ppc: Clean up and QOMify hypercall emulation
commit1d1be34d26b66069e20cbbcd798ea57763a0f152
authorDavid Gibson <david@gibson.dropbear.id.au>
Fri, 28 Oct 2016 11:06:21 +0000 (28 22:06 +1100)
committerDavid Gibson <david@gibson.dropbear.id.au>
Mon, 30 Jan 2017 23:10:13 +0000 (31 10:10 +1100)
tree1299adce01019ee3e3b757edb3a5e38e27a662c4
parent5b120785e70a9a48b43e3f1f156a10a015334a28
ppc: Clean up and QOMify hypercall emulation

The pseries machine type is a bit unusual in that it runs a paravirtualized
guest.  The guest expects to interact with a hypervisor, and qemu
emulates the functions of that hypervisor directly, rather than executing
hypervisor code within the emulated system.

To implement this in TCG, we need to intercept hypercall instructions and
direct them to the machine's hypercall handlers, rather than attempting to
perform a privilege change within TCG.  This is controlled by a global
hook - cpu_ppc_hypercall.

This cleanup makes the handling a little cleaner and more extensible than
a single global variable.  Instead, each CPU to have hypercalls intercepted
has a pointer set to a QOM object implementing a new virtual hypervisor
interface.  A method in that interface is called by TCG when it sees a
hypercall instruction.  It's possible we may want to add other methods in
future.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
hw/ppc/spapr.c
hw/ppc/spapr_cpu_core.c
target/ppc/cpu.h
target/ppc/excp_helper.c
target/ppc/translate_init.c