RE: [RFC PATCH v2 08/10] vfio/type1: Add domain at(de)taching group helpers

2018-09-14 Thread Tian, Kevin
> From: Jean-Philippe Brucker > Sent: Friday, September 14, 2018 10:46 PM > > On 13/09/2018 01:35, Tian, Kevin wrote: > >>> Let's consider it from the API point of view. > >>> > >>> We have iommu_a(de)ttach_device() APIs to attach or detach a domain > >>> to/from a device. We should avoid

Re: [RFC PATCH v2 00/10] vfio/mdev: IOMMU aware mediated device

2018-09-14 Thread Jacob Pan
On Thu, 13 Sep 2018 16:03:01 +0100 Jean-Philippe Brucker wrote: > On 13/09/2018 01:19, Tian, Kevin wrote: > >>> This is proposed for architectures which support finer granularity > >>> second level translation with no impact on architectures which > >>> only support Source ID or the similar

Re: [RFC PATCH 1/3] ARM: dma-mapping: update comment about handling dma_ops when detaching from IOMMU

2018-09-14 Thread Wolfram Sang
On Fri, Sep 14, 2018 at 02:15:01PM +0200, Geert Uytterhoeven wrote: > On Thu, Sep 13, 2018 at 5:18 PM Wolfram Sang > wrote: > > Update the comment because we don't set the pointer to NULL anymore. > > Also use the correct pointer name 'dma_ops' instead of 'dma_map_ops'. > > > > Fixes:

Re: [RFC PATCH 3/3] dma-mapping: clear dma_parms on teardown, too

2018-09-14 Thread Wolfram Sang
On Fri, Sep 14, 2018 at 02:23:51PM +0100, Robin Murphy wrote: > On 13/09/18 16:17, Wolfram Sang wrote: > > While sanitizig the pointer for dma_ops on teardown, do the same for > > dma_parms, too. Rename the function to have a more generic name. > > Upon closer inspection, it looks like there are

Re: [PATCH, for-4.19] dma-mapping: add the missing ARCH_HAS_SYNC_DMA_FOR_CPU_ALL declaration

2018-09-14 Thread Christoph Hellwig
On Fri, Sep 14, 2018 at 04:44:15PM +0100, Robin Murphy wrote: > On 14/09/18 11:08, Christoph Hellwig wrote: >> Aby chance to get a review for this? > > So without this, the select does nothing, > CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU_ALL is never defined, and BMIPS gets the > static inline stub and

Re: [PATCH, for-4.19] dma-mapping: add the missing ARCH_HAS_SYNC_DMA_FOR_CPU_ALL declaration

2018-09-14 Thread Robin Murphy
On 14/09/18 11:08, Christoph Hellwig wrote: Aby chance to get a review for this? So without this, the select does nothing, CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU_ALL is never defined, and BMIPS gets the static inline stub and never flushes the RAC when it should? I don't know enough MIPS to

Re: [RFC PATCH v2 08/10] vfio/type1: Add domain at(de)taching group helpers

2018-09-14 Thread Jean-Philippe Brucker
On 13/09/2018 01:35, Tian, Kevin wrote: >>> Let's consider it from the API point of view. >>> >>> We have iommu_a(de)ttach_device() APIs to attach or detach a domain >>> to/from a device. We should avoid applying a limitation of "these are >>> only for single domain case, for multiple domains, use

Re: [RFC PATCH v2 00/10] vfio/mdev: IOMMU aware mediated device

2018-09-14 Thread Jean-Philippe Brucker
>> This example only needs to modify first-level translation, and works >> with SMMUv3. The kernel here could be the host, in which case >> second-level translation is disabled in the SMMU, or it could be the >> guest, in which case second-level mappings are created by QEMU and >> first-level

Re: [RFC PATCH v2 00/10] vfio/mdev: IOMMU aware mediated device

