qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC 1/4] target-ppc: introduce PPCMachineClass and PPC


From: David Gibson
Subject: Re: [Qemu-devel] [RFC 1/4] target-ppc: introduce PPCMachineClass and PPCMachineState
Date: Fri, 15 Apr 2016 15:13:22 +1000
User-agent: Mutt/1.5.24 (2015-08-30)

On Thu, Apr 07, 2016 at 04:23:11PM +0100, Mark Cave-Ayland wrote:
> Introduce PPCMachineClass in anticipation of making it the superclass for
> all PPC machines.
> 
> Signed-off-by: Mark Cave-Ayland <address@hidden>
> ---
>  hw/ppc/ppc.c            |   16 ++++++++++++++++
>  include/hw/ppc/ppc.h    |   16 ++++++++++++++++
>  include/qemu/typedefs.h |    2 ++
>  3 files changed, 34 insertions(+)
> 
> diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c
> index 38ff2e1..ccdca5d 100644
> --- a/hw/ppc/ppc.c
> +++ b/hw/ppc/ppc.c
> @@ -1343,3 +1343,19 @@ PowerPCCPU *ppc_get_vcpu_by_dt_id(int cpu_dt_id)
>  
>      return NULL;
>  }
> +
> +/* Generic PPC machine */
> +static const TypeInfo ppc_machine_info = {
> +    .name = TYPE_PPC_MACHINE,
> +    .parent = TYPE_MACHINE,
> +    .abstract = true,
> +    .instance_size = sizeof(PPCMachineState),
> +    .class_size = sizeof(PPCMachineClass)
> +};
> +
> +static void ppc_machine_register_types(void)
> +{
> +    type_register_static(&ppc_machine_info);
> +}
> +
> +type_init(ppc_machine_register_types)
> diff --git a/include/hw/ppc/ppc.h b/include/hw/ppc/ppc.h
> index 14efd0c..f1be147 100644
> --- a/include/hw/ppc/ppc.h
> +++ b/include/hw/ppc/ppc.h
> @@ -1,6 +1,22 @@
>  #ifndef HW_PPC_H
>  #define HW_PPC_H 1
>  
> +#include "hw/boards.h"
> +
> +struct PPCMachineState {
> +    /*< private >*/
> +    MachineState parent_obj;
> +};
> +
> +struct PPCMachineClass {
> +    /*< private >*/
> +    MachineClass parent_class;
> +};

It's normal QOM practice not to create actual typedefs if there's
nothing in them except the parent object.  I believe you're adding
something to one of these in subsequent patches, in which case it's ok
to create it here, but I don't think that's true for both of them.

> +#define TYPE_PPC_MACHINE "generic-ppc-machine"
> +#define PPC_MACHINE(obj) \
> +    OBJECT_CHECK(PPCMachineState, (obj), TYPE_PPC_MACHINE)
> +
>  void ppc_set_irq(PowerPCCPU *cpu, int n_IRQ, int level);
>  
>  /* PowerPC hardware exceptions management helpers */
> diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h
> index 1dcf6f5..73fbad5 100644
> --- a/include/qemu/typedefs.h
> +++ b/include/qemu/typedefs.h
> @@ -73,6 +73,8 @@ typedef struct PCMachineState PCMachineState;
>  typedef struct PCMCIACardState PCMCIACardState;
>  typedef struct PixelFormat PixelFormat;
>  typedef struct PostcopyDiscardState PostcopyDiscardState;
> +typedef struct PPCMachineClass PPCMachineClass;
> +typedef struct PPCMachineState PPCMachineState;
>  typedef struct Property Property;
>  typedef struct PropertyInfo PropertyInfo;
>  typedef struct QEMUBH QEMUBH;

-- 
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

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]