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

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