linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 00/10] iommufd: Add VIOMMU infrastructure (Part-2 VIRQ)
@ 2024-08-27 17:02 Nicolin Chen
  2024-08-27 17:02 ` [PATCH v1 01/10] iommufd: Rename IOMMUFD_OBJ_FAULT to IOMMUFD_OBJ_EVENT_IOPF Nicolin Chen
                   ` (9 more replies)
  0 siblings, 10 replies; 17+ messages in thread
From: Nicolin Chen @ 2024-08-27 17:02 UTC (permalink / raw)
  To: jgg, kevin.tian, will
  Cc: joro, suravee.suthikulpanit, robin.murphy, dwmw2, baolu.lu, shuah,
	linux-kernel, iommu, linux-arm-kernel, linux-kselftest,
	eric.auger, jean-philippe, mdf, mshavit,
	shameerali.kolothum.thodi, smostafa, yi.l.liu

As the part-2 of the VIOMMU infrastructure, this series introduces a VIRQ
object after repurposing the existing FAULT object, which provides a nice
notification pathway to the user space already. So, the first thing to do
is reworking the FAULT object.

Mimicing the HWPT structures, add a common EVENT structure to support its
derivatives: EVENT_IOPF (the prior FAULT object) and EVENT_VIRQ (new one).
IOMMUFD_CMD_VIRQ_ALLOC is introduced to allocate EVENT_VIRQ for a VIOMMU.
One VIOMMU can have multiple VIRQs in different types but can not support
multiple VIRQs with the same types.

Drivers might need the VIOMMU's vdev_id list or the exact vdev_id link of
the passthrough device's to forward IRQs/events via the VIOMMU framework.
Thus, extend the set/unset_vdev_id ioctls down to the driver using VIOMMU
ops. This allows drivers to take the control of a vdev_id's lifecycle.

The forwarding part is fairly simple but might need to replace a physical
device ID with a virtual device ID. So, there comes with some helpers for
drivers to use.

As usual, this series comes with the selftest coverage for this new VIRQ,
and with a real world use case in the ARM SMMUv3 driver.

This must be based on the VIOMMU Part-1 series. It's on Github:
https://github.com/nicolinc/iommufd/commits/iommufd_virq-v1
Paring QEMU branch for testing:
https://github.com/nicolinc/qemu/commits/wip/for_iommufd_virq-v1

Thanks!
Nicolin

Nicolin Chen (10):
  iommufd: Rename IOMMUFD_OBJ_FAULT to IOMMUFD_OBJ_EVENT_IOPF
  iommufd: Rename fault.c to event.c
  iommufd: Add IOMMUFD_OBJ_EVENT_VIRQ and IOMMUFD_CMD_VIRQ_ALLOC
  iommufd/viommu: Allow drivers to control vdev_id lifecycle
  iommufd/viommu: Add iommufd_vdev_id_to_dev helper
  iommufd/viommu: Add iommufd_viommu_report_irq helper
  iommufd/selftest: Implement mock_viommu_set/unset_vdev_id
  iommufd/selftest: Add IOMMU_TEST_OP_TRIGGER_VIRQ for VIRQ coverage
  iommufd/selftest: Add EVENT_VIRQ test coverage
  iommu/arm-smmu-v3: Report virtual IRQ for device in user space

 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c   | 109 +++-
 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h   |   2 +
 drivers/iommu/iommufd/Makefile                |   2 +-
 drivers/iommu/iommufd/device.c                |   2 +
 drivers/iommu/iommufd/event.c                 | 613 ++++++++++++++++++
 drivers/iommu/iommufd/fault.c                 | 443 -------------
 drivers/iommu/iommufd/hw_pagetable.c          |  12 +-
 drivers/iommu/iommufd/iommufd_private.h       | 147 ++++-
 drivers/iommu/iommufd/iommufd_test.h          |  10 +
 drivers/iommu/iommufd/main.c                  |  13 +-
 drivers/iommu/iommufd/selftest.c              |  66 ++
 drivers/iommu/iommufd/viommu.c                |  25 +-
 drivers/iommu/iommufd/viommu_api.c            |  54 ++
 include/linux/iommufd.h                       |  28 +
 include/uapi/linux/iommufd.h                  |  46 ++
 tools/testing/selftests/iommu/iommufd.c       |  11 +
 tools/testing/selftests/iommu/iommufd_utils.h |  64 ++
 17 files changed, 1130 insertions(+), 517 deletions(-)
 create mode 100644 drivers/iommu/iommufd/event.c
 delete mode 100644 drivers/iommu/iommufd/fault.c

-- 
2.43.0



^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2024-10-28 13:04 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-27 17:02 [PATCH v1 00/10] iommufd: Add VIOMMU infrastructure (Part-2 VIRQ) Nicolin Chen
2024-08-27 17:02 ` [PATCH v1 01/10] iommufd: Rename IOMMUFD_OBJ_FAULT to IOMMUFD_OBJ_EVENT_IOPF Nicolin Chen
2024-08-27 17:02 ` [PATCH v1 02/10] iommufd: Rename fault.c to event.c Nicolin Chen
2024-08-27 17:02 ` [PATCH v1 03/10] iommufd: Add IOMMUFD_OBJ_EVENT_VIRQ and IOMMUFD_CMD_VIRQ_ALLOC Nicolin Chen
2024-08-27 17:02 ` [PATCH v1 04/10] iommufd/viommu: Allow drivers to control vdev_id lifecycle Nicolin Chen
2024-09-05 18:01   ` Jason Gunthorpe
2024-10-08 17:39     ` Nicolin Chen
2024-10-23  7:22     ` Nicolin Chen
2024-10-23 16:59       ` Jason Gunthorpe
2024-10-23 18:54         ` Nicolin Chen
2024-10-28 12:58           ` Jason Gunthorpe
2024-08-27 17:02 ` [PATCH v1 05/10] iommufd/viommu: Add iommufd_vdev_id_to_dev helper Nicolin Chen
2024-08-27 17:02 ` [PATCH v1 06/10] iommufd/viommu: Add iommufd_viommu_report_irq helper Nicolin Chen
2024-08-27 17:02 ` [PATCH v1 07/10] iommufd/selftest: Implement mock_viommu_set/unset_vdev_id Nicolin Chen
2024-08-27 17:02 ` [PATCH v1 08/10] iommufd/selftest: Add IOMMU_TEST_OP_TRIGGER_VIRQ for VIRQ coverage Nicolin Chen
2024-08-27 17:02 ` [PATCH v1 09/10] iommufd/selftest: Add EVENT_VIRQ test coverage Nicolin Chen
2024-08-27 17:02 ` [PATCH v1 10/10] iommu/arm-smmu-v3: Report virtual IRQ for device in user space Nicolin Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).