kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [GIT PULL] Please pull IOMMUFD subsystem changes
@ 2022-12-12 18:30 Jason Gunthorpe
  2022-12-14 18:04 ` pr-tracker-bot
  0 siblings, 1 reply; 51+ messages in thread
From: Jason Gunthorpe @ 2022-12-12 18:30 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: iommu, kvm, linux-kernel, Kevin Tian

[-- Attachment #1: Type: text/plain, Size: 23403 bytes --]

Hi Linus,

This is the first PR for a new char device called 'iommufd'. This has
been in discussions for about two years now, while attempts to
implement the needed features have been tried since as far back as
2017. In January a group of us sat down and actually made it.

It may seem strange that a lowlevel, seemingly internal, function like
the iommu would have a user API. However, for performance, it has
become quite popular to setup virtual machines so that HW (eg
networking/storage devices) can have direct DMA into the virtual
machine memory itself. To achieve this requires special programming of
the IOMMU HW.

Further, we have advanced PCI features like Process Address Space ID
(PASID) and Page Request Interface (PRI) that rely on the IOMMU HW to
implement them. In particular PASID & PRI are used to create something
called Shared Virtual Addressing (SVA or SVM) where DMA from a device
can be directly delivered to a process virtual memory address by
having the IOMMU HW directly walk the CPU's page table for the
process, and trigger faults for DMA to non-present pages.

Naturally people would like to have virtualized versions of all of
this. A vIOMMU driver that can implement vPASID and vPRI to achieve
vSVA within a VM.

Thus, we get to iommufd. It is a uAPI to allow something like qemu to
have some direct control over the IOMMU to implement, in userspace, a
vIOMMU device emulation that can provide all these services to the
IOMMU driver running in the VM. Like KVM this is done in a general way
where we delegate functionality to userspace and if the userspace is
something like qemu then it will compose that functionality into an
emulated vIOMMU device. iommufd itself doesn't interact with
virtualization or KVM.

This PR is the starting point, it just gets all the infrastructure
setup so that it is as good as VFIO is right now. We see a broad need
for extended
features, some being highly IOMMU device specific:

 - Binding iommu_domain's to PASID/SSID
 - Userspace IO page tables, for ARM, x86 and S390
 - Kernel bypassed invalidation of user page tables
 - Re-use of the KVM page table in the IOMMU
 - Dirty page tracking in the IOMMU
 - Runtime Increase/Decrease of IOPTE size
 - PRI support with faults resolved in userspace

Currently vfio provides the uAPI for iommu HW, but its ioctl design
has reached a difficult point to evolve further, and has developed a
small wishlist of changes. Worse, it is tied to VFIO, and other
subystems working with direct VM DMA, like VPDA, were cloning the
iommu control with their own IOCTLs.

Background
==========

The built-in kdocs are rendered here, and make an good backgrounder, along
with the main cover letter:

 https://docs.kernel.org/next/userspace-api/iommufd.html
 https://lore.kernel.org/kvm/0-v6-a196d26f289e+11787-iommufd_jgg@nvidia.com/

Eric and Yi gave a nice presentation at KVM forum on the history and qemu side
of the project:

 https://youtu.be/PlEzLywexHE

A group discussion at LPC, though the AV is troubled enough it is not
so
good:

 https://youtu.be/tHNhegCD2tU

And a few older, related, conference presentations:

 Some AMD IOMMU HW features:
   https://static.sched.com/hosted_files/kvmforum2021/da/vIOMMU%20KVM%20Forum%202021%20-%20v4.pdf

 Sharing the KVM page table with the IOMMU
   https://static.sched.com/hosted_files/kvmforum2021/a3/KVM_2021_sharing_TDP_IOMMU.pdf

 Earlier approach for nested translation/userspace page tables on ARM:
   https://archive.fosdem.org/2019/schedule/event/vai_iommu_implementation_using_hw_nested_paging/attachments/slides/2915/export/events/attachments/vai_iommu_implementation_using_hw_nested_paging/slides/2915/fosdem19_viommu_nested_mode.

The PR
======

This PR is following about 300 patches already merged that have been
restructuring parts of the iommu subsystem, VFIO, and all its
drivers. The large amount of preparatory work is the main reason why
this has been such a challenging task.

As for this PR, it is organized into parts:

 - First is a shared branch with Joerg that gets the necessary iommu
   subsystem rework required.

 - Second is the "generic iommufd" basic char dev. This is at the
   level of near functional equivalence to the current VFIO interface.

 - Third is a series to make VFIO able to use iommufd.

 - Fourth is some VFIO patches that have become conflict entangled
   with this work, but were otherwise completed this cycle.

 - Finally a few small fixup patches from late review on the mailing
   list after the commits had been frozen.

The next cycle(s) will see additional functionality land in iommufd,
and completion of the VFIO rework which will finally bring the new
features people have been seeking.

The bulk of the PR has been in linux-next since next-20221102, it
comes with a fairly complete selftest, and separately syzkaller
descriptions were created and run against the full uAPI with
reasonable coverage results. These are now pushed to syzbot and are
running continuously.

Several people have contributed directly to this work: Eric Auger,
Joao Martins, Kevin Tian, Lu Baolu, Nicolin Chen, Yi L Liu. Many more
have participated in the discussions that lead here, and provided
ideas. Thanks to all!

Merge Conflicts
===============

Finally, there are some interactions with other trees. Everything was
fine until rc8 then all these conflicts appeared :(

Trivial compile time failure with Greg's work to add const-ness:

  https://lore.kernel.org/r/20221206132153.074fff0c@canb.auug.org.au

--- a/drivers/vfio/group.c
+++ b/drivers/vfio/group.c
@@ -827,7 +827,7 @@ bool vfio_file_has_dev(struct file *file, struct vfio_device *device)
 }
 EXPORT_SYMBOL_GPL(vfio_file_has_dev);

-static char *vfio_devnode(struct device *dev, umode_t *mode)
+static char *vfio_devnode(const struct device *dev, umode_t *mode)
 {
        return kasprintf(GFP_KERNEL, "vfio/%s", dev_name(dev));
 }

There are more ugly problems with VFIO that we didn't manage to avoid:

 https://lore.kernel.org/r/20221206125542.52ea97a7@canb.auug.org.au

And another one that Stephen hasn't written about yet. I've created a
'for-linus-iommufd-merged' tag with my resolution against Alex's
current tree and a diff is included the end of this email.

Though I don't think there will be a merge, compile, or functional
problem, changes to gup.c going through Andrew's mm tree want the
changes below. I will send a patch for this during rc1.

diff --git a/drivers/iommu/iommufd/pages.c b/drivers/iommu/iommufd/pages.c
index 429fa3b0a239cd..12c93b7bf15793 100644
--- a/drivers/iommu/iommufd/pages.c
+++ b/drivers/iommu/iommufd/pages.c
@@ -707,12 +707,9 @@ static void pfn_reader_user_init(struct pfn_reader_user *user,
 	user->upages_end = 0;
 	user->locked = -1;

-	if (pages->writable) {
-		user->gup_flags = FOLL_LONGTERM | FOLL_WRITE;
-	} else {
-		/* Still need to break COWs on read */
-		user->gup_flags = FOLL_LONGTERM | FOLL_FORCE | FOLL_WRITE;
-	}
+	user->gup_flags = FOLL_LONGTERM;
+	if (pages->writable)
+		user->gup_flags |= FOLL_WRITE;
 }

 static void pfn_reader_user_destroy(struct pfn_reader_user *user,
@@ -782,13 +779,9 @@ static int pfn_reader_user_pin(struct pfn_reader_user *user,
 			mmap_read_lock(pages->source_mm);
 			user->locked = 1;
 		}
-		/*
-		 * FIXME: last NULL can be &pfns->locked once the GUP patch
-		 * is merged.
-		 */
 		rc = pin_user_pages_remote(pages->source_mm, uptr, npages,
 					   user->gup_flags, user->upages, NULL,
-					   NULL);
+					   &user->locked);
 	}
 	if (rc <= 0) {
 		if (WARN_ON(!rc))

Thanks,
Jason

The tag for-linus-iommufd-merged with my merge resolution to your tree is also available to pull.

The following changes since commit b7b275e60bcd5f89771e865a8239325f86d9927d:

  Linux 6.1-rc7 (2022-11-27 13:31:48 -0800)

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 d6c55c0a20e5059abdde81713ddf6324a946eb3c:

  iommufd: Change the order of MSI setup (2022-12-09 15:24:30 -0400)

----------------------------------------------------------------
iommufd for 6.2

iommufd is the user API to control the IOMMU subsystem as it relates to
managing IO page tables that point at user space memory.

It takes over from drivers/vfio/vfio_iommu_type1.c (aka the VFIO
container) which is the VFIO specific interface for a similar idea.

We see a broad need for extended features, some being highly IOMMU device
specific:
 - Binding iommu_domain's to PASID/SSID
 - Userspace IO page tables, for ARM, x86 and S390
 - Kernel bypassed invalidation of user page tables
 - Re-use of the KVM page table in the IOMMU
 - Dirty page tracking in the IOMMU
 - Runtime Increase/Decrease of IOPTE size
 - PRI support with faults resolved in userspace

Many of these HW features exist to support VM use cases - for instance the
combination of PASID, PRI and Userspace IO Page Tables allows an
implementation of DMA Shared Virtual Addressing (vSVA) within a
guest. Dirty tracking enables VM live migration with SRIOV devices and
PASID support allow creating "scalable IOV" devices, among other things.

As these features are fundamental to a VM platform they need to be
uniformly exposed to all the driver families that do DMA into VMs, which
is currently VFIO and VDPA.

----------------------------------------------------------------
Jason Gunthorpe (36):
      iommu: Add IOMMU_CAP_ENFORCE_CACHE_COHERENCY
      interval-tree: Add a utility to iterate over spans in an interval tree
      scripts/kernel-doc: support EXPORT_SYMBOL_NS_GPL() with -export
      iommufd: File descriptor, context, kconfig and makefiles
      kernel/user: Allow user_struct::locked_vm to be usable for iommufd
      iommufd: PFN handling for iopt_pages
      iommufd: Algorithms for PFN storage
      iommufd: Data structure to provide IOVA to PFN mapping
      iommufd: IOCTLs for the io_pagetable
      iommufd: Add a HW pagetable object
      iommufd: Add kAPI toward external drivers for physical devices
      iommufd: Add kAPI toward external drivers for kernel access
      iommufd: vfio container FD ioctl compatibility
      iommufd: Add kernel support for testing iommufd
      iommufd: Add some fault injection points
      iommufd: Add additional invariant assertions
      iommufd: Add a selftest
      Merge patch series "IOMMUFD Generic interface"
      vfio: Move vfio_device driver open/close code to a function
      vfio: Move vfio_device_assign_container() into vfio_device_first_open()
      vfio: Rename vfio_device_assign/unassign_container()
      vfio: Use IOMMU_CAP_ENFORCE_CACHE_COHERENCY for vfio_file_enforced_coherent()
      vfio-iommufd: Allow iommufd to be used in place of a container fd
      vfio-iommufd: Support iommufd for physical VFIO devices
      vfio-iommufd: Support iommufd for emulated VFIO devices
      vfio: Move container related MODULE_ALIAS statements into container.c
      vfio: Make vfio_container optionally compiled
      iommufd: Allow iommufd to supply /dev/vfio/vfio
      Merge patch series "Connect VFIO to IOMMUFD"
      Merge tag 'v6.1-rc7' into iommufd.git for-next
      vfio: Simplify vfio_create_group()
      vfio: Move the sanity check of the group to vfio_create_group()
      Merge patch series "Move group specific code into group.c"
      iommufd: Fix comment typos
      iommufd: Improve a few unclear bits of code
      iommufd: Change the order of MSI setup

Joerg Roedel (1):
      Merge tag 'for-joerg' of git://git.kernel.org/pub/scm/linux/kernel/git/jgg/iommufd into core

Kevin Tian (1):
      iommufd: Document overview of iommufd

Lu Baolu (14):
      iommu: Add max_pasids field in struct iommu_device
      iommu: Add max_pasids field in struct dev_iommu
      iommu: Remove SVM_FLAG_SUPERVISOR_MODE support
      PCI: Enable PASID only when ACS RR & UF enabled on upstream path
      iommu: Add attach/detach_dev_pasid iommu interfaces
      iommu: Add IOMMU SVA domain support
      iommu/vt-d: Add SVA domain support
      arm-smmu-v3/sva: Add SVA domain support
      iommu/sva: Refactoring iommu_sva_bind/unbind_device()
      iommu: Remove SVA related callbacks from iommu ops
      iommu: Prepare IOMMU domain for IOPF
      iommu: Per-domain I/O page fault handling
      iommu: Rename iommu-sva-lib.{c,h}
      iommu: Add device-centric DMA ownership interfaces

Matthew Rosato (1):
      vfio/ap: Validate iova during dma_unmap and trigger irq disable

Nicolin Chen (5):
      iommu/amd: Drop unnecessary checks in amd_iommu_attach_device()
      iommu: Add return value rules to attach_dev op and APIs
      iommu: Regulate EINVAL in ->attach_dev callback functions
      iommu: Use EINVAL for incompatible device/domain in ->attach_dev
      iommu: Propagate return value in ->attach_dev callback functions

Yi Liu (9):
      i915/gvt: Move gvt mapping cache initialization to intel_vgpu_init_dev()
      vfio: Create wrappers for group register/unregister
      vfio: Set device->group in helper function
      vfio: Swap order of vfio_device_container_register() and open_device()
      vfio: Make vfio_device_open() truly device specific
      vfio: Refactor vfio_device open and close
      vfio: Wrap vfio group module init/clean code into helpers
      vfio: Refactor dma APIs for emulated devices
      vfio: Move vfio group specific code into group.c

 .clang-format                                      |    3 +
 Documentation/userspace-api/index.rst              |    1 +
 Documentation/userspace-api/ioctl/ioctl-number.rst |    1 +
 Documentation/userspace-api/iommufd.rst            |  223 +++
 MAINTAINERS                                        |   12 +
 drivers/dma/idxd/cdev.c                            |    3 +-
 drivers/dma/idxd/init.c                            |   25 +-
 drivers/gpu/drm/i915/gvt/kvmgt.c                   |   21 +-
 drivers/iommu/Kconfig                              |    1 +
 drivers/iommu/Makefile                             |    4 +-
 drivers/iommu/amd/iommu.c                          |   14 +-
 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c    |  104 +-
 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c        |   32 +-
 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h        |   23 +-
 drivers/iommu/arm/arm-smmu/arm-smmu.c              |    3 -
 drivers/iommu/arm/arm-smmu/qcom_iommu.c            |    7 +-
 drivers/iommu/fsl_pamu.c                           |    2 +-
 drivers/iommu/fsl_pamu_domain.c                    |    4 +-
 drivers/iommu/intel/dmar.c                         |    7 +
 drivers/iommu/intel/iommu.c                        |   56 +-
 drivers/iommu/intel/iommu.h                        |   18 +-
 drivers/iommu/intel/pasid.c                        |    6 +-
 drivers/iommu/intel/svm.c                          |  145 +-
 drivers/iommu/io-pgfault.c                         |   77 +-
 drivers/iommu/iommu-sva-lib.c                      |   71 -
 drivers/iommu/iommu-sva.c                          |  240 +++
 drivers/iommu/{iommu-sva-lib.h => iommu-sva.h}     |   14 +-
 drivers/iommu/iommu.c                              |  416 ++--
 drivers/iommu/iommufd/Kconfig                      |   44 +
 drivers/iommu/iommufd/Makefile                     |   13 +
 drivers/iommu/iommufd/device.c                     |  772 ++++++++
 drivers/iommu/iommufd/double_span.h                |   53 +
 drivers/iommu/iommufd/hw_pagetable.c               |   57 +
 drivers/iommu/iommufd/io_pagetable.c               | 1216 ++++++++++++
 drivers/iommu/iommufd/io_pagetable.h               |  241 +++
 drivers/iommu/iommufd/ioas.c                       |  398 ++++
 drivers/iommu/iommufd/iommufd_private.h            |  307 +++
 drivers/iommu/iommufd/iommufd_test.h               |   93 +
 drivers/iommu/iommufd/main.c                       |  460 +++++
 drivers/iommu/iommufd/pages.c                      | 1984 ++++++++++++++++++++
 drivers/iommu/iommufd/selftest.c                   |  853 +++++++++
 drivers/iommu/iommufd/vfio_compat.c                |  472 +++++
 drivers/iommu/ipmmu-vmsa.c                         |    2 -
 drivers/iommu/mtk_iommu.c                          |    4 +-
 drivers/iommu/omap-iommu.c                         |    6 +-
 drivers/iommu/sprd-iommu.c                         |    4 +-
 drivers/iommu/tegra-gart.c                         |    2 +-
 drivers/iommu/virtio-iommu.c                       |    7 +-
 drivers/misc/uacce/uacce.c                         |    2 +-
 drivers/pci/ats.c                                  |    3 +
 drivers/s390/cio/vfio_ccw_ops.c                    |    3 +
 drivers/s390/crypto/vfio_ap_ops.c                  |   21 +-
 drivers/vfio/Kconfig                               |   36 +-
 drivers/vfio/Makefile                              |    6 +-
 drivers/vfio/container.c                           |  145 +-
 drivers/vfio/fsl-mc/vfio_fsl_mc.c                  |    3 +
 drivers/vfio/group.c                               |  877 +++++++++
 drivers/vfio/iommufd.c                             |  158 ++
 drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c     |    6 +
 drivers/vfio/pci/mlx5/main.c                       |    3 +
 drivers/vfio/pci/vfio_pci.c                        |    3 +
 drivers/vfio/platform/vfio_amba.c                  |    3 +
 drivers/vfio/platform/vfio_platform.c              |    3 +
 drivers/vfio/vfio.h                                |  120 +-
 drivers/vfio/vfio_main.c                           |  983 ++--------
 include/linux/intel-svm.h                          |   13 -
 include/linux/interval_tree.h                      |   58 +
 include/linux/iommu.h                              |  145 +-
 include/linux/iommufd.h                            |   98 +
 include/linux/sched/user.h                         |    2 +-
 include/linux/vfio.h                               |   39 +
 include/uapi/linux/iommufd.h                       |  347 ++++
 kernel/user.c                                      |    1 +
 lib/Kconfig                                        |    4 +
 lib/interval_tree.c                                |  132 ++
 scripts/kernel-doc                                 |   12 +-
 tools/testing/selftests/Makefile                   |    1 +
 tools/testing/selftests/iommu/.gitignore           |    3 +
 tools/testing/selftests/iommu/Makefile             |   12 +
 tools/testing/selftests/iommu/config               |    2 +
 tools/testing/selftests/iommu/iommufd.c            | 1654 ++++++++++++++++
 tools/testing/selftests/iommu/iommufd_fail_nth.c   |  580 ++++++
 tools/testing/selftests/iommu/iommufd_utils.h      |  278 +++
 83 files changed, 12811 insertions(+), 1466 deletions(-)

diff --cc drivers/vfio/Kconfig
index 286c1663bd7564,0b8d53f63c7e5c..a8f54462946742
--- a/drivers/vfio/Kconfig
+++ b/drivers/vfio/Kconfig
@@@ -46,17 -38,6 +46,12 @@@ config VFIO_NOIOMM
  	  this mode since there is no IOMMU to provide DMA translation.
  
  	  If you don't know what to do here, say N.
 +endif
 +
- config VFIO_SPAPR_EEH
- 	tristate
- 	depends on EEH && VFIO_IOMMU_SPAPR_TCE
- 	default VFIO
- 
 +config VFIO_VIRQFD
- 	tristate
++	bool
 +	select EVENTFD
 +	default n
  
  source "drivers/vfio/pci/Kconfig"
  source "drivers/vfio/platform/Kconfig"
diff --cc drivers/vfio/Makefile
index 3783db7e8082c8,0721ed4831c92f..7eae72e2c6bf9f
--- a/drivers/vfio/Makefile
+++ b/drivers/vfio/Makefile
@@@ -2,17 -2,12 +2,14 @@@
  obj-$(CONFIG_VFIO) += vfio.o
  
  vfio-y += vfio_main.o \
 -	  iova_bitmap.o \
 -	  container.o
 +	  group.o \
 +	  iova_bitmap.o
+ vfio-$(CONFIG_VFIO_VIRQFD) += virqfd.o
 +vfio-$(CONFIG_IOMMUFD) += iommufd.o
 +vfio-$(CONFIG_VFIO_CONTAINER) += container.o
  
- obj-$(CONFIG_VFIO_VIRQFD) += vfio_virqfd.o
  obj-$(CONFIG_VFIO_IOMMU_TYPE1) += vfio_iommu_type1.o
  obj-$(CONFIG_VFIO_IOMMU_SPAPR_TCE) += vfio_iommu_spapr_tce.o
- obj-$(CONFIG_VFIO_SPAPR_EEH) += vfio_spapr_eeh.o
  obj-$(CONFIG_VFIO_PCI) += pci/
  obj-$(CONFIG_VFIO_PLATFORM) += platform/
  obj-$(CONFIG_VFIO_MDEV) += mdev/
diff --cc drivers/vfio/vfio.h
index 2e05418fd18df0,7c2cbf8a48ad1b..d5fa896b5a8562
--- a/drivers/vfio/vfio.h
+++ b/drivers/vfio/vfio.h
@@@ -73,27 -60,8 +73,22 @@@ struct vfio_group 
  	struct kvm			*kvm;
  	struct file			*opened_file;
  	struct blocking_notifier_head	notifier;
 +	struct iommufd_ctx		*iommufd;
  };
  
 +int vfio_device_set_group(struct vfio_device *device,
 +			  enum vfio_group_type type);
 +void vfio_device_remove_group(struct vfio_device *device);
 +void vfio_device_group_register(struct vfio_device *device);
 +void vfio_device_group_unregister(struct vfio_device *device);
 +int vfio_device_group_use_iommu(struct vfio_device *device);
 +void vfio_device_group_unuse_iommu(struct vfio_device *device);
 +void vfio_device_group_close(struct vfio_device *device);
 +bool vfio_device_has_container(struct vfio_device *device);
 +int __init vfio_group_init(void);
 +void vfio_group_cleanup(void);
 +
 +#if IS_ENABLED(CONFIG_VFIO_CONTAINER)
- /* events for the backend driver notify callback */
- enum vfio_iommu_notify_type {
- 	VFIO_IOMMU_CONTAINER_CLOSE = 0,
- };
- 
  /**
   * struct vfio_iommu_driver_ops - VFIO IOMMU driver callbacks
   */
diff --cc drivers/vfio/vfio_main.c
index e21ff965141e69,03dbcd3d96f0e5..d4087fe7419996
--- a/drivers/vfio/vfio_main.c
+++ b/drivers/vfio/vfio_main.c
@@@ -1260,27 -1902,59 +1348,34 @@@ static int __init vfio_init(void
  	if (ret)
  		return ret;
  
+ 	ret = vfio_virqfd_init();
+ 	if (ret)
 -		goto err_virqfd;
 -
 -	/* /dev/vfio/$GROUP */
 -	vfio.class = class_create(THIS_MODULE, "vfio");
 -	if (IS_ERR(vfio.class)) {
 -		ret = PTR_ERR(vfio.class);
 -		goto err_group_class;
 -	}
 -
 -	vfio.class->devnode = vfio_devnode;
++		goto err_group;
+ 
  	/* /sys/class/vfio-dev/vfioX */
  	vfio.device_class = class_create(THIS_MODULE, "vfio-dev");
  	if (IS_ERR(vfio.device_class)) {
  		ret = PTR_ERR(vfio.device_class);
--		goto err_dev_class;
++		goto err_virqfd;
  	}
  
 -	ret = alloc_chrdev_region(&vfio.group_devt, 0, MINORMASK + 1, "vfio");
 -	if (ret)
 -		goto err_alloc_chrdev;
 -
  	pr_info(DRIVER_DESC " version: " DRIVER_VERSION "\n");
  	return 0;
  
 -err_alloc_chrdev:
 -	class_destroy(vfio.device_class);
 -	vfio.device_class = NULL;
--err_dev_class:
 -	class_destroy(vfio.class);
 -	vfio.class = NULL;
 -err_group_class:
 -	vfio_virqfd_exit();
+ err_virqfd:
 -	vfio_container_cleanup();
++	vfio_virqfd_exit();
++err_group:
 +	vfio_group_cleanup();
  	return ret;
  }
  
  static void __exit vfio_cleanup(void)
  {
 -	WARN_ON(!list_empty(&vfio.group_list));
 -
  	ida_destroy(&vfio.device_ida);
 -	ida_destroy(&vfio.group_ida);
 -	unregister_chrdev_region(vfio.group_devt, MINORMASK + 1);
  	class_destroy(vfio.device_class);
  	vfio.device_class = NULL;
 -	class_destroy(vfio.class);
+ 	vfio_virqfd_exit();
 -	vfio_container_cleanup();
 -	vfio.class = NULL;
 +	vfio_group_cleanup();
  	xa_destroy(&vfio_device_set_xa);
  }
  

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [GIT PULL] Please pull IOMMUFD subsystem changes
  2022-12-12 18:30 Jason Gunthorpe
@ 2022-12-14 18:04 ` pr-tracker-bot
  0 siblings, 0 replies; 51+ messages in thread
