From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59338) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTlR8-0006Dy-1M for qemu-devel@nongnu.org; Thu, 11 Feb 2016 02:13:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aTlR4-0001jn-Ri for qemu-devel@nongnu.org; Thu, 11 Feb 2016 02:13:09 -0500 References: <1455127752-17293-1-git-send-email-thuth@redhat.com> <1455127752-17293-2-git-send-email-thuth@redhat.com> <20160210233020.GE29288@voom.bne.redhat.com> From: Thomas Huth Message-ID: <56BC3476.6090700@redhat.com> Date: Thu, 11 Feb 2016 08:12:54 +0100 MIME-Version: 1.0 In-Reply-To: <20160210233020.GE29288@voom.bne.redhat.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="sMt3gEksUh8CjIwit6NnNFJgSSWRoJior" Subject: Re: [Qemu-devel] [PATCH 1/4] hw/ppc/spapr: Add h_set_sprg0 hypercall List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: David Gibson Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, laurent@vivier.eu This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --sMt3gEksUh8CjIwit6NnNFJgSSWRoJior Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 11.02.2016 00:30, David Gibson wrote: > On Wed, Feb 10, 2016 at 07:09:09PM +0100, Thomas Huth wrote: >> This is a very simple hypercall that only sets up the SPRG0 >> register for the guest (since writing to SPRG0 was only permitted >> to the hypervisor in older versions of the PowerISA). >> >> Signed-off-by: Thomas Huth >> --- >> hw/ppc/spapr_hcall.c | 15 +++++++++++++-- >> 1 file changed, 13 insertions(+), 2 deletions(-) >> >> diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c >> index 12f8c33..58103ef 100644 >> --- a/hw/ppc/spapr_hcall.c >> +++ b/hw/ppc/spapr_hcall.c >> @@ -332,6 +332,15 @@ static target_ulong h_read(PowerPCCPU *cpu, sPAPR= MachineState *spapr, >> return H_SUCCESS; >> } >> =20 >> +static target_ulong h_set_sprg0(PowerPCCPU *cpu, sPAPRMachineState *s= papr, >> + target_ulong opcode, target_ulong *ar= gs) >> +{ >> + CPUState *cs =3D CPU(cpu); >> + >> + set_spr(cs, SPR_SPRG0, args[0], -1L); >=20 > This looks correct, but I think set_spr() is serious overkill here. > It does some fancy synchronization designed for setting one cpu's SPR > from an hcall executed on a different CPU. In this case the calling > CPU is just setting its own SPRG0, so just > cpu_synchronize_state() > env->spr[SPR_SPRG0] =3D XXX >=20 > Should be sufficient. AFAIK the synchronization stuff is skipped when set_spr() runs already on the destination CPU, but ok, since h-calls should be fast, I can change this anyway to save some precious cycles. Thomas --sMt3gEksUh8CjIwit6NnNFJgSSWRoJior Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJWvDR+AAoJEC7Z13T+cC21xCgP/RRPkQIN6cms/CiBZW/Tus06 bQMSu1aELltooQhRqy8hBVFkMiNAdqcC3xPB5vfUWTmLWfxIGneAWZFFByovzojH uMStkB2Nbat6t+pUs13jrY2mFUiXIecNFFSYQapXCsjqHxGo1AX0ulg9ufNuJlsi 2Qe8AZk+JwgQnLqX6vTJ2ffb13xY2o0H+r+CmD7p/0cclACapmc3SNFDfmpx8Ju5 HKR3/nkXm0wKE+9k9O59E73rc0Baitm5+tHoPfnkMiw/xy9bNKgDW3L5QTFXiqsD 5r+ILdb4srlydFlp8NQWrIU2QahXaHThu1NVJlf8WkRyscgYmbu+ZMf6ZJNE4BQZ z7Ch9zfCdUfE94FKXPmtlo7UNSZARqhg4J4CW7m9MfQENSnRplFiEkHbsfqWGbLN HP2OFcfIM6N7KJJRoTtbkIsaWq10PEf5LtsBxYVY3ZA2xPeYYe6j1jDKmEYdSHBM G0ARmC9XHyQJCHLeHEW6w9i7ol+wRdsxwC8LVU97oI6UtGFicEoCWP/i1oCbLT5t UtTZsl21cxFpNGSyR5IovivGu5cV4lxhD/8j5RWIzjKbAjNORWMu5+UQm+n+YuMG NSQziA4Ody4KjVQfGtrQkJvHZjv3kjD7rMl2fnQC4t+t3gcM6e00kkSdcJM57+gO Eyoaz08yp7i9X+CW1SrM =bdud -----END PGP SIGNATURE----- --sMt3gEksUh8CjIwit6NnNFJgSSWRoJior--