Re: [PATCH v3 4/4] vfio/type1: Use iommu_aux_at(de)tach_group() APIs

2020-07-29 Thread Lu Baolu
Hi Alex, On 7/30/20 4:32 AM, Alex Williamson wrote: On Tue, 14 Jul 2020 13:57:03 +0800 Lu Baolu wrote: Replace iommu_aux_at(de)tach_device() with iommu_aux_at(de)tach_group(). It also saves the IOMMU_DEV_FEAT_AUX-capable physcail device in the vfio_group data structure so that it could be

Re: [PATCH v3 1/4] iommu: Check IOMMU_DEV_FEAT_AUX feature in aux api's

2020-07-29 Thread Lu Baolu
Hi Alex, On 7/30/20 4:03 AM, Alex Williamson wrote: On Tue, 14 Jul 2020 13:57:00 +0800 Lu Baolu wrote: The iommu aux-domain api's work only when IOMMU_DEV_FEAT_AUX is enabled for the device. Add this check to avoid misuse. Shouldn't this really be the IOMMU driver's respons

Re: [PATCH v3 1/1] PCI/ATS: Check PRI supported on the PF device when SRIOV is enabled

2020-07-23 Thread Lu Baolu
(pci_pasid_features) for PRI. Fixes: b16d0cb9e2fc ("iommu/vt-d: Always enable PASID/PRI PCI capabilities before ATS") Signed-off-by: Ashok Raj To: Bjorn Helgaas To: Joerg Roedel To: Lu Baolu Reviewed-by: Lu Baolu Best regards, baolu Cc: sta...@vger.kernel.org Cc: linux-...@vger.kernel.org

Re: [PATCH v3 0/4] iommu aux-domain APIs extensions

2020-07-23 Thread Lu Baolu
, baolu On 2020/7/14 13:56, Lu Baolu wrote: This series aims to extend the IOMMU aux-domain API set so that it could be more friendly to vfio/mdev usage. The interactions between vfio/mdev and iommu during mdev creation and passthr are: 1. Create a group for mdev with iommu_group_alloc(); 2. Add

Re: [PATCH 1/1] iommu/vt-d: Skip TE disabling on quirky gfx dedicated iommu

2020-07-22 Thread Lu Baolu
On 7/22/20 7:45 AM, Limonciello, Mario wrote: -Original Message- From: Lu Baolu Sent: Tuesday, July 21, 2020 6:07 PM To: Limonciello, Mario; Joerg Roedel Cc: baolu...@linux.intel.com; Ashok Raj; linux-kernel@vger.kernel.org; sta...@vger.kernel.org; Koba Ko; io...@lists.linux

[PATCH v2 1/1] iommu/vt-d: Skip TE disabling on quirky gfx dedicated iommu

2020-07-22 Thread Lu Baolu
those devices and skips TE disabling if the qurik hits. Fixes: https://bugzilla.kernel.org/show_bug.cgi?id=208363 Fixes: https://bugzilla.kernel.org/show_bug.cgi?id=206571 Tested-by: Koba Ko Tested-by: Jun Miao Cc: Ashok Raj Cc: sta...@vger.kernel.org Signed-off-by: Lu Baolu --- Change since v1

Re: [PATCH v5 3/7] iommu/vt-d: Fix PASID devTLB invalidation

2020-07-22 Thread Lu Baolu
efficient in that multiple PASIDs can be used by a single device, when tearing down a PASID entry we shall flush only the devTLB specific to a PASID. Fixes: 6f7db75e1c46 ("iommu/vt-d: Add second level page table") Signed-off-by: Jacob Pan Reviewed-by: Eric Auger Acked-by: Lu Ba

Re: Subject: Re: [PATCH 1/1] iommu/vt-d: Skip TE disabling on quirky gfx dedicated iommu

2020-07-21 Thread Lu Baolu
On 7/22/20 11:03 AM, Jun Miao wrote: On 7/22/20 10:40 AM, Lu Baolu wrote: Hi Jun, On 7/22/20 10:26 AM, Miao, Jun wrote: Kernel panic - not syncing: DMAR hardware is malfunctioning CPU: 0 PID: 347 Comm: rtcwake Not tainted 5.4.0-yocto-standard #124 Hardware name: Intel Corporation Ice Lake

[PATCH 1/1] iommu/vt-d: Rename intel-pasid.h to pasid.h

2020-07-21 Thread Lu Baolu
As Intel VT-d files have been move to its own subdirectory, the prefix makes no sense. Signed-off-by: Lu Baolu --- drivers/iommu/intel/debugfs.c | 2 +- drivers/iommu/intel/iommu.c| 2 +- drivers/iommu/intel/pasid.c| 2 +- drivers/iommu

Re: Subject: Re: [PATCH 1/1] iommu/vt-d: Skip TE disabling on quirky gfx dedicated iommu

2020-07-21 Thread Lu Baolu
Hi Jun, On 7/22/20 10:26 AM, Miao, Jun wrote: Kernel panic - not syncing: DMAR hardware is malfunctioning CPU: 0 PID: 347 Comm: rtcwake Not tainted 5.4.0-yocto-standard #124 Hardware name: Intel Corporation Ice Lake Client Platform/IceLake U DDR4 SODIMM PD RVP TLC, BIOS ICLSFWR1.R00.3162.A00.190

Re: [PATCH v4 4/7] iommu/vt-d: Handle non-page aligned address

2020-07-21 Thread Lu Baolu
checks and enforce address to be page aligned, otherwise reserved bits can be set in the invalidation descriptor. Unrecoverable fault will be reported due to non-zero value in the reserved bits. Fixes: 61a06a16e36d8 ("iommu/vt-d: Support flushing more translation cache types") Acked-by

Re: [PATCH 1/1] iommu/vt-d: Skip TE disabling on quirky gfx dedicated iommu