From: pr-tracker-bot @ 2022-12-14 18:04 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: Linus Torvalds, iommu, kvm, linux-kernel, Kevin Tian

The pull request you sent on Mon, 12 Dec 2022 14:30:37 -0400:

> git://git.kernel.org/pub/scm/linux/kernel/git/jgg/iommufd.git tags/for-linus-iommufd

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/08cdc2157966c07d3f986a097ddaa74cee312751

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html

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

* [GIT PULL] Please pull IOMMUFD subsystem changes
@ 2023-02-21 15:39 Jason Gunthorpe
  2023-02-24 22:50 ` Linus Torvalds
  2023-02-24 23:27 ` pr-tracker-bot
  0 siblings, 2 replies; 51+ messages in thread
From: Jason Gunthorpe @ 2023-02-21 15:39 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: iommu, kvm, linux-kernel, Kevin Tian

[-- Attachment #1: Type: text/plain, Size: 7203 bytes --]

Hi Linus,

This PR has a few smaller updates related to iommufd. Several big topics are
currently still on the mailing list in review:

- VFIO device cdev support to allow exposing all the iommufd features:
  https://lore.kernel.org/kvm/20230221034812.138051-1-yi.l.liu@intel.com/

- iommufd page table replace operation:
  https://lore.kernel.org/kvm/cover.1675802050.git.nicolinc@nvidia.com/

- IOMMU driver information query:
  https://lore.kernel.org/r/20230209041642.9346-1-yi.l.liu@intel.com

- Intel VT-d nested translation:
  https://lore.kernel.org/r/20230209043153.14964-1-yi.l.liu@intel.com

- Draft patches for ARM SMMUv3 nested translation:
  https://github.com/nicolinc/iommufd/commits/wip/iommufd-v6.2-rc5-nesting

Along with qemu patches implementing iommufd:
https://lore.kernel.org/qemu-devel/20230131205305.2726330-1-eric.auger@redhat.com/

And draft patches for the qemu side support for nested translation.

This PR has a shared branch with Joerg's tree changing the signature of
iommu_map() to add a gfp_t. There were some conflicts with v6.2 which I've
resolved in this PR and there will be a conflict against the rpmsg tree:

 https://lore.kernel.org/r/20230127180226.783baf07@canb.auug.org.au

--- a/drivers/remoteproc/qcom_q6v5_adsp.c
+++ b/drivers/remoteproc/qcom_q6v5_adsp.c
@@ -367,7 +367,8 @@ static int adsp_map_carveout(struct rproc *rproc)
        iova =  adsp->mem_phys | (sid << 32);

        ret = iommu_map(rproc->domain, iova, adsp->mem_phys,
-                       adsp->mem_size, IOMMU_READ | IOMMU_WRITE);
+                       adsp->mem_size, IOMMU_READ | IOMMU_WRITE,
+                       GFP_KERNEL);
        if (ret) {
                dev_err(adsp->dev, "Unable to map ADSP Physical Memory\n");
                return ret;

Thanks,
Jason

The following changes since commit c9c3395d5e3dcc6daee66c6908354d47bf98cb0c:

  Linux 6.2 (2023-02-19 14:24:22 -0800)

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 939204e4df962982cbc84acc26b29b421dd530a8:

  Merge tag 'v6.2' into iommufd.git for-next (2023-02-21 11:11:03 -0400)

----------------------------------------------------------------
iommufd for 6.3

Some polishing and small fixes for iommufd:

- Remove IOMMU_CAP_INTR_REMAP, instead rely on the interrupt subsystem

- Use GFP_KERNEL_ACCOUNT inside the iommu_domains

- Support VFIO_NOIOMMU mode with iommufd

- Various typos

- A list corruption bug if HWPTs are used for attach

----------------------------------------------------------------
Jason Gunthorpe (26):
      genirq/msi: Add msi_device_has_isolated_msi()
      iommu: Add iommu_group_has_isolated_msi()
      vfio/type1: Convert to iommu_group_has_isolated_msi()
      iommufd: Convert to msi_device_has_isolated_msi()
      genirq/irqdomain: Remove unused irq_domain_check_msi_remap() code
      genirq/msi: Rename IRQ_DOMAIN_MSI_REMAP to IRQ_DOMAIN_ISOLATED_MSI
      iommu/x86: Replace IOMMU_CAP_INTR_REMAP with IRQ_DOMAIN_FLAG_ISOLATED_MSI
      irq/s390: Add arch_is_isolated_msi() for s390
      iommu: Remove IOMMU_CAP_INTR_REMAP
      Merge branch 'isolated_msi' into iommufd.git for-next
      iommu: Add a gfp parameter to iommu_map()
      iommu: Remove iommu_map_atomic()
      iommu: Add a gfp parameter to iommu_map_sg()
      iommu/dma: Use the gfp parameter in __iommu_dma_alloc_noncontiguous()
      iommufd: Use GFP_KERNEL_ACCOUNT for iommu_map()
      iommu/intel: Add a gfp parameter to alloc_pgtable_page()
      iommu/intel: Support the gfp argument to the map_pages op
      iommu/intel: Use GFP_KERNEL in sleepable contexts
      iommu/s390: Push the gfp parameter to the kmem_cache_alloc()'s
      iommu/s390: Use GFP_KERNEL in sleepable contexts
      Merge branch 'iommu-memory-accounting' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/joro/iommu intoiommufd/for-next
      vfio: Support VFIO_NOIOMMU with iommufd
      Merge branch 'vfio-no-iommu' into iommufd.git for-next
      iommufd: Make sure to zero vfio_iommu_type1_info before copying to user
      iommufd: Do not add the same hwpt to the ioas->hwpt_list twice
      Merge tag 'v6.2' into iommufd.git for-next

Nicolin Chen (1):
      selftests: iommu: Fix test_cmd_destroy_access() call in user_copy

Yi Liu (1):
      iommufd: Add three missing structures in ucmd_buffer

 arch/arm/mm/dma-mapping.c                          |  11 ++-
 arch/s390/include/asm/msi.h                        |  17 ++++
 arch/s390/include/asm/pci_dma.h                    |   5 +-
 arch/s390/pci/pci_dma.c                            |  31 +++---
 .../gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c    |   3 +-
 drivers/gpu/drm/tegra/drm.c                        |   2 +-
 drivers/gpu/host1x/cdma.c                          |   2 +-
 drivers/infiniband/hw/usnic/usnic_uiom.c           |   8 +-
 drivers/iommu/amd/iommu.c                          |   5 +-
 drivers/iommu/dma-iommu.c                          |  18 +++-
 drivers/iommu/intel/iommu.c                        |  38 ++++----
 drivers/iommu/intel/iommu.h                        |   2 +-
 drivers/iommu/intel/irq_remapping.c                |   3 +-
 drivers/iommu/intel/pasid.c                        |   2 +-
 drivers/iommu/iommu.c                              |  77 ++++++++-------
 drivers/iommu/iommufd/Kconfig                      |   2 +-
 drivers/iommu/iommufd/device.c                     |   8 +-
 drivers/iommu/iommufd/iommufd_private.h            |   2 +
 drivers/iommu/iommufd/main.c                       |   3 +
 drivers/iommu/iommufd/pages.c                      |   6 +-
 drivers/iommu/iommufd/vfio_compat.c                | 107 +++++++++++++++++----
 drivers/iommu/s390-iommu.c                         |  17 ++--
 drivers/irqchip/irq-gic-v3-its.c                   |   4 +-
 drivers/media/platform/qcom/venus/firmware.c       |   2 +-
 drivers/net/ipa/ipa_mem.c                          |   6 +-
 drivers/net/wireless/ath/ath10k/snoc.c             |   2 +-
 drivers/net/wireless/ath/ath11k/ahb.c              |   4 +-
 drivers/remoteproc/remoteproc_core.c               |   5 +-
 drivers/vfio/Kconfig                               |   2 +-
 drivers/vfio/container.c                           |   7 --
 drivers/vfio/group.c                               |   7 +-
 drivers/vfio/iommufd.c                             |  19 +++-
 drivers/vfio/vfio.h                                |   8 +-
 drivers/vfio/vfio_iommu_type1.c                    |  25 ++---
 drivers/vfio/vfio_main.c                           |   7 ++
 drivers/vhost/vdpa.c                               |   2 +-
 include/linux/iommu.h                              |  33 ++-----
 include/linux/iommufd.h                            |  12 ++-
 include/linux/irqdomain.h                          |  29 +-----
 include/linux/msi.h                                |  17 ++++
 kernel/irq/irqdomain.c                             |  39 --------
 kernel/irq/msi.c                                   |  27 ++++++
 tools/testing/selftests/iommu/iommufd.c            |   2 +-
 43 files changed, 369 insertions(+), 259 deletions(-)
 create mode 100644 arch/s390/include/asm/msi.h

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [GIT PULL] Please pull IOMMUFD subsystem changes
  2023-02-21 15:39 Jason Gunthorpe
@ 2023-02-24 22:50 ` Linus Torvalds
  2023-02-25  0:02   ` Jason Gunthorpe
  2023-02-24 23:27 ` pr-tracker-bot
  1 sibling, 1 reply; 51+ messages in thread
From: Linus Torvalds @ 2023-02-24 22:50 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: iommu, kvm, linux-kernel, Kevin Tian

On Tue, Feb 21, 2023 at 7:39 AM Jason Gunthorpe <jgg@nvidia.com> wrote:
>
> iommufd for 6.3
>
> Some polishing and small fixes for iommufd:

Hmm. About half the patches seem to not be about iommufd, but about
'isolated_msi', which isn't even mentioned in the pull request at all
(well, it's there in the shortlog, but not in the actual "this is what
happened")

I already merged it, and am not sure what I would add to the commit
message, but I really would have liked to see that mentioned,
considering that it wasn't some small part of it all.

              Linus

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

* Re: [GIT PULL] Please pull IOMMUFD subsystem changes
  2023-02-21 15:39 Jason Gunthorpe
  2023-02-24 22:50 ` Linus Torvalds
@ 2023-02-24 23:27 ` pr-tracker-bot
  1 sibling, 0 replies; 51+ messages in thread
From: pr-tracker-bot @ 2023-02-24 23:27 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: Linus Torvalds, iommu, kvm, linux-kernel, Kevin Tian

The pull request you sent on Tue, 21 Feb 2023 11:39:51 -0400:

> git://git.kernel.org/pub/scm/linux/kernel/git/jgg/iommufd.git tags/for-linus-iommufd

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/143c7bc6496c886ce5db2a2f9cec580494690170

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html

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

* Re: [GIT PULL] Please pull IOMMUFD subsystem changes
  2023-02-24 22:50 ` Linus Torvalds
@ 2023-02-25  0:02   ` Jason Gunthorpe
  2023-02-25  0:50     ` Linus Torvalds
  0 siblings, 1 reply; 51+ messages in thread
From: Jason Gunthorpe @ 2023-02-25  0:02 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: iommu, kvm, linux-kernel, Kevin Tian

On Fri, Feb 24, 2023 at 02:50:45PM -0800, Linus Torvalds wrote:
> On Tue, Feb 21, 2023 at 7:39 AM Jason Gunthorpe <jgg@nvidia.com> wrote:
> >
> > iommufd for 6.3
> >
> > Some polishing and small fixes for iommufd:
> 
> Hmm. About half the patches seem to not be about iommufd, but about
> 'isolated_msi', which isn't even mentioned in the pull request at all
> (well, it's there in the shortlog, but not in the actual "this is what
> happened")

Ah, it is perhaps somewhat cryptically mentioned in the tag:

"Remove IOMMU_CAP_INTR_REMAP, instead rely on the interrupt subsystem"

In retrospect I can see that is pretty obtuse, but from my POV that
was the goal of that series :)

> I already merged it, and am not sure what I would add to the commit
> message, but I really would have liked to see that mentioned,
> considering that it wasn't some small part of it all.

I think the missing paragraph is something like:

 This PR includes some rework of MSI isolation/security capability
 detection that touches irq, iommu, vfio and iommufd. It consolidates
 two partially overlapping approaches into a single one.

Do you like this sort of explanation in the email or the tag?

Honestly, after 5 years (wow time flies) of sending PRs for rdma I'm
still a bit unclear on the best way to write the tag message.

I suppose you noticed, but I've followed John Corbet's suggestion to
capture the cover letters in internal merge commits. Eg isolated-msi
has a lot of words in commit fc3873095a

Thanks,
Jason

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

* Re: [GIT PULL] Please pull IOMMUFD subsystem changes
  2023-02-25  0:02   ` Jason Gunthorpe
@ 2023-02-25  0:50     ` Linus Torvalds
  0 siblings, 0 replies; 51+ messages in thread
From: Linus Torvalds @ 2023-02-25  0:50 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: iommu, kvm, linux-kernel, Kevin Tian

On Fri, Feb 24, 2023 at 4:02 PM Jason Gunthorpe <jgg@nvidia.com> wrote:
>
> Do you like this sort of explanation in the email or the tag?

Either works, I really don't have a strong preference. Some people do
one, others do the other. And some people (like Rafael) do both - with
the summary list in the tag (and thus also as part of the pull
request), but an overview at the top of the email.

> Honestly, after 5 years (wow time flies) of sending PRs for rdma I'm
> still a bit unclear on the best way to write the tag message.

Heh. Probably because there isn't any "one correct" way. Whatever
works best for you.

The thing I personally care about is just that there _is_ an
explanation, and that it makes sense in the context of a human reader
who looks at the merge later.

So no automatically generated stuff that you could just get with some
git command anyway, but an actual overview.

And I'll edit things to make sense in a commit message anyway, so I'll
remove language like "This pull request contains.." because that
doesn't make sense once it's just a merge commit and no longer is a
pull request.

So I'll generally edit that kind of laniage down to "This contains.."
instead or something like that.

I also try to *generally* make the merge commit messages look roughly
the same, so that when people use wildly different whitespace (tabs vs
spaces) or use different bullet points - "-" vs "o" vs "*" etc) I
generally try to make those kinds of things also be at least
*somewhat* consistent.

