Re: [PATCH v2 3/7] iommu/vt-d: Expose ISA direct mapping region via iommu_get_resv_regions

2019-04-15 Thread Lu Baolu
Hi James, On 4/15/19 10:16 PM, James Sewart wrote: Hey Lu, On 10 Apr 2019, at 06:22, Lu Baolu wrote: Hi James, On 4/6/19 2:02 AM, James Sewart wrote: Hey Lu, My bad, did some debugging on my end. The issue was swapping out find_domain for iommu_get_domain_for_dev. It seems in some

Re: [PATCH 10/18] iommu/vt-d: Add custom allocator for IOASID

2019-04-15 Thread Jacob Pan
On Mon, 15 Apr 2019 14:37:11 -0600 Alex Williamson wrote: > On Mon, 8 Apr 2019 16:59:25 -0700 > Jacob Pan wrote: > > > When VT-d driver runs in the guest, PASID allocation must be > > performed via virtual command interface. This patch register a > > custom IOASID allocator which takes

Re: [PATCH 4/4] swiotlb-xen: ensure we have a single callsite for xen_dma_map_page

2019-04-15 Thread Stefano Stabellini
On Thu, 11 Apr 2019, Christoph Hellwig wrote: > Refactor the code a bit to make further changes easier. > > Signed-off-by: Christoph Hellwig Reviewed-by: Stefano Stabellini > --- > drivers/xen/swiotlb-xen.c | 31 --- > 1 file changed, 16 insertions(+), 15

Re: [PATCH 2/4] swiotlb-xen: use ->map_page to implement ->map_sg

2019-04-15 Thread Stefano Stabellini
On Thu, 11 Apr 2019, Christoph Hellwig wrote: > We can simply loop over the segments and map them, removing lots of > duplicate code. Right, the only difference is the additional dma_capable check which is good to have. Reviewed-by: Stefano Stabellini > Signed-off-by: Christoph Hellwig > ---

Re: [PATCH 1/4] swiotlb-xen: make instances match their method names

2019-04-15 Thread Stefano Stabellini
On Thu, 11 Apr 2019, Christoph Hellwig wrote: > Just drop two pointless _attrs prefixes to make the code a little > more grep-able. > > Signed-off-by: Christoph Hellwig Reviewed-by: Stefano Stabellini > --- > drivers/xen/swiotlb-xen.c | 17 +++-- > 1 file changed, 7

Re: [PATCH 3/4] swiotlb-xen: simplify the DMA sync method implementations

2019-04-15 Thread Stefano Stabellini
On Thu, 11 Apr 2019, Christoph Hellwig wrote: > Get rid of the grand multiplexer and implement the sync_single_for_cpu > and sync_single_for_device methods directly, and then loop over them > for the scatterlist based variants. > > Note that this also loses a few comments related to highlevel DMA

Re: [PATCH 02/18] ioasid: Add custom IOASID allocator

2019-04-15 Thread Jacob Pan
On Mon, 15 Apr 2019 12:53:48 -0600 Alex Williamson wrote: > On Mon, 8 Apr 2019 16:59:17 -0700 > Jacob Pan wrote: > > > Sometimes, IOASID allocation must be handled by platform specific > > code. The use cases are guest vIOMMU and pvIOMMU where IOASIDs need > > to be allocated by the host via

Re: [PATCH 10/18] iommu/vt-d: Add custom allocator for IOASID

2019-04-15 Thread Alex Williamson
On Mon, 8 Apr 2019 16:59:25 -0700 Jacob Pan wrote: > When VT-d driver runs in the guest, PASID allocation must be > performed via virtual command interface. This patch register a > custom IOASID allocator which takes precedence over the default > IDR based allocator. The resulting IOASID

Re: [PATCH 02/18] ioasid: Add custom IOASID allocator

2019-04-15 Thread Alex Williamson
On Mon, 8 Apr 2019 16:59:17 -0700 Jacob Pan wrote: > Sometimes, IOASID allocation must be handled by platform specific > code. The use cases are guest vIOMMU and pvIOMMU where IOASIDs need > to be allocated by the host via enlightened or paravirt interfaces. > > This patch adds an extension to