2020-07-21 Thread Lu Baolu
Hi Limonciello, On 7/21/20 10:44 PM, Limonciello, Mario wrote: -Original Message- From: iommu On Behalf Of Lu Baolu Sent: Monday, July 20, 2020 7:17 PM To: Joerg Roedel Cc: Ashok Raj;linux-kernel@vger.kernel.org;sta...@vger.kernel.org; Koba Ko;io...@lists.linux-foundation.org Subject

[PATCH 1/1] iommu/vt-d: Skip TE disabling on quirky gfx dedicated iommu

2020-07-20 Thread Lu Baolu
those devices and skips TE disabling if the qurik hits. Fixes: https://bugzilla.kernel.org/show_bug.cgi?id=208363 Tested-by: Koba Ko Cc: Ashok Raj Cc: sta...@vger.kernel.org Signed-off-by: Lu Baolu --- drivers/iommu/intel/dmar.c | 1 + drivers/iommu/intel/iommu.c | 27

Re: [PATCH v5 5/5] iommu/vt-d: Check UAPI data processed by IOMMU core

2020-07-16 Thread Lu Baolu
On 7/17/20 2:45 AM, Jacob Pan wrote: IOMMU generic layer already does sanity checks UAPI data for version match and argsz range under generic information. Remove the redundant version check from VT-d driver and check for vendor specific data size. Signed-off-by: Jacob Pan Reviewed-by: Lu

Re: [PATCH v3 2/4] iommu: Add iommu_aux_at(de)tach_group()

2020-07-15 Thread Lu Baolu
Hi Jacob, On 7/16/20 12:01 AM, Jacob Pan wrote: On Wed, 15 Jul 2020 08:47:36 +0800 Lu Baolu wrote: Hi Jacob, On 7/15/20 12:39 AM, Jacob Pan wrote: On Tue, 14 Jul 2020 13:57:01 +0800 Lu Baolu wrote: This adds two new aux-domain APIs for a use case like vfio/mdev where sub-devices

Re: [PATCH v3 4/4] vfio/type1: Use iommu_aux_at(de)tach_group() APIs

2020-07-14 Thread Lu Baolu
Hi Christoph and Jacob, On 7/15/20 12:29 AM, Jacob Pan wrote: On Tue, 14 Jul 2020 09:25:14 +0100 Christoph Hellwig wrote: On Tue, Jul 14, 2020 at 01:57:03PM +0800, Lu Baolu wrote: Replace iommu_aux_at(de)tach_device() with iommu_aux_at(de)tach_group(). It also saves the IOMMU_DEV_FEAT_AUX

Re: [PATCH v3 2/4] iommu: Add iommu_aux_at(de)tach_group()

2020-07-14 Thread Lu Baolu
Hi Jacob, On 7/15/20 12:39 AM, Jacob Pan wrote: On Tue, 14 Jul 2020 13:57:01 +0800 Lu Baolu wrote: This adds two new aux-domain APIs for a use case like vfio/mdev where sub-devices derived from an aux-domain capable device are created and put in an iommu_group

[PATCH v3 4/4] vfio/type1: Use iommu_aux_at(de)tach_group() APIs

2020-07-13 Thread Lu Baolu
Replace iommu_aux_at(de)tach_device() with iommu_aux_at(de)tach_group(). It also saves the IOMMU_DEV_FEAT_AUX-capable physcail device in the vfio_group data structure so that it could be reused in other places. Signed-off-by: Lu Baolu --- drivers/vfio/vfio_iommu_type1.c | 44

[PATCH v3 2/4] iommu: Add iommu_aux_at(de)tach_group()

2020-07-13 Thread Lu Baolu
, struct device *dev) It also adds a flag in the iommu_group data structure to identify an iommu_group with aux-domain attached from those normal ones. Signed-off-by: Lu Baolu --- drivers/iommu/iommu.c | 58 +++ include/linux/iommu.h | 17 + 2

[PATCH v3 1/4] iommu: Check IOMMU_DEV_FEAT_AUX feature in aux api's

2020-07-13 Thread Lu Baolu
The iommu aux-domain api's work only when IOMMU_DEV_FEAT_AUX is enabled for the device. Add this check to avoid misuse. Signed-off-by: Lu Baolu --- drivers/iommu/iommu.c | 16 +--- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/iommu/iommu.c b/drivers/

[PATCH v3 3/4] iommu: Add iommu_aux_get_domain_for_dev()

2020-07-13 Thread Lu Baolu
-by: Alex Williamson Signed-off-by: Lu Baolu --- drivers/iommu/iommu.c | 18 ++ include/linux/iommu.h | 7 +++ 2 files changed, 25 insertions(+) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index cad5a19ebf22..434bf42b6b9b 100644 --- a/drivers/iommu/iommu.c ++

[PATCH v3 0/4] iommu aux-domain APIs extensions

2020-07-13 Thread Lu Baolu
olu --- Change log: - v1->v2: - https://lore.kernel.org/linux-iommu/20200627031532.28046-1-baolu...@linux.intel.com/ - Suggested by Robin. - v2->v3: - https://lore.kernel.org/linux-iommu/20200707013957.23672-1-baolu...@linux.intel.com/ - Suggested by Alex Lu Baolu (4): iom

Re: [PATCH v3 4/4] iommu/vt-d: Add page response ops support

2020-07-10 Thread Lu Baolu
Hi Kevin, On 2020/7/10 13:49, Tian, Kevin wrote: From: Lu Baolu Sent: Friday, July 10, 2020 1:37 PM Hi Kevin, On 2020/7/10 10:42, Tian, Kevin wrote: From: Lu Baolu Sent: Thursday, July 9, 2020 3:06 PM After page requests are handled, software must respond to the device which raised the page

Re: [PATCH v3 4/4] iommu/vt-d: Add page response ops support

