From patchwork Wed Jan 8 05:23:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 11322861 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7735D1580 for ; Wed, 8 Jan 2020 05:28:13 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4D08320705 for ; Wed, 8 Jan 2020 05:28:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.b="bVsPWdop" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4D08320705 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:37026 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ip3t6-0002nk-0I for patchwork-qemu-devel@patchwork.kernel.org; Wed, 08 Jan 2020 00:28:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47577) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ip3oc-0003t5-CA for qemu-devel@nongnu.org; Wed, 08 Jan 2020 00:23:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ip3oa-0002lU-VY for qemu-devel@nongnu.org; Wed, 08 Jan 2020 00:23:34 -0500 Received: from bilbo.ozlabs.org ([2401:3900:2:1::2]:37385 helo=ozlabs.org) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ip3oa-0002ht-K4; Wed, 08 Jan 2020 00:23:32 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 47syMC6WDfz9sSY; Wed, 8 Jan 2020 16:23:19 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1578460999; bh=kGaZI5Lnwcj97tGSIjPD6mGjpb+lCMs2T2ZbPDSKe04=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bVsPWdopg+WJF2wYvKkxHm2aAg/D+w5phEjkJAM+/4UCZacOe8uIanPYICagBrBQQ Lrb6vUgH1aDevyX/kqqEKnlj7CwOe3HV3nZu/KsmkCSE8iThl80e3eAXD2XoLXaAIk tIIgweDaKUCqqvnHWL8So4SYpJfx7qNYOi6zgdJU= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 22/26] pnv/xive: Deduce the PnvXive pointer from XiveTCTX::xptr Date: Wed, 8 Jan 2020 16:23:08 +1100 Message-Id: <20200108052312.238710-23-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200108052312.238710-1-david@gibson.dropbear.id.au> References: <20200108052312.238710-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 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, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, clg@kaod.org, David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Greg Kurz And use it instead of reaching out to the machine. This allows to get rid of pnv_get_chip(). Signed-off-by: Greg Kurz Signed-off-by: Cédric Le Goater Message-Id: <20200106145645.4539-11-clg@kaod.org> Signed-off-by: David Gibson --- hw/intc/pnv_xive.c | 8 ++------ hw/ppc/pnv.c | 14 -------------- include/hw/ppc/pnv.h | 2 -- 3 files changed, 2 insertions(+), 22 deletions(-) diff --git a/hw/intc/pnv_xive.c b/hw/intc/pnv_xive.c index 6412cf222e..715fca61ae 100644 --- a/hw/intc/pnv_xive.c +++ b/hw/intc/pnv_xive.c @@ -472,12 +472,8 @@ static uint8_t pnv_xive_get_block_id(XiveRouter *xrtr) static PnvXive *pnv_xive_tm_get_xive(PowerPCCPU *cpu) { int pir = ppc_cpu_pir(cpu); - PnvChip *chip; - PnvXive *xive; - - chip = pnv_get_chip(PNV9_PIR2CHIP(pir)); - assert(chip); - xive = &PNV9_CHIP(chip)->xive; + XivePresenter *xptr = XIVE_TCTX(pnv_cpu_state(cpu)->intc)->xptr; + PnvXive *xive = PNV_XIVE(xptr); if (!pnv_xive_is_cpu_enabled(xive, cpu)) { xive_error(xive, "IC: CPU %x is not enabled", pir); diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 19fc5d4ddb..e2735bb8dd 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -1717,20 +1717,6 @@ static int pnv_match_nvt(XiveFabric *xfb, uint8_t format, return total_count; } -PnvChip *pnv_get_chip(uint32_t chip_id) -{ - PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); - int i; - - for (i = 0; i < pnv->num_chips; i++) { - PnvChip *chip = pnv->chips[i]; - if (chip->chip_id == chip_id) { - return chip; - } - } - return NULL; -} - static void pnv_machine_power8_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); diff --git a/include/hw/ppc/pnv.h b/include/hw/ppc/pnv.h index 2504d8cd4f..d65dd32036 100644 --- a/include/hw/ppc/pnv.h +++ b/include/hw/ppc/pnv.h @@ -219,8 +219,6 @@ struct PnvMachineState { PnvPnor *pnor; }; -PnvChip *pnv_get_chip(uint32_t chip_id); - #define PNV_FDT_ADDR 0x01000000 #define PNV_TIMEBASE_FREQ 512000000ULL