From: Jason Gunthorpe <jgg@nvidia.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: iommu@lists.linux.dev, kvm@vger.kernel.org,
linux-kernel@vger.kernel.org, Kevin Tian <kevin.tian@intel.com>
Subject: [GIT PULL] Please pull IOMMUFD subsystem changes
Date: Mon, 31 Mar 2025 13:12:27 -0300 [thread overview]
Message-ID: <20250331161227.GA287780@nvidia.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 10911 bytes --]
Hi Linus,
Late this time due to some travel and a bunch of linux-next issues
last week. I think it is quiet now.
There is a shared branch with Joerg's tree that has already been
merged by you. That branch contained a fix for a long standing issue
with how interrupts on ARM interwork with iommufd, and it should bring
full functionality to ARM systems now too.
Despite the shared branch there was still a merge conflict
(take both but drop mutex and sw_msi):
diff --cc drivers/iommu/dma-iommu.c
index 8cc5397d7dfc1a,0832998eca389a..6054d0ab802321
--- a/drivers/iommu/dma-iommu.c
+++ b/drivers/iommu/dma-iommu.c
@@@ -54,31 -59,34 +54,30 @@@ struct iommu_dma_options
};
struct iommu_dma_cookie {
- enum iommu_dma_cookie_type type;
+ struct iova_domain iovad;
+ struct list_head msi_page_list;
+ /* Flush queue */
union {
- /* Full allocator for IOMMU_DMA_IOVA_COOKIE */
- struct {
- struct iova_domain iovad;
- /* Flush queue */
- union {
- struct iova_fq *single_fq;
- struct iova_fq __percpu *percpu_fq;
- };
- /* Number of TLB flushes that have been started */
- atomic64_t fq_flush_start_cnt;
- /* Number of TLB flushes that have been finished */
- atomic64_t fq_flush_finish_cnt;
- /* Timer to regularily empty the flush queues */
- struct timer_list fq_timer;
- /* 1 when timer is active, 0 when not */
- atomic_t fq_timer_on;
- };
- /* Trivial linear page allocator for IOMMU_DMA_MSI_COOKIE */
- dma_addr_t msi_iova;
+ struct iova_fq *single_fq;
+ struct iova_fq __percpu *percpu_fq;
};
- struct list_head msi_page_list;
-
+ /* Number of TLB flushes that have been started */
+ atomic64_t fq_flush_start_cnt;
+ /* Number of TLB flushes that have been finished */
+ atomic64_t fq_flush_finish_cnt;
+ /* Timer to regularily empty the flush queues */
+ struct timer_list fq_timer;
+ /* 1 when timer is active, 0 when not */
+ atomic_t fq_timer_on;
/* Domain for flush queue callback; NULL if flush queue not in use */
- struct iommu_domain *fq_domain;
+ struct iommu_domain *fq_domain;
/* Options for dma-iommu use */
- struct iommu_dma_options options;
+ struct iommu_dma_options options;
- struct mutex mutex;
+};
+
+struct iommu_dma_msi_cookie {
+ dma_addr_t msi_iova;
+ struct list_head msi_page_list;
};
static DEFINE_STATIC_KEY_FALSE(iommu_deferred_attach_enabled);
@@@ -363,19 -393,14 +362,18 @@@ int iommu_dma_init_fq(struct iommu_doma
*/
int iommu_get_dma_cookie(struct iommu_domain *domain)
{
- if (domain->iova_cookie)
+ struct iommu_dma_cookie *cookie;
+
+ if (domain->cookie_type != IOMMU_COOKIE_NONE)
return -EEXIST;
- domain->iova_cookie = cookie_alloc(IOMMU_DMA_IOVA_COOKIE);
- if (!domain->iova_cookie)
+ cookie = kzalloc(sizeof(*cookie), GFP_KERNEL);
+ if (!cookie)
return -ENOMEM;
- mutex_init(&cookie->mutex);
- iommu_domain_set_sw_msi(domain, iommu_dma_sw_msi);
+ INIT_LIST_HEAD(&cookie->msi_page_list);
+ domain->cookie_type = IOMMU_COOKIE_DMA_IOVA;
+ domain->iova_cookie = cookie;
return 0;
}
The tag for-linus-iommufd-merged with my merge resolution to your tree is also available to pull.
The following changes since commit 5e9f822c9c683ae884fa5e71df41d1647b2876c6:
iommu: Swap the order of setting group->pasid_array and calling attach op of iommu drivers (2025-02-28 10:07:14 -0400)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/jgg/iommufd.git tags/for-linus-iommufd
for you to fetch changes up to 7be11d34f660bfa6583f3d6e2032d5dcbff56081:
iommufd: Test attach before detaching pasid (2025-03-28 11:40:41 -0300)
----------------------------------------------------------------
iommufd 6.15 merge window pull
Two significant new items:
- Allow reporting IOMMU HW events to userspace when the events are clearly
linked to a device. This is linked to the VIOMMU object and is intended to
be used by a VMM to forward HW events to the virtual machine as part of
emulating a vIOMMU. ARM SMMUv3 is the first driver to use this
mechanism. Like the existing fault events the data is delivered through
a simple FD returning event records on read().
- PASID support in VFIO. "Process Address Space ID" is a PCI feature that
allows the device to tag all PCI DMA operations with an ID. The IOMMU
will then use the ID to select a unique translation for those DMAs. This
is part of Intel's vIOMMU support as VT-D HW requires the hypervisor to
manage each PASID entry. The support is generic so any VFIO user could
attach any translation to a PASID, and the support should work on ARM
SMMUv3 as well. AMD requires additional driver work.
Some minor updates, along with fixes:
- Prevent using nested parents with fault's, no driver support today
- Put a single "cookie_type" value in the iommu_domain to indicate what
owns the various opaque owner fields
----------------------------------------------------------------
Bagas Sanjaya (1):
iommufd: Fix iommu_vevent_header tables markup
Josh Poimboeuf (1):
iommu: Convert unreachable() to BUG()
Nicolin Chen (18):
iommufd: Fix uninitialized rc in iommufd_access_rw()
iommufd: Set domain->iommufd_hwpt in all hwpt->domain allocators
iommufd/fault: Move two fault functions out of the header
iommufd/fault: Add an iommufd_fault_init() helper
iommufd: Abstract an iommufd_eventq from iommufd_fault
iommufd: Rename fault.c to eventq.c
iommufd: Add IOMMUFD_OBJ_VEVENTQ and IOMMUFD_CMD_VEVENTQ_ALLOC
iommufd/viommu: Add iommufd_viommu_get_vdev_id helper
iommufd/viommu: Add iommufd_viommu_report_event helper
iommufd/selftest: Require vdev_id when attaching to a nested domain
iommufd/selftest: Add IOMMU_TEST_OP_TRIGGER_VEVENT for vEVENTQ coverage
iommufd/selftest: Add IOMMU_VEVENTQ_ALLOC test coverage
Documentation: userspace-api: iommufd: Update FAULT and VEVENTQ
iommu/arm-smmu-v3: Introduce struct arm_smmu_vmaster
iommu/arm-smmu-v3: Report events that belong to devices attached to vIOMMU
iommu/arm-smmu-v3: Set MEV bit in nested STE for DoS mitigations
iommufd: Move iommufd_sw_msi and related functions to driver.c
iommu: Drop sw_msi from iommu_domain
Robin Murphy (1):
iommu: Sort out domain user data
Yi Liu (28):
iommufd: Disallow allocating nested parent domain with fault ID
iommufd: Fail replace if device has not been attached
iommu: Require passing new handles to APIs supporting handle
iommu: Introduce a replace API for device pasid
iommufd: Pass @pasid through the device attach/replace path
iommufd/device: Only add reserved_iova in non-pasid path
iommufd/device: Replace idev->igroup with local variable
iommufd/device: Add helper to detect the first attach of a group
iommufd/device: Wrap igroup->hwpt and igroup->device_list into attach struct
iommufd/device: Replace device_list with device_array
iommufd/device: Add pasid_attach array to track per-PASID attach
iommufd: Enforce PASID-compatible domain in PASID path
iommufd: Support pasid attach/replace
iommufd: Enforce PASID-compatible domain for RID
iommu/vt-d: Add IOMMU_HWPT_ALLOC_PASID support
iommufd: Allow allocating PASID-compatible domain
iommufd/selftest: Add set_dev_pasid in mock iommu
iommufd/selftest: Add a helper to get test device
iommufd/selftest: Add test ops to test pasid attach/detach
iommufd/selftest: Add coverage for iommufd pasid attach/detach
ida: Add ida_find_first_range()
vfio-iommufd: Support pasid [at|de]tach for physical VFIO devices
vfio: VFIO_DEVICE_[AT|DE]TACH_IOMMUFD_PT support pasid
iommufd: Extend IOMMU_GET_HW_INFO to report PASID capability
iommufd/selftest: Add coverage for reporting max_pasid_log2 via IOMMU_HW_INFO
iommufd: Initialize the flags of vevent in iommufd_viommu_report_event()
iommufd: Balance veventq->num_events inc/dec
iommufd: Test attach before detaching pasid
Documentation/userspace-api/iommufd.rst | 17 +
.../iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c | 60 +++
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 80 ++-
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 36 ++
drivers/iommu/dma-iommu.c | 204 +++----
drivers/iommu/dma-iommu.h | 14 +
drivers/iommu/intel/iommu.c | 3 +-
drivers/iommu/intel/nested.c | 2 +-
drivers/iommu/iommu-priv.h | 16 +
drivers/iommu/iommu-sva.c | 1 +
drivers/iommu/iommu.c | 160 +++++-
drivers/iommu/iommufd/Kconfig | 2 +-
drivers/iommu/iommufd/Makefile | 2 +-
drivers/iommu/iommufd/device.c | 499 ++++++++++-------
drivers/iommu/iommufd/driver.c | 198 +++++++
drivers/iommu/iommufd/eventq.c | 598 +++++++++++++++++++++
drivers/iommu/iommufd/fault.c | 342 ------------
drivers/iommu/iommufd/hw_pagetable.c | 42 +-
drivers/iommu/iommufd/iommufd_private.h | 156 ++++--
drivers/iommu/iommufd/iommufd_test.h | 40 ++
drivers/iommu/iommufd/main.c | 7 +
drivers/iommu/iommufd/selftest.c | 297 +++++++++-
drivers/iommu/iommufd/viommu.c | 2 +
drivers/pci/ats.c | 33 ++
drivers/vfio/device_cdev.c | 60 ++-
drivers/vfio/iommufd.c | 60 ++-
drivers/vfio/pci/vfio_pci.c | 2 +
include/linux/idr.h | 11 +
include/linux/iommu.h | 35 +-
include/linux/iommufd.h | 32 +-
include/linux/pci-ats.h | 3 +
include/linux/vfio.h | 14 +
include/uapi/linux/iommufd.h | 129 ++++-
include/uapi/linux/vfio.h | 29 +-
lib/idr.c | 67 +++
lib/test_ida.c | 70 +++
tools/testing/selftests/iommu/iommufd.c | 365 +++++++++++++
tools/testing/selftests/iommu/iommufd_fail_nth.c | 59 +-
tools/testing/selftests/iommu/iommufd_utils.h | 229 +++++++-
39 files changed, 3147 insertions(+), 829 deletions(-)
(diffstat from tag for-linus-iommufd-merged)
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next reply other threads:[~2025-03-31 16:12 UTC|newest]
Thread overview: 67+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-31 16:12 Jason Gunthorpe [this message]
2025-04-02 1:50 ` [GIT PULL] Please pull IOMMUFD subsystem changes pr-tracker-bot
-- strict thread matches above, loose matches on Subject: below --
2026-04-16 17:33 Jason Gunthorpe
2026-04-17 4:27 ` pr-tracker-bot
2026-01-30 23:41 Jason Gunthorpe
2026-01-31 1:20 ` pr-tracker-bot
2025-12-18 18:52 Jason Gunthorpe
2025-12-18 20:39 ` pr-tracker-bot
2025-12-02 17:50 Jason Gunthorpe
2025-12-05 3:01 ` pr-tracker-bot
2025-11-25 15:09 Jason Gunthorpe
2025-11-25 16:38 ` pr-tracker-bot
2025-11-07 18:51 Jason Gunthorpe
2025-11-07 21:21 ` pr-tracker-bot
2025-10-02 14:29 Jason Gunthorpe
2025-10-04 1:40 ` pr-tracker-bot
2025-09-22 14:33 Jason Gunthorpe
2025-09-22 18:27 ` pr-tracker-bot
2025-08-22 14:21 Jason Gunthorpe
2025-08-22 21:28 ` pr-tracker-bot
2025-07-30 18:47 Jason Gunthorpe
2025-07-31 20:01 ` pr-tracker-bot
2025-07-02 14:14 Jason Gunthorpe
2025-07-02 17:06 ` pr-tracker-bot
2025-01-23 16:59 Jason Gunthorpe
2025-01-24 21:45 ` pr-tracker-bot
2024-12-05 18:44 Jason Gunthorpe
2024-12-05 23:08 ` pr-tracker-bot
2024-11-20 14:53 Jason Gunthorpe
2024-11-21 21:20 ` pr-tracker-bot
2024-09-23 17:45 Jason Gunthorpe
2024-09-24 19:36 ` pr-tracker-bot
2024-08-20 22:48 Jason Gunthorpe
2024-08-20 23:52 ` pr-tracker-bot
2024-07-17 18:46 Jason Gunthorpe
2024-07-19 18:09 ` pr-tracker-bot
2024-04-19 17:29 Jason Gunthorpe
2024-04-19 21:07 ` pr-tracker-bot
2024-03-02 0:08 Jason Gunthorpe
2024-03-02 1:31 ` pr-tracker-bot
2024-02-22 13:23 Jason Gunthorpe
2024-02-22 20:03 ` pr-tracker-bot
2024-01-12 17:49 Jason Gunthorpe
2024-01-18 23:35 ` pr-tracker-bot
2023-12-04 19:35 Jason Gunthorpe
2023-12-04 21:59 ` pr-tracker-bot
2023-10-31 13:14 Jason Gunthorpe
2023-11-02 2:51 ` pr-tracker-bot
2023-08-30 23:40 Jason Gunthorpe
2023-08-31 3:50 ` pr-tracker-bot
2023-08-31 3:59 ` Linus Torvalds
2023-08-31 16:43 ` Jason Gunthorpe
2023-07-28 13:48 Jason Gunthorpe
2023-07-28 18:39 ` pr-tracker-bot
2023-06-28 14:04 Jason Gunthorpe
2023-06-30 4:16 ` pr-tracker-bot
2023-04-25 14:46 Jason Gunthorpe
2023-04-27 17:15 ` pr-tracker-bot
2023-04-06 13:34 Jason Gunthorpe
2023-04-06 18:46 ` pr-tracker-bot
2023-02-21 15:39 Jason Gunthorpe
2023-02-24 22:50 ` Linus Torvalds
2023-02-25 0:02 ` Jason Gunthorpe
2023-02-25 0:50 ` Linus Torvalds
2023-02-24 23:27 ` pr-tracker-bot
2022-12-12 18:30 Jason Gunthorpe
2022-12-14 18:04 ` pr-tracker-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250331161227.GA287780@nvidia.com \
--to=jgg@nvidia.com \
--cc=iommu@lists.linux.dev \
--cc=kevin.tian@intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.