Received: from eggs.gnu.org ([2001:4830:134:3::10]:35981) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFxTv-00079F-U2 for qemu-devel@nongnu.org; Thu, 23 Jun 2016 01:47:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFxTr-0002b5-0p for qemu-devel@nongnu.org; Thu, 23 Jun 2016 01:47:14 -0400 From: David Gibson Date: Thu, 23 Jun 2016 15:48:37 +1000 Message-Id: <1466660926-1544-9-git-send-email-david@gibson.dropbear.id.au> In-Reply-To: <1466660926-1544-1-git-send-email-david@gibson.dropbear.id.au> References: <1466660926-1544-1-git-send-email-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 08/17] ppc: define a default LPCR value List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: peter.maydell@linaro.org Cc: agraf@suse.de, qemu-ppc@nongnu.org, pbonzini@redhat.com, qemu-devel@nongnu.org, Benjamin Herrenschmidt , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , David Gibson From: Benjamin Herrenschmidt This allows us to set the appropriate LPCR bits which will be used when fixing the exception model for the HV mode. Signed-off-by: Benjamin Herrenschmidt Reviewed-by: David Gibson [clg: previous commit 26a7f1291bb5 did not include the LPCR setting as it was not needed at the time, adapted commit log ] Signed-off-by: C=C3=A9dric Le Goater Signed-off-by: David Gibson --- target-ppc/translate_init.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c index c847a3e..db56a39 100644 --- a/target-ppc/translate_init.c +++ b/target-ppc/translate_init.c @@ -8518,6 +8518,7 @@ POWERPC_FAMILY(POWER8)(ObjectClass *oc, void *data) void cpu_ppc_set_papr(PowerPCCPU *cpu) { CPUPPCState *env =3D &cpu->env; + ppc_spr_t *lpcr =3D &env->spr_cb[SPR_LPCR]; ppc_spr_t *amor =3D &env->spr_cb[SPR_AMOR]; =20 /* PAPR always has exception vectors in RAM not ROM. To ensure this, @@ -8527,6 +8528,19 @@ void cpu_ppc_set_papr(PowerPCCPU *cpu) */ env->msr_mask &=3D ~((1ull << MSR_EP) | MSR_HVB); =20 + /* Set emulated LPCR to not send interrupts to hypervisor. Note that + * under KVM, the actual HW LPCR will be set differently by KVM itse= lf, + * the settings below ensure proper operations with TCG in absence o= f + * a real hypervisor + */ + lpcr->default_value &=3D ~(LPCR_VPM0 | LPCR_VPM1 | LPCR_ISL | LPCR_K= BV); + lpcr->default_value |=3D LPCR_LPES0 | LPCR_LPES1; + + /* We should be followed by a CPU reset but update the active value + * just in case... + */ + env->spr[SPR_LPCR] =3D lpcr->default_value; + /* Set a full AMOR so guest can use the AMR as it sees fit */ env->spr[SPR_AMOR] =3D amor->default_value =3D 0xffffffffffffffffull= ; =20 --=20 2.5.5