2020-07-09 Thread Lu Baolu
Hi Kevin, On 2020/7/10 10:42, Tian, Kevin wrote: From: Lu Baolu Sent: Thursday, July 9, 2020 3:06 PM After page requests are handled, software must respond to the device which raised the page request with the result. This is done through the iommu ops.page_response if the request was reported

Re: [PATCH v3 3/4] iommu/vt-d: Report page request faults for guest SVA

2020-07-09 Thread Lu Baolu
Hi Kevin, On 2020/7/10 10:24, Tian, Kevin wrote: From: Lu Baolu Sent: Thursday, July 9, 2020 3:06 PM A pasid might be bound to a page table from a VM guest via the iommu ops.sva_bind_gpasid. In this case, when a DMA page fault is detected on the physical IOMMU, we need to inject the page

[PATCH v3 2/4] iommu/vt-d: Add a helper to get svm and sdev for pasid

2020-07-09 Thread Lu Baolu
There are several places in the code that need to get the pointers of svm and sdev according to a pasid and device. Add a helper to achieve this for code consolidation and readability. Signed-off-by: Lu Baolu Reviewed-by: Kevin Tian --- drivers/iommu/intel/svm.c | 121

[PATCH v3 4/4] iommu/vt-d: Add page response ops support

2020-07-09 Thread Lu Baolu
of page_response ops. Co-developed-by: Jacob Pan Signed-off-by: Jacob Pan Co-developed-by: Liu Yi L Signed-off-by: Liu Yi L Signed-off-by: Lu Baolu --- drivers/iommu/intel/iommu.c | 1 + drivers/iommu/intel/svm.c | 100 include/linux/intel-iommu.h

[PATCH v3 3/4] iommu/vt-d: Report page request faults for guest SVA

2020-07-09 Thread Lu Baolu
: Liu Yi L Signed-off-by: Liu Yi L Signed-off-by: Lu Baolu --- drivers/iommu/intel/svm.c | 103 +++--- 1 file changed, 85 insertions(+), 18 deletions(-) diff --git a/drivers/iommu/intel/svm.c b/drivers/iommu/intel/svm.c index c23167877b2b..d24e71bac8db 100644

[PATCH v3 1/4] iommu/vt-d: Refactor device_to_iommu() helper

2020-07-09 Thread Lu Baolu
It is refactored in two ways: - Make it global so that it could be used in other files. - Make bus/devfn optional so that callers could ignore these two returned values when they only want to get the coresponding iommu pointer. Signed-off-by: Lu Baolu Reviewed-by: Kevin Tian --- drivers

[PATCH v3 0/4] iommu/vt-d: Add prq report and response support

2020-07-09 Thread Lu Baolu
lkml/2020/6/27/387 - Remove unnecessary pci_get_domain_bus_and_slot() - Return error when sdev == NULL in intel_svm_page_response() Lu Baolu (4): iommu/vt-d: Refactor device_to_iommu() helper iommu/vt-d: Add a helper to get svm and sdev for pasid iommu/vt-d: Report page request faults

Re: [PATCH v2 1/2] iommu: iommu_aux_at(de)tach_device() extension

2020-07-08 Thread Lu Baolu
On 2020/7/7 9:39, Lu Baolu wrote: The hardware assistant vfio mediated device is a use case of iommu aux-domain. The interactions between vfio/mdev and iommu during mdev creation and passthr are: - Create a group for mdev with iommu_group_alloc(); - Add the device to the group with

Re: [PATCH v4 1/5] docs: IOMMU user API

2020-07-08 Thread Lu Baolu
Hi Jacob, On 7/8/20 11:29 PM, Jacob Pan wrote: On Wed, 8 Jul 2020 10:07:13 +0800 Lu Baolu wrote: Hi, On 7/8/20 7:43 AM, Jacob Pan wrote: +For UAPIs that are shared with in-kernel users, a wrapper function +is provided to distinguish the callers. For example, + +Userspace caller :: + + int

Re: [PATCH v2 1/2] iommu: iommu_aux_at(de)tach_device() extension

2020-07-08 Thread Lu Baolu
Hi Alex, On 7/9/20 3:07 AM, Alex Williamson wrote: On Wed, 8 Jul 2020 10:53:12 +0800 Lu Baolu wrote: Hi Alex, Thanks a lot for your comments. Please check my reply inline. On 7/8/20 5:04 AM, Alex Williamson wrote: On Tue, 7 Jul 2020 09:39:56 +0800 Lu Baolu wrote: The hardware

Re: [PATCH v2 4/4] iommu/vt-d: Add page response ops support

2020-07-08 Thread Lu Baolu
Hi Kevin, On 7/6/20 9:47 AM, Tian, Kevin wrote: From: Lu Baolu Sent: Monday, July 6, 2020 8:26 AM After a page request is handled, software must response the device which raised the page request with the handling result. This is done through 'response' is a noun. Yes.

Re: [PATCH v2 1/2] iommu: iommu_aux_at(de)tach_device() extension

2020-07-07 Thread Lu Baolu
Hi Alex, Thanks a lot for your comments. Please check my reply inline. On 7/8/20 5:04 AM, Alex Williamson wrote: On Tue, 7 Jul 2020 09:39:56 +0800 Lu Baolu wrote: The hardware assistant vfio mediated device is a use case of iommu aux-domain. The interactions between vfio/mdev and iommu

Re: [PATCH v4 3/5] iommu/uapi: Use named union for user data

2020-07-07 Thread Lu Baolu
Hi Jacob, On 7/8/20 7:43 AM, Jacob Pan wrote: IOMMU UAPI data size is filled by the user space which must be validated by ther kernel. To ensure backward compatibility, user data can only be extended by either re-purpose padding bytes or extend the variable sized union at the end. No size change

