Blame SOURCES/kvm-hw-nvram-spapr_nvram-Device-can-not-be-created-by-th.patch

9bac43
From 04b5f1821a275b874f372ad3c0f758305b856545 Mon Sep 17 00:00:00 2001
9bac43
From: Sam Bobroff <sbobroff@redhat.com>
9bac43
Date: Tue, 10 Oct 2017 03:07:14 +0200
9bac43
Subject: [PATCH 32/34] hw/nvram/spapr_nvram: Device can not be created by the
9bac43
 users
9bac43
9bac43
RH-Author: Sam Bobroff <sbobroff@redhat.com>
9bac43
Message-id: <1507604834-28278-1-git-send-email-sbobroff@redhat.com>
9bac43
Patchwork-id: 77048
9bac43
O-Subject: [PATCH] hw/nvram/spapr_nvram: Device can not be created by the users
9bac43
Bugzilla: 1490869
9bac43
RH-Acked-by: Thomas Huth <thuth@redhat.com>
9bac43
RH-Acked-by: David Gibson <dgibson@redhat.com>
9bac43
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
9bac43
9bac43
From: Thomas Huth <thuth@redhat.com>
9bac43
9bac43
Trying to add a spapr-nvram device currently aborts QEMU like this:
9bac43
9bac43
$ ppc64-softmmu/qemu-system-ppc64  -device spapr-nvram
9bac43
qemu-system-ppc64: hw/ppc/spapr_rtas.c:407: spapr_rtas_register:
9bac43
 Assertion `!rtas_table[token].name' failed.
9bac43
Aborted (core dumped)
9bac43
9bac43
This NVRAM device registers RTAS calls during its realize function
9bac43
and thus can only be used once - and that's internally from spapr.c.
9bac43
So let's mark the device with user_creatable = false to avoid that
9bac43
the users can crash their QEMU this way.
9bac43
9bac43
Signed-off-by: Thomas Huth <thuth@redhat.com>
9bac43
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
9bac43
(cherry picked from commit 280503ee9d7833a793770d732dda5358659825e9)
9bac43
9bac43
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1490869
9bac43
Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=14217542
9bac43
Testing: Run "ppc64-softmmu/qemu-system-ppc64  -device spapr-nvram".
9bac43
Signed-off-by: Sam Bobroff <sbobroff@redhat.com>
9bac43
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9bac43
---
9bac43
 hw/nvram/spapr_nvram.c | 2 ++
9bac43
 1 file changed, 2 insertions(+)
9bac43
9bac43
diff --git a/hw/nvram/spapr_nvram.c b/hw/nvram/spapr_nvram.c
9bac43
index bc355a4..4a0aec8 100644
9bac43
--- a/hw/nvram/spapr_nvram.c
9bac43
+++ b/hw/nvram/spapr_nvram.c
9bac43
@@ -264,6 +264,8 @@ static void spapr_nvram_class_init(ObjectClass *klass, void *data)
9bac43
     set_bit(DEVICE_CATEGORY_MISC, dc->categories);
9bac43
     dc->props = spapr_nvram_properties;
9bac43
     dc->vmsd = &vmstate_spapr_nvram;
9bac43
+    /* Reason: Internal device only, uses spapr_rtas_register() in realize() */
9bac43
+    dc->user_creatable = false;
9bac43
 }
9bac43
 
9bac43
 static const TypeInfo spapr_nvram_type_info = {
9bac43
-- 
9bac43
1.8.3.1
9bac43