[PATCH v7 6/9] iommu/vt-d: Return ID associated with an auxiliary domain

2019-02-21 Thread Lu Baolu
: Kevin Tian Signed-off-by: Sanjay Kumar Signed-off-by: Liu Yi L Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 8ecf09db6047..b79c72cc5931 100644 --- a/drivers

[PATCH v7 1/9] iommu: Add APIs for multiple domains per device

2019-02-21 Thread Lu Baolu
logy-for-directed-io-architecture-specification [4] https://lkml.org/lkml/2018/7/26/4 [5] https://www.spinics.net/lists/iommu/msg31874.html Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Suggested-by: Kevin Tian Suggested-by: Jean-Philippe Brucker Suggested-by: Joerg Roedel Signed-off-by

[PATCH v7 5/9] iommu/vt-d: Aux-domain specific domain attach/detach

2019-02-21 Thread Lu Baolu
/detach_device() ops to support managing PASID granular translation structures when the device driver has enabled multiple domains per device. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Signed-off-by: Sanjay Kumar Signed-off-by: Liu Yi L Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 152

Re: [PATCH v6 0/9] vfio/mdev: IOMMU aware mediated device

2019-02-21 Thread Lu Baolu
Hi, On 2/15/19 4:14 AM, Alex Williamson wrote: On Wed, 13 Feb 2019 12:02:52 +0800 Lu Baolu wrote: Hi, The Mediate Device is a framework for fine-grained physical device sharing across the isolated domains. Currently the mdev framework is designed to be independent of the platform IOMMU

Re: [PATCH v6 0/9] vfio/mdev: IOMMU aware mediated device

2019-02-18 Thread Lu Baolu
Hi Kirti, On 2/15/19 4:14 AM, Alex Williamson wrote: On Wed, 13 Feb 2019 12:02:52 +0800 Lu Baolu wrote: Hi, The Mediate Device is a framework for fine-grained physical device sharing across the isolated domains. Currently the mdev framework is designed to be independent of the platform

Re: [PATCH v6 0/9] vfio/mdev: IOMMU aware mediated device

2019-02-18 Thread Lu Baolu
://schd.ws/hosted_files/lc32018/00/LC3-SIOV-final.pdf Best regards, Lu Baolu Change log:    v5->v6: This looks pretty reasonable with Jean-Philippe's nit fixups.  Where do we go from here?  I think we need an ack from Kirti since they have an interest here.  Presumably this looks ok to the A

Re: [PATCH v6 1/9] iommu: Add APIs for multiple domains per device

2019-02-13 Thread Lu Baolu
Hi Jean, On 2/13/19 7:55 PM, Jean-Philippe Brucker wrote: Hi, I have a few boring nits and one question below Thanks a lot for reviewing my patch. On 13/02/2019 04:02, Lu Baolu wrote: Sharing a physical PCI device in a finer-granularity way is becoming a consensus in the industry. IOMMU

[PATCH v6 6/9] iommu/vt-d: Return ID associated with an auxiliary domain

2019-02-12 Thread Lu Baolu
: Kevin Tian Signed-off-by: Sanjay Kumar Signed-off-by: Liu Yi L Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 8ecf09db6047..b79c72cc5931 100644 --- a/drivers

[PATCH v6 7/9] vfio/mdev: Add iommu related member in mdev_device

2019-02-12 Thread Lu Baolu
ivers don't need to set the iommu device if it uses vendor defined isolation. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Suggested-by: Kevin Tian Suggested-by: Alex Williamson Signed-off-by: Lu Baolu --- drivers/vfio/mdev/mdev_core.c| 18 ++ d

[PATCH v6 8/9] vfio/type1: Add domain at(de)taching group helpers

2019-02-12 Thread Lu Baolu
scope) instead. The added helper supports attaching domain to groups for both pci and mdev devices. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Signed-off-by: Sanjay Kumar Signed-off-by: Liu Yi L Signed-off-by: Lu Baolu --- drivers/vfio/vfio_iommu_type1.c | 84

[PATCH v6 4/9] iommu/vt-d: Move common code out of iommu_attch_device()

2019-02-12 Thread Lu Baolu
This part of code could be used by both normal and aux domain specific attach entries. Hence move them into a common function to avoid duplication. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 60 ++--- 1

[PATCH v6 9/9] vfio/type1: Handle different mdev isolation type

2019-02-12 Thread Lu Baolu
Cc: Kevin Tian Signed-off-by: Sanjay Kumar Signed-off-by: Liu Yi L Signed-off-by: Lu Baolu --- drivers/vfio/vfio_iommu_type1.c | 48 - 1 file changed, 41 insertions(+), 7 deletions(-) diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1

[PATCH v6 5/9] iommu/vt-d: Aux-domain specific domain attach/detach

