Re: [PATCH] iommu/vt-d: avoid unnecessory panic if iommu init fail in tboot

2020-11-08 Thread Lu Baolu
Hi Zhenzhong, On 11/9/20 10:27 AM, Zhenzhong Duan wrote: +intel iommu maintainers, Can anyone help review this patch? Thanks Zhenzhong On Wed, Nov 4, 2020 at 4:15 PM Zhenzhong Duan wrote: "intel_iommu=off" command line is used to disable iommu and iommu is force enabled in a tboot system.

Re: [PATCH] iommu/vt-d: remove redundant variable no_platform_optin

2020-11-04 Thread Lu Baolu
Hi Zhenzhong, On 11/4/20 4:19 PM, Zhenzhong Duan wrote: no_platform_optin is redundant with dmar_disabled and it's only used in platform_optin_force_iommu(), remove it and use dmar_disabled instead. It's actually not. If CONFIG_INTEL_IOMMU_DEFAULT_ON is not set, we will get "dmar_disable =

Re: [PATCH 1/1] iommu: Fix deferred domain attachment in iommu_probe_device()

2020-11-03 Thread Lu Baolu
Hi Joerg, On 11/3/20 9:23 PM, Joerg Roedel wrote: Hi Baolu, On Mon, Oct 26, 2020 at 02:30:08PM +0800, Lu Baolu wrote: @@ -264,7 +266,8 @@ int iommu_probe_device(struct device *dev) */ iommu_alloc_default_domain(group, dev); - if (group->default_domain) + if (gr

Re: [PATCH v6 5/5] vfio/type1: Use mdev bus iommu_ops for IOMMU callbacks

2020-11-02 Thread Lu Baolu
Hi Alex, On 10/31/20 5:06 AM, Alex Williamson wrote: On Fri, 30 Oct 2020 06:16:28 + "Tian, Kevin" wrote: From: Lu Baolu Sent: Friday, October 30, 2020 12:58 PM With the IOMMU driver registering iommu_ops for the mdev_bus, the IOMMU operations on an mdev could be done in th

Re: [PATCH v4 0/7] Convert the intel iommu driver to the dma-iommu api

2020-11-02 Thread Lu Baolu
On 11/2/20 7:52 PM, Tvrtko Ursulin wrote: On 02/11/2020 02:00, Lu Baolu wrote: Hi Tvrtko, On 10/12/20 4:44 PM, Tvrtko Ursulin wrote: On 29/09/2020 01:11, Lu Baolu wrote: Hi Tvrtko, On 9/28/20 5:44 PM, Tvrtko Ursulin wrote: On 27/09/2020 07:34, Lu Baolu wrote: Hi, The previous post

Re: [PATCH v4 0/7] Convert the intel iommu driver to the dma-iommu api

2020-11-01 Thread Lu Baolu
Hi Tvrtko, On 10/12/20 4:44 PM, Tvrtko Ursulin wrote: On 29/09/2020 01:11, Lu Baolu wrote: Hi Tvrtko, On 9/28/20 5:44 PM, Tvrtko Ursulin wrote: On 27/09/2020 07:34, Lu Baolu wrote: Hi, The previous post of this series could be found here. https://lore.kernel.org/linux-iommu

Re: [PATCH v2 2/2] iommu/vt-d: Fix a bug for PDP check in prq_event_thread

2020-10-30 Thread Lu Baolu
-off-by: Liu, Yi L Signed-off-by: Yi Sun Cc: sta...@ver.kernel.org Acked-by: Lu Baolu Best regards, 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 7584669..3242ebd 100644

Re: [PATCH v2 1/2] iommu/vt-d: Fix sid not set issue in intel_svm_bind_gpasid()

2020-10-30 Thread Lu Baolu
igned-off-by: Yi Sun Cc: sta...@ver.kernel.org Acked-by: Lu Baolu Best regards, baolu --- drivers/iommu/intel/svm.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/iommu/intel/svm.c b/drivers/iommu/intel/svm.c index f1861fa..7584669 100644 --- a/drivers/iommu/intel/svm

[PATCH v6 5/5] vfio/type1: Use mdev bus iommu_ops for IOMMU callbacks

2020-10-29 Thread Lu Baolu
With the IOMMU driver registering iommu_ops for the mdev_bus, the IOMMU operations on an mdev could be done in the same way as any normal device (for example, PCI/PCIe). There's no need to distinguish an mdev from others for iommu operations. Remove the unnecessary code. Signed-off-by: Lu Baolu

[PATCH v6 0/5] iommu aux-domain APIs extensions

2020-10-29 Thread Lu Baolu
regards, baolu Lu Baolu (5): vfio/mdev: Register mdev bus earlier during boot iommu: Use bus iommu ops for aux related callback iommu/vt-d: Make some static functions global iommu/vt-d: Add iommu_ops support for subdevice bus vfio/type1: Use mdev bus iommu_ops for IOMMU callbacks drivers

[PATCH v6 2/5] iommu: Use bus iommu ops for aux related callback

2020-10-29 Thread Lu Baolu
The aux-domain apis were designed for macro driver where the subdevices are created and used inside a device driver. Use the device's bus iommu ops instead of that in iommu domain for various callbacks. Signed-off-by: Lu Baolu --- drivers/iommu/iommu.c | 16 ++-- 1 file changed, 10

[PATCH v6 1/5] vfio/mdev: Register mdev bus earlier during boot

2020-10-29 Thread Lu Baolu
Move mdev bus registration earlier than IOMMU probe processing so that the IOMMU drivers could be able to set iommu_ops for the mdev bus. This only applies when vfio-mdev module is setected to be built-in. Signed-off-by: Lu Baolu --- drivers/vfio/mdev/mdev_core.c | 4 1 file changed, 4

[PATCH v6 3/5] iommu/vt-d: Make some static functions global

2020-10-29 Thread Lu Baolu
So that they could be used in other files as well. No functional changes. Signed-off-by: Lu Baolu --- drivers/iommu/intel/iommu.c | 74 +++-- include/linux/intel-iommu.h | 49 2 files changed, 62 insertions(+), 61 deletions(-) diff --git

[PATCH v6 4/5] iommu/vt-d: Add iommu_ops support for subdevice bus

2020-10-29 Thread Lu Baolu
as an aux-domain; Otherwise, it will be attached to the parent as a primary domain. Signed-off-by: Lu Baolu --- drivers/iommu/intel/Kconfig | 13 drivers/iommu/intel/Makefile | 1 + drivers/iommu/intel/iommu.c | 5 ++ drivers/iommu/intel/siov.c | 119

[PATCH 1/1] iommu: Fix deferred domain attachment in iommu_probe_device()

2020-10-26 Thread Lu Baolu
The IOMMU core has support for deferring the attachment of default domain to device. Fix a missed deferred attaching check in iommu_probe_device(). Fixes: cf193888bfbd3 ("iommu: Move new probe_device path to separate function") Cc: sta...@vger.kernel.org # v5.8+ Signed-off-by

Re: [PATCH next] iommu: intel: don't dereference iommu_device if IOMMU_API is not built

2020-10-14 Thread Lu Baolu
Hi Bartosz, On 10/14/20 3:18 PM, Bartosz Golaszewski wrote: On Wed, Oct 14, 2020 at 2:49 AM Lu Baolu wrote: On 10/13/20 3:30 PM, Bartosz Golaszewski wrote: From: Bartosz Golaszewski Since commit c40c1018 ("iommu/vt-d: Gracefully handle DMAR units with no supported address w

Re: [PATCH next] iommu: intel: don't dereference iommu_device if IOMMU_API is not built

2020-10-13 Thread Lu Baolu
szewski With commit title adjusted to "iommu/vt-d: Don't dereference iommu_device if IOMMU_API is not built", Acked-by: Lu Baolu Best regards, baolu --- drivers/iommu/intel/dmar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/intel/dmar.c

Re: [PATCH next] iommu: intel: make DMAR_TABLE select IOMMU_API

2020-10-12 Thread Lu Baolu
Hi, On 10/12/20 8:31 PM, Bartosz Golaszewski wrote: From: Bartosz Golaszewski Since commit c40c1018 ("iommu/vt-d: Gracefully handle DMAR units with no supported address widths") dmar.c needs struct iommu_device to be defined. We need to unconditionally select IOMMU_API when DMAR_TABLE is

Re: [PATCH v4 0/7] Convert the intel iommu driver to the dma-iommu api

2020-10-12 Thread Lu Baolu
Hi Tvrtko, On 10/12/20 4:44 PM, Tvrtko Ursulin wrote: On 29/09/2020 01:11, Lu Baolu wrote: Hi Tvrtko, On 9/28/20 5:44 PM, Tvrtko Ursulin wrote: On 27/09/2020 07:34, Lu Baolu wrote: Hi, The previous post of this series could be found here. https://lore.kernel.org/linux-iommu

Re: [PATCH v3 0/2] Add support for ACPI device in RMRR

2020-10-11 Thread Lu Baolu
Hi Felix, On 10/10/20 4:02 PM, FelixCuioc wrote: BIOS allocate reserved memory ranges that may be DMA targets. BIOS may report each such reserved memory region through the RMRR structures,along with the devices that requires access to the specified reserved memory region. The purpose of this

Re: [PATCH v4 0/7] Convert the intel iommu driver to the dma-iommu api

2020-10-02 Thread Lu Baolu
Hi Joerg, On 2020/10/1 20:17, Joerg Roedel wrote: Hi Baolu, On Tue, Sep 29, 2020 at 08:11:35AM +0800, Lu Baolu wrote: I have no preference. It depends on which patch goes first. Let the maintainers help here. No preference on my side, except that it is too late for this now to make

Re: [PATCH v4 0/7] Convert the intel iommu driver to the dma-iommu api

2020-09-28 Thread Lu Baolu
Hi Tvrtko, On 9/28/20 5:44 PM, Tvrtko Ursulin wrote: On 27/09/2020 07:34, Lu Baolu wrote: Hi, The previous post of this series could be found here. https://lore.kernel.org/linux-iommu/20200912032200.11489-1-baolu...@linux.intel.com/ This version introduce a new patch [4/7] to fix

[PATCH v4 1/7] iommu: Handle freelists when using deferred flushing in iommu drivers

2020-09-27 Thread Lu Baolu
table pages can be freed. This way we can still batch ioTLB free operations and handle the freelists. Signed-off-by: Tom Murphy Signed-off-by: Lu Baolu --- drivers/iommu/dma-iommu.c | 29 +-- drivers/iommu/intel/iommu.c | 55 - include/linux

[PATCH v4 6/7] iommu/vt-d: Convert intel iommu driver to the iommu ops

2020-09-27 Thread Lu Baolu
From: Tom Murphy Convert the intel iommu driver to the dma-iommu api. Remove the iova handling and reserve region code from the intel iommu driver. Signed-off-by: Tom Murphy Signed-off-by: Lu Baolu --- drivers/iommu/intel/Kconfig | 1 + drivers/iommu/intel/iommu.c | 742

[PATCH v4 2/7] iommu: Add iommu_dma_free_cpu_cached_iovas()

2020-09-27 Thread Lu Baolu
From: Tom Murphy Add a iommu_dma_free_cpu_cached_iovas function to allow drivers which use the dma-iommu ops to free cached cpu iovas. Signed-off-by: Tom Murphy Signed-off-by: Lu Baolu --- drivers/iommu/dma-iommu.c | 9 + include/linux/dma-iommu.h | 8 2 files changed, 17

[PATCH v4 5/7] iommu/vt-d: Update domain geometry in iommu_ops.at(de)tach_dev

2020-09-27 Thread Lu Baolu
The iommu-dma constrains IOVA allocation based on the domain geometry that the driver reports. Update domain geometry everytime a domain is attached to or detached from a device. Signed-off-by: Lu Baolu --- drivers/iommu/intel/iommu.c | 16 ++-- 1 file changed, 14 insertions(+), 2

[PATCH v4 3/7] iommu: Allow the dma-iommu api to use bounce buffers

2020-09-27 Thread Lu Baolu
From: Tom Murphy Allow the dma-iommu api to use bounce buffers for untrusted devices. This is a copy of the intel bounce buffer code. Signed-off-by: Tom Murphy Co-developed-by: Lu Baolu Signed-off-by: Lu Baolu --- drivers/iommu/dma-iommu.c | 163 +++--- 1

[PATCH v4 4/7] iommu: Add quirk for Intel graphic devices in map_sg

2020-09-27 Thread Lu Baolu
depends on the previous behaviour of the Intel iommu driver which would return the same number of elements in the output list as in the input list. Signed-off-by: Tom Murphy Signed-off-by: Lu Baolu --- drivers/iommu/dma-iommu.c | 27 +++ 1 file changed, 27 insertions

[PATCH v4 0/7] Convert the intel iommu driver to the dma-iommu api

2020-09-27 Thread Lu Baolu
...@linux.intel.com/ There aren't any other changes. Please help to test and review. Best regards, baolu Lu Baolu (3): iommu: Add quirk for Intel graphic devices in map_sg iommu/vt-d: Update domain geometry in iommu_ops.at(de)tach_dev iommu/vt-d: Cleanup after converting to dma-iommu ops Tom Murphy

[PATCH 1/1] iommu/vt-d: Fix lockdep splat in iommu_flush_dev_iotlb()

2020-09-27 Thread Lu Baolu
ock(>lock); [ 12.704158] [ 12.704164] lock(device_domain_lock); [ 12.704174] *** DEADLOCK *** Signed-off-by: Lu Baolu --- drivers/iommu/intel/iommu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/i

Re: [PATCH v5 0/5] iommu aux-domain APIs extensions

2020-09-24 Thread Lu Baolu
Hi Joerg, On 9/24/20 5:55 PM, Joerg Roedel wrote: On Tue, Sep 22, 2020 at 02:10:37PM +0800, Lu Baolu wrote: Hi Jorge and Alex, A description of this patch series could be found here. https://lore.kernel.org/linux-iommu/20200901033422.22249-1-baolu...@linux.intel.com/ Hmm, I am wondering

Re: [PATCH v3 0/6] Convert the intel iommu driver to the dma-iommu api

2020-09-22 Thread Lu Baolu
On 9/22/20 7:05 PM, Robin Murphy wrote: With the previous version of the series I hit a problem on Ivybridge where apparently the dma engine width is not respected. At least that is my layman interpretation of the errors. From the older thread: <3> [209.526605] DMAR: intel_iommu_map: iommu

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

2020-09-22 Thread Lu Baolu
Replace iommu_aux_at(de)tach_device() with iommu_at(de)tach_subdev_group(). Signed-off-by: Lu Baolu --- drivers/vfio/vfio_iommu_type1.c | 43 + 1 file changed, 6 insertions(+), 37 deletions(-) diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio

[PATCH v5 5/5] iommu/vt-d: Add is_aux_domain support

2020-09-22 Thread Lu Baolu
With subdevice information opt-in through iommu_ops.aux_at(de)tach_dev() interfaces, the vendor iommu driver is able to learn the knowledge about the relationships between the subdevices and the aux-domains. Implement is_aux_domain() support based on the relationship knowledges. Signed-off-by: Lu

[PATCH v5 0/5] iommu aux-domain APIs extensions

2020-09-22 Thread Lu Baolu
Lu Baolu (5): iommu: Add optional subdev in aux_at(de)tach ops iommu: Add iommu_at(de)tach_subdev_group() iommu: Add iommu_aux_get_domain_for_dev() vfio/type1: Use iommu_aux_at(de)tach_group() APIs iommu/vt-d: Add is_aux_domain support drivers/iommu/intel/iommu.c | 139

Re: [Intel-gfx] [PATCH v3 0/6] Convert the intel iommu driver to the dma-iommu api

2020-09-21 Thread Lu Baolu
Hi Logan, On 9/21/20 11:48 PM, Logan Gunthorpe wrote: On 2020-09-20 12:36 a.m., Lu Baolu wrote: Hi Logan, On 2020/9/19 4:47, Logan Gunthorpe wrote: Hi Lu, On 2020-09-11 9:21 p.m., Lu Baolu wrote: Tom Murphy has almost done all the work. His latest patch series was posted here. https

Re: [Intel-gfx] [PATCH v3 0/6] Convert the intel iommu driver to the dma-iommu api

2020-09-20 Thread Lu Baolu
Hi Logan, On 2020/9/19 4:47, Logan Gunthorpe wrote: Hi Lu, On 2020-09-11 9:21 p.m., Lu Baolu wrote: Tom Murphy has almost done all the work. His latest patch series was posted here. https://lore.kernel.org/linux-iommu/20200903201839.7327-1-murph...@tcd.ie/ Thanks a lot! This series

Re: [PATCH v3 0/6] Convert the intel iommu driver to the dma-iommu api

2020-09-14 Thread Lu Baolu
Hi Tvrtko, On 9/14/20 4:04 PM, Tvrtko Ursulin wrote: Hi, On 12/09/2020 04:21, Lu Baolu wrote: Tom Murphy has almost done all the work. His latest patch series was posted here. https://lore.kernel.org/linux-iommu/20200903201839.7327-1-murph...@tcd.ie/ Thanks a lot! This series is a follow

Re: [PATCH v4 5/5] iommu/vt-d: Add is_aux_domain support

2020-09-13 Thread Lu Baolu
Hi Alex, On 9/11/20 6:05 AM, Alex Williamson wrote: On Tue, 1 Sep 2020 11:34:22 +0800 Lu Baolu wrote: With subdevice information opt-in through iommu_ops.aux_at(de)tach_dev() interfaces, the vendor iommu driver is able to learn the knowledge about the relationships between the subdevices

Re: [PATCH v4 2/5] iommu: Add iommu_at(de)tach_subdev_group()

2020-09-13 Thread Lu Baolu
Hi Alex, On 9/11/20 6:05 AM, Alex Williamson wrote: On Tue, 1 Sep 2020 11:34:19 +0800 Lu Baolu wrote: This adds two new APIs for the use cases like vfio/mdev where subdevices derived from physical devices are created and put in an iommu_group. The new IOMMU API interfaces mimic

[PATCH v3 6/6] iommu/vt-d: Cleanup after converting to dma-iommu ops

2020-09-11 Thread Lu Baolu
Some cleanups after converting the driver to use dma-iommu ops. - Remove nobounce option; - Cleanup and simplify the path in domain mapping. Signed-off-by: Lu Baolu --- .../admin-guide/kernel-parameters.txt | 5 -- drivers/iommu/intel/iommu.c | 90

[PATCH v3 4/6] iommu: Add quirk for Intel graphic devices in map_sg

2020-09-11 Thread Lu Baolu
depends on the previous behaviour of the Intel iommu driver which would return the same number of elements in the output list as in the input list. Signed-off-by: Tom Murphy Signed-off-by: Lu Baolu --- drivers/iommu/dma-iommu.c | 27 +++ 1 file changed, 27 insertions

[PATCH v3 3/6] iommu: Allow the dma-iommu api to use bounce buffers

2020-09-11 Thread Lu Baolu
From: Tom Murphy Allow the dma-iommu api to use bounce buffers for untrusted devices. This is a copy of the intel bounce buffer code. Signed-off-by: Tom Murphy Co-developed-by: Lu Baolu Signed-off-by: Lu Baolu --- drivers/iommu/dma-iommu.c | 163 +++--- 1

[PATCH v3 5/6] iommu/vt-d: Convert intel iommu driver to the iommu ops

2020-09-11 Thread Lu Baolu
From: Tom Murphy Convert the intel iommu driver to the dma-iommu api. Remove the iova handling and reserve region code from the intel iommu driver. Signed-off-by: Tom Murphy Signed-off-by: Lu Baolu --- drivers/iommu/intel/Kconfig | 1 + drivers/iommu/intel/iommu.c | 742

[PATCH v3 1/6] iommu: Handle freelists when using deferred flushing in iommu drivers

2020-09-11 Thread Lu Baolu
table pages can be freed. This way we can still batch ioTLB free operations and handle the freelists. Signed-off-by: Tom Murphy Signed-off-by: Lu Baolu --- drivers/iommu/dma-iommu.c | 30 ++-- drivers/iommu/intel/iommu.c | 55 - include

[PATCH v3 2/6] iommu: Add iommu_dma_free_cpu_cached_iovas()

2020-09-11 Thread Lu Baolu
From: Tom Murphy Add a iommu_dma_free_cpu_cached_iovas function to allow drivers which use the dma-iommu ops to free cached cpu iovas. Signed-off-by: Tom Murphy Signed-off-by: Lu Baolu --- drivers/iommu/dma-iommu.c | 9 + include/linux/dma-iommu.h | 8 2 files changed, 17

[PATCH v3 0/6] Convert the intel iommu driver to the dma-iommu api

2020-09-11 Thread Lu Baolu
. Fix several bugs in patch "iommu: Allow the dma-iommu api to use bounce buffers" to make the bounce buffer work for untrusted devices. 3. Several cleanups in iommu/vt-d driver after the conversion. Please review and test. Best regards, baolu Lu Baolu (2): iommu: Add quirk for Int

Re: [PATCH V2 5/5] DO NOT MERGE: iommu: disable list appending in dma-iommu

2020-09-11 Thread Lu Baolu
On 2020/9/9 15:06, Christoph Hellwig wrote: On Wed, Sep 09, 2020 at 09:43:09AM +0800, Lu Baolu wrote: + /* +* The Intel graphic device driver is used to assume that the returned +* sg list is not combound. This blocks the efforts of converting the This adds pointless

Re: [PATCH V2 2/5] iommu: Add iommu_dma_free_cpu_cached_iovas function

2020-09-11 Thread Lu Baolu
On 2020/9/9 15:05, Christoph Hellwig wrote: +static inline void iommu_dma_free_cpu_cached_iovas(unsigned int cpu, + struct iommu_domain *domain) This adds a crazy long line. Which is rather pointless as other bits of code in the patch use the

Re: [PATCH V2 4/5] iommu/vt-d: Convert intel iommu driver to the iommu ops

2020-09-08 Thread Lu Baolu
On 9/4/20 4:18 AM, Tom Murphy wrote: +static int intel_iommu_needs_bounce_buffer(struct device *d) +{ + return !intel_no_bounce && dev_is_pci(d) && to_pci_dev(d)->untrusted; +} + + static void intel_iommu_probe_finalize(struct device *dev) { - struct iommu_domain *domain; +

Re: [PATCH V2 5/5] DO NOT MERGE: iommu: disable list appending in dma-iommu

2020-09-08 Thread Lu Baolu
Hi Christoph, On 9/8/20 2:23 PM, Christoph Hellwig wrote: On Tue, Sep 08, 2020 at 02:04:53PM +0800, Lu Baolu wrote: Do you mind telling where can I find Marek's series? [PATCH v10 00/30] DRM: fix struct sg_table nents vs. orig_nents misuse on various lists including the iommu one

Re: [PATCH V2 2/5] iommu: Add iommu_dma_free_cpu_cached_iovas function

2020-09-08 Thread Lu Baolu
On 9/4/20 4:18 AM, Tom Murphy wrote: to dma-iommu ops Add a iommu_dma_free_cpu_cached_iovas function to allow drivers which use the dma-iommu ops to free cached cpu iovas. Signed-off-by: Tom Murphy --- drivers/iommu/dma-iommu.c | 9 + include/linux/dma-iommu.h | 3 +++ 2 files

Re: [PATCH V2 5/5] DO NOT MERGE: iommu: disable list appending in dma-iommu

2020-09-08 Thread Lu Baolu
On 2020/9/8 14:23, Christoph Hellwig wrote: On Tue, Sep 08, 2020 at 02:04:53PM +0800, Lu Baolu wrote: Do you mind telling where can I find Marek's series? [PATCH v10 00/30] DRM: fix struct sg_table nents vs. orig_nents misuse on various lists including the iommu one. Get it. Thank you

Re: [PATCH V2 5/5] DO NOT MERGE: iommu: disable list appending in dma-iommu

2020-09-08 Thread Lu Baolu
://linuxplumbersconf.org/event/7/contributions/846/ As far as I can remember everyone seemed happy with that solution. I won't be working on this though as I don't have any more time to dedicate to this. It seems Lu Baolu will take over this. I'm absolutely again passing a flag. Tha just invites

Re: [PATCH v2 1/1] iommu/vt-d: Use device numa domain if RHSA is missing

2020-09-03 Thread Lu Baolu
Hi Kevin, On 9/4/20 10:16 AM, Tian, Kevin wrote: From: Lu Baolu Sent: Friday, September 4, 2020 9:03 AM If there are multiple NUMA domains but the RHSA is missing in ACPI/DMAR table, we could default to the device NUMA domain as fall back. This could also benefit a vIOMMU use case where only

[PATCH v2 1/1] iommu/vt-d: Use device numa domain if RHSA is missing

2020-09-03 Thread Lu Baolu
Cc: Kevin Tian Cc: Ashok Raj Signed-off-by: Lu Baolu --- drivers/iommu/intel/iommu.c | 37 +++-- 1 file changed, 35 insertions(+), 2 deletions(-) Change log: v1->v2: - Add a comment as suggested by Kevin. https://lore.kernel.org/linux-io

Re: 答复: 答复: [PATCH v3 2/2] iommu/vt-d:Add support for probing ACPI device in RMRR

2020-09-03 Thread Lu Baolu
Hi Felix, On 9/2/20 11:24 AM, FelixCui-oc wrote: hi baolu, So you have a hidden device (invisible to host kernel). But you need to setup some identity mappings for this device, so that the firmware could keep working, right? The platform designs this by putting that range in the RMRR

[PATCH 1/1] iommu/vt-d: Fix NULL pointer dereference in dev_iommu_priv_set()

2020-09-03 Thread Lu Baolu
iommu/vt-d: Use dev_iommu_priv_get/set()") Reported-by: Torsten Hilbrich Reported-by: Wendy Wang Link: https://lore.kernel.org/linux-iommu/96717683-70be-7388-3d2f-61131070a...@secunet.com/ Signed-off-by: Lu Baolu --- drivers/iommu/intel/iommu.c | 100

Re: [PATCH v2 3/9] iommu/ioasid: Introduce ioasid_set APIs

2020-09-01 Thread Lu Baolu
Hi, On 9/2/20 5:28 AM, Jacob Pan wrote: On Mon, 24 Aug 2020 10:24:11 +0800 Lu Baolu wrote: Hi Jacob, On 8/22/20 12:35 PM, Jacob Pan wrote: ioasid_set was introduced as an arbitrary token that are shared by a group of IOASIDs. For example, if IOASID #1 and #2 are allocated via the same

Re: 答复: [PATCH v3 2/2] iommu/vt-d:Add support for probing ACPI device in RMRR

2020-09-01 Thread Lu Baolu
*发件人:* Lu Baolu *发送时间:* 2020年9月1日 14:12:34 *收件人:* FelixCui-oc; Joerg Roedel; io...@lists.linux-foundation.org; linux-kernel@vger.kernel.org; David Woodhouse; Dan Carpenter; kbu...@lists.01.org *抄送:* baolu...@linux.intel.com; CobeChen-oc; RaymondPang-oc; Tony W Wang-oc *主题

Re: [PATCH v3 2/2] iommu/vt-d:Add support for probing ACPI device in RMRR

2020-09-01 Thread Lu Baolu
Hi Felix, On 8/27/20 6:02 PM, FelixCuioc wrote: After acpi device in RMRR is detected,it is necessary to establish a mapping for these devices. In acpi_device_create_direct_mappings(),create a mapping for the acpi device in RMRR. Add a helper to achieve the acpi namespace device can access the

Re: [PATCH v3 1/2] iommu/vt-d:Add support for detecting ACPI device in RMRR

2020-09-01 Thread Lu Baolu
Hi Felix, On 8/27/20 6:02 PM, FelixCuioc wrote: Some ACPI devices need to issue dma requests to access the reserved memory area.BIOS uses the device scope type ACPI_NAMESPACE_DEVICE in RMRR to report these ACPI devices. This patch add support for detecting ACPI devices in RMRR. Signed-off-by:

[PATCH v4 0/5] iommu aux-domain APIs extensions

2020-08-31 Thread Lu Baolu
domain is aux-domain for a device. - Return domain only if the domain is aux-domain in iommu_aux_get_domain_for_dev(). Lu Baolu (5): iommu: Add optional subdev in aux_at(de)tach ops iommu: Add iommu_at(de)tach_subdev_group() iommu: Add iommu_aux_get_domain_for_dev() vfio/type1: Use

[PATCH v4 3/5] iommu: Add iommu_aux_get_domain_for_dev()

2020-08-31 Thread Lu Baolu
ted-by: Alex Williamson Link: https://lore.kernel.org/linux-iommu/20200708130749.1b1e1...@x1.home/ Signed-off-by: Lu Baolu --- drivers/iommu/iommu.c | 18 ++ include/linux/iommu.h | 20 2 files changed, 38 insertions(+) diff --git a/drivers/iommu/iommu.c b/driv

[PATCH v4 5/5] iommu/vt-d: Add is_aux_domain support

2020-08-31 Thread Lu Baolu
With subdevice information opt-in through iommu_ops.aux_at(de)tach_dev() interfaces, the vendor iommu driver is able to learn the knowledge about the relationships between the subdevices and the aux-domains. Implement is_aux_domain() support based on the relationship knowledges. Signed-off-by: Lu

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

2020-08-31 Thread Lu Baolu
Replace iommu_aux_at(de)tach_device() with iommu_at(de)tach_subdev_group(). Signed-off-by: Lu Baolu --- drivers/vfio/vfio_iommu_type1.c | 43 + 1 file changed, 6 insertions(+), 37 deletions(-) diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio

[PATCH v4 1/5] iommu: Add optional subdev in aux_at(de)tach ops

2020-08-31 Thread Lu Baolu
-in. Signed-off-by: Lu Baolu --- drivers/iommu/intel/iommu.c | 10 ++ drivers/iommu/iommu.c | 4 ++-- include/linux/iommu.h | 6 -- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c index bce158468abf

[PATCH v4 2/5] iommu: Add iommu_at(de)tach_subdev_group()

2020-08-31 Thread Lu Baolu
the _attach_group() interfaces while the _attach_device() interfaces are relegated to special cases. Link: https://lore.kernel.org/linux-iommu/20200730134658.44c57...@x1.home/ Link: https://lore.kernel.org/linux-iommu/20200730151703.5daf8...@x1.home/ Signed-off-by: Lu Baolu --- drivers/iommu

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

2020-08-31 Thread Lu Baolu
3) /* page-level write through */ #define IOMMU_SVA_VTD_GPASID_EMTE (1 << 4) /* extended mem type enable */ #define IOMMU_SVA_VTD_GPASID_CD (1 << 5) /* PASID-level cache disable */ +#define IOMMU_SVA_VTD_GPASID_LAST (1 << 6) __u64 flags; __u32

Re: [patch V2 00/46] x86, PCI, XEN, genirq ...: Prepare for device MSI

2020-08-31 Thread Lu Baolu
Hi Thomas, On 2020/8/31 15:10, Thomas Gleixner wrote: On Mon, Aug 31 2020 at 08:51, Lu Baolu wrote: On 8/26/20 7:16 PM, Thomas Gleixner wrote: This is the second version of providing a base to support device MSI (non PCI based) and on top of that support for IMS (Interrupt Message Storm

Re: [PATCH 1/1] iommu/vt-d: Use device numa domain if RHSA is missing

2020-08-30 Thread Lu Baolu
Hi Kevin, Thanks a lot for looking at my patch. On 8/28/20 10:13 AM, Tian, Kevin wrote: From: Lu Baolu Sent: Thursday, August 27, 2020 1:57 PM If there are multiple NUMA domains but the RHSA is missing in ACPI/DMAR table, we could default to the device NUMA domain as fall back. This also

Re: [patch V2 00/46] x86, PCI, XEN, genirq ...: Prepare for device MSI

2020-08-30 Thread Lu Baolu
Hi Thomas, On 8/26/20 7:16 PM, Thomas Gleixner wrote: This is the second version of providing a base to support device MSI (non PCI based) and on top of that support for IMS (Interrupt Message Storm) based devices in a halfways architecture independent way. After applying this patch series,

[PATCH v3 1/1] iommu/vt-d: Serialize IOMMU GCMD register modifications

2020-08-27 Thread Lu Baolu
) Cc: Andy Lutomirski Cc: Jacob Pan Cc: Kevin Tian Cc: Ashok Raj Signed-off-by: Lu Baolu --- drivers/iommu/intel/irq_remapping.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) Change log: v1->v2: - v1 posted here https://lore.kernel.org/linux-iommu/20200826025825

Re: [PATCH v2 1/1] iommu/vt-d: Serialize IOMMU GCMD register modifications

2020-08-27 Thread Lu Baolu
Hi, On 8/27/20 1:39 PM, Tian, Kevin wrote: From: Lu Baolu Sent: Thursday, August 27, 2020 12:25 PM The VT-d spec requires (10.4.4 Global Command Register, GCMD_REG General Description) that: If multiple control fields in this register need to be modified, software must serialize

[PATCH 1/1] iommu/vt-d: Use device numa domain if RHSA is missing

2020-08-27 Thread Lu Baolu
Cc: Kevin Tian Cc: Ashok Raj Signed-off-by: Lu Baolu --- drivers/iommu/intel/iommu.c | 31 +-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c index e0516d64d7a3..bce158468abf 100644

Re: [PATCH 1/1] iommu/vt-d: Serialize IOMMU GCMD register modifications

2020-08-26 Thread Lu Baolu
Hi Kevin, On 8/26/20 1:29 PM, Tian, Kevin wrote: From: Lu Baolu Sent: Wednesday, August 26, 2020 10:58 AM The VT-d spec requires (10.4.4 Global Command Register, GCMD_REG General Description) that: If multiple control fields in this register need to be modified, software must serialize

[PATCH v2 1/1] iommu/vt-d: Serialize IOMMU GCMD register modifications

2020-08-26 Thread Lu Baolu
and CFI are done in one write. We need to do two separate writes with STS checking after each. Fixes: af8d102f999a4 ("x86/intel/irq_remapping: Clean up x2apic opt-out security warning mess") Cc: Andy Lutomirski Cc: Jacob Pan Cc: Kevin Tian Cc: Ashok Raj Signed-off-by: Lu Baolu --- dri

[PATCH 1/1] iommu/vt-d: Serialize IOMMU GCMD register modifications

2020-08-25 Thread Lu Baolu
and CFI are done in one write. We need to do two separate writes with STS checking after each. Fixes: af8d102f999a4 ("x86/intel/irq_remapping: Clean up x2apic opt-out security warning mess") Cc: Andy Lutomirski Cc: Jacob Pan Signed-off-by: Lu Baolu --- drivers/iommu/intel/irq_remap

Re: [PATCH] iommu/vt-d:Add support for detecting ACPI device in RMRR

2020-08-25 Thread Lu Baolu
Hi Felix, On 8/18/20 10:44 AM, FelixCuioc wrote: Some ACPI devices need to issue dma requests to access the reserved memory area.BIOS uses the device scope type ACPI_NAMESPACE_DEVICE in RMRR to report these ACPI devices. This patch add support for detecting ACPI devices in RMRR. If you are

Re: [PATCH v4 07/15] iommu/vt-d: Delegate the dma domain to upper layer

2020-08-24 Thread Lu Baolu
Hi Chris, On 8/24/20 4:35 PM, Chris Wilson wrote: Quoting Lu Baolu (2020-08-24 07:31:23) Hi Chris, On 2020/8/22 2:33, Chris Wilson wrote: Quoting Lu Baolu (2019-05-25 06:41:28) This allows the iommu generic layer to allocate a dma domain and attach it to a device through the iommu api's

Re: [PATCH v4 07/15] iommu/vt-d: Delegate the dma domain to upper layer

2020-08-24 Thread Lu Baolu
Hi Chris, On 2020/8/22 2:33, Chris Wilson wrote: Quoting Lu Baolu (2019-05-25 06:41:28) This allows the iommu generic layer to allocate a dma domain and attach it to a device through the iommu api's. With all types of domains being delegated to upper layer, we can remove an internal flag which

Re: [RESEND PATCH 4/5] iommu: intel: Drop kerneldoc marker from regular comment

2020-08-23 Thread Lu Baolu
iommu/vt-d: Drop kerneldoc marker from regular comment", Reviewed-by: Lu Baolu Best regards, baolu --- drivers/iommu/intel/dmar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/intel/dmar.c b/drivers/iommu/intel/dmar.c index 93e6345f3414..ba47edf03

Re: [PATCH v2 4/9] iommu/ioasid: Add reference couting functions

2020-08-23 Thread Lu Baolu
Hi Jacob, On 8/22/20 12:35 PM, Jacob Pan wrote: There can be multiple users of an IOASID, each user could have hardware contexts associated with the IOASID. In order to align lifecycles, reference counting is introduced in this patch. It is expected that when an IOASID is being freed, each user

Re: [PATCH v2 3/9] iommu/ioasid: Introduce ioasid_set APIs

2020-08-23 Thread Lu Baolu
Hi Jacob, On 8/22/20 12:35 PM, Jacob Pan wrote: ioasid_set was introduced as an arbitrary token that are shared by a group of IOASIDs. For example, if IOASID #1 and #2 are allocated via the same ioasid_set*, they are viewed as to belong to the same set. For guest SVA usages, system-wide IOASID

Re: [PATCH v2 1/9] docs: Document IO Address Space ID (IOASID) APIs

2020-08-23 Thread Lu Baolu
Hi Jacob, On 2020/8/22 12:35, Jacob Pan wrote: IOASID is used to identify address spaces that can be targeted by device DMA. It is a system-wide resource that is essential to its many users. This document is an attempt to help developers from all vendors navigate the APIs. At this time, ARM

Re: 答复: 答复: 答复: 答复: 答复: 答复: 答复: [PATCH] iommu/vt-d:Add support for ACPI device in RMRR

2020-08-07 Thread Lu Baolu
return 0; } Best regards Felix cui-oc -邮件原件----- 发件人: Lu Baolu 发送时间: 2020年8月7日 9:08 收件人: FelixCui-oc ; Joerg Roedel ; io...@lists.linux-foundation.org; linux-kernel@vger.kernel.org; David Woodhouse 抄送: baolu...@linux.intel.com; RaymondPang-oc ; CobeChen-oc 主题: Re: 答复

