History

iommu/arm-smmu-v3: Report events that belong to devices attached to vIOMMU

Aside from the IOPF framework, iommufd provides an additional pathway to report hardware events, via the vEVENTQ of vIOMMU infrastructure. Define an iommu_vevent_arm_smmuv3 uAPI structure, and report stage-1 events in the threaded IRQ handler. Also, add another four event record types that can be forwarded to a VM.

Nicolin Chen committed 1 year ago

Commit e7d3fa31 parent f0ea2074 files · +80 −25Browse files

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

Unified · Split

include/uapi/linux/iommufd.h+23−0
@@ -1054,9 +1054,32 @@ struct iommufd_vevent_header { · 1053 unmodified lines
10541054 /**
10551055 * enum iommu_veventq_type - Virtual Event Queue Type
10561056 * @IOMMU_VEVENTQ_TYPE_DEFAULT: Reserved for future use
1057+ * @IOMMU_VEVENTQ_TYPE_ARM_SMMUV3: ARM SMMUv3 Virtual Event Queue
10571058 */
10581059 enum iommu_veventq_type {
10591060 IOMMU_VEVENTQ_TYPE_DEFAULT = 0,
1061+ IOMMU_VEVENTQ_TYPE_ARM_SMMUV3 = 1,
1062+};
1063+
1064+/**
1065+ * struct iommu_vevent_arm_smmuv3 - ARM SMMUv3 Virtual Event
1066+ * (IOMMU_VEVENTQ_TYPE_ARM_SMMUV3)
1067+ * @evt: 256-bit ARM SMMUv3 Event record, little-endian.
1068+ * Reported event records: (Refer to "7.3 Event records" in SMMUv3 HW Spec)
1069+ * - 0x04 C_BAD_STE
1070+ * - 0x06 F_STREAM_DISABLED
1071+ * - 0x08 C_BAD_SUBSTREAMID
1072+ * - 0x0a C_BAD_CD
1073+ * - 0x10 F_TRANSLATION
1074+ * - 0x11 F_ADDR_SIZE
1075+ * - 0x12 F_ACCESS
1076+ * - 0x13 F_PERMISSION
1077+ *
1078+ * StreamID field reports a virtual device ID. To receive a virtual event for a
1079+ * device, a vDEVICE must be allocated via IOMMU_VDEVICE_ALLOC.
1080+ */
1081+struct iommu_vevent_arm_smmuv3 {
1082+ __aligned_le64 evt[4];
10601083 };
10611084
10621085 /**