Re: [PATCH v2 1/7] ACPI/IORT: Check ATS capability in root complex nodes

2019-04-15 Thread Robin Murphy
On 09/04/2019 17:52, Jean-Philippe Brucker wrote: Root complex node in IORT has a bit telling whether it supports ATS or not. Store this bit in the IOMMU fwspec when setting up a device, so it can be accessed later by an IOMMU driver. Hmm, it doesn't feel quite right to store a copy of the

Re: [PATCH 5/9] iommu/amd: Implement .flush_np_cache

2019-04-15 Thread Tom Murphy via iommu
This is a cut and paste from the current amd_iommu driver. I really have no idea if it's a good idea or not. It looks like joerg.roe...@amd.com might be the person to ask. @Joerg Roedel should we keep this? On Mon, Apr 15, 2019 at 7:33 AM Christoph Hellwig wrote: > > > +static void

[PATCH] iommu/amd: Add allocated domain to global list earlier

2019-04-15 Thread Tom Murphy via iommu
dma_ops_domain_free() expects domain to be in a global list. Arguably, could be called before protection_domain_init(). Signed-off-by: Dmitry Safonov Signed-off-by: Tom Murphy --- drivers/iommu/amd_iommu.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git

Re: [PATCH 9/9] iommu/amd: Add allocated domain to global list earlier

2019-04-15 Thread Tom Murphy via iommu
>This seems like a fix to the existing code and should probably go out first. I'll send this patch out on it's own now. On Mon, Apr 15, 2019 at 7:23 AM Christoph Hellwig wrote: > > On Thu, Apr 11, 2019 at 07:47:38PM +0100, Tom Murphy via iommu wrote: > > dma_ops_domain_free() expects domain to

Re: [PATCH v2 6/7] iommu/arm-smmu-v3: Add support for PCI ATS

2019-04-15 Thread Jean-Philippe Brucker
On 15/04/2019 14:21, Will Deacon wrote: > On Tue, Apr 09, 2019 at 05:52:44PM +0100, Jean-Philippe Brucker wrote: >> PCIe devices can implement their own TLB, named Address Translation Cache >> (ATC). Enable Address Translation Service (ATS) for devices that support >> it and send them invalidation

Re: [PATCH v2 1/7] ACPI/IORT: Check ATS capability in root complex nodes

2019-04-15 Thread Jean-Philippe Brucker
On 15/04/2019 14:21, Will Deacon wrote: > On Tue, Apr 09, 2019 at 05:52:39PM +0100, Jean-Philippe Brucker wrote: >> Root complex node in IORT has a bit telling whether it supports ATS or >> not. Store this bit in the IOMMU fwspec when setting up a device, so it >> can be accessed later by an IOMMU

[PATCH 1/1] iommu/arm-smmu: Log CBFRSYNRA register on context fault

2019-04-15 Thread Vivek Gautam
Bits[15:0] in CBFRSYNRA register contain information about StreamID of the incoming transaction that generated the fault. Dump CBFRSYNRA register to get this info. This is specially useful in a distributed SMMU architecture where multiple masters are connected to the SMMU. SID information helps to

Re: [PATCH 00/18] Shared virtual address IOMMU and VT-d support

2019-04-15 Thread Jacob Pan
Hi Joerg and all, Just a gentle reminder if you have any comments on this series. The goal is to support vSVA but without page request. It shares code with Eric Auger's series sMMU v3 for nested mode. Jean, I took your ioasid allocator and modified for PASID allocation as we discussed for the

Re: [PATCH v2 3/7] iommu/vt-d: Expose ISA direct mapping region via iommu_get_resv_regions

2019-04-15 Thread James Sewart via iommu
Hey Lu, > On 10 Apr 2019, at 06:22, Lu Baolu wrote: > > Hi James, > > On 4/6/19 2:02 AM, James Sewart wrote: >> Hey Lu, >> My bad, did some debugging on my end. The issue was swapping out >> find_domain for iommu_get_domain_for_dev. It seems in some situations the >> domain is not attached to

