RE: [PATCH v10 3/4] block: add a helper function to merge the segments

2019-09-02 Thread Yoshihiro Shimoda
Hi Christoph, Now this patch series got {Ack,Review}ed-by from each maintainer. https://patchwork.kernel.org/project/linux-renesas-soc/list/?series=166501 So, would you pick this up through the dma-mapping tree as you said before? > From: Jens Axboe, Sent: Tuesday, September 3, 2019 6:47 AM >

Re: [RFC PATCH] iommu/vt-d: Fix IOMMU field not populated on device hot re-plug

2019-09-02 Thread Lu Baolu
Hi Janusz, On 9/2/19 4:37 PM, Janusz Krzysztofik wrote: I am not saying that keeping data is not acceptable. I just want to check whether there are any other solutions. Then reverting 458b7c8e0dde and applying this patch still resolves the issue for me. No errors appear when mappings are

Re: [PATCH 2/2] media: i2c: dw9768: Add DW9768 VCM driver

2019-09-02 Thread Tomasz Figa
Hi Dongchun, On Tue, Sep 3, 2019 at 12:02 AM Dongchun Zhu wrote: > > Hi Tomasz, > > On Fri, 2019-08-23 at 17:17 +0900, Tomasz Figa wrote: > > Hi Dongchun, > > > > On Mon, Jul 08, 2019 at 06:06:41PM +0800, dongchun@mediatek.com wrote: > > > From: Dongchun Zhu > > > > > > This patch adds a

[PATCH -next] iommu/arm-smmu-v3: Fix build error without CONFIG_PCI_ATS

2019-09-02 Thread YueHaibing
If CONFIG_PCI_ATS is not set, building fails: drivers/iommu/arm-smmu-v3.c: In function arm_smmu_ats_supported: drivers/iommu/arm-smmu-v3.c:2325:35: error: struct pci_dev has no member named ats_cap; did you mean msi_cap? return !pdev->untrusted && pdev->ats_cap;

[PATCH v2 5/7] arm64: tegra: Add Memory controller DT node on T194

2019-09-02 Thread Krishna Reddy
Add Memory controller DT node on T194 and enable it. This patch is a prerequisite for SMMU enable on T194. Signed-off-by: Krishna Reddy --- arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi | 4 arch/arm64/boot/dts/nvidia/tegra194.dtsi | 7 +++ 2 files changed, 11 insertions(+)

RE: [PATCH 1/7] iommu/arm-smmu: add Nvidia SMMUv2 implementation

2019-09-02 Thread Krishna Reddy
>>> +ARM_SMMU_MATCH_DATA(nvidia_smmuv2, ARM_SMMU_V2, NVIDIA_SMMUV2); >> The ARM MMU-500 implementation is unmodified. It is the way the are >> integrated and used together(for interleaved accesses) is different from >> regular ARM MMU-500. >> I have added it to get the model number and to be

"Rework enabling/disabling of ATS for PCI masters" failed to compile on arm64

2019-09-02 Thread Qian Cai
The linux-next commit “iommu/arm-smmu-v3: Rework enabling/disabling of ATS for PCI masters” [1] causes a compilation error when PCI_ATS=n on arm64. [1] https://lore.kernel.org/linux-iommu/20190820154549.17018-3-w...@kernel.org/ drivers/iommu/arm-smmu-v3.c:2325:35: error: no member named

[PATCH v2 2/7] iommu/arm-smmu: add NVIDIA implementation for dual ARM MMU-500 usage

2019-09-02 Thread Krishna Reddy
NVIDIA's Tegra194 soc uses two ARM MMU-500s together to interleave IOVA accesses across them. Add NVIDIA implementation for dual ARM MMU-500s and add new compatible string for Tegra194 soc. Signed-off-by: Krishna Reddy --- MAINTAINERS | 2 + drivers/iommu/Makefile

[PATCH v2 6/7] arm64: tegra: Add DT node for T194 SMMU

