From nobody Tue Feb 10 01:32:51 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.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 (zohomail.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=1576558632; cv=none; d=zohomail.com; s=zohoarc; b=FWBKgGN/wYGJupmGeBtwWUfp9n0NZL7Cc5PCslgzEOeJ47wxflLvrwSkIct7mBYzv698KDUUoN7ShkxWZj/MtMSrjDMWd37AfV+Xug9G/5efIczSeZf5H1pFWVezY0ugjCLlqGOPtG9O7aWFeRK5L8JXrRfTWOVRQR7N3/YxqHw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576558632; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=C0KbMer+/Rluv9Pnc4O/rgrYg6W1We2noM4nAnpDO00=; b=VimptQb3gTQJuPLsPJehjFp0LxPNw4clE4xw5V62AP7bSTDryuvh8/1IRBc2Hh4kmmazqJWWXeJIwP+/FqZQVqNKnIhiOTsFbkHIhLYPpJzWm8IsaPjzjMGP4kB6NchHqlkY03d4jXmjUNHGEIyLSHaqzqhjo43rMMDV8QboO6k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1576558632115455.9724129294; Mon, 16 Dec 2019 20:57:12 -0800 (PST) Received: from localhost ([::1]:35270 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ih4v0-0000mq-J5 for importer@patchew.org; Mon, 16 Dec 2019 23:57:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33710) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ih4iG-0008JP-5U for qemu-devel@nongnu.org; Mon, 16 Dec 2019 23:44:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ih4iB-0005Zs-S7 for qemu-devel@nongnu.org; Mon, 16 Dec 2019 23:43:58 -0500 Received: from ozlabs.org ([203.11.71.1]:34159) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ih4iB-0005TW-BU; Mon, 16 Dec 2019 23:43:55 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 47cQWT6bt3z9sSk; Tue, 17 Dec 2019 15:43:31 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1576557813; bh=qLrrxGz/L7uIfowC5RKd93eD4t4+MzoytoM8oaYxtik=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ejBv/UPj41KRJgeI9Ed4GCrnoIiNVoycWAnLumAStDEtYXfK52hW40S2OwHD5dSqy 7UX2ZlppC6sb8Apjsh1oIwkjS4LGrJa+Jqpz+Q9JcIXuoja+/S3eyQ8oj5IZUH3ycy AoUOimvg8qtFgE1QhY/yL1XQ7FxCpSIGaBIgkX84= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 27/88] ppc/xive: Introduce a XivePresenter interface Date: Tue, 17 Dec 2019 15:42:21 +1100 Message-Id: <20191217044322.351838-28-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191217044322.351838-1-david@gibson.dropbear.id.au> References: <20191217044322.351838-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] [fuzzy] X-Received-From: 203.11.71.1 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, aik@ozlabs.ru, qemu-devel@nongnu.org, groug@kaod.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: C=C3=A9dric Le Goater When the XIVE IVRE sub-engine (XiveRouter) looks for a Notification Virtual Target (NVT) to notify, it broadcasts a message on the PowerBUS to find an XIVE IVPE sub-engine (Presenter) with the NVT dispatched on one of its HW threads, and then forwards the notification if any response was received. The current XIVE presenter model is sufficient for the pseries machine because it has a single interrupt controller device, but the PowerNV machine can have multiple chips each having its own interrupt controller. In this case, the XIVE presenter model is too simple and the CAM line matching should scan all chips of the system. To start fixing this issue, we first extend the XIVE Router model with a new XivePresenter QOM interface representing the XIVE IVPE sub-engine. This interface exposes a 'match_nvt' handler which the sPAPR and PowerNV XIVE Router models will need to implement to perform the CAM line matching. Signed-off-by: C=C3=A9dric Le Goater Reviewed-by: Greg Kurz Signed-off-by: C=C3=A9dric Le Goater Message-Id: <20191125065820.927-2-clg@kaod.org> Signed-off-by: David Gibson --- hw/intc/xive.c | 26 +++++++++++++++++--------- include/hw/ppc/xive.h | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 9 deletions(-) diff --git a/hw/intc/xive.c b/hw/intc/xive.c index 511e1a9363..344bb3f3bc 100644 --- a/hw/intc/xive.c +++ b/hw/intc/xive.c @@ -1363,9 +1363,10 @@ static uint32_t xive_tctx_hw_cam_line(XiveTCTX *tctx) /* * The thread context register words are in big-endian format. */ -static int xive_presenter_tctx_match(XiveTCTX *tctx, uint8_t format, - uint8_t nvt_blk, uint32_t nvt_idx, - bool cam_ignore, uint32_t logic_serv) +int xive_presenter_tctx_match(XivePresenter *xptr, XiveTCTX *tctx, + uint8_t format, + uint8_t nvt_blk, uint32_t nvt_idx, + bool cam_ignore, uint32_t logic_serv) { uint32_t cam =3D xive_nvt_cam_line(nvt_blk, nvt_idx); uint32_t qw3w2 =3D xive_tctx_word2(&tctx->regs[TM_QW3_HV_PHYS]); @@ -1422,11 +1423,6 @@ static int xive_presenter_tctx_match(XiveTCTX *tctx,= uint8_t format, return -1; } =20 -typedef struct XiveTCTXMatch { - XiveTCTX *tctx; - uint8_t ring; -} XiveTCTXMatch; - static bool xive_presenter_match(XiveRouter *xrtr, uint8_t format, uint8_t nvt_blk, uint32_t nvt_idx, bool cam_ignore, uint8_t priority, @@ -1460,7 +1456,8 @@ static bool xive_presenter_match(XiveRouter *xrtr, ui= nt8_t format, * Check the thread context CAM lines and record matches. We * will handle CPU exception delivery later */ - ring =3D xive_presenter_tctx_match(tctx, format, nvt_blk, nvt_idx, + ring =3D xive_presenter_tctx_match(XIVE_PRESENTER(xrtr), tctx, for= mat, + nvt_blk, nvt_idx, cam_ignore, logic_serv); /* * Save the context and follow on to catch duplicates, that we @@ -1754,6 +1751,7 @@ static const TypeInfo xive_router_info =3D { .class_init =3D xive_router_class_init, .interfaces =3D (InterfaceInfo[]) { { TYPE_XIVE_NOTIFIER }, + { TYPE_XIVE_PRESENTER }, { } } }; @@ -1923,10 +1921,20 @@ static const TypeInfo xive_notifier_info =3D { .class_size =3D sizeof(XiveNotifierClass), }; =20 +/* + * XIVE Presenter + */ +static const TypeInfo xive_presenter_info =3D { + .name =3D TYPE_XIVE_PRESENTER, + .parent =3D TYPE_INTERFACE, + .class_size =3D sizeof(XivePresenterClass), +}; + static void xive_register_types(void) { type_register_static(&xive_source_info); type_register_static(&xive_notifier_info); + type_register_static(&xive_presenter_info); type_register_static(&xive_router_info); type_register_static(&xive_end_source_info); type_register_static(&xive_tctx_info); diff --git a/include/hw/ppc/xive.h b/include/hw/ppc/xive.h index fa7adf87fe..f9aa0fa0da 100644 --- a/include/hw/ppc/xive.h +++ b/include/hw/ppc/xive.h @@ -367,6 +367,38 @@ int xive_router_write_nvt(XiveRouter *xrtr, uint8_t nv= t_blk, uint32_t nvt_idx, XiveTCTX *xive_router_get_tctx(XiveRouter *xrtr, CPUState *cs); void xive_router_notify(XiveNotifier *xn, uint32_t lisn); =20 +/* + * XIVE Presenter + */ + +typedef struct XiveTCTXMatch { + XiveTCTX *tctx; + uint8_t ring; +} XiveTCTXMatch; + +typedef struct XivePresenter XivePresenter; + +#define TYPE_XIVE_PRESENTER "xive-presenter" +#define XIVE_PRESENTER(obj) \ + INTERFACE_CHECK(XivePresenter, (obj), TYPE_XIVE_PRESENTER) +#define XIVE_PRESENTER_CLASS(klass) \ + OBJECT_CLASS_CHECK(XivePresenterClass, (klass), TYPE_XIVE_PRESENTER) +#define XIVE_PRESENTER_GET_CLASS(obj) \ + OBJECT_GET_CLASS(XivePresenterClass, (obj), TYPE_XIVE_PRESENTER) + +typedef struct XivePresenterClass { + InterfaceClass parent; + int (*match_nvt)(XivePresenter *xptr, uint8_t format, + uint8_t nvt_blk, uint32_t nvt_idx, + bool cam_ignore, uint8_t priority, + uint32_t logic_serv, XiveTCTXMatch *match); +} XivePresenterClass; + +int xive_presenter_tctx_match(XivePresenter *xptr, XiveTCTX *tctx, + uint8_t format, + uint8_t nvt_blk, uint32_t nvt_idx, + bool cam_ignore, uint32_t logic_serv); + /* * XIVE END ESBs */ --=20 2.23.0