From: Harsh Prateek Bora <harshpb@linux.ibm.com>
To: qemu-devel@nongnu.org
Cc: Caleb Schlossin <calebs@linux.ibm.com>,
Michael Kowal <kowal@linux.ibm.com>,
Aditya Gupta <adityag@linux.ibm.com>,
Chalapathi V <chalapathi.v@linux.ibm.com>,
Glenn Miles <milesg@linux.ibm.com>
Subject: [PULL 08/10] hw/ppc: Add VMSTATE information to PnvPsi
Date: Mon, 12 Jan 2026 16:04:31 +0530 [thread overview]
Message-ID: <20260112103433.8451-9-harshpb@linux.ibm.com> (raw)
In-Reply-To: <20260112103433.8451-1-harshpb@linux.ibm.com>
From: Caleb Schlossin <calebs@linux.ibm.com>
PnvPsi needs to be able to save/load snapshots. Add VMSTATE information
to the device class and a post_load() method to restore dynamic data items and
memory region mappings.
Signed-off-by: Michael Kowal <kowal@linux.ibm.com>
Reviewed-by: Michael Kowal <kowal@linux.ibm.com>
Reviewed-by: Aditya Gupta <adityag@linux.ibm.com>
Reviewed-by: Chalapathi V <chalapathi.v@linux.ibm.com>
Signed-off-by: Caleb Schlossin <calebs@linux.ibm.com>
Reviewed-by: Glenn Miles <milesg@linux.ibm.com>
Link: https://lore.kernel.org/qemu-devel/20260105160138.3242709-8-calebs@linux.ibm.com
Signed-off-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
---
hw/ppc/pnv_psi.c | 36 ++++++++++++++++++++++++++++++++++--
1 file changed, 34 insertions(+), 2 deletions(-)
diff --git a/hw/ppc/pnv_psi.c b/hw/ppc/pnv_psi.c
index 264568cdfb..e8701c6100 100644
--- a/hw/ppc/pnv_psi.c
+++ b/hw/ppc/pnv_psi.c
@@ -25,6 +25,7 @@
#include "qemu/module.h"
#include "system/reset.h"
#include "qapi/error.h"
+#include "migration/vmstate.h"
#include "hw/ppc/fdt.h"
@@ -130,12 +131,11 @@ static void pnv_psi_set_bar(PnvPsi *psi, uint64_t bar)
{
PnvPsiClass *ppc = PNV_PSI_GET_CLASS(psi);
MemoryRegion *sysmem = get_system_memory();
- uint64_t old = psi->regs[PSIHB_XSCOM_BAR];
psi->regs[PSIHB_XSCOM_BAR] = bar & (ppc->bar_mask | PSIHB_BAR_EN);
/* Update MR, always remove it first */
- if (old & PSIHB_BAR_EN) {
+ if (memory_region_is_mapped(&psi->regs_mr)) {
memory_region_del_subregion(sysmem, &psi->regs_mr);
}
@@ -919,6 +919,37 @@ static const TypeInfo pnv_psi_power9_info = {
},
};
+static int vmstate_pnv_psi_post_load(void *opaque, int version_id)
+{
+ PnvPsi *psi = PNV_PSI(opaque);
+ Pnv9Psi *psi9 = PNV9_PSI(psi);
+ MemoryRegion *sysmem = get_system_memory();
+ uint64_t esb_bar;
+ hwaddr esb_addr;
+
+ /* Set the ESB MMIO mapping */
+ esb_bar = psi->regs[PSIHB_REG(PSIHB9_ESB_CI_BASE)];
+
+ if (esb_bar & PSIHB9_ESB_CI_VALID) {
+ esb_addr = esb_bar & PSIHB9_ESB_CI_ADDR_MASK;
+ memory_region_add_subregion(sysmem, esb_addr,
+ &psi9->source.esb_mmio);
+ }
+
+ return 0;
+}
+
+static const VMStateDescription vmstate_pnv_psi = {
+ .name = TYPE_PNV_PSI,
+ .version_id = 1,
+ .minimum_version_id = 1,
+ .post_load = vmstate_pnv_psi_post_load,
+ .fields = (const VMStateField[]) {
+ VMSTATE_UINT64_ARRAY(regs, PnvPsi, PSIHB_XSCOM_MAX),
+ VMSTATE_END_OF_LIST()
+ }
+};
+
static void pnv_psi_power10_class_init(ObjectClass *klass, const void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
@@ -926,6 +957,7 @@ static void pnv_psi_power10_class_init(ObjectClass *klass, const void *data)
static const char compat[] = "ibm,power10-psihb-x\0ibm,psihb-x";
dc->desc = "PowerNV PSI Controller POWER10";
+ dc->vmsd = &vmstate_pnv_psi;
ppc->xscom_pcba = PNV10_XSCOM_PSIHB_BASE;
ppc->xscom_size = PNV10_XSCOM_PSIHB_SIZE;
--
2.52.0
next prev parent reply other threads:[~2026-01-12 10:36 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-12 10:34 [PULL 00/10] ppc-for-11.0 queue Harsh Prateek Bora
2026-01-12 10:34 ` [PULL 01/10] target/ppc/kvm : Use macro names instead of hardcoded constants as return values Harsh Prateek Bora
2026-01-12 10:34 ` [PULL 02/10] hw/ppc: Add VMSTATE information for LPC model Harsh Prateek Bora
2026-01-12 10:34 ` [PULL 03/10] hw/ppc: Add pnv_spi vmstate support Harsh Prateek Bora
2026-01-12 10:34 ` [PULL 04/10] hw/ppc: Add pnv_i2c " Harsh Prateek Bora
2026-01-12 10:34 ` [PULL 05/10] hw/ppc: pnv_adu.c added " Harsh Prateek Bora
2026-01-12 10:34 ` [PULL 06/10] hw/ppc: pnv_core.c add " Harsh Prateek Bora
2026-01-12 10:34 ` [PULL 07/10] hw/ppc: pnv_chiptod.c " Harsh Prateek Bora
2026-01-12 10:34 ` Harsh Prateek Bora [this message]
2026-01-12 10:34 ` [PULL 09/10] target/ppc: Fix env->quiesced migration Harsh Prateek Bora
2026-01-12 10:34 ` [PULL 10/10] tests/functional: Add a OS level migration test for pseries Harsh Prateek Bora
2026-01-13 0:50 ` [PULL 00/10] ppc-for-11.0 queue Richard Henderson
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=20260112103433.8451-9-harshpb@linux.ibm.com \
--to=harshpb@linux.ibm.com \
--cc=adityag@linux.ibm.com \
--cc=calebs@linux.ibm.com \
--cc=chalapathi.v@linux.ibm.com \
--cc=kowal@linux.ibm.com \
--cc=milesg@linux.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.