diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2022-05-05 19:39:47 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2022-05-19 16:19:01 +0100 |
commit | 9f225e607f215003de1e4157255bb0199adff9aa (patch) | |
tree | f11f288961b57b95a5089505189be16412edcfe4 /target/arm/internals.h | |
parent | 78ac2eebbab9150edf5d0d00e3648f5ebb599001 (diff) | |
download | qemu-9f225e607f215003de1e4157255bb0199adff9aa.zip qemu-9f225e607f215003de1e4157255bb0199adff9aa.tar.gz qemu-9f225e607f215003de1e4157255bb0199adff9aa.tar.bz2 |
target/arm: Postpone interpretation of stage 2 descriptor attribute bits
In the original Arm v8 two-stage translation, both stage 1 and stage
2 specify memory attributes (memory type, cacheability,
shareability); these are then combined to produce the overall memory
attributes for the whole stage 1+2 access. In QEMU we implement this
by having get_phys_addr() fill in an ARMCacheAttrs struct, and we
convert both the stage 1 and stage 2 attribute bit formats to the
same encoding (an 8-bit attribute value matching the MAIR_EL1 fields,
plus a 2-bit shareability value).
The new FEAT_S2FWB feature allows the guest to enable a different
interpretation of the attribute bits in the stage 2 descriptors.
These bits can now be used to control details of how the stage 1 and
2 attributes should be combined (for instance they can say "always
use the stage 1 attributes" or "ignore the stage 1 attributes and
always be Device memory"). This means we need to pass the raw bit
information for stage 2 down to the function which combines the stage
1 and stage 2 information.
Add a field to ARMCacheAttrs that indicates whether the attrs field
should be interpreted as MAIR format, or as the raw stage 2 attribute
bits from the descriptor, and store the appropriate values when
filling in cacheattrs.
We only need to interpret the attrs field in a few places:
* in do_ats_write(), where we know to expect a MAIR value
(there is no ATS instruction to do a stage-2-only walk)
* in S1_ptw_translate(), where we want to know whether the
combined S1 + S2 attributes indicate Device memory that
should provoke a fault
* in combine_cacheattrs(), which does the S1 + S2 combining
Update those places accordingly.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220505183950.2781801-2-peter.maydell@linaro.org
Diffstat (limited to 'target/arm/internals.h')
-rw-r--r-- | target/arm/internals.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/target/arm/internals.h b/target/arm/internals.h index 6ca0e95..9b354ee 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -1149,8 +1149,13 @@ bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address, /* Cacheability and shareability attributes for a memory access */ typedef struct ARMCacheAttrs { - unsigned int attrs:8; /* as in the MAIR register encoding */ + /* + * If is_s2_format is true, attrs is the S2 descriptor bits [5:2] + * Otherwise, attrs is the same as the MAIR_EL1 8-bit format + */ + unsigned int attrs:8; unsigned int shareability:2; /* as in the SH field of the VMSAv8-64 PTEs */ + bool is_s2_format:1; } ARMCacheAttrs; bool get_phys_addr(CPUARMState *env, target_ulong address, |