Re: [PATCH v2 3/4] iommu/vt-d: Report page request faults for guest SVA

2020-07-07 Thread Lu Baolu
Hi Jean, On 7/7/20 7:23 PM, Jean-Philippe Brucker wrote: On Mon, Jul 06, 2020 at 08:25:34AM +0800, Lu Baolu wrote: A pasid might be bound to a page table from a VM guest via the iommu ops.sva_bind_gpasid. In this case, when a DMA page fault is detected on the physical IOMMU, we need to inject

Re: [PATCH v4 1/5] docs: IOMMU user API

2020-07-07 Thread Lu Baolu
Hi, On 7/8/20 7:43 AM, Jacob Pan wrote: +For UAPIs that are shared with in-kernel users, a wrapper function +is provided to distinguish the callers. For example, + +Userspace caller :: + + int iommu_sva_unbind_gpasid(struct iommu_domain *domain, struct device *dev, + void __user *udata) + +In-

Re: [Issue]platform/x86: iommu: System can't shutdown because iommu driver keeps checking the status of DMA_GSTS_TES

2020-07-07 Thread Lu Baolu
Hi Koba KO, On 2020/7/7 11:27, Koba Ko wrote: Dear Baolu, On Tue, Jun 30, 2020 at 3:52 PM Lu Baolu wrote: Hi Koba, On 2020/6/30 15:31, Koba Ko wrote: On Mon, Jun 15, 2020 at 3:20 PM Lu Baolu wrote: Hi Koba Ko, On 2020/6/15 11:19, Koba Ko wrote: hi All, I have a machine and there&#

[PATCH v2 0/2] iommu_aux_at(de)tach_device() enhancement

2020-07-06 Thread Lu Baolu
cording to Robin's feedback. Your comments are very appreciated. Best regards, baolu Lu Baolu (2): iommu: iommu_aux_at(de)tach_device() extension iommu: Add aux_domain_attached flag to iommu_group drivers/iommu/iommu.c | 98 + drivers/vfio/vfio_iom

[PATCH v2 2/2] iommu: Add aux_domain_attached flag to iommu_group

2020-07-06 Thread Lu Baolu
rohibit an iommu_group to go through aux-domain api's if group->domain != NULL; but we don't check aux-domain attachment in the normal attach api's. This marks an iommu_group after an aux-domain is attached, so that normal domain at(de)tach api's should never be used after that. Cc

[PATCH v2 1/2] iommu: iommu_aux_at(de)tach_device() extension

2020-07-06 Thread Lu Baolu
This extends iommu_aux_at(de)tach_device() so that the users could pass in an optional device pointer (struct device for vfio/mdev for example), and the necessary check and data link could be done. Fixes: a3a195929d40b ("iommu: Add APIs for multiple domains per device") Cc: Robin Murphy

Re: [PATCH 1/2] iommu: Add iommu_group_get/set_domain()

2020-07-06 Thread Lu Baolu
On 7/2/20 10:36 AM, Lu Baolu wrote: Hi Robin, On 7/1/20 8:18 PM, Robin Murphy wrote: On 2020-07-01 08:32, Lu Baolu wrote: Hi Robin, On 2020/7/1 0:51, Robin Murphy wrote: On 2020-06-30 02:03, Lu Baolu wrote: Hi Robin, On 6/29/20 7:56 PM, Robin Murphy wrote: On 2020-06-27 04:15, Lu Baolu

Re: [PATCH v2 3/4] iommu/vt-d: Report page request faults for guest SVA

2020-07-06 Thread Lu Baolu
On 2020/7/6 9:36, Tian, Kevin wrote: From: Tian, Kevin Sent: Monday, July 6, 2020 9:30 AM From: Lu Baolu Sent: Monday, July 6, 2020 8:26 AM A pasid might be bound to a page table from a VM guest via the iommu ops.sva_bind_gpasid. In this case, when a DMA page fault is detected on the

Re: [PATCH v2 3/4] iommu/vt-d: Report page request faults for guest SVA

2020-07-06 Thread Lu Baolu
Hi Kevin, On 2020/7/6 9:29, Tian, Kevin wrote: From: Lu Baolu Sent: Monday, July 6, 2020 8:26 AM A pasid might be bound to a page table from a VM guest via the iommu ops.sva_bind_gpasid. In this case, when a DMA page fault is detected on the physical IOMMU, we need to inject the page fault

[PATCH v2 3/4] iommu/vt-d: Report page request faults for guest SVA

2020-07-05 Thread Lu Baolu
Signed-off-by: Lu Baolu --- drivers/iommu/intel/svm.c | 99 --- 1 file changed, 81 insertions(+), 18 deletions(-) diff --git a/drivers/iommu/intel/svm.c b/drivers/iommu/intel/svm.c index c23167877b2b..08c58c2b1a06 100644 --- a/drivers/iommu/intel/svm.c +++ b

[PATCH v2 4/4] iommu/vt-d: Add page response ops support

2020-07-05 Thread Lu Baolu
implementation of page_response ops. Co-developed-by: Jacob Pan Signed-off-by: Jacob Pan Co-developed-by: Liu Yi L Signed-off-by: Liu Yi L Signed-off-by: Lu Baolu --- drivers/iommu/intel/iommu.c | 1 + drivers/iommu/intel/svm.c | 74 + include/linux/intel

[PATCH v2 2/4] iommu/vt-d: Add a helper to get svm and sdev for pasid

2020-07-05 Thread Lu Baolu
There are several places in the code that need to get the pointers of svm and sdev according to a pasid and device. Add a helper to achieve this for code consolidation and readability. Signed-off-by: Lu Baolu --- drivers/iommu/intel/svm.c | 121 +- 1 file

[PATCH v2 1/4] iommu/vt-d: Refactor device_to_iommu() helper

