thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
62547e
From 7634eed5aea61dc94f9a828c62ef3da9aeaa62ae Mon Sep 17 00:00:00 2001
62547e
From: Janosch Frank <frankja@linux.ibm.com>
62547e
Date: Mon, 17 Oct 2022 08:38:18 +0000
62547e
Subject: [PATCH 37/42] s390x: Add protected dump cap
62547e
MIME-Version: 1.0
62547e
Content-Type: text/plain; charset=UTF-8
62547e
Content-Transfer-Encoding: 8bit
62547e
62547e
RH-Author: Cédric Le Goater <clg@redhat.com>
62547e
RH-MergeRequest: 226: s390: Enhanced Interpretation for PCI Functions and Secure Execution guest dump
62547e
RH-Bugzilla: 1664378 2043909
62547e
RH-Acked-by: Thomas Huth <thuth@redhat.com>
62547e
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
62547e
RH-Acked-by: Jon Maloy <jmaloy@redhat.com>
62547e
RH-Commit: [37/41] 52e1e7bf1a00ce3a220d3db2f733a65548bfec6d
62547e
62547e
Add a protected dump capability for later feature checking.
62547e
62547e
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
62547e
Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
62547e
Reviewed-by: Thomas Huth <thuth@redhat.com>
62547e
Reviewed-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
62547e
Message-Id: <20221017083822.43118-7-frankja@linux.ibm.com>
62547e
[ Marc-André - Add missing stubs when !kvm ]
62547e
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
62547e
(cherry picked from commit ad3b2e693daac6ed92db7361236028851d37c77c)
62547e
Signed-off-by: Cédric Le Goater <clg@redhat.com>
62547e
---
62547e
 target/s390x/kvm/kvm.c       |  7 +++++++
62547e
 target/s390x/kvm/kvm_s390x.h |  1 +
62547e
 target/s390x/kvm/meson.build |  2 ++
62547e
 target/s390x/kvm/stubs.c     | 12 ++++++++++++
62547e
 4 files changed, 22 insertions(+)
62547e
 create mode 100644 target/s390x/kvm/stubs.c
62547e
62547e
diff --git a/target/s390x/kvm/kvm.c b/target/s390x/kvm/kvm.c
62547e
index 30712487d4..d36b44f32a 100644
62547e
--- a/target/s390x/kvm/kvm.c
62547e
+++ b/target/s390x/kvm/kvm.c
62547e
@@ -159,6 +159,7 @@ static int cap_hpage_1m;
62547e
 static int cap_vcpu_resets;
62547e
 static int cap_protected;
62547e
 static int cap_zpci_op;
62547e
+static int cap_protected_dump;
62547e
 
62547e
 static bool mem_op_storage_key_support;
62547e
 
62547e
@@ -365,6 +366,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s)
62547e
     cap_vcpu_resets = kvm_check_extension(s, KVM_CAP_S390_VCPU_RESETS);
62547e
     cap_protected = kvm_check_extension(s, KVM_CAP_S390_PROTECTED);
62547e
     cap_zpci_op = kvm_check_extension(s, KVM_CAP_S390_ZPCI_OP);
62547e
+    cap_protected_dump = kvm_check_extension(s, KVM_CAP_S390_PROTECTED_DUMP);
62547e
 
62547e
     kvm_vm_enable_cap(s, KVM_CAP_S390_USER_SIGP, 0);
62547e
     kvm_vm_enable_cap(s, KVM_CAP_S390_VECTOR_REGISTERS, 0);
62547e
@@ -2042,6 +2044,11 @@ int kvm_s390_assign_subch_ioeventfd(EventNotifier *notifier, uint32_t sch,
62547e
     return kvm_vm_ioctl(kvm_state, KVM_IOEVENTFD, &kick);
62547e
 }
62547e
 
62547e
+int kvm_s390_get_protected_dump(void)
62547e
+{
62547e
+    return cap_protected_dump;
62547e
+}
62547e
+
62547e
 int kvm_s390_get_ri(void)
62547e
 {
62547e
     return cap_ri;
62547e
diff --git a/target/s390x/kvm/kvm_s390x.h b/target/s390x/kvm/kvm_s390x.h
62547e
index aaae8570de..f9785564d0 100644
62547e
--- a/target/s390x/kvm/kvm_s390x.h
62547e
+++ b/target/s390x/kvm/kvm_s390x.h
62547e
@@ -26,6 +26,7 @@ int kvm_s390_set_cpu_state(S390CPU *cpu, uint8_t cpu_state);
62547e
 void kvm_s390_vcpu_interrupt_pre_save(S390CPU *cpu);
62547e
 int kvm_s390_vcpu_interrupt_post_load(S390CPU *cpu);
62547e
 int kvm_s390_get_hpage_1m(void);
62547e
+int kvm_s390_get_protected_dump(void);
62547e
 int kvm_s390_get_ri(void);
62547e
 int kvm_s390_get_zpci_op(void);
62547e
 int kvm_s390_get_clock(uint8_t *tod_high, uint64_t *tod_clock);
62547e
diff --git a/target/s390x/kvm/meson.build b/target/s390x/kvm/meson.build
62547e
index d1356356b1..aef52b6686 100644
62547e
--- a/target/s390x/kvm/meson.build
62547e
+++ b/target/s390x/kvm/meson.build
62547e
@@ -1,6 +1,8 @@
62547e
 
62547e
 s390x_ss.add(when: 'CONFIG_KVM', if_true: files(
62547e
   'kvm.c'
62547e
+), if_false: files(
62547e
+  'stubs.c'
62547e
 ))
62547e
 
62547e
 # Newer kernels on s390 check for an S390_PGSTE program header and
62547e
diff --git a/target/s390x/kvm/stubs.c b/target/s390x/kvm/stubs.c
62547e
new file mode 100644
62547e
index 0000000000..5fd63b9a7e
62547e
--- /dev/null
62547e
+++ b/target/s390x/kvm/stubs.c
62547e
@@ -0,0 +1,12 @@
62547e
+/*
62547e
+ * SPDX-License-Identifier: GPL-2.0-or-later
62547e
+ */
62547e
+
62547e
+#include "qemu/osdep.h"
62547e
+
62547e
+#include "kvm_s390x.h"
62547e
+
62547e
+int kvm_s390_get_protected_dump(void)
62547e
+{
62547e
+    return false;
62547e
+}
62547e
-- 
62547e
2.37.3
62547e