Blame SOURCES/kvm-s390x-s390-skeys-Mark-the-storage-key-devices-with-u.patch

4a2fec
From b830658def8c36d5449e0b704e2f0cb26a593c1e Mon Sep 17 00:00:00 2001
4a2fec
From: Thomas Huth <thuth@redhat.com>
4a2fec
Date: Mon, 9 Oct 2017 12:32:42 +0200
4a2fec
Subject: [PATCH 23/34] s390x/s390-skeys: Mark the storage key devices with
4a2fec
 user_creatable = false
4a2fec
4a2fec
RH-Author: Thomas Huth <thuth@redhat.com>
4a2fec
Message-id: <1507552368-9245-7-git-send-email-thuth@redhat.com>
4a2fec
Patchwork-id: 77024
4a2fec
O-Subject: [RHEL-7.5 qemu-kvm-ma PATCH 06/12] s390x/s390-skeys: Mark the storage key devices with user_creatable = false
4a2fec
Bugzilla: 1492033
4a2fec
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
4a2fec
RH-Acked-by: David Gibson <dgibson@redhat.com>
4a2fec
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
4a2fec
4a2fec
QEMU currently aborts if the user tries to create a skey device:
4a2fec
4a2fec
$ s390x-softmmu/qemu-system-s390x -nographic -device s390-skeys-qemu
4a2fec
qemu-system-s390x: hw/s390x/s390-skeys.c:30: s390_get_skeys_device:
4a2fec
 Assertion `ss' failed.
4a2fec
Aborted (core dumped)
4a2fec
4a2fec
The storage key devices are only meant to be instantiated one time,
4a2fec
internally. They can not be used by the user, so mark them with
4a2fec
user_creatable = false.
4a2fec
4a2fec
Signed-off-by: Thomas Huth <thuth@redhat.com>
4a2fec
Message-Id: <1503569328-22197-1-git-send-email-thuth@redhat.com>
4a2fec
Reviewed-by: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>
4a2fec
Reviewed-by: Halil Pasic <pasic@linux.vnet.ibm.com>
4a2fec
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
4a2fec
(cherry picked from commit 574ee06de9c4fe63c90be90dc9c747fc9382bb2b)
4a2fec
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
4a2fec
---
4a2fec
 hw/s390x/s390-skeys-kvm.c | 4 ++++
4a2fec
 hw/s390x/s390-skeys.c     | 4 ++++
4a2fec
 2 files changed, 8 insertions(+)
4a2fec
4a2fec
diff --git a/hw/s390x/s390-skeys-kvm.c b/hw/s390x/s390-skeys-kvm.c
4a2fec
index 131da56..dc54ed8 100644
4a2fec
--- a/hw/s390x/s390-skeys-kvm.c
4a2fec
+++ b/hw/s390x/s390-skeys-kvm.c
4a2fec
@@ -54,10 +54,14 @@ static int kvm_s390_skeys_set(S390SKeysState *ss, uint64_t start_gfn,
4a2fec
 static void kvm_s390_skeys_class_init(ObjectClass *oc, void *data)
4a2fec
 {
4a2fec
     S390SKeysClass *skeyclass = S390_SKEYS_CLASS(oc);
4a2fec
+    DeviceClass *dc = DEVICE_CLASS(oc);
4a2fec
 
4a2fec
     skeyclass->skeys_enabled = kvm_s390_skeys_enabled;
4a2fec
     skeyclass->get_skeys = kvm_s390_skeys_get;
4a2fec
     skeyclass->set_skeys = kvm_s390_skeys_set;
4a2fec
+
4a2fec
+    /* Reason: Internal device (only one skeys device for the whole memory) */
4a2fec
+    dc->user_creatable = false;
4a2fec
 }
4a2fec
 
4a2fec
 static const TypeInfo kvm_s390_skeys_info = {
4a2fec
diff --git a/hw/s390x/s390-skeys.c b/hw/s390x/s390-skeys.c
4a2fec
index c0de3b0..53ad5d3 100644
4a2fec
--- a/hw/s390x/s390-skeys.c
4a2fec
+++ b/hw/s390x/s390-skeys.c
4a2fec
@@ -229,10 +229,14 @@ static int qemu_s390_skeys_get(S390SKeysState *ss, uint64_t start_gfn,
4a2fec
 static void qemu_s390_skeys_class_init(ObjectClass *oc, void *data)
4a2fec
 {
4a2fec
     S390SKeysClass *skeyclass = S390_SKEYS_CLASS(oc);
4a2fec
+    DeviceClass *dc = DEVICE_CLASS(oc);
4a2fec
 
4a2fec
     skeyclass->skeys_enabled = qemu_s390_skeys_enabled;
4a2fec
     skeyclass->get_skeys = qemu_s390_skeys_get;
4a2fec
     skeyclass->set_skeys = qemu_s390_skeys_set;
4a2fec
+
4a2fec
+    /* Reason: Internal device (only one skeys device for the whole memory) */
4a2fec
+    dc->user_creatable = false;
4a2fec
 }
4a2fec
 
4a2fec
 static const TypeInfo qemu_s390_skeys_info = {
4a2fec
-- 
4a2fec
1.8.3.1
4a2fec