2020-07-05 Thread Lu Baolu
It is refactored in two ways: - Make it global so that it could be used in other files. - Make bus/devfn optional so that callers could ignore these two returned values when they only want to get the coresponding iommu pointer. Signed-off-by: Lu Baolu --- drivers/iommu/intel/iommu.c | 55

[PATCH v2 0/4] iommu/vt-d: Add prq report and response support

2020-07-05 Thread Lu Baolu
Remove unnecessary pci_get_domain_bus_and_slot() - Return error when sdev == NULL in intel_svm_page_response() Lu Baolu (4): iommu/vt-d: Refactor device_to_iommu() helper iommu/vt-d: Add a helper to get svm and sdev for pasid iommu/vt-d: Report page request faults for guest SVA iommu/vt-d: Ad

Re: [PATCH 1/2] iommu: Add iommu_group_get/set_domain()

2020-07-01 Thread Lu Baolu
Hi Robin, On 7/1/20 8:18 PM, Robin Murphy wrote: On 2020-07-01 08:32, Lu Baolu wrote: Hi Robin, On 2020/7/1 0:51, Robin Murphy wrote: On 2020-06-30 02:03, Lu Baolu wrote: Hi Robin, On 6/29/20 7:56 PM, Robin Murphy wrote: On 2020-06-27 04:15, Lu Baolu wrote: The hardware assistant vfio

Re: [PATCH 1/2] iommu: Add iommu_group_get/set_domain()

2020-07-01 Thread Lu Baolu
Hello, On 7/1/20 8:18 PM, Robin Murphy wrote: On 2020-07-01 08:32, Lu Baolu wrote: Hi Robin, On 2020/7/1 0:51, Robin Murphy wrote: On 2020-06-30 02:03, Lu Baolu wrote: Hi Robin, On 6/29/20 7:56 PM, Robin Murphy wrote: On 2020-06-27 04:15, Lu Baolu wrote: The hardware assistant vfio

Re: [PATCH v3 6/7] iommu/vt-d: Warn on out-of-range invalidation address

2020-07-01 Thread Lu Baolu
patch relax the fault handling from error to warning and proceed with invalidation request with the given mask. Signed-off-by: Jacob Pan Fixes: 6ee1b77ba3ac0 ("iommu/vt-d: Add svm/sva invalidate function") Acked-by: Lu Baolu Best regards, baolu --- drivers/iommu/intel/iommu.c | 7 +

Re: [PATCH v3 3/7] iommu/vt-d: Fix PASID devTLB invalidation

2020-07-01 Thread Lu Baolu
efficient in that multiple PASIDs can be used by a single device, when tearing down a PASID entry we shall flush only the devTLB specific to a PASID. Fixes: 6f7db75e1c46 ("iommu/vt-d: Add second level page table") Signed-off-by: Jacob Pan Acked-by: Lu Baolu Best regards, baolu ---

Re: [PATCH 1/2] iommu: Add iommu_group_get/set_domain()

2020-07-01 Thread Lu Baolu
Hi Robin, On 2020/7/1 0:51, Robin Murphy wrote: On 2020-06-30 02:03, Lu Baolu wrote: Hi Robin, On 6/29/20 7:56 PM, Robin Murphy wrote: On 2020-06-27 04:15, Lu Baolu wrote: The hardware assistant vfio mediated device is a use case of iommu aux-domain. The interactions between vfio/mdev and

Re: [PATCH 4/4] iommu/vt-d: Add page response ops support

2020-06-30 Thread Lu Baolu
Hi Kevin, On 6/30/20 2:19 PM, Tian, Kevin wrote: From: Lu Baolu Sent: Sunday, June 28, 2020 8:34 AM After a page request is handled, software must response the device which raised the page request with the handling result. This is done through the iommu ops.page_response if the request was

Re: [PATCH 3/4] iommu/vt-d: Report page request faults for guest SVA

2020-06-30 Thread Lu Baolu
Hi Kevin, Thanks a lot for reviewing my patches. On 6/30/20 2:01 PM, Tian, Kevin wrote: From: Lu Baolu Sent: Sunday, June 28, 2020 8:34 AM A pasid might be bound to a page table from a VM guest via the iommu ops.sva_bind_gpasid. In this case, when a DMA page fault is detected on the physical

Re: [PATCH v2 1/2] iommu/vt-d: Move Kconfig and Makefile bits down into intel directory

2020-06-30 Thread Lu Baolu
Hi Jerry, On 7/1/20 4:06 AM, Jerry Snitselaar wrote: Move Intel Kconfig and Makefile bits down into intel directory with the rest of the Intel specific files. Cc: Joerg Roedel Cc: Lu Baolu Reviewed-by: Lu Baolu Best regards, baolu Signed-off-by: Jerry Snitselaar --- drivers/iommu

Re: [PATCH 6/7] iommu/vt-d: Warn on out-of-range invalidation address

2020-06-30 Thread Lu Baolu
Hi Jacob, On 7/1/20 1:34 AM, Jacob Pan wrote: On Thu, 25 Jun 2020 18:10:43 +0800 Lu Baolu wrote: Hi, On 2020/6/23 23:43, Jacob Pan wrote: For guest requested IOTLB invalidation, address and mask are provided as part of the invalidation data. VT-d HW silently ignores any address bits below

Re: [PATCH v2 5/7] iommu/vt-d: Fix devTLB flush for vSVA

2020-06-30 Thread Lu Baolu
7ba3ac ("iommu/vt-d: Add svm/sva invalidate function") Signed-off-by: Liu Yi L Signed-off-by: Jacob Pan Acked-by: Lu Baolu Best regards, baolu --- drivers/iommu/intel/iommu.c | 28 ++-- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/dri

Re: [PATCH v2 4/7] iommu/vt-d: Handle non-page aligned address

