aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@linaro.org>2024-01-29 17:44:44 +0100
committerThomas Huth <thuth@redhat.com>2024-03-12 11:46:16 +0100
commit97e03106018301969f9e7c1eb22d3838adbe0bcc (patch)
tree0f51a4a48a5de2624a7fc84d192e3876167bb3a2 /hw
parentee1004bba6eadeddf988a29716dc28849c0211c8 (diff)
downloadqemu-97e03106018301969f9e7c1eb22d3838adbe0bcc.zip
qemu-97e03106018301969f9e7c1eb22d3838adbe0bcc.tar.gz
qemu-97e03106018301969f9e7c1eb22d3838adbe0bcc.tar.bz2
hw/core: Declare CPUArchId::cpu as CPUState instead of Object
Do not accept any Object for CPUArchId::cpu field, restrict it to CPUState type. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <20240129164514.73104-3-philmd@linaro.org> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/core/machine.c4
-rw-r--r--hw/i386/x86.c2
-rw-r--r--hw/loongarch/virt.c2
-rw-r--r--hw/ppc/spapr.c5
-rw-r--r--hw/s390x/s390-virtio-ccw.c2
5 files changed, 7 insertions, 8 deletions
diff --git a/hw/core/machine.c b/hw/core/machine.c
index 9ac5d53..024bf34 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -716,7 +716,7 @@ HotpluggableCPUList *machine_query_hotpluggable_cpus(MachineState *machine)
mc->possible_cpu_arch_ids(machine);
for (i = 0; i < machine->possible_cpus->len; i++) {
- Object *cpu;
+ CPUState *cpu;
HotpluggableCPU *cpu_item = g_new0(typeof(*cpu_item), 1);
cpu_item->type = g_strdup(machine->possible_cpus->cpus[i].type);
@@ -726,7 +726,7 @@ HotpluggableCPUList *machine_query_hotpluggable_cpus(MachineState *machine)
cpu = machine->possible_cpus->cpus[i].cpu;
if (cpu) {
- cpu_item->qom_path = object_get_canonical_path(cpu);
+ cpu_item->qom_path = object_get_canonical_path(OBJECT(cpu));
}
QAPI_LIST_PREPEND(head, cpu_item);
}
diff --git a/hw/i386/x86.c b/hw/i386/x86.c
index 807e09b..ffbda48 100644
--- a/hw/i386/x86.c
+++ b/hw/i386/x86.c
@@ -225,7 +225,7 @@ void x86_cpu_plug(HotplugHandler *hotplug_dev,
}
found_cpu = x86_find_cpu_slot(MACHINE(x86ms), cpu->apic_id, NULL);
- found_cpu->cpu = OBJECT(dev);
+ found_cpu->cpu = CPU(dev);
out:
error_propagate(errp, local_err);
}
diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c
index 1e98d8b..efce112 100644
--- a/hw/loongarch/virt.c
+++ b/hw/loongarch/virt.c
@@ -858,7 +858,7 @@ static void loongarch_init(MachineState *machine)
for (i = 0; i < possible_cpus->len; i++) {
cpu = cpu_create(machine->cpu_type);
cpu->cpu_index = i;
- machine->possible_cpus->cpus[i].cpu = OBJECT(cpu);
+ machine->possible_cpus->cpus[i].cpu = cpu;
lacpu = LOONGARCH_CPU(cpu);
lacpu->phy_id = machine->possible_cpus->cpus[i].arch_id;
}
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 55263f0..f8980b6 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -3979,7 +3979,6 @@ static void spapr_core_plug(HotplugHandler *hotplug_dev, DeviceState *dev)
SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
SpaprCpuCore *core = SPAPR_CPU_CORE(OBJECT(dev));
CPUCore *cc = CPU_CORE(dev);
- CPUState *cs;
SpaprDrc *drc;
CPUArchId *core_slot;
int index;
@@ -4013,7 +4012,7 @@ static void spapr_core_plug(HotplugHandler *hotplug_dev, DeviceState *dev)
}
}
- core_slot->cpu = OBJECT(dev);
+ core_slot->cpu = CPU(dev);
/*
* Set compatibility mode to match the boot CPU, which was either set
@@ -4029,7 +4028,7 @@ static void spapr_core_plug(HotplugHandler *hotplug_dev, DeviceState *dev)
if (smc->pre_2_10_has_unused_icps) {
for (i = 0; i < cc->nr_threads; i++) {
- cs = CPU(core->threads[i]);
+ CPUState *cs = CPU(core->threads[i]);
pre_2_10_vmstate_unregister_dummy_icp(cs->cpu_index);
}
}
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index 4b6aab8..b1dcb38 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -317,7 +317,7 @@ static void s390_cpu_plug(HotplugHandler *hotplug_dev,
S390CPU *cpu = S390_CPU(dev);
g_assert(!ms->possible_cpus->cpus[cpu->env.core_id].cpu);
- ms->possible_cpus->cpus[cpu->env.core_id].cpu = OBJECT(dev);
+ ms->possible_cpus->cpus[cpu->env.core_id].cpu = CPU(dev);
if (s390_has_topology()) {
s390_topology_setup_cpu(ms, cpu, errp);