History

iommu: Allow page responses without PASID

Some PCIe devices do not expect a PASID value in PRI Page Responses. If the "PRG Response PASID Required" bit in the PRI capability is zero, then the OS should not set the PASID field. Similarly on Arm SMMU, responses to stall events do not have a PASID. Currently iommu_page_response() systematically checks that the PASID in the page response corresponds to the one in the page request. This can't work with virtualization because a page response coming from a guest OS won't have a PASID if the passed-through device does not require one. Add a flag to page requests that declares whether the corresponding response needs to have a PASID. When this flag isn't set, allow page responses without PASID.

Jean-Philippe Brucker committed 6 years ago

Commit 97047191 parent d3e3d2b2 files · +22 −7Browse files

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

Unified · Split

include/uapi/linux/iommu.h+5−1
@@ -81,7 +81,10 @@ struct iommu_fault_unrecoverable { · 80 unmodified lines
81/**81/**
82 * struct iommu_fault_page_request - Page Request data82 * struct iommu_fault_page_request - Page Request data
83 * @flags: encodes whether the corresponding fields are valid and whether this83 * @flags: encodes whether the corresponding fields are valid and whether this
84 * is the last page in group (IOMMU_FAULT_PAGE_REQUEST_* values)84 * is the last page in group (IOMMU_FAULT_PAGE_REQUEST_* values).
85 * When IOMMU_FAULT_PAGE_RESPONSE_NEEDS_PASID is set, the page response
86 * must have the same PASID value as the page request. When it is clear,
87 * the page response should not have a PASID.
85 * @pasid: Process Address Space ID88 * @pasid: Process Address Space ID
86 * @grpid: Page Request Group Index89 * @grpid: Page Request Group Index
87 * @perm: requested page permissions (IOMMU_FAULT_PERM_* values)90 * @perm: requested page permissions (IOMMU_FAULT_PERM_* values)
@@ -92,6 +95,7 @@ struct iommu_fault_page_request { · 4 unmodified lines
92#define IOMMU_FAULT_PAGE_REQUEST_PASID_VALID (1 << 0)95#define IOMMU_FAULT_PAGE_REQUEST_PASID_VALID (1 << 0)
93#define IOMMU_FAULT_PAGE_REQUEST_LAST_PAGE (1 << 1)96#define IOMMU_FAULT_PAGE_REQUEST_LAST_PAGE (1 << 1)
94#define IOMMU_FAULT_PAGE_REQUEST_PRIV_DATA (1 << 2)97#define IOMMU_FAULT_PAGE_REQUEST_PRIV_DATA (1 << 2)
98#define IOMMU_FAULT_PAGE_RESPONSE_NEEDS_PASID (1 << 3)
95 __u32 flags;99 __u32 flags;
96 __u32 pasid;100 __u32 pasid;
97 __u32 grpid;101 __u32 grpid;