From: Kunkun Jiang jiangkunkun@huawei.com
virt inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I61SPO CVE: NA
--------------------------------
This reverts commit 7733f2e7a689598588f6074acca8b9424a76ea4a.
Signed-off-by: Kunkun Jiang jiangkunkun@huawei.com Reviewed-by: Keqian Zhu zhukeqian1@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 40 ++------------------- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 4 --- 2 files changed, 2 insertions(+), 42 deletions(-)
diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c index 74eb98bd3e6e..b061ed78c202 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c @@ -1700,7 +1700,6 @@ static int arm_smmu_handle_evt(struct arm_smmu_device *smmu, u64 *evt) u32 perm = 0; struct arm_smmu_master *master; bool ssid_valid = evt[0] & EVTQ_0_SSV; - u8 type = FIELD_GET(EVTQ_0_ID, evt[0]); u32 sid = FIELD_GET(EVTQ_0_SID, evt[0]); struct iommu_fault_event fault_evt = { }; struct iommu_fault *flt = &fault_evt.fault; @@ -1753,6 +1752,8 @@ static int arm_smmu_handle_evt(struct arm_smmu_device *smmu, u64 *evt) } else { flt->type = IOMMU_FAULT_DMA_UNRECOV; flt->event = (struct iommu_fault_unrecoverable) { + .reason = reason, + .flags = IOMMU_FAULT_UNRECOV_ADDR_VALID, .perm = perm, .addr = FIELD_GET(EVTQ_2_ADDR, evt[2]), }; @@ -1761,43 +1762,6 @@ static int arm_smmu_handle_evt(struct arm_smmu_device *smmu, u64 *evt) flt->event.flags |= IOMMU_FAULT_UNRECOV_PASID_VALID; flt->event.pasid = FIELD_GET(EVTQ_0_SSID, evt[0]); } - - switch (type) { - case EVT_ID_TRANSLATION_FAULT: - flt->event.reason = IOMMU_FAULT_REASON_PTE_FETCH; - flt->event.flags |= IOMMU_FAULT_UNRECOV_ADDR_VALID; - break; - case EVT_ID_ADDR_SIZE_FAULT: - flt->event.reason = IOMMU_FAULT_REASON_OOR_ADDRESS; - flt->event.flags |= IOMMU_FAULT_UNRECOV_ADDR_VALID; - break; - case EVT_ID_ACCESS_FAULT: - flt->event.reason = IOMMU_FAULT_REASON_ACCESS; - flt->event.flags |= IOMMU_FAULT_UNRECOV_ADDR_VALID; - break; - case EVT_ID_PERMISSION_FAULT: - flt->event.reason = IOMMU_FAULT_REASON_PERMISSION; - flt->event.flags |= IOMMU_FAULT_UNRECOV_ADDR_VALID; - break; - case EVT_ID_BAD_SUBSTREAMID: - flt->event.reason = IOMMU_FAULT_REASON_PASID_INVALID; - break; - case EVT_ID_CD_FETCH: - flt->event.reason = IOMMU_FAULT_REASON_PASID_FETCH; - flt->event.flags |= IOMMU_FAULT_UNRECOV_FETCH_ADDR_VALID; - break; - case EVT_ID_BAD_CD: - flt->event.reason = IOMMU_FAULT_REASON_BAD_PASID_ENTRY; - break; - case EVT_ID_WALK_EABT: - flt->event.reason = IOMMU_FAULT_REASON_WALK_EABT; - flt->event.flags |= IOMMU_FAULT_UNRECOV_ADDR_VALID | - IOMMU_FAULT_UNRECOV_FETCH_ADDR_VALID; - break; - default: - /* TODO: report other unrecoverable faults. */ - return -EFAULT; - } }
mutex_lock(&smmu->streams_mutex); diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h index d0f3181a22c5..c744d812fc8d 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h @@ -433,10 +433,6 @@
#define EVTQ_0_ID GENMASK_ULL(7, 0)
-#define EVT_ID_BAD_SUBSTREAMID 0x08 -#define EVT_ID_CD_FETCH 0x09 -#define EVT_ID_BAD_CD 0x0a -#define EVT_ID_WALK_EABT 0x0b #define EVT_ID_TRANSLATION_FAULT 0x10 #define EVT_ID_ADDR_SIZE_FAULT 0x11 #define EVT_ID_ACCESS_FAULT 0x12