Patchwork [qom-next,40/59] spapr: Pass PowerPCCPU to spapr_hypercall()

login
register
mail settings
Submitter Andreas Färber
Date May 23, 2012, 3:08 a.m.
Message ID <1337742502-28565-41-git-send-email-afaerber@suse.de>
Download mbox | patch
Permalink /patch/160816/
State New
Headers show

Comments

Andreas Färber - May 23, 2012, 3:08 a.m.
Needed for the hypercall handlers.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/spapr.c       |    2 +-
 hw/spapr.h       |    2 +-
 hw/spapr_hcall.c |    4 +++-
 target-ppc/kvm.c |    3 ++-
 4 files changed, 7 insertions(+), 4 deletions(-)

Patch

diff --git a/hw/spapr.c b/hw/spapr.c
index 70068b4..f9c3631 100644
--- a/hw/spapr.c
+++ b/hw/spapr.c
@@ -481,7 +481,7 @@  static void emulate_spapr_hypercall(PowerPCCPU *cpu)
 {
     CPUPPCState *env = &cpu->env;
 
-    env->gpr[3] = spapr_hypercall(env, env->gpr[3], &env->gpr[4]);
+    env->gpr[3] = spapr_hypercall(cpu, env->gpr[3], &env->gpr[4]);
 }
 
 static void spapr_reset(void *opaque)
diff --git a/hw/spapr.h b/hw/spapr.h
index 654a7a8..ad901ae 100644
--- a/hw/spapr.h
+++ b/hw/spapr.h
@@ -283,7 +283,7 @@  typedef target_ulong (*spapr_hcall_fn)(CPUPPCState *env, sPAPREnvironment *spapr
                                        target_ulong *args);
 
 void spapr_register_hypercall(target_ulong opcode, spapr_hcall_fn fn);
-target_ulong spapr_hypercall(CPUPPCState *env, target_ulong opcode,
+target_ulong spapr_hypercall(PowerPCCPU *cpu, target_ulong opcode,
                              target_ulong *args);
 
 qemu_irq spapr_allocate_irq(uint32_t hint, uint32_t *irq_num,
diff --git a/hw/spapr_hcall.c b/hw/spapr_hcall.c
index 94bb504..5d39316 100644
--- a/hw/spapr_hcall.c
+++ b/hw/spapr_hcall.c
@@ -644,9 +644,11 @@  void spapr_register_hypercall(target_ulong opcode, spapr_hcall_fn fn)
     *slot = fn;
 }
 
-target_ulong spapr_hypercall(CPUPPCState *env, target_ulong opcode,
+target_ulong spapr_hypercall(PowerPCCPU *cpu, target_ulong opcode,
                              target_ulong *args)
 {
+    CPUPPCState *env = &cpu->env;
+
     if (msr_pr) {
         hcall_dprintf("Hypercall made with MSR[PR]=1\n");
         return H_PRIVILEGE;
diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index a5bdbef..148c095 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -559,7 +559,8 @@  int kvm_arch_handle_exit(CPUPPCState *env, struct kvm_run *run)
 #ifdef CONFIG_PSERIES
     case KVM_EXIT_PAPR_HCALL:
         dprintf("handle PAPR hypercall\n");
-        run->papr_hcall.ret = spapr_hypercall(env, run->papr_hcall.nr,
+        run->papr_hcall.ret = spapr_hypercall(ppc_env_get_cpu(env),
+                                              run->papr_hcall.nr,
                                               run->papr_hcall.args);
         ret = 1;
         break;