From nobody Sun Nov 9 16:22:03 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1551157163114272.76968068871065; Mon, 25 Feb 2019 20:59:23 -0800 (PST) Received: from localhost ([127.0.0.1]:48808 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gyUpr-0000Uo-3d for importer@patchew.org; Mon, 25 Feb 2019 23:59:19 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57502) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gyUkQ-0004eQ-OA for qemu-devel@nongnu.org; Mon, 25 Feb 2019 23:53:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gyUkL-0001Cd-0p for qemu-devel@nongnu.org; Mon, 25 Feb 2019 23:53:38 -0500 Received: from ozlabs.org ([203.11.71.1]:39589) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gyUkI-0000g9-BD; Mon, 25 Feb 2019 23:53:35 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 447mfG49RWz9sDb; Tue, 26 Feb 2019 15:53:10 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1551156790; bh=DlGPSYu0ILHA0fNTzU/VMvE4bX4SWt+AoAtvZN/wHUU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DiQVNiiU9r42DmC2bGSU3gNbBUxA5U+tJ30nRgam8Oy6fd2VhuNlhBSuuLVc0qem4 n7ECRYBKxCMLNMO6RkQH79/eBSKwvqSYUpi1sskMnP5MozpSRr8Pz4LdWQY8w7tHg7 3T8fElRB08kE1poxyC0Uuk2n6E+9hUMjp3KrySsg= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 26 Feb 2019 15:52:24 +1100 Message-Id: <20190226045304.25618-11-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190226045304.25618-1-david@gibson.dropbear.id.au> References: <20190226045304.25618-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PULL 10/50] target/ppc: Add support for LPCR:HEIC on POWER9 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, gkurz@kaod.org, qemu-devel@nongnu.org, qemu-ppc@nongnu.org, clg@kaod.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Benjamin Herrenschmidt This controls whether the External Interrupt (0x500) can be delivered to the hypervisor or not. Signed-off-by: Benjamin Herrenschmidt Signed-off-by: C=C3=A9dric Le Goater Reviewed-by: David Gibson Message-Id: <20190215161648.9600-11-clg@kaod.org> Signed-off-by: David Gibson --- target/ppc/excp_helper.c | 5 ++++- target/ppc/translate_init.inc.c | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index d171a5eb62..39bedbb11d 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -827,7 +827,10 @@ static void ppc_hw_interrupt(CPUPPCState *env) /* External interrupt can ignore MSR:EE under some circumstances */ if (env->pending_interrupts & (1 << PPC_INTERRUPT_EXT)) { bool lpes0 =3D !!(env->spr[SPR_LPCR] & LPCR_LPES0); - if (async_deliver || (env->has_hv_mode && msr_hv =3D=3D 0 && !lpes= 0)) { + bool heic =3D !!(env->spr[SPR_LPCR] & LPCR_HEIC); + /* HEIC blocks delivery to the hypervisor */ + if ((async_deliver && !(heic && msr_hv && !msr_pr)) || + (env->has_hv_mode && msr_hv =3D=3D 0 && !lpes0)) { powerpc_excp(cpu, env->excp_model, POWERPC_EXCP_EXTERNAL); return; } diff --git a/target/ppc/translate_init.inc.c b/target/ppc/translate_init.in= c.c index 9d84164915..965c5273a6 100644 --- a/target/ppc/translate_init.inc.c +++ b/target/ppc/translate_init.inc.c @@ -8823,7 +8823,10 @@ static bool cpu_has_work_POWER9(CPUState *cs) /* External Exception */ if ((env->pending_interrupts & (1u << PPC_INTERRUPT_EXT)) && (env->spr[SPR_LPCR] & LPCR_EEE)) { - return true; + bool heic =3D !!(env->spr[SPR_LPCR] & LPCR_HEIC); + if (heic =3D=3D 0 || !msr_hv || msr_pr) { + return true; + } } /* Decrementer Exception */ if ((env->pending_interrupts & (1u << PPC_INTERRUPT_DECR)) && --=20 2.20.1