From nobody Fri Apr 19 20:33:33 2024 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=1560361668; cv=none; d=zoho.com; s=zohoarc; b=JQx6MT65xn+OqEMOXpo248ZTLjFPXjOHBXcCySY5tgIWlakuB54NN8EUulH6kuTacU2qGYdyMvRUyulQ3WxyUzniNw6AdbRo90Uom4nhjYnNyYuNh54Un2YRFSlVuO+wvXgpkI+5Z7ZM2XPXqvolQ9dU+M7aUfjG8EdX4zrgM4U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560361668; 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=KwAI/FpMVuPr/AM4xgCNJvIwkhyyMeknxg1+0zozN0E=; b=UPfIy94/vJPhlLA36uZBraZR9NyJV8JaqeOpIrOruHcK9Cmp7lKn7jkCFUnCh7ibYSpVy8UCfGffB8TnLdPTp5+nOfR1Z2I6xX655hWD3ghYC8+cg7LGhcdtiytynyqCOZ1nVdsNKFdcN8WIlgkDY4keKlbmZjsp1HAUqHl/se8= 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 1560361668157556.5993324594906; Wed, 12 Jun 2019 10:47:48 -0700 (PDT) Received: from localhost ([::1]:34138 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hb7Ld-0003BH-7Y for importer@patchew.org; Wed, 12 Jun 2019 13:47:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42048) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hb7I1-0001F3-Vi for qemu-devel@nongnu.org; Wed, 12 Jun 2019 13:44:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hb7I0-0005za-Bb for qemu-devel@nongnu.org; Wed, 12 Jun 2019 13:44:01 -0400 Received: from 3.mo2.mail-out.ovh.net ([46.105.58.226]:34977) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hb7I0-0005xi-3Q for qemu-devel@nongnu.org; Wed, 12 Jun 2019 13:44:00 -0400 Received: from player792.ha.ovh.net (unknown [10.109.143.238]) by mo2.mail-out.ovh.net (Postfix) with ESMTP id 6C3F619E7EC for ; Wed, 12 Jun 2019 19:43:58 +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 player792.ha.ovh.net (Postfix) with ESMTPSA id 201CD6D91683; Wed, 12 Jun 2019 17:43:54 +0000 (UTC) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Wed, 12 Jun 2019 19:43:44 +0200 Message-Id: <20190612174345.9799-2-clg@kaod.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190612174345.9799-1-clg@kaod.org> References: <20190612174345.9799-1-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 4169770307637316582 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduuddrudehjedguddvvdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 46.105.58.226 Subject: [Qemu-devel] [PATCH 1/2] ppc/pnc: fix XSCOM MMIO base address for P9 machines with multiple chips 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: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" The PNV_XSCOM_BASE and PNV_XSCOM_SIZE macros are specific to POWER8 and they are used when the device tree is populated and the MMIO region created, even for POWER9 chips. This is not too much of a problem today because we don't have important devices on the second chip, but we might have oneday (PHBs). Fix by using the appropriate macros in case of P9. Signed-off-by: C=C3=A9dric Le Goater --- include/hw/ppc/pnv.h | 3 +++ include/hw/ppc/pnv_xscom.h | 2 +- hw/ppc/pnv.c | 24 ++++++++++++++++-------- hw/ppc/pnv_xscom.c | 17 ++++++++++++----- 4 files changed, 32 insertions(+), 14 deletions(-) diff --git a/include/hw/ppc/pnv.h b/include/hw/ppc/pnv.h index 703e5ef222de..aa926d120771 100644 --- a/include/hw/ppc/pnv.h +++ b/include/hw/ppc/pnv.h @@ -283,4 +283,7 @@ int pnv_bmc_hiomap(IPMIBmc *bmc); #define PNV9_PSIHB_ESB_SIZE 0x0000000000010000ull #define PNV9_PSIHB_ESB_BASE(chip) PNV9_CHIP_BASE(chip, 0x00060302031c00= 00ull) =20 +#define PNV9_XSCOM_SIZE 0x0000000400000000ull +#define PNV9_XSCOM_BASE(chip) PNV9_CHIP_BASE(chip, 0x00603fc0000000= 0ull) + #endif /* PPC_PNV_H */ diff --git a/include/hw/ppc/pnv_xscom.h b/include/hw/ppc/pnv_xscom.h index 7ddc82c3a288..78fcf88a495b 100644 --- a/include/hw/ppc/pnv_xscom.h +++ b/include/hw/ppc/pnv_xscom.h @@ -102,7 +102,7 @@ typedef struct PnvXScomInterfaceClass { #define PNV9_XSCOM_PEC_PCI_BASE 0xd010800 #define PNV9_XSCOM_PEC_PCI_SIZE 0x200 =20 -extern void pnv_xscom_realize(PnvChip *chip, Error **errp); +extern void pnv_xscom_realize(PnvChip *chip, uint64_t size, Error **errp); extern int pnv_dt_xscom(PnvChip *chip, void *fdt, int offset); =20 extern void pnv_xscom_add_subregion(PnvChip *chip, hwaddr offset, diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 7b60c97339dd..92c01dfc09ef 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -902,6 +902,14 @@ static void pnv_chip_power8_realize(DeviceState *dev, = Error **errp) Error *local_err =3D NULL; int i; =20 + /* XSCOM bridge is first */ + pnv_xscom_realize(chip, PNV_XSCOM_SIZE, &local_err); + if (local_err) { + error_propagate(errp, local_err); + return; + } + sysbus_mmio_map(SYS_BUS_DEVICE(chip), 0, PNV_XSCOM_BASE(chip)); + pcc->parent_realize(dev, &local_err); if (local_err) { error_propagate(errp, local_err); @@ -1092,6 +1100,14 @@ static void pnv_chip_power9_realize(DeviceState *dev= , Error **errp) Error *local_err =3D NULL; uint32_t i; =20 + /* XSCOM bridge is first */ + pnv_xscom_realize(chip, PNV9_XSCOM_SIZE, &local_err); + if (local_err) { + error_propagate(errp, local_err); + return; + } + sysbus_mmio_map(SYS_BUS_DEVICE(chip), 0, PNV9_XSCOM_BASE(chip)); + pcc->parent_realize(dev, &local_err); if (local_err) { error_propagate(errp, local_err); @@ -1301,14 +1317,6 @@ static void pnv_chip_realize(DeviceState *dev, Error= **errp) PnvChip *chip =3D PNV_CHIP(dev); Error *error =3D NULL; =20 - /* XSCOM bridge */ - pnv_xscom_realize(chip, &error); - if (error) { - error_propagate(errp, error); - return; - } - sysbus_mmio_map(SYS_BUS_DEVICE(chip), 0, PNV_XSCOM_BASE(chip)); - /* Cores */ pnv_chip_core_realize(chip, &error); if (error) { diff --git a/hw/ppc/pnv_xscom.c b/hw/ppc/pnv_xscom.c index cc7c66320f23..770176326526 100644 --- a/hw/ppc/pnv_xscom.c +++ b/hw/ppc/pnv_xscom.c @@ -211,17 +211,17 @@ const MemoryRegionOps pnv_xscom_ops =3D { .endianness =3D DEVICE_BIG_ENDIAN, }; =20 -void pnv_xscom_realize(PnvChip *chip, Error **errp) +void pnv_xscom_realize(PnvChip *chip, uint64_t size, Error **errp) { SysBusDevice *sbd =3D SYS_BUS_DEVICE(chip); char *name; =20 name =3D g_strdup_printf("xscom-%x", chip->chip_id); memory_region_init_io(&chip->xscom_mmio, OBJECT(chip), &pnv_xscom_ops, - chip, name, PNV_XSCOM_SIZE); + chip, name, size); sysbus_init_mmio(sbd, &chip->xscom_mmio); =20 - memory_region_init(&chip->xscom, OBJECT(chip), name, PNV_XSCOM_SIZE); + memory_region_init(&chip->xscom, OBJECT(chip), name, size); address_space_init(&chip->xscom_as, &chip->xscom, name); g_free(name); } @@ -263,12 +263,19 @@ static const char compat_p9[] =3D "ibm,power9-xscom\0= ibm,xscom"; =20 int pnv_dt_xscom(PnvChip *chip, void *fdt, int root_offset) { - uint64_t reg[] =3D { cpu_to_be64(PNV_XSCOM_BASE(chip)), - cpu_to_be64(PNV_XSCOM_SIZE) }; + uint64_t reg[2]; int xscom_offset; ForeachPopulateArgs args; char *name; =20 + if (pnv_chip_is_power9(chip)) { + reg[0] =3D cpu_to_be64(PNV9_XSCOM_BASE(chip)); + reg[1] =3D cpu_to_be64(PNV9_XSCOM_SIZE); + } else { + reg[0] =3D cpu_to_be64(PNV_XSCOM_BASE(chip)); + reg[1] =3D cpu_to_be64(PNV_XSCOM_SIZE); + } + name =3D g_strdup_printf("xscom@%" PRIx64, be64_to_cpu(reg[0])); xscom_offset =3D fdt_add_subnode(fdt, root_offset, name); _FDT(xscom_offset); --=20 2.21.0 From nobody Fri Apr 19 20:33:33 2024 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=1560361701; cv=none; d=zoho.com; s=zohoarc; b=lCheX9GvdCkh+DigfNRII4aNwZ7wG1FVg6/QqZf7z1yvXNM7zVK4VxYWbVxpkH0xq7Uxpb9k5SJ3G02hyQBo5aeFDjB0LAPyH7GW5km7dvEdpXIC2f8bogsE1WzzV6JGrvwK1dNJ0zDrKfHvzLPPIwljv5KxGTcoeVPNFrElua8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560361701; 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=McdrYd94vXwMvQk44C2fR4LAkPgyrQSkrGNhGB0wn8I=; b=Fs4BjGuSiyEafd58F8ev8z21t8RBkako9siXXeQ7Ud5sXdOdixwnju3irZtNtFNOgGLfv4PXILUvuySkJ9QXjhpwL1ghSTfWhWXOEYhAWyPTOfHN/FHKWkBZGnZRZq8ob9N4CM6Y1XnFy1kBHmmUXV6jBZjTdmC4oFZJIW+WQNM= 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 1560361701003174.27505702756253; Wed, 12 Jun 2019 10:48:21 -0700 (PDT) Received: from localhost ([::1]:34140 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hb7M9-0003aO-VX for importer@patchew.org; Wed, 12 Jun 2019 13:48:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42123) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hb7I6-0001Oe-DX for qemu-devel@nongnu.org; Wed, 12 Jun 2019 13:44:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hb7I5-00062k-6R for qemu-devel@nongnu.org; Wed, 12 Jun 2019 13:44:06 -0400 Received: from 19.mo1.mail-out.ovh.net ([178.32.97.206]:52745) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hb7I5-00061c-0t for qemu-devel@nongnu.org; Wed, 12 Jun 2019 13:44:05 -0400 Received: from player792.ha.ovh.net (unknown [10.109.159.20]) by mo1.mail-out.ovh.net (Postfix) with ESMTP id E19CB17D05E for ; Wed, 12 Jun 2019 19:44:02 +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 player792.ha.ovh.net (Postfix) with ESMTPSA id 6F5CF6D9169F; Wed, 12 Jun 2019 17:43:58 +0000 (UTC) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Wed, 12 Jun 2019 19:43:45 +0200 Message-Id: <20190612174345.9799-3-clg@kaod.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190612174345.9799-1-clg@kaod.org> References: <20190612174345.9799-1-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 4170896207446445030 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduuddrudehjedguddvvdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd 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.97.206 Subject: [Qemu-devel] [PATCH 2/2] ppc/pnc: remove xscom_base field from PnvChip 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: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" It has now became useless with the previous patch. Signed-off-by: C=C3=A9dric Le Goater --- include/hw/ppc/pnv.h | 5 +---- hw/ppc/pnv.c | 10 ---------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/include/hw/ppc/pnv.h b/include/hw/ppc/pnv.h index aa926d120771..de0c1d285fa7 100644 --- a/include/hw/ppc/pnv.h +++ b/include/hw/ppc/pnv.h @@ -58,7 +58,6 @@ typedef struct PnvChip { uint64_t cores_mask; void *cores; =20 - hwaddr xscom_base; MemoryRegion xscom_mmio; MemoryRegion xscom; AddressSpace xscom_as; @@ -114,8 +113,6 @@ typedef struct PnvChipClass { uint64_t cores_mask; uint32_t num_phbs; =20 - hwaddr xscom_base; - DeviceRealize parent_realize; =20 uint32_t (*core_pir)(PnvChip *chip, uint32_t core_id); @@ -226,7 +223,7 @@ int pnv_bmc_hiomap(IPMIBmc *bmc); */ #define PNV_XSCOM_SIZE 0x800000000ull #define PNV_XSCOM_BASE(chip) \ - (chip->xscom_base + ((uint64_t)(chip)->chip_id) * PNV_XSCOM_SIZE) + (0x0003fc0000000000ull + ((uint64_t)(chip)->chip_id) * PNV_XSCOM_SIZE) =20 /* * XSCOM 0x20109CA defines the ICP BAR: diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 92c01dfc09ef..4352066ec1f2 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -982,7 +982,6 @@ static void pnv_chip_power8e_class_init(ObjectClass *kl= ass, void *data) k->isa_create =3D pnv_chip_power8_isa_create; k->dt_populate =3D pnv_chip_power8_dt_populate; k->pic_print_info =3D pnv_chip_power8_pic_print_info; - k->xscom_base =3D 0x003fc0000000000ull; dc->desc =3D "PowerNV Chip POWER8E"; =20 device_class_set_parent_realize(dc, pnv_chip_power8_realize, @@ -1003,7 +1002,6 @@ static void pnv_chip_power8_class_init(ObjectClass *k= lass, void *data) k->isa_create =3D pnv_chip_power8_isa_create; k->dt_populate =3D pnv_chip_power8_dt_populate; k->pic_print_info =3D pnv_chip_power8_pic_print_info; - k->xscom_base =3D 0x003fc0000000000ull; dc->desc =3D "PowerNV Chip POWER8"; =20 device_class_set_parent_realize(dc, pnv_chip_power8_realize, @@ -1024,7 +1022,6 @@ static void pnv_chip_power8nvl_class_init(ObjectClass= *klass, void *data) k->isa_create =3D pnv_chip_power8nvl_isa_create; k->dt_populate =3D pnv_chip_power8_dt_populate; k->pic_print_info =3D pnv_chip_power8_pic_print_info; - k->xscom_base =3D 0x003fc0000000000ull; dc->desc =3D "PowerNV Chip POWER8NVL"; =20 device_class_set_parent_realize(dc, pnv_chip_power8_realize, @@ -1210,7 +1207,6 @@ static void pnv_chip_power9_class_init(ObjectClass *k= lass, void *data) k->isa_create =3D pnv_chip_power9_isa_create; k->dt_populate =3D pnv_chip_power9_dt_populate; k->pic_print_info =3D pnv_chip_power9_pic_print_info; - k->xscom_base =3D 0x00603fc00000000ull; dc->desc =3D "PowerNV Chip POWER9"; =20 device_class_set_parent_realize(dc, pnv_chip_power9_realize, @@ -1247,11 +1243,6 @@ static void pnv_chip_core_sanitize(PnvChip *chip, Er= ror **errp) } } =20 -static void pnv_chip_instance_init(Object *obj) -{ - PNV_CHIP(obj)->xscom_base =3D PNV_CHIP_GET_CLASS(obj)->xscom_base; -} - static void pnv_chip_core_realize(PnvChip *chip, Error **errp) { Error *error =3D NULL; @@ -1519,7 +1510,6 @@ static const TypeInfo types[] =3D { .name =3D TYPE_PNV_CHIP, .parent =3D TYPE_SYS_BUS_DEVICE, .class_init =3D pnv_chip_class_init, - .instance_init =3D pnv_chip_instance_init, .instance_size =3D sizeof(PnvChip), .class_size =3D sizeof(PnvChipClass), .abstract =3D true, --=20 2.21.0