From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55997) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YnDDn-000233-DI for qemu-devel@nongnu.org; Tue, 28 Apr 2015 17:39:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YnDDj-0007Vq-DD for qemu-devel@nongnu.org; Tue, 28 Apr 2015 17:39:15 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:41405 helo=imgpgp01.kl.imgtec.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YnDDj-0007Ve-4V for qemu-devel@nongnu.org; Tue, 28 Apr 2015 17:39:11 -0400 Date: Tue, 28 Apr 2015 22:39:08 +0100 From: James Hogan Message-ID: <20150428213908.GC22974@jhogan-linux.le.imgtec.org> References: <1430224874-18513-1-git-send-email-leon.alrae@imgtec.com> <1430224874-18513-3-git-send-email-leon.alrae@imgtec.com> <553F8C8E.2030706@imgtec.com> <553FAE58.9010609@imgtec.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ZmUaFz6apKcXQszQ" Content-Disposition: inline In-Reply-To: <553FAE58.9010609@imgtec.com> Subject: Re: [Qemu-devel] [PATCH 2/7] target-mips: support Page Frame Number Extension field List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Leon Alrae Cc: qemu-devel@nongnu.org, aurelien@aurel32.net --ZmUaFz6apKcXQszQ Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Apr 28, 2015 at 04:59:20PM +0100, Leon Alrae wrote: > Hi James, >=20 > On 28/04/2015 14:35, James Hogan wrote: > >=20 > >=20 > > On 28/04/15 13:41, Leon Alrae wrote: > >> Update tlb->PFN to contain PFN concatenated with PFNX. PFNX is 0 if la= rge > >> physical address is not supported. > >> > >> Signed-off-by: Leon Alrae > >> --- > >> target-mips/op_helper.c | 32 ++++++++++++++++++++++++++------ > >> 1 file changed, 26 insertions(+), 6 deletions(-) > >> > >> diff --git a/target-mips/op_helper.c b/target-mips/op_helper.c > >> index c9a60bd..6bff927 100644 > >> --- a/target-mips/op_helper.c > >> +++ b/target-mips/op_helper.c > >> @@ -1825,6 +1825,16 @@ static void r4k_mips_tlb_flush_extra (CPUMIPSSt= ate *env, int first) > >> } > >> } > >> =20 > >> +static inline uint64_t get_tlb_pfn_from_entrylo(uint64_t entrylo) > >> +{ > >> +#if defined(TARGET_MIPS64) > >> + return extract64(entrylo, 6, 54); > >> +#else > >> + return extract64(entrylo, 6, 24) | /* PFN */ > >> + (extract64(entrylo, 32, 32) << 24); /* PFNX */ > >=20 > > Where does the 32,32 come from? The PRA I have seems to imply that PFNX > > starts at bit 30 and goes up to bit 54. >=20 > This comes directly from MIPS32 PRA (I presume you are looking at MIPS64 > PRA). Right, the MIPS32 64-bit representation is the same as what mfc0 and mfhc0 would give you, and I see that the raw EntryLo representation in QEMU already has XI/RI in different places depending on MIPS64/MIPS32, i.e. following how each PRA represents the raw state differently. I think I wasn't expecting that because 32-bit kernels can run on MIPS64 hardware using the same mfc0/mfhc0 instructions, so having a single internal representation in QEMU seemed simpler & less fragile, since the same source code needs to support both MIPS32 and MIPS64 anyway. > Note that EntryLo.PFNX starts at bit 32 as there is 2-bit gap > occupied by RI/XI (unlike MIPS64 where it starts at bit 30). Well, from a programmer point of view mfc0 and mfhc0 with EntryLo behave identically on both MIPS32 and MIPS64. Thanks James --ZmUaFz6apKcXQszQ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBAgAGBQJVP/38AAoJEGwLaZPeOHZ6rfsP/1i7jFrAgo8I7IZ7m8R1UGXb 1Olq0sBm2OxvUwZCAxQX3i4TRaUbBrLhQYs5nv7IJnq7N0O0+cXzGeZNVM4sMqm5 7Ey/TrfhxnBYzIhRNBegj+6wz1mILXKGAXvh/aS+aaWAviCR2Gv1s7tZruQf6MgW 54tmoWZ4JAILwQ+tYz3iEOon6luqTbVVmUuRq0WHYKi9+zvL5zy6paO1Pbjjd9JR qgp6mf9iZqQflYdYxYkt+JESjb1MMwuk1ZucvUN5LtkqBvr7tr+7wiMC6w0qzSnJ pFF6doeKFMFiehSsLeLPSz3pL2PHpliHF14cguSmlLn6PqBdApPyQYgYfZxcF12L NHs1uSWYDtS+UF2rXxv2LVrq4ntNiN8qlhzY3gkFl0PAdcZnYJ7sWML4yF6PIYqb dLc95+7RRAjxkCQ4qj80i6bwWvpFXlLI+A8Pb+ihve3UFJsaYxx+WzvTssIW6XuE sCs4gyxuhRD2v/+zakR++Dtetcqrn++kGb0EJW+BgDj/6EU/9AWK2Dw+EKePizzn cchOb0CYljYjTnWHoI9vTSIDKbzmldoU2BkCeEmhDDNGyZYFYz5qXoWpcxC4jZfx 04/KxHj4vjozF9ADP2WPrSjqb84V9L3O3XOfSK2LZb0s+ThYYpGza6affj3HsdQc G046V3UeQcgBNfnJHfpp =rVFc -----END PGP SIGNATURE----- --ZmUaFz6apKcXQszQ--