2020-06-30 Thread Lu Baolu
reserved bits can be set in the invalidation descriptor. Unrecoverable fault will be reported due to non-zero value in the reserved bits. Signed-off-by: Liu Yi L Signed-off-by: Jacob Pan Fixes: 61a06a16e36d8 ("iommu/vt-d: Support flushing more translation cache types") Acked-by: Lu Ba

Re: [PATCH v2 3/7] iommu/vt-d: Fix PASID devTLB invalidation

2020-06-30 Thread Lu Baolu
Hi Jacob, On 7/1/20 5:07 AM, Jacob Pan wrote: DevTLB flush can be used for both DMA request with and without PASIDs. The former uses PASID#0 (RID2PASID), latter uses non-zero PASID for SVA usage. This patch adds a check for PASID value such that devTLB flush with PASID is used for SVA case. Thi

Re: [Issue]platform/x86: iommu: System can't shutdown because iommu driver keeps checking the status of DMA_GSTS_TES

2020-06-30 Thread Lu Baolu
Hi Koba, On 2020/6/30 15:31, Koba Ko wrote: On Mon, Jun 15, 2020 at 3:20 PM Lu Baolu wrote: Hi Koba Ko, On 2020/6/15 11:19, Koba Ko wrote: hi All, I have a machine and there's only intel gpu. the secureboot and vt-d is enabled in BIOS. On the Ubuntu desktop, I do s2idle first and re

Re: [PATCH v2 6/7] PCI: Move pci_dev->untrusted logic to use device location instead

2020-06-30 Thread Lu Baolu
sing the same "ExternalFacing" firmware info. Any device not behind the "ExternalFacing" bridges are marked internal and the ones behind such bridges are markes external. Signed-off-by: Rajat Jain For changes in Intel VT-d driver, Reviewed-by: Lu Baolu Best regards, baolu ---

Re: [PATCH v2 2/7] PCI: Set "untrusted" flag for truly external devices only

2020-06-30 Thread Lu Baolu
d then use it to mark any downstream devices as "untrusted". The external-facing devices themselves are left as "trusted". This was discussed here: https://lkml.org/lkml/2020/6/10/1049 Signed-off-by: Rajat Jain For changes in Intel VT-d driver, Reviewed-by: Lu Baolu

Re: [PATCH 1/2] iommu: Add iommu_group_get/set_domain()

2020-06-29 Thread Lu Baolu
Hi Robin, On 6/29/20 7:56 PM, Robin Murphy wrote: On 2020-06-27 04:15, Lu Baolu wrote: The hardware assistant vfio mediated device is a use case of iommu aux-domain. The interactions between vfio/mdev and iommu during mdev creation and passthr are: - Create a group for mdev with

[PATCH 4/4] iommu/vt-d: Add page response ops support

2020-06-27 Thread Lu Baolu
implementation of page_response ops. Co-developed-by: Jacob Pan Signed-off-by: Jacob Pan Co-developed-by: Liu Yi L Signed-off-by: Liu Yi L Signed-off-by: Lu Baolu --- drivers/iommu/intel/iommu.c | 1 + drivers/iommu/intel/svm.c | 73 + include/linux/intel

[PATCH 0/4] iommu/vt-d: Add prq report and response support

2020-06-27 Thread Lu Baolu
->sva_bind_gpasid() api, the page requests should be routed to the guest, and after the page is served, the device should be responded with the result. Your review comments are very appreciated. Best regards, baolu Lu Baolu (4): iommu/vt-d: Refactor device_to_iommu() helper iommu/vt-d: Add a hel

[PATCH 2/4] iommu/vt-d: Add a helper to get svm and sdev for pasid

2020-06-27 Thread Lu Baolu
There are several places in the code that need to get the pointers of svm and sdev according to a pasid and device. Add a helper to achieve this for code consolidation and readability. Signed-off-by: Lu Baolu --- drivers/iommu/intel/svm.c | 121 +- 1 file

[PATCH 1/4] iommu/vt-d: Refactor device_to_iommu() helper

2020-06-27 Thread Lu Baolu
It is refactored in two ways: - Make it global so that it could be used in other files. - Make bus/devfn optional so that callers could ignore these two returned values when they only want to get the coresponding iommu pointer. Signed-off-by: Lu Baolu --- drivers/iommu/intel/iommu.c | 55

[PATCH 3/4] iommu/vt-d: Report page request faults for guest SVA

2020-06-27 Thread Lu Baolu
Signed-off-by: Lu Baolu --- drivers/iommu/intel/svm.c | 83 +-- 1 file changed, 80 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/intel/svm.c b/drivers/iommu/intel/svm.c index c23167877b2b..4800bb6f8794 100644 --- a/drivers/iommu/intel/svm.c +++ b

[PATCH 2/2] vfio/type1: Update group->domain after aux attach and detach

2020-06-26 Thread Lu Baolu
Update group->domain whenever an aux-domain is attached to or detached from a mediated device. Without this change, iommu_get_domain_for_dev() will be broken for mdev devices. Fixes: 7bd50f0cd2fd5 ("vfio/type1: Add domain at(de)taching group helpers") Signed-off-by: Lu Baolu ---

[PATCH 1/2] iommu: Add iommu_group_get/set_domain()