2019-02-12 Thread Lu Baolu
/detach_device() ops to support managing PASID granular translation structures when the device driver has enabled multiple domains per device. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Signed-off-by: Sanjay Kumar Signed-off-by: Liu Yi L Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 152

[PATCH v6 3/9] iommu/vt-d: Add per-device IOMMU feature ops entries

2019-02-12 Thread Lu Baolu
This adds the iommu ops entries for aux-domain per-device feature query and enable/disable. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Signed-off-by: Sanjay Kumar Signed-off-by: Liu Yi L Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 159

[PATCH v6 1/9] iommu: Add APIs for multiple domains per device

2019-02-12 Thread Lu Baolu
cted-io-architecture-specification [4] https://lkml.org/lkml/2018/7/26/4 [5] https://www.spinics.net/lists/iommu/msg31874.html Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Suggested-by: Kevin Tian Suggested-by: Jean-Philippe Brucker Suggested-by: Joerg Roedel Signed-off-by: Lu Baolu

[PATCH v6 2/9] iommu/vt-d: Move enable pasid out of CONFIG_INTEL_IOMMU_SVM

2019-02-12 Thread Lu Baolu
This moves intel_iommu_enable_pasid() out of the scope of CONFIG_INTEL_IOMMU_SVM with more and more features requiring pasid function. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 22 +++--- drivers/iommu/intel-svm.c

[PATCH v6 0/9] vfio/mdev: IOMMU aware mediated device

2019-02-12 Thread Lu Baolu
cted-io-architecture-specification [2] https://software.intel.com/en-us/download/intel-scalable-io-virtualization-technical-specification [3] https://schd.ws/hosted_files/lc32018/00/LC3-SIOV-final.pdf Best regards, Lu Baolu Change log: v5->v6: - Add a new API iommu_dev_feature_enabled() to check whether

Re: [PATCH v1 4/7] iommu/vt-d: Remove unnecessary local variable initializations

2019-02-10 Thread Lu Baolu
Hi, On 2/11/19 11:33 AM, Bjorn Helgaas wrote: On Sun, Feb 10, 2019 at 8:00 PM Lu Baolu wrote: Hi, On 2/9/19 6:06 AM, Bjorn Helgaas wrote: From: Bjorn Helgaas A local variable initialization is a hint that the variable will be used in an unusual way. If the initialization is unnecessary

Re: [PATCH v1 4/7] iommu/vt-d: Remove unnecessary local variable initializations

2019-02-10 Thread Lu Baolu
t" might go through dma_pte_clear_level() without any touches. Best regards, Lu Baolu

Re: [PATCH 1/1] iommu/vt-d: Leave scalable mode default off

2019-01-24 Thread Lu Baolu
Hi Joerg, On 1/24/19 9:22 PM, Joerg Roedel wrote: On Thu, Jan 24, 2019 at 10:31:32AM +0800, Lu Baolu wrote: Commit 765b6a98c1de3 ("iommu/vt-d: Enumerate the scalable mode capability") enables VT-d scalable mode if hardware advertises the capability. As we will bring up different fe

Re: [PATCH v5 2/8] iommu/vt-d: Add per-device IOMMU feature ops entries

2019-01-23 Thread Lu Baolu
n, dev) Best regards, Lu Baolu

[PATCH 1/1] iommu/vt-d: Leave scalable mode default off

2019-01-23 Thread Lu Baolu
atures are supported in the kernel. Cc: Liu Yi L Cc: Jacob Pan Suggested-by: Ashok Raj Suggested-by: Kevin Tian Signed-off-by: Lu Baolu --- Documentation/admin-guide/kernel-parameters.txt | 7 +++ drivers/iommu/intel-iommu.c | 8 2 files changed, 7 insert

Re: [PATCH v5 4/8] iommu/vt-d: Aux-domain specific domain attach/detach

2019-01-14 Thread Lu Baolu
Hi, On 1/14/19 8:26 PM, Jonathan Cameron wrote: On Thu, 10 Jan 2019 11:00:23 +0800 Lu Baolu wrote: When multiple domains per device has been enabled by the device driver, the device will tag the default PASID for the domain to all DMA traffics out of the subset of this device; and the IOMMU

Re: [PATCH v5 1/8] iommu: Add APIs for multiple domains per device

2019-01-14 Thread Lu Baolu
Hi, On 1/14/19 7:22 PM, Jonathan Cameron wrote: On Thu, 10 Jan 2019 11:00:20 +0800 Lu Baolu wrote: Sharing a physical PCI device in a finer-granularity way is becoming a consensus in the industry. IOMMU vendors are also engaging efforts to support such sharing as well as possible. Among the

Re: [PATCH v5 2/8] iommu/vt-d: Add per-device IOMMU feature ops entries

