[PATCH V2] iommu/vt-d: Add RPLS to quirk list to skip TE disabling

2022-02-24 Thread Tejas Upadhyay
The VT-d spec requires (10.4.4 Global Command Register, TE field) that: Hardware implementations supporting DMA draining must drain any in-flight DMA read/write requests queued within the Root-Complex before completing the translation enable command and reflecting the status of the command through

Re: [PATCH] iommu/vt-d: Add RPLS to quirk list to skip TE disabling

2022-02-24 Thread Lu Baolu
On 2/24/22 9:39 PM, Vivi, Rodrigo wrote: On Thu, 2022-02-24 at 13:42 +0800, Lu Baolu wrote: On 2/23/22 2:29 PM, Tejas Upadhyay wrote: The VT-d spec requires (10.4.4 Global Command Register, TE field) that: Hardware implementations supporting DMA draining must drain any in-flight DMA read/write

Re: [PATCH v2 08/11] iommu/vt-d: Fix indentation of goto labels

2022-02-24 Thread Lu Baolu
On 2/24/22 9:08 PM, Jason Gunthorpe wrote: On Mon, Feb 14, 2022 at 10:57:01AM +0800, Lu Baolu wrote: Remove blanks before goto labels. Signed-off-by: Lu Baolu drivers/iommu/intel/iommu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) It would be better to rework this function t

Re: [PATCH v2 06/11] iommu/vt-d: Remove unnecessary includes

2022-02-24 Thread Lu Baolu
On 2/24/22 9:05 PM, Jason Gunthorpe wrote: On Mon, Feb 14, 2022 at 10:56:59AM +0800, Lu Baolu wrote: Remove unnecessary include files and sort the remaining alphabetically. Signed-off-by: Lu Baolu --- drivers/iommu/intel/iommu.c | 34 +++--- 1 file changed, 7 ins

Re: [PATCH v2 05/11] iommu/vt-d: Remove DEFER_DEVICE_DOMAIN_INFO

2022-02-24 Thread Lu Baolu
On 2/24/22 9:04 PM, Jason Gunthorpe wrote: On Mon, Feb 14, 2022 at 10:56:58AM +0800, Lu Baolu wrote: diff --git a/drivers/iommu/intel/debugfs.c b/drivers/iommu/intel/debugfs.c index db7a0ca73626..ed796eea4581 100644 --- a/drivers/iommu/intel/debugfs.c +++ b/drivers/iommu/intel/debugfs.c @@ -344

Re: [PATCH v2 09/11] iommu/vt-d: Remove commented code

2022-02-24 Thread Lu Baolu
On 2/24/22 9:09 PM, Jason Gunthorpe wrote: On Mon, Feb 14, 2022 at 10:57:02AM +0800, Lu Baolu wrote: This removes unnecessary commented code. Signed-off-by: Lu Baolu --- drivers/iommu/intel/iommu.c | 10 +- 1 file changed, 1 insertion(+), 9 deletions(-) Assuming you don't want to

Re: cleanup swiotlb initialization

2022-02-24 Thread Boris Ostrovsky
On 2/24/22 11:39 AM, Christoph Hellwig wrote: On Thu, Feb 24, 2022 at 11:18:33AM -0500, Boris Ostrovsky wrote: On 2/24/22 10:58 AM, Christoph Hellwig wrote: Thanks. This looks really strange as early_amd_iommu_init should not interact much with the changes. I'll see if I can find a AMD syst

Re: cleanup swiotlb initialization

2022-02-24 Thread Christoph Hellwig
On Thu, Feb 24, 2022 at 11:18:33AM -0500, Boris Ostrovsky wrote: > > On 2/24/22 10:58 AM, Christoph Hellwig wrote: >> Thanks. >> >> This looks really strange as early_amd_iommu_init should not interact much >> with the changes. I'll see if I can find a AMD system to test on. > > > Just to be clear

Re: cleanup swiotlb initialization

2022-02-24 Thread Boris Ostrovsky
On 2/24/22 10:58 AM, Christoph Hellwig wrote: Thanks. This looks really strange as early_amd_iommu_init should not interact much with the changes. I'll see if I can find a AMD system to test on. Just to be clear: this crashes only as dom0. Boots fine as baremetal. -boris On Wed, Feb 2

Re: cleanup swiotlb initialization

2022-02-24 Thread Christoph Hellwig
Thanks. This looks really strange as early_amd_iommu_init should not interact much with the changes. I'll see if I can find a AMD system to test on. On Wed, Feb 23, 2022 at 07:57:49PM -0500, Boris Ostrovsky wrote: > [   37.377313] BUG: unable to handle page fault for address: c90042880018 >

Re: [PATCH] iommu/vt-d: Add RPLS to quirk list to skip TE disabling

2022-02-24 Thread Vivi, Rodrigo
On Thu, 2022-02-24 at 13:42 +0800, Lu Baolu wrote: > On 2/23/22 2:29 PM, Tejas Upadhyay wrote: > > The VT-d spec requires (10.4.4 Global Command Register, TE > > field) that: > > > > Hardware implementations supporting DMA draining must drain > > any in-flight DMA read/write requests queued within

Re: [PATCH v2 09/11] iommu/vt-d: Remove commented code

2022-02-24 Thread Jason Gunthorpe via iommu
On Mon, Feb 14, 2022 at 10:57:02AM +0800, Lu Baolu wrote: > This removes unnecessary commented code. > > Signed-off-by: Lu Baolu > --- > drivers/iommu/intel/iommu.c | 10 +- > 1 file changed, 1 insertion(+), 9 deletions(-) Assuming you don't want to uncomment it Reviewed-by: Jason Gunt

Re: [PATCH v2 08/11] iommu/vt-d: Fix indentation of goto labels

2022-02-24 Thread Jason Gunthorpe via iommu
On Mon, Feb 14, 2022 at 10:57:01AM +0800, Lu Baolu wrote: > Remove blanks before goto labels. > > Signed-off-by: Lu Baolu > drivers/iommu/intel/iommu.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) It would be better to rework this function to not have the goto spaghetti in the fi

Re: [PATCH v2 07/11] iommu/vt-d: Remove unnecessary prototypes

2022-02-24 Thread Jason Gunthorpe via iommu
On Mon, Feb 14, 2022 at 10:57:00AM +0800, Lu Baolu wrote: > Some prototypes in iommu.c are unnecessary. Delete them. > > Signed-off-by: Lu Baolu > --- > drivers/iommu/intel/iommu.c | 5 - > 1 file changed, 5 deletions(-) Reviewed-by: Jason Gunthorpe Jason _

Re: [PATCH v2 06/11] iommu/vt-d: Remove unnecessary includes

2022-02-24 Thread Jason Gunthorpe via iommu
On Mon, Feb 14, 2022 at 10:56:59AM +0800, Lu Baolu wrote: > Remove unnecessary include files and sort the remaining alphabetically. > > Signed-off-by: Lu Baolu > --- > drivers/iommu/intel/iommu.c | 34 +++--- > 1 file changed, 7 insertions(+), 27 deletions(-) Are we

Re: [PATCH v2 05/11] iommu/vt-d: Remove DEFER_DEVICE_DOMAIN_INFO

2022-02-24 Thread Jason Gunthorpe via iommu
On Mon, Feb 14, 2022 at 10:56:58AM +0800, Lu Baolu wrote: > diff --git a/drivers/iommu/intel/debugfs.c b/drivers/iommu/intel/debugfs.c > index db7a0ca73626..ed796eea4581 100644 > --- a/drivers/iommu/intel/debugfs.c > +++ b/drivers/iommu/intel/debugfs.c > @@ -344,7 +344,8 @@ static void pgtable_wal

Re: [PATCH v2 04/11] iommu/vt-d: Remove domain and devinfo mempool

2022-02-24 Thread Jason Gunthorpe via iommu
On Mon, Feb 14, 2022 at 10:56:57AM +0800, Lu Baolu wrote: > The domain and devinfo memory blocks are only allocated during device > probe and released during remove. There's no hot-path context, hence > no need for memory pools. > > Signed-off-by: Lu Baolu > Reviewed-by: Christoph Hellwig > ---

Re: [PATCH v2 03/11] iommu/vt-d: Remove iova_cache_get/put()

2022-02-24 Thread Jason Gunthorpe via iommu
On Mon, Feb 14, 2022 at 10:56:56AM +0800, Lu Baolu wrote: > These have been done in drivers/iommu/dma-iommu.c. Remove this duplicate > code. > > Signed-off-by: Lu Baolu > Reviewed-by: Christoph Hellwig > --- > drivers/iommu/intel/iommu.c | 5 - > 1 file changed, 5 deletions(-) Reviewed-by:

Re: [PATCH v2 02/11] iommu/vt-d: Remove finding domain in dmar_insert_one_dev_info()

2022-02-24 Thread Jason Gunthorpe via iommu
On Mon, Feb 14, 2022 at 10:56:55AM +0800, Lu Baolu wrote: > The Intel IOMMU driver has already converted to use default domain > framework in iommu core. There's no need to find a domain for the > device in the domain attaching path. Cleanup that code. > > Signed-off-by: Lu Baolu > Reviewed-by: C

Re: [PATCH v2 01/11] iommu/vt-d: Remove intel_iommu::domains

2022-02-24 Thread Jason Gunthorpe via iommu
On Mon, Feb 14, 2022 at 10:56:54AM +0800, Lu Baolu wrote: > The "domains" field of the intel_iommu structure keeps the mapping of > domain_id to dmar_domain. This information is not used anywhere. Remove > and cleanup it to avoid unnecessary memory consumption. > > Signed-off-by: Lu Baolu > Revie

Re: [PATCH v4 2/8] hwtracing: Add trace function support for HiSilicon PCIe Tune and Trace device

2022-02-24 Thread Yicong Yang via iommu
On 2022/2/24 20:32, John Garry wrote: > On 24/02/2022 03:53, Yicong Yang wrote: >> On 2022/2/22 19:06, John Garry wrote: >>> On 21/02/2022 08:43, Yicong Yang wrote: HiSilicon PCIe tune and trace device(PTT) is a PCIe Root Complex integrated Endpoint(RCiEP) device, providing the capability

Re: [PATCH v4 2/8] hwtracing: Add trace function support for HiSilicon PCIe Tune and Trace device

2022-02-24 Thread John Garry via iommu
On 24/02/2022 03:53, Yicong Yang wrote: On 2022/2/22 19:06, John Garry wrote: On 21/02/2022 08:43, Yicong Yang wrote: HiSilicon PCIe tune and trace device(PTT) is a PCIe Root Complex integrated Endpoint(RCiEP) device, providing the capability to dynamically monitor and tune the PCIe traffic, an

Re: [PATCH 05/11] swiotlb: pass a gfp_mask argument to swiotlb_init_late

2022-02-24 Thread Anshuman Khandual
On 2/22/22 9:05 PM, Christoph Hellwig wrote: > Let the caller chose a zone to allocate from. This is being used later via xen_swiotlb_gfp() on arm platform. > > Signed-off-by: Christoph Hellwig > --- > arch/x86/pci/sta2x11-fixup.c | 2 +- > include/linux/swiotlb.h | 2 +- > kernel/dma/

Re: [PATCH 04/11] swiotlb: rename swiotlb_late_init_with_default_size

2022-02-24 Thread Anshuman Khandual
On 2/22/22 9:05 PM, Christoph Hellwig wrote: > swiotlb_late_init_with_default_size is an overly verbose name that > doesn't even catch what the function is doing, given that the size is > not just a default but the actual requested size. > > Rename it to swiotlb_init_late. > > Signed-off-by: C

Re: [PATCH 03/11] swiotlb: simplify swiotlb_max_segment

2022-02-24 Thread Anshuman Khandual
On 2/22/22 9:05 PM, Christoph Hellwig wrote: > Remove the bogus Xen override that was usually larger than the actual > size and just calculate the value on demand. Note that > swiotlb_max_segment still doesn't make sense as an interface and should > eventually be removed. > > Signed-off-by: Ch

Re: [PATCH 02/11] swiotlb: make swiotlb_exit a no-op if SWIOTLB_FORCE is set

2022-02-24 Thread Anshuman Khandual
On 2/22/22 9:05 PM, Christoph Hellwig wrote: > If force bouncing is enabled we can't release the bufffers. typo > > Signed-off-by: Christoph Hellwig > --- > kernel/dma/swiotlb.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --gi

Re: [PATCH 01/11] dma-direct: use is_swiotlb_active in dma_direct_map_page

2022-02-24 Thread Anshuman Khandual
On 2/22/22 9:05 PM, Christoph Hellwig wrote: > Use the more specific is_swiotlb_active check instead of checking the > global swiotlb_force variable. > > Signed-off-by: Christoph Hellwig > --- > kernel/dma/direct.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kern

Re: [PATCH 07/11] x86: remove the IOMMU table infrastructure

2022-02-24 Thread Anshuman Khandual
On 2/22/22 9:05 PM, Christoph Hellwig wrote: > The IOMMU table tries to separate the different IOMMUs into different > backends, but actually requires various cross calls. > > Rewrite the code to do the generic swiotlb/swiotlb-xen setup directly > in pci-dma.c and then just call into the IOMMU d

Re: [PATCH 10/11] swiotlb: merge swiotlb-xen initialization into swiotlb

2022-02-24 Thread Anshuman Khandual
On 2/22/22 9:05 PM, Christoph Hellwig wrote: > Allow to pass a remap argument to the swiotlb initialization functions > to handle the Xen/x86 remap case. ARM/ARM64 never did any remapping > from xen_swiotlb_fixup, so we don't even need that quirk. > > Signed-off-by: Christoph Hellwig > --- > ar

Re: [PATCH v8 03/11] ACPI/IORT: Add helper functions to parse RMR nodes

2022-02-24 Thread Lorenzo Pieralisi
On Mon, Feb 21, 2022 at 03:43:36PM +, Shameer Kolothum wrote: > The helper functions here parse through the IORT RMR nodes and > populate a reserved region list corresponding to a given iommu > and device(optional). These also go through the ID mappings of > the RMR node and retrieves all the

Re: [PATCH v6 01/11] iommu: Add dma ownership management interfaces

2022-02-24 Thread Robin Murphy
On 2022-02-24 05:29, Lu Baolu wrote: On 2/24/22 1:16 PM, Lu Baolu wrote: Hi Robin and Jason, On 2/24/22 2:02 AM, Jason Gunthorpe wrote: On Wed, Feb 23, 2022 at 06:00:06PM +, Robin Murphy wrote: ...and equivalently just set owner_cnt directly to 0 here. I don't see a realistic use-case fo