And for that, it can certainly make my life easier if you look at what
merge messages look like, and don't try to make your pull request
message wildly different. But it's really not a big deal - I do that
kind of reformatting as part of simply reading the message, so it's
all fine.

Finally - remember that the merge message is for humans reading it
later, and not everybody necessarily knows the TLA's that may be
obvious to you as a maintainer of that subsystem. So try to make it
somewhat legible to a general (kernel developer) public.

And then if I feel like the message doesn't cover all of the changes,
I'll prod you, like I did in this case.

               Linus

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

* [GIT PULL] Please pull IOMMUFD subsystem changes
@ 2023-04-06 13:34 Jason Gunthorpe
  2023-04-06 18:46 ` pr-tracker-bot
  0 siblings, 1 reply; 51+ messages in thread
From: Jason Gunthorpe @ 2023-04-06 13:34 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: iommu, kvm, linux-kernel, Kevin Tian

[-- Attachment #1: Type: text/plain, Size: 1667 bytes --]

Hi Linus,

Three bug fixes that a syzkaller instance found in iommufd. We added
some selftest coverage for this, but it will come in the merge window
as it depends on some other selftest changes.

I'm pretty happy with this as it shows the selftest setup is allowing
syzkaller into code paths that would normally be only reached by
in-kernel VFIO mdev drivers. These are bugs that the normal vGVT and
S390 vfio-mdev test suites didn't find.

Thanks,
Jason

The following changes since commit 7e364e56293bb98cae1b55fd835f5991c4e96e7d:

  Linux 6.3-rc5 (2023-04-02 14:29:29 -0700)

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 13a0d1ae7ee6b438f5537711a8c60cba00554943:

  iommufd: Do not corrupt the pfn list when doing batch carry (2023-04-04 09:10:55 -0300)

----------------------------------------------------------------
iommufd for 6.3 rc

Three bugs found by syzkaller:

 - An invalid VA range can be be put in a pages and eventually trigger
   WARN_ON, reject it early

 - Use of the wrong start index value when doing the complex batch carry
   scheme

 - Wrong store ordering resulting in corrupting data used in a later
   calculation that corrupted the batch structure during carry

----------------------------------------------------------------
Jason Gunthorpe (3):
      iommufd: Check for uptr overflow
      iommufd: Fix unpinning of pages when an access is present
      iommufd: Do not corrupt the pfn list when doing batch carry

 drivers/iommu/iommufd/pages.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [GIT PULL] Please pull IOMMUFD subsystem changes
  2023-04-06 13:34 Jason Gunthorpe
@ 2023-04-06 18:46 ` pr-tracker-bot
  0 siblings, 0 replies; 51+ messages in thread
From: pr-tracker-bot @ 2023-04-06 18:46 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: Linus Torvalds, iommu, kvm, linux-kernel, Kevin Tian

The pull request you sent on Thu, 6 Apr 2023 10:34:39 -0300:

> git://git.kernel.org/pub/scm/linux/kernel/git/jgg/iommufd.git tags/for-linus-iommufd

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/105b64c83872c39d86c1e3dea9ee4185c62114dc

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html

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

* [GIT PULL] Please pull IOMMUFD subsystem changes
@ 2023-04-25 14:46 Jason Gunthorpe
  2023-04-27 17:15 ` pr-tracker-bot
  0 siblings, 1 reply; 51+ messages in thread
From: Jason Gunthorpe @ 2023-04-25 14:46 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: iommu, kvm, linux-kernel, Kevin Tian

[-- Attachment #1: Type: text/plain, Size: 5534 bytes --]

Hi Linus,

We did not manage to get the VFIO parts ready for this cycle, but it
looks really close now. Here is the stuff still in progress:

- VFIO PCI hot reset support for iommufd:
  https://lore.kernel.org/kvm/20230401144429.88673-1-yi.l.liu@intel.com/

- VFIO device cdev support to allow exposing all the iommufd features:
  https://lore.kernel.org/kvm/20230401151833.124749-1-yi.l.liu@intel.com/

- iommufd page table replace operation:
  https://lore.kernel.org/kvm/0-v6-fdb604df649a+369-iommufd_alloc_jgg@nvidia.com/

- IOMMU driver information query:
  https://lore.kernel.org/kvm/20230309075358.571567-1-yi.l.liu@intel.com/

- Intel VT-d nested translation:
  https://lore.kernel.org/kvm/20230309082207.612346-1-yi.l.liu@intel.com/

- ARM SMMUv3 nested translation:
  https://lore.kernel.org/linux-iommu/cover.1678348754.git.nicolinc@nvidia.com/

Along with qemu patches implementing iommufd:
https://lore.kernel.org/qemu-devel/20230131205305.2726330-1-eric.auger@redhat.com/

And draft patches for the qemu side support for nested translation.

This PR is some small fixes and two preperatory reworks for the above
series.

Thanks,
Jason

The following changes since commit 13a0d1ae7ee6b438f5537711a8c60cba00554943:

  iommufd: Do not corrupt the pfn list when doing batch carry (2023-04-04 09:10:55 -0300)

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 62e37c86bf0718e1ec0156c7a88a43ced6cdf201:

  iommufd/selftest: Cover domain unmap with huge pages and access (2023-04-04 13:11:24 -0300)

----------------------------------------------------------------
iommufd for 6.4

Two series:

 - Reorganize how the hardware page table objects are managed,
   particularly their destruction flow. Increase the selftest
   test coverage in this area by creating a more complete mock
   iommu driver.

   This is preparation to add a replace operation for HWPT binding,
   which is done but waiting for the VFIO parts to complete so there
   is a user.

 - Split the iommufd support for "access" to make it two step - allocate
   an access then link it to an IOAS. Update VFIO and have VFIO always
   create an access even for the VFIO mdevs that never do DMA.

   This is also preperation for the replace VFIO series that will allow
   replace to work on access types as well.

Three minor fixes:

 - Sykzaller found the selftest code didn't check for overflow when
   processing user VAs

 - smatch noted a .data item should have been static

 - Add a selftest that reproduces a syzkaller bug for batch carry already
   fixed in rc

----------------------------------------------------------------
Jason Gunthorpe (16):
      iommufd: Assert devices_lock for iommufd_hw_pagetable_has_group()
      iommufd: Add iommufd_lock_obj() around the auto-domains hwpts
      iommufd: Consistently manage hwpt_item
      iommufd: Move ioas related HWPT destruction into iommufd_hw_pagetable_destroy()
      iommufd: Move iommufd_device to iommufd_private.h
      iommufd: Make iommufd_hw_pagetable_alloc() do iopt_table_add_domain()
      iommufd/selftest: Rename the sefltest 'device_id' to 'stdev_id'
      iommufd/selftest: Rename domain_id to stdev_id for FIXTURE iommufd_ioas
      iommufd/selftest: Rename domain_id to hwpt_id for FIXTURE iommufd_mock_domain
      iommufd/selftest: Rename the remaining mock device_id's to stdev_id
      iommufd/selftest: Make selftest create a more complete mock device
      iommufd/selftest: Add a selftest for iommufd_device_attach() with a hwpt argument
      iommufd/selftest: Catch overflow of uptr and length
      Merge branch 'vfio_mdev_ops' into iommufd.git for-next
      Merge branch 'iommufd/for-rc' into for-next
      iommufd/selftest: Cover domain unmap with huge pages and access

Nicolin Chen (1):
      iommufd: Create access in vfio_iommufd_emulated_bind()

Tom Rix (1):
      iommufd/selftest: Set varaiable mock_iommu_device storage-class-specifier to static

Yi Liu (5):
      iommu/iommufd: Pass iommufd_ctx pointer in iommufd_get_ioas()
      vfio-iommufd: No need to record iommufd_ctx in vfio_device
      vfio-iommufd: Make vfio_iommufd_emulated_bind() return iommufd_access ID
      vfio/mdev: Uses the vfio emulated iommufd ops set in the mdev sample drivers
      vfio: Check the presence for iommufd callbacks in __vfio_register_dev()

 drivers/iommu/iommufd/device.c                   | 205 +++++++++------------
 drivers/iommu/iommufd/hw_pagetable.c             |  70 ++++++--
 drivers/iommu/iommufd/ioas.c                     |  14 +-
 drivers/iommu/iommufd/iommufd_private.h          |  39 +++-
 drivers/iommu/iommufd/iommufd_test.h             |   2 +-
 drivers/iommu/iommufd/selftest.c                 | 219 +++++++++++++++++++----
 drivers/iommu/iommufd/vfio_compat.c              |   2 +-
 drivers/vfio/iommufd.c                           |  37 ++--
 drivers/vfio/vfio_main.c                         |   5 +-
 include/linux/iommufd.h                          |   5 +-
 include/linux/vfio.h                             |   1 -
 samples/vfio-mdev/mbochs.c                       |   3 +
 samples/vfio-mdev/mdpy.c                         |   3 +
 samples/vfio-mdev/mtty.c                         |   3 +
 tools/testing/selftests/iommu/iommufd.c          | 104 +++++++----
 tools/testing/selftests/iommu/iommufd_fail_nth.c |  38 ++--
 tools/testing/selftests/iommu/iommufd_utils.h    |  16 +-
 17 files changed, 494 insertions(+), 272 deletions(-)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [GIT PULL] Please pull IOMMUFD subsystem changes
  2023-04-25 14:46 Jason Gunthorpe
@ 2023-04-27 17:15 ` pr-tracker-bot
  0 siblings, 0 replies; 51+ messages in thread
From: pr-tracker-bot @ 2023-04-27 17:15 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: Linus Torvalds, iommu, kvm, linux-kernel, Kevin Tian

The pull request you sent on Tue, 25 Apr 2023 11:46:17 -0300:

> git://git.kernel.org/pub/scm/linux/kernel/git/jgg/iommufd.git tags/for-linus-iommufd

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/6df969b77ecc2ba21dcd0e57f416e58bec2a5ca1

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html

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

* [GIT PULL] Please pull IOMMUFD subsystem changes
@ 2023-06-28 14:04 Jason Gunthorpe
  2023-06-30  4:16 ` pr-tracker-bot
  0 siblings, 1 reply; 51+ messages in thread
From: Jason Gunthorpe @ 2023-06-28 14:04 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: iommu, kvm, linux-kernel, Kevin Tian

[-- Attachment #1: Type: text/plain, Size: 1168 bytes --]

Hi Linus,

Just two rc syzkaller fixes for this merge window. It looks like the
vfio changes are now done so we should see progress next cycle.

Thanks,
Jason

The following changes since commit 6995e2de6891c724bfeb2db33d7b87775f913ad1:

  Linux 6.4 (2023-06-25 16:29:58 -0700)

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 dbe245cdf5189e88d680379ed13901356628b650:

  iommufd: Call iopt_area_contig_done() under the lock (2023-06-26 09:00:23 -0300)

----------------------------------------------------------------
iommufd for 6.5

Just two RC syzkaller fixes, both for the same basic issue, using the area
pointer during an access forced unmap while the locks protecting it were
let go.

----------------------------------------------------------------
Jason Gunthorpe (2):
      iommufd: Do not access the area pointer after unlocking
      iommufd: Call iopt_area_contig_done() under the lock

 drivers/iommu/iommufd/device.c       |  2 +-
 drivers/iommu/iommufd/io_pagetable.c | 14 +++++++++++---
 2 files changed, 12 insertions(+), 4 deletions(-)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [GIT PULL] Please pull IOMMUFD subsystem changes
  2023-06-28 14:04 Jason Gunthorpe
@ 2023-06-30  4:16 ` pr-tracker-bot
  0 siblings, 0 replies; 51+ messages in thread
From: pr-tracker-bot @ 2023-06-30  4:16 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: Linus Torvalds, iommu, kvm, linux-kernel, Kevin Tian

The pull request you sent on Wed, 28 Jun 2023 11:04:20 -0300:

> git://git.kernel.org/pub/scm/linux/kernel/git/jgg/iommufd.git tags/for-linus-iommufd

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/31929ae00890d921618b0b449722dcdf4a4416cc

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html

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

* [GIT PULL] Please pull IOMMUFD subsystem changes
@ 2023-07-28 13:48 Jason Gunthorpe
  2023-07-28 18:39 ` pr-tracker-bot
  0 siblings, 1 reply; 51+ messages in thread
From: Jason Gunthorpe @ 2023-07-28 13:48 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: iommu, kvm, linux-kernel, Kevin Tian

[-- Attachment #1: Type: text/plain, Size: 1369 bytes --]

Hi Linus,

Small rc update for some recently found bugs

Thanks,
Jason

The following changes since commit 6eaae198076080886b9e7d57f4ae06fa782f90ef:

  Linux 6.5-rc3 (2023-07-23 15:24:10 -0700)

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 b7c822fa6b7701b17e139f1c562fc24135880ed4:

  iommufd: Set end correctly when doing batch carry (2023-07-27 11:27:20 -0300)

----------------------------------------------------------------
iommufd for 6.5 rc

Two user triggerable problems:

- Syzkaller found a way to trigger a WARN_ON and leak memory by racing
  destroy with other actions

- There is still a bug in the "batch carry" stuff that gets invoked for
  complex cases with accesses and unmapping of huge pages. The test suite
  found this (triggers rarely)

----------------------------------------------------------------
Jason Gunthorpe (2):
      iommufd: IOMMUFD_DESTROY should not increase the refcount
      iommufd: Set end correctly when doing batch carry

 drivers/iommu/iommufd/device.c          | 12 ++---
 drivers/iommu/iommufd/iommufd_private.h | 15 ++++++-
 drivers/iommu/iommufd/main.c            | 78 +++++++++++++++++++++++++--------
 drivers/iommu/iommufd/pages.c           |  2 +-
 4 files changed, 76 insertions(+), 31 deletions(-)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [GIT PULL] Please pull IOMMUFD subsystem changes
  2023-07-28 13:48 Jason Gunthorpe
@ 2023-07-28 18:39 ` pr-tracker-bot
  0 siblings, 0 replies; 51+ messages in thread
From: pr-tracker-bot @ 2023-07-28 18:39 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: Linus Torvalds, iommu, kvm, linux-kernel, Kevin Tian

The pull request you sent on Fri, 28 Jul 2023 10:48:08 -0300:

> git://git.kernel.org/pub/scm/linux/kernel/git/jgg/iommufd.git tags/for-linus-iommufd

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/0299a13af0be43f2679047c7236e3a58e587f3f8

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html

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

* [GIT PULL] Please pull IOMMUFD subsystem changes
@ 2023-08-30 23:40 Jason Gunthorpe
  2023-08-31  3:50 ` pr-tracker-bot
  2023-08-31  3:59 ` Linus Torvalds
  0 siblings, 2 replies; 51+ messages in thread
From: Jason Gunthorpe @ 2023-08-30 23:40 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: iommu, kvm, linux-kernel, Kevin Tian