2018-09-14 Thread Jean-Philippe Brucker
On 13/09/2018 17:55, Raj, Ashok wrote: >> For Arm SMMU we're more interested in the PASID-granular case than the >> RID-granular one. It doesn't necessarily require vt-d rev3 scalable >> mode, the following example can be implemented with an SMMUv3, since it >> only needs PASID-granular

[PATCH v7 6/6] iommu/arm-smmu: Support non-strict mode

2018-09-14 Thread Robin Murphy
All we need is to wire up .flush_iotlb_all properly and implement the domain attribute, and iommu-dma and io-pgtable-arm will do the rest for us. Rather than bother implementing it for v7s format for the highly unlikely chance of that being relevant, we can simply hide the non-strict flag from

[PATCH v7 5/6] iommu/arm-smmu-v3: Add support for non-strict mode

2018-09-14 Thread Robin Murphy
From: Zhen Lei Dynamically choose strict or non-strict mode for page table config based on the iommu domain type. Signed-off-by: Zhen Lei [rm: convert to domain attribute] Signed-off-by: Robin Murphy --- drivers/iommu/arm-smmu-v3.c | 30 -- 1 file changed, 24

[PATCH v7 4/6] iommu: Add bootup option "iommu.non_strict"

2018-09-14 Thread Robin Murphy
From: Zhen Lei Add a bootup option to make the system manager can choose which mode to be used. The default mode is strict. Signed-off-by: Zhen Lei [rm: move handling out of SMMUv3 driver] Signed-off-by: Robin Murphy --- .../admin-guide/kernel-parameters.txt | 13 ++

[PATCH v7 3/6] iommu/io-pgtable-arm: Add support for non-strict mode

2018-09-14 Thread Robin Murphy
From: Zhen Lei To support non-strict mode, now we only TLBI and sync for strict mode, except for non-leaf invalidations since page table updates themselves must always be synchronous. To save having to reason about it too much, make sure the invalidation in arm_lpae_split_blk_unmap() just

[PATCH v7 0/6] Add non-strict mode support for iommu-dma

2018-09-14 Thread Robin Murphy
Hi all, Since we'd like to get this polished up and merged and Leizhen has other commitments, here's v7 of the previous series[1] wherein I address all my own feedback :) This is a quick tweak of the v6 I sent yesterday since I figured out slightly too late a much neater way of setting the

[PATCH v7 1/6] iommu/arm-smmu-v3: Implement flush_iotlb_all hook

2018-09-14 Thread Robin Murphy
From: Zhen Lei .flush_iotlb_all is currently stubbed to arm_smmu_iotlb_sync() since the only time it would ever need to actually do anything is for callers doing their own explicit batching, e.g.: iommu_unmap_fast(domain, ...); iommu_unmap_fast(domain, ...);

[PATCH v7 2/6] iommu/dma: Add support for non-strict mode

2018-09-14 Thread Robin Murphy
From: Zhen Lei 1. Save the related domain pointer in struct iommu_dma_cookie, make iovad capable call domain->ops->flush_iotlb_all to flush TLB. 2. During the iommu domain initialization phase, base on domain->non_strict field to check whether non-strict mode is supported or not. If so,

Re: [RFCv2 PATCH 0/7] A General Accelerator Framework, WarpDrive

2018-09-14 Thread Jerome Glisse
On Fri, Sep 14, 2018 at 06:50:55AM +, Tian, Kevin wrote: > > From: Jerome Glisse > > Sent: Thursday, September 13, 2018 10:52 PM > > > [...] > > AFAIK, on x86 and PPC at least, all PCIE devices are in the same group > > by default at boot or at least all devices behind the same bridge. > >

Re: [RFCv2 PATCH 0/7] A General Accelerator Framework, WarpDrive