2019-09-02 Thread Krishna Reddy
Add DT node for T194 SMMU to enable SMMU support. Signed-off-by: Krishna Reddy --- arch/arm64/boot/dts/nvidia/tegra194.dtsi | 77 1 file changed, 77 insertions(+) diff --git a/arch/arm64/boot/dts/nvidia/tegra194.dtsi b/arch/arm64/boot/dts/nvidia/tegra194.dtsi

[PATCH v2 1/7] iommu/arm-smmu: prepare arm_smmu_flush_ops for override

2019-09-02 Thread Krishna Reddy
Remove const keyword for arm_smmu_flush_ops in arm_smmu_domain and replace direct references to arm_smmu_tlb_sync* functions with arm_smmu_flush_ops->tlb_sync(). This is necessary for vendor specific implementations that need to override arm_smmu_flush_ops in part or full. Signed-off-by: Krishna

[PATCH v2 4/7] iommu/arm-smmu: Add global/context fault implementation hooks

2019-09-02 Thread Krishna Reddy
Add global/context fault hooks to allow NVIDIA SMMU implementation handle faults across multiple SMMUs. Signed-off-by: Krishna Reddy --- drivers/iommu/arm-smmu-nvidia.c | 100 drivers/iommu/arm-smmu.c| 11 - drivers/iommu/arm-smmu.h|

[PATCH v2 3/7] dt-bindings: arm-smmu: Add binding for Tegra194 SMMU

2019-09-02 Thread Krishna Reddy
Add binding for NVIDIA's Tegra194 Soc SMMU that is based on ARM MMU-500. Signed-off-by: Krishna Reddy --- Documentation/devicetree/bindings/iommu/arm,smmu.txt | 4 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu.txt

[PATCH v2 0/7] Nvidia Arm SMMUv2 Implementation

2019-09-02 Thread Krishna Reddy
Changes in v2: - Prepare arm_smu_flush_ops for override. - Remove NVIDIA_SMMUv2 and use ARM_SMMUv2 model as T194 SMMU hasn't modified ARM MMU-500. - Add T194 specific compatible string - "nvidia,tegra194-smmu" - Remove tlb_sync hook added in v1 and Override arm_smmu_flush_ops->tlb_sync() from

[PATCH v2 7/7] arm64: tegra: enable SMMU for SDHCI and EQOS on T194

2019-09-02 Thread Krishna Reddy
Enable SMMU translations for SDHCI and EQOS transactions on T194. Signed-off-by: Krishna Reddy --- arch/arm64/boot/dts/nvidia/tegra194.dtsi | 4 1 file changed, 4 insertions(+) diff --git a/arch/arm64/boot/dts/nvidia/tegra194.dtsi b/arch/arm64/boot/dts/nvidia/tegra194.dtsi index

[PATCH v2] swiotlb-xen: Convert to use macro

2019-09-02 Thread Souptick Joarder
Rather than using static int max_dma_bits, this can be coverted to use as macro. Signed-off-by: Souptick Joarder Reviewed-by: Juergen Gross --- drivers/xen/swiotlb-xen.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/xen/swiotlb-xen.c

Re: [PATCH v8 7/7] iommu/vt-d: Use bounce buffer for untrusted devices

2019-09-02 Thread Lu Baolu
Hi David, On 8/30/19 9:39 PM, David Laight wrote: From: Lu Baolu Sent: 30 August 2019 08:17 The Intel VT-d hardware uses paging for DMA remapping. The minimum mapped window is a page size. The device drivers may map buffers not filling the whole IOMMU window. This allows the device to

Re: [PATCH v8 3/7] swiotlb: Zero out bounce buffer for untrusted device

2019-09-02 Thread Christoph Hellwig
On Mon, Sep 02, 2019 at 09:58:27AM +0800, Lu Baolu wrote: > The untrusted flag is introduced in another series. I agree that we > could consider to move it to struct device, but I think making it > in a separated patch looks better. A separate patch is of course a good idea. But it needs to

