[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC PATCH v2 08/23] ppc: Prepare CPU socket/core abstr
From: |
David Gibson |
Subject: |
Re: [Qemu-devel] [RFC PATCH v2 08/23] ppc: Prepare CPU socket/core abstraction |
Date: |
Wed, 25 Mar 2015 13:06:31 +1100 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Mon, Mar 23, 2015 at 07:05:49PM +0530, Bharata B Rao wrote:
Again, this needs a commit message explaining why the new abstraction
is valuable.
> Signed-off-by: Bharata B Rao <address@hidden>
> Signed-off-by: Andreas Färber <address@hidden>
> ---
> hw/ppc/Makefile.objs | 1 +
> hw/ppc/cpu-core.c | 46 ++++++++++++++++++++++++++++++++++++++++++++
> hw/ppc/cpu-socket.c | 47
> +++++++++++++++++++++++++++++++++++++++++++++
> include/hw/ppc/cpu-core.h | 32 ++++++++++++++++++++++++++++++
> include/hw/ppc/cpu-socket.h | 32 ++++++++++++++++++++++++++++++
> 5 files changed, 158 insertions(+)
> create mode 100644 hw/ppc/cpu-core.c
> create mode 100644 hw/ppc/cpu-socket.c
> create mode 100644 include/hw/ppc/cpu-core.h
> create mode 100644 include/hw/ppc/cpu-socket.h
>
> diff --git a/hw/ppc/Makefile.objs b/hw/ppc/Makefile.objs
> index c8ab06e..a35cac5 100644
> --- a/hw/ppc/Makefile.objs
> +++ b/hw/ppc/Makefile.objs
> @@ -1,5 +1,6 @@
> # shared objects
> obj-y += ppc.o ppc_booke.o
> +obj-y += cpu-socket.o cpu-core.o
> # IBM pSeries (sPAPR)
> obj-$(CONFIG_PSERIES) += spapr.o spapr_vio.o spapr_events.o
> obj-$(CONFIG_PSERIES) += spapr_hcall.o spapr_iommu.o spapr_rtas.o
> diff --git a/hw/ppc/cpu-core.c b/hw/ppc/cpu-core.c
> new file mode 100644
> index 0000000..ed0481f
> --- /dev/null
> +++ b/hw/ppc/cpu-core.c
> @@ -0,0 +1,46 @@
> +/*
> + * ppc CPU core abstraction
> + *
> + * Copyright (c) 2015 SUSE Linux GmbH
> + * Copyright (C) 2015 Bharata B Rao <address@hidden>
> + */
> +
> +#include "hw/qdev.h"
> +#include "hw/ppc/cpu-core.h"
> +
> +static int ppc_cpu_core_realize_child(Object *child, void *opaque)
> +{
> + Error **errp = opaque;
> +
> + object_property_set_bool(child, true, "realized", errp);
> + if (*errp) {
> + return 1;
> + }
> +
> + return 0;
> +}
> +
> +static void ppc_cpu_core_realize(DeviceState *dev, Error **errp)
> +{
> + object_child_foreach(OBJECT(dev), ppc_cpu_core_realize_child, errp);
> +}
> +
> +static void ppc_cpu_core_class_init(ObjectClass *oc, void *data)
> +{
> + DeviceClass *dc = DEVICE_CLASS(oc);
> +
> + dc->realize = ppc_cpu_core_realize;
> +}
> +
> +static const TypeInfo ppc_cpu_core_type_info = {
> + .name = TYPE_POWERPC_CPU_CORE,
> + .parent = TYPE_DEVICE,
> + .class_init = ppc_cpu_core_class_init,
> +};
> +
> +static void ppc_cpu_core_register_types(void)
> +{
> + type_register_static(&ppc_cpu_core_type_info);
> +}
> +
> +type_init(ppc_cpu_core_register_types)
> diff --git a/hw/ppc/cpu-socket.c b/hw/ppc/cpu-socket.c
> new file mode 100644
> index 0000000..602a060
> --- /dev/null
> +++ b/hw/ppc/cpu-socket.c
> @@ -0,0 +1,47 @@
> +/*
> + * PPC CPU socket abstraction
> + *
> + * Copyright (c) 2015 SUSE Linux GmbH
> + * Copyright (C) 2015 Bharata B Rao <address@hidden>
> + */
> +
> +#include "hw/qdev.h"
> +#include "hw/ppc/cpu-socket.h"
> +#include "sysemu/cpus.h"
> +
> +static int ppc_cpu_socket_realize_child(Object *child, void *opaque)
> +{
> + Error **errp = opaque;
> +
> + object_property_set_bool(child, true, "realized", errp);
> + if (*errp) {
> + return 1;
> + } else {
> + return 0;
> + }
> +}
> +
> +static void ppc_cpu_socket_realize(DeviceState *dev, Error **errp)
> +{
> + object_child_foreach(OBJECT(dev), ppc_cpu_socket_realize_child, errp);
> +}
> +
> +static void ppc_cpu_socket_class_init(ObjectClass *oc, void *data)
> +{
> + DeviceClass *dc = DEVICE_CLASS(oc);
> +
> + dc->realize = ppc_cpu_socket_realize;
> +}
> +
> +static const TypeInfo ppc_cpu_socket_type_info = {
> + .name = TYPE_POWERPC_CPU_SOCKET,
> + .parent = TYPE_CPU_SOCKET,
> + .class_init = ppc_cpu_socket_class_init,
> +};
> +
> +static void ppc_cpu_socket_register_types(void)
> +{
> + type_register_static(&ppc_cpu_socket_type_info);
> +}
> +
> +type_init(ppc_cpu_socket_register_types)
> diff --git a/include/hw/ppc/cpu-core.h b/include/hw/ppc/cpu-core.h
> new file mode 100644
> index 0000000..95f1c28
> --- /dev/null
> +++ b/include/hw/ppc/cpu-core.h
> @@ -0,0 +1,32 @@
> +/*
> + * PowerPC CPU core abstraction
> + *
> + * Copyright (c) 2015 SUSE Linux GmbH
> + * Copyright (C) 2015 Bharata B Rao <address@hidden>
> + */
> +#ifndef HW_PPC_CPU_CORE_H
> +#define HW_PPC_CPU_CORE_H
> +
> +#include "hw/qdev.h"
> +#include "cpu.h"
> +
> +#ifdef TARGET_PPC64
> +#define TYPE_POWERPC_CPU_CORE "powerpc64-cpu-core"
> +#elif defined(TARGET_PPCEMB)
> +#define TYPE_POWERPC_CPU_CORE "embedded-powerpc-cpu-core"
> +#else
> +#define TYPE_POWERPC_CPU_CORE "powerpc-cpu-core"
> +#endif
> +
> +#define POWERPC_CPU_CORE(obj) \
> + OBJECT_CHECK(PowerPCCPUCore, (obj), TYPE_POWERPC_CPU_CORE)
> +
> +typedef struct PowerPCCPUCore {
> + /*< private >*/
> + DeviceState parent_obj;
> + /*< public >*/
> +
> + PowerPCCPU thread[0];
> +} PowerPCCPUCore;
> +
> +#endif
> diff --git a/include/hw/ppc/cpu-socket.h b/include/hw/ppc/cpu-socket.h
> new file mode 100644
> index 0000000..5ae19d0
> --- /dev/null
> +++ b/include/hw/ppc/cpu-socket.h
> @@ -0,0 +1,32 @@
> +/*
> + * PowerPC CPU socket abstraction
> + *
> + * Copyright (c) 2015 SUSE Linux GmbH
> + * Copyright (C) 2015 Bharata B Rao <address@hidden>
> + */
> +#ifndef HW_PPC_CPU_SOCKET_H
> +#define HW_PPC_CPU_SOCKET_H
> +
> +#include "hw/cpu/socket.h"
> +#include "cpu-core.h"
> +
> +#ifdef TARGET_PPC64
> +#define TYPE_POWERPC_CPU_SOCKET "powerpc64-cpu-socket"
> +#elif defined(TARGET_PPCEMB)
> +#define TYPE_POWERPC_CPU_SOCKET "embedded-powerpc-cpu-socket"
> +#else
> +#define TYPE_POWERPC_CPU_SOCKET "powerpc-cpu-socket"
> +#endif
> +
> +#define POWERPC_CPU_SOCKET(obj) \
> + OBJECT_CHECK(PowerPCCPUSocket, (obj), TYPE_POWERPC_CPU_SOCKET)
> +
> +typedef struct PowerPCCPUSocket {
> + /*< private >*/
> + DeviceState parent_obj;
> + /*< public >*/
> +
> + PowerPCCPUCore core[0];
> +} PowerPCCPUSocket;
> +
> +#endif
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
pgpYL4VhQqb2Z.pgp
Description: PGP signature
- Re: [Qemu-devel] [RFC PATCH v2 05/23] spapr: Reorganize CPU dt generation code, (continued)
[Qemu-devel] [RFC PATCH v2 04/23] spapr: Support ibm, lrdr-capacity device tree property, Bharata B Rao, 2015/03/23
[Qemu-devel] [RFC PATCH v2 03/23] spapr: Consider max_cpus during xics initialization, Bharata B Rao, 2015/03/23
[Qemu-devel] [RFC PATCH v2 06/23] spapr: Consolidate cpu init code into a routine, Bharata B Rao, 2015/03/23
[Qemu-devel] [RFC PATCH v2 07/23] cpu: Prepare Socket container type, Bharata B Rao, 2015/03/23
[Qemu-devel] [RFC PATCH v2 08/23] ppc: Prepare CPU socket/core abstraction, Bharata B Rao, 2015/03/23
- Re: [Qemu-devel] [RFC PATCH v2 08/23] ppc: Prepare CPU socket/core abstraction,
David Gibson <=
[Qemu-devel] [RFC PATCH v2 10/23] ppc: Update cpu_model in MachineState, Bharata B Rao, 2015/03/23
[Qemu-devel] [RFC PATCH v2 12/23] spapr: CPU hotplug support, Bharata B Rao, 2015/03/23
[Qemu-devel] [RFC PATCH v2 09/23] spapr: Add CPU hotplug handler, Bharata B Rao, 2015/03/23
[Qemu-devel] [RFC PATCH v2 11/23] ppc: Create sockets and cores for CPUs, Bharata B Rao, 2015/03/23