qemu/docs/system/arm
Peter Maydell 75d08a4072 target/arm: Advertise support for FEAT_BBM level 2
The description in the Arm ARM of the requirements of FEAT_BBM is
admirably clear on the guarantees it provides software, but slightly
more obscure on what that means for implementations.  The description
of the equivalent SMMU feature in the SMMU specification (IHI0070D.b
section 3.21.1) is perhaps a bit more detailed and includes some
example valid implementation choices. (The SMMU version of this
feature is slightly tighter than the CPU version: the CPU is permitted
to raise TLB Conflict aborts in some situations that the SMMU may
not. This doesn't matter for QEMU because we don't want to do TLB
Conflict aborts anyway.)

The informal summary of FEAT_BBM is that it is about permitting an OS
to switch a range of memory between "covered by a huge page" and
"covered by a sequence of normal pages" without having to engage in
the 'break-before-make' dance that has traditionally been
necessary. The 'break-before-make' sequence is:

 * replace the old translation table entry with an invalid entry
 * execute a DSB insn
 * execute a broadcast TLB invalidate insn
 * execute a DSB insn
 * write the new translation table entry
 * execute a DSB insn

The point of this is to ensure that no TLB can simultaneously contain
TLB entries for the old and the new entry, which would traditionally
be UNPREDICTABLE (allowing the CPU to generate a TLB Conflict fault
or to use a random mishmash of values from the old and the new
entry).  FEAT_BBM level 2 says "for the specific case where the only
thing that changed is the size of the block, the TLB is guaranteed
not to do weird things even if there are multiple entries for an
address", which means that software can now do:

 * replace old translation table entry with new entry
 * DSB
 * broadcast TLB invalidate
 * DSB

As the SMMU spec notes, valid ways to do this include:

 * if there are multiple entries in the TLB for an address,
   choose one of them and use it, ignoring the others
 * if there are multiple entries in the TLB for an address,
   throw them all out and do a page table walk to get a new one

QEMU's page table walk implementation for Arm CPUs already meets the
requirements for FEAT_BBM level 2. When we cache an entry in our TCG
TLB, we do so only for the specific (non-huge) page that the address
is in, and there is no way for the TLB data structure to ever have
more than one TLB entry for that page. (We handle huge pages only in
that we track what part of the address space is covered by huge pages
so that a TLB invalidate operation for an address in a huge page
results in an invalidation of the whole TLB.) We ignore the Contiguous
bit in page table entries, so we don't have to do anything for the
parts of FEAT_BBM that deal with changis to the Contiguous bit.

FEAT_BBM level 2 also requires that the nT bit in block descriptors
must be ignored; since commit 39a1fd2528 we do this.

It's therefore safe for QEMU to advertise FEAT_BBM level 2 by
setting ID_AA64MMFR2_EL1.BBM to 2.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220426160422.2353158-3-peter.maydell@linaro.org
2022-04-28 13:59:23 +01:00
..
aspeed.rst arm: Remove swift-bmc machine 2022-02-26 18:40:51 +01:00
collie.rst docs/system: Briefly document collie board 2020-07-20 11:35:17 +01:00
cpu-features.rst hw/arm/virt: KVM: Enable PAuth when supported by the host 2022-01-20 11:47:52 +00:00
cubieboard.rst docs: Add skeletal documentation of cubieboard 2021-07-18 10:59:47 +01:00
digic.rst docs/system: Briefly document canon-a1100 board 2020-07-20 11:35:17 +01:00
emcraft-sf2.rst docs: Add skeletal documentation of the emcraft-sf2 2021-07-18 10:59:47 +01:00
emulation.rst target/arm: Advertise support for FEAT_BBM level 2 2022-04-28 13:59:23 +01:00
gumstix.rst docs/system: Briefly document gumstix boards 2020-07-20 11:35:17 +01:00
highbank.rst docs: Add skeletal documentation of highbank and midway 2021-07-18 10:59:47 +01:00
imx25-pdk.rst docs: Add documentation of Arm 'imx25-pdk' board 2021-08-02 11:42:38 +01:00
integratorcp.rst docs/system: Add 'Arm' to the Integrator/CP document title 2020-05-21 20:00:18 +01:00
kzm.rst docs: Add documentation of Arm 'kzm' board 2021-08-02 11:42:38 +01:00
mainstone.rst docs: Add documentation of Arm 'mainstone' board 2021-08-02 11:42:38 +01:00
mps2.rst hw/arm/mps2-tz: Implement AN524 memory remapping via machine property 2021-05-10 17:21:54 +01:00
musca.rst docs/system: Document Musca boards 2020-05-21 20:00:18 +01:00
musicpal.rst docs: Be consistent about capitalization of 'Arm' 2020-03-12 11:20:20 +00:00
nrf.rst docs/system: arm: Add nRF boards description 2021-06-24 14:58:48 +01:00
nseries.rst docs: Be consistent about capitalization of 'Arm' 2020-03-12 11:20:20 +00:00
nuvoton.rst hw/arm: add initial mori-bmc board 2022-02-21 13:30:21 +00:00
orangepi.rst docs: Render binary names as monospaced text 2021-11-22 15:02:38 +01:00
palm.rst docs: Be consistent about capitalization of 'Arm' 2020-03-12 11:20:20 +00:00
raspi.rst docs/system/arm: Document the various raspi boards 2020-11-23 10:53:02 +00:00
realview.rst docs: Be consistent about capitalization of 'Arm' 2020-03-12 11:20:20 +00:00
sabrelite.rst arm: Consistently use "Cortex-Axx", not "Cortex Axx" 2021-06-03 16:43:25 +01:00
sbsa.rst docs: Format literals correctly 2021-08-02 11:42:38 +01:00
stellaris.rst docs/system: Split target-arm.rst into sub-documents 2020-03-12 11:20:20 +00:00
stm32.rst docs/system: arm: Add stm32 boards description 2021-07-09 16:09:12 +01:00
sx1.rst docs: Be consistent about capitalization of 'Arm' 2020-03-12 11:20:20 +00:00
versatile.rst docs/system: document an example booting the versatilepb machine 2021-02-08 10:55:20 +00:00
vexpress.rst docs/system: document an example vexpress-a15 invocation 2021-02-08 10:55:20 +00:00
virt.rst hw/arm/virt: Support TCG GICv4 2022-04-22 14:44:53 +01:00
xlnx-versal-virt.rst docs/system/arm: xlnx-versal-virt: BBRAM and eFUSE Usage 2021-09-30 13:42:10 +01:00
xscale.rst docs/system/arm: Document the Sharp Zaurus SL-6000 2020-11-23 10:53:18 +00:00