From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:45454) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SX1x0-0001F7-Ev for qemu-devel@nongnu.org; Tue, 22 May 2012 23:09:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SX1wq-0005mM-Gw for qemu-devel@nongnu.org; Tue, 22 May 2012 23:09:25 -0400 Received: from cantor2.suse.de ([195.135.220.15]:35620 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SX1wq-0005kz-0F for qemu-devel@nongnu.org; Tue, 22 May 2012 23:09:16 -0400 Received: from relay2.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id EF53997719 for ; Wed, 23 May 2012 05:09:14 +0200 (CEST) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Wed, 23 May 2012 05:08:04 +0200 Message-Id: <1337742502-28565-42-git-send-email-afaerber@suse.de> In-Reply-To: <1337742502-28565-1-git-send-email-afaerber@suse.de> References: <1337742502-28565-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH qom-next 41/59] spapr: Pass PowerPCCPU to hypercalls List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Andreas=20F=C3=A4rber?= Needed for cpu_has_work() in h_cede(). Signed-off-by: Andreas F=C3=A4rber --- hw/spapr.h | 2 +- hw/spapr_hcall.c | 34 ++++++++++++++++++++-------------- hw/spapr_llan.c | 10 +++++----- hw/spapr_vio.c | 12 ++++++------ hw/spapr_vty.c | 4 ++-- hw/xics.c | 11 +++++++---- 6 files changed, 41 insertions(+), 32 deletions(-) diff --git a/hw/spapr.h b/hw/spapr.h index ad901ae..25aa40c 100644 --- a/hw/spapr.h +++ b/hw/spapr.h @@ -278,7 +278,7 @@ extern sPAPREnvironment *spapr; do { } while (0) #endif =20 -typedef target_ulong (*spapr_hcall_fn)(CPUPPCState *env, sPAPREnvironmen= t *spapr, +typedef target_ulong (*spapr_hcall_fn)(PowerPCCPU *cpu, sPAPREnvironment= *spapr, target_ulong opcode, target_ulong *args); =20 diff --git a/hw/spapr_hcall.c b/hw/spapr_hcall.c index 5d39316..47fca58 100644 --- a/hw/spapr_hcall.c +++ b/hw/spapr_hcall.c @@ -92,9 +92,10 @@ static target_ulong compute_tlbie_rb(target_ulong v, t= arget_ulong r, return rb; } =20 -static target_ulong h_enter(CPUPPCState *env, sPAPREnvironment *spapr, +static target_ulong h_enter(PowerPCCPU *cpu, sPAPREnvironment *spapr, target_ulong opcode, target_ulong *args) { + CPUPPCState *env =3D &cpu->env; target_ulong flags =3D args[0]; target_ulong pte_index =3D args[1]; target_ulong pteh =3D args[2]; @@ -219,9 +220,10 @@ static target_ulong remove_hpte(CPUPPCState *env, ta= rget_ulong ptex, return REMOVE_SUCCESS; } =20 -static target_ulong h_remove(CPUPPCState *env, sPAPREnvironment *spapr, +static target_ulong h_remove(PowerPCCPU *cpu, sPAPREnvironment *spapr, target_ulong opcode, target_ulong *args) { + CPUPPCState *env =3D &cpu->env; target_ulong flags =3D args[0]; target_ulong pte_index =3D args[1]; target_ulong avpn =3D args[2]; @@ -265,9 +267,10 @@ static target_ulong h_remove(CPUPPCState *env, sPAPR= Environment *spapr, =20 #define H_BULK_REMOVE_MAX_BATCH 4 =20 -static target_ulong h_bulk_remove(CPUPPCState *env, sPAPREnvironment *sp= apr, +static target_ulong h_bulk_remove(PowerPCCPU *cpu, sPAPREnvironment *spa= pr, target_ulong opcode, target_ulong *arg= s) { + CPUPPCState *env =3D &cpu->env; int i; =20 for (i =3D 0; i < H_BULK_REMOVE_MAX_BATCH; i++) { @@ -311,9 +314,10 @@ static target_ulong h_bulk_remove(CPUPPCState *env, = sPAPREnvironment *spapr, return H_SUCCESS; } =20 -static target_ulong h_protect(CPUPPCState *env, sPAPREnvironment *spapr, +static target_ulong h_protect(PowerPCCPU *cpu, sPAPREnvironment *spapr, target_ulong opcode, target_ulong *args) { + CPUPPCState *env =3D &cpu->env; target_ulong flags =3D args[0]; target_ulong pte_index =3D args[1]; target_ulong avpn =3D args[2]; @@ -356,7 +360,7 @@ static target_ulong h_protect(CPUPPCState *env, sPAPR= Environment *spapr, return H_SUCCESS; } =20 -static target_ulong h_set_dabr(CPUPPCState *env, sPAPREnvironment *spapr= , +static target_ulong h_set_dabr(PowerPCCPU *cpu, sPAPREnvironment *spapr, target_ulong opcode, target_ulong *args) { /* FIXME: actually implement this */ @@ -490,7 +494,7 @@ static target_ulong deregister_dtl(CPUPPCState *env, = target_ulong addr) return H_SUCCESS; } =20 -static target_ulong h_register_vpa(CPUPPCState *env, sPAPREnvironment *s= papr, +static target_ulong h_register_vpa(PowerPCCPU *cpu, sPAPREnvironment *sp= apr, target_ulong opcode, target_ulong *ar= gs) { target_ulong flags =3D args[0]; @@ -538,9 +542,11 @@ static target_ulong h_register_vpa(CPUPPCState *env,= sPAPREnvironment *spapr, return ret; } =20 -static target_ulong h_cede(CPUPPCState *env, sPAPREnvironment *spapr, +static target_ulong h_cede(PowerPCCPU *cpu, sPAPREnvironment *spapr, target_ulong opcode, target_ulong *args) { + CPUPPCState *env =3D &cpu->env; + env->msr |=3D (1ULL << MSR_EE); hreg_compute_hflags(env); if (!cpu_has_work(env)) { @@ -549,7 +555,7 @@ static target_ulong h_cede(CPUPPCState *env, sPAPREnv= ironment *spapr, return H_SUCCESS; } =20 -static target_ulong h_rtas(CPUPPCState *env, sPAPREnvironment *spapr, +static target_ulong h_rtas(PowerPCCPU *cpu, sPAPREnvironment *spapr, target_ulong opcode, target_ulong *args) { target_ulong rtas_r3 =3D args[0]; @@ -561,7 +567,7 @@ static target_ulong h_rtas(CPUPPCState *env, sPAPREnv= ironment *spapr, nret, rtas_r3 + 12 + 4*nargs); } =20 -static target_ulong h_logical_load(CPUPPCState *env, sPAPREnvironment *s= papr, +static target_ulong h_logical_load(PowerPCCPU *cpu, sPAPREnvironment *sp= apr, target_ulong opcode, target_ulong *ar= gs) { target_ulong size =3D args[0]; @@ -584,7 +590,7 @@ static target_ulong h_logical_load(CPUPPCState *env, = sPAPREnvironment *spapr, return H_PARAMETER; } =20 -static target_ulong h_logical_store(CPUPPCState *env, sPAPREnvironment *= spapr, +static target_ulong h_logical_store(PowerPCCPU *cpu, sPAPREnvironment *s= papr, target_ulong opcode, target_ulong *a= rgs) { target_ulong size =3D args[0]; @@ -608,14 +614,14 @@ static target_ulong h_logical_store(CPUPPCState *en= v, sPAPREnvironment *spapr, return H_PARAMETER; } =20 -static target_ulong h_logical_icbi(CPUPPCState *env, sPAPREnvironment *s= papr, +static target_ulong h_logical_icbi(PowerPCCPU *cpu, sPAPREnvironment *sp= apr, target_ulong opcode, target_ulong *ar= gs) { /* Nothing to do on emulation, KVM will trap this in the kernel */ return H_SUCCESS; } =20 -static target_ulong h_logical_dcbf(CPUPPCState *env, sPAPREnvironment *s= papr, +static target_ulong h_logical_dcbf(PowerPCCPU *cpu, sPAPREnvironment *sp= apr, target_ulong opcode, target_ulong *ar= gs) { /* Nothing to do on emulation, KVM will trap this in the kernel */ @@ -659,14 +665,14 @@ target_ulong spapr_hypercall(PowerPCCPU *cpu, targe= t_ulong opcode, spapr_hcall_fn fn =3D papr_hypercall_table[opcode / 4]; =20 if (fn) { - return fn(env, spapr, opcode, args); + return fn(cpu, spapr, opcode, args); } } else if ((opcode >=3D KVMPPC_HCALL_BASE) && (opcode <=3D KVMPPC_HCALL_MAX)) { spapr_hcall_fn fn =3D kvmppc_hypercall_table[opcode - KVMPPC_HCA= LL_BASE]; =20 if (fn) { - return fn(env, spapr, opcode, args); + return fn(cpu, spapr, opcode, args); } } =20 diff --git a/hw/spapr_llan.c b/hw/spapr_llan.c index 8313043..0d31147 100644 --- a/hw/spapr_llan.c +++ b/hw/spapr_llan.c @@ -262,7 +262,7 @@ static int check_bd(VIOsPAPRVLANDevice *dev, vlan_bd_= t bd, return 0; } =20 -static target_ulong h_register_logical_lan(CPUPPCState *env, +static target_ulong h_register_logical_lan(PowerPCCPU *cpu, sPAPREnvironment *spapr, target_ulong opcode, target_ulong *args) @@ -326,7 +326,7 @@ static target_ulong h_register_logical_lan(CPUPPCStat= e *env, } =20 =20 -static target_ulong h_free_logical_lan(CPUPPCState *env, sPAPREnvironmen= t *spapr, +static target_ulong h_free_logical_lan(PowerPCCPU *cpu, sPAPREnvironment= *spapr, target_ulong opcode, target_ulong= *args) { target_ulong reg =3D args[0]; @@ -347,7 +347,7 @@ static target_ulong h_free_logical_lan(CPUPPCState *e= nv, sPAPREnvironment *spapr return H_SUCCESS; } =20 -static target_ulong h_add_logical_lan_buffer(CPUPPCState *env, +static target_ulong h_add_logical_lan_buffer(PowerPCCPU *cpu, sPAPREnvironment *spapr, target_ulong opcode, target_ulong *args) @@ -396,7 +396,7 @@ static target_ulong h_add_logical_lan_buffer(CPUPPCSt= ate *env, return H_SUCCESS; } =20 -static target_ulong h_send_logical_lan(CPUPPCState *env, sPAPREnvironmen= t *spapr, +static target_ulong h_send_logical_lan(PowerPCCPU *cpu, sPAPREnvironment= *spapr, target_ulong opcode, target_ulong= *args) { target_ulong reg =3D args[0]; @@ -465,7 +465,7 @@ static target_ulong h_send_logical_lan(CPUPPCState *e= nv, sPAPREnvironment *spapr return H_SUCCESS; } =20 -static target_ulong h_multicast_ctrl(CPUPPCState *env, sPAPREnvironment = *spapr, +static target_ulong h_multicast_ctrl(PowerPCCPU *cpu, sPAPREnvironment *= spapr, target_ulong opcode, target_ulong *= args) { target_ulong reg =3D args[0]; diff --git a/hw/spapr_vio.c b/hw/spapr_vio.c index 315ab80..94de609 100644 --- a/hw/spapr_vio.c +++ b/hw/spapr_vio.c @@ -194,7 +194,7 @@ static void rtce_init(VIOsPAPRDevice *dev) } } =20 -static target_ulong h_put_tce(CPUPPCState *env, sPAPREnvironment *spapr, +static target_ulong h_put_tce(PowerPCCPU *cpu, sPAPREnvironment *spapr, target_ulong opcode, target_ulong *args) { target_ulong liobn =3D args[0]; @@ -403,7 +403,7 @@ uint64_t ldq_tce(VIOsPAPRDevice *dev, uint64_t taddr) /* * CRQ handling */ -static target_ulong h_reg_crq(CPUPPCState *env, sPAPREnvironment *spapr, +static target_ulong h_reg_crq(PowerPCCPU *cpu, sPAPREnvironment *spapr, target_ulong opcode, target_ulong *args) { target_ulong reg =3D args[0]; @@ -461,7 +461,7 @@ static target_ulong free_crq(VIOsPAPRDevice *dev) return H_SUCCESS; } =20 -static target_ulong h_free_crq(CPUPPCState *env, sPAPREnvironment *spapr= , +static target_ulong h_free_crq(PowerPCCPU *cpu, sPAPREnvironment *spapr, target_ulong opcode, target_ulong *args) { target_ulong reg =3D args[0]; @@ -475,7 +475,7 @@ static target_ulong h_free_crq(CPUPPCState *env, sPAP= REnvironment *spapr, return free_crq(dev); } =20 -static target_ulong h_send_crq(CPUPPCState *env, sPAPREnvironment *spapr= , +static target_ulong h_send_crq(PowerPCCPU *cpu, sPAPREnvironment *spapr, target_ulong opcode, target_ulong *args) { target_ulong reg =3D args[0]; @@ -498,7 +498,7 @@ static target_ulong h_send_crq(CPUPPCState *env, sPAP= REnvironment *spapr, return H_HARDWARE; } =20 -static target_ulong h_enable_crq(CPUPPCState *env, sPAPREnvironment *spa= pr, +static target_ulong h_enable_crq(PowerPCCPU *cpu, sPAPREnvironment *spap= r, target_ulong opcode, target_ulong *args= ) { target_ulong reg =3D args[0]; @@ -706,7 +706,7 @@ static int spapr_vio_busdev_init(DeviceState *qdev) return pc->init(dev); } =20 -static target_ulong h_vio_signal(CPUPPCState *env, sPAPREnvironment *spa= pr, +static target_ulong h_vio_signal(PowerPCCPU *cpu, sPAPREnvironment *spap= r, target_ulong opcode, target_ulong *args) { diff --git a/hw/spapr_vty.c b/hw/spapr_vty.c index c9674f3..700283e 100644 --- a/hw/spapr_vty.c +++ b/hw/spapr_vty.c @@ -70,7 +70,7 @@ static int spapr_vty_init(VIOsPAPRDevice *sdev) } =20 /* Forward declaration */ -static target_ulong h_put_term_char(CPUPPCState *env, sPAPREnvironment *= spapr, +static target_ulong h_put_term_char(PowerPCCPU *cpu, sPAPREnvironment *s= papr, target_ulong opcode, target_ulong *a= rgs) { target_ulong reg =3D args[0]; @@ -97,7 +97,7 @@ static target_ulong h_put_term_char(CPUPPCState *env, s= PAPREnvironment *spapr, return H_SUCCESS; } =20 -static target_ulong h_get_term_char(CPUPPCState *env, sPAPREnvironment *= spapr, +static target_ulong h_get_term_char(PowerPCCPU *cpu, sPAPREnvironment *s= papr, target_ulong opcode, target_ulong *a= rgs) { target_ulong reg =3D args[0]; diff --git a/hw/xics.c b/hw/xics.c index 668a0d6..67782c0 100644 --- a/hw/xics.c +++ b/hw/xics.c @@ -329,16 +329,17 @@ qemu_irq xics_assign_irq(struct icp_state *icp, int= irq, return icp->ics->qirqs[irq - icp->ics->offset]; } =20 -static target_ulong h_cppr(CPUPPCState *env, sPAPREnvironment *spapr, +static target_ulong h_cppr(PowerPCCPU *cpu, sPAPREnvironment *spapr, target_ulong opcode, target_ulong *args) { + CPUPPCState *env =3D &cpu->env; target_ulong cppr =3D args[0]; =20 icp_set_cppr(spapr->icp, env->cpu_index, cppr); return H_SUCCESS; } =20 -static target_ulong h_ipi(CPUPPCState *env, sPAPREnvironment *spapr, +static target_ulong h_ipi(PowerPCCPU *cpu, sPAPREnvironment *spapr, target_ulong opcode, target_ulong *args) { target_ulong server =3D args[0]; @@ -353,18 +354,20 @@ static target_ulong h_ipi(CPUPPCState *env, sPAPREn= vironment *spapr, =20 } =20 -static target_ulong h_xirr(CPUPPCState *env, sPAPREnvironment *spapr, +static target_ulong h_xirr(PowerPCCPU *cpu, sPAPREnvironment *spapr, target_ulong opcode, target_ulong *args) { + CPUPPCState *env =3D &cpu->env; uint32_t xirr =3D icp_accept(spapr->icp->ss + env->cpu_index); =20 args[0] =3D xirr; return H_SUCCESS; } =20 -static target_ulong h_eoi(CPUPPCState *env, sPAPREnvironment *spapr, +static target_ulong h_eoi(PowerPCCPU *cpu, sPAPREnvironment *spapr, target_ulong opcode, target_ulong *args) { + CPUPPCState *env =3D &cpu->env; target_ulong xirr =3D args[0]; =20 icp_eoi(spapr->icp, env->cpu_index, xirr); --=20 1.7.7