2019-01-13 Thread Lu Baolu
extended capability list. More below: On Thu, Jan 10, 2019 at 11:00:21AM +0800, Lu Baolu wrote: +static int intel_iommu_enable_auxd(struct device *dev) +{ + struct device_domain_info *info; + struct dmar_domain *domain; + unsigned long flags; + + if (!scalable_mode_support

[PATCH 1/1] iommu/vt-d: Support page request in scalable mode

2019-01-10 Thread Lu Baolu
de") Signed-off-by: Lu Baolu --- drivers/iommu/intel-svm.c | 77 ++--- include/linux/intel-iommu.h | 21 +- include/linux/intel-svm.h | 2 +- 3 files changed, 55 insertions(+), 45 deletions(-) diff --git a/drivers/iommu/intel-svm.c b/drivers/iom

[PATCH v5 6/8] vfio/mdev: Add iommu related member in mdev_device

2019-01-09 Thread Lu Baolu
ivers don't need to set the iommu device if it uses vendor defined isolation. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Suggested-by: Kevin Tian Suggested-by: Alex Williamson Signed-off-by: Lu Baolu --- drivers/vfio/mdev/mdev_core.c| 18 ++ d

[PATCH v5 8/8] vfio/type1: Handle different mdev isolation type

2019-01-09 Thread Lu Baolu
Cc: Kevin Tian Signed-off-by: Sanjay Kumar Signed-off-by: Liu Yi L Signed-off-by: Lu Baolu --- drivers/vfio/vfio_iommu_type1.c | 48 - 1 file changed, 41 insertions(+), 7 deletions(-) diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1

[PATCH v5 4/8] iommu/vt-d: Aux-domain specific domain attach/detach

2019-01-09 Thread Lu Baolu
/detach_device() ops to support managing PASID granular translation structures when the device driver has enabled multiple domains per device. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Signed-off-by: Sanjay Kumar Signed-off-by: Liu Yi L Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 152

[PATCH v5 3/8] iommu/vt-d: Move common code out of iommu_attch_device()

2019-01-09 Thread Lu Baolu
This part of code could be used by both normal and aux domain specific attach entries. Hence move them into a common function to avoid duplication. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 60 ++--- 1

[PATCH v5 7/8] vfio/type1: Add domain at(de)taching group helpers

2019-01-09 Thread Lu Baolu
scope) instead. The added helper supports attaching domain to groups for both pci and mdev devices. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Signed-off-by: Sanjay Kumar Signed-off-by: Liu Yi L Signed-off-by: Lu Baolu --- drivers/vfio/vfio_iommu_type1.c | 84

[PATCH v5 5/8] iommu/vt-d: Return ID associated with an auxiliary domain

2019-01-09 Thread Lu Baolu
: Kevin Tian Signed-off-by: Sanjay Kumar Signed-off-by: Liu Yi L Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index b8fb6a4bd447..614906276bf1 100644 --- a/drivers

[PATCH v5 1/8] iommu: Add APIs for multiple domains per device

2019-01-09 Thread Lu Baolu
l Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Suggested-by: Kevin Tian Suggested-by: Jean-Philippe Brucker Suggested-by: Joerg Roedel Signed-off-by: Lu Baolu --- drivers/iommu/iommu.c | 80 +++ include/linux/iommu.h | 61 ++

[PATCH v5 2/8] iommu/vt-d: Add per-device IOMMU feature ops entries

2019-01-09 Thread Lu Baolu
This adds the iommu ops entries for aux-domain per-device feature query and enable/disable. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Signed-off-by: Sanjay Kumar Signed-off-by: Liu Yi L Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 86

[PATCH v5 0/8] vfio/mdev: IOMMU aware mediated device

2019-01-09 Thread Lu Baolu
] https://schd.ws/hosted_files/lc32018/00/LC3-SIOV-final.pdf Best regards, Lu Baolu Change log: v4->v5: - The iommu APIs have been updated with Joerg's proposal posted here https://www.spinics.net/lists/iommu/msg31874.html. - Some typos in commit message and comments have been

Re: [RFC PATCH 1/5] iommu: Add APIs for IOMMU PASID management

2018-12-15 Thread Lu Baolu
Hi, On 12/16/18 6:38 AM, Liu, Yi L wrote: From: Lu Baolu [mailto:baolu...@linux.intel.com] Sent: Sunday, November 11, 2018 10:45 PM Subject: [RFC PATCH 1/5] iommu: Add APIs for IOMMU PASID management This adds APIs for IOMMU drivers and device drivers to manage the PASIDs used for DMA

[PATCH v6 08/12] iommu/vt-d: Pass pasid table to context mapping

2018-12-09 Thread Lu Baolu
So that the pasid related info, such as the pasid table and the maximum of pasid could be used during setting up scalable mode context. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Cc: Sanjay Kumar Signed-off-by: Lu Baolu Reviewed-by: Ashok Raj Reviewed-by: Kevin Tian

[PATCH v6 03/12] iommu/vt-d: Move page table helpers into header