2018-09-14 Thread Jerome Glisse
On Fri, Sep 14, 2018 at 11:12:01AM +0800, Kenneth Lee wrote: > On Thu, Sep 13, 2018 at 10:51:50AM -0400, Jerome Glisse wrote: > > On Thu, Sep 13, 2018 at 04:32:32PM +0800, Kenneth Lee wrote: > > > On Tue, Sep 11, 2018 at 09:40:14AM -0400, Jerome Glisse wrote: > > > > On Tue, Sep 11, 2018 at

Re: [PATCH v5 13/23] iommu: introduce device fault report API

2018-09-14 Thread Auger Eric
Hi Jacob, On 5/11/18 10:54 PM, Jacob Pan wrote: > Traditionally, device specific faults are detected and handled within > their own device drivers. When IOMMU is enabled, faults such as DMA > related transactions are detected by IOMMU. There is no generic > reporting mechanism to report faults

Re: [RFC PATCH 3/3] dma-mapping: clear dma_parms on teardown, too

2018-09-14 Thread Robin Murphy
On 13/09/18 16:17, Wolfram Sang wrote: While sanitizig the pointer for dma_ops on teardown, do the same for dma_parms, too. Rename the function to have a more generic name. Upon closer inspection, it looks like there are some cases (at least PCI and MFD) where dma_parms is installed by the

Re: [RFC PATCH 3/3] dma-mapping: clear dma_parms on teardown, too

2018-09-14 Thread Christoph Hellwig
Same here. I don't even think we really need to clear the ops to start with, but we if we want to do it I'd just do it directly in the two callers. ___ iommu mailing list iommu@lists.linux-foundation.org

Re: [RFC PATCH 2/3] dma-mapping: clear dma_ops pointer also on ARM

2018-09-14 Thread Christoph Hellwig
On Thu, Sep 13, 2018 at 05:17:15PM +0200, Wolfram Sang wrote: > The generic fallback of arch_teardown_dma_ops() clears the dma_ops > pointer but the ARM specific version does not. Rename the generic one, > so it can be called from ARM specific one, too. This will ensure > consistent behaviour.

Re: [RFCv2 PATCH 0/7] A General Accelerator Framework, WarpDrive

2018-09-14 Thread Kenneth Lee
On Fri, Sep 14, 2018 at 06:50:55AM +, Tian, Kevin wrote: > Date: Fri, 14 Sep 2018 06:50:55 + > From: "Tian, Kevin" > To: Jerome Glisse , Kenneth Lee > CC: Kenneth Lee , Alex Williamson > , Herbert Xu , > "k...@vger.kernel.org" , Jonathan Corbet > , Greg Kroah-Hartman , Zaibo > Xu ,

Re: [PATCH v2 0/3] iommu: Avoid DMA ops domain refcount contention

2018-09-14 Thread Will Deacon
Hi Robin, On Wed, Sep 12, 2018 at 04:24:11PM +0100, Robin Murphy wrote: > John raised the issue[1] that we have some unnecessary refcount contention > in the DMA ops path which shows scalability problems now that we have more > real high-performance hardware using iommu-dma. The x86 IOMMU drivers

Re: [RFC PATCH 1/3] ARM: dma-mapping: update comment about handling dma_ops when detaching from IOMMU

2018-09-14 Thread Geert Uytterhoeven
On Thu, Sep 13, 2018 at 5:18 PM Wolfram Sang wrote: > Update the comment because we don't set the pointer to NULL anymore. > Also use the correct pointer name 'dma_ops' instead of 'dma_map_ops'. > > Fixes: 1874619a7df4 ("ARM: dma-mapping: Set proper DMA ops in > arm_iommu_detach_device()") >

Re: [PATCH, for-4.19] dma-mapping: add the missing ARCH_HAS_SYNC_DMA_FOR_CPU_ALL declaration

2018-09-14 Thread Christoph Hellwig
Aby chance to get a review for this? On Tue, Sep 11, 2018 at 11:00:49AM +0200, Christoph Hellwig wrote: > The patch adding the infrastructure failed to actually add the symbol > declaration, oops.. > > Fixes: faef87723a ("dma-noncoherent: add a arch_sync_dma_for_cpu_all hook") > Signed-off-by:

