On Thu, Oct 31, 2024 at 10:14:59AM -0300, Jason Gunthorpe wrote:
> On Wed, Oct 30, 2024 at 02:34:33PM -0700, Nicolin Chen wrote:
> > +static struct iommufd_hwpt_nested *
> > +iommufd_viommu_alloc_hwpt_nested(struct iommufd_viommu *viommu, u32 flags,
> > +
Reviewed-by: Kevin Tian
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
. Since a vIOMMU object holds the parent hwpt's
refcount already, increase the refcount of the vIOMMU only.
Reviewed-by: Kevin Tian
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/iommufd_private.h | 1 +
include/uapi/linux/iommufd.h| 14 ++---
drivers/iommu/io
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.
Reviewed-by: Kevin Tian
Reviewed-by: Jason Gunthorpe
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd
refcount is unbalanced. The refcount inc/dec will be added
in the following patch.
Suggested-by: Jason Gunthorpe
Reviewed-by: Kevin Tian
Reviewed-by: Jason Gunthorpe
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/selftest.c | 39 +---
1 file changed, 31 inse
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.
Reviewed-by: Kevin Tian
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/iommufd_test.h | 5
tools/testing/selft
This avoids a bigger trouble of exposing struct iommufd_device and struct
iommufd_vdevice in the public header.
Reviewed-by: Kevin Tian
Signed-off-by: Nicolin Chen
---
include/linux/iommufd.h| 8
drivers/iommu/iommufd/driver.c | 13 +
2 files changed, 21
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.
Reviewed-by: Kevin Tian
Signed-off-by: Nicolin Chen
---
tools/testing/selftests/iommu/iommufd_utils.h | 32
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
Reviewed-by: Jason Gunthorpe
Signed-off-by: Nicolin Chen
---
include/linux/iommufd.h | 9 +
1 file changed, 9
tl handler.
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/iommufd_private.h | 18 ++
include/linux/iommufd.h | 4 ++
include/uapi/linux/iommufd.h| 22 +++
drivers/iommu/iommufd/main.c| 6 ++
drivers/iommu/iommufd/viommu.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.
Reviewed-by: Kevin Tian
Signed-off-by: Nicolin Chen
---
tools/testing/selftests/iommu/iommufd_utils.h | 28
tools/testing/selftests/iommu/iommufd.c
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.
Reviewed-by: Kevin Tian
Reviewed-by: Jason Gunthorpe
Signed-off-by: Nicolin Chen
---
dr
A nested domain now can be allocated for a parent domain or for a vIOMMU
object. Rework the existing allocators to prepare for the latter case.
Reviewed-by: Kevin Tian
Reviewed-by: Jason Gunthorpe
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/selftest.c | 89
iommu_copy_struct_from_user_array kdoc
accordingly.
Signed-off-by: Jason Gunthorpe
Reviewed-by: Kevin Tian
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
With the introduction of the new object and its infrastructure, update the
doc and the vIOMMU graph to reflect that.
Reviewed-by: Jason Gunthorpe
Reviewed-by: Kevin Tian
Signed-off-by: Nicolin Chen
---
Documentation/userspace-api/iommufd.rst | 41 +++--
1 file changed, 32
MUFD_DRIVER config
* Dropped useless iommu_dev point from the viommu structure
* Added missing index numnbers to new types in the uAPI header
* Dropped IOMMU_VIOMMU_INVALIDATE uAPI; Instead, reuse the HWPT one
* Reworked mock_viommu_cache_invalidate() using the new iommu helper
* Reordered details of s
more robust to verify if
the xarray slot indexed by the input obj->id is having an XA_ZERO_ENTRY,
which is the reserved value stored by xa_alloc via iommufd_object_alloc.
Suggested-by: Jason Gunthorpe
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/main.c | 16 +++-
1 file
remaining
to be selectable for drivers to build the existing iova_bitmap.c file.
Suggested-by: Jason Gunthorpe
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/Kconfig | 5
drivers/iommu/iommufd/Makefile | 5 +++-
drivers/iommu/iommufd/iommufd_private.h | 4 ---
include
;
};
It has to expose struct iommufd_object and enum iommufd_object_type from
the core-level private header to the public iommufd header.
Reviewed-by: Jason Gunthorpe
Reviewed-by: Kevin Tian
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/iommufd_private.h | 25
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
Reviewed-by: Kevin Tian
Signed-off-by: Nicolin Chen
---
include/linux/iommufd.h | 10 ++
1
.
Update the uAPI, kdoc, and selftest case accordingly.
Reviewed-by: Jason Gunthorpe
Reviewed-by: Kevin Tian
Signed-off-by: Nicolin Chen
---
include/uapi/linux/iommufd.h| 9 --
drivers/iommu/iommufd/hw_pagetable.c| 40 +++--
tools/testing/selftests/iommu
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.
Reviewed-by: Kevin Tian
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/iommufd_test.h | 25 +
drivers/iommu/iommufd/selftest.c
unthorpe (1):
iommu: Add iommu_copy_struct_from_full_user_array helper
Nicolin Chen (9):
iommufd/viommu: Add IOMMUFD_OBJ_VDEVICE and IOMMU_VDEVICE_ALLOC ioctl
iommufd/selftest: Add IOMMU_VDEVICE_ALLOC test coverage
iommu/viommu: Add cache_invalidate to iommufd_viommu_ops
iommufd: Allow hwpt
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.
Reviewed-by: Kevin Tian
Reviewed-by: Jason Gunthorpe
Signed-off-by: Nicolin Chen
---
tools/testing
iommu_domain_ops my_driver_domain_ops = {
.viommu_alloc = my_driver_viommu_alloc,
};
Suggested-by: Jason Gunthorpe
Reviewed-by: Kevin Tian
Reviewed-by: Jason Gunthorpe
Signed-off-by: Nicolin Chen
---
include/linux/iommu.h | 14 ++
include/lin
On Thu, Oct 31, 2024 at 10:16:37AM -0300, Jason Gunthorpe wrote:
> On Wed, Oct 30, 2024 at 02:34:38PM -0700, Nicolin Chen wrote:
> > +FIXTURE_SETUP(iommufd_viommu)
> > +{
> > + self->fd = open("/dev/iommu", O_RDWR);
> > + ASSERT_NE(-1, self->fd);
&
On Thu, Oct 31, 2024 at 02:28:12PM +0800, Zhangfei Gao wrote:
> On Thu, 31 Oct 2024 at 05:36, Nicolin Chen wrote:
> >
> > Following the previous vIOMMU series, this adds another vDEVICE structure,
> > representing the association from an iommufd_device to an iommufd_viomm
On Thu, Oct 31, 2024 at 08:59:37AM -0300, Jason Gunthorpe wrote:
> On Thu, Oct 31, 2024 at 02:28:12PM +0800, Zhangfei Gao wrote:
>
> > > As for the implementation of the series, add driver support in ARM SMMUv3
> > > for a real world use case.
> > >
> > > This series is on Github:
> > > https://gi
On Thu, Oct 31, 2024 at 10:29:41AM -0300, Jason Gunthorpe wrote:
> On Wed, Oct 30, 2024 at 02:35:27PM -0700, Nicolin Chen wrote:
> > +void iommufd_vdevice_destroy(struct iommufd_object *obj)
> > +{
> > + struct iommufd_vdevice *vdev =
> > + container_of(obj,
On Thu, Oct 31, 2024 at 02:04:46PM -0300, Jason Gunthorpe wrote:
> On Thu, Oct 31, 2024 at 09:56:37AM -0700, Nicolin Chen wrote:
> > On Thu, Oct 31, 2024 at 10:29:41AM -0300, Jason Gunthorpe wrote:
> > > On Wed, Oct 30, 2024 at 02:35:27PM -0700, Nicolin Chen wr
On Thu, Nov 07, 2024 at 09:11:27PM +1100, Alexey Kardashevskiy wrote:
> On 31/10/24 08:35, Nicolin Chen wrote:
> > Introduce a new IOMMUFD_OBJ_VDEVICE to represent a physical device (struct
> > device) against a vIOMMU (struct iommufd_viommu) object in a VM.
> >
> > T
On Thu, Nov 07, 2024 at 10:20:49AM +0700, Bagas Sanjaya wrote:
> On Wed, Nov 06, 2024 at 05:35:45PM -0800, Nicolin Chen wrote:
> > On Thu, Nov 07, 2024 at 07:56:31AM +0700, Bagas Sanjaya wrote:
> > > On Tue, Nov 05, 2024 at 12:04:29PM -0800, Nicolin Chen wrote:
> > > >
On Thu, Nov 07, 2024 at 12:37:59PM +1100, Alexey Kardashevskiy wrote:
> On 31/10/24 08:34, Nicolin Chen wrote:
> > +int iommufd_viommu_alloc_ioctl(struct iommufd_ucmd *ucmd)
> > +{
> > + struct iommu_viommu_alloc *cmd = ucmd->cmd;
> > + struct io
On Thu, Nov 07, 2024 at 07:56:31AM +0700, Bagas Sanjaya wrote:
> On Tue, Nov 05, 2024 at 12:04:29PM -0800, Nicolin Chen wrote:
> > With the introduction of the new object and its infrastructure, update the
> > doc to reflect that and add a new graph.
> >
> > R
On Thu, Nov 14, 2024 at 12:20:10PM -0400, Jason Gunthorpe wrote:
> On Wed, Nov 13, 2024 at 07:18:42PM -0800, Nicolin Chen wrote:
> > > so the user would try to create vDevices with a given viommu_obj until
> > > failure, then it would allocate another viommu_obj for the faile
On Thu, Nov 14, 2024 at 11:13:00AM +0800, Yi Liu wrote:
> On 2024/11/14 08:18, Nicolin Chen wrote:
> > On Tue, Nov 12, 2024 at 09:15:02PM +0800, Yi Liu wrote:
> > > On 2024/11/6 04:04, Nicolin Chen wrote:
> > > > +5. IOMMUFD_OBJ_VIOMMU can be
On Tue, Nov 12, 2024 at 09:15:02PM +0800, Yi Liu wrote:
> On 2024/11/6 04:04, Nicolin Chen wrote:
> > +5. IOMMUFD_OBJ_VIOMMU can be only manually created via the
> > IOMMU_VIOMMU_ALLOC
> > + uAPI, provided a dev_id (for the device's physical IOMMU to back the
> >
Similar to iommu_report_device_fault, this allows IOMMU drivers to report,
from threaded IRQ handlers to user space hypervisors, IRQs or events that
belong to a vIOMMU.
Signed-off-by: Nicolin Chen
---
include/linux/iommufd.h| 9
drivers/iommu/iommufd/driver.c | 41
The handler will get vDEVICE object from the given mdev and convert it to
its per-vIOMMU virtual ID to mimic a real IOMMU driver.
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/iommufd_test.h | 10 ++
drivers/iommu/iommufd/selftest.c | 30
2 files
ops don't call arm_smmu_attach_prepare/commit(), thus simply
call the new helpers at the top.
Signed-off-by: Nicolin Chen
---
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 23 +
.../arm/arm-smmu-v3/arm-smmu-v3-iommufd.c | 49 +++
drivers/iommu/arm/arm-smmu-v
iommufd_fault_iopf_handler() in the header too, since it's quite
simple after all.
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/iommufd_private.h | 20 +++-
drivers/iommu/iommufd/fault.c | 17 -
2 files changed, 19 insertions(+), 18 deletions(-)
diff --
Rename the file, aligning with the new eventq object.
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/Makefile | 2 +-
drivers/iommu/iommufd/{fault.c => eventq.c} | 0
2 files changed, 1 insertion(+), 1 deletion(-)
rename drivers/iommu/iommufd/{fault.c => eventq.c
out a minimal level of renamings to all the related functions.
Add a common iommufd_eventq_ops and iommufd_eventq_init to prepare for an
IOMMUFD_OBJ_EVENTQ_VIRQ. Also, add missing xa_destroy and mutex_destroy in
iommufd_fault_destroy().
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/iom
Aside from the IOPF framework, iommufd provides an additional pathway to
report a hardware event or IRQ, via the vIRQ of vIOMMU infrastructure.
Define an iommu_virq_arm_smmuv3 uAPI structure, and report stage-1 faults
in the threaded IRQ handler.
Signed-off-by: Nicolin Chen
---
drivers/iommu
Allow a vIOMMU object to allocate vIRQ Event Queues, with a condition that
each vIOMMU can only have one single vIRQ event queue per type.
Add iommufd_eventq_virq_alloc with an iommufd_eventq_virq_ops for this new
ioctl.
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/iommufd_private.h
-off-by: Nicolin Chen
---
include/linux/iommufd.h| 8
drivers/iommu/iommufd/driver.c | 18 ++
2 files changed, 26 insertions(+)
diff --git a/include/linux/iommufd.h b/include/linux/iommufd.h
index 40cc9bbb1d24..1f5376476cfa 100644
--- a/include/linux/iommufd.h
+++ b
: Nicolin Chen
---
drivers/iommu/iommufd/selftest.c| 23 +++
tools/testing/selftests/iommu/iommufd.c | 5 +
2 files changed, 28 insertions(+)
diff --git a/drivers/iommu/iommufd/selftest.c b/drivers/iommu/iommufd/selftest.c
index a0de6d6d4e68..d1438d81e664 100644
Trigger an IRQ giving an idev ID, to test the loopback whether receiving
or not the vdev_id that was set to the idev by the line above.
Signed-off-by: Nicolin Chen
---
tools/testing/selftests/iommu/iommufd_utils.h | 63 +++
tools/testing/selftests/iommu/iommufd.c | 22
With the introduction of the new objects, update the doc to reflect that.
Signed-off-by: Nicolin Chen
---
Documentation/userspace-api/iommufd.rst | 19 +++
1 file changed, 19 insertions(+)
diff --git a/Documentation/userspace-api/iommufd.rst
b/Documentation/userspace-api
On Mon, Jan 06, 2025 at 11:01:32AM +0800, Baolu Lu wrote:
> On 1/4/25 03:43, Nicolin Chen wrote:
> > diff --git a/include/uapi/linux/iommufd.h b/include/uapi/linux/iommufd.h
> > index 0a08aa82e7cc..55e3d5a14cca 100644
> > --- a/include/uapi/linux/iommufd.h
> > +++ b/i
On Mon, Jan 06, 2025 at 10:46:21AM -0800, Nicolin Chen wrote:
> On Mon, Jan 06, 2025 at 11:01:32AM +0800, Baolu Lu wrote:
> > Nit: I think it would be more readable to add a check in the vevent
> > reporting helper.
> >
> > diff --git a/drivers/iommu/iommufd/drive
iommufd_veventq_ops for the new ioctl.
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/iommufd_private.h | 58 +++
include/linux/iommufd.h | 3 +
include/uapi/linux/iommufd.h| 31 ++
drivers/iommu/iommufd/eventq.c | 129
attaching to a nested
domain, calling a newly added iommufd_viommu_get_vdev_id helper
* Adde an arm_vmaster_report_event helper in arm-smmu-v3-iommufd file
to simplify the routine in arm_smmu_handle_evt() of the main driver
v1
https://lore.kernel.org/all/cover.1724777091.git
iommufd_fault_iopf_handler() in the header too, since it's quite
simple after all.
Reviewed-by: Kevin Tian
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/iommufd_private.h | 20 +++-
drivers/iommu/iommufd/fault.c | 17 -
2 files changed, 19 insertions(+
x27;t need "response", leave the xa_init_flags
in its original location.
Reviewed-by: Kevin Tian
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/fault.c | 48 ---
1 file changed, 28 insertions(+), 20 deletions(-)
diff --git a/drivers/iommu/iommufd/fa
Move VDEVICE upward to keep the order. Also run clang-format for the same
coding style at line wrappings. No functional change.
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/main.c | 16 +++-
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/drivers/iommu/iommufd
-off-by: Nicolin Chen
---
include/linux/iommufd.h| 8
drivers/iommu/iommufd/driver.c | 20
2 files changed, 28 insertions(+)
diff --git a/include/linux/iommufd.h b/include/linux/iommufd.h
index 8948b1836940..9c6ba7df3994 100644
--- a/include/linux/iommufd.h
Trigger a vEVENT by feeding an idev ID and validating the returned output
virt_id whether it equals to the value that was set to the vDEVICE.
Signed-off-by: Nicolin Chen
---
tools/testing/selftests/iommu/iommufd_utils.h | 65 +++
tools/testing/selftests/iommu/iommufd.c
Rename the file, aligning with the new eventq object.
Reviewed-by: Kevin Tian
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/Makefile | 2 +-
drivers/iommu/iommufd/{fault.c => eventq.c} | 0
2 files changed, 1 insertion(+), 1 deletion(-)
rename drivers/iommu/iomm
.
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/selftest.c| 23 +++
tools/testing/selftests/iommu/iommufd.c | 5 +
2 files changed, 28 insertions(+)
diff --git a/drivers/iommu/iommufd/selftest.c b/drivers/iommu/iommufd/selftest.c
index a0de6d6d4e68
t Queue).
Also, add missing xa_destroy and mutex_destroy in iommufd_fault_destroy().
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/iommufd_private.h | 52 ++---
drivers/iommu/iommufd/fault.c | 142 +++-
drivers/iommu/iommufd/hw_pagetable.c| 6 +-
With the introduction of the new objects, update the doc to reflect that.
Signed-off-by: Nicolin Chen
---
Documentation/userspace-api/iommufd.rst | 16
1 file changed, 16 insertions(+)
diff --git a/Documentation/userspace-api/iommufd.rst
b/Documentation/userspace-api
The handler will get vDEVICE object from the given mdev and convert it to
its per-vIOMMU virtual ID to mimic a real IOMMU driver.
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/iommufd_test.h | 10 ++
drivers/iommu/iommufd/selftest.c | 30
2 files
Similar to iommu_report_device_fault, this allows IOMMU drivers to report
vIOMMU events from threaded IRQ handlers to user space hypervisors.
Signed-off-by: Nicolin Chen
---
include/linux/iommufd.h| 11 ++
drivers/iommu/iommufd/driver.c | 40 ++
2
gned-off-by: Nicolin Chen
---
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 23 +
.../arm/arm-smmu-v3/arm-smmu-v3-iommufd.c | 49 +++
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 32 +++-
3 files changed, 103 insertions(+), 1 deletion(-)
diff --git a/drivers/io
On Thu, Jan 02, 2025 at 04:45:07PM -0400, Jason Gunthorpe wrote:
> On Tue, Dec 17, 2024 at 09:00:19PM -0800, Nicolin Chen wrote:
> > Allow a vIOMMU object to allocate vIRQ Event Queues, with a condition that
> > each vIOMMU can only have one single vIRQ event queue per type.
>
Aside from the IOPF framework, iommufd provides an additional pathway to
report hardware events, via the vEVENTQ of vIOMMU infrastructure.
Define an iommu_vevent_arm_smmuv3 uAPI structure, and report stage-1 events
in the threaded IRQ handler.
Signed-off-by: Nicolin Chen
---
drivers/iommu/arm
iommufd_viommu_get_vdev_id helper
* Adde an arm_vmaster_report_event helper in arm-smmu-v3-iommufd file
to simplify the routine in arm_smmu_handle_evt() of the main driver
v1
https://lore.kernel.org/all/cover.1724777091.git.nicol...@nvidia.com/
Thanks!
Nicolin
Nicolin Chen (1
iommufd_veventq_ops for the new ioctl.
And add a supports_veventq viommu op for drivers to help the core code
validate the input vEVENTQ type.
Reviewed-by: Lu Baolu
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/iommufd_private.h | 58 ++
include/linux/iommufd.h | 5
-by: Lu Baolu
Signed-off-by: Nicolin Chen
---
include/linux/iommufd.h| 8
drivers/iommu/iommufd/driver.c | 20
2 files changed, 28 insertions(+)
diff --git a/include/linux/iommufd.h b/include/linux/iommufd.h
index 941f2ed29914..a6dd9f8edcf3 100644
--- a
Rename the file, aligning with the new eventq object.
Reviewed-by: Kevin Tian
Reviewed-by: Lu Baolu
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/Makefile | 2 +-
drivers/iommu/iommufd/{fault.c => eventq.c} | 0
2 files changed, 1 insertion(+), 1 deletion(-)
ren
Similar to iommu_report_device_fault, this allows IOMMU drivers to report
vIOMMU events from threaded IRQ handlers to user space hypervisors.
Reviewed-by: Lu Baolu
Signed-off-by: Nicolin Chen
---
include/linux/iommufd.h| 11 +
drivers/iommu/iommufd/driver.c | 43
gned-off-by: Nicolin Chen
---
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 23 +
.../arm/arm-smmu-v3/arm-smmu-v3-iommufd.c | 49 +++
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 32 +++-
3 files changed, 103 insertions(+), 1 deletion(-)
diff --git a/drivers/io
t Queue).
Also, add missing xa_destroy and mutex_destroy in iommufd_fault_destroy().
Reviewed-by: Lu Baolu
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/iommufd_private.h | 52 ++---
drivers/iommu/iommufd/fault.c | 142 +++-
drivers/iommu/iommufd/hw_
x27;t need "response", leave the xa_init_flags
in its original location.
Reviewed-by: Kevin Tian
Reviewed-by: Lu Baolu
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/fault.c | 48 ---
1 file changed, 28 insertions(+), 20 deletions(-)
diff --git
iommufd_fault_iopf_handler() in the header too, since it's quite
simple after all.
Reviewed-by: Kevin Tian
Reviewed-by: Lu Baolu
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/iommufd_private.h | 20 +++-
drivers/iommu/iommufd/fault.c | 17 -
2 files change
Reorder the existing OBJ/IOCTL lists.
Also run clang-format for the same coding style at line wrappings.
No functional change.
Reviewed-by: Lu Baolu
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/main.c | 30 ++
1 file changed, 14 insertions(+), 16
.
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/selftest.c| 23 +++
tools/testing/selftests/iommu/iommufd.c | 5 +
2 files changed, 28 insertions(+)
diff --git a/drivers/iommu/iommufd/selftest.c b/drivers/iommu/iommufd/selftest.c
index a0de6d6d4e68
Trigger a vEVENT by feeding an idev ID and validating the returned output
virt_id whether it equals to the value that was set to the vDEVICE.
Signed-off-by: Nicolin Chen
---
tools/testing/selftests/iommu/iommufd_utils.h | 65 +++
tools/testing/selftests/iommu/iommufd.c
With the introduction of the new objects, update the doc to reflect that.
Reviewed-by: Lu Baolu
Signed-off-by: Nicolin Chen
---
Documentation/userspace-api/iommufd.rst | 16
1 file changed, 16 insertions(+)
diff --git a/Documentation/userspace-api/iommufd.rst
b/Documentation
The handler will get vDEVICE object from the given mdev and convert it to
its per-vIOMMU virtual ID to mimic a real IOMMU driver.
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/iommufd_test.h | 10 ++
drivers/iommu/iommufd/selftest.c | 30
2 files
Aside from the IOPF framework, iommufd provides an additional pathway to
report hardware events, via the vEVENTQ of vIOMMU infrastructure.
Define an iommu_vevent_arm_smmuv3 uAPI structure, and report stage-1 events
in the threaded IRQ handler.
Signed-off-by: Nicolin Chen
---
drivers/iommu/arm
On Mon, Jan 06, 2025 at 08:37:04PM -0800, Nicolin Chen wrote:
> I added something like this. Will send a v5.
>
> diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c
> b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c
> index 0c7a5894ba07..348179f3cf2a 100644
On Tue, Jan 07, 2025 at 01:54:00PM +0800, Baolu Lu wrote:
> On 1/7/25 12:36, Nicolin Chen wrote:
> > +static bool arm_vsmmu_supports_veventq(unsigned int type)
> > +{
> > + return type == IOMMU_VIOMMU_TYPE_ARM_SMMUV3;
>
> Do you need to check the hardware capabiliti
iommu_get_vdev_id helper
* Adde an arm_vmaster_report_event helper in arm-smmu-v3-iommufd file
to simplify the routine in arm_smmu_handle_evt() of the main driver
v1
https://lore.kernel.org/all/cover.1724777091.git.nicol...@nvidia.com/
Thanks!
Nicolin
Nicolin Chen (14):
iommufd:
Move VDEVICE upward to keep the order. Also run clang-format keep the same
coding style at line wrappings. No functional change.
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/main.c | 14 ++
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/drivers/iommu/iommufd
iommufd_fault_iopf_handler() in the header too, since it's quite
simple after all.
Reviewed-by: Kevin Tian
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/iommufd_private.h | 20 +++-
drivers/iommu/iommufd/fault.c | 17 -
2 files changed, 19 insertions(+
ssing xa_destroy and mutex_destroy in iommufd_fault_destroy().
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/iommufd_private.h | 52 ++---
drivers/iommu/iommufd/fault.c | 142 +++-
drivers/iommu/iommufd/hw_pagetable.c| 6 +-
3 files changed, 1
Rename the file, aligning with the new eventq object.
Reviewed-by: Kevin Tian
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/Makefile | 2 +-
drivers/iommu/iommufd/{fault.c => eventq.c} | 0
2 files changed, 1 insertion(+), 1 deletion(-)
rename drivers/iommu/iomm
Allow a vIOMMU object to allocate vIRQ Event Queues, with a condition that
each vIOMMU can only have one single vIRQ event queue per type.
Add iommufd_eventq_virq_alloc with an iommufd_eventq_virq_ops for this new
ioctl.
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/iommufd_private.h
need "response", leave the xa_init_flags
in its original location.
Reviewed-by: Kevin Tian
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/fault.c | 48 ---
1 file changed, 28 insertions(+), 20 deletions(-)
diff --git a/drivers/iommu/iommufd/fa
gned-off-by: Nicolin Chen
---
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 23 +
.../arm/arm-smmu-v3/arm-smmu-v3-iommufd.c | 49 +++
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 32 +++-
3 files changed, 103 insertions(+), 1 deletion(-)
diff --git a/drivers/io
Aside from the IOPF framework, iommufd provides an additional pathway to
report a hardware event or IRQ, via the vIRQ of vIOMMU infrastructure.
Define an iommu_virq_arm_smmuv3 uAPI structure, and report stage-1 faults
in the threaded IRQ handler.
Signed-off-by: Nicolin Chen
---
drivers/iommu
The handler will get vDEVICE object from the given mdev and convert it to
its per-vIOMMU virtual ID to mimic a real IOMMU driver.
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/iommufd_test.h | 10 ++
drivers/iommu/iommufd/selftest.c | 30
2 files
Trigger a vIRQ giving an idev ID, to test the loopback whether receiving
or not the vdev_id that was set to the idev by the line above.
Signed-off-by: Nicolin Chen
---
tools/testing/selftests/iommu/iommufd_utils.h | 63 +++
tools/testing/selftests/iommu/iommufd.c | 22
-off-by: Nicolin Chen
---
include/linux/iommufd.h| 8
drivers/iommu/iommufd/driver.c | 20
2 files changed, 28 insertions(+)
diff --git a/include/linux/iommufd.h b/include/linux/iommufd.h
index b082676c9e43..ac1f1897d290 100644
--- a/include/linux/iommufd.h
With the introduction of the new objects, update the doc to reflect that.
Signed-off-by: Nicolin Chen
---
Documentation/userspace-api/iommufd.rst | 16
1 file changed, 16 insertions(+)
diff --git a/Documentation/userspace-api/iommufd.rst
b/Documentation/userspace-api
: Nicolin Chen
---
drivers/iommu/iommufd/selftest.c| 23 +++
tools/testing/selftests/iommu/iommufd.c | 5 +
2 files changed, 28 insertions(+)
diff --git a/drivers/iommu/iommufd/selftest.c b/drivers/iommu/iommufd/selftest.c
index a0de6d6d4e68..d1438d81e664 100644
Similar to iommu_report_device_fault, this allows IOMMU drivers to report,
from threaded IRQ handlers to user space hypervisors, IRQs or events that
belong to a vIOMMU.
Signed-off-by: Nicolin Chen
---
include/linux/iommufd.h| 9 +
drivers/iommu/iommufd/driver.c | 37
101 - 200 of 702 matches
Mail list logo