Commit 2ff4bed7 authored by Jason Gunthorpe's avatar Jason Gunthorpe
Browse files

iommufd: File descriptor, context, kconfig and makefiles

This is the basic infrastructure of a new miscdevice to hold the iommufd
IOCTL API.

It provides:
 - A miscdevice to create file descriptors to run the IOCTL interface over

 - A table based ioctl dispatch and centralized extendable pre-validation
   step

 - An xarray mapping userspace ID's to kernel objects. The design has
   multiple inter-related objects held within in a single IOMMUFD fd

 - A simple usage count to build a graph of object relations and protect
   against hostile userspace racing ioctls

The only IOCTL provided in this patch is the generic 'destroy any object
by handle' operation.

Link: https://lore.kernel.org/r/6-v6-a196d26f289e+11787-iommufd_jgg@nvidia.com


Reviewed-by: default avatarLu Baolu <baolu.lu@linux.intel.com>
Reviewed-by: default avatarKevin Tian <kevin.tian@intel.com>
Reviewed-by: default avatarEric Auger <eric.auger@redhat.com>
Tested-by: default avatarNicolin Chen <nicolinc@nvidia.com>
Tested-by: default avatarYi Liu <yi.l.liu@intel.com>
Tested-by: default avatarLixiao Yang <lixiao.yang@intel.com>
Tested-by: default avatarMatthew Rosato <mjrosato@linux.ibm.com>
Signed-off-by: default avatarYi Liu <yi.l.liu@intel.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
parent 658234de
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -105,6 +105,7 @@ Code Seq# Include File Comments
'8'   all                                                            SNP8023 advanced NIC card
                                                                     <mailto:mcr@solidum.com>
';'   64-7F  linux/vfio.h
';'   80-FF  linux/iommufd.h
'='   00-3f  uapi/linux/ptp_clock.h                                  <mailto:richardcochran@gmail.com>
'@'   00-0F  linux/radeonfb.h                                        conflict!
'@'   00-0F  drivers/video/aty/aty128fb.c                            conflict!
+12 −0
Original line number Diff line number Diff line
@@ -10717,6 +10717,18 @@ F: drivers/iommu/dma-iommu.h
F:	drivers/iommu/iova.c
F:	include/linux/iova.h
IOMMUFD
M:	Jason Gunthorpe <jgg@nvidia.com>
M:	Kevin Tian <kevin.tian@intel.com>
L:	iommu@lists.linux.dev
S:	Maintained
T:	git git://git.kernel.org/pub/scm/linux/kernel/git/jgg/iommufd.git
F:	Documentation/userspace-api/iommufd.rst
F:	drivers/iommu/iommufd/
F:	include/linux/iommufd.h
F:	include/uapi/linux/iommufd.h
F:	tools/testing/selftests/iommu/
IOMMU SUBSYSTEM
M:	Joerg Roedel <joro@8bytes.org>
M:	Will Deacon <will@kernel.org>
+1 −0
Original line number Diff line number Diff line
@@ -188,6 +188,7 @@ config MSM_IOMMU

source "drivers/iommu/amd/Kconfig"
source "drivers/iommu/intel/Kconfig"
source "drivers/iommu/iommufd/Kconfig"

config IRQ_REMAP
	bool "Support for Interrupt Remapping"
+1 −1
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0
obj-y += amd/ intel/ arm/
obj-y += amd/ intel/ arm/ iommufd/
obj-$(CONFIG_IOMMU_API) += iommu.o
obj-$(CONFIG_IOMMU_API) += iommu-traces.o
obj-$(CONFIG_IOMMU_API) += iommu-sysfs.o
+12 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0-only
config IOMMUFD
	tristate "IOMMU Userspace API"
	select INTERVAL_TREE
	select INTERVAL_TREE_SPAN_ITER
	select IOMMU_API
	default n
	help
	  Provides /dev/iommu, the user API to control the IOMMU subsystem as
	  it relates to managing IO page tables that point at user space memory.

	  If you don't know what to do here, say N.
Loading