|
|
97168e |
From 95c229506a6e7261fce184488e880a94f9ba0789 Mon Sep 17 00:00:00 2001
|
|
|
97168e |
From: Janosch Frank <frankja@linux.ibm.com>
|
|
|
97168e |
Date: Mon, 17 Oct 2022 08:38:21 +0000
|
|
|
97168e |
Subject: [PATCH 40/42] s390x: Add KVM PV dump interface
|
|
|
97168e |
MIME-Version: 1.0
|
|
|
97168e |
Content-Type: text/plain; charset=UTF-8
|
|
|
97168e |
Content-Transfer-Encoding: 8bit
|
|
|
97168e |
|
|
|
97168e |
RH-Author: Cédric Le Goater <clg@redhat.com>
|
|
|
97168e |
RH-MergeRequest: 226: s390: Enhanced Interpretation for PCI Functions and Secure Execution guest dump
|
|
|
97168e |
RH-Bugzilla: 1664378 2043909
|
|
|
97168e |
RH-Acked-by: Thomas Huth <thuth@redhat.com>
|
|
|
97168e |
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
|
|
|
97168e |
RH-Acked-by: Jon Maloy <jmaloy@redhat.com>
|
|
|
97168e |
RH-Commit: [40/41] 5df512a63b2ed17991489565b70f89f4efc0b639
|
|
|
97168e |
|
|
|
97168e |
Let's add a few bits of code which hide the new KVM PV dump API from
|
|
|
97168e |
us via new functions.
|
|
|
97168e |
|
|
|
97168e |
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
|
|
|
97168e |
Reviewed-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
|
|
|
97168e |
Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
|
|
|
97168e |
[ Marc-André: fix up for compilation issue ]
|
|
|
97168e |
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
|
|
|
97168e |
Message-Id: <20221017083822.43118-10-frankja@linux.ibm.com>
|
|
|
97168e |
(cherry picked from commit 753ca06f4706cd6e57750a606afb08c5c5299643)
|
|
|
97168e |
Signed-off-by: Cédric Le Goater <clg@redhat.com>
|
|
|
97168e |
---
|
|
|
97168e |
hw/s390x/pv.c | 51 +++++++++++++++++++++++++++++++++++++++++++
|
|
|
97168e |
include/hw/s390x/pv.h | 9 ++++++++
|
|
|
97168e |
2 files changed, 60 insertions(+)
|
|
|
97168e |
|
|
|
97168e |
diff --git a/hw/s390x/pv.c b/hw/s390x/pv.c
|
|
|
97168e |
index 4c012f2eeb..728ba24547 100644
|
|
|
97168e |
--- a/hw/s390x/pv.c
|
|
|
97168e |
+++ b/hw/s390x/pv.c
|
|
|
97168e |
@@ -175,6 +175,57 @@ bool kvm_s390_pv_info_basic_valid(void)
|
|
|
97168e |
return info_valid;
|
|
|
97168e |
}
|
|
|
97168e |
|
|
|
97168e |
+static int s390_pv_dump_cmd(uint64_t subcmd, uint64_t uaddr, uint64_t gaddr,
|
|
|
97168e |
+ uint64_t len)
|
|
|
97168e |
+{
|
|
|
97168e |
+ struct kvm_s390_pv_dmp dmp = {
|
|
|
97168e |
+ .subcmd = subcmd,
|
|
|
97168e |
+ .buff_addr = uaddr,
|
|
|
97168e |
+ .buff_len = len,
|
|
|
97168e |
+ .gaddr = gaddr,
|
|
|
97168e |
+ };
|
|
|
97168e |
+ int ret;
|
|
|
97168e |
+
|
|
|
97168e |
+ ret = s390_pv_cmd(KVM_PV_DUMP, (void *)&dmp);
|
|
|
97168e |
+ if (ret) {
|
|
|
97168e |
+ error_report("KVM DUMP command %ld failed", subcmd);
|
|
|
97168e |
+ }
|
|
|
97168e |
+ return ret;
|
|
|
97168e |
+}
|
|
|
97168e |
+
|
|
|
97168e |
+int kvm_s390_dump_cpu(S390CPU *cpu, void *buff)
|
|
|
97168e |
+{
|
|
|
97168e |
+ struct kvm_s390_pv_dmp dmp = {
|
|
|
97168e |
+ .subcmd = KVM_PV_DUMP_CPU,
|
|
|
97168e |
+ .buff_addr = (uint64_t)buff,
|
|
|
97168e |
+ .gaddr = 0,
|
|
|
97168e |
+ .buff_len = info_dump.dump_cpu_buffer_len,
|
|
|
97168e |
+ };
|
|
|
97168e |
+ struct kvm_pv_cmd pv = {
|
|
|
97168e |
+ .cmd = KVM_PV_DUMP,
|
|
|
97168e |
+ .data = (uint64_t)&dmp,
|
|
|
97168e |
+ };
|
|
|
97168e |
+
|
|
|
97168e |
+ return kvm_vcpu_ioctl(CPU(cpu), KVM_S390_PV_CPU_COMMAND, &pv;;
|
|
|
97168e |
+}
|
|
|
97168e |
+
|
|
|
97168e |
+int kvm_s390_dump_init(void)
|
|
|
97168e |
+{
|
|
|
97168e |
+ return s390_pv_dump_cmd(KVM_PV_DUMP_INIT, 0, 0, 0);
|
|
|
97168e |
+}
|
|
|
97168e |
+
|
|
|
97168e |
+int kvm_s390_dump_mem_state(uint64_t gaddr, size_t len, void *dest)
|
|
|
97168e |
+{
|
|
|
97168e |
+ return s390_pv_dump_cmd(KVM_PV_DUMP_CONFIG_STOR_STATE, (uint64_t)dest,
|
|
|
97168e |
+ gaddr, len);
|
|
|
97168e |
+}
|
|
|
97168e |
+
|
|
|
97168e |
+int kvm_s390_dump_completion_data(void *buff)
|
|
|
97168e |
+{
|
|
|
97168e |
+ return s390_pv_dump_cmd(KVM_PV_DUMP_COMPLETE, (uint64_t)buff, 0,
|
|
|
97168e |
+ info_dump.dump_config_finalize_len);
|
|
|
97168e |
+}
|
|
|
97168e |
+
|
|
|
97168e |
#define TYPE_S390_PV_GUEST "s390-pv-guest"
|
|
|
97168e |
OBJECT_DECLARE_SIMPLE_TYPE(S390PVGuest, S390_PV_GUEST)
|
|
|
97168e |
|
|
|
97168e |
diff --git a/include/hw/s390x/pv.h b/include/hw/s390x/pv.h
|
|
|
97168e |
index e5ea0eca16..9360aa1091 100644
|
|
|
97168e |
--- a/include/hw/s390x/pv.h
|
|
|
97168e |
+++ b/include/hw/s390x/pv.h
|
|
|
97168e |
@@ -51,6 +51,10 @@ uint64_t kvm_s390_pv_dmp_get_size_cpu(void);
|
|
|
97168e |
uint64_t kvm_s390_pv_dmp_get_size_mem_state(void);
|
|
|
97168e |
uint64_t kvm_s390_pv_dmp_get_size_completion_data(void);
|
|
|
97168e |
bool kvm_s390_pv_info_basic_valid(void);
|
|
|
97168e |
+int kvm_s390_dump_init(void);
|
|
|
97168e |
+int kvm_s390_dump_cpu(S390CPU *cpu, void *buff);
|
|
|
97168e |
+int kvm_s390_dump_mem_state(uint64_t addr, size_t len, void *dest);
|
|
|
97168e |
+int kvm_s390_dump_completion_data(void *buff);
|
|
|
97168e |
#else /* CONFIG_KVM */
|
|
|
97168e |
static inline bool s390_is_pv(void) { return false; }
|
|
|
97168e |
static inline int s390_pv_query_info(void) { return 0; }
|
|
|
97168e |
@@ -66,6 +70,11 @@ static inline uint64_t kvm_s390_pv_dmp_get_size_cpu(void) { return 0; }
|
|
|
97168e |
static inline uint64_t kvm_s390_pv_dmp_get_size_mem_state(void) { return 0; }
|
|
|
97168e |
static inline uint64_t kvm_s390_pv_dmp_get_size_completion_data(void) { return 0; }
|
|
|
97168e |
static inline bool kvm_s390_pv_info_basic_valid(void) { return false; }
|
|
|
97168e |
+static inline int kvm_s390_dump_init(void) { return 0; }
|
|
|
97168e |
+static inline int kvm_s390_dump_cpu(S390CPU *cpu, void *buff) { return 0; }
|
|
|
97168e |
+static inline int kvm_s390_dump_mem_state(uint64_t addr, size_t len,
|
|
|
97168e |
+ void *dest) { return 0; }
|
|
|
97168e |
+static inline int kvm_s390_dump_completion_data(void *buff) { return 0; }
|
|
|
97168e |
#endif /* CONFIG_KVM */
|
|
|
97168e |
|
|
|
97168e |
int s390_pv_kvm_init(ConfidentialGuestSupport *cgs, Error **errp);
|
|
|
97168e |
--
|
|
|
97168e |
2.37.3
|
|
|
97168e |
|