From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=40231 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pzu6C-0003ip-Ha for qemu-devel@nongnu.org; Wed, 16 Mar 2011 13:01:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pzu68-0001Zi-I3 for qemu-devel@nongnu.org; Wed, 16 Mar 2011 13:01:26 -0400 Received: from mail-yx0-f173.google.com ([209.85.213.173]:43332) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pzu68-0001Zd-Dn for qemu-devel@nongnu.org; Wed, 16 Mar 2011 13:01:24 -0400 Received: by yxk8 with SMTP id 8so891927yxk.4 for ; Wed, 16 Mar 2011 10:01:23 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <4D80BF4F.8030406@suse.de> References: <1300251423-6715-1-git-send-email-david@gibson.dropbear.id.au> <1300251423-6715-4-git-send-email-david@gibson.dropbear.id.au> <4D80BF4F.8030406@suse.de> Date: Wed, 16 Mar 2011 16:58:41 +0000 Message-ID: Subject: Re: [Qemu-devel] Re: [PATCH 03/26] Add a hook to allow hypercalls to be emulated on PowerPC From: Stefan Hajnoczi Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: David Gibson Cc: Alexander Graf , paulus@samba.org, qemu-devel@nongnu.org, anton@samba.org On Wed, Mar 16, 2011 at 1:46 PM, Alexander Graf wrote: > On 03/16/2011 05:56 AM, David Gibson wrote: >> >> From: David Gibson >> >> PowerPC and POWER chips since the POWER4 and 970 have a special >> hypervisor mode, and a corresponding form of the system call >> instruction which traps to the hypervisor. >> >> qemu currently has stub implementations of hypervisor mode. =A0That >> is, the outline is there to allow qemu to run a PowerPC hypervisor >> under emulation. =A0There are a number of details missing so this >> won't actually work at present, but the idea is there. >> >> What there is no provision at all, is for qemu to instead emulate >> the hypervisor itself. =A0That is to have hypercalls trap into qemu >> and their result be emulated from qemu, rather than running >> hypervisor code within the emulated system. >> >> Hypervisor hardware aware KVM implementations are in the works and >> it would =A0be useful for debugging and development to also allow >> full emulation of the same para-virtualized guests as such a KVM. >> >> Therefore, this patch adds a hook which will allow a machine to >> set up emulation of hypervisor calls. >> >> Signed-off-by: David Gibson >> --- >> =A0target-ppc/cpu.h =A0 =A0| =A0 =A02 ++ >> =A0target-ppc/helper.c | =A0 =A04 ++++ >> =A02 files changed, 6 insertions(+), 0 deletions(-) >> >> diff --git a/target-ppc/cpu.h b/target-ppc/cpu.h >> index a20c132..eaddc27 100644 >> --- a/target-ppc/cpu.h >> +++ b/target-ppc/cpu.h >> @@ -692,6 +692,8 @@ struct CPUPPCState { >> =A0 =A0 =A0int bfd_mach; >> =A0 =A0 =A0uint32_t flags; >> =A0 =A0 =A0uint64_t insns_flags; >> + =A0 =A0void (*emulate_hypercall)(CPUState *, void *); >> + =A0 =A0void *hcall_opaque; >> >> =A0 =A0 =A0int error_code; >> =A0 =A0 =A0uint32_t pending_interrupts; >> diff --git a/target-ppc/helper.c b/target-ppc/helper.c >> index 2094ca3..19aa067 100644 >> --- a/target-ppc/helper.c >> +++ b/target-ppc/helper.c >> @@ -2152,6 +2152,10 @@ static inline void powerpc_excp(CPUState *env, in= t >> excp_model, int excp) >> =A0 =A0 =A0case POWERPC_EXCP_SYSCALL: =A0 /* System call exception >> =A0 =A0*/ >> =A0 =A0 =A0 =A0 =A0dump_syscall(env); >> =A0 =A0 =A0 =A0 =A0lev =3D env->error_code; >> + =A0 =A0 =A0 if ((lev =3D=3D 1)&& =A0env->emulate_hypercall) { >> + =A0 =A0 =A0 =A0 =A0 env->emulate_hypercall(env, env->hcall_opaque); >> + =A0 =A0 =A0 =A0 =A0 return; >> + =A0 =A0 =A0 } > > Tabs! Please go through all your patches and make sure there are no tabs = in > there :(. scripts/checkpatch.pl is there to automate style checking. That's the easiest way to check patches before submitting them. Stefan