merge dma_direct_ops and dma_noncoherent_ops v3

2018-09-14 Thread Christoph Hellwig
While most architectures are either always or never dma coherent for a given build, the arm, arm64, mips and soon arc architectures can have different dma coherent settings on a per-device basis. Additionally some mips builds can decide at boot time if dma is coherent or not. I've started to

[PATCH 4/6] dma-mapping: merge direct and noncoherent ops

2018-09-14 Thread Christoph Hellwig
All the cache maintainance is already stubbed out when not enabled, but merging the two allows us to nicely handle the case where cache maintainance is required for some devices, but not others. Signed-off-by: Christoph Hellwig Acked-by: Paul Burton # MIPS parts --- arch/arc/Kconfig

[PATCH 1/6] dma-mapping: add the missing ARCH_HAS_SYNC_DMA_FOR_CPU_ALL declaration

2018-09-14 Thread Christoph Hellwig
The patch adding the infrastructure failed to actually add the symbol declaration, oops.. Fixes: faef87723a ("dma-noncoherent: add a arch_sync_dma_for_cpu_all hook") Signed-off-by: Christoph Hellwig --- kernel/dma/Kconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/dma/Kconfig

[PATCH 5/6] dma-mapping: consolidate the dma mmap implementations

2018-09-14 Thread Christoph Hellwig
The only functional differences (modulo a few missing fixes in the arch code) is that architectures without coherent caches need a hook to convert a virtual or dma address into a pfn, given that we don't have the kernel linear mapping available for the otherwise easy virt_to_page call. As a side

[PATCH 6/6] dma-mapping: support non-coherent devices in dma_common_get_sgtable

2018-09-14 Thread Christoph Hellwig
We can use the arch_dma_coherent_to_pfn hook to provide a ->get_sgtable implementation. Note that this isn't an endorsement of this interface (which is a horrible bad idea), but it is required to move arm64 over to the generic code without a loss of functionality. Signed-off-by: Christoph

[PATCH 3/6] dma-mapping: move the dma_coherent flag to struct device

2018-09-14 Thread Christoph Hellwig
Various architectures support both coherent and non-coherent dma on a per-device basis. Move the dma_noncoherent flag from the mips archdata field to struct device proper to prepare the infrastructure for reuse on other architectures. Signed-off-by: Christoph Hellwig Acked-by: Paul Burton

[PATCH 2/6] MIPS: don't select DMA_MAYBE_COHERENT from DMA_PERDEV_COHERENT

2018-09-14 Thread Christoph Hellwig
While both option select a form of conditional dma coherence they don't actually share any code in the implementation, so untangle them. Signed-off-by: Christoph Hellwig Acked-by: Paul Burton --- arch/mips/Kconfig| 2 +- arch/mips/kernel/setup.c | 2 +- arch/mips/mm/c-r4k.c | 17

Re: of_dma_request_slave_channel() failed ?

2018-09-14 Thread Geert Uytterhoeven
Hi Morimoto-san, On Fri, Sep 14, 2018 at 2:53 AM Kuninori Morimoto wrote: > > > Before 6c92d5a2744e2761 patch, driver will forcibly ignore > > > non-SSI modules, and try to use PIO mode. > > > I'm not sure it is "kindly support" or "overkill support". > > > > > > After this patch, it needs DMA,

RE: [RFCv2 PATCH 0/7] A General Accelerator Framework, WarpDrive

2018-09-14 Thread Tian, Kevin
> From: Jerome Glisse > Sent: Thursday, September 13, 2018 10:52 PM > [...] > AFAIK, on x86 and PPC at least, all PCIE devices are in the same group > by default at boot or at least all devices behind the same bridge. the group thing reflects physical hierarchy limitation, not changed cross