[PULL 46/71] hw/pci-host: Constify VMState

2023-12-29 Thread Richard Henderson
Tested-by: Philippe Mathieu-Daudé 
Reviewed-by: Philippe Mathieu-Daudé 
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-47-richard.hender...@linaro.org>
---
 hw/pci-host/astro.c  |  4 ++--
 hw/pci-host/bonito.c |  2 +-
 hw/pci-host/designware.c | 10 +-
 hw/pci-host/dino.c   |  2 +-
 hw/pci-host/gpex.c   |  2 +-
 hw/pci-host/gt64120.c|  2 +-
 hw/pci-host/i440fx.c |  2 +-
 hw/pci-host/ppce500.c|  6 +++---
 hw/pci-host/q35.c|  2 +-
 hw/pci-host/raven.c  |  2 +-
 hw/pci-host/versatile.c  |  2 +-
 11 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/hw/pci-host/astro.c b/hw/pci-host/astro.c
index 7d68ccee7e..f4de70475c 100644
--- a/hw/pci-host/astro.c
+++ b/hw/pci-host/astro.c
@@ -459,7 +459,7 @@ static const VMStateDescription vmstate_elroy = {
 .name = "Elroy",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64(hpa, ElroyState),
 VMSTATE_UINT32(pci_bus_num, ElroyState),
 VMSTATE_UINT64(config_address, ElroyState),
@@ -691,7 +691,7 @@ static const VMStateDescription vmstate_astro = {
 .name = "Astro",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64(ioc_ctrl, AstroState),
 VMSTATE_UINT64(ioc_status_ctrl, AstroState),
 VMSTATE_UINT64_ARRAY(ioc_ranges, AstroState, (0x03d8 - 0x300) / 8),
diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c
index bab661f3ce..1f0c435348 100644
--- a/hw/pci-host/bonito.c
+++ b/hw/pci-host/bonito.c
@@ -619,7 +619,7 @@ static const VMStateDescription vmstate_bonito = {
 .name = "Bonito",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_PCI_DEVICE(dev, PCIBonitoState),
 VMSTATE_END_OF_LIST()
 }
diff --git a/hw/pci-host/designware.c b/hw/pci-host/designware.c
index f477f97847..dd9e389c07 100644
--- a/hw/pci-host/designware.c
+++ b/hw/pci-host/designware.c
@@ -529,7 +529,7 @@ static const VMStateDescription 
vmstate_designware_pcie_msi_bank = {
 .name = "designware-pcie-msi-bank",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(enable, DesignwarePCIEMSIBank),
 VMSTATE_UINT32(mask, DesignwarePCIEMSIBank),
 VMSTATE_UINT32(status, DesignwarePCIEMSIBank),
@@ -541,7 +541,7 @@ static const VMStateDescription vmstate_designware_pcie_msi 
= {
 .name = "designware-pcie-msi",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64(base, DesignwarePCIEMSI),
 VMSTATE_STRUCT_ARRAY(intr,
  DesignwarePCIEMSI,
@@ -557,7 +557,7 @@ static const VMStateDescription 
vmstate_designware_pcie_viewport = {
 .name = "designware-pcie-viewport",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64(base, DesignwarePCIEViewport),
 VMSTATE_UINT64(target, DesignwarePCIEViewport),
 VMSTATE_UINT32(limit, DesignwarePCIEViewport),
@@ -570,7 +570,7 @@ static const VMStateDescription 
vmstate_designware_pcie_root = {
 .name = "designware-pcie-root",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_PCI_DEVICE(parent_obj, PCIBridge),
 VMSTATE_UINT32(atu_viewport, DesignwarePCIERoot),
 VMSTATE_STRUCT_2DARRAY(viewports,
@@ -718,7 +718,7 @@ static const VMStateDescription 
vmstate_designware_pcie_host = {
 .name = "designware-pcie-host",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_STRUCT(root,
DesignwarePCIEHost,
1,
diff --git a/hw/pci-host/dino.c b/hw/pci-host/dino.c
index 5b0947a16c..d992c4bb69 100644
--- a/hw/pci-host/dino.c
+++ b/hw/pci-host/dino.c
@@ -287,7 +287,7 @@ static const VMStateDescription vmstate_dino = {
 .name = "Dino",
 .version_id = 2,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(iar0, DinoState),
 VMSTATE_UINT32(iar1, DinoState),
 VMSTATE_UINT32(imr, DinoState),
diff --git a/hw/pci-host/gpex.c b/hw/pci-host/gpex.c
index a6752fac5e..e117e47fa7 100644
--- a/hw/pci-host/gpex.c
+++ b/hw/pci-host/gpex.c
@@ -195,7 +195,7 @@ static const VMStateDescription vmstate_gpex_root = {
 .name = "gpex_root",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_PCI_DEVICE(par

[PULL 21/71] hw/acpi: Constify VMState

2023-12-29 Thread Richard Henderson
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-22-richard.hender...@linaro.org>
---
 hw/acpi/cpu.c  |  4 ++--
 hw/acpi/erst.c |  2 +-
 hw/acpi/generic_event_device.c | 12 ++--
 hw/acpi/ich9.c | 12 ++--
 hw/acpi/ich9_tco.c |  2 +-
 hw/acpi/memory_hotplug.c   |  4 ++--
 hw/acpi/pcihp.c|  2 +-
 hw/acpi/piix4.c| 12 ++--
 hw/acpi/vmgenid.c  |  2 +-
 9 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/hw/acpi/cpu.c b/hw/acpi/cpu.c
index 011d2c6c2d..2d81c1e790 100644
--- a/hw/acpi/cpu.c
+++ b/hw/acpi/cpu.c
@@ -297,7 +297,7 @@ static const VMStateDescription vmstate_cpuhp_sts = {
 .name = "CPU hotplug device state",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields  = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_BOOL(is_inserting, AcpiCpuStatus),
 VMSTATE_BOOL(is_removing, AcpiCpuStatus),
 VMSTATE_UINT32(ost_event, AcpiCpuStatus),
@@ -310,7 +310,7 @@ const VMStateDescription vmstate_cpu_hotplug = {
 .name = "CPU hotplug state",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields  = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(selector, CPUHotplugState),
 VMSTATE_UINT8(command, CPUHotplugState),
 VMSTATE_STRUCT_VARRAY_POINTER_UINT32(devs, CPUHotplugState, dev_count,
diff --git a/hw/acpi/erst.c b/hw/acpi/erst.c
index ba751dc60e..b2f1b13630 100644
--- a/hw/acpi/erst.c
+++ b/hw/acpi/erst.c
@@ -932,7 +932,7 @@ static const VMStateDescription erst_vmstate  = {
 .version_id = 1,
 .minimum_version_id = 1,
 .post_load = erst_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8(operation, ERSTDeviceState),
 VMSTATE_UINT8(busy_status, ERSTDeviceState),
 VMSTATE_UINT8(command_status, ERSTDeviceState),
diff --git a/hw/acpi/generic_event_device.c b/hw/acpi/generic_event_device.c
index a3d31631fe..2d6e91b124 100644
--- a/hw/acpi/generic_event_device.c
+++ b/hw/acpi/generic_event_device.c
@@ -312,7 +312,7 @@ static const VMStateDescription vmstate_memhp_state = {
 .name = "acpi-ged/memhp",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields  = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_MEMORY_HOTPLUG(memhp_state, AcpiGedState),
 VMSTATE_END_OF_LIST()
 }
@@ -322,7 +322,7 @@ static const VMStateDescription vmstate_ged_state = {
 .name = "acpi-ged-state",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields  = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(sel, GEDState),
 VMSTATE_END_OF_LIST()
 }
@@ -332,7 +332,7 @@ static const VMStateDescription vmstate_ghes = {
 .name = "acpi-ghes",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64(ghes_addr_le, AcpiGhesState),
 VMSTATE_END_OF_LIST()
 },
@@ -349,7 +349,7 @@ static const VMStateDescription vmstate_ghes_state = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = ghes_needed,
-.fields  = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_STRUCT(ghes_state, AcpiGedState, 1,
vmstate_ghes, AcpiGhesState),
 VMSTATE_END_OF_LIST()
@@ -360,11 +360,11 @@ static const VMStateDescription vmstate_acpi_ged = {
 .name = "acpi-ged",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_STRUCT(ged_state, AcpiGedState, 1, vmstate_ged_state, 
GEDState),
 VMSTATE_END_OF_LIST(),
 },
-.subsections = (const VMStateDescription * []) {
+.subsections = (const VMStateDescription * const []) {
 &vmstate_memhp_state,
 &vmstate_ghes_state,
 NULL
diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c
index 25e2c7243e..573d032e8e 100644
--- a/hw/acpi/ich9.c
+++ b/hw/acpi/ich9.c
@@ -164,7 +164,7 @@ static const VMStateDescription vmstate_memhp_state = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = vmstate_test_use_memhp,
-.fields  = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_MEMORY_HOTPLUG(acpi_memory_hotplug, ICH9LPCPMRegs),
 VMSTATE_END_OF_LIST()
 }
@@ -181,7 +181,7 @@ static const VMStateDescription vmstate_tco_io_state = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = vmstate_test_use_tco,
-.fields  = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_STRUCT(tco_regs, ICH9LPCPMRegs, 1, vmstate_tco_io_sts,
TCOIORegs),
 VMSTATE_END_OF_LIST()
@@ -208,7 +208,7 @@ static const VMStateDescription vmstate_cpuhp_stat

[PULL 49/71] hw/rtc: Constify VMState

2023-12-29 Thread Richard Henderson
Reviewed-by: Philippe Mathieu-Daudé 
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-50-richard.hender...@linaro.org>
---
 hw/rtc/allwinner-rtc.c   | 2 +-
 hw/rtc/aspeed_rtc.c  | 2 +-
 hw/rtc/ds1338.c  | 2 +-
 hw/rtc/exynos4210_rtc.c  | 2 +-
 hw/rtc/goldfish_rtc.c| 2 +-
 hw/rtc/ls7a_rtc.c| 2 +-
 hw/rtc/m48t59.c  | 2 +-
 hw/rtc/mc146818rtc.c | 6 +++---
 hw/rtc/pl031.c   | 6 +++---
 hw/rtc/twl92230.c| 4 ++--
 hw/rtc/xlnx-zynqmp-rtc.c | 2 +-
 11 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/hw/rtc/allwinner-rtc.c b/hw/rtc/allwinner-rtc.c
index 7e493f0e79..2ac50b30cb 100644
--- a/hw/rtc/allwinner-rtc.c
+++ b/hw/rtc/allwinner-rtc.c
@@ -305,7 +305,7 @@ static const VMStateDescription allwinner_rtc_vmstate = {
 .name = "allwinner-rtc",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32_ARRAY(regs, AwRtcState, AW_RTC_REGS_NUM),
 VMSTATE_END_OF_LIST()
 }
diff --git a/hw/rtc/aspeed_rtc.c b/hw/rtc/aspeed_rtc.c
index fa861e2d49..589d9a5a7a 100644
--- a/hw/rtc/aspeed_rtc.c
+++ b/hw/rtc/aspeed_rtc.c
@@ -137,7 +137,7 @@ static const MemoryRegionOps aspeed_rtc_ops = {
 static const VMStateDescription vmstate_aspeed_rtc = {
 .name = TYPE_ASPEED_RTC,
 .version_id = 2,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32_ARRAY(reg, AspeedRtcState, 0x18),
 VMSTATE_INT64(offset, AspeedRtcState),
 VMSTATE_END_OF_LIST()
diff --git a/hw/rtc/ds1338.c b/hw/rtc/ds1338.c
index 36d8121ddd..e479661c39 100644
--- a/hw/rtc/ds1338.c
+++ b/hw/rtc/ds1338.c
@@ -46,7 +46,7 @@ static const VMStateDescription vmstate_ds1338 = {
 .name = "ds1338",
 .version_id = 2,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_I2C_SLAVE(parent_obj, DS1338State),
 VMSTATE_INT64(offset, DS1338State),
 VMSTATE_UINT8_V(wday_offset, DS1338State, 2),
diff --git a/hw/rtc/exynos4210_rtc.c b/hw/rtc/exynos4210_rtc.c
index cc7101c530..319371f97d 100644
--- a/hw/rtc/exynos4210_rtc.c
+++ b/hw/rtc/exynos4210_rtc.c
@@ -122,7 +122,7 @@ static const VMStateDescription 
vmstate_exynos4210_rtc_state = {
 .name = "exynos4210.rtc",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(reg_intp, Exynos4210RTCState),
 VMSTATE_UINT32(reg_rtccon, Exynos4210RTCState),
 VMSTATE_UINT32(reg_ticcnt, Exynos4210RTCState),
diff --git a/hw/rtc/goldfish_rtc.c b/hw/rtc/goldfish_rtc.c
index 19a56402a0..01acf30b27 100644
--- a/hw/rtc/goldfish_rtc.c
+++ b/hw/rtc/goldfish_rtc.c
@@ -242,7 +242,7 @@ static const VMStateDescription goldfish_rtc_vmstate = {
 .version_id = 2,
 .pre_save = goldfish_rtc_pre_save,
 .post_load = goldfish_rtc_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64(tick_offset_vmstate, GoldfishRTCState),
 VMSTATE_UINT64(alarm_next, GoldfishRTCState),
 VMSTATE_UINT32(alarm_running, GoldfishRTCState),
diff --git a/hw/rtc/ls7a_rtc.c b/hw/rtc/ls7a_rtc.c
index 1f9e38a735..ac28c1165b 100644
--- a/hw/rtc/ls7a_rtc.c
+++ b/hw/rtc/ls7a_rtc.c
@@ -454,7 +454,7 @@ static const VMStateDescription vmstate_ls7a_rtc = {
 .minimum_version_id = 1,
 .pre_save = ls7a_rtc_pre_save,
 .post_load = ls7a_rtc_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_INT64(offset_toy, LS7ARtcState),
 VMSTATE_INT64(offset_rtc, LS7ARtcState),
 VMSTATE_UINT32_ARRAY(toymatch, LS7ARtcState, TIMER_NUMS),
diff --git a/hw/rtc/m48t59.c b/hw/rtc/m48t59.c
index 2e2c849985..aa44c4b20c 100644
--- a/hw/rtc/m48t59.c
+++ b/hw/rtc/m48t59.c
@@ -526,7 +526,7 @@ static const VMStateDescription vmstate_m48t59 = {
 .name = "m48t59",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8(lock, M48t59State),
 VMSTATE_UINT16(addr, M48t59State),
 VMSTATE_VBUFFER_UINT32(buffer, M48t59State, 0, NULL, size),
diff --git a/hw/rtc/mc146818rtc.c b/hw/rtc/mc146818rtc.c
index 2d391a8396..f4c1869232 100644
--- a/hw/rtc/mc146818rtc.c
+++ b/hw/rtc/mc146818rtc.c
@@ -817,7 +817,7 @@ static const VMStateDescription 
vmstate_rtc_irq_reinject_on_ack_count = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = rtc_irq_reinject_on_ack_count_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT16(irq_reinject_on_ack_count, MC146818RtcState),
 VMSTATE_END_OF_LIST()
 }
@@ -829,7 +829,7 @@ static const VMStateDescription vmstate_rtc = {
 .minimum_version_id = 1,
 .pre_save = rtc_pre_save,
 .post_load = rtc_post_load,
-.f

[PULL 59/71] hw/vfio: Constify VMState

2023-12-29 Thread Richard Henderson
Signed-off-by: Richard Henderson 
Reviewed-by: Cédric Le Goater 
Message-Id: <20231221031652.119827-60-richard.hender...@linaro.org>
---
 hw/vfio/display.c | 2 +-
 hw/vfio/pci.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/vfio/display.c b/hw/vfio/display.c
index 7a10fa8604..1aa440c663 100644
--- a/hw/vfio/display.c
+++ b/hw/vfio/display.c
@@ -560,7 +560,7 @@ const VMStateDescription vfio_display_vmstate = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = migrate_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_STRUCT_POINTER(ramfb, VFIODisplay, ramfb_vmstate, RAMFBState),
 VMSTATE_END_OF_LIST(),
 }
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index 1874ec1aba..9f838978be 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -2561,7 +2561,7 @@ const VMStateDescription vmstate_vfio_display = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = vfio_display_migration_needed,
-.fields = (VMStateField[]){
+.fields = (const VMStateField[]){
 VMSTATE_STRUCT_POINTER(dpy, VFIOPCIDevice, vfio_display_vmstate,
VFIODisplay),
 VMSTATE_END_OF_LIST()
@@ -2572,12 +2572,12 @@ const VMStateDescription vmstate_vfio_pci_config = {
 .name = "VFIOPCIDevice",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_PCI_DEVICE(pdev, VFIOPCIDevice),
 VMSTATE_MSIX_TEST(pdev, VFIOPCIDevice, vfio_msix_present),
 VMSTATE_END_OF_LIST()
 },
-.subsections = (const VMStateDescription * []) {
+.subsections = (const VMStateDescription * const []) {
 &vmstate_vfio_display,
 NULL
 }
-- 
2.34.1




[PULL 70/71] tests/unit/test-vmstate: Constify VMState

2023-12-29 Thread Richard Henderson
While const data in tests is not particularly important,
this makes a grep test clear across the tree.

Reviewed-by: Juan Quintela 
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-71-richard.hender...@linaro.org>
---
 tests/unit/test-vmstate.c | 36 ++--
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/tests/unit/test-vmstate.c b/tests/unit/test-vmstate.c
index 0b7d5ecd68..c4f9faa273 100644
--- a/tests/unit/test-vmstate.c
+++ b/tests/unit/test-vmstate.c
@@ -197,7 +197,7 @@ static const VMStateDescription vmstate_simple_primitive = {
 .name = "simple/primitive",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_BOOL(b_1, TestSimple),
 VMSTATE_BOOL(b_2, TestSimple),
 VMSTATE_UINT8(u8_1, TestSimple),
@@ -299,7 +299,7 @@ static const VMStateDescription vmstate_simple_arr = {
 .name = "simple/array",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT16_ARRAY(u16_1, TestSimpleArray, 3),
 VMSTATE_END_OF_LIST()
 }
@@ -341,7 +341,7 @@ static const VMStateDescription vmstate_versioned = {
 .name = "test/versioned",
 .version_id = 2,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(a, TestStruct),
 VMSTATE_UINT32_V(b, TestStruct, 2), /* Versioned field in the middle, 
so
  * we catch bugs more easily.
@@ -412,7 +412,7 @@ static const VMStateDescription vmstate_skipping = {
 .name = "test/skip",
 .version_id = 2,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(a, TestStruct),
 VMSTATE_UINT32(b, TestStruct),
 VMSTATE_UINT32_TEST(c, TestStruct, test_skip),
@@ -524,7 +524,7 @@ const VMStateDescription vmsd_tst = {
 .name = "test/tst",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_INT32(i, TestStructTriv),
 VMSTATE_END_OF_LIST()
 }
@@ -542,7 +542,7 @@ const VMStateDescription vmsd_arps = {
 .name = "test/arps",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_ARRAY_OF_POINTER_TO_STRUCT(ar, TestArrayOfPtrToStuct,
 AR_SIZE, 0, vmsd_tst, TestStructTriv),
 VMSTATE_END_OF_LIST()
@@ -630,7 +630,7 @@ const VMStateDescription vmsd_arpp = {
 .name = "test/arps",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_ARRAY_OF_POINTER(ar, TestArrayOfPtrToInt,
 AR_SIZE, 0, vmstate_info_int32, int32_t*),
 VMSTATE_END_OF_LIST()
@@ -685,7 +685,7 @@ static const VMStateDescription vmstate_q_element = {
 .name = "test/queue-element",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_BOOL(b, TestQtailqElement),
 VMSTATE_UINT8(u8, TestQtailqElement),
 VMSTATE_END_OF_LIST()
@@ -696,7 +696,7 @@ static const VMStateDescription vmstate_q = {
 .name = "test/queue",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_INT16(i16, TestQtailq),
 VMSTATE_QTAILQ_V(q, TestQtailq, 1, vmstate_q_element, 
TestQtailqElement,
  next),
@@ -821,7 +821,7 @@ typedef struct TestGTreeInterval {
 .name = "interval",\
 .version_id = 1,   \
 .minimum_version_id = 1,   \
-.fields = (VMStateField[]) {   \
+.fields = (const VMStateField[]) { \
 VMSTATE_UINT64(low, TestGTreeInterval),\
 VMSTATE_UINT64(high, TestGTreeInterval),   \
 VMSTATE_END_OF_LIST()  \
@@ -839,7 +839,7 @@ typedef struct TestGTreeMapping {
 .name = "mapping",\
 .version_id = 1,  \
 .minimum_version_id = 1,  \
-.fields = (VMStateField[]) {  \
+.fields = (const VMStateField[]) {\
 VMSTATE_UINT64(phys_addr, TestGTreeMapping),  \
 VMSTATE_UINT32(flags, TestGTreeMapping),  \
 VMSTATE_END_OF_LIST() \
@@ -915,7 +915,7 @@ static const VMStateDescription vmstate_domain = {
 .version_id = 1,
 .minimum_version_id = 1,
 .pre_load = domain_preload,
-.fields = (VMStateField[]) {
+.fields = (const 

[PULL 69/71] util/fifo8: Constify VMState

2023-12-29 Thread Richard Henderson
Reviewed-by: Philippe Mathieu-Daudé 
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-70-richard.hender...@linaro.org>
---
 util/fifo8.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/util/fifo8.c b/util/fifo8.c
index d4d1c135e0..de8fd0f1c5 100644
--- a/util/fifo8.c
+++ b/util/fifo8.c
@@ -109,7 +109,7 @@ const VMStateDescription vmstate_fifo8 = {
 .name = "Fifo8",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_VBUFFER_UINT32(data, Fifo8, 1, NULL, capacity),
 VMSTATE_UINT32(head, Fifo8),
 VMSTATE_UINT32(num, Fifo8),
-- 
2.34.1




[PULL 63/71] audio: Constify VMState

2023-12-29 Thread Richard Henderson
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-64-richard.hender...@linaro.org>
---
 audio/audio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/audio/audio.c b/audio/audio.c
index 8d1e4ad922..a1097bb016 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -1683,7 +1683,7 @@ static const VMStateDescription vmstate_audio = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = vmstate_audio_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_END_OF_LIST()
 }
 };
-- 
2.34.1




[PULL 47/71] hw/ppc: Constify VMState

2023-12-29 Thread Richard Henderson
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-48-richard.hender...@linaro.org>
---
 hw/ppc/ppc.c|  2 +-
 hw/ppc/ppc4xx_pci.c |  6 +++---
 hw/ppc/prep_systemio.c  |  2 +-
 hw/ppc/rs6000_mc.c  |  2 +-
 hw/ppc/spapr.c  | 20 ++--
 hw/ppc/spapr_caps.c |  2 +-
 hw/ppc/spapr_cpu_core.c | 12 ++--
 hw/ppc/spapr_drc.c  |  8 
 hw/ppc/spapr_iommu.c|  6 +++---
 hw/ppc/spapr_nvdimm.c   |  4 ++--
 hw/ppc/spapr_ovec.c |  2 +-
 hw/ppc/spapr_pci.c  |  6 +++---
 hw/ppc/spapr_rtc.c  |  2 +-
 hw/ppc/spapr_vio.c  |  2 +-
 14 files changed, 38 insertions(+), 38 deletions(-)

diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c
index be167710a3..c532d79f0e 100644
--- a/hw/ppc/ppc.c
+++ b/hw/ppc/ppc.c
@@ -1066,7 +1066,7 @@ const VMStateDescription vmstate_ppc_timebase = {
 .version_id = 1,
 .minimum_version_id = 1,
 .pre_save = timebase_pre_save,
-.fields  = (VMStateField []) {
+.fields = (const VMStateField []) {
 VMSTATE_UINT64(guest_timebase, PPCTimebase),
 VMSTATE_INT64(time_of_the_day_ns, PPCTimebase),
 VMSTATE_END_OF_LIST()
diff --git a/hw/ppc/ppc4xx_pci.c b/hw/ppc/ppc4xx_pci.c
index 6652119008..0a07aab5d1 100644
--- a/hw/ppc/ppc4xx_pci.c
+++ b/hw/ppc/ppc4xx_pci.c
@@ -276,7 +276,7 @@ static const VMStateDescription vmstate_pci_master_map = {
 .name = "pci_master_map",
 .version_id = 0,
 .minimum_version_id = 0,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(la, struct PCIMasterMap),
 VMSTATE_UINT32(ma, struct PCIMasterMap),
 VMSTATE_UINT32(pcila, struct PCIMasterMap),
@@ -289,7 +289,7 @@ static const VMStateDescription vmstate_pci_target_map = {
 .name = "pci_target_map",
 .version_id = 0,
 .minimum_version_id = 0,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(ms, struct PCITargetMap),
 VMSTATE_UINT32(la, struct PCITargetMap),
 VMSTATE_END_OF_LIST()
@@ -300,7 +300,7 @@ static const VMStateDescription vmstate_ppc4xx_pci = {
 .name = "ppc4xx_pci",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_STRUCT_ARRAY(pmm, PPC4xxPCIState, PPC4xx_PCI_NR_PMMS, 1,
  vmstate_pci_master_map,
  struct PCIMasterMap),
diff --git a/hw/ppc/prep_systemio.c b/hw/ppc/prep_systemio.c
index c96cefb13d..4d3a251ed8 100644
--- a/hw/ppc/prep_systemio.c
+++ b/hw/ppc/prep_systemio.c
@@ -277,7 +277,7 @@ static const VMStateDescription vmstate_prep_systemio = {
 .name = "prep_systemio",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8(sreset, PrepSystemIoState),
 VMSTATE_UINT8(system_control, PrepSystemIoState),
 VMSTATE_UINT8(iomap_type, PrepSystemIoState),
diff --git a/hw/ppc/rs6000_mc.c b/hw/ppc/rs6000_mc.c
index c0bc212e92..b35f8ba112 100644
--- a/hw/ppc/rs6000_mc.c
+++ b/hw/ppc/rs6000_mc.c
@@ -202,7 +202,7 @@ static const VMStateDescription vmstate_rs6000mc = {
 .name = "rs6000-mc",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8(port0820_index, RS6000MCState),
 VMSTATE_END_OF_LIST()
 },
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 9b6c1c129f..4997aa4f1d 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -152,7 +152,7 @@ static const VMStateDescription pre_2_10_vmstate_dummy_icp 
= {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = pre_2_10_vmstate_dummy_icp_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UNUSED(4), /* uint32_t xirr */
 VMSTATE_UNUSED(1), /* uint8_t pending_priority */
 VMSTATE_UNUSED(1), /* uint8_t mfrr */
@@ -1919,7 +1919,7 @@ static const VMStateDescription vmstate_spapr_event_entry 
= {
 .name = "spapr_event_log_entry",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(summary, SpaprEventLogEntry),
 VMSTATE_UINT32(extended_length, SpaprEventLogEntry),
 VMSTATE_VBUFFER_ALLOC_UINT32(extended_log, SpaprEventLogEntry, 0,
@@ -1933,7 +1933,7 @@ static const VMStateDescription 
vmstate_spapr_pending_events = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = spapr_pending_events_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_QTAILQ_V(pending_events, SpaprMachineState, 1,
  vmstate_spapr_event_entry, SpaprEventLogEntry, next),
 VMSTATE_END_OF_LIST()
@@ -1989,7 +1989,7 @@ static const VMStateDescription vmstate_spapr_ov5_cas = {
 .version_id = 1,

[PULL 50/71] hw/s390x: Constify VMState

2023-12-29 Thread Richard Henderson
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-51-richard.hender...@linaro.org>
---
 hw/s390x/ccw-device.c |  2 +-
 hw/s390x/css.c| 36 ++--
 hw/s390x/event-facility.c |  8 
 hw/s390x/ipl.c|  8 
 hw/s390x/sclpquiesce.c|  2 +-
 hw/s390x/virtio-ccw.c |  4 ++--
 6 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/hw/s390x/ccw-device.c b/hw/s390x/ccw-device.c
index 95f269ab44..fb8c1acc64 100644
--- a/hw/s390x/ccw-device.c
+++ b/hw/s390x/ccw-device.c
@@ -66,7 +66,7 @@ const VMStateDescription vmstate_ccw_dev = {
 .name = "s390_ccw_dev",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_STRUCT_POINTER(sch, CcwDevice, vmstate_subch_dev, SubchDev),
 VMSTATE_END_OF_LIST()
 }
diff --git a/hw/s390x/css.c b/hw/s390x/css.c
index bcedec2fc8..295530963a 100644
--- a/hw/s390x/css.c
+++ b/hw/s390x/css.c
@@ -32,7 +32,7 @@ static const VMStateDescription vmstate_crw = {
 .name = "s390_crw",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT16(flags, CRW),
 VMSTATE_UINT16(rsid, CRW),
 VMSTATE_END_OF_LIST()
@@ -43,7 +43,7 @@ static const VMStateDescription vmstate_crw_container = {
 .name = "s390_crw_container",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_STRUCT(crw, CrwContainer, 0, vmstate_crw, CRW),
 VMSTATE_END_OF_LIST()
 },
@@ -59,7 +59,7 @@ static const VMStateDescription vmstate_chp_info = {
 .name = "s390_chp_info",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8(in_use, ChpInfo),
 VMSTATE_UINT8(type, ChpInfo),
 VMSTATE_UINT8(is_virtual, ChpInfo),
@@ -77,7 +77,7 @@ static const VMStateDescription vmstate_scsw = {
 .name = "s390_scsw",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT16(flags, SCSW),
 VMSTATE_UINT16(ctrl, SCSW),
 VMSTATE_UINT32(cpa, SCSW),
@@ -92,7 +92,7 @@ static const VMStateDescription vmstate_pmcw = {
 .name = "s390_pmcw",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(intparm, PMCW),
 VMSTATE_UINT16(flags, PMCW),
 VMSTATE_UINT16(devno, PMCW),
@@ -113,7 +113,7 @@ static const VMStateDescription vmstate_schib = {
 .name = "s390_schib",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_STRUCT(pmcw, SCHIB, 0, vmstate_pmcw, PMCW),
 VMSTATE_STRUCT(scsw, SCHIB, 0, vmstate_scsw, SCSW),
 VMSTATE_UINT64(mba, SCHIB),
@@ -127,7 +127,7 @@ static const VMStateDescription vmstate_ccw1 = {
 .name = "s390_ccw1",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8(cmd_code, CCW1),
 VMSTATE_UINT8(flags, CCW1),
 VMSTATE_UINT16(count, CCW1),
@@ -140,7 +140,7 @@ static const VMStateDescription vmstate_ciw = {
 .name = "s390_ciw",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8(type, CIW),
 VMSTATE_UINT8(command, CIW),
 VMSTATE_UINT16(count, CIW),
@@ -152,7 +152,7 @@ static const VMStateDescription vmstate_sense_id = {
 .name = "s390_sense_id",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8(reserved, SenseId),
 VMSTATE_UINT16(cu_type, SenseId),
 VMSTATE_UINT8(cu_model, SenseId),
@@ -168,7 +168,7 @@ static const VMStateDescription vmstate_orb = {
 .name = "s390_orb",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(intparm, ORB),
 VMSTATE_UINT16(ctrl0, ORB),
 VMSTATE_UINT8(lpm, ORB),
@@ -188,7 +188,7 @@ static const VMStateDescription vmstate_schdev_orb = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = vmstate_schdev_orb_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_STRUCT(orb, SubchDev, 1, vmstate_orb, ORB),
 VMSTATE_END_OF_LIST()
 }
@@ -207,7 +207,7 @@ const VMStateDescription vmstate_subch_dev = {
 .minimum_version_id = 1,
 .post_load = subch_dev_post_load,
 .pre_save = subch_dev_pre_save,
-.fields = (VMStateField[]) {
+.fields

[PULL 54/71] hw/sparc: Constify VMState

2023-12-29 Thread Richard Henderson
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-55-richard.hender...@linaro.org>
---
 hw/sparc/sun4m_iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/sparc/sun4m_iommu.c b/hw/sparc/sun4m_iommu.c
index eb40f9377c..06703b1d96 100644
--- a/hw/sparc/sun4m_iommu.c
+++ b/hw/sparc/sun4m_iommu.c
@@ -331,7 +331,7 @@ static const VMStateDescription vmstate_iommu = {
 .name = "iommu",
 .version_id = 2,
 .minimum_version_id = 2,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32_ARRAY(regs, IOMMUState, IOMMU_NREGS),
 VMSTATE_UINT64(iostart, IOMMUState),
 VMSTATE_END_OF_LIST()
-- 
2.34.1




[PULL 61/71] hw/watchdog: Constify VMState

2023-12-29 Thread Richard Henderson
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-62-richard.hender...@linaro.org>
---
 hw/watchdog/allwinner-wdt.c  | 2 +-
 hw/watchdog/cmsdk-apb-watchdog.c | 2 +-
 hw/watchdog/sbsa_gwdt.c  | 2 +-
 hw/watchdog/spapr_watchdog.c | 2 +-
 hw/watchdog/wdt_aspeed.c | 2 +-
 hw/watchdog/wdt_diag288.c| 2 +-
 hw/watchdog/wdt_i6300esb.c   | 2 +-
 hw/watchdog/wdt_ib700.c  | 2 +-
 hw/watchdog/wdt_imx2.c   | 2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/hw/watchdog/allwinner-wdt.c b/hw/watchdog/allwinner-wdt.c
index 6205765efe..d35711c7c5 100644
--- a/hw/watchdog/allwinner-wdt.c
+++ b/hw/watchdog/allwinner-wdt.c
@@ -313,7 +313,7 @@ static const VMStateDescription allwinner_wdt_vmstate = {
 .name = "allwinner-wdt",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_PTIMER(timer, AwWdtState),
 VMSTATE_UINT32_ARRAY(regs, AwWdtState, AW_WDT_REGS_NUM),
 VMSTATE_END_OF_LIST()
diff --git a/hw/watchdog/cmsdk-apb-watchdog.c b/hw/watchdog/cmsdk-apb-watchdog.c
index 5a2cd46eb7..3091e5c3d5 100644
--- a/hw/watchdog/cmsdk-apb-watchdog.c
+++ b/hw/watchdog/cmsdk-apb-watchdog.c
@@ -361,7 +361,7 @@ static const VMStateDescription cmsdk_apb_watchdog_vmstate 
= {
 .name = "cmsdk-apb-watchdog",
 .version_id = 2,
 .minimum_version_id = 2,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_CLOCK(wdogclk, CMSDKAPBWatchdog),
 VMSTATE_PTIMER(timer, CMSDKAPBWatchdog),
 VMSTATE_UINT32(control, CMSDKAPBWatchdog),
diff --git a/hw/watchdog/sbsa_gwdt.c b/hw/watchdog/sbsa_gwdt.c
index 7aa57a8c51..96895d7636 100644
--- a/hw/watchdog/sbsa_gwdt.c
+++ b/hw/watchdog/sbsa_gwdt.c
@@ -28,7 +28,7 @@ static const VMStateDescription vmstate_sbsa_gwdt = {
 .name = "sbsa-gwdt",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_TIMER_PTR(timer, SBSA_GWDTState),
 VMSTATE_UINT32(wcs, SBSA_GWDTState),
 VMSTATE_UINT32(worl, SBSA_GWDTState),
diff --git a/hw/watchdog/spapr_watchdog.c b/hw/watchdog/spapr_watchdog.c
index 55ff1f03c1..2bb1d3c532 100644
--- a/hw/watchdog/spapr_watchdog.c
+++ b/hw/watchdog/spapr_watchdog.c
@@ -226,7 +226,7 @@ static const VMStateDescription vmstate_wdt = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = watchdog_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_TIMER(timer, SpaprWatchdog),
 VMSTATE_UINT8(action, SpaprWatchdog),
 VMSTATE_UINT8(leave_others, SpaprWatchdog),
diff --git a/hw/watchdog/wdt_aspeed.c b/hw/watchdog/wdt_aspeed.c
index 273a49d360..d70b656f8e 100644
--- a/hw/watchdog/wdt_aspeed.c
+++ b/hw/watchdog/wdt_aspeed.c
@@ -218,7 +218,7 @@ static const VMStateDescription vmstate_aspeed_wdt = {
 .name = "vmstate_aspeed_wdt",
 .version_id = 0,
 .minimum_version_id = 0,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_TIMER_PTR(timer, AspeedWDTState),
 VMSTATE_UINT32_ARRAY(regs, AspeedWDTState, ASPEED_WDT_REGS_MAX),
 VMSTATE_END_OF_LIST()
diff --git a/hw/watchdog/wdt_diag288.c b/hw/watchdog/wdt_diag288.c
index 76d89fbf78..1b73b16fb3 100644
--- a/hw/watchdog/wdt_diag288.c
+++ b/hw/watchdog/wdt_diag288.c
@@ -23,7 +23,7 @@ static const VMStateDescription vmstate_diag288 = {
 .name = "vmstate_diag288",
 .version_id = 0,
 .minimum_version_id = 0,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_TIMER_PTR(timer, DIAG288State),
 VMSTATE_BOOL(enabled, DIAG288State),
 VMSTATE_END_OF_LIST()
diff --git a/hw/watchdog/wdt_i6300esb.c b/hw/watchdog/wdt_i6300esb.c
index 54c167cd35..8bce0509cd 100644
--- a/hw/watchdog/wdt_i6300esb.c
+++ b/hw/watchdog/wdt_i6300esb.c
@@ -418,7 +418,7 @@ static const VMStateDescription vmstate_i6300esb = {
  */
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_PCI_DEVICE(dev, I6300State),
 VMSTATE_INT32(reboot_enabled, I6300State),
 VMSTATE_INT32(clock_scale, I6300State),
diff --git a/hw/watchdog/wdt_ib700.c b/hw/watchdog/wdt_ib700.c
index a1750a4957..eea8da6059 100644
--- a/hw/watchdog/wdt_ib700.c
+++ b/hw/watchdog/wdt_ib700.c
@@ -95,7 +95,7 @@ static const VMStateDescription vmstate_ib700 = {
 .name = "ib700_wdt",
 .version_id = 0,
 .minimum_version_id = 0,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_TIMER_PTR(timer, IB700State),
 VMSTATE_END_OF_LIST()
 }
diff --git a/hw/watchdog/wdt_imx2.c b/hw/watchdog/wdt_imx2.c
index 891d7beb2a..6452fc4721 100644
--- a/hw/watchdog/wdt_imx2.c
+++ b/hw/watchdog/wdt_imx2.c
@@ -234,7 +234,7 @@ static 

[PULL 48/71] hw/riscv: Constify VMState

2023-12-29 Thread Richard Henderson
Acked-by: Alistair Francis 
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-49-richard.hender...@linaro.org>
---
 hw/riscv/virt-acpi-build.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/riscv/virt-acpi-build.c b/hw/riscv/virt-acpi-build.c
index 7331248f59..d3bfaf502e 100644
--- a/hw/riscv/virt-acpi-build.c
+++ b/hw/riscv/virt-acpi-build.c
@@ -374,7 +374,7 @@ static const VMStateDescription vmstate_virt_acpi_build = {
 .name = "virt_acpi_build",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_BOOL(patched, AcpiBuildState),
 VMSTATE_END_OF_LIST()
 },
-- 
2.34.1




[PULL 36/71] hw/ipmi: Constify VMState

2023-12-29 Thread Richard Henderson
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-37-richard.hender...@linaro.org>
---
 hw/ipmi/ipmi_bmc_extern.c | 2 +-
 hw/ipmi/ipmi_bmc_sim.c| 2 +-
 hw/ipmi/ipmi_bt.c | 2 +-
 hw/ipmi/ipmi_kcs.c| 2 +-
 hw/ipmi/isa_ipmi_bt.c | 2 +-
 hw/ipmi/isa_ipmi_kcs.c| 2 +-
 hw/ipmi/pci_ipmi_bt.c | 2 +-
 hw/ipmi/pci_ipmi_kcs.c| 2 +-
 hw/ipmi/smbus_ipmi.c  | 2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/hw/ipmi/ipmi_bmc_extern.c b/hw/ipmi/ipmi_bmc_extern.c
index 2117dad35a..29c5af3cc3 100644
--- a/hw/ipmi/ipmi_bmc_extern.c
+++ b/hw/ipmi/ipmi_bmc_extern.c
@@ -479,7 +479,7 @@ static const VMStateDescription vmstate_ipmi_bmc_extern = {
 .version_id = 1,
 .minimum_version_id = 1,
 .post_load = ipmi_bmc_extern_post_migrate,
-.fields  = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_BOOL(send_reset, IPMIBmcExtern),
 VMSTATE_BOOL(waiting_rsp, IPMIBmcExtern),
 VMSTATE_END_OF_LIST()
diff --git a/hw/ipmi/ipmi_bmc_sim.c b/hw/ipmi/ipmi_bmc_sim.c
index 905e091094..33c839c65a 100644
--- a/hw/ipmi/ipmi_bmc_sim.c
+++ b/hw/ipmi/ipmi_bmc_sim.c
@@ -2103,7 +2103,7 @@ static const VMStateDescription vmstate_ipmi_sim = {
 .name = TYPE_IPMI_BMC_SIMULATOR,
 .version_id = 1,
 .minimum_version_id = 1,
-.fields  = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8(bmc_global_enables, IPMIBmcSim),
 VMSTATE_UINT8(msg_flags, IPMIBmcSim),
 VMSTATE_BOOL(watchdog_initialized, IPMIBmcSim),
diff --git a/hw/ipmi/ipmi_bt.c b/hw/ipmi/ipmi_bt.c
index 22f94fb98d..583fc64730 100644
--- a/hw/ipmi/ipmi_bt.c
+++ b/hw/ipmi/ipmi_bt.c
@@ -396,7 +396,7 @@ const VMStateDescription vmstate_IPMIBT = {
 .version_id = 1,
 .minimum_version_id = 1,
 .post_load = ipmi_bt_vmstate_post_load,
-.fields  = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_BOOL(obf_irq_set, IPMIBT),
 VMSTATE_BOOL(atn_irq_set, IPMIBT),
 VMSTATE_BOOL(irqs_enabled, IPMIBT),
diff --git a/hw/ipmi/ipmi_kcs.c b/hw/ipmi/ipmi_kcs.c
index a77612946a..c15977cab4 100644
--- a/hw/ipmi/ipmi_kcs.c
+++ b/hw/ipmi/ipmi_kcs.c
@@ -379,7 +379,7 @@ const VMStateDescription vmstate_IPMIKCS = {
 .version_id = 2,
 .minimum_version_id = 1,
 .post_load = ipmi_kcs_vmstate_post_load,
-.fields  = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_BOOL(obf_irq_set, IPMIKCS),
 VMSTATE_BOOL(atn_irq_set, IPMIKCS),
 VMSTATE_UNUSED_TEST(vmstate_kcs_before_version2, 1), /* Was use_irq */
diff --git a/hw/ipmi/isa_ipmi_bt.c b/hw/ipmi/isa_ipmi_bt.c
index aec064d3cd..7b36d51494 100644
--- a/hw/ipmi/isa_ipmi_bt.c
+++ b/hw/ipmi/isa_ipmi_bt.c
@@ -77,7 +77,7 @@ static const VMStateDescription vmstate_ISAIPMIBTDevice = {
  * because it used VMSTATE_VBUFFER_UINT32, but it did not transfer
  * the buffer length, so random things would happen.
  */
-.fields  = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_STRUCT(bt, ISAIPMIBTDevice, 1, vmstate_IPMIBT, IPMIBT),
 VMSTATE_END_OF_LIST()
 }
diff --git a/hw/ipmi/isa_ipmi_kcs.c b/hw/ipmi/isa_ipmi_kcs.c
index b5dcb64616..f52b32e590 100644
--- a/hw/ipmi/isa_ipmi_kcs.c
+++ b/hw/ipmi/isa_ipmi_kcs.c
@@ -76,7 +76,7 @@ static const VMStateDescription vmstate_ISAIPMIKCSDevice = {
 .name = TYPE_IPMI_INTERFACE,
 .version_id = 2,
 .minimum_version_id = 1,
-.fields  = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_VSTRUCT_TEST(kcs, ISAIPMIKCSDevice, 
vmstate_kcs_before_version2,
  0, vmstate_IPMIKCS, IPMIKCS, 1),
 VMSTATE_VSTRUCT_V(kcs, ISAIPMIKCSDevice, 2, vmstate_IPMIKCS,
diff --git a/hw/ipmi/pci_ipmi_bt.c b/hw/ipmi/pci_ipmi_bt.c
index 633931b825..afeea6f303 100644
--- a/hw/ipmi/pci_ipmi_bt.c
+++ b/hw/ipmi/pci_ipmi_bt.c
@@ -87,7 +87,7 @@ const VMStateDescription vmstate_PCIIPMIBTDevice = {
 .name = TYPE_IPMI_INTERFACE_PREFIX "pci-bt",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields  = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_PCI_DEVICE(dev, PCIIPMIBTDevice),
 VMSTATE_STRUCT(bt, PCIIPMIBTDevice, 1, vmstate_IPMIBT, IPMIBT),
 VMSTATE_END_OF_LIST()
diff --git a/hw/ipmi/pci_ipmi_kcs.c b/hw/ipmi/pci_ipmi_kcs.c
index 1a581413c2..05ba97ec58 100644
--- a/hw/ipmi/pci_ipmi_kcs.c
+++ b/hw/ipmi/pci_ipmi_kcs.c
@@ -87,7 +87,7 @@ const VMStateDescription vmstate_PCIIPMIKCSDevice = {
 .name = TYPE_IPMI_INTERFACE_PREFIX "pci-kcs",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields  = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_PCI_DEVICE(dev, PCIIPMIKCSDevice),
 VMSTATE_STRUCT(kcs, PCIIPMIKCSDevice, 1, vmstate_IPMIKCS, IPMIKCS),
 VMSTATE_END_OF_LIST()
diff --git a/hw/ipmi/smbus_ipmi.c b/hw/ipmi/smbus_ipmi.c
ind

[PULL 62/71] hw/misc/macio: Constify VMState

2023-12-29 Thread Richard Henderson
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-63-richard.hender...@linaro.org>
---
 hw/misc/macio/cuda.c  | 2 +-
 hw/misc/macio/gpio.c  | 2 +-
 hw/misc/macio/mac_dbdma.c | 8 
 hw/misc/macio/macio.c | 4 ++--
 hw/misc/macio/pmu.c   | 6 +++---
 5 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
index 6336dcb194..41934e2cf8 100644
--- a/hw/misc/macio/cuda.c
+++ b/hw/misc/macio/cuda.c
@@ -487,7 +487,7 @@ static const VMStateDescription vmstate_cuda = {
 .name = "cuda",
 .version_id = 6,
 .minimum_version_id = 6,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_STRUCT(mos6522_cuda.parent_obj, CUDAState, 0, vmstate_mos6522,
MOS6522State),
 VMSTATE_UINT8(last_b, CUDAState),
diff --git a/hw/misc/macio/gpio.c b/hw/misc/macio/gpio.c
index 4deb330471..549563747d 100644
--- a/hw/misc/macio/gpio.c
+++ b/hw/misc/macio/gpio.c
@@ -168,7 +168,7 @@ static const VMStateDescription vmstate_macio_gpio = {
 .name = "macio_gpio",
 .version_id = 0,
 .minimum_version_id = 0,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8_ARRAY(gpio_levels, MacIOGPIOState, 8),
 VMSTATE_UINT8_ARRAY(gpio_regs, MacIOGPIOState, 36),
 VMSTATE_END_OF_LIST()
diff --git a/hw/misc/macio/mac_dbdma.c b/hw/misc/macio/mac_dbdma.c
index 80a789f32b..2a528ea08c 100644
--- a/hw/misc/macio/mac_dbdma.c
+++ b/hw/misc/macio/mac_dbdma.c
@@ -807,7 +807,7 @@ static const VMStateDescription vmstate_dbdma_io = {
 .name = "dbdma_io",
 .version_id = 0,
 .minimum_version_id = 0,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64(addr, struct DBDMA_io),
 VMSTATE_INT32(len, struct DBDMA_io),
 VMSTATE_INT32(is_last, struct DBDMA_io),
@@ -821,7 +821,7 @@ static const VMStateDescription vmstate_dbdma_cmd = {
 .name = "dbdma_cmd",
 .version_id = 0,
 .minimum_version_id = 0,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT16(req_count, dbdma_cmd),
 VMSTATE_UINT16(command, dbdma_cmd),
 VMSTATE_UINT32(phy_addr, dbdma_cmd),
@@ -836,7 +836,7 @@ static const VMStateDescription vmstate_dbdma_channel = {
 .name = "dbdma_channel",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32_ARRAY(regs, struct DBDMA_channel, DBDMA_REGS),
 VMSTATE_STRUCT(io, struct DBDMA_channel, 0, vmstate_dbdma_io, 
DBDMA_io),
 VMSTATE_STRUCT(current, struct DBDMA_channel, 0, vmstate_dbdma_cmd,
@@ -849,7 +849,7 @@ static const VMStateDescription vmstate_dbdma = {
 .name = "dbdma",
 .version_id = 3,
 .minimum_version_id = 3,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_STRUCT_ARRAY(channels, DBDMAState, DBDMA_CHANNELS, 1,
  vmstate_dbdma_channel, DBDMA_channel),
 VMSTATE_END_OF_LIST()
diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c
index 265c0bbd8d..c9f22f8515 100644
--- a/hw/misc/macio/macio.c
+++ b/hw/misc/macio/macio.c
@@ -376,7 +376,7 @@ static const VMStateDescription vmstate_macio_oldworld = {
 .name = "macio-oldworld",
 .version_id = 0,
 .minimum_version_id = 0,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_PCI_DEVICE(parent_obj.parent, OldWorldMacIOState),
 VMSTATE_END_OF_LIST()
 }
@@ -396,7 +396,7 @@ static const VMStateDescription vmstate_macio_newworld = {
 .name = "macio-newworld",
 .version_id = 0,
 .minimum_version_id = 0,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_PCI_DEVICE(parent_obj.parent, NewWorldMacIOState),
 VMSTATE_END_OF_LIST()
 }
diff --git a/hw/misc/macio/pmu.c b/hw/misc/macio/pmu.c
index 58316d1871..e9a90da88f 100644
--- a/hw/misc/macio/pmu.c
+++ b/hw/misc/macio/pmu.c
@@ -668,7 +668,7 @@ static const VMStateDescription vmstate_pmu_adb = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = pmu_adb_state_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8(adb_reply_size, PMUState),
 VMSTATE_BUFFER(adb_reply, PMUState),
 VMSTATE_END_OF_LIST()
@@ -679,7 +679,7 @@ static const VMStateDescription vmstate_pmu = {
 .name = "pmu",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_STRUCT(mos6522_pmu.parent_obj, PMUState, 0, vmstate_mos6522,
MOS6522State),
 VMSTATE_UINT8(last_b, PMUState),
@@ -698,7 +698,7 @@ static const VMStateDescription vmstate_pmu = {
 VMSTATE_INT64(one_sec_target, PMUState),
 VMSTATE_END

[PULL 67/71] system: Constify VMState

2023-12-29 Thread Richard Henderson
Tested-by: Philippe Mathieu-Daudé 
Reviewed-by: Philippe Mathieu-Daudé 
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-68-richard.hender...@linaro.org>
---
 system/cpu-timers.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/system/cpu-timers.c b/system/cpu-timers.c
index 7452d97b67..bdf3a41dcb 100644
--- a/system/cpu-timers.c
+++ b/system/cpu-timers.c
@@ -165,7 +165,7 @@ static const VMStateDescription icount_vmstate_warp_timer = 
{
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = warp_timer_state_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_INT64(vm_clock_warp_start, TimersState),
 VMSTATE_TIMER_PTR(icount_warp_timer, TimersState),
 VMSTATE_END_OF_LIST()
@@ -177,7 +177,7 @@ static const VMStateDescription 
icount_vmstate_adjust_timers = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = adjust_timers_state_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_TIMER_PTR(icount_rt_timer, TimersState),
 VMSTATE_TIMER_PTR(icount_vm_timer, TimersState),
 VMSTATE_END_OF_LIST()
@@ -189,7 +189,7 @@ static const VMStateDescription icount_vmstate_shift = {
 .version_id = 2,
 .minimum_version_id = 2,
 .needed = icount_shift_state_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_INT16(icount_time_shift, TimersState),
 VMSTATE_INT64(last_delta, TimersState),
 VMSTATE_END_OF_LIST()
@@ -204,12 +204,12 @@ static const VMStateDescription icount_vmstate_timers = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = icount_state_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_INT64(qemu_icount_bias, TimersState),
 VMSTATE_INT64(qemu_icount, TimersState),
 VMSTATE_END_OF_LIST()
 },
-.subsections = (const VMStateDescription * []) {
+.subsections = (const VMStateDescription * const []) {
 &icount_vmstate_warp_timer,
 &icount_vmstate_adjust_timers,
 &icount_vmstate_shift,
@@ -221,13 +221,13 @@ static const VMStateDescription vmstate_timers = {
 .name = "timer",
 .version_id = 2,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_INT64(cpu_ticks_offset, TimersState),
 VMSTATE_UNUSED(8),
 VMSTATE_INT64_V(cpu_clock_offset, TimersState, 2),
 VMSTATE_END_OF_LIST()
 },
-.subsections = (const VMStateDescription * []) {
+.subsections = (const VMStateDescription * const []) {
 &icount_vmstate_timers,
 NULL
 }
-- 
2.34.1




[PULL 44/71] hw/pci: Constify VMState

2023-12-29 Thread Richard Henderson
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-45-richard.hender...@linaro.org>
---
 include/hw/pci/shpc.h | 2 +-
 hw/pci/msix.c | 4 ++--
 hw/pci/pci.c  | 8 
 hw/pci/pci_host.c | 2 +-
 hw/pci/pcie_aer.c | 4 ++--
 hw/pci/shpc.c | 2 +-
 6 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/include/hw/pci/shpc.h b/include/hw/pci/shpc.h
index 89c7a3b7fa..a0789df153 100644
--- a/include/hw/pci/shpc.h
+++ b/include/hw/pci/shpc.h
@@ -52,7 +52,7 @@ void shpc_device_unplug_cb(HotplugHandler *hotplug_dev, 
DeviceState *dev,
 void shpc_device_unplug_request_cb(HotplugHandler *hotplug_dev,
DeviceState *dev, Error **errp);
 
-extern VMStateInfo shpc_vmstate_info;
+extern const VMStateInfo shpc_vmstate_info;
 #define SHPC_VMSTATE(_field, _type,  _test) \
 VMSTATE_BUFFER_UNSAFE_INFO_TEST(_field, _type, _test, 0, \
 shpc_vmstate_info, 0)
diff --git a/hw/pci/msix.c b/hw/pci/msix.c
index cd817f4ca8..487e49834e 100644
--- a/hw/pci/msix.c
+++ b/hw/pci/msix.c
@@ -685,7 +685,7 @@ static int get_msix_state(QEMUFile *f, void *pv, size_t 
size,
 return 0;
 }
 
-static VMStateInfo vmstate_info_msix = {
+static const VMStateInfo vmstate_info_msix = {
 .name = "msix state",
 .get  = get_msix_state,
 .put  = put_msix_state,
@@ -693,7 +693,7 @@ static VMStateInfo vmstate_info_msix = {
 
 const VMStateDescription vmstate_msix = {
 .name = "msix",
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 {
 .name = "msix",
 .version_id   = 0,
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index c49417abb2..76080af580 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -92,7 +92,7 @@ static const VMStateDescription vmstate_pcibus = {
 .name = "PCIBUS",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_INT32_EQUAL(nirq, PCIBus, NULL),
 VMSTATE_VARRAY_INT32(irq_count, PCIBus,
  nirq, 0, vmstate_info_int32,
@@ -673,7 +673,7 @@ static int put_pci_config_device(QEMUFile *f, void *pv, 
size_t size,
 return 0;
 }
 
-static VMStateInfo vmstate_info_pci_config = {
+static const VMStateInfo vmstate_info_pci_config = {
 .name = "pci config",
 .get  = get_pci_config_device,
 .put  = put_pci_config_device,
@@ -714,7 +714,7 @@ static int put_pci_irq_state(QEMUFile *f, void *pv, size_t 
size,
 return 0;
 }
 
-static VMStateInfo vmstate_info_pci_irq_state = {
+static const VMStateInfo vmstate_info_pci_irq_state = {
 .name = "pci irq state",
 .get  = get_pci_irq_state,
 .put  = put_pci_irq_state,
@@ -734,7 +734,7 @@ const VMStateDescription vmstate_pci_device = {
 .name = "PCIDevice",
 .version_id = 2,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_INT32_POSITIVE_LE(version_id, PCIDevice),
 VMSTATE_BUFFER_UNSAFE_INFO_TEST(config, PCIDevice,
migrate_is_not_pcie,
diff --git a/hw/pci/pci_host.c b/hw/pci/pci_host.c
index a18aa0a8d4..dfe6fe6184 100644
--- a/hw/pci/pci_host.c
+++ b/hw/pci/pci_host.c
@@ -234,7 +234,7 @@ const VMStateDescription vmstate_pcihost = {
 .needed = pci_host_needed,
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(config_reg, PCIHostState),
 VMSTATE_END_OF_LIST()
 }
diff --git a/hw/pci/pcie_aer.c b/hw/pci/pcie_aer.c
index b68c7ecb49..2c85a78fcd 100644
--- a/hw/pci/pcie_aer.c
+++ b/hw/pci/pcie_aer.c
@@ -797,7 +797,7 @@ static const VMStateDescription vmstate_pcie_aer_err = {
 .name = "PCIE_AER_ERROR",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(status, PCIEAERErr),
 VMSTATE_UINT16(source_id, PCIEAERErr),
 VMSTATE_UINT16(flags, PCIEAERErr),
@@ -818,7 +818,7 @@ const VMStateDescription vmstate_pcie_aer_log = {
 .name = "PCIE_AER_ERROR_LOG",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT16(log_num, PCIEAERLog),
 VMSTATE_UINT16_EQUAL(log_max, PCIEAERLog, NULL),
 VMSTATE_VALIDATE("log_num <= log_max", pcie_aer_state_log_num_valid),
diff --git a/hw/pci/shpc.c b/hw/pci/shpc.c
index df7f370111..d2a5eea69e 100644
--- a/hw/pci/shpc.c
+++ b/hw/pci/shpc.c
@@ -736,7 +736,7 @@ static int shpc_load(QEMUFile *f, void *pv, size_t size,
 return 0;
 }
 
-VMStateInfo shpc_vmstate_info = {
+const VMStateInfo shpc_vmstate_info = {
 .name = "shpc",
 .get  = shpc_load,
 .put  = shpc_save,
-- 
2.34.1




[PULL 64/71] backends: Constify VMState

2023-12-29 Thread Richard Henderson
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-65-richard.hender...@linaro.org>
---
 backends/dbus-vmstate.c | 2 +-
 backends/tpm/tpm_emulator.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/backends/dbus-vmstate.c b/backends/dbus-vmstate.c
index a9d8cb0acd..be6c4d8e0a 100644
--- a/backends/dbus-vmstate.c
+++ b/backends/dbus-vmstate.c
@@ -393,7 +393,7 @@ static const VMStateDescription dbus_vmstate = {
 .version_id = 0,
 .pre_save = dbus_vmstate_pre_save,
 .post_load = dbus_vmstate_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(data_size, DBusVMState),
 VMSTATE_VBUFFER_ALLOC_UINT32(data, DBusVMState, 0, 0, data_size),
 VMSTATE_END_OF_LIST()
diff --git a/backends/tpm/tpm_emulator.c b/backends/tpm/tpm_emulator.c
index f7f1b4ad7a..ebdd2e0a69 100644
--- a/backends/tpm/tpm_emulator.c
+++ b/backends/tpm/tpm_emulator.c
@@ -939,7 +939,7 @@ static const VMStateDescription vmstate_tpm_emulator = {
 .version_id = 0,
 .pre_save = tpm_emulator_pre_save,
 .post_load = tpm_emulator_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(state_blobs.permanent_flags, TPMEmulator),
 VMSTATE_UINT32(state_blobs.permanent.size, TPMEmulator),
 VMSTATE_VBUFFER_ALLOC_UINT32(state_blobs.permanent.buffer,
-- 
2.34.1




[PULL 27/71] hw/dma: Constify VMState

2023-12-29 Thread Richard Henderson
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-28-richard.hender...@linaro.org>
---
 hw/dma/bcm2835_dma.c  |  4 ++--
 hw/dma/i82374.c   |  2 +-
 hw/dma/i8257.c|  4 ++--
 hw/dma/pl080.c|  4 ++--
 hw/dma/pl330.c| 10 +-
 hw/dma/pxa2xx_dma.c   |  4 ++--
 hw/dma/rc4030.c   |  2 +-
 hw/dma/sparc32_dma.c  |  2 +-
 hw/dma/xlnx-zdma.c|  2 +-
 hw/dma/xlnx-zynq-devcfg.c |  4 ++--
 hw/dma/xlnx_csu_dma.c |  2 +-
 hw/dma/xlnx_dpdma.c   |  2 +-
 12 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/hw/dma/bcm2835_dma.c b/hw/dma/bcm2835_dma.c
index 5e9306110d..9bda45072b 100644
--- a/hw/dma/bcm2835_dma.c
+++ b/hw/dma/bcm2835_dma.c
@@ -311,7 +311,7 @@ static const VMStateDescription vmstate_bcm2835_dma_chan = {
 .name = TYPE_BCM2835_DMA "-chan",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(cs, BCM2835DMAChan),
 VMSTATE_UINT32(conblk_ad, BCM2835DMAChan),
 VMSTATE_UINT32(ti, BCM2835DMAChan),
@@ -329,7 +329,7 @@ static const VMStateDescription vmstate_bcm2835_dma = {
 .name = TYPE_BCM2835_DMA,
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_STRUCT_ARRAY(chan, BCM2835DMAState, BCM2835_DMA_NCHANS, 1,
  vmstate_bcm2835_dma_chan, BCM2835DMAChan),
 VMSTATE_UINT32(int_status, BCM2835DMAState),
diff --git a/hw/dma/i82374.c b/hw/dma/i82374.c
index 63734c22c9..f6ddfc51c5 100644
--- a/hw/dma/i82374.c
+++ b/hw/dma/i82374.c
@@ -58,7 +58,7 @@ static const VMStateDescription vmstate_i82374 = {
 .name = "i82374",
 .version_id = 0,
 .minimum_version_id = 0,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8_ARRAY(commands, I82374State, 8),
 VMSTATE_END_OF_LIST()
 },
diff --git a/hw/dma/i8257.c b/hw/dma/i8257.c
index de5f696919..de1d5b110c 100644
--- a/hw/dma/i8257.c
+++ b/hw/dma/i8257.c
@@ -517,7 +517,7 @@ static const VMStateDescription vmstate_i8257_regs = {
 .name = "dma_regs",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_INT32_ARRAY(now, I8257Regs, 2),
 VMSTATE_UINT16_ARRAY(base, I8257Regs, 2),
 VMSTATE_UINT8(mode, I8257Regs),
@@ -542,7 +542,7 @@ static const VMStateDescription vmstate_i8257 = {
 .version_id = 1,
 .minimum_version_id = 1,
 .post_load = i8257_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8(command, I8257State),
 VMSTATE_UINT8(mask, I8257State),
 VMSTATE_UINT8(flip_flop, I8257State),
diff --git a/hw/dma/pl080.c b/hw/dma/pl080.c
index 2627307cc8..1e49c22e93 100644
--- a/hw/dma/pl080.c
+++ b/hw/dma/pl080.c
@@ -39,7 +39,7 @@ static const VMStateDescription vmstate_pl080_channel = {
 .name = "pl080_channel",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(src, pl080_channel),
 VMSTATE_UINT32(dest, pl080_channel),
 VMSTATE_UINT32(lli, pl080_channel),
@@ -53,7 +53,7 @@ static const VMStateDescription vmstate_pl080 = {
 .name = "pl080",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8(tc_int, PL080State),
 VMSTATE_UINT8(tc_mask, PL080State),
 VMSTATE_UINT8(err_int, PL080State),
diff --git a/hw/dma/pl330.c b/hw/dma/pl330.c
index e7e67dd8b6..70a502d245 100644
--- a/hw/dma/pl330.c
+++ b/hw/dma/pl330.c
@@ -139,7 +139,7 @@ static const VMStateDescription vmstate_pl330_chan = {
 .name = "pl330_chan",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(src, PL330Chan),
 VMSTATE_UINT32(dst, PL330Chan),
 VMSTATE_UINT32(pc, PL330Chan),
@@ -170,7 +170,7 @@ static const VMStateDescription vmstate_pl330_fifo = {
 .name = "pl330_chan",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_VBUFFER_UINT32(buf, PL330Fifo, 1, NULL, buf_size),
 VMSTATE_VBUFFER_UINT32(tag, PL330Fifo, 1, NULL, buf_size),
 VMSTATE_UINT32(head, PL330Fifo),
@@ -194,7 +194,7 @@ static const VMStateDescription vmstate_pl330_queue_entry = 
{
 .name = "pl330_queue_entry",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(addr, PL330QueueEntry),
 VMSTATE_UINT32(len, PL330QueueEntry),
 VMSTATE_UINT8(n, PL330QueueEntry),
@@ -216,7 +216,7 @@ static const 

[PULL 58/71] hw/usb: Constify VMState

2023-12-29 Thread Richard Henderson
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-59-richard.hender...@linaro.org>
---
 hw/usb/bus.c|  2 +-
 hw/usb/ccid-card-passthru.c |  2 +-
 hw/usb/dev-hid.c|  4 ++--
 hw/usb/dev-hub.c|  8 
 hw/usb/dev-mtp.c|  2 +-
 hw/usb/dev-smartcard-reader.c   |  8 
 hw/usb/dev-storage.c|  2 +-
 hw/usb/dev-uas.c|  2 +-
 hw/usb/hcd-dwc2.c   |  4 ++--
 hw/usb/hcd-dwc3.c   |  2 +-
 hw/usb/hcd-ehci-pci.c   |  2 +-
 hw/usb/hcd-ehci-sysbus.c|  2 +-
 hw/usb/hcd-ehci.c   |  2 +-
 hw/usb/hcd-ohci-pci.c   |  2 +-
 hw/usb/hcd-ohci.c   |  8 
 hw/usb/hcd-uhci.c   |  4 ++--
 hw/usb/hcd-xhci-pci.c   |  2 +-
 hw/usb/hcd-xhci-sysbus.c|  2 +-
 hw/usb/hcd-xhci.c   | 12 ++--
 hw/usb/host-libusb.c|  2 +-
 hw/usb/imx-usb-phy.c|  2 +-
 hw/usb/redirect.c   | 16 
 hw/usb/u2f-passthru.c   |  2 +-
 hw/usb/u2f.c|  2 +-
 hw/usb/xlnx-versal-usb2-ctrl-regs.c |  2 +-
 25 files changed, 49 insertions(+), 49 deletions(-)

diff --git a/hw/usb/bus.c b/hw/usb/bus.c
index 92d6ed5626..59c39945dd 100644
--- a/hw/usb/bus.c
+++ b/hw/usb/bus.c
@@ -69,7 +69,7 @@ const VMStateDescription vmstate_usb_device = {
 .version_id = 1,
 .minimum_version_id = 1,
 .post_load = usb_device_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8(addr, USBDevice),
 VMSTATE_INT32(state, USBDevice),
 VMSTATE_INT32(remote_wakeup, USBDevice),
diff --git a/hw/usb/ccid-card-passthru.c b/hw/usb/ccid-card-passthru.c
index 07ee42f304..a515703904 100644
--- a/hw/usb/ccid-card-passthru.c
+++ b/hw/usb/ccid-card-passthru.c
@@ -378,7 +378,7 @@ static const VMStateDescription passthru_vmstate = {
 .name = "ccid-card-passthru",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_BUFFER(vscard_in_data, PassthruState),
 VMSTATE_UINT32(vscard_in_pos, PassthruState),
 VMSTATE_UINT32(vscard_in_hdr, PassthruState),
diff --git a/hw/usb/dev-hid.c b/hw/usb/dev-hid.c
index bdd6d1ffaf..9e358c934e 100644
--- a/hw/usb/dev-hid.c
+++ b/hw/usb/dev-hid.c
@@ -756,7 +756,7 @@ static const VMStateDescription vmstate_usb_ptr = {
 .version_id = 1,
 .minimum_version_id = 1,
 .post_load = usb_ptr_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_USB_DEVICE(dev, USBHIDState),
 VMSTATE_HID_POINTER_DEVICE(hid, USBHIDState),
 VMSTATE_END_OF_LIST()
@@ -767,7 +767,7 @@ static const VMStateDescription vmstate_usb_kbd = {
 .name = "usb-kbd",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_USB_DEVICE(dev, USBHIDState),
 VMSTATE_HID_KEYBOARD_DEVICE(hid, USBHIDState),
 VMSTATE_END_OF_LIST()
diff --git a/hw/usb/dev-hub.c b/hw/usb/dev-hub.c
index 5703e0e826..06e9537d03 100644
--- a/hw/usb/dev-hub.c
+++ b/hw/usb/dev-hub.c
@@ -623,7 +623,7 @@ static const VMStateDescription vmstate_usb_hub_port = {
 .name = "usb-hub-port",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT16(wPortStatus, USBHubPort),
 VMSTATE_UINT16(wPortChange, USBHubPort),
 VMSTATE_END_OF_LIST()
@@ -642,7 +642,7 @@ static const VMStateDescription vmstate_usb_hub_port_timer 
= {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = usb_hub_port_timer_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_TIMER_PTR(port_timer, USBHubState),
 VMSTATE_END_OF_LIST()
 },
@@ -652,13 +652,13 @@ static const VMStateDescription vmstate_usb_hub = {
 .name = "usb-hub",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_USB_DEVICE(dev, USBHubState),
 VMSTATE_STRUCT_ARRAY(ports, USBHubState, MAX_PORTS, 0,
  vmstate_usb_hub_port, USBHubPort),
 VMSTATE_END_OF_LIST()
 },
-.subsections = (const VMStateDescription * []) {
+.subsections = (const VMStateDescription * const []) {
 &vmstate_usb_hub_port_timer,
 NULL
 }
diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c
index 1cac1cd435..7e4a0765ae 100644
--- a/hw/usb/dev-mtp.c
+++ b/hw/usb/dev-mtp.c
@@ -2072,7 +2072,7 @@ static const VMStateDescription vmstate_usb_mtp = {
 .unmigratable = 1,
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateFi

[PULL 52/71] hw/sd: Constify VMState

2023-12-29 Thread Richard Henderson
Tested-by: Philippe Mathieu-Daudé 
Reviewed-by: Philippe Mathieu-Daudé 
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-53-richard.hender...@linaro.org>
---
 hw/sd/allwinner-sdhost.c | 2 +-
 hw/sd/aspeed_sdhci.c | 2 +-
 hw/sd/bcm2835_sdhost.c   | 2 +-
 hw/sd/cadence_sdhci.c| 2 +-
 hw/sd/npcm7xx_sdhci.c| 2 +-
 hw/sd/pl181.c| 2 +-
 hw/sd/pxa2xx_mmci.c  | 2 +-
 hw/sd/sd.c   | 6 +++---
 hw/sd/sdhci.c| 6 +++---
 hw/sd/ssi-sd.c   | 2 +-
 10 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/hw/sd/allwinner-sdhost.c b/hw/sd/allwinner-sdhost.c
index 1a576d62ae..a1b7230633 100644
--- a/hw/sd/allwinner-sdhost.c
+++ b/hw/sd/allwinner-sdhost.c
@@ -773,7 +773,7 @@ static const VMStateDescription vmstate_allwinner_sdhost = {
 .name = "allwinner-sdhost",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(global_ctl, AwSdHostState),
 VMSTATE_UINT32(clock_ctl, AwSdHostState),
 VMSTATE_UINT32(timeout, AwSdHostState),
diff --git a/hw/sd/aspeed_sdhci.c b/hw/sd/aspeed_sdhci.c
index e53206d959..3b63926c3a 100644
--- a/hw/sd/aspeed_sdhci.c
+++ b/hw/sd/aspeed_sdhci.c
@@ -177,7 +177,7 @@ static void aspeed_sdhci_reset(DeviceState *dev)
 static const VMStateDescription vmstate_aspeed_sdhci = {
 .name = TYPE_ASPEED_SDHCI,
 .version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32_ARRAY(regs, AspeedSDHCIState, ASPEED_SDHCI_NUM_REGS),
 VMSTATE_END_OF_LIST(),
 },
diff --git a/hw/sd/bcm2835_sdhost.c b/hw/sd/bcm2835_sdhost.c
index a600cf39e2..11c54dd4a7 100644
--- a/hw/sd/bcm2835_sdhost.c
+++ b/hw/sd/bcm2835_sdhost.c
@@ -381,7 +381,7 @@ static const VMStateDescription vmstate_bcm2835_sdhost = {
 .name = TYPE_BCM2835_SDHOST,
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(cmd, BCM2835SDHostState),
 VMSTATE_UINT32(cmdarg, BCM2835SDHostState),
 VMSTATE_UINT32(status, BCM2835SDHostState),
diff --git a/hw/sd/cadence_sdhci.c b/hw/sd/cadence_sdhci.c
index ef4e0d74e3..7c8bc5464b 100644
--- a/hw/sd/cadence_sdhci.c
+++ b/hw/sd/cadence_sdhci.c
@@ -159,7 +159,7 @@ static void cadence_sdhci_realize(DeviceState *dev, Error 
**errp)
 static const VMStateDescription vmstate_cadence_sdhci = {
 .name = TYPE_CADENCE_SDHCI,
 .version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32_ARRAY(regs, CadenceSDHCIState, CADENCE_SDHCI_NUM_REGS),
 VMSTATE_END_OF_LIST(),
 },
diff --git a/hw/sd/npcm7xx_sdhci.c b/hw/sd/npcm7xx_sdhci.c
index 9958680090..e93dab8dbd 100644
--- a/hw/sd/npcm7xx_sdhci.c
+++ b/hw/sd/npcm7xx_sdhci.c
@@ -142,7 +142,7 @@ static void npcm7xx_sdhci_reset(DeviceState *dev)
 static const VMStateDescription vmstate_npcm7xx_sdhci = {
 .name = TYPE_NPCM7XX_SDHCI,
 .version_id = 0,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(regs.boottoctrl, NPCM7xxSDHCIState),
 VMSTATE_END_OF_LIST(),
 },
diff --git a/hw/sd/pl181.c b/hw/sd/pl181.c
index 2b33814d83..e3633c2e6f 100644
--- a/hw/sd/pl181.c
+++ b/hw/sd/pl181.c
@@ -63,7 +63,7 @@ static const VMStateDescription vmstate_pl181 = {
 .name = "pl181",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(clock, PL181State),
 VMSTATE_UINT32(power, PL181State),
 VMSTATE_UINT32(cmdarg, PL181State),
diff --git a/hw/sd/pxa2xx_mmci.c b/hw/sd/pxa2xx_mmci.c
index 5e8ea69188..82529708c8 100644
--- a/hw/sd/pxa2xx_mmci.c
+++ b/hw/sd/pxa2xx_mmci.c
@@ -84,7 +84,7 @@ static const VMStateDescription vmstate_pxa2xx_mmci = {
 .name = "pxa2xx-mmci",
 .version_id = 2,
 .minimum_version_id = 2,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(status, PXA2xxMMCIState),
 VMSTATE_UINT32(clkrt, PXA2xxMMCIState),
 VMSTATE_UINT32(spi, PXA2xxMMCIState),
diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index 1106ff7d78..807b5d3de3 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -681,7 +681,7 @@ static const VMStateDescription sd_ocr_vmstate = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = sd_ocr_vmstate_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(ocr, SDState),
 VMSTATE_TIMER_PTR(ocr_power_timer, SDState),
 VMSTATE_END_OF_LIST()
@@ -706,7 +706,7 @@ static const VMStateDescription sd_vmstate = {
 .version_id = 2,
 .minimum_version_id = 2,
 .pre_load = sd_vmstate_pre_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(mode, SDState),
 VMSTATE_INT32(sta

[PULL 29/71] hw/hyperv: Constify VMState

2023-12-29 Thread Richard Henderson
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-30-richard.hender...@linaro.org>
---
 hw/hyperv/vmbus.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/hw/hyperv/vmbus.c b/hw/hyperv/vmbus.c
index c64eaa5a46..c86d1895ba 100644
--- a/hw/hyperv/vmbus.c
+++ b/hw/hyperv/vmbus.c
@@ -526,7 +526,7 @@ static const VMStateDescription vmstate_gpadl = {
 .name = "vmbus/gpadl",
 .version_id = 0,
 .minimum_version_id = 0,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(id, VMBusGpadl),
 VMSTATE_UINT32(child_relid, VMBusGpadl),
 VMSTATE_UINT32(num_gfns, VMBusGpadl),
@@ -1489,7 +1489,7 @@ static const VMStateDescription vmstate_channel = {
 .version_id = 0,
 .minimum_version_id = 0,
 .post_load = channel_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(id, VMBusChannel),
 VMSTATE_UINT16(subchan_idx, VMBusChannel),
 VMSTATE_UINT32(open_id, VMBusChannel),
@@ -2380,7 +2380,7 @@ const VMStateDescription vmstate_vmbus_dev = {
 .name = TYPE_VMBUS_DEVICE,
 .version_id = 0,
 .minimum_version_id = 0,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8_ARRAY(instanceid.data, VMBusDevice, 16),
 VMSTATE_UINT16(num_channels, VMBusDevice),
 VMSTATE_STRUCT_VARRAY_POINTER_UINT16(channels, VMBusDevice,
@@ -2549,7 +2549,7 @@ static const VMStateDescription 
vmstate_post_message_input = {
 .name = "vmbus/hyperv_post_message_input",
 .version_id = 0,
 .minimum_version_id = 0,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 /*
  * skip connection_id and message_type as they are validated before
  * queueing and ignored on dequeueing
@@ -2572,7 +2572,7 @@ static const VMStateDescription vmstate_rx_queue = {
 .version_id = 0,
 .minimum_version_id = 0,
 .needed = vmbus_rx_queue_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8(rx_queue_head, VMBus),
 VMSTATE_UINT8(rx_queue_size, VMBus),
 VMSTATE_STRUCT_ARRAY(rx_queue, VMBus,
@@ -2589,7 +2589,7 @@ static const VMStateDescription vmstate_vmbus = {
 .minimum_version_id = 0,
 .pre_load = vmbus_pre_load,
 .post_load = vmbus_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8(state, VMBus),
 VMSTATE_UINT32(version, VMBus),
 VMSTATE_UINT32(target_vp, VMBus),
@@ -2598,7 +2598,7 @@ static const VMStateDescription vmstate_vmbus = {
  vmstate_gpadl, VMBusGpadl, link),
 VMSTATE_END_OF_LIST()
 },
-.subsections = (const VMStateDescription * []) {
+.subsections = (const VMStateDescription * const []) {
 &vmstate_rx_queue,
 NULL
 }
@@ -2643,7 +2643,7 @@ static const VMStateDescription vmstate_vmbus_bridge = {
 .name = TYPE_VMBUS_BRIDGE,
 .version_id = 0,
 .minimum_version_id = 0,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_STRUCT_POINTER(bus, VMBusBridge, vmstate_vmbus, VMBus),
 VMSTATE_END_OF_LIST()
 },
-- 
2.34.1




[PULL 66/71] migration: Constify VMState

2023-12-29 Thread Richard Henderson
Reviewed-by: Juan Quintela 
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-67-richard.hender...@linaro.org>
---
 migration/global_state.c |  2 +-
 migration/savevm.c   | 10 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/migration/global_state.c b/migration/global_state.c
index 4e2a9d8ec0..8ee15dbb06 100644
--- a/migration/global_state.c
+++ b/migration/global_state.c
@@ -131,7 +131,7 @@ static const VMStateDescription vmstate_globalstate = {
 .post_load = global_state_post_load,
 .pre_save = global_state_pre_save,
 .needed = global_state_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(size, GlobalState),
 VMSTATE_BUFFER(runstate, GlobalState),
 VMSTATE_END_OF_LIST()
diff --git a/migration/savevm.c b/migration/savevm.c
index eab62330b6..c8d08fa079 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -438,7 +438,7 @@ static const VMStateDescription vmstate_target_page_bits = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = vmstate_target_page_bits_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(target_page_bits, SaveState),
 VMSTATE_END_OF_LIST()
 }
@@ -454,7 +454,7 @@ static const VMStateDescription vmstate_capabilites = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = vmstate_capabilites_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32_V(caps_count, SaveState, 1),
 VMSTATE_VARRAY_UINT32_ALLOC(capabilities, SaveState, caps_count, 1,
 vmstate_info_capability,
@@ -499,7 +499,7 @@ static const VMStateDescription vmstate_uuid = {
 .minimum_version_id = 1,
 .needed = vmstate_uuid_needed,
 .post_load = vmstate_uuid_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8_ARRAY_V(uuid.data, SaveState, sizeof(QemuUUID), 1),
 VMSTATE_END_OF_LIST()
 }
@@ -512,12 +512,12 @@ static const VMStateDescription vmstate_configuration = {
 .post_load = configuration_post_load,
 .pre_save = configuration_pre_save,
 .post_save = configuration_post_save,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(len, SaveState),
 VMSTATE_VBUFFER_ALLOC_UINT32(name, SaveState, 0, NULL, len),
 VMSTATE_END_OF_LIST()
 },
-.subsections = (const VMStateDescription *[]) {
+.subsections = (const VMStateDescription * const []) {
 &vmstate_target_page_bits,
 &vmstate_capabilites,
 &vmstate_uuid,
-- 
2.34.1




[PULL 40/71] hw/misc: Constify VMState

2023-12-29 Thread Richard Henderson
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-41-richard.hender...@linaro.org>
---
 hw/misc/a9scu.c|  2 +-
 hw/misc/allwinner-a10-ccm.c|  2 +-
 hw/misc/allwinner-a10-dramc.c  |  2 +-
 hw/misc/allwinner-cpucfg.c |  2 +-
 hw/misc/allwinner-h3-ccu.c |  2 +-
 hw/misc/allwinner-h3-dramc.c   |  2 +-
 hw/misc/allwinner-h3-sysctrl.c |  2 +-
 hw/misc/allwinner-r40-ccu.c|  2 +-
 hw/misc/allwinner-r40-dramc.c  |  2 +-
 hw/misc/allwinner-sid.c|  2 +-
 hw/misc/allwinner-sramc.c  |  2 +-
 hw/misc/arm_l2x0.c |  2 +-
 hw/misc/arm_sysctl.c   |  2 +-
 hw/misc/armsse-cpu-pwrctrl.c   |  2 +-
 hw/misc/armsse-mhu.c   |  2 +-
 hw/misc/aspeed_hace.c  |  2 +-
 hw/misc/aspeed_i3c.c   |  4 ++--
 hw/misc/aspeed_lpc.c   |  2 +-
 hw/misc/aspeed_sbc.c   |  2 +-
 hw/misc/aspeed_scu.c   |  2 +-
 hw/misc/aspeed_sdmc.c  |  2 +-
 hw/misc/aspeed_xdma.c  |  2 +-
 hw/misc/axp2xx.c   |  2 +-
 hw/misc/bcm2835_cprman.c   | 10 +-
 hw/misc/bcm2835_mbox.c |  4 ++--
 hw/misc/bcm2835_mphi.c |  2 +-
 hw/misc/bcm2835_powermgt.c |  2 +-
 hw/misc/bcm2835_property.c |  2 +-
 hw/misc/bcm2835_rng.c  |  2 +-
 hw/misc/bcm2835_thermal.c  |  2 +-
 hw/misc/djmemc.c   |  2 +-
 hw/misc/eccmemctl.c|  2 +-
 hw/misc/exynos4210_clk.c   |  2 +-
 hw/misc/exynos4210_pmu.c   |  2 +-
 hw/misc/exynos4210_rng.c   |  2 +-
 hw/misc/imx25_ccm.c|  2 +-
 hw/misc/imx31_ccm.c|  2 +-
 hw/misc/imx6_ccm.c |  2 +-
 hw/misc/imx6_src.c |  2 +-
 hw/misc/imx6ul_ccm.c   |  2 +-
 hw/misc/imx7_ccm.c |  4 ++--
 hw/misc/imx7_snvs.c|  2 +-
 hw/misc/imx7_src.c |  2 +-
 hw/misc/imx_rngc.c |  2 +-
 hw/misc/iosb.c |  2 +-
 hw/misc/iotkit-secctl.c| 10 +-
 hw/misc/iotkit-sysctl.c|  8 
 hw/misc/ivshmem.c  |  4 ++--
 hw/misc/lasi.c |  2 +-
 hw/misc/led.c  |  2 +-
 hw/misc/mac_via.c  |  4 ++--
 hw/misc/mips_cmgcr.c   |  2 +-
 hw/misc/mips_cpc.c |  2 +-
 hw/misc/mos6522.c  |  4 ++--
 hw/misc/mps2-fpgaio.c  |  2 +-
 hw/misc/mps2-scc.c |  2 +-
 hw/misc/msf2-sysreg.c  |  2 +-
 hw/misc/mst_fpga.c |  2 +-
 hw/misc/npcm7xx_clk.c  |  8 
 hw/misc/npcm7xx_gcr.c  |  2 +-
 hw/misc/npcm7xx_mft.c  |  2 +-
 hw/misc/npcm7xx_pwm.c  |  4 ++--
 hw/misc/npcm7xx_rng.c  |  2 +-
 hw/misc/nrf51_rng.c|  2 +-
 hw/misc/pca9552.c  |  2 +-
 hw/misc/pvpanic-pci.c  |  2 +-
 hw/misc/slavio_misc.c  |  2 +-
 hw/misc/stm32f4xx_exti.c   |  2 +-
 hw/misc/stm32f4xx_syscfg.c |  2 +-
 hw/misc/tz-mpc.c   |  2 +-
 hw/misc/tz-msc.c   |  2 +-
 hw/misc/tz-ppc.c   |  2 +-
 hw/misc/virt_ctrl.c|  2 +-
 hw/misc/vmcoreinfo.c   |  2 +-
 hw/misc/xlnx-versal-cframe-reg.c   |  6 +++---
 hw/misc/xlnx-versal-cfu.c  |  6 +++---
 hw/misc/xlnx-versal-crl.c  |  2 +-
 hw/misc/xlnx-versal-pmc-iou-slcr.c |  2 +-
 hw/misc/xlnx-versal-trng.c |  2 +-
 hw/misc/xlnx-versal-xramc.c|  2 +-
 hw/misc/xlnx-zynqmp-apu-ctrl.c |  2 +-
 hw/misc/xlnx-zynqmp-crf.c  |  2 +-
 hw/misc/zynq_slcr.c|  2 +-
 83 files changed, 108 insertions(+), 108 deletions(-)

diff --git a/hw/misc/a9scu.c b/hw/misc/a9scu.c
index a375ebc987..04225dfb78 100644
--- a/hw/misc/a9scu.c
+++ b/hw/misc/a9scu.c
@@ -116,7 +116,7 @@ static const VMStateDescription vmstate_a9_scu = {
 .name = "a9-scu",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(control, A9SCUState),
 VMSTATE_UINT32(status, A9SCUState),
 VMSTATE_END_OF_LIST()
diff --git a/hw/misc/allwinner-a10-ccm.c b/hw/misc/allwinner-a10-ccm.c
index 68146ee340..575b018952 100644
--- a/hw/misc/allwinner-a10-ccm.c
+++ b/hw/misc/allwinner-a10-ccm.c
@@ -193,7 +193,7 @@ static const VMStateDescription allwinner_a10_ccm_vmstate = 
{
 .name = "allwinner-a10-ccm",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32_ARRAY(regs, AwA10ClockCtlState, AW_A10_CCM_REGS_NUM),
 VMSTATE_END_OF_LIST()
 }
diff --git a/hw/misc/allwinner-a10-dramc.c b/hw/misc/allwinner-a10-dramc.c
index e118b0c2fd..a7c58fa6d0 100644
--- a/hw/misc/allwinn

[PULL 71/71] docs: Constify VMstate in examples

2023-12-29 Thread Richard Henderson
Reviewed-by: Juan Quintela 
Reviewed-by: Philippe Mathieu-Daudé 
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-72-richard.hender...@linaro.org>
---
 docs/devel/clocks.rst| 2 +-
 docs/devel/migration.rst | 8 
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/docs/devel/clocks.rst b/docs/devel/clocks.rst
index 675fbeb6ab..c4d14bde04 100644
--- a/docs/devel/clocks.rst
+++ b/docs/devel/clocks.rst
@@ -502,7 +502,7 @@ This is typically used to migrate an input clock state. For 
example:
 
 VMStateDescription my_device_vmstate = {
 .name = "my_device",
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 [...], /* other migrated fields */
 VMSTATE_CLOCK(clk, MyDeviceState),
 VMSTATE_END_OF_LIST()
diff --git a/docs/devel/migration.rst b/docs/devel/migration.rst
index ec55089b25..95351ba51f 100644
--- a/docs/devel/migration.rst
+++ b/docs/devel/migration.rst
@@ -158,7 +158,7 @@ An example (from hw/input/pckbd.c)
   .name = "pckbd",
   .version_id = 3,
   .minimum_version_id = 3,
-  .fields = (VMStateField[]) {
+  .fields = (const VMStateField[]) {
   VMSTATE_UINT8(write_cmd, KBDState),
   VMSTATE_UINT8(status, KBDState),
   VMSTATE_UINT8(mode, KBDState),
@@ -294,7 +294,7 @@ Example:
   .pre_save = ide_drive_pio_pre_save,
   .post_load = ide_drive_pio_post_load,
   .needed = ide_drive_pio_state_needed,
-  .fields = (VMStateField[]) {
+  .fields = (const VMStateField[]) {
   VMSTATE_INT32(req_nb_sectors, IDEState),
   VMSTATE_VARRAY_INT32(io_buffer, IDEState, io_buffer_total_len, 1,
vmstate_info_uint8, uint8_t),
@@ -312,11 +312,11 @@ Example:
   .version_id = 3,
   .minimum_version_id = 0,
   .post_load = ide_drive_post_load,
-  .fields = (VMStateField[]) {
+  .fields = (const VMStateField[]) {
    several fields 
   VMSTATE_END_OF_LIST()
   },
-  .subsections = (const VMStateDescription*[]) {
+  .subsections = (const VMStateDescription * const []) {
   &vmstate_ide_drive_pio_state,
   NULL
   }
-- 
2.34.1




[PULL 41/71] hw/net: Constify VMState

2023-12-29 Thread Richard Henderson
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-42-richard.hender...@linaro.org>
---
 hw/net/allwinner-sun8i-emac.c  |  2 +-
 hw/net/allwinner_emac.c|  4 ++--
 hw/net/cadence_gem.c   |  2 +-
 hw/net/can/can_kvaser_pci.c|  2 +-
 hw/net/can/can_mioe3680_pci.c  |  2 +-
 hw/net/can/can_pcm3680_pci.c   |  2 +-
 hw/net/can/can_sja1000.c   |  4 ++--
 hw/net/can/ctucan_core.c   |  4 ++--
 hw/net/can/ctucan_pci.c|  2 +-
 hw/net/can/xlnx-versal-canfd.c |  2 +-
 hw/net/can/xlnx-zynqmp-can.c   |  2 +-
 hw/net/dp8393x.c   |  2 +-
 hw/net/e1000.c | 10 +-
 hw/net/e1000e.c|  6 +++---
 hw/net/eepro100.c  |  2 +-
 hw/net/ftgmac100.c |  4 ++--
 hw/net/i82596.c|  2 +-
 hw/net/igb.c   |  8 
 hw/net/imx_fec.c   |  6 +++---
 hw/net/lan9118.c   |  4 ++--
 hw/net/lance.c |  2 +-
 hw/net/lasi_i82596.c   |  2 +-
 hw/net/mipsnet.c   |  2 +-
 hw/net/msf2-emac.c |  2 +-
 hw/net/mv88w8618_eth.c |  2 +-
 hw/net/ne2000-isa.c|  2 +-
 hw/net/ne2000-pci.c|  2 +-
 hw/net/ne2000.c|  2 +-
 hw/net/npcm7xx_emc.c   |  2 +-
 hw/net/pcnet-pci.c |  2 +-
 hw/net/pcnet.c |  2 +-
 hw/net/rtl8139.c   |  6 +++---
 hw/net/smc91c111.c |  2 +-
 hw/net/spapr_llan.c|  8 
 hw/net/stellaris_enet.c|  4 ++--
 hw/net/sungem.c|  2 +-
 hw/net/sunhme.c|  2 +-
 hw/net/tulip.c |  2 +-
 hw/net/virtio-net.c| 18 +-
 hw/net/vmxnet3.c   | 18 +-
 hw/net/xgmac.c |  4 ++--
 41 files changed, 80 insertions(+), 80 deletions(-)

diff --git a/hw/net/allwinner-sun8i-emac.c b/hw/net/allwinner-sun8i-emac.c
index cc350d40e5..108ae9c853 100644
--- a/hw/net/allwinner-sun8i-emac.c
+++ b/hw/net/allwinner-sun8i-emac.c
@@ -851,7 +851,7 @@ static const VMStateDescription vmstate_aw_emac = {
 .version_id = 1,
 .minimum_version_id = 1,
 .post_load = allwinner_sun8i_emac_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8(mii_phy_addr, AwSun8iEmacState),
 VMSTATE_UINT32(mii_cmd, AwSun8iEmacState),
 VMSTATE_UINT32(mii_data, AwSun8iEmacState),
diff --git a/hw/net/allwinner_emac.c b/hw/net/allwinner_emac.c
index e10965de14..989839784a 100644
--- a/hw/net/allwinner_emac.c
+++ b/hw/net/allwinner_emac.c
@@ -472,7 +472,7 @@ static const VMStateDescription vmstate_mii = {
 .name = "rtl8201cp",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT16(bmcr, RTL8201CPState),
 VMSTATE_UINT16(bmsr, RTL8201CPState),
 VMSTATE_UINT16(anar, RTL8201CPState),
@@ -495,7 +495,7 @@ static const VMStateDescription vmstate_aw_emac = {
 .version_id = 1,
 .minimum_version_id = 1,
 .post_load = aw_emac_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_STRUCT(mii, AwEmacState, 1, vmstate_mii, RTL8201CPState),
 VMSTATE_UINT32(ctl, AwEmacState),
 VMSTATE_UINT32(tx_mode, AwEmacState),
diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c
index 296bba238e..d7b7b134b0 100644
--- a/hw/net/cadence_gem.c
+++ b/hw/net/cadence_gem.c
@@ -1771,7 +1771,7 @@ static const VMStateDescription vmstate_cadence_gem = {
 .name = "cadence_gem",
 .version_id = 4,
 .minimum_version_id = 4,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32_ARRAY(regs, CadenceGEMState, CADENCE_GEM_MAXREG),
 VMSTATE_UINT16_ARRAY(phy_regs, CadenceGEMState, 32),
 VMSTATE_UINT8(phy_loop, CadenceGEMState),
diff --git a/hw/net/can/can_kvaser_pci.c b/hw/net/can/can_kvaser_pci.c
index 2cd90cef1e..bf41e6b261 100644
--- a/hw/net/can/can_kvaser_pci.c
+++ b/hw/net/can/can_kvaser_pci.c
@@ -266,7 +266,7 @@ static const VMStateDescription vmstate_kvaser_pci = {
 .name = "kvaser_pci",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_PCI_DEVICE(dev, KvaserPCIState),
 /* Load this before sja_state.  */
 VMSTATE_UINT32(s5920_intcsr, KvaserPCIState),
diff --git a/hw/net/can/can_mioe3680_pci.c b/hw/net/can/can_mioe3680_pci.c
index b9918773b3..308b17e0c0 100644
--- a/hw/net/can/can_mioe3680_pci.c
+++ b/hw/net/can/can_mioe3680_pci.c
@@ -203,7 +203,7 @@ static const VMStateDescription vmstate_mioe3680_pci = {
 .name = "mioe3680_pci",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_PCI_DEVICE(dev, Mioe3680PCIState),
 VMSTATE_STRUCT(

[PULL 45/71] hw/pci-bridge: Constify VMState

2023-12-29 Thread Richard Henderson
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-46-richard.hender...@linaro.org>
---
 hw/pci-bridge/gen_pcie_root_port.c | 2 +-
 hw/pci-bridge/i82801b11.c  | 2 +-
 hw/pci-bridge/ioh3420.c| 2 +-
 hw/pci-bridge/pci_bridge_dev.c | 2 +-
 hw/pci-bridge/pcie_pci_bridge.c| 2 +-
 hw/pci-bridge/xio3130_downstream.c | 2 +-
 hw/pci-bridge/xio3130_upstream.c   | 2 +-
 7 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/hw/pci-bridge/gen_pcie_root_port.c 
b/hw/pci-bridge/gen_pcie_root_port.c
index 1ce4e7beba..784507c826 100644
--- a/hw/pci-bridge/gen_pcie_root_port.c
+++ b/hw/pci-bridge/gen_pcie_root_port.c
@@ -117,7 +117,7 @@ static const VMStateDescription vmstate_rp_dev = {
 .version_id = 1,
 .minimum_version_id = 1,
 .post_load = pcie_cap_slot_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_PCI_DEVICE(parent_obj.parent_obj.parent_obj, PCIESlot),
 VMSTATE_STRUCT(parent_obj.parent_obj.parent_obj.exp.aer_log,
PCIESlot, 0, vmstate_pcie_aer_log, PCIEAERLog),
diff --git a/hw/pci-bridge/i82801b11.c b/hw/pci-bridge/i82801b11.c
index 0e83cd11b2..c140919cbc 100644
--- a/hw/pci-bridge/i82801b11.c
+++ b/hw/pci-bridge/i82801b11.c
@@ -81,7 +81,7 @@ err_bridge:
 static const VMStateDescription i82801b11_bridge_dev_vmstate = {
 .name = "i82801b11_bridge",
 .priority = MIG_PRI_PCI_BUS,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_PCI_DEVICE(parent_obj, PCIBridge),
 VMSTATE_END_OF_LIST()
 }
diff --git a/hw/pci-bridge/ioh3420.c b/hw/pci-bridge/ioh3420.c
index f1e16135a3..be752a4bda 100644
--- a/hw/pci-bridge/ioh3420.c
+++ b/hw/pci-bridge/ioh3420.c
@@ -88,7 +88,7 @@ static const VMStateDescription vmstate_ioh3420 = {
 .version_id = 1,
 .minimum_version_id = 1,
 .post_load = pcie_cap_slot_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_PCI_DEVICE(parent_obj.parent_obj.parent_obj, PCIESlot),
 VMSTATE_STRUCT(parent_obj.parent_obj.parent_obj.exp.aer_log,
PCIESlot, 0, vmstate_pcie_aer_log, PCIEAERLog),
diff --git a/hw/pci-bridge/pci_bridge_dev.c b/hw/pci-bridge/pci_bridge_dev.c
index 4b2696ea7f..089f91efed 100644
--- a/hw/pci-bridge/pci_bridge_dev.c
+++ b/hw/pci-bridge/pci_bridge_dev.c
@@ -199,7 +199,7 @@ static bool pci_device_shpc_present(void *opaque, int 
version_id)
 static const VMStateDescription pci_bridge_dev_vmstate = {
 .name = "pci_bridge",
 .priority = MIG_PRI_PCI_BUS,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_PCI_DEVICE(parent_obj, PCIBridge),
 SHPC_VMSTATE(shpc, PCIDevice, pci_device_shpc_present),
 VMSTATE_END_OF_LIST()
diff --git a/hw/pci-bridge/pcie_pci_bridge.c b/hw/pci-bridge/pcie_pci_bridge.c
index 2301b2ca0b..7646ac2397 100644
--- a/hw/pci-bridge/pcie_pci_bridge.c
+++ b/hw/pci-bridge/pcie_pci_bridge.c
@@ -132,7 +132,7 @@ static Property pcie_pci_bridge_dev_properties[] = {
 static const VMStateDescription pcie_pci_bridge_dev_vmstate = {
 .name = TYPE_PCIE_PCI_BRIDGE_DEV,
 .priority = MIG_PRI_PCI_BUS,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_PCI_DEVICE(parent_obj, PCIBridge),
 SHPC_VMSTATE(shpc, PCIDevice, NULL),
 VMSTATE_END_OF_LIST()
diff --git a/hw/pci-bridge/xio3130_downstream.c 
b/hw/pci-bridge/xio3130_downstream.c
index 38a2361fa2..907d5105b0 100644
--- a/hw/pci-bridge/xio3130_downstream.c
+++ b/hw/pci-bridge/xio3130_downstream.c
@@ -146,7 +146,7 @@ static const VMStateDescription vmstate_xio3130_downstream 
= {
 .version_id = 1,
 .minimum_version_id = 1,
 .post_load = pcie_cap_slot_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_PCI_DEVICE(parent_obj.parent_obj.parent_obj, PCIESlot),
 VMSTATE_STRUCT(parent_obj.parent_obj.parent_obj.exp.aer_log,
PCIESlot, 0, vmstate_pcie_aer_log, PCIEAERLog),
diff --git a/hw/pci-bridge/xio3130_upstream.c b/hw/pci-bridge/xio3130_upstream.c
index a48bfe3bc5..2a6cff6e03 100644
--- a/hw/pci-bridge/xio3130_upstream.c
+++ b/hw/pci-bridge/xio3130_upstream.c
@@ -115,7 +115,7 @@ static const VMStateDescription vmstate_xio3130_upstream = {
 .priority = MIG_PRI_PCI_BUS,
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_PCI_DEVICE(parent_obj.parent_obj, PCIEPort),
 VMSTATE_STRUCT(parent_obj.parent_obj.exp.aer_log, PCIEPort, 0,
vmstate_pcie_aer_log, PCIEAERLog),
-- 
2.34.1




[PULL 43/71] hw/openrisc: Constify VMState

2023-12-29 Thread Richard Henderson
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-44-richard.hender...@linaro.org>
---
 hw/openrisc/cputimer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/openrisc/cputimer.c b/hw/openrisc/cputimer.c
index 10163b391b..835986c4db 100644
--- a/hw/openrisc/cputimer.c
+++ b/hw/openrisc/cputimer.c
@@ -145,7 +145,7 @@ static const VMStateDescription vmstate_or1k_timer = {
 .name = "or1k_timer",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(ttcr, OR1KTimerState),
 VMSTATE_UINT64(last_clk, OR1KTimerState),
 VMSTATE_END_OF_LIST()
-- 
2.34.1




[PULL 39/71] hw/m68k: Constify VMState

2023-12-29 Thread Richard Henderson
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-40-richard.hender...@linaro.org>
---
 hw/m68k/next-cube.c | 4 ++--
 hw/m68k/q800-glue.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c
index 292f13defb..9f6f90d68b 100644
--- a/hw/m68k/next-cube.c
+++ b/hw/m68k/next-cube.c
@@ -923,7 +923,7 @@ static const VMStateDescription next_rtc_vmstate = {
 .name = "next-rtc",
 .version_id = 2,
 .minimum_version_id = 2,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_INT8(phase, NextRtc),
 VMSTATE_UINT8_ARRAY(ram, NextRtc, 32),
 VMSTATE_UINT8(command, NextRtc),
@@ -939,7 +939,7 @@ static const VMStateDescription next_pc_vmstate = {
 .name = "next-pc",
 .version_id = 2,
 .minimum_version_id = 2,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(scr1, NeXTPC),
 VMSTATE_UINT32(scr2, NeXTPC),
 VMSTATE_UINT32(old_scr2, NeXTPC),
diff --git a/hw/m68k/q800-glue.c b/hw/m68k/q800-glue.c
index f413b1599a..b5a7713863 100644
--- a/hw/m68k/q800-glue.c
+++ b/hw/m68k/q800-glue.c
@@ -189,7 +189,7 @@ static const VMStateDescription vmstate_glue = {
 .name = "q800-glue",
 .version_id = 0,
 .minimum_version_id = 0,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8(ipr, GLUEState),
 VMSTATE_UINT8(auxmode, GLUEState),
 VMSTATE_TIMER_PTR(nmi_release, GLUEState),
-- 
2.34.1




[PULL 60/71] hw/virtio: Constify VMState

2023-12-29 Thread Richard Henderson
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-61-richard.hender...@linaro.org>
---
 hw/virtio/vdpa-dev.c   |  2 +-
 hw/virtio/vhost-user-fs.c  |  6 +++---
 hw/virtio/vhost-vsock.c|  2 +-
 hw/virtio/virtio-balloon.c | 10 +-
 hw/virtio/virtio-crypto.c  |  2 +-
 hw/virtio/virtio-iommu.c   | 12 ++--
 hw/virtio/virtio-mem.c |  8 
 hw/virtio/virtio-mmio.c|  8 
 hw/virtio/virtio-pci.c |  8 
 hw/virtio/virtio-rng.c |  2 +-
 hw/virtio/virtio.c | 28 ++--
 11 files changed, 44 insertions(+), 44 deletions(-)

diff --git a/hw/virtio/vdpa-dev.c b/hw/virtio/vdpa-dev.c
index 8774986571..eb9ecea83b 100644
--- a/hw/virtio/vdpa-dev.c
+++ b/hw/virtio/vdpa-dev.c
@@ -344,7 +344,7 @@ static const VMStateDescription vmstate_vhost_vdpa_device = 
{
 .unmigratable = 1,
 .minimum_version_id = 1,
 .version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_VIRTIO_DEVICE,
 VMSTATE_END_OF_LIST()
 },
diff --git a/hw/virtio/vhost-user-fs.c b/hw/virtio/vhost-user-fs.c
index eb91723855..cca2cd41be 100644
--- a/hw/virtio/vhost-user-fs.c
+++ b/hw/virtio/vhost-user-fs.c
@@ -373,11 +373,11 @@ static const VMStateDescription vuf_backend_vmstate;
 static const VMStateDescription vuf_vmstate = {
 .name = "vhost-user-fs",
 .version_id = 0,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_VIRTIO_DEVICE,
 VMSTATE_END_OF_LIST()
 },
-.subsections = (const VMStateDescription * []) {
+.subsections = (const VMStateDescription * const []) {
 &vuf_backend_vmstate,
 NULL,
 }
@@ -389,7 +389,7 @@ static const VMStateDescription vuf_backend_vmstate = {
 .needed = vuf_is_internal_migration,
 .pre_load = vuf_check_migration_support,
 .pre_save = vuf_check_migration_support,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 {
 .name = "back-end",
 .info = &(const VMStateInfo) {
diff --git a/hw/virtio/vhost-vsock.c b/hw/virtio/vhost-vsock.c
index aa16d584ee..d5ca0b5a10 100644
--- a/hw/virtio/vhost-vsock.c
+++ b/hw/virtio/vhost-vsock.c
@@ -111,7 +111,7 @@ static const VMStateDescription vmstate_virtio_vhost_vsock 
= {
 .name = "virtio-vhost_vsock",
 .minimum_version_id = VHOST_VSOCK_SAVEVM_VERSION,
 .version_id = VHOST_VSOCK_SAVEVM_VERSION,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_VIRTIO_DEVICE,
 VMSTATE_END_OF_LIST()
 },
diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
index d004cf29d2..486fe3da32 100644
--- a/hw/virtio/virtio-balloon.c
+++ b/hw/virtio/virtio-balloon.c
@@ -817,7 +817,7 @@ static const VMStateDescription 
vmstate_virtio_balloon_free_page_hint = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = virtio_balloon_free_page_support,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(free_page_hint_cmd_id, VirtIOBalloon),
 VMSTATE_UINT32(free_page_hint_status, VirtIOBalloon),
 VMSTATE_END_OF_LIST()
@@ -829,7 +829,7 @@ static const VMStateDescription 
vmstate_virtio_balloon_page_poison = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = virtio_balloon_page_poison_support,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(poison_val, VirtIOBalloon),
 VMSTATE_END_OF_LIST()
 }
@@ -840,12 +840,12 @@ static const VMStateDescription 
vmstate_virtio_balloon_device = {
 .version_id = 1,
 .minimum_version_id = 1,
 .post_load = virtio_balloon_post_load_device,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(num_pages, VirtIOBalloon),
 VMSTATE_UINT32(actual, VirtIOBalloon),
 VMSTATE_END_OF_LIST()
 },
-.subsections = (const VMStateDescription * []) {
+.subsections = (const VMStateDescription * const []) {
 &vmstate_virtio_balloon_free_page_hint,
 &vmstate_virtio_balloon_page_poison,
 NULL
@@ -996,7 +996,7 @@ static const VMStateDescription vmstate_virtio_balloon = {
 .name = "virtio-balloon",
 .minimum_version_id = 1,
 .version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_VIRTIO_DEVICE,
 VMSTATE_END_OF_LIST()
 },
diff --git a/hw/virtio/virtio-crypto.c b/hw/virtio/virtio-crypto.c
index 0e2cc8d5a8..fe1313f2ad 100644
--- a/hw/virtio/virtio-crypto.c
+++ b/hw/virtio/virtio-crypto.c
@@ -1122,7 +1122,7 @@ static const VMStateDescription vmstate_virtio_crypto = {
 .unmigratable = 1,
 .minimum_version_id = VIRTIO_CRYPTO_VM_VERSION,
 .version_id = VIRTIO_CRYPTO_VM_VERSION,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_VIRTIO_DEVICE,

[PULL 56/71] hw/timer: Constify VMState

2023-12-29 Thread Richard Henderson
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-57-richard.hender...@linaro.org>
---
 hw/timer/a9gtimer.c|  8 
 hw/timer/allwinner-a10-pit.c   |  2 +-
 hw/timer/arm_mptimer.c |  4 ++--
 hw/timer/arm_timer.c   |  4 ++--
 hw/timer/armv7m_systick.c  |  2 +-
 hw/timer/aspeed_timer.c|  4 ++--
 hw/timer/bcm2835_systmr.c  |  2 +-
 hw/timer/cadence_ttc.c |  4 ++--
 hw/timer/cmsdk-apb-dualtimer.c |  4 ++--
 hw/timer/cmsdk-apb-timer.c |  2 +-
 hw/timer/digic-timer.c |  2 +-
 hw/timer/etraxfs_timer.c   |  2 +-
 hw/timer/exynos4210_mct.c  | 12 ++--
 hw/timer/exynos4210_pwm.c  |  4 ++--
 hw/timer/hpet.c| 10 +-
 hw/timer/i8254_common.c|  4 ++--
 hw/timer/ibex_timer.c  |  2 +-
 hw/timer/imx_epit.c|  2 +-
 hw/timer/imx_gpt.c |  2 +-
 hw/timer/mss-timer.c   |  4 ++--
 hw/timer/npcm7xx_timer.c   |  8 
 hw/timer/nrf51_timer.c |  2 +-
 hw/timer/pxa2xx_timer.c|  6 +++---
 hw/timer/renesas_cmt.c |  2 +-
 hw/timer/renesas_tmr.c |  2 +-
 hw/timer/sifive_pwm.c  |  2 +-
 hw/timer/slavio_timer.c|  4 ++--
 hw/timer/sse-counter.c |  2 +-
 hw/timer/sse-timer.c   |  2 +-
 hw/timer/stellaris-gptm.c  |  2 +-
 hw/timer/stm32f2xx_timer.c |  2 +-
 31 files changed, 57 insertions(+), 57 deletions(-)

diff --git a/hw/timer/a9gtimer.c b/hw/timer/a9gtimer.c
index 5e959b6d09..a2ac5bdfb9 100644
--- a/hw/timer/a9gtimer.c
+++ b/hw/timer/a9gtimer.c
@@ -328,7 +328,7 @@ static const VMStateDescription vmstate_a9_gtimer_per_cpu = 
{
 .name = "arm.cortex-a9-global-timer.percpu",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(control, A9GTimerPerCPU),
 VMSTATE_UINT64(compare, A9GTimerPerCPU),
 VMSTATE_UINT32(status, A9GTimerPerCPU),
@@ -342,7 +342,7 @@ static const VMStateDescription vmstate_a9_gtimer_control = 
{
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = vmstate_a9_gtimer_control_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(control, A9GTimerState),
 VMSTATE_END_OF_LIST()
 }
@@ -352,7 +352,7 @@ static const VMStateDescription vmstate_a9_gtimer = {
 .name = "arm.cortex-a9-global-timer",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_TIMER_PTR(timer, A9GTimerState),
 VMSTATE_UINT64(counter, A9GTimerState),
 VMSTATE_UINT64(ref_counter, A9GTimerState),
@@ -362,7 +362,7 @@ static const VMStateDescription vmstate_a9_gtimer = {
  A9GTimerPerCPU),
 VMSTATE_END_OF_LIST()
 },
-.subsections = (const VMStateDescription*[]) {
+.subsections = (const VMStateDescription * const []) {
 &vmstate_a9_gtimer_control,
 NULL
 }
diff --git a/hw/timer/allwinner-a10-pit.c b/hw/timer/allwinner-a10-pit.c
index 971f78462a..a524de1381 100644
--- a/hw/timer/allwinner-a10-pit.c
+++ b/hw/timer/allwinner-a10-pit.c
@@ -200,7 +200,7 @@ static const VMStateDescription vmstate_a10_pit = {
 .name = "a10.pit",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(irq_enable, AwA10PITState),
 VMSTATE_UINT32(irq_status, AwA10PITState),
 VMSTATE_UINT32_ARRAY(control, AwA10PITState, AW_A10_PIT_TIMER_NR),
diff --git a/hw/timer/arm_mptimer.c b/hw/timer/arm_mptimer.c
index cdfca3000b..bca4cee0e4 100644
--- a/hw/timer/arm_mptimer.c
+++ b/hw/timer/arm_mptimer.c
@@ -281,7 +281,7 @@ static const VMStateDescription vmstate_timerblock = {
 .name = "arm_mptimer_timerblock",
 .version_id = 3,
 .minimum_version_id = 3,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(control, TimerBlock),
 VMSTATE_UINT32(status, TimerBlock),
 VMSTATE_PTIMER(timer, TimerBlock),
@@ -293,7 +293,7 @@ static const VMStateDescription vmstate_arm_mptimer = {
 .name = "arm_mptimer",
 .version_id = 3,
 .minimum_version_id = 3,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_STRUCT_VARRAY_UINT32(timerblock, ARMMPTimerState, num_cpu,
  3, vmstate_timerblock, TimerBlock),
 VMSTATE_END_OF_LIST()
diff --git a/hw/timer/arm_timer.c b/hw/timer/arm_timer.c
index 9afe8da831..0940e03f1d 100644
--- a/hw/timer/arm_timer.c
+++ b/hw/timer/arm_timer.c
@@ -163,7 +163,7 @@ static const VMStateDescription vmstate_arm_timer = {
 .name = "arm_timer",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32

[PULL 53/71] hw/sensor: Constify VMState

2023-12-29 Thread Richard Henderson
Tested-by: Philippe Mathieu-Daudé 
Reviewed-by: Philippe Mathieu-Daudé 
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-54-richard.hender...@linaro.org>
---
 hw/sensor/adm1266.c| 2 +-
 hw/sensor/adm1272.c| 2 +-
 hw/sensor/dps310.c | 2 +-
 hw/sensor/emc141x.c| 2 +-
 hw/sensor/lsm303dlhc_mag.c | 2 +-
 hw/sensor/max31785.c   | 2 +-
 hw/sensor/max34451.c   | 2 +-
 hw/sensor/tmp105.c | 6 +++---
 hw/sensor/tmp421.c | 2 +-
 9 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/hw/sensor/adm1266.c b/hw/sensor/adm1266.c
index 5ae4f82ba1..5454b73a63 100644
--- a/hw/sensor/adm1266.c
+++ b/hw/sensor/adm1266.c
@@ -202,7 +202,7 @@ static const VMStateDescription vmstate_adm1266 = {
 .name = "ADM1266",
 .version_id = 0,
 .minimum_version_id = 0,
-.fields = (VMStateField[]){
+.fields = (const VMStateField[]){
 VMSTATE_PMBUS_DEVICE(parent, ADM1266State),
 VMSTATE_END_OF_LIST()
 }
diff --git a/hw/sensor/adm1272.c b/hw/sensor/adm1272.c
index 8f4a1c2cd4..1f7c8abb83 100644
--- a/hw/sensor/adm1272.c
+++ b/hw/sensor/adm1272.c
@@ -457,7 +457,7 @@ static const VMStateDescription vmstate_adm1272 = {
 .name = "ADM1272",
 .version_id = 0,
 .minimum_version_id = 0,
-.fields = (VMStateField[]){
+.fields = (const VMStateField[]){
 VMSTATE_PMBUS_DEVICE(parent, ADM1272State),
 VMSTATE_UINT64(ein_ext, ADM1272State),
 VMSTATE_UINT32(pin_ext, ADM1272State),
diff --git a/hw/sensor/dps310.c b/hw/sensor/dps310.c
index addee99b19..01c776dd7a 100644
--- a/hw/sensor/dps310.c
+++ b/hw/sensor/dps310.c
@@ -188,7 +188,7 @@ static const VMStateDescription vmstate_dps310 = {
 .name = "DPS310",
 .version_id = 0,
 .minimum_version_id = 0,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8(len, DPS310State),
 VMSTATE_UINT8_ARRAY(regs, DPS310State, NUM_REGISTERS),
 VMSTATE_UINT8(pointer, DPS310State),
diff --git a/hw/sensor/emc141x.c b/hw/sensor/emc141x.c
index 7ce8f4e979..95079558e8 100644
--- a/hw/sensor/emc141x.c
+++ b/hw/sensor/emc141x.c
@@ -228,7 +228,7 @@ static const VMStateDescription vmstate_emc141x = {
 .name = "EMC141X",
 .version_id = 0,
 .minimum_version_id = 0,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8(len, EMC141XState),
 VMSTATE_UINT8(data, EMC141XState),
 VMSTATE_UINT8(pointer, EMC141XState),
diff --git a/hw/sensor/lsm303dlhc_mag.c b/hw/sensor/lsm303dlhc_mag.c
index bb8d48b2fd..343ff98990 100644
--- a/hw/sensor/lsm303dlhc_mag.c
+++ b/hw/sensor/lsm303dlhc_mag.c
@@ -442,7 +442,7 @@ static const VMStateDescription vmstate_lsm303dlhc_mag = {
 .name = "LSM303DLHC_MAG",
 .version_id = 0,
 .minimum_version_id = 0,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 
 VMSTATE_I2C_SLAVE(parent_obj, LSM303DLHCMagState),
 VMSTATE_UINT8(len, LSM303DLHCMagState),
diff --git a/hw/sensor/max31785.c b/hw/sensor/max31785.c
index 8b95e32481..916ed4d457 100644
--- a/hw/sensor/max31785.c
+++ b/hw/sensor/max31785.c
@@ -487,7 +487,7 @@ static const VMStateDescription vmstate_max31785 = {
 .name = TYPE_MAX31785,
 .version_id = 0,
 .minimum_version_id = 0,
-.fields = (VMStateField[]){
+.fields = (const VMStateField[]){
 VMSTATE_PMBUS_DEVICE(parent, MAX31785State),
 VMSTATE_UINT16_ARRAY(mfr_mode, MAX31785State,
  MAX31785_TOTAL_NUM_PAGES),
diff --git a/hw/sensor/max34451.c b/hw/sensor/max34451.c
index 9db52ef677..031ae53f59 100644
--- a/hw/sensor/max34451.c
+++ b/hw/sensor/max34451.c
@@ -654,7 +654,7 @@ static const VMStateDescription vmstate_max34451 = {
 .name = TYPE_MAX34451,
 .version_id = 0,
 .minimum_version_id = 0,
-.fields = (VMStateField[]){
+.fields = (const VMStateField[]){
 VMSTATE_PMBUS_DEVICE(parent, MAX34451State),
 VMSTATE_UINT16_ARRAY(power_good_on, MAX34451State,
  MAX34451_NUM_PWR_DEVICES),
diff --git a/hw/sensor/tmp105.c b/hw/sensor/tmp105.c
index 2056449489..a8730d0b7f 100644
--- a/hw/sensor/tmp105.c
+++ b/hw/sensor/tmp105.c
@@ -238,7 +238,7 @@ static const VMStateDescription 
vmstate_tmp105_detect_falling = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = detect_falling_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_BOOL(detect_falling, TMP105State),
 VMSTATE_END_OF_LIST()
 }
@@ -249,7 +249,7 @@ static const VMStateDescription vmstate_tmp105 = {
 .version_id = 0,
 .minimum_version_id = 0,
 .post_load = tmp105_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8(len, TMP105State),
 VMSTATE_UINT8_ARRAY(buf, TMP105State, 2),
 VMSTATE_UINT8(pointer, TMP105State),
@@ -260,7 +260,7 @@ st

[PULL 65/71] cpu-target: Constify VMState

2023-12-29 Thread Richard Henderson
Reviewed-by: Philippe Mathieu-Daudé 
Signed-off-by: Richard Henderson 
Reviewed-by: Zhao Liu 
Message-Id: <20231221031652.119827-66-richard.hender...@linaro.org>
---
 cpu-target.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/cpu-target.c b/cpu-target.c
index 508013e23d..430dc53566 100644
--- a/cpu-target.c
+++ b/cpu-target.c
@@ -87,7 +87,7 @@ static const VMStateDescription 
vmstate_cpu_common_exception_index = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = cpu_common_exception_index_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_INT32(exception_index, CPUState),
 VMSTATE_END_OF_LIST()
 }
@@ -105,7 +105,7 @@ static const VMStateDescription 
vmstate_cpu_common_crash_occurred = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = cpu_common_crash_occurred_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_BOOL(crash_occurred, CPUState),
 VMSTATE_END_OF_LIST()
 }
@@ -117,12 +117,12 @@ const VMStateDescription vmstate_cpu_common = {
 .minimum_version_id = 1,
 .pre_load = cpu_common_pre_load,
 .post_load = cpu_common_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(halted, CPUState),
 VMSTATE_UINT32(interrupt_request, CPUState),
 VMSTATE_END_OF_LIST()
 },
-.subsections = (const VMStateDescription*[]) {
+.subsections = (const VMStateDescription * const []) {
 &vmstate_cpu_common_exception_index,
 &vmstate_cpu_common_crash_occurred,
 NULL
-- 
2.34.1




[PULL 57/71] hw/tpm: Constify VMState

2023-12-29 Thread Richard Henderson
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-58-richard.hender...@linaro.org>
---
 hw/tpm/tpm_crb.c| 2 +-
 hw/tpm/tpm_spapr.c  | 2 +-
 hw/tpm/tpm_tis_common.c | 2 +-
 hw/tpm/tpm_tis_i2c.c| 2 +-
 hw/tpm/tpm_tis_isa.c| 2 +-
 hw/tpm/tpm_tis_sysbus.c | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/hw/tpm/tpm_crb.c b/hw/tpm/tpm_crb.c
index ea930da545..5cd5a2533b 100644
--- a/hw/tpm/tpm_crb.c
+++ b/hw/tpm/tpm_crb.c
@@ -220,7 +220,7 @@ static int tpm_crb_pre_save(void *opaque)
 static const VMStateDescription vmstate_tpm_crb = {
 .name = "tpm-crb",
 .pre_save = tpm_crb_pre_save,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32_ARRAY(regs, CRBState, TPM_CRB_R_MAX),
 VMSTATE_END_OF_LIST(),
 }
diff --git a/hw/tpm/tpm_spapr.c b/hw/tpm/tpm_spapr.c
index dea7b1333b..e084e987e6 100644
--- a/hw/tpm/tpm_spapr.c
+++ b/hw/tpm/tpm_spapr.c
@@ -353,7 +353,7 @@ static const VMStateDescription vmstate_spapr_vtpm = {
 .name = "tpm-spapr",
 .pre_save = tpm_spapr_pre_save,
 .post_load = tpm_spapr_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_SPAPR_VIO(vdev, SpaprTpmState),
 
 VMSTATE_UINT8(state, SpaprTpmState),
diff --git a/hw/tpm/tpm_tis_common.c b/hw/tpm/tpm_tis_common.c
index 279ce436b5..1bfa28bfd9 100644
--- a/hw/tpm/tpm_tis_common.c
+++ b/hw/tpm/tpm_tis_common.c
@@ -879,7 +879,7 @@ int tpm_tis_pre_save(TPMState *s)
 const VMStateDescription vmstate_locty = {
 .name = "tpm-tis/locty",
 .version_id = 0,
-.fields  = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(state, TPMLocality),
 VMSTATE_UINT32(inte, TPMLocality),
 VMSTATE_UINT32(ints, TPMLocality),
diff --git a/hw/tpm/tpm_tis_i2c.c b/hw/tpm/tpm_tis_i2c.c
index 4ecea7fa3e..4bb09655b4 100644
--- a/hw/tpm/tpm_tis_i2c.c
+++ b/hw/tpm/tpm_tis_i2c.c
@@ -115,7 +115,7 @@ static const VMStateDescription vmstate_tpm_tis_i2c = {
 .version_id = 0,
 .pre_save  = tpm_tis_i2c_pre_save,
 .post_load  = tpm_tis_i2c_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_BUFFER(state.buffer, TPMStateI2C),
 VMSTATE_UINT16(state.rw_offset, TPMStateI2C),
 VMSTATE_UINT8(state.active_locty, TPMStateI2C),
diff --git a/hw/tpm/tpm_tis_isa.c b/hw/tpm/tpm_tis_isa.c
index 0367401586..8887b3c9c4 100644
--- a/hw/tpm/tpm_tis_isa.c
+++ b/hw/tpm/tpm_tis_isa.c
@@ -53,7 +53,7 @@ static const VMStateDescription vmstate_tpm_tis_isa = {
 .name = "tpm-tis",
 .version_id = 0,
 .pre_save  = tpm_tis_pre_save_isa,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_BUFFER(state.buffer, TPMStateISA),
 VMSTATE_UINT16(state.rw_offset, TPMStateISA),
 VMSTATE_UINT8(state.active_locty, TPMStateISA),
diff --git a/hw/tpm/tpm_tis_sysbus.c b/hw/tpm/tpm_tis_sysbus.c
index 2fc550f119..941f7f7f62 100644
--- a/hw/tpm/tpm_tis_sysbus.c
+++ b/hw/tpm/tpm_tis_sysbus.c
@@ -52,7 +52,7 @@ static const VMStateDescription vmstate_tpm_tis_sysbus = {
 .name = "tpm-tis",
 .version_id = 0,
 .pre_save  = tpm_tis_pre_save_sysbus,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_BUFFER(state.buffer, TPMStateSysBus),
 VMSTATE_UINT16(state.rw_offset, TPMStateSysBus),
 VMSTATE_UINT8(state.active_locty, TPMStateSysBus),
-- 
2.34.1




[PULL 68/71] replay: Constify VMState

2023-12-29 Thread Richard Henderson
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-69-richard.hender...@linaro.org>
---
 replay/replay-snapshot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/replay/replay-snapshot.c b/replay/replay-snapshot.c
index 10a7cf7992..e5e39161e3 100644
--- a/replay/replay-snapshot.c
+++ b/replay/replay-snapshot.c
@@ -51,7 +51,7 @@ static const VMStateDescription vmstate_replay = {
 .minimum_version_id = 2,
 .pre_save = replay_pre_save,
 .post_load = replay_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_INT64_ARRAY(cached_clock, ReplayState, REPLAY_CLOCK_COUNT),
 VMSTATE_UINT64(current_icount, ReplayState),
 VMSTATE_INT32(instruction_count, ReplayState),
-- 
2.34.1




[PULL 32/71] hw/ide: Constify VMState

2023-12-29 Thread Richard Henderson
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-33-richard.hender...@linaro.org>
---
 hw/ide/ahci-allwinner.c |  2 +-
 hw/ide/ahci.c   |  8 
 hw/ide/core.c   | 16 
 hw/ide/ich.c|  2 +-
 hw/ide/isa.c|  2 +-
 hw/ide/macio.c  |  2 +-
 hw/ide/microdrive.c |  2 +-
 hw/ide/mmio.c   |  2 +-
 hw/ide/pci.c| 10 +-
 9 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/hw/ide/ahci-allwinner.c b/hw/ide/ahci-allwinner.c
index 227e747ba7..b173121006 100644
--- a/hw/ide/ahci-allwinner.c
+++ b/hw/ide/ahci-allwinner.c
@@ -97,7 +97,7 @@ static const VMStateDescription vmstate_allwinner_ahci = {
 .name = "allwinner-ahci",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32_ARRAY(regs, AllwinnerAHCIState,
  ALLWINNER_AHCI_MMIO_SIZE / 4),
 VMSTATE_END_OF_LIST()
diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index afdc44b8e0..0eb83a6d46 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -1685,7 +1685,7 @@ void ahci_reset(AHCIState *s)
 static const VMStateDescription vmstate_ncq_tfs = {
 .name = "ncq state",
 .version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(sector_count, NCQTransferState),
 VMSTATE_UINT64(lba, NCQTransferState),
 VMSTATE_UINT8(tag, NCQTransferState),
@@ -1700,7 +1700,7 @@ static const VMStateDescription vmstate_ncq_tfs = {
 static const VMStateDescription vmstate_ahci_device = {
 .name = "ahci port",
 .version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_IDE_BUS(port, AHCIDevice),
 VMSTATE_IDE_DRIVE(port.ifs[0], AHCIDevice),
 VMSTATE_UINT32(port_state, AHCIDevice),
@@ -1817,7 +1817,7 @@ const VMStateDescription vmstate_ahci = {
 .name = "ahci",
 .version_id = 1,
 .post_load = ahci_state_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_STRUCT_VARRAY_POINTER_INT32(dev, AHCIState, ports,
  vmstate_ahci_device, AHCIDevice),
 VMSTATE_UINT32(control_regs.cap, AHCIState),
@@ -1833,7 +1833,7 @@ const VMStateDescription vmstate_ahci = {
 
 static const VMStateDescription vmstate_sysbus_ahci = {
 .name = "sysbus-ahci",
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_AHCI(ahci, SysbusAHCIState),
 VMSTATE_END_OF_LIST()
 },
diff --git a/hw/ide/core.c b/hw/ide/core.c
index 8a0579bff4..9c4a812902 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -2918,7 +2918,7 @@ static const VMStateDescription 
vmstate_ide_atapi_gesn_state = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = ide_atapi_gesn_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_BOOL(events.new_media, IDEState),
 VMSTATE_BOOL(events.eject_request, IDEState),
 VMSTATE_END_OF_LIST()
@@ -2930,7 +2930,7 @@ static const VMStateDescription vmstate_ide_tray_state = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = ide_tray_state_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_BOOL(tray_open, IDEState),
 VMSTATE_BOOL(tray_locked, IDEState),
 VMSTATE_END_OF_LIST()
@@ -2944,7 +2944,7 @@ static const VMStateDescription 
vmstate_ide_drive_pio_state = {
 .pre_save = ide_drive_pio_pre_save,
 .post_load = ide_drive_pio_post_load,
 .needed = ide_drive_pio_state_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_INT32(req_nb_sectors, IDEState),
 VMSTATE_VARRAY_INT32(io_buffer, IDEState, io_buffer_total_len, 1,
  vmstate_info_uint8, uint8_t),
@@ -2962,7 +2962,7 @@ const VMStateDescription vmstate_ide_drive = {
 .version_id = 3,
 .minimum_version_id = 0,
 .post_load = ide_drive_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_INT32(mult_sectors, IDEState),
 VMSTATE_INT32(identify_set, IDEState),
 VMSTATE_BUFFER_TEST(identify_data, IDEState, is_identify_set),
@@ -2985,7 +2985,7 @@ const VMStateDescription vmstate_ide_drive = {
 VMSTATE_UINT8_V(cdrom_changed, IDEState, 3),
 VMSTATE_END_OF_LIST()
 },
-.subsections = (const VMStateDescription*[]) {
+.subsections = (const VMStateDescription * const []) {
 &vmstate_ide_drive_pio_state,
 &vmstate_ide_tray_state,
 &vmstate_ide_atapi_gesn_state,
@@ -2998,7 +2998,7 @@ static const VMStateDescription vmstate_ide_error_status 
= {
 .version_id = 2,
 .minimum_version_id = 1,
 .needed = ide_error_needed,
-.fields = (VMStateField[]) {
+.fields 

[PULL 51/71] hw/scsi: Constify VMState

2023-12-29 Thread Richard Henderson
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-52-richard.hender...@linaro.org>
---
 hw/scsi/esp-pci.c | 2 +-
 hw/scsi/esp.c | 8 
 hw/scsi/lsi53c895a.c  | 2 +-
 hw/scsi/megasas.c | 4 ++--
 hw/scsi/mptsas.c  | 2 +-
 hw/scsi/scsi-bus.c| 6 +++---
 hw/scsi/scsi-disk.c   | 2 +-
 hw/scsi/spapr_vscsi.c | 4 ++--
 hw/scsi/vhost-scsi.c  | 2 +-
 hw/scsi/vhost-user-scsi.c | 2 +-
 hw/scsi/virtio-scsi.c | 2 +-
 hw/scsi/vmw_pvscsi.c  | 6 +++---
 12 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/hw/scsi/esp-pci.c b/hw/scsi/esp-pci.c
index 4e890db0e2..93b3429e0f 100644
--- a/hw/scsi/esp-pci.c
+++ b/hw/scsi/esp-pci.c
@@ -333,7 +333,7 @@ static const VMStateDescription vmstate_esp_pci_scsi = {
 .version_id = 2,
 .minimum_version_id = 1,
 .pre_save = esp_pre_save,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_PCI_DEVICE(parent_obj, PCIESPState),
 VMSTATE_BUFFER_UNSAFE(dma_regs, PCIESPState, 0, 8 * sizeof(uint32_t)),
 VMSTATE_UINT8_V(esp.mig_version_id, PCIESPState, 2),
diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c
index 9b11d8c573..ff90572830 100644
--- a/hw/scsi/esp.c
+++ b/hw/scsi/esp.c
@@ -1237,7 +1237,7 @@ static const VMStateDescription vmstate_esp_pdma = {
 .version_id = 0,
 .minimum_version_id = 0,
 .needed = esp_pdma_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8(pdma_cb, ESPState),
 VMSTATE_END_OF_LIST()
 }
@@ -1248,7 +1248,7 @@ const VMStateDescription vmstate_esp = {
 .version_id = 6,
 .minimum_version_id = 3,
 .post_load = esp_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_BUFFER(rregs, ESPState),
 VMSTATE_BUFFER(wregs, ESPState),
 VMSTATE_INT32(ti_size, ESPState),
@@ -1277,7 +1277,7 @@ const VMStateDescription vmstate_esp = {
 VMSTATE_UINT8_TEST(lun, ESPState, esp_is_version_6),
 VMSTATE_END_OF_LIST()
 },
-.subsections = (const VMStateDescription * []) {
+.subsections = (const VMStateDescription * const []) {
 &vmstate_esp_pdma,
 NULL
 }
@@ -1448,7 +1448,7 @@ static const VMStateDescription vmstate_sysbus_esp_scsi = 
{
 .version_id = 2,
 .minimum_version_id = 1,
 .pre_save = esp_pre_save,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8_V(esp.mig_version_id, SysBusESPState, 2),
 VMSTATE_STRUCT(esp, SysBusESPState, 0, vmstate_esp, ESPState),
 VMSTATE_END_OF_LIST()
diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c
index 634ed49c2e..34e3b89287 100644
--- a/hw/scsi/lsi53c895a.c
+++ b/hw/scsi/lsi53c895a.c
@@ -2205,7 +2205,7 @@ static const VMStateDescription vmstate_lsi_scsi = {
 .minimum_version_id = 0,
 .pre_save = lsi_pre_save,
 .post_load = lsi_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_PCI_DEVICE(parent_obj, LSIState),
 
 VMSTATE_INT32(carry, LSIState),
diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
index 32c70c9e99..2d0c607177 100644
--- a/hw/scsi/megasas.c
+++ b/hw/scsi/megasas.c
@@ -2299,7 +2299,7 @@ static const VMStateDescription vmstate_megasas_gen1 = {
 .name = "megasas",
 .version_id = 0,
 .minimum_version_id = 0,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_PCI_DEVICE(parent_obj, MegasasState),
 VMSTATE_MSIX(parent_obj, MegasasState),
 
@@ -2317,7 +2317,7 @@ static const VMStateDescription vmstate_megasas_gen2 = {
 .name = "megasas-gen2",
 .version_id = 0,
 .minimum_version_id = 0,
-.fields  = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_PCI_DEVICE(parent_obj, MegasasState),
 VMSTATE_MSIX(parent_obj, MegasasState),
 
diff --git a/hw/scsi/mptsas.c b/hw/scsi/mptsas.c
index 75d3ab8bd1..c5d3138c93 100644
--- a/hw/scsi/mptsas.c
+++ b/hw/scsi/mptsas.c
@@ -1366,7 +1366,7 @@ static const VMStateDescription vmstate_mptsas = {
 .version_id = 0,
 .minimum_version_id = 0,
 .post_load = mptsas_post_load,
-.fields  = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_PCI_DEVICE(dev, MPTSASState),
 VMSTATE_BOOL(msi_in_use, MPTSASState),
 VMSTATE_UINT32(state, MPTSASState),
diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
index 5b08cbf60a..0a2eb11c56 100644
--- a/hw/scsi/scsi-bus.c
+++ b/hw/scsi/scsi-bus.c
@@ -1893,7 +1893,7 @@ static const VMStateDescription vmstate_scsi_sense_state 
= {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = scsi_sense_state_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8_SUB_ARRAY(sense, SCSIDevice,
 SCSI_SENSE_BUF_SIZE_OLD,
  

[PULL 55/71] hw/ssi: Constify VMState

2023-12-29 Thread Richard Henderson
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-56-richard.hender...@linaro.org>
---
 hw/ssi/aspeed_smc.c   | 2 +-
 hw/ssi/ibex_spi_host.c| 2 +-
 hw/ssi/imx_spi.c  | 2 +-
 hw/ssi/mss-spi.c  | 2 +-
 hw/ssi/npcm7xx_fiu.c  | 2 +-
 hw/ssi/npcm_pspi.c| 2 +-
 hw/ssi/pl022.c| 2 +-
 hw/ssi/ssi.c  | 2 +-
 hw/ssi/stm32f2xx_spi.c| 2 +-
 hw/ssi/xilinx_spi.c   | 2 +-
 hw/ssi/xilinx_spips.c | 6 +++---
 hw/ssi/xlnx-versal-ospi.c | 4 ++--
 12 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/hw/ssi/aspeed_smc.c b/hw/ssi/aspeed_smc.c
index 2a4001b774..3c93936fd1 100644
--- a/hw/ssi/aspeed_smc.c
+++ b/hw/ssi/aspeed_smc.c
@@ -1201,7 +1201,7 @@ static const VMStateDescription vmstate_aspeed_smc = {
 .name = "aspeed.smc",
 .version_id = 2,
 .minimum_version_id = 2,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32_ARRAY(regs, AspeedSMCState, ASPEED_SMC_R_MAX),
 VMSTATE_UINT8(snoop_index, AspeedSMCState),
 VMSTATE_UINT8(snoop_dummies, AspeedSMCState),
diff --git a/hw/ssi/ibex_spi_host.c b/hw/ssi/ibex_spi_host.c
index c300ec294d..863b5fd60e 100644
--- a/hw/ssi/ibex_spi_host.c
+++ b/hw/ssi/ibex_spi_host.c
@@ -570,7 +570,7 @@ static const VMStateDescription vmstate_ibex = {
 .name = TYPE_IBEX_SPI_HOST,
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32_ARRAY(regs, IbexSPIHostState, IBEX_SPI_HOST_MAX_REGS),
 VMSTATE_VARRAY_UINT32(config_opts, IbexSPIHostState,
   num_cs, 0, vmstate_info_uint32, uint32_t),
diff --git a/hw/ssi/imx_spi.c b/hw/ssi/imx_spi.c
index 189423bb3a..d8a7583ff3 100644
--- a/hw/ssi/imx_spi.c
+++ b/hw/ssi/imx_spi.c
@@ -62,7 +62,7 @@ static const VMStateDescription vmstate_imx_spi = {
 .name = TYPE_IMX_SPI,
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_FIFO32(tx_fifo, IMXSPIState),
 VMSTATE_FIFO32(rx_fifo, IMXSPIState),
 VMSTATE_INT16(burst_length, IMXSPIState),
diff --git a/hw/ssi/mss-spi.c b/hw/ssi/mss-spi.c
index b2432c5a13..1d25ba23aa 100644
--- a/hw/ssi/mss-spi.c
+++ b/hw/ssi/mss-spi.c
@@ -390,7 +390,7 @@ static const VMStateDescription vmstate_mss_spi = {
 .name = TYPE_MSS_SPI,
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_FIFO32(tx_fifo, MSSSpiState),
 VMSTATE_FIFO32(rx_fifo, MSSSpiState),
 VMSTATE_UINT32_ARRAY(regs, MSSSpiState, R_SPI_MAX),
diff --git a/hw/ssi/npcm7xx_fiu.c b/hw/ssi/npcm7xx_fiu.c
index 4eedb2927e..81dd972ee8 100644
--- a/hw/ssi/npcm7xx_fiu.c
+++ b/hw/ssi/npcm7xx_fiu.c
@@ -534,7 +534,7 @@ static const VMStateDescription vmstate_npcm7xx_fiu = {
 .name = "npcm7xx-fiu",
 .version_id = 0,
 .minimum_version_id = 0,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_INT32(active_cs, NPCM7xxFIUState),
 VMSTATE_UINT32_ARRAY(regs, NPCM7xxFIUState, NPCM7XX_FIU_NR_REGS),
 VMSTATE_END_OF_LIST(),
diff --git a/hw/ssi/npcm_pspi.c b/hw/ssi/npcm_pspi.c
index 3fb935043a..41a5323530 100644
--- a/hw/ssi/npcm_pspi.c
+++ b/hw/ssi/npcm_pspi.c
@@ -192,7 +192,7 @@ static const VMStateDescription vmstate_npcm_pspi = {
 .name = "npcm-pspi",
 .version_id = 0,
 .minimum_version_id = 0,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT16_ARRAY(regs, NPCMPSPIState, NPCM_PSPI_NR_REGS),
 VMSTATE_END_OF_LIST(),
 },
diff --git a/hw/ssi/pl022.c b/hw/ssi/pl022.c
index 8954ffebb1..b8be8ddf0e 100644
--- a/hw/ssi/pl022.c
+++ b/hw/ssi/pl022.c
@@ -249,7 +249,7 @@ static const VMStateDescription vmstate_pl022 = {
 .version_id = 1,
 .minimum_version_id = 1,
 .post_load = pl022_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(cr0, PL022State),
 VMSTATE_UINT32(cr1, PL022State),
 VMSTATE_UINT32(bitmask, PL022State),
diff --git a/hw/ssi/ssi.c b/hw/ssi/ssi.c
index 1f3e540ab8..3f357e8f16 100644
--- a/hw/ssi/ssi.c
+++ b/hw/ssi/ssi.c
@@ -172,7 +172,7 @@ const VMStateDescription vmstate_ssi_peripheral = {
 .name = "SSISlave",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_BOOL(cs, SSIPeripheral),
 VMSTATE_END_OF_LIST()
 }
diff --git a/hw/ssi/stm32f2xx_spi.c b/hw/ssi/stm32f2xx_spi.c
index cd6e8443db..a37139fe5a 100644
--- a/hw/ssi/stm32f2xx_spi.c
+++ b/hw/ssi/stm32f2xx_spi.c
@@ -174,7 +174,7 @@ static const VMStateDescription vmstate_stm32f2xx_spi = {
 .name = TYPE_STM32F2XX_SPI,
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {

[PULL 22/71] hw/adc: Constify VMState

2023-12-29 Thread Richard Henderson
Reviewed-by: Philippe Mathieu-Daudé 
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-23-richard.hender...@linaro.org>
---
 hw/adc/aspeed_adc.c| 2 +-
 hw/adc/max111x.c   | 2 +-
 hw/adc/npcm7xx_adc.c   | 2 +-
 hw/adc/stm32f2xx_adc.c | 2 +-
 hw/adc/zynq-xadc.c | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/hw/adc/aspeed_adc.c b/hw/adc/aspeed_adc.c
index 0d29663129..68bdbc73b0 100644
--- a/hw/adc/aspeed_adc.c
+++ b/hw/adc/aspeed_adc.c
@@ -280,7 +280,7 @@ static const VMStateDescription vmstate_aspeed_adc_engine = 
{
 .name = TYPE_ASPEED_ADC,
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32_ARRAY(regs, AspeedADCEngineState, ASPEED_ADC_NR_REGS),
 VMSTATE_END_OF_LIST(),
 }
diff --git a/hw/adc/max111x.c b/hw/adc/max111x.c
index e8bf4cccd4..957d177e1c 100644
--- a/hw/adc/max111x.c
+++ b/hw/adc/max111x.c
@@ -96,7 +96,7 @@ static const VMStateDescription vmstate_max111x = {
 .name = "max111x",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_SSI_PERIPHERAL(parent_obj, MAX111xState),
 VMSTATE_UINT8(tb1, MAX111xState),
 VMSTATE_UINT8(rb2, MAX111xState),
diff --git a/hw/adc/npcm7xx_adc.c b/hw/adc/npcm7xx_adc.c
index bc6f3f55e6..c6647eec6d 100644
--- a/hw/adc/npcm7xx_adc.c
+++ b/hw/adc/npcm7xx_adc.c
@@ -253,7 +253,7 @@ static const VMStateDescription vmstate_npcm7xx_adc = {
 .name = "npcm7xx-adc",
 .version_id = 0,
 .minimum_version_id = 0,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_TIMER(conv_timer, NPCM7xxADCState),
 VMSTATE_UINT32(con, NPCM7xxADCState),
 VMSTATE_UINT32(data, NPCM7xxADCState),
diff --git a/hw/adc/stm32f2xx_adc.c b/hw/adc/stm32f2xx_adc.c
index 01a0b14e69..e9df6ea53f 100644
--- a/hw/adc/stm32f2xx_adc.c
+++ b/hw/adc/stm32f2xx_adc.c
@@ -254,7 +254,7 @@ static const VMStateDescription vmstate_stm32f2xx_adc = {
 .name = TYPE_STM32F2XX_ADC,
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(adc_sr, STM32F2XXADCState),
 VMSTATE_UINT32(adc_cr1, STM32F2XXADCState),
 VMSTATE_UINT32(adc_cr2, STM32F2XXADCState),
diff --git a/hw/adc/zynq-xadc.c b/hw/adc/zynq-xadc.c
index 032e19cbd0..34268319a4 100644
--- a/hw/adc/zynq-xadc.c
+++ b/hw/adc/zynq-xadc.c
@@ -269,7 +269,7 @@ static const VMStateDescription vmstate_zynq_xadc = {
 .name = "zynq-xadc",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32_ARRAY(regs, ZynqXADCState, ZYNQ_XADC_NUM_IO_REGS),
 VMSTATE_UINT16_ARRAY(xadc_regs, ZynqXADCState,
  ZYNQ_XADC_NUM_ADC_REGS),
-- 
2.34.1




[PULL 42/71] hw/nvram: Constify VMState

2023-12-29 Thread Richard Henderson
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-43-richard.hender...@linaro.org>
---
 hw/nvram/ds1225y.c| 2 +-
 hw/nvram/eeprom93xx.c | 2 +-
 hw/nvram/fw_cfg.c | 8 
 hw/nvram/mac_nvram.c  | 2 +-
 hw/nvram/npcm7xx_otp.c| 2 +-
 hw/nvram/nrf51_nvm.c  | 2 +-
 hw/nvram/spapr_nvram.c| 2 +-
 hw/nvram/xlnx-bbram.c | 2 +-
 hw/nvram/xlnx-versal-efuse-ctrl.c | 2 +-
 hw/nvram/xlnx-zynqmp-efuse.c  | 2 +-
 10 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/hw/nvram/ds1225y.c b/hw/nvram/ds1225y.c
index 3660a47c51..6d510dcc68 100644
--- a/hw/nvram/ds1225y.c
+++ b/hw/nvram/ds1225y.c
@@ -102,7 +102,7 @@ static const VMStateDescription vmstate_nvram = {
 .version_id = 0,
 .minimum_version_id = 0,
 .post_load = nvram_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_VARRAY_UINT32(contents, NvRamState, chip_size, 0,
   vmstate_info_uint8, uint8_t),
 VMSTATE_END_OF_LIST()
diff --git a/hw/nvram/eeprom93xx.c b/hw/nvram/eeprom93xx.c
index 57d63638d7..a8fd60a8fb 100644
--- a/hw/nvram/eeprom93xx.c
+++ b/hw/nvram/eeprom93xx.c
@@ -131,7 +131,7 @@ static const VMStateDescription vmstate_eeprom = {
 .name = "eeprom",
 .version_id = EEPROM_VERSION,
 .minimum_version_id = OLD_EEPROM_VERSION,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8(tick, eeprom_t),
 VMSTATE_UINT8(address, eeprom_t),
 VMSTATE_UINT8(command, eeprom_t),
diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
index 4e4524673a..e85493d513 100644
--- a/hw/nvram/fw_cfg.c
+++ b/hw/nvram/fw_cfg.c
@@ -656,7 +656,7 @@ static int fw_cfg_acpi_mr_restore_post_load(void *opaque, 
int version_id)
 static const VMStateDescription vmstate_fw_cfg_dma = {
 .name = "fw_cfg/dma",
 .needed = fw_cfg_dma_enabled,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64(dma_addr, FWCfgState),
 VMSTATE_END_OF_LIST()
 },
@@ -668,7 +668,7 @@ static const VMStateDescription vmstate_fw_cfg_acpi_mr = {
 .minimum_version_id = 1,
 .needed = fw_cfg_acpi_mr_restore,
 .post_load = fw_cfg_acpi_mr_restore_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64(table_mr_size, FWCfgState),
 VMSTATE_UINT64(linker_mr_size, FWCfgState),
 VMSTATE_UINT64(rsdp_mr_size, FWCfgState),
@@ -680,13 +680,13 @@ static const VMStateDescription vmstate_fw_cfg = {
 .name = "fw_cfg",
 .version_id = 2,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT16(cur_entry, FWCfgState),
 VMSTATE_UINT16_HACK(cur_offset, FWCfgState, is_version_1),
 VMSTATE_UINT32_V(cur_offset, FWCfgState, 2),
 VMSTATE_END_OF_LIST()
 },
-.subsections = (const VMStateDescription*[]) {
+.subsections = (const VMStateDescription * const []) {
 &vmstate_fw_cfg_dma,
 &vmstate_fw_cfg_acpi_mr,
 NULL,
diff --git a/hw/nvram/mac_nvram.c b/hw/nvram/mac_nvram.c
index 810e84f07e..5f9d16fb3e 100644
--- a/hw/nvram/mac_nvram.c
+++ b/hw/nvram/mac_nvram.c
@@ -79,7 +79,7 @@ static const VMStateDescription vmstate_macio_nvram = {
 .name = "macio_nvram",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_VBUFFER_UINT32(data, MacIONVRAMState, 0, NULL, size),
 VMSTATE_END_OF_LIST()
 }
diff --git a/hw/nvram/npcm7xx_otp.c b/hw/nvram/npcm7xx_otp.c
index c61f2fc1aa..f00ebfa931 100644
--- a/hw/nvram/npcm7xx_otp.c
+++ b/hw/nvram/npcm7xx_otp.c
@@ -384,7 +384,7 @@ static const VMStateDescription vmstate_npcm7xx_otp = {
 .name = "npcm7xx-otp",
 .version_id = 0,
 .minimum_version_id = 0,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32_ARRAY(regs, NPCM7xxOTPState, NPCM7XX_OTP_NR_REGS),
 VMSTATE_UINT8_ARRAY(array, NPCM7xxOTPState, NPCM7XX_OTP_ARRAY_BYTES),
 VMSTATE_END_OF_LIST(),
diff --git a/hw/nvram/nrf51_nvm.c b/hw/nvram/nrf51_nvm.c
index 7f1db8c423..ed8b836074 100644
--- a/hw/nvram/nrf51_nvm.c
+++ b/hw/nvram/nrf51_nvm.c
@@ -366,7 +366,7 @@ static const VMStateDescription vmstate_nvm = {
 .name = "nrf51_soc.nvm",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32_ARRAY(uicr_content, NRF51NVMState,
 NRF51_UICR_FIXTURE_SIZE),
 VMSTATE_UINT32(config, NRF51NVMState),
diff --git a/hw/nvram/spapr_nvram.c b/hw/nvram/spapr_nvram.c
index 2d72f30442..bfd8aa367e 100644
--- a/hw/nvram/spapr_nvram.c
+++ b/hw/nvram/spapr_nvram.c
@@ -245,7 +245,7 @@ static const VMStateDescription vmstate_spapr_

[PULL 03/71] target/arm: Constify hvf/hvf.c

2023-12-29 Thread Richard Henderson
Tested-by: Philippe Mathieu-Daudé 
Reviewed-by: Philippe Mathieu-Daudé 
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-4-richard.hender...@linaro.org>
---
 target/arm/hvf/hvf.c | 13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
index 757e13b0f9..203d88f80b 100644
--- a/target/arm/hvf/hvf.c
+++ b/target/arm/hvf/hvf.c
@@ -36,7 +36,7 @@
 #define MDSCR_EL1_SS_SHIFT  0
 #define MDSCR_EL1_MDE_SHIFT 15
 
-static uint16_t dbgbcr_regs[] = {
+static const uint16_t dbgbcr_regs[] = {
 HV_SYS_REG_DBGBCR0_EL1,
 HV_SYS_REG_DBGBCR1_EL1,
 HV_SYS_REG_DBGBCR2_EL1,
@@ -54,7 +54,8 @@ static uint16_t dbgbcr_regs[] = {
 HV_SYS_REG_DBGBCR14_EL1,
 HV_SYS_REG_DBGBCR15_EL1,
 };
-static uint16_t dbgbvr_regs[] = {
+
+static const uint16_t dbgbvr_regs[] = {
 HV_SYS_REG_DBGBVR0_EL1,
 HV_SYS_REG_DBGBVR1_EL1,
 HV_SYS_REG_DBGBVR2_EL1,
@@ -72,7 +73,8 @@ static uint16_t dbgbvr_regs[] = {
 HV_SYS_REG_DBGBVR14_EL1,
 HV_SYS_REG_DBGBVR15_EL1,
 };
-static uint16_t dbgwcr_regs[] = {
+
+static const uint16_t dbgwcr_regs[] = {
 HV_SYS_REG_DBGWCR0_EL1,
 HV_SYS_REG_DBGWCR1_EL1,
 HV_SYS_REG_DBGWCR2_EL1,
@@ -90,7 +92,8 @@ static uint16_t dbgwcr_regs[] = {
 HV_SYS_REG_DBGWCR14_EL1,
 HV_SYS_REG_DBGWCR15_EL1,
 };
-static uint16_t dbgwvr_regs[] = {
+
+static const uint16_t dbgwvr_regs[] = {
 HV_SYS_REG_DBGWVR0_EL1,
 HV_SYS_REG_DBGWVR1_EL1,
 HV_SYS_REG_DBGWVR2_EL1,
@@ -2010,7 +2013,7 @@ static const VMStateDescription vmstate_hvf_vtimer = {
 .name = "hvf-vtimer",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64(vtimer_val, HVFVTimer),
 VMSTATE_END_OF_LIST()
 },
-- 
2.34.1




[PULL 09/71] target/loongarch: Constify VMState in machine.c

2023-12-29 Thread Richard Henderson
Signed-off-by: Richard Henderson 
Reviewed-by: Song Gao 
Message-Id: <20231221031652.119827-10-richard.hender...@linaro.org>
---
 target/loongarch/machine.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/target/loongarch/machine.c b/target/loongarch/machine.c
index 1c4e01d076..c7029fb9b4 100644
--- a/target/loongarch/machine.c
+++ b/target/loongarch/machine.c
@@ -14,7 +14,7 @@ static const VMStateDescription vmstate_fpu_reg = {
 .name = "fpu_reg",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64(UD(0), VReg),
 VMSTATE_END_OF_LIST()
 }
@@ -36,7 +36,7 @@ static const VMStateDescription vmstate_fpu = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = fpu_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_FPU_REGS(env.fpr, LoongArchCPU, 0),
 VMSTATE_UINT32(env.fcsr0, LoongArchCPU),
 VMSTATE_BOOL_ARRAY(env.cf, LoongArchCPU, 8),
@@ -48,7 +48,7 @@ static const VMStateDescription vmstate_lsxh_reg = {
 .name = "lsxh_reg",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64(UD(1), VReg),
 VMSTATE_END_OF_LIST()
 }
@@ -70,7 +70,7 @@ static const VMStateDescription vmstate_lsx = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = lsx_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_LSXH_REGS(env.fpr, LoongArchCPU, 0),
 VMSTATE_END_OF_LIST()
 },
@@ -80,7 +80,7 @@ static const VMStateDescription vmstate_lasxh_reg = {
 .name = "lasxh_reg",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64(UD(2), VReg),
 VMSTATE_UINT64(UD(3), VReg),
 VMSTATE_END_OF_LIST()
@@ -103,7 +103,7 @@ static const VMStateDescription vmstate_lasx = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = lasx_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_LASXH_REGS(env.fpr, LoongArchCPU, 0),
 VMSTATE_END_OF_LIST()
 },
@@ -114,7 +114,7 @@ const VMStateDescription vmstate_tlb = {
 .name = "cpu/tlb",
 .version_id = 0,
 .minimum_version_id = 0,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64(tlb_misc, LoongArchTLB),
 VMSTATE_UINT64(tlb_entry0, LoongArchTLB),
 VMSTATE_UINT64(tlb_entry1, LoongArchTLB),
@@ -127,7 +127,7 @@ const VMStateDescription vmstate_loongarch_cpu = {
 .name = "cpu",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINTTL_ARRAY(env.gpr, LoongArchCPU, 32),
 VMSTATE_UINTTL(env.pc, LoongArchCPU),
 
@@ -193,7 +193,7 @@ const VMStateDescription vmstate_loongarch_cpu = {
 
 VMSTATE_END_OF_LIST()
 },
-.subsections = (const VMStateDescription*[]) {
+.subsections = (const VMStateDescription * const []) {
 &vmstate_fpu,
 &vmstate_lsx,
 &vmstate_lasx,
-- 
2.34.1




[PULL 10/71] target/m68k: Constify VMState in machine.c

2023-12-29 Thread Richard Henderson
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-11-richard.hender...@linaro.org>
---
 target/m68k/cpu.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c
index 11c7e0a790..43b1bde21c 100644
--- a/target/m68k/cpu.c
+++ b/target/m68k/cpu.c
@@ -381,7 +381,7 @@ static const VMStateDescription vmstate_freg_tmp = {
 .name = "freg_tmp",
 .post_load = freg_post_load,
 .pre_save  = freg_pre_save,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64(tmp_mant, m68k_FPReg_tmp),
 VMSTATE_UINT16(tmp_exp, m68k_FPReg_tmp),
 VMSTATE_END_OF_LIST()
@@ -390,7 +390,7 @@ static const VMStateDescription vmstate_freg_tmp = {
 
 static const VMStateDescription vmstate_freg = {
 .name = "freg",
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_WITH_TMP(FPReg, m68k_FPReg_tmp, vmstate_freg_tmp),
 VMSTATE_END_OF_LIST()
 }
@@ -411,7 +411,7 @@ const VMStateDescription vmmstate_fpu = {
 .minimum_version_id = 1,
 .needed = fpu_needed,
 .post_load = fpu_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(env.fpcr, M68kCPU),
 VMSTATE_UINT32(env.fpsr, M68kCPU),
 VMSTATE_STRUCT_ARRAY(env.fregs, M68kCPU, 8, 0, vmstate_freg, FPReg),
@@ -432,7 +432,7 @@ const VMStateDescription vmstate_cf_spregs = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = cf_spregs_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64_ARRAY(env.macc, M68kCPU, 4),
 VMSTATE_UINT32(env.macsr, M68kCPU),
 VMSTATE_UINT32(env.mac_mask, M68kCPU),
@@ -454,7 +454,7 @@ const VMStateDescription vmstate_68040_mmu = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = cpu_68040_mmu_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(env.mmu.ar, M68kCPU),
 VMSTATE_UINT32(env.mmu.ssw, M68kCPU),
 VMSTATE_UINT16(env.mmu.tcr, M68kCPU),
@@ -479,7 +479,7 @@ const VMStateDescription vmstate_68040_spregs = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = cpu_68040_spregs_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(env.vbr, M68kCPU),
 VMSTATE_UINT32(env.cacr, M68kCPU),
 VMSTATE_UINT32(env.sfc, M68kCPU),
@@ -492,7 +492,7 @@ static const VMStateDescription vmstate_m68k_cpu = {
 .name = "cpu",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields  = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32_ARRAY(env.dregs, M68kCPU, 8),
 VMSTATE_UINT32_ARRAY(env.aregs, M68kCPU, 8),
 VMSTATE_UINT32(env.pc, M68kCPU),
@@ -509,7 +509,7 @@ static const VMStateDescription vmstate_m68k_cpu = {
 VMSTATE_INT32(env.pending_level, M68kCPU),
 VMSTATE_END_OF_LIST()
 },
-.subsections = (const VMStateDescription * []) {
+.subsections = (const VMStateDescription * const []) {
 &vmmstate_fpu,
 &vmstate_cf_spregs,
 &vmstate_68040_mmu,
-- 
2.34.1




[PULL 11/71] target/microblaze: Constify VMState in machine.c

2023-12-29 Thread Richard Henderson
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-12-richard.hender...@linaro.org>
---
 target/microblaze/machine.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/target/microblaze/machine.c b/target/microblaze/machine.c
index d24def3992..51705e4f5c 100644
--- a/target/microblaze/machine.c
+++ b/target/microblaze/machine.c
@@ -22,7 +22,7 @@
 #include "migration/cpu.h"
 
 
-static VMStateField vmstate_mmu_fields[] = {
+static const VMStateField vmstate_mmu_fields[] = {
 VMSTATE_UINT64_2DARRAY(rams, MicroBlazeMMU, 2, TLB_ENTRIES),
 VMSTATE_UINT8_ARRAY(tids, MicroBlazeMMU, TLB_ENTRIES),
 VMSTATE_UINT32_ARRAY(regs, MicroBlazeMMU, 3),
@@ -60,7 +60,7 @@ static const VMStateInfo vmstate_msr = {
 .put = put_msr,
 };
 
-static VMStateField vmstate_env_fields[] = {
+static const VMStateField vmstate_env_fields[] = {
 VMSTATE_UINT32_ARRAY(regs, CPUMBState, 32),
 
 VMSTATE_UINT32(pc, CPUMBState),
@@ -92,7 +92,7 @@ static const VMStateDescription vmstate_env = {
 .fields = vmstate_env_fields,
 };
 
-static VMStateField vmstate_cpu_fields[] = {
+static const VMStateField vmstate_cpu_fields[] = {
 VMSTATE_CPU(),
 VMSTATE_STRUCT(env, MicroBlazeCPU, 1, vmstate_env, CPUMBState),
 VMSTATE_END_OF_LIST()
-- 
2.34.1




[PULL 07/71] target/hppa: Constify VMState in machine.c

2023-12-29 Thread Richard Henderson
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-8-richard.hender...@linaro.org>
---
 target/hppa/machine.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/hppa/machine.c b/target/hppa/machine.c
index 15cbc5e6d0..211bfcf640 100644
--- a/target/hppa/machine.c
+++ b/target/hppa/machine.c
@@ -201,7 +201,7 @@ static const VMStateField vmstate_env_fields[] = {
 VMSTATE_END_OF_LIST()
 };
 
-static const VMStateDescription *vmstate_env_subsections[] = {
+static const VMStateDescription * const vmstate_env_subsections[] = {
 &vmstate_tlb,
 NULL
 };
-- 
2.34.1




[PULL 15/71] target/riscv: Constify VMState in machine.c

2023-12-29 Thread Richard Henderson
Acked-by: Alistair Francis 
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-16-richard.hender...@linaro.org>
---
 target/riscv/machine.c | 28 ++--
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/target/riscv/machine.c b/target/riscv/machine.c
index fdde243e04..72fe2374dc 100644
--- a/target/riscv/machine.c
+++ b/target/riscv/machine.c
@@ -49,7 +49,7 @@ static const VMStateDescription vmstate_pmp_entry = {
 .name = "cpu/pmp/entry",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINTTL(addr_reg, pmp_entry_t),
 VMSTATE_UINT8(cfg_reg, pmp_entry_t),
 VMSTATE_END_OF_LIST()
@@ -62,7 +62,7 @@ static const VMStateDescription vmstate_pmp = {
 .minimum_version_id = 1,
 .needed = pmp_needed,
 .post_load = pmp_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_STRUCT_ARRAY(env.pmp_state.pmp, RISCVCPU, MAX_RISCV_PMPS,
  0, vmstate_pmp_entry, pmp_entry_t),
 VMSTATE_END_OF_LIST()
@@ -82,7 +82,7 @@ static const VMStateDescription vmstate_hyper = {
 .version_id = 3,
 .minimum_version_id = 3,
 .needed = hyper_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINTTL(env.hstatus, RISCVCPU),
 VMSTATE_UINTTL(env.hedeleg, RISCVCPU),
 VMSTATE_UINT64(env.hideleg, RISCVCPU),
@@ -138,7 +138,7 @@ static const VMStateDescription vmstate_vector = {
 .version_id = 2,
 .minimum_version_id = 2,
 .needed = vector_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64_ARRAY(env.vreg, RISCVCPU, 32 * RV_VLEN_MAX / 64),
 VMSTATE_UINTTL(env.vxrm, RISCVCPU),
 VMSTATE_UINTTL(env.vxsat, RISCVCPU),
@@ -163,7 +163,7 @@ static const VMStateDescription vmstate_pointermasking = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = pointermasking_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINTTL(env.mmte, RISCVCPU),
 VMSTATE_UINTTL(env.mpmmask, RISCVCPU),
 VMSTATE_UINTTL(env.mpmbase, RISCVCPU),
@@ -189,7 +189,7 @@ static const VMStateDescription vmstate_rv128 = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = rv128_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINTTL_ARRAY(env.gprh, RISCVCPU, 32),
 VMSTATE_UINT64(env.mscratchh, RISCVCPU),
 VMSTATE_UINT64(env.sscratchh, RISCVCPU),
@@ -218,7 +218,7 @@ static const VMStateDescription vmstate_kvmtimer = {
 .minimum_version_id = 1,
 .needed = kvmtimer_needed,
 .post_load = cpu_kvmtimer_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64(env.kvm_timer_time, RISCVCPU),
 VMSTATE_UINT64(env.kvm_timer_compare, RISCVCPU),
 VMSTATE_UINT64(env.kvm_timer_state, RISCVCPU),
@@ -252,7 +252,7 @@ static const VMStateDescription vmstate_debug = {
 .minimum_version_id = 2,
 .needed = debug_needed,
 .post_load = debug_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINTTL(env.trigger_cur, RISCVCPU),
 VMSTATE_UINTTL_ARRAY(env.tdata1, RISCVCPU, RV_MAX_TRIGGERS),
 VMSTATE_UINTTL_ARRAY(env.tdata2, RISCVCPU, RV_MAX_TRIGGERS),
@@ -283,7 +283,7 @@ static const VMStateDescription vmstate_smstateen = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = smstateen_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64_ARRAY(env.mstateen, RISCVCPU, 4),
 VMSTATE_UINT64_ARRAY(env.hstateen, RISCVCPU, 4),
 VMSTATE_UINT64_ARRAY(env.sstateen, RISCVCPU, 4),
@@ -304,7 +304,7 @@ static const VMStateDescription vmstate_envcfg = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = envcfg_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64(env.menvcfg, RISCVCPU),
 VMSTATE_UINTTL(env.senvcfg, RISCVCPU),
 VMSTATE_UINT64(env.henvcfg, RISCVCPU),
@@ -324,7 +324,7 @@ static const VMStateDescription vmstate_pmu_ctr_state = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = pmu_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINTTL(mhpmcounter_val, PMUCTRState),
 VMSTATE_UINTTL(mhpmcounterh_val, PMUCTRState),
 VMSTATE_UINTTL(mhpmcounter_prev, PMUCTRState),
@@ -346,7 +346,7 @@ static const VMStateDescription vmstate_jvt = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = jvt_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINTTL(env.jvt, RISCVCPU),
 VMSTATE_END_OF_LIST()

[PULL 30/71] hw/i2c: Constify VMState

2023-12-29 Thread Richard Henderson
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-31-richard.hender...@linaro.org>
---
 hw/i2c/allwinner-i2c.c  | 2 +-
 hw/i2c/aspeed_i2c.c | 4 ++--
 hw/i2c/core.c   | 4 ++--
 hw/i2c/exynos4210_i2c.c | 2 +-
 hw/i2c/imx_i2c.c| 2 +-
 hw/i2c/microbit_i2c.c   | 2 +-
 hw/i2c/mpc_i2c.c| 2 +-
 hw/i2c/npcm7xx_smbus.c  | 2 +-
 hw/i2c/pm_smbus.c   | 2 +-
 hw/i2c/pmbus_device.c   | 2 +-
 hw/i2c/smbus_eeprom.c   | 2 +-
 hw/i2c/smbus_ich9.c | 2 +-
 hw/i2c/smbus_slave.c| 2 +-
 13 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/hw/i2c/allwinner-i2c.c b/hw/i2c/allwinner-i2c.c
index 9e8efa1d63..8abcc39a5c 100644
--- a/hw/i2c/allwinner-i2c.c
+++ b/hw/i2c/allwinner-i2c.c
@@ -415,7 +415,7 @@ static const VMStateDescription allwinner_i2c_vmstate = {
 .name = TYPE_AW_I2C,
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8(addr, AWI2CState),
 VMSTATE_UINT8(xaddr, AWI2CState),
 VMSTATE_UINT8(data, AWI2CState),
diff --git a/hw/i2c/aspeed_i2c.c b/hw/i2c/aspeed_i2c.c
index 1037c22b2f..b43afd250d 100644
--- a/hw/i2c/aspeed_i2c.c
+++ b/hw/i2c/aspeed_i2c.c
@@ -945,7 +945,7 @@ static const VMStateDescription aspeed_i2c_bus_vmstate = {
 .name = TYPE_ASPEED_I2C,
 .version_id = 5,
 .minimum_version_id = 5,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32_ARRAY(regs, AspeedI2CBus, ASPEED_I2C_NEW_NUM_REG),
 VMSTATE_END_OF_LIST()
 }
@@ -955,7 +955,7 @@ static const VMStateDescription aspeed_i2c_vmstate = {
 .name = TYPE_ASPEED_I2C,
 .version_id = 2,
 .minimum_version_id = 2,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(intr_status, AspeedI2CState),
 VMSTATE_STRUCT_ARRAY(busses, AspeedI2CState,
  ASPEED_I2C_NR_BUSSES, 1, aspeed_i2c_bus_vmstate,
diff --git a/hw/i2c/core.c b/hw/i2c/core.c
index 879a1d45cb..4cf30b2c86 100644
--- a/hw/i2c/core.c
+++ b/hw/i2c/core.c
@@ -50,7 +50,7 @@ static const VMStateDescription vmstate_i2c_bus = {
 .version_id = 1,
 .minimum_version_id = 1,
 .pre_save = i2c_bus_pre_save,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8(saved_address, I2CBus),
 VMSTATE_END_OF_LIST()
 }
@@ -359,7 +359,7 @@ const VMStateDescription vmstate_i2c_slave = {
 .version_id = 1,
 .minimum_version_id = 1,
 .post_load = i2c_slave_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8(address, I2CSlave),
 VMSTATE_END_OF_LIST()
 }
diff --git a/hw/i2c/exynos4210_i2c.c b/hw/i2c/exynos4210_i2c.c
index b65a7d0222..9445424d5f 100644
--- a/hw/i2c/exynos4210_i2c.c
+++ b/hw/i2c/exynos4210_i2c.c
@@ -273,7 +273,7 @@ static const VMStateDescription exynos4210_i2c_vmstate = {
 .name = "exynos4210.i2c",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8(i2ccon, Exynos4210I2CState),
 VMSTATE_UINT8(i2cstat, Exynos4210I2CState),
 VMSTATE_UINT8(i2cds, Exynos4210I2CState),
diff --git a/hw/i2c/imx_i2c.c b/hw/i2c/imx_i2c.c
index 9792583fea..a25676f025 100644
--- a/hw/i2c/imx_i2c.c
+++ b/hw/i2c/imx_i2c.c
@@ -285,7 +285,7 @@ static const VMStateDescription imx_i2c_vmstate = {
 .name = TYPE_IMX_I2C,
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT16(address, IMXI2CState),
 VMSTATE_UINT16(iadr, IMXI2CState),
 VMSTATE_UINT16(ifdr, IMXI2CState),
diff --git a/hw/i2c/microbit_i2c.c b/hw/i2c/microbit_i2c.c
index e92f9f84ea..24d36d15b0 100644
--- a/hw/i2c/microbit_i2c.c
+++ b/hw/i2c/microbit_i2c.c
@@ -80,7 +80,7 @@ static const VMStateDescription microbit_i2c_vmstate = {
 .name = TYPE_MICROBIT_I2C,
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32_ARRAY(regs, MicrobitI2CState, MICROBIT_I2C_NREGS),
 VMSTATE_UINT32(read_idx, MicrobitI2CState),
 VMSTATE_END_OF_LIST()
diff --git a/hw/i2c/mpc_i2c.c b/hw/i2c/mpc_i2c.c
index 219c548402..cb051a520f 100644
--- a/hw/i2c/mpc_i2c.c
+++ b/hw/i2c/mpc_i2c.c
@@ -312,7 +312,7 @@ static const VMStateDescription mpc_i2c_vmstate = {
 .name = TYPE_MPC_I2C,
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8(address, MPCI2CState),
 VMSTATE_UINT8(adr, MPCI2CState),
 VMSTATE_UINT8(fdr, MPCI2CState),
diff --git a/hw/i2c/npcm7xx_smbus.c b/hw/i2c/npcm7xx_smbus.c
index e7e0ba66fe..0ea3083bb6 100644
--- a/hw/i2c/npcm7xx_smbus.c
+++ b/hw/i2c/npcm7xx_smbus.c
@@ -1046,7 +1046,7 @@ st

[PULL 31/71] hw/i386: Constify VMState

2023-12-29 Thread Richard Henderson
Signed-off-by: Richard Henderson 
Reviewed-by: Zhao Liu 
Message-Id: <20231221031652.119827-32-richard.hender...@linaro.org>
---
 hw/i386/acpi-build.c   | 2 +-
 hw/i386/intel_iommu.c  | 2 +-
 hw/i386/kvm/clock.c| 6 +++---
 hw/i386/kvm/xen_evtchn.c   | 4 ++--
 hw/i386/kvm/xen_gnttab.c   | 2 +-
 hw/i386/kvm/xen_overlay.c  | 2 +-
 hw/i386/kvm/xen_xenstore.c | 2 +-
 hw/i386/kvmvapic.c | 6 +++---
 hw/i386/port92.c   | 2 +-
 hw/i386/vmmouse.c  | 2 +-
 hw/i386/xen/xen_platform.c | 2 +-
 hw/i386/xen/xen_pvdevice.c | 2 +-
 12 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 80db183b78..edc979379c 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -2770,7 +2770,7 @@ static const VMStateDescription vmstate_acpi_build = {
 .name = "acpi_build",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8(patched, AcpiBuildState),
 VMSTATE_END_OF_LIST()
 },
diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
index 5085a6fee3..ed5677c0ae 100644
--- a/hw/i386/intel_iommu.c
+++ b/hw/i386/intel_iommu.c
@@ -3289,7 +3289,7 @@ static const VMStateDescription vtd_vmstate = {
 .minimum_version_id = 1,
 .priority = MIG_PRI_IOMMU,
 .post_load = vtd_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64(root, IntelIOMMUState),
 VMSTATE_UINT64(intr_root, IntelIOMMUState),
 VMSTATE_UINT64(iq, IntelIOMMUState),
diff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c
index e756b0aa43..40aa9a32c3 100644
--- a/hw/i386/kvm/clock.c
+++ b/hw/i386/kvm/clock.c
@@ -245,7 +245,7 @@ static const VMStateDescription kvmclock_reliable_get_clock 
= {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = kvmclock_clock_is_reliable_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_BOOL(clock_is_reliable, KVMClockState),
 VMSTATE_END_OF_LIST()
 }
@@ -295,11 +295,11 @@ static const VMStateDescription kvmclock_vmsd = {
 .minimum_version_id = 1,
 .pre_load = kvmclock_pre_load,
 .pre_save = kvmclock_pre_save,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64(clock, KVMClockState),
 VMSTATE_END_OF_LIST()
 },
-.subsections = (const VMStateDescription * []) {
+.subsections = (const VMStateDescription * const []) {
 &kvmclock_reliable_get_clock,
 NULL
 }
diff --git a/hw/i386/kvm/xen_evtchn.c b/hw/i386/kvm/xen_evtchn.c
index 02b8cbf8df..9a5f3caa24 100644
--- a/hw/i386/kvm/xen_evtchn.c
+++ b/hw/i386/kvm/xen_evtchn.c
@@ -240,7 +240,7 @@ static const VMStateDescription xen_evtchn_port_vmstate = {
 .name = "xen_evtchn_port",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(vcpu, XenEvtchnPort),
 VMSTATE_UINT16(type, XenEvtchnPort),
 VMSTATE_UINT16(u.val, XenEvtchnPort),
@@ -255,7 +255,7 @@ static const VMStateDescription xen_evtchn_vmstate = {
 .needed = xen_evtchn_is_needed,
 .pre_load = xen_evtchn_pre_load,
 .post_load = xen_evtchn_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64(callback_param, XenEvtchnState),
 VMSTATE_UINT32(nr_ports, XenEvtchnState),
 VMSTATE_STRUCT_VARRAY_UINT32(port_table, XenEvtchnState, nr_ports, 1,
diff --git a/hw/i386/kvm/xen_gnttab.c b/hw/i386/kvm/xen_gnttab.c
index 0a24f53f20..a0cc30f619 100644
--- a/hw/i386/kvm/xen_gnttab.c
+++ b/hw/i386/kvm/xen_gnttab.c
@@ -127,7 +127,7 @@ static const VMStateDescription xen_gnttab_vmstate = {
 .minimum_version_id = 1,
 .needed = xen_gnttab_is_needed,
 .post_load = xen_gnttab_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(nr_frames, XenGnttabState),
 VMSTATE_VARRAY_UINT32(gnt_frame_gpas, XenGnttabState, nr_frames, 0,
   vmstate_info_uint64, uint64_t),
diff --git a/hw/i386/kvm/xen_overlay.c b/hw/i386/kvm/xen_overlay.c
index 39fda1b72c..526f7a6077 100644
--- a/hw/i386/kvm/xen_overlay.c
+++ b/hw/i386/kvm/xen_overlay.c
@@ -139,7 +139,7 @@ static const VMStateDescription xen_overlay_vmstate = {
 .needed = xen_overlay_is_needed,
 .pre_save = xen_overlay_pre_save,
 .post_load = xen_overlay_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64(shinfo_gpa, XenOverlayState),
 VMSTATE_BOOL(long_mode, XenOverlayState),
 VMSTATE_END_OF_LIST()
diff --git a/hw/i386/kvm/xen_xenstore.c b/hw/i386/kvm/xen_xenstore.c
index 6e651960b3..c3633f7829 100644
--- a/hw/i386/kvm/xen_xenstore.c
+++ b/hw/i386/kvm/xen_xenstore.c
@@ -243,7 +243,7 @@ static const 

[PULL 06/71] target/cris: Constify VMState in machine.c

2023-12-29 Thread Richard Henderson
Reviewed-by: Philippe Mathieu-Daudé 
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-7-richard.hender...@linaro.org>
---
 target/cris/machine.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/target/cris/machine.c b/target/cris/machine.c
index f370f33486..7b9bde872a 100644
--- a/target/cris/machine.c
+++ b/target/cris/machine.c
@@ -26,7 +26,7 @@ static const VMStateDescription vmstate_tlbset = {
 .name = "cpu/tlbset",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(lo, TLBSet),
 VMSTATE_UINT32(hi, TLBSet),
 VMSTATE_END_OF_LIST()
@@ -37,7 +37,7 @@ static const VMStateDescription vmstate_cris_env = {
 .name = "env",
 .version_id = 2,
 .minimum_version_id = 2,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32_ARRAY(regs, CPUCRISState, 16),
 VMSTATE_UINT32_ARRAY(pregs, CPUCRISState, 16),
 VMSTATE_UINT32(pc, CPUCRISState),
@@ -85,7 +85,7 @@ const VMStateDescription vmstate_cris_cpu = {
 .name = "cpu",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_CPU(),
 VMSTATE_STRUCT(env, CRISCPU, 1, vmstate_cris_env, CPUCRISState),
 VMSTATE_END_OF_LIST()
-- 
2.34.1




[PULL 34/71] hw/intc: Constify VMState

2023-12-29 Thread Richard Henderson
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-35-richard.hender...@linaro.org>
---
 hw/intc/allwinner-a10-pic.c|  2 +-
 hw/intc/apic_common.c  |  6 +++---
 hw/intc/arm_gic_common.c   |  8 
 hw/intc/arm_gicv3_common.c | 16 
 hw/intc/arm_gicv3_its_common.c |  2 +-
 hw/intc/armv7m_nvic.c  |  8 
 hw/intc/aspeed_vic.c   |  2 +-
 hw/intc/bcm2835_ic.c   |  2 +-
 hw/intc/bcm2836_control.c  |  2 +-
 hw/intc/exynos4210_combiner.c  |  4 ++--
 hw/intc/goldfish_pic.c |  2 +-
 hw/intc/heathrow_pic.c |  4 ++--
 hw/intc/i8259_common.c |  6 +++---
 hw/intc/imx_avic.c |  2 +-
 hw/intc/imx_gpcv2.c|  2 +-
 hw/intc/ioapic_common.c|  2 +-
 hw/intc/loongarch_extioi.c |  2 +-
 hw/intc/loongarch_ipi.c|  4 ++--
 hw/intc/loongarch_pch_pic.c|  2 +-
 hw/intc/m68k_irqc.c|  2 +-
 hw/intc/nios2_vic.c|  2 +-
 hw/intc/ompic.c|  4 ++--
 hw/intc/openpic.c  | 12 ++--
 hw/intc/pl190.c|  2 +-
 hw/intc/ppc-uic.c  |  2 +-
 hw/intc/riscv_aclint.c |  2 +-
 hw/intc/riscv_aplic.c  |  2 +-
 hw/intc/riscv_imsic.c  |  2 +-
 hw/intc/rx_icu.c   |  2 +-
 hw/intc/s390_flic.c| 10 +-
 hw/intc/s390_flic_kvm.c|  8 
 hw/intc/sifive_plic.c  |  2 +-
 hw/intc/slavio_intctl.c|  4 ++--
 hw/intc/spapr_xive.c   |  6 +++---
 hw/intc/xics.c |  6 +++---
 hw/intc/xive.c |  4 ++--
 hw/intc/xlnx-pmu-iomod-intc.c  |  2 +-
 hw/intc/xlnx-zynqmp-ipi.c  |  2 +-
 38 files changed, 77 insertions(+), 77 deletions(-)

diff --git a/hw/intc/allwinner-a10-pic.c b/hw/intc/allwinner-a10-pic.c
index d0bf8d545b..cea559c39d 100644
--- a/hw/intc/allwinner-a10-pic.c
+++ b/hw/intc/allwinner-a10-pic.c
@@ -142,7 +142,7 @@ static const VMStateDescription vmstate_aw_a10_pic = {
 .name = "a10.pic",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(vector, AwA10PICState),
 VMSTATE_UINT32(base_addr, AwA10PICState),
 VMSTATE_UINT32(protect, AwA10PICState),
diff --git a/hw/intc/apic_common.c b/hw/intc/apic_common.c
index bccb4241c2..6c100b48d6 100644
--- a/hw/intc/apic_common.c
+++ b/hw/intc/apic_common.c
@@ -349,7 +349,7 @@ static const VMStateDescription vmstate_apic_common_sipi = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = apic_common_sipi_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_INT32(sipi_vector, APICCommonState),
 VMSTATE_INT32(wait_for_sipi, APICCommonState),
 VMSTATE_END_OF_LIST()
@@ -363,7 +363,7 @@ static const VMStateDescription vmstate_apic_common = {
 .pre_load = apic_pre_load,
 .pre_save = apic_dispatch_pre_save,
 .post_load = apic_dispatch_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(apicbase, APICCommonState),
 VMSTATE_UINT8(id, APICCommonState),
 VMSTATE_UINT8(arb_id, APICCommonState),
@@ -386,7 +386,7 @@ static const VMStateDescription vmstate_apic_common = {
   APICCommonState), /* open-coded timer state */
 VMSTATE_END_OF_LIST()
 },
-.subsections = (const VMStateDescription*[]) {
+.subsections = (const VMStateDescription * const []) {
 &vmstate_apic_common_sipi,
 NULL
 }
diff --git a/hw/intc/arm_gic_common.c b/hw/intc/arm_gic_common.c
index 7c28504ace..94c173cb07 100644
--- a/hw/intc/arm_gic_common.c
+++ b/hw/intc/arm_gic_common.c
@@ -62,7 +62,7 @@ static const VMStateDescription vmstate_gic_irq_state = {
 .name = "arm_gic_irq_state",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8(enabled, gic_irq_state),
 VMSTATE_UINT8(pending, gic_irq_state),
 VMSTATE_UINT8(active, gic_irq_state),
@@ -79,7 +79,7 @@ static const VMStateDescription vmstate_gic_virt_state = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = gic_virt_state_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 /* Virtual interface */
 VMSTATE_UINT32_ARRAY(h_hcr, GICState, GIC_NCPU),
 VMSTATE_UINT32_ARRAY(h_misr, GICState, GIC_NCPU),
@@ -104,7 +104,7 @@ static const VMStateDescription vmstate_gic = {
 .minimum_version_id = 12,
 .pre_save = gic_pre_save,
 .post_load = gic_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(ctlr, GICState),
 VMSTATE_UINT32_SUB_ARRAY(cpu_ctlr, GICState, 0, GIC_NCPU),
 VMSTATE_STRUCT_ARRAY(irq_state, GICState, GIC_MAXIRQ, 1,
@@ -122,7 +122,7 @@ static const VMStateDes

[PULL 23/71] hw/audio: Constify VMState

2023-12-29 Thread Richard Henderson
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-24-richard.hender...@linaro.org>
---
 hw/audio/ac97.c| 4 ++--
 hw/audio/asc.c | 4 ++--
 hw/audio/cs4231.c  | 2 +-
 hw/audio/cs4231a.c | 2 +-
 hw/audio/es1370.c  | 4 ++--
 hw/audio/gus.c | 2 +-
 hw/audio/hda-codec.c   | 8 
 hw/audio/intel-hda.c   | 4 ++--
 hw/audio/lm4549.c  | 2 +-
 hw/audio/marvell_88w8618.c | 2 +-
 hw/audio/pcspk.c   | 2 +-
 hw/audio/pl041.c   | 8 
 hw/audio/sb16.c| 2 +-
 hw/audio/virtio-snd.c  | 2 +-
 hw/audio/wm8750.c  | 2 +-
 15 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/hw/audio/ac97.c b/hw/audio/ac97.c
index 6a7a2dc80c..3f0053f94d 100644
--- a/hw/audio/ac97.c
+++ b/hw/audio/ac97.c
@@ -1094,7 +1094,7 @@ static const VMStateDescription vmstate_ac97_bm_regs = {
 .name = "ac97_bm_regs",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(bdbar, AC97BusMasterRegs),
 VMSTATE_UINT8(civ, AC97BusMasterRegs),
 VMSTATE_UINT8(lvi, AC97BusMasterRegs),
@@ -1142,7 +1142,7 @@ static const VMStateDescription vmstate_ac97 = {
 .version_id = 3,
 .minimum_version_id = 2,
 .post_load = ac97_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_PCI_DEVICE(dev, AC97LinkState),
 VMSTATE_UINT32(glob_cnt, AC97LinkState),
 VMSTATE_UINT32(glob_sta, AC97LinkState),
diff --git a/hw/audio/asc.c b/hw/audio/asc.c
index 0f36b4ce9b..87b5624326 100644
--- a/hw/audio/asc.c
+++ b/hw/audio/asc.c
@@ -555,7 +555,7 @@ static const VMStateDescription vmstate_asc_fifo = {
 .name = "apple-sound-chip.fifo",
 .version_id = 0,
 .minimum_version_id = 0,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8_ARRAY(fifo, ASCFIFOState, ASC_FIFO_SIZE),
 VMSTATE_UINT8(int_status, ASCFIFOState),
 VMSTATE_INT32(cnt, ASCFIFOState),
@@ -575,7 +575,7 @@ static const VMStateDescription vmstate_asc = {
 .version_id = 0,
 .minimum_version_id = 0,
 .post_load = asc_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_STRUCT_ARRAY(fifos, ASCState, 2, 0, vmstate_asc_fifo,
  ASCFIFOState),
 VMSTATE_UINT8_ARRAY(regs, ASCState, ASC_REG_SIZE),
diff --git a/hw/audio/cs4231.c b/hw/audio/cs4231.c
index aefc3edea1..967caa7fcb 100644
--- a/hw/audio/cs4231.c
+++ b/hw/audio/cs4231.c
@@ -142,7 +142,7 @@ static const VMStateDescription vmstate_cs4231 = {
 .name ="cs4231",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32_ARRAY(regs, CSState, CS_REGS),
 VMSTATE_UINT8_ARRAY(dregs, CSState, CS_DREGS),
 VMSTATE_END_OF_LIST()
diff --git a/hw/audio/cs4231a.c b/hw/audio/cs4231a.c
index 3aa105748d..9ef57f042d 100644
--- a/hw/audio/cs4231a.c
+++ b/hw/audio/cs4231a.c
@@ -637,7 +637,7 @@ static const VMStateDescription vmstate_cs4231a = {
 .minimum_version_id = 1,
 .pre_load = cs4231a_pre_load,
 .post_load = cs4231a_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32_ARRAY (regs, CSState, CS_REGS),
 VMSTATE_BUFFER (dregs, CSState),
 VMSTATE_INT32 (dma_running, CSState),
diff --git a/hw/audio/es1370.c b/hw/audio/es1370.c
index fad5541211..4ab61d3b9d 100644
--- a/hw/audio/es1370.c
+++ b/hw/audio/es1370.c
@@ -765,7 +765,7 @@ static const VMStateDescription vmstate_es1370_channel = {
 .name = "es1370_channel",
 .version_id = 2,
 .minimum_version_id = 2,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32 (shift, struct chan),
 VMSTATE_UINT32 (leftover, struct chan),
 VMSTATE_UINT32 (scount, struct chan),
@@ -808,7 +808,7 @@ static const VMStateDescription vmstate_es1370 = {
 .version_id = 2,
 .minimum_version_id = 2,
 .post_load = es1370_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_PCI_DEVICE (dev, ES1370State),
 VMSTATE_STRUCT_ARRAY (chan, ES1370State, NB_CHANNELS, 2,
   vmstate_es1370_channel, struct chan),
diff --git a/hw/audio/gus.c b/hw/audio/gus.c
index 6c2b586ca7..4beb3fd74e 100644
--- a/hw/audio/gus.c
+++ b/hw/audio/gus.c
@@ -209,7 +209,7 @@ static const VMStateDescription vmstate_gus = {
 .name = "gus",
 .version_id = 2,
 .minimum_version_id = 2,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_INT32 (pos, GUSState),
 VMSTATE_INT32 (left, GUSState),
 VMSTATE_INT32 (shift, GUSState),
diff --git a/hw/audio/hda-codec.c b/hw/audio/hda-codec.c
index 0bc20

[PULL 35/71] hw/ipack: Constify VMState

2023-12-29 Thread Richard Henderson
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-36-richard.hender...@linaro.org>
---
 hw/ipack/ipack.c   | 2 +-
 hw/ipack/tpci200.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/ipack/ipack.c b/hw/ipack/ipack.c
index ae20f36da6..c39dbb481f 100644
--- a/hw/ipack/ipack.c
+++ b/hw/ipack/ipack.c
@@ -93,7 +93,7 @@ const VMStateDescription vmstate_ipack_device = {
 .name = "ipack_device",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_INT32(slot, IPackDevice),
 VMSTATE_END_OF_LIST()
 }
diff --git a/hw/ipack/tpci200.c b/hw/ipack/tpci200.c
index 6b3edbf017..88eef4b830 100644
--- a/hw/ipack/tpci200.c
+++ b/hw/ipack/tpci200.c
@@ -619,7 +619,7 @@ static const VMStateDescription vmstate_tpci200 = {
 .name = "tpci200",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_PCI_DEVICE(dev, TPCI200State),
 VMSTATE_BOOL_ARRAY(big_endian, TPCI200State, 3),
 VMSTATE_UINT8_ARRAY(ctrl, TPCI200State, N_MODULES),
-- 
2.34.1




[PULL 26/71] hw/display: Constify VMState

2023-12-29 Thread Richard Henderson
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-27-richard.hender...@linaro.org>
---
 hw/display/artist.c   |  2 +-
 hw/display/bcm2835_fb.c   |  2 +-
 hw/display/bochs-display.c|  2 +-
 hw/display/cg3.c  |  2 +-
 hw/display/cirrus_vga.c   |  4 ++--
 hw/display/dpcd.c |  2 +-
 hw/display/exynos4210_fimd.c  |  4 ++--
 hw/display/g364fb.c   |  4 ++--
 hw/display/i2c-ddc.c  |  2 +-
 hw/display/jazz_led.c |  2 +-
 hw/display/macfb.c|  6 +++---
 hw/display/pl110.c|  2 +-
 hw/display/pxa2xx_lcd.c   |  4 ++--
 hw/display/qxl.c  | 10 +-
 hw/display/ramfb-standalone.c |  2 +-
 hw/display/ramfb.c|  2 +-
 hw/display/sii9022.c  |  2 +-
 hw/display/sm501.c|  6 +++---
 hw/display/ssd0303.c  |  2 +-
 hw/display/ssd0323.c  |  2 +-
 hw/display/tcx.c  |  2 +-
 hw/display/vga-pci.c  |  2 +-
 hw/display/vga.c  |  6 +++---
 hw/display/virtio-gpu.c   |  8 
 hw/display/virtio-vga.c   |  2 +-
 hw/display/vmware_vga.c   |  4 ++--
 hw/display/xlnx_dp.c  |  2 +-
 27 files changed, 45 insertions(+), 45 deletions(-)

diff --git a/hw/display/artist.c b/hw/display/artist.c
index fde050c882..d9134532fb 100644
--- a/hw/display/artist.c
+++ b/hw/display/artist.c
@@ -1435,7 +1435,7 @@ static const VMStateDescription vmstate_artist = {
 .version_id = 2,
 .minimum_version_id = 2,
 .post_load = vmstate_artist_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT16(height, ARTISTState),
 VMSTATE_UINT16(width, ARTISTState),
 VMSTATE_UINT16(depth, ARTISTState),
diff --git a/hw/display/bcm2835_fb.c b/hw/display/bcm2835_fb.c
index a05277674f..e40ed2d2e1 100644
--- a/hw/display/bcm2835_fb.c
+++ b/hw/display/bcm2835_fb.c
@@ -355,7 +355,7 @@ static const VMStateDescription vmstate_bcm2835_fb = {
 .name = TYPE_BCM2835_FB,
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_BOOL(lock, BCM2835FBState),
 VMSTATE_BOOL(invalidate, BCM2835FBState),
 VMSTATE_BOOL(pending, BCM2835FBState),
diff --git a/hw/display/bochs-display.c b/hw/display/bochs-display.c
index 9138e98c3b..3b1d922b6e 100644
--- a/hw/display/bochs-display.c
+++ b/hw/display/bochs-display.c
@@ -61,7 +61,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(BochsDisplayState, BOCHS_DISPLAY)
 
 static const VMStateDescription vmstate_bochs_display = {
 .name = "bochs-display",
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_PCI_DEVICE(pci, BochsDisplayState),
 VMSTATE_UINT16_ARRAY(vbe_regs, BochsDisplayState, VBE_DISPI_INDEX_NB),
 VMSTATE_BOOL(big_endian_fb, BochsDisplayState),
diff --git a/hw/display/cg3.c b/hw/display/cg3.c
index 2e9656ae1c..b271faaa48 100644
--- a/hw/display/cg3.c
+++ b/hw/display/cg3.c
@@ -334,7 +334,7 @@ static const VMStateDescription vmstate_cg3 = {
 .version_id = 1,
 .minimum_version_id = 1,
 .post_load = vmstate_cg3_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT16(height, CG3State),
 VMSTATE_UINT16(width, CG3State),
 VMSTATE_UINT16(depth, CG3State),
diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
index b80f98b6c4..5dd5136a0c 100644
--- a/hw/display/cirrus_vga.c
+++ b/hw/display/cirrus_vga.c
@@ -2739,7 +2739,7 @@ const VMStateDescription vmstate_cirrus_vga = {
 .version_id = 2,
 .minimum_version_id = 1,
 .post_load = cirrus_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(vga.latch, CirrusVGAState),
 VMSTATE_UINT8(vga.sr_index, CirrusVGAState),
 VMSTATE_BUFFER(vga.sr, CirrusVGAState),
@@ -2777,7 +2777,7 @@ static const VMStateDescription vmstate_pci_cirrus_vga = {
 .name = "cirrus_vga",
 .version_id = 2,
 .minimum_version_id = 2,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_PCI_DEVICE(dev, PCICirrusVGAState),
 VMSTATE_STRUCT(cirrus_vga, PCICirrusVGAState, 0,
vmstate_cirrus_vga, CirrusVGAState),
diff --git a/hw/display/dpcd.c b/hw/display/dpcd.c
index 64463654a1..aab1b1a2d7 100644
--- a/hw/display/dpcd.c
+++ b/hw/display/dpcd.c
@@ -135,7 +135,7 @@ static const VMStateDescription vmstate_dpcd = {
 .name = TYPE_DPCD,
 .version_id = 0,
 .minimum_version_id = 0,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8_ARRAY_V(dpcd_info, DPCDState, DPCD_READABLE_AREA, 0),
 VMSTATE_END_OF_LIST()
 }
diff --git a/hw/display/exynos4210_fimd.c b/hw/display/exynos4210_fimd.c
index 34a960a976..84687527d5 100644
--- a/hw/display/exynos4210_fimd.c
+++ b/hw/display/exynos4210_fim

[PULL 20/71] hw/9pfs: Constify VMState

2023-12-29 Thread Richard Henderson
Acked-by: Greg Kurz 
Acked-by: Christian Schoenebeck 
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-21-richard.hender...@linaro.org>
---
 hw/9pfs/virtio-9p-device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/9pfs/virtio-9p-device.c b/hw/9pfs/virtio-9p-device.c
index 5f522e68e9..efa41cfd73 100644
--- a/hw/9pfs/virtio-9p-device.c
+++ b/hw/9pfs/virtio-9p-device.c
@@ -237,7 +237,7 @@ static const VMStateDescription vmstate_virtio_9p = {
 .name = "virtio-9p",
 .minimum_version_id = 1,
 .version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_VIRTIO_DEVICE,
 VMSTATE_END_OF_LIST()
 },
-- 
2.34.1




[PULL 19/71] hw/core: Constify VMState

2023-12-29 Thread Richard Henderson
Tested-by: Philippe Mathieu-Daudé 
Reviewed-by: Philippe Mathieu-Daudé 
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-20-richard.hender...@linaro.org>
---
 hw/core/clock-vmstate.c | 6 +++---
 hw/core/or-irq.c| 6 +++---
 hw/core/ptimer.c| 2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/hw/core/clock-vmstate.c b/hw/core/clock-vmstate.c
index 7eccb6d4ea..e831fc596f 100644
--- a/hw/core/clock-vmstate.c
+++ b/hw/core/clock-vmstate.c
@@ -41,7 +41,7 @@ const VMStateDescription vmstate_muldiv = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = muldiv_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(multiplier, Clock),
 VMSTATE_UINT32(divider, Clock),
 VMSTATE_END_OF_LIST()
@@ -53,11 +53,11 @@ const VMStateDescription vmstate_clock = {
 .version_id = 0,
 .minimum_version_id = 0,
 .pre_load = clock_pre_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64(period, Clock),
 VMSTATE_END_OF_LIST()
 },
-.subsections = (const VMStateDescription*[]) {
+.subsections = (const VMStateDescription * const []) {
 &vmstate_muldiv,
 NULL
 },
diff --git a/hw/core/or-irq.c b/hw/core/or-irq.c
index 1df4bc05a7..13907df026 100644
--- a/hw/core/or-irq.c
+++ b/hw/core/or-irq.c
@@ -94,7 +94,7 @@ static const VMStateDescription vmstate_or_irq_extras = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = vmstate_extras_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_VARRAY_UINT16_UNSAFE(levels, OrIRQState, num_lines, 0,
  vmstate_info_bool, bool),
 VMSTATE_END_OF_LIST(),
@@ -105,11 +105,11 @@ static const VMStateDescription vmstate_or_irq = {
 .name = TYPE_OR_IRQ,
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_BOOL_SUB_ARRAY(levels, OrIRQState, 0, OLD_MAX_OR_LINES),
 VMSTATE_END_OF_LIST(),
 },
-.subsections = (const VMStateDescription*[]) {
+.subsections = (const VMStateDescription * const []) {
 &vmstate_or_irq_extras,
 NULL
 },
diff --git a/hw/core/ptimer.c b/hw/core/ptimer.c
index e03165febf..b1517592c6 100644
--- a/hw/core/ptimer.c
+++ b/hw/core/ptimer.c
@@ -441,7 +441,7 @@ const VMStateDescription vmstate_ptimer = {
 .name = "ptimer",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8(enabled, ptimer_state),
 VMSTATE_UINT64(limit, ptimer_state),
 VMSTATE_UINT64(delta, ptimer_state),
-- 
2.34.1




[PULL 37/71] hw/isa: Constify VMState

2023-12-29 Thread Richard Henderson
Reviewed-by: Philippe Mathieu-Daudé 
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-38-richard.hender...@linaro.org>
---
 hw/isa/apm.c  | 2 +-
 hw/isa/i82378.c   | 2 +-
 hw/isa/lpc_ich9.c | 8 
 hw/isa/pc87312.c  | 2 +-
 hw/isa/piix.c | 8 
 hw/isa/vt82c686.c | 4 ++--
 6 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/hw/isa/apm.c b/hw/isa/apm.c
index dfe9020d30..e34edb864c 100644
--- a/hw/isa/apm.c
+++ b/hw/isa/apm.c
@@ -68,7 +68,7 @@ const VMStateDescription vmstate_apm = {
 .name = "APM State",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8(apmc, APMState),
 VMSTATE_UINT8(apms, APMState),
 VMSTATE_END_OF_LIST()
diff --git a/hw/isa/i82378.c b/hw/isa/i82378.c
index 203b92c264..cbaa152a89 100644
--- a/hw/isa/i82378.c
+++ b/hw/isa/i82378.c
@@ -40,7 +40,7 @@ static const VMStateDescription vmstate_i82378 = {
 .name = "pci-i82378",
 .version_id = 0,
 .minimum_version_id = 0,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_PCI_DEVICE(parent_obj, I82378State),
 VMSTATE_END_OF_LIST()
 },
diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c
index 23eba64f22..3924eec483 100644
--- a/hw/isa/lpc_ich9.c
+++ b/hw/isa/lpc_ich9.c
@@ -768,7 +768,7 @@ static const VMStateDescription vmstate_ich9_rst_cnt = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = ich9_rst_cnt_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8(rst_cnt, ICH9LPCState),
 VMSTATE_END_OF_LIST()
 }
@@ -788,7 +788,7 @@ static const VMStateDescription vmstate_ich9_smi_feat = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = ich9_smi_feat_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8_ARRAY(smi_guest_features_le, ICH9LPCState,
 sizeof(uint64_t)),
 VMSTATE_UINT8(smi_features_ok, ICH9LPCState),
@@ -802,7 +802,7 @@ static const VMStateDescription vmstate_ich9_lpc = {
 .version_id = 1,
 .minimum_version_id = 1,
 .post_load = ich9_lpc_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_PCI_DEVICE(d, ICH9LPCState),
 VMSTATE_STRUCT(apm, ICH9LPCState, 0, vmstate_apm, APMState),
 VMSTATE_STRUCT(pm, ICH9LPCState, 0, vmstate_ich9_pm, ICH9LPCPMRegs),
@@ -810,7 +810,7 @@ static const VMStateDescription vmstate_ich9_lpc = {
 VMSTATE_UINT32(sci_level, ICH9LPCState),
 VMSTATE_END_OF_LIST()
 },
-.subsections = (const VMStateDescription*[]) {
+.subsections = (const VMStateDescription * const []) {
 &vmstate_ich9_rst_cnt,
 &vmstate_ich9_smi_feat,
 NULL
diff --git a/hw/isa/pc87312.c b/hw/isa/pc87312.c
index 8d7b8d3db2..ee23f3e164 100644
--- a/hw/isa/pc87312.c
+++ b/hw/isa/pc87312.c
@@ -319,7 +319,7 @@ static const VMStateDescription vmstate_pc87312 = {
 .version_id = 1,
 .minimum_version_id = 1,
 .post_load = pc87312_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8(read_id_step, PC87312State),
 VMSTATE_UINT8(selected_index, PC87312State),
 VMSTATE_UINT8_ARRAY(regs, PC87312State, 3),
diff --git a/hw/isa/piix.c b/hw/isa/piix.c
index 04ebed5b52..344bf32e54 100644
--- a/hw/isa/piix.c
+++ b/hw/isa/piix.c
@@ -230,7 +230,7 @@ static const VMStateDescription vmstate_piix3_rcr = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = piix3_rcr_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8(rcr, PIIXState),
 VMSTATE_END_OF_LIST()
 }
@@ -242,13 +242,13 @@ static const VMStateDescription vmstate_piix3 = {
 .minimum_version_id = 2,
 .post_load = piix_post_load,
 .pre_save = piix3_pre_save,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_PCI_DEVICE(dev, PIIXState),
 VMSTATE_INT32_ARRAY_V(pci_irq_levels_vmstate, PIIXState,
   PIIX_NUM_PIRQS, 3),
 VMSTATE_END_OF_LIST()
 },
-.subsections = (const VMStateDescription*[]) {
+.subsections = (const VMStateDescription * const []) {
 &vmstate_piix3_rcr,
 NULL
 }
@@ -259,7 +259,7 @@ static const VMStateDescription vmstate_piix4 = {
 .version_id = 3,
 .minimum_version_id = 2,
 .post_load = piix4_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_PCI_DEVICE(dev, PIIXState),
 VMSTATE_UINT8_V(rcr, PIIXState, 3),
 VMSTATE_END_OF_LIST()
diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c
index 9c2333a277..d3e0f6d01f 100644
--- a/hw/isa/vt82c686.c
+++ b/hw/isa/vt82c686.c
@@ -82,7 +82,7 @@ static const VMStateDescription vms

[PULL 33/71] hw/input: Constify VMState

2023-12-29 Thread Richard Henderson
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-34-richard.hender...@linaro.org>
---
 hw/input/adb-kbd.c   |  2 +-
 hw/input/adb-mouse.c |  2 +-
 hw/input/adb.c   |  4 ++--
 hw/input/ads7846.c   |  2 +-
 hw/input/hid.c   |  6 +++---
 hw/input/lasips2.c   |  4 ++--
 hw/input/lm832x.c|  2 +-
 hw/input/pckbd.c | 12 ++--
 hw/input/pl050.c |  2 +-
 hw/input/ps2.c   | 14 +++---
 hw/input/pxa2xx_keypad.c |  2 +-
 hw/input/stellaris_gamepad.c |  2 +-
 hw/input/tsc2005.c   |  2 +-
 hw/input/tsc210x.c   |  2 +-
 hw/input/virtio-input.c  |  2 +-
 15 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/hw/input/adb-kbd.c b/hw/input/adb-kbd.c
index e21edf9acd..758fa6d267 100644
--- a/hw/input/adb-kbd.c
+++ b/hw/input/adb-kbd.c
@@ -332,7 +332,7 @@ static const VMStateDescription vmstate_adb_kbd = {
 .name = "adb_kbd",
 .version_id = 2,
 .minimum_version_id = 2,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_STRUCT(parent_obj, KBDState, 0, vmstate_adb_device, ADBDevice),
 VMSTATE_BUFFER(data, KBDState),
 VMSTATE_INT32(rptr, KBDState),
diff --git a/hw/input/adb-mouse.c b/hw/input/adb-mouse.c
index e6b341f028..144a0ccce7 100644
--- a/hw/input/adb-mouse.c
+++ b/hw/input/adb-mouse.c
@@ -217,7 +217,7 @@ static const VMStateDescription vmstate_adb_mouse = {
 .name = "adb_mouse",
 .version_id = 2,
 .minimum_version_id = 2,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_STRUCT(parent_obj, MouseState, 0, vmstate_adb_device,
ADBDevice),
 VMSTATE_INT32(buttons_state, MouseState),
diff --git a/hw/input/adb.c b/hw/input/adb.c
index 8aed0da2cd..0f3c73d6d0 100644
--- a/hw/input/adb.c
+++ b/hw/input/adb.c
@@ -221,7 +221,7 @@ static const VMStateDescription vmstate_adb_bus = {
 .name = "adb_bus",
 .version_id = 0,
 .minimum_version_id = 0,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_TIMER_PTR(autopoll_timer, ADBBusState),
 VMSTATE_BOOL(autopoll_enabled, ADBBusState),
 VMSTATE_UINT8(autopoll_rate_ms, ADBBusState),
@@ -279,7 +279,7 @@ const VMStateDescription vmstate_adb_device = {
 .name = "adb_device",
 .version_id = 0,
 .minimum_version_id = 0,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_INT32(devaddr, ADBDevice),
 VMSTATE_INT32(handler, ADBDevice),
 VMSTATE_END_OF_LIST()
diff --git a/hw/input/ads7846.c b/hw/input/ads7846.c
index 91116c6bdb..cde3892216 100644
--- a/hw/input/ads7846.c
+++ b/hw/input/ads7846.c
@@ -130,7 +130,7 @@ static const VMStateDescription vmstate_ads7846 = {
 .version_id = 1,
 .minimum_version_id = 1,
 .post_load = ads7856_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_SSI_PERIPHERAL(ssidev, ADS7846State),
 VMSTATE_INT32_ARRAY(input, ADS7846State, 8),
 VMSTATE_INT32(noise, ADS7846State),
diff --git a/hw/input/hid.c b/hw/input/hid.c
index b8e85374ca..76bedc1844 100644
--- a/hw/input/hid.c
+++ b/hw/input/hid.c
@@ -581,7 +581,7 @@ static const VMStateDescription vmstate_hid_ptr_queue = {
 .name = "HIDPointerEventQueue",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_INT32(xdx, HIDPointerEvent),
 VMSTATE_INT32(ydy, HIDPointerEvent),
 VMSTATE_INT32(dz, HIDPointerEvent),
@@ -595,7 +595,7 @@ const VMStateDescription vmstate_hid_ptr_device = {
 .version_id = 1,
 .minimum_version_id = 1,
 .post_load = hid_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_STRUCT_ARRAY(ptr.queue, HIDState, QUEUE_LENGTH, 0,
  vmstate_hid_ptr_queue, HIDPointerEvent),
 VMSTATE_UINT32(head, HIDState),
@@ -611,7 +611,7 @@ const VMStateDescription vmstate_hid_keyboard_device = {
 .version_id = 1,
 .minimum_version_id = 1,
 .post_load = hid_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32_ARRAY(kbd.keycodes, HIDState, QUEUE_LENGTH),
 VMSTATE_UINT32(head, HIDState),
 VMSTATE_UINT32(n, HIDState),
diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c
index 6075121b72..d9f8c36778 100644
--- a/hw/input/lasips2.c
+++ b/hw/input/lasips2.c
@@ -39,7 +39,7 @@ static const VMStateDescription vmstate_lasips2_port = {
 .name = "lasips2-port",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8(control, LASIPS2Port),
 VMSTATE_UINT8(buf, LASIPS2Port),
 VMSTATE_BOOL(loopback_rbne, LASIPS2Port),
@@

[PULL 25/71] hw/char: Constify VMState

2023-12-29 Thread Richard Henderson
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-26-richard.hender...@linaro.org>
---
 hw/char/bcm2835_aux.c   |  2 +-
 hw/char/cadence_uart.c  |  2 +-
 hw/char/cmsdk-apb-uart.c|  2 +-
 hw/char/digic-uart.c|  2 +-
 hw/char/escc.c  |  4 ++--
 hw/char/exynos4210_uart.c   |  4 ++--
 hw/char/goldfish_tty.c  |  2 +-
 hw/char/ibex_uart.c |  2 +-
 hw/char/imx_serial.c|  2 +-
 hw/char/ipoctal232.c|  6 +++---
 hw/char/mchp_pfsoc_mmuart.c |  2 +-
 hw/char/nrf51_uart.c|  2 +-
 hw/char/parallel.c  |  2 +-
 hw/char/pl011.c |  6 +++---
 hw/char/renesas_sci.c   |  2 +-
 hw/char/sclpconsole-lm.c|  2 +-
 hw/char/sclpconsole.c   |  2 +-
 hw/char/serial-isa.c|  2 +-
 hw/char/serial-pci-multi.c  |  2 +-
 hw/char/serial-pci.c|  2 +-
 hw/char/serial.c| 20 ++--
 hw/char/sifive_uart.c   |  2 +-
 hw/char/spapr_vty.c |  2 +-
 hw/char/virtio-serial-bus.c |  2 +-
 24 files changed, 39 insertions(+), 39 deletions(-)

diff --git a/hw/char/bcm2835_aux.c b/hw/char/bcm2835_aux.c
index 96410b1ff8..83990e20f7 100644
--- a/hw/char/bcm2835_aux.c
+++ b/hw/char/bcm2835_aux.c
@@ -260,7 +260,7 @@ static const VMStateDescription vmstate_bcm2835_aux = {
 .name = TYPE_BCM2835_AUX,
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8_ARRAY(read_fifo, BCM2835AuxState,
 BCM2835_AUX_RX_FIFO_LEN),
 VMSTATE_UINT8(read_pos, BCM2835AuxState),
diff --git a/hw/char/cadence_uart.c b/hw/char/cadence_uart.c
index a2ac062b1e..db31d7cc85 100644
--- a/hw/char/cadence_uart.c
+++ b/hw/char/cadence_uart.c
@@ -602,7 +602,7 @@ static const VMStateDescription vmstate_cadence_uart = {
 .minimum_version_id = 2,
 .pre_load = cadence_uart_pre_load,
 .post_load = cadence_uart_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32_ARRAY(r, CadenceUARTState, CADENCE_UART_R_MAX),
 VMSTATE_UINT8_ARRAY(rx_fifo, CadenceUARTState,
 CADENCE_UART_RX_FIFO_SIZE),
diff --git a/hw/char/cmsdk-apb-uart.c b/hw/char/cmsdk-apb-uart.c
index d466cd93de..d07cca1bd4 100644
--- a/hw/char/cmsdk-apb-uart.c
+++ b/hw/char/cmsdk-apb-uart.c
@@ -366,7 +366,7 @@ static const VMStateDescription cmsdk_apb_uart_vmstate = {
 .version_id = 1,
 .minimum_version_id = 1,
 .post_load = cmsdk_apb_uart_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(state, CMSDKAPBUART),
 VMSTATE_UINT32(ctrl, CMSDKAPBUART),
 VMSTATE_UINT32(intstatus, CMSDKAPBUART),
diff --git a/hw/char/digic-uart.c b/hw/char/digic-uart.c
index 51d4e7db52..ef2d762726 100644
--- a/hw/char/digic-uart.c
+++ b/hw/char/digic-uart.c
@@ -165,7 +165,7 @@ static const VMStateDescription vmstate_digic_uart = {
 .name = "digic-uart",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(reg_rx, DigicUartState),
 VMSTATE_UINT32(reg_st, DigicUartState),
 VMSTATE_END_OF_LIST()
diff --git a/hw/char/escc.c b/hw/char/escc.c
index 48b30ee760..d450d70eda 100644
--- a/hw/char/escc.c
+++ b/hw/char/escc.c
@@ -766,7 +766,7 @@ static const VMStateDescription vmstate_escc_chn = {
 .name = "escc_chn",
 .version_id = 2,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(vmstate_dummy, ESCCChannelState),
 VMSTATE_UINT32(reg, ESCCChannelState),
 VMSTATE_UINT32(rxint, ESCCChannelState),
@@ -785,7 +785,7 @@ static const VMStateDescription vmstate_escc = {
 .name = "escc",
 .version_id = 2,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_STRUCT_ARRAY(chn, ESCCState, 2, 2, vmstate_escc_chn,
  ESCCChannelState),
 VMSTATE_END_OF_LIST()
diff --git a/hw/char/exynos4210_uart.c b/hw/char/exynos4210_uart.c
index 7b7c56b6ef..8cdd42e54f 100644
--- a/hw/char/exynos4210_uart.c
+++ b/hw/char/exynos4210_uart.c
@@ -628,7 +628,7 @@ static const VMStateDescription 
vmstate_exynos4210_uart_fifo = {
 .name = "exynos4210.uart.fifo",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(sp, Exynos4210UartFIFO),
 VMSTATE_UINT32(rp, Exynos4210UartFIFO),
 VMSTATE_VBUFFER_UINT32(data, Exynos4210UartFIFO, 1, NULL, size),
@@ -641,7 +641,7 @@ static const VMStateDescription vmstate_exynos4210_uart = {
 .version_id = 1,
 .minimum_version_id = 1,
 .post_load = exynos4210_uart_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
  

[PULL 17/71] target/sparc: Constify VMState in machine.c

2023-12-29 Thread Richard Henderson
Reviewed-by: Mark Cave-Ayland 
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-18-richard.hender...@linaro.org>
---
 target/sparc/machine.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/target/sparc/machine.c b/target/sparc/machine.c
index 44dfc07014..2b5686c330 100644
--- a/target/sparc/machine.c
+++ b/target/sparc/machine.c
@@ -10,7 +10,7 @@ static const VMStateDescription vmstate_cpu_timer = {
 .name = "cpu_timer",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(frequency, CPUTimer),
 VMSTATE_UINT32(disabled, CPUTimer),
 VMSTATE_UINT64(disabled_mask, CPUTimer),
@@ -29,7 +29,7 @@ static const VMStateDescription vmstate_trap_state = {
 .name = "trap_state",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64(tpc, trap_state),
 VMSTATE_UINT64(tnpc, trap_state),
 VMSTATE_UINT64(tstate, trap_state),
@@ -42,7 +42,7 @@ static const VMStateDescription vmstate_tlb_entry = {
 .name = "tlb_entry",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64(tag, SparcTLBEntry),
 VMSTATE_UINT64(tte, SparcTLBEntry),
 VMSTATE_END_OF_LIST()
@@ -147,7 +147,7 @@ const VMStateDescription vmstate_sparc_cpu = {
 .version_id = SPARC_VMSTATE_VER,
 .minimum_version_id = SPARC_VMSTATE_VER,
 .pre_save = cpu_pre_save,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINTTL_ARRAY(env.gregs, SPARCCPU, 8),
 VMSTATE_UINT32(env.nwindows, SPARCCPU),
 VMSTATE_VARRAY_MULTIPLY(env.regbase, SPARCCPU, env.nwindows, 16,
-- 
2.34.1




[PULL 24/71] hw/block: Constify VMState

2023-12-29 Thread Richard Henderson
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-25-richard.hender...@linaro.org>
---
 hw/block/ecc.c|  2 +-
 hw/block/fdc-isa.c|  2 +-
 hw/block/fdc-sysbus.c |  2 +-
 hw/block/fdc.c| 20 ++--
 hw/block/m25p80.c | 12 ++--
 hw/block/nand.c   |  2 +-
 hw/block/onenand.c|  2 +-
 hw/block/pflash_cfi01.c   |  2 +-
 hw/block/swim.c   |  6 +++---
 hw/block/vhost-user-blk.c |  2 +-
 hw/block/virtio-blk.c |  2 +-
 11 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/hw/block/ecc.c b/hw/block/ecc.c
index 6e0d63842c..ed889a4184 100644
--- a/hw/block/ecc.c
+++ b/hw/block/ecc.c
@@ -82,7 +82,7 @@ const VMStateDescription vmstate_ecc_state = {
 .name = "ecc-state",
 .version_id = 0,
 .minimum_version_id = 0,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8(cp, ECCState),
 VMSTATE_UINT16_ARRAY(lp, ECCState, 2),
 VMSTATE_UINT16(count, ECCState),
diff --git a/hw/block/fdc-isa.c b/hw/block/fdc-isa.c
index 7ec075e470..ad0921c7d3 100644
--- a/hw/block/fdc-isa.c
+++ b/hw/block/fdc-isa.c
@@ -259,7 +259,7 @@ static const VMStateDescription vmstate_isa_fdc = {
 .name = "fdc",
 .version_id = 2,
 .minimum_version_id = 2,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_STRUCT(state, FDCtrlISABus, 0, vmstate_fdc, FDCtrl),
 VMSTATE_END_OF_LIST()
 }
diff --git a/hw/block/fdc-sysbus.c b/hw/block/fdc-sysbus.c
index 86ea51d003..266bc4d145 100644
--- a/hw/block/fdc-sysbus.c
+++ b/hw/block/fdc-sysbus.c
@@ -168,7 +168,7 @@ static const VMStateDescription vmstate_sysbus_fdc = {
 .name = "fdc",
 .version_id = 2,
 .minimum_version_id = 2,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_STRUCT(state, FDCtrlSysBus, 0, vmstate_fdc, FDCtrl),
 VMSTATE_END_OF_LIST()
 }
diff --git a/hw/block/fdc.c b/hw/block/fdc.c
index d7cc4d3ec1..6dd94e98bc 100644
--- a/hw/block/fdc.c
+++ b/hw/block/fdc.c
@@ -854,7 +854,7 @@ static const VMStateDescription 
vmstate_fdrive_media_changed = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = fdrive_media_changed_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8(media_changed, FDrive),
 VMSTATE_END_OF_LIST()
 }
@@ -864,7 +864,7 @@ static const VMStateDescription vmstate_fdrive_media_rate = 
{
 .name = "fdrive/media_rate",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8(media_rate, FDrive),
 VMSTATE_END_OF_LIST()
 }
@@ -882,7 +882,7 @@ static const VMStateDescription 
vmstate_fdrive_perpendicular = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = fdrive_perpendicular_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8(perpendicular, FDrive),
 VMSTATE_END_OF_LIST()
 }
@@ -899,13 +899,13 @@ static const VMStateDescription vmstate_fdrive = {
 .version_id = 1,
 .minimum_version_id = 1,
 .post_load = fdrive_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8(head, FDrive),
 VMSTATE_UINT8(track, FDrive),
 VMSTATE_UINT8(sect, FDrive),
 VMSTATE_END_OF_LIST()
 },
-.subsections = (const VMStateDescription*[]) {
+.subsections = (const VMStateDescription * const []) {
 &vmstate_fdrive_media_changed,
 &vmstate_fdrive_media_rate,
 &vmstate_fdrive_perpendicular,
@@ -977,7 +977,7 @@ static const VMStateDescription vmstate_fdc_reset_sensei = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = fdc_reset_sensei_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_INT32(reset_sensei, FDCtrl),
 VMSTATE_END_OF_LIST()
 }
@@ -995,7 +995,7 @@ static const VMStateDescription vmstate_fdc_result_timer = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = fdc_result_timer_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_TIMER_PTR(result_timer, FDCtrl),
 VMSTATE_END_OF_LIST()
 }
@@ -1013,7 +1013,7 @@ static const VMStateDescription vmstate_fdc_phase = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = fdc_phase_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8(phase, FDCtrl),
 VMSTATE_END_OF_LIST()
 }
@@ -1026,7 +1026,7 @@ const VMStateDescription vmstate_fdc = {
 .pre_save = fdc_pre_save,
 .pre_load = fdc_pre_load,
 .post_load = fdc_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 /* Controller State */
 VMSTATE_UI

[PULL 18/71] hw/arm: Constify VMState

2023-12-29 Thread Richard Henderson
Tested-by: Philippe Mathieu-Daudé 
Reviewed-by: Philippe Mathieu-Daudé 
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-19-richard.hender...@linaro.org>
---
 hw/arm/armsse.c  |  2 +-
 hw/arm/armv7m.c  |  2 +-
 hw/arm/highbank.c|  2 +-
 hw/arm/integratorcp.c|  6 +++---
 hw/arm/musicpal.c| 14 +++---
 hw/arm/pxa2xx.c  | 18 +-
 hw/arm/pxa2xx_gpio.c |  2 +-
 hw/arm/pxa2xx_pic.c  |  2 +-
 hw/arm/smmuv3.c  |  8 
 hw/arm/spitz.c   |  8 
 hw/arm/stellaris.c   |  6 +++---
 hw/arm/strongarm.c   | 12 ++--
 hw/arm/versatilepb.c |  2 +-
 hw/arm/virt-acpi-build.c |  2 +-
 hw/arm/z2.c  |  4 ++--
 15 files changed, 45 insertions(+), 45 deletions(-)

diff --git a/hw/arm/armsse.c b/hw/arm/armsse.c
index 31acbf7347..02b4f6596f 100644
--- a/hw/arm/armsse.c
+++ b/hw/arm/armsse.c
@@ -1677,7 +1677,7 @@ static const VMStateDescription armsse_vmstate = {
 .name = "iotkit",
 .version_id = 2,
 .minimum_version_id = 2,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_CLOCK(mainclk, ARMSSE),
 VMSTATE_CLOCK(s32kclk, ARMSSE),
 VMSTATE_UINT32(nsccfg, ARMSSE),
diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c
index d10abb36a8..375a40962f 100644
--- a/hw/arm/armv7m.c
+++ b/hw/arm/armv7m.c
@@ -559,7 +559,7 @@ static const VMStateDescription vmstate_armv7m = {
 .name = "armv7m",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_CLOCK(refclk, ARMv7MState),
 VMSTATE_CLOCK(cpuclk, ARMv7MState),
 VMSTATE_END_OF_LIST()
diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c
index f12aacea6b..c21e18d08f 100644
--- a/hw/arm/highbank.c
+++ b/hw/arm/highbank.c
@@ -112,7 +112,7 @@ static const VMStateDescription vmstate_highbank_regs = {
 .name = "highbank-regs",
 .version_id = 0,
 .minimum_version_id = 0,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32_ARRAY(regs, HighbankRegsState, NUM_REGS),
 VMSTATE_END_OF_LIST(),
 },
diff --git a/hw/arm/integratorcp.c b/hw/arm/integratorcp.c
index d176e9af7e..e602ca5e14 100644
--- a/hw/arm/integratorcp.c
+++ b/hw/arm/integratorcp.c
@@ -63,7 +63,7 @@ static const VMStateDescription vmstate_integratorcm = {
 .name = "integratorcm",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields  = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(cm_osc, IntegratorCMState),
 VMSTATE_UINT32(cm_ctrl, IntegratorCMState),
 VMSTATE_UINT32(cm_lock, IntegratorCMState),
@@ -346,7 +346,7 @@ static const VMStateDescription vmstate_icp_pic = {
 .name = "icp_pic",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields  = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(level, icp_pic_state),
 VMSTATE_UINT32(irq_enabled, icp_pic_state),
 VMSTATE_UINT32(fiq_enabled, icp_pic_state),
@@ -488,7 +488,7 @@ static const VMStateDescription vmstate_icp_control = {
 .name = "icp_control",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields  = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(intreg_state, ICPCtrlRegsState),
 VMSTATE_END_OF_LIST()
 }
diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c
index 9703bfb97f..3200c9f68a 100644
--- a/hw/arm/musicpal.c
+++ b/hw/arm/musicpal.c
@@ -275,7 +275,7 @@ static const VMStateDescription musicpal_lcd_vmsd = {
 .name = "musicpal_lcd",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(brightness, musicpal_lcd_state),
 VMSTATE_UINT32(mode, musicpal_lcd_state),
 VMSTATE_UINT32(irqctrl, musicpal_lcd_state),
@@ -400,7 +400,7 @@ static const VMStateDescription mv88w8618_pic_vmsd = {
 .name = "mv88w8618_pic",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(level, mv88w8618_pic_state),
 VMSTATE_UINT32(enabled, mv88w8618_pic_state),
 VMSTATE_END_OF_LIST()
@@ -583,7 +583,7 @@ static const VMStateDescription mv88w8618_timer_vmsd = {
 .name = "timer",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_PTIMER(ptimer, mv88w8618_timer_state),
 VMSTATE_UINT32(limit, mv88w8618_timer_state),
 VMSTATE_END_OF_LIST()
@@ -594,7 +594,7 @@ static const VMStateDescription mv88w8618_pit_vmsd = {
 .name = "mv88w8618_pit",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_STRUCT_ARRAY(time

[PULL 00/71] Constify VMState

2023-12-29 Thread Richard Henderson
The following changes since commit 7425b6277f12e82952cede1f531bfc689bf77fb1:

  Merge tag 'tracing-pull-request' of https://gitlab.com/stefanha/qemu into 
staging (2023-12-27 05:15:32 -0500)

are available in the Git repository at:

  https://gitlab.com/rth7680/qemu.git tags/pull-20231230

for you to fetch changes up to 2563c97f611f709b975880737a24dddc3318fa17:

  docs: Constify VMstate in examples (2023-12-30 07:38:06 +1100)


Mark VMStateField and VMStateDescription arrays const.


Richard Henderson (71):
  migration: Make VMStateDescription.subsections const
  target/arm: Constify VMState in machine.c
  target/arm: Constify hvf/hvf.c
  target/alpha: Constify VMState in machine.c
  target/avr: Constify VMState in machine.c
  target/cris: Constify VMState in machine.c
  target/hppa: Constify VMState in machine.c
  target/i386: Constify VMState in machine.c
  target/loongarch: Constify VMState in machine.c
  target/m68k: Constify VMState in machine.c
  target/microblaze: Constify VMState in machine.c
  target/mips: Constify VMState in machine.c
  target/openrisc: Constify VMState in machine.c
  target/ppc: Constify VMState in machine.c
  target/riscv: Constify VMState in machine.c
  target/s390x: Constify VMState in machine.c
  target/sparc: Constify VMState in machine.c
  hw/arm: Constify VMState
  hw/core: Constify VMState
  hw/9pfs: Constify VMState
  hw/acpi: Constify VMState
  hw/adc: Constify VMState
  hw/audio: Constify VMState
  hw/block: Constify VMState
  hw/char: Constify VMState
  hw/display: Constify VMState
  hw/dma: Constify VMState
  hw/gpio: Constify VMState
  hw/hyperv: Constify VMState
  hw/i2c: Constify VMState
  hw/i386: Constify VMState
  hw/ide: Constify VMState
  hw/input: Constify VMState
  hw/intc: Constify VMState
  hw/ipack: Constify VMState
  hw/ipmi: Constify VMState
  hw/isa: Constify VMState
  hw/loongarch: Constify VMState
  hw/m68k: Constify VMState
  hw/misc: Constify VMState
  hw/net: Constify VMState
  hw/nvram: Constify VMState
  hw/openrisc: Constify VMState
  hw/pci: Constify VMState
  hw/pci-bridge: Constify VMState
  hw/pci-host: Constify VMState
  hw/ppc: Constify VMState
  hw/riscv: Constify VMState
  hw/rtc: Constify VMState
  hw/s390x: Constify VMState
  hw/scsi: Constify VMState
  hw/sd: Constify VMState
  hw/sensor: Constify VMState
  hw/sparc: Constify VMState
  hw/ssi: Constify VMState
  hw/timer: Constify VMState
  hw/tpm: Constify VMState
  hw/usb: Constify VMState
  hw/vfio: Constify VMState
  hw/virtio: Constify VMState
  hw/watchdog: Constify VMState
  hw/misc/macio: Constify VMState
  audio: Constify VMState
  backends: Constify VMState
  cpu-target: Constify VMState
  migration: Constify VMState
  system: Constify VMState
  replay: Constify VMState
  util/fifo8: Constify VMState
  tests/unit/test-vmstate: Constify VMState
  docs: Constify VMstate in examples

 docs/devel/clocks.rst   |   2 +-
 docs/devel/migration.rst|   8 +--
 include/hw/pci/shpc.h   |   2 +-
 include/migration/vmstate.h |   2 +-
 audio/audio.c   |   2 +-
 backends/dbus-vmstate.c |   2 +-
 backends/tpm/tpm_emulator.c |   2 +-
 cpu-target.c|   8 +--
 hw/9pfs/virtio-9p-device.c  |   2 +-
 hw/acpi/cpu.c   |   4 +-
 hw/acpi/erst.c  |   2 +-
 hw/acpi/generic_event_device.c  |  12 ++--
 hw/acpi/ich9.c  |  12 ++--
 hw/acpi/ich9_tco.c  |   2 +-
 hw/acpi/memory_hotplug.c|   4 +-
 hw/acpi/pcihp.c |   2 +-
 hw/acpi/piix4.c |  12 ++--
 hw/acpi/vmgenid.c   |   2 +-
 hw/adc/aspeed_adc.c |   2 +-
 hw/adc/max111x.c|   2 +-
 hw/adc/npcm7xx_adc.c|   2 +-
 hw/adc/stm32f2xx_adc.c  |   2 +-
 hw/adc/zynq-xadc.c  |   2 +-
 hw/arm/armsse.c |   2 +-
 hw/arm/armv7m.c |   2 +-
 hw/arm/highbank.c   |   2 +-
 hw/arm/integratorcp.c   |   6 +-
 hw/arm/musicpal.c   |  14 ++--
 hw/arm/pxa2xx.c |  18 ++---
 hw/arm/pxa2xx_gpio.c|   2 +-
 hw/arm/pxa2xx_pic.c |   2 +-
 hw/arm/smmuv3.c |   8 +--
 hw/arm/spitz.c  |   8 +--
 hw/arm/stellaris.c  |   6 +-
 hw/arm/strongarm.c  |  12 ++--
 hw/arm/versatilepb.c|   2 +-
 hw/arm/virt-acpi-build.c|   2 +-
 

[PULL 05/71] target/avr: Constify VMState in machine.c

2023-12-29 Thread Richard Henderson
Tested-by: Philippe Mathieu-Daudé 
Reviewed-by: Philippe Mathieu-Daudé 
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-6-richard.hender...@linaro.org>
---
 target/avr/machine.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/avr/machine.c b/target/avr/machine.c
index 16f7a3e031..4402862fb9 100644
--- a/target/avr/machine.c
+++ b/target/avr/machine.c
@@ -100,7 +100,7 @@ const VMStateDescription vms_avr_cpu = {
 .name = "cpu",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(env.pc_w, AVRCPU),
 VMSTATE_UINT32(env.sp, AVRCPU),
 VMSTATE_UINT32(env.skip, AVRCPU),
-- 
2.34.1




[PULL 38/71] hw/loongarch: Constify VMState

2023-12-29 Thread Richard Henderson
Signed-off-by: Richard Henderson 
Reviewed-by: Song Gao 
Message-Id: <20231221031652.119827-39-richard.hender...@linaro.org>
---
 hw/loongarch/acpi-build.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/loongarch/acpi-build.c b/hw/loongarch/acpi-build.c
index ae292fc543..730bc4a748 100644
--- a/hw/loongarch/acpi-build.c
+++ b/hw/loongarch/acpi-build.c
@@ -564,7 +564,7 @@ static const VMStateDescription vmstate_acpi_build = {
 .name = "acpi_build",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8(patched, AcpiBuildState),
 VMSTATE_END_OF_LIST()
 },
-- 
2.34.1




[PULL 16/71] target/s390x: Constify VMState in machine.c

2023-12-29 Thread Richard Henderson
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-17-richard.hender...@linaro.org>
---
 target/s390x/machine.c | 32 
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/target/s390x/machine.c b/target/s390x/machine.c
index 37a076858c..a125ebcc2f 100644
--- a/target/s390x/machine.c
+++ b/target/s390x/machine.c
@@ -66,7 +66,7 @@ static const VMStateDescription vmstate_fpu = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = fpu_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64(env.vregs[0][0], S390CPU),
 VMSTATE_UINT64(env.vregs[1][0], S390CPU),
 VMSTATE_UINT64(env.vregs[2][0], S390CPU),
@@ -98,7 +98,7 @@ static const VMStateDescription vmstate_vregs = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = vregs_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 /* vregs[0][0] -> vregs[15][0] and fregs are overlays */
 VMSTATE_UINT64(env.vregs[16][0], S390CPU),
 VMSTATE_UINT64(env.vregs[17][0], S390CPU),
@@ -157,12 +157,12 @@ static bool riccb_needed(void *opaque)
 return s390_has_feat(S390_FEAT_RUNTIME_INSTRUMENTATION);
 }
 
-const VMStateDescription vmstate_riccb = {
+static const VMStateDescription vmstate_riccb = {
 .name = "cpu/riccb",
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = riccb_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8_ARRAY(env.riccb, S390CPU, 64),
 VMSTATE_END_OF_LIST()
 }
@@ -174,12 +174,12 @@ static bool exval_needed(void *opaque)
 return cpu->env.ex_value != 0;
 }
 
-const VMStateDescription vmstate_exval = {
+static const VMStateDescription vmstate_exval = {
 .name = "cpu/exval",
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = exval_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64(env.ex_value, S390CPU),
 VMSTATE_END_OF_LIST()
 }
@@ -190,12 +190,12 @@ static bool gscb_needed(void *opaque)
 return s390_has_feat(S390_FEAT_GUARDED_STORAGE);
 }
 
-const VMStateDescription vmstate_gscb = {
+static const VMStateDescription vmstate_gscb = {
 .name = "cpu/gscb",
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = gscb_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64_ARRAY(env.gscb, S390CPU, 4),
 VMSTATE_END_OF_LIST()
 }
@@ -206,12 +206,12 @@ static bool bpbc_needed(void *opaque)
 return s390_has_feat(S390_FEAT_BPB);
 }
 
-const VMStateDescription vmstate_bpbc = {
+static const VMStateDescription vmstate_bpbc = {
 .name = "cpu/bpbc",
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = bpbc_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_BOOL(env.bpbc, S390CPU),
 VMSTATE_END_OF_LIST()
 }
@@ -222,12 +222,12 @@ static bool etoken_needed(void *opaque)
 return s390_has_feat(S390_FEAT_ETOKEN);
 }
 
-const VMStateDescription vmstate_etoken = {
+static const VMStateDescription vmstate_etoken = {
 .name = "cpu/etoken",
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = etoken_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64(env.etoken, S390CPU),
 VMSTATE_UINT64(env.etoken_extension, S390CPU),
 VMSTATE_END_OF_LIST()
@@ -239,12 +239,12 @@ static bool diag318_needed(void *opaque)
 return s390_has_feat(S390_FEAT_DIAG_318);
 }
 
-const VMStateDescription vmstate_diag318 = {
+static const VMStateDescription vmstate_diag318 = {
 .name = "cpu/diag318",
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = diag318_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64(env.diag318_info, S390CPU),
 VMSTATE_END_OF_LIST()
 }
@@ -256,7 +256,7 @@ const VMStateDescription vmstate_s390_cpu = {
 .pre_save = cpu_pre_save,
 .version_id = 4,
 .minimum_version_id = 3,
-.fields  = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64_ARRAY(env.regs, S390CPU, 16),
 VMSTATE_UINT64(env.psw.mask, S390CPU),
 VMSTATE_UINT64(env.psw.addr, S390CPU),
@@ -278,7 +278,7 @@ const VMStateDescription vmstate_s390_cpu = {
irqstate_saved_size),
 VMSTATE_END_OF_LIST()
 },
-.subsections = (const VMStateDescription*[]) {
+.subsections = (const VMStateDescription * const []) {
 &vmstate_fpu,
 &vmstate_vregs,
 &vmstate_riccb,
-- 
2.34.1




[PULL 28/71] hw/gpio: Constify VMState

2023-12-29 Thread Richard Henderson
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-29-richard.hender...@linaro.org>
---
 hw/gpio/aspeed_gpio.c  | 4 ++--
 hw/gpio/bcm2835_gpio.c | 2 +-
 hw/gpio/gpio_key.c | 2 +-
 hw/gpio/imx_gpio.c | 2 +-
 hw/gpio/max7310.c  | 2 +-
 hw/gpio/mpc8xxx.c  | 2 +-
 hw/gpio/npcm7xx_gpio.c | 2 +-
 hw/gpio/nrf51_gpio.c   | 2 +-
 hw/gpio/pl061.c| 2 +-
 hw/gpio/sifive_gpio.c  | 2 +-
 hw/gpio/zaurus.c   | 2 +-
 11 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/hw/gpio/aspeed_gpio.c b/hw/gpio/aspeed_gpio.c
index 1e267dd482..c1781e2ba3 100644
--- a/hw/gpio/aspeed_gpio.c
+++ b/hw/gpio/aspeed_gpio.c
@@ -1067,7 +1067,7 @@ static const VMStateDescription vmstate_gpio_regs = {
 .name = TYPE_ASPEED_GPIO"/regs",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(data_value,   GPIOSets),
 VMSTATE_UINT32(data_read,GPIOSets),
 VMSTATE_UINT32(direction,GPIOSets),
@@ -1090,7 +1090,7 @@ static const VMStateDescription vmstate_aspeed_gpio = {
 .name = TYPE_ASPEED_GPIO,
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_STRUCT_ARRAY(sets, AspeedGPIOState, ASPEED_GPIO_MAX_NR_SETS,
  1, vmstate_gpio_regs, GPIOSets),
 VMSTATE_UINT32_ARRAY(debounce_regs, AspeedGPIOState,
diff --git a/hw/gpio/bcm2835_gpio.c b/hw/gpio/bcm2835_gpio.c
index c995bba1d9..6bd50bb0b6 100644
--- a/hw/gpio/bcm2835_gpio.c
+++ b/hw/gpio/bcm2835_gpio.c
@@ -284,7 +284,7 @@ static const VMStateDescription vmstate_bcm2835_gpio = {
 .name = "bcm2835_gpio",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8_ARRAY(fsel, BCM2835GpioState, 54),
 VMSTATE_UINT32(lev0, BCM2835GpioState),
 VMSTATE_UINT32(lev1, BCM2835GpioState),
diff --git a/hw/gpio/gpio_key.c b/hw/gpio/gpio_key.c
index 74f6138356..61bb587058 100644
--- a/hw/gpio/gpio_key.c
+++ b/hw/gpio/gpio_key.c
@@ -45,7 +45,7 @@ static const VMStateDescription vmstate_gpio_key = {
 .name = "gpio-key",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_TIMER_PTR(timer, GPIOKEYState),
 VMSTATE_END_OF_LIST()
 }
diff --git a/hw/gpio/imx_gpio.c b/hw/gpio/imx_gpio.c
index c7f98b7bb1..e53b00d951 100644
--- a/hw/gpio/imx_gpio.c
+++ b/hw/gpio/imx_gpio.c
@@ -277,7 +277,7 @@ static const VMStateDescription vmstate_imx_gpio = {
 .name = TYPE_IMX_GPIO,
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(dr, IMXGPIOState),
 VMSTATE_UINT32(gdir, IMXGPIOState),
 VMSTATE_UINT32(psr, IMXGPIOState),
diff --git a/hw/gpio/max7310.c b/hw/gpio/max7310.c
index 4470cfe985..86315714fb 100644
--- a/hw/gpio/max7310.c
+++ b/hw/gpio/max7310.c
@@ -155,7 +155,7 @@ static const VMStateDescription vmstate_max7310 = {
 .name = "max7310",
 .version_id = 0,
 .minimum_version_id = 0,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_INT32(i2c_command_byte, MAX7310State),
 VMSTATE_INT32(len, MAX7310State),
 VMSTATE_UINT8(level, MAX7310State),
diff --git a/hw/gpio/mpc8xxx.c b/hw/gpio/mpc8xxx.c
index cb42acb6da..0b3f9e516d 100644
--- a/hw/gpio/mpc8xxx.c
+++ b/hw/gpio/mpc8xxx.c
@@ -48,7 +48,7 @@ static const VMStateDescription vmstate_mpc8xxx_gpio = {
 .name = "mpc8xxx_gpio",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(dir, MPC8XXXGPIOState),
 VMSTATE_UINT32(odr, MPC8XXXGPIOState),
 VMSTATE_UINT32(dat, MPC8XXXGPIOState),
diff --git a/hw/gpio/npcm7xx_gpio.c b/hw/gpio/npcm7xx_gpio.c
index 3376901ab1..6e70ac1f24 100644
--- a/hw/gpio/npcm7xx_gpio.c
+++ b/hw/gpio/npcm7xx_gpio.c
@@ -377,7 +377,7 @@ static const VMStateDescription vmstate_npcm7xx_gpio = {
 .name = "npcm7xx-gpio",
 .version_id = 0,
 .minimum_version_id = 0,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(pin_level, NPCM7xxGPIOState),
 VMSTATE_UINT32(ext_level, NPCM7xxGPIOState),
 VMSTATE_UINT32(ext_driven, NPCM7xxGPIOState),
diff --git a/hw/gpio/nrf51_gpio.c b/hw/gpio/nrf51_gpio.c
index 08396c69a4..ffc7dff796 100644
--- a/hw/gpio/nrf51_gpio.c
+++ b/hw/gpio/nrf51_gpio.c
@@ -280,7 +280,7 @@ static const VMStateDescription vmstate_nrf51_gpio = {
 .name = TYPE_NRF51_GPIO,
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(out, NRF51GPIOState),
 VMSTATE_UINT32(in, NRF51GPIOState),
  

[PULL 13/71] target/openrisc: Constify VMState in machine.c

2023-12-29 Thread Richard Henderson
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-14-richard.hender...@linaro.org>
---
 target/openrisc/machine.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/target/openrisc/machine.c b/target/openrisc/machine.c
index b7d7388640..3574e571cb 100644
--- a/target/openrisc/machine.c
+++ b/target/openrisc/machine.c
@@ -25,7 +25,7 @@ static const VMStateDescription vmstate_tlb_entry = {
 .name = "tlb_entry",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINTTL(mr, OpenRISCTLBEntry),
 VMSTATE_UINTTL(tr, OpenRISCTLBEntry),
 VMSTATE_END_OF_LIST()
@@ -36,7 +36,7 @@ static const VMStateDescription vmstate_cpu_tlb = {
 .name = "cpu_tlb",
 .version_id = 2,
 .minimum_version_id = 2,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_STRUCT_ARRAY(itlb, CPUOpenRISCTLBContext, TLB_SIZE, 0,
  vmstate_tlb_entry, OpenRISCTLBEntry),
 VMSTATE_STRUCT_ARRAY(dtlb, CPUOpenRISCTLBContext, TLB_SIZE, 0,
@@ -71,7 +71,7 @@ static const VMStateDescription vmstate_env = {
 .name = "env",
 .version_id = 6,
 .minimum_version_id = 6,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINTTL_2DARRAY(shadow_gpr, CPUOpenRISCState, 16, 32),
 VMSTATE_UINTTL(pc, CPUOpenRISCState),
 VMSTATE_UINTTL(ppc, CPUOpenRISCState),
@@ -135,7 +135,7 @@ const VMStateDescription vmstate_openrisc_cpu = {
 .version_id = 1,
 .minimum_version_id = 1,
 .post_load = cpu_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_CPU(),
 VMSTATE_STRUCT(env, OpenRISCCPU, 1, vmstate_env, CPUOpenRISCState),
 VMSTATE_END_OF_LIST()
-- 
2.34.1




[PULL 04/71] target/alpha: Constify VMState in machine.c

2023-12-29 Thread Richard Henderson
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-5-richard.hender...@linaro.org>
---
 target/alpha/machine.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/alpha/machine.c b/target/alpha/machine.c
index 2b7c8148ff..f09834f635 100644
--- a/target/alpha/machine.c
+++ b/target/alpha/machine.c
@@ -24,7 +24,7 @@ static const VMStateInfo vmstate_fpcr = {
 .put = put_fpcr,
 };
 
-static VMStateField vmstate_env_fields[] = {
+static const VMStateField vmstate_env_fields[] = {
 VMSTATE_UINTTL_ARRAY(ir, CPUAlphaState, 31),
 VMSTATE_UINTTL_ARRAY(fir, CPUAlphaState, 31),
 /* Save the architecture value of the fpcr, not the internally
@@ -73,7 +73,7 @@ static const VMStateDescription vmstate_env = {
 .fields = vmstate_env_fields,
 };
 
-static VMStateField vmstate_cpu_fields[] = {
+static const VMStateField vmstate_cpu_fields[] = {
 VMSTATE_CPU(),
 VMSTATE_STRUCT(env, AlphaCPU, 1, vmstate_env, CPUAlphaState),
 VMSTATE_END_OF_LIST()
-- 
2.34.1




[PULL 14/71] target/ppc: Constify VMState in machine.c

2023-12-29 Thread Richard Henderson
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-15-richard.hender...@linaro.org>
---
 target/ppc/machine.c | 32 
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/target/ppc/machine.c b/target/ppc/machine.c
index 68cbdffecd..203fe28e01 100644
--- a/target/ppc/machine.c
+++ b/target/ppc/machine.c
@@ -351,7 +351,7 @@ static const VMStateDescription vmstate_fpu = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = fpu_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_FPR_ARRAY(env.vsr, PowerPCCPU, 32),
 VMSTATE_UINTTL(env.fpscr, PowerPCCPU),
 VMSTATE_END_OF_LIST()
@@ -392,7 +392,7 @@ static const VMStateDescription vmstate_altivec = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = altivec_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_AVR_ARRAY(env.vsr, PowerPCCPU, 32),
 /*
  * Save the architecture value of the vscr, not the internally
@@ -425,7 +425,7 @@ static const VMStateDescription vmstate_vsx = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = vsx_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_VSR_ARRAY(env.vsr, PowerPCCPU, 32),
 VMSTATE_END_OF_LIST()
 },
@@ -445,7 +445,7 @@ static const VMStateDescription vmstate_tm = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = tm_needed,
-.fields  = (VMStateField []) {
+.fields = (const VMStateField []) {
 VMSTATE_UINTTL_ARRAY(env.tm_gpr, PowerPCCPU, 32),
 VMSTATE_AVR_ARRAY(env.tm_vsr, PowerPCCPU, 64),
 VMSTATE_UINT64(env.tm_cr, PowerPCCPU),
@@ -479,7 +479,7 @@ static const VMStateDescription vmstate_sr = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = sr_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINTTL_ARRAY(env.sr, PowerPCCPU, 32),
 VMSTATE_END_OF_LIST()
 },
@@ -553,7 +553,7 @@ static const VMStateDescription vmstate_slb = {
 .minimum_version_id = 1,
 .needed = slb_needed,
 .post_load = slb_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_INT32_TEST(mig_slb_nr, PowerPCCPU, cpu_pre_3_0_migration),
 VMSTATE_SLB_ARRAY(env.slb, PowerPCCPU, MAX_SLB_ENTRIES),
 VMSTATE_END_OF_LIST()
@@ -565,7 +565,7 @@ static const VMStateDescription vmstate_tlb6xx_entry = {
 .name = "cpu/tlb6xx_entry",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINTTL(pte0, ppc6xx_tlb_t),
 VMSTATE_UINTTL(pte1, ppc6xx_tlb_t),
 VMSTATE_UINTTL(EPN, ppc6xx_tlb_t),
@@ -586,7 +586,7 @@ static const VMStateDescription vmstate_tlb6xx = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = tlb6xx_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_INT32_EQUAL(env.nb_tlb, PowerPCCPU, NULL),
 VMSTATE_STRUCT_VARRAY_POINTER_INT32(env.tlb.tlb6, PowerPCCPU,
 env.nb_tlb,
@@ -601,7 +601,7 @@ static const VMStateDescription vmstate_tlbemb_entry = {
 .name = "cpu/tlbemb_entry",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64(RPN, ppcemb_tlb_t),
 VMSTATE_UINTTL(EPN, ppcemb_tlb_t),
 VMSTATE_UINTTL(PID, ppcemb_tlb_t),
@@ -625,7 +625,7 @@ static const VMStateDescription vmstate_tlbemb = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = tlbemb_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_INT32_EQUAL(env.nb_tlb, PowerPCCPU, NULL),
 VMSTATE_STRUCT_VARRAY_POINTER_INT32(env.tlb.tlbe, PowerPCCPU,
 env.nb_tlb,
@@ -639,7 +639,7 @@ static const VMStateDescription vmstate_tlbmas_entry = {
 .name = "cpu/tlbmas_entry",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(mas8, ppcmas_tlb_t),
 VMSTATE_UINT32(mas1, ppcmas_tlb_t),
 VMSTATE_UINT64(mas2, ppcmas_tlb_t),
@@ -661,7 +661,7 @@ static const VMStateDescription vmstate_tlbmas = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = tlbmas_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_INT32_EQUAL(env.nb_tlb, PowerPCCPU, NULL),
 VMSTATE_STRUCT_VARRAY_POINTER_INT32(env.tlb.tlbm, PowerPCCPU,
 env.nb_tlb,
@@ -684,7 +684,7 @@ static const VMStateDescription vmstate_compat = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = com

[PULL 02/71] target/arm: Constify VMState in machine.c

2023-12-29 Thread Richard Henderson
Tested-by: Philippe Mathieu-Daudé 
Reviewed-by: Philippe Mathieu-Daudé 
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-3-richard.hender...@linaro.org>
---
 target/arm/machine.c | 54 ++--
 1 file changed, 27 insertions(+), 27 deletions(-)

diff --git a/target/arm/machine.c b/target/arm/machine.c
index 9e20b41189..542be14bec 100644
--- a/target/arm/machine.c
+++ b/target/arm/machine.c
@@ -49,7 +49,7 @@ static const VMStateDescription vmstate_vfp = {
 .version_id = 3,
 .minimum_version_id = 3,
 .needed = vfp_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 /* For compatibility, store Qn out of Zn here.  */
 VMSTATE_UINT64_SUB_ARRAY(env.vfp.zregs[0].d, ARMCPU, 0, 2),
 VMSTATE_UINT64_SUB_ARRAY(env.vfp.zregs[1].d, ARMCPU, 0, 2),
@@ -115,7 +115,7 @@ static const VMStateDescription vmstate_iwmmxt = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = iwmmxt_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64_ARRAY(env.iwmmxt.regs, ARMCPU, 16),
 VMSTATE_UINT32_ARRAY(env.iwmmxt.cregs, ARMCPU, 16),
 VMSTATE_END_OF_LIST()
@@ -140,7 +140,7 @@ static const VMStateDescription vmstate_zreg_hi_reg = {
 .name = "cpu/sve/zreg_hi",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64_SUB_ARRAY(d, ARMVectorReg, 2, ARM_MAX_VQ - 2),
 VMSTATE_END_OF_LIST()
 }
@@ -150,7 +150,7 @@ static const VMStateDescription vmstate_preg_reg = {
 .name = "cpu/sve/preg",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64_ARRAY(p, ARMPredicateReg, 2 * ARM_MAX_VQ / 8),
 VMSTATE_END_OF_LIST()
 }
@@ -161,7 +161,7 @@ static const VMStateDescription vmstate_sve = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = sve_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_STRUCT_ARRAY(env.vfp.zregs, ARMCPU, 32, 0,
  vmstate_zreg_hi_reg, ARMVectorReg),
 VMSTATE_STRUCT_ARRAY(env.vfp.pregs, ARMCPU, 17, 0,
@@ -174,7 +174,7 @@ static const VMStateDescription vmstate_vreg = {
 .name = "vreg",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64_ARRAY(d, ARMVectorReg, ARM_MAX_VQ * 2),
 VMSTATE_END_OF_LIST()
 }
@@ -196,7 +196,7 @@ static const VMStateDescription vmstate_za = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = za_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_STRUCT_ARRAY(env.zarray, ARMCPU, ARM_MAX_VQ * 16, 0,
  vmstate_vreg, ARMVectorReg),
 VMSTATE_END_OF_LIST()
@@ -217,7 +217,7 @@ static const VMStateDescription vmstate_serror = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = serror_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8(env.serror.pending, ARMCPU),
 VMSTATE_UINT8(env.serror.has_esr, ARMCPU),
 VMSTATE_UINT64(env.serror.esr, ARMCPU),
@@ -235,7 +235,7 @@ static const VMStateDescription vmstate_irq_line_state = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = irq_line_state_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(env.irq_line_state, ARMCPU),
 VMSTATE_END_OF_LIST()
 }
@@ -254,7 +254,7 @@ static const VMStateDescription vmstate_m_faultmask_primask 
= {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = m_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(env.v7m.faultmask[M_REG_NS], ARMCPU),
 VMSTATE_UINT32(env.v7m.primask[M_REG_NS], ARMCPU),
 VMSTATE_END_OF_LIST()
@@ -289,7 +289,7 @@ static const VMStateDescription vmstate_m_csselr = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = m_csselr_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32_ARRAY(env.v7m.csselr, ARMCPU, M_REG_NUM_BANKS),
 VMSTATE_VALIDATE("CSSELR is valid", csselr_vmstate_validate),
 VMSTATE_END_OF_LIST()
@@ -301,7 +301,7 @@ static const VMStateDescription vmstate_m_scr = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = m_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(env.v7m.scr[M_REG_NS], ARMCPU),
 VMSTATE_END_OF_LIST()
 }
@@ -312,7 +312,7 @@ static const VMStateDescription vmstate_m_other_sp = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = m_need

[PULL 08/71] target/i386: Constify VMState in machine.c

2023-12-29 Thread Richard Henderson
Signed-off-by: Richard Henderson 
Reviewed-by: Zhao Liu 
Message-Id: <20231221031652.119827-9-richard.hender...@linaro.org>
---
 target/i386/machine.c | 128 +-
 1 file changed, 64 insertions(+), 64 deletions(-)

diff --git a/target/i386/machine.c b/target/i386/machine.c
index a1041ef828..c3ae320814 100644
--- a/target/i386/machine.c
+++ b/target/i386/machine.c
@@ -18,7 +18,7 @@ static const VMStateDescription vmstate_segment = {
 .name = "segment",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(selector, SegmentCache),
 VMSTATE_UINTTL(base, SegmentCache),
 VMSTATE_UINT32(limit, SegmentCache),
@@ -43,7 +43,7 @@ static const VMStateDescription vmstate_xmm_reg = {
 .name = "xmm_reg",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64(ZMM_Q(0), ZMMReg),
 VMSTATE_UINT64(ZMM_Q(1), ZMMReg),
 VMSTATE_END_OF_LIST()
@@ -59,7 +59,7 @@ static const VMStateDescription vmstate_ymmh_reg = {
 .name = "ymmh_reg",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64(ZMM_Q(2), ZMMReg),
 VMSTATE_UINT64(ZMM_Q(3), ZMMReg),
 VMSTATE_END_OF_LIST()
@@ -74,7 +74,7 @@ static const VMStateDescription vmstate_zmmh_reg = {
 .name = "zmmh_reg",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64(ZMM_Q(4), ZMMReg),
 VMSTATE_UINT64(ZMM_Q(5), ZMMReg),
 VMSTATE_UINT64(ZMM_Q(6), ZMMReg),
@@ -92,7 +92,7 @@ static const VMStateDescription vmstate_hi16_zmm_reg = {
 .name = "hi16_zmm_reg",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64(ZMM_Q(0), ZMMReg),
 VMSTATE_UINT64(ZMM_Q(1), ZMMReg),
 VMSTATE_UINT64(ZMM_Q(2), ZMMReg),
@@ -114,7 +114,7 @@ static const VMStateDescription vmstate_bnd_regs = {
 .name = "bnd_regs",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64(lb, BNDReg),
 VMSTATE_UINT64(ub, BNDReg),
 VMSTATE_END_OF_LIST()
@@ -128,7 +128,7 @@ static const VMStateDescription vmstate_mtrr_var = {
 .name = "mtrr_var",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64(base, MTRRVar),
 VMSTATE_UINT64(mask, MTRRVar),
 VMSTATE_END_OF_LIST()
@@ -142,7 +142,7 @@ static const VMStateDescription vmstate_lbr_records_var = {
 .name = "lbr_records_var",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64(from, LBREntry),
 VMSTATE_UINT64(to, LBREntry),
 VMSTATE_UINT64(info, LBREntry),
@@ -201,7 +201,7 @@ static const VMStateDescription vmstate_fpreg_tmp = {
 .name = "fpreg_tmp",
 .post_load = fpreg_post_load,
 .pre_save  = fpreg_pre_save,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64(tmp_mant, x86_FPReg_tmp),
 VMSTATE_UINT16(tmp_exp, x86_FPReg_tmp),
 VMSTATE_END_OF_LIST()
@@ -210,7 +210,7 @@ static const VMStateDescription vmstate_fpreg_tmp = {
 
 static const VMStateDescription vmstate_fpreg = {
 .name = "fpreg",
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_WITH_TMP(FPReg, x86_FPReg_tmp, vmstate_fpreg_tmp),
 VMSTATE_END_OF_LIST()
 }
@@ -453,7 +453,7 @@ static const VMStateDescription vmstate_exception_info = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = exception_info_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT8(env.exception_pending, X86CPU),
 VMSTATE_UINT8(env.exception_injected, X86CPU),
 VMSTATE_UINT8(env.exception_has_payload, X86CPU),
@@ -475,7 +475,7 @@ static const VMStateDescription vmstate_steal_time_msr = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = steal_time_msr_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64(env.steal_time_msr, X86CPU),
 VMSTATE_END_OF_LIST()
 }
@@ -486,7 +486,7 @@ static const VMStateDescription vmstate_async_pf_msr = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = async_pf_msr_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64(env.async_pf_en_msr, X86CPU),
 VMSTATE_END_OF_LIST()
 }
@@ -497,7 +497,7 @@ static const VMStateDescrip

[PULL 12/71] target/mips: Constify VMState in machine.c

2023-12-29 Thread Richard Henderson
Tested-by: Philippe Mathieu-Daudé 
Reviewed-by: Philippe Mathieu-Daudé 
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-13-richard.hender...@linaro.org>
---
 target/mips/sysemu/machine.c | 26 +-
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/target/mips/sysemu/machine.c b/target/mips/sysemu/machine.c
index 80d37f9c2f..218f4c3a67 100644
--- a/target/mips/sysemu/machine.c
+++ b/target/mips/sysemu/machine.c
@@ -44,7 +44,7 @@ static int put_fpr(QEMUFile *f, void *pv, size_t size,
 return 0;
 }
 
-const VMStateInfo vmstate_info_fpr = {
+static const VMStateInfo vmstate_info_fpr = {
 .name = "fpr",
 .get  = get_fpr,
 .put  = put_fpr,
@@ -56,21 +56,21 @@ const VMStateInfo vmstate_info_fpr = {
 #define VMSTATE_FPR_ARRAY(_f, _s, _n)   \
 VMSTATE_FPR_ARRAY_V(_f, _s, _n, 0)
 
-static VMStateField vmstate_fpu_fields[] = {
+static const VMStateField vmstate_fpu_fields[] = {
 VMSTATE_FPR_ARRAY(fpr, CPUMIPSFPUContext, 32),
 VMSTATE_UINT32(fcr0, CPUMIPSFPUContext),
 VMSTATE_UINT32(fcr31, CPUMIPSFPUContext),
 VMSTATE_END_OF_LIST()
 };
 
-const VMStateDescription vmstate_fpu = {
+static const VMStateDescription vmstate_fpu = {
 .name = "cpu/fpu",
 .version_id = 1,
 .minimum_version_id = 1,
 .fields = vmstate_fpu_fields
 };
 
-const VMStateDescription vmstate_inactive_fpu = {
+static const VMStateDescription vmstate_inactive_fpu = {
 .name = "cpu/inactive_fpu",
 .version_id = 1,
 .minimum_version_id = 1,
@@ -79,7 +79,7 @@ const VMStateDescription vmstate_inactive_fpu = {
 
 /* TC state */
 
-static VMStateField vmstate_tc_fields[] = {
+static const VMStateField vmstate_tc_fields[] = {
 VMSTATE_UINTTL_ARRAY(gpr, TCState, 32),
 #if defined(TARGET_MIPS64)
 VMSTATE_UINT64_ARRAY(gpr_hi, TCState, 32),
@@ -103,14 +103,14 @@ static VMStateField vmstate_tc_fields[] = {
 VMSTATE_END_OF_LIST()
 };
 
-const VMStateDescription vmstate_tc = {
+static const VMStateDescription vmstate_tc = {
 .name = "cpu/tc",
 .version_id = 2,
 .minimum_version_id = 2,
 .fields = vmstate_tc_fields
 };
 
-const VMStateDescription vmstate_inactive_tc = {
+static const VMStateDescription vmstate_inactive_tc = {
 .name = "cpu/inactive_tc",
 .version_id = 2,
 .minimum_version_id = 2,
@@ -119,11 +119,11 @@ const VMStateDescription vmstate_inactive_tc = {
 
 /* MVP state */
 
-const VMStateDescription vmstate_mvp = {
+static const VMStateDescription vmstate_mvp = {
 .name = "cpu/mvp",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_INT32(CP0_MVPControl, CPUMIPSMVPContext),
 VMSTATE_INT32(CP0_MVPConf0, CPUMIPSMVPContext),
 VMSTATE_INT32(CP0_MVPConf1, CPUMIPSMVPContext),
@@ -190,7 +190,7 @@ static int put_tlb(QEMUFile *f, void *pv, size_t size,
 return 0;
 }
 
-const VMStateInfo vmstate_info_tlb = {
+static const VMStateInfo vmstate_info_tlb = {
 .name = "tlb_entry",
 .get  = get_tlb,
 .put  = put_tlb,
@@ -202,11 +202,11 @@ const VMStateInfo vmstate_info_tlb = {
 #define VMSTATE_TLB_ARRAY(_f, _s, _n)   \
 VMSTATE_TLB_ARRAY_V(_f, _s, _n, 0)
 
-const VMStateDescription vmstate_tlb = {
+static const VMStateDescription vmstate_tlb = {
 .name = "cpu/tlb",
 .version_id = 2,
 .minimum_version_id = 2,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT32(nb_tlb, CPUMIPSTLBContext),
 VMSTATE_UINT32(tlb_in_use, CPUMIPSTLBContext),
 VMSTATE_TLB_ARRAY(mmu.r4k.tlb, CPUMIPSTLBContext, MIPS_TLB_MAX),
@@ -221,7 +221,7 @@ const VMStateDescription vmstate_mips_cpu = {
 .version_id = 21,
 .minimum_version_id = 21,
 .post_load = cpu_post_load,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 /* Active TC */
 VMSTATE_STRUCT(env.active_tc, MIPSCPU, 1, vmstate_tc, TCState),
 
-- 
2.34.1




[PULL 01/71] migration: Make VMStateDescription.subsections const

2023-12-29 Thread Richard Henderson
Allow the array of pointers to itself be const.
Propagate this through the copies of this field.

Tested-by: Philippe Mathieu-Daudé 
Reviewed-by: Philippe Mathieu-Daudé 
Reviewed-by: Juan Quintela 
Signed-off-by: Richard Henderson 
Message-Id: <20231221031652.119827-2-richard.hender...@linaro.org>
---
 include/migration/vmstate.h |  2 +-
 migration/savevm.c  | 12 ++--
 migration/vmstate.c | 14 --
 3 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
index 9821918631..294d2d8486 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -209,7 +209,7 @@ struct VMStateDescription {
 bool (*dev_unplug_pending)(void *opaque);
 
 const VMStateField *fields;
-const VMStateDescription **subsections;
+const VMStateDescription * const *subsections;
 };
 
 extern const VMStateInfo vmstate_info_bool;
diff --git a/migration/savevm.c b/migration/savevm.c
index 1b9ab7b8ee..eab62330b6 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -551,11 +551,11 @@ static void dump_vmstate_vmsf(FILE *out_file, const 
VMStateField *field,
 }
 
 static void dump_vmstate_vmss(FILE *out_file,
-  const VMStateDescription **subsection,
+  const VMStateDescription *subsection,
   int indent)
 {
-if (*subsection != NULL) {
-dump_vmstate_vmsd(out_file, *subsection, indent, true);
+if (subsection != NULL) {
+dump_vmstate_vmsd(out_file, subsection, indent, true);
 }
 }
 
@@ -597,7 +597,7 @@ static void dump_vmstate_vmsd(FILE *out_file,
 fprintf(out_file, "\n%*s]", indent, "");
 }
 if (vmsd->subsections != NULL) {
-const VMStateDescription **subsection = vmsd->subsections;
+const VMStateDescription * const *subsection = vmsd->subsections;
 bool first;
 
 fprintf(out_file, ",\n%*s\"Subsections\": [\n", indent, "");
@@ -606,7 +606,7 @@ static void dump_vmstate_vmsd(FILE *out_file,
 if (!first) {
 fprintf(out_file, ",\n");
 }
-dump_vmstate_vmss(out_file, subsection, indent + 2);
+dump_vmstate_vmss(out_file, *subsection, indent + 2);
 subsection++;
 first = false;
 }
@@ -831,7 +831,7 @@ void unregister_savevm(VMStateIf *obj, const char *idstr, 
void *opaque)
 static void vmstate_check(const VMStateDescription *vmsd)
 {
 const VMStateField *field = vmsd->fields;
-const VMStateDescription **subsection = vmsd->subsections;
+const VMStateDescription * const *subsection = vmsd->subsections;
 
 if (field) {
 while (field->name) {
diff --git a/migration/vmstate.c b/migration/vmstate.c
index b7723a4187..ef26f26ccd 100644
--- a/migration/vmstate.c
+++ b/migration/vmstate.c
@@ -452,13 +452,15 @@ int vmstate_save_state_v(QEMUFile *f, const 
VMStateDescription *vmsd,
 }
 
 static const VMStateDescription *
-vmstate_get_subsection(const VMStateDescription **sub, char *idstr)
+vmstate_get_subsection(const VMStateDescription * const *sub,
+   const char *idstr)
 {
-while (sub && *sub) {
-if (strcmp(idstr, (*sub)->name) == 0) {
-return *sub;
+if (sub) {
+for (const VMStateDescription *s = *sub; s ; s = *++sub) {
+if (strcmp(idstr, s->name) == 0) {
+return s;
+}
 }
-sub++;
 }
 return NULL;
 }
@@ -517,7 +519,7 @@ static int vmstate_subsection_load(QEMUFile *f, const 
VMStateDescription *vmsd,
 static int vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd,
void *opaque, JSONWriter *vmdesc)
 {
-const VMStateDescription **sub = vmsd->subsections;
+const VMStateDescription * const *sub = vmsd->subsections;
 bool vmdesc_has_subsections = false;
 int ret = 0;
 
-- 
2.34.1




[PATCH] hw/vfio: fix iteration over global VFIODevice list

2023-12-29 Thread Volker Rümelin
Commit 3d779abafe ("vfio/common: Introduce a global VFIODevice list")
introduced a global VFIODevice list, but forgot to update the list
element field name when iterating over the new list. Change the code
to use the correct list element field.

Fixes: 3d779abafe ("vfio/common: Introduce a global VFIODevice list")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2061
Signed-off-by: Volker Rümelin 
---
 hw/vfio/common.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index 08a3e57672..3ba892d7d3 100644
--- a/hw/vfio/common.c
+++ b/hw/vfio/common.c
@@ -74,7 +74,7 @@ bool vfio_mig_active(void)
 return false;
 }
 
-QLIST_FOREACH(vbasedev, &vfio_device_list, next) {
+QLIST_FOREACH(vbasedev, &vfio_device_list, global_next) {
 if (vbasedev->migration_blocker) {
 return false;
 }
@@ -95,7 +95,7 @@ static bool vfio_multiple_devices_migration_is_supported(void)
 unsigned int device_num = 0;
 bool all_support_p2p = true;
 
-QLIST_FOREACH(vbasedev, &vfio_device_list, next) {
+QLIST_FOREACH(vbasedev, &vfio_device_list, global_next) {
 if (vbasedev->migration) {
 device_num++;
 
@@ -1367,13 +1367,13 @@ void vfio_reset_handler(void *opaque)
 {
 VFIODevice *vbasedev;
 
-QLIST_FOREACH(vbasedev, &vfio_device_list, next) {
+QLIST_FOREACH(vbasedev, &vfio_device_list, global_next) {
 if (vbasedev->dev->realized) {
 vbasedev->ops->vfio_compute_needs_reset(vbasedev);
 }
 }
 
-QLIST_FOREACH(vbasedev, &vfio_device_list, next) {
+QLIST_FOREACH(vbasedev, &vfio_device_list, global_next) {
 if (vbasedev->dev->realized && vbasedev->needs_reset) {
 vbasedev->ops->vfio_hot_reset_multi(vbasedev);
 }
-- 
2.35.3




RE: [PATCH 1/3] ui/gtk: flush display pipeline before saving vmstate when blob=true

2023-12-29 Thread Kim, Dongwon
Hi,

> Subject: RE: [PATCH 1/3] ui/gtk: flush display pipeline before saving vmstate
> when blob=true
> 
> Hi,
> 
> >
> > On Thu, Dec 14, 2023 at 8:26 AM Dongwon Kim 
> > wrote:
> > >
> > > If the guest state is paused before it gets a response for the
> > > current scanout frame submission (resource-flush), it won't flush
> > > new frames after being restored as it still waits for the old
> > > response, which is accepted as a scanout render done signal. So it's
> > > needed to unblock the current scanout render pipeline before the run
> > > state is changed to make sure the guest receives the response for
> > > the current frame submission.
> > >
> > > v2: Giving some time for the fence to be signaled before flushing
> > > the pipeline
> > >
> > > Cc: Marc-André Lureau 
> > > Cc: Vivek Kasireddy 
> > > Signed-off-by: Dongwon Kim 
> > > ---
> > >  ui/gtk.c | 19 +++
> > >  1 file changed, 19 insertions(+)
> > >
> > > diff --git a/ui/gtk.c b/ui/gtk.c
> > > index 810d7fc796..ea8d07833e 100644
> > > --- a/ui/gtk.c
> > > +++ b/ui/gtk.c
> > > @@ -678,6 +678,25 @@ static const DisplayGLCtxOps egl_ctx_ops = {
> > > static void gd_change_runstate(void *opaque, bool running, RunState
> > state)
> > >  {
> > >  GtkDisplayState *s = opaque;
> > > +int i;
> > > +
> > > +if (state == RUN_STATE_SAVE_VM) {
> > > +for (i = 0; i < s->nb_vcs; i++) {
> > > +VirtualConsole *vc = &s->vc[i];
> > > +
> > > +if (vc->gfx.guest_fb.dmabuf &&
> > > +vc->gfx.guest_fb.dmabuf->fence_fd >= 0) {
> > > +eglClientWaitSync(qemu_egl_display,
> > > +  vc->gfx.guest_fb.dmabuf->sync,
> > > +  EGL_SYNC_FLUSH_COMMANDS_BIT_KHR,
> > > +  1);
> >
> > This won't work. dmabuf->sync is NULL after egl_dmabuf_create_sync.
> Right, we destroy the sync object after we create the fence from it. If you 
> want
> to use eglClientWaitSync() here, you either need to recreate the sync object
> using fence_fd or don't destroy it in egl_dmabuf_create_fence().
> Either way should be ok but make sure you destroy it when the fence_fd is
> closed.

I guess it makes sense to destroy sync object inside gd_hw_gl_flushed if that 
is the case.
Another thing is I mentioned that "dmabuf == NULL or fence_fd < 0" doesn't seem 
to be checked
in gd_hw_flushed in my previous reply but now I am thinking it is needed 
because gd_hw_gl_flushed
can be called twice with given code change - once when rendering is done and 
the fence is signaled during
eglClientWaitSync and second after eglClientWaitSync. I will come up with a new 
version of patches.
 
> 
> Thanks,
> Vivek
> 
> >
> > I will let Vivek, who wrote the sync code, comment.
> >
> > thanks
> >
> >
> >
> > --
> > Marc-André Lureau


Re: [PATCH] tcg/i386: use 8-bit OR or XOR for unsigned 8-bit immediates

2023-12-29 Thread Paolo Bonzini
Il gio 28 dic 2023, 21:45 Richard Henderson 
ha scritto:

> On 12/28/23 23:05, Paolo Bonzini wrote:
> > In the case where OR or XOR has an 8-bit immediate between 128 and 255,
> we can
> > operate on a low-byte register and shorten the output by two or three
> bytes
> > (two if a prefix byte is needed for REX.B).
> >
> > Signed-off-by: Paolo Bonzini 
> > ---
> >   tcg/i386/tcg-target.c.inc | 7 +++
> >   1 file changed, 7 insertions(+)
>
> At least once upon a time the partial register stall like this was quite
> slow.  IIRC there
> have been improvements in the last couple of generations, but it's still
> slower.
>
> Data to show this is worthwhile?
>

To be honest I simply had noticed that GCC generates it just fine these
days.

However, Agner Fog says that the (previously very high) penalty for partial
register access became just 1 uop starting with the Pentium D, and it's
gone completely except for AH/BH/CH/DH starting with Haswell.

On Atom and AMD processors there's a false dependency on the rest of the
register, but you'd have a (true) dependency anyway for OR r32, imm. The
only case where the false dependency matters is for instructions such as
MOV AL, imm; these have such a dependency on Atom and AMD processors but
not on recent Intel processors.

Paolo


>
> r~
>
> >
> > diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc
> > index 1791b959738..a24a23f43b1 100644
> > --- a/tcg/i386/tcg-target.c.inc
> > +++ b/tcg/i386/tcg-target.c.inc
> > @@ -244,6 +244,7 @@ static bool tcg_target_const_match(int64_t val,
> TCGType type, int ct, int vece)
> >   #define P_VEXL  0x8 /* Set VEX.L = 1 */
> >   #define P_EVEX  0x10/* Requires EVEX encoding */
> >
> > +#define OPC_ARITH_EbIb   (0x80)
> >   #define OPC_ARITH_EvIz  (0x81)
> >   #define OPC_ARITH_EvIb  (0x83)
> >   #define OPC_ARITH_GvEv  (0x03)  /* ... plus (ARITH_FOO <<
> 3) */
> > @@ -1366,6 +1367,12 @@ static void tgen_arithi(TCGContext *s, int c, int
> r0,
> >   tcg_out8(s, val);
> >   return;
> >   }
> > +if (val == (uint8_t)val && (c == ARITH_OR || c == ARITH_XOR) &&
> > +(r0 < 4 || TCG_TARGET_REG_BITS == 64)) {
> > +tcg_out_modrm(s, OPC_ARITH_EbIb + P_REXB_RM, c, r0);
> > +tcg_out8(s, val);
> > +return;
> > +}
> >   if (rexw == 0 || val == (int32_t)val) {
> >   tcg_out_modrm(s, OPC_ARITH_EvIz + rexw, c, r0);
> >   tcg_out32(s, val);
>
>


Re: [PATCH v2] esp: process the result of scsi_device_find()

2023-12-29 Thread Philippe Mathieu-Daudé

Cc'ing Mark.

On 29/12/23 16:26, Alexandra Diupina wrote:

Add a 'current_lun' check for a null value
to avoid null pointer dereferencing and
recover host if NULL return

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 4eb8606560 (esp: store lun coming from the MESSAGE OUT phase)
Signed-off-by: Alexandra Diupina 
---
v2: duplicate the scsi_device_find() logic from esp_select()
  hw/scsi/esp.c | 10 ++
  1 file changed, 10 insertions(+)

diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c
index 9b11d8c573..03fdd53de6 100644
--- a/hw/scsi/esp.c
+++ b/hw/scsi/esp.c
@@ -292,6 +292,16 @@ static void do_command_phase(ESPState *s)
  esp_fifo_pop_buf(&s->cmdfifo, buf, cmdlen);
  
  current_lun = scsi_device_find(&s->bus, 0, s->current_dev->id, s->lun);

+
+if (!current_lun) {
+/* No such drive */
+s->rregs[ESP_RSTAT] = 0;
+s->rregs[ESP_RINTR] = INTR_DC;
+s->rregs[ESP_RSEQ] = SEQ_0;
+esp_raise_irq(s);
+return;
+}
+
  s->current_req = scsi_req_new(current_lun, 0, s->lun, buf, cmdlen, s);
  datalen = scsi_req_enqueue(s->current_req);
  s->ti_size = datalen;





Re: [PATCH v2 4/6] target/riscv: Add pointer masking tb flags

2023-12-29 Thread Alexey Baturo
>Any particular reason to add these in the middle?
No actual reason except for previously those flags were there in the
middle. I'll move them to the end of the list, that sounds reasonable.

>Something to consider as a somewhat unrelated cleanup would be to add an...
That's a good idea and I agree we could do it as part of future clean up.

Thanks, Richard

пт, 29 дек. 2023 г. в 02:33, Richard Henderson :

> On 12/24/23 15:48, Alexey Baturo wrote:
> > From: Alexey Baturo 
> >
> > Signed-off-by: Alexey Baturo 
> > ---
> >   target/riscv/cpu.h| 15 +--
> >   target/riscv/cpu_helper.c |  3 +++
> >   target/riscv/translate.c  |  5 +
> >   3 files changed, 17 insertions(+), 6 deletions(-)
> >
> > diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
> > index c607a94bba..038b86db4b 100644
> > --- a/target/riscv/cpu.h
> > +++ b/target/riscv/cpu.h
> > @@ -538,14 +538,17 @@ FIELD(TB_FLAGS, VILL, 14, 1)
> >   FIELD(TB_FLAGS, VSTART_EQ_ZERO, 15, 1)
> >   /* The combination of MXL/SXL/UXL that applies to the current cpu
> mode. */
> >   FIELD(TB_FLAGS, XL, 16, 2)
> > -FIELD(TB_FLAGS, VTA, 18, 1)
> > -FIELD(TB_FLAGS, VMA, 19, 1)
> > +/* If pointer masking should be applied and address sign extended */
> > +FIELD(TB_FLAGS, PM_PMM, 18, 2)
> > +FIELD(TB_FLAGS, PM_SIGNEXTEND, 20, 1)
> > +FIELD(TB_FLAGS, VTA, 21, 1)
> > +FIELD(TB_FLAGS, VMA, 22, 1)
> >   /* Native debug itrigger */
> > -FIELD(TB_FLAGS, ITRIGGER, 20, 1)
> > +FIELD(TB_FLAGS, ITRIGGER, 23, 1)
> >   /* Virtual mode enabled */
> > -FIELD(TB_FLAGS, VIRT_ENABLED, 21, 1)
> > -FIELD(TB_FLAGS, PRIV, 22, 2)
> > -FIELD(TB_FLAGS, AXL, 24, 2)
> > +FIELD(TB_FLAGS, VIRT_ENABLED, 24, 1)
> > +FIELD(TB_FLAGS, PRIV, 25, 2)
> > +FIELD(TB_FLAGS, AXL, 27, 2)
>
> Any particular reason to add these in the middle?
>
> Something to consider as a somewhat unrelated cleanup would be to add an
> eighth MMUIdx for
> MMUIdx_M + no translation.  This would be used both for MBARE and
> internally within
> get_physical_address for accessing PTEs.  See also the ptw_translate
> cleanups in
> target/i386 for atomic PTE updates (4a1e9d4d11cd).
>
> At which point PM_SIGNEXTEND can be replaced by a test vs mmu_idx, saving
> a bit in tb_flags.
>
> Something for later, anyway.
>
>
> r~
>


[PATCH v3 3/3] hw/arm: Connect STM32L4x5 SYSCFG to STM32L4x5 SoC

2023-12-29 Thread Inès Varhol
The SYSCFG input GPIOs aren't connected yet. When the STM32L4x5 GPIO
device will be implemented, its output GPIOs will be connected to the
SYSCFG input GPIOs.

Signed-off-by: Arnaud Minier 
Signed-off-by: Inès Varhol 
---
 hw/arm/Kconfig |  1 +
 hw/arm/stm32l4x5_soc.c | 23 ++-
 include/hw/arm/stm32l4x5_soc.h |  2 ++
 3 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
index 9c9d5bb541..e7c9470d59 100644
--- a/hw/arm/Kconfig
+++ b/hw/arm/Kconfig
@@ -458,6 +458,7 @@ config STM32L4X5_SOC
 bool
 select ARM_V7M
 select OR_IRQ
+select STM32L4X5_SYSCFG
 select STM32L4X5_EXTI
 
 config XLNX_ZYNQMP_ARM
diff --git a/hw/arm/stm32l4x5_soc.c b/hw/arm/stm32l4x5_soc.c
index 08b8a4c2ed..0581f4ce30 100644
--- a/hw/arm/stm32l4x5_soc.c
+++ b/hw/arm/stm32l4x5_soc.c
@@ -37,6 +37,7 @@
 #define SRAM2_SIZE (32 * KiB)
 
 #define EXTI_ADDR 0x40010400
+#define SYSCFG_ADDR 0x4001
 
 #define NUM_EXTI_IRQ 40
 /* Match exti line connections with their CPU IRQ number */
@@ -81,6 +82,8 @@ static void stm32l4x5_soc_initfn(Object *obj)
 
 object_initialize_child(obj, "exti", &s->exti, TYPE_STM32L4X5_EXTI);
 
+object_initialize_child(obj, "syscfg", &s->syscfg, TYPE_STM32L4X5_SYSCFG);
+
 s->sysclk = qdev_init_clock_in(DEVICE(s), "sysclk", NULL, NULL, 0);
 s->refclk = qdev_init_clock_in(DEVICE(s), "refclk", NULL, NULL, 0);
 }
@@ -158,6 +161,20 @@ static void stm32l4x5_soc_realize(DeviceState *dev_soc, 
Error **errp)
 return;
 }
 
+/* System configuration controller */
+dev = DEVICE(&s->syscfg);
+if (!sysbus_realize(SYS_BUS_DEVICE(&s->syscfg), errp)) {
+return;
+}
+busdev = SYS_BUS_DEVICE(dev);
+sysbus_mmio_map(busdev, 0, SYSCFG_ADDR);
+/*
+ * TODO: when the GPIO device is implemented, connect it
+ * to SYCFG using `qdev_connect_gpio_out`, NUM_GPIOS and
+ * GPIO_NUM_PINS.
+ */
+
+/* EXTI device */
 dev = DEVICE(&s->exti);
 if (!sysbus_realize(SYS_BUS_DEVICE(&s->exti), errp)) {
 return;
@@ -168,6 +185,11 @@ static void stm32l4x5_soc_realize(DeviceState *dev_soc, 
Error **errp)
 sysbus_connect_irq(busdev, i, qdev_get_gpio_in(armv7m, exti_irq[i]));
 }
 
+for (i = 0; i < 16; i++) {
+qdev_connect_gpio_out(DEVICE(&s->syscfg), i,
+  qdev_get_gpio_in(dev, i));
+}
+
 /* APB1 BUS */
 create_unimplemented_device("TIM2",  0x4000, 0x400);
 create_unimplemented_device("TIM3",  0x4400, 0x400);
@@ -205,7 +227,6 @@ static void stm32l4x5_soc_realize(DeviceState *dev_soc, 
Error **errp)
 /* RESERVED:0x40009800, 0x6800 */
 
 /* APB2 BUS */
-create_unimplemented_device("SYSCFG",0x4001, 0x30);
 create_unimplemented_device("VREFBUF",   0x40010030, 0x1D0);
 create_unimplemented_device("COMP",  0x40010200, 0x200);
 /* RESERVED:0x40010800, 0x1400 */
diff --git a/include/hw/arm/stm32l4x5_soc.h b/include/hw/arm/stm32l4x5_soc.h
index 6cba566a31..04b1151eed 100644
--- a/include/hw/arm/stm32l4x5_soc.h
+++ b/include/hw/arm/stm32l4x5_soc.h
@@ -28,6 +28,7 @@
 #include "qemu/units.h"
 #include "hw/qdev-core.h"
 #include "hw/arm/armv7m.h"
+#include "hw/misc/stm32l4x5_syscfg.h"
 #include "hw/misc/stm32l4x5_exti.h"
 #include "qom/object.h"
 
@@ -43,6 +44,7 @@ struct Stm32l4x5SocState {
 ARMv7MState armv7m;
 
 Stm32l4x5ExtiState exti;
+Stm32l4x5SyscfgState syscfg;
 
 MemoryRegion sram1;
 MemoryRegion sram2;
-- 
2.43.0




[PATCH v3 1/3] hw/misc: Implement STM32L4x5 SYSCFG

2023-12-29 Thread Inès Varhol
Signed-off-by: Arnaud Minier 
Signed-off-by: Inès Varhol 
---
 docs/system/arm/b-l475e-iot01a.rst |   2 +-
 hw/misc/Kconfig|   3 +
 hw/misc/meson.build|   1 +
 hw/misc/stm32l4x5_syscfg.c | 265 +
 hw/misc/trace-events   |   6 +
 include/hw/misc/stm32l4x5_syscfg.h |  54 ++
 6 files changed, 330 insertions(+), 1 deletion(-)
 create mode 100644 hw/misc/stm32l4x5_syscfg.c
 create mode 100644 include/hw/misc/stm32l4x5_syscfg.h

diff --git a/docs/system/arm/b-l475e-iot01a.rst 
b/docs/system/arm/b-l475e-iot01a.rst
index 72f256ace7..1a021b306a 100644
--- a/docs/system/arm/b-l475e-iot01a.rst
+++ b/docs/system/arm/b-l475e-iot01a.rst
@@ -16,6 +16,7 @@ Currently B-L475E-IOT01A machine's only supports the 
following devices:
 
 - Cortex-M4F based STM32L4x5 SoC
 - STM32L4x5 EXTI (Extended interrupts and events controller)
+- STM32L4x5 SYSCFG (System configuration controller)
 
 Missing devices
 """
@@ -24,7 +25,6 @@ The B-L475E-IOT01A does *not* support the following devices:
 
 - Reset and clock control (RCC)
 - Serial ports (UART)
-- System configuration controller (SYSCFG)
 - General-purpose I/Os (GPIO)
 - Analog to Digital Converter (ADC)
 - SPI controller
diff --git a/hw/misc/Kconfig b/hw/misc/Kconfig
index 3efe3dc2cc..4fc6b29b43 100644
--- a/hw/misc/Kconfig
+++ b/hw/misc/Kconfig
@@ -90,6 +90,9 @@ config STM32F4XX_EXTI
 config STM32L4X5_EXTI
 bool
 
+config STM32L4X5_SYSCFG
+bool
+
 config MIPS_ITU
 bool
 
diff --git a/hw/misc/meson.build b/hw/misc/meson.build
index 16db6e228d..2ca2ce4b62 100644
--- a/hw/misc/meson.build
+++ b/hw/misc/meson.build
@@ -111,6 +111,7 @@ system_ss.add(when: 'CONFIG_STM32F2XX_SYSCFG', if_true: 
files('stm32f2xx_syscfg.
 system_ss.add(when: 'CONFIG_STM32F4XX_SYSCFG', if_true: 
files('stm32f4xx_syscfg.c'))
 system_ss.add(when: 'CONFIG_STM32F4XX_EXTI', if_true: 
files('stm32f4xx_exti.c'))
 system_ss.add(when: 'CONFIG_STM32L4X5_EXTI', if_true: 
files('stm32l4x5_exti.c'))
+system_ss.add(when: 'CONFIG_STM32L4X5_SYSCFG', if_true: 
files('stm32l4x5_syscfg.c'))
 system_ss.add(when: 'CONFIG_MPS2_FPGAIO', if_true: files('mps2-fpgaio.c'))
 system_ss.add(when: 'CONFIG_MPS2_SCC', if_true: files('mps2-scc.c'))
 
diff --git a/hw/misc/stm32l4x5_syscfg.c b/hw/misc/stm32l4x5_syscfg.c
new file mode 100644
index 00..36ac8956f9
--- /dev/null
+++ b/hw/misc/stm32l4x5_syscfg.c
@@ -0,0 +1,265 @@
+/*
+ * STM32L4x5 SYSCFG (System Configuration Controller)
+ *
+ * Copyright (c) 2023 Arnaud Minier 
+ * Copyright (c) 2023 Inès Varhol 
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ *
+ * This work is based on the stm32f4xx_syscfg by Alistair Francis.
+ * Original code is licensed under the MIT License:
+ *
+ * Copyright (c) 2014 Alistair Francis 
+ */
+
+/*
+ * The reference used is the STMicroElectronics RM0351 Reference manual
+ * for STM32L4x5 and STM32L4x6 advanced Arm ® -based 32-bit MCUs.
+ * 
https://www.st.com/en/microcontrollers-microprocessors/stm32l4x5/documentation.html
+ */
+
+#include "qemu/osdep.h"
+#include "qemu/log.h"
+#include "trace.h"
+#include "hw/irq.h"
+#include "migration/vmstate.h"
+#include "hw/misc/stm32l4x5_syscfg.h"
+
+#define SYSCFG_MEMRMP 0x00
+#define SYSCFG_CFGR1 0x04
+#define SYSCFG_EXTICR1 0x08
+#define SYSCFG_EXTICR2 0x0C
+#define SYSCFG_EXTICR3 0x10
+#define SYSCFG_EXTICR4 0x14
+#define SYSCFG_SCSR 0x18
+#define SYSCFG_CFGR2 0x1C
+#define SYSCFG_SWPR 0x20
+#define SYSCFG_SKR 0x24
+#define SYSCFG_SWPR2 0x28
+
+/* __0001_0111 */
+#define ACTIVABLE_BITS_MEMRP 0x0107
+
+/* 1100__0001_ */
+#define ACTIVABLE_BITS_CFGR1 0xFCFF0100
+/* ___0001 */
+#define FIREWALL_DISABLE_CFGR1 0x0001
+
+/* ___ */
+#define ACTIVABLE_BITS_EXTICR 0x
+
+/* ___0011 */
+/* #define ACTIVABLE_BITS_SCSR 0x0003 */
+
+/* ___ */
+#define ECC_LOCK_CFGR2 0x000F
+/* __0001_ */
+#define SRAM2_PARITY_ERROR_FLAG_CFGR2 0x0100
+
+/* ___ */
+#define ACTIVABLE_BITS_SKR 0x00FF
+
+static void stm32l4x5_syscfg_hold_reset(Object *obj)
+{
+Stm32l4x5SyscfgState *s = STM32L4X5_SYSCFG(obj);
+
+s->memrmp = 0x;
+s->cfgr1 = 0x7C01;
+s->exticr[0] = 0x;
+s->exticr[1] = 0x;
+s->exticr[2] = 0x;
+s->exticr[3] = 0x;
+s->scsr = 0x;
+s->cfgr2 = 0x;
+s->swpr = 0x;
+s->skr = 0x;
+s->swpr2 = 0x;
+}
+
+static void stm32l4x5_syscfg_set_irq(void *opaque, int irq, int level)
+{
+Stm32l4x5SyscfgState *s = opaque;
+uint8_t gpio = irq / GPIO_NUM_PINS;
+g_assert(gpio < NUM_GPIOS);
+
+int line = irq % G

[PATCH v3 2/3] tests/qtest: Add STM32L4x5 SYSCFG QTest testcase

2023-12-29 Thread Inès Varhol
Acked-by: Alistair Francis 

Signed-off-by: Arnaud Minier 
Signed-off-by: Inès Varhol 
---
 tests/qtest/meson.build |   3 +-
 tests/qtest/stm32l4x5_syscfg-test.c | 408 
 2 files changed, 410 insertions(+), 1 deletion(-)
 create mode 100644 tests/qtest/stm32l4x5_syscfg-test.c

diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
index d5126f4d86..a2213d60b3 100644
--- a/tests/qtest/meson.build
+++ b/tests/qtest/meson.build
@@ -196,7 +196,8 @@ qtests_aspeed = \
'aspeed_gpio-test']
 
 qtests_stm32l4x5 = \
-  ['stm32l4x5_exti-test']
+  ['stm32l4x5_exti-test',
+   'stm32l4x5_syscfg-test']
 
 qtests_arm = \
   (config_all_devices.has_key('CONFIG_MPS2') ? ['sse-timer-test'] : []) + \
diff --git a/tests/qtest/stm32l4x5_syscfg-test.c 
b/tests/qtest/stm32l4x5_syscfg-test.c
new file mode 100644
index 00..3edd13b222
--- /dev/null
+++ b/tests/qtest/stm32l4x5_syscfg-test.c
@@ -0,0 +1,408 @@
+/*
+ * QTest testcase for STM32L4x5_SYSCFG
+ *
+ * Copyright (c) 2023 Arnaud Minier 
+ * Copyright (c) 2023 Inès Varhol 
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include "qemu/osdep.h"
+#include "libqtest-single.h"
+
+#define SYSCFG_BASE_ADDR 0x4001
+#define SYSCFG_MEMRMP 0x00
+#define SYSCFG_CFGR1 0x04
+#define SYSCFG_EXTICR1 0x08
+#define SYSCFG_EXTICR2 0x0C
+#define SYSCFG_EXTICR3 0x10
+#define SYSCFG_EXTICR4 0x14
+#define SYSCFG_SCSR 0x18
+#define SYSCFG_CFGR2 0x1C
+#define SYSCFG_SWPR 0x20
+#define SYSCFG_SKR 0x24
+#define SYSCFG_SWPR2 0x28
+#define INVALID_ADDR 0x2C
+
+#define EXTI_BASE_ADDR 0x40010400
+#define EXTI_IMR1 0x00
+#define EXTI_RTSR1 0x08
+#define EXTI_FTSR1 0x0C
+
+static void syscfg_writel(unsigned int offset, uint32_t value)
+{
+writel(SYSCFG_BASE_ADDR + offset, value);
+}
+
+static uint32_t syscfg_readl(unsigned int offset)
+{
+return readl(SYSCFG_BASE_ADDR + offset);
+}
+
+static void exti_writel(unsigned int offset, uint32_t value)
+{
+writel(EXTI_BASE_ADDR + offset, value);
+}
+
+static void system_reset(void)
+{
+QDict *response;
+response = qtest_qmp(global_qtest, "{'execute': 'system_reset'}");
+g_assert(qdict_haskey(response, "return"));
+qobject_unref(response);
+}
+
+static void test_reset(void)
+{
+/*
+ * Test that registers are initialized at the correct values
+ */
+const uint32_t memrmp = syscfg_readl(SYSCFG_MEMRMP);
+g_assert_cmpuint(memrmp, ==, 0x);
+
+const uint32_t cfgr1 = syscfg_readl(SYSCFG_CFGR1);
+g_assert_cmpuint(cfgr1, ==, 0x7C01);
+
+const uint32_t exticr1 = syscfg_readl(SYSCFG_EXTICR1);
+g_assert_cmpuint(exticr1, ==, 0x);
+
+const uint32_t exticr2 = syscfg_readl(SYSCFG_EXTICR2);
+g_assert_cmpuint(exticr2, ==, 0x);
+
+const uint32_t exticr3 = syscfg_readl(SYSCFG_EXTICR3);
+g_assert_cmpuint(exticr3, ==, 0x);
+
+const uint32_t exticr4 = syscfg_readl(SYSCFG_EXTICR4);
+g_assert_cmpuint(exticr4, ==, 0x);
+
+const uint32_t scsr = syscfg_readl(SYSCFG_SCSR);
+g_assert_cmpuint(scsr, ==, 0x);
+
+const uint32_t cfgr2 = syscfg_readl(SYSCFG_CFGR2);
+g_assert_cmpuint(cfgr2, ==, 0x);
+
+const uint32_t swpr = syscfg_readl(SYSCFG_SWPR);
+g_assert_cmpuint(swpr, ==, 0x);
+
+const uint32_t skr = syscfg_readl(SYSCFG_SKR);
+g_assert_cmpuint(skr, ==, 0x);
+
+const uint32_t swpr2 = syscfg_readl(SYSCFG_SWPR2);
+g_assert_cmpuint(swpr2, ==, 0x);
+}
+
+static void test_reserved_bits(void)
+{
+/*
+ * Test that reserved bits stay at reset value
+ * (which is 0 for all of them) by writing '1'
+ * in all reserved bits (keeping reset value for
+ * other bits) and checking that the
+ * register is still at reset value
+ */
+syscfg_writel(SYSCFG_MEMRMP, 0xFEF8);
+const uint32_t memrmp = syscfg_readl(SYSCFG_MEMRMP);
+g_assert_cmpuint(memrmp, ==, 0x);
+
+syscfg_writel(SYSCFG_CFGR1, 0x7F00FEFF);
+const uint32_t cfgr1 = syscfg_readl(SYSCFG_CFGR1);
+g_assert_cmpuint(cfgr1, ==, 0x7C01);
+
+syscfg_writel(SYSCFG_EXTICR1, 0x);
+const uint32_t exticr1 = syscfg_readl(SYSCFG_EXTICR1);
+g_assert_cmpuint(exticr1, ==, 0x);
+
+syscfg_writel(SYSCFG_EXTICR2, 0x);
+const uint32_t exticr2 = syscfg_readl(SYSCFG_EXTICR2);
+g_assert_cmpuint(exticr2, ==, 0x);
+
+syscfg_writel(SYSCFG_EXTICR3, 0x);
+const uint32_t exticr3 = syscfg_readl(SYSCFG_EXTICR3);
+g_assert_cmpuint(exticr3, ==, 0x);
+
+syscfg_writel(SYSCFG_EXTICR4, 0x);
+const uint32_t exticr4 = syscfg_readl(SYSCFG_EXTICR4);
+g_assert_cmpuint(exticr4, ==, 0x);
+
+syscfg_writel(SYSCFG_SKR, 0xFF00);
+const uint32_t skr = syscfg_readl(SYSCFG_SKR);
+g_assert_cmpuint(skr, ==, 0x);
+}
+
+static void test_set_and_clear(void)

[PATCH v3 0/3] Add device STM32L4x5 SYSCFG

2023-12-29 Thread Inès Varhol
Changes from v2 to v3:
- updating the B-L475E-IOT01A machine's documentation file
- using `GPIO_NUM_PINS` instead of 16 in `stm32l4x5_syscfg_init`
- correcting the formatting of multiline indents
- renaming a trace function (`trace_stm32l4x5_syscfg_forward_exti`
instead of `trace_stm32l4x5_syscfg_pulse_exti`)

Changes from v1 to v2:
- explain in 3rd commit why SYSCFG input GPIOs aren't connected and add
a TODO comment in stm32l4x5_soc.c
- use macros `NUM_GPIOS` and `GPIO_NUM_PINS` in
`stm32l4x5_syscfg_set_irq`
- rename STM32L4XX to STM32L4X5, Stm32l4xx to Stm32l4x5
(the SYSCFG implementation is only valid for STM32L4x5 and STM32L4x6
but not for STM32L41xx/42xx/43xx/44xx)
- refactor `STM32L4x5SyscfgState` to `Stm32l4x5SyscfgState` to be
consistent with other peripherals

Based-on: <20231228161944.303768-1-ines.var...@telecom-paris.fr>
([PATCH v5 0/3] Add device STM32L4x5 EXTI)

Signed-off-by: Arnaud Minier 
Signed-off-by: Inès Varhol 

Inès Varhol (3):
  hw/misc: Implement STM32L4x5 SYSCFG
  tests/qtest: Add STM32L4x5 SYSCFG QTest testcase
  hw/arm: Connect STM32L4x5 SYSCFG to STM32L4x5 SoC

 docs/system/arm/b-l475e-iot01a.rst  |   2 +-
 hw/arm/Kconfig  |   1 +
 hw/arm/stm32l4x5_soc.c  |  23 +-
 hw/misc/Kconfig |   3 +
 hw/misc/meson.build |   1 +
 hw/misc/stm32l4x5_syscfg.c  | 265 ++
 hw/misc/trace-events|   6 +
 include/hw/arm/stm32l4x5_soc.h  |   2 +
 include/hw/misc/stm32l4x5_syscfg.h  |  54 
 tests/qtest/meson.build |   3 +-
 tests/qtest/stm32l4x5_syscfg-test.c | 408 
 11 files changed, 765 insertions(+), 3 deletions(-)
 create mode 100644 hw/misc/stm32l4x5_syscfg.c
 create mode 100644 include/hw/misc/stm32l4x5_syscfg.h
 create mode 100644 tests/qtest/stm32l4x5_syscfg-test.c

-- 
2.43.0




Re: [PATCH v4 21/21] tests: Add parallels format support to image-fleecing

2023-12-29 Thread Vladimir Sementsov-Ogievskiy

On 28.12.23 13:12, Alexander Ivanov wrote:

Use a different bitmap name for parallels images because their has own ID
format, and can't contain an arbitrary string.

Replace hardcoded 'qcow2' format to iotests.imgfmt.

Add 'parallels' to supported formats.

Signed-off-by: Alexander Ivanov


Reviewed-by: Vladimir Sementsov-Ogievskiy 

--
Best regards,
Vladimir




Re: [PATCH] blockcommit: Reopen base image as RO after abort

2023-12-29 Thread Vladimir Sementsov-Ogievskiy

On 30.11.23 13:11, Alexander Ivanov wrote:

If a blockcommit is aborted the base image remains in RW mode, that leads
to a fail of subsequent live migration.

How to reproduce:
   $ virsh snapshot-create-as vm snp1 --disk-only

   *** write something to the disk ***

   $ virsh blockcommit vm vda --active --shallow && virsh blockjob vm vda 
--abort
   $ lsof /vzt/vm.qcow2
   COMMAND  PID USER   FD   TYPE DEVICE   SIZE/OFF NODE NAME
   qemu-syst 433203 root   45u   REG  253,0 1724776448  133 /vzt/vm.qcow2
   $ cat /proc/433203/fdinfo/45
   pos:0
   flags:  02140002

Reopen the base image in RO mode in mirror_exit_common() if the blockjob
is aborted.

Signed-off-by: Alexander Ivanov 
---
  block/mirror.c | 4 
  1 file changed, 4 insertions(+)

diff --git a/block/mirror.c b/block/mirror.c
index dcd88de2e3..50a2825b1c 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -789,6 +789,10 @@ static int mirror_exit_common(Job *job)
  block_job_remove_all_bdrv(bjob);
  bdrv_replace_node(mirror_top_bs, mirror_top_bs->backing->bs, 
&error_abort);
  
+if (abort && !bdrv_is_read_only(target_bs)) {


I think, we also should check here, that we did 
bdrv_reopen_set_read_only(false) at job start (probably we didn't, or we are in 
mirror job)


+bdrv_reopen_set_read_only(target_bs, true, NULL);
+}
+
  bs_opaque->job = NULL;
  
  bdrv_drained_end(src);


--
Best regards,
Vladimir




Re: [PULL 31/53] hw/i386/pc: Default to use SMBIOS 3.0 for newer machine models

2023-12-29 Thread Michael S. Tsirkin
On Fri, Dec 29, 2023 at 04:35:14PM +0100, Igor Mammedov wrote:
> On Thu, 30 Nov 2023 12:22:37 +0100
> Igor Mammedov  wrote:
> 
> > On Wed, 29 Nov 2023 11:01:07 +0100
> > Igor Mammedov  wrote:
> > 
> > > On Tue, 28 Nov 2023 11:00:29 -0500
> > > "Michael S. Tsirkin"  wrote:
> > >   
> > > > On Tue, Nov 28, 2023 at 03:53:21PM +0100, Fiona Ebner wrote:
> > > > > Am 28.11.23 um 15:13 schrieb Daniel P. Berrangé:  
> > > > > > On Tue, Nov 28, 2023 at 02:57:17PM +0100, Fiona Ebner wrote:  
> > > > > >> we received some reports about the new default causing issues for
> > > > > >> certain guest OSes [0][1]. Namely, for Juniper vSRX, where boot 
> > > > > >> fails
> > > > > >> and Microsoft Windows, where querying an UUID set via QEMU cmdline
> > > > > >> -smbios 'type=1,uuid=a4656bd0-a07d-48e0-9dfd-bdc84667a8d0'
> > > > > >> in Powershell with
> > > > > >> get-wmiobject win32_computersystemproduct | Select-Object
> > > > > >> -expandProperty UUID
> > > > > >> doesn't return any value anymore and can trip up some guest
> > > > > >> applications. The original report is about Windows 10 and I 
> > > > > >> reproduced
> > > > > >> this with Windows Server 2019 and the German (but I hope it doesn't
> > > > > >> matter this time) version of Windows Server 2022.
> > > > > >>
> > > > > >> Using machine type 8.0 or the machine option 
> > > > > >> smbios-entry-point-type=32
> > > > > >> are workarounds.
> > > > > >>
> > > > > >> Since Windows is widely used, that seems a bit unfortunate. Just 
> > > > > >> wanted
> > > > > >> to ask if you are aware of the issue and if there is something 
> > > > > >> else that
> > > > > >> can be done other than specifying the more specific machine 
> > > > > >> commandline
> > > > > >> for those OSes?  
> > > > > > 
> > > > > > I don't recall seeing this issue mentioned before. Could you file a
> > > > > > bug at https://gitlab.com/qemu-project/qemu
> > > > > >   
> > > > > 
> > > > > I made one for the Windows issue:
> > > > > https://gitlab.com/qemu-project/qemu/-/issues/2008
> > > > > 
> > > > > It's not clear to me if this is a bug in QEMU or just a bug/limitation
> > > > > of the guest OS when 64 bit entry is used by SMBIOS.
> > > > > 
> > > > > I didn't create one for vSRX, because I'm not using it myself and 
> > > > > since
> > > > > it's based on FreeBSD and FreeBSD 13.1 can boot just fine with both 32
> > > > > and 64 bit entry, it might be an issue on their side.
> > > > > 
> > > > > Best Regards,
> > > > > Fiona  
> > > > 
> > > > I would be inclined to limit this to when we have too many VCPUs then.
> > > > Igor WDYT?
> > > 
> > > Let me try to reproduce and see if Windows debug logs would provide some 
> > > clue.  
> > 
> > Nothing notable in debug output on Windows side, but it looks like Windows
> > doesn't see SMBIOS tables at all.
> > 
> > However it affects VMs with Seabios only, UEFI based VMs work just fine.
> > My guess would be it's not QEMU issue, but Seabios one.
> > I'm still looking at it,
> > but CCing Gerd, who might have an idea what's going wrong from firmware 
> > pov. 
> > 
> 
> So running Seabios VM with Win10 as a guest under debugger
> (set access breakpoint on SMBIOS anchor string), one can see
> that Windows doesn't look for _SM3_ signature during lookup
> at all. While after some convincing and making make lookup
> code return SMBIOS 3.x entrypoint, the rest of Windows handles
> SMBIOS 3.x just fine and shows UUID /using Fiona's reproducer/.
> 
> So it's bug in Windows.
> 
> As for qemu, I'd guess we'd just have to live with it until MS
> fixes it and even after that it won't help with unsupported versions
> as they are not likely to get fix.
> 
> To that effect, we have 3 options:
>1. make mgmt force 32bit entry point if they are starting Windows VM
>2. unconditionally switch pc|q35 9.0+ machine types to 32bit entry point
>   and error out if configuration doesn't fit into SMBIOS 2.0 tables
>   (easiest from QEMU pov)
>3. introduce 'auto' value for smbios entry point option, and then
>   try to stick with 32bit entry point while it is usable
>   (cpu count < 256 and tables still fit in guest's FSEG RAM).
>   When that fails switch dynamically to 64bit entry point.
> 
> Any opinions on preferable route?
> 
> I'm looking into my least favorite option 3 atm, and it's pretty messy
> with current SMBIOS code and needs quite a bit of cleanup.

I like 3 as the least disruptive ... but UEFI works do you know why?


-- 
MST




Re: [PULL 31/53] hw/i386/pc: Default to use SMBIOS 3.0 for newer machine models

2023-12-29 Thread Igor Mammedov
On Thu, 30 Nov 2023 12:22:37 +0100
Igor Mammedov  wrote:

> On Wed, 29 Nov 2023 11:01:07 +0100
> Igor Mammedov  wrote:
> 
> > On Tue, 28 Nov 2023 11:00:29 -0500
> > "Michael S. Tsirkin"  wrote:
> >   
> > > On Tue, Nov 28, 2023 at 03:53:21PM +0100, Fiona Ebner wrote:
> > > > Am 28.11.23 um 15:13 schrieb Daniel P. Berrangé:  
> > > > > On Tue, Nov 28, 2023 at 02:57:17PM +0100, Fiona Ebner wrote:  
> > > > >> we received some reports about the new default causing issues for
> > > > >> certain guest OSes [0][1]. Namely, for Juniper vSRX, where boot fails
> > > > >> and Microsoft Windows, where querying an UUID set via QEMU cmdline
> > > > >> -smbios 'type=1,uuid=a4656bd0-a07d-48e0-9dfd-bdc84667a8d0'
> > > > >> in Powershell with
> > > > >> get-wmiobject win32_computersystemproduct | Select-Object
> > > > >> -expandProperty UUID
> > > > >> doesn't return any value anymore and can trip up some guest
> > > > >> applications. The original report is about Windows 10 and I 
> > > > >> reproduced
> > > > >> this with Windows Server 2019 and the German (but I hope it doesn't
> > > > >> matter this time) version of Windows Server 2022.
> > > > >>
> > > > >> Using machine type 8.0 or the machine option 
> > > > >> smbios-entry-point-type=32
> > > > >> are workarounds.
> > > > >>
> > > > >> Since Windows is widely used, that seems a bit unfortunate. Just 
> > > > >> wanted
> > > > >> to ask if you are aware of the issue and if there is something else 
> > > > >> that
> > > > >> can be done other than specifying the more specific machine 
> > > > >> commandline
> > > > >> for those OSes?  
> > > > > 
> > > > > I don't recall seeing this issue mentioned before. Could you file a
> > > > > bug at https://gitlab.com/qemu-project/qemu
> > > > >   
> > > > 
> > > > I made one for the Windows issue:
> > > > https://gitlab.com/qemu-project/qemu/-/issues/2008
> > > > 
> > > > It's not clear to me if this is a bug in QEMU or just a bug/limitation
> > > > of the guest OS when 64 bit entry is used by SMBIOS.
> > > > 
> > > > I didn't create one for vSRX, because I'm not using it myself and since
> > > > it's based on FreeBSD and FreeBSD 13.1 can boot just fine with both 32
> > > > and 64 bit entry, it might be an issue on their side.
> > > > 
> > > > Best Regards,
> > > > Fiona  
> > > 
> > > I would be inclined to limit this to when we have too many VCPUs then.
> > > Igor WDYT?
> > 
> > Let me try to reproduce and see if Windows debug logs would provide some 
> > clue.  
> 
> Nothing notable in debug output on Windows side, but it looks like Windows
> doesn't see SMBIOS tables at all.
> 
> However it affects VMs with Seabios only, UEFI based VMs work just fine.
> My guess would be it's not QEMU issue, but Seabios one.
> I'm still looking at it,
> but CCing Gerd, who might have an idea what's going wrong from firmware pov. 
> 

So running Seabios VM with Win10 as a guest under debugger
(set access breakpoint on SMBIOS anchor string), one can see
that Windows doesn't look for _SM3_ signature during lookup
at all. While after some convincing and making make lookup
code return SMBIOS 3.x entrypoint, the rest of Windows handles
SMBIOS 3.x just fine and shows UUID /using Fiona's reproducer/.

So it's bug in Windows.

As for qemu, I'd guess we'd just have to live with it until MS
fixes it and even after that it won't help with unsupported versions
as they are not likely to get fix.

To that effect, we have 3 options:
   1. make mgmt force 32bit entry point if they are starting Windows VM
   2. unconditionally switch pc|q35 9.0+ machine types to 32bit entry point
  and error out if configuration doesn't fit into SMBIOS 2.0 tables
  (easiest from QEMU pov)
   3. introduce 'auto' value for smbios entry point option, and then
  try to stick with 32bit entry point while it is usable
  (cpu count < 256 and tables still fit in guest's FSEG RAM).
  When that fails switch dynamically to 64bit entry point.

Any opinions on preferable route?

I'm looking into my least favorite option 3 atm, and it's pretty messy
with current SMBIOS code and needs quite a bit of cleanup.




[PATCH v2] esp: process the result of scsi_device_find()

2023-12-29 Thread Alexandra Diupina
Add a 'current_lun' check for a null value
to avoid null pointer dereferencing and
recover host if NULL return

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 4eb8606560 (esp: store lun coming from the MESSAGE OUT phase)
Signed-off-by: Alexandra Diupina 
---
v2: duplicate the scsi_device_find() logic from esp_select()
 hw/scsi/esp.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c
index 9b11d8c573..03fdd53de6 100644
--- a/hw/scsi/esp.c
+++ b/hw/scsi/esp.c
@@ -292,6 +292,16 @@ static void do_command_phase(ESPState *s)
 esp_fifo_pop_buf(&s->cmdfifo, buf, cmdlen);
 
 current_lun = scsi_device_find(&s->bus, 0, s->current_dev->id, s->lun);
+
+if (!current_lun) {
+/* No such drive */
+s->rregs[ESP_RSTAT] = 0;
+s->rregs[ESP_RINTR] = INTR_DC;
+s->rregs[ESP_RSEQ] = SEQ_0;
+esp_raise_irq(s);
+return;
+}
+
 s->current_req = scsi_req_new(current_lun, 0, s->lun, buf, cmdlen, s);
 datalen = scsi_req_enqueue(s->current_req);
 s->ti_size = datalen;
-- 
2.30.2




Re: Qemu setting "-cpu host" seems broken with Windows vms

2023-12-29 Thread Stefan Hajnoczi
On Thu, 28 Dec 2023 at 17:21,  wrote:

CCing Paolo, the general x86 maintainer.

Stefan

> I noticed something weird when using "-cpu host" with Windows vms.
> First, I always use it along with ",hv_passthrough" as well.
>
> First, performance: since some years ago, since prior to qemu 6.2 until
> latest 8.2, win10 and win11 vms always worked slower than expected. This
> could be noticed by comparing booting/starting times between vm and a
> bare metal installation, but I particularly measured it when installing
> windows cumulative updates through windows update. On vm, from
> downloading to finishing rebooting it always took 1.5 circa 1.5 hours,
> while just 40 minutes on bare metal.
>
> Second, and more recently, newer windows 11 23h2 seems to have big
> problem with "-cpu host".
> When trying to update from 22h2 to 23h2 I got either black screen or
> bsod after trying to reboot.
> Also, same result when trying to install 23h2 from scratch.
> This on qemu 7.1 and 8.2.
> Did a long search, and finally found the cause which also solved the
> problem for me:
> https://forum.proxmox.com/threads/new-windows-11-vm-fails-boot-after-update.137543/
> I found similar problems and similar solution in other forums as well.
>
> So in my case, physical host cpu is intel core 11th gen; tried using
> libvirt's "virsh capabilities" to see which qemu cpu model better
> matched, and for some reason it gave Broadwell instead of newer
> Skylake...
> Anyway, tried with "-cpu ,hv_passthrough", and this
> solved *both* problems: performance finally matched bare metal in all
> aspects, and the windows 23h2 problem was finally gone.
>
> On IRC, it was suggested to try "-cpu host" and "disabling CPU bits" one
> by one until finding the culprit. But I don't know how to do this...
>
> Could someone look into this?
> Thanks.
>



[PATCH v2 0/4] target/riscv: SMBIOS support for RISC-V virt machine

2023-12-29 Thread Heinrich Schuchardt
Generate SMBIOS tables for the RISC-V mach-virt.
Add CONFIG_SMBIOS=y to the RISC-V default config.

With the series the following firmware tables are provided:

etc/smbios/smbios-anchor
etc/smbios/smbios-tables

Add processor-family to the '-smbios type=4' command line options.

Heinrich Schuchardt (4):
  smbios: add processor-family option
  smbios: function to set default processor family
  target/riscv: SMBIOS support for RISC-V virt machine
  qemu-options: enable -smbios option on RISC-V

 hw/riscv/Kconfig |  1 +
 hw/riscv/virt.c  | 42 
 hw/smbios/smbios.c   | 20 ++--
 include/hw/firmware/smbios.h |  1 +
 qemu-options.hx  |  6 +++---
 5 files changed, 65 insertions(+), 5 deletions(-)

-- 
2.43.0




[PATCH v2 2/4] smbios: function to set default processor family

2023-12-29 Thread Heinrich Schuchardt
Provide a function to set the default processor family.

Signed-off-by: Heinrich Schuchardt 
---
v2:
new patch
---
 hw/smbios/smbios.c   | 7 +++
 include/hw/firmware/smbios.h | 1 +
 2 files changed, 8 insertions(+)

diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
index 647bc6d603..03fe736565 100644
--- a/hw/smbios/smbios.c
+++ b/hw/smbios/smbios.c
@@ -989,6 +989,13 @@ void smbios_set_cpuid(uint32_t version, uint32_t features)
 field = value;\
 }
 
+void smbios_set_default_processor_family(uint16_t processor_family)
+{
+if (type4.processor_family <= 0x01) {
+type4.processor_family = processor_family;
+}
+}
+
 void smbios_set_defaults(const char *manufacturer, const char *product,
  const char *version, bool legacy_mode,
  bool uuid_encoded, SmbiosEntryPointType ep_type)
diff --git a/include/hw/firmware/smbios.h b/include/hw/firmware/smbios.h
index 7f3259a630..6e514982d4 100644
--- a/include/hw/firmware/smbios.h
+++ b/include/hw/firmware/smbios.h
@@ -295,6 +295,7 @@ void smbios_set_cpuid(uint32_t version, uint32_t features);
 void smbios_set_defaults(const char *manufacturer, const char *product,
  const char *version, bool legacy_mode,
  bool uuid_encoded, SmbiosEntryPointType ep_type);
+void smbios_set_default_processor_family(uint16_t processor_family);
 uint8_t *smbios_get_table_legacy(MachineState *ms, size_t *length);
 void smbios_get_tables(MachineState *ms,
const struct smbios_phys_mem_area *mem_array,
-- 
2.43.0




[PATCH v2 1/4] smbios: add processor-family option

2023-12-29 Thread Heinrich Schuchardt
For RISC-V the SMBIOS standard requires specific values of the processor
family value depending on the bitness of the CPU.

Add a processor-family option for SMBIOS table 4.

The value of processor-family may exceed 255 and therefore must be provided
in the Processor Family 2 field. Set the Processor Family field to 0xFE
which signals that the Processor Family 2 is used.

Signed-off-by: Heinrich Schuchardt 
---
v2:
new patch
---
 hw/smbios/smbios.c | 13 +++--
 qemu-options.hx|  4 ++--
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
index 2a90601ac5..647bc6d603 100644
--- a/hw/smbios/smbios.c
+++ b/hw/smbios/smbios.c
@@ -102,6 +102,7 @@ static struct {
 #define DEFAULT_CPU_SPEED 2000
 
 static struct {
+uint16_t processor_family;
 const char *sock_pfx, *manufacturer, *version, *serial, *asset, *part;
 uint64_t max_speed;
 uint64_t current_speed;
@@ -110,6 +111,7 @@ static struct {
 .max_speed = DEFAULT_CPU_SPEED,
 .current_speed = DEFAULT_CPU_SPEED,
 .processor_id = 0,
+.processor_family = 0x01, /* Other */
 };
 
 struct type8_instance {
@@ -337,6 +339,10 @@ static const QemuOptDesc qemu_smbios_type4_opts[] = {
 .name = "part",
 .type = QEMU_OPT_STRING,
 .help = "part number",
+}, {
+.name = "processor-family",
+.type = QEMU_OPT_NUMBER,
+.help = "processor family",
 }, {
 .name = "processor-id",
 .type = QEMU_OPT_NUMBER,
@@ -726,7 +732,7 @@ static void smbios_build_type_4_table(MachineState *ms, 
unsigned instance)
 snprintf(sock_str, sizeof(sock_str), "%s%2x", type4.sock_pfx, instance);
 SMBIOS_TABLE_SET_STR(4, socket_designation_str, sock_str);
 t->processor_type = 0x03; /* CPU */
-t->processor_family = 0x01; /* Other */
+t->processor_family = 0xfe; /* use Processor Family 2 field */
 SMBIOS_TABLE_SET_STR(4, processor_manufacturer_str, type4.manufacturer);
 if (type4.processor_id == 0) {
 t->processor_id[0] = cpu_to_le32(smbios_cpuid_version);
@@ -758,7 +764,7 @@ static void smbios_build_type_4_table(MachineState *ms, 
unsigned instance)
 t->thread_count = (threads_per_socket > 255) ? 0xFF : threads_per_socket;
 
 t->processor_characteristics = cpu_to_le16(0x02); /* Unknown */
-t->processor_family2 = cpu_to_le16(0x01); /* Other */
+t->processor_family2 = cpu_to_le16(type4.processor_family);
 
 if (tbl_len == SMBIOS_TYPE_4_LEN_V30) {
 t->core_count2 = t->core_enabled2 = cpu_to_le16(cores_per_socket);
@@ -1402,6 +1408,9 @@ void smbios_entry_add(QemuOpts *opts, Error **errp)
 return;
 }
 save_opt(&type4.sock_pfx, opts, "sock_pfx");
+type4.processor_family = qemu_opt_get_number(opts,
+ "processor-family",
+ 0x01 /* Other */);
 save_opt(&type4.manufacturer, opts, "manufacturer");
 save_opt(&type4.version, opts, "version");
 save_opt(&type4.serial, opts, "serial");
diff --git a/qemu-options.hx b/qemu-options.hx
index b66570ae00..7bdb414345 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -2694,7 +2694,7 @@ DEF("smbios", HAS_ARG, QEMU_OPTION_smbios,
 "specify SMBIOS type 3 fields\n"
 "-smbios 
type=4[,sock_pfx=str][,manufacturer=str][,version=str][,serial=str]\n"
 "  [,asset=str][,part=str][,max-speed=%d][,current-speed=%d]\n"
-"  [,processor-id=%d]\n"
+"  [,processor-family=%d,processor-id=%d]\n"
 "specify SMBIOS type 4 fields\n"
 "-smbios 
type=8[,external_reference=str][,internal_reference=str][,connector_type=%d][,port_type=%d]\n"
 "specify SMBIOS type 8 fields\n"
@@ -2722,7 +2722,7 @@ SRST
 ``-smbios 
type=3[,manufacturer=str][,version=str][,serial=str][,asset=str][,sku=str]``
 Specify SMBIOS type 3 fields
 
-``-smbios 
type=4[,sock_pfx=str][,manufacturer=str][,version=str][,serial=str][,asset=str][,part=str][,processor-id=%d]``
+``-smbios 
type=4[,sock_pfx=str][,manufacturer=str][,version=str][,serial=str][,asset=str][,part=str][,processor-family=%d][,processor-id=%d]``
 Specify SMBIOS type 4 fields
 
 ``-smbios type=11[,value=str][,path=filename]``
-- 
2.43.0




[PATCH v2 3/4] target/riscv: SMBIOS support for RISC-V virt machine

2023-12-29 Thread Heinrich Schuchardt
Generate SMBIOS tables for the RISC-V mach-virt.
Add CONFIG_SMBIOS=y to the RISC-V default config.
Set the default processor family in the type 4 table.

The implementation is based on the corresponding ARM and Loongson code.

With the patch the following firmware tables are provided:

etc/smbios/smbios-anchor
etc/smbios/smbios-tables

Signed-off-by: Heinrich Schuchardt 
---
v2:
set processor family
---
 hw/riscv/Kconfig |  1 +
 hw/riscv/virt.c  | 42 ++
 2 files changed, 43 insertions(+)

diff --git a/hw/riscv/Kconfig b/hw/riscv/Kconfig
index b6a5eb4452..1e11ac9432 100644
--- a/hw/riscv/Kconfig
+++ b/hw/riscv/Kconfig
@@ -41,6 +41,7 @@ config RISCV_VIRT
 select RISCV_IMSIC
 select SIFIVE_PLIC
 select SIFIVE_TEST
+select SMBIOS
 select VIRTIO_MMIO
 select FW_CFG_DMA
 select PLATFORM_BUS
diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
index d2eac24156..a876dd8f34 100644
--- a/hw/riscv/virt.c
+++ b/hw/riscv/virt.c
@@ -36,6 +36,7 @@
 #include "hw/riscv/boot.h"
 #include "hw/riscv/numa.h"
 #include "kvm/kvm_riscv.h"
+#include "hw/firmware/smbios.h"
 #include "hw/intc/riscv_aclint.h"
 #include "hw/intc/riscv_aplic.h"
 #include "hw/intc/riscv_imsic.h"
@@ -1249,6 +1250,45 @@ static void create_platform_bus(RISCVVirtState *s, 
DeviceState *irqchip)
 sysbus_mmio_get_region(sysbus, 0));
 }
 
+static void virt_build_smbios(RISCVVirtState *s)
+{
+MachineClass *mc = MACHINE_GET_CLASS(s);
+MachineState *ms = MACHINE(s);
+uint8_t *smbios_tables, *smbios_anchor;
+size_t smbios_tables_len, smbios_anchor_len;
+struct smbios_phys_mem_area mem_array;
+const char *product = "QEMU Virtual Machine";
+
+if (kvm_enabled()) {
+product = "KVM Virtual Machine";
+}
+
+smbios_set_defaults("QEMU", product, mc->name, false,
+true, SMBIOS_ENTRY_POINT_TYPE_64);
+
+#if defined(TARGET_RISCV32)
+smbios_set_default_processor_family(0x200);
+#elif defined(TARGET_RISCV64)
+smbios_set_default_processor_family(0x201);
+#endif
+
+/* build the array of physical mem area from base_memmap */
+mem_array.address = s->memmap[VIRT_DRAM].base;
+mem_array.length = ms->ram_size;
+
+smbios_get_tables(ms, &mem_array, 1,
+  &smbios_tables, &smbios_tables_len,
+  &smbios_anchor, &smbios_anchor_len,
+  &error_fatal);
+
+if (smbios_anchor) {
+fw_cfg_add_file(s->fw_cfg, "etc/smbios/smbios-tables",
+smbios_tables, smbios_tables_len);
+fw_cfg_add_file(s->fw_cfg, "etc/smbios/smbios-anchor",
+smbios_anchor, smbios_anchor_len);
+}
+}
+
 static void virt_machine_done(Notifier *notifier, void *data)
 {
 RISCVVirtState *s = container_of(notifier, RISCVVirtState,
@@ -1337,6 +1377,8 @@ static void virt_machine_done(Notifier *notifier, void 
*data)
 riscv_setup_direct_kernel(kernel_entry, fdt_load_addr);
 }
 
+virt_build_smbios(s);
+
 if (virt_is_acpi_enabled(s)) {
 virt_acpi_setup(s);
 }
-- 
2.43.0




[PATCH v2 4/4] qemu-options: enable -smbios option on RISC-V

2023-12-29 Thread Heinrich Schuchardt
With SMBIOS support added for RISC-V we also should enable the command line
option.

Signed-off-by: Heinrich Schuchardt 
---
v2:
new patch
---
 qemu-options.hx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/qemu-options.hx b/qemu-options.hx
index 7bdb414345..5ed82df11f 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -2705,7 +2705,7 @@ DEF("smbios", HAS_ARG, QEMU_OPTION_smbios,
 "specify SMBIOS type 17 fields\n"
 "-smbios type=41[,designation=str][,kind=str][,instance=%d][,pcidev=str]\n"
 "specify SMBIOS type 41 fields\n",
-QEMU_ARCH_I386 | QEMU_ARCH_ARM | QEMU_ARCH_LOONGARCH)
+QEMU_ARCH_I386 | QEMU_ARCH_ARM | QEMU_ARCH_LOONGARCH | QEMU_ARCH_RISCV)
 SRST
 ``-smbios file=binary``
 Load SMBIOS entry from binary file.
-- 
2.43.0




Re: [PATCH 0/2] ARM Sbsa-ref: Enable CPU cluster topology

2023-12-29 Thread Marcin Juszkiewicz

W dniu 27.12.2023 o 13:07, Xiong Yining pisze:

Enable CPU cluster support on SbsaQemu platform, so that users can
specify a 4-level CPU hierarchy sockets/clusters/cores/threads. And this
topology can be passed to the firmware through DT cpu-map.

xiongyining1480 (2):
   hw/arm/sbsa-ref:Enable CPU cluster on ARM sbsa machine
   hw/arm/sbsa-ref: Add cpu-map to device tree

  hw/arm/sbsa-ref.c | 36 
  1 file changed, 36 insertions(+)



Tested-by: Marcin Juszkiewicz 

Booted system with "-smp 8,sockets=2,clusters=2,cores=1,threads=2" and 
got what I wanted:


cpus {
#size-cells = <0x00>;
#address-cells = <0x02>;

cpu-map {
socket0 {
cluster0 {
core0 {
thread0 {
cpu = <0x8007>;
};
thread1 {
cpu = <0x8006>;
};
};
};
cluster1 {
core0 {
thread0 {
cpu = <0x8005>;
};
thread1 {
cpu = <0x8004>;
};
};
};
};
socket1 {
cluster0 {
core0 {
thread0 {
cpu = <0x8003>;
};
thread1 {
cpu = <0x8002>;
};
};
};
cluster1 {
core0 {
thread0 {
cpu = <0x8001>;
};
thread1 {
cpu = <0x8000>;
};
};
};
};
};

cpu@0 {
phandle = <0x8007>;
reg = <0x00 0x00>;
};

cpu@1 {
phandle = <0x8006>;
reg = <0x00 0x01>;
};

cpu@2 {
phandle = <0x8005>;
reg = <0x00 0x02>;
};

cpu@3 {
phandle = <0x8004>;
reg = <0x00 0x03>;
};

cpu@4 {
phandle = <0x8003>;
reg = <0x00 0x04>;
};

cpu@5 {
phandle = <0x8002>;
reg = <0x00 0x05>;
};

cpu@6 {
phandle = <0x8001>;
reg = <0x00 0x06>;
};

cpu@7 {
phandle = <0x8000>;
reg = <0x00 0x07>;
};
};



Re: [PATCH 2/2] hw/arm/sbsa-ref: Add cpu-map to device tree

2023-12-29 Thread Marcin Juszkiewicz

W dniu 27.12.2023 o 13:07, Xiong Yining pisze:

From: xiongyining1480 

Support CPU topology description through device tree.

Signed-off-by: Xiong Yining 
Signed-off-by: Chen Baozi 
---
  hw/arm/sbsa-ref.c | 35 +++
  1 file changed, 35 insertions(+)

diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c
index e6cd612bc5..a3c851148a 100644
--- a/hw/arm/sbsa-ref.c
+++ b/hw/arm/sbsa-ref.c
@@ -283,10 +283,45 @@ static void create_fdt(SBSAMachineState *sms)
  ms->possible_cpus->cpus[cs->cpu_index].props.node_id);
  }
  
+qemu_fdt_setprop_cell(sms->fdt, nodename, "phandle",

+qemu_fdt_alloc_phandle(sms->fdt));
+
  g_free(nodename);
  }
  
+

  sbsa_fdt_add_gic_node(sms);


Can you add vCPU topology code before ^^ line? So code would add /cpus/ 
node and then go for /intc/ node.



+
+/*
+ * Add vCPU topology description through fdt node cpu-map.


Maybe worth adding pointer to hw/arm/virt.c code for longer description?


+ */
+qemu_fdt_add_subnode(sms->fdt, "/cpus/cpu-map");
+
+for (cpu = sms->smp_cpus - 1; cpu >= 0; cpu--) {
+char *cpu_path = g_strdup_printf("/cpus/cpu@%d", cpu);
+char *map_path;
+
+if (ms->smp.threads > 1) {
+map_path = g_strdup_printf(
+"/cpus/cpu-map/socket%d/cluster%d/core%d/thread%d",
+cpu / (ms->smp.clusters * ms->smp.cores * ms->smp.threads),
+(cpu / (ms->smp.cores * ms->smp.threads)) % ms->smp.clusters,
+(cpu / ms->smp.threads) % ms->smp.cores,
+cpu % ms->smp.threads);
+} else {
+map_path = g_strdup_printf(
+"/cpus/cpu-map/socket%d/cluster%d/core%d",
+cpu / (ms->smp.clusters * ms->smp.cores),
+(cpu / ms->smp.cores) % ms->smp.clusters,
+cpu % ms->smp.cores);
+}
+qemu_fdt_add_path(sms->fdt, map_path);
+qemu_fdt_setprop_phandle(sms->fdt, map_path, "cpu", cpu_path);
+
+g_free(map_path);
+g_free(cpu_path);
+}
+
  }
  
  #define SBSA_FLASH_SECTOR_SIZE (256 * KiB)





Re: [PATCH 21/35] target/arm: Add FEAT_NV to max, neoverse-n2, neoverse-v1 CPUs

2023-12-29 Thread Marcin Juszkiewicz

W dniu 18.12.2023 o 12:32, Peter Maydell pisze:

Enable FEAT_NV on the 'max' CPU, and stop filtering it out for the 
Neoverse N2 and Neoverse V1 CPUs.  We continue to downgrade FEAT_NV2 
support to FEAT_NV for the latter two CPU types.


According to Neoverse-V1 TRM r1p2 it has FEAT_NV2. Similar with Neoverse-N2.

You wrote already:

in practice hypervisors such as KVM are going to require FEAT_NV2 
and not bother to support the FEAT_NV-only case, so I have

implemented them one after the other in this single patchset.
So maybe they both should be FEAT_NV2 and FEAT_NV will be left unused. 
Or enable FEAT_NV for V1 (as being older) and FEAT_NV2 on N2.


This way if someone wants to test nested virtualization then both 
versions will be available without use of 'max' cpu.




Re: [PATCH v2 00/16] target/riscv: deprecate riscv_cpu_options[]

2023-12-29 Thread Vladimir Isaev
22.12.2023 15:22, Daniel Henrique Barboza wrote:
> 
> Hi,
> 
> This new version fixes all instances of 'const PropertyInfo' added,
> changing it to 'static const PropertyInfo', like suggested by Richard in
> v1.
> 
> Patches based on Alistair's riscv-to-apply.next. Series is also found
> here:
> 
> https://gitlab.com/danielhb/qemu/-/tree/fix_cpu_opts_v2
> 
> Changes from v1:
> - changed 'const PropertyInfo' to 'static const PropertyInfo' in all
>   relevant patches.
> - v1 link: 
> https://lore.kernel.org/qemu-riscv/20231221175137.497379-1-dbarb...@ventanamicro.com/
> 
> Daniel Henrique Barboza (16):
>   target/riscv/cpu_cfg.h: remove user_spec and bext_spec
>   target/riscv: move 'pmu-mask' and 'pmu-num' to riscv_cpu_properties[]
>   target/riscv: make riscv_cpu_is_generic() public
>   target/riscv: move 'mmu' to riscv_cpu_properties[]
>   target/riscv: move 'pmp' to riscv_cpu_properties[]
>   target/riscv: rework 'priv_spec'
>   target/riscv: rework 'vext_spec'
>   target/riscv: move 'vlen' to riscv_cpu_properties[]
>   target/riscv: move 'elen' to riscv_cpu_properties[]
>   target/riscv: create finalize_features() for KVM
>   target/riscv: move 'cbom_blocksize' to riscv_cpu_properties[]
>   target/riscv: move 'cboz_blocksize' to riscv_cpu_properties[]
>   target/riscv: remove riscv_cpu_options[]
>   target/riscv/cpu.c: move 'mvendorid' to riscv_cpu_properties[]
>   target/riscv/cpu.c: move 'mimpid' to riscv_cpu_properties[]
>   target/riscv/cpu.c: move 'marchid' to riscv_cpu_properties[]
> 
>  target/riscv/cpu.c   | 584 +--
>  target/riscv/cpu.h   |   7 +-
>  target/riscv/cpu_cfg.h   |   4 -
>  target/riscv/kvm/kvm-cpu.c   |  94 +++---
>  target/riscv/kvm/kvm_riscv.h |   1 +
>  target/riscv/tcg/tcg-cpu.c   |  63 
>  6 files changed, 561 insertions(+), 192 deletions(-)
> 
> --
> 2.43.0
> 
> 

For whole series and TCG part:

Tested-by: Vladimir Isaev 



Re: [PATCH v2 10/16] target/riscv: create finalize_features() for KVM

2023-12-29 Thread Vladimir Isaev
22.12.2023 15:22, Daniel Henrique Barboza wrote:
> To turn cbom_blocksize and cboz_blocksize into class properties we need
> KVM specific changes.
> 
> KVM is creating its own version of these options with a customized
> setter() that prevents users from picking an invalid value during init()
> time. This comes at the cost of duplicating each option that KVM
> supports. This will keep happening for each new shared option KVM
> implements in the future.
> 
> We can avoid that by using the same property TCG uses and adding
> specific KVM handling during finalize() time, like TCG already does with
> riscv_tcg_cpu_finalize_features(). To do that, the common CPU property
> offers a way of knowing if an option was user set or not, sparing us
> from doing unneeded syscalls.
> 
> riscv_kvm_cpu_finalize_features() is then created using the same
> KVMScratch CPU we already use during init() time, since finalize() time
> is still too early to use the official KVM CPU for it. cbom_blocksize
> and cboz_blocksize are then handled during finalize() in the same way
> they're handled by their KVM specific setter.
> 
> With this change we can proceed with the blocksize changes in the common
> code without breaking the KVM driver.
> 
> Signed-off-by: Daniel Henrique Barboza 
> ---
>  target/riscv/cpu.c   | 16 +++---
>  target/riscv/cpu.h   |  1 +
>  target/riscv/kvm/kvm-cpu.c   | 59 
>  target/riscv/kvm/kvm_riscv.h |  1 +
>  4 files changed, 72 insertions(+), 5 deletions(-)
> 
> diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
> index 8be619b6f1..f49d31d753 100644
> --- a/target/riscv/cpu.c
> +++ b/target/riscv/cpu.c
> @@ -63,6 +63,11 @@ static void cpu_option_add_user_setting(const char 
> *optname, uint32_t value)
>  GUINT_TO_POINTER(value));
>  }
> 
> +bool riscv_cpu_option_set(const char *optname)
> +{
> +return g_hash_table_contains(general_user_opts, optname);
> +}
> +

This function may work in unexpected way for future developer since we can 
check just somehow restricted
number of options using it, like vlen/elen/cbom/cboz size, but not vext_spec or 
pmu-num/mask.

>  #define ISA_EXT_DATA_ENTRY(_name, _min_ver, _prop) \
>  {#_name, _min_ver, CPU_CFG_OFFSET(_prop)}
> 
> @@ -1056,17 +1061,18 @@ void riscv_cpu_finalize_features(RISCVCPU *cpu, Error 
> **errp)
>  {
>  Error *local_err = NULL;
> 
> -/*
> - * KVM accel does not have a specialized finalize()
> - * callback because its extensions are validated
> - * in the get()/set() callbacks of each property.
> - */
>  if (tcg_enabled()) {
>  riscv_tcg_cpu_finalize_features(cpu, &local_err);
>  if (local_err != NULL) {
>  error_propagate(errp, local_err);
>  return;
>  }
> +} else if (kvm_enabled()) {
> +riscv_kvm_cpu_finalize_features(cpu, &local_err);
> +if (local_err != NULL) {
> +error_propagate(errp, local_err);
> +return;
> +}
>  }
> 
>  #ifndef CONFIG_USER_ONLY
> diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
> index 53101b82c5..988471c7ba 100644
> --- a/target/riscv/cpu.h
> +++ b/target/riscv/cpu.h
> @@ -495,6 +495,7 @@ bool riscv_cpu_tlb_fill(CPUState *cs, vaddr address, int 
> size,
>  bool probe, uintptr_t retaddr);
>  char *riscv_isa_string(RISCVCPU *cpu);
>  void riscv_cpu_list(void);
> +bool riscv_cpu_option_set(const char *optname);
> 
>  #define cpu_list riscv_cpu_list
>  #define cpu_mmu_index riscv_cpu_mmu_index
> diff --git a/target/riscv/kvm/kvm-cpu.c b/target/riscv/kvm/kvm-cpu.c
> index 62a1e51f0a..70fb075846 100644
> --- a/target/riscv/kvm/kvm-cpu.c
> +++ b/target/riscv/kvm/kvm-cpu.c
> @@ -1490,6 +1490,65 @@ static void kvm_cpu_instance_init(CPUState *cs)
>  }
>  }
> 
> +void riscv_kvm_cpu_finalize_features(RISCVCPU *cpu, Error **errp)
> +{
> +CPURISCVState *env = &cpu->env;
> +KVMScratchCPU kvmcpu;
> +struct kvm_one_reg reg;
> +uint64_t val;
> +int ret;
> +
> +/* short-circuit without spinning the scratch CPU */
> +if (!cpu->cfg.ext_zicbom && !cpu->cfg.ext_zicboz) {
> +return;
> +}
> +
> +if (!kvm_riscv_create_scratch_vcpu(&kvmcpu)) {
> +error_setg(errp, "Unable to create scratch KVM cpu");
> +return;
> +}
> +
> +if (cpu->cfg.ext_zicbom &&
> +riscv_cpu_option_set(kvm_cbom_blocksize.name)) {
> +
> +reg.id = kvm_riscv_reg_id_ulong(env, KVM_REG_RISCV_CONFIG,
> +kvm_cbom_blocksize.kvm_reg_id);
> +reg.addr = (uint64_t)&val;
> +ret = ioctl(kvmcpu.cpufd, KVM_GET_ONE_REG, ®);
> +if (ret != 0) {
> +error_setg(errp, "Unable to read cbom_blocksize, error %d", 
> errno);
> +return;
> +}
> +
> +if (cpu->cfg.cbom_blocksize != val) {
> +error_setg(errp, "Unable to set cbom_blocksize to a different "
> +

Re: [PATCH v2 08/16] target/riscv: move 'vlen' to riscv_cpu_properties[]

2023-12-29 Thread Vladimir Isaev
22.12.2023 15:22, Daniel Henrique Barboza wrote:
> 
> Turning 'vlen' into a class property will allow its default value to be
> overwritten by cpu_init() later on, solving the issue we have now where
> CPU specific settings are getting overwritten by the default.
> 
> For 'vlen', 'elen' and the blocksize options we need a way of tracking
> if the user set a value for them. This is benign for TCG since the cost
> of always validating these values are small, but for KVM we need syscalls
> to read the host values to make the validations. Knowing whether the
> user didn't touch the values makes a difference. We'll track user setting
> for these properties using a hash, like we do in the TCG driver.
> 
> Common validation bits are moved from riscv_cpu_validate_v() to
> prop_vlen_set() to be shared with KVM.
> 
> And, as done with every option we migrated to riscv_cpu_properties[],
> vendor CPUs can't have their 'vlen' value changed.
> 
> Signed-off-by: Daniel Henrique Barboza 
> ---
>  target/riscv/cpu.c | 63 +-
>  target/riscv/tcg/tcg-cpu.c |  5 ---
>  2 files changed, 62 insertions(+), 6 deletions(-)
> 
> diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
> index d6625399a7..c2ff50bcab 100644
> --- a/target/riscv/cpu.c
> +++ b/target/riscv/cpu.c
> @@ -29,6 +29,7 @@
>  #include "qapi/visitor.h"
>  #include "qemu/error-report.h"
>  #include "hw/qdev-properties.h"
> +#include "hw/core/qdev-prop-internal.h"
>  #include "migration/vmstate.h"
>  #include "fpu/softfloat-helpers.h"
>  #include "sysemu/kvm.h"
> @@ -53,6 +54,15 @@ const uint32_t misa_bits[] = {RVI, RVE, RVM, RVA, RVF, 
> RVD, RVV,
>  #define BYTE(x)   (x)
>  #endif
> 
> +/* Hash that stores general user set numeric options */
> +static GHashTable *general_user_opts;
> +
> +static void cpu_option_add_user_setting(const char *optname, uint32_t value)
> +{
> +g_hash_table_insert(general_user_opts, (gpointer)optname,
> +GUINT_TO_POINTER(value));
> +}
> +
>  #define ISA_EXT_DATA_ENTRY(_name, _min_ver, _prop) \
>  {#_name, _min_ver, CPU_CFG_OFFSET(_prop)}
> 
> @@ -1244,6 +1254,8 @@ static void riscv_cpu_init(Object *obj)
>IRQ_LOCAL_MAX + IRQ_LOCAL_GUEST_MAX);
>  #endif /* CONFIG_USER_ONLY */
> 
> +general_user_opts = g_hash_table_new(g_str_hash, g_str_equal);
> +
>  /*
>   * The timer and performance counters extensions were supported
>   * in QEMU before they were added as discrete extensions in the
> @@ -1664,8 +1676,54 @@ static const PropertyInfo prop_vext_spec = {
>  .set = prop_vext_spec_set,
>  };
> 
> +static void prop_vlen_set(Object *obj, Visitor *v, const char *name,
> + void *opaque, Error **errp)
> +{
> +RISCVCPU *cpu = RISCV_CPU(obj);
> +uint16_t value;
> +
> +if (!visit_type_uint16(v, name, &value, errp)) {
> +return;
> +}
> +
> +if (!is_power_of_2(value)) {
> +error_setg(errp, "Vector extension VLEN must be power of 2");
> +return;
> +}
> +
> +/* Always allow setting a default value */

What is the case for vlen equal to 0? Since in properties it is defined with 
default value set to 128.

> +if (cpu->cfg.vlen == 0) {
> +cpu->cfg.vlen = value;
> +return;
> +}
> +
> +if (value != cpu->cfg.vlen && riscv_cpu_is_vendor(obj)) {
> +cpu_set_prop_err(cpu, name, errp);
> +error_append_hint(errp, "Current '%s' val: %u\n",
> +  name, cpu->cfg.vlen);
> +return;
> +}
> +
> +cpu_option_add_user_setting(name, value);
> +cpu->cfg.vlen = value;
> +}
> +
> +static void prop_vlen_get(Object *obj, Visitor *v, const char *name,
> + void *opaque, Error **errp)
> +{
> +uint16_t value = RISCV_CPU(obj)->cfg.vlen;
> +
> +visit_type_uint16(v, name, &value, errp);
> +}
> +
> +static const PropertyInfo prop_vlen = {
> +.name = "vlen",
> +.get = prop_vlen_get,
> +.set = prop_vlen_set,
> +.set_default_value = qdev_propinfo_set_default_value_uint,
> +};
> +
>  Property riscv_cpu_options[] = {
> -DEFINE_PROP_UINT16("vlen", RISCVCPU, cfg.vlen, 128),
>  DEFINE_PROP_UINT16("elen", RISCVCPU, cfg.elen, 64),
> 
>  DEFINE_PROP_UINT16("cbom_blocksize", RISCVCPU, cfg.cbom_blocksize, 64),
> @@ -1687,6 +1745,9 @@ static Property riscv_cpu_properties[] = {
>  {.name = "priv_spec", .info = &prop_priv_spec},
>  {.name = "vext_spec", .info = &prop_vext_spec},
> 
> +{.name = "vlen", .info = &prop_vlen,
> + .set_default = true, .defval.u = 128},
> +
>  #ifndef CONFIG_USER_ONLY
>  DEFINE_PROP_UINT64("resetvec", RISCVCPU, env.resetvec, DEFAULT_RSTVEC),
>  #endif
> diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c
> index 6501c29d8e..8ec858e096 100644
> --- a/target/riscv/tcg/tcg-cpu.c
> +++ b/target/riscv/tcg/tcg-cpu.c
> @@ -178,11 +178,6 @@ static void riscv_cpu_validate_misa_mxl(RISCVCPU *cpu, 
> Error **errp)
>  

Re: [PATCH v2 01/16] target/riscv/cpu_cfg.h: remove user_spec and bext_spec

2023-12-29 Thread Vladimir Isaev
22.12.2023 15:22, Daniel Henrique Barboza wrote:> 
> They aren't being used.
> 
> Signed-off-by: Daniel Henrique Barboza 
> ---
>  target/riscv/cpu_cfg.h | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/target/riscv/cpu_cfg.h b/target/riscv/cpu_cfg.h
> index f4605fb190..c67a8731d3 100644
> --- a/target/riscv/cpu_cfg.h
> +++ b/target/riscv/cpu_cfg.h
> @@ -136,8 +136,6 @@ struct RISCVCPUConfig {
> 
>  uint32_t pmu_mask;
>  char *priv_spec;
> -char *user_spec;
> -char *bext_spec;
>  char *vext_spec;
>  uint16_t vlen;
>  uint16_t elen;
> --
> 2.43.0
> 
> 

bext_ver from target/riscv/cpu.h is also unused.



Re: [PATCH 1/1] target/loongarch: move translate modules to tcg/

2023-12-29 Thread Philippe Mathieu-Daudé

Hi,

On 29/12/23 10:24, Song Gao wrote:

Introduce the target/loongarch/tcg directory. Its purpose is to hold the TCG
code that is selected by CONFIG_TCG

Signed-off-by: Song Gao 
---
  target/loongarch/{ => tcg}/constant_timer.c |  0
  target/loongarch/{ => tcg}/csr_helper.c |  0
  target/loongarch/{ => tcg}/fpu_helper.c |  0
  target/loongarch/{ => tcg}/iocsr_helper.c   |  0
  target/loongarch/{ => tcg}/op_helper.c  |  0
  target/loongarch/{ => tcg}/tlb_helper.c |  0
  target/loongarch/{ => tcg}/translate.c  |  0
  target/loongarch/{ => tcg}/vec_helper.c |  0
  .../{ => tcg}/insn_trans/trans_arith.c.inc  |  0
  .../{ => tcg}/insn_trans/trans_atomic.c.inc |  0
  .../{ => tcg}/insn_trans/trans_bit.c.inc|  0
  .../{ => tcg}/insn_trans/trans_branch.c.inc |  0
  .../{ => tcg}/insn_trans/trans_extra.c.inc  |  0
  .../{ => tcg}/insn_trans/trans_farith.c.inc |  0
  .../{ => tcg}/insn_trans/trans_fcmp.c.inc   |  0
  .../{ => tcg}/insn_trans/trans_fcnv.c.inc   |  0
  .../{ => tcg}/insn_trans/trans_fmemory.c.inc|  0
  .../{ => tcg}/insn_trans/trans_fmov.c.inc   |  0
  .../{ => tcg}/insn_trans/trans_memory.c.inc |  0
  .../{ => tcg}/insn_trans/trans_privileged.c.inc |  0
  .../{ => tcg}/insn_trans/trans_shift.c.inc  |  0
  .../{ => tcg}/insn_trans/trans_vec.c.inc|  0
  target/loongarch/meson.build| 17 ++---
  target/loongarch/tcg/meson.build| 15 +++
  24 files changed, 17 insertions(+), 15 deletions(-)
  rename target/loongarch/{ => tcg}/constant_timer.c (100%)
  rename target/loongarch/{ => tcg}/csr_helper.c (100%)
  rename target/loongarch/{ => tcg}/fpu_helper.c (100%)
  rename target/loongarch/{ => tcg}/iocsr_helper.c (100%)
  rename target/loongarch/{ => tcg}/op_helper.c (100%)
  rename target/loongarch/{ => tcg}/tlb_helper.c (100%)
  rename target/loongarch/{ => tcg}/translate.c (100%)
  rename target/loongarch/{ => tcg}/vec_helper.c (100%)
  rename target/loongarch/{ => tcg}/insn_trans/trans_arith.c.inc (100%)
  rename target/loongarch/{ => tcg}/insn_trans/trans_atomic.c.inc (100%)
  rename target/loongarch/{ => tcg}/insn_trans/trans_bit.c.inc (100%)
  rename target/loongarch/{ => tcg}/insn_trans/trans_branch.c.inc (100%)
  rename target/loongarch/{ => tcg}/insn_trans/trans_extra.c.inc (100%)
  rename target/loongarch/{ => tcg}/insn_trans/trans_farith.c.inc (100%)
  rename target/loongarch/{ => tcg}/insn_trans/trans_fcmp.c.inc (100%)
  rename target/loongarch/{ => tcg}/insn_trans/trans_fcnv.c.inc (100%)
  rename target/loongarch/{ => tcg}/insn_trans/trans_fmemory.c.inc (100%)
  rename target/loongarch/{ => tcg}/insn_trans/trans_fmov.c.inc (100%)
  rename target/loongarch/{ => tcg}/insn_trans/trans_memory.c.inc (100%)
  rename target/loongarch/{ => tcg}/insn_trans/trans_privileged.c.inc (100%)
  rename target/loongarch/{ => tcg}/insn_trans/trans_shift.c.inc (100%)
  rename target/loongarch/{ => tcg}/insn_trans/trans_vec.c.inc (100%)
  create mode 100644 target/loongarch/tcg/meson.build




diff --git a/target/loongarch/meson.build b/target/loongarch/meson.build
index 18e8191e2b..a004523439 100644
--- a/target/loongarch/meson.build
+++ b/target/loongarch/meson.build
@@ -3,31 +3,18 @@ gen = decodetree.process('insns.decode')
  loongarch_ss = ss.source_set()
  loongarch_ss.add(files(
'cpu.c',
+  'gdbstub.c'


Preferably a preliminary commit "gdbstub.c is not specific to TCG and
can be used by other accelerators ...". Otherwise just mention it in
this patch description.


  ))
-loongarch_tcg_ss = ss.source_set()
-loongarch_tcg_ss.add(gen)
-loongarch_tcg_ss.add(files(
-  'fpu_helper.c',
-  'op_helper.c',
-  'translate.c',
-  'gdbstub.c',
-  'vec_helper.c',
-))
-loongarch_tcg_ss.add(zlib)
  
  loongarch_system_ss = ss.source_set()

  loongarch_system_ss.add(files(
'loongarch-qmp-cmds.c',
'machine.c',
-  'tlb_helper.c',
-  'constant_timer.c',
-  'csr_helper.c',
-  'iocsr_helper.c',
  ))
  
  common_ss.add(when: 'CONFIG_LOONGARCH_DIS', if_true: [files('disas.c'), gen])
  
-loongarch_ss.add_all(when: 'CONFIG_TCG', if_true: [loongarch_tcg_ss])

+subdir('tcg')
  
  target_arch += {'loongarch': loongarch_ss}

  target_system_arch += {'loongarch': loongarch_system_ss}
diff --git a/target/loongarch/tcg/meson.build b/target/loongarch/tcg/meson.build
new file mode 100644
index 00..bb7411e5e5
--- /dev/null
+++ b/target/loongarch/tcg/meson.build
@@ -0,0 +1,15 @@


You missed the CONFIG_TCG check, you can use either:

  if 'CONFIG_TCG' in config_all
 subdir('tcg')
  endif

in target/loongarch/meson.build, but since your target seems well
designed and doesn't require TCG stub, you can do directly here:

  if 'CONFIG_TCG' not in config_all
subdir_done()
  endif

so the rest of this file isn't processed.


+loongarch_ss.add([zlib, gen])
+
+loongarch_ss.add(files(
+  'fpu_helper.c',
+  'op_helper.c',
+  'vec_helper.c',
+  'translate

  1   2   >