From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49980) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOKao-00027E-Nw for qemu-devel@nongnu.org; Wed, 27 Jan 2016 02:32:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aOKal-0003Qw-Ic for qemu-devel@nongnu.org; Wed, 27 Jan 2016 02:32:42 -0500 References: <1453698952-32092-1-git-send-email-david@gibson.dropbear.id.au> <1453698952-32092-4-git-send-email-david@gibson.dropbear.id.au> <56A6760B.2020300@suse.de> <20160127000414.GG16692@voom.fritz.box> From: Thomas Huth Message-ID: <56A87289.6000200@redhat.com> Date: Wed, 27 Jan 2016 08:32:25 +0100 MIME-Version: 1.0 In-Reply-To: <20160127000414.GG16692@voom.fritz.box> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="1A84eGmUNEX7pTmj65ipoupLl64JjpLvM" Subject: Re: [Qemu-devel] [PATCH 03/10] target-ppc: Rework ppc_store_slb List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: David Gibson , Alexander Graf Cc: aik@ozlabs.ru, qemu-ppc@nongnu.org, qemu-devel@nongnu.org, lvivier@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --1A84eGmUNEX7pTmj65ipoupLl64JjpLvM Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 27.01.2016 01:04, David Gibson wrote: > On Mon, Jan 25, 2016 at 08:22:51PM +0100, Alexander Graf wrote: >> >> >> On 01/25/2016 06:15 AM, David Gibson wrote: >>> ppc_store_slb updates the SLB for PPC cpus with 64-bit hash MMUs. >>> Currently it takes two parameters, which contain values encoded as th= e >>> register arguments to the slbmte instruction, one register contains t= he >>> ESID portion of the SLBE and also the slot number, the other contains= the >>> VSID portion of the SLBE. >>> >>> We're shortly going to want to do some SLB updates from other code wh= ere >>> it is more convenient to supply the slot number and ESID separately, = so >>> rework this function and its callers to work this way. >>> >>> As a bonus, this slightly simplifies the emulation of segment registe= rs for >>> when running a 32-bit OS on a 64-bit CPU. >>> >>> Signed-off-by: David Gibson >>> --- >>> target-ppc/kvm.c | 2 +- >>> target-ppc/mmu-hash64.c | 24 +++++++++++++----------- >>> target-ppc/mmu-hash64.h | 3 ++- >>> target-ppc/mmu_helper.c | 14 +++++--------- >>> 4 files changed, 21 insertions(+), 22 deletions(-) =2E.. >>> @@ -196,7 +198,7 @@ void helper_store_slb(CPUPPCState *env, target_ul= ong rb, target_ulong rs) >>> { >>> PowerPCCPU *cpu =3D ppc_env_get_cpu(env); >>> - if (ppc_store_slb(cpu, rb, rs) < 0) { >>> + if (ppc_store_slb(cpu, rb & 0xfff, rb & ~0xfff, rs) < 0) { >> >> This might truncate the esid to 32bits on 32bits hosts, no? Should be >> 0xfffULL instead. >=20 > Good point, nice catch. Are you sure that it is really needed? If I run the following test program on my 64-bit system: int main() { unsigned long long ll =3D -1ULL; printf("%llx %llx\n", ll, ll & ~0xfff); return 0; } Then I get this output: ffffffffffffffff fffffffffffff000 So it sounds like the value is sign-extended when it is cast to 64-bit. However, if you respin this patch series anyway, then maybe better add the ULL for clarity. Thomas --1A84eGmUNEX7pTmj65ipoupLl64JjpLvM 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) iQIcBAEBAgAGBQJWqHKOAAoJEC7Z13T+cC215N8QAKBKLKfxuRseliqy0Y+qYAcD OSjQRvuRaZ+TWXB4O6wu+zSBpnYJkdLXQS2Kd0Kko0+SmJQJc7+QAGcufRqv84n3 yy4uBwwWXQptu5fw2Que45qpWC1MnRXF1QEF/bSiP4KU+9azzUvPINFue1VVN67H o4YtofbOdBbAuYKbR8kc8nH0StmuQNJjBTPU5tf1qcQBDvrRuklEUJeMsbnXFgq/ 8Nscobb6zPdSrVxNa1S/8lcJefFHkMTdFJvOu/FIAxz66VGyxQTCIUQxr79qDwTB ItGCnJ6yBxY4ANzsHQTvUGN3CagW1+fKcaVG9EkuY378bN04OJXWkGdulM6m9r5b zN+K/ZXiF+EBXDNmlW7L5Wpe02irQNCJ9eT0eLyY6g3bwL4+UCNngZ7Zz4PmfS8a SWcZrqEGV0+8I9khyEGz0Txiyf9QO6Zc0RF1bdq2mj0QsEtsRC30VVTTX5lkbkc2 qxTX68tSkZ4N/GDZAo1rNm+pnlF97x7tVuuMm9KTWV77i7NjlpEIaA0JDEaSylef aFtlcvLvIz2Gq5RZevCWmf7EnRGfz5H40WYhGRcKt8kkmU9eYWS6Gfod0oPfj7lG 40rrrFQ6nMz53+YLI5o0LMF5tOC4fyD2UvK4UXb9i+zqrdp+SeqVYqdwwpcO5eGk iCtfT+tmzQh3KQYlMMvX =OA0E -----END PGP SIGNATURE----- --1A84eGmUNEX7pTmj65ipoupLl64JjpLvM--