2020-06-26 Thread Lu Baolu
t, iommu_get_domain_for_dev() doesn't work anymore. This adds iommu_group_get/set_domain() so that group->domain could be managed whenever a domain is attached or detached through the aux-domain api's. Fixes: 7bd50f0cd2fd5 ("vfio/type1: Add domain at(de)taching group helpers&

Re: [PATCH v4 12/12] x86/traps: Fix up invalid PASID

2020-06-25 Thread Lu Baolu
SR is already initialized, then the #GP was for some other reason 3) Try initializing the PASID MSR and returning. If the #GP was from an ENQCMD this will fix it. If not, the #GP fault will be repeated and will hit case "2". For changes in Intel VT-d driver, Reviewed-by: Lu Baolu

Re: [PATCH v4 01/12] iommu: Change type of pasid to u32

2020-06-25 Thread Lu Baolu
"u32" is also shorter and a little more explicit than "unsigned int". For changes in Intel VT-d driver, Reviewed-by: Lu Baolu Best regards, baolu No PASID type change in uapi although it defines PASID as __u64 in some places. Suggested-by: Thomas Gleixner Signed-off-by

Re: [PATCH v4 10/12] x86/mmu: Allocate/free PASID

2020-06-25 Thread Lu Baolu
exits (so no need to keep reference counts on how many SVM devices are sharing the PASID). For changes in Intel VT-d driver, Reviewed-by: Lu Baolu Best regards, baolu Signed-off-by: Fenghua Yu Reviewed-by: Tony Luck --- v4: - Change PASID type to u32 (Christoph) v3: - Add sanity

Re: [PATCH v4 02/12] iommu/vt-d: Change flags type to unsigned int in binding mm

2020-06-25 Thread Lu Baolu
Hi Fenghua, On 2020/6/26 4:17, Fenghua Yu wrote: "flags" passed to intel_svm_bind_mm() is a bit mask and should be defined as "unsigned int" instead of "int". Change its type to "unsigned int". Reviewed-by: Lu Baolu Best regards, baolu Sugg

Re: [PATCH 02/13] iommu/vt-d: Use dev_iommu_priv_get/set()

2020-06-25 Thread Lu Baolu
ers/iommu/intel/iommu.c| 18 +- For changes in VT-d driver, Reviewed-by: Lu Baolu Best regards, baolu 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/i915/selftests/mock_gem_device.c b/drivers/gpu/drm/i915/selfte

Re: [PATCH v3 5/5] iommu/uapi: Support both kernel and user unbind guest PASID

2020-06-25 Thread Lu Baolu
Hi Jacob, On 2020/6/24 1:03, Jacob Pan wrote: +int __iommu_sva_unbind_gpasid(struct iommu_domain *domain, struct device *dev, + struct iommu_gpasid_bind_data *data) { if (unlikely(!domain->ops->sva_unbind_gpasid)) return -ENODEV; - return domain

Re: [PATCH 7/7] iommu/vt-d: Disable multiple GPASID-dev bind

2020-06-25 Thread Lu Baolu
available. Overall, the complexity and potential glitch do not warrant this unlikely use case thereby removed by this patch. Cc: Kevin Tian Cc: Lu Baolu Signed-off-by: Liu Yi L Signed-off-by: Jacob Pan Fixes: 56722a4398a30 ("iommu/vt-d: Add bind guest PASID support") Acked-by: Lu Ba

Re: [PATCH 6/7] iommu/vt-d: Warn on out-of-range invalidation address

2020-06-25 Thread Lu Baolu
Hi, On 2020/6/23 23:43, Jacob Pan wrote: For guest requested IOTLB invalidation, address and mask are provided as part of the invalidation data. VT-d HW silently ignores any address bits below the mask. SW shall also allow such case but give warning if address does not align with the mask. This

Re: [PATCH 4/7] iommu/vt-d: Handle non-page aligned address

2020-06-25 Thread Lu Baolu
Hi, On 2020/6/23 23:43, Jacob Pan wrote: From: Liu Yi L Address information for device TLB invalidation comes from userspace when device is directly assigned to a guest with vIOMMU support. VT-d requires page aligned address. This patch checks and enforce address to be page aligned, otherwise

Re: [PATCH 3/7] iommu/vt-d: Fix PASID devTLB invalidation

2020-06-25 Thread Lu Baolu
On 2020/6/23 23:43, Jacob Pan wrote: DevTLB flush can be used for both DMA request with and without PASIDs. The former uses PASID#0 (RID2PASID), latter uses non-zero PASID for SVA usage. This patch adds a check for PASID value such that devTLB flush with PASID is used for SVA case. This is more

Re: [PATCH 2/7] iommu/vt-d: Remove global page support in devTLB flush

2020-06-25 Thread Lu Baolu
On 2020/6/23 23:43, Jacob Pan wrote: Global pages support is removed from VT-d spec 3.0 for dev TLB invalidation. This patch is to remove the bits for vSVA. Similar change already made for the native SVA. See the link below. Acked-by: Lu Baolu Best regards, baolu Link: https://lkml.org

Re: [PATCH 1/7] iommu/vt-d: Enforce PASID devTLB field mask

2020-06-25 Thread Lu Baolu
On 2020/6/23 23:43, Jacob Pan wrote: From: Liu Yi L Set proper masks to avoid invalid input spillover to reserved bits. Acked-by: Lu Baolu Best regards, baolu Signed-off-by: Liu Yi L Signed-off-by: Jacob Pan --- include/linux/intel-iommu.h | 4 ++-- 1 file changed, 2 insertions

Re: [PATCH v3 4/5] iommu/uapi: Handle data and argsz filled by users

2020-06-25 Thread Lu Baolu
On 2020/6/25 1:07, Jacob Pan wrote: On Wed, 24 Jun 2020 14:54:49 +0800 Lu Baolu wrote: Hi Jacob, On 2020/6/24 1:03, Jacob Pan wrote: IOMMU UAPI data has a user filled argsz field which indicates the data length comes with the API call. User data is not trusted, argsz must be validated based

Re: [PATCH v3 5/5] iommu/uapi: Support both kernel and user unbind guest PASID

2020-06-24 Thread Lu Baolu
Hi Jacob, On 2020/6/24 1:03, Jacob Pan wrote: Guest SVA unbind data can come from either kernel and user space, if a either kernel or user space user pointer is passed in, IOMMU driver must copy from data from user. copy data from user If the unbind data is assembled in kernel, data can

Re: [PATCH v3 4/5] iommu/uapi: Handle data and argsz filled by users

2020-06-23 Thread Lu Baolu
Hi Jacob, On 2020/6/24 1:03, Jacob Pan wrote: IOMMU UAPI data has a user filled argsz field which indicates the data length comes with the API call. User data is not trusted, argsz must be validated based on the current kernel data size, mandatory data size, and feature flags. User data may als

Re: [PATCH v3 3/5] iommu/uapi: Use named union for user data

2020-06-23 Thread Lu Baolu
GRANU_ADDR && size && - (inv_info->addr_info.addr & ((BIT(VTD_PAGE_SHIFT + size)) - 1))) { + (inv_info->granu.addr_info.addr & ((BIT(VTD_PAGE_SHIFT + size)) - 1))) { Nit: Keep it a

[PATCH 1/1] iommu/vt-d: Fix misuse of iommu_domain_identity_map()

2020-06-18 Thread Lu Baolu
The iommu_domain_identity_map() helper takes start/end PFN as arguments. Fix a misuse case where the start and end addresses are passed. Fixes: e70b081c6f376 ("iommu/vt-d: Remove IOVA handling code from the non-dma_ops path") Cc: Tom Murphy Reported-by: Alex Williamson Signed-off-by

Re: [Issue]platform/x86: iommu: System can't shutdown because iommu driver keeps checking the status of DMA_GSTS_TES

2020-06-15 Thread Lu Baolu
Hi Koba Ko, On 2020/6/15 11:19, Koba Ko wrote: hi All, I have a machine and there's only intel gpu. the secureboot and vt-d is enabled in BIOS. On the Ubuntu desktop, I do s2idle first and restart the machine. The machine can't restart successfully, so I need to press the power button to shutdo

Re: [PATCH v2 11/12] x86/mmu: Allocate/free PASID

2020-06-14 Thread Lu Baolu
Hi Fenghua, On 6/13/20 8:41 AM, Fenghua Yu wrote: A PASID is allocated for an "mm" the first time any thread attaches to an SVM capable device. Later device attachments (whether to the same device or another SVM device) will re-use the same PASID. The PASID is freed when the process exits (so n

Re: [PATCH v2 11/12] x86/mmu: Allocate/free PASID

2020-06-13 Thread Lu Baolu
Hi Fenghua, On 2020/6/13 8:41, Fenghua Yu wrote: A PASID is allocated for an "mm" the first time any thread attaches to an SVM capable device. Later device attachments (whether to the same device or another SVM device) will re-use the same PASID. The PASID is freed when the process exits (so no

Re: [PATCH v2 04/12] docs: x86: Add documentation for SVA (Shared Virtual Addressing)

2020-06-13 Thread Lu Baolu
Hi Fenghua, On 2020/6/13 8:41, Fenghua Yu wrote: From: Ashok Raj ENQCMD and Data Streaming Accelerator (DSA) and all of their associated features are a complicated stack with lots of interconnected pieces. This documentation provides a big picture overview for all of the features. Signed-off-

Re: [PATCH 1/2] iommu/vt-d: Move Kconfig and Makefile bits down into intel directory

2020-06-12 Thread Lu Baolu
Hi Jerry, On 2020/6/13 7:10, Jerry Snitselaar wrote: Move Intel Kconfig and Makefile bits down into intel directory with the rest of the Intel specific files. Cc: Joerg Roedel Cc: Lu Baolu Thanks! Reviewed-by: Lu Baolu Best regards, baolu Signed-off-by: Jerry Snitselaar --- drivers

Re: [PATCH v2 1/3] docs: IOMMU user API

2020-06-10 Thread Lu Baolu
Hi Jacob, On 2020/6/11 12:12, Jacob Pan wrote: IOMMU UAPI is newly introduced to support communications between guest virtual IOMMU and host IOMMU. There has been lots of discussions on how it should work with VFIO UAPI and userspace in general. This document is indended to clarify the UAPI des

Re: [PATCH v2 2/2] iommu/vt-d: Move Intel IOMMU driver into subdirectory

2020-06-09 Thread Lu Baolu
Hi Joerg, On 6/9/20 9:03 PM, Joerg Roedel wrote: From: Joerg Roedel Move all files related to the Intel IOMMU driver into its own subdirectory. Signed-off-by: Joerg Roedel Reviewed-by: Jerry Snitselaar Reviewed-by: Lu Baolu Best regards, baolu --- MAINTAINERS

[PATCH 1/1] iommu/vt-d: Update scalable mode paging structure coherency

2020-06-08 Thread Lu Baolu
so that paging structure updates could be manually flushed from the cache line if hardware page walking is not snooped. Fixes: 765b6a98c1de3 ("iommu/vt-d: Enumerate the scalable mode capability") Cc: Ashok Raj Cc: Kevin Tian Cc: Jacob Pan Signed-off-by: Lu Baolu --- drivers/iommu/int

[PATCH 1/1] iommu/vt-d: Enable PCI ACS for platform opt in hint

2020-06-08 Thread Lu Baolu
Signed-off-by: Lalithambika Krishnakumar Signed-off-by: Lu Baolu --- drivers/iommu/dmar.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c index 60a2970c37ff..9e3e9067a71d 100644 --- a/drivers/iommu/dmar.c +++ b/drivers/iommu/d

Re: [PATCH 0/2] iommu: Move Intel and AMD drivers into their own subdirectory

2020-06-03 Thread Lu Baolu
Hi Joerg, On 6/2/20 5:26 PM, Joerg Roedel wrote: Hi, two small patches to move the Intel and AMD IOMMU drivers into their own subdirectory under drivers/iommu/ to make the file structure a bit less cluttered. Does the MAINTAINERS file need to update? Best regards, baolu Regards,

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