[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC 01/18] pc: create "PC" device class
From: |
Eduardo Habkost |
Subject: |
Re: [Qemu-devel] [RFC 01/18] pc: create "PC" device class |
Date: |
Wed, 3 Oct 2012 11:48:17 -0300 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Wed, Oct 03, 2012 at 04:38:10PM +0200, Paolo Bonzini wrote:
> Il 03/10/2012 15:28, Eduardo Habkost ha scritto:
> > We can make it a child of a generic "machine" class later, but right now
> > a "PC" class is needed to allow global-properties to control some
> > details of CPU creation on the PC code.
>
> Does it need to be a Device, or can it be a normal Object (or for
> clarity a derivative of TYPE_CONTAINER)?
It needs to be a Device because that's the only way to use global
properties, today.
I have some experimental patches that allow normal objects to get global
properties set (as long as an explicit call to a
object_set_global_props() function is made). Would that be preferrable?
>
> Paolo
>
> > Signed-off-by: Eduardo Habkost <address@hidden>
> > ---
> > hw/pc.c | 18 ++++++++++++++++++
> > hw/pc.h | 6 ++++++
> > 2 files changed, 24 insertions(+)
> >
> > diff --git a/hw/pc.c b/hw/pc.c
> > index 7e7e0e2..9b68282 100644
> > --- a/hw/pc.c
> > +++ b/hw/pc.c
> > @@ -550,6 +550,24 @@ static void bochs_bios_write(void *opaque, uint32_t
> > addr, uint32_t val)
> > }
> > }
> >
> > +typedef struct PC {
> > + DeviceState parent_obj;
> > +} PC;
> > +
> > +static const TypeInfo pc_type_info = {
> > + .name = TYPE_PC_MACHINE,
> > + .parent = TYPE_DEVICE,
> > + .instance_size = sizeof(PC),
> > + .class_size = sizeof(DeviceClass),
> > +};
> > +
> > +static void pc_register_type(void)
> > +{
> > + type_register_static(&pc_type_info);
> > +}
> > +
> > +type_init(pc_register_type);
> > +
> > int e820_add_entry(uint64_t address, uint64_t length, uint32_t type)
> > {
> > int index = le32_to_cpu(e820_table.count);
> > diff --git a/hw/pc.h b/hw/pc.h
> > index e4db071..77e898f 100644
> > --- a/hw/pc.h
> > +++ b/hw/pc.h
> > @@ -102,6 +102,12 @@ void i8042_setup_a20_line(ISADevice *dev, qemu_irq
> > *a20_out);
> > /* pc.c */
> > extern int fd_bootchk;
> >
> > +#define TYPE_PC_MACHINE "PC"
> > +#define PC(obj) \
> > + OBJECT_CHECK(PC, (obj), TYPE_PC_MACHINE)
> > +struct PC;
> > +typedef struct PC PC;
> > +
> > void pc_register_ferr_irq(qemu_irq irq);
> > void pc_acpi_smi_interrupt(void *opaque, int irq, int level);
> >
> >
>
--
Eduardo
- [Qemu-devel] [RFC v2 00/18] Fix APIC-ID-based CPU topology, Eduardo Habkost, 2012/10/03
- [Qemu-devel] [RFC 09/18] target-i386: cpu: move cpuid_apic_id initialization to cpu_x86_register(), Eduardo Habkost, 2012/10/03
- [Qemu-devel] [RFC 12/18] fw_cfg: remove FW_CFG_MAX_CPUS from fw_cfg_init(), Eduardo Habkost, 2012/10/03
- [Qemu-devel] [RFC 01/18] pc: create "PC" device class, Eduardo Habkost, 2012/10/03
- Re: [Qemu-devel] [RFC 01/18] pc: create "PC" device class, Anthony Liguori, 2012/10/04
- Re: [Qemu-devel] [RFC 01/18] pc: create "PC" device class, Paolo Bonzini, 2012/10/04
- Re: [Qemu-devel] [RFC 01/18] pc: create "PC" device class, Andreas Färber, 2012/10/04
- Re: [Qemu-devel] [RFC 01/18] pc: create "PC" device class, Anthony Liguori, 2012/10/04
- Re: [Qemu-devel] [RFC 01/18] pc: create "PC" device class, Eduardo Habkost, 2012/10/04
- Re: [Qemu-devel] [RFC 01/18] pc: create "PC" device class, Anthony Liguori, 2012/10/04
- Re: [Qemu-devel] [RFC 01/18] pc: create "PC" device class, Eduardo Habkost, 2012/10/04
- Re: [Qemu-devel] [RFC 01/18] pc: create "PC" device class, Anthony Liguori, 2012/10/04
- Re: [Qemu-devel] [RFC 01/18] pc: create "PC" device class, Eduardo Habkost, 2012/10/04