[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH v3 01/18] hw/arm/smmu-common: Add missing size check for stag
From: |
Mostafa Saleh |
Subject: |
[RFC PATCH v3 01/18] hw/arm/smmu-common: Add missing size check for stage-1 |
Date: |
Mon, 29 Apr 2024 03:23:45 +0000 |
According to the SMMU architecture specification (ARM IHI 0070 F.b),
in “3.4 Address sizes”
The address output from the translation causes a stage 1 Address Size
fault if it exceeds the range of the effective IPA size for the given CD.
However, this check was missing.
There is already a similar check for stage-2 against effective PA.
Signed-off-by: Mostafa Saleh <smostafa@google.com>
---
hw/arm/smmu-common.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
index 1ce706bf94..eb2356bc35 100644
--- a/hw/arm/smmu-common.c
+++ b/hw/arm/smmu-common.c
@@ -381,6 +381,16 @@ static int smmu_ptw_64_s1(SMMUTransCfg *cfg,
goto error;
}
+ /*
+ * The address output from the translation causes a stage 1 Address
+ * Size fault if it exceeds the range of the effective IPA size for
+ * the given CD.
+ */
+ if (gpa >= (1ULL << cfg->oas)) {
+ info->type = SMMU_PTW_ERR_ADDR_SIZE;
+ goto error;
+ }
+
tlbe->entry.translated_addr = gpa;
tlbe->entry.iova = iova & ~mask;
tlbe->entry.addr_mask = mask;
--
2.44.0.769.g3c40516874-goog
- [RFC PATCH v3 00/18] SMMUv3 nested translation support, Mostafa Saleh, 2024/04/28
- [RFC PATCH v3 01/18] hw/arm/smmu-common: Add missing size check for stage-1,
Mostafa Saleh <=
- [RFC PATCH v3 02/18] hw/arm/smmu: Fix IPA for stage-2 events, Mostafa Saleh, 2024/04/28
- [RFC PATCH v3 03/18] hw/arm/smmuv3: Fix encoding of CLASS in events, Mostafa Saleh, 2024/04/28
- [RFC PATCH v3 04/18] hw/arm/smmu: Use enum for SMMU stage, Mostafa Saleh, 2024/04/28
- [RFC PATCH v3 05/18] hw/arm/smmu: Split smmuv3_translate(), Mostafa Saleh, 2024/04/28
- [RFC PATCH v3 06/18] hw/arm/smmu: Consolidate ASID and VMID types, Mostafa Saleh, 2024/04/28
- [RFC PATCH v3 07/18] hw/arm/smmuv3: Translate CD and TT using stage-2 table, Mostafa Saleh, 2024/04/28
- [RFC PATCH v3 08/18] hw/arm/smmu-common: Add support for nested TLB, Mostafa Saleh, 2024/04/28
- [RFC PATCH v3 09/18] hw/arm/smmu-common: Rework TLB lookup for nesting, Mostafa Saleh, 2024/04/28
- [RFC PATCH v3 10/18] hw/arm/smmu-common: Support nested translation, Mostafa Saleh, 2024/04/28
- [RFC PATCH v3 11/18] hw/arm/smmu: Support nesting in smmuv3_range_inval(), Mostafa Saleh, 2024/04/28