diff options
author | Anthony Liguori <aliguori@us.ibm.com> | 2013-06-19 15:40:30 -0500 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2013-07-01 01:11:16 +0200 |
commit | 210b580b106fa798149e28aa13c66b325a43204e (patch) | |
tree | ec7bc9e868e6f622dadebe8633f5b60da0c33de4 | |
parent | 159f8286b760deace1008f5f68a46cadba337780 (diff) |
spapr-rtas: add CPU argument to RTAS calls
RTAS is a hypervisor provided binary blob that a guest loads and
calls into to execute certain functions. It's similar to the
vsyscall page in Linux or the short lived VMCI paravirt interface
from VMware.
The QEMU implementation of the RTAS blob is simply a passthrough
that proxies all RTAS calls to the hypervisor via an hypercall.
While we pass a CPU argument for hypercall handling in QEMU, we
don't pass it for RTAS calls. Since some RTAs calls require
making hypercalls (normally RTAS is implemented as guest code) we
have nasty hacks to allow that.
Add a CPU argument to RTAS call handling so we can more easily
invoke hypercalls just as guest code would.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
-rw-r--r-- | hw/nvram/spapr_nvram.c | 4 | ||||
-rw-r--r-- | hw/ppc/spapr_events.c | 2 | ||||
-rw-r--r-- | hw/ppc/spapr_hcall.c | 2 | ||||
-rw-r--r-- | hw/ppc/spapr_pci.c | 13 | ||||
-rw-r--r-- | hw/ppc/spapr_rtas.c | 21 | ||||
-rw-r--r-- | hw/ppc/spapr_vio.c | 6 | ||||
-rw-r--r-- | hw/ppc/xics.c | 12 | ||||
-rw-r--r-- | include/hw/ppc/spapr.h | 5 |
8 files changed, 37 insertions, 28 deletions
diff --git a/hw/nvram/spapr_nvram.c b/hw/nvram/spapr_nvram.c index 1eb05c9075..eb4500e26f 100644 --- a/hw/nvram/spapr_nvram.c +++ b/hw/nvram/spapr_nvram.c @@ -44,7 +44,7 @@ typedef struct sPAPRNVRAM { #define DEFAULT_NVRAM_SIZE 65536 #define MAX_NVRAM_SIZE (UINT16_MAX * 16) -static void rtas_nvram_fetch(sPAPREnvironment *spapr, +static void rtas_nvram_fetch(PowerPCCPU *cpu, sPAPREnvironment *spapr, uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) @@ -91,7 +91,7 @@ static void rtas_nvram_fetch(sPAPREnvironment *spapr, rtas_st(rets, 1, (alen < 0) ? 0 : alen); } -static void rtas_nvram_store(sPAPREnvironment *spapr, +static void rtas_nvram_store(PowerPCCPU *cpu, sPAPREnvironment *spapr, uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) diff --git a/hw/ppc/spapr_events.c b/hw/ppc/spapr_events.c index c0d7e62f32..a69390e54e 100644 --- a/hw/ppc/spapr_events.c +++ b/hw/ppc/spapr_events.c @@ -277,7 +277,7 @@ static void spapr_powerdown_req(Notifier *n, void *opaque) qemu_irq_pulse(xics_get_qirq(spapr->icp, spapr->epow_irq)); } -static void check_exception(sPAPREnvironment *spapr, +static void check_exception(PowerPCCPU *cpu, sPAPREnvironment *spapr, uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c index 8f0b7e8076..e6f321d538 100644 --- a/hw/ppc/spapr_hcall.c +++ b/hw/ppc/spapr_hcall.c @@ -525,7 +525,7 @@ static target_ulong h_rtas(PowerPCCPU *cpu, sPAPREnvironment *spapr, uint32_t nargs = ldl_be_phys(rtas_r3 + 4); uint32_t nret = ldl_be_phys(rtas_r3 + 8); - return spapr_rtas_call(spapr, token, nargs, rtas_r3 + 12, + return spapr_rtas_call(cpu, spapr, token, nargs, rtas_r3 + 12, nret, rtas_r3 + 12 + 4*nargs); } diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index 04e836257c..c8c12c8241 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -119,7 +119,7 @@ static void finish_read_pci_config(sPAPREnvironment *spapr, uint64_t buid, rtas_st(rets, 1, val); } -static void rtas_ibm_read_pci_config(sPAPREnvironment *spapr, +static void rtas_ibm_read_pci_config(PowerPCCPU *cpu, sPAPREnvironment *spapr, uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) @@ -139,7 +139,7 @@ static void rtas_ibm_read_pci_config(sPAPREnvironment *spapr, finish_read_pci_config(spapr, buid, addr, size, rets); } -static void rtas_read_pci_config(sPAPREnvironment *spapr, +static void rtas_read_pci_config(PowerPCCPU *cpu, sPAPREnvironment *spapr, uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) @@ -185,7 +185,7 @@ static void finish_write_pci_config(sPAPREnvironment *spapr, uint64_t buid, rtas_st(rets, 0, 0); } -static void rtas_ibm_write_pci_config(sPAPREnvironment *spapr, +static void rtas_ibm_write_pci_config(PowerPCCPU *cpu, sPAPREnvironment *spapr, uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) @@ -206,7 +206,7 @@ static void rtas_ibm_write_pci_config(sPAPREnvironment *spapr, finish_write_pci_config(spapr, buid, addr, size, val, rets); } -static void rtas_write_pci_config(sPAPREnvironment *spapr, +static void rtas_write_pci_config(PowerPCCPU *cpu, sPAPREnvironment *spapr, uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) @@ -277,7 +277,7 @@ static void spapr_msi_setmsg(PCIDevice *pdev, hwaddr addr, } } -static void rtas_ibm_change_msi(sPAPREnvironment *spapr, +static void rtas_ibm_change_msi(PowerPCCPU *cpu, sPAPREnvironment *spapr, uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) @@ -374,7 +374,8 @@ static void rtas_ibm_change_msi(sPAPREnvironment *spapr, trace_spapr_pci_rtas_ibm_change_msi(func, req_num); } -static void rtas_ibm_query_interrupt_source_number(sPAPREnvironment *spapr, +static void rtas_ibm_query_interrupt_source_number(PowerPCCPU *cpu, + sPAPREnvironment *spapr, uint32_t token, uint32_t nargs, target_ulong args, diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c index 42ed7dc093..394ce05ba2 100644 --- a/hw/ppc/spapr_rtas.c +++ b/hw/ppc/spapr_rtas.c @@ -38,7 +38,7 @@ #define TOKEN_BASE 0x2000 #define TOKEN_MAX 0x100 -static void rtas_display_character(sPAPREnvironment *spapr, +static void rtas_display_character(PowerPCCPU *cpu, sPAPREnvironment *spapr, uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) @@ -54,7 +54,7 @@ static void rtas_display_character(sPAPREnvironment *spapr, } } -static void rtas_get_time_of_day(sPAPREnvironment *spapr, +static void rtas_get_time_of_day(PowerPCCPU *cpu, sPAPREnvironment *spapr, uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) @@ -78,7 +78,7 @@ static void rtas_get_time_of_day(sPAPREnvironment *spapr, rtas_st(rets, 7, 0); /* we don't do nanoseconds */ } -static void rtas_set_time_of_day(sPAPREnvironment *spapr, +static void rtas_set_time_of_day(PowerPCCPU *cpu, sPAPREnvironment *spapr, uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) @@ -99,7 +99,7 @@ static void rtas_set_time_of_day(sPAPREnvironment *spapr, rtas_st(rets, 0, 0); /* Success */ } -static void rtas_power_off(sPAPREnvironment *spapr, +static void rtas_power_off(PowerPCCPU *cpu, sPAPREnvironment *spapr, uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) { @@ -111,7 +111,7 @@ static void rtas_power_off(sPAPREnvironment *spapr, rtas_st(rets, 0, 0); } -static void rtas_system_reboot(sPAPREnvironment *spapr, +static void rtas_system_reboot(PowerPCCPU *cpu, sPAPREnvironment *spapr, uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) @@ -124,7 +124,8 @@ static void rtas_system_reboot(sPAPREnvironment *spapr, rtas_st(rets, 0, 0); } -static void rtas_query_cpu_stopped_state(sPAPREnvironment *spapr, +static void rtas_query_cpu_stopped_state(PowerPCCPU *cpu_, + sPAPREnvironment *spapr, uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) @@ -154,7 +155,7 @@ static void rtas_query_cpu_stopped_state(sPAPREnvironment *spapr, rtas_st(rets, 0, -3); } -static void rtas_start_cpu(sPAPREnvironment *spapr, +static void rtas_start_cpu(PowerPCCPU *cpu_, sPAPREnvironment *spapr, uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) @@ -208,7 +209,7 @@ static struct rtas_call { struct rtas_call *rtas_next = rtas_table; -target_ulong spapr_rtas_call(sPAPREnvironment *spapr, +target_ulong spapr_rtas_call(PowerPCCPU *cpu, sPAPREnvironment *spapr, uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) { @@ -217,7 +218,7 @@ target_ulong spapr_rtas_call(sPAPREnvironment *spapr, struct rtas_call *call = rtas_table + (token - TOKEN_BASE); if (call->fn) { - call->fn(spapr, token, nargs, args, nret, rets); + call->fn(cpu, spapr, token, nargs, args, nret, rets); return H_SUCCESS; } } @@ -227,7 +228,7 @@ target_ulong spapr_rtas_call(sPAPREnvironment *spapr, * machines) without looking it up in the device tree. This * special case makes this work */ if (token == 0xa) { - rtas_display_character(spapr, 0xa, nargs, args, nret, rets); + rtas_display_character(cpu, spapr, 0xa, nargs, args, nret, rets); return H_SUCCESS; } diff --git a/hw/ppc/spapr_vio.c b/hw/ppc/spapr_vio.c index 3c5a655ad7..9c18741cea 100644 --- a/hw/ppc/spapr_vio.c +++ b/hw/ppc/spapr_vio.c @@ -321,7 +321,8 @@ static void spapr_vio_quiesce_one(VIOsPAPRDevice *dev) free_crq(dev); } -static void rtas_set_tce_bypass(sPAPREnvironment *spapr, uint32_t token, +static void rtas_set_tce_bypass(PowerPCCPU *cpu, sPAPREnvironment *spapr, + uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) { @@ -351,7 +352,8 @@ static void rtas_set_tce_bypass(sPAPREnvironment *spapr, uint32_t token, rtas_st(rets, 0, 0); } -static void rtas_quiesce(sPAPREnvironment *spapr, uint32_t token, +static void rtas_quiesce(PowerPCCPU *cpu, sPAPREnvironment *spapr, + uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) { diff --git a/hw/ppc/xics.c b/hw/ppc/xics.c index 1b25075d14..091912e2ca 100644 --- a/hw/ppc/xics.c +++ b/hw/ppc/xics.c @@ -400,7 +400,8 @@ static target_ulong h_eoi(PowerPCCPU *cpu, sPAPREnvironment *spapr, return H_SUCCESS; } -static void rtas_set_xive(sPAPREnvironment *spapr, uint32_t token, +static void rtas_set_xive(PowerPCCPU *cpu, sPAPREnvironment *spapr, + uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) { @@ -427,7 +428,8 @@ static void rtas_set_xive(sPAPREnvironment *spapr, uint32_t token, rtas_st(rets, 0, 0); /* Success */ } -static void rtas_get_xive(sPAPREnvironment *spapr, uint32_t token, +static void rtas_get_xive(PowerPCCPU *cpu, sPAPREnvironment *spapr, + uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) { @@ -451,7 +453,8 @@ static void rtas_get_xive(sPAPREnvironment *spapr, uint32_t token, rtas_st(rets, 2, ics->irqs[nr - ics->offset].priority); } -static void rtas_int_off(sPAPREnvironment *spapr, uint32_t token, +static void rtas_int_off(PowerPCCPU *cpu, sPAPREnvironment *spapr, + uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) { @@ -476,7 +479,8 @@ static void rtas_int_off(sPAPREnvironment *spapr, uint32_t token, rtas_st(rets, 0, 0); /* Success */ } -static void rtas_int_on(sPAPREnvironment *spapr, uint32_t token, +static void rtas_int_on(PowerPCCPU *cpu, sPAPREnvironment *spapr, + uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) { diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index a83720ee65..09c4570982 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -319,11 +319,12 @@ static inline void rtas_st(target_ulong phys, int n, uint32_t val) stl_be_phys(phys + 4*n, val); } -typedef void (*spapr_rtas_fn)(sPAPREnvironment *spapr, uint32_t token, +typedef void (*spapr_rtas_fn)(PowerPCCPU *cpu, sPAPREnvironment *spapr, + uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets); int spapr_rtas_register(const char *name, spapr_rtas_fn fn); -target_ulong spapr_rtas_call(sPAPREnvironment *spapr, +target_ulong spapr_rtas_call(PowerPCCPU *cpu, sPAPREnvironment *spapr, uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets); int spapr_rtas_device_tree_setup(void *fdt, hwaddr rtas_addr, |