Re: [PATCH] PCI: Remove unused includes and superfluous struct declaration

2019-09-02 Thread kbuild test robot
/Krzysztof-Wilczynski/PCI-Remove-unused-includes-and-superfluous-struct-declaration/20190902-040019 config: arm64-defconfig (attached as .config) compiler: aarch64-linux-gcc (GCC) 7.4.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin

Re: [PATCH] swiotlb-zen: Convert to use macro

2019-09-02 Thread Juergen Gross
On 01.09.19 21:28, Souptick Joarder wrote: Rather than using static int max_dma_bits, this can be coverted to use as macro. Signed-off-by: Souptick Joarder s/zen/xen/ in the patch title, other than that: Reviewed-by: Juergen Gross Juergen

Re: [RFC PATCH] iommu/vt-d: Fix IOMMU field not populated on device hot re-plug

2019-09-02 Thread Janusz Krzysztofik
Hi Baolu, On Thursday, August 29, 2019 11:08:18 AM CEST Lu Baolu wrote: > Hi, > > On 8/29/19 3:58 PM, Janusz Krzysztofik wrote: > > Hi Baolu, > > > > On Thursday, August 29, 2019 3:43:31 AM CEST Lu Baolu wrote: > >> Hi Janusz, > >> > >> On 8/28/19 10:17 PM, Janusz Krzysztofik wrote: > We

Re: [PATCH 2/7] dt-bindings: arm-smmu: Add binding for nvidia, smmu-v2

