|
|
7711c0 |
From fee69ca995ff34fc343fa3e0f57aab5f0e5f7351 Mon Sep 17 00:00:00 2001
|
|
|
7711c0 |
From: Markus Armbruster <armbru@redhat.com>
|
|
|
7711c0 |
Date: Fri, 17 May 2019 06:51:08 +0200
|
|
|
7711c0 |
Subject: [PATCH 41/53] vl: Prepare fix of latent bug with -global and onboard
|
|
|
7711c0 |
devices
|
|
|
7711c0 |
MIME-Version: 1.0
|
|
|
7711c0 |
Content-Type: text/plain; charset=UTF-8
|
|
|
7711c0 |
Content-Transfer-Encoding: 8bit
|
|
|
7711c0 |
|
|
|
7711c0 |
RH-Author: Markus Armbruster <armbru@redhat.com>
|
|
|
7711c0 |
Message-id: <20190517065120.12028-20-armbru@redhat.com>
|
|
|
7711c0 |
Patchwork-id: 87980
|
|
|
7711c0 |
O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH v3 19/31] vl: Prepare fix of latent bug with -global and onboard devices
|
|
|
7711c0 |
Bugzilla: 1624009
|
|
|
7711c0 |
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
|
|
7711c0 |
RH-Acked-by: Thomas Huth <thuth@redhat.com>
|
|
|
7711c0 |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
7711c0 |
|
|
|
7711c0 |
main() registers the user's -global only after we create the machine
|
|
|
7711c0 |
object, i.e. too late for devices created in the machine's
|
|
|
7711c0 |
.instance_init(). The next commit is upstream's fix. To make it
|
|
|
7711c0 |
apply, we need to move machine and accelerator compat property
|
|
|
7711c0 |
creation out of register_global_properties(), so its MachineState
|
|
|
7711c0 |
parameter becomes unused.
|
|
|
7711c0 |
|
|
|
7711c0 |
Create machine compat props right after select_machine(). Create
|
|
|
7711c0 |
accelerator compat props in accel_init_machine(). In both cases, this
|
|
|
7711c0 |
creates them as early as possible, and exactly where upstream creates
|
|
|
7711c0 |
them since commit 1a3ec8c1564. Note that their relative order remains
|
|
|
7711c0 |
unchanged; machine compat props still override accelerator compat
|
|
|
7711c0 |
props.
|
|
|
7711c0 |
|
|
|
7711c0 |
Why not backport commit 1a3ec8c1564 instead? That commit fixes a
|
|
|
7711c0 |
latent bug in upstream's reorganization of compat properties (merge
|
|
|
7711c0 |
commit 31ed41889e6). It has a bug fixed up in commit 79b9d4bde7d. It
|
|
|
7711c0 |
doesn't apply without the reorganization. This commit reimplements
|
|
|
7711c0 |
enough of the two commits (without fixing any bugs) to make the
|
|
|
7711c0 |
remainder of the upstream series apply cleanly.
|
|
|
7711c0 |
|
|
|
7711c0 |
Signed-off-by: Markus Armbruster <armbru@redhat.com>
|
|
|
7711c0 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
7711c0 |
---
|
|
|
7711c0 |
accel/accel.c | 2 ++
|
|
|
7711c0 |
hw/core/machine.c | 3 +--
|
|
|
7711c0 |
include/hw/boards.h | 2 +-
|
|
|
7711c0 |
vl.c | 3 +--
|
|
|
7711c0 |
4 files changed, 5 insertions(+), 5 deletions(-)
|
|
|
7711c0 |
|
|
|
7711c0 |
diff --git a/accel/accel.c b/accel/accel.c
|
|
|
7711c0 |
index 124f957..2e0bff5 100644
|
|
|
7711c0 |
--- a/accel/accel.c
|
|
|
7711c0 |
+++ b/accel/accel.c
|
|
|
7711c0 |
@@ -64,6 +64,8 @@ static int accel_init_machine(AccelClass *acc, MachineState *ms)
|
|
|
7711c0 |
ms->accelerator = NULL;
|
|
|
7711c0 |
*(acc->allowed) = false;
|
|
|
7711c0 |
object_unref(OBJECT(accel));
|
|
|
7711c0 |
+ } else {
|
|
|
7711c0 |
+ accel_register_compat_props(ms->accelerator);
|
|
|
7711c0 |
}
|
|
|
7711c0 |
return ret;
|
|
|
7711c0 |
}
|
|
|
7711c0 |
diff --git a/hw/core/machine.c b/hw/core/machine.c
|
|
|
7711c0 |
index b4804e9..e5b8881 100644
|
|
|
7711c0 |
--- a/hw/core/machine.c
|
|
|
7711c0 |
+++ b/hw/core/machine.c
|
|
|
7711c0 |
@@ -839,9 +839,8 @@ static void machine_class_finalize(ObjectClass *klass, void *data)
|
|
|
7711c0 |
g_free(mc->name);
|
|
|
7711c0 |
}
|
|
|
7711c0 |
|
|
|
7711c0 |
-void machine_register_compat_props(MachineState *machine)
|
|
|
7711c0 |
+void machine_register_compat_props(MachineClass *mc)
|
|
|
7711c0 |
{
|
|
|
7711c0 |
- MachineClass *mc = MACHINE_GET_CLASS(machine);
|
|
|
7711c0 |
int i;
|
|
|
7711c0 |
GlobalProperty *p;
|
|
|
7711c0 |
|
|
|
7711c0 |
diff --git a/include/hw/boards.h b/include/hw/boards.h
|
|
|
7711c0 |
index a609239..cf24cbf 100644
|
|
|
7711c0 |
--- a/include/hw/boards.h
|
|
|
7711c0 |
+++ b/include/hw/boards.h
|
|
|
7711c0 |
@@ -70,7 +70,7 @@ int machine_kvm_shadow_mem(MachineState *machine);
|
|
|
7711c0 |
int machine_phandle_start(MachineState *machine);
|
|
|
7711c0 |
bool machine_dump_guest_core(MachineState *machine);
|
|
|
7711c0 |
bool machine_mem_merge(MachineState *machine);
|
|
|
7711c0 |
-void machine_register_compat_props(MachineState *machine);
|
|
|
7711c0 |
+void machine_register_compat_props(MachineClass *mc);
|
|
|
7711c0 |
HotpluggableCPUList *machine_query_hotpluggable_cpus(MachineState *machine);
|
|
|
7711c0 |
void machine_set_cpu_numa_node(MachineState *machine,
|
|
|
7711c0 |
const CpuInstanceProperties *props,
|
|
|
7711c0 |
diff --git a/vl.c b/vl.c
|
|
|
7711c0 |
index a22da93..72c489f 100644
|
|
|
7711c0 |
--- a/vl.c
|
|
|
7711c0 |
+++ b/vl.c
|
|
|
7711c0 |
@@ -3060,8 +3060,6 @@ static void user_register_global_props(void)
|
|
|
7711c0 |
*/
|
|
|
7711c0 |
static void register_global_properties(MachineState *ms)
|
|
|
7711c0 |
{
|
|
|
7711c0 |
- accel_register_compat_props(ms->accelerator);
|
|
|
7711c0 |
- machine_register_compat_props(ms);
|
|
|
7711c0 |
user_register_global_props();
|
|
|
7711c0 |
}
|
|
|
7711c0 |
|
|
|
7711c0 |
@@ -4127,6 +4125,7 @@ int main(int argc, char **argv, char **envp)
|
|
|
7711c0 |
limit_max_cpus_in_machines();
|
|
|
7711c0 |
|
|
|
7711c0 |
machine_class = select_machine();
|
|
|
7711c0 |
+ machine_register_compat_props(machine_class);
|
|
|
7711c0 |
|
|
|
7711c0 |
set_memory_options(&ram_slots, &maxram_size, machine_class);
|
|
|
7711c0 |
|
|
|
7711c0 |
--
|
|
|
7711c0 |
1.8.3.1
|
|
|
7711c0 |
|