History

iommufd: Allow pt_id to carry viommu_id for IOMMU_HWPT_ALLOC

Now a vIOMMU holds a shareable nesting parent HWPT. So, it can act like that nesting parent HWPT to allocate a nested HWPT. Support that in the IOMMU_HWPT_ALLOC ioctl handler, and update its kdoc. Also, add an iommufd_viommu_alloc_hwpt_nested helper to allocate a nested HWPT for a vIOMMU object. Since a vIOMMU object holds the parent hwpt's refcount already, increase the refcount of the vIOMMU only.

Nicolin Chen committed 2 years ago

Commit 13a75011 parent 69d26893 files · +81 −7Browse files

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

Unified · Split

include/uapi/linux/iommufd.h+8−6
@@ -435,7 +435,7 @@ enum iommu_hwpt_data_type { · 434 unmodified lines
435 * @size: sizeof(struct iommu_hwpt_alloc)435 * @size: sizeof(struct iommu_hwpt_alloc)
436 * @flags: Combination of enum iommufd_hwpt_alloc_flags436 * @flags: Combination of enum iommufd_hwpt_alloc_flags
437 * @dev_id: The device to allocate this HWPT for437 * @dev_id: The device to allocate this HWPT for
438 * @pt_id: The IOAS or HWPT to connect this HWPT to438 * @pt_id: The IOAS or HWPT or vIOMMU to connect this HWPT to
439 * @out_hwpt_id: The ID of the new HWPT439 * @out_hwpt_id: The ID of the new HWPT
440 * @__reserved: Must be 0440 * @__reserved: Must be 0
441 * @data_type: One of enum iommu_hwpt_data_type441 * @data_type: One of enum iommu_hwpt_data_type
@@ -454,11 +454,13 @@ enum iommu_hwpt_data_type { · 12 unmodified lines
454 * IOMMU_HWPT_DATA_NONE. The HWPT can be allocated as a parent HWPT for a454 * IOMMU_HWPT_DATA_NONE. The HWPT can be allocated as a parent HWPT for a
455 * nesting configuration by passing IOMMU_HWPT_ALLOC_NEST_PARENT via @flags.455 * nesting configuration by passing IOMMU_HWPT_ALLOC_NEST_PARENT via @flags.
456 *456 *
457 * A user-managed nested HWPT will be created from a given parent HWPT via457 * A user-managed nested HWPT will be created from a given vIOMMU (wrapping a
458 * @pt_id, in which the parent HWPT must be allocated previously via the458 * parent HWPT) or a parent HWPT via @pt_id, in which the parent HWPT must be
459 * same ioctl from a given IOAS (@pt_id). In this case, the @data_type459 * allocated previously via the same ioctl from a given IOAS (@pt_id). In this
460 * must be set to a pre-defined type corresponding to an I/O page table460 * case, the @data_type must be set to a pre-defined type corresponding to an
461 * type supported by the underlying IOMMU hardware.461 * I/O page table type supported by the underlying IOMMU hardware. The device
462 * via @dev_id and the vIOMMU via @pt_id must be associated to the same IOMMU
463 * instance.
462 *464 *
463 * If the @data_type is set to IOMMU_HWPT_DATA_NONE, @data_len and465 * If the @data_type is set to IOMMU_HWPT_DATA_NONE, @data_len and
464 * @data_uptr should be zero. Otherwise, both @data_len and @data_uptr466 * @data_uptr should be zero. Otherwise, both @data_len and @data_uptr

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