aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2024-04-25 09:43:29 -0700
committerRichard Henderson <richard.henderson@linaro.org>2024-04-25 09:43:29 -0700
commita118c4aff4087eafb68f7132b233ad548cf16376 (patch)
tree2177101d366d37a7f15c2a86e23977dbaf3780ca /hw
parent83baec642a13a69398a2643a1f905606c13cd363 (diff)
parent098de99aad1aa911b4950b47b55d2e2bcc4f9c0c (diff)
downloadqemu-a118c4aff4087eafb68f7132b233ad548cf16376.zip
qemu-a118c4aff4087eafb68f7132b233ad548cf16376.tar.gz
qemu-a118c4aff4087eafb68f7132b233ad548cf16376.tar.bz2
Merge tag 'hw-misc-20240425' of https://github.com/philmd/qemu into staging
Misc HW patch queue - Script to compare machines compat_props[] (Maksim) - Introduce 'module' CPU topology level (Zhao) - Various cleanups (Thomas, Zhao, Inès, Bernhard) # -----BEGIN PGP SIGNATURE----- # # iQIzBAABCAAdFiEE+qvnXhKRciHc/Wuy4+MsLN6twN4FAmYqN3wACgkQ4+MsLN6t # wN4hTw/9FHsItnEkme/864DRPSP7A9mCGa+JfzJmsL8oUb9fBjXXKm+lNchMLu3B # uvzfXB2Ea24yf5vyrldo0XlU3i/4GDvqXTI6YFYqBvitGICauYBu+6n2NZh2Y/Pn # zZCcVo167o0q7dHu2WSrZ6cSUchsF2C80HjuS07QaN2YZ7QMuN1+uqTjCQ/JHQWA # MH4xHh7cXdfCbbv8iNhMWn6sa+Bw/UyfRcc2W6w9cF5Q5cuuTshgDyd0JBOzkM1i # Mcul7TuKrSiLUeeeqfTjwtw3rtbNfkelV3ycgvgECFAlzPSjF5a6d/EGdO2zo3T/ # aFZnQBYrb4U0SzsmfXFHW7cSylIc1Jn2CCuZZBIvdVcu8TGDD5XsgZbGoCfKdWxp # l67qbQJy1Mp3LrRzygJIaxDOfE8fhhRrcIxfK/GoTHaCkqeFRkGjTeiDTVBqAES2 # zs6kUYZyG/xGaa2tsMu+HbtSO5EEqPC2QCdHayY3deW42Kwjj/HFV50Ya8YgYSVp # gEAjTDOle2dDjlkYud+ymTJz7LnGb3G7q0EZRI9DWolx/bu+uZGQqTSRRre4qFQY # SgN576hsFGN4NdM7tyJWiiqD/OC9ZeqUx3gGBtmI52Q6obBCE9hcow0fPs55Tk95 # 1YzPrt/3IoPI5ZptCoA8DFiysQ46OLtpIsQO9YcrpJmxWyLDSr0= # =tm+U # -----END PGP SIGNATURE----- # gpg: Signature made Thu 25 Apr 2024 03:59:08 AM PDT # gpg: using RSA key FAABE75E12917221DCFD6BB2E3E32C2CDEADC0DE # gpg: Good signature from "Philippe Mathieu-Daudé (F4BUG) <f4bug@amsat.org>" [full] * tag 'hw-misc-20240425' of https://github.com/philmd/qemu: (22 commits) hw/core: Support module-id in numa configuration hw/core: Introduce module-id as the topology subindex hw/core/machine: Support modules in -smp hw/core/machine: Introduce the module as a CPU topology level hw/i386/pc_sysfw: Remove unused parameter from pc_isa_bios_init() hw/misc : Correct 5 spaces indents in stm32l4x5_exti hw/xtensa: Include missing 'exec/cpu-common.h' in 'bootparam.h' hw/elf_ops: Rename elf_ops.h -> elf_ops.h.inc hw/cxl/cxl-cdat: Make cxl_doe_cdat_init() return boolean hw/cxl/cxl-cdat: Make ct3_build_cdat() return boolean hw/cxl/cxl-cdat: Make ct3_load_cdat() return boolean hw: Add a Kconfig switch for the TYPE_CPU_CLUSTER device hw: Fix problem with the A*MPCORE switches in the Kconfig files hw/riscv/virt: Replace sprintf by g_strdup_printf hw/misc/imx: Replace sprintf() by snprintf() hw/misc/applesmc: Simplify DeviceReset handler target/i386: Move APIC related code to cpu-apic.c hw/core: Remove check on NEED_CPU_H in tcg-cpu-ops.h scripts: add script to compare compatibility properties python/qemu/machine: add method to retrieve QEMUMachine::binary field ... Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'hw')
-rw-r--r--hw/Kconfig1
-rw-r--r--hw/arm/Kconfig18
-rw-r--r--hw/core/loader.c4
-rw-r--r--hw/core/machine-hmp-cmds.c4
-rw-r--r--hw/core/machine-qmp-cmds.c23
-rw-r--r--hw/core/machine-smp.c41
-rw-r--r--hw/core/machine.c18
-rw-r--r--hw/cpu/Kconfig15
-rw-r--r--hw/cpu/meson.build3
-rw-r--r--hw/cxl/cxl-cdat.c28
-rw-r--r--hw/i386/pc_sysfw.c5
-rw-r--r--hw/mem/cxl_type3.c3
-rw-r--r--hw/misc/applesmc.c36
-rw-r--r--hw/misc/imx25_ccm.c2
-rw-r--r--hw/misc/imx31_ccm.c2
-rw-r--r--hw/misc/imx6_ccm.c4
-rw-r--r--hw/misc/imx6_src.c2
-rw-r--r--hw/misc/imx6ul_ccm.c4
-rw-r--r--hw/misc/imx7_src.c2
-rw-r--r--hw/misc/stm32l4x5_exti.c8
-rw-r--r--hw/net/imx_fec.c2
-rw-r--r--hw/pci-bridge/cxl_upstream.c3
-rw-r--r--hw/riscv/Kconfig2
-rw-r--r--hw/riscv/virt.c17
-rw-r--r--hw/ssi/imx_spi.c2
-rw-r--r--hw/xtensa/bootparam.h2
26 files changed, 165 insertions, 86 deletions
diff --git a/hw/Kconfig b/hw/Kconfig
index b1cc40d..f7866e7 100644
--- a/hw/Kconfig
+++ b/hw/Kconfig
@@ -47,6 +47,7 @@ source watchdog/Kconfig
# arch Kconfig
source arm/Kconfig
+source cpu/Kconfig
source alpha/Kconfig
source avr/Kconfig
source cris/Kconfig
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
index 098d043..e8b6e5e 100644
--- a/hw/arm/Kconfig
+++ b/hw/arm/Kconfig
@@ -486,6 +486,7 @@ config XLNX_ZYNQMP_ARM
select AHCI
select ARM_GIC
select CADENCE
+ select CPU_CLUSTER
select DDC
select DPCD
select SDHCI
@@ -504,6 +505,7 @@ config XLNX_VERSAL
default y
depends on TCG && AARCH64
select ARM_GIC
+ select CPU_CLUSTER
select PL011
select CADENCE
select VIRTIO_MMIO
@@ -679,21 +681,6 @@ config ZAURUS
select NAND
select ECC
-config A9MPCORE
- bool
- select A9_GTIMER
- select A9SCU # snoop control unit
- select ARM_GIC
- select ARM_MPTIMER
-
-config A15MPCORE
- bool
- select ARM_GIC
-
-config ARM11MPCORE
- bool
- select ARM11SCU
-
config ARMSSE
bool
select ARM_V7M
@@ -704,6 +691,7 @@ config ARMSSE
select CMSDK_APB_DUALTIMER
select CMSDK_APB_UART
select CMSDK_APB_WATCHDOG
+ select CPU_CLUSTER
select IOTKIT_SECCTL
select IOTKIT_SYSCTL
select IOTKIT_SYSINFO
diff --git a/hw/core/loader.c b/hw/core/loader.c
index b8e52f3..2f8105d 100644
--- a/hw/core/loader.c
+++ b/hw/core/loader.c
@@ -305,7 +305,7 @@ static void *load_at(int fd, off_t offset, size_t size)
#define elf_word uint32_t
#define elf_sword int32_t
#define bswapSZs bswap32s
-#include "hw/elf_ops.h"
+#include "hw/elf_ops.h.inc"
#undef elfhdr
#undef elf_phdr
@@ -327,7 +327,7 @@ static void *load_at(int fd, off_t offset, size_t size)
#define elf_sword int64_t
#define bswapSZs bswap64s
#define SZ 64
-#include "hw/elf_ops.h"
+#include "hw/elf_ops.h.inc"
const char *load_elf_strerror(ssize_t error)
{
diff --git a/hw/core/machine-hmp-cmds.c b/hw/core/machine-hmp-cmds.c
index a6ff6a4..8701f00 100644
--- a/hw/core/machine-hmp-cmds.c
+++ b/hw/core/machine-hmp-cmds.c
@@ -87,6 +87,10 @@ void hmp_hotpluggable_cpus(Monitor *mon, const QDict *qdict)
monitor_printf(mon, " cluster-id: \"%" PRIu64 "\"\n",
c->cluster_id);
}
+ if (c->has_module_id) {
+ monitor_printf(mon, " module-id: \"%" PRIu64 "\"\n",
+ c->module_id);
+ }
if (c->has_core_id) {
monitor_printf(mon, " core-id: \"%" PRIu64 "\"\n", c->core_id);
}
diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c
index c20829b..5972100 100644
--- a/hw/core/machine-qmp-cmds.c
+++ b/hw/core/machine-qmp-cmds.c
@@ -64,7 +64,8 @@ CpuInfoFastList *qmp_query_cpus_fast(Error **errp)
return head;
}
-MachineInfoList *qmp_query_machines(Error **errp)
+MachineInfoList *qmp_query_machines(bool has_compat_props, bool compat_props,
+ Error **errp)
{
GSList *el, *machines = object_class_get_list(TYPE_MACHINE, false);
MachineInfoList *mach_list = NULL;
@@ -96,6 +97,26 @@ MachineInfoList *qmp_query_machines(Error **errp)
info->default_ram_id = g_strdup(mc->default_ram_id);
}
+ if (compat_props && mc->compat_props) {
+ int i;
+ info->compat_props = NULL;
+ CompatPropertyList **tail = &(info->compat_props);
+ info->has_compat_props = true;
+
+ for (i = 0; i < mc->compat_props->len; i++) {
+ GlobalProperty *mt_prop = g_ptr_array_index(mc->compat_props,
+ i);
+ CompatProperty *prop;
+
+ prop = g_malloc0(sizeof(*prop));
+ prop->qom_type = g_strdup(mt_prop->driver);
+ prop->property = g_strdup(mt_prop->property);
+ prop->value = g_strdup(mt_prop->value);
+
+ QAPI_LIST_APPEND(tail, prop);
+ }
+ }
+
QAPI_LIST_PREPEND(mach_list, info);
}
diff --git a/hw/core/machine-smp.c b/hw/core/machine-smp.c
index 27864c9..2b93fa9 100644
--- a/hw/core/machine-smp.c
+++ b/hw/core/machine-smp.c
@@ -51,6 +51,10 @@ static char *cpu_hierarchy_to_string(MachineState *ms)
g_string_append_printf(s, " * clusters (%u)", ms->smp.clusters);
}
+ if (mc->smp_props.modules_supported) {
+ g_string_append_printf(s, " * modules (%u)", ms->smp.modules);
+ }
+
g_string_append_printf(s, " * cores (%u)", ms->smp.cores);
g_string_append_printf(s, " * threads (%u)", ms->smp.threads);
@@ -88,6 +92,7 @@ void machine_parse_smp_config(MachineState *ms,
unsigned sockets = config->has_sockets ? config->sockets : 0;
unsigned dies = config->has_dies ? config->dies : 0;
unsigned clusters = config->has_clusters ? config->clusters : 0;
+ unsigned modules = config->has_modules ? config->modules : 0;
unsigned cores = config->has_cores ? config->cores : 0;
unsigned threads = config->has_threads ? config->threads : 0;
unsigned maxcpus = config->has_maxcpus ? config->maxcpus : 0;
@@ -103,6 +108,7 @@ void machine_parse_smp_config(MachineState *ms,
(config->has_sockets && config->sockets == 0) ||
(config->has_dies && config->dies == 0) ||
(config->has_clusters && config->clusters == 0) ||
+ (config->has_modules && config->modules == 0) ||
(config->has_cores && config->cores == 0) ||
(config->has_threads && config->threads == 0) ||
(config->has_maxcpus && config->maxcpus == 0)) {
@@ -115,6 +121,20 @@ void machine_parse_smp_config(MachineState *ms,
* If not supported by the machine, a topology parameter must be
* omitted.
*/
+ if (!mc->smp_props.modules_supported && config->has_modules) {
+ if (config->modules > 1) {
+ error_setg(errp, "modules not supported by this "
+ "machine's CPU topology");
+ return;
+ } else {
+ /* Here modules only equals 1 since we've checked zero case. */
+ warn_report("Deprecated CPU topology (considered invalid): "
+ "Unsupported modules parameter mustn't be "
+ "specified as 1");
+ }
+ }
+ modules = modules > 0 ? modules : 1;
+
if (!mc->smp_props.clusters_supported && config->has_clusters) {
if (config->clusters > 1) {
error_setg(errp, "clusters not supported by this "
@@ -185,11 +205,13 @@ void machine_parse_smp_config(MachineState *ms,
cores = cores > 0 ? cores : 1;
threads = threads > 0 ? threads : 1;
sockets = maxcpus /
- (drawers * books * dies * clusters * cores * threads);
+ (drawers * books * dies * clusters *
+ modules * cores * threads);
} else if (cores == 0) {
threads = threads > 0 ? threads : 1;
cores = maxcpus /
- (drawers * books * sockets * dies * clusters * threads);
+ (drawers * books * sockets * dies *
+ clusters * modules * threads);
}
} else {
/* prefer cores over sockets since 6.2 */
@@ -197,22 +219,26 @@ void machine_parse_smp_config(MachineState *ms,
sockets = sockets > 0 ? sockets : 1;
threads = threads > 0 ? threads : 1;
cores = maxcpus /
- (drawers * books * sockets * dies * clusters * threads);
+ (drawers * books * sockets * dies *
+ clusters * modules * threads);
} else if (sockets == 0) {
threads = threads > 0 ? threads : 1;
sockets = maxcpus /
- (drawers * books * dies * clusters * cores * threads);
+ (drawers * books * dies * clusters *
+ modules * cores * threads);
}
}
/* try to calculate omitted threads at last */
if (threads == 0) {
threads = maxcpus /
- (drawers * books * sockets * dies * clusters * cores);
+ (drawers * books * sockets * dies *
+ clusters * modules * cores);
}
}
- total_cpus = drawers * books * sockets * dies * clusters * cores * threads;
+ total_cpus = drawers * books * sockets * dies *
+ clusters * modules * cores * threads;
maxcpus = maxcpus > 0 ? maxcpus : total_cpus;
cpus = cpus > 0 ? cpus : maxcpus;
@@ -222,6 +248,7 @@ void machine_parse_smp_config(MachineState *ms,
ms->smp.sockets = sockets;
ms->smp.dies = dies;
ms->smp.clusters = clusters;
+ ms->smp.modules = modules;
ms->smp.cores = cores;
ms->smp.threads = threads;
ms->smp.max_cpus = maxcpus;
@@ -266,7 +293,7 @@ void machine_parse_smp_config(MachineState *ms,
unsigned int machine_topo_get_cores_per_socket(const MachineState *ms)
{
- return ms->smp.cores * ms->smp.clusters * ms->smp.dies;
+ return ms->smp.cores * ms->smp.modules * ms->smp.clusters * ms->smp.dies;
}
unsigned int machine_topo_get_threads_per_socket(const MachineState *ms)
diff --git a/hw/core/machine.c b/hw/core/machine.c
index 582c2df..0dec48e 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -800,6 +800,11 @@ void machine_set_cpu_numa_node(MachineState *machine,
return;
}
+ if (props->has_module_id && !slot->props.has_module_id) {
+ error_setg(errp, "module-id is not supported");
+ return;
+ }
+
if (props->has_cluster_id && !slot->props.has_cluster_id) {
error_setg(errp, "cluster-id is not supported");
return;
@@ -824,6 +829,11 @@ void machine_set_cpu_numa_node(MachineState *machine,
continue;
}
+ if (props->has_module_id &&
+ props->module_id != slot->props.module_id) {
+ continue;
+ }
+
if (props->has_cluster_id &&
props->cluster_id != slot->props.cluster_id) {
continue;
@@ -881,6 +891,7 @@ static void machine_get_smp(Object *obj, Visitor *v, const char *name,
.has_sockets = true, .sockets = ms->smp.sockets,
.has_dies = true, .dies = ms->smp.dies,
.has_clusters = true, .clusters = ms->smp.clusters,
+ .has_modules = true, .modules = ms->smp.modules,
.has_cores = true, .cores = ms->smp.cores,
.has_threads = true, .threads = ms->smp.threads,
.has_maxcpus = true, .maxcpus = ms->smp.max_cpus,
@@ -1157,6 +1168,7 @@ static void machine_initfn(Object *obj)
ms->smp.sockets = 1;
ms->smp.dies = 1;
ms->smp.clusters = 1;
+ ms->smp.modules = 1;
ms->smp.cores = 1;
ms->smp.threads = 1;
@@ -1224,6 +1236,12 @@ static char *cpu_slot_to_string(const CPUArchId *cpu)
}
g_string_append_printf(s, "cluster-id: %"PRId64, cpu->props.cluster_id);
}
+ if (cpu->props.has_module_id) {
+ if (s->len) {
+ g_string_append_printf(s, ", ");
+ }
+ g_string_append_printf(s, "module-id: %"PRId64, cpu->props.module_id);
+ }
if (cpu->props.has_core_id) {
if (s->len) {
g_string_append_printf(s, ", ");
diff --git a/hw/cpu/Kconfig b/hw/cpu/Kconfig
index 1767d02..baff478 100644
--- a/hw/cpu/Kconfig
+++ b/hw/cpu/Kconfig
@@ -1,8 +1,17 @@
-config ARM11MPCORE
- bool
-
config A9MPCORE
bool
+ select A9_GTIMER
+ select A9SCU # snoop control unit
+ select ARM_GIC
+ select ARM_MPTIMER
config A15MPCORE
bool
+ select ARM_GIC
+
+config ARM11MPCORE
+ bool
+ select ARM11SCU
+
+config CPU_CLUSTER
+ bool
diff --git a/hw/cpu/meson.build b/hw/cpu/meson.build
index 38cdcfb..9d36bf8 100644
--- a/hw/cpu/meson.build
+++ b/hw/cpu/meson.build
@@ -1,4 +1,5 @@
-system_ss.add(files('core.c', 'cluster.c'))
+system_ss.add(files('core.c'))
+system_ss.add(when: 'CONFIG_CPU_CLUSTER', if_true: files('cluster.c'))
system_ss.add(when: 'CONFIG_ARM11MPCORE', if_true: files('arm11mpcore.c'))
system_ss.add(when: 'CONFIG_REALVIEW', if_true: files('realview_mpcore.c'))
diff --git a/hw/cxl/cxl-cdat.c b/hw/cxl/cxl-cdat.c
index 551545f..959a555 100644
--- a/hw/cxl/cxl-cdat.c
+++ b/hw/cxl/cxl-cdat.c
@@ -44,7 +44,7 @@ static void cdat_len_check(CDATSubHeader *hdr, Error **errp)
}
}
-static void ct3_build_cdat(CDATObject *cdat, Error **errp)
+static bool ct3_build_cdat(CDATObject *cdat, Error **errp)
{
g_autofree CDATTableHeader *cdat_header = NULL;
g_autofree CDATEntry *cdat_st = NULL;
@@ -58,7 +58,7 @@ static void ct3_build_cdat(CDATObject *cdat, Error **errp)
cdat_header = g_malloc0(sizeof(*cdat_header));
if (!cdat_header) {
error_setg(errp, "Failed to allocate CDAT header");
- return;
+ return false;
}
cdat->built_buf_len = cdat->build_cdat_table(&cdat->built_buf,
@@ -67,14 +67,14 @@ static void ct3_build_cdat(CDATObject *cdat, Error **errp)
if (cdat->built_buf_len <= 0) {
/* Build later as not all data available yet */
cdat->to_update = true;
- return;
+ return true;
}
cdat->to_update = false;
cdat_st = g_malloc0(sizeof(*cdat_st) * (cdat->built_buf_len + 1));
if (!cdat_st) {
error_setg(errp, "Failed to allocate CDAT entry array");
- return;
+ return false;
}
/* Entry 0 for CDAT header, starts with Entry 1 */
@@ -109,9 +109,10 @@ static void ct3_build_cdat(CDATObject *cdat, Error **errp)
cdat_st[0].length = sizeof(*cdat_header);
cdat->entry_len = 1 + cdat->built_buf_len;
cdat->entry = g_steal_pointer(&cdat_st);
+ return true;
}
-static void ct3_load_cdat(CDATObject *cdat, Error **errp)
+static bool ct3_load_cdat(CDATObject *cdat, Error **errp)
{
g_autofree CDATEntry *cdat_st = NULL;
g_autofree uint8_t *buf = NULL;
@@ -127,11 +128,11 @@ static void ct3_load_cdat(CDATObject *cdat, Error **errp)
&file_size, &error)) {
error_setg(errp, "CDAT: File read failed: %s", error->message);
g_error_free(error);
- return;
+ return false;
}
if (file_size < sizeof(CDATTableHeader)) {
error_setg(errp, "CDAT: File too short");
- return;
+ return false;
}
i = sizeof(CDATTableHeader);
num_ent = 1;
@@ -139,19 +140,19 @@ static void ct3_load_cdat(CDATObject *cdat, Error **errp)
hdr = (CDATSubHeader *)(buf + i);
if (i + sizeof(CDATSubHeader) > file_size) {
error_setg(errp, "CDAT: Truncated table");
- return;
+ return false;
}
cdat_len_check(hdr, errp);
i += hdr->length;
if (i > file_size) {
error_setg(errp, "CDAT: Truncated table");
- return;
+ return false;
}
num_ent++;
}
if (i != file_size) {
error_setg(errp, "CDAT: File length mismatch");
- return;
+ return false;
}
cdat_st = g_new0(CDATEntry, num_ent);
@@ -185,16 +186,17 @@ static void ct3_load_cdat(CDATObject *cdat, Error **errp)
cdat->entry_len = num_ent;
cdat->entry = g_steal_pointer(&cdat_st);
cdat->buf = g_steal_pointer(&buf);
+ return true;
}
-void cxl_doe_cdat_init(CXLComponentState *cxl_cstate, Error **errp)
+bool cxl_doe_cdat_init(CXLComponentState *cxl_cstate, Error **errp)
{
CDATObject *cdat = &cxl_cstate->cdat;
if (cdat->filename) {
- ct3_load_cdat(cdat, errp);
+ return ct3_load_cdat(cdat, errp);
} else {
- ct3_build_cdat(cdat, errp);
+ return ct3_build_cdat(cdat, errp);
}
}
diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c
index 3efabbb..87b5bf5 100644
--- a/hw/i386/pc_sysfw.c
+++ b/hw/i386/pc_sysfw.c
@@ -41,8 +41,7 @@
#define FLASH_SECTOR_SIZE 4096
static void pc_isa_bios_init(MemoryRegion *rom_memory,
- MemoryRegion *flash_mem,
- int ram_size)
+ MemoryRegion *flash_mem)
{
int isa_bios_size;
MemoryRegion *isa_bios;
@@ -186,7 +185,7 @@ static void pc_system_flash_map(PCMachineState *pcms,
if (i == 0) {
flash_mem = pflash_cfi01_get_memory(system_flash);
- pc_isa_bios_init(rom_memory, flash_mem, size);
+ pc_isa_bios_init(rom_memory, flash_mem);
/* Encrypt the pflash boot ROM */
if (sev_enabled()) {
diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c
index b0a7e9f..3e42490 100644
--- a/hw/mem/cxl_type3.c
+++ b/hw/mem/cxl_type3.c
@@ -705,8 +705,7 @@ static void ct3_realize(PCIDevice *pci_dev, Error **errp)
cxl_cstate->cdat.build_cdat_table = ct3_build_cdat_table;
cxl_cstate->cdat.free_cdat_table = ct3_free_cdat_table;
cxl_cstate->cdat.private = ct3d;
- cxl_doe_cdat_init(cxl_cstate, errp);
- if (*errp) {
+ if (!cxl_doe_cdat_init(cxl_cstate, errp)) {
goto err_free_special_ops;
}
diff --git a/hw/misc/applesmc.c b/hw/misc/applesmc.c
index 14e3ef6..59a4899 100644
--- a/hw/misc/applesmc.c
+++ b/hw/misc/applesmc.c
@@ -145,7 +145,7 @@ static void applesmc_io_cmd_write(void *opaque, hwaddr addr, uint64_t val,
s->data_pos = 0;
}
-static struct AppleSMCData *applesmc_find_key(AppleSMCState *s)
+static const struct AppleSMCData *applesmc_find_key(AppleSMCState *s)
{
struct AppleSMCData *d;
@@ -161,7 +161,7 @@ static void applesmc_io_data_write(void *opaque, hwaddr addr, uint64_t val,
unsigned size)
{
AppleSMCState *s = opaque;
- struct AppleSMCData *d;
+ const struct AppleSMCData *d;
smc_debug("DATA received: 0x%02x\n", (uint8_t)val);
switch (s->cmd) {
@@ -269,23 +269,10 @@ static void applesmc_add_key(AppleSMCState *s, const char *key,
static void qdev_applesmc_isa_reset(DeviceState *dev)
{
AppleSMCState *s = APPLE_SMC(dev);
- struct AppleSMCData *d, *next;
- /* Remove existing entries */
- QLIST_FOREACH_SAFE(d, &s->data_def, node, next) {
- QLIST_REMOVE(d, node);
- g_free(d);
- }
s->status = 0x00;
s->status_1e = 0x00;
s->last_ret = 0x00;
-
- applesmc_add_key(s, "REV ", 6, "\x01\x13\x0f\x00\x00\x03");
- applesmc_add_key(s, "OSK0", 32, s->osk);
- applesmc_add_key(s, "OSK1", 32, s->osk + 32);
- applesmc_add_key(s, "NATJ", 1, "\0");
- applesmc_add_key(s, "MSSP", 1, "\0");
- applesmc_add_key(s, "MSSD", 1, "\0x3");
}
static const MemoryRegionOps applesmc_data_io_ops = {
@@ -343,6 +330,24 @@ static void applesmc_isa_realize(DeviceState *dev, Error **errp)
}
QLIST_INIT(&s->data_def);
+ applesmc_add_key(s, "REV ", 6, "\x01\x13\x0f\x00\x00\x03");
+ applesmc_add_key(s, "OSK0", 32, s->osk);
+ applesmc_add_key(s, "OSK1", 32, s->osk + 32);
+ applesmc_add_key(s, "NATJ", 1, "\0");
+ applesmc_add_key(s, "MSSP", 1, "\0");
+ applesmc_add_key(s, "MSSD", 1, "\0x3");
+}
+
+static void applesmc_unrealize(DeviceState *dev)
+{
+ AppleSMCState *s = APPLE_SMC(dev);
+ struct AppleSMCData *d, *next;
+
+ /* Remove existing entries */
+ QLIST_FOREACH_SAFE(d, &s->data_def, node, next) {
+ QLIST_REMOVE(d, node);
+ g_free(d);
+ }
}
static Property applesmc_isa_properties[] = {
@@ -377,6 +382,7 @@ static void qdev_applesmc_class_init(ObjectClass *klass, void *data)
AcpiDevAmlIfClass *adevc = ACPI_DEV_AML_IF_CLASS(klass);
dc->realize = applesmc_isa_realize;
+ dc->unrealize = applesmc_unrealize;
dc->reset = qdev_applesmc_isa_reset;
device_class_set_props(dc, applesmc_isa_properties);
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
diff --git a/hw/misc/imx25_ccm.c b/hw/misc/imx25_ccm.c
index d888966..faa726a 100644
--- a/hw/misc/imx25_ccm.c
+++ b/hw/misc/imx25_ccm.c
@@ -91,7 +91,7 @@ static const char *imx25_ccm_reg_name(uint32_t reg)
case IMX25_CCM_LPIMR1_REG:
return "lpimr1";
default:
- sprintf(unknown, "[%u ?]", reg);
+ snprintf(unknown, sizeof(unknown), "[%u ?]", reg);
return unknown;
}
}
diff --git a/hw/misc/imx31_ccm.c b/hw/misc/imx31_ccm.c
index a9059bb..125d4fc 100644
--- a/hw/misc/imx31_ccm.c
+++ b/hw/misc/imx31_ccm.c
@@ -89,7 +89,7 @@ static const char *imx31_ccm_reg_name(uint32_t reg)
case IMX31_CCM_PDR2_REG:
return "PDR2";
default:
- sprintf(unknown, "[%u ?]", reg);
+ snprintf(unknown, sizeof(unknown), "[%u ?]", reg);
return unknown;
}
}
diff --git a/hw/misc/imx6_ccm.c b/hw/misc/imx6_ccm.c
index 56489d8..b1def7f 100644
--- a/hw/misc/imx6_ccm.c
+++ b/hw/misc/imx6_ccm.c
@@ -85,7 +85,7 @@ static const char *imx6_ccm_reg_name(uint32_t reg)
case CCM_CMEOR:
return "CMEOR";
default:
- sprintf(unknown, "%u ?", reg);
+ snprintf(unknown, sizeof(unknown), "%u ?", reg);
return unknown;
}
}
@@ -224,7 +224,7 @@ static const char *imx6_analog_reg_name(uint32_t reg)
case USB_ANALOG_DIGPROG:
return "USB_ANALOG_DIGPROG";
default:
- sprintf(unknown, "%u ?", reg);
+ snprintf(unknown, sizeof(unknown), "%u ?", reg);
return unknown;
}
}
diff --git a/hw/misc/imx6_src.c b/hw/misc/imx6_src.c
index 0c60035..3766bdf 100644
--- a/hw/misc/imx6_src.c
+++ b/hw/misc/imx6_src.c
@@ -68,7 +68,7 @@ static const char *imx6_src_reg_name(uint32_t reg)
case SRC_GPR10:
return "SRC_GPR10";
default:
- sprintf(unknown, "%u ?", reg);
+ snprintf(unknown, sizeof(unknown), "%u ?", reg);
return unknown;
}
}
diff --git a/hw/misc/imx6ul_ccm.c b/hw/misc/imx6ul_ccm.c
index bbc0be9..0ac49ea 100644
--- a/hw/misc/imx6ul_ccm.c
+++ b/hw/misc/imx6ul_ccm.c
@@ -143,7 +143,7 @@ static const char *imx6ul_ccm_reg_name(uint32_t reg)
case CCM_CMEOR:
return "CMEOR";
default:
- sprintf(unknown, "%u ?", reg);
+ snprintf(unknown, sizeof(unknown), "%u ?", reg);
return unknown;
}
}
@@ -274,7 +274,7 @@ static const char *imx6ul_analog_reg_name(uint32_t reg)
case USB_ANALOG_DIGPROG:
return "USB_ANALOG_DIGPROG";
default:
- sprintf(unknown, "%u ?", reg);
+ snprintf(unknown, sizeof(unknown), "%u ?", reg);
return unknown;
}
}
diff --git a/hw/misc/imx7_src.c b/hw/misc/imx7_src.c
index b3725ff..d19f045 100644
--- a/hw/misc/imx7_src.c
+++ b/hw/misc/imx7_src.c
@@ -75,7 +75,7 @@ static const char *imx7_src_reg_name(uint32_t reg)
case SRC_GPR10:
return "SRC_GPR10";
default:
- sprintf(unknown, "%u ?", reg);
+ snprintf(unknown, sizeof(unknown), "%u ?", reg);
return unknown;
}
}
diff --git a/hw/misc/stm32l4x5_exti.c b/hw/misc/stm32l4x5_exti.c
index a090dbd..495a000 100644
--- a/hw/misc/stm32l4x5_exti.c
+++ b/hw/misc/stm32l4x5_exti.c
@@ -59,22 +59,22 @@ static const uint32_t exti_romask[EXTI_NUM_REGISTER] = {
static unsigned regbank_index_by_irq(unsigned irq)
{
- return irq >= EXTI_MAX_IRQ_PER_BANK ? 1 : 0;
+ return irq >= EXTI_MAX_IRQ_PER_BANK ? 1 : 0;
}
static unsigned regbank_index_by_addr(hwaddr addr)
{
- return addr >= EXTI_IMR2 ? 1 : 0;
+ return addr >= EXTI_IMR2 ? 1 : 0;
}
static unsigned valid_mask(unsigned bank)
{
- return MAKE_64BIT_MASK(0, irqs_per_bank[bank]);
+ return MAKE_64BIT_MASK(0, irqs_per_bank[bank]);
}
static unsigned configurable_mask(unsigned bank)
{
- return valid_mask(bank) & ~exti_romask[bank];
+ return valid_mask(bank) & ~exti_romask[bank];
}
static void stm32l4x5_exti_reset_hold(Object *obj, ResetType type)
diff --git a/hw/net/imx_fec.c b/hw/net/imx_fec.c
index cee84af..8c91d20 100644
--- a/hw/net/imx_fec.c
+++ b/hw/net/imx_fec.c
@@ -41,7 +41,7 @@
static const char *imx_default_reg_name(IMXFECState *s, uint32_t index)
{
static char tmp[20];
- sprintf(tmp, "index %d", index);
+ snprintf(tmp, sizeof(tmp), "index %d", index);
return tmp;
}
diff --git a/hw/pci-bridge/cxl_upstream.c b/hw/pci-bridge/cxl_upstream.c
index 783fa6a..e51221a 100644
--- a/hw/pci-bridge/cxl_upstream.c
+++ b/hw/pci-bridge/cxl_upstream.c
@@ -338,8 +338,7 @@ static void cxl_usp_realize(PCIDevice *d, Error **errp)
cxl_cstate->cdat.build_cdat_table = build_cdat_table;
cxl_cstate->cdat.free_cdat_table = free_default_cdat_table;
cxl_cstate->cdat.private = d;
- cxl_doe_cdat_init(cxl_cstate, errp);
- if (*errp) {
+ if (!cxl_doe_cdat_init(cxl_cstate, errp)) {
goto err_cap;
}
diff --git a/hw/riscv/Kconfig b/hw/riscv/Kconfig
index 5d644eb..fc72ef0 100644
--- a/hw/riscv/Kconfig
+++ b/hw/riscv/Kconfig
@@ -9,6 +9,7 @@ config IBEX
config MICROCHIP_PFSOC
bool
select CADENCE_SDHCI
+ select CPU_CLUSTER
select MCHP_PFSOC_DMC
select MCHP_PFSOC_IOSCB
select MCHP_PFSOC_MMUART
@@ -68,6 +69,7 @@ config SIFIVE_E
config SIFIVE_U
bool
select CADENCE
+ select CPU_CLUSTER
select RISCV_ACLINT
select SIFIVE_GPIO
select SIFIVE_PDMA
diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
index d171e74..4fdb660 100644
--- a/hw/riscv/virt.c
+++ b/hw/riscv/virt.c
@@ -1617,10 +1617,8 @@ static void virt_machine_instance_init(Object *obj)
static char *virt_get_aia_guests(Object *obj, Error **errp)
{
RISCVVirtState *s = RISCV_VIRT_MACHINE(obj);
- char val[32];
- sprintf(val, "%d", s->aia_guests);
- return g_strdup(val);
+ return g_strdup_printf("%d", s->aia_guests);
}
static void virt_set_aia_guests(Object *obj, const char *val, Error **errp)
@@ -1741,7 +1739,6 @@ static void virt_machine_device_plug_cb(HotplugHandler *hotplug_dev,
static void virt_machine_class_init(ObjectClass *oc, void *data)
{
- char str[128];
MachineClass *mc = MACHINE_CLASS(oc);
HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc);
@@ -1767,7 +1764,6 @@ static void virt_machine_class_init(ObjectClass *oc, void *data)
machine_class_allow_dynamic_sysbus_dev(mc, TYPE_TPM_TIS_SYSBUS);
#endif
-
object_class_property_add_bool(oc, "aclint", virt_get_aclint,
virt_set_aclint);
object_class_property_set_description(oc, "aclint",
@@ -1785,9 +1781,14 @@ static void virt_machine_class_init(ObjectClass *oc, void *data)
object_class_property_add_str(oc, "aia-guests",
virt_get_aia_guests,
virt_set_aia_guests);
- sprintf(str, "Set number of guest MMIO pages for AIA IMSIC. Valid value "
- "should be between 0 and %d.", VIRT_IRQCHIP_MAX_GUESTS);
- object_class_property_set_description(oc, "aia-guests", str);
+ {
+ g_autofree char *str =
+ g_strdup_printf("Set number of guest MMIO pages for AIA IMSIC. "
+ "Valid value should be between 0 and %d.",
+ VIRT_IRQCHIP_MAX_GUESTS);
+ object_class_property_set_description(oc, "aia-guests", str);
+ }
+
object_class_property_add(oc, "acpi", "OnOffAuto",
virt_get_acpi, virt_set_acpi,
NULL, NULL);
diff --git a/hw/ssi/imx_spi.c b/hw/ssi/imx_spi.c
index d8a7583..12d897d 100644
--- a/hw/ssi/imx_spi.c
+++ b/hw/ssi/imx_spi.c
@@ -53,7 +53,7 @@ static const char *imx_spi_reg_name(uint32_t reg)
case ECSPI_MSGDATA:
return "ECSPI_MSGDATA";
default:
- sprintf(unknown, "%u ?", reg);
+ snprintf(unknown, sizeof(unknown), "%u ?", reg);
return unknown;
}
}
diff --git a/hw/xtensa/bootparam.h b/hw/xtensa/bootparam.h
index ade7891..f57ff85 100644
--- a/hw/xtensa/bootparam.h
+++ b/hw/xtensa/bootparam.h
@@ -1,6 +1,8 @@
#ifndef HW_XTENSA_BOOTPARAM_H
#define HW_XTENSA_BOOTPARAM_H
+#include "exec/cpu-common.h"
+
#define BP_TAG_COMMAND_LINE 0x1001 /* command line (0-terminated string)*/
#define BP_TAG_INITRD 0x1002 /* ramdisk addr and size (bp_meminfo) */
#define BP_TAG_MEMORY 0x1003 /* memory addr and size (bp_meminfo) */