[PATCH] iommu/exynos: Make driver independent of the system page size

2022-06-23 Thread Marek Szyprowski
PAGE_{SIZE,SHIFT} macros depend on the configured kernel's page size, but the driver expects values calculated as for 4KB pages. Fix this. Reported-by: Robin Murphy Signed-off-by: Marek Szyprowski --- Untested, because Exynos based boards I have doesn't boot with non-4KB page size

Re: [RFC 2/3] iommu/samsung: Introduce Exynos sysmmu-v8 driver

2022-06-22 Thread Marek Szyprowski
On 22.06.2022 11:14, Robin Murphy wrote: > On 2022-06-21 20:57, Sam Protsenko wrote: >> Hi Marek, >> >> On Fri, 21 Jan 2022 at 14:31, Marek Szyprowski >> wrote: >> >> [snip] >> >>> >>> Well, for starting point the existing exynos-

Re: [PATCH V2 2/6] iommu: iova: properly handle 0 as a valid IOVA address

2022-06-17 Thread Marek Szyprowski
Hi Robin, On 06.06.2022 14:38, Robin Murphy wrote: > On 2022-06-02 16:58, Marek Szyprowski wrote: >> On 23.05.2022 19:30, Robin Murphy wrote: >>> On 2022-05-11 13:15, Ajay Kumar wrote: >>>> From: Marek Szyprowski >>>> >>>> Zero is a valid

Re: [PATCH V2 2/6] iommu: iova: properly handle 0 as a valid IOVA address

2022-06-02 Thread Marek Szyprowski
Hi Robin, On 23.05.2022 19:30, Robin Murphy wrote: > On 2022-05-11 13:15, Ajay Kumar wrote: >> From: Marek Szyprowski >> >> Zero is a valid DMA and IOVA address on many architectures, so adjust >> the >> IOVA management code to properly handle it. A new

Re: [PATCH 00/13] iommu: Retire bus_set_iommu()

2022-04-14 Thread Marek Szyprowski
functionally) on my device_iommu_capable() patches > here: > > https://lore.kernel.org/linux-iommu/cover.1649089693.git.robin.mur...@arm.com/ > > since those are pretty much good to go now (I'll send a slightly-tweaked > final version once the iommu/core branch is open). Work

Re: [RFC 2/3] iommu/samsung: Introduce Exynos sysmmu-v8 driver

2022-01-21 Thread Marek Szyprowski
ces between SYSMMU v5 (already supported by the exynos-iommu driver) and v7 are just a matter of changing a one register during the initialization and different bits the page fault reason decoding. You must of course rely on the DMA-mapping framework and its imple

Re: [PATCH 11/11] dma-direct: add a dma_direct_use_pool helper

2021-12-08 Thread Marek Szyprowski
ma_direct_alloc_pages(struct device *dev, > size_t size, > struct page *page; > void *ret; > > - if (force_dma_unencrypted(dev) && !gfpflags_allow_blocking(gfp) && > - !is_swiotlb_for_alloc(dev)) > + if (force_dma_un

Re: [PATCH] iommu/dma: Tidy up Kconfig selects

2021-09-28 Thread Marek Szyprowski
s something for the future :) Maybe it would be a good motivation to get back to https://lore.kernel.org/linux-iommu/cover.1597931875.git.robin.mur...@arm.com/ :) Best regards -- Marek Szyprowski, PhD Samsung R&D Institute Poland ___ iommu mailing

Re: [PATCH v4] iommu/of: Fix pci_request_acs() before enumerating PCI devices

2021-09-01 Thread Marek Szyprowski
d */ > + if (of_property_read_bool(node, "iommu-map")) > + pci_request_acs(); > + > bridge->swizzle_irq = pci_common_swizzle; > bridge->map_irq = of_irq_parse_and_map_pci; > Best regards -- Marek Szyprowski, PhD Samsung R&D Institute Poland ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

Re: [PATCH v3 05/25] iommu/exynos: Drop IOVA cookie management

2021-08-05 Thread Marek Szyprowski
On 04.08.2021 19:15, Robin Murphy wrote: > The core code bakes its own cookies now. > > CC: Marek Szyprowski > Signed-off-by: Robin Murphy Acked-by: Marek Szyprowski Tested-by: Marek Szyprowski > --- > > v3: Also remove unneeded include > --- > driver

Re: [PATCH v3 01/25] iommu: Pull IOVA cookie management into the core

2021-08-05 Thread Marek Szyprowski
On 04.08.2021 19:15, Robin Murphy wrote: > Now that everyone has converged on iommu-dma for IOMMU_DOMAIN_DMA > support, we can abandon the notion of drivers being responsible for the > cookie type, and consolidate all the management into the core code. > > CC: Marek Szyprowski

Re: [PATCH] iommu: qcom: Revert "iommu/arm: Cleanup resources in case of probe error path"

2021-07-05 Thread Marek Szyprowski
On 05.07.2021 16:30, Amey Narkhede wrote: > On 21/07/05 08:56AM, Marek Szyprowski wrote: >> QCOM IOMMU driver calls bus_set_iommu() for every IOMMU device controller, >> what fails for the second and latter IOMMU devices. This is intended and >> must be not fatal to the driver

[PATCH] iommu: qcom: Revert "iommu/arm: Cleanup resources in case of probe error path"

2021-07-04 Thread Marek Szyprowski
patch. Revert relevant changes to the QCOM IOMMU driver until a proper fix is prepared. This partially reverts commit 249c9dc6aa0db74a0f7908efd04acf774e19b155. Fixes: 249c9dc6aa0d ("iommu/arm: Cleanup resources in case of probe error path") Suggested-by: Will Deacon Signed-off-by: Marek

Re: [PATCH] iommu/arm: Cleanup resources in case of probe error path

2021-07-01 Thread Marek Szyprowski
On 01.07.2021 11:11, Robin Murphy wrote: > On 2021-07-01 10:01, Will Deacon wrote: >> On Thu, Jul 01, 2021 at 10:29:29AM +0200, Marek Szyprowski wrote: >>> Hi Robin, >>> >>> On 30.06.2021 16:01, Robin Murphy wrote: >>>> On 2021-06-30 14:48, Marek S

Re: [PATCH] iommu/arm: Cleanup resources in case of probe error path

2021-07-01 Thread Marek Szyprowski
Hi Robin, On 30.06.2021 16:01, Robin Murphy wrote: > On 2021-06-30 14:48, Marek Szyprowski wrote: >> On 30.06.2021 14:59, Will Deacon wrote: >>> On Wed, Jun 30, 2021 at 02:48:15PM +0200, Marek Szyprowski wrote: >>>> On 08.06.2021 18:45, Amey Narkhede wrote: >

Re: [PATCH] iommu/arm: Cleanup resources in case of probe error path

2021-06-30 Thread Marek Szyprowski
On 30.06.2021 14:59, Will Deacon wrote: > On Wed, Jun 30, 2021 at 02:48:15PM +0200, Marek Szyprowski wrote: >> On 08.06.2021 18:45, Amey Narkhede wrote: >>> If device registration fails, remove sysfs attribute >>> and if setting bus callbacks fails, unregister the devic

Re: [PATCH] iommu/arm: Cleanup resources in case of probe error path

2021-06-30 Thread Marek Szyprowski
err_unregister_device; > > if (qcom_iommu->local_base) { > pm_runtime_get_sync(dev); > @@ -862,6 +864,13 @@ static int qcom_iommu_device_probe(struct > platform_device *pdev) > } > > return 0; > + > +err_unregister_device: > + iommu_device_unregister(&qcom_iommu->iommu); > + > +err_sysfs_remove: > + iommu_device_sysfs_remove(&qcom_iommu->iommu); > + return ret; > } > > static int qcom_iommu_device_remove(struct platform_device *pdev) > -- > 2.31.1 > Best regards -- Marek Szyprowski, PhD Samsung R&D Institute Poland ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

