[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [RFC 23/41] hw/cpu/die: Abstract cpu-die level as topology device
From: Zhao Liu <zhao1.liu@xxxxxxxxx> Abstract die level as a topology device "cpu-die" to allow user to create die level topology from cli and later the cpu-dies could be added into topology tree. In addition, mark the cpu-die as DEVICE_CATEGORY_CPU_DEF category to indicate it belongs to the basic CPU definition and should be created from cli before board initialization. Signed-off-by: Zhao Liu <zhao1.liu@xxxxxxxxx> --- MAINTAINERS | 2 ++ hw/cpu/die.c | 46 ++++++++++++++++++++++++++++++++++++++++++++ hw/cpu/meson.build | 2 +- include/hw/cpu/die.h | 38 ++++++++++++++++++++++++++++++++++++ 4 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 hw/cpu/die.c create mode 100644 include/hw/cpu/die.h diff --git a/MAINTAINERS b/MAINTAINERS index 89e350866d6a..91d0936edb32 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1863,6 +1863,7 @@ F: hw/core/machine-smp.c F: hw/core/null-machine.c F: hw/core/numa.c F: hw/cpu/cluster.c +F: hw/cpu/die.c F: qapi/machine.json F: qapi/machine-common.json F: qapi/machine-target.json @@ -1870,6 +1871,7 @@ F: include/hw/boards.h F: include/hw/core/cpu.h F: include/hw/core/cpu-topo.h F: include/hw/cpu/cluster.h +F: include/hw/cpu/die.h F: include/sysemu/numa.h F: tests/unit/test-smp-parse.c T: git https://gitlab.com/ehabkost/qemu.git machine-next diff --git a/hw/cpu/die.c b/hw/cpu/die.c new file mode 100644 index 000000000000..06c4f7cc8fa2 --- /dev/null +++ b/hw/cpu/die.c @@ -0,0 +1,46 @@ +/* + * CPU die abstract device + * + * Copyright (c) 2023 Intel Corporation + * Author: Zhao Liu <zhao1.liu@xxxxxxxxx> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, + * or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see <http://www.gnu.org/licenses/>. + */ + +#include "qemu/osdep.h" +#include "hw/cpu/die.h" + +static void cpu_die_class_init(ObjectClass *oc, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(oc); + CPUTopoClass *tc = CPU_TOPO_CLASS(oc); + + set_bit(DEVICE_CATEGORY_CPU_DEF, dc->categories); + + tc->level = CPU_TOPO_DIE; +} + +static const TypeInfo cpu_die_type_info = { + .name = TYPE_CPU_DIE, + .parent = TYPE_CPU_TOPO, + .class_init = cpu_die_class_init, + .instance_size = sizeof(CPUDie), +}; + +static void cpu_die_register_types(void) +{ + type_register_static(&cpu_die_type_info); +} + +type_init(cpu_die_register_types) diff --git a/hw/cpu/meson.build b/hw/cpu/meson.build index 6d319947ca0b..e685fe1c7d8a 100644 --- a/hw/cpu/meson.build +++ b/hw/cpu/meson.build @@ -1,4 +1,4 @@ -system_ss.add(files('core.c', 'cluster.c')) +system_ss.add(files('core.c', 'cluster.c', 'die.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/include/hw/cpu/die.h b/include/hw/cpu/die.h new file mode 100644 index 000000000000..4c68786b5f2f --- /dev/null +++ b/include/hw/cpu/die.h @@ -0,0 +1,38 @@ +/* + * CPU die abstract device + * + * Copyright (c) 2023 Intel Corporation + * Author: Zhao Liu <zhao1.liu@xxxxxxxxx> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, + * or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef HW_CPU_DIE_H +#define HW_CPU_DIE_H + +#include "hw/core/cpu-topo.h" +#include "hw/qdev-core.h" + +#define TYPE_CPU_DIE "cpu-die" + +OBJECT_DECLARE_SIMPLE_TYPE(CPUDie, CPU_DIE) + +struct CPUDie { + /*< private >*/ + CPUTopoState obj; + + /*< public >*/ +}; + +#endif /* HW_CPU_DIE_H */ -- 2.34.1
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |