mirror of https://github.com/xqemu/xqemu.git
hw/core: Introduce QEMU machine as QOM object
The main functional change is to convert QEMUMachine into MachineClass and QEMUMachineInitArgs into MachineState, instance of MachineClass. As a first step, in order to make possible an incremental development, both QEMUMachine and QEMUMachineInitArgs are being embedded into the new types. Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
parent
49649f23db
commit
36d20cb2b3
|
@ -8,7 +8,7 @@ common-obj-$(CONFIG_EMPTY_SLOT) += empty_slot.o
|
|||
common-obj-$(CONFIG_XILINX_AXI) += stream.o
|
||||
common-obj-$(CONFIG_PTIMER) += ptimer.o
|
||||
common-obj-$(CONFIG_SOFTMMU) += sysbus.o
|
||||
common-obj-$(CONFIG_SOFTMMU) += machine.o
|
||||
common-obj-$(CONFIG_SOFTMMU) += null-machine.o
|
||||
common-obj-$(CONFIG_SOFTMMU) += loader.o
|
||||
common-obj-$(CONFIG_SOFTMMU) += qdev-properties-system.o
|
||||
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* QEMU Machine
|
||||
*
|
||||
* Copyright (C) 2014 Red Hat Inc
|
||||
*
|
||||
* Authors:
|
||||
* Marcel Apfelbaum <marcel.a@redhat.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/boards.h"
|
||||
|
||||
static const TypeInfo machine_info = {
|
||||
.name = TYPE_MACHINE,
|
||||
.parent = TYPE_OBJECT,
|
||||
.abstract = true,
|
||||
.class_size = sizeof(MachineClass),
|
||||
.instance_size = sizeof(MachineState),
|
||||
};
|
||||
|
||||
static void machine_register_types(void)
|
||||
{
|
||||
type_register_static(&machine_info);
|
||||
}
|
||||
|
||||
type_init(machine_register_types)
|
|
@ -6,6 +6,7 @@
|
|||
#include "sysemu/blockdev.h"
|
||||
#include "sysemu/qemumachine.h"
|
||||
#include "hw/qdev.h"
|
||||
#include "qom/object.h"
|
||||
|
||||
typedef struct QEMUMachineInitArgs {
|
||||
const QEMUMachine *machine;
|
||||
|
@ -55,4 +56,53 @@ QEMUMachine *find_default_machine(void);
|
|||
|
||||
extern QEMUMachine *current_machine;
|
||||
|
||||
#define TYPE_MACHINE "machine"
|
||||
#define MACHINE(obj) \
|
||||
OBJECT_CHECK(MachineState, (obj), TYPE_MACHINE)
|
||||
#define MACHINE_GET_CLASS(obj) \
|
||||
OBJECT_GET_CLASS(MachineClass, (obj), TYPE_MACHINE)
|
||||
#define MACHINE_CLASS(klass) \
|
||||
OBJECT_CLASS_CHECK(MachineClass, (klass), TYPE_MACHINE)
|
||||
|
||||
typedef struct MachineState MachineState;
|
||||
typedef struct MachineClass MachineClass;
|
||||
|
||||
/**
|
||||
* MachineClass:
|
||||
* @qemu_machine: #QEMUMachine
|
||||
*/
|
||||
struct MachineClass {
|
||||
/*< private >*/
|
||||
ObjectClass parent_class;
|
||||
/*< public >*/
|
||||
|
||||
QEMUMachine *qemu_machine;
|
||||
};
|
||||
|
||||
/**
|
||||
* MachineState:
|
||||
*/
|
||||
struct MachineState {
|
||||
/*< private >*/
|
||||
Object parent_obj;
|
||||
/*< public >*/
|
||||
|
||||
char *accel;
|
||||
bool kernel_irqchip;
|
||||
int kvm_shadow_mem;
|
||||
char *kernel;
|
||||
char *initrd;
|
||||
char *append;
|
||||
char *dtb;
|
||||
char *dumpdtb;
|
||||
int phandle_start;
|
||||
char *dt_compatible;
|
||||
bool dump_guest_core;
|
||||
bool mem_merge;
|
||||
bool usb;
|
||||
char *firmware;
|
||||
|
||||
QEMUMachineInitArgs init_args;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue