[PATCH 4/4] iommu/vt-d: Remove unnecessary parentheses

2018-05-03 Thread Lu Baolu
Remove unnecessary parentheses to comply with preferred coding style. Signed-off-by: Lu Baolu --- drivers/iommu/intel-svm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c index e8cd984..45f6e58

[PATCH 1/4] iommu: Clean up the comments for iommu_group_alloc

2018-05-03 Thread Lu Baolu
@name parameter has been removed. Signed-off-by: Lu Baolu --- drivers/iommu/iommu.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index d2aa2320..d87e7c2 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c

Re: [PATCH 11/13] mips, unicore32: swiotlb doesn't need sg->dma_length

2018-05-03 Thread James Hogan via iommu
On Thu, May 03, 2018 at 05:56:43AM +0200, Christoph Hellwig wrote: > On Wed, May 02, 2018 at 11:20:18PM +0100, James Hogan wrote: > > On Wed, Apr 25, 2018 at 07:15:37AM +0200, Christoph Hellwig wrote: > > > Only mips and unicore32 select CONFIG_NEED_SG_DMA_LENGTH when building > > > swiotlb.

[GIT PULL] dma mapping fix for 4.17-rc4

2018-05-03 Thread Christoph Hellwig
The following changes since commit 2d618bdf71635463a4aa4ad0fe46ec852292bc0c: Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rkuo/linux-hexagon-kernel (2018-05-01 19:54:22 -0700) are available in the Git repository at:

Re: [PATCH] iommu/vt-d: fix shift-out-of-bounds in bug checking

2018-05-03 Thread Joerg Roedel
On Fri, Apr 20, 2018 at 01:29:55PM +0800, changbin...@intel.com wrote: > > Signed-off-by: Changbin Du > --- > drivers/iommu/dmar.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Applied and put a patch on-top to change the BUG_ON to a WARN_ON_ONCE.

Re: [PATCH v4 1/2] iommu - Enable debugfs exposure of the IOMMU

2018-05-03 Thread Joerg Roedel
On Mon, Apr 30, 2018 at 02:58:49PM -0500, Gary R Hook wrote: > Provide base enablement for using debugfs to expose internal data of > an IOMMU driver. When called, create the /sys/kernel/debug/iommu > directory. Emit a strong warning at boot time to indicate that this > feature is enabled. > >

Re: [RFC/RFT] Add noats flag to boot parameters

2018-05-03 Thread Sinan Kaya
On 5/3/2018 9:35 AM, Joerg Roedel wrote: > On Sun, Apr 29, 2018 at 09:16:48PM +0300, Gil Kupfer wrote: >> This patch adds noats option to the pci boot parameter. >> When noats is selected, all ATS related functions fail immediately and >> the IOMMU is configured to not use device-iotlb. >> >> Any

Re: [RFC/RFT] Add noats flag to boot parameters

2018-05-03 Thread Sinan Kaya
+Bjorn, On 5/3/2018 9:59 AM, Joerg Roedel wrote: > On Thu, May 03, 2018 at 09:46:34AM -0400, Sinan Kaya wrote: >> I also like the idea in general. >> Minor nit.. >> >> Shouldn't this be an iommu parameter rather than a PCI kernel command line >> parameter? >> We now have an iommu.passthrough

Re: [PATCH 1/2] iommu/amd - Update the PASID information printed to the system log

2018-05-03 Thread Gary R Hook
On 05/03/2018 08:57 AM, Joerg Roedel wrote: On Tue, May 01, 2018 at 02:52:52PM -0500, Gary R Hook wrote: @@ -567,7 +567,7 @@ static void iommu_print_event(struct amd_iommu *iommu, void *__evt) } if (type == EVENT_TYPE_IO_FAULT) { -

Re: [PATCH 1/2] iommu/amd - Update the PASID information printed to the system log

2018-05-03 Thread Joerg Roedel
On Tue, May 01, 2018 at 02:52:52PM -0500, Gary R Hook wrote: > @@ -567,7 +567,7 @@ static void iommu_print_event(struct amd_iommu *iommu, > void *__evt) > } > > if (type == EVENT_TYPE_IO_FAULT) { > - amd_iommu_report_page_fault(devid, domid, address, flags); > +

Re: [PATCH] iommu/io-pgtable-arm: Use for_each_set_bit to simplify code

2018-05-03 Thread Joerg Roedel
On Thu, Apr 26, 2018 at 12:49:29PM +0800, YueHaibing wrote: > We can use for_each_set_bit() to simplify code slightly in the > ARM io-pgtable self tests while unmapping. > > Signed-off-by: YueHaibing > --- > drivers/iommu/io-pgtable-arm-v7s.c | 5 + >

Re: [RFC/RFT] Add noats flag to boot parameters

2018-05-03 Thread Joerg Roedel
On Sun, Apr 29, 2018 at 09:16:48PM +0300, Gil Kupfer wrote: > This patch adds noats option to the pci boot parameter. > When noats is selected, all ATS related functions fail immediately and > the IOMMU is configured to not use device-iotlb. > > Any function that checks for ATS capabilities

Re: [RFC/RFT] Add noats flag to boot parameters

2018-05-03 Thread Joerg Roedel
On Thu, May 03, 2018 at 09:46:34AM -0400, Sinan Kaya wrote: > I also like the idea in general. > Minor nit.. > > Shouldn't this be an iommu parameter rather than a PCI kernel command line > parameter? > We now have an iommu.passthrough argument that prevents page translation. > > Doesn't this

Re: [PATCH 1/2] iommu/amd - Update the PASID information printed to the system log

2018-05-03 Thread Joerg Roedel
On Thu, May 03, 2018 at 01:09:18PM -0500, Gary R Hook wrote: > Yes, I didn't quite get this right. Both values should be passed along. Or > perhaps the entire event could be passed in and decoded by > amd_iommu_report_page_fault()? You already pass in the flags, you can chose the correct message

Re: [PATCHv4 1/2] iommu/vt-d: Ratelimit each dmar fault printing

2018-05-03 Thread Dmitry Safonov via iommu
On Thu, 2018-05-03 at 14:40 +0200, Joerg Roedel wrote: > On Wed, May 02, 2018 at 03:22:24AM +0100, Dmitry Safonov wrote: > > Hi Joerg, > > > > is there anything I may do about those two patches? > > In 2/2 I've limited loop cnt as discussed in v3. > > This one solves softlockup for us, might be

Re: [PATCH v4 2/2] drivers: remove force dma flag from buses

2018-05-03 Thread Vinod Koul
On Sat, Apr 28, 2018 at 08:21:59AM +0530, Nipun Gupta wrote: > With each bus implementing its own DMA configuration callback, > there is no need for bus to explicitly have force_dma in its > global structure. This patch modifies of_dma_configure API to > accept an input parameter which specifies

Re: [RFC/RFT] Add noats flag to boot parameters

2018-05-03 Thread Bjorn Helgaas
On Thu, May 03, 2018 at 10:23:02AM -0400, Sinan Kaya wrote: > +Bjorn, > > On 5/3/2018 9:59 AM, Joerg Roedel wrote: > > On Thu, May 03, 2018 at 09:46:34AM -0400, Sinan Kaya wrote: > >> I also like the idea in general. > >> Minor nit.. > >> > >> Shouldn't this be an iommu parameter rather than a

Re: [RFC/RFT] Add noats flag to boot parameters

2018-05-03 Thread Nadav Amit
Sinan Kaya wrote: > +Bjorn, > > On 5/3/2018 9:59 AM, Joerg Roedel wrote: >> On Thu, May 03, 2018 at 09:46:34AM -0400, Sinan Kaya wrote: >>> I also like the idea in general. >>> Minor nit.. >>> >>> Shouldn't this be an iommu parameter rather than a PCI kernel command line

[PATCH v2 4/9] iommu/vt-d: Move device_domain_info to header

2018-05-03 Thread Lu Baolu
This allows the per device iommu data to be accessed from other files. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Signed-off-by: Lu Baolu Reviewed-by: Liu Yi L

[PATCH v2 1/9] iommu/vt-d: Global PASID name space

2018-05-03 Thread Lu Baolu
This adds the system wide PASID name space for the PASID allocation. Currently we are using per IOMMU PASID name spaces which are not suitable for some use cases. For an example, one application (associated with a PASID) might talk to two physical devices simultaneously while the two devices could

[PATCH v2 3/9] iommu/vt-d: Use global PASID for SVM usage

2018-05-03 Thread Lu Baolu
This patch switches PASID management for SVM from per iommu idr to the global idr. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Signed-off-by: Lu Baolu

[PATCH v2 2/9] iommu/vt-d: Decouple idr bond pointer from svm

2018-05-03 Thread Lu Baolu
As we move the PASID idr out of SVM code and make it serving as a global PASID name space, the consumer can specify a ptr to bind it with a PASID. We shouldn't assume that each PASID will be bond with a ptr of struct intel_svm anymore. This patch cleans up a idr_for_each_entry() usage in the SVM

[PATCH v2 0/9] iommu/vt-d: Improve PASID id and table management

2018-05-03 Thread Lu Baolu
This patch set improves the PASID id and PASID table management for Intel IOMMU driver. PATCH 1~3 replace per IOMMU idr name space with a global one. Current per IOMMU idr doesn't work in some cases where one application (associated with a PASID) might talk to two physical devices simultaneously

[PATCH v2 7/9] iommu/vt-d: Calculate PTS value

2018-05-03 Thread Lu Baolu
Calculate PTS (PASID Table Size) value for the extended context entry from the real size of the PASID table for a domain. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Signed-off-by: Lu

[PATCH v2 8/9] iommu/vt-d: Use per-domain pasid table

2018-05-03 Thread Lu Baolu
This patch replaces current per iommu pasid table with the new added per domain pasid table. Each svm-capable PCI device will be configured with a pasid table which shares with other svm-capable devices within its iommu domain. Cc: Ashok Raj Cc: Jacob Pan

[PATCH v2 5/9] iommu/vt-d: Per domain pasid table interfaces

2018-05-03 Thread Lu Baolu
This patch adds the interfaces for per domain pasid table management. Currently we allocate one pasid table for all devices under the scope of an IOMMU. It's insecure in the cases where multiple devices under one single IOMMU unit support PASID feature. With per domain pasid table, we can achieve

[PATCH v2 9/9] iommu/vt-d: Clean up PASID talbe management for SVM

2018-05-03 Thread Lu Baolu
The previous per iommu pasid table alloc/free interfaces are no longer used. Clean up the driver by removing it. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Signed-off-by: Lu Baolu

Re: [PATCH v2 2/3] intel-iommu: generalize __mapping_notify_one()

2018-05-03 Thread Peter Xu
On Thu, May 03, 2018 at 03:14:24PM +0200, Joerg Roedel wrote: > On Wed, Apr 18, 2018 at 04:39:52PM +0800, Peter Xu wrote: > > Generalize this new helper to notify one newly created mapping on one > > single IOMMU. We can further leverage this helper in the next patch. > > You introduce the

[PATCH v3 2/2] iommu/vt-d: Fix iotlb psi missing for mappings

2018-05-03 Thread Peter Xu
When caching mode is enabled for IOMMU, we should send explicit IOTLB PSIs even for newly created mappings. However these events are missing for all intel_iommu_map() callers, e.g., iommu_map(). One direct user is the vfio-pci driver. To make sure we'll send the PSIs always when necessary, this

[PATCH v3 0/2] iommu/vt-d: Fix mapping PSI missing for iommu_map()

2018-05-03 Thread Peter Xu
v3: - drop the pr_debug patch [Joerg] - rename all the subjects as suggested [Joerg] - rebase v2: - cc correct people and iommu list (PSI stands for: Page Selective Invalidations) Intel IOMMU has the caching mode to ease emulation of the device. When that bit is set, we need to send PSIs even

[PATCH v3 1/2] iommu/vt-d: Introduce __mapping_notify_one()

2018-05-03 Thread Peter Xu
Introduce this new helper to notify one newly created mapping on one single IOMMU. We can further leverage this helper in the next patch. Signed-off-by: Peter Xu --- drivers/iommu/intel-iommu.c | 26 ++ 1 file changed, 14 insertions(+), 12

Re: [PATCH] iommu/vt-d: fix usage of force parameter in intel_ir_reconfigure_irte()

2018-05-03 Thread Joerg Roedel
On Tue, Mar 06, 2018 at 05:39:41PM -0500, Jagannathan Raman wrote: > It was noticed that the IRTE configured for guest OS kernel > was over-written while the guest was running. As a result, > vt-d Posted Interrupts configured for the guest are not being > delivered directly, and instead bounces

Re: [PATCH v6 4/7] iommu/dma: Move PCI window region reservation back into dma specific path.

2018-05-03 Thread Joerg Roedel
On Wed, Apr 18, 2018 at 12:40:42PM +0100, Shameer Kolothum wrote: > This pretty much reverts commit 273df9635385 ("iommu/dma: Make PCI > window reservation generic") by moving the PCI window region > reservation back into the dma specific path so that these regions > doesn't get exposed via the

Re: [PATCH v4 1/2] dma-mapping: move dma configuration to bus infrastructure

2018-05-03 Thread Christoph Hellwig
On Mon, Apr 30, 2018 at 12:41:24PM +0200, Thierry Reding wrote: > On Sat, Apr 28, 2018 at 08:21:58AM +0530, Nipun Gupta wrote: > [...] > > diff --git a/drivers/gpu/host1x/bus.c b/drivers/gpu/host1x/bus.c > > index 88a3558..a9ec99d 100644 > > --- a/drivers/gpu/host1x/bus.c > > +++

Re: [PATCH v4 1/2] dma-mapping: move dma configuration to bus infrastructure

2018-05-03 Thread Christoph Hellwig
This still fails to apply against either 4.17-rc3 or current Linus master for me. Please resend against it, and mention the tree it is against. Also please resend it in a separate email thread (all your patches were replies to the previous ones) and include a cover letter.

Re: [PATCH] iommu: rockchip: fix building without CONFIG_OF

2018-05-03 Thread Joerg Roedel
On Wed, Apr 04, 2018 at 12:23:53PM +0200, Arnd Bergmann wrote: > We get a build error when compiling the iommu driver without CONFIG_OF: > > drivers/iommu/rockchip-iommu.c: In function 'rk_iommu_of_xlate': > drivers/iommu/rockchip-iommu.c:1101:2: error: implicit declaration of > function

Re: [PATCH v2 2/3] intel-iommu: generalize __mapping_notify_one()

2018-05-03 Thread Joerg Roedel
On Wed, Apr 18, 2018 at 04:39:52PM +0800, Peter Xu wrote: > Generalize this new helper to notify one newly created mapping on one > single IOMMU. We can further leverage this helper in the next patch. You introduce the function, you do not generalize it. Please fix that in the subject and

Re: [PATCH v3 09/20] iommu: Remove depends on HAS_DMA in case of platform dependency

2018-05-03 Thread Joerg Roedel
On Tue, Apr 17, 2018 at 07:49:09PM +0200, Geert Uytterhoeven wrote: > Remove dependencies on HAS_DMA where a Kconfig symbol depends on another > symbol that implies HAS_DMA, and, optionally, on "|| COMPILE_TEST". > In most cases this other symbol is an architecture or platform specific > symbol,

Re: [PATCH 24/61] iommu: simplify getting .drvdata

2018-05-03 Thread Joerg Roedel
On Thu, Apr 19, 2018 at 04:05:54PM +0200, Wolfram Sang wrote: > We should get drvdata from struct device directly. Going via > platform_device is an unneeded step back and forth. > > Signed-off-by: Wolfram Sang > --- > > Build tested only. buildbot is happy.

Re: [PATCHv4 1/2] iommu/vt-d: Ratelimit each dmar fault printing

2018-05-03 Thread Joerg Roedel
On Wed, May 02, 2018 at 03:22:24AM +0100, Dmitry Safonov wrote: > Hi Joerg, > > is there anything I may do about those two patches? > In 2/2 I've limited loop cnt as discussed in v3. > This one solves softlockup for us, might be useful. Applied the first patch, thanks. Please re-work the second

Re: [PATCH] iommu: amd: hide unused iommu_table_lock

2018-05-03 Thread Joerg Roedel
On Wed, Apr 04, 2018 at 12:56:59PM +0200, Arnd Bergmann wrote: > The newly introduced lock is only used when CONFIG_IRQ_REMAP is enabled: > > drivers/iommu/amd_iommu.c:86:24: error: 'iommu_table_lock' defined but not > used [-Werror=unused-variable] > static DEFINE_SPINLOCK(iommu_table_lock); >

Re: [PATCH v1 0/4] Tegra GART fixes and improvements

2018-05-03 Thread Joerg Roedel
On Mon, Apr 09, 2018 at 11:07:18PM +0300, Dmitry Osipenko wrote: > GART driver wasn't ever been utilized in upstream, but finally this should > change sometime soon with Tegra's DRM driver rework. In general GART driver > works fine, though there are couple things that could be improved. > >

Re: [PATCH v2] iommu/rockchip: make clock handling optional

2018-05-03 Thread Joerg Roedel
On Tue, May 01, 2018 at 11:57:29AM +0200, Heiko Stuebner wrote: > Ho Joerg, > > Am Dienstag, 17. April 2018, 14:09:15 CEST schrieb Heiko Stuebner: > > iommu clocks are optional, so the driver should not fail if they are not > > present. Instead just set the number of clocks to 0, which the

Re: [PATCH v4 05/22] iommu: introduce iommu invalidate API function

2018-05-03 Thread Jacob Pan
On Wed, 2 May 2018 10:31:50 +0100 Jean-Philippe Brucker wrote: > On 01/05/18 23:58, Jacob Pan wrote: > Maybe this should be called "NG_PAGE_PASID", > >>> Sure. I was thinking page range already implies non-global > >>> pages. > and "DOMAIN_PAGE"

[PATCH 2/4] iommu/vt-d: Clean up unused variable in find_or_alloc_domain

2018-05-03 Thread Lu Baolu
Remove it to make the code more concise. Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 749d8f2..9064607 100644 ---

[PATCH 3/4] iommu/vt-d: Clean up pasid quirk for pre-production devices

2018-05-03 Thread Lu Baolu
The pasid28 quirk is needed only for some pre-production devices. Remove it to make the code concise. Signed-off-by: Ashok Raj Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 32 ++--

[PATCH 0/4] iommu/vt-d: Several cleanup patches

2018-05-03 Thread Lu Baolu
Hi, This includes several cleanup patches which aim to make the code more concise and easier for reading. There aren't any functionality changes. Best regards, Lu Baolu Lu Baolu (4): iommu: Clean up the comments for iommu_group_alloc iommu/vt-d: Clean up unused variable in