Merge remote-tracking branch 'remotes/ehabkost/tags/machine-next-pull-request' into staging

Machine queue post-3.1.0 (including 4.0 machine-types)

Features:
* Add 4.0 machine-types to q35/440fx/arm/spapr (Alex Williamson)

Documentation:
* Document vCPU hotplug procedure (Kashyap Chamarthy)
* Deprecate `cpu-add` monitor commands (Kashyap Chamarthy)

Bug fixes:
* A small sun4v_rtc_write() tracing fix that fell through the cracks
  (Eduardo Habkost)
* Validation of "host-nodes" option on memory backends (Eduardo Habkost)
* memory-device fixes and cleanups (David Hildenbrand)

Cleanups:
* Machine-type code cleanup (remove unnecessary instance_init functions)
  (Eduardo Habkost)
* qdev, qom, and global property code cleanups (Marc-André Lureau)
* PCMachineState field renames (Corey Minyard)
* numa: Match struct to typedef name (Eric Blake)
* hostmem-file: remove object id from pmem error message (Zhang Yi)

# gpg: Signature made Tue 11 Dec 2018 17:58:03 GMT
# gpg:                using RSA key 2807936F984DC5A6
# gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>"
# Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF  D1AA 2807 936F 984D C5A6

* remotes/ehabkost/tags/machine-next-pull-request: (24 commits)
  qom: remove unimplemented class_finalize
  qdev: move qdev_prop_register_global_list() to tests
  accel: register global_props like machine globals
  qom: make user_creatable_complete() specific to UserCreatable
  qom: make interface types abstract
  tests: qdev_prop_check_globals() doesn't return "all_used"
  pc: Use default_machine_opts to set suppress_vmdesc
  spapr: Delete instance_options functions
  spapr: Use default_machine_opts to set suppress_vmdesc
  spapr: Use default_machine_opts to set use_hotplug_event_source
  virt: Eliminate separate instance_init functions
  q35/440fx/arm/spapr: Add QEMU 4.0 machine type
  hostmem: Validate host-nodes before setting bitmap
  numa: Match struct to typedef name
  i386: Rename bools in PCMachineState to end in _enabled
  move ObjectClass to typedefs.h
  memory-device: avoid overflows on very huge devices
  memory-device: use QEMU_IS_ALIGNED
  range: pass const pointer where possible
  Deprecate HMP `cpu-add`
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell
2018-12-11 19:18:58 +00:00
44 changed files with 349 additions and 363 deletions
+8 -1
View File
@@ -34,6 +34,7 @@
#include "qom/object.h"
#include "qemu/error-report.h"
#include "qemu/option.h"
#include "qapi/error.h"
static const TypeInfo accel_type = {
.name = TYPE_ACCEL,
@@ -121,7 +122,13 @@ void configure_accelerator(MachineState *ms)
void accel_register_compat_props(AccelState *accel)
{
AccelClass *class = ACCEL_GET_CLASS(accel);
register_compat_props_array(class->global_props);
GlobalProperty *prop = class->global_props;
for (; prop && prop->driver; prop++) {
/* Any compat_props must never cause error */
prop->errp = &error_abort;
qdev_prop_register_global(prop);
}
}
void accel_setup_post(MachineState *ms)
+4 -10
View File
@@ -145,26 +145,20 @@ static void file_memory_backend_set_pmem(Object *o, bool value, Error **errp)
HostMemoryBackendFile *fb = MEMORY_BACKEND_FILE(o);
if (host_memory_backend_mr_inited(backend)) {
char *path = object_get_canonical_path_component(o);
error_setg(errp, "cannot change property 'pmem' of %s '%s'",
object_get_typename(o),
path);
g_free(path);
error_setg(errp, "cannot change property 'pmem' of %s.",
object_get_typename(o));
return;
}
#ifndef CONFIG_LIBPMEM
if (value) {
Error *local_err = NULL;
char *path = object_get_canonical_path_component(o);
error_setg(&local_err,
"Lack of libpmem support while setting the 'pmem=on'"
" of %s '%s'. We can't ensure data persistence.",
object_get_typename(o),
path);
g_free(path);
" of %s. We can't ensure data persistence.",
object_get_typename(o));
error_propagate(errp, local_err);
return;
}
+14 -5
View File
@@ -103,14 +103,23 @@ host_memory_backend_set_host_nodes(Object *obj, Visitor *v, const char *name,
{
#ifdef CONFIG_NUMA
HostMemoryBackend *backend = MEMORY_BACKEND(obj);
uint16List *l = NULL;
uint16List *l, *host_nodes = NULL;
visit_type_uint16List(v, name, &l, errp);
visit_type_uint16List(v, name, &host_nodes, errp);
while (l) {
bitmap_set(backend->host_nodes, l->value, 1);
l = l->next;
for (l = host_nodes; l; l = l->next) {
if (l->value >= MAX_NODES) {
error_setg(errp, "Invalid host-nodes value: %d", l->value);
goto out;
}
}
for (l = host_nodes; l; l = l->next) {
bitmap_set(backend->host_nodes, l->value, 1);
}
out:
qapi_free_uint16List(host_nodes);
#else
error_setg(errp, "NUMA node binding are not supported by this QEMU");
#endif
+142
View File
@@ -0,0 +1,142 @@
===================
Virtual CPU hotplug
===================
A complete example of vCPU hotplug (and hot-unplug) using QMP
``device_add`` and ``device_del``.
vCPU hotplug
------------
(1) Launch QEMU as follows (note that the "maxcpus" is mandatory to
allow vCPU hotplug)::
$ qemu-system-x86_64 -display none -no-user-config -m 2048 \
-nodefaults -monitor stdio -machine pc,accel=kvm,usb=off \
-smp 1,maxcpus=2 -cpu IvyBridge-IBRS \
-qmp unix:/tmp/qmp-sock,server,nowait
(2) Run 'qmp-shell' (located in the source tree, under: "scripts/qmp/)
to connect to the just-launched QEMU::
$> ./qmp-shell -p -v /tmp/qmp-sock
[...]
(QEMU)
(3) Find out which CPU types could be plugged, and into which sockets::
(QEMU) query-hotpluggable-cpus
{
"execute": "query-hotpluggable-cpus",
"arguments": {}
}
{
"return": [
{
"type": "IvyBridge-IBRS-x86_64-cpu",
"vcpus-count": 1,
"props": {
"socket-id": 1,
"core-id": 0,
"thread-id": 0
}
},
{
"qom-path": "/machine/unattached/device[0]",
"type": "IvyBridge-IBRS-x86_64-cpu",
"vcpus-count": 1,
"props": {
"socket-id": 0,
"core-id": 0,
"thread-id": 0
}
}
]
}
(QEMU)
(4) The ``query-hotpluggable-cpus`` command returns an object for CPUs
that are present (containing a "qom-path" member) or which may be
hot-plugged (no "qom-path" member). From its output in step (3), we
can see that ``IvyBridge-IBRS-x86_64-cpu`` is present in socket 0,
while hot-plugging a CPU into socket 1 requires passing the listed
properties to QMP ``device_add``:
(QEMU) device_add id=cpu-2 driver=IvyBridge-IBRS-x86_64-cpu socket-id=1 core-id=0 thread-id=0
{
"execute": "device_add",
"arguments": {
"socket-id": 1,
"driver": "IvyBridge-IBRS-x86_64-cpu",
"id": "cpu-2",
"core-id": 0,
"thread-id": 0
}
}
{
"return": {}
}
(QEMU)
(5) Optionally, run QMP `query-cpus-fast` for some details about the
vCPUs::
(QEMU) query-cpus-fast
{
"execute": "query-cpus-fast",
"arguments": {}
}
{
"return": [
{
"qom-path": "/machine/unattached/device[0]",
"target": "x86_64",
"thread-id": 11534,
"cpu-index": 0,
"props": {
"socket-id": 0,
"core-id": 0,
"thread-id": 0
},
"arch": "x86"
},
{
"qom-path": "/machine/peripheral/cpu-2",
"target": "x86_64",
"thread-id": 12106,
"cpu-index": 1,
"props": {
"socket-id": 1,
"core-id": 0,
"thread-id": 0
},
"arch": "x86"
}
]
}
(QEMU)
vCPU hot-unplug
---------------
From the 'qmp-shell', invoke the QMP ``device_del`` command::
(QEMU) device_del id=cpu-2
{
"execute": "device_del",
"arguments": {
"id": "cpu-2"
}
}
{
"return": {}
}
(QEMU)
.. note::
vCPU hot-unplug requires guest cooperation; so the ``device_del``
command above does not guarantee vCPU removal -- it's a "request to
unplug". At this point, the guest will get a System Control
Interupt (SCI) and calls the ACPI handler for the affected vCPU
device. Then the guest kernel will bring the vCPU offline and tell
QEMU to unplug it.
+4 -2
View File
@@ -1849,14 +1849,16 @@ ETEXI
.name = "cpu-add",
.args_type = "id:i",
.params = "id",
.help = "add cpu",
.help = "add cpu (deprecated, use device_add instead)",
.cmd = hmp_cpu_add,
},
STEXI
@item cpu-add @var{id}
@findex cpu-add
Add CPU with id @var{id}
Add CPU with id @var{id}. This command is deprecated, please
+use @code{device_add} instead. For details, refer to
'docs/cpu-hotplug.rst'.
ETEXI
{
+2
View File
@@ -2372,6 +2372,8 @@ void hmp_cpu_add(Monitor *mon, const QDict *qdict)
int cpuid;
Error *err = NULL;
error_report("cpu_add is deprecated, please use device_add instead");
cpuid = qdict_get_int(qdict, "id");
qmp_cpu_add(cpuid, &err);
hmp_handle_error(mon, &err);
+33 -63
View File
@@ -74,7 +74,6 @@
static const TypeInfo machvirt_##major##_##minor##_info = { \
.name = MACHINE_TYPE_NAME("virt-" # major "." # minor), \
.parent = TYPE_VIRT_MACHINE, \
.instance_init = virt_##major##_##minor##_instance_init, \
.class_init = virt_##major##_##minor##_class_init, \
}; \
static void machvirt_machine_##major##_##minor##_init(void) \
@@ -1778,26 +1777,7 @@ static void virt_machine_class_init(ObjectClass *oc, void *data)
hc->plug = virt_machine_device_plug_cb;
}
static const TypeInfo virt_machine_info = {
.name = TYPE_VIRT_MACHINE,
.parent = TYPE_MACHINE,
.abstract = true,
.instance_size = sizeof(VirtMachineState),
.class_size = sizeof(VirtMachineClass),
.class_init = virt_machine_class_init,
.interfaces = (InterfaceInfo[]) {
{ TYPE_HOTPLUG_HANDLER },
{ }
},
};
static void machvirt_machine_init(void)
{
type_register_static(&virt_machine_info);
}
type_init(machvirt_machine_init);
static void virt_3_1_instance_init(Object *obj)
static void virt_instance_init(Object *obj)
{
VirtMachineState *vms = VIRT_MACHINE(obj);
VirtMachineClass *vmc = VIRT_MACHINE_GET_CLASS(vms);
@@ -1867,19 +1847,44 @@ static void virt_3_1_instance_init(Object *obj)
vms->irqmap = a15irqmap;
}
static void virt_machine_3_1_options(MachineClass *mc)
static const TypeInfo virt_machine_info = {
.name = TYPE_VIRT_MACHINE,
.parent = TYPE_MACHINE,
.abstract = true,
.instance_size = sizeof(VirtMachineState),
.class_size = sizeof(VirtMachineClass),
.class_init = virt_machine_class_init,
.instance_init = virt_instance_init,
.interfaces = (InterfaceInfo[]) {
{ TYPE_HOTPLUG_HANDLER },
{ }
},
};
static void machvirt_machine_init(void)
{
type_register_static(&virt_machine_info);
}
type_init(machvirt_machine_init);
static void virt_machine_4_0_options(MachineClass *mc)
{
}
DEFINE_VIRT_MACHINE_AS_LATEST(3, 1)
DEFINE_VIRT_MACHINE_AS_LATEST(4, 0)
#define VIRT_COMPAT_3_1 \
HW_COMPAT_3_1
static void virt_machine_3_1_options(MachineClass *mc)
{
virt_machine_4_0_options(mc);
SET_MACHINE_COMPAT(mc, VIRT_COMPAT_3_1);
}
DEFINE_VIRT_MACHINE(3, 1)
#define VIRT_COMPAT_3_0 \
HW_COMPAT_3_0
static void virt_3_0_instance_init(Object *obj)
{
virt_3_1_instance_init(obj);
}
static void virt_machine_3_0_options(MachineClass *mc)
{
virt_machine_3_1_options(mc);
@@ -1890,11 +1895,6 @@ DEFINE_VIRT_MACHINE(3, 0)
#define VIRT_COMPAT_2_12 \
HW_COMPAT_2_12
static void virt_2_12_instance_init(Object *obj)
{
virt_3_0_instance_init(obj);
}
static void virt_machine_2_12_options(MachineClass *mc)
{
VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc));
@@ -1909,11 +1909,6 @@ DEFINE_VIRT_MACHINE(2, 12)
#define VIRT_COMPAT_2_11 \
HW_COMPAT_2_11
static void virt_2_11_instance_init(Object *obj)
{
virt_2_12_instance_init(obj);
}
static void virt_machine_2_11_options(MachineClass *mc)
{
VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc));
@@ -1927,11 +1922,6 @@ DEFINE_VIRT_MACHINE(2, 11)
#define VIRT_COMPAT_2_10 \
HW_COMPAT_2_10
static void virt_2_10_instance_init(Object *obj)
{
virt_2_11_instance_init(obj);
}
static void virt_machine_2_10_options(MachineClass *mc)
{
virt_machine_2_11_options(mc);
@@ -1944,11 +1934,6 @@ DEFINE_VIRT_MACHINE(2, 10)
#define VIRT_COMPAT_2_9 \
HW_COMPAT_2_9
static void virt_2_9_instance_init(Object *obj)
{
virt_2_10_instance_init(obj);
}
static void virt_machine_2_9_options(MachineClass *mc)
{
virt_machine_2_10_options(mc);
@@ -1959,11 +1944,6 @@ DEFINE_VIRT_MACHINE(2, 9)
#define VIRT_COMPAT_2_8 \
HW_COMPAT_2_8
static void virt_2_8_instance_init(Object *obj)
{
virt_2_9_instance_init(obj);
}
static void virt_machine_2_8_options(MachineClass *mc)
{
VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc));
@@ -1980,11 +1960,6 @@ DEFINE_VIRT_MACHINE(2, 8)
#define VIRT_COMPAT_2_7 \
HW_COMPAT_2_7
static void virt_2_7_instance_init(Object *obj)
{
virt_2_8_instance_init(obj);
}
static void virt_machine_2_7_options(MachineClass *mc)
{
VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc));
@@ -2001,11 +1976,6 @@ DEFINE_VIRT_MACHINE(2, 7)
#define VIRT_COMPAT_2_6 \
HW_COMPAT_2_6
static void virt_2_6_instance_init(Object *obj)
{
virt_2_7_instance_init(obj);
}
static void virt_machine_2_6_options(MachineClass *mc)
{
VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc));
-11
View File
@@ -834,16 +834,6 @@ void machine_run_board_init(MachineState *machine)
machine_class->init(machine);
}
static void machine_class_finalize(ObjectClass *klass, void *data)
{
MachineClass *mc = MACHINE_CLASS(klass);
if (mc->compat_props) {
g_array_free(mc->compat_props, true);
}
g_free(mc->name);
}
void machine_register_compat_props(MachineState *machine)
{
MachineClass *mc = MACHINE_GET_CLASS(machine);
@@ -869,7 +859,6 @@ static const TypeInfo machine_info = {
.class_size = sizeof(MachineClass),
.class_init = machine_class_init,
.class_base_init = machine_class_base_init,
.class_finalize = machine_class_finalize,
.instance_size = sizeof(MachineState),
.instance_init = machine_initfn,
.instance_finalize = machine_finalize,
-30
View File
@@ -1180,36 +1180,6 @@ void qdev_prop_register_global(GlobalProperty *prop)
global_props = g_list_append(global_props, prop);
}
void register_compat_prop(const char *driver,
const char *property,
const char *value)
{
GlobalProperty *p = g_new0(GlobalProperty, 1);
/* Any compat_props must never cause error */
p->errp = &error_abort;
p->driver = driver;
p->property = property;
p->value = value;
qdev_prop_register_global(p);
}
void register_compat_props_array(GlobalProperty *prop)
{
for (; prop && prop->driver; prop++) {
register_compat_prop(prop->driver, prop->property, prop->value);
}
}
void qdev_prop_register_global_list(GlobalProperty *props)
{
int i;
for (i = 0; props[i].driver != NULL; i++) {
qdev_prop_register_global(props+i);
}
}
int qdev_prop_check_globals(void)
{
GList *l;
+9 -9
View File
@@ -2222,42 +2222,42 @@ static bool pc_machine_get_smbus(Object *obj, Error **errp)
{
PCMachineState *pcms = PC_MACHINE(obj);
return pcms->smbus;
return pcms->smbus_enabled;
}
static void pc_machine_set_smbus(Object *obj, bool value, Error **errp)
{
PCMachineState *pcms = PC_MACHINE(obj);
pcms->smbus = value;
pcms->smbus_enabled = value;
}
static bool pc_machine_get_sata(Object *obj, Error **errp)
{
PCMachineState *pcms = PC_MACHINE(obj);
return pcms->sata;
return pcms->sata_enabled;
}
static void pc_machine_set_sata(Object *obj, bool value, Error **errp)
{
PCMachineState *pcms = PC_MACHINE(obj);
pcms->sata = value;
pcms->sata_enabled = value;
}
static bool pc_machine_get_pit(Object *obj, Error **errp)
{
PCMachineState *pcms = PC_MACHINE(obj);
return pcms->pit;
return pcms->pit_enabled;
}
static void pc_machine_set_pit(Object *obj, bool value, Error **errp)
{
PCMachineState *pcms = PC_MACHINE(obj);
pcms->pit = value;
pcms->pit_enabled = value;
}
static void pc_machine_initfn(Object *obj)
@@ -2271,9 +2271,9 @@ static void pc_machine_initfn(Object *obj)
pcms->acpi_nvdimm_state.is_enabled = false;
/* acpi build is enabled by default if machine supports it */
pcms->acpi_build_enabled = PC_MACHINE_GET_CLASS(pcms)->has_acpi_build;
pcms->smbus = true;
pcms->sata = true;
pcms->pit = true;
pcms->smbus_enabled = true;
pcms->sata_enabled = true;
pcms->pit_enabled = true;
}
static void pc_machine_reset(void)
+15 -5
View File
@@ -239,7 +239,8 @@ static void pc_init1(MachineState *machine,
/* init basic PC hardware */
pc_basic_device_init(isa_bus, pcms->gsi, &rtc_state, true,
(pcms->vmport != ON_OFF_AUTO_ON), pcms->pit, 0x4);
(pcms->vmport != ON_OFF_AUTO_ON), pcms->pit_enabled,
0x4);
pc_nic_init(pcmc, isa_bus, pci_bus);
@@ -320,7 +321,6 @@ static void pc_compat_2_3(MachineState *machine)
static void pc_compat_2_2(MachineState *machine)
{
pc_compat_2_3(machine);
machine->suppress_vmdesc = true;
}
static void pc_compat_2_1(MachineState *machine)
@@ -428,21 +428,30 @@ static void pc_i440fx_machine_options(MachineClass *m)
machine_class_allow_dynamic_sysbus_dev(m, TYPE_RAMFB_DEVICE);
}
static void pc_i440fx_3_1_machine_options(MachineClass *m)
static void pc_i440fx_4_0_machine_options(MachineClass *m)
{
pc_i440fx_machine_options(m);
m->alias = "pc";
m->is_default = 1;
}
DEFINE_I440FX_MACHINE(v4_0, "pc-i440fx-4.0", NULL,
pc_i440fx_4_0_machine_options);
static void pc_i440fx_3_1_machine_options(MachineClass *m)
{
pc_i440fx_4_0_machine_options(m);
m->is_default = 0;
m->alias = NULL;
SET_MACHINE_COMPAT(m, PC_COMPAT_3_1);
}
DEFINE_I440FX_MACHINE(v3_1, "pc-i440fx-3.1", NULL,
pc_i440fx_3_1_machine_options);
static void pc_i440fx_3_0_machine_options(MachineClass *m)
{
pc_i440fx_3_1_machine_options(m);
m->is_default = 0;
m->alias = NULL;
SET_MACHINE_COMPAT(m, PC_COMPAT_3_0);
}
@@ -562,6 +571,7 @@ static void pc_i440fx_2_2_machine_options(MachineClass *m)
PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
pc_i440fx_2_3_machine_options(m);
m->hw_version = "2.2.0";
m->default_machine_opts = "firmware=bios-256k.bin,suppress-vmdesc=on";
SET_MACHINE_COMPAT(m, PC_COMPAT_2_2);
pcmc->rsdp_in_ram = false;
}
+14 -5
View File
@@ -236,13 +236,13 @@ static void pc_q35_init(MachineState *machine)
/* init basic PC hardware */
pc_basic_device_init(isa_bus, pcms->gsi, &rtc_state, !mc->no_floppy,
(pcms->vmport != ON_OFF_AUTO_ON), pcms->pit,
(pcms->vmport != ON_OFF_AUTO_ON), pcms->pit_enabled,
0xff0104);
/* connect pm stuff to lpc */
ich9_lpc_pm_init(lpc, pc_machine_is_smm_enabled(pcms));
if (pcms->sata) {
if (pcms->sata_enabled) {
/* ahci and SATA device, for q35 1 ahci controller is built-in */
ahci = pci_create_simple_multifunction(host_bus,
PCI_DEVFN(ICH9_SATA1_DEV,
@@ -262,7 +262,7 @@ static void pc_q35_init(MachineState *machine)
ehci_create_ich9_with_companions(host_bus, 0x1d);
}
if (pcms->smbus) {
if (pcms->smbus_enabled) {
/* TODO: Populate SPD eeprom data. */
smbus_eeprom_init(ich9_smb_init(host_bus,
PCI_DEVFN(ICH9_SMB_DEV, ICH9_SMB_FUNC),
@@ -311,19 +311,28 @@ static void pc_q35_machine_options(MachineClass *m)
m->max_cpus = 288;
}
static void pc_q35_3_1_machine_options(MachineClass *m)
static void pc_q35_4_0_machine_options(MachineClass *m)
{
pc_q35_machine_options(m);
m->alias = "q35";
}
DEFINE_Q35_MACHINE(v4_0, "pc-q35-4.0", NULL,
pc_q35_4_0_machine_options);
static void pc_q35_3_1_machine_options(MachineClass *m)
{
pc_q35_4_0_machine_options(m);
m->alias = NULL;
SET_MACHINE_COMPAT(m, PC_COMPAT_3_1);
}
DEFINE_Q35_MACHINE(v3_1, "pc-q35-3.1", NULL,
pc_q35_3_1_machine_options);
static void pc_q35_3_0_machine_options(MachineClass *m)
{
pc_q35_3_1_machine_options(m);
m->alias = NULL;
SET_MACHINE_COMPAT(m, PC_COMPAT_3_0);
}
+5 -4
View File
@@ -85,7 +85,8 @@ static void memory_device_check_addable(MachineState *ms, uint64_t size,
/* will we exceed the total amount of memory specified */
memory_device_used_region_size(OBJECT(ms), &used_region_size);
if (used_region_size + size > ms->maxram_size - ms->ram_size) {
if (used_region_size + size < used_region_size ||
used_region_size + size > ms->maxram_size - ms->ram_size) {
error_setg(errp, "not enough space, currently 0x%" PRIx64
" in use of total space for memory devices 0x" RAM_ADDR_FMT,
used_region_size, ms->maxram_size - ms->ram_size);
@@ -120,7 +121,7 @@ static uint64_t memory_device_get_free_addr(MachineState *ms,
g_assert(address_space_end >= address_space_start);
/* address_space_start indicates the maximum alignment we expect */
if (QEMU_ALIGN_UP(address_space_start, align) != address_space_start) {
if (!QEMU_IS_ALIGNED(address_space_start, align)) {
error_setg(errp, "the alignment (0x%" PRIx64 ") is not supported",
align);
return 0;
@@ -131,13 +132,13 @@ static uint64_t memory_device_get_free_addr(MachineState *ms,
return 0;
}
if (hint && QEMU_ALIGN_UP(*hint, align) != *hint) {
if (hint && !QEMU_IS_ALIGNED(*hint, align)) {
error_setg(errp, "address must be aligned to 0x%" PRIx64 " bytes",
align);
return 0;
}
if (QEMU_ALIGN_UP(size, align) != size) {
if (!QEMU_IS_ALIGNED(size, align)) {
error_setg(errp, "backend memory size must be multiple of 0x%"
PRIx64, align);
return 0;
+1 -1
View File
@@ -1280,7 +1280,7 @@ static void desugar_shm(IVShmemState *s)
object_property_add_child(OBJECT(s), "internal-shm-backend", obj,
&error_abort);
object_unref(obj);
user_creatable_complete(obj, &error_abort);
user_creatable_complete(USER_CREATABLE(obj), &error_abort);
s->hostmem = MEMORY_BACKEND(obj);
}
+20 -88
View File
@@ -3939,16 +3939,10 @@ static const TypeInfo spapr_machine_info = {
mc->is_default = 1; \
} \
} \
static void spapr_machine_##suffix##_instance_init(Object *obj) \
{ \
MachineState *machine = MACHINE(obj); \
spapr_machine_##suffix##_instance_options(machine); \
} \
static const TypeInfo spapr_machine_##suffix##_info = { \
.name = MACHINE_TYPE_NAME("pseries-" verstr), \
.parent = TYPE_SPAPR_MACHINE, \
.class_init = spapr_machine_##suffix##_class_init, \
.instance_init = spapr_machine_##suffix##_instance_init, \
}; \
static void spapr_machine_register_##suffix(void) \
{ \
@@ -3956,19 +3950,29 @@ static const TypeInfo spapr_machine_info = {
} \
type_init(spapr_machine_register_##suffix)
/*
* pseries-3.1
/*
* pseries-4.0
*/
static void spapr_machine_3_1_instance_options(MachineState *machine)
{
}
static void spapr_machine_3_1_class_options(MachineClass *mc)
static void spapr_machine_4_0_class_options(MachineClass *mc)
{
/* Defaults for the latest behaviour inherited from the base class */
}
DEFINE_SPAPR_MACHINE(3_1, "3.1", true);
DEFINE_SPAPR_MACHINE(4_0, "4.0", true);
/*
* pseries-3.1
*/
#define SPAPR_COMPAT_3_1 \
HW_COMPAT_3_1
static void spapr_machine_3_1_class_options(MachineClass *mc)
{
spapr_machine_4_0_class_options(mc);
SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_3_1);
}
DEFINE_SPAPR_MACHINE(3_1, "3.1", false);
/*
* pseries-3.0
@@ -3976,11 +3980,6 @@ DEFINE_SPAPR_MACHINE(3_1, "3.1", true);
#define SPAPR_COMPAT_3_0 \
HW_COMPAT_3_0
static void spapr_machine_3_0_instance_options(MachineState *machine)
{
spapr_machine_3_1_instance_options(machine);
}
static void spapr_machine_3_0_class_options(MachineClass *mc)
{
sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
@@ -4010,11 +4009,6 @@ DEFINE_SPAPR_MACHINE(3_0, "3.0", false);
.value = "on", \
},
static void spapr_machine_2_12_instance_options(MachineState *machine)
{
spapr_machine_3_0_instance_options(machine);
}
static void spapr_machine_2_12_class_options(MachineClass *mc)
{
sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
@@ -4032,11 +4026,6 @@ static void spapr_machine_2_12_class_options(MachineClass *mc)
DEFINE_SPAPR_MACHINE(2_12, "2.12", false);
static void spapr_machine_2_12_sxxm_instance_options(MachineState *machine)
{
spapr_machine_2_12_instance_options(machine);
}
static void spapr_machine_2_12_sxxm_class_options(MachineClass *mc)
{
sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
@@ -4055,11 +4044,6 @@ DEFINE_SPAPR_MACHINE(2_12_sxxm, "2.12-sxxm", false);
#define SPAPR_COMPAT_2_11 \
HW_COMPAT_2_11
static void spapr_machine_2_11_instance_options(MachineState *machine)
{
spapr_machine_2_12_instance_options(machine);
}
static void spapr_machine_2_11_class_options(MachineClass *mc)
{
sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
@@ -4077,11 +4061,6 @@ DEFINE_SPAPR_MACHINE(2_11, "2.11", false);
#define SPAPR_COMPAT_2_10 \
HW_COMPAT_2_10
static void spapr_machine_2_10_instance_options(MachineState *machine)
{
spapr_machine_2_11_instance_options(machine);
}
static void spapr_machine_2_10_class_options(MachineClass *mc)
{
spapr_machine_2_11_class_options(mc);
@@ -4101,11 +4080,6 @@ DEFINE_SPAPR_MACHINE(2_10, "2.10", false);
.value = "on", \
}, \
static void spapr_machine_2_9_instance_options(MachineState *machine)
{
spapr_machine_2_10_instance_options(machine);
}
static void spapr_machine_2_9_class_options(MachineClass *mc)
{
sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
@@ -4130,11 +4104,6 @@ DEFINE_SPAPR_MACHINE(2_9, "2.9", false);
.value = "off", \
},
static void spapr_machine_2_8_instance_options(MachineState *machine)
{
spapr_machine_2_9_instance_options(machine);
}
static void spapr_machine_2_8_class_options(MachineClass *mc)
{
spapr_machine_2_9_class_options(mc);
@@ -4219,20 +4188,13 @@ static void phb_placement_2_7(sPAPRMachineState *spapr, uint32_t index,
*/
}
static void spapr_machine_2_7_instance_options(MachineState *machine)
{
sPAPRMachineState *spapr = SPAPR_MACHINE(machine);
spapr_machine_2_8_instance_options(machine);
spapr->use_hotplug_event_source = false;
}
static void spapr_machine_2_7_class_options(MachineClass *mc)
{
sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
spapr_machine_2_8_class_options(mc);
mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("power7_v2.3");
mc->default_machine_opts = "modern-hotplug-events=off";
SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_7);
smc->phb_placement = phb_placement_2_7;
}
@@ -4250,11 +4212,6 @@ DEFINE_SPAPR_MACHINE(2_7, "2.7", false);
.value = stringify(off),\
},
static void spapr_machine_2_6_instance_options(MachineState *machine)
{
spapr_machine_2_7_instance_options(machine);
}
static void spapr_machine_2_6_class_options(MachineClass *mc)
{
spapr_machine_2_7_class_options(mc);
@@ -4275,11 +4232,6 @@ DEFINE_SPAPR_MACHINE(2_6, "2.6", false);
.value = "off", \
},
static void spapr_machine_2_5_instance_options(MachineState *machine)
{
spapr_machine_2_6_instance_options(machine);
}
static void spapr_machine_2_5_class_options(MachineClass *mc)
{
sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
@@ -4297,11 +4249,6 @@ DEFINE_SPAPR_MACHINE(2_5, "2.5", false);
#define SPAPR_COMPAT_2_4 \
HW_COMPAT_2_4
static void spapr_machine_2_4_instance_options(MachineState *machine)
{
spapr_machine_2_5_instance_options(machine);
}
static void spapr_machine_2_4_class_options(MachineClass *mc)
{
sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
@@ -4324,11 +4271,6 @@ DEFINE_SPAPR_MACHINE(2_4, "2.4", false);
.value = "off",\
},
static void spapr_machine_2_3_instance_options(MachineState *machine)
{
spapr_machine_2_4_instance_options(machine);
}
static void spapr_machine_2_3_class_options(MachineClass *mc)
{
spapr_machine_2_4_class_options(mc);
@@ -4348,16 +4290,11 @@ DEFINE_SPAPR_MACHINE(2_3, "2.3", false);
.value = "0x20000000",\
},
static void spapr_machine_2_2_instance_options(MachineState *machine)
{
spapr_machine_2_3_instance_options(machine);
machine->suppress_vmdesc = true;
}
static void spapr_machine_2_2_class_options(MachineClass *mc)
{
spapr_machine_2_3_class_options(mc);
SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_2);
mc->default_machine_opts = "modern-hotplug-events=off,suppress-vmdesc=on";
}
DEFINE_SPAPR_MACHINE(2_2, "2.2", false);
@@ -4367,11 +4304,6 @@ DEFINE_SPAPR_MACHINE(2_2, "2.2", false);
#define SPAPR_COMPAT_2_1 \
HW_COMPAT_2_1
static void spapr_machine_2_1_instance_options(MachineState *machine)
{
spapr_machine_2_2_instance_options(machine);
}
static void spapr_machine_2_1_class_options(MachineClass *mc)
{
spapr_machine_2_2_class_options(mc);
+1 -1
View File
@@ -41,7 +41,7 @@ static uint64_t sun4v_rtc_read(void *opaque, hwaddr addr,
static void sun4v_rtc_write(void *opaque, hwaddr addr,
uint64_t val, unsigned size)
{
trace_sun4v_rtc_read(addr, val);
trace_sun4v_rtc_write(addr, val);
}
static const MemoryRegionOps sun4v_rtc_ops = {
+1 -1
View File
@@ -191,7 +191,7 @@ static void virtio_rng_device_realize(DeviceState *dev, Error **errp)
if (vrng->conf.rng == NULL) {
vrng->conf.default_backend = RNG_RANDOM(object_new(TYPE_RNG_RANDOM));
user_creatable_complete(OBJECT(vrng->conf.default_backend),
user_creatable_complete(USER_CREATABLE(vrng->conf.default_backend),
&local_err);
if (local_err) {
error_propagate(errp, local_err);
+1 -5
View File
@@ -25,11 +25,7 @@ typedef enum {
INTERFACE_CHECK(AcpiDeviceIf, (obj), \
TYPE_ACPI_DEVICE_IF)
typedef struct AcpiDeviceIf {
/* <private> */
Object Parent;
} AcpiDeviceIf;
typedef struct AcpiDeviceIf AcpiDeviceIf;
void acpi_send_event(DeviceState *dev, AcpiEventStatusBits event);
+1 -4
View File
@@ -16,10 +16,7 @@
#define ARM_LINUX_BOOT_IF(obj) \
INTERFACE_CHECK(ARMLinuxBootIf, (obj), TYPE_ARM_LINUX_BOOT_IF)
typedef struct ARMLinuxBootIf {
/*< private >*/
Object parent_obj;
} ARMLinuxBootIf;
typedef struct ARMLinuxBootIf ARMLinuxBootIf;
typedef struct ARMLinuxBootIfClass {
/*< private >*/
+3
View File
@@ -1,6 +1,9 @@
#ifndef HW_COMPAT_H
#define HW_COMPAT_H
#define HW_COMPAT_3_1 \
/* empty */
#define HW_COMPAT_3_0 \
/* empty */

Some files were not shown because too many files have changed in this diff Show More