From nobody Tue Feb 10 04:14:27 2026 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=1568826796; cv=none; d=zoho.com; s=zohoarc; b=nLyBRhldZheBclU5GZhKkrSPDXrJP/i/p2NRgFaeSUBhXMzYAhh/x8+imqX7RncMvBMboZHH4G/XKj7wRrqUOsJ/pznogEcdE0/vZWHX6Iq7vXUKsVrykMfcUPPjRml9fpoNym+uitSGuLlDvPa6Zz68JMrOohnZhXQlo+Pfc7U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568826796; 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:ARC-Authentication-Results; bh=NyS8WXi2InZlZMbp04hstuMjXTYP2UMxjPT6s2LiUN0=; b=R2rb0UiMD5aKMg5YJEnhnuQ6/XTI/5qxGAa4R8LEzbcQDkvH+WWTnxfTeOCv74a4thz2EnEZLg9SP9vTEuQNBrxxoMCAwXJAsQ9tP2C544lr7d4o57hQr0/TlOXbOCF9puVF/SrlM8Whk99NERZgsbgnEG2XsXsfYhZgByb3DaA= 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 156882679601741.2530007714214; Wed, 18 Sep 2019 10:13:16 -0700 (PDT) Received: from localhost ([::1]:33156 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAdVw-0000JD-FL for importer@patchew.org; Wed, 18 Sep 2019 13:13:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55454) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAcU6-00033v-W6 for qemu-devel@nongnu.org; Wed, 18 Sep 2019 12:07:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iAcU5-0002dp-PO for qemu-devel@nongnu.org; Wed, 18 Sep 2019 12:07:14 -0400 Received: from 7.mo2.mail-out.ovh.net ([188.165.48.182]:56539) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iAcU5-0002dM-Jq for qemu-devel@nongnu.org; Wed, 18 Sep 2019 12:07:13 -0400 Received: from player799.ha.ovh.net (unknown [10.108.54.87]) by mo2.mail-out.ovh.net (Postfix) with ESMTP id 42AAC1AD3AC for ; Wed, 18 Sep 2019 18:07:12 +0200 (CEST) Received: from kaod.org (lfbn-1-2240-157.w90-76.abo.wanadoo.fr [90.76.60.157]) (Authenticated sender: clg@kaod.org) by player799.ha.ovh.net (Postfix) with ESMTPSA id 4E7869F0E3C3; Wed, 18 Sep 2019 16:07:06 +0000 (UTC) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Wed, 18 Sep 2019 18:06:23 +0200 Message-Id: <20190918160645.25126-4-clg@kaod.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190918160645.25126-1-clg@kaod.org> References: <20190918160645.25126-1-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 6210463888279636966 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedufedrudekgdeljecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 188.165.48.182 Subject: [Qemu-devel] [PATCH v4 03/25] ppc/pnv: Introduce a PNV_CHIP_CPU_FOREACH() helper 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: =?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" As there is now easy way to loop on the CPUs belonging to a chip, add a helper to filter out external CPUs. Signed-off-by: C=C3=A9dric Le Goater --- hw/intc/pnv_xive.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/hw/intc/pnv_xive.c b/hw/intc/pnv_xive.c index ae449aa1119b..e1c15b6b5b71 100644 --- a/hw/intc/pnv_xive.c +++ b/hw/intc/pnv_xive.c @@ -392,15 +392,36 @@ static int pnv_xive_get_eas(XiveRouter *xrtr, uint8_t= blk, uint32_t idx, return pnv_xive_vst_read(xive, VST_TSEL_IVT, blk, idx, eas); } =20 +static int cpu_pir(PowerPCCPU *cpu) +{ + CPUPPCState *env =3D &cpu->env; + return env->spr_cb[SPR_PIR].default_value; +} + +static int cpu_chip_id(PowerPCCPU *cpu) +{ + int pir =3D cpu_pir(cpu); + return (pir >> 8) & 0x7f; +} + +#define PNV_CHIP_CPU_FOREACH(chip, cs) \ + CPU_FOREACH(cs) \ + if (chip->chip_id !=3D cpu_chip_id(POWERPC_CPU(cs))) {} else + static int pnv_xive_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) { + PnvXive *xive =3D PNV_XIVE(xptr); CPUState *cs; int count =3D 0; =20 - CPU_FOREACH(cs) { + /* + * Loop on all CPUs of the machine and filter out the CPUs + * belonging to another chip. + */ + PNV_CHIP_CPU_FOREACH(xive->chip, cs) { PowerPCCPU *cpu =3D POWERPC_CPU(cs); XiveTCTX *tctx =3D XIVE_TCTX(pnv_cpu_state(cpu)->intc); int ring; --=20 2.21.0