2018-12-09 Thread Lu Baolu
So that they could also be used in other source files. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Cc: Sanjay Kumar Signed-off-by: Lu Baolu Reviewed-by: Ashok Raj Reviewed-by: Kevin Tian --- drivers/iommu/intel-iommu.c | 43 - include/linux

[PATCH v6 05/12] iommu/vt-d: Reserve a domain id for FL and PT modes

2018-12-09 Thread Lu Baolu
pass-through translations. This reserves a domain id for first-level and pass-through translations. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Cc: Sanjay Kumar Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 10 ++ drivers/iommu/intel-pasid.h | 6 ++ 2

[PATCH v6 10/12] iommu/vt-d: Add first level page table interface

2018-12-09 Thread Lu Baolu
This adds an interface to setup the PASID entries for first level page table translation. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Signed-off-by: Sanjay Kumar Signed-off-by: Liu Yi L Signed-off-by: Lu Baolu Reviewed-by: Ashok Raj --- drivers/iommu/intel-pasid.c | 80

[PATCH v6 11/12] iommu/vt-d: Shared virtual address in scalable mode

2018-12-09 Thread Lu Baolu
This patch enables the current SVA (Shared Virtual Address) implementation to work in the scalable mode. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Signed-off-by: Sanjay Kumar Signed-off-by: Liu Yi L Signed-off-by: Lu Baolu Reviewed-by: Ashok Raj --- drivers/iommu/intel-iommu.c | 38

[PATCH v6 12/12] iommu/vt-d: Remove deferred invalidation

2018-12-09 Thread Lu Baolu
Deferred invalidation is an ECS specific feature. It will not be supported when IOMMU works in scalable mode. As we deprecated the ECS support, remove deferred invalidation and cleanup the code. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Cc: Sanjay Kumar Signed-off-by: Lu Baolu

[PATCH v6 06/12] iommu/vt-d: Add second level page table interface

2018-12-09 Thread Lu Baolu
This adds the interfaces to setup or tear down the structures for second level page table translations. This includes types of second level only translation and pass through. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Signed-off-by: Sanjay Kumar Signed-off-by: Liu Yi L Signed-off-by: Lu

[PATCH v6 09/12] iommu/vt-d: Setup context and enable RID2PASID support

2018-12-09 Thread Lu Baolu
This patch enables the translation for requests without PASID in the scalable mode by setting up the root and context entries. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Signed-off-by: Sanjay Kumar Signed-off-by: Liu Yi L Signed-off-by: Lu Baolu Reviewed-by: Ashok Raj --- drivers/iommu

[PATCH v6 07/12] iommu/vt-d: Setup pasid entry for RID2PASID support

2018-12-09 Thread Lu Baolu
use the PASID 0 as a sort of design decision. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Signed-off-by: Sanjay Kumar Signed-off-by: Liu Yi L Signed-off-by: Lu Baolu Reviewed-by: Ashok Raj --- drivers/iommu/intel-iommu.c | 20 drivers/iommu/intel-pasid.h | 1 + 2 files

[PATCH v6 01/12] iommu/vt-d: Enumerate the scalable mode capability

2018-12-09 Thread Lu Baolu
). This patch adds enumeration for Scalable Mode and removes the deprecated ECS enumeration. It provides a boot time option to disable scalable mode even hardware claims to support it. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Signed-off-by: Sanjay Kumar Signed-off-by: Liu Yi L Signed-off-by: Lu

[PATCH v6 00/12] iommu/vt-d: Add scalable mode support

2018-12-09 Thread Lu Baolu
support. - Fix various comments received during v2 review period. All were code style related. v1->v2: - Rebase all patches on top of v4.19-rc1; - Add 256-bit invalidation descriptor support; - Reserve a domain id for first level and pass-through usage to make hardware cache

[PATCH v6 02/12] iommu/vt-d: Manage scalalble mode PASID tables

2018-12-09 Thread Lu Baolu
directory and PASID table. It also adds a helper to get the PASID table entry according to the pasid value. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Signed-off-by: Sanjay Kumar Signed-off-by: Liu Yi L Signed-off-by: Lu Baolu Reviewed-by: Ashok Raj ---

[PATCH v6 04/12] iommu/vt-d: Add 256-bit invalidation descriptor support

2018-12-09 Thread Lu Baolu
256-bit invalidation descriptor support if the hardware presents scalable mode capability. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Signed-off-by: Sanjay Kumar Signed-off-by: Liu Yi L Signed-off-by: Lu Baolu --- drivers/iommu/dmar.c| 91

[PATCH v4 4/8] iommu/vt-d: Attach/detach domains in auxiliary mode

2018-11-04 Thread Lu Baolu
/detach_device() ops to support managing PASID granular translation structures when the device driver has enabled multiple domains per device. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Signed-off-by: Sanjay Kumar Signed-off-by: Lu Baolu Signed-off-by: Liu Yi L --- drivers/iommu/intel-iommu.c | 192

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

