Hi David,
On 2022/3/22 14:35, David Stevens wrote:
From: David Stevens
Calculate the appropriate mask for non-size-aligned page selective
invalidation. Since psi uses the mask value to mask out the lower order
bits of the target address, properly flushing the iotlb requires using a
mask value
On 2022/3/21 20:50, Jason Gunthorpe wrote:
On Sun, Mar 20, 2022 at 02:40:29PM +0800, Lu Baolu wrote:
+static enum iommu_page_response_code
+iommu_sva_handle_iopf(struct iommu_fault *fault, void *data)
+{
+ vm_fault_t ret;
+ struct mm_struct *mm;
+ struct vm_area_struct *vma
On 2022/3/21 19:39, Jean-Philippe Brucker wrote:
On Sun, Mar 20, 2022 at 02:40:29PM +0800, Lu Baolu wrote:
The existing IOPF handling framework only handles the I/O page faults for
SVA. Ginven that we are able to link iommu domain with each I/O page fault,
we can now make the I/O page fault
On 2022/3/21 20:43, Jason Gunthorpe wrote:
On Mon, Mar 21, 2022 at 11:42:16AM +, Jean-Philippe Brucker wrote:
I tend to disagree with that last part. The fault is caused by a specific
device accessing shared page tables. We should keep that device
information throughout the fault handling,
On 2022/3/21 20:40, Jason Gunthorpe wrote:
On Sun, Mar 20, 2022 at 02:40:28PM +0800, Lu Baolu wrote:
@@ -3098,7 +3101,16 @@ int iommu_attach_device_pasid(struct iommu_domain
*domain,
if (iommu_group_device_count(group) != 1)
goto out_unlock;
+ xa_lock(&g
On 2022/3/21 20:05, Jason Gunthorpe wrote:
On Sun, Mar 20, 2022 at 02:40:25PM +0800, Lu Baolu wrote:
+/**
+ * iommu_sva_bind_device() - Bind a process address space to a device
+ * @dev: the device
+ * @mm: the mm to bind, caller must hold a reference to it
+ * @drvdata: opaque data pointer to
On 2022/3/21 19:33, Jean-Philippe Brucker wrote:
On Sun, Mar 20, 2022 at 02:40:25PM +0800, Lu Baolu wrote:
diff --git a/drivers/iommu/iommu-sva-lib.c b/drivers/iommu/iommu-sva-lib.c
index 106506143896..47cf98e661ff 100644
--- a/drivers/iommu/iommu-sva-lib.c
+++ b/drivers/iommu/iommu-sva-lib.c
On 2022/3/21 19:56, Jason Gunthorpe wrote:
On Sun, Mar 20, 2022 at 02:40:23PM +0800, Lu Baolu wrote:
Add support for SVA domain allocation and provide an SVA-specific
iommu_domain_ops.
Signed-off-by: Lu Baolu
include/linux/intel-iommu.h | 1 +
drivers/iommu/intel/iommu.c | 12
On 2022/3/21 19:47, Jason Gunthorpe wrote:
On Sun, Mar 20, 2022 at 02:40:21PM +0800, Lu Baolu wrote:
Add a new iommu domain type IOMMU_DOMAIN_SVA to represent an I/O page
table which is shared from CPU host VA. Add a sva_cookie field in the
iommu_domain structure to save the mm_struct which
On 2022/3/22 8:26, Tian, Kevin wrote:
From: Lu Baolu
Sent: Monday, March 21, 2022 6:22 PM
- if (features >= 0)
+ if (features >= 0) {
info->pasid_supported = fea
On 2022/3/21 19:22, Jean-Philippe Brucker wrote:
Hi Baolu,
On Sun, Mar 20, 2022 at 02:40:20PM +0800, Lu Baolu wrote:
diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
index 627a3ed5ee8f..8e262210b5ad 100644
--- a/drivers/iommu/arm/arm-smmu
On 2022/3/21 16:04, Tian, Kevin wrote:
From: Lu Baolu
Sent: Sunday, March 20, 2022 2:40 PM
+struct iommu_sva *
+iommu_sva_bind_device(struct device *dev, struct mm_struct *mm, void
*drvdata)
+{
+ int ret = -EINVAL;
+ struct iommu_sva *handle;
+ struct iommu_domain *domain
On 2022/3/21 15:45, Tian, Kevin wrote:
From: Lu Baolu
Sent: Sunday, March 20, 2022 2:40 PM
Add support for SVA domain allocation and provide an SVA-specific
iommu_domain_ops.
Signed-off-by: Lu Baolu
---
include/linux/intel-iommu.h | 1 +
drivers/iommu/intel/iommu.c | 12
On 2022/3/21 15:13, Tian, Kevin wrote:
From: Lu Baolu
Sent: Sunday, March 20, 2022 2:40 PM
Attaching an IOMMU domain to a PASID of a device is a generic operation
for modern IOMMU drivers which support PASID-granular DMA address
translation. Currently visible usage scenarios include (but not
On 2022/3/21 15:06, Tian, Kevin wrote:
From: Lu Baolu
Sent: Sunday, March 20, 2022 2:40 PM
Add a new iommu domain type IOMMU_DOMAIN_SVA to represent an I/O
page
table which is shared from CPU host VA. Add a sva_cookie field in the
iommu_domain structure to save the mm_struct which represent the
On 2022/3/21 15:01, Tian, Kevin wrote:
From: Lu Baolu
Sent: Sunday, March 20, 2022 2:40 PM
Use this field to save the pasid/ssid bits that a device is able to
support with its IOMMU hardware. It is a generic attribute of a device
and lifting it into the per-device dev_iommu struct makes it
Rename iommu-sva-lib.c[h] to iommu-sva.c[h] as it contains all code
for SVA implementation in iommu core.
Signed-off-by: Lu Baolu
---
drivers/iommu/{iommu-sva-lib.h => iommu-sva.h} | 0
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 2 +-
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
The existing IOPF handling framework only handles the I/O page faults for
SVA. Ginven that we are able to link iommu domain with each I/O page fault,
we can now make the I/O page fault handling framework more general for
more types of page faults.
Signed-off-by: Lu Baolu
---
include/linux
.
Signed-off-by: Lu Baolu
---
include/linux/iommu.h | 8
drivers/iommu/iommu.c | 31 +++
2 files changed, 39 insertions(+)
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 47c9aa5aa9c8..803e7b07605e 100644
--- a/include/linux/iommu.h
+++ b
Directly call the IO page fault handler in iommu_report_device_fault()
unless the device driver registered its own page fault handler. There
is no need to explicitly register the fault handler in IOMMU drivers.
Signed-off-by: Lu Baolu
---
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 13
These ops'es have been replaced with the dev_attach/detach_pasid domain
ops'es. There's no need for them anymore. Remove them to avoid dead
code.
Signed-off-by: Lu Baolu
---
include/linux/intel-iommu.h | 4 --
include/linux/iommu.h |
U SVA interfaces implementation by using the
attach/detach_pasid_dev ops and align them with the concept of the
iommu domain. Put the new SVA code in the sva related file in order
to make it self-contained.
Signed-off-by: Lu Baolu
---
include/linux/iommu.h | 46 +---
drivers/
Add support for SVA domain allocation and provide an SVA-specific
iommu_domain_ops.
Signed-off-by: Lu Baolu
---
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 14 ++
.../iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 45 +++
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 13
Add support for SVA domain allocation and provide an SVA-specific
iommu_domain_ops.
Signed-off-by: Lu Baolu
---
include/linux/intel-iommu.h | 1 +
drivers/iommu/intel/iommu.c | 12
drivers/iommu/intel/svm.c | 34 ++
3 files changed, 47 insertions
of common domain ops for this purpose and implements a
couple of wrapper helpers for in-kernel usage.
Signed-off-by: Lu Baolu
---
include/linux/iommu.h | 22 ++
drivers/iommu/iommu.c | 41 +
2 files changed, 63 insertions(+)
diff --git
Add a new iommu domain type IOMMU_DOMAIN_SVA to represent an I/O page
table which is shared from CPU host VA. Add a sva_cookie field in the
iommu_domain structure to save the mm_struct which represent the CPU
memory page table.
Signed-off-by: Lu Baolu
---
include/linux/iommu.h | 6 ++
1
which suports PASID related features should set this
field before features are enabled on the devices.
Signed-off-by: Lu Baolu
---
include/linux/iommu.h | 1 +
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 1 +
drivers/iommu/intel/iommu.c | 5 -
3 files
,
baolu
Lu Baolu (11):
iommu: Add pasid_bits field in struct dev_iommu
iommu: Add iommu_domain type for SVA
iommu: Add attach/detach_dev_pasid domain ops
iommu/vt-d: Add SVA domain support
arm-smmu-v3/sva: Add SVA domain support
iommu/sva: Use attach/detach_pasid_dev in SVA interfaces
On 2022/3/15 13:07, Jacob Pan wrote:
DMA mapping API is the de facto standard for in-kernel DMA. It operates
on a per device/RID basis which is not PASID-aware.
Some modern devices such as Intel Data Streaming Accelerator, PASID is
required for certain work submissions. To allow such devices use
On 2022/3/15 19:49, Tian, Kevin wrote:
From: Jean-Philippe Brucker
Sent: Tuesday, March 15, 2022 7:27 PM
On Mon, Mar 14, 2022 at 10:07:06PM -0700, Jacob Pan wrote:
From: Lu Baolu
An IOMMU domain represents an address space which can be attached by
devices that perform DMA within a domain
On 2022/3/15 13:07, Jacob Pan wrote:
From: Lu Baolu
An IOMMU domain represents an address space which can be attached by
devices that perform DMA within a domain. However, for platforms with
PASID capability the domain attachment needs be handled at device+PASID
level. There can be multiple
On 2022/2/11 11:05, Lu Baolu wrote:
The IOMMU subsystem has already provided an interface to query whether
the IOMMU hardware is enabled for a specific device. This changes the
check from Intel specific intel_iommu_gfx_mapped (globally exported by
the Intel IOMMU driver) to probing the presence
The iommu group changes notifer is not referenced in the tree. Remove it
to avoid dead code.
Suggested-by: Christoph Hellwig
Signed-off-by: Lu Baolu
Reviewed-by: Jason Gunthorpe
---
include/linux/iommu.h | 23 -
drivers/iommu/iommu.c | 75
ff-by: Lu Baolu
Reviewed-by: Jason Gunthorpe
Acked-by: Alex Williamson
---
drivers/vfio/vfio.c | 147
1 file changed, 147 deletions(-)
diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c
index e0df2bc692b2..dd3fac0d6bc9 100644
--- a/drivers/vfio/v
_group_dev() returns, so simply delete the
unbound_list entirely.
Reviewed-by: Chaitanya Kulkarni
Signed-off-by: Jason Gunthorpe
Signed-off-by: Lu Baolu
Acked-by: Alex Williamson
---
drivers/vfio/vfio.c | 74 ++---
1 file changed, 2 insertions(+), 72 dele
The only remaining reference is in GROUP_GET_STATUS, which could be called
at any time when group fd is valid. Here we just replace the
vfio_group_viable() by directly calling IOMMU core to get viability status.
Signed-off-by: Lu Baolu
Reviewed-by: Jason Gunthorpe
Acked-by: Alex Williamson
---
dri
just like what
we have done in the pcieport driver.
Signed-off-by: Lu Baolu
Reviewed-by: Jason Gunthorpe
Acked-by: Alex Williamson
---
drivers/vfio/fsl-mc/vfio_fsl_mc.c | 1 +
drivers/vfio/pci/vfio_pci.c | 1 +
drivers/vfio/platform/vfio_amba.c | 1 +
drivers/vfio/pla
7;t use MMIO as you can't find ioremap() or similar calls. It's
tolerant to userspace possibly also touching the same MMIO registers
via P2P DMA access.
Suggested-by: Jason Gunthorpe
Suggested-by: Kevin Tian
Signed-off-by: Lu Baolu
Reviewed-by: Jason Gunthorpe
Acked-by: B
admin to block driver binding after
applying the DMA ownership to VFIO.
Signed-off-by: Lu Baolu
Reviewed-by: Jason Gunthorpe
Acked-by: Bjorn Helgaas
---
drivers/pci/pci-stub.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/pci/pci-stub.c b/drivers/pci/pci-stub.c
index e408099fea52
-off-by: Lu Baolu
Reviewed-by: Greg Kroah-Hartman
Reviewed-by: Jason Gunthorpe
---
include/linux/amba/bus.h| 8
include/linux/fsl/mc.h | 8
include/linux/pci.h | 8
include/linux/platform_device.h | 8
drivers/amba/bus.c
Stop sharing platform_dma_configure() helper as they are about to have
their own bus dma_configure callbacks.
Signed-off-by: Lu Baolu
Reviewed-by: Jason Gunthorpe
---
include/linux/platform_device.h | 2 --
drivers/amba/bus.c | 19 ++-
drivers/base/platform.c
lockdown=integrity, can force the kernel to BUG.
With this change, the bus driver could check and set the DMA ownership in
driver binding process and fail on ownership conflicts. The DMA ownership
should be released during driver unbinding.
Signed-off-by: Lu Baolu
Reviewed-by: Greg Kroah-Hartman
iommu_group *group);
The device userspace assignment must be disallowed if the DMA owner
claiming interface returns failure.
Signed-off-by: Jason Gunthorpe
Signed-off-by: Kevin Tian
Signed-off-by: Lu Baolu
---
include/linux/iommu.h | 31 +
drivers/iommu/iommu.c | 153
d VFIO maintainers.
This is based on next branch of linux-iommu tree:
https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git
and also available on github:
https://github.com/LuBaolu/intel-iommu/commits/iommu-dma-ownership-v8
Best regards,
baolu
Jason Gunthorpe (1):
vfio: Delete t
On 2022/3/7 20:42, Eric Auger wrote:
Hi Lu,
On 3/7/22 4:27 AM, Lu Baolu wrote:
Hi Robin,
On 3/4/22 10:10 PM, Robin Murphy wrote:
On 2022-03-04 13:55, Eric Auger wrote:
Hi Robin,
On 3/4/22 1:22 PM, Robin Murphy wrote:
On 2022-03-04 10:43, Lu Baolu wrote:
Hi Eric,
On 2022/3/4 18:34, Eric
Hi Robin,
On 3/4/22 10:10 PM, Robin Murphy wrote:
On 2022-03-04 13:55, Eric Auger wrote:
Hi Robin,
On 3/4/22 1:22 PM, Robin Murphy wrote:
On 2022-03-04 10:43, Lu Baolu wrote:
Hi Eric,
On 2022/3/4 18:34, Eric Auger wrote:
I hit a WARN_ON() when unbinding an e1000e driver just after boot
Hi Eric,
On 2022/3/4 18:34, Eric Auger wrote:
I hit a WARN_ON() when unbinding an e1000e driver just after boot:
sudo modprobe -v vfio-pci
echo vfio-pci | sudo tee -a
/sys/bus/pci/devices/0004:01:00.0/driver_override
vfio-pci
echo 0004:01:00.0 | sudo tee -a /sys/bus/pci/drivers/e1000e/unbind
Hi Joerg,
On 2022/3/4 17:37, Joerg Roedel wrote:
Hi Baolu,
On Tue, Mar 01, 2022 at 10:01:47AM +0800, Lu Baolu wrote:
This includes patches queued for v5.18. It includes:
- [PATCH 1 ~ 11] Various cleanups, no intentional functional changes.
- [PATCH 12] Enable ATS in SoC-integrated
Hi Bjorn,
On 3/1/22 3:56 AM, Bjorn Helgaas wrote:
On Mon, Feb 28, 2022 at 08:50:51AM +0800, Lu Baolu wrote:
If a switch lacks ACS P2P Request Redirect, a device below the switch can
bypass the IOMMU and DMA directly to other devices below the switch, so
all the downstream devices must be in
becomes dead
code now.
Signed-off-by: Yian Chen
Link: https://lore.kernel.org/r/20220222185416.1722611-1-yian.c...@intel.com
Signed-off-by: Lu Baolu
---
include/linux/intel-iommu.h | 1 -
drivers/iommu/intel/iommu.c | 40 +++--
2 files changed, 38 insertions(+), 3
From: YueHaibing
This is unused since commit 4048377414162 ("iommu/vt-d: Use
iommu_sva_alloc(free)_pasid() helpers").
Signed-off-by: YueHaibing
Link: https://lore.kernel.org/r/20220216113851.25004-1-yuehaib...@huawei.com
Signed-off-by: Lu Baolu
---
drivers/iommu/intel/svm.c | 5 ---
Bonelli
Link: https://lore.kernel.org/r/20220210023141.9208-1-ma...@mebeim.net
Signed-off-by: Lu Baolu
---
drivers/iommu/intel/iommu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index f5b15bc20426..19562891d6ef 100644
--- a
nk:
https://lore.kernel.org/r/20220207141240.8253-1-andriy.shevche...@linux.intel.com
Signed-off-by: Lu Baolu
---
include/linux/intel-iommu.h | 2 ++
drivers/iommu/intel/dmar.c | 2 --
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iom
Remove blanks before goto labels.
Signed-off-by: Lu Baolu
Reviewed-by: Christoph Hellwig
Reviewed-by: Jason Gunthorpe
Link:
https://lore.kernel.org/r/20220214025704.3184654-1-baolu...@linux.intel.com
---
drivers/iommu/intel/iommu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions
Some prototypes in iommu.c are unnecessary. Delete them.
Signed-off-by: Lu Baolu
Reviewed-by: Christoph Hellwig
Reviewed-by: Jason Gunthorpe
Link:
https://lore.kernel.org/r/20220214025704.3184654-1-baolu...@linux.intel.com
---
drivers/iommu/intel/iommu.c | 5 -
1 file changed, 5
Remove unnecessary include files and sort the remaining alphabetically.
Signed-off-by: Lu Baolu
Reviewed-by: Christoph Hellwig
Reviewed-by: Jason Gunthorpe
Link:
https://lore.kernel.org/r/20220214025704.3184654-1-baolu...@linux.intel.com
---
drivers/iommu/intel/iommu.c | 34
getting the private data and domain are also cleaned.
Signed-off-by: Lu Baolu
Reviewed-by: Christoph Hellwig
Reviewed-by: Jason Gunthorpe
Link:
https://lore.kernel.org/r/20220214025704.3184654-1-baolu...@linux.intel.com
---
include/linux/intel-iommu.h | 2 -
drivers/iommu/intel/debugfs.c | 3
The domain and devinfo memory blocks are only allocated during device
probe and released during remove. There's no hot-path context, hence
no need for memory pools.
Signed-off-by: Lu Baolu
Reviewed-by: Christoph Hellwig
Reviewed-by: Jason Gunthorpe
Link:
https://lore.kernel.
These have been done in drivers/iommu/dma-iommu.c. Remove this duplicate
code.
Signed-off-by: Lu Baolu
Reviewed-by: Christoph Hellwig
Reviewed-by: Jason Gunthorpe
Link:
https://lore.kernel.org/r/20220214025704.3184654-1-baolu...@linux.intel.com
---
drivers/iommu/intel/iommu.c | 5 -
1
The Intel IOMMU driver has already converted to use default domain
framework in iommu core. There's no need to find a domain for the
device in the domain attaching path. Cleanup that code.
Signed-off-by: Lu Baolu
Reviewed-by: Christoph Hellwig
Reviewed-by: Jason Gunthorpe
Link:
The "domains" field of the intel_iommu structure keeps the mapping of
domain_id to dmar_domain. This information is not used anywhere. Remove
and cleanup it to avoid unnecessary memory consumption.
Signed-off-by: Lu Baolu
Reviewed-by: Christoph Hellwig
Reviewed-by: Jason Gunthorpe
Li
(1):
iommu/vt-d: Move intel_iommu_ops to header file
Lu Baolu (8):
iommu/vt-d: Remove intel_iommu::domains
iommu/vt-d: Remove finding domain in dmar_insert_one_dev_info()
iommu/vt-d: Remove iova_cache_get/put()
iommu/vt-d: Remove domain and devinfo mempool
iommu/vt-d: Remove
On 2/18/22 8:55 AM, Lu Baolu wrote:
v6:
- Refine comments and commit mesages.
- Rename iommu_group_set_dma_owner() to iommu_group_claim_dma_owner().
- Rename iommu_device_use/unuse_kernel_dma() to
iommu_device_use/unuse_default_domain().
- Remove unnecessary EXPORT_SYMBOL_GPL
The iommu group changes notifer is not referenced in the tree. Remove it
to avoid dead code.
Suggested-by: Christoph Hellwig
Signed-off-by: Lu Baolu
Reviewed-by: Jason Gunthorpe
---
include/linux/iommu.h | 23 -
drivers/iommu/iommu.c | 75
ff-by: Lu Baolu
Reviewed-by: Jason Gunthorpe
---
drivers/vfio/vfio.c | 147
1 file changed, 147 deletions(-)
diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c
index e0df2bc692b2..dd3fac0d6bc9 100644
--- a/drivers/vfio/vfio.c
+++ b/drivers/vfio/v
_group_dev() returns, so simply delete the
unbound_list entirely.
Reviewed-by: Chaitanya Kulkarni
Signed-off-by: Jason Gunthorpe
Signed-off-by: Lu Baolu
---
drivers/vfio/vfio.c | 74 ++---
1 file changed, 2 insertions(+), 72 deletions(-)
diff --git a/d
The only remaining reference is in GROUP_GET_STATUS, which could be called
at any time when group fd is valid. Here we just replace the
vfio_group_viable() by directly calling IOMMU core to get viability status.
Signed-off-by: Lu Baolu
Reviewed-by: Jason Gunthorpe
---
drivers/vfio/vf
just like what
we have done in the pcieport driver.
Signed-off-by: Lu Baolu
Reviewed-by: Jason Gunthorpe
---
drivers/vfio/fsl-mc/vfio_fsl_mc.c | 1 +
drivers/vfio/pci/vfio_pci.c | 1 +
drivers/vfio/platform/vfio_amba.c | 1 +
drivers/vfio/platform/vfio_platform.c | 1 +
dr
: Jason Gunthorpe
Suggested-by: Kevin Tian
Signed-off-by: Lu Baolu
Reviewed-by: Jason Gunthorpe
---
drivers/pci/pcie/portdrv_pci.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c
index 35eca6277a96..6b2adb678c21 100644
--- a
admin to block driver binding after
applying the DMA ownership to VFIO.
Signed-off-by: Lu Baolu
Reviewed-by: Jason Gunthorpe
---
drivers/pci/pci-stub.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/pci/pci-stub.c b/drivers/pci/pci-stub.c
index e408099fea52..d1f4c1ce7bd1 100644
--- a
be solved.
Cc: Greg Kroah-Hartman
Cc: Bjorn Helgaas
Cc: Stuart Yoder
Cc: Laurentiu Tudor
Signed-off-by: Lu Baolu
Reviewed-by: Greg Kroah-Hartman
Reviewed-by: Jason Gunthorpe
---
include/linux/amba/bus.h| 8
include/linux/fsl/mc.h | 8
include/linux
Stop sharing platform_dma_configure() helper as they are about to have
their own bus dma_configure callbacks.
Signed-off-by: Lu Baolu
Reviewed-by: Jason Gunthorpe
---
include/linux/platform_device.h | 2 --
drivers/amba/bus.c | 19 ++-
drivers/base/platform.c
lockdown=integrity, can force the kernel to BUG.
With this change, the bus driver could check and set the DMA ownership in
driver binding process and fail on ownership conflicts. The DMA ownership
should be released during driver unbinding.
Signed-off-by: Lu Baolu
Reviewed-by: Greg Kroah-Hartman
iommu_group *group);
The device userspace assignment must be disallowed if the DMA owner
claiming interface returns failure.
Signed-off-by: Jason Gunthorpe
Signed-off-by: Kevin Tian
Signed-off-by: Lu Baolu
---
include/linux/iommu.h | 31 +
drivers/iommu/iommu.c | 153
ment of unsafe bridge
drivers.
- Comments refinement.
This is based on next branch of linux-iommu tree:
https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git
and also available on github:
https://github.com/LuBaolu/intel-iommu/commits/iommu-dma-ownership-v7
Best regards,
baolu
Jason Gu
On 2/25/22 10:12 PM, Vivi, Rodrigo wrote:
On Fri, 2022-02-25 at 10:20 +0800, Lu Baolu wrote:
On 2/24/22 9:39 PM, Vivi, Rodrigo wrote:
On Thu, 2022-02-24 at 13:42 +0800, Lu Baolu wrote:
On 2/23/22 2:29 PM, Tejas Upadhyay wrote:
The VT-d spec requires (10.4.4 Global Command Register, TE
field
On 2/24/22 9:39 PM, Vivi, Rodrigo wrote:
On Thu, 2022-02-24 at 13:42 +0800, Lu Baolu wrote:
On 2/23/22 2:29 PM, Tejas Upadhyay wrote:
The VT-d spec requires (10.4.4 Global Command Register, TE
field) that:
Hardware implementations supporting DMA draining must drain
any in-flight DMA read
On 2/24/22 9:08 PM, Jason Gunthorpe wrote:
On Mon, Feb 14, 2022 at 10:57:01AM +0800, Lu Baolu wrote:
Remove blanks before goto labels.
Signed-off-by: Lu Baolu
drivers/iommu/intel/iommu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
It would be better to rework this function
On 2/24/22 9:05 PM, Jason Gunthorpe wrote:
On Mon, Feb 14, 2022 at 10:56:59AM +0800, Lu Baolu wrote:
Remove unnecessary include files and sort the remaining alphabetically.
Signed-off-by: Lu Baolu
---
drivers/iommu/intel/iommu.c | 34 +++---
1 file changed, 7
On 2/24/22 9:04 PM, Jason Gunthorpe wrote:
On Mon, Feb 14, 2022 at 10:56:58AM +0800, Lu Baolu wrote:
diff --git a/drivers/iommu/intel/debugfs.c b/drivers/iommu/intel/debugfs.c
index db7a0ca73626..ed796eea4581 100644
--- a/drivers/iommu/intel/debugfs.c
+++ b/drivers/iommu/intel/debugfs.c
On 2/24/22 9:09 PM, Jason Gunthorpe wrote:
On Mon, Feb 14, 2022 at 10:57:02AM +0800, Lu Baolu wrote:
This removes unnecessary commented code.
Signed-off-by: Lu Baolu
---
drivers/iommu/intel/iommu.c | 10 +-
1 file changed, 1 insertion(+), 9 deletions(-)
Assuming you don't wa
On 2/23/22 2:29 PM, Tejas Upadhyay wrote:
The VT-d spec requires (10.4.4 Global Command Register, TE
field) that:
Hardware implementations supporting DMA draining must drain
any in-flight DMA read/write requests queued within the
Root-Complex before completing the translation enable
command and
On 2/24/22 1:16 PM, Lu Baolu wrote:
Hi Robin and Jason,
On 2/24/22 2:02 AM, Jason Gunthorpe wrote:
On Wed, Feb 23, 2022 at 06:00:06PM +, Robin Murphy wrote:
...and equivalently just set owner_cnt directly to 0 here. I don't see a
realistic use-case for any driver to claim the same
On 2/24/22 2:00 AM, Robin Murphy wrote:
On 2022-02-18 00:55, Lu Baolu wrote:
[...]
+/**
+ * iommu_group_claim_dma_owner() - Set DMA ownership of a group
+ * @group: The group.
+ * @owner: Caller specified pointer. Used for exclusive ownership.
+ *
+ * This is to support backward compatibility
Hi Robin and Jason,
On 2/24/22 2:02 AM, Jason Gunthorpe wrote:
On Wed, Feb 23, 2022 at 06:00:06PM +, Robin Murphy wrote:
...and equivalently just set owner_cnt directly to 0 here. I don't see a
realistic use-case for any driver to claim the same group more than once,
and allowing it in the
Hi Alex,
On 2/24/22 5:53 AM, Alex Williamson wrote:
On Fri, 18 Feb 2022 08:55:20 +0800
Lu Baolu wrote:
The iommu core and driver core have been enhanced to avoid unsafe driver
binding to a live group after iommu_group_set_dma_owner(PRIVATE_USER)
has been called. There's no need to reg
On 2/23/22 7:53 AM, Jason Gunthorpe wrote:
To spell it out, the scheme I'm proposing looks like this:
Well, I already got this, it is what is in driver_or_DMA_API_token()
that matters
I think you are suggesting to do something like:
if (!READ_ONCE(dev->driver) || ???)
return NULL;
On 2/22/22 7:48 AM, Jason Gunthorpe wrote:
since we should only care about ownership at probe, hotplug, and other
places well outside critical fast-paths, I'm not sure we really need to keep
track of that anyway - it can always be recalculated by walking the
group->devices list,
It has to be loc
ices of the VMD device.
Fixes: 474dd1c65064 ("iommu/vt-d: Fix clearing real DMA device's scalable-mode
context entries")
Cc: sta...@vger.kernel.org # v5.14+
Signed-off-by: Adrian Huang
Link: https://lore.kernel.org/r/20220216091307.703-1-adrianhuang0...@gmail.com
Signed-off-by: Lu Ba
Hi Joerg,
One fix is queued for v5.17. It aims to fix:
- Kernel BUG() when VMD is enabled in scalable mode.
Please consider it for the iommu/fix branch.
Best regards,
Lu Baolu
Adrian Huang (1):
iommu/vt-d: Fix double list_add when enabling VMD in scalable mode
drivers/iommu/intel
On 2/19/22 3:31 PM, Christoph Hellwig wrote:
The overall API and patch looks fine, but:
+ * iommu_group_dma_owner_claimed() - Query group dma ownership status
+ * @group: The group.
+ *
+ * This provides status query on a given group. It is racey and only for
+ * non-binding status reporting.
On 2/18/22 11:51 PM, Jason Gunthorpe wrote:
On Fri, Feb 18, 2022 at 08:55:10AM +0800, Lu Baolu wrote:
Hi folks,
The iommu group is the minimal isolation boundary for DMA. Devices in
a group can access each other's MMIO registers via peer to peer DMA
and also need share the same I/O ad
On 2/18/22 4:21 PM, Huang Adrian wrote:
Another thing I am still concerned is about the context entry setup.
What does the context entries look like for both VMD and subdevices
after domain_context_mapping() being called?
pasid_table in struct device_domain_info is NULL because the field
pasid_t
Hi Yian,
On 2/17/22 3:36 AM, Yian Chen wrote:
Starting from Intel VT-d v3.2, Intel platform BIOS can provide
additional SATC table structure. SATC table includes a list of
SoC integrated devices that support ATC (Address translation
cache).
Enabling ATC (via ATS capability) can be a functional
On 2/16/22 5:13 PM, Adrian Huang wrote:
pci_real_dma_dev() in pci_for_each_dma_alias() gets the real dma device
which is the VMD device :59:00.5. However, pte of the VMD device
:59:00.5 has been configured during this message "pci :59:00.5:
Adding to iommu group 42". So, the status -E
On 1/4/22 9:56 AM, Lu Baolu wrote:
Hi folks,
The iommu group is the minimal isolation boundary for DMA. Devices in
a group can access each other's MMIO registers via peer to peer DMA
and also need share the same I/O address space.
Once the I/O address space is assigned to user control it
iommu_group *group);
The device userspace assignment must be disallowed if the DMA owner
claiming interface returns failure.
Signed-off-by: Jason Gunthorpe
Signed-off-by: Kevin Tian
Signed-off-by: Lu Baolu
---
include/linux/iommu.h | 31 +
drivers/iommu/iommu.c | 158
The only remaining reference is in GROUP_GET_STATUS, which could be called
at any time when group fd is valid. Here we just replace the
vfio_group_viable() by directly calling IOMMU core to get viability status.
Signed-off-by: Lu Baolu
---
drivers/vfio/vfio.c | 18 ++
1 file c
Stop sharing platform_dma_configure() helper as they are about to have
their own bus dma_configure callbacks.
Signed-off-by: Lu Baolu
---
include/linux/platform_device.h | 2 --
drivers/amba/bus.c | 19 ++-
drivers/base/platform.c | 3 +--
3 files changed
The iommu group changes notifer is not referenced in the tree. Remove it
to avoid dead code.
Suggested-by: Christoph Hellwig
Signed-off-by: Lu Baolu
---
include/linux/iommu.h | 23 -
drivers/iommu/iommu.c | 75 ---
2 files changed, 98
301 - 400 of 2383 matches
Mail list logo