* [Qemu-devel] [PULL v2 000/108] pc, pci, virtio, hotplug fixes, enhancements
@ 2014-06-18 16:43 Michael S. Tsirkin
2014-06-18 16:43 ` [Qemu-devel] [PULL v2 001/108] pc: create custom generic PC machine type Michael S. Tsirkin
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Michael S. Tsirkin @ 2014-06-18 16:43 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Maydell, Anthony Liguori
The following changes since commit 0360fbd076e8bdbb9498598b0c559464346babe4:
Merge remote-tracking branch 'remotes/riku/linux-user-for-upstream' into staging (2014-06-17 16:08:06 +0100)
are available in the git repository at:
git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream
for you to fetch changes up to 2de1c32c6aa4fdcef9e1e0c25246329f7cfd2981:
vhost: fix resource leak in error handling (2014-06-18 18:55:22 +0300)
----------------------------------------------------------------
pc,pci,virtio,hotplug fixes, enhancements
numa work by Hu Tao and others
memory hotplug by Igor
vhost-user by Nikolay, Antonios and others
guest virtio announcements by Jason
qtest fixes by Sergey
qdev hotplug fixes by Paolo
misc other fixes mostly by myself
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
----------------------------------------------------------------
Hu Tao (10):
Introduce signed range.
qom: introduce object_property_get_enum and object_property_get_uint16List
backend:hostmem: replace hostmemory with host_memory
hostmem: separate allocation from UserCreatable complete method
hostmem: add properties for NUMA memory policy
qmp: add query-memdev
hmp: add info memdev
tests: fix memory leak in test of string input visitor
qapi: make string input visitor parse int list
qapi: make string output visitor parse int list
Igor Mammedov (40):
pc: create custom generic PC machine type
pc: ACPI BIOS: use enum for defining memory affinity flags
object_add: allow completion handler to get canonical path
vl.c: daemonize before guest memory allocation
add memdev backend infrastructure
vl.c: extend -m option to support options for memory hotplug
qdev: hotplug for bus-less devices
qdev: expose DeviceState.hotplugged field as a property
memory: add memory_region_is_mapped() API
pc-dimm: do not allow setting an in-use memdev
pc: initialize memory hotplug address space
pc: exit QEMU if number of slots more than supported 256
pc: add 'etc/reserved-memory-end' fw_cfg interface for SeaBIOS
pc: exit QEMU if compat machine doesn't support memory hotlpug
pc: add memory hotplug handler to PC_MACHINE
pc-dimm: add busy address check and address auto-allocation
pc-dimm: add busy slot check and slot auto-allocation
acpi: rename cpu_hotplug_defs.h to pc-hotplug.h
acpi: memory hotplug ACPI hardware implementation
trace: add acpi memory hotplug IO region events
trace: pc: add PC_DIMM slot & address allocation
acpi:piix4: allow plug/unlug callbacks handle not only PCI devices
acpi:piix4: add memory hotplug handling
pc: ich9 lpc: make it work with global/compat properties
acpi:ich9: add memory hotplug handling
pc: migrate piix4 & ich9 MemHotplugState
pc: add acpi-device link to PCMachineState
pc: propagate memory hotplug event to ACPI device
pc: ACPI BIOS: implement memory hotplug interface
pc: add "hotplug-memory-region-size" property to PC_MACHINE
pc: ACPI BIOS: reserve SRAT entry for hotplug mem hole
pc: ACPI BIOS: make GPE.3 handle memory hotplug event on PIIX and Q35 machines
pc: q35: acpi: report error to user on unsupported unplug request
pc: acpi: do not hardcode preprocessor
numa: handle mmaped memory allocation failure correctly
qmp: add query-memory-devices command
acpi: introduce TYPE_ACPI_DEVICE_IF interface
acpi: implement ospm_status() method for PIIX4/ICH9_LPC devices
qmp: add query-acpi-ospm-status command
qmp: add ACPI_DEVICE_OST event handling
Jason Wang (3):
migration: export SELF_ANNOUNCE_ROUNDS
migration: introduce self_announce_delay()
virtio-net: announce self by guest
Luiz Capitulino (1):
man: improve -numa doc
Markus Armbruster (2):
virtio: Drop superfluous conditionals around g_free()
virtio: Drop superfluous conditionals around g_strdup()
Michael S. Tsirkin (11):
acpi: update generated files
acpi-test: update expected tables
ich: get rid of spaces in type name
qapi: fix build on glib < 2.28
qmp: clean out whitespace
acpi: rephrase comment
qapi: fix input visitor bugs
tests: simplify code
qapi/string-output-visitor: fix bugs
vhost: block migration if backend does not log memory
vhost: fix resource leak in error handling
Nikolay Nikolaev (18):
Add kvm_eventfds_enabled function
Add chardev API qemu_chr_fe_read_all
Add chardev API qemu_chr_fe_set_msgfds
Add chardev API qemu_chr_fe_get_msgfds
Add G_IO_HUP handler for socket chardev
vhost: add vhost_get_features and vhost_ack_features
vhost_net should call the poll callback only when it is set
Refactor virtio-net to use generic get_vhost_net
vhost_net_init will use VhostNetOptions to get all its arguments
Add vhost_ops to vhost_dev struct and replace all relevant ioctls
Add vhost-backend and VhostBackendType
Add vhost-user as a vhost backend.
vhost-net: vhost-user feature bits support
Add new vhost-user netdev backend
Add the vhost-user netdev backend to the command line
Add vhost-user protocol documentation
libqemustub: add stubs to be able to use qemu-char.c
Add qtest for vhost-user
Paolo Bonzini (16):
qmp: improve error reporting for -object and object-add
numa: introduce memory_region_allocate_system_memory
memory: reorganize file-based allocation
memory: move preallocation code out of exec.c
memory: move RAM_PREALLOC_MASK to exec.c, rename
numa: add -numa node,memdev= option
memory: move mem_path handling to memory_region_allocate_system_memory
memory: add error propagation to file-based RAM allocation
vl: redo -object parsing
pc: pass MachineState to pc_memory_init
hostmem: add file-based HostMemoryBackend
hostmem: add merge and dump properties
hostmem: allow preallocation of any memory region
hostmem: add property to map memory with MAP_SHARED
qdev: reorganize error reporting in bus_set_realized
qdev: recursively unrealize devices when unrealizing bus
Vasilis Liaskovitis (1):
pc: implement pc-dimm device abstraction
Wanlong Gao (6):
NUMA: move numa related code to new file numa.c
NUMA: check if the total numa memory size is equal to ram_size
NUMA: Add numa_info structure to contain numa nodes info
NUMA: convert -numa option to use OptsVisitor
NUMA: expand MAX_NODES from 64 to 128
configure: add Linux libnuma detection
configure | 32 ++
Makefile.target | 2 +-
qapi-schema.json | 208 ++++++++-
hmp.h | 1 +
include/exec/cpu-all.h | 8 -
include/exec/cpu-common.h | 2 +
include/exec/memory.h | 41 ++
include/exec/ram_addr.h | 4 +
include/hw/acpi/acpi.h | 5 +
include/hw/acpi/acpi_dev_interface.h | 43 ++
include/hw/acpi/cpu_hotplug.h | 2 +-
include/hw/acpi/cpu_hotplug_defs.h | 32 --
include/hw/acpi/ich9.h | 7 +
include/hw/acpi/memory_hotplug.h | 38 ++
include/hw/acpi/pc-hotplug.h | 56 +++
include/hw/boards.h | 16 +-
include/hw/i386/ich9.h | 2 +-
include/hw/i386/pc.h | 79 +++-
include/hw/mem/pc-dimm.h | 81 ++++
include/hw/virtio/vhost-backend.h | 38 ++
include/hw/virtio/vhost.h | 14 +-
include/hw/virtio/virtio-net.h | 17 +
include/migration/vmstate.h | 10 +
include/monitor/monitor.h | 1 +
include/net/vhost-user.h | 17 +
include/net/vhost_net.h | 11 +-
include/qemu/osdep.h | 12 +
include/qemu/range.h | 72 ++++
include/qom/object.h | 28 ++
include/sysemu/char.h | 44 +-
include/sysemu/cpus.h | 1 -
include/sysemu/hostmem.h | 68 +++
include/sysemu/kvm.h | 11 +
include/sysemu/sysemu.h | 18 +-
net/clients.h | 3 +
backends/hostmem-file.c | 134 ++++++
backends/hostmem-ram.c | 53 +++
backends/hostmem.c | 375 ++++++++++++++++
cpus.c | 14 -
exec.c | 211 +++++----
hmp.c | 36 ++
hw/9pfs/virtio-9p.c | 4 +-
hw/acpi/acpi_interface.c | 15 +
hw/acpi/ich9.c | 69 +++
hw/acpi/memory_hotplug.c | 245 +++++++++++
hw/acpi/piix4.c | 85 +++-
hw/core/qdev.c | 57 ++-
hw/i386/acpi-build.c | 75 +++-
hw/i386/pc.c | 252 ++++++++++-
hw/i386/pc_piix.c | 59 +--
hw/i386/pc_q35.c | 29 +-
hw/isa/lpc_ich9.c | 38 +-
hw/mem/pc-dimm.c | 281 ++++++++++++
hw/mips/mips_malta.c | 2 +-
hw/net/vhost_net.c | 228 +++++++---
hw/net/virtio-net.c | 98 +++--
hw/ppc/spapr.c | 11 +-
hw/scsi/vhost-scsi.c | 45 +-
hw/virtio/vhost-backend.c | 71 +++
hw/virtio/vhost-user.c | 342 +++++++++++++++
hw/virtio/vhost.c | 112 +++--
hw/virtio/virtio.c | 16 +-
kvm-all.c | 4 +
kvm-stub.c | 1 +
memory.c | 39 +-
monitor.c | 10 +-
net/hub.c | 1 +
net/net.c | 3 +
net/tap.c | 18 +-
net/vhost-user.c | 258 +++++++++++
numa.c | 369 ++++++++++++++++
qapi/string-input-visitor.c | 201 ++++++++-
qapi/string-output-visitor.c | 235 +++++++++-
qemu-char.c | 277 ++++++++++--
qmp.c | 44 +-
qom/object.c | 35 ++
savevm.c | 3 +-
stubs/bdrv-commit-all.c | 7 +
stubs/chr-msmouse.c | 7 +
stubs/get-next-serial.c | 3 +
stubs/is-daemonized.c | 7 +
stubs/machine-init-done.c | 6 +
stubs/monitor-init.c | 6 +
stubs/notify-event.c | 6 +
stubs/qmp_pc_dimm_device_list.c | 7 +
stubs/vc-init.c | 7 +
tests/test-string-input-visitor.c | 37 ++
tests/test-string-output-visitor.c | 38 +-
tests/vhost-user-test.c | 312 ++++++++++++++
util/oslib-posix.c | 73 ++++
vl.c | 268 +++++-------
backends/Makefile.objs | 3 +
default-configs/i386-softmmu.mak | 1 +
default-configs/x86_64-softmmu.mak | 1 +
docs/qmp/qmp-events.txt | 10 +
docs/specs/acpi_mem_hotplug.txt | 44 ++
docs/specs/vhost-user.txt | 266 ++++++++++++
hmp-commands.hx | 4 +-
hw/Makefile.objs | 1 +
hw/acpi/Makefile.objs | 2 +
hw/i386/Makefile.objs | 5 +-
hw/i386/acpi-dsdt.dsl | 7 +-
hw/i386/acpi-dsdt.hex.generated | 31 +-
hw/i386/q35-acpi-dsdt.dsl | 7 +-
hw/i386/q35-acpi-dsdt.hex.generated | 31 +-
hw/i386/ssdt-mem.dsl | 77 ++++
hw/i386/ssdt-mem.hex.generated | 213 +++++++++
hw/i386/ssdt-misc.dsl | 164 +++++++
hw/i386/ssdt-misc.hex.generated | 811 ++++++++++++++++++++++++++++++++++-
hw/i386/ssdt-pcihp.hex.generated | 6 +-
hw/i386/ssdt-proc.hex.generated | 6 +-
hw/mem/Makefile.objs | 1 +
hw/virtio/Makefile.objs | 2 +-
net/Makefile.objs | 2 +-
qemu-options.hx | 45 +-
qmp-commands.hx | 89 +++-
stubs/Makefile.objs | 9 +
tests/Makefile | 4 +
tests/acpi-test-data/pc/DSDT | Bin 4480 -> 4499 bytes
tests/acpi-test-data/pc/SSDT | Bin 2269 -> 3065 bytes
tests/acpi-test-data/q35/DSDT | Bin 7378 -> 7397 bytes
tests/acpi-test-data/q35/SSDT | Bin 550 -> 1346 bytes
trace-events | 17 +
123 files changed, 7399 insertions(+), 723 deletions(-)
create mode 100644 include/hw/acpi/acpi_dev_interface.h
delete mode 100644 include/hw/acpi/cpu_hotplug_defs.h
create mode 100644 include/hw/acpi/memory_hotplug.h
create mode 100644 include/hw/acpi/pc-hotplug.h
create mode 100644 include/hw/mem/pc-dimm.h
create mode 100644 include/hw/virtio/vhost-backend.h
create mode 100644 include/net/vhost-user.h
create mode 100644 include/sysemu/hostmem.h
create mode 100644 backends/hostmem-file.c
create mode 100644 backends/hostmem-ram.c
create mode 100644 backends/hostmem.c
create mode 100644 hw/acpi/acpi_interface.c
create mode 100644 hw/acpi/memory_hotplug.c
create mode 100644 hw/mem/pc-dimm.c
create mode 100644 hw/virtio/vhost-backend.c
create mode 100644 hw/virtio/vhost-user.c
create mode 100644 net/vhost-user.c
create mode 100644 numa.c
create mode 100644 stubs/bdrv-commit-all.c
create mode 100644 stubs/chr-msmouse.c
create mode 100644 stubs/get-next-serial.c
create mode 100644 stubs/is-daemonized.c
create mode 100644 stubs/machine-init-done.c
create mode 100644 stubs/monitor-init.c
create mode 100644 stubs/notify-event.c
create mode 100644 stubs/qmp_pc_dimm_device_list.c
create mode 100644 stubs/vc-init.c
create mode 100644 tests/vhost-user-test.c
create mode 100644 docs/specs/acpi_mem_hotplug.txt
create mode 100644 docs/specs/vhost-user.txt
create mode 100644 hw/i386/ssdt-mem.dsl
create mode 100644 hw/i386/ssdt-mem.hex.generated
create mode 100644 hw/mem/Makefile.objs
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Qemu-devel] [PULL v2 001/108] pc: create custom generic PC machine type
2014-06-18 16:43 [Qemu-devel] [PULL v2 000/108] pc, pci, virtio, hotplug fixes, enhancements Michael S. Tsirkin
@ 2014-06-18 16:43 ` Michael S. Tsirkin
2014-06-18 16:43 ` [Qemu-devel] [PULL v2 002/108] pc: ACPI BIOS: use enum for defining memory affinity flags Michael S. Tsirkin
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Michael S. Tsirkin @ 2014-06-18 16:43 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Peter Crosthwaite, Anthony Liguori, Igor Mammedov
From: Igor Mammedov <imammedo@redhat.com>
it will be used for PC specific options/variables
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Acked-by: Peter Crosthwaite <peter.crostwaite@xilinx.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
include/hw/i386/pc.h | 24 ++++++++++++++++++++++
hw/i386/pc.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++
hw/i386/pc_piix.c | 36 ++++++++++++++++-----------------
hw/i386/pc_q35.c | 12 +++++------
4 files changed, 105 insertions(+), 24 deletions(-)
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index fa9d997..aade1b2 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -12,9 +12,33 @@
#include "qemu/bitmap.h"
#include "sysemu/sysemu.h"
#include "hw/pci/pci.h"
+#include "hw/boards.h"
#define HPET_INTCAP "hpet-intcap"
+struct PCMachineState {
+ /*< private >*/
+ MachineState parent_obj;
+};
+
+struct PCMachineClass {
+ /*< private >*/
+ MachineClass parent_class;
+};
+
+typedef struct PCMachineState PCMachineState;
+typedef struct PCMachineClass PCMachineClass;
+
+#define TYPE_PC_MACHINE "generic-pc-machine"
+#define PC_MACHINE(obj) \
+ OBJECT_CHECK(PCMachineState, (obj), TYPE_PC_MACHINE)
+#define PC_MACHINE_GET_CLASS(obj) \
+ OBJECT_GET_CLASS(PCMachineClass, (obj), TYPE_PC_MACHINE)
+#define PC_MACHINE_CLASS(klass) \
+ OBJECT_CLASS_CHECK(PCMachineClass, (klass), TYPE_PC_MACHINE)
+
+void qemu_register_pc_machine(QEMUMachine *m);
+
/* PC-style peripherals (also used by other machines). */
typedef struct PcPciInfo {
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 3e0ecf1..77c587b 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1455,3 +1455,60 @@ void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name)
gsi_state->ioapic_irq[i] = qdev_get_gpio_in(dev, i);
}
}
+
+static void pc_generic_machine_class_init(ObjectClass *oc, void *data)
+{
+ MachineClass *mc = MACHINE_CLASS(oc);
+ QEMUMachine *qm = data;
+
+ mc->name = qm->name;
+ mc->alias = qm->alias;
+ mc->desc = qm->desc;
+ mc->init = qm->init;
+ mc->reset = qm->reset;
+ mc->hot_add_cpu = qm->hot_add_cpu;
+ mc->kvm_type = qm->kvm_type;
+ mc->block_default_type = qm->block_default_type;
+ mc->max_cpus = qm->max_cpus;
+ mc->no_serial = qm->no_serial;
+ mc->no_parallel = qm->no_parallel;
+ mc->use_virtcon = qm->use_virtcon;
+ mc->use_sclp = qm->use_sclp;
+ mc->no_floppy = qm->no_floppy;
+ mc->no_cdrom = qm->no_cdrom;
+ mc->no_sdcard = qm->no_sdcard;
+ mc->is_default = qm->is_default;
+ mc->default_machine_opts = qm->default_machine_opts;
+ mc->default_boot_order = qm->default_boot_order;
+ mc->compat_props = qm->compat_props;
+ mc->hw_version = qm->hw_version;
+}
+
+void qemu_register_pc_machine(QEMUMachine *m)
+{
+ char *name = g_strconcat(m->name, TYPE_MACHINE_SUFFIX, NULL);
+ TypeInfo ti = {
+ .name = name,
+ .parent = TYPE_PC_MACHINE,
+ .class_init = pc_generic_machine_class_init,
+ .class_data = (void *)m,
+ };
+
+ type_register(&ti);
+ g_free(name);
+}
+
+static const TypeInfo pc_machine_info = {
+ .name = TYPE_PC_MACHINE,
+ .parent = TYPE_MACHINE,
+ .abstract = true,
+ .instance_size = sizeof(PCMachineState),
+ .class_size = sizeof(PCMachineClass),
+};
+
+static void pc_machine_register_types(void)
+{
+ type_register_static(&pc_machine_info);
+}
+
+type_init(pc_machine_register_types)
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index a48e263..abb599b 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -843,25 +843,25 @@ static QEMUMachine xenfv_machine = {
static void pc_machine_init(void)
{
- qemu_register_machine(&pc_i440fx_machine_v2_1);
- qemu_register_machine(&pc_i440fx_machine_v2_0);
- qemu_register_machine(&pc_i440fx_machine_v1_7);
- qemu_register_machine(&pc_i440fx_machine_v1_6);
- qemu_register_machine(&pc_i440fx_machine_v1_5);
- qemu_register_machine(&pc_i440fx_machine_v1_4);
- qemu_register_machine(&pc_machine_v1_3);
- qemu_register_machine(&pc_machine_v1_2);
- qemu_register_machine(&pc_machine_v1_1);
- qemu_register_machine(&pc_machine_v1_0);
- qemu_register_machine(&pc_machine_v0_15);
- qemu_register_machine(&pc_machine_v0_14);
- qemu_register_machine(&pc_machine_v0_13);
- qemu_register_machine(&pc_machine_v0_12);
- qemu_register_machine(&pc_machine_v0_11);
- qemu_register_machine(&pc_machine_v0_10);
- qemu_register_machine(&isapc_machine);
+ qemu_register_pc_machine(&pc_i440fx_machine_v2_1);
+ qemu_register_pc_machine(&pc_i440fx_machine_v2_0);
+ qemu_register_pc_machine(&pc_i440fx_machine_v1_7);
+ qemu_register_pc_machine(&pc_i440fx_machine_v1_6);
+ qemu_register_pc_machine(&pc_i440fx_machine_v1_5);
+ qemu_register_pc_machine(&pc_i440fx_machine_v1_4);
+ qemu_register_pc_machine(&pc_machine_v1_3);
+ qemu_register_pc_machine(&pc_machine_v1_2);
+ qemu_register_pc_machine(&pc_machine_v1_1);
+ qemu_register_pc_machine(&pc_machine_v1_0);
+ qemu_register_pc_machine(&pc_machine_v0_15);
+ qemu_register_pc_machine(&pc_machine_v0_14);
+ qemu_register_pc_machine(&pc_machine_v0_13);
+ qemu_register_pc_machine(&pc_machine_v0_12);
+ qemu_register_pc_machine(&pc_machine_v0_11);
+ qemu_register_pc_machine(&pc_machine_v0_10);
+ qemu_register_pc_machine(&isapc_machine);
#ifdef CONFIG_XEN
- qemu_register_machine(&xenfv_machine);
+ qemu_register_pc_machine(&xenfv_machine);
#endif
}
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index b3c02c1..d211393 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -384,12 +384,12 @@ static QEMUMachine pc_q35_machine_v1_4 = {
static void pc_q35_machine_init(void)
{
- qemu_register_machine(&pc_q35_machine_v2_1);
- qemu_register_machine(&pc_q35_machine_v2_0);
- qemu_register_machine(&pc_q35_machine_v1_7);
- qemu_register_machine(&pc_q35_machine_v1_6);
- qemu_register_machine(&pc_q35_machine_v1_5);
- qemu_register_machine(&pc_q35_machine_v1_4);
+ qemu_register_pc_machine(&pc_q35_machine_v2_1);
+ qemu_register_pc_machine(&pc_q35_machine_v2_0);
+ qemu_register_pc_machine(&pc_q35_machine_v1_7);
+ qemu_register_pc_machine(&pc_q35_machine_v1_6);
+ qemu_register_pc_machine(&pc_q35_machine_v1_5);
+ qemu_register_pc_machine(&pc_q35_machine_v1_4);
}
machine_init(pc_q35_machine_init);
--
MST
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Qemu-devel] [PULL v2 002/108] pc: ACPI BIOS: use enum for defining memory affinity flags
2014-06-18 16:43 [Qemu-devel] [PULL v2 000/108] pc, pci, virtio, hotplug fixes, enhancements Michael S. Tsirkin
2014-06-18 16:43 ` [Qemu-devel] [PULL v2 001/108] pc: create custom generic PC machine type Michael S. Tsirkin
@ 2014-06-18 16:43 ` Michael S. Tsirkin
2014-06-18 16:43 ` [Qemu-devel] [PULL v2 005/108] add memdev backend infrastructure Michael S. Tsirkin
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Michael S. Tsirkin @ 2014-06-18 16:43 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Peter Crosthwaite, Anthony Liguori, Igor Mammedov
From: Igor Mammedov <imammedo@redhat.com>
replace magic numbers with enum describing Flags field of
memory affinity in SRAT table.
MemoryAffinityFlags enum will define flags decribed by:
ACPI spec 5.0, "5.2.16.2 Memory Affinity Structure",
"Table 5-69 Flags - Memory Affinity Structure"
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Acked-by: Peter Crosthwaite <peter.crostwaite@xilinx.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/i386/acpi-build.c | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 1e0aa09..9a41510 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1132,15 +1132,22 @@ build_hpet(GArray *table_data, GArray *linker)
(void *)hpet, "HPET", sizeof(*hpet), 1);
}
+typedef enum {
+ MEM_AFFINITY_NOFLAGS = 0,
+ MEM_AFFINITY_ENABLED = (1 << 0),
+ MEM_AFFINITY_HOTPLUGGABLE = (1 << 1),
+ MEM_AFFINITY_NON_VOLATILE = (1 << 2),
+} MemoryAffinityFlags;
+
static void
-acpi_build_srat_memory(AcpiSratMemoryAffinity *numamem,
- uint64_t base, uint64_t len, int node, int enabled)
+acpi_build_srat_memory(AcpiSratMemoryAffinity *numamem, uint64_t base,
+ uint64_t len, int node, MemoryAffinityFlags flags)
{
numamem->type = ACPI_SRAT_MEMORY;
numamem->length = sizeof(*numamem);
memset(numamem->proximity, 0, 4);
numamem->proximity[0] = node;
- numamem->flags = cpu_to_le32(!!enabled);
+ numamem->flags = cpu_to_le32(flags);
numamem->base_addr = cpu_to_le64(base);
numamem->range_length = cpu_to_le64(len);
}
@@ -1188,7 +1195,7 @@ build_srat(GArray *table_data, GArray *linker,
numa_start = table_data->len;
numamem = acpi_data_push(table_data, sizeof *numamem);
- acpi_build_srat_memory(numamem, 0, 640*1024, 0, 1);
+ acpi_build_srat_memory(numamem, 0, 640*1024, 0, MEM_AFFINITY_ENABLED);
next_base = 1024 * 1024;
for (i = 1; i < guest_info->numa_nodes + 1; ++i) {
mem_base = next_base;
@@ -1204,19 +1211,21 @@ build_srat(GArray *table_data, GArray *linker,
mem_len -= next_base - guest_info->ram_size_below_4g;
if (mem_len > 0) {
numamem = acpi_data_push(table_data, sizeof *numamem);
- acpi_build_srat_memory(numamem, mem_base, mem_len, i-1, 1);
+ acpi_build_srat_memory(numamem, mem_base, mem_len, i - 1,
+ MEM_AFFINITY_ENABLED);
}
mem_base = 1ULL << 32;
mem_len = next_base - guest_info->ram_size_below_4g;
next_base += (1ULL << 32) - guest_info->ram_size_below_4g;
}
numamem = acpi_data_push(table_data, sizeof *numamem);
- acpi_build_srat_memory(numamem, mem_base, mem_len, i - 1, 1);
+ acpi_build_srat_memory(numamem, mem_base, mem_len, i - 1,
+ MEM_AFFINITY_ENABLED);
}
slots = (table_data->len - numa_start) / sizeof *numamem;
for (; slots < guest_info->numa_nodes + 2; slots++) {
numamem = acpi_data_push(table_data, sizeof *numamem);
- acpi_build_srat_memory(numamem, 0, 0, 0, 0);
+ acpi_build_srat_memory(numamem, 0, 0, 0, MEM_AFFINITY_NOFLAGS);
}
build_header(linker, table_data,
--
MST
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Qemu-devel] [PULL v2 005/108] add memdev backend infrastructure
2014-06-18 16:43 [Qemu-devel] [PULL v2 000/108] pc, pci, virtio, hotplug fixes, enhancements Michael S. Tsirkin
2014-06-18 16:43 ` [Qemu-devel] [PULL v2 001/108] pc: create custom generic PC machine type Michael S. Tsirkin
2014-06-18 16:43 ` [Qemu-devel] [PULL v2 002/108] pc: ACPI BIOS: use enum for defining memory affinity flags Michael S. Tsirkin
@ 2014-06-18 16:43 ` Michael S. Tsirkin
2014-06-18 16:44 ` [Qemu-devel] [PULL v2 006/108] vl.c: extend -m option to support options for memory hotplug Michael S. Tsirkin
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Michael S. Tsirkin @ 2014-06-18 16:43 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Hu Tao, Marcelo Tosatti, Michael Tokarev,
Anthony Liguori, Igor Mammedov, Paolo Bonzini
From: Igor Mammedov <imammedo@redhat.com>
Provides framework for splitting host RAM allocation/
policies into a separate backend that could be used
by devices.
Initially only legacy RAM backend is provided, which
uses memory_region_init_ram() allocator and compatible
with every CLI option that affects memory_region_init_ram().
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
include/sysemu/hostmem.h | 60 ++++++++++++++++++++++++++++++
backends/hostmem-ram.c | 54 +++++++++++++++++++++++++++
backends/hostmem.c | 97 ++++++++++++++++++++++++++++++++++++++++++++++++
backends/Makefile.objs | 2 +
4 files changed, 213 insertions(+)
create mode 100644 include/sysemu/hostmem.h
create mode 100644 backends/hostmem-ram.c
create mode 100644 backends/hostmem.c
diff --git a/include/sysemu/hostmem.h b/include/sysemu/hostmem.h
new file mode 100644
index 0000000..4fc081e
--- /dev/null
+++ b/include/sysemu/hostmem.h
@@ -0,0 +1,60 @@
+/*
+ * QEMU Host Memory Backend
+ *
+ * Copyright (C) 2013-2014 Red Hat Inc
+ *
+ * Authors:
+ * Igor Mammedov <imammedo@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.
+ */
+#ifndef QEMU_RAM_H
+#define QEMU_RAM_H
+
+#include "qom/object.h"
+#include "qapi/error.h"
+#include "exec/memory.h"
+#include "qemu/option.h"
+
+#define TYPE_MEMORY_BACKEND "memory-backend"
+#define MEMORY_BACKEND(obj) \
+ OBJECT_CHECK(HostMemoryBackend, (obj), TYPE_MEMORY_BACKEND)
+#define MEMORY_BACKEND_GET_CLASS(obj) \
+ OBJECT_GET_CLASS(HostMemoryBackendClass, (obj), TYPE_MEMORY_BACKEND)
+#define MEMORY_BACKEND_CLASS(klass) \
+ OBJECT_CLASS_CHECK(HostMemoryBackendClass, (klass), TYPE_MEMORY_BACKEND)
+
+typedef struct HostMemoryBackend HostMemoryBackend;
+typedef struct HostMemoryBackendClass HostMemoryBackendClass;
+
+/**
+ * HostMemoryBackendClass:
+ * @parent_class: opaque parent class container
+ */
+struct HostMemoryBackendClass {
+ ObjectClass parent_class;
+};
+
+/**
+ * @HostMemoryBackend
+ *
+ * @parent: opaque parent object container
+ * @size: amount of memory backend provides
+ * @id: unique identification string in memdev namespace
+ * @mr: MemoryRegion representing host memory belonging to backend
+ */
+struct HostMemoryBackend {
+ /* private */
+ Object parent;
+
+ /* protected */
+ uint64_t size;
+
+ MemoryRegion mr;
+};
+
+MemoryRegion *host_memory_backend_get_memory(HostMemoryBackend *backend,
+ Error **errp);
+
+#endif
diff --git a/backends/hostmem-ram.c b/backends/hostmem-ram.c
new file mode 100644
index 0000000..bba2ebc
--- /dev/null
+++ b/backends/hostmem-ram.c
@@ -0,0 +1,54 @@
+/*
+ * QEMU Host Memory Backend
+ *
+ * Copyright (C) 2013-2014 Red Hat Inc
+ *
+ * Authors:
+ * Igor Mammedov <imammedo@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 "sysemu/hostmem.h"
+#include "qom/object_interfaces.h"
+
+#define TYPE_MEMORY_BACKEND_RAM "memory-backend-ram"
+
+
+static void
+ram_backend_memory_init(UserCreatable *uc, Error **errp)
+{
+ HostMemoryBackend *backend = MEMORY_BACKEND(uc);
+ char *path;
+
+ if (!backend->size) {
+ error_setg(errp, "can't create backend with size 0");
+ return;
+ }
+
+ path = object_get_canonical_path_component(OBJECT(backend));
+ memory_region_init_ram(&backend->mr, OBJECT(backend), path,
+ backend->size);
+ g_free(path);
+}
+
+static void
+ram_backend_class_init(ObjectClass *oc, void *data)
+{
+ UserCreatableClass *ucc = USER_CREATABLE_CLASS(oc);
+
+ ucc->complete = ram_backend_memory_init;
+}
+
+static const TypeInfo ram_backend_info = {
+ .name = TYPE_MEMORY_BACKEND_RAM,
+ .parent = TYPE_MEMORY_BACKEND,
+ .class_init = ram_backend_class_init,
+};
+
+static void register_types(void)
+{
+ type_register_static(&ram_backend_info);
+}
+
+type_init(register_types);
diff --git a/backends/hostmem.c b/backends/hostmem.c
new file mode 100644
index 0000000..2f578ac
--- /dev/null
+++ b/backends/hostmem.c
@@ -0,0 +1,97 @@
+/*
+ * QEMU Host Memory Backend
+ *
+ * Copyright (C) 2013-2014 Red Hat Inc
+ *
+ * Authors:
+ * Igor Mammedov <imammedo@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 "sysemu/hostmem.h"
+#include "sysemu/sysemu.h"
+#include "qapi/visitor.h"
+#include "qapi/qmp/qerror.h"
+#include "qemu/config-file.h"
+#include "qom/object_interfaces.h"
+
+static void
+hostmemory_backend_get_size(Object *obj, Visitor *v, void *opaque,
+ const char *name, Error **errp)
+{
+ HostMemoryBackend *backend = MEMORY_BACKEND(obj);
+ uint64_t value = backend->size;
+
+ visit_type_size(v, &value, name, errp);
+}
+
+static void
+hostmemory_backend_set_size(Object *obj, Visitor *v, void *opaque,
+ const char *name, Error **errp)
+{
+ HostMemoryBackend *backend = MEMORY_BACKEND(obj);
+ Error *local_err = NULL;
+ uint64_t value;
+
+ if (memory_region_size(&backend->mr)) {
+ error_setg(&local_err, "cannot change property value");
+ goto out;
+ }
+
+ visit_type_size(v, &value, name, &local_err);
+ if (local_err) {
+ goto out;
+ }
+ if (!value) {
+ error_setg(&local_err, "Property '%s.%s' doesn't take value '%"
+ PRIu64 "'", object_get_typename(obj), name, value);
+ goto out;
+ }
+ backend->size = value;
+out:
+ error_propagate(errp, local_err);
+}
+
+static void hostmemory_backend_init(Object *obj)
+{
+ object_property_add(obj, "size", "int",
+ hostmemory_backend_get_size,
+ hostmemory_backend_set_size, NULL, NULL, NULL);
+}
+
+static void hostmemory_backend_finalize(Object *obj)
+{
+ HostMemoryBackend *backend = MEMORY_BACKEND(obj);
+
+ if (memory_region_size(&backend->mr)) {
+ memory_region_destroy(&backend->mr);
+ }
+}
+
+MemoryRegion *
+host_memory_backend_get_memory(HostMemoryBackend *backend, Error **errp)
+{
+ return memory_region_size(&backend->mr) ? &backend->mr : NULL;
+}
+
+static const TypeInfo hostmemory_backend_info = {
+ .name = TYPE_MEMORY_BACKEND,
+ .parent = TYPE_OBJECT,
+ .abstract = true,
+ .class_size = sizeof(HostMemoryBackendClass),
+ .instance_size = sizeof(HostMemoryBackend),
+ .instance_init = hostmemory_backend_init,
+ .instance_finalize = hostmemory_backend_finalize,
+ .interfaces = (InterfaceInfo[]) {
+ { TYPE_USER_CREATABLE },
+ { }
+ }
+};
+
+static void register_types(void)
+{
+ type_register_static(&hostmemory_backend_info);
+}
+
+type_init(register_types);
diff --git a/backends/Makefile.objs b/backends/Makefile.objs
index 591ddcf..7fb7acd 100644
--- a/backends/Makefile.objs
+++ b/backends/Makefile.objs
@@ -6,3 +6,5 @@ common-obj-$(CONFIG_BRLAPI) += baum.o
baum.o-cflags := $(SDL_CFLAGS)
common-obj-$(CONFIG_TPM) += tpm.o
+
+common-obj-y += hostmem.o hostmem-ram.o
--
MST
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Qemu-devel] [PULL v2 006/108] vl.c: extend -m option to support options for memory hotplug
2014-06-18 16:43 [Qemu-devel] [PULL v2 000/108] pc, pci, virtio, hotplug fixes, enhancements Michael S. Tsirkin
` (2 preceding siblings ...)
2014-06-18 16:43 ` [Qemu-devel] [PULL v2 005/108] add memdev backend infrastructure Michael S. Tsirkin
@ 2014-06-18 16:44 ` Michael S. Tsirkin
2014-06-18 16:44 ` [Qemu-devel] [PULL v2 007/108] qdev: hotplug for bus-less devices Michael S. Tsirkin
2014-06-18 16:44 ` [Qemu-devel] [PULL v2 008/108] qdev: expose DeviceState.hotplugged field as a property Michael S. Tsirkin
5 siblings, 0 replies; 7+ messages in thread
From: Michael S. Tsirkin @ 2014-06-18 16:44 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Stefan Hajnoczi, Marcel Apfelbaum, Michael Tokarev,
Alexander Graf, Markus Armbruster, Anthony Liguori, Paolo Bonzini,
Igor Mammedov, =?UTF-8?q?Andreas=20F=C3=A4rber?=
From: Igor Mammedov <imammedo@redhat.com>
Add following parameters:
"slots" - total number of hotplug memory slots
"maxmem" - maximum possible memory
"slots" and "maxmem" should go in pair and "maxmem" should be greater
than "mem" for memory hotplug to be enabled.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
include/hw/boards.h | 2 ++
vl.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
qemu-options.hx | 9 ++++++---
3 files changed, 59 insertions(+), 3 deletions(-)
diff --git a/include/hw/boards.h b/include/hw/boards.h
index 2d2e2be..184d245 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -113,6 +113,8 @@ struct MachineState {
char *firmware;
ram_addr_t ram_size;
+ ram_addr_t maxram_size;
+ uint64_t ram_slots;
const char *boot_order;
char *kernel_filename;
char *kernel_cmdline;
diff --git a/vl.c b/vl.c
index 16418ec..4c6d6df 100644
--- a/vl.c
+++ b/vl.c
@@ -520,6 +520,14 @@ static QemuOptsList qemu_mem_opts = {
.name = "size",
.type = QEMU_OPT_SIZE,
},
+ {
+ .name = "slots",
+ .type = QEMU_OPT_NUMBER,
+ },
+ {
+ .name = "maxmem",
+ .type = QEMU_OPT_SIZE,
+ },
{ /* end of list */ }
},
};
@@ -2992,6 +3000,8 @@ int main(int argc, char **argv, char **envp)
const char *trace_file = NULL;
const ram_addr_t default_ram_size = (ram_addr_t)DEFAULT_RAM_SIZE *
1024 * 1024;
+ ram_addr_t maxram_size = default_ram_size;
+ uint64_t ram_slots = 0;
atexit(qemu_run_exit_notifiers);
error_set_progname(argv[0]);
@@ -3327,6 +3337,7 @@ int main(int argc, char **argv, char **envp)
case QEMU_OPTION_m: {
uint64_t sz;
const char *mem_str;
+ const char *maxmem_str, *slots_str;
opts = qemu_opts_parse(qemu_find_opts("memory"),
optarg, 1);
@@ -3368,6 +3379,44 @@ int main(int argc, char **argv, char **envp)
error_report("ram size too large");
exit(EXIT_FAILURE);
}
+
+ maxmem_str = qemu_opt_get(opts, "maxmem");
+ slots_str = qemu_opt_get(opts, "slots");
+ if (maxmem_str && slots_str) {
+ uint64_t slots;
+
+ sz = qemu_opt_get_size(opts, "maxmem", 0);
+ if (sz < ram_size) {
+ fprintf(stderr, "qemu: invalid -m option value: maxmem "
+ "(%" PRIu64 ") <= initial memory (%"
+ PRIu64 ")\n", sz, ram_size);
+ exit(EXIT_FAILURE);
+ }
+
+ slots = qemu_opt_get_number(opts, "slots", 0);
+ if ((sz > ram_size) && !slots) {
+ fprintf(stderr, "qemu: invalid -m option value: maxmem "
+ "(%" PRIu64 ") more than initial memory (%"
+ PRIu64 ") but no hotplug slots where "
+ "specified\n", sz, ram_size);
+ exit(EXIT_FAILURE);
+ }
+
+ if ((sz <= ram_size) && slots) {
+ fprintf(stderr, "qemu: invalid -m option value: %"
+ PRIu64 " hotplug slots where specified but "
+ "maxmem (%" PRIu64 ") <= initial memory (%"
+ PRIu64 ")\n", slots, sz, ram_size);
+ exit(EXIT_FAILURE);
+ }
+ maxram_size = sz;
+ ram_slots = slots;
+ } else if ((!maxmem_str && slots_str) ||
+ (maxmem_str && !slots_str)) {
+ fprintf(stderr, "qemu: invalid -m option value: missing "
+ "'%s' option\n", slots_str ? "maxmem" : "slots");
+ exit(EXIT_FAILURE);
+ }
break;
}
#ifdef CONFIG_TPM
@@ -4436,6 +4485,8 @@ int main(int argc, char **argv, char **envp)
qdev_machine_init();
current_machine->ram_size = ram_size;
+ current_machine->maxram_size = maxram_size;
+ current_machine->ram_slots = ram_slots;
current_machine->boot_order = boot_order;
current_machine->cpu_model = cpu_model;
diff --git a/qemu-options.hx b/qemu-options.hx
index d0714c4..5a4eff9 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -210,17 +210,20 @@ use is discouraged as it may be removed from future versions.
ETEXI
DEF("m", HAS_ARG, QEMU_OPTION_m,
- "-m [size=]megs\n"
+ "-m[emory] [size=]megs[,slots=n,maxmem=size]\n"
" configure guest RAM\n"
" size: initial amount of guest memory (default: "
- stringify(DEFAULT_RAM_SIZE) "MiB)\n",
+ stringify(DEFAULT_RAM_SIZE) "MiB)\n"
+ " slots: number of hotplug slots (default: none)\n"
+ " maxmem: maximum amount of guest memory (default: none)\n",
QEMU_ARCH_ALL)
STEXI
@item -m [size=]@var{megs}
@findex -m
Set virtual RAM size to @var{megs} megabytes. Default is 128 MiB. Optionally,
a suffix of ``M'' or ``G'' can be used to signify a value in megabytes or
-gigabytes respectively.
+gigabytes respectively. Optional pair @var{slots}, @var{maxmem} could be used
+to set amount of hotluggable memory slots and possible maximum amount of memory.
ETEXI
DEF("mem-path", HAS_ARG, QEMU_OPTION_mempath,
--
MST
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Qemu-devel] [PULL v2 007/108] qdev: hotplug for bus-less devices
2014-06-18 16:43 [Qemu-devel] [PULL v2 000/108] pc, pci, virtio, hotplug fixes, enhancements Michael S. Tsirkin
` (3 preceding siblings ...)
2014-06-18 16:44 ` [Qemu-devel] [PULL v2 006/108] vl.c: extend -m option to support options for memory hotplug Michael S. Tsirkin
@ 2014-06-18 16:44 ` Michael S. Tsirkin
2014-06-18 16:44 ` [Qemu-devel] [PULL v2 008/108] qdev: expose DeviceState.hotplugged field as a property Michael S. Tsirkin
5 siblings, 0 replies; 7+ messages in thread
From: Michael S. Tsirkin @ 2014-06-18 16:44 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Eduardo Habkost, Igor Mammedov, Marcel Apfelbaum,
Alexander Graf, Anthony Liguori, Peter Crosthwaite, Paolo Bonzini,
=?UTF-8?q?Andreas=20F=C3=A4rber?=
From: Igor Mammedov <imammedo@redhat.com>
Add get_hotplug_handler() method to machine, and
make bus-less device use it during hotplug
as a means to discover a hotplug handler controller.
The returned controller is used to perform hotplug
actions.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Acked-by: Peter Crosthwaite <peter.crostwaite@xilinx.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
include/hw/boards.h | 8 ++++++++
hw/core/qdev.c | 13 +++++++++++++
2 files changed, 21 insertions(+)
diff --git a/include/hw/boards.h b/include/hw/boards.h
index 184d245..429ac43 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -61,6 +61,11 @@ extern MachineState *current_machine;
/**
* MachineClass:
* @qemu_machine: #QEMUMachine
+ * @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.
*/
struct MachineClass {
/*< private >*/
@@ -90,6 +95,9 @@ struct MachineClass {
const char *default_boot_order;
GlobalProperty *compat_props;
const char *hw_version;
+
+ HotplugHandler *(*get_hotplug_handler)(MachineState *machine,
+ DeviceState *dev);
};
/**
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index e65a5aa..fded645 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -34,6 +34,7 @@
#include "qapi/qmp/qjson.h"
#include "monitor/monitor.h"
#include "hw/hotplug.h"
+#include "hw/boards.h"
int qdev_hotplug = 0;
static bool qdev_hot_added = false;
@@ -813,6 +814,18 @@ static void device_set_realized(Object *obj, bool value, Error **errp)
local_err == NULL) {
hotplug_handler_plug(dev->parent_bus->hotplug_handler,
dev, &local_err);
+ } else if (local_err == NULL &&
+ object_dynamic_cast(qdev_get_machine(), TYPE_MACHINE)) {
+ HotplugHandler *hotplug_ctrl;
+ MachineState *machine = MACHINE(qdev_get_machine());
+ MachineClass *mc = MACHINE_GET_CLASS(machine);
+
+ if (mc->get_hotplug_handler) {
+ hotplug_ctrl = mc->get_hotplug_handler(machine, dev);
+ if (hotplug_ctrl) {
+ hotplug_handler_plug(hotplug_ctrl, dev, &local_err);
+ }
+ }
}
if (qdev_get_vmsd(dev) && local_err == NULL) {
--
MST
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Qemu-devel] [PULL v2 008/108] qdev: expose DeviceState.hotplugged field as a property
2014-06-18 16:43 [Qemu-devel] [PULL v2 000/108] pc, pci, virtio, hotplug fixes, enhancements Michael S. Tsirkin
` (4 preceding siblings ...)
2014-06-18 16:44 ` [Qemu-devel] [PULL v2 007/108] qdev: hotplug for bus-less devices Michael S. Tsirkin
@ 2014-06-18 16:44 ` Michael S. Tsirkin
5 siblings, 0 replies; 7+ messages in thread
From: Michael S. Tsirkin @ 2014-06-18 16:44 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Igor Mammedov, Anthony Liguori, Peter Crosthwaite,
Paolo Bonzini, =?UTF-8?q?Andreas=20F=C3=A4rber?=
From: Igor Mammedov <imammedo@redhat.com>
so that management could detect via QOM interface if device was
hotplugged
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Acked-by: Peter Crosthwaite <peter.crostwaite@xilinx.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/core/qdev.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index fded645..3226a71 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -878,6 +878,20 @@ static bool device_get_hotpluggable(Object *obj, Error **errp)
dev->parent_bus->allow_hotplug);
}
+static bool device_get_hotplugged(Object *obj, Error **err)
+{
+ DeviceState *dev = DEVICE(obj);
+
+ return dev->hotplugged;
+}
+
+static void device_set_hotplugged(Object *obj, bool value, Error **err)
+{
+ DeviceState *dev = DEVICE(obj);
+
+ dev->hotplugged = value;
+}
+
static void device_initfn(Object *obj)
{
DeviceState *dev = DEVICE(obj);
@@ -896,6 +910,9 @@ static void device_initfn(Object *obj)
device_get_realized, device_set_realized, NULL);
object_property_add_bool(obj, "hotpluggable",
device_get_hotpluggable, NULL, NULL);
+ object_property_add_bool(obj, "hotplugged",
+ device_get_hotplugged, device_set_hotplugged,
+ &error_abort);
class = object_get_class(OBJECT(dev));
do {
--
MST
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-06-18 16:44 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-18 16:43 [Qemu-devel] [PULL v2 000/108] pc, pci, virtio, hotplug fixes, enhancements Michael S. Tsirkin
2014-06-18 16:43 ` [Qemu-devel] [PULL v2 001/108] pc: create custom generic PC machine type Michael S. Tsirkin
2014-06-18 16:43 ` [Qemu-devel] [PULL v2 002/108] pc: ACPI BIOS: use enum for defining memory affinity flags Michael S. Tsirkin
2014-06-18 16:43 ` [Qemu-devel] [PULL v2 005/108] add memdev backend infrastructure Michael S. Tsirkin
2014-06-18 16:44 ` [Qemu-devel] [PULL v2 006/108] vl.c: extend -m option to support options for memory hotplug Michael S. Tsirkin
2014-06-18 16:44 ` [Qemu-devel] [PULL v2 007/108] qdev: hotplug for bus-less devices Michael S. Tsirkin
2014-06-18 16:44 ` [Qemu-devel] [PULL v2 008/108] qdev: expose DeviceState.hotplugged field as a property Michael S. Tsirkin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).