2007-11-17 20:14:51 +03:00
|
|
|
/* Declarations for use by board files for creating devices. */
|
|
|
|
|
|
|
|
#ifndef HW_BOARDS_H
|
|
|
|
#define HW_BOARDS_H
|
|
|
|
|
2014-04-09 21:34:52 +04:00
|
|
|
#include "qemu/typedefs.h"
|
2012-12-17 21:20:04 +04:00
|
|
|
#include "sysemu/blockdev.h"
|
2014-09-27 00:45:31 +04:00
|
|
|
#include "sysemu/accel.h"
|
2013-02-04 18:40:22 +04:00
|
|
|
#include "hw/qdev.h"
|
2014-03-05 21:30:45 +04:00
|
|
|
#include "qom/object.h"
|
2009-07-15 15:48:21 +04:00
|
|
|
|
2012-10-16 00:22:02 +04:00
|
|
|
|
2014-05-07 18:42:57 +04:00
|
|
|
typedef void QEMUMachineInitFunc(MachineState *ms);
|
2007-11-17 20:14:51 +03:00
|
|
|
|
2012-08-07 10:41:51 +04:00
|
|
|
typedef void QEMUMachineResetFunc(void);
|
|
|
|
|
2013-04-30 17:41:24 +04:00
|
|
|
typedef void QEMUMachineHotAddCPUFunc(const int64_t id, Error **errp);
|
|
|
|
|
2013-12-23 19:40:40 +04:00
|
|
|
typedef int QEMUMachineGetKvmtypeFunc(const char *arg);
|
|
|
|
|
2013-10-30 16:56:39 +04:00
|
|
|
struct QEMUMachine {
|
2007-11-17 20:14:51 +03:00
|
|
|
const char *name;
|
2009-07-22 13:02:50 +04:00
|
|
|
const char *alias;
|
2007-11-17 20:14:51 +03:00
|
|
|
const char *desc;
|
|
|
|
QEMUMachineInitFunc *init;
|
2012-08-07 10:41:51 +04:00
|
|
|
QEMUMachineResetFunc *reset;
|
2013-04-30 17:41:24 +04:00
|
|
|
QEMUMachineHotAddCPUFunc *hot_add_cpu;
|
2013-12-23 19:40:40 +04:00
|
|
|
QEMUMachineGetKvmtypeFunc *kvm_type;
|
2012-11-20 18:30:34 +04:00
|
|
|
BlockInterfaceType block_default_type;
|
pc/vl: Add units-per-default-bus property
This patch adds the 'units_per_default_bus' property which
allows individual boards to declare their desired
index => (bus,unit) mapping for their default HBA, so that
boards such as Q35 can specify that its default if_ide HBA,
AHCI, only accepts one unit per bus.
This property only overrides the mapping for drives matching
the block_default_type interface.
This patch also adds this property to *all* past and present
Q35 machine types. This retroactive addition is justified
because the previous erroneous index=>(bus,unit) mappings
caused by lack of such a property were not utilized due to
lack of initialization code in the Q35 init routine.
Further, semantically, the Q35 board type has always had the
property that its default HBA, AHCI, only accepts one unit per
bus. The new code added to add devices to drives relies upon
the accuracy of this mapping. Thus, the property is applied
retroactively to reduce complexity of allowing IDE HBAs with
different units per bus.
Examples:
Prior to this patch, all IDE HBAs were assumed to use 2 units
per bus (Master, Slave). When using Q35 and AHCI, however, we
only allow one unit per bus.
-hdb foo.qcow2 would become index=1, or bus=0,unit=1.
-hdd foo.qcow2 would become index=3, or bus=1,unit=1.
-drive file=foo.qcow2,index=5 becomes bus=2,unit=1.
These are invalid for AHCI. They now become, under Q35 only:
-hdb foo.qcow2 --> index=1, bus=1, unit=0.
-hdd foo.qcow2 --> index=3, bus=3, unit=0.
-drive file=foo.qcow2,index=5 --> bus=5,unit=0.
The mapping is adjusted based on the fact that the default IF
for the Q35 machine type is IF_IDE, and units-per-default-bus
overrides the IDE mapping from its default of 2 units per bus
to just 1 unit per bus.
Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Message-id: 1412187569-23452-4-git-send-email-jsnow@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-10-01 22:19:26 +04:00
|
|
|
int units_per_default_bus;
|
2008-10-08 00:39:39 +04:00
|
|
|
int max_cpus;
|
2009-12-25 19:12:26 +03:00
|
|
|
unsigned int no_serial:1,
|
2009-12-08 15:11:54 +03:00
|
|
|
no_parallel:1,
|
|
|
|
use_virtcon:1,
|
2013-01-24 15:18:52 +04:00
|
|
|
use_sclp:1,
|
2009-12-16 16:25:39 +03:00
|
|
|
no_floppy:1,
|
|
|
|
no_cdrom:1,
|
|
|
|
no_sdcard:1;
|
2009-05-22 05:41:01 +04:00
|
|
|
int is_default;
|
2010-11-22 18:44:15 +03:00
|
|
|
const char *default_machine_opts;
|
hw: Clean up bogus default boot order
We set default boot order "cad" in every single machine definition
except "pseries" and "moxiesim", even though very few boards actually
care for boot order, and "cad" makes sense for even fewer.
Machines that care:
* pc and its variants
Accept up to three letters 'a', 'b' (undocumented alias for 'a'),
'c', 'd' and 'n'. Reject all others (fatal with -boot).
* nseries (n800, n810)
Check whether order starts with 'n'. Silently ignored otherwise.
* prep, g3beige, mac99
Extract the first character the machine understands (subset of
'a'..'f'). Silently ignored otherwise.
* spapr
Accept an arbitrary string (vl.c restricts it to contain only
'a'..'p', no duplicates).
* sun4[mdc]
Use the first character. Silently ignored otherwise.
Strip characters these machines ignore from their default boot order.
For all other machines, remove the unused default boot order
alltogether.
Note that my rename of QEMUMachine member boot_order to
default_boot_order and QEMUMachineInitArgs member boot_device to
boot_order has a welcome side effect: it makes every use of boot
orders visible in this patch, for easy review.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2013-08-16 15:13:50 +04:00
|
|
|
const char *default_boot_order;
|
2009-12-08 15:11:33 +03:00
|
|
|
GlobalProperty *compat_props;
|
2012-05-30 07:35:51 +04:00
|
|
|
const char *hw_version;
|
2013-10-30 16:56:39 +04:00
|
|
|
};
|
2007-11-17 20:14:51 +03:00
|
|
|
|
2014-05-14 13:43:15 +04:00
|
|
|
void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner,
|
|
|
|
const char *name,
|
|
|
|
uint64_t ram_size);
|
|
|
|
|
2007-11-17 20:14:51 +03:00
|
|
|
int qemu_register_machine(QEMUMachine *m);
|
2009-02-11 18:21:54 +03:00
|
|
|
|
2014-05-14 13:43:15 +04:00
|
|
|
#define TYPE_MACHINE_SUFFIX "-machine"
|
2014-03-05 21:30:45 +04:00
|
|
|
#define TYPE_MACHINE "machine"
|
2014-03-18 19:26:35 +04:00
|
|
|
#undef MACHINE /* BSD defines it and QEMU does not use it */
|
2014-03-05 21:30:45 +04:00
|
|
|
#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)
|
|
|
|
|
2014-03-05 21:30:47 +04:00
|
|
|
MachineClass *find_default_machine(void);
|
|
|
|
extern MachineState *current_machine;
|
|
|
|
|
2014-03-05 21:30:45 +04:00
|
|
|
/**
|
|
|
|
* MachineClass:
|
|
|
|
* @qemu_machine: #QEMUMachine
|
2014-06-02 17:25:03 +04:00
|
|
|
* @get_hotplug_handler: this function is called during bus-less
|
|
|
|
* device hotplug. If defined it returns pointer to an instance
|
|
|
|
* of HotplugHandler object, which handles hotplug operation
|
|
|
|
* for a given @dev. It may return NULL if @dev doesn't require
|
|
|
|
* any actions to be performed by hotplug handler.
|
2014-03-05 21:30:45 +04:00
|
|
|
*/
|
|
|
|
struct MachineClass {
|
|
|
|
/*< private >*/
|
|
|
|
ObjectClass parent_class;
|
|
|
|
/*< public >*/
|
|
|
|
|
2014-04-09 21:34:50 +04:00
|
|
|
const char *name;
|
|
|
|
const char *alias;
|
|
|
|
const char *desc;
|
|
|
|
|
2014-05-07 18:42:57 +04:00
|
|
|
void (*init)(MachineState *state);
|
2014-04-09 21:34:50 +04:00
|
|
|
void (*reset)(void);
|
|
|
|
void (*hot_add_cpu)(const int64_t id, Error **errp);
|
|
|
|
int (*kvm_type)(const char *arg);
|
|
|
|
|
|
|
|
BlockInterfaceType block_default_type;
|
pc/vl: Add units-per-default-bus property
This patch adds the 'units_per_default_bus' property which
allows individual boards to declare their desired
index => (bus,unit) mapping for their default HBA, so that
boards such as Q35 can specify that its default if_ide HBA,
AHCI, only accepts one unit per bus.
This property only overrides the mapping for drives matching
the block_default_type interface.
This patch also adds this property to *all* past and present
Q35 machine types. This retroactive addition is justified
because the previous erroneous index=>(bus,unit) mappings
caused by lack of such a property were not utilized due to
lack of initialization code in the Q35 init routine.
Further, semantically, the Q35 board type has always had the
property that its default HBA, AHCI, only accepts one unit per
bus. The new code added to add devices to drives relies upon
the accuracy of this mapping. Thus, the property is applied
retroactively to reduce complexity of allowing IDE HBAs with
different units per bus.
Examples:
Prior to this patch, all IDE HBAs were assumed to use 2 units
per bus (Master, Slave). When using Q35 and AHCI, however, we
only allow one unit per bus.
-hdb foo.qcow2 would become index=1, or bus=0,unit=1.
-hdd foo.qcow2 would become index=3, or bus=1,unit=1.
-drive file=foo.qcow2,index=5 becomes bus=2,unit=1.
These are invalid for AHCI. They now become, under Q35 only:
-hdb foo.qcow2 --> index=1, bus=1, unit=0.
-hdd foo.qcow2 --> index=3, bus=3, unit=0.
-drive file=foo.qcow2,index=5 --> bus=5,unit=0.
The mapping is adjusted based on the fact that the default IF
for the Q35 machine type is IF_IDE, and units-per-default-bus
overrides the IDE mapping from its default of 2 units per bus
to just 1 unit per bus.
Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Message-id: 1412187569-23452-4-git-send-email-jsnow@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-10-01 22:19:26 +04:00
|
|
|
int units_per_default_bus;
|
2014-04-09 21:34:50 +04:00
|
|
|
int max_cpus;
|
|
|
|
unsigned int no_serial:1,
|
|
|
|
no_parallel:1,
|
|
|
|
use_virtcon:1,
|
|
|
|
use_sclp:1,
|
|
|
|
no_floppy:1,
|
|
|
|
no_cdrom:1,
|
|
|
|
no_sdcard:1;
|
|
|
|
int is_default;
|
|
|
|
const char *default_machine_opts;
|
|
|
|
const char *default_boot_order;
|
|
|
|
GlobalProperty *compat_props;
|
|
|
|
const char *hw_version;
|
2014-06-02 17:25:03 +04:00
|
|
|
|
|
|
|
HotplugHandler *(*get_hotplug_handler)(MachineState *machine,
|
|
|
|
DeviceState *dev);
|
2014-03-05 21:30:45 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* MachineState:
|
|
|
|
*/
|
|
|
|
struct MachineState {
|
|
|
|
/*< private >*/
|
|
|
|
Object parent_obj;
|
|
|
|
/*< public >*/
|
|
|
|
|
|
|
|
char *accel;
|
|
|
|
bool kernel_irqchip;
|
|
|
|
int kvm_shadow_mem;
|
|
|
|
char *dtb;
|
|
|
|
char *dumpdtb;
|
|
|
|
int phandle_start;
|
|
|
|
char *dt_compatible;
|
|
|
|
bool dump_guest_core;
|
|
|
|
bool mem_merge;
|
|
|
|
bool usb;
|
|
|
|
char *firmware;
|
2014-08-16 09:55:40 +04:00
|
|
|
bool iommu;
|
2014-03-05 21:30:45 +04:00
|
|
|
|
2014-05-07 18:42:57 +04:00
|
|
|
ram_addr_t ram_size;
|
2014-06-02 17:25:02 +04:00
|
|
|
ram_addr_t maxram_size;
|
|
|
|
uint64_t ram_slots;
|
2014-05-07 18:42:57 +04:00
|
|
|
const char *boot_order;
|
2014-05-26 16:40:58 +04:00
|
|
|
char *kernel_filename;
|
|
|
|
char *kernel_cmdline;
|
|
|
|
char *initrd_filename;
|
2014-05-07 18:42:57 +04:00
|
|
|
const char *cpu_model;
|
2014-09-27 00:45:31 +04:00
|
|
|
AccelState *accelerator;
|
2014-03-05 21:30:45 +04:00
|
|
|
};
|
|
|
|
|
2007-11-17 20:14:51 +03:00
|
|
|
#endif
|