thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

Blame SOURCES/kvm-s390x-s390-virtio-ccw-Fix-build-on-systems-without-K.patch

77c23f
From 0db8d909a2f3c53d12b0ae12307965f9a8193dbc Mon Sep 17 00:00:00 2001
77c23f
From: Thomas Huth <thuth@redhat.com>
77c23f
Date: Fri, 29 May 2020 05:54:19 -0400
77c23f
Subject: [PATCH 37/42] s390x/s390-virtio-ccw: Fix build on systems without KVM
77c23f
MIME-Version: 1.0
77c23f
Content-Type: text/plain; charset=UTF-8
77c23f
Content-Transfer-Encoding: 8bit
77c23f
77c23f
RH-Author: Thomas Huth <thuth@redhat.com>
77c23f
Message-id: <20200529055420.16855-38-thuth@redhat.com>
77c23f
Patchwork-id: 97047
77c23f
O-Subject: [RHEL-8.3.0 qemu-kvm PATCH v2 37/38] s390x/s390-virtio-ccw: Fix build on systems without KVM
77c23f
Bugzilla: 1828317
77c23f
RH-Acked-by: Claudio Imbrenda <cimbrend@redhat.com>
77c23f
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
77c23f
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
77c23f
RH-Acked-by: David Hildenbrand <david@redhat.com>
77c23f
77c23f
From: Christian Borntraeger <borntraeger@de.ibm.com>
77c23f
77c23f
linux/kvm.h is not available on all platforms. Let us move
77c23f
s390_machine_inject_pv_error into pv.c as it uses KVM structures.
77c23f
Also rename the function to s390_pv_inject_reset_error.
77c23f
77c23f
While at it, ipl.h needs an include for "exec/address-spaces.h"
77c23f
as it uses address_space_memory.
77c23f
77c23f
Fixes: c3347ed0d2ee ("s390x: protvirt: Support unpack facility")
77c23f
Reported-by: Bruce Rogers <brogers@suse.com>
77c23f
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
77c23f
Message-Id: <20200406100158.5940-2-borntraeger@de.ibm.com>
77c23f
Reviewed-by: David Hildenbrand <david@redhat.com>
77c23f
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
77c23f
(cherry picked from commit fbc1384ccd48fa7c0c38f950adf7992a4fb6042e)
77c23f
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
77c23f
---
77c23f
 hw/s390x/ipl.h             |  1 +
77c23f
 hw/s390x/pv.c              | 11 +++++++++++
77c23f
 hw/s390x/s390-virtio-ccw.c | 12 +-----------
77c23f
 include/hw/s390x/pv.h      |  3 +++
77c23f
 4 files changed, 16 insertions(+), 11 deletions(-)
77c23f
77c23f
diff --git a/hw/s390x/ipl.h b/hw/s390x/ipl.h
77c23f
index 89b3044d7a..53cc9eb5ac 100644
77c23f
--- a/hw/s390x/ipl.h
77c23f
+++ b/hw/s390x/ipl.h
77c23f
@@ -14,6 +14,7 @@
77c23f
 #define HW_S390_IPL_H
77c23f
 
77c23f
 #include "cpu.h"
77c23f
+#include "exec/address-spaces.h"
77c23f
 #include "hw/qdev-core.h"
77c23f
 
