target/arm: Handle AArch32 CP15 trapping via HSTR_EL2
commit5bb0a20b74ad17dee5dae38e3b8b70b383ee7c2d
authorMarc Zyngier <maz@kernel.org>
Sun, 1 Dec 2019 12:20:17 +0000 (1 12:20 +0000)
committerPeter Maydell <peter.maydell@linaro.org>
Mon, 16 Dec 2019 10:46:35 +0000 (16 10:46 +0000)
tree60d79a11f29636313eb7988539cecf1e627267c8
parent9ca1d776cb49c09b09579d9edd0447542970c834
target/arm: Handle AArch32 CP15 trapping via HSTR_EL2

HSTR_EL2 offers a way to trap ranges of CP15 system register
accesses to EL2, and it looks like this register is completely
ignored by QEMU.

To avoid adding extra .accessfn filters all over the place (which
would have a direct performance impact), let's add a new TB flag
that gets set whenever HSTR_EL2 is non-zero and that QEMU translates
a context where this trap has a chance to apply, and only generate
the extra access check if the hypervisor is actively using this feature.

Tested with a hand-crafted KVM guest accessing CBAR.

Signed-off-by: Marc Zyngier <maz@kernel.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20191201122018.25808-5-maz@kernel.org
[PMM: use is_a64(); fix comment syntax]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
target/arm/cpu.h
target/arm/helper.c
target/arm/op_helper.c
target/arm/translate.c
target/arm/translate.h