From nobody Mon Nov 10 22:30:38 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; 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 ARC-Seal: i=1; a=rsa-sha256; t=1559843120; cv=none; d=zoho.com; s=zohoarc; b=mCJQEFOsaAfKW9OajheuZjPna14oWKa1vMRKpBfKOCoYBsMf9Q26VjHyrOFrx+pC808XfkqZpVYNa40mmpPGHo6SV9DMRY4oqPEE176ipEMEdKkFcUN9DCZTRHsWcSboaXXHEvQ7JSxAzJlDXhJyE3eHHw9qWMGkSSNKBpGtHhY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559843120; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=xhbugiOuLsDQQTTj4+gKtD/tGPOvAqhG4a806KCUs7M=; b=mo6t6HPijHmJizuthpUhnGcRHjiRw09w+8YDU6KXEp6fI+j5sbSPjT7mUEbvQAGMr4MVeuC201LYfr/brY6R3xCV0gD7snTDRAw31KJqWtxiuqBgodGUMjhdktVx+tKtfxWHQj8jk/sCzBAgt8J3LoMd6ANNMpO3Zh20UJ5LrfM= ARC-Authentication-Results: i=1; mx.zoho.com; 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 1559843120933761.1070949968748; Thu, 6 Jun 2019 10:45:20 -0700 (PDT) Received: from localhost ([127.0.0.1]:35828 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hYwRy-0002fj-Eg for importer@patchew.org; Thu, 06 Jun 2019 13:45:18 -0400 Received: from eggs.gnu.org ([209.51.188.92]:43753) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hYwR6-0002Gq-M3 for qemu-devel@nongnu.org; Thu, 06 Jun 2019 13:44:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hYwR5-0000og-8c for qemu-devel@nongnu.org; Thu, 06 Jun 2019 13:44:24 -0400 Received: from 10.mo1.mail-out.ovh.net ([178.32.96.102]:37543) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hYwR4-0000mH-UL for qemu-devel@nongnu.org; Thu, 06 Jun 2019 13:44:23 -0400 Received: from player758.ha.ovh.net (unknown [10.108.35.232]) by mo1.mail-out.ovh.net (Postfix) with ESMTP id B36EA17D3A3 for ; Thu, 6 Jun 2019 19:44:20 +0200 (CEST) Received: from kaod.org (lfbn-1-10649-41.w90-89.abo.wanadoo.fr [90.89.235.41]) (Authenticated sender: clg@kaod.org) by player758.ha.ovh.net (Postfix) with ESMTPSA id 408A569BFEAC; Thu, 6 Jun 2019 17:44:13 +0000 (UTC) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Thu, 6 Jun 2019 19:44:09 +0200 Message-Id: <20190606174409.12502-1-clg@kaod.org> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-Ovh-Tracer-Id: 5833287421316860902 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduuddrudeggedguddujecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 178.32.96.102 Subject: [Qemu-devel] [PATCH] ppc/xive: Make XIVE generate the proper interrupt types 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: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , qemu-ppc@nongnu.org, qemu-devel@nongnu.org, Greg Kurz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Benjamin Herrenschmidt It should be generic Hypervisor Virtualization interrupts for HV directed rings and traditional External Interrupts for the OS directed ring. Don't generate anything for the user ring as it isn't actually supported. Signed-off-by: Benjamin Herrenschmidt Signed-off-by: C=C3=A9dric Le Goater Reviewed-by: David Gibson --- I forgot to resend this patch, an important one for HV machines ! include/hw/ppc/xive.h | 3 ++- hw/intc/xive.c | 22 +++++++++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/include/hw/ppc/xive.h b/include/hw/ppc/xive.h index d872f96d1a1b..a6ee7e831d8b 100644 --- a/include/hw/ppc/xive.h +++ b/include/hw/ppc/xive.h @@ -317,7 +317,8 @@ typedef struct XiveTCTX { DeviceState parent_obj; =20 CPUState *cs; - qemu_irq output; + qemu_irq hv_output; + qemu_irq os_output; =20 uint8_t regs[XIVE_TM_RING_COUNT * XIVE_TM_RING_SIZE]; } XiveTCTX; diff --git a/hw/intc/xive.c b/hw/intc/xive.c index 0c74e47aa49c..b2b92a92c84f 100644 --- a/hw/intc/xive.c +++ b/hw/intc/xive.c @@ -61,13 +61,28 @@ static uint8_t exception_mask(uint8_t ring) } } =20 +static qemu_irq xive_tctx_output(XiveTCTX *tctx, uint8_t ring) +{ + switch (ring) { + case TM_QW0_USER: + return 0; /* Not supported */ + case TM_QW1_OS: + return tctx->os_output; + case TM_QW2_HV_POOL: + case TM_QW3_HV_PHYS: + return tctx->hv_output; + default: + return 0; + } +} + static uint64_t xive_tctx_accept(XiveTCTX *tctx, uint8_t ring) { uint8_t *regs =3D &tctx->regs[ring]; uint8_t nsr =3D regs[TM_NSR]; uint8_t mask =3D exception_mask(ring); =20 - qemu_irq_lower(tctx->output); + qemu_irq_lower(xive_tctx_output(tctx, ring)); =20 if (regs[TM_NSR] & mask) { uint8_t cppr =3D regs[TM_PIPR]; @@ -100,7 +115,7 @@ static void xive_tctx_notify(XiveTCTX *tctx, uint8_t ri= ng) default: g_assert_not_reached(); } - qemu_irq_raise(tctx->output); + qemu_irq_raise(xive_tctx_output(tctx, ring)); } } =20 @@ -556,7 +571,8 @@ static void xive_tctx_realize(DeviceState *dev, Error *= *errp) env =3D &cpu->env; switch (PPC_INPUT(env)) { case PPC_FLAGS_INPUT_POWER9: - tctx->output =3D env->irq_inputs[POWER9_INPUT_INT]; + tctx->hv_output =3D env->irq_inputs[POWER9_INPUT_HINT]; + tctx->os_output =3D env->irq_inputs[POWER9_INPUT_INT]; break; =20 default: --=20 2.21.0