Re: 答复: 答复: 答复: 答复: 答复: 答复: [PATCH] iommu/vt-d:Add support for ACPI device in RMRR

2020-08-06 Thread Lu Baolu
he same time? Best regards, baolu Best regards Felix cui -邮件原件- 发件人: Lu Baolu 发送时间: 2020年8月6日 10:36 收件人: FelixCui-oc ; Joerg Roedel ; io...@lists.linux-foundation.org; linux-kernel@vger.kernel.org; David Woodhouse 抄送: baolu...@linux.intel.com; RaymondPang-oc ; CobeChen-oc 主题: Re:

Re: 答复: 答复: 答复: 答复: 答复: [PATCH] iommu/vt-d:Add support for ACPI device in RMRR

2020-08-05 Thread Lu Baolu
Hi Felix, On 8/5/20 3:37 PM, FelixCui-oc wrote: Hi baolu, Let me talk about why acpi_device_create_direct_mappings() is needed and please tell me if there is an error. Sure. Before that, let me sync my understanding with you. You have an acpi namespace device in ANDD table,

Re: 答复: 答复: 答复: 答复: [PATCH] iommu/vt-d:Add support for ACPI device in RMRR

2020-08-04 Thread Lu Baolu
since the rmrr identity mapping is already done in the iommu core. Best regards, baolu Best regards Felix cui-oc -邮件原件- 发件人: Lu Baolu 发送时间: 2020年8月4日 9:12 收件人: FelixCui-oc ; Joerg Roedel ; io...@lists.linux-foundation.org; linux-kernel@vger.kernel.org;