[-- Attachment #1: Type: text/plain, Size: 12007 bytes --]

Hi Linus,

This PR includes several of the items that have been in progress for quite
some time now, details in the tag.

For those following, these series are still progressing:

- User page table invalidation:
 https://lore.kernel.org/all/20230724110406.107212-1-yi.l.liu@intel.com/

- Intel VT-d nested translation:
 https://lore.kernel.org/all/20230724111335.107427-1-yi.l.liu@intel.com/

- ARM SMMv3 nested translation:
 https://lore.kernel.org/all/cover.1683688960.git.nicolinc@nvidia.com/

- Draft AMD IOMMU nested translation:
 https://lore.kernel.org/all/20230621235508.113949-1-suravee.suthikulpanit@amd.com/

There is also alot of ongoing work to generically enable PASID support in all
the IOMMU drivers:
 SMMUv3:
   https://lore.kernel.org/linux-iommu/20230621063825.268890-1-mshavit@google.com/
 AMD:
   https://lore.kernel.org/all/20230821104227.706997-1-vasant.hegde@amd.com/
   https://lore.kernel.org/all/20230821104956.707235-1-vasant.hegde@amd.com/
   https://lore.kernel.org/all/20230816174031.634453-1-vasant.hegde@amd.com/

Which will see exposure through the iommufd uAPI soon.

Along with qemu patches implementing iommufd:
 https://lore.kernel.org/all/20230830103754.36461-1-zhenzhong.duan@intel.com/

Draft patches for the qemu side support for nested translation support in
the vIOMMU drivers are linked from the above.

Thanks,
Jason

The following changes since commit 2ccdd1b13c591d306f0401d98dedc4bdcd02b421:

  Linux 6.5-rc6 (2023-08-13 11:29:55 -0700)

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 eb501c2d96cfce6b42528e8321ea085ec605e790:

  iommufd/selftest: Don't leak the platform device memory when unloading the module (2023-08-18 12:56:24 -0300)

----------------------------------------------------------------
iommufd for 6.6

This includes a shared branch with VFIO:

 - Enhance VFIO_DEVICE_GET_PCI_HOT_RESET_INFO so it can work with iommufd
   FDs, not just group FDs. This removes the last place in the uAPI that
   required the group fd.

 - Give VFIO a new device node /dev/vfio/devices/vfioX (the so called cdev
   node) which is very similar to the FD from VFIO_GROUP_GET_DEVICE_FD.
   The cdev is associated with the struct device that the VFIO driver is
   bound to and shows up in sysfs in the normal way.

 - Add a cdev IOCTL VFIO_DEVICE_BIND_IOMMUFD which allows a newly opened
   /dev/vfio/devices/vfioX to be associated with an IOMMUFD, this replaces
   the VFIO_GROUP_SET_CONTAINER flow.

 - Add cdev IOCTLs VFIO_DEVICE_[AT|DE]TACH_IOMMUFD_PT to allow the IOMMU
   translation the vfio_device is associated with to be changed. This is a
   significant new feature for VFIO as previously each vfio_device was
   fixed to a single translation.

   The translation is under the control of iommufd, so it can be any of
   the different translation modes that iommufd is learning to create.

At this point VFIO has compilation options to remove the legacy interfaces
and in modern mode it behaves like a normal driver subsystem. The
/dev/vfio/iommu and /dev/vfio/groupX nodes are not present and each
vfio_device only has a /dev/vfio/devices/vfioX cdev node that represents
the device.

On top of this is built some of the new iommufd functionality:

 - IOMMU_HWPT_ALLOC allows userspace to directly create the low level
   IO Page table objects and affiliate them with IOAS objects that hold
   the translation mapping. This is the basic functionality for the
   normal IOMMU_DOMAIN_PAGING domains.

 - VFIO_DEVICE_ATTACH_IOMMUFD_PT can be used to replace the current
   translation. This is wired up to through all the layers down to the
   driver so the driver has the ability to implement a hitless
   replacement. This is necessary to fully support guest behaviors when
   emulating HW (eg guest atomic change of translation)

 - IOMMU_GET_HW_INFO returns information about the IOMMU driver HW that
   owns a VFIO device. This includes support for the Intel iommu, and
   patches have been posted for all the other server IOMMU.

Along the way are a number of internal items:

 - New iommufd kapis iommufd_ctx_has_group(), iommufd_device_to_ictx(),
   iommufd_device_to_id(), iommufd_access_detach(), iommufd_ctx_from_fd(),
   iommufd_device_replace()

 - iommufd now internally tracks iommu_groups as it needs some per-group
   data

 - Reorganize how the internal hwpt allocation flows to have more robust
   locking

 - Improve the access interfaces to support detach and replace of an IOAS
   from an access

 - New selftests and a rework of how the selftests creates a mock iommu
   driver to be more like a real iommu driver

----------------------------------------------------------------
Jason Gunthorpe (21):
      Merge branch 'v6.6/vfio/cdev' of https://github.com/awilliam/linux-vfio into iommufd for-next
      iommufd: Move isolated msi enforcement to iommufd_device_bind()
      iommufd: Add iommufd_group
      iommufd: Replace the hwpt->devices list with iommufd_group
      iommu: Export iommu_get_resv_regions()
      iommufd: Keep track of each device's reserved regions instead of groups
      iommufd: Use the iommufd_group to avoid duplicate MSI setup
      iommufd: Make sw_msi_start a group global
      iommufd: Move putting a hwpt to a helper function
      iommufd: Add enforced_cache_coherency to iommufd_hw_pagetable_alloc()
      iommufd: Allow a hwpt to be aborted after allocation
      iommufd: Fix locking around hwpt allocation
      iommufd: Reorganize iommufd_device_attach into iommufd_device_change_pt
      iommufd: Add iommufd_device_replace()
      iommufd: Make destroy_rwsem use a lock class per object type
      iommufd: Add IOMMU_HWPT_ALLOC
      iommufd/selftest: Return the real idev id from selftest mock_domain
      iommufd/selftest: Add a selftest for IOMMU_HWPT_ALLOC
      iommufd/selftest: Make the mock iommu driver into a real driver
      Merge tag 'v6.5-rc6' into iommufd for-next
      iommufd: Remove iommufd_ref_to_users()

Lu Baolu (1):
      iommu: Add new iommu op to get iommu hardware information

Nicolin Chen (11):
      iommufd/device: Add iommufd_access_detach() API
      iommu: Introduce a new iommu_group_replace_domain() API
      iommufd/selftest: Test iommufd_device_replace()
      vfio: Do not allow !ops->dma_unmap in vfio_pin/unpin_pages()
      iommufd: Allow passing in iopt_access_list_id to iopt_remove_access()
      iommufd: Add iommufd_access_change_ioas(_id) helpers
      iommufd: Use iommufd_access_change_ioas in iommufd_access_destroy_object
      iommufd: Add iommufd_access_replace() API
      iommufd/selftest: Add IOMMU_TEST_OP_ACCESS_REPLACE_IOAS coverage
      vfio: Support IO page table replacement
      iommufd/selftest: Add coverage for IOMMU_GET_HW_INFO ioctl

Yang Yingliang (1):
      iommufd/selftest: Don't leak the platform device memory when unloading the module

Yi Liu (38):
      vfio/pci: Update comment around group_fd get in vfio_pci_ioctl_pci_hot_reset()
      vfio/pci: Move the existing hot reset logic to be a helper
      iommufd: Reserve all negative IDs in the iommufd xarray
      iommufd: Add iommufd_ctx_has_group()
      iommufd: Add helper to retrieve iommufd_ctx and devid
      vfio: Mark cdev usage in vfio_device
      vfio: Add helper to search vfio_device in a dev_set
      vfio/pci: Extend VFIO_DEVICE_GET_PCI_HOT_RESET_INFO for vfio device cdev
      vfio/pci: Copy hot-reset device info to userspace in the devices loop
      vfio/pci: Allow passing zero-length fd array in VFIO_DEVICE_PCI_HOT_RESET
      vfio: Allocate per device file structure
      vfio: Refine vfio file kAPIs for KVM
      vfio: Accept vfio device file in the KVM facing kAPI
      kvm/vfio: Prepare for accepting vfio device fd
      kvm/vfio: Accept vfio device file from userspace
      vfio: Pass struct vfio_device_file * to vfio_device_open/close()
      vfio: Block device access via device fd until device is opened
      vfio: Add cdev_device_open_cnt to vfio_group
      vfio: Make vfio_df_open() single open for device cdev path
      vfio-iommufd: Move noiommu compat validation out of vfio_iommufd_bind()
      vfio-iommufd: Split bind/attach into two steps
      vfio: Record devid in vfio_device_file
      vfio-iommufd: Add detach_ioas support for physical VFIO devices
      vfio-iommufd: Add detach_ioas support for emulated VFIO devices
      vfio: Move vfio_device_group_unregister() to be the first operation in unregister
      vfio: Move device_del() before waiting for the last vfio_device registration refcount
      vfio: Add cdev for vfio_device
      vfio: Test kvm pointer in _vfio_device_get_kvm_safe()
      iommufd: Add iommufd_ctx_from_fd()
      vfio: Avoid repeated user pointer cast in vfio_device_fops_unl_ioctl()
      vfio: Add VFIO_DEVICE_BIND_IOMMUFD
      vfio: Add VFIO_DEVICE_[AT|DE]TACH_IOMMUFD_PT
      vfio: Move the IOMMU_CAP_CACHE_COHERENCY check in __vfio_register_dev()
      vfio: Compile vfio_group infrastructure optionally
      docs: vfio: Add vfio device cdev description
      iommu: Move dev_iommu_ops() to private header
      iommufd: Add IOMMU_GET_HW_INFO
      iommu/vt-d: Implement hw_info for iommu capability query

 Documentation/driver-api/vfio.rst                | 147 ++++-
 Documentation/virt/kvm/devices/vfio.rst          |  47 +-
 drivers/gpu/drm/i915/gvt/kvmgt.c                 |   1 +
 drivers/iommu/intel/iommu.c                      |  19 +
 drivers/iommu/iommu-priv.h                       |  30 +
 drivers/iommu/iommu.c                            |  81 ++-
 drivers/iommu/iommufd/Kconfig                    |   4 +-
 drivers/iommu/iommufd/device.c                   | 801 ++++++++++++++++++-----
 drivers/iommu/iommufd/hw_pagetable.c             | 112 +++-
 drivers/iommu/iommufd/io_pagetable.c             |  36 +-
 drivers/iommu/iommufd/iommufd_private.h          |  86 +--
 drivers/iommu/iommufd/iommufd_test.h             |  19 +
 drivers/iommu/iommufd/main.c                     |  61 +-
 drivers/iommu/iommufd/selftest.c                 | 213 ++++--
 drivers/s390/cio/vfio_ccw_ops.c                  |   1 +
 drivers/s390/crypto/vfio_ap_ops.c                |   1 +
 drivers/vfio/Kconfig                             |  27 +
 drivers/vfio/Makefile                            |   3 +-
 drivers/vfio/device_cdev.c                       | 228 +++++++
 drivers/vfio/fsl-mc/vfio_fsl_mc.c                |   1 +
 drivers/vfio/group.c                             | 173 +++--
 drivers/vfio/iommufd.c                           | 145 +++-
 drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c   |   2 +
 drivers/vfio/pci/mlx5/main.c                     |   1 +
 drivers/vfio/pci/vfio_pci.c                      |   1 +
 drivers/vfio/pci/vfio_pci_core.c                 | 250 ++++---
 drivers/vfio/platform/vfio_amba.c                |   1 +
 drivers/vfio/platform/vfio_platform.c            |   1 +
 drivers/vfio/vfio.h                              | 218 +++++-
 drivers/vfio/vfio_main.c                         | 258 +++++++-
 include/linux/iommu.h                            |  16 +-
 include/linux/iommufd.h                          |   9 +
 include/linux/vfio.h                             |  66 +-
 include/uapi/linux/iommufd.h                     |  97 +++
 include/uapi/linux/kvm.h                         |  13 +-
 include/uapi/linux/vfio.h                        | 148 ++++-
 samples/vfio-mdev/mbochs.c                       |   1 +
 samples/vfio-mdev/mdpy.c                         |   1 +
 samples/vfio-mdev/mtty.c                         |   1 +
 tools/testing/selftests/iommu/iommufd.c          | 130 +++-
 tools/testing/selftests/iommu/iommufd_fail_nth.c |  71 +-
 tools/testing/selftests/iommu/iommufd_utils.h    | 144 +++-
 virt/kvm/vfio.c                                  | 137 ++--
 43 files changed, 3130 insertions(+), 672 deletions(-)
 create mode 100644 drivers/iommu/iommu-priv.h
 create mode 100644 drivers/vfio/device_cdev.c

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [GIT PULL] Please pull IOMMUFD subsystem changes
  2023-08-30 23:40 Jason Gunthorpe
@ 2023-08-31  3:50 ` pr-tracker-bot
  2023-08-31  3:59 ` Linus Torvalds
  1 sibling, 0 replies; 51+ messages in thread
From: pr-tracker-bot @ 2023-08-31  3:50 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: Linus Torvalds, iommu, kvm, linux-kernel, Kevin Tian

The pull request you sent on Wed, 30 Aug 2023 20:40:43 -0300:

> git://git.kernel.org/pub/scm/linux/kernel/git/jgg/iommufd.git tags/for-linus-iommufd

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/4debf77169ee459c46ec70e13dc503bc25efd7d2

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html

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

* Re: [GIT PULL] Please pull IOMMUFD subsystem changes
  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
  1 sibling, 1 reply; 51+ messages in thread
From: Linus Torvalds @ 2023-08-31  3:59 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: iommu, kvm, linux-kernel, Kevin Tian

On Wed, 30 Aug 2023 at 16:40, Jason Gunthorpe <jgg@nvidia.com> wrote:
>
> This includes a shared branch with VFIO:
>
>  - Enhance VFIO_DEVICE_GET_PCI_HOT_RESET_INFO so it can work with iommufd
>    FDs, not just group FDs. [...]

So because I had pulled the vfio changes independently with their own
merge message, I ended up editing out all the commentary you had about
the vfio side of the changes.

Which is kind of sad, since you arguably put some more information and
effort into it than Alex had done in his vfio pull request. But the
vfio parts just weren't part of the merge any more.

I did put a link to your pull request in the commit, so people can
find this info, but I thought I'd mention how I ruthlessly edited down
the merge commit message to just the parts that were new to the merge.

I appreciate the extra background, even if I then decided that by the
time I merged your part, some of it was "old news" and not actually
about what I merged when I pulled your branch.

.. and if I had realized when I merged the vfio parts, I probably
could have added your commentary to that merge. Oh well.

                  Linus

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

* Re: [GIT PULL] Please pull IOMMUFD subsystem changes
  2023-08-31  3:59 ` Linus Torvalds
@ 2023-08-31 16:43   ` Jason Gunthorpe
  0 siblings, 0 replies; 51+ messages in thread
From: Jason Gunthorpe @ 2023-08-31 16:43 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: iommu, kvm, linux-kernel, Kevin Tian

On Wed, Aug 30, 2023 at 08:59:15PM -0700, Linus Torvalds wrote:
> On Wed, 30 Aug 2023 at 16:40, Jason Gunthorpe <jgg@nvidia.com> wrote:
> >
> > This includes a shared branch with VFIO:
> >
> >  - Enhance VFIO_DEVICE_GET_PCI_HOT_RESET_INFO so it can work with iommufd
> >    FDs, not just group FDs. [...]
> 
> So because I had pulled the vfio changes independently with their own
> merge message, I ended up editing out all the commentary you had about
> the vfio side of the changes.
> 
> Which is kind of sad, since you arguably put some more information and
> effort into it than Alex had done in his vfio pull request. But the
> vfio parts just weren't part of the merge any more.
> 
> I did put a link to your pull request in the commit, so people can
> find this info, but I thought I'd mention how I ruthlessly edited down
> the merge commit message to just the parts that were new to the merge.
> 
> I appreciate the extra background, even if I then decided that by the
> time I merged your part, some of it was "old news" and not actually
> about what I merged when I pulled your branch.
> 
> .. and if I had realized when I merged the vfio parts, I probably
> could have added your commentary to that merge. Oh well.

Thanks, I've been trying to make these PR emails sort of a 'state of
the union' for the project as there are a lot of collaborators
involved right now. The vfio parts are logically part of the iommufd
work.

Jason

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

* [GIT PULL] Please pull IOMMUFD subsystem changes
@ 2023-10-31 13:14 Jason Gunthorpe
  2023-11-02  2:51 ` pr-tracker-bot
  0 siblings, 1 reply; 51+ messages in thread
From: Jason Gunthorpe @ 2023-10-31 13:14 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: iommu, kvm, linux-kernel, Kevin Tian

[-- Attachment #1: Type: text/plain, Size: 12638 bytes --]

Hi Linus,

This PR includes the dirty tracking and first part of the nested
translation items for iommufd, details in the tag.

For those following, these series are still progressing:

- User page table invalidation:
 https://lore.kernel.org/r/20231020092426.13907-1-yi.l.liu@intel.com
 https://lore.kernel.org/r/20231020093719.18725-1-yi.l.liu@intel.com

- ARM SMMUv3 nested translation:
 https://lore.kernel.org/all/cover.1683688960.git.nicolinc@nvidia.com/

- Draft AMD IOMMU nested translation:
 https://lore.kernel.org/all/20230621235508.113949-1-suravee.suthikulpanit@amd.com/

- ARM SMMUv3 Dirty tracking:
 https://github.com/jpemartins/linux/commits/smmu-iommufd-v3

There is also a lot of ongoing work to consistently and generically enable
PASID and SVA support in all the IOMMU drivers:

 SMMUv3:
   https://lore.kernel.org/r/0-v1-e289ca9121be+2be-smmuv3_newapi_p1_jgg@nvidia.com
   https://lore.kernel.org/r/0-v1-afbb86647bbd+5-smmuv3_newapi_p2_jgg@nvidia.com
 AMD:
   https://lore.kernel.org/all/20231016104351.5749-1-vasant.hegde@amd.com/
   https://lore.kernel.org/all/20231013151652.6008-1-vasant.hegde@amd.com/
 Intel:
   https://lore.kernel.org/r/20231017032045.114868-1-tina.zhang@intel.com

RFC patches for PASID support in iommufd & vfio:
 https://lore.kernel.org/all/20230926092651.17041-1-yi.l.liu@intel.com/
 https://lore.kernel.org/all/20230926093121.18676-1-yi.l.liu@intel.com/

IO page faults and events delivered to userspace through iommufd:
 https://lore.kernel.org/all/20231026024930.382898-1-baolu.lu@linux.intel.com/

RFC patches exploring support for the first Intel Scalable IO Virtualization
(SIOV r1) device are posted:
 https://lore.kernel.org/all/20231009085123.463179-1-yi.l.liu@intel.com/

Along with qemu patches implementing iommufd:
 https://lore.kernel.org/all/20231016083223.1519410-1-zhenzhong.duan@intel.com/

There are some conflicts with Joerg's main iommu tree, most are of the append
to list type of conflict. A few notes:

drivers/iommu/iommufd/selftest.c needs a non-conflict hunk:

- static struct iommu_domain *mock_domain_alloc(unsigned int iommu_domain_type)
- {
-       if (iommu_domain_type == IOMMU_DOMAIN_BLOCKED)
-               return &mock_blocking_domain;
-       if (iommu_domain_type == IOMMU_DOMAIN_UNMANAGED)
-               return mock_domain_alloc_paging(NULL);
-       return NULL;
- }
-

drivers/iommu/iommufd/selftest.c should be:

@@@ -466,10 -293,8 +450,9 @@@ static const struct iommu_ops mock_ops
        .owner = THIS_MODULE,
        .pgsize_bitmap = MOCK_IO_PAGE_SIZE,
        .hw_info = mock_domain_hw_info,
-       .domain_alloc = mock_domain_alloc,
+       .domain_alloc_paging = mock_domain_alloc_paging,
 +      .domain_alloc_user = mock_domain_alloc_user,
        .capable = mock_domain_capable,
-       .set_platform_dma_ops = mock_domain_set_plaform_dma_ops,

include/linux/iommu.h should be:

 - * @domain_alloc: allocate iommu domain
 + * @domain_alloc: allocate and return an iommu domain if success. Otherwise
 + *                NULL is returned. The domain is not fully initialized until
 + *                the caller iommu_domain_alloc() returns.
 + * @domain_alloc_user: Allocate an iommu domain corresponding to the input
 + *                     parameters as defined in include/uapi/linux/iommufd.h.
 + *                     Unlike @domain_alloc, it is called only by IOMMUFD and
 + *                     must fully initialize the new domain before return.
 + *                     Upon success, if the @user_data is valid and the @parent
 + *                     points to a kernel-managed domain, the new domain must be
 + *                     IOMMU_DOMAIN_NESTED type; otherwise, the @parent must be
 + *                     NULL while the @user_data can be optionally provided, the
 + *                     new domain must support __IOMMU_DOMAIN_PAGING.
 + *                     Upon failure, ERR_PTR must be returned.
+  * @domain_alloc_paging: Allocate an iommu_domain that can be used for
+  *                       UNMANAGED, DMA, and DMA_FQ domain types.

The rest were straightforward.

The tag for-linus-iommufd-merged with my merge resolution to your tree
is also available to pull.

Thanks,
Jason

The following changes since commit ce9ecca0238b140b88f43859b211c9fdfd8e5b70:

  Linux 6.6-rc2 (2023-09-17 14:40:24 -0700)

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 b2b67c997bf74453f3469d8b54e4859f190943bd:

  iommufd: Organize the mock domain alloc functions closer to Joerg's tree (2023-10-30 18:01:56 -0300)

----------------------------------------------------------------
iommufd for 6.7

This branch has three new iommufd capabilities:

 - Dirty tracking for DMA. AMD/ARM/Intel CPUs can now record if a DMA
   writes to a page in the IOPTEs within the IO page table. This can be used
   to generate a record of what memory is being dirtied by DMA activities
   during a VM migration process. A VMM like qemu will combine the IOMMU
   dirty bits with the CPU's dirty log to determine what memory to
   transfer.

   VFIO already has a DMA dirty tracking framework that requires PCI
   devices to implement tracking HW internally. The iommufd version
   provides an alternative that the VMM can select, if available. The two
   are designed to have very similar APIs.

 - Userspace controlled attributes for hardware page
   tables (HWPT/iommu_domain). There are currently a few generic attributes
   for HWPTs (support dirty tracking, and parent of a nest). This is an
   entry point for the userspace iommu driver to control the HW in detail.

 - Nested translation support for HWPTs. This is a 2D translation scheme
   similar to the CPU where a DMA goes through a first stage to determine
   an intermediate address which is then translated trough a second stage
   to a physical address.

   Like for CPU translation the first stage table would exist in VM
   controlled memory and the second stage is in the kernel and matches the
   VM's guest to physical map.

   As every IOMMU has a unique set of parameter to describe the S1 IO page
   table and its associated parameters the userspace IOMMU driver has to
   marshal the information into the correct format.

   This is 1/3 of the feature, it allows creating the nested translation
   and binding it to VFIO devices, however the API to support IOTLB and
   ATC invalidation of the stage 1 io page table, and forwarding of IO
   faults are still in progress.

The series includes AMD and Intel support for dirty tracking. Intel
support for nested translation.

Along the way are a number of internal items:

 - New iommu core items: ops->domain_alloc_user(), ops->set_dirty_tracking,
   ops->read_and_clear_dirty(), IOMMU_DOMAIN_NESTED, and iommu_copy_struct_from_user

 - UAF fix in iopt_area_split()

 - Spelling fixes and some test suite improvement

----------------------------------------------------------------
GuokaiXu (1):
      iommufd: Fix spelling errors in comments

Jason Gunthorpe (4):
      iommufd: Rename IOMMUFD_OBJ_HW_PAGETABLE to IOMMUFD_OBJ_HWPT_PAGING
      iommufd/device: Wrap IOMMUFD_OBJ_HWPT_PAGING-only configurations
      iommufd: Add iopt_area_alloc()
      iommufd: Organize the mock domain alloc functions closer to Joerg's tree

Joao Martins (19):
      vfio/iova_bitmap: Export more API symbols
      vfio: Move iova_bitmap into iommufd
      iommufd/iova_bitmap: Move symbols to IOMMUFD namespace
      iommu: Add iommu_domain ops for dirty tracking
      iommufd: Add a flag to enforce dirty tracking on attach
      iommufd: Add IOMMU_HWPT_SET_DIRTY_TRACKING
      iommufd: Add IOMMU_HWPT_GET_DIRTY_BITMAP
      iommufd: Add capabilities to IOMMU_GET_HW_INFO
      iommufd: Add a flag to skip clearing of IOPTE dirty
      iommu/amd: Add domain_alloc_user based domain allocation
      iommu/amd: Access/Dirty bit support in IOPTEs
      iommu/vt-d: Access/Dirty bit support for SS domains
      iommufd/selftest: Expand mock_domain with dev_flags
      iommufd/selftest: Test IOMMU_HWPT_ALLOC_DIRTY_TRACKING
      iommufd/selftest: Test IOMMU_HWPT_SET_DIRTY_TRACKING
      iommufd/selftest: Test IOMMU_HWPT_GET_DIRTY_BITMAP
      iommufd/selftest: Test out_capabilities in IOMMU_GET_HW_INFO
      iommufd/selftest: Test IOMMU_HWPT_GET_DIRTY_BITMAP_NO_CLEAR flag
      iommufd/selftest: Fix page-size check in iommufd_test_dirty()

Koichiro Den (1):
      iommufd: Fix missing update of domains_itree after splitting iopt_area

Lu Baolu (6):
      iommu: Add IOMMU_DOMAIN_NESTED
      iommu/vt-d: Extend dmar_domain to support nested domain
      iommu/vt-d: Add helper for nested domain allocation
      iommu/vt-d: Add helper to setup pasid nested translation
      iommu/vt-d: Add nested domain allocation
      iommu/vt-d: Disallow read-only mappings to nest parent domain

Nicolin Chen (10):
      iommufd/selftest: Iterate idev_ids in mock_domain's alloc_hwpt test
      iommufd/selftest: Rework TEST_LENGTH to test min_size explicitly
      iommufd: Correct IOMMU_HWPT_ALLOC_NEST_PARENT description
      iommufd: Only enforce cache coherency in iommufd_hw_pagetable_alloc
      iommufd: Derive iommufd_hwpt_paging from iommufd_hw_pagetable
      iommufd: Share iommufd_hwpt_alloc with IOMMUFD_OBJ_HWPT_NESTED
      iommufd: Add a nested HW pagetable object
      iommu: Add iommu_copy_struct_from_user helper
      iommufd/selftest: Add nested domain allocation for mock domain
      iommufd/selftest: Add coverage for IOMMU_HWPT_ALLOC with nested HWPTs

Yi Liu (11):
      iommu: Add new iommu op to create domains owned by userspace
      iommufd: Use the domain_alloc_user() op for domain allocation
      iommufd: Flow user flags for domain allocation to domain_alloc_user()
      iommufd: Support allocating nested parent domain
      iommufd/selftest: Add domain_alloc_user() support in iommu mock
      iommu/vt-d: Add domain_alloc_user op
      iommu: Pass in parent domain with user_data to domain_alloc_user op
      iommu/vt-d: Enhance capability check for nested parent domain allocation
      iommufd: Add data structure for Intel VT-d stage-1 domain allocation
      iommu/vt-d: Make domain attach helpers to be extern
      iommu/vt-d: Set the nested domain to a device

 drivers/iommu/Kconfig                            |   4 +
 drivers/iommu/amd/Kconfig                        |   1 +
 drivers/iommu/amd/amd_iommu_types.h              |  12 +
 drivers/iommu/amd/io_pgtable.c                   |  68 ++++
 drivers/iommu/amd/iommu.c                        | 147 ++++++++-
 drivers/iommu/intel/Kconfig                      |   1 +
 drivers/iommu/intel/Makefile                     |   2 +-
 drivers/iommu/intel/iommu.c                      | 156 +++++++++-
 drivers/iommu/intel/iommu.h                      |  64 +++-
 drivers/iommu/intel/nested.c                     | 117 +++++++
 drivers/iommu/intel/pasid.c                      | 221 +++++++++++++
 drivers/iommu/intel/pasid.h                      |   6 +
 drivers/iommu/iommufd/Makefile                   |   1 +
 drivers/iommu/iommufd/device.c                   | 174 +++++++----
 drivers/iommu/iommufd/hw_pagetable.c             | 304 ++++++++++++++----
 drivers/iommu/iommufd/io_pagetable.c             | 200 +++++++++++-
 drivers/iommu/iommufd/iommufd_private.h          |  84 ++++-
 drivers/iommu/iommufd/iommufd_test.h             |  39 +++
 drivers/{vfio => iommu/iommufd}/iova_bitmap.c    |   5 +-
 drivers/iommu/iommufd/main.c                     |  17 +-
 drivers/iommu/iommufd/pages.c                    |   2 +
 drivers/iommu/iommufd/selftest.c                 | 328 ++++++++++++++++++--
 drivers/iommu/iommufd/vfio_compat.c              |   6 +-
 drivers/vfio/Makefile                            |   3 +-
 drivers/vfio/pci/mlx5/Kconfig                    |   1 +
 drivers/vfio/pci/mlx5/main.c                     |   1 +
 drivers/vfio/pci/pds/Kconfig                     |   1 +
 drivers/vfio/pci/pds/pci_drv.c                   |   1 +
 drivers/vfio/vfio_main.c                         |   1 +
 include/linux/io-pgtable.h                       |   4 +
 include/linux/iommu.h                            | 146 ++++++++-
 include/linux/iova_bitmap.h                      |  26 ++
 include/uapi/linux/iommufd.h                     | 180 ++++++++++-
 tools/testing/selftests/iommu/iommufd.c          | 379 ++++++++++++++++++++++-
 tools/testing/selftests/iommu/iommufd_fail_nth.c |   7 +-
 tools/testing/selftests/iommu/iommufd_utils.h    | 233 +++++++++++++-
 36 files changed, 2723 insertions(+), 219 deletions(-)


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [GIT PULL] Please pull IOMMUFD subsystem changes
  2023-10-31 13:14 Jason Gunthorpe
@ 2023-11-02  2:51 ` pr-tracker-bot
  0 siblings, 0 replies; 51+ messages in thread
From: pr-tracker-bot @ 2023-11-02  2:51 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: Linus Torvalds, iommu, kvm, linux-kernel, Kevin Tian

The pull request you sent on Tue, 31 Oct 2023 10:14:17 -0300:

> git://git.kernel.org/pub/scm/linux/kernel/git/jgg/iommufd.git tags/for-linus-iommufd

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/463f46e114f74465cf8d01b124e7b74ad1ce2afd

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html

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

* [GIT PULL] Please pull IOMMUFD subsystem changes
@ 2023-12-04 19:35 Jason Gunthorpe
  2023-12-04 21:59 ` pr-tracker-bot
  0 siblings, 1 reply; 51+ messages in thread
From: Jason Gunthorpe @ 2023-12-04 19:35 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: iommu, kvm, linux-kernel, Kevin Tian

[-- Attachment #1: Type: text/plain, Size: 1527 bytes --]

Hi Linus,

Two bug fixes for the rc cycle.

Thanks,
Jason

The following changes since commit 98b1cc82c4affc16f5598d4fa14b1858671b2263:

  Linux 6.7-rc2 (2023-11-19 15:02:14 -0800)

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 6f9c4d8c468c189d6dc470324bd52955f8aa0a10:

  iommufd: Do not UAF during iommufd_put_object() (2023-11-29 20:30:03 -0400)

----------------------------------------------------------------
iommufd 6.7 first rc pull request

A small fix for the dirty tracking self test to fail correctly if the code
is buggy.

Fix a tricky syzkaller race UAF with object reference counting.

----------------------------------------------------------------
Jason Gunthorpe (2):
      iommufd: Add iommufd_ctx to iommufd_put_object()
      iommufd: Do not UAF during iommufd_put_object()

Robin Murphy (1):
      iommufd/selftest: Fix _test_mock_dirty_bitmaps()

 drivers/iommu/iommufd/device.c                |  14 +--
 drivers/iommu/iommufd/hw_pagetable.c          |   8 +-
 drivers/iommu/iommufd/ioas.c                  |  14 +--
 drivers/iommu/iommufd/iommufd_private.h       |  70 +++++++++---
 drivers/iommu/iommufd/main.c                  | 146 ++++++++++++++------------
 drivers/iommu/iommufd/selftest.c              |  14 +--
 drivers/iommu/iommufd/vfio_compat.c           |  18 ++--
 tools/testing/selftests/iommu/iommufd_utils.h |  13 ++-
 8 files changed, 177 insertions(+), 120 deletions(-)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [GIT PULL] Please pull IOMMUFD subsystem changes
  2023-12-04 19:35 Jason Gunthorpe
@ 2023-12-04 21:59 ` pr-tracker-bot
  0 siblings, 0 replies; 51+ messages in thread
From: pr-tracker-bot @ 2023-12-04 21:59 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: Linus Torvalds, iommu, kvm, linux-kernel, Kevin Tian

The pull request you sent on Mon, 4 Dec 2023 15:35:34 -0400:

> git://git.kernel.org/pub/scm/linux/kernel/git/jgg/iommufd.git tags/for-linus-iommufd

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/bee0e7762ad2c6025b9f5245c040fcc36ef2bde8

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html

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

* [GIT PULL] Please pull IOMMUFD subsystem changes
@ 2024-01-12 17:49 Jason Gunthorpe
  2024-01-18 23:35 ` pr-tracker-bot
  0 siblings, 1 reply; 51+ messages in thread
From: Jason Gunthorpe @ 2024-01-12 17:49 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: iommu, kvm, linux-kernel, Kevin Tian

[-- Attachment #1: Type: text/plain, Size: 5174 bytes --]

Hi Linus,

There was a last minute doubt from Intel on their error handling
plan. They decided to remove it since it has uAPI meaning this was
delayed while they made that edit. The prior verions has been in
linux-next for a while now but the update has only had a day.

This PR includes the second part of the nested translation items for
iommufd, details in the tag.

For those following, these series are still progressing:

- User page table invalidation (non-Intel) has a roadmap:
 https://lore.kernel.org/linux-iommu/20231209014726.GA2945299@nvidia.com/

 There will be at least two more invalidation IOCTLs - IOMMU_DEVICE_INVALIDATE
 and IOMMU_VIOMMU_INVALIDATE in future.

- ARM SMMUv3 nested translation:
 https://github.com/jgunthorpe/linux/commits/smmuv3_newapi

- Draft AMD IOMMU nested translation:
 https://lore.kernel.org/linux-iommu/20240112000646.98001-1-suravee.suthikulpanit@amd.com

- ARM SMMUv3 Dirty tracking:
 https://lore.kernel.org/linux-iommu/20231128094940.1344-1-shameerali.kolothum.thodi@huawei.com/

- x86 KVM and IOMMU page table sharing (IOMMU_DOMAIN_KVM):
 https://lore.kernel.org/all/20231202091211.13376-1-yan.y.zhao@intel.com/

There is also a lot of ongoing work to consistently and generically enable
PASID and SVA support in all the IOMMU drivers:
 SMMUv3:
   https://lore.kernel.org/r/0-v3-d794f8d934da+411a-smmuv3_newapi_p1_jgg@nvidia.com
   https://lore.kernel.org/r/0-v3-9083a9368a5c+23fb-smmuv3_newapi_p2_jgg@nvidia.com
 AMD:
   https://lore.kernel.org/linux-iommu/20231212085224.6985-1-vasant.hegde@amd.com/
   https://lore.kernel.org/linux-iommu/20231221111558.64652-1-vasant.hegde@amd.com/
 Intel:
   https://lore.kernel.org/r/20231017032045.114868-1-tina.zhang@intel.com

RFC patches for PASID support in iommufd & vfio:
 https://lore.kernel.org/all/20231127063428.127436-1-yi.l.liu@intel.com/
 https://lore.kernel.org/all/20231127063909.129153-1-yi.l.liu@intel.com/

IO page faults and events delivered to userspace through iommufd:
 https://lore.kernel.org/all/20231220012332.168188-1-baolu.lu@linux.intel.com/
 https://lore.kernel.org/all/20231026024930.382898-1-baolu.lu@linux.intel.com/

RFC patches exploring support for the first Intel Scalable IO Virtualization
(SIOV r1) device are posted:
 https://lore.kernel.org/all/20231009085123.463179-1-yi.l.liu@intel.com/

A lot of the iommufd support has now been merged to qemu, though I think we
are still needing dirty tracking and nesting stuff.
 https://lore.kernel.org/all/20231121084426.1286987-1-zhenzhong.duan@intel.com/
 https://lore.kernel.org/all/20230622214845.3980-1-joao.m.martins@oracle.com/

A video of the iommufd session at LPC has been posted:
 https://youtu.be/IE_A8wSWV7g

Thanks,
Jason

The following changes since commit 861deac3b092f37b2c5e6871732f3e11486f7082:

  Linux 6.7-rc7 (2023-12-23 16:25:56 -0800)

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 47f2bd2ff382e5fe766b1322e354558a8da4a470:

  iommufd/selftest: Check the bus type during probe (2024-01-11 15:53:28 -0400)

----------------------------------------------------------------
iommufd for 6.8

This brings the first of three planned user IO page table invalidation
operations:

 - IOMMU_HWPT_INVALIDATE allows invalidating the IOTLB integrated into the
   iommu itself. The Intel implementation will also generate an ATC
   invalidation to flush the device IOTLB as it unambiguously knows the
   device, but other HW will not.

It goes along with the prior PR to implement userspace IO page tables (aka
nested translation for VMs) to allow Intel to have full functionality for
simple cases. An Intel implementation of the operation is provided.

Fix a small bug in the selftest mock iommu driver probe.

----------------------------------------------------------------
Jason Gunthorpe (1):
      iommufd/selftest: Check the bus type during probe

Lu Baolu (2):
      iommu: Add cache_invalidate_user op
      iommu/vt-d: Add iotlb flush for nested domain

Nicolin Chen (4):
      iommu: Add iommu_copy_struct_from_user_array helper
      iommufd/selftest: Add mock_domain_cache_invalidate_user support
      iommufd/selftest: Add IOMMU_TEST_OP_MD_CHECK_IOTLB test op
      iommufd/selftest: Add coverage for IOMMU_HWPT_INVALIDATE ioctl

Yi Liu (2):
      iommufd: Add IOMMU_HWPT_INVALIDATE
      iommufd: Add data structure for Intel VT-d stage-1 cache invalidation

 drivers/iommu/intel/nested.c                  |  88 +++++++++++++++
 drivers/iommu/iommufd/hw_pagetable.c          |  41 +++++++
 drivers/iommu/iommufd/iommufd_private.h       |  10 ++
 drivers/iommu/iommufd/iommufd_test.h          |  23 ++++
 drivers/iommu/iommufd/main.c                  |   3 +
 drivers/iommu/iommufd/selftest.c              | 104 +++++++++++++++---
 include/linux/iommu.h                         |  77 +++++++++++++
 include/uapi/linux/iommufd.h                  |  79 +++++++++++++
 tools/testing/selftests/iommu/iommufd.c       | 152 ++++++++++++++++++++++++++
 tools/testing/selftests/iommu/iommufd_utils.h |  55 ++++++++++
 10 files changed, 619 insertions(+), 13 deletions(-)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [GIT PULL] Please pull IOMMUFD subsystem changes
  2024-01-12 17:49 Jason Gunthorpe
@ 2024-01-18 23:35 ` pr-tracker-bot
  0 siblings, 0 replies; 51+ messages in thread
From: pr-tracker-bot @ 2024-01-18 23:35 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: Linus Torvalds, iommu, kvm, linux-kernel, Kevin Tian

The pull request you sent on Fri, 12 Jan 2024 13:49:28 -0400:

> git://git.kernel.org/pub/scm/linux/kernel/git/jgg/iommufd.git tags/for-linus-iommufd

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/86c4d58a99ab1ccfa03860d4dead157be51eb2b6

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html

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

* [GIT PULL] Please pull IOMMUFD subsystem changes
@ 2024-02-22 13:23 Jason Gunthorpe
  2024-02-22 20:03 ` pr-tracker-bot
  0 siblings, 1 reply; 51+ messages in thread
From: Jason Gunthorpe @ 2024-02-22 13:23 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: iommu, kvm, linux-kernel, Kevin Tian

[-- Attachment #1: Type: text/plain, Size: 2281 bytes --]

Hi Linus,

Some small fixes and updates for the selftest. I'm aware of some
syzkaller issues that hopefully will get fixes into another PR before
the merge window.

The following changes since commit 54be6c6c5ae8e0d93a6c4641cb7528eb0b6ba478:

  Linux 6.8-rc3 (2024-02-04 12:20:36 +0000)

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 510325e5ac5f45c1180189d3bfc108c54bf64544:

  selftests/iommu: fix the config fragment (2024-02-22 09:02:05 -0400)

----------------------------------------------------------------
iommufd for 6.8 rc

- Fix dirty tracking bitmap collection when using reporting bitmaps that
  are not neatly aligned to u64's or match the IO page table radix tree
  layout.

- Add self tests to cover the cases that were found to be broken.

- Add missing enforcement of invalidation type in the uapi.

- Fix selftest config generation

----------------------------------------------------------------
Jason Gunthorpe (1):
      iommufd: Reject non-zero data_type if no data_len is provided

Joao Martins (9):
      iommufd/iova_bitmap: Bounds check mapped::pages access
      iommufd/iova_bitmap: Switch iova_bitmap::bitmap to an u8 array
      iommufd/selftest: Test u64 unaligned bitmaps
      iommufd/iova_bitmap: Handle recording beyond the mapped pages
      iommufd/selftest: Refactor dirty bitmap tests
      iommufd/selftest: Refactor mock_domain_read_and_clear_dirty()
      iommufd/selftest: Hugepage mock domain support
      iommufd/selftest: Add mock IO hugepages tests
      iommufd/iova_bitmap: Consider page offset for the pages to be pinned

Muhammad Usama Anjum (1):
      selftests/iommu: fix the config fragment

 drivers/iommu/iommufd/hw_pagetable.c          |  3 +-
 drivers/iommu/iommufd/iommufd_test.h          |  1 +
 drivers/iommu/iommufd/iova_bitmap.c           | 68 +++++++++++++++++++----
 drivers/iommu/iommufd/selftest.c              | 79 ++++++++++++++++++++-------
 tools/testing/selftests/iommu/config          |  5 +-
 tools/testing/selftests/iommu/iommufd.c       | 78 +++++++++++++++++++++-----
 tools/testing/selftests/iommu/iommufd_utils.h | 39 ++++++++-----
 7 files changed, 210 insertions(+), 63 deletions(-)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [GIT PULL] Please pull IOMMUFD subsystem changes
  2024-02-22 13:23 Jason Gunthorpe
@ 2024-02-22 20:03 ` pr-tracker-bot
  0 siblings, 0 replies; 51+ messages in thread
From: pr-tracker-bot @ 2024-02-22 20:03 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: Linus Torvalds, iommu, kvm, linux-kernel, Kevin Tian

The pull request you sent on Thu, 22 Feb 2024 09:23:04 -0400:

> git://git.kernel.org/pub/scm/linux/kernel/git/jgg/iommufd.git tags/for-linus-iommufd

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/4c36fbb46f1326c8a11d81594a710098909eb9bf

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html

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

* [GIT PULL] Please pull IOMMUFD subsystem changes
@ 2024-03-02  0:08 Jason Gunthorpe
  2024-03-02  1:31 ` pr-tracker-bot
  0 siblings, 1 reply; 51+ messages in thread
From: Jason Gunthorpe @ 2024-03-02  0:08 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: iommu, kvm, linux-kernel, Kevin Tian

[-- Attachment #1: Type: text/plain, Size: 1397 bytes --]

Hi Linus,

The fixes for the new syzkaller bugs I mentioned before.

Thanks,
Jason

The following changes since commit d206a76d7d2726f3b096037f2079ce0bd3ba329b:

  Linux 6.8-rc6 (2024-02-25 15:46:06 -0800)

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 bb04d13353885f81c87879b2deb296bd2adb6cab:

  iommufd/selftest: Don't check map/unmap pairing with HUGE_PAGES (2024-02-26 16:59:12 -0400)

----------------------------------------------------------------
iommufd for 6.8 rc

Four syzkaller found bugs:

- Corruption during error unwind in iommufd_access_change_ioas()

- Overlapping IDs in the test suite due to out of order destruction

- Missing locking for access->ioas in the test suite

- False failures in the test suite validation logic with huge pages

----------------------------------------------------------------
Jason Gunthorpe (1):
      iommufd/selftest: Don't check map/unmap pairing with HUGE_PAGES

Nicolin Chen (3):
      iommufd: Fix iopt_access_list_id overwrite bug
      iommufd/selftest: Fix mock_dev_num bug
      iommufd: Fix protection fault in iommufd_test_syz_conv_iova

 drivers/iommu/iommufd/io_pagetable.c |  9 +++--
 drivers/iommu/iommufd/selftest.c     | 69 +++++++++++++++++++++++++-----------
 2 files changed, 54 insertions(+), 24 deletions(-)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [GIT PULL] Please pull IOMMUFD subsystem changes
  2024-03-02  0:08 Jason Gunthorpe
@ 2024-03-02  1:31 ` pr-tracker-bot
  0 siblings, 0 replies; 51+ messages in thread
From: pr-tracker-bot @ 2024-03-02  1:31 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: Linus Torvalds, iommu, kvm, linux-kernel, Kevin Tian

The pull request you sent on Fri, 1 Mar 2024 20:08:29 -0400:

> git://git.kernel.org/pub/scm/linux/kernel/git/jgg/iommufd.git tags/for-linus-iommufd

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/e613c90ddabcef5134ec4daa23b319ad7c99b94b

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html

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

* [GIT PULL] Please pull IOMMUFD subsystem changes
@ 2024-04-19 17:29 Jason Gunthorpe
  2024-04-19 21:07 ` pr-tracker-bot
  0 siblings, 1 reply; 51+ messages in thread
From: Jason Gunthorpe @ 2024-04-19 17:29 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: iommu, kvm, linux-kernel, Kevin Tian

[-- Attachment #1: Type: text/plain, Size: 1072 bytes --]

Hi Linus,

Minor selftest fixes.

The following changes since commit fec50db7033ea478773b159e0e2efb135270e3b7:

  Linux 6.9-rc3 (2024-04-07 13:22:46 -0700)

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 2760c51b8040d7cffedc337939e7475a17cc4b19:

  iommufd: Add config needed for iommufd_fail_nth (2024-04-14 13:52:08 -0300)

----------------------------------------------------------------
iommufd for 6.9 first rc

Two fixes for the selftests:

- CONFIG_IOMMUFD_TEST needs CONFIG_IOMMUFD_DRIVER to work

- The kconfig fragment sshould include fault injection so the fault
  injection test can work

----------------------------------------------------------------
Jason Gunthorpe (1):
      iommufd: Add missing IOMMUFD_DRIVER kconfig for the selftest

Muhammad Usama Anjum (1):
      iommufd: Add config needed for iommufd_fail_nth

 drivers/iommu/iommufd/Kconfig        | 1 +
 tools/testing/selftests/iommu/config | 2 ++
 2 files changed, 3 insertions(+)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [GIT PULL] Please pull IOMMUFD subsystem changes
  2024-04-19 17:29 Jason Gunthorpe
@ 2024-04-19 21:07 ` pr-tracker-bot
  0 siblings, 0 replies; 51+ messages in thread
From: pr-tracker-bot @ 2024-04-19 21:07 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: Linus Torvalds, iommu, kvm, linux-kernel, Kevin Tian

The pull request you sent on Fri, 19 Apr 2024 14:29:00 -0300:

> git://git.kernel.org/pub/scm/linux/kernel/git/jgg/iommufd.git tags/for-linus-iommufd

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/50a1317fd18acc2793edcb1d078909527c273a9e

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html

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

* [GIT PULL] Please pull IOMMUFD subsystem changes
@ 2024-07-17 18:46 Jason Gunthorpe
  2024-07-19 18:09 ` pr-tracker-bot
  0 siblings, 1 reply; 51+ messages in thread
From: Jason Gunthorpe @ 2024-07-17 18:46 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: iommu, kvm, linux-kernel, Kevin Tian

[-- Attachment #1: Type: text/plain, Size: 5688 bytes --]

Hi Linus,

This PR includes IO fault reporting for iommufd, along with some improvements
to the dirty bitmap reporting library. Details in the tag.

For those following, these series are still progressing:

- User page table invalidation (non-Intel) has a roadmap:
 https://lore.kernel.org/linux-iommu/20231209014726.GA2945299@nvidia.com/

 There will be at least two more invalidation IOCTLs - IOMMU_DEVICE_INVALIDATE
 and IOMMU_VIOMMU_INVALIDATE in future.

- ARM SMMUv3 nested translation:
 https://github.com/jgunthorpe/linux/commits/smmuv3_nesting

- Draft AMD IOMMU nested translation:
 https://lore.kernel.org/linux-iommu/20240112000646.98001-1-suravee.suthikulpanit@amd.com

- Draft vBTM support for SMMUv3:
 https://lore.kernel.org/linux-iommu/20240208151837.35068-1-shameerali.kolothum.thodi@huawei.com/

- Draft RISCV nesting support:
 https://lore.kernel.org/all/20240507142600.23844-1-zong.li@sifive.com/

- Grace command queue passthrough iommufd support:
 https://lore.kernel.org/all/cover.1712978212.git.nicolinc@nvidia.com/

RFC patches for PASID support in iommufd & vfio:
  https://lore.kernel.org/r/20240628090557.50898-1-yi.l.liu@intel.com
  https://lore.kernel.org/r/20240412082121.33382-1-yi.l.liu@intel.com/

RFC patches exploring support for the first Intel Scalable IO Virtualization
(SIOV r1) device are posted:
 https://lore.kernel.org/all/20231009085123.463179-1-yi.l.liu@intel.com/

A lot of the iommufd support has now been merged to qemu, with more
progressing.

Thanks,
Jason

The following changes since commit f2661062f16b2de5d7b6a5c42a9a5c96326b8454:

  Linux 6.10-rc5 (2024-06-23 17:08:54 -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 136a8066676e593cd29627219467fc222c8f3b04:

  iommufd: Put constants for all the uAPI enums (2024-07-15 09:44:54 -0300)

----------------------------------------------------------------
iommufd for 6.11 merge window

Major changes:

- The iova_bitmap logic for efficiently reporting dirty pages back to
  userspace has a few more tricky corner case bugs that have been resolved
  and backed with new tests. The revised version has simpler logic.

- Shared branch with iommu for handle support when doing domain
  attach. Handles allow the domain owner to include additional private data
  on a per-device basis.

- IO Page Fault Reporting to userspace via iommufd. Page faults can be
  generated on fault capable HWPTs when a translation is not present.
  Routing them to userspace would allow a VMM to be able to virtualize them
  into an emulated vIOMMU. This is the next step to fully enabling vSVA
  support.

----------------------------------------------------------------
Jason Gunthorpe (3):
      Merge branch 'iommufd_pri' into iommufd for-next
      iommufd: Require drivers to supply the cache_invalidate_user ops
      iommufd: Put constants for all the uAPI enums

Joao Martins (11):
      iommufd/selftest: Fix dirty bitmap tests with u8 bitmaps
      iommufd/selftest: Fix iommufd_test_dirty() to handle <u8 bitmaps
      iommufd/selftest: Add tests for <= u8 bitmap sizes
      iommufd/selftest: Fix tests to use MOCK_PAGE_SIZE based buffer sizes
      iommufd/selftest: Do not record head iova to better match iommu drivers
      iommufd/iova_bitmap: Check iova_bitmap_done() after set ahead
      iommufd/iova_bitmap: Cache mapped length in iova_bitmap_map struct
      iommufd/iova_bitmap: Move initial pinning to iova_bitmap_for_each()
      iommufd/iova_bitmap: Consolidate iova_bitmap_set exit conditionals
      iommufd/iova_bitmap: Dynamic pinning on iova_bitmap_set()
      iommufd/iova_bitmap: Remove iterator logic

Lu Baolu (13):
      iommu: Introduce domain attachment handle
      iommu: Remove sva handle list
      iommu: Add attach handle to struct iopf_group
      iommu: Extend domain attach group with handle support
      iommufd: Add fault and response message definitions
      iommufd: Add iommufd fault object
      iommufd: Fault-capable hwpt attach/detach/replace
      iommufd: Associate fault object with iommufd_hw_pgtable
      iommufd/selftest: Add IOPF support for mock device
      iommufd/selftest: Add coverage for IOPF test
      iommufd: Remove IOMMUFD_PAGE_RESP_FAILURE
      iommufd: Add check on user response code
      iommufd: Fix error pointer checking

 drivers/dma/idxd/init.c                          |   2 +-
 drivers/iommu/io-pgfault.c                       |  63 ++--
 drivers/iommu/iommu-priv.h                       |  11 +
 drivers/iommu/iommu-sva.c                        |  42 ++-
 drivers/iommu/iommu.c                            | 185 +++++++---
 drivers/iommu/iommufd/Makefile                   |   1 +
 drivers/iommu/iommufd/device.c                   |   7 +-
 drivers/iommu/iommufd/fault.c                    | 443 +++++++++++++++++++++++
 drivers/iommu/iommufd/hw_pagetable.c             |  41 ++-
 drivers/iommu/iommufd/iommufd_private.h          |  80 ++++
 drivers/iommu/iommufd/iommufd_test.h             |   8 +
 drivers/iommu/iommufd/iova_bitmap.c              | 124 +++----
 drivers/iommu/iommufd/main.c                     |   6 +
 drivers/iommu/iommufd/selftest.c                 |  70 +++-
 include/linux/iommu.h                            |  41 ++-
 include/uapi/linux/iommufd.h                     | 141 +++++++-
 tools/testing/selftests/iommu/iommufd.c          |  86 +++--
 tools/testing/selftests/iommu/iommufd_fail_nth.c |   2 +-
 tools/testing/selftests/iommu/iommufd_utils.h    |  92 ++++-
 19 files changed, 1206 insertions(+), 239 deletions(-)
 create mode 100644 drivers/iommu/iommufd/fault.c

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [GIT PULL] Please pull IOMMUFD subsystem changes
  2024-07-17 18:46 Jason Gunthorpe
@ 2024-07-19 18:09 ` pr-tracker-bot
  0 siblings, 0 replies; 51+ messages in thread
From: pr-tracker-bot @ 2024-07-19 18:09 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: Linus Torvalds, iommu, kvm, linux-kernel, Kevin Tian

The pull request you sent on Wed, 17 Jul 2024 15:46:03 -0300:

> git://git.kernel.org/pub/scm/linux/kernel/git/jgg/iommufd.git tags/for-linus-iommufd

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/ef7c8f2b1fb46d3fc7a46d64bb73919e288ba547

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html

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

* [GIT PULL] Please pull IOMMUFD subsystem changes
@ 2024-08-20 22:48 Jason Gunthorpe
  2024-08-20 23:52 ` pr-tracker-bot
  0 siblings, 1 reply; 51+ messages in thread
From: Jason Gunthorpe @ 2024-08-20 22:48 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: iommu, kvm, linux-kernel, Kevin Tian

[-- Attachment #1: Type: text/plain, Size: 1011 bytes --]

Hi Linus,

Two small RC fixes, thanks

Jason

The following changes since commit 8400291e289ee6b2bf9779ff1c83a291501f017b:

  Linux 6.11-rc1 (2024-07-28 14:19:55 -0700)

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 cf1e515c9a40caa8bddb920970d3257bb01c1421:

  iommufd/selftest: Make dirty_ops static (2024-08-19 09:26:41 -0300)

----------------------------------------------------------------
iommufd 6.11 rc first pull

Two small fixes:

- Incorrect error unwind in iommufd_device_do_replace()

- Correct a sparse warning missing static

----------------------------------------------------------------
Jinjie Ruan (1):
      iommufd/selftest: Make dirty_ops static

Nicolin Chen (1):
      iommufd/device: Fix hwpt at err_unresv in iommufd_device_do_replace()

 drivers/iommu/iommufd/device.c   | 2 +-
 drivers/iommu/iommufd/selftest.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [GIT PULL] Please pull IOMMUFD subsystem changes
  2024-08-20 22:48 Jason Gunthorpe
@ 2024-08-20 23:52 ` pr-tracker-bot
  0 siblings, 0 replies; 51+ messages in thread
From: pr-tracker-bot @ 2024-08-20 23:52 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: Linus Torvalds, iommu, kvm, linux-kernel, Kevin Tian

The pull request you sent on Tue, 20 Aug 2024 19:48:37 -0300:

> git://git.kernel.org/pub/scm/linux/kernel/git/jgg/iommufd.git tags/for-linus-iommufd

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/0108b7be2a18d85face1e10c68ecc0138f1bed58

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html

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

* [GIT PULL] Please pull IOMMUFD subsystem changes
@ 2024-09-23 17:45 Jason Gunthorpe
  2024-09-24 19:36 ` pr-tracker-bot
  0 siblings, 1 reply; 51+ messages in thread
From: Jason Gunthorpe @ 2024-09-23 17:45 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: iommu, kvm, linux-kernel, Kevin Tian

[-- Attachment #1: Type: text/plain, Size: 3010 bytes --]

Hi Linus,

Nothing big this time, I was hoping viommu would make it, but not yet.

There is a small merge conflict "take mine" to resolve, the mm tree
added a debugfs.h include to a file that mine already has.

The tag for-linus-iommufd-merged with my merge resolution to your tree
is also available to pull.

Thanks,
Jason

The following changes since commit 5be63fc19fcaa4c236b307420483578a56986a37:

  Linux 6.11-rc5 (2024-08-25 19:07:11 +1200)

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 79805c1bbbf9846fe91c16933d64614cbbff1dee:

  iommu: Set iommu_attach_handle->domain in core (2024-09-11 20:14:07 -0300)

----------------------------------------------------------------
iommufd 6.12 merge window pull

Collection of small cleanup and one fix:

- Sort headers and struct forward declarations

- Fix random selftest failures in some cases due to dirty tracking tests

- Have the reserved IOVA regions mechanism work when a HWPT is used as a
  nesting parent. This updates the nesting parent's IOAS with the reserved
  regions of the device and will also install the ITS doorbell page on
  ARM.

- Add missed validation of parent domain ops against the current iommu

- Fix a syzkaller bug related to integer overflow during ALIGN()

- Tidy two iommu_domain attach paths

----------------------------------------------------------------
Jason Gunthorpe (4):
      iommufd/selftest: Fix buffer read overrrun in the dirty test
      Merge branch 'nesting_reserved_regions' into iommufd.git for-next
      iommufd: Check the domain owner of the parent before creating a nesting domain
      iommufd: Protect against overflow of ALIGN() during iova allocation

Nicolin Chen (3):
      iommufd: Reorder include files
      iommufd/device: Enforce reserved IOVA also when attached to hwpt_nested
      iommufd: Reorder struct forward declarations

Yi Liu (2):
      iommufd: Avoid duplicated __iommu_group_set_core_domain() call
      iommu: Set iommu_attach_handle->domain in core

 drivers/iommu/iommu.c                   |  1 +
 drivers/iommu/iommufd/device.c          | 56 ++++++++++++++++-----------------
 drivers/iommu/iommufd/fault.c           |  5 ++-
 drivers/iommu/iommufd/hw_pagetable.c    |  3 +-
 drivers/iommu/iommufd/io_pagetable.c    | 16 +++++++---
 drivers/iommu/iommufd/io_pagetable.h    |  2 +-
 drivers/iommu/iommufd/ioas.c            |  2 +-
 drivers/iommu/iommufd/iommufd_private.h | 32 ++++++++++++++++---
 drivers/iommu/iommufd/iommufd_test.h    |  2 +-
 drivers/iommu/iommufd/iova_bitmap.c     |  2 +-
 drivers/iommu/iommufd/main.c            |  8 ++---
 drivers/iommu/iommufd/pages.c           | 10 +++---
 drivers/iommu/iommufd/selftest.c        | 19 ++++++-----
 include/linux/iommufd.h                 | 12 +++----
 include/uapi/linux/iommufd.h            |  2 +-
 15 files changed, 101 insertions(+), 71 deletions(-)
(diffstat from tag for-linus-iommufd-merged)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [GIT PULL] Please pull IOMMUFD subsystem changes
  2024-09-23 17:45 Jason Gunthorpe
@ 2024-09-24 19:36 ` pr-tracker-bot
  0 siblings, 0 replies; 51+ messages in thread
From: pr-tracker-bot @ 2024-09-24 19:36 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: Linus Torvalds, iommu, kvm, linux-kernel, Kevin Tian

The pull request you sent on Mon, 23 Sep 2024 14:45:35 -0300:

> git://git.kernel.org/pub/scm/linux/kernel/git/jgg/iommufd.git tags/for-linus-iommufd

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/db78436bed06708a8cadb61c60881d568fb4ae27

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html

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

* [GIT PULL] Please pull IOMMUFD subsystem changes
@ 2024-11-20 14:53 Jason Gunthorpe
  2024-11-21 21:20 ` pr-tracker-bot
  0 siblings, 1 reply; 51+ messages in thread
From: Jason Gunthorpe @ 2024-11-20 14:53 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: iommu, kvm, linux-kernel, Kevin Tian

[-- Attachment #1: Type: text/plain, Size: 9658 bytes --]

Hi Linus,

This is a bigger PR that principally includes ARM SMMUv3 support for
nested translation. There are still additional series needed to solve
problems with IRQs, but this is the iommufd side of the work.

For those following, these series are still progressing:

- Draft AMD IOMMU nested translation:
 https://lore.kernel.org/linux-iommu/20240112000646.98001-1-suravee.suthikulpanit@amd.com
 (and many other AMD patches to prepare for this)

- Draft vBTM support for SMMUv3:
 https://lore.kernel.org/linux-iommu/20240208151837.35068-1-shameerali.kolothum.thodi@huawei.com/

- Draft RISCV nesting support:
 https://lore.kernel.org/all/20240507142600.23844-1-zong.li@sifive.com/

- Grace command queue passthrough iommufd support:
 https://lore.kernel.org/all/cover.1712978212.git.nicolinc@nvidia.com/

Patches for PASID support in iommufd & vfio:
 https://lore.kernel.org/r/20241104132513.15890-1-yi.l.liu@intel.com
 https://lore.kernel.org/r/20241108121742.18889-1-yi.l.liu@intel.com
 (Several precursor series were merged this cycle so I hope this
  to go next cycle)

A lot of the iommufd support has now been merged to qemu, with more
progressing.

This has a shared branch Will created for some of the SMMUv3 code.

I have two patches renaming a function that I would like to get merged
in this window as well to simplify next cycle. They need both iommufd
and iommu trees to be merged together so I think there will be another
tiny pull request.

Thanks,
Jason

The following changes since commit 8e929cb546ee42c9a61d24fae60605e9e3192354:

  Linux 6.12-rc3 (2024-10-13 14:33:32 -0700)

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 6d026e6d48cd2a95407c8fdd8d6187b871401c23:

  iommu/arm-smmu-v3: Import IOMMUFD module namespace (2024-11-14 21:07:15 -0400)

----------------------------------------------------------------
iommufd 6.13 merge window pull

Several new features and uAPI for iommufd:

- IOMMU_IOAS_MAP_FILE allows passing in a file descriptor as the backing
  memory for an iommu mapping. To date VFIO/iommufd have used VMA's and
  pin_user_pages(), this now allows using memfds and memfd_pin_folios().
  Notably this creates a pure folio path from the memfd to the iommu page
  table where memory is never broken down to PAGE_SIZE.

- IOMMU_IOAS_CHANGE_PROCESS moves the pinned page accounting between two
  processes. Combined with the above this allows iommufd to support a VMM
  re-start using exec() where something like qemu would exec() a new
  version of itself and fd pass the memfds/iommufd/etc to the new
  process. The memfd allows DMA access to the memory to continue while
  the new process is getting setup, and the CHANGE_PROCESS updates all
  the accounting.

- Support for fault reporting to userspace on non-PRI HW, such as ARM
  stall-mode embedded devices.

- IOMMU_VIOMMU_ALLOC introduces the concept of a HW/driver backed virtual
  iommu. This will be used by VMMs to access hardware features that are
  contained with in a VM. The first use is to inform the kernel of the
  virtual SID to physical SID mapping when issuing SID based invalidation
  on ARM. Further uses will tie HW features that are directly accessed by
  the VM, such as invalidation queue assignment and others.

- IOMMU_VDEVICE_ALLOC informs the kernel about the mapping of virtual
  device to physical device within a VIOMMU. Minimially this is used to
  translate VM issued cache invalidation commands from virtual to physical
  device IDs.

- Enhancements to IOMMU_HWPT_INVALIDATE and IOMMU_HWPT_ALLOC to work with
  the VIOMMU

- ARM SMMuv3 support for nested translation. Using the VIOMMU and VDEVICE
  the driver can model this HW's behavior for nested translation. This
  includes a shared branch from Will.

----------------------------------------------------------------
Jason Gunthorpe (9):
      vfio: Remove VFIO_TYPE1_NESTING_IOMMU
      iommu/arm-smmu-v3: Report IOMMU_CAP_ENFORCE_CACHE_COHERENCY for CANWBS
      iommu/arm-smmu-v3: Implement IOMMU_HWPT_ALLOC_NEST_PARENT
      iommu/arm-smmu-v3: Expose the arm_smmu_attach interface
      iommu: Add iommu_copy_struct_from_full_user_array helper
      Merge branch 'iommufd/arm-smmuv3-nested' of iommu/linux into iommufd for-next
      iommu/arm-smmu-v3: Support IOMMU_DOMAIN_NESTED
      iommu/arm-smmu-v3: Use S2FWB for NESTED domains
      iommu/arm-smmu-v3: Allow ATS for IOMMU_DOMAIN_NESTED

Nathan Chancellor (1):
      iommu/arm-smmu-v3: Import IOMMUFD module namespace

Nicolin Chen (28):
      Documentation: userspace-api: iommufd: Update HWPT_PAGING and HWPT_NESTED
      ACPICA: IORT: Update for revision E.f
      ACPI/IORT: Support CANWBS memory access flag
      iommu/arm-smmu-v3: Support IOMMU_GET_HW_INFO via struct arm_smmu_hw_info
      iommufd: Move struct iommufd_object to public iommufd header
      iommufd: Move _iommufd_object_alloc helper to a sharable file
      iommufd: Introduce IOMMUFD_OBJ_VIOMMU and its related struct
      iommufd: Verify object in iommufd_object_finalize/abort()
      iommufd/viommu: Add IOMMU_VIOMMU_ALLOC ioctl
      iommufd: Add alloc_domain_nested op to iommufd_viommu_ops
      iommufd: Allow pt_id to carry viommu_id for IOMMU_HWPT_ALLOC
      iommufd/selftest: Add container_of helpers
      iommufd/selftest: Prepare for mock_viommu_alloc_domain_nested()
      iommufd/selftest: Add refcount to mock_iommu_device
      iommufd/selftest: Add IOMMU_VIOMMU_TYPE_SELFTEST
      iommufd/selftest: Add IOMMU_VIOMMU_ALLOC test coverage
      Documentation: userspace-api: iommufd: Update vIOMMU
      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_id to carry viommu_id for IOMMU_HWPT_INVALIDATE
      iommufd/viommu: Add iommufd_viommu_find_dev helper
      iommufd/selftest: Add mock_viommu_cache_invalidate
      iommufd/selftest: Add IOMMU_TEST_OP_DEV_CHECK_CACHE test command
      iommufd/selftest: Add vIOMMU coverage for IOMMU_HWPT_INVALIDATE ioctl
      Documentation: userspace-api: iommufd: Update vDEVICE
      iommu/arm-smmu-v3: Support IOMMU_VIOMMU_ALLOC
      iommu/arm-smmu-v3: Support IOMMU_HWPT_INVALIDATE using a VIOMMU object

Steve Sistare (13):
      mm/gup: Add folio_add_pins()
      iommufd: Rename uptr in iopt_alloc_iova()
      iommufd: Generalize iopt_pages address
      iommufd: pfn_reader local variables
      iommufd: Folio subroutines
      iommufd: pfn_reader for file mappings
      iommufd: Add IOMMU_IOAS_MAP_FILE
      iommufd: File mappings for mdev
      iommufd: Selftest coverage for IOMMU_IOAS_MAP_FILE
      iommufd: Export do_update_pinned
      iommufd: Lock all IOAS objects
      iommufd: Add IOMMU_IOAS_CHANGE_PROCESS
      iommufd: IOMMU_IOAS_CHANGE_PROCESS selftest

Zhangfei Gao (1):
      iommufd: Allow fault reporting for non-PRI PCI devices

 Documentation/userspace-api/iommufd.rst            | 226 ++++++--
 drivers/acpi/arm64/iort.c                          |  13 +
 drivers/iommu/Kconfig                              |   9 +
 drivers/iommu/arm/arm-smmu-v3/Makefile             |   1 +
 .../iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c    | 401 ++++++++++++++
 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c        | 139 +++--
 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h        |  92 +++-
 drivers/iommu/arm/arm-smmu/arm-smmu.c              |  16 -
 drivers/iommu/io-pgtable-arm.c                     |  27 +-
 drivers/iommu/iommu.c                              |  10 -
 drivers/iommu/iommufd/Kconfig                      |   4 +
 drivers/iommu/iommufd/Makefile                     |   6 +-
 drivers/iommu/iommufd/driver.c                     |  53 ++
 drivers/iommu/iommufd/fault.c                      |   9 +-
 drivers/iommu/iommufd/hw_pagetable.c               | 113 +++-
 drivers/iommu/iommufd/io_pagetable.c               | 105 +++-
 drivers/iommu/iommufd/io_pagetable.h               |  26 +-
 drivers/iommu/iommufd/ioas.c                       | 259 +++++++++
 drivers/iommu/iommufd/iommufd_private.h            |  58 +-
 drivers/iommu/iommufd/iommufd_test.h               |  32 ++
 drivers/iommu/iommufd/main.c                       |  65 +--
 drivers/iommu/iommufd/pages.c                      | 319 ++++++++---
 drivers/iommu/iommufd/selftest.c                   | 364 ++++++++++---
 drivers/iommu/iommufd/vfio_compat.c                |   7 +-
 drivers/iommu/iommufd/viommu.c                     | 157 ++++++
 drivers/vfio/vfio_iommu_type1.c                    |  12 +-
 include/acpi/actbl2.h                              |   3 +-
 include/linux/io-pgtable.h                         |   2 +
 include/linux/iommu.h                              |  67 ++-
 include/linux/iommufd.h                            | 108 ++++
 include/linux/mm.h                                 |   1 +
 include/uapi/linux/iommufd.h                       | 216 +++++++-
 include/uapi/linux/vfio.h                          |   2 +-
 mm/gup.c                                           |  24 +
 tools/testing/selftests/iommu/Makefile             |   1 +
 tools/testing/selftests/iommu/iommufd.c            | 606 ++++++++++++++++++++-
 tools/testing/selftests/iommu/iommufd_fail_nth.c   |  54 ++
 tools/testing/selftests/iommu/iommufd_utils.h      | 174 ++++++
 38 files changed, 3354 insertions(+), 427 deletions(-)
 create mode 100644 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c
 create mode 100644 drivers/iommu/iommufd/driver.c
 create mode 100644 drivers/iommu/iommufd/viommu.c

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [GIT PULL] Please pull IOMMUFD subsystem changes
  2024-11-20 14:53 Jason Gunthorpe
@ 2024-11-21 21:20 ` pr-tracker-bot
  0 siblings, 0 replies; 51+ messages in thread
From: pr-tracker-bot @ 2024-11-21 21:20 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: Linus Torvalds, iommu, kvm, linux-kernel, Kevin Tian

The pull request you sent on Wed, 20 Nov 2024 10:53:45 -0400:

> git://git.kernel.org/pub/scm/linux/kernel/git/jgg/iommufd.git tags/for-linus-iommufd

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/341d041daae52cd5f014f68c1c7d9039db818fca

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html

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

* [GIT PULL] Please pull IOMMUFD subsystem changes
@ 2024-12-05 18:44 Jason Gunthorpe
  2024-12-05 23:08 ` pr-tracker-bot
  0 siblings, 1 reply; 51+ messages in thread
From: Jason Gunthorpe @ 2024-12-05 18:44 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: iommu, kvm, linux-kernel, Kevin Tian

[-- Attachment #1: Type: text/plain, Size: 1414 bytes --]

Hi Linus,

One bug fix and some documentation updates

Thanks,
Jason

The following changes since commit 40384c840ea1944d7c5a392e8975ed088ecf0b37:

  Linux 6.13-rc1 (2024-12-01 14:28:56 -0800)

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 2ca704f55e22b7b00cc7025953091af3c82fa5c0:

  iommu/arm-smmu-v3: Improve uAPI comment for IOMMU_HW_INFO_TYPE_ARM_SMMUV3 (2024-12-03 13:30:31 -0400)

----------------------------------------------------------------
iommufd 6.13 first rc pull

- Correct typos in comments

- Elaborate a comment about how the uAPI works for
  IOMMU_HW_INFO_TYPE_ARM_SMMUV3

- Fix a double free on error path and add test coverage for the bug

----------------------------------------------------------------
Jason Gunthorpe (1):
      iommu/arm-smmu-v3: Improve uAPI comment for IOMMU_HW_INFO_TYPE_ARM_SMMUV3

Nicolin Chen (2):
      iommufd: Fix out_fput in iommufd_fault_alloc()
      iommufd/selftest: Cover IOMMU_FAULT_QUEUE_ALLOC in iommufd_fail_nth

Randy Dunlap (1):
      iommufd: Fix typos in kernel-doc comments

 drivers/iommu/iommufd/fault.c                    |  2 --
 include/uapi/linux/iommufd.h                     | 31 +++++++++++++++---------
 tools/testing/selftests/iommu/iommufd_fail_nth.c | 14 +++++++++++
 3 files changed, 34 insertions(+), 13 deletions(-)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [GIT PULL] Please pull IOMMUFD subsystem changes
  2024-12-05 18:44 Jason Gunthorpe
@ 2024-12-05 23:08 ` pr-tracker-bot
  0 siblings, 0 replies; 51+ messages in thread
From: pr-tracker-bot @ 2024-12-05 23:08 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: Linus Torvalds, iommu, kvm, linux-kernel, Kevin Tian

The pull request you sent on Thu, 5 Dec 2024 14:44:30 -0400:

> git://git.kernel.org/pub/scm/linux/kernel/git/jgg/iommufd.git tags/for-linus-iommufd

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/6a103867b95ac7f9cc7dffe2fcad2f6c0d60b9ae

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html

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

* [GIT PULL] Please pull IOMMUFD subsystem changes
@ 2025-01-23 16:59 Jason Gunthorpe
  2025-01-24 21:45 ` pr-tracker-bot
  0 siblings, 1 reply; 51+ messages in thread
From: Jason Gunthorpe @ 2025-01-23 16:59 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: iommu, kvm, linux-kernel, Kevin Tian

[-- Attachment #1: Type: text/plain, Size: 2634 bytes --]

Hi Linus,

Small pull request this cycle, there are several larger series near
completion on the list that will hopefully go next round.

Thanks,
Jason

The following changes since commit fac04efc5c793dccbd07e2d59af9f90b7fc0dca4:

  Linux 6.13-rc2 (2024-12-08 14:03:39 -0800)

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 e721f619e3ec9bae08bf419c3944cf1e6966c821:

  iommufd: Fix struct iommu_hwpt_pgfault init and padding (2025-01-21 13:55:49 -0400)

----------------------------------------------------------------
iommufd 6.14 merge window pull

No major functionality this cycle:

- iommufd part of the domain_alloc_paging_flags() conversion

- Move IOMMU_HWPT_FAULT_ID_VALID processing out of drivers

- Increase a timeout waiting for other threads to drop transient refcounts
  that syzkaller was hitting

- Fix a UBSAN hit in iova_bitmap due to shift out of bounds

- Add missing cleanup of fault events during FD shutdown, fixing a memory leak

- Improve the fault delivery flow to have a smaller locking critical
  region that does not include copy_to_user()

- Fix 32 bit ABI breakage due to missed implicit padding, and fix the
  stack memory leakage

----------------------------------------------------------------
Jason Gunthorpe (1):
      iommufd/selftest: Remove domain_alloc_paging()

Nicolin Chen (4):
      iommufd: Keep OBJ/IOCTL lists in an alphabetical order
      iommufd/fault: Destroy response and mutex in iommufd_fault_destroy()
      iommufd/fault: Use a separate spinlock to protect fault->deliver list
      iommufd: Fix struct iommu_hwpt_pgfault init and padding

Qasim Ijaz (1):
      iommufd/iova_bitmap: Fix shift-out-of-bounds in iova_bitmap_offset_to_index()

Suraj Sonawane (1):
      iommu: iommufd: fix WARNING in iommufd_device_unbind

Yi Liu (1):
      iommufd: Deal with IOMMU_HWPT_FAULT_ID_VALID in iommufd core

 .../iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c    |  8 +---
 drivers/iommu/intel/iommu.c                        |  3 +-
 drivers/iommu/iommufd/fault.c                      | 44 ++++++++++++++-------
 drivers/iommu/iommufd/hw_pagetable.c               | 10 +++--
 drivers/iommu/iommufd/iommufd_private.h            | 29 +++++++++++++-
 drivers/iommu/iommufd/iova_bitmap.c                |  2 +-
 drivers/iommu/iommufd/main.c                       | 32 ++++++++-------
 drivers/iommu/iommufd/selftest.c                   | 45 ++++++++--------------
 include/uapi/linux/iommufd.h                       |  4 +-
 9 files changed, 103 insertions(+), 74 deletions(-)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [GIT PULL] Please pull IOMMUFD subsystem changes
  2025-01-23 16:59 Jason Gunthorpe
@ 2025-01-24 21:45 ` pr-tracker-bot
  0 siblings, 0 replies; 51+ messages in thread
From: pr-tracker-bot @ 2025-01-24 21:45 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: Linus Torvalds, iommu, kvm, linux-kernel, Kevin Tian

The pull request you sent on Thu, 23 Jan 2025 12:59:23 -0400:

> git://git.kernel.org/pub/scm/linux/kernel/git/jgg/iommufd.git tags/for-linus-iommufd

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/aa44198a6cf599837350aa954b5153b75feaed2d

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html

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

* [GIT PULL] Please pull IOMMUFD subsystem changes
@ 2025-03-31 16:12 Jason Gunthorpe
  2025-04-02  1:50 ` pr-tracker-bot
  0 siblings, 1 reply; 51+ messages in thread
From: Jason Gunthorpe @ 2025-03-31 16:12 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: iommu, kvm, linux-kernel, Kevin Tian

[-- 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 --]

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

* Re: [GIT PULL] Please pull IOMMUFD subsystem changes
  2025-03-31 16:12 Jason Gunthorpe
@ 2025-04-02  1:50 ` pr-tracker-bot
  0 siblings, 0 replies; 51+ messages in thread
From: pr-tracker-bot @ 2025-04-02  1:50 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: Linus Torvalds, iommu, kvm, linux-kernel, Kevin Tian

The pull request you sent on Mon, 31 Mar 2025 13:12:27 -0300:

> git://git.kernel.org/pub/scm/linux/kernel/git/jgg/iommufd.git tags/for-linus-iommufd

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/48552153cf49e252071f28e45d770b3741040e4e

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html

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

* [GIT PULL] Please pull IOMMUFD subsystem changes
@ 2025-07-02 14:14 Jason Gunthorpe
  2025-07-02 17:06 ` pr-tracker-bot
  0 siblings, 1 reply; 51+ messages in thread
From: Jason Gunthorpe @ 2025-07-02 14:14 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: iommu, kvm, linux-kernel, Kevin Tian

[-- Attachment #1: Type: text/plain, Size: 1562 bytes --]

Hi Linus,

Some small iommufd selftest changes to make it work again in 6.16-rc.

Thanks,
Jason

The following changes since commit 86731a2a651e58953fc949573895f2fa6d456841:

  Linux 6.16-rc3 (2025-06-22 13:30:08 -0700)

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 9a96876e3c6578031fa5dc5dde7759d383b2fb75:

  iommufd/selftest: Fix build warnings due to uninitialized mfd (2025-06-24 15:45:13 -0300)

----------------------------------------------------------------
iommufd 6.16 first rc pull

Some changes to the userspace selftest framework cause the iommufd tests
to start failing. This turned out to be bugs in the iommufd side that were
just getting uncovered.

- Deal with MAP_HUGETLB mmaping more than requested even when in MAP_FIXED
  mode

- Fixup missing error flow cleanup in the test

- Check that the memory allocations suceeded

- Suppress some bogus gcc 'may be used uninitialized' warnings

----------------------------------------------------------------
Nicolin Chen (4):
      iommufd/selftest: Fix iommufd_dirty_tracking with large hugepage sizes
      iommufd/selftest: Add missing close(mfd) in memfd_mmap()
      iommufd/selftest: Add asserts testing global mfd
      iommufd/selftest: Fix build warnings due to uninitialized mfd

 tools/testing/selftests/iommu/iommufd.c       | 40 +++++++++++++++++++--------
 tools/testing/selftests/iommu/iommufd_utils.h |  9 ++++--
 2 files changed, 36 insertions(+), 13 deletions(-)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [GIT PULL] Please pull IOMMUFD subsystem changes
  2025-07-02 14:14 Jason Gunthorpe
@ 2025-07-02 17:06 ` pr-tracker-bot
  0 siblings, 0 replies; 51+ messages in thread
From: pr-tracker-bot @ 2025-07-02 17:06 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: Linus Torvalds, iommu, kvm, linux-kernel, Kevin Tian

The pull request you sent on Wed, 2 Jul 2025 11:14:53 -0300:

> git://git.kernel.org/pub/scm/linux/kernel/git/jgg/iommufd.git tags/for-linus-iommufd

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/3c894cb29bbf4e36c5f2497cf8ea6fb09e157920

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html

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

* [GIT PULL] Please pull IOMMUFD subsystem changes
@ 2025-07-30 18:47 Jason Gunthorpe
  2025-07-31 20:01 ` pr-tracker-bot
  0 siblings, 1 reply; 51+ messages in thread
From: Jason Gunthorpe @ 2025-07-30 18:47 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: iommu, kvm, linux-kernel, Kevin Tian

[-- Attachment #1: Type: text/plain, Size: 7631 bytes --]

Hi Linus,

This PR broadly brings the assigned HW command queue support to
iommufd. This feature is used to improve SVA performance in VMs by
avoiding paravirtualization traps during SVA invalidations.

Along the way I think some of the core logic is in a much better state
to support future driver backed features.

Thanks,
Jason

The following changes since commit 19272b37aa4f83ca52bdf9c16d5d81bdd1354494:

  Linux 6.16-rc1 (2025-06-08 13:44:43 -0700)

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 2c78e74493d33b002312296fbab1d688bfd0f76f:

  iommu/arm-smmu-v3: Replace vsmmu_size/type with get_viommu_size (2025-07-28 12:07:50 -0300)

----------------------------------------------------------------
iommufd 6.17 merge window pull

- IOMMU HW now has features to directly assign HW command queues to a
  guest VM. In this mode the command queue operates on a limited set of
  invalidation commands that are suitable for improving guest invalidation
  performance and easy for the HW to virtualize.

  This PR brings the generic infrastructure to allow IOMMU drivers to
  expose such command queues through the iommufd uAPI, mmap the doorbell
  pages, and get the guest physical range for the command queue ring
  itself.

- An implementation for the NVIDIA SMMUv3 extension "cmdqv" is built on
  the new iommufd command queue features. It works with the existing SMMU
  driver support for cmdqv in guest VMs.

- Many precursor cleanups and improvements to support the above cleanly,
  changes to the general ioctl and object helpers, driver support for
  VDEVICE, and mmap pgoff cookie infrastructure.

- Sequence VDEVICE destruction to always happen before VFIO device
  destruction. When using the above type features, and also in future
  confidential compute, the internal virtual device representation becomes
  linked to HW or CC TSM configuration and objects. If a VFIO device is
  removed from iommufd those HW objects should also be cleaned up to
  prevent a sort of UAF. This became important now that we have HW backing
  the VDEVICE.

- Fix one syzkaller found error related to math overflows during iova
  allocation

----------------------------------------------------------------
Arnd Bergmann (1):
      iommu/tegra241-cmdqv: import IOMMUFD module namespace

Jason Gunthorpe (2):
      iommufd: Prevent ALIGN() overflow
      iommufd/selftest: Test reserved regions near ULONG_MAX

Nicolin Chen (46):
      iommufd: Apply obvious cosmetic fixes
      iommufd: Drop unused ictx in struct iommufd_vdevice
      iommufd: Use enum iommu_viommu_type for type in struct iommufd_viommu
      iommufd: Use enum iommu_veventq_type for type in struct iommufd_veventq
      iommufd: Return EOPNOTSUPP for failures due to driver bugs
      iommu: Introduce get_viommu_size and viommu_init ops
      iommufd/viommu: Support get_viommu_size and viommu_init ops
      iommufd/selftest: Drop parent domain from mock_iommu_domain_nested
      iommufd/selftest: Replace mock_viommu_alloc with mock_viommu_init
      iommu/arm-smmu-v3: Replace arm_vsmmu_alloc with arm_vsmmu_init
      iommu: Deprecate viommu_alloc op
      iommufd: Move _iommufd_object_alloc out of driver.c
      iommufd: Introduce iommufd_object_alloc_ucmd helper
      iommufd: Apply the new iommufd_object_alloc_ucmd helper
      iommufd: Report unmapped bytes in the error path of iopt_unmap_iova_range
      iommufd: Correct virt_id kdoc at struct iommu_vdevice_alloc
      iommufd/viommu: Explicitly define vdev->virt_id
      iommu: Use enum iommu_hw_info_type for type in hw_info op
      iommu: Add iommu_copy_struct_to_user helper
      iommu: Pass in a driver-level user data structure to viommu_init op
      iommufd/viommu: Allow driver-specific user data for a vIOMMU object
      iommufd/selftest: Support user_data in mock_viommu_alloc
      iommufd/selftest: Add coverage for viommu data
      iommufd/access: Add internal APIs for HW queue to use
      iommufd/access: Bypass access->ops->unmap for internal use
      iommufd/viommu: Add driver-defined vDEVICE support
      iommufd/viommu: Introduce IOMMUFD_OBJ_HW_QUEUE and its related struct
      iommufd/viommu: Add IOMMUFD_CMD_HW_QUEUE_ALLOC ioctl
      iommufd/driver: Add iommufd_hw_queue_depend/undepend() helpers
      iommufd/selftest: Add coverage for IOMMUFD_CMD_HW_QUEUE_ALLOC
      iommufd: Add mmap interface
      iommufd/selftest: Add coverage for the new mmap interface
      Documentation: userspace-api: iommufd: Update HW QUEUE
      iommu: Allow an input type in hw_info op
      iommufd: Allow an input data_type via iommu_hw_info
      iommufd/selftest: Update hw_info coverage for an input data_type
      iommu/arm-smmu-v3-iommufd: Add vsmmu_size/type and vsmmu_init impl ops
      iommu/arm-smmu-v3-iommufd: Add hw_info to impl_ops
      iommu/tegra241-cmdqv: Use request_threaded_irq
      iommu/tegra241-cmdqv: Simplify deinit flow in tegra241_cmdqv_remove_vintf()
      iommu/tegra241-cmdqv: Do not statically map LVCMDQs
      iommu/tegra241-cmdqv: Add user-space use support
      iommu/tegra241-cmdqv: Add IOMMU_VEVENTQ_TYPE_TEGRA241_CMDQV support
      iommufd: Do not allow _iommufd_object_alloc_ucmd if abort op is set
      iommu/arm-smmu-v3: Do not bother impl_ops if IOMMU_VIOMMU_TYPE_ARM_SMMUV3
      iommu/arm-smmu-v3: Replace vsmmu_size/type with get_viommu_size

Xu Yilun (8):
      iommufd/viommu: Roll back to use iommufd_object_alloc() for vdevice
      iommufd: Add iommufd_object_tombstone_user() helper
      iommufd: Add a pre_destroy() op for objects
      iommufd: Destroy vdevice on idevice destroy
      iommufd/vdevice: Remove struct device reference from struct vdevice
      iommufd/selftest: Explicitly skip tests for inapplicable variant
      iommufd/selftest: Add coverage for vdevice tombstone
      iommufd: Rename some shortterm-related identifiers

 Documentation/userspace-api/iommufd.rst            |  12 +
 .../iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c    |  70 ++-
 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c        |  17 +-
 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h        |  33 +-
 drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c     | 493 ++++++++++++++++++-
 drivers/iommu/intel/iommu.c                        |   7 +-
 drivers/iommu/iommufd/device.c                     | 143 +++++-
 drivers/iommu/iommufd/driver.c                     | 113 +++--
 drivers/iommu/iommufd/eventq.c                     |  14 +-
 drivers/iommu/iommufd/hw_pagetable.c               |  10 +-
 drivers/iommu/iommufd/io_pagetable.c               |  57 ++-
 drivers/iommu/iommufd/io_pagetable.h               |   5 +-
 drivers/iommu/iommufd/iommufd_private.h            | 135 ++++-
 drivers/iommu/iommufd/iommufd_test.h               |  20 +
 drivers/iommu/iommufd/iova_bitmap.c                |   1 -
 drivers/iommu/iommufd/main.c                       | 206 +++++++-
 drivers/iommu/iommufd/pages.c                      |  21 +-
 drivers/iommu/iommufd/selftest.c                   | 207 ++++++--
 drivers/iommu/iommufd/viommu.c                     | 309 +++++++++++-
 include/linux/iommu.h                              |  74 ++-
 include/linux/iommufd.h                            | 196 +++++++-
 include/uapi/linux/iommufd.h                       | 154 +++++-
 tools/testing/selftests/iommu/iommufd.c            | 541 +++++++++++++--------
 tools/testing/selftests/iommu/iommufd_fail_nth.c   |  15 +-
 tools/testing/selftests/iommu/iommufd_utils.h      |  89 +++-
 25 files changed, 2436 insertions(+), 506 deletions(-)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [GIT PULL] Please pull IOMMUFD subsystem changes
  2025-07-30 18:47 Jason Gunthorpe
@ 2025-07-31 20:01 ` pr-tracker-bot
  0 siblings, 0 replies; 51+ messages in thread
From: pr-tracker-bot @ 2025-07-31 20:01 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: Linus Torvalds, iommu, kvm, linux-kernel, Kevin Tian

The pull request you sent on Wed, 30 Jul 2025 15:47:34 -0300:

> git://git.kernel.org/pub/scm/linux/kernel/git/jgg/iommufd.git tags/for-linus-iommufd

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/c93529ad4fa8d8d8cb21649e70a46991a1dda0f8

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html

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

* [GIT PULL] Please pull IOMMUFD subsystem changes
@ 2025-08-22 14:21 Jason Gunthorpe
  2025-08-22 21:28 ` pr-tracker-bot
  0 siblings, 1 reply; 51+ messages in thread
From: Jason Gunthorpe @ 2025-08-22 14:21 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: iommu, kvm, linux-kernel, Kevin Tian

[-- Attachment #1: Type: text/plain, Size: 997 bytes --]

Hi Linus,

Two very minor fixes

Thanks,
Jason

The following changes since commit c17b750b3ad9f45f2b6f7e6f7f4679844244f0b9:

  Linux 6.17-rc2 (2025-08-17 15:22:10 -0700)

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 447c6141e8ea68ef4e56c55144fd18f43e6c8dca:

  iommufd: Fix spelling errors in iommufd.rst (2025-08-18 11:15:06 -0300)

----------------------------------------------------------------
iommufd 6.17 first rc pull

- Fix mismatched kvalloc()/kfree()

- Spelling fixes in documentation

----------------------------------------------------------------
Akhilesh Patil (1):
      iommufd: viommu: free memory allocated by kvcalloc() using kvfree()

Alessandro Ratti (1):
      iommufd: Fix spelling errors in iommufd.rst

 Documentation/userspace-api/iommufd.rst | 4 ++--
 drivers/iommu/iommufd/viommu.c          | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [GIT PULL] Please pull IOMMUFD subsystem changes
  2025-08-22 14:21 [GIT PULL] Please pull IOMMUFD subsystem changes Jason Gunthorpe
@ 2025-08-22 21:28 ` pr-tracker-bot
  0 siblings, 0 replies; 51+ messages in thread
From: pr-tracker-bot @ 2025-08-22 21:28 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: Linus Torvalds, iommu, kvm, linux-kernel, Kevin Tian

The pull request you sent on Fri, 22 Aug 2025 11:21:47 -0300:

> git://git.kernel.org/pub/scm/linux/kernel/git/jgg/iommufd.git tags/for-linus-iommufd

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/471b25a2fcbb25dccd7c9bece30313f2440a554e

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html

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

end of thread, other threads:[~2025-08-22 21:28 UTC | newest]

Thread overview: 51+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-22 14:21 [GIT PULL] Please pull IOMMUFD subsystem changes Jason Gunthorpe
2025-08-22 21:28 ` pr-tracker-bot
  -- strict thread matches above, loose matches on Subject: below --
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-03-31 16:12 Jason Gunthorpe
2025-04-02  1:50 ` 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

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).