[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[qemu-s390x] [PATCH v1 3/8] machine: provide default resource handler
From: |
David Hildenbrand |
Subject: |
[qemu-s390x] [PATCH v1 3/8] machine: provide default resource handler |
Date: |
Thu, 3 May 2018 17:49:31 +0200 |
Most resources that can't be handled via the hotplug handler will have
to assign "system wide" resource. This is e.g. the case for memory
devices. This will allow for a quite clean implementation for such
handling.
The new functions will soon be filled with life.
Signed-off-by: David Hildenbrand <address@hidden>
---
hw/core/machine.c | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/hw/core/machine.c b/hw/core/machine.c
index 2040177664..a41068410c 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -517,8 +517,31 @@ void machine_set_cpu_numa_node(MachineState *machine,
}
}
+static ResourceHandler *machine_get_resource_handler(MachineState *machine,
+ const DeviceState *dev)
+{
+ return NULL;
+}
+
+static void machine_resource_handler_pre_assign(ResourceHandler *rh,
+ const DeviceState *dev,
+ Error **errp)
+{
+}
+
+static void machine_resource_handler_assign(ResourceHandler *rh,
+ DeviceState *dev, Error **errp)
+{
+}
+
+static void machine_resource_handler_unassign(ResourceHandler *rh,
+ DeviceState *dev)
+{
+}
+
static void machine_class_init(ObjectClass *oc, void *data)
{
+ ResourceHandlerClass *rhc = RESOURCE_HANDLER_CLASS(oc);
MachineClass *mc = MACHINE_CLASS(oc);
/* Default 128 MB as guest ram size */
@@ -531,6 +554,12 @@ static void machine_class_init(ObjectClass *oc, void *data)
mc->numa_mem_align_shift = 23;
mc->numa_auto_assign_ram = numa_default_auto_assign_ram;
+ /* default resource handler */
+ mc->get_resource_handler = machine_get_resource_handler;
+ rhc->pre_assign = machine_resource_handler_pre_assign;
+ rhc->assign = machine_resource_handler_assign;
+ rhc->unassign = machine_resource_handler_unassign;
+
object_class_property_add_str(oc, "accel",
machine_get_accel, machine_set_accel, &error_abort);
object_class_property_set_description(oc, "accel",
@@ -868,6 +897,10 @@ static const TypeInfo machine_info = {
.instance_size = sizeof(MachineState),
.instance_init = machine_initfn,
.instance_finalize = machine_finalize,
+ .interfaces = (InterfaceInfo[]) {
+ { TYPE_RESOURCE_HANDLER },
+ { }
+ },
};
static void machine_register_types(void)
--
2.14.3
- [qemu-s390x] [PATCH v1 0/8] MemoryDevice: introduce and use ResourceHandler, David Hildenbrand, 2018/05/03
- [qemu-s390x] [PATCH v1 1/8] memory-device: always compile support for memory devices for SOFTMMU, David Hildenbrand, 2018/05/03
- [qemu-s390x] [PATCH v1 2/8] qdev: introduce ResourceHandler as a first-stage hotplug handler, David Hildenbrand, 2018/05/03
- [qemu-s390x] [PATCH v1 3/8] machine: provide default resource handler,
David Hildenbrand <=
- [qemu-s390x] [PATCH v1 4/8] memory-device: new functions to handle resource assignment, David Hildenbrand, 2018/05/03
- [qemu-s390x] [PATCH v1 5/8] pc-dimm: implement new memory device functions, David Hildenbrand, 2018/05/03
- [qemu-s390x] [PATCH v1 6/8] machine: introduce enforce_memory_device_align() and add it for pc, David Hildenbrand, 2018/05/03
- [qemu-s390x] [PATCH v1 7/8] memory-device: factor out pre-assign into default resource handler, David Hildenbrand, 2018/05/03
- [qemu-s390x] [PATCH v1 8/8] memory-device: factor out (un)assign into default resource handler, David Hildenbrand, 2018/05/03
- Re: [qemu-s390x] [Qemu-devel] [PATCH v1 0/8] MemoryDevice: introduce and use ResourceHandler, Igor Mammedov, 2018/05/04
- Re: [qemu-s390x] [PATCH v1 0/8] MemoryDevice: introduce and use ResourceHandler, David Hildenbrand, 2018/05/09