xen/arm: don't read aarch32 regs when aarch32 isn't available
authorStefano Stabellini <sstabellini@kernel.org>
Tue, 12 Jan 2021 23:44:50 +0000 (15:44 -0800)
committerStefano Stabellini <sstabellini@kernel.org>
Thu, 14 Jan 2021 00:00:51 +0000 (16:00 -0800)
commit0293fd24bbaa2c4fa0acbe2abcd2d41b96ecd7e1
tree573dc5e9e81c79430fc5084b92a72de28b83309f
parent896128e9352327c4ff2b5c0c6cfa3856e45e2ca3
xen/arm: don't read aarch32 regs when aarch32 isn't available

Don't read aarch32 system registers at boot time when the aarch32 state
is not available at EL0. They are UNKNOWN, so it is not useful to read
them. Moreover, on Cavium ThunderX reading ID_PFR2_EL1 generates an
unsupported exception which causes a Xen crash.  Instead, only read them
when aarch32 is available.

Leave the corresponding fields in struct cpuinfo_arm so that they
are read-as-zero from a guest.

Since we are editing identify_cpu, also fix the indentation: 4 spaces
instead of 8.

Fixes: 9cfdb489af81 ("xen/arm: Add ID registers and complete cpuinfo")
Link: https://lore.kernel.org/xen-devel/f90e40ee-b042-6cc5-a08d-aef41a279527@suse.com/
Suggested-by: Julien Grall <julien@xen.org>
Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
Acked-by: Julien Grall <jgrall@amazon.com>
xen/arch/arm/cpufeature.c
xen/include/asm-arm/cpufeature.h