Received: from eggs.gnu.org ([209.51.188.92]:53107) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hEplc-0005LO-U5 for qemu-devel@nongnu.org; Fri, 12 Apr 2019 02:34:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hEplX-0000q5-Uj for qemu-devel@nongnu.org; Fri, 12 Apr 2019 02:34:27 -0400 Date: Fri, 12 Apr 2019 16:10:44 +1000 From: David Gibson Message-ID: <20190412061044.GC8005@umbus.fritz.box> References: <20190411080004.8690-1-clg@kaod.org> <20190411080004.8690-2-clg@kaod.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Y5rl02BVI9TCfPar" Content-Disposition: inline In-Reply-To: <20190411080004.8690-2-clg@kaod.org> Subject: Re: [Qemu-devel] [PATCH 1/6] target/ppc: Don't check UPRT in radix mode when in HV real mode List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?iso-8859-1?Q?C=E9dric?= Le Goater Cc: qemu-ppc@nongnu.org, Suraj Jitindar Singh , qemu-devel@nongnu.org, Benjamin Herrenschmidt --Y5rl02BVI9TCfPar Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Apr 11, 2019 at 09:59:59AM +0200, C=E9dric Le Goater wrote: > From: Benjamin Herrenschmidt >=20 > It appears that during kexec, we run for a while in hypervisor > real mode with LPCR:HR set and LPCR:UPRT clear, which trips > the assertion in ppc_radix64_handle_mmu_fault(). >=20 > First this shouldn't be an assertion, it's a guest error. >=20 > Then we shouldn't be checking these things in hypervisor real > mode (or in virtual hypervisor guest real mode which is similar) > as the real HW won't use those LPCR bits in those cases anyway, > so technically it's ok to have this discrepancy. >=20 > Signed-off-by: Benjamin Herrenschmidt > Signed-off-by: C=E9dric Le Goater Applied to ppc-for-4.1, thanks. > --- > target/ppc/mmu-radix64.c | 16 +++++++++++++--- > 1 file changed, 13 insertions(+), 3 deletions(-) >=20 > diff --git a/target/ppc/mmu-radix64.c b/target/ppc/mmu-radix64.c > index ca1fb2673f93..cac076ee92d9 100644 > --- a/target/ppc/mmu-radix64.c > +++ b/target/ppc/mmu-radix64.c > @@ -228,10 +228,10 @@ int ppc_radix64_handle_mmu_fault(PowerPCCPU *cpu, v= addr eaddr, int rwx, > ppc_v3_pate_t pate; > =20 > assert((rwx =3D=3D 0) || (rwx =3D=3D 1) || (rwx =3D=3D 2)); > - assert(ppc64_use_proc_tbl(cpu)); > =20 > - /* Real Mode Access */ > - if (((rwx =3D=3D 2) && (msr_ir =3D=3D 0)) || ((rwx !=3D 2) && (msr_d= r =3D=3D 0))) { > + /* HV or virtual hypervisor Real Mode Access */ > + if ((msr_hv || cpu->vhyp) && > + (((rwx =3D=3D 2) && (msr_ir =3D=3D 0)) || ((rwx !=3D 2) && (msr_= dr =3D=3D 0)))) { Hrm.. this looks like a different bug fix. Were we preivously incorrectly handling guest real mode when running powernv? > /* In real mode top 4 effective addr bits (mostly) ignored */ > raddr =3D eaddr & 0x0FFFFFFFFFFFFFFFULL; > =20 > @@ -241,6 +241,16 @@ int ppc_radix64_handle_mmu_fault(PowerPCCPU *cpu, va= ddr eaddr, int rwx, > return 0; > } > =20 > + /* > + * Check UPRT (we avoid the check in real mode to deal with > + * transitional states during kexec. > + */ > + if (!ppc64_use_proc_tbl(cpu)) { > + qemu_log_mask(LOG_GUEST_ERROR, > + "LPCR:UPRT not set in radix mode ! LPCR=3D%016lx\n= ", > + env->spr[SPR_LPCR]); > + } > + > /* Virtual Mode Access - get the fully qualified address */ > if (!ppc_radix64_get_fully_qualified_addr(env, eaddr, &lpid, &pid)) { > ppc_radix64_raise_segi(cpu, rwx, eaddr); --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --Y5rl02BVI9TCfPar Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEdfRlhq5hpmzETofcbDjKyiDZs5IFAlywK+EACgkQbDjKyiDZ s5LHbBAAx0fcB2MeWFKDmKNS0G4EG2DmNF1fJERuWPlBZll9JUZZdDcPBtrplHvt 6Qrum/sddTruQ6ti0LSwXLY8IkOTTgwA6vvf4kIEFuVuXFhCjfMEZG4ua8/AOSM+ 1GbSdcZYxq6C86dF+vgz5oA+hwnbc/JY6SApS3D/bv+KuJ/oF/jKXHn568yt93BC zG63mYSJZRzCqsieHjjcVTgOV5FCBTFxvL1KQAv2CVEk/+jlboMFvZZaEoiHw/T3 Dp8PzDj0eyck03GGLzIzbIZnYVSeocn7//9osFgJjHKZ+De2bamN9xUVbOaoS59T xlvuxdEak/Qqj+cZ9hzUDGNQthD2/x+HkksEOqohIs/NtGJkXuyq9EvrMa3ziMZO 347/WJM2JNV217KyU68jURppK4CHtFNrt5SDX+s4CNxsDuh9WzEqh5eNFcVHIeGi U9N0vkR23xviGS8oLZwWNCmgMcKLsASeuCnZo57Ag7zhBZ01P3hjoP5aSE2sHcN5 Gh80ekFmEbvULCYPXXj8WIYEn1s8/0Ff0XVQVkqjZke1o2ofcO8dtpFeYef7SD0V 8Omeu8NuO7AeiChlgwKCyLQ8khjALAUJ839dGJ3y3VcqmRKpLwWZLOJ2PHPXRihz ycgDLF1h+3xIF6bqTL6DHXpkYAOhmaXYBVIdmAq0IVTnIHikEU4= =ZOsX -----END PGP SIGNATURE----- --Y5rl02BVI9TCfPar--