From: Balamuruhan S <bala24@linux.ibm.com>
To: qemu-devel@nongnu.org
Cc: maddy@linux.vnet.ibm.com, Balamuruhan S <bala24@linux.ibm.com>,
anju@linux.vnet.ibm.com, clg@kaod.org, hari@linux.vnet.ibm.com,
pbonzini@redhat.com, david@gibson.dropbear.id.au
Subject: [Qemu-devel] [RFC PATCH 4/6] hw/ppc/pnv: initialize and realize homer/occ common area
Date: Wed, 7 Aug 2019 12:44:43 +0530 [thread overview]
Message-ID: <20190807071445.4109-5-bala24@linux.ibm.com> (raw)
In-Reply-To: <20190807071445.4109-1-bala24@linux.ibm.com>
homer and occ common area region base address are initialized
to create device tree and realized to map the address with
mmio callbacks during `pnv_chip_realize()`.
`SysBusNum` enum is introduced to set sysbus for XSCOM, ICP,
HOMER and OCC appropriately and chip_num to initialize and
retrieve base address + size contiguously on a PowerNV with
multichip boot.
Signed-off-by: Balamuruhan S <bala24@linux.ibm.com>
---
hw/ppc/pnv.c | 49 +++++++++++++++++++++++++++++++++++++++++++++----
include/hw/ppc/pnv.h | 1 +
2 files changed, 46 insertions(+), 4 deletions(-)
diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
index bd4531c822..f6e56e915d 100644
--- a/hw/ppc/pnv.c
+++ b/hw/ppc/pnv.c
@@ -675,6 +675,7 @@ static void pnv_init(MachineState *machine)
Object *chip = object_new(chip_typename);
pnv->chips[i] = PNV_CHIP(chip);
+ PNV_CHIP(chip)->chip_num = i;
/* TODO: put all the memory in one node on chip 0 until we find a
* way to specify different ranges for each chip
@@ -824,18 +825,20 @@ static void pnv_chip_icp_realize(Pnv8Chip *chip8, Error **errp)
{
PnvChip *chip = PNV_CHIP(chip8);
PnvChipClass *pcc = PNV_CHIP_GET_CLASS(chip);
+ SysBusDevice *sbd = SYS_BUS_DEVICE(chip);
const char *typename = pnv_chip_core_typename(chip);
size_t typesize = object_type_get_instance_size(typename);
int i, j;
char *name;
XICSFabric *xi = XICS_FABRIC(qdev_get_machine());
+ sbd->num_mmio = PNV_ICP_SYSBUS;
name = g_strdup_printf("icp-%x", chip->chip_id);
memory_region_init(&chip8->icp_mmio, OBJECT(chip), name, PNV_ICP_SIZE);
- sysbus_init_mmio(SYS_BUS_DEVICE(chip), &chip8->icp_mmio);
+ sysbus_init_mmio(sbd, &chip8->icp_mmio);
g_free(name);
- sysbus_mmio_map(SYS_BUS_DEVICE(chip), 1, PNV_ICP_BASE(chip));
+ sysbus_mmio_map(sbd, PNV_ICP_SYSBUS, PNV_ICP_BASE(chip));
/* Map the ICP registers for each thread */
for (i = 0; i < chip->nr_cores; i++) {
@@ -866,7 +869,26 @@ static void pnv_chip_power8_realize(DeviceState *dev, Error **errp)
error_propagate(errp, local_err);
return;
}
- sysbus_mmio_map(SYS_BUS_DEVICE(chip), 0, PNV_XSCOM_BASE(chip));
+ sysbus_mmio_map(SYS_BUS_DEVICE(chip), PNV_XSCOM_SYSBUS,
+ PNV_XSCOM_BASE(chip));
+
+ /* homer */
+ pnv_homer_realize(chip, &local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
+ return;
+ }
+ sysbus_mmio_map(SYS_BUS_DEVICE(chip), PNV_HOMER_SYSBUS,
+ PNV_HOMER_BASE(chip));
+
+ /* occ common area */
+ pnv_occ_common_area_realize(chip, &local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
+ return;
+ }
+ sysbus_mmio_map(SYS_BUS_DEVICE(chip), PNV_OCC_COMMON_AREA_SYSBUS,
+ PNV_OCC_COMMON_AREA(chip));
pcc->parent_realize(dev, &local_err);
if (local_err) {
@@ -1035,7 +1057,26 @@ static void pnv_chip_power9_realize(DeviceState *dev, Error **errp)
error_propagate(errp, local_err);
return;
}
- sysbus_mmio_map(SYS_BUS_DEVICE(chip), 0, PNV9_XSCOM_BASE(chip));
+ sysbus_mmio_map(SYS_BUS_DEVICE(chip), PNV_XSCOM_SYSBUS,
+ PNV9_XSCOM_BASE(chip));
+
+ /* homer */
+ pnv_homer_realize(chip, &local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
+ return;
+ }
+ sysbus_mmio_map(SYS_BUS_DEVICE(chip), PNV_HOMER_SYSBUS,
+ PNV9_HOMER_BASE(chip));
+
+ /* occ common area */
+ pnv_occ_common_area_realize(chip, &local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
+ return;
+ }
+ sysbus_mmio_map(SYS_BUS_DEVICE(chip), PNV_OCC_COMMON_AREA_SYSBUS,
+ PNV9_OCC_COMMON_AREA(chip));
pcc->parent_realize(dev, &local_err);
if (local_err) {
diff --git a/include/hw/ppc/pnv.h b/include/hw/ppc/pnv.h
index 6464e32892..dea6772988 100644
--- a/include/hw/ppc/pnv.h
+++ b/include/hw/ppc/pnv.h
@@ -57,6 +57,7 @@ typedef struct PnvChip {
/*< public >*/
uint32_t chip_id;
+ uint32_t chip_num;
uint64_t ram_start;
uint64_t ram_size;
--
2.14.5
next prev parent reply other threads:[~2019-08-07 7:18 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-07 7:14 [Qemu-devel] [RFC PATCH 0/6] Enhancing Qemu MMIO emulation with scripting interface Balamuruhan S
2019-08-07 7:14 ` [Qemu-devel] [RFC PATCH 1/6] utils/python_api: add scripting interface for Qemu with python lib Balamuruhan S
2019-08-07 10:20 ` Philippe Mathieu-Daudé
2019-08-08 10:10 ` Stefan Hajnoczi
2019-08-08 10:33 ` Philippe Mathieu-Daudé
2019-08-08 10:53 ` Daniel P. Berrangé
2019-08-09 8:46 ` Stefan Hajnoczi
2019-08-12 4:53 ` Balamuruhan S
2019-08-08 10:09 ` Stefan Hajnoczi
2019-08-11 6:39 ` Balamuruhan S
2019-08-08 10:49 ` Daniel P. Berrangé
2019-08-08 12:45 ` Philippe Mathieu-Daudé
2019-08-09 4:39 ` David Gibson
2019-08-12 4:45 ` Balamuruhan S
2019-08-07 7:14 ` [Qemu-devel] [RFC PATCH 2/6] hw/ppc/pnv_xscom: extend xscom to use python interface Balamuruhan S
2019-08-08 9:04 ` Cédric Le Goater
2019-08-07 7:14 ` [Qemu-devel] [RFC PATCH 3/6] hw/ppc/pnv_homer: add homer/occ common area emulation for PowerNV Balamuruhan S
2019-08-07 7:54 ` Cédric Le Goater
2019-08-07 10:07 ` Balamuruhan S
2019-08-08 8:32 ` Cédric Le Goater
2019-08-09 4:44 ` David Gibson
2019-08-11 6:34 ` Balamuruhan S
2019-08-07 7:14 ` Balamuruhan S [this message]
2019-08-07 7:59 ` [Qemu-devel] [RFC PATCH 4/6] hw/ppc/pnv: initialize and realize homer/occ common area Cédric Le Goater
2019-08-07 10:12 ` Balamuruhan S
2019-08-08 8:46 ` Cédric Le Goater
2019-08-09 4:45 ` David Gibson
2019-08-07 7:14 ` [Qemu-devel] [RFC PATCH 5/6] hw/ppc/pnv_xscom: retrieve homer/occ base address from PBA BARs Balamuruhan S
2019-08-07 8:01 ` Cédric Le Goater
2019-08-07 10:22 ` Balamuruhan S
2019-08-09 4:45 ` David Gibson
2019-08-07 7:14 ` [Qemu-devel] [RFC PATCH 6/6] hw/ppc/pnv_homer: add python interface support for homer/occ common area Balamuruhan S
2019-08-07 10:27 ` Philippe Mathieu-Daudé
2019-08-11 6:05 ` Balamuruhan S
2019-08-09 4:46 ` David Gibson
2019-08-11 6:19 ` Balamuruhan S
2019-08-07 7:33 ` [Qemu-devel] [RFC PATCH 0/6] Enhancing Qemu MMIO emulation with scripting interface no-reply
2019-08-07 8:15 ` Cédric Le Goater
2019-08-07 10:16 ` Balamuruhan S
2019-08-09 4:49 ` David Gibson
2019-08-12 5:07 ` Balamuruhan S
2019-08-07 8:51 ` no-reply
2019-08-07 9:18 ` no-reply
2019-08-08 10:25 ` Stefan Hajnoczi
2019-08-12 6:03 ` Balamuruhan S
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190807071445.4109-5-bala24@linux.ibm.com \
--to=bala24@linux.ibm.com \
--cc=anju@linux.vnet.ibm.com \
--cc=clg@kaod.org \
--cc=david@gibson.dropbear.id.au \
--cc=hari@linux.vnet.ibm.com \
--cc=maddy@linux.vnet.ibm.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).