[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v4 01/43] hw/boards: Add struct CpuTopology to Machin
From: |
Eduardo Habkost |
Subject: |
[Qemu-devel] [PULL v4 01/43] hw/boards: Add struct CpuTopology to MachineState |
Date: |
Wed, 3 Jul 2019 15:06:44 -0300 |
From: Like Xu <address@hidden>
The cpu topology property CpuTopology is added to the MachineState
and its members are initialized with the leagcy global smp variables.
>From this commit, the code in the system emulation mode is supposed to
use cpu topology variables from MachineState instead of the global ones
defined in vl.c and there is no semantic change.
Suggested-by: Igor Mammedov <address@hidden>
Suggested-by: Eduardo Habkost <address@hidden>
Signed-off-by: Like Xu <address@hidden>
Reviewed-by: Alistair Francis <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Eduardo Habkost <address@hidden>
---
include/hw/boards.h | 15 +++++++++++++++
vl.c | 5 +++++
2 files changed, 20 insertions(+)
diff --git a/include/hw/boards.h b/include/hw/boards.h
index eaa050a7ab..31dab77b4b 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -231,6 +231,20 @@ typedef struct DeviceMemoryState {
MemoryRegion mr;
} DeviceMemoryState;
+/**
+ * CpuTopology:
+ * @cpus: the number of present logical processors on the machine
+ * @cores: the number of cores in one package
+ * @threads: the number of threads in one core
+ * @max_cpus: the maximum number of logical processors on the machine
+ */
+typedef struct CpuTopology {
+ unsigned int cpus;
+ unsigned int cores;
+ unsigned int threads;
+ unsigned int max_cpus;
+} CpuTopology;
+
/**
* MachineState:
*/
@@ -273,6 +287,7 @@ struct MachineState {
const char *cpu_type;
AccelState *accelerator;
CPUArchIdList *possible_cpus;
+ CpuTopology smp;
struct NVDIMMState *nvdimms_state;
};
diff --git a/vl.c b/vl.c
index 99a56b5556..e9698cb1b1 100644
--- a/vl.c
+++ b/vl.c
@@ -4059,6 +4059,11 @@ int main(int argc, char **argv, char **envp)
smp_parse(qemu_opts_find(qemu_find_opts("smp-opts"), NULL));
+ current_machine->smp.cpus = smp_cpus;
+ current_machine->smp.max_cpus = max_cpus;
+ current_machine->smp.cores = smp_cores;
+ current_machine->smp.threads = smp_threads;
+
/* sanity-check smp_cpus and max_cpus against machine_class */
if (smp_cpus < machine_class->min_cpus) {
error_report("Invalid SMP CPUs %d. The min CPUs "
--
2.18.0.rc1.1.g3f1ff2140
- [Qemu-devel] [PULL v4 00/43] Machine and x86 queue, 2019-07-03, Eduardo Habkost, 2019/07/03
- [Qemu-devel] [PULL v4 01/43] hw/boards: Add struct CpuTopology to MachineState,
Eduardo Habkost <=
- [Qemu-devel] [PULL v4 02/43] machine: Refactor smp-related call chains to pass MachineState, Eduardo Habkost, 2019/07/03
- [Qemu-devel] [PULL v4 03/43] general: Replace global smp variables with smp machine properties, Eduardo Habkost, 2019/07/03
- [Qemu-devel] [PULL v4 05/43] hw/riscv: Replace global smp variables with machine smp properties, Eduardo Habkost, 2019/07/03
- [Qemu-devel] [PULL v4 04/43] hw/ppc: Replace global smp variables with machine smp properties, Eduardo Habkost, 2019/07/03
- [Qemu-devel] [PULL v4 06/43] hw/s390x: Replace global smp variables with machine smp properties, Eduardo Habkost, 2019/07/03
- [Qemu-devel] [PULL v4 07/43] hw/i386: Replace global smp variables with machine smp properties, Eduardo Habkost, 2019/07/03
- [Qemu-devel] [PULL v4 08/43] hw/arm: Replace global smp variables with machine smp properties, Eduardo Habkost, 2019/07/03
- [Qemu-devel] [PULL v4 10/43] vl.c: Replace smp global variables with smp machine properties, Eduardo Habkost, 2019/07/03
- [Qemu-devel] [PULL v4 09/43] hw: Replace global smp variables with MachineState for all remaining archs, Eduardo Habkost, 2019/07/03
- [Qemu-devel] [PULL v4 11/43] i386: Add die-level cpu topology to x86CPU on PCMachine, Eduardo Habkost, 2019/07/03