On Tue, May 06, 2025 at 09:58:47AM -0300, Jason Gunthorpe wrote:
> On Mon, May 05, 2025 at 07:53:44PM -0700, Nicolin Chen wrote:
> > On Mon, May 05, 2025 at 02:08:07PM -0300, Jason Gunthorpe wrote:
> > > On Wed, Apr 30, 2025 at 12:58:47AM -0700, Nicolin Chen wrote:
> >
On Mon, May 05, 2025 at 02:08:07PM -0300, Jason Gunthorpe wrote:
> On Wed, Apr 30, 2025 at 12:58:47AM -0700, Nicolin Chen wrote:
>
> > > ... and I just hit a problem with it - this is basically guest BDFn
> > > and it works as long as I'm hotplugging the TEE-IO VF
On Wed, Apr 30, 2025 at 05:54:53PM +1000, Alexey Kardashevskiy wrote:
> On 4/10/24 21:41, Jason Gunthorpe wrote:
> > On Fri, Oct 04, 2024 at 02:32:28PM +1000, Alexey Kardashevskiy wrote:
> >
> > > > + __u32 __reserved;
> > > > + __aligned_u64 vdev_id;
>
> I believe this ended up being
On Thu, Feb 27, 2025 at 11:32:42AM -0400, Jason Gunthorpe wrote:
> On Thu, Feb 27, 2025 at 11:21:28AM +, Robin Murphy wrote:
> > All I'm saying is to hide the callback detail in the IOMMUFD code because
> > being IOMMUFD modular is unique to IOMMUFD and not the rest of the core
> > code's probl
On Wed, Feb 26, 2025 at 01:36:10PM -0400, Jason Gunthorpe wrote:
> On Tue, Feb 25, 2025 at 06:25:27PM -0800, Nicolin Chen wrote:
> > On Fri, Feb 21, 2025 at 10:39:59AM -0400, Jason Gunthorpe wrote:
> > > diff --git a/include/linux/iommu.h b/include/linux/iommu.h
> >
On Fri, Feb 21, 2025 at 10:39:59AM -0400, Jason Gunthorpe wrote:
> diff --git a/include/linux/iommu.h b/include/linux/iommu.h
> index 99dd72998cb7f7..082274e8ba6a3d 100644
> --- a/include/linux/iommu.h
> +++ b/include/linux/iommu.h
> @@ -1534,12 +1534,16 @@ void iommu_debugfs_setup(void);
> static
Gunthorpe
Signed-off-by: Nicolin Chen
---
include/linux/msi.h | 33 -
drivers/iommu/dma-iommu.c | 28 +---
2 files changed, 25 insertions(+), 36 deletions(-)
diff --git a/include/linux/msi.h b/include/linux/msi.h
index b10093c4d00e..fc
patch, which
allows multiple implementation options for iommu_dma_prepare_msi(). So, it
does not make sense to have the iommu_dma_compose_msi_msg() in dma-iommu.c
as it no longer provides the only iommu_dma_prepare_msi() implementation.
Signed-off-by: Jason Gunthorpe
Signed-off-by: Nicolin Chen
to use dma-iommu.c for sw_msi and still need iova_cookie.
Suggested-by: Jason Gunthorpe
Signed-off-by: Nicolin Chen
---
include/linux/iommu.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index e93d2e918599..99dd72998cb7 10
comments for readability.
Signed-off-by: Nicolin Chen
---
include/linux/iommu.h| 6 --
drivers/iommu/iommufd/fault.c| 2 +-
drivers/iommu/iommufd/hw_pagetable.c | 2 +-
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/include/linux/iommu.h b/include/linux/
ff-by: Nicolin Chen
---
drivers/iommu/Kconfig | 1 -
drivers/irqchip/Kconfig | 4
kernel/irq/Kconfig | 1 +
3 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
index ec1b5e32b972..5124e7431fe3 100644
--- a/drivers/iommu/Kconfig
+++ b/dr
!
Nicolin
Jason Gunthorpe (5):
genirq/msi: Store the IOMMU IOVA directly in msi_desc instead of
iommu_cookie
genirq/msi: Refactor iommu_dma_compose_msi_msg()
iommu: Make iommu_dma_prepare_msi() into a generic operation
irqchip: Have CONFIG_IRQ_MSI_IOMMU be selected by irqchips that need
mapping directly and use a global per-fd table to
associate assigned IOVA to the MSI pages. This allows the MSI pages to
be loaded into a domain before it is attached ensuring that MSI is not
disrupted.
Signed-off-by: Jason Gunthorpe
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd
rtion for the group mutex
as documentation. For the dmau_iommu.c each iommu_domain is unique to a
group.
Signed-off-by: Jason Gunthorpe
Signed-off-by: Nicolin Chen
---
include/linux/iommu.h | 44 ++-
drivers/iommu/dma-iommu.c
On Wed, Feb 19, 2025 at 09:37:23AM -0400, Jason Gunthorpe wrote:
> On Sat, Feb 08, 2025 at 01:02:33AM -0800, Nicolin Chen wrote:
> > iommu: Turn iova_cookie to dma-iommu private pointer
>
> I suggest you respin this with the updates and stop here at this
> patch, it is enou
On Thu, Feb 13, 2025 at 09:57:52AM -0400, Jason Gunthorpe wrote:
> Nicolin - lets change the patch structure a little bit can you adjust
> this patch to leave iommu_dma_compose_msi_msg() in dma-iommu.c and the
> next patch will be all about renaming and moving it to the MSI core
> code instead? Eas
On Thu, Feb 13, 2025 at 12:28:49PM -0800, Jacob Pan wrote:
> Hi Nicolin,
>
> On Sat, 8 Feb 2025 01:02:34 -0800
> Nicolin Chen wrote:
>
> > -static inline void msi_desc_set_iommu_cookie(struct msi_desc *desc,
> > -c
On Tue, Feb 11, 2025 at 02:16:20PM -0400, Jason Gunthorpe wrote:
> On Sat, Feb 08, 2025 at 01:02:39AM -0800, Nicolin Chen wrote:
>
> > +static struct iommufd_attach_handle *
> > +iommu_group_get_iommufd_handle(struct iommu_group *group)
> > +{
> > + stru
On Sun, Feb 09, 2025 at 02:41:52PM -0400, Jason Gunthorpe wrote:
> On Sat, Feb 08, 2025 at 01:02:41AM -0800, Nicolin Chen wrote:
> > @@ -433,8 +433,8 @@ static int iommufd_group_setup_msi(struct iommufd_group
> > *igroup,
> > list_for_each_entry(cur, &ictx-
Also add fail_nth coverage too.
Signed-off-by: Nicolin Chen
---
tools/testing/selftests/iommu/iommufd.c | 97 +++
.../selftests/iommu/iommufd_fail_nth.c| 21
2 files changed, 118 insertions(+)
diff --git a/tools/testing/selftests/iommu/iommufd.c
b/tools
The iopt_table_enforce_dev_resv_regions needs to access the sw_msi_start
and sw_msi_size stored in the idev, set by user space. So, pass in idev
pointer instead.
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/iommufd_private.h | 2 +-
drivers/iommu/iommufd/device.c | 5
The new IOMMU_OPTION_SW_MSI_START/SIZE must not overlap with any existing
device reserved region, so add a testing region [0x8000, 0x8fff],
on top of the normal IOVA aperture for selftest program to run an overlap
test.
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd
Add a new MOCK_FLAGS_DEVICE_NO_ATTACH flag to allow the mock_domain cmd to
bypass the attach step, as IOMMU_OPTION_SW_MSI_START/SIZE only allow users
to set prior to an IOAS/HWPT attachment.
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/iommufd_test.h | 1 +
drivers/iommu/iommufd
must set the values before attaching the device to
any HWPT/IOAS to have an effect.
Suggested-by: Jason Gunthorpe
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/iommufd_private.h | 2 +
include/uapi/linux/iommufd.h| 20 -
drivers/iommu/iommufd/io_pagetable.c| 15
mapping directly and use a global per-fd table to
associate assigned iova to the MSI pages. This allows the MSI pages to
be loaded into a domain before it is attached ensuring that MSI is not
disrupted.
Signed-off-by: Jason Gunthorpe
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd
comments for readability.
Signed-off-by: Nicolin Chen
---
include/linux/iommu.h| 6 --
drivers/iommu/iommufd/fault.c| 2 +-
drivers/iommu/iommufd/hw_pagetable.c | 2 +-
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/include/linux/iommu.h b/include/linux/
ff-by: Nicolin Chen
---
include/linux/iommu.h | 44 ++-
drivers/iommu/dma-iommu.c | 33 +
drivers/iommu/iommu.c | 29 ++
3 files changed, 73 insertions(+), 33 deletions(-)
diff --git a/include/linux/iomm
The sw_msi_start was set from the per-device reserved region, so storing
it in the iommufd_device structure makes sense too. This will also ease
a following patch adding a SET_OPTION uAPI to set per-idev sw_msi args.
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/iommufd_private.h | 2
to use dma-iommu.c for sw_msi and still need iova_cookie.
Signed-off-by: Nicolin Chen
---
include/linux/iommu.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index e93d2e918599..99dd72998cb7 100644
--- a/include/linux/iommu.h
+++
be compiled into
the kernel.
If IRQ_MSI_IOMMU is selected with no IOMMU side implementation then
prepare/compose will be NOP stubs.
If IRQ_MSI_IOMMU is not selected by an irqchip then the related code on
the iommu side is compiled out.
Signed-off-by: Jason Gunthorpe
Signed-off-by: Nicolin Chen
.
Signed-off-by: Jason Gunthorpe
Signed-off-by: Nicolin Chen
---
include/linux/msi.h | 18 --
drivers/irqchip/irq-gic-v2m.c | 5 +
drivers/irqchip/irq-gic-v3-its.c | 13 +++--
drivers/irqchip/irq-gic-v3-mbi.c | 12
drivers/irqchip/irq
son Gunthorpe
Signed-off-by: Nicolin Chen
---
include/linux/iommu.h | 6 -
include/linux/msi.h | 49 +--
drivers/iommu/dma-iommu.c | 30
3 files changed, 36 insertions(+), 49 deletions(-)
diff --git a/include/linux/iomm
Rename iommu_dma_compose_msi_msg() to msi_msg_set_addr()
iommu: Make iommu_dma_prepare_msi() into a generic operation
irqchip: Have CONFIG_IRQ_MSI_IOMMU be selected by the irqchips that
need it
iommufd: Implement sw_msi support natively
Nicolin Chen (8):
iommu: Turn fault_data to iommufd
On Fri, Feb 07, 2025 at 11:28:01AM -0400, Jason Gunthorpe wrote:
> On Fri, Feb 07, 2025 at 10:30:20AM -0400, Jason Gunthorpe wrote:
> > On Thu, Feb 06, 2025 at 08:26:05PM -0800, Nicolin Chen wrote:
> > > Yea, I found iopt_reserve_iova() is actually missed entirely...
> > &g
On Wed, Jan 29, 2025 at 10:58:00AM -0400, Jason Gunthorpe wrote:
> On Wed, Jan 29, 2025 at 02:44:12PM +0100, Eric Auger wrote:
> > On 1/11/25 4:32 AM, Nicolin Chen wrote:
> > > For systems that require MSI pages to be mapped into the IOMMU translation
> > > t
On Wed, Feb 05, 2025 at 02:49:04PM -0800, Jacob Pan wrote:
> > There have been two approaches to solve this problem:
> > 1. Create an identity mapping in the stage-1. VMM could insert a few
> > RMRs (Reserved Memory Regions) in guest's IORT. Then the guest kernel
> > would fetch these RMR entries f
On Thu, Jan 23, 2025 at 10:07:13AM +, Tian, Kevin wrote:
> > From: Nicolin Chen
> > Sent: Saturday, January 11, 2025 11:32 AM
> >
> > @@ -294,7 +294,9 @@ struct iommu_ioas_unmap {
> >
> > /**
> > * enum iommufd_op
On Wed, Jan 29, 2025 at 02:14:47PM +0100, Eric Auger wrote:
> > @@ -352,6 +352,111 @@ iommufd_device_attach_reserved_iova(struct
> > iommufd_device *idev,
> > return 0;
> > }
> >
> > +/* The device attach/detach/replace helpers for attach_handle */
> > +
> > +static int iommufd_hwpt_attach_
Hi Eric,
On Wed, Jan 29, 2025 at 01:40:54PM +0100, Eric Auger wrote:
> On 1/11/25 4:32 AM, Nicolin Chen wrote:
> > A "fault_data" was added exclusively for the iommufd_fault_iopf_handler()
> > used by IOPF/PRI use cases, along with the attach_handle. Now, the iomm
On Sun, Jan 19, 2025 at 06:40:57PM +0800, Yi Liu wrote:
> On 2025/1/19 04:32, Nicolin Chen wrote:
> > On Sat, Jan 18, 2025 at 04:23:22PM +0800, Yi Liu wrote:
> > > On 2025/1/11 11:32, Nicolin Chen wrote:
> > > > +static int iommufd_hwpt_attach_device(struct iommu
On Sat, Jan 18, 2025 at 04:23:22PM +0800, Yi Liu wrote:
> On 2025/1/11 11:32, Nicolin Chen wrote:
> > "attach_handle" was added exclusively for the iommufd_fault_iopf_handler()
> > used by IOPF/PRI use cases, along with the "fault_data". Now, the iommufd
> &
.
Signed-off-by: Jason Gunthorpe
Signed-off-by: Nicolin Chen
---
include/linux/msi.h | 18 --
drivers/irqchip/irq-gic-v2m.c | 5 +
drivers/irqchip/irq-gic-v3-its.c | 13 +++--
drivers/irqchip/irq-gic-v3-mbi.c | 12
drivers/irqchip/irq
ckdep assertion for the group mutex
as documentation. For the dma_iommu.c each iommu_domain unique to a
group.
Signed-off-by: Jason Gunthorpe
[nicolinc: move iommu_domain_set_sw_msi() from iommu_dma_init_domain() to
iommu_dma_init_domain(); add in iommu_put_dma_cookie() an sw_msi test]
Signed-off-by: Ni
ss,
in order to work with the IOMMU on ARM64.
Signed-off-by: Nicolin Chen
---
include/uapi/linux/vfio.h | 8 --
drivers/vfio/pci/vfio_pci_intrs.c | 46 +++
drivers/vfio/vfio_main.c | 3 ++
3 files changed, 55 insertions(+), 2 deletions(-)
diff -
As the bridge between iommufd core and vfio core, add a set of msi_iova
helpers to call the new msi_iova helpers from the iommufd_device level.
The next patch will use this bridging helpers in vfio-pci code.
Signed-off-by: Nicolin Chen
---
include/linux/vfio.h | 25
vide a set of helpers to allocate/set/unset the resizable array. The
next patch will call them from the vfio code.
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/iommufd_private.h | 2 ++
include/linux/iommufd.h | 6
drivers/iommu/iommufd/device.c
Also add fail_nth coverage too.
Signed-off-by: Nicolin Chen
---
tools/testing/selftests/iommu/iommufd.c | 53 +++
.../selftests/iommu/iommufd_fail_nth.c| 14 +
2 files changed, 67 insertions(+)
diff --git a/tools/testing/selftests/iommu/iommufd.c
b/tools
directly replace the IOMMU_RESV_SW_MSI values. The VMM must set
the values before creating any hwpt's to have any effect.
Suggested-by: Jason Gunthorpe
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/iommufd_private.h | 4 +++
include/uapi/linux/iommufd.h
: Nicolin Chen
---
drivers/iommu/iommufd/iommufd_private.h | 23 +++-
drivers/iommu/iommufd/device.c | 158
drivers/iommu/iommufd/hw_pagetable.c| 3 +
drivers/iommu/iommufd/main.c| 9 ++
4 files changed, 170 insertions(+), 23 deletions(-)
diff
Now, iommufd has its own iommufd_sw_msi using iommufd_hwpt, the iommufd
owned domain's private pointer. Similarly, iova_cookie can be seen as a
dma-iommu owned domain's private pointer. So, move iova_cookie into the
union.
Signed-off-by: Nicolin Chen
---
include/linux/iommu.h | 2
the fault.c file to make it generic for
all cases. Simplify the remaining fault specific routine to attach/detach.
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/iommufd_private.h | 40 +---
drivers/iommu/iommufd/device.c | 105 +
drivers/iommu/iommufd/fau
comments for readability.
Signed-off-by: Nicolin Chen
---
include/linux/iommu.h| 6 --
drivers/iommu/iommufd/fault.c| 2 +-
drivers/iommu/iommufd/hw_pagetable.c | 2 +-
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/include/linux/iommu.h b/include/linux/
be compiled into
the kernel.
If IRQ_MSI_IOMMU is selected with no IOMMU side implementation then
prepare/compose will be NOP stubs.
If IRQ_MSI_IOMMU is not selected by an irqchip then the related code on
the iommu side is compiled out.
Signed-off-by: Jason Gunthorpe
Signed-off-by: Nicolin Chen
horpe
Signed-off-by: Nicolin Chen
---
include/linux/iommu.h | 6 --
include/linux/msi.h | 45 +++
drivers/iommu/dma-iommu.c | 30 +-
3 files changed, 32 insertions(+), 49 deletions(-)
diff --git a/include/linux/iommu.h b/
orpe (5):
genirq/msi: Store the IOMMU IOVA directly in msi_desc instead of
iommu_cookie
genirq/msi: Rename iommu_dma_compose_msi_msg() to
msi_msg_set_msi_addr()
iommu: Make iommu_dma_prepare_msi() into a generic operation
irqchip: Have CONFIG_IRQ_MSI_IOMMU be selected by the irqchips t
This was missing in the series introducing the fault object. Thus, add it.
Signed-off-by: Nicolin Chen
---
tools/testing/selftests/iommu/iommufd_fail_nth.c | 14 ++
1 file changed, 14 insertions(+)
diff --git a/tools/testing/selftests/iommu/iommufd_fail_nth.c
b/tools/testing
There are a few patches in vIRQ series that rework the fault.c file. So,
we should fix this before that bigger series touches the same code.
And add missing coverage for IOMMU_FAULT_QUEUE_ALLOC in iommufd_fail_nth.
Thanks!
Nicolin
Nicolin Chen (2):
iommufd/fault: Fix out_fput in
ef_put+0x100/0x138 (L)
__fput_sync+0x4c/0xd0
Drop those two lines to fix the warnings above.
Fixes: 07838f7fd529 ("iommufd: Add iommufd fault object")
Cc: sta...@vger.kernel.org
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/fault.c | 2 --
1 file changed, 2 deletions(
On Fri, Oct 25, 2024 at 04:49:52PM -0700, Nicolin Chen wrote:
> With the introduction of the new object and its infrastructure, update the
> doc to reflect that and add a new graph.
>
> Reviewed-by: Jason Gunthorpe
> Reviewed-by: Kevin Tian
> Signed-off-by: Nicolin Chen
>
On Tue, Oct 29, 2024 at 08:24:52AM +, Tian, Kevin wrote:
> > From: Nicolin Chen
> > Sent: Saturday, October 26, 2024 7:51 AM
> >
> > From: Jason Gunthorpe
> >
> > The iommu_copy_struct_from_user_array helper can be used to copy a
> > single
>
On Tue, Oct 29, 2024 at 03:55:58PM -0300, Jason Gunthorpe wrote:
> On Tue, Oct 29, 2024 at 09:18:05AM -0700, Nicolin Chen wrote:
> > I think we'd need the same change in iommufd_object_abort() too.
>
> Makes sense
I found xa_cmpxchg() does xas_result to its returnin
On Tue, Oct 29, 2024 at 04:09:41PM -0300, Jason Gunthorpe wrote:
> On Fri, Oct 25, 2024 at 04:50:34PM -0700, Nicolin Chen wrote:
> > @@ -497,17 +497,35 @@ int iommufd_hwpt_invalidate(struct iommufd_ucmd *ucmd)
> > goto out;
> > }
> >
> > - hw
On Tue, Oct 29, 2024 at 03:48:01PM -0300, Jason Gunthorpe wrote:
> On Tue, Oct 29, 2024 at 10:29:56AM -0700, Nicolin Chen wrote:
> > On Tue, Oct 29, 2024 at 12:58:24PM -0300, Jason Gunthorpe wrote:
> > > On Fri, Oct 25, 2024 at 04:50:30PM -0700, Nicolin Chen wrote:
> >
On Tue, Oct 29, 2024 at 03:55:58PM -0300, Jason Gunthorpe wrote:
> On Tue, Oct 29, 2024 at 09:18:05AM -0700, Nicolin Chen wrote:
> > On Tue, Oct 29, 2024 at 11:49:07AM -0300, Jason Gunthorpe wrote:
> > > On Fri, Oct 25, 2024 at 04:49:43PM -0700, Nicolin Chen wrote:
> &g
On Tue, Oct 29, 2024 at 12:58:24PM -0300, Jason Gunthorpe wrote:
> On Fri, Oct 25, 2024 at 04:50:30PM -0700, Nicolin Chen wrote:
> > diff --git a/drivers/iommu/iommufd/device.c b/drivers/iommu/iommufd/device.c
> > index 5fd3dd420290..e50113305a9c 100644
> > --- a/drivers/i
On Tue, Oct 29, 2024 at 11:49:07AM -0300, Jason Gunthorpe wrote:
> On Fri, Oct 25, 2024 at 04:49:43PM -0700, Nicolin Chen wrote:
> > To support driver-allocated vIOMMU objects, it's suggested to call the
> > allocator helper in IOMMU dirvers. However, there is no guarantee t
On Tue, Oct 29, 2024 at 12:27:46PM -0300, Jason Gunthorpe wrote:
> On Mon, Oct 28, 2024 at 07:52:10AM -0700, Nicolin Chen wrote:
> > On Mon, Oct 28, 2024 at 10:03:09AM -0300, Jason Gunthorpe wrote:
> > In iommufd_hwpt_paging_alloc(), we reject IOMMU_HWPT_FAULT_ID_VALID:
&g
On Tue, Oct 29, 2024 at 12:59:35PM -0300, Jason Gunthorpe wrote:
> On Tue, Oct 29, 2024 at 08:46:40AM -0700, Nicolin Chen wrote:
> > On Tue, Oct 29, 2024 at 12:36:24PM -0300, Jason Gunthorpe wrote:
> > > On Tue, Oct 29, 2024 at 11:54:36AM -0300, Jason Gunthorpe wrote:
> >
On Tue, Oct 29, 2024 at 12:34:38PM -0300, Jason Gunthorpe wrote:
> On Fri, Oct 25, 2024 at 04:49:49PM -0700, Nicolin Chen wrote:
> > For an iommu_dev that can unplug (so far only this selftest does so), the
> > viommu->iommu_dev pointer has no guarantee of its life cycle afte
On Tue, Oct 29, 2024 at 12:36:24PM -0300, Jason Gunthorpe wrote:
> On Tue, Oct 29, 2024 at 11:54:36AM -0300, Jason Gunthorpe wrote:
> > On Fri, Oct 25, 2024 at 04:49:44PM -0700, Nicolin Chen wrote:
> > > +void iommufd_viommu_destroy(struct iommufd_object *obj)
>
On Tue, Oct 29, 2024 at 11:54:36AM -0300, Jason Gunthorpe wrote:
> On Fri, Oct 25, 2024 at 04:49:44PM -0700, Nicolin Chen wrote:
> > +void iommufd_viommu_destroy(struct iommufd_object *obj)
> > +{
> > + struct iommufd_viommu *viommu =
> > + container_of(obj,
On Mon, Oct 28, 2024 at 07:52:10AM -0700, Nicolin Chen wrote:
> On Mon, Oct 28, 2024 at 10:03:09AM -0300, Jason Gunthorpe wrote:
> > On Mon, Oct 28, 2024 at 11:24:10AM +0800, Zhangfei Gao wrote:
> >
> > > > +/**
> > > > + * iommufd_viommu_alloc_hwpt_ne
On Mon, Oct 28, 2024 at 03:11:32AM +, Tian, Kevin wrote:
> > From: Nicolin Chen
> > Sent: Saturday, October 26, 2024 7:51 AM
> >
> > +
> > +/**
> > + * struct iommu_vdevice_alloc - ioctl(IOMMU_VDEVICE_ALLOC)
> > + * @size: sizeof(struct iommu_vdevi
On Mon, Oct 28, 2024 at 10:53:38PM +0800, Zhangfei Gao wrote:
> On Mon, 28 Oct 2024 at 11:24, Zhangfei Gao wrote:
>
> > By the way, has qemu changed compared with v3?
> > I still got a hardware error in this version, in check
>
> Found iommufd_viommu_p2-v5 misses some patches,
> Simply tested ok
On Mon, Oct 28, 2024 at 10:03:09AM -0300, Jason Gunthorpe wrote:
> On Mon, Oct 28, 2024 at 11:24:10AM +0800, Zhangfei Gao wrote:
>
> > > +/**
> > > + * iommufd_viommu_alloc_hwpt_nested() - Get a hwpt_nested for a vIOMMU
> > > + * @viommu: vIOMMU ojbect to associate the hwpt_nested/domain with
> >
On Sun, Oct 27, 2024 at 11:02:31PM +0800, Zhangfei Gao wrote:
> On Sat, 26 Oct 2024 at 07:51, Nicolin Chen wrote:
> > +/* Caller should xa_lock(&viommu->vdevs) to protect the return value */
> > +struct device *iommufd_viommu_find_dev(struct
Similar to the coverage of cache_invalidate_user for iotlb invalidation,
add a device cache and a viommu_cache_invalidate function to test it out.
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/iommufd_test.h | 25 +
drivers/iommu/iommufd/selftest.c | 76
refcount is unbalanced. The refcount inc/dec will be added
in the following patch.
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/selftest.c | 32
1 file changed, 24 insertions(+), 8 deletions(-)
diff --git a/drivers/iommu/iommufd/selftest.c b/drivers/i
Add a vdevice_alloc op to the viommu mock_viommu_ops for the coverage of
IOMMU_VIOMMU_TYPE_SELFTEST allocations. Then, add a vdevice_alloc TEST_F
to cover the IOMMU_VDEVICE_ALLOC ioctl.
Signed-off-by: Nicolin Chen
---
tools/testing/selftests/iommu/iommufd_utils.h | 27 +++
tools
Allow IOMMU driver to use a vIOMMU object that holds a nesting parent
hwpt/domain to allocate a nested domain.
Suggested-by: Jason Gunthorpe
Reviewed-by: Kevin Tian
Signed-off-by: Nicolin Chen
---
include/linux/iommufd.h | 9 +
1 file changed, 9 insertions(+)
diff --git a/include
re both as
the ioctl inputs and take refcounts in the ioctl handler.
Then, let the idev structure hold the allocated vdev pointer with a proper
locking protection.
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/iommufd_private.h | 20 +
include/linux/iommufd.h | 3
This avoids a bigger trouble of exposing struct iommufd_device and struct
iommufd_vdevice in the public header.
Signed-off-by: Nicolin Chen
---
include/linux/iommufd.h| 8
drivers/iommu/iommufd/driver.c | 13 +
2 files changed, 21 insertions(+)
diff --git a
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/Makefile | 3 +-
drivers/iommu/iommufd/iommufd_private.h | 3 +
include/uapi/linux/iommufd.h| 40 +++
drivers/iommu/iommufd/main.c| 6 ++
drivers/iommu/iommufd/viommu.c | 89
Use these inline helpers to shorten those container_of lines.
Note that one of them goes back and forth between iommu_domain and
mock_iommu_domain, which isn't necessary. So drop its container_of.
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/selftest.c
Scan those
commands against the permitted command list and fix their VMID/SID fields.
Co-developed-by: Eric Auger
Signed-off-by: Eric Auger
Co-developed-by: Jason Gunthorpe
Signed-off-by: Jason Gunthorpe
Signed-off-by: Nicolin Chen
---
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 5 +
in
From: Jason Gunthorpe
Now, ATC invalidation can be done with the vIOMMU invalidation op. A guest
owned IOMMU_DOMAIN_NESTED can do an ATS too. Allow it to pass in the EATS
field via the vSTE words.
Signed-off-by: Jason Gunthorpe
Signed-off-by: Nicolin Chen
---
drivers/iommu/arm/arm-smmu-v3
With the introduction of the new object and its infrastructure, update the
doc and the vIOMMU graph to reflect that.
Reviewed-by: Jason Gunthorpe
Signed-off-by: Nicolin Chen
---
Documentation/userspace-api/iommufd.rst | 41 +++--
1 file changed, 32 insertions(+), 9
Add a viommu_cache test function to cover vIOMMU invalidations using the
updated IOMMU_HWPT_INVALIDATE ioctl, which now allows passing in a vIOMMU
via its hwpt_id field.
Signed-off-by: Nicolin Chen
---
tools/testing/selftests/iommu/iommufd_utils.h | 32
tools/testing/selftests/iommu
Similar to IOMMU_TEST_OP_MD_CHECK_IOTLB verifying a mock_domain's iotlb,
IOMMU_TEST_OP_DEV_CHECK_CACHE will be used to verify a mock_dev's cache.
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/iommufd_test.h | 5
tools/testing/selftests/iommu/iommufd_ut
iommu_copy_struct_from_user_array kdoc
accordingly.
Signed-off-by: Jason Gunthorpe
Signed-off-by: Nicolin Chen
---
include/linux/iommu.h | 48 ++-
1 file changed, 47 insertions(+), 1 deletion(-)
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 14f24b5cd16f
viommu_id,
and reuse the IOMMU_HWPT_INVALIDATE uAPI for vIOMMU invalidations. Drivers
can define different structures for vIOMMU invalidations v.s. HWPT ones.
Update the uAPI, kdoc, and selftest case accordingly.
Reviewed-by: Jason Gunthorpe
Signed-off-by: Nicolin Chen
---
include/uapi/linux
This per-vIOMMU cache_invalidate op is like the cache_invalidate_user op
in struct iommu_domain_ops, but wider, supporting device cache (e.g. PCI
ATC invaldiations).
Reviewed-by: Jason Gunthorpe
Signed-off-by: Nicolin Chen
---
include/linux/iommufd.h | 10 ++
1 file changed, 10
A vIOMMU-based hwpt_nested requires a cache invalidation op too, either
using the one in iommu_domain_ops or the one in viommu_ops. Enforce that
upon the allocated hwpt_nested.
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/hw_pagetable.c | 4 +++-
1 file changed, 3 insertions(+), 1
t/unset_vdev_id handlers for proper lockings
v1
https://lore.kernel.org/all/cover.1723061377.git.nicol...@nvidia.com/
Thanks!
Nicolin
Jason Gunthorpe (2):
iommu: Add iommu_copy_struct_from_full_user_array helper
iommu/arm-smmu-v3: Allow ATS for IOMMU_DOMAIN_NESTED
Nicolin Chen (11):
iommufd/v
ictx.
Reviewed-by: Kevin Tian
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/iommufd_private.h | 3 +++
drivers/iommu/iommufd/main.c| 20
2 files changed, 23 insertions(+)
diff --git a/drivers/iommu/iommufd/iommufd_private.h
b/drivers/iommu/io
int in creating a vIOMMU (vsmmu) from the beginning if it would
not support a nested_domain.
Signed-off-by: Nicolin Chen
---
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 26 +++---
include/uapi/linux/iommufd.h | 2 +
.../arm/arm-smmu-v3/arm-smmu-v3-iommufd.c
Add a new iommufd_viommu FIXTURE and setup it up with a vIOMMU object.
Any new vIOMMU feature will be added as a TEST_F under that.
Signed-off-by: Nicolin Chen
---
tools/testing/selftests/iommu/iommufd_utils.h | 28 ++
tools/testing/selftests/iommu/iommufd.c | 87
With the introduction of the new object and its infrastructure, update the
doc to reflect that and add a new graph.
Reviewed-by: Jason Gunthorpe
Reviewed-by: Kevin Tian
Signed-off-by: Nicolin Chen
---
Documentation/userspace-api/iommufd.rst | 69 -
1 file changed, 68
Implement the viommu alloc/free functions to increase/reduce refcount of
its dependent mock iommu device. User space can verify this loop via the
IOMMU_VIOMMU_TYPE_SELFTEST.
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/iommufd_test.h | 2 +
drivers/iommu/iommufd/selftest.c | 64
object. Since a vIOMMU object holds the parent
hwpt's refcount already, increase the refcount of the vIOMMU only.
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/iommufd_private.h | 1 +
include/uapi/linux/iommufd.h| 14 ++---
drivers/iommu/iommufd/hw_pagetable.c
1 - 100 of 1209 matches
Mail list logo