Add sPAPR specific abastract CPU core device that is based on generic CPU core device. This will serve as base type for all PowerPC CPU specific core devices.
Signed-off-by: Bharata B Rao <bhar...@linux.vnet.ibm.com> --- hw/ppc/Makefile.objs | 1 + hw/ppc/spapr_cpu_core.c | 30 ++++++++++++++++++++++++++++++ include/hw/ppc/spapr_cpu_core.h | 27 +++++++++++++++++++++++++++ 3 files changed, 58 insertions(+) create mode 100644 hw/ppc/spapr_cpu_core.c create mode 100644 include/hw/ppc/spapr_cpu_core.h diff --git a/hw/ppc/Makefile.objs b/hw/ppc/Makefile.objs index c1ffc77..5cc6608 100644 --- a/hw/ppc/Makefile.objs +++ b/hw/ppc/Makefile.objs @@ -4,6 +4,7 @@ obj-y += ppc.o ppc_booke.o obj-$(CONFIG_PSERIES) += spapr.o spapr_vio.o spapr_events.o obj-$(CONFIG_PSERIES) += spapr_hcall.o spapr_iommu.o spapr_rtas.o obj-$(CONFIG_PSERIES) += spapr_pci.o spapr_rtc.o spapr_drc.o spapr_rng.o +obj-$(CONFIG_PSERIES) += spapr_cpu_core.o ifeq ($(CONFIG_PCI)$(CONFIG_PSERIES)$(CONFIG_LINUX), yyy) obj-y += spapr_pci_vfio.o endif diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c new file mode 100644 index 0000000..8cbe2a5 --- /dev/null +++ b/hw/ppc/spapr_cpu_core.c @@ -0,0 +1,30 @@ +/* + * sPAPR CPU core device, acts as container of CPU thread devices. + * + * Copyright (C) 2016 Bharata B Rao <bhar...@linux.vnet.ibm.com> + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ +#include "hw/cpu/core.h" +#include "hw/ppc/spapr_cpu_core.h" +#include "hw/ppc/spapr.h" +#include "hw/boards.h" +#include "qemu/error-report.h" +#include "qapi/visitor.h" +#include <sysemu/cpus.h> +#include "target-ppc/kvm_ppc.h" + +static const TypeInfo spapr_cpu_core_type_info = { + .name = TYPE_SPAPR_CPU_CORE, + .parent = TYPE_CPU_CORE, + .abstract = true, + .instance_size = sizeof(sPAPRCPUCore), +}; + +static void spapr_cpu_core_register_types(void) +{ + type_register_static(&spapr_cpu_core_type_info); +} + +type_init(spapr_cpu_core_register_types) diff --git a/include/hw/ppc/spapr_cpu_core.h b/include/hw/ppc/spapr_cpu_core.h new file mode 100644 index 0000000..e3340ea --- /dev/null +++ b/include/hw/ppc/spapr_cpu_core.h @@ -0,0 +1,27 @@ +/* + * sPAPR CPU core device. + * + * Copyright (C) 2016 Bharata B Rao <bhar...@linux.vnet.ibm.com> + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ +#ifndef HW_SPAPR_CPU_CORE_H +#define HW_SPAPR_CPU_CORE_H + +#include "hw/qdev.h" +#include "hw/cpu/core.h" + +#define TYPE_SPAPR_CPU_CORE "spapr-cpu-core" +#define SPAPR_CPU_CORE(obj) \ + OBJECT_CHECK(sPAPRCPUCore, (obj), TYPE_SPAPR_CPU_CORE) + +typedef struct sPAPRCPUCore { + /*< private >*/ + CPUCore parent_obj; + + /*< public >*/ + PowerPCCPU *threads; +} sPAPRCPUCore; + +#endif -- 2.1.0