2018-05-16 Thread Lu Baolu
Hi, On 05/16/2018 04:56 PM, Tian, Kevin wrote: >> From: Lu Baolu [mailto:baolu...@linux.intel.com] >> Sent: Wednesday, May 16, 2018 4:01 PM >> >> Hi Joerg, >> >> Thank you for looking at my patches. >> >> On 05/15/2018 10:11 PM, Joerg Roedel wrote:

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

2018-05-16 Thread Lu Baolu
Hi Joerg, Thank you for looking at my patches. On 05/15/2018 10:11 PM, Joerg Roedel wrote: > On Fri, May 04, 2018 at 09:41:15AM +0800, Lu Baolu wrote: >> PATCH 4~9 implement per domain PASID table. Current per IOMMU >> PASID table implementation is insecure in the cases where >

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

2018-05-14 Thread Lu Baolu
Hi, On 05/15/2018 04:55 AM, Jacob Pan wrote: > On Mon, 14 May 2018 14:01:06 +0800 > Lu Baolu wrote: > >> Hi, >> >> On 05/12/2018 04:54 AM, Jacob Pan wrote: >>> Traditionally, device specific faults are detected and handled >>> within their own devic

Re: [PATCH v5 17/23] iommu/vt-d: report non-recoverable faults to device

2018-05-14 Thread Lu Baolu
t; #endif > - ret = dmar_set_interrupt(iommu); > + ret = dmar_set_interrupt(iommu, true); > if (ret) > goto disable_iommu; > > diff --git a/include/linux/dmar.h b/include/linux/dmar.h > index e2433bc..21f2162 100644 > --- a/include/linux/dmar.h > +++ b/include/linux/dmar.h > @@ -278,7 +278,7 @@ extern void dmar_msi_unmask(struct irq_data *data); > extern void dmar_msi_mask(struct irq_data *data); > extern void dmar_msi_read(int irq, struct msi_msg *msg); > extern void dmar_msi_write(int irq, struct msi_msg *msg); > -extern int dmar_set_interrupt(struct intel_iommu *iommu); > +extern int dmar_set_interrupt(struct intel_iommu *iommu, bool queue_fault); > extern irqreturn_t dmar_fault(int irq, void *dev_id); > extern int dmar_alloc_hwirq(int id, int node, void *arg); > extern void dmar_free_hwirq(int irq); > diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h > index 5ac0c28..b3a26c7 100644 > --- a/include/linux/intel-iommu.h > +++ b/include/linux/intel-iommu.h > @@ -472,6 +472,7 @@ struct intel_iommu { > struct iommu_device iommu; /* IOMMU core code handle */ > int node; > u32 flags; /* Software defined flags */ > + struct workqueue_struct *fault_wq; /* Reporting IOMMU fault to device */ > }; > > /* PCI domain-device relationship */ Best regards, Lu Baolu

Re: [PATCH v5 15/23] iommu: handle page response timeout