Re: 答复: 答复: 答复: [PATCH] iommu/vt-d:Add support for ACPI device in RMRR

2020-08-03 Thread Lu Baolu
in probe_acpi_namespace_devices(). Best regards, baolu Best regards Felix cui-oc -邮件原件- 发件人: FelixCui-oc 发送时间: 2020年8月3日 17:02 收件人: 'Lu Baolu' ; Joerg Roedel ; io...@lists.linux-foundation.org; linux-kernel@vger.kernel.org; David Woodhouse 抄送: RaymondPang-oc ; CobeChen-oc 主题: 答复: 答复: 答复: [PATCH

Re: 答复: 答复: [PATCH] iommu/vt-d:Add support for ACPI device in RMRR

2020-08-03 Thread Lu Baolu
the enumeration and setup the identity mappings. Can you please check why that code doesn't work for you? Best regards, baolu Best regards Felix cui -邮件原件- 发件人: Lu Baolu 发送时间: 2020年8月3日 14:19 收件人: FelixCui-oc ; Joerg Roedel ; io...@lists.linux-foundation.org; linux-kernel

Re: 答复: [PATCH] iommu/vt-d:Add support for ACPI device in RMRR

2020-08-03 Thread Lu Baolu
atch in order to distinguish acpi device from pci device. You can refer to the description of type in 8.3.1 device scope in vt-d spec. Best regards FelixCui-oc -邮件原件- 发件人: Lu Baolu 发送时间: 2020年8月3日 10:32 收件人: FelixCui-oc ; Joerg Roedel ; io...@lists.linux-foundation.org;

Re: [PATCH] iommu/vt-d:Add support for ACPI device in RMRR

2020-08-02 Thread Lu Baolu
Hi, On 8/2/20 6:07 PM, FelixCuioc wrote: Some ACPI devices require access to the specified reserved memory region.BIOS report the specified reserved memory region through RMRR structures.Add analysis of ACPI device in RMRR and establish identity mapping for ACPI device. Can you please add

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

2020-08-02 Thread Lu Baolu
Hi Alex, On 8/1/20 2:14 AM, Alex Williamson wrote: On Fri, 31 Jul 2020 14:30:03 +0800 Lu Baolu wrote: Hi Alex, On 2020/7/30 4:25, Alex Williamson wrote: On Tue, 14 Jul 2020 13:57:02 +0800 Lu Baolu wrote: The device driver needs an API to get its aux-domain. A typical usage scenario

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

2020-08-02 Thread Lu Baolu
Hi Alex, On 8/1/20 2:05 AM, Alex Williamson wrote: On Fri, 31 Jul 2020 13:47:57 +0800 Lu Baolu wrote: Hi Alex, On 2020/7/31 3:46, Alex Williamson wrote: On Wed, 29 Jul 2020 23:34:40 + "Tian, Kevin" wrote: From: Alex Williamson Sent: Thursday, July 30, 2020 4:04 AM

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

2020-07-31 Thread Lu Baolu
Hi Alex, On 2020/7/30 4:25, Alex Williamson wrote: On Tue, 14 Jul 2020 13:57:02 +0800 Lu Baolu wrote: The device driver needs an API to get its aux-domain. A typical usage scenario is: unsigned long pasid; struct iommu_domain *domain; struct device *dev = mdev_dev

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

2020-07-30 Thread Lu Baolu
Hi Alex, On 2020/7/31 3:46, Alex Williamson wrote: On Wed, 29 Jul 2020 23:34:40 + "Tian, Kevin" wrote: From: Alex Williamson Sent: Thursday, July 30, 2020 4:04 AM On Thu, 16 Jul 2020 09:07:46 +0800 Lu Baolu wrote: Hi Jacob, On 7/16/20 12:01 AM, Jacob Pan wrote: On W

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

2020-07-30 Thread Lu Baolu
Hi Yi, On 7/30/20 5:36 PM, Liu, Yi L wrote: From: Lu Baolu Sent: Tuesday, July 14, 2020 1:57 PM 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

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

2020-07-30 Thread Lu Baolu
Hi Alex, On 7/31/20 5:17 AM, Alex Williamson wrote: On Thu, 30 Jul 2020 10:41:32 +0800 Lu Baolu wrote: 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

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

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