77c23f
 struct IPLBlockPVComp {
77c23f
diff --git a/hw/s390x/pv.c b/hw/s390x/pv.c
77c23f
index cb0dce4a4f..f11868e865 100644
77c23f
--- a/hw/s390x/pv.c
77c23f
+++ b/hw/s390x/pv.c
77c23f
@@ -13,8 +13,10 @@
77c23f
 
77c23f
 #include <linux/kvm.h>
77c23f
 
77c23f
+#include "cpu.h"
77c23f
 #include "qemu/error-report.h"
77c23f
 #include "sysemu/kvm.h"
77c23f
+#include "hw/s390x/ipl.h"
77c23f
 #include "hw/s390x/pv.h"
77c23f
 
77c23f
 static int __s390_pv_cmd(uint32_t cmd, const char *cmdname, void *data)
77c23f
@@ -100,3 +102,12 @@ void s390_pv_unshare(void)
77c23f
 {
77c23f
     s390_pv_cmd_exit(KVM_PV_UNSHARE_ALL, NULL);
77c23f
 }
77c23f
+
77c23f
+void s390_pv_inject_reset_error(CPUState *cs)
77c23f
+{
77c23f
+    int r1 = (cs->kvm_run->s390_sieic.ipa & 0x00f0) >> 4;
77c23f
+    CPUS390XState *env = &S390_CPU(cs)->env;
77c23f
+
77c23f
+    /* Report that we are unable to enter protected mode */
77c23f
+    env->regs[r1 + 1] = DIAG_308_RC_INVAL_FOR_PV;
77c23f
+}
77c23f
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
77c23f
index c08e42bda1..07773a12b2 100644
77c23f
--- a/hw/s390x/s390-virtio-ccw.c
77c23f
+++ b/hw/s390x/s390-virtio-ccw.c
77c23f
@@ -44,7 +44,6 @@
77c23f
 #include "sysemu/sysemu.h"
77c23f
 #include "sysemu/balloon.h"
77c23f
 #include "hw/s390x/pv.h"
77c23f
-#include <linux/kvm.h>
77c23f
 #include "migration/blocker.h"
77c23f
 
77c23f
 static Error *pv_mig_blocker;
77c23f
@@ -391,15 +390,6 @@ out_err:
77c23f
     return rc;
77c23f
 }
77c23f
 
77c23f
-static void s390_machine_inject_pv_error(CPUState *cs)
77c23f
-{
77c23f
-    int r1 = (cs->kvm_run->s390_sieic.ipa & 0x00f0) >> 4;
77c23f
-    CPUS390XState *env = &S390_CPU(cs)->env;
77c23f
-
77c23f
-    /* Report that we are unable to enter protected mode */
77c23f
-    env->regs[r1 + 1] = DIAG_308_RC_INVAL_FOR_PV;
77c23f
-}
77c23f
-
77c23f
 static void s390_pv_prepare_reset(S390CcwMachineState *ms)
77c23f
 {
77c23f
     CPUState *cs;
77c23f
@@ -485,7 +475,7 @@ static void s390_machine_reset(MachineState *machine)
77c23f
         run_on_cpu(cs, s390_do_cpu_reset, RUN_ON_CPU_NULL);
77c23f
 
77c23f
         if (s390_machine_protect(ms)) {
77c23f
-            s390_machine_inject_pv_error(cs);
77c23f
+            s390_pv_inject_reset_error(cs);
77c23f
             /*
77c23f
              * Continue after the diag308 so the guest knows something
77c23f
              * went wrong.
77c23f
diff --git a/include/hw/s390x/pv.h b/include/hw/s390x/pv.h
77c23f
index c6cb360f2f..522ca6a04e 100644
77c23f
--- a/include/hw/s390x/pv.h
77c23f
+++ b/include/hw/s390x/pv.h
77c23f
@@ -13,6 +13,7 @@
77c23f
 #define HW_S390_PV_H
77c23f
 
77c23f
 #ifdef CONFIG_KVM
77c23f
+#include "cpu.h"
77c23f
 #include "hw/s390x/s390-virtio-ccw.h"
77c23f
 
77c23f
 static inline bool s390_is_pv(void)
77c23f
@@ -41,6 +42,7 @@ int s390_pv_unpack(uint64_t addr, uint64_t size, uint64_t tweak);
77c23f
 void s390_pv_perf_clear_reset(void);
77c23f
 int s390_pv_verify(void);
77c23f
 void s390_pv_unshare(void);
77c23f
+void s390_pv_inject_reset_error(CPUState *cs);
77c23f
 #else /* CONFIG_KVM */
77c23f
 static inline bool s390_is_pv(void) { return false; }
77c23f
 static inline int s390_pv_vm_enable(void) { return 0; }
77c23f
@@ -50,6 +52,7 @@ static inline int s390_pv_unpack(uint64_t addr, uint64_t size, uint64_t tweak) {
77c23f
 static inline void s390_pv_perf_clear_reset(void) {}
77c23f
 static inline int s390_pv_verify(void) { return 0; }
77c23f
 static inline void s390_pv_unshare(void) {}
77c23f
+static inline void s390_pv_inject_reset_error(CPUState *cs) {};
77c23f
 #endif /* CONFIG_KVM */
77c23f
 
77c23f
 #endif /* HW_S390_PV_H */
77c23f
-- 
77c23f
2.27.0
77c23f