2018-05-14 Thread Lu Baolu
t means a fault might be pending there until about (2 * prq_timeout) seconds later. Out of curiosity, Why not adding a timer in iommu_fault_event, starting it in iommu_report_device_fault() and removing it in iommu_page_response()? Best regards, Lu Baolu > /** > * iommu_regis

Re: [PATCH v5 14/23] iommu: introduce page response function

2018-05-13 Thread Lu Baolu
; + msg->private_data = evt->iommu_private; > + ret = domain->ops->page_response(dev, msg); > + list_del(&evt->list); > + kfree(evt); > + break; > + } &g

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

2018-05-13 Thread Lu Baolu
iommu_dev_fault_handler_t handler, > + void *data); > + > +extern int iommu_unregister_device_fault_handler(struct device *dev); > + > +extern int iommu_report_device_fault(struct device *dev, struct > iommu_fault_event *evt); > + > extern int iommu_group_id(struct iommu_group *group); > extern struct iommu_group *iommu_group_get_for_dev(struct device *dev); > extern struct iommu_domain *iommu_group_default_domain(struct iommu_group *); > @@ -727,6 +741,23 @@ static inline int iommu_group_unregister_notifier(struct > iommu_group *group, > return 0; > } > > +static inline int iommu_register_device_fault_handler(struct device *dev, > + iommu_dev_fault_handler_t > handler, > + void *data) > +{ > + return -ENODEV; > +} > + > +static inline int iommu_unregister_device_fault_handler(struct device *dev) > +{ > + return 0; > +} > + > +static inline int iommu_report_device_fault(struct device *dev, struct > iommu_fault_event *evt) > +{ > + return -ENODEV; > +} > + > static inline int iommu_group_id(struct iommu_group *group) > { > return -ENODEV; Best regards, Lu Baolu

Re: [PATCH v5 11/23] driver core: add per device iommu param

2018-05-13 Thread Lu Baolu
The idea is to create a parent pointer under device struct and move previous iommu_group and iommu_fwspec together with the iommu fault related data into it. Best regards, Lu Baolu > > Suggested-by: Greg Kroah-Hartman > Reviewed-by: Greg Kroah-Hartman > Signed-off-by: Jacob Pan > Li

Re: [PATCH v5 09/23] iommu/vt-d: add svm/sva invalidate function

2018-05-13 Thread Lu Baolu
spin_unlock(&iommu->lock); > + spin_unlock_irqrestore(&device_domain_lock, flags); > + > + return ret; > +} > + > static int intel_iommu_map(struct iommu_domain *domain, > unsigned long iova, phys_addr_t hpa, > size_t size, int iommu_prot) > @@ -5401,6 +5529,7 @@ const struct iommu_ops intel_iommu_ops = { > #ifdef CONFIG_INTEL_IOMMU_SVM > .bind_pasid_table = intel_iommu_bind_pasid_table, > .unbind_pasid_table = intel_iommu_unbind_pasid_table, > + .sva_invalidate = intel_iommu_sva_invalidate, > #endif > .map= intel_iommu_map, > .unmap = intel_iommu_unmap, Best regards, Lu Baolu

Re: [PATCH v5 08/23] iommu/vt-d: support flushing more translation cache types

2018-05-13 Thread Lu Baolu
sh_iotlb(struct intel_iommu *iommu, u16 did, u64 addr, > unsigned int size_order, u64 type); > +extern void qi_flush_eiotlb(struct intel_iommu *iommu, u16 did, u64 addr, > + u32 pasid, unsigned int size_order, u64 type, bool > global); > extern void qi_flush_

Re: [PATCH v5 07/23] iommu/vt-d: fix dev iotlb pfsid use

2018-05-13 Thread Lu Baolu
unsigned int size_order, u64 type); > -extern void qi_flush_dev_iotlb(struct intel_iommu *iommu, u16 sid, u16 qdep, > - u64 addr, unsigned mask); > - > +extern void qi_flush_dev_iotlb(struct intel_iommu *iommu, u16 sid, u16 pfsid, > + u16 qdep, u64 addr, unsigned mask); Alignment should match open parenthesis. > extern int qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu); > > extern int dmar_ir_support(void); Best regards, Lu Baolu

Re: [PATCH v5 06/23] iommu/vt-d: add definitions for PFSID

2018-05-13 Thread Lu Baolu
o global list */ > u8 bus; /* PCI bus number */ > u8 devfn; /* PCI devfn number */ > + u16 pfsid; /* SRIOV physical function source ID */ > u8 pasid_supported:3; > u8 pasid_enabled:1; > u8 pri_supported:1; Best regards, Lu Baolu

Re: [PATCH v5 04/23] iommu/vt-d: add bind_pasid_table function

2018-05-13 Thread Lu Baolu
= intel_iommu_domain_free, > .attach_dev = intel_iommu_attach_device, > .detach_dev = intel_iommu_detach_device, > +#ifdef CONFIG_INTEL_IOMMU_SVM > + .bind_pasid_table = intel_iommu_bind_pasid_table, > + .unbind_pasid_table = intel_iommu_unbind_pasid_table, > +#endif > .map= intel_iommu_map, > .unmap = intel_iommu_unmap, > .map_sg = default_iommu_map_sg, > diff --git a/include/linux/dma_remapping.h b/include/linux/dma_remapping.h > index 21b3e7d..db290b2 100644 > --- a/include/linux/dma_remapping.h > +++ b/include/linux/dma_remapping.h > @@ -28,6 +28,7 @@ > > #define CONTEXT_DINVE(1ULL << 8) > #define CONTEXT_PRS (1ULL << 9) > +#define CONTEXT_NESTE(1ULL << 10) > #define CONTEXT_PASIDE (1ULL << 11) > > struct intel_iommu; Best regards, Lu Baolu

Re: [PATCH v5 03/23] iommu/vt-d: add a flag for pasid table bound status

2018-05-13 Thread Lu Baolu
orted:1; > u8 ats_enabled:1; > + u8 pasid_table_bound:1; Can you please add some comments here? So that, people can understand the purpose for this bit exactly. Best regards, Lu Baolu > u8 ats_qdep; > u64 fault_mask; /* selected IOMMU faults to be reported */ > struct device *dev; /* it's NULL for PCIe-to-PCI bridge */

Re: [PATCH v5 03/23] iommu/vt-d: add a flag for pasid table bound status

2018-05-13 Thread Lu Baolu
Hi, On 05/12/2018 04:53 AM, Jacob Pan wrote: > Adding a flag in device domain into to track whether a guest or typo: ^^info Best regards, Lu Baolu > user PASID table is bound to a device. > > Signed-off-by: Jacob Pan > --- > include/l

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

