aboutsummaryrefslogtreecommitdiff
path: root/hw/i386/x86.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2021-06-17 17:53:03 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2021-06-25 16:13:48 +0200
commit67872eb8ed194117f5af71694374a083c3f45eb2 (patch)
tree8c932318f0fb053f535edb50e3e2a5520788b2f1 /hw/i386/x86.c
parentbd80936a4f18075e0e407df180801a9743ce290c (diff)
downloadqemu-67872eb8ed194117f5af71694374a083c3f45eb2.zip
qemu-67872eb8ed194117f5af71694374a083c3f45eb2.tar.gz
qemu-67872eb8ed194117f5af71694374a083c3f45eb2.tar.bz2
machine: move dies from X86MachineState to CpuTopology
In order to make SMP configuration a Machine property, we need a getter as well as a setter. To simplify the implementation put everything that the getter needs in the CpuTopology struct. Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20210617155308.928754-7-pbonzini@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/i386/x86.c')
-rw-r--r--hw/i386/x86.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/hw/i386/x86.c b/hw/i386/x86.c
index d30cf27..00448ed 100644
--- a/hw/i386/x86.c
+++ b/hw/i386/x86.c
@@ -64,7 +64,7 @@ inline void init_topo_info(X86CPUTopoInfo *topo_info,
{
MachineState *ms = MACHINE(x86ms);
- topo_info->dies_per_pkg = x86ms->smp_dies;
+ topo_info->dies_per_pkg = ms->smp.dies;
topo_info->cores_per_die = ms->smp.cores;
topo_info->threads_per_core = ms->smp.threads;
}
@@ -293,7 +293,7 @@ void x86_cpu_pre_plug(HotplugHandler *hotplug_dev,
init_topo_info(&topo_info, x86ms);
- env->nr_dies = x86ms->smp_dies;
+ env->nr_dies = ms->smp.dies;
/*
* If APIC ID is not set,
@@ -301,13 +301,13 @@ void x86_cpu_pre_plug(HotplugHandler *hotplug_dev,
*/
if (cpu->apic_id == UNASSIGNED_APIC_ID) {
int max_socket = (ms->smp.max_cpus - 1) /
- smp_threads / smp_cores / x86ms->smp_dies;
+ smp_threads / smp_cores / ms->smp.dies;
/*
* die-id was optional in QEMU 4.0 and older, so keep it optional
* if there's only one die per socket.
*/
- if (cpu->die_id < 0 && x86ms->smp_dies == 1) {
+ if (cpu->die_id < 0 && ms->smp.dies == 1) {
cpu->die_id = 0;
}
@@ -322,9 +322,9 @@ void x86_cpu_pre_plug(HotplugHandler *hotplug_dev,
if (cpu->die_id < 0) {
error_setg(errp, "CPU die-id is not set");
return;
- } else if (cpu->die_id > x86ms->smp_dies - 1) {
+ } else if (cpu->die_id > ms->smp.dies - 1) {
error_setg(errp, "Invalid CPU die-id: %u must be in range 0:%u",
- cpu->die_id, x86ms->smp_dies - 1);
+ cpu->die_id, ms->smp.dies - 1);
return;
}
if (cpu->core_id < 0) {
@@ -477,7 +477,7 @@ const CPUArchIdList *x86_possible_cpu_arch_ids(MachineState *ms)
&topo_info, &topo_ids);
ms->possible_cpus->cpus[i].props.has_socket_id = true;
ms->possible_cpus->cpus[i].props.socket_id = topo_ids.pkg_id;
- if (x86ms->smp_dies > 1) {
+ if (ms->smp.dies > 1) {
ms->possible_cpus->cpus[i].props.has_die_id = true;
ms->possible_cpus->cpus[i].props.die_id = topo_ids.die_id;
}
@@ -1269,7 +1269,6 @@ static void x86_machine_initfn(Object *obj)
x86ms->smm = ON_OFF_AUTO_AUTO;
x86ms->acpi = ON_OFF_AUTO_AUTO;
- x86ms->smp_dies = 1;
x86ms->pci_irq_mask = ACPI_BUILD_PCI_IRQS;
x86ms->oem_id = g_strndup(ACPI_BUILD_APPNAME6, 6);
x86ms->oem_table_id = g_strndup(ACPI_BUILD_APPNAME8, 8);