Re: [PATCH v2 6/7] iommu/arm-smmu-v3: Add support for PCI ATS

2019-04-15 Thread Will Deacon
On Tue, Apr 09, 2019 at 05:52:44PM +0100, Jean-Philippe Brucker wrote: > PCIe devices can implement their own TLB, named Address Translation Cache > (ATC). Enable Address Translation Service (ATS) for devices that support > it and send them invalidation requests whenever we invalidate the IOTLBs.

Re: [PATCH v2 1/7] ACPI/IORT: Check ATS capability in root complex nodes

2019-04-15 Thread Will Deacon
On Tue, Apr 09, 2019 at 05:52:39PM +0100, Jean-Philippe Brucker wrote: > Root complex node in IORT has a bit telling whether it supports ATS or > not. Store this bit in the IOMMU fwspec when setting up a device, so it > can be accessed later by an IOMMU driver. > > Use the negative version

Re: [PATCH v2 0/7] Add PCI ATS support to Arm SMMUv3

2019-04-15 Thread Will Deacon
Hi Jean-Philippe, On Tue, Apr 09, 2019 at 05:52:38PM +0100, Jean-Philippe Brucker wrote: > This series enables PCI ATS in SMMUv3. Changes since v1 [1]: > > * Simplify the SMMU structures (patches 2-4 are new). > > * Don't enable ATS for devices that are attached to a bypass domain, > because

Re: [PATCH 1/1] swiotlb: save io_tlb_used to local variable before leaving critical section

2019-04-15 Thread Dongli Zhang
On 04/15/2019 07:26 PM, Konrad Rzeszutek Wilk wrote: > > > On Mon, Apr 15, 2019, 2:50 AM Dongli Zhang > wrote: > > As the patch to be fixed is still in Konrad's own tree, I will send the > v2 for > the patch to be fixed, instead of an incremental

Re: [PATCH 1/1] iommu/arm-smmu: Add SID information to context fault log

2019-04-15 Thread Vivek Gautam
On 4/15/2019 3:11 PM, Robin Murphy wrote: On 15/04/2019 09:07, Vivek Gautam wrote: Extract the SID and add the information to context fault log. This is specially useful in a distributed smmu architecture where multiple masters are connected to smmu. SID information helps to quickly identify

Re: [PATCH 1/1] swiotlb: save io_tlb_used to local variable before leaving critical section

2019-04-15 Thread Konrad Rzeszutek Wilk
On Mon, Apr 15, 2019, 2:50 AM Dongli Zhang wrote: > As the patch to be fixed is still in Konrad's own tree, I will send the v2 > for > the patch to be fixed, instead of an incremental fix. > I squashed it in. > Dongli Zhang > > On 4/12/19 10:13 PM, Joe Jin wrote: > > I'm good to have this

Re: [PATCH 1/1] iommu/arm-smmu: Add SID information to context fault log

2019-04-15 Thread Robin Murphy
On 15/04/2019 09:07, Vivek Gautam wrote: Extract the SID and add the information to context fault log. This is specially useful in a distributed smmu architecture where multiple masters are connected to smmu. SID information helps to quickly identify the faulting master device. Hmm, given how

Re: [PATCH v2 3/3] drm/panfrost: Add initial panfrost driver

2019-04-15 Thread Steven Price
On 15/04/2019 10:18, Daniel Vetter wrote: > On Fri, Apr 05, 2019 at 05:42:33PM +0100, Steven Price wrote: >> On 05/04/2019 17:16, Alyssa Rosenzweig wrote: >>> acronym once ever and have it as a "??"), I'm not sure how to respond to >>> that... We don't know how to allocate memory for the

Re: [PATCH v2 3/3] drm/panfrost: Add initial panfrost driver

