[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 14/18] target/arm: Validate tlbi TG matches translation granul
From: |
Richard Henderson |
Subject: |
[PATCH v4 14/18] target/arm: Validate tlbi TG matches translation granule in use |
Date: |
Tue, 1 Mar 2022 11:59:54 -1000 |
For FEAT_LPA2, we will need other ARMVAParameters, which themselves
depend on the translation granule in use. We might as well validate
that the given TG matches; the architecture "does not require that
the instruction invalidates any entries" if this is not true.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/arm/helper.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/target/arm/helper.c b/target/arm/helper.c
index e455397fb5..3a7f5cf6f0 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -4520,12 +4520,16 @@ static TLBIRange tlbi_aa64_get_range(CPUARMState *env,
ARMMMUIdx mmuidx,
uint64_t value)
{
unsigned int page_size_granule, page_shift, num, scale, exponent;
+ /* Extract one bit to represent the va selector in use. */
+ uint64_t select = sextract64(value, 36, 1);
+ ARMVAParameters param = aa64_va_parameters(env, select, mmuidx, true);
TLBIRange ret = { };
page_size_granule = extract64(value, 46, 2);
- if (page_size_granule == 0) {
- qemu_log_mask(LOG_GUEST_ERROR, "Invalid page size granule %d\n",
+ /* The granule encoded in value must match the granule in use. */
+ if (page_size_granule != (param.using64k ? 3 : param.using16k ? 2 : 1)) {
+ qemu_log_mask(LOG_GUEST_ERROR, "Invalid tlbi page size granule %d\n",
page_size_granule);
return ret;
}
@@ -4537,7 +4541,7 @@ static TLBIRange tlbi_aa64_get_range(CPUARMState *env,
ARMMMUIdx mmuidx,
ret.length = (num + 1) << (exponent + page_shift);
- if (regime_has_2_ranges(mmuidx)) {
+ if (param.select) {
ret.base = sextract64(value, 0, 37);
} else {
ret.base = extract64(value, 0, 37);
--
2.25.1
- [PATCH v4 01/18] hw/registerfields: Add FIELD_SEX<N> and FIELD_SDP<N>, (continued)
- [PATCH v4 01/18] hw/registerfields: Add FIELD_SEX<N> and FIELD_SDP<N>, Richard Henderson, 2022/03/01
- [PATCH v4 03/18] target/arm: Fault on invalid TCR_ELx.TxSZ, Richard Henderson, 2022/03/01
- [PATCH v4 05/18] target/arm: Pass outputsize down to check_s2_mmu_setup, Richard Henderson, 2022/03/01
- [PATCH v4 06/18] target/arm: Use MAKE_64BIT_MASK to compute indexmask, Richard Henderson, 2022/03/01
- [PATCH v4 08/18] target/arm: Prepare DBGBVR and DBGWVR for FEAT_LVA, Richard Henderson, 2022/03/01
- [PATCH v4 10/18] target/arm: Implement FEAT_LPA, Richard Henderson, 2022/03/01
- [PATCH v4 07/18] target/arm: Honor TCR_ELx.{I}PS, Richard Henderson, 2022/03/01
- [PATCH v4 09/18] target/arm: Implement FEAT_LVA, Richard Henderson, 2022/03/01
- [PATCH v4 12/18] target/arm: Introduce tlbi_aa64_get_range, Richard Henderson, 2022/03/01
- [PATCH v4 11/18] target/arm: Extend arm_fi_to_lfsc to level -1, Richard Henderson, 2022/03/01
- [PATCH v4 14/18] target/arm: Validate tlbi TG matches translation granule in use,
Richard Henderson <=
- [PATCH v4 13/18] target/arm: Fix TLBIRange.base for 16k and 64k pages, Richard Henderson, 2022/03/01
- [PATCH v4 17/18] target/arm: Provide cpu property for controling FEAT_LPA2, Richard Henderson, 2022/03/01
- [PATCH v4 15/18] target/arm: Advertise all page sizes for -cpu max, Richard Henderson, 2022/03/01
- [PATCH v4 16/18] target/arm: Implement FEAT_LPA2, Richard Henderson, 2022/03/01
- [PATCH v4 18/18] hw/arm/virt: Disable LPA2 for -machine virt-6.2, Richard Henderson, 2022/03/01