qemu-patch-raspberry4/target/ppc
David Gibson 9d2179d6f9 ppc: Validate compatibility modes when setting
Current ppc_set_compat() will attempt to set any compatiblity mode
specified, regardless of whether it's available on the CPU.  The caller is
expected to make sure it is setting a possible mode, which is awkwward
because most of the information to make that decision is at the CPU level.

This begins to clean this up by introducing a ppc_check_compat() function
which will determine if a given compatiblity mode is supported on a CPU
(and also whether it lies within specified minimum and maximum compat
levels, which will be useful later).  It also contains an assertion that
the CPU has a "virtual hypervisor"[1], that is, that the guest isn't
permitted to execute hypervisor privilege code.  Without that, the guest
would own the PCR and so could override any mode set here.  Only machine
types which use a virtual hypervisor (i.e. 'pseries') should use
ppc_check_compat().

ppc_set_compat() is modified to validate the compatibility mode it is given
and fail if it's not available on this CPU.

[1] Or user-only mode, which also obviously doesn't allow access to the
hypervisor privileged PCR.  We don't use that now, but could in future.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2017-01-31 10:10:13 +11:00
..
translate target-ppc: implement stxvll instructions 2017-01-31 10:10:13 +11:00
arch_dump.c
compat.c ppc: Validate compatibility modes when setting 2017-01-31 10:10:13 +11:00
cpu-models.c
cpu-models.h
cpu-qom.h
cpu.h ppc: Validate compatibility modes when setting 2017-01-31 10:10:13 +11:00
dfp_helper.c
excp_helper.c ppc: Clean up and QOMify hypercall emulation 2017-01-31 10:10:13 +11:00
fpu_helper.c target-ppc: Add xxperm and xxpermr instructions 2017-01-31 10:10:13 +11:00
gdbstub.c
helper.h target-ppc: implement stxvll instructions 2017-01-31 10:10:13 +11:00
helper_regs.h cputlb: drop flush_global flag from tlb_flush 2017-01-13 14:24:37 +00:00
int_helper.c target-ppc: Implement bcd_is_valid function 2017-01-31 10:10:13 +11:00
internal.h target-ppc: move ppc_vsr_t to common header 2017-01-31 10:10:13 +11:00
kvm-stub.c
kvm.c ppc: Rename cpu_version to compat_pvr 2017-01-31 10:10:13 +11:00
kvm_ppc.h ppc: Rename cpu_version to compat_pvr 2017-01-31 10:10:13 +11:00
machine.c migration: extend VMStateInfo 2017-01-24 17:54:47 +00:00
Makefile.objs ppc: Rewrite ppc_set_compat() 2017-01-31 10:10:13 +11:00
mem_helper.c target-ppc: implement stxvll instructions 2017-01-31 10:10:13 +11:00
mfrom_table.c
mfrom_table_gen.c
misc_helper.c cputlb: drop flush_global flag from tlb_flush 2017-01-13 14:24:37 +00:00
mmu-hash32.c
mmu-hash32.h
mmu-hash64.c kvm: move cpu synchronization code 2017-01-19 22:07:46 +01:00
mmu-hash64.h
mmu_helper.c cputlb: drop flush_global flag from tlb_flush 2017-01-13 14:24:37 +00:00
monitor.c
STATUS
timebase_helper.c
trace-events
translate.c target-ppc: implement stop instruction 2017-01-31 10:10:13 +11:00
translate_init.c ppc: Rewrite ppc_get_compat_smt_threads() 2017-01-31 10:10:13 +11:00
user_only_helper.c