2019-04-15 Thread Daniel Vetter
On Fri, Apr 05, 2019 at 05:42:33PM +0100, Steven Price wrote: > On 05/04/2019 17:16, Alyssa Rosenzweig wrote: > > acronym once ever and have it as a "??"), I'm not sure how to respond to > > that... We don't know how to allocate memory for the GPU-internal data > > structures (the tiler heap, for

[PATCH 1/1] iommu/arm-smmu: Add SID information to context fault log

2019-04-15 Thread Vivek Gautam
Extract the SID and add the information to context fault log. This is specially useful in a distributed smmu architecture where multiple masters are connected to smmu. SID information helps to quickly identify the faulting master device. Signed-off-by: Vivek Gautam ---

Re: [PATCH 1/1] swiotlb: save io_tlb_used to local variable before leaving critical section

2019-04-15 Thread Dongli Zhang
As the patch to be fixed is still in Konrad's own tree, I will send the v2 for the patch to be fixed, instead of an incremental fix. Dongli Zhang On 4/12/19 10:13 PM, Joe Jin wrote: > I'm good to have this patch, which helps identify the cause of failure is > fragmentation or it really been used

Re: [PATCH 4/9] iommu/dma-iommu: Add iommu_dma_map_page_coherent

2019-04-15 Thread Christoph Hellwig
> @@ -693,7 +694,19 @@ dma_addr_t iommu_dma_map_page(struct device *dev, struct > page *page, > unsigned long offset, size_t size, int prot) > { > return __iommu_dma_map(dev, page_to_phys(page) + offset, size, prot, > - iommu_get_dma_domain(dev)); > +

Re: [PATCH 5/9] iommu/amd: Implement .flush_np_cache

2019-04-15 Thread Christoph Hellwig
> +static void amd_iommu_flush_np_cache(struct iommu_domain *domain, > + unsigned long iova, size_t size) > +{ > + struct protection_domain *dom = to_pdomain(domain); > + > + if (unlikely(amd_iommu_np_cache)) { Is this case really so unlikely that it needs a static branch

Re: [PATCH 1/9] iommu/dma-iommu: Add iommu_map_atomic

2019-04-15 Thread Christoph Hellwig
On Thu, Apr 11, 2019 at 07:47:30PM +0100, Tom Murphy via iommu wrote: > The iommu ops .map function (or the iommu_map function which calls it) > was always supposed to be sleepable (according to Joerg's comment in > this thread: https://lore.kernel.org/patchwork/patch/977520/ ) and so > should

Re: [PATCH 3/9] iommu/dma-iommu: Add iommu_dma_copy_reserved_iova, iommu_dma_apply_resv_region to the dma-iommu api

2019-04-15 Thread Christoph Hellwig
On Thu, Apr 11, 2019 at 07:47:32PM +0100, Tom Murphy via iommu wrote: > + > + WARN_ON_ONCE(iommu_dma_reserve_iova(domain, region->start, end) == > NULL); Overly long line.. ___ iommu mailing list iommu@lists.linux-foundation.org

Re: [PATCH 9/9] iommu/amd: Add allocated domain to global list earlier

2019-04-15 Thread Christoph Hellwig
On Thu, Apr 11, 2019 at 07:47:38PM +0100, Tom Murphy via iommu wrote: > dma_ops_domain_free() expects domain to be in a global list. > Arguably, could be called before protection_domain_init(). > > Signed-off-by: Dmitry Safonov > Signed-off-by: Tom Murphy This seems like a fix to the existing

Re: [PATCH 8/9] iommu/amd: Clean up unused functions

2019-04-15 Thread Christoph Hellwig
On Thu, Apr 11, 2019 at 07:47:37PM +0100, Tom Murphy via iommu wrote: > Now that we are using the dma-iommu api we have a lot of unused code. > This patch removes all that unused code. This should be merged into the previous patch. ___ iommu mailing

Re: [PATCH 0/9] iommu/amd: Convert the AMD iommu driver to the dma-iommu api

2019-04-15 Thread Christoph Hellwig
Hi Tom, can you rebase this on top of this series: https://lists.linuxfoundation.org/pipermail/iommu/2019-March/034357.html or the version addressing Robin's comments here: http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/dma-iommu-ops.3 so that we can avoid introducing more