2018-05-04 Thread Lu Baolu
domain mapping > will trigger the MAP PSI notifications. > > Without the patchset, nested device assignment (assign one device > firstly to L1 guest, then to L2 guest) won't work for QEMU. After > applying the patchset, it works. > > Please review. Thanks. Both

[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 variab

[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 --- a/drivers/iommu/intel-iommu.c +++ b

[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 100644 --- a/drivers/iommu

[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 ++-- include/linux/intel-iommu.h | 1 - 2 files changed, 2 insertions(+), 31

[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 @@ -322,7 +322,6 @@ static

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

2018-05-03 Thread Lu Baolu
reside behind two different IOMMU units. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Suggested-by: Ashok Raj Signed-off-by: Lu Baolu Reviewed-by: Kevin Tian Reviewed-by: Liu Yi L --- drivers/iommu/Makefile | 2 +- drivers/iommu/intel-iommu.c | 13 ++ drivers

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

2018-05-03 Thread Lu Baolu
e SVM code. It's required to replace the SVM-specific idr with the global PASID idr. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Signed-off-by: Lu Baolu Reviewed-by: Kevin Tian Reviewed-by: Liu Yi L --- drivers/iommu/intel-svm.c | 14 ++ include/linux/intel-io

[PATCH v2 6/9] iommu/vt-d: Allocate and free pasid table

2018-05-03 Thread Lu Baolu
This patch allocates PASID table for a domain at the time when it is being created (if any devices using this domain supports PASID feature), and free it when the domain is freed. 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 8/9] iommu/vt-d: Use per-domain pasid table

2018-05-03 Thread Lu Baolu
-off-by: Lu Baolu Reviewed-by: Liu Yi L --- drivers/iommu/intel-iommu.c | 6 +++--- drivers/iommu/intel-svm.c | 37 + 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 5602ccd

[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 Reviewed-by: Liu Yi L --- drivers/iommu/intel-iommu.c | 6 +++--- drivers/iommu/intel-svm.c

[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 Baolu Reviewed-by: Liu Yi L --- drivers/iommu/intel-iommu.c | 22 -- 1

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

2018-05-03 Thread Lu Baolu
hieve finer protection and isolation granularity. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Suggested-by: Ashok Raj Signed-off-by: Lu Baolu Reviewed-by: Liu Yi L --- drivers/iommu/intel-pasid.c | 75 + drivers/iommu/intel-pasid.h

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

2018-05-03 Thread Lu Baolu
e can achieve finer protection and isolation granularity. Best regards, Lu Baolu Change log: v1->v2: - Patches have been reviewed by "Liu Yi L ". - An error case handling was added in PATCH 6/9. - Some commit messages are refined to be more accurate. Lu Baolu (9): iommu/vt-d: Globa

[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 Reviewed-by: Kevin Tian Reviewed-by: Liu Yi L --- drivers/iommu/intel-svm.c | 22 +++--- include/linux/intel

[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 --- drivers/iommu/intel-iommu.c | 62 +++-- include/linux/intel-iommu.h | 68

Re: [PATCHv4 2/2] iommu/vt-d: Limit number of faults to clear in irq handler

2018-05-02 Thread Lu Baolu
Hi, On 05/03/2018 10:34 AM, Dmitry Safonov wrote: > On Thu, 2018-05-03 at 10:16 +0800, Lu Baolu wrote: >> Hi, >> >> On 05/03/2018 09:59 AM, Dmitry Safonov wrote: >>> On Thu, 2018-05-03 at 09:32 +0800, Lu Baolu wrote: >>>> Hi, >>>> >>&

Re: [PATCHv4 2/2] iommu/vt-d: Limit number of faults to clear in irq handler

2018-05-02 Thread Lu Baolu
Hi, On 05/03/2018 10:16 AM, Lu Baolu wrote: > Hi, > > On 05/03/2018 09:59 AM, Dmitry Safonov wrote: >> On Thu, 2018-05-03 at 09:32 +0800, Lu Baolu wrote: >>> Hi, >>> >>> On 05/03/2018 08:52 AM, Dmitry Safonov wrote: >>>> AFAICS, we're d

Re: [PATCHv4 2/2] iommu/vt-d: Limit number of faults to clear in irq handler

2018-05-02 Thread Lu Baolu
Hi, On 05/03/2018 09:59 AM, Dmitry Safonov wrote: > On Thu, 2018-05-03 at 09:32 +0800, Lu Baolu wrote: >> Hi, >> >> On 05/03/2018 08:52 AM, Dmitry Safonov wrote: >>> AFAICS, we're doing fault-clearing in a loop inside irq handler. >>> That means that w

Re: [PATCHv4 2/2] iommu/vt-d: Limit number of faults to clear in irq handler

2018-05-02 Thread Lu Baolu
Hi, On 05/03/2018 08:52 AM, Dmitry Safonov wrote: > On Thu, 2018-05-03 at 07:49 +0800, Lu Baolu wrote: >> Hi, >> >> On 05/02/2018 08:38 PM, Dmitry Safonov wrote: >>> Hi Lu, >>> >>> On Wed, 2018-05-02 at 14:34 +0800, Lu Baolu wrote: >>>>

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

2018-05-02 Thread Lu Baolu
000 > [3.932382] cpuidle_enter_state+0xb4/0x470 > [3.936558] do_idle+0x222/0x310 > [3.939779] cpu_startup_entry+0x78/0x90 > [3.943693] start_secondary+0x205/0x2e0 > [3.947607] secondary_startup_64+0xa5/0xb0 > [3.951783] > =

Re: [PATCHv4 2/2] iommu/vt-d: Limit number of faults to clear in irq handler

2018-05-02 Thread Lu Baolu
Hi, On 05/02/2018 08:38 PM, Dmitry Safonov wrote: > Hi Lu, > > On Wed, 2018-05-02 at 14:34 +0800, Lu Baolu wrote: >> Hi, >> >> On 03/31/2018 08:33 AM, Dmitry Safonov wrote: >>> Theoretically, on some machines faults might be generated faster >>> than

Re: [PATCHv4 2/2] iommu/vt-d: Limit number of faults to clear in irq handler

2018-05-01 Thread Lu Baolu
ding registers full of faults, hence new faults will be dropped without logging? And even worse, new faults will not generate interrupts? Best regards, Lu Baolu > > Cc: Alex Williamson > Cc: David Woodhouse > Cc: Ingo Molnar > Cc: Joerg Roedel > Cc: Lu Baolu > Cc: io...

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

2018-05-01 Thread Lu Baolu
Hi, On 05/01/2018 05:24 PM, Liu, Yi L wrote: >> From: Lu Baolu [mailto:baolu...@linux.intel.com] >> Sent: Tuesday, April 17, 2018 11:03 AM >> >> The previous per iommu pasid table alloc/free interfaces >> are no longer used. Clean up the driver by removing it. >

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

2018-05-01 Thread Lu Baolu
Hi, On 05/01/2018 05:23 PM, Liu, Yi L wrote: >> From: Lu Baolu [mailto:baolu...@linux.intel.com] >> Sent: Tuesday, April 17, 2018 11:03 AM >> >> This patch replaces current per iommu pasid table with >> the new added per domain pasid table. Each svm-capable >>

Re: [PATCH 6/9] iommu/vt-d: Allocate and free pasid table

2018-05-01 Thread Lu Baolu
Hi, On 05/01/2018 05:22 PM, Liu, Yi L wrote: >> From: Lu Baolu [mailto:baolu...@linux.intel.com] >> Sent: Tuesday, April 17, 2018 11:03 AM >> >> This patch allocates PASID table for a domain at the time when >> it is being created (if any devices using this domain s

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

2018-05-01 Thread Lu Baolu
Hi Yi, Thank you very much for reviewing my patches. On 05/01/2018 05:22 PM, Liu, Yi L wrote: >> From: Lu Baolu [mailto:baolu...@linux.intel.com] >> Sent: Tuesday, April 17, 2018 11:03 AM >> >> This patch adds the interfaces for per domain pasid table >> managem

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

2018-04-16 Thread Lu Baolu
e SVM code. It's required to replace the SVM-specific idr with the global PASID idr. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Signed-off-by: Lu Baolu Reviewed-by: Kevin Tian --- drivers/iommu/intel-svm.c | 14 ++ include/linux/intel-iommu.h | 1 + 2 files c

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

2018-04-16 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 --- drivers/iommu/intel-iommu.c | 62 +++-- include/linux/intel-iommu.h | 68

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

2018-04-16 Thread Lu Baolu
hieve finer protection and isolation granularity. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Suggested-by: Ashok Raj Signed-off-by: Lu Baolu --- drivers/iommu/intel-pasid.c | 75 + drivers/iommu/intel-pasid.h | 4 +++ include/linux/

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

2018-04-16 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 Baolu --- drivers/iommu/intel-iommu.c | 22 -- 1 file changed, 8 insertions

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

2018-04-16 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 have its own pasid table. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 6 +++--- drivers/iommu

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

2018-04-16 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 --- drivers/iommu/intel-iommu.c | 6 +++--- drivers/iommu/intel-svm.c | 17

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

2018-04-16 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 Reviewed-by: Kevin Tian --- drivers/iommu/intel-svm.c | 22 +++--- include/linux/intel-iommu.h | 1 - 2

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

2018-04-16 Thread Lu Baolu
reside behind two different IOMMU units. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Suggested-by: Ashok Raj Signed-off-by: Lu Baolu Reviewed-by: Kevin Tian --- drivers/iommu/Makefile | 2 +- drivers/iommu/intel-iommu.c | 13 ++ drivers/iommu/intel-pasid.c | 60

<    1   2   3   4   5   6   7   8   9   10   >