History

iommufd/viommu: Add IOMMU_VIOMMU_ALLOC ioctl

Add a new ioctl for user space to do a vIOMMU allocation. It must be based on a nesting parent HWPT, so take its refcount. IOMMU driver wanting to support vIOMMUs must define its IOMMU_VIOMMU_TYPE_ in the uAPI header and implement a viommu_alloc op in its iommu_ops.

Nicolin Chen committed 2 years ago

Commit 4db97c21 parent d56d1e85 files · +132 −1Browse files

Showing the changes to include/uapi (1 of 5 files). Show all

Unified · Split

include/uapi/linux/iommufd.h+40−0
@@ -52,6 +52,7 @@ enum { · 51 unmodified lines
52 IOMMUFD_CMD_HWPT_INVALIDATE = 0x8d,52 IOMMUFD_CMD_HWPT_INVALIDATE = 0x8d,
53 IOMMUFD_CMD_FAULT_QUEUE_ALLOC = 0x8e,53 IOMMUFD_CMD_FAULT_QUEUE_ALLOC = 0x8e,
54 IOMMUFD_CMD_IOAS_MAP_FILE = 0x8f,54 IOMMUFD_CMD_IOAS_MAP_FILE = 0x8f,
55 IOMMUFD_CMD_VIOMMU_ALLOC = 0x90,
55};56};
56 57
57/**58/**
@@ -822,4 +823,43 @@ struct iommu_fault_alloc { · 764 unmodified lines
822 __u32 out_fault_fd;823 __u32 out_fault_fd;
823};824};
824#define IOMMU_FAULT_QUEUE_ALLOC _IO(IOMMUFD_TYPE, IOMMUFD_CMD_FAULT_QUEUE_ALLOC)825#define IOMMU_FAULT_QUEUE_ALLOC _IO(IOMMUFD_TYPE, IOMMUFD_CMD_FAULT_QUEUE_ALLOC)
826
827/**
828 * enum iommu_viommu_type - Virtual IOMMU Type
829 * @IOMMU_VIOMMU_TYPE_DEFAULT: Reserved for future use
830 */
831enum iommu_viommu_type {
832 IOMMU_VIOMMU_TYPE_DEFAULT = 0,
833};
834
835/**
836 * struct iommu_viommu_alloc - ioctl(IOMMU_VIOMMU_ALLOC)
837 * @size: sizeof(struct iommu_viommu_alloc)
838 * @flags: Must be 0
839 * @type: Type of the virtual IOMMU. Must be defined in enum iommu_viommu_type
840 * @dev_id: The device's physical IOMMU will be used to back the virtual IOMMU
841 * @hwpt_id: ID of a nesting parent HWPT to associate to
842 * @out_viommu_id: Output virtual IOMMU ID for the allocated object
843 *
844 * Allocate a virtual IOMMU object, representing the underlying physical IOMMU's
845 * virtualization support that is a security-isolated slice of the real IOMMU HW
846 * that is unique to a specific VM. Operations global to the IOMMU are connected
847 * to the vIOMMU, such as:
848 * - Security namespace for guest owned ID, e.g. guest-controlled cache tags
849 * - Non-device-affiliated event reporting, e.g. invalidation queue errors
850 * - Access to a sharable nesting parent pagetable across physical IOMMUs
851 * - Virtualization of various platforms IDs, e.g. RIDs and others
852 * - Delivery of paravirtualized invalidation
853 * - Direct assigned invalidation queues
854 * - Direct assigned interrupts
855 */
856struct iommu_viommu_alloc {
857 __u32 size;
858 __u32 flags;
859 __u32 type;
860 __u32 dev_id;
861 __u32 hwpt_id;
862 __u32 out_viommu_id;
863};
864#define IOMMU_VIOMMU_ALLOC _IO(IOMMUFD_TYPE, IOMMUFD_CMD_VIOMMU_ALLOC)
825#endif865#endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t