2019-09-02 Thread Thierry Reding
On Fri, Aug 30, 2019 at 06:12:08PM +, Krishna Reddy wrote: > >> +"nidia,smmu-v2" > >> "qcom,smmu-v2" > > >I agree with Mikko that the compatible must be at least SoC-specific, but > >potentially even instance-specific (e.g.

Re: [PATCH 2/2] iommu: dma: Use of_iommu_get_resv_regions()

2019-09-02 Thread Thierry Reding
On Mon, Sep 02, 2019 at 03:22:35PM +0100, Robin Murphy wrote: > On 29/08/2019 12:14, Thierry Reding wrote: > > From: Thierry Reding > > > > For device tree nodes, use the standard of_iommu_get_resv_regions() > > implementation to obtain the reserved memory regions associated with a > > device. >

Re: [PATCH 1/2] iommu: Implement of_iommu_get_resv_regions()

2019-09-02 Thread Robin Murphy
On 29/08/2019 12:14, Thierry Reding wrote: From: Thierry Reding This is an implementation that IOMMU drivers can use to obtain reserved memory regions from a device tree node. It uses the reserved-memory DT bindings to find the regions associated with a given device. These regions will be used

Re: [PATCH 2/2] iommu: dma: Use of_iommu_get_resv_regions()

2019-09-02 Thread Robin Murphy
On 29/08/2019 12:14, Thierry Reding wrote: From: Thierry Reding For device tree nodes, use the standard of_iommu_get_resv_regions() implementation to obtain the reserved memory regions associated with a device. This covers the window between iommu_probe_device() setting up a default domain

Re: [PATCH v1 2/2] of: Let of_for_each_phandle fallback to non-negative cell_count

2019-09-02 Thread Rob Herring
On Sat, Aug 24, 2019 at 03:28:46PM +0200, Uwe Kleine-König wrote: > Referencing device tree nodes from a property allows to pass arguments. > This is for example used for referencing gpios. This looks as follows: > > gpio_ctrl: gpio-controller { > #gpio-cells = <2> >

Re: [PATCH 1/2] iommu: Implement of_iommu_get_resv_regions()

2019-09-02 Thread Thierry Reding
On Mon, Sep 02, 2019 at 02:54:23PM +0100, Robin Murphy wrote: > On 29/08/2019 12:14, Thierry Reding wrote: > > From: Thierry Reding > > > > This is an implementation that IOMMU drivers can use to obtain reserved > > memory regions from a device tree node. It uses the reserved-memory DT > >

[PATCH 11/13] swiotlb-xen: remove page-coherent.h

2019-09-02 Thread Christoph Hellwig
The only thing left of page-coherent.h is two functions implemented by the architecture for non-coherent DMA support that are never called for fully coherent architectures. Just move the prototypes for those to swiotlb-xen.h instead. Signed-off-by: Christoph Hellwig Reviewed-by: Stefano

[PATCH 13/13] arm64: use asm-generic/dma-mapping.h

2019-09-02 Thread Christoph Hellwig
Now that the Xen special cases are gone nothing worth mentioning is left in the arm64 file, so switch to use the asm-generic version instead. Signed-off-by: Christoph Hellwig Acked-by: Will Deacon Reviewed-by: Stefano Stabellini --- arch/arm64/include/asm/Kbuild| 1 +

Re: [PATCH v2 01/11] asm-generic: add dma_zone_size

2019-09-02 Thread Christoph Hellwig
On Fri, Aug 30, 2019 at 07:24:25PM +0200, Nicolas Saenz Julienne wrote: > I'll be happy to implement it that way. I agree it's a good compromise. > > @Christoph, do you still want the patch where I create 'zone_dma_bits'? With a > hardcoded ZONE_DMA it's not absolutely necessary. Though I

[PATCH 09/13] swiotlb-xen: use the same foreign page check everywhere

2019-09-02 Thread Christoph Hellwig
xen_dma_map_page uses a different and more complicated check for foreign pages than the other three cache maintainance helpers. Switch it to the simpler pfn_valid method a well, and document the scheme with a single improved comment in xen_dma_map_page. Signed-off-by: Christoph Hellwig

[PATCH 12/13] swiotlb-xen: merge xen_unmap_single into xen_swiotlb_unmap_page

2019-09-02 Thread Christoph Hellwig
No need for a no-op wrapper. Signed-off-by: Christoph Hellwig Reviewed-by: Stefano Stabellini --- drivers/xen/swiotlb-xen.c | 15 --- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c index

Re: [PATCH] PCI: Remove unused includes and superfluous struct declaration

2019-09-02 Thread Rob Herring
On Sun, 1 Sep 2019 13:25:06 +0200, Krzysztof Wilczynski wrote: > Remove and from being included > directly as part of the include/linux/of_pci.h, and remove > superfluous declaration of struct of_phandle_args. > > Move users of include to include > and directly rather than rely on both

Re: [PATCH 1/7] iommu/arm-smmu: add Nvidia SMMUv2 implementation

2019-09-02 Thread Robin Murphy
On 30/08/2019 19:16, Krishna Reddy wrote: +ARM_SMMU_MATCH_DATA(nvidia_smmuv2, ARM_SMMU_V2, NVIDIA_SMMUV2); From the previous discussions, I got the impression that other than the 'novel' way they're integrated, the actual SMMU implementations were unmodified Arm MMU-500s. Is that the case,

Re: [PATCH 1/2] iommu: Implement of_iommu_get_resv_regions()

2019-09-02 Thread Rob Herring
On Thu, 29 Aug 2019 13:14:06 +0200, Thierry Reding wrote: > From: Thierry Reding > > This is an implementation that IOMMU drivers can use to obtain reserved > memory regions from a device tree node. It uses the reserved-memory DT > bindings to find the regions associated with a given device.

Re: [PATCH 3/7] iommu/arm-smmu: Add tlb_sync implementation hook

2019-09-02 Thread Robin Murphy
On 30/08/2019 23:49, Krishna Reddy wrote: + if (smmu->impl->tlb_sync) { + smmu->impl->tlb_sync(smmu, page, sync, status); What I'd hoped is that rather than needing a hook for this, you could just override smmu_domain->tlb_ops from .init_context to wire up the alternate

swiotlb-xen cleanups v3

2019-09-02 Thread Christoph Hellwig
Hi Xen maintainers and friends, please take a look at this series that cleans up the parts of swiotlb-xen that deal with non-coherent caches. Boris and Juergen, can you take a look at patch 8, which touches x86 a as well? Changes since v2: - further dma_cache_maint improvements - split the

[PATCH 01/13] xen/arm: use dma-noncoherent.h calls for xen-swiotlb cache maintainance

2019-09-02 Thread Christoph Hellwig
Copy the arm64 code that uses the dma-direct/swiotlb helpers for DMA on-coherent devices. Signed-off-by: Christoph Hellwig --- arch/arm/include/asm/device.h| 3 - arch/arm/include/asm/xen/page-coherent.h | 72 +--- arch/arm/mm/dma-mapping.c| 8

[PATCH 03/13] xen/arm: use dev_is_dma_coherent

2019-09-02 Thread Christoph Hellwig
Use the dma-noncoherent dev_is_dma_coherent helper instead of the home grown variant. Note that both are always initialized to the same value in arch_setup_dma_ops. Signed-off-by: Christoph Hellwig Reviewed-by: Julien Grall Reviewed-by: Stefano Stabellini ---

[PATCH 02/13] xen/arm: consolidate page-coherent.h

2019-09-02 Thread Christoph Hellwig
Shared the duplicate arm/arm64 code in include/xen/arm/page-coherent.h. Signed-off-by: Christoph Hellwig --- arch/arm/include/asm/xen/page-coherent.h | 75 arch/arm64/include/asm/xen/page-coherent.h | 75 include/xen/arm/page-coherent.h|

[PATCH 05/13] xen/arm: remove xen_dma_ops

2019-09-02 Thread Christoph Hellwig
arm and arm64 can just use xen_swiotlb_dma_ops directly like x86, no need for a pointer indirection. Signed-off-by: Christoph Hellwig Reviewed-by: Julien Grall Reviewed-by: Stefano Stabellini --- arch/arm/mm/dma-mapping.c| 3 ++- arch/arm/xen/mm.c| 4

[PATCH 06/13] xen: remove the exports for xen_{create,destroy}_contiguous_region

2019-09-02 Thread Christoph Hellwig
These routines are only used by swiotlb-xen, which cannot be modular. Signed-off-by: Christoph Hellwig Reviewed-by: Stefano Stabellini --- arch/arm/xen/mm.c | 2 -- arch/x86/xen/mmu_pv.c | 2 -- 2 files changed, 4 deletions(-) diff --git a/arch/arm/xen/mm.c b/arch/arm/xen/mm.c index

[PATCH 07/13] swiotlb-xen: remove xen_swiotlb_dma_mmap and -xen_swiotlb_dma_get_sgtable

2019-09-02 Thread Christoph Hellwig
There is no need to wrap the common version, just wire them up directly. Signed-off-by: Christoph Hellwig Reviewed-by: Stefano Stabellini --- drivers/xen/swiotlb-xen.c | 29 ++--- 1 file changed, 2 insertions(+), 27 deletions(-) diff --git a/drivers/xen/swiotlb-xen.c

[PATCH 04/13] xen/arm: simplify dma_cache_maint

2019-09-02 Thread Christoph Hellwig
Calculate the required operation in the caller, and pass it directly instead of recalculating it for each page, and use simple arithmetics to get from the physical address to Xen page size aligned chunks. Signed-off-by: Christoph Hellwig Reviewed-by: Stefano Stabellini --- arch/arm/xen/mm.c |

[PATCH 08/13] swiotlb-xen: always use dma-direct helpers to alloc coherent pages

2019-09-02 Thread Christoph Hellwig
x86 currently calls alloc_pages, but using dma-direct works as well there, with the added benefit of using the CMA pool if available. The biggest advantage is of course to remove a pointless bit of architecture specific code. Signed-off-by: Christoph Hellwig Reviewed-by: Stefano Stabellini ---

[PATCH 10/13] swiotlb-xen: simplify cache maintainance

2019-09-02 Thread Christoph Hellwig
Now that we know we always have the dma-noncoherent.h helpers available if we are on an architecture with support for non-coherent devices, we can just call them directly, and remove the calls to the dma-direct routines, including the fact that we call the dma_direct_map_page routines but ignore

Re: [PATCH] PCI: Move ATS declarations to linux/pci.h

2019-09-02 Thread Bjorn Helgaas
On Fri, Aug 30, 2019 at 09:18:40AM -0700, Christoph Hellwig wrote: > On Fri, Aug 30, 2019 at 05:07:56PM +0200, Krzysztof Wilczynski wrote: > > Move ATS function prototypes from include/linux/pci-ats.h to > > include/linux/pci.h so users only need to include : > > Why is that so important? Very

Re: [PATCH] PCI: Move ATS declarations to linux/pci.h

2019-09-02 Thread Bjorn Helgaas
[+cc Kelsey] On Mon, Sep 02, 2019 at 04:11:00PM -0500, Bjorn Helgaas wrote: > On Fri, Aug 30, 2019 at 09:18:40AM -0700, Christoph Hellwig wrote: > > On Fri, Aug 30, 2019 at 05:07:56PM +0200, Krzysztof Wilczynski wrote: > > > Move ATS function prototypes from include/linux/pci-ats.h to > > >

Re: [PATCH v10 3/4] block: add a helper function to merge the segments

2019-09-02 Thread Jens Axboe
On 8/28/19 6:35 AM, Yoshihiro Shimoda wrote: > This patch adds a helper function whether a queue can merge > the segments by the DMA MAP layer (e.g. via IOMMU). Reviewed-by: Jens Axboe -- Jens Axboe

[PATCH 4/4] dma-mapping: remove the dma_declare_coherent_memory export

2019-09-02 Thread Christoph Hellwig
dma_declare_coherent_memory is something that the platform setup code (which pretty much means the device tree these days) need to do so that drivers can use the memory as declared by the platform. Drivers themselves have no business calling this function. Signed-off-by: Christoph Hellwig ---

[PATCH 2/4] dma-mapping: remove the dma_mmap_from_dev_coherent export

2019-09-02 Thread Christoph Hellwig
dma_mmap_from_dev_coherent is only used by dma_map_ops instances, none of which is modular. Signed-off-by: Christoph Hellwig --- kernel/dma/coherent.c | 1 - 1 file changed, 1 deletion(-) diff --git a/kernel/dma/coherent.c b/kernel/dma/coherent.c index 7271cda86a37..7cafe1affdc9 100644 ---

remove various dma_declare_coherent related exports

2019-09-02 Thread Christoph Hellwig
Hi all, this is a refresh of and older series that tries to ensure that drivers don't use the dma_declare_coherent function, which is intende for platform code. Unfortunately we've actually grown a user in remoteproc since then. While the maintainers havee promised to fix that up that hasn't

[PATCH 1/4] dma-mapping: remove dma_release_declared_memory

2019-09-02 Thread Christoph Hellwig
This function is entirely unused given that declared memory is generally provided by platform setup code. Signed-off-by: Christoph Hellwig --- Documentation/DMA-API.txt | 11 --- include/linux/dma-mapping.h | 6 -- kernel/dma/coherent.c | 11 --- 3 files changed, 28

[PATCH 3/4] remoteproc: don't allow modular build

2019-09-02 Thread Christoph Hellwig
Remoteproc started using dma_declare_coherent_memory recently, which is a bad idea from drivers, and the maintainers agreed to fix that. But until that is fixed only allow building the driver built in so that we can remove the dma_declare_coherent_memory export and prevent other drivers from