Re: [PATCH rdma-next v1 1/2] lib/scatterlist: Fix wrong update of orig_nents

2021-06-30 Thread Marek Szyprowski
!new_sg) > return ERR_PTR(-ENOMEM); > sg_init_table(new_sg, alloc_size); > + table->total_nents += alloc_size; > if (cur) { > __sg_chain(next_sg, new_sg); > - table->orig_nents += alloc_size - 1; > } else { >

Re: [PATCH v3 3/9] iommu/arm-smmu: Implement ->probe_finalize()

2021-06-15 Thread Marek Szyprowski
m-smmu.h > +++ b/drivers/iommu/arm/arm-smmu/arm-smmu.h > @@ -439,6 +439,7 @@ struct arm_smmu_impl { > struct device *dev, int start); > void (*write_s2cr)(struct arm_smmu_device *smmu, int idx); > void (*write_sctlr)(struct arm_smmu_device

Re: [PATCH 1/1] dma: coherent: check no-map property for arm64

2021-06-15 Thread Marek Szyprowski
s causes 2 issues. First - one would need to split 2M entry into 4K entries. Second - 2M section mappings for the whole lowmem area are located in the per-process page tables. Changing the cache attributes would require locking all processes and iterating over their page

Re: [PATCH] iommu: exynos: remove unneeded local variable initialization

2021-04-09 Thread Marek Szyprowski
On 08.04.2021 22:16, Krzysztof Kozlowski wrote: > The initialization of 'fault_addr' local variable is not needed as it is > shortly after overwritten. > > Addresses-Coverity: Unused value > Signed-off-by: Krzysztof Kozlowski Acked-by: Marek Szyprowski > --- >

Re: [PATCH v2 5/6] media: uvcvideo: Use dma_alloc_noncontiguos API

2020-11-25 Thread Marek Szyprowski
> -#endif > - if (!uvc_urb->buffer) { > + if (!uvc_alloc_urb_buffer(stream, uvc_urb, gfp_flags)) { > uvc_free_urb_buffers(stream); > break; > } > diff --git a/drivers/media/usb/uvc/uvcvideo.h > b/drivers/media/usb/uvc/uvcvideo.h > index a3dfacf069c4..3e6618a2ac82 100644 > --- a/drivers/media/usb/uvc/uvcvideo.h > +++ b/drivers/media/usb/uvc/uvcvideo.h > @@ -532,6 +532,8 @@ struct uvc_urb { > > char *buffer; > dma_addr_t dma; > + struct page **pages; > + struct sg_table sgt; > > unsigned int async_operations; > struct uvc_copy_op copy_operations[UVC_MAX_PACKETS]; Best regards -- Marek Szyprowski, PhD Samsung R&D Institute Poland ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

Re: [PATCH] iommu: Clarify .of_xlate assumptions

2020-10-30 Thread Marek Szyprowski
d-off-by: Robin Murphy > --- > drivers/iommu/arm/arm-smmu/qcom_iommu.c | 7 --- > drivers/iommu/exynos-iommu.c| 15 ++- Acked-by: Marek Szyprowski > drivers/iommu/ipmmu-vmsa.c | 13 ++--- > drivers/iommu/mtk_iommu.c | 8

Re: [Linaro-mm-sig] [PATCH v5 05/38] drm: prime: use sgtable iterators in drm_prime_sg_to_page_addr_arrays()

2020-09-30 Thread Marek Szyprowski
Hi All, On 25.09.2020 23:23, Alex Deucher wrote: > On Tue, Sep 22, 2020 at 2:28 AM Marek Szyprowski > wrote: >> On 22.09.2020 01:15, Alex Goins wrote: >>> Tested-by: Alex Goins >>> >>> This change fixes a regression with drm_prime_sg_to_page_addr_arrays(

Re: [PATCH 05/18] ARM/dma-mapping: Switch to iommu_dma_ops

2020-09-28 Thread Marek Szyprowski
27; using the   * specified gfp mask.  Note that 'size' must be page aligned. I also wonder if it would be better to use per-arch __dma_clear_buffer() instead of setting __GFP_ZERO unconditionally in dma-iommu.c. This should be faster on ARM with highmem... > ... Best

Re: IOVA allocation dependency between firmware buffer and remaining buffers

2020-09-27 Thread Marek Szyprowski
Hi Robin, On 24.09.2020 13:06, Robin Murphy wrote: > On 2020-09-24 11:47, Marek Szyprowski wrote: >> On 24.09.2020 12:40, Robin Murphy wrote: >>> On 2020-09-24 11:16, Thierry Reding wrote: >>>> On Thu, Sep 24, 2020 at 10:46:46AM +0200, Marek Szyprowski wrote: &g

[PATCH 7/8] media: platform: exynos4-is: use DMA_ATTR_LOW_ADDRESS

2020-09-25 Thread Marek Szyprowski
soon, so add the needed DMA attribute to force such behavior of the DMA-mapping code. Signed-off-by: Marek Szyprowski --- drivers/media/platform/exynos4-is/fimc-is.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/exynos4-is/fimc-is.c b/drivers

[PATCH 4/8] iommu: dma-iommu: refactor iommu_dma_alloc_iova()

2020-09-25 Thread Marek Szyprowski
list, move struct device to the second position to better match the convention of the DMA-mapping related functions. Signed-off-by: Marek Szyprowski --- drivers/iommu/dma-iommu.c | 23 +-- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/drivers/iommu/dma

[PATCH 5/8] iommu: dma-iommu: add support for DMA_ATTR_LOW_ADDRESS

2020-09-25 Thread Marek Szyprowski
Implement support for the DMA_ATTR_LOW_ADDRESS DMA attribute. If it has been set, call alloc_iova_first_fit() instead of the alloc_iova_fast() to allocate the new IOVA from the beginning of the address space. Signed-off-by: Marek Szyprowski --- drivers/iommu/dma-iommu.c | 50

[PATCH 6/8] media: platform: exynos4-is: remove all references to physicall addresses

2020-09-25 Thread Marek Szyprowski
This driver always operates on the DMA/IOVA addresses, so calling them physicall addresses is misleading, although when no IOMMU is used they equal each other. Fix this by renaming all such entries to 'addr' and adjusting comments. Signed-off-by: Marek Szyprowski --- .../media/platfo

[PATCH 8/8] media: platform: s5p-mfc: use DMA_ATTR_LOW_ADDRESS

2020-09-25 Thread Marek Szyprowski
soon, so limit the dma_mask to size of the DMA window the hardware can use and add the needed DMA attribute to force proper IOVA allocation of the firmware buffer. Signed-off-by: Marek Szyprowski --- drivers/media/platform/s5p-mfc/s5p_mfc.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions

[PATCH 2/8] iommu: iova: properly handle 0 as a valid IOVA address

2020-09-25 Thread Marek Szyprowski
: Marek Szyprowski --- drivers/iommu/dma-iommu.c | 18 ++ drivers/iommu/intel/iommu.c | 12 ++-- drivers/iommu/iova.c| 10 ++ include/linux/iova.h| 2 ++ 4 files changed, 24 insertions(+), 18 deletions(-) diff --git a/drivers/iommu/dma-iommu.c b

[PATCH 1/8] dma-mapping: add DMA_ATTR_LOW_ADDRESS attribute

2020-09-25 Thread Marek Szyprowski
be easily fulfilled, simply by enforcing the 'first-fit' IOVA allocation algorithm. This patch adds a DMA attribute for such case. Signed-off-by: Marek Szyprowski --- include/linux/dma-mapping.h | 6 ++ 1 file changed, 6 insertions(+) diff --git a/include/linux/dma-mapping.h

[PATCH 3/8] iommu: iova: add support for 'first-fit' algorithm

2020-09-25 Thread Marek Szyprowski
Add support for the 'first-fit' allocation algorithm. It will be used for the special case of implementing DMA_ATTR_LOW_ADDRESS, so this path doesn't use IOVA cache. Signed-off-by: Marek Szyprowski --- drivers/iommu/iova.c | 78 inclu

[PATCH 0/8] IOMMU-DMA - support old allocation algorithm used on ARM

2020-09-25 Thread Marek Szyprowski
ow-address Best regards, Marek Szyprowski References: [1] https://lore.kernel.org/lkml/cover.1597931875.git.robin.mur...@arm.com/ [2] https://lore.kernel.org/linux-iommu/bff57cbe-2247-05e1-9059-d9c66d64c...@arm.com/ [3] https://lore.kernel.org/linux-samsung-soc/20200918144833.14618-1

Re: IOVA allocation dependency between firmware buffer and remaining buffers

2020-09-24 Thread Marek Szyprowski
Hi Robin, On 24.09.2020 12:40, Robin Murphy wrote: > On 2020-09-24 11:16, Thierry Reding wrote: >> On Thu, Sep 24, 2020 at 10:46:46AM +0200, Marek Szyprowski wrote: >>> On 24.09.2020 10:28, Joerg Roedel wrote: >>>> On Wed, Sep 23, 2020 at 08:48:26AM +0200, Marek Szy

Re: IOVA allocation dependency between firmware buffer and remaining buffers

2020-09-24 Thread Marek Szyprowski
Hi Thierry, On 24.09.2020 12:16, Thierry Reding wrote: > On Thu, Sep 24, 2020 at 10:46:46AM +0200, Marek Szyprowski wrote: >> On 24.09.2020 10:28, Joerg Roedel wrote: >>> On Wed, Sep 23, 2020 at 08:48:26AM +0200, Marek Szyprowski wrote: >>>> It allows to remap giv

Re: IOVA allocation dependency between firmware buffer and remaining buffers

2020-09-24 Thread Marek Szyprowski
Hi Joerg, On 24.09.2020 10:28, Joerg Roedel wrote: > On Wed, Sep 23, 2020 at 08:48:26AM +0200, Marek Szyprowski wrote: >> It allows to remap given buffer at the specific IOVA address, although >> it doesn't guarantee that those specific addresses won't be later used

Re: IOVA allocation dependency between firmware buffer and remaining buffers

2020-09-22 Thread Marek Szyprowski
IOVA address, although it doesn't guarantee that those specific addresses won't be later used by the IOVA allocator. Probably it would make sense to add an API for generic IOMMU-DMA framework to mark the given IOVA range as reserved/unused to protect them. Best regards Marek Szyprows

Re: [PATCH v5 05/38] drm: prime: use sgtable iterators in drm_prime_sg_to_page_addr_arrays()

2020-09-21 Thread Marek Szyprowski
nflict in the -next. Do you have any AMDGPU fixes for v5.9 in the queue? Maybe you can add that patch to the queue? Dave: would it be okay that way? Best regards -- Marek Szyprowski, PhD Samsung R&D Institute Poland ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

Re: [PATCH] iommu/exynos: add missing put_device() call in exynos_iommu_of_xlate()

2020-09-18 Thread Marek Szyprowski
/exynos: Add callback for initializing devices > from device tree") > Signed-off-by: Yu Kuai Thanks for the fix! Acked-by: Marek Szyprowski > --- > drivers/iommu/exynos-iommu.c | 8 ++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/drivers/

Re: [PATCH 00/18] Convert arch/arm to use iommu-dma

2020-09-18 Thread Marek Szyprowski
Hi all, On 24.08.2020 13:40, Marek Szyprowski wrote: > On 20.08.2020 17:08, Robin Murphy wrote: >> After 5 years or so of intending to get round to this, finally the >> time comes! The changes themselves actualy turn out to be relatively >> mechanical; the bigger concern app

Re: [PATCH 14/18] drm/exynos: Consolidate IOMMU mapping code

2020-09-18 Thread Marek Szyprowski
ruct device *dev, struct > device *master, > struct exynos_drm_ipp *ipp = &scaler->ipp; > > exynos_drm_ipp_unregister(dev, ipp); > - exynos_drm_unregister_dma(scaler->drm_dev, scaler->dev, > - &scaler->dma_priv); > + exynos_drm_unregister_dma(scaler->drm_dev, scaler->dev); > } > > static const struct component_ops scaler_component_ops = { > diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c > b/drivers/gpu/drm/exynos/exynos_mixer.c > index af192e5a16ef..18972e605c5d 100644 > --- a/drivers/gpu/drm/exynos/exynos_mixer.c > +++ b/drivers/gpu/drm/exynos/exynos_mixer.c > @@ -94,7 +94,6 @@ struct mixer_context { > struct platform_device *pdev; > struct device *dev; > struct drm_device *drm_dev; > - void*dma_priv; > struct exynos_drm_crtc *crtc; > struct exynos_drm_plane planes[MIXER_WIN_NR]; > unsigned long flags; > @@ -895,14 +894,12 @@ static int mixer_initialize(struct mixer_context > *mixer_ctx, > } > } > > - return exynos_drm_register_dma(drm_dev, mixer_ctx->dev, > -&mixer_ctx->dma_priv); > + return exynos_drm_register_dma(drm_dev, mixer_ctx->dev); > } > > static void mixer_ctx_remove(struct mixer_context *mixer_ctx) > { > - exynos_drm_unregister_dma(mixer_ctx->drm_dev, mixer_ctx->dev, > - &mixer_ctx->dma_priv); > + exynos_drm_unregister_dma(mixer_ctx->drm_dev, mixer_ctx->dev); > } > > static int mixer_enable_vblank(struct exynos_drm_crtc *crtc) Best regards -- Marek Szyprowski, PhD Samsung R&D Institute Poland ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

Re: [PATCH v10 30/30] videobuf2: use sgtable-based scatterlist wrappers

2020-09-07 Thread Marek Szyprowski
Hi Tomasz, On 07.09.2020 15:07, Tomasz Figa wrote: > On Fri, Sep 4, 2020 at 3:35 PM Marek Szyprowski > wrote: >> Use recently introduced common wrappers operating directly on the struct >> sg_table objects and scatterlist page iterators to make the code a bit >> more co

[PATCH v10 09/30] drm: lima: fix common struct sg_table related issues

2020-09-04 Thread Marek Szyprowski
common dma-mapping wrappers operating directly on the struct sg_table objects and use scatterlist page iterators where possible. This, almost always, hides references to the nents and orig_nents entries, making the code robust, easier to follow and copy/paste safe. Signed-off-by: Marek Szyprowski

[PATCH v10 06/30] drm: exynos: use common helper for a scatterlist contiguity check

2020-09-04 Thread Marek Szyprowski
Use common helper for checking the contiguity of the imported dma-buf. Signed-off-by: Marek Szyprowski Reviewed-by: Andrzej Hajda Acked-by : Inki Dae --- drivers/gpu/drm/exynos/exynos_drm_gem.c | 23 +++ 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a

[PATCH v10 07/30] drm: exynos: fix common struct sg_table related issues

2020-09-04 Thread Marek Szyprowski
common dma-mapping wrappers operating directly on the struct sg_table objects and use scatterlist page iterators where possible. This, almost always, hides references to the nents and orig_nents entries, making the code robust, easier to follow and copy/paste safe. Signed-off-by: Marek Szyprowski

[PATCH v10 30/30] videobuf2: use sgtable-based scatterlist wrappers

2020-09-04 Thread Marek Szyprowski
. Signed-off-by: Marek Szyprowski Reviewed-by: Robin Murphy --- .../common/videobuf2/videobuf2-dma-contig.c | 34 --- .../media/common/videobuf2/videobuf2-dma-sg.c | 32 +++-- .../common/videobuf2/videobuf2-vmalloc.c | 12 +++ 3 files changed, 31 insertions

[PATCH v10 26/30] staging: tegra-vde: fix common struct sg_table related issues

2020-09-04 Thread Marek Szyprowski
common dma-mapping wrappers operating directly on the struct sg_table objects and use scatterlist page iterators where possible. This, almost always, hides references to the nents and orig_nents entries, making the code robust, easier to follow and copy/paste safe. Signed-off-by: Marek Szyprowski

[PATCH v10 20/30] drm: vmwgfx: fix common struct sg_table related issues

2020-09-04 Thread Marek Szyprowski
common dma-mapping wrappers operating directly on the struct sg_table objects and use scatterlist page iterators where possible. This, almost always, hides references to the nents and orig_nents entries, making the code robust, easier to follow and copy/paste safe. Signed-off-by: Marek Szyprowski

[PATCH v10 15/30] drm: rockchip: use common helper for a scatterlist contiguity check

2020-09-04 Thread Marek Szyprowski
Use common helper for checking the contiguity of the imported dma-buf. Signed-off-by: Marek Szyprowski Reviewed-by: Robin Murphy --- drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 19 +-- 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/drivers/gpu/drm/rockchip

[PATCH v10 22/30] xen: gntdev: fix common struct sg_table related issues

2020-09-04 Thread Marek Szyprowski
common dma-mapping wrappers operating directly on the struct sg_table objects and use scatterlist page iterators where possible. This, almost always, hides references to the nents and orig_nents entries, making the code robust, easier to follow and copy/paste safe. Signed-off-by: Marek Szyprowski

[PATCH v10 05/30] drm: etnaviv: fix common struct sg_table related issues

2020-09-04 Thread Marek Szyprowski
common dma-mapping wrappers operating directly on the struct sg_table objects and use scatterlist page iterators where possible. This, almost always, hides references to the nents and orig_nents entries, making the code robust, easier to follow and copy/paste safe. Signed-off-by: Marek Szyprowski

[PATCH v10 19/30] drm: virtio: fix common struct sg_table related issues

2020-09-04 Thread Marek Szyprowski
common dma-mapping wrappers operating directly on the struct sg_table objects and use scatterlist page iterators where possible. This, almost always, hides references to the nents and orig_nents entries, making the code robust, easier to follow and copy/paste safe. Signed-off-by: Marek Szyprowski

[PATCH v10 18/30] drm: v3d: fix common struct sg_table related issues

2020-09-04 Thread Marek Szyprowski
common dma-mapping wrappers operating directly on the struct sg_table objects and use scatterlist page iterators where possible. This, almost always, hides references to the nents and orig_nents entries, making the code robust, easier to follow and copy/paste safe. Signed-off-by: Marek Szyprowski

[PATCH v10 10/30] drm: mediatek: use common helper for a scatterlist contiguity check

2020-09-04 Thread Marek Szyprowski
Use common helper for checking the contiguity of the imported dma-buf and do this check before allocating resources, so the error path is simpler. Signed-off-by: Marek Szyprowski Reviewed-by: Robin Murphy Acked-by: Chun-Kuang Hu --- drivers/gpu/drm/mediatek/mtk_drm_gem.c | 28

[PATCH v10 12/30] drm: msm: fix common struct sg_table related issues

2020-09-04 Thread Marek Szyprowski
common dma-mapping wrappers operating directly on the struct sg_table objects and use scatterlist page iterators where possible. This, almost always, hides references to the nents and orig_nents entries, making the code robust, easier to follow and copy/paste safe. Signed-off-by: Marek Szyprowski

[PATCH v10 29/30] media: pci: fix common ALSA DMA-mapping related codes

2020-09-04 Thread Marek Szyprowski
nts in turn holds the result of the dma_map_sg call as stated in include/linux/scatterlist.h. Adapt the code to obey those rules. While touching this code, update it to use the modern DMA_FROM_DEVICE definitions. Signed-off-by: Marek Szyprowski --- drivers/media/pci/cx23885/cx23885-alsa.c

[PATCH v10 25/30] dmabuf: fix common struct sg_table related issues

2020-09-04 Thread Marek Szyprowski
common dma-mapping wrappers operating directly on the struct sg_table objects and use scatterlist page iterators where possible. This, almost always, hides references to the nents and orig_nents entries, making the code robust, easier to follow and copy/paste safe. Signed-off-by: Marek Szyprowski

[PATCH v10 03/30] drm: core: fix common struct sg_table related issues

2020-09-04 Thread Marek Szyprowski
common dma-mapping wrappers operating directly on the struct sg_table objects and use scatterlist page iterators where possible. This, almost always, hides references to the nents and orig_nents entries, making the code robust, easier to follow and copy/paste safe. Signed-off-by: Marek Szyprowski

[PATCH v10 28/30] samples: vfio-mdev/mbochs: fix common struct sg_table related issues

2020-09-04 Thread Marek Szyprowski
add missing call to dma_unmap_sgtable. Signed-off-by: Marek Szyprowski Reviewed-by: Robin Murphy --- samples/vfio-mdev/mbochs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/samples/vfio-mdev/mbochs.c b/samples/vfio-mdev/mbochs.c index 3cc5e5921682..e03068917273 100644

[PATCH v10 27/30] rapidio: fix common struct sg_table related issues

2020-09-04 Thread Marek Szyprowski
common dma-mapping wrappers operating directly on the struct sg_table objects and use scatterlist page iterators where possible. This, almost always, hides references to the nents and orig_nents entries, making the code robust, easier to follow and copy/paste safe. Signed-off-by: Marek Szyprowski

[PATCH v10 00/30] DRM: fix struct sg_table nents vs. orig_nents misuse

2020-09-04 Thread Marek Szyprowski
le I would like ask for merging most of the patches via DRM tree. Best regards, Marek Szyprowski References: [1] https://lkml.org/lkml/2020/3/27/555 [2] https://lkml.org/lkml/2020/3/29/65 [3] Documentation/DMA-API-HOWTO.txt [4] https://lore.kernel.org/linux-iommu/20200512121931.gd20...@lst.

[PATCH v10 13/30] drm: omapdrm: use common helper for extracting pages array

2020-09-04 Thread Marek Szyprowski
Use common helper for converting a sg_table object into struct page pointer array. Signed-off-by: Marek Szyprowski Reviewed-by: Robin Murphy --- drivers/gpu/drm/omapdrm/omap_gem.c | 14 -- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/omapdrm

[PATCH v10 17/30] drm: tegra: fix common struct sg_table related issues

2020-09-04 Thread Marek Szyprowski
common dma-mapping wrappers operating directly on the struct sg_table objects and use scatterlist page iterators where possible. This, almost always, hides references to the nents and orig_nents entries, making the code robust, easier to follow and copy/paste safe. Signed-off-by: Marek Szyprowski

[PATCH v10 08/30] drm: i915: fix common struct sg_table related issues

2020-09-04 Thread Marek Szyprowski
rectly on the struct sg_table objects to the dmabuf related functions, so the other drivers, which might share buffers with i915 could rely on the properly set nents and orig_nents values. Signed-off-by: Marek Szyprowski Reviewed-by: Robin Murphy Reviewed-by: Michael J. Ruhl --- drivers/gpu/dr

[PATCH v10 24/30] drm: rcar-du: fix common struct sg_table related issues

2020-09-04 Thread Marek Szyprowski
returns zero or an error code, so adjust the return value check for the vsp1_du_map_sg() function. Signed-off-by: Marek Szyprowski Reviewed-by: Laurent Pinchart --- drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 3 +-- drivers/media/platform/vsp1/vsp1_drm.c | 8 2 files changed, 5 insertions(+), 6

[PATCH v10 23/30] drm: host1x: fix common struct sg_table related issues

2020-09-04 Thread Marek Szyprowski
common dma-mapping wrappers operating directly on the struct sg_table objects and use scatterlist page iterators where possible. This, almost always, hides references to the nents and orig_nents entries, making the code robust, easier to follow and copy/paste safe. Signed-off-by: Marek Szyprowski

[PATCH v10 16/30] drm: rockchip: fix common struct sg_table related issues

2020-09-04 Thread Marek Szyprowski
common dma-mapping wrappers operating directly on the struct sg_table objects and use scatterlist page iterators where possible. This, almost always, hides references to the nents and orig_nents entries, making the code robust, easier to follow and copy/paste safe. Signed-off-by: Marek Szyprowski

[PATCH v10 11/30] drm: mediatek: use common helper for extracting pages array

2020-09-04 Thread Marek Szyprowski
Use common helper for converting a sg_table object into struct page pointer array. Signed-off-by: Marek Szyprowski Reviewed-by: Robin Murphy Acked-by: Chun-Kuang Hu --- drivers/gpu/drm/mediatek/mtk_drm_gem.c | 9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers

[PATCH v10 21/30] drm: xen: fix common struct sg_table related issues

2020-09-04 Thread Marek Szyprowski
nents or orig_nents entries. This driver reports the number of the pages in the imported scatterlist, so it should refer to sg_table->orig_nents entry. Signed-off-by: Marek Szyprowski Acked-by: Oleksandr Andrushchenko --- drivers/gpu/drm/xen/xen_drm_front_gem.c | 2 +- 1 file changed, 1 insert

[PATCH v10 04/30] drm: armada: fix common struct sg_table related issues

2020-09-04 Thread Marek Szyprowski
common dma-mapping wrappers operating directly on the struct sg_table objects and use scatterlist page iterators where possible. This, almost always, hides references to the nents and orig_nents entries, making the code robust, easier to follow and copy/paste safe. Signed-off-by: Marek Szyprowski

[PATCH v10 14/30] drm: panfrost: fix common struct sg_table related issues

2020-09-04 Thread Marek Szyprowski
common dma-mapping wrappers operating directly on the struct sg_table objects and use scatterlist page iterators where possible. This, almost always, hides references to the nents and orig_nents entries, making the code robust, easier to follow and copy/paste safe. Signed-off-by: Marek Szyprowski

[PATCH v10 01/30] drm: prime: add common helper to check scatterlist contiguity

2020-09-04 Thread Marek Szyprowski
It is a common operation done by DRM drivers to check the contiguity of the DMA-mapped buffer described by a scatterlist in the sg_table object. Let's add a common helper for this operation. Signed-off-by: Marek Szyprowski Reviewed-by: Andrzej Hajda Reviewed-by: Robin Murphy --- driver

[PATCH v10 02/30] drm: prime: use sgtable iterators in drm_prime_sg_to_page_addr_arrays()

2020-09-04 Thread Marek Szyprowski
describing the old code is no longer needed. Signed-off-by: Marek Szyprowski Reviewed-by: Andrzej Hajda Reviewed-by: Robin Murphy --- drivers/gpu/drm/drm_prime.c | 49 - 1 file changed, 15 insertions(+), 34 deletions(-) diff --git a/drivers/gpu/drm/drm_prime.c b

Re: [PATCH v9 14/32] drm: omapdrm: fix common struct sg_table related issues

2020-09-04 Thread Marek Szyprowski
Hi again, On 04.09.2020 14:06, Marek Szyprowski wrote: > Hi Tomi, > > On 02.09.2020 10:00, Tomi Valkeinen wrote: >> On 01/09/2020 22:33, Robin Murphy wrote: >>> On 2020-08-26 07:32, Marek Szyprowski wrote: >>>> The Documentation/DMA-API-HOWTO.txt states

Re: [PATCH v9 14/32] drm: omapdrm: fix common struct sg_table related issues

2020-09-04 Thread Marek Szyprowski
Hi Tomi, On 02.09.2020 10:00, Tomi Valkeinen wrote: > On 01/09/2020 22:33, Robin Murphy wrote: >> On 2020-08-26 07:32, Marek Szyprowski wrote: >>> The Documentation/DMA-API-HOWTO.txt states that the dma_map_sg() function >>> returns the number of the created entri

[PATCH v9 31/32] media: pci: fix common ALSA DMA-mapping related codes

2020-08-25 Thread Marek Szyprowski
nts in turn holds the result of the dma_map_sg call as stated in include/linux/scatterlist.h. Adapt the code to obey those rules. Signed-off-by: Marek Szyprowski --- drivers/media/pci/cx23885/cx23885-alsa.c | 2 +- drivers/media/pci/cx25821/cx25821-alsa.c | 2 +- drivers/media/pci/cx88/cx88-als

[PATCH v9 28/32] misc: fastrpc: fix common struct sg_table related issues

2020-08-25 Thread Marek Szyprowski
common dma-mapping wrappers operating directly on the struct sg_table objects and use scatterlist page iterators where possible. This, almost always, hides references to the nents and orig_nents entries, making the code robust, easier to follow and copy/paste safe. Signed-off-by: Marek Szyprowski

[PATCH v9 32/32] videobuf2: use sgtable-based scatterlist wrappers

2020-08-25 Thread Marek Szyprowski
. Signed-off-by: Marek Szyprowski --- .../common/videobuf2/videobuf2-dma-contig.c | 34 --- .../media/common/videobuf2/videobuf2-dma-sg.c | 32 +++-- .../common/videobuf2/videobuf2-vmalloc.c | 12 +++ 3 files changed, 31 insertions(+), 47 deletions(-) diff

[PATCH v9 17/32] drm: rockchip: fix common struct sg_table related issues

2020-08-25 Thread Marek Szyprowski
common dma-mapping wrappers operating directly on the struct sg_table objects and use scatterlist page iterators where possible. This, almost always, hides references to the nents and orig_nents entries, making the code robust, easier to follow and copy/paste safe. Signed-off-by: Marek Szyprowski

[PATCH v9 23/32] xen: gntdev: fix common struct sg_table related issues

2020-08-25 Thread Marek Szyprowski
common dma-mapping wrappers operating directly on the struct sg_table objects and use scatterlist page iterators where possible. This, almost always, hides references to the nents and orig_nents entries, making the code robust, easier to follow and copy/paste safe. Signed-off-by: Marek Szyprowski

[PATCH v9 03/32] drm: core: fix common struct sg_table related issues

2020-08-25 Thread Marek Szyprowski
common dma-mapping wrappers operating directly on the struct sg_table objects and use scatterlist page iterators where possible. This, almost always, hides references to the nents and orig_nents entries, making the code robust, easier to follow and copy/paste safe. Signed-off-by: Marek Szyprowski

[PATCH v9 30/32] samples: vfio-mdev/mbochs: fix common struct sg_table related issues

2020-08-25 Thread Marek Szyprowski
add missing call to dma_unmap_sgtable. Signed-off-by: Marek Szyprowski --- samples/vfio-mdev/mbochs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/samples/vfio-mdev/mbochs.c b/samples/vfio-mdev/mbochs.c index 3cc5e5921682..e03068917273 100644 --- a/samples/vfio-mdev

[PATCH v9 27/32] staging: tegra-vde: fix common struct sg_table related issues

2020-08-25 Thread Marek Szyprowski
common dma-mapping wrappers operating directly on the struct sg_table objects and use scatterlist page iterators where possible. This, almost always, hides references to the nents and orig_nents entries, making the code robust, easier to follow and copy/paste safe. Signed-off-by: Marek Szyprowski

[PATCH v9 24/32] drm: host1x: fix common struct sg_table related issues

2020-08-25 Thread Marek Szyprowski
common dma-mapping wrappers operating directly on the struct sg_table objects and use scatterlist page iterators where possible. This, almost always, hides references to the nents and orig_nents entries, making the code robust, easier to follow and copy/paste safe. Signed-off-by: Marek Szyprowski

[PATCH v9 25/32] drm: rcar-du: fix common struct sg_table related issues

2020-08-25 Thread Marek Szyprowski
returns zero or an error code, so adjust the return value check for the vsp1_du_map_sg() function. Signed-off-by: Marek Szyprowski Reviewed-by: Laurent Pinchart --- drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 3 +-- drivers/media/platform/vsp1/vsp1_drm.c | 8 2 files changed, 5 insertions(+), 6

[PATCH v9 00/32] DRM: fix struct sg_table nents vs. orig_nents misuse

2020-08-25 Thread Marek Szyprowski
ike ask for merging of the 1-27 patches via DRM misc tree. Best regards, Marek Szyprowski References: [1] https://lkml.org/lkml/2020/3/27/555 [2] https://lkml.org/lkml/2020/3/29/65 [3] Documentation/DMA-API-HOWTO.txt [4] https://lore.kernel.org/linux-iommu/20200512121931.gd20...@lst.de/T/#ma18c958a

[PATCH v9 21/32] drm: vmwgfx: fix common struct sg_table related issues

2020-08-25 Thread Marek Szyprowski
common dma-mapping wrappers operating directly on the struct sg_table objects and use scatterlist page iterators where possible. This, almost always, hides references to the nents and orig_nents entries, making the code robust, easier to follow and copy/paste safe. Signed-off-by: Marek Szyprowski

[PATCH v9 19/32] drm: v3d: fix common struct sg_table related issues

2020-08-25 Thread Marek Szyprowski
common dma-mapping wrappers operating directly on the struct sg_table objects and use scatterlist page iterators where possible. This, almost always, hides references to the nents and orig_nents entries, making the code robust, easier to follow and copy/paste safe. Signed-off-by: Marek Szyprowski

[PATCH v9 26/32] dmabuf: fix common struct sg_table related issues

2020-08-25 Thread Marek Szyprowski
common dma-mapping wrappers operating directly on the struct sg_table objects and use scatterlist page iterators where possible. This, almost always, hides references to the nents and orig_nents entries, making the code robust, easier to follow and copy/paste safe. Signed-off-by: Marek Szyprowski

[PATCH v9 16/32] drm: rockchip: use common helper for a scatterlist contiguity check

2020-08-25 Thread Marek Szyprowski
Use common helper for checking the contiguity of the imported dma-buf. Signed-off-by: Marek Szyprowski --- drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 19 +-- 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c b/drivers

[PATCH v9 07/32] drm: exynos: fix common struct sg_table related issues

2020-08-25 Thread Marek Szyprowski
common dma-mapping wrappers operating directly on the struct sg_table objects and use scatterlist page iterators where possible. This, almost always, hides references to the nents and orig_nents entries, making the code robust, easier to follow and copy/paste safe. Signed-off-by: Marek Szyprowski

[PATCH v9 02/32] drm: prime: use sgtable iterators in drm_prime_sg_to_page_addr_arrays()

2020-08-25 Thread Marek Szyprowski
describing the old code is no longer needed. Signed-off-by: Marek Szyprowski Reviewed-by: Andrzej Hajda --- drivers/gpu/drm/drm_prime.c | 49 - 1 file changed, 15 insertions(+), 34 deletions(-) diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c

[PATCH v9 08/32] drm: i915: fix common struct sg_table related issues

2020-08-25 Thread Marek Szyprowski
rectly on the struct sg_table objects to the dmabuf related functions, so the other drivers, which might share buffers with i915 could rely on the properly set nents and orig_nents values. Signed-off-by: Marek Szyprowski --- drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c | 11 +++ drive

[PATCH v9 29/32] rapidio: fix common struct sg_table related issues

2020-08-25 Thread Marek Szyprowski
common dma-mapping wrappers operating directly on the struct sg_table objects and use scatterlist page iterators where possible. This, almost always, hides references to the nents and orig_nents entries, making the code robust, easier to follow and copy/paste safe. Signed-off-by: Marek Szyprowski

[PATCH v9 01/32] drm: prime: add common helper to check scatterlist contiguity

2020-08-25 Thread Marek Szyprowski
It is a common operation done by DRM drivers to check the contiguity of the DMA-mapped buffer described by a scatterlist in the sg_table object. Let's add a common helper for this operation. Signed-off-by: Marek Szyprowski Reviewed-by: Andrzej Hajda --- drivers/gpu/drm/drm_gem_cma_hel

[PATCH v9 09/32] drm: lima: fix common struct sg_table related issues

2020-08-25 Thread Marek Szyprowski
common dma-mapping wrappers operating directly on the struct sg_table objects and use scatterlist page iterators where possible. This, almost always, hides references to the nents and orig_nents entries, making the code robust, easier to follow and copy/paste safe. Signed-off-by: Marek Szyprowski

[PATCH v9 13/32] drm: omapdrm: use common helper for extracting pages array

2020-08-25 Thread Marek Szyprowski
Use common helper for converting a sg_table object into struct page pointer array. Signed-off-by: Marek Szyprowski --- drivers/gpu/drm/omapdrm/omap_gem.c | 14 -- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c b/drivers/gpu/drm

[PATCH v9 11/32] drm: mediatek: use common helper for extracting pages array

2020-08-25 Thread Marek Szyprowski
Use common helper for converting a sg_table object into struct page pointer array. Signed-off-by: Marek Szyprowski --- drivers/gpu/drm/mediatek/mtk_drm_gem.c | 9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_gem.c b/drivers/gpu/drm

  1   2   3   4   5   6   7   8   9   10   >