From: Janosch Frank <frankja@linux.ibm.com>
To: qemu-devel@nongnu.org
Cc: marcandre.lureau@redhat.com, pbonzini@redhat.com,
mhartmay@linux.ibm.com, borntraeger@linux.ibm.com,
imbrenda@linux.ibm.com, pasic@linux.ibm.com, cohuck@redhat.com,
thuth@redhat.com, qemu-s390x@nongnu.org, seiden@linux.ibm.com,
scgl@linux.ibm.com
Subject: [PATCH v6 09/10] s390x: Add KVM PV dump interface
Date: Mon, 17 Oct 2022 08:38:21 +0000 [thread overview]
Message-ID: <20221017083822.43118-10-frankja@linux.ibm.com> (raw)
In-Reply-To: <20221017083822.43118-1-frankja@linux.ibm.com>
Let's add a few bits of code which hide the new KVM PV dump API from
us via new functions.
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
---
hw/s390x/pv.c | 51 +++++++++++++++++++++++++++++++++++++++++++
include/hw/s390x/pv.h | 9 ++++++++
2 files changed, 60 insertions(+)
diff --git a/hw/s390x/pv.c b/hw/s390x/pv.c
index 4c012f2eeb..728ba24547 100644
--- a/hw/s390x/pv.c
+++ b/hw/s390x/pv.c
@@ -175,6 +175,57 @@ bool kvm_s390_pv_info_basic_valid(void)
return info_valid;
}
+static int s390_pv_dump_cmd(uint64_t subcmd, uint64_t uaddr, uint64_t gaddr,
+ uint64_t len)
+{
+ struct kvm_s390_pv_dmp dmp = {
+ .subcmd = subcmd,
+ .buff_addr = uaddr,
+ .buff_len = len,
+ .gaddr = gaddr,
+ };
+ int ret;
+
+ ret = s390_pv_cmd(KVM_PV_DUMP, (void *)&dmp);
+ if (ret) {
+ error_report("KVM DUMP command %ld failed", subcmd);
+ }
+ return ret;
+}
+
+int kvm_s390_dump_cpu(S390CPU *cpu, void *buff)
+{
+ struct kvm_s390_pv_dmp dmp = {
+ .subcmd = KVM_PV_DUMP_CPU,
+ .buff_addr = (uint64_t)buff,
+ .gaddr = 0,
+ .buff_len = info_dump.dump_cpu_buffer_len,
+ };
+ struct kvm_pv_cmd pv = {
+ .cmd = KVM_PV_DUMP,
+ .data = (uint64_t)&dmp,
+ };
+
+ return kvm_vcpu_ioctl(CPU(cpu), KVM_S390_PV_CPU_COMMAND, &pv);
+}
+
+int kvm_s390_dump_init(void)
+{
+ return s390_pv_dump_cmd(KVM_PV_DUMP_INIT, 0, 0, 0);
+}
+
+int kvm_s390_dump_mem_state(uint64_t gaddr, size_t len, void *dest)
+{
+ return s390_pv_dump_cmd(KVM_PV_DUMP_CONFIG_STOR_STATE, (uint64_t)dest,
+ gaddr, len);
+}
+
+int kvm_s390_dump_completion_data(void *buff)
+{
+ return s390_pv_dump_cmd(KVM_PV_DUMP_COMPLETE, (uint64_t)buff, 0,
+ info_dump.dump_config_finalize_len);
+}
+
#define TYPE_S390_PV_GUEST "s390-pv-guest"
OBJECT_DECLARE_SIMPLE_TYPE(S390PVGuest, S390_PV_GUEST)
diff --git a/include/hw/s390x/pv.h b/include/hw/s390x/pv.h
index e5ea0eca16..3164006674 100644
--- a/include/hw/s390x/pv.h
+++ b/include/hw/s390x/pv.h
@@ -51,6 +51,10 @@ uint64_t kvm_s390_pv_dmp_get_size_cpu(void);
uint64_t kvm_s390_pv_dmp_get_size_mem_state(void);
uint64_t kvm_s390_pv_dmp_get_size_completion_data(void);
bool kvm_s390_pv_info_basic_valid(void);
+int kvm_s390_dump_init(void);
+int kvm_s390_dump_cpu(S390CPU *cpu, void *buff);
+int kvm_s390_dump_mem_state(uint64_t addr, size_t len, void *dest);
+int kvm_s390_dump_completion_data(void *buff);
#else /* CONFIG_KVM */
static inline bool s390_is_pv(void) { return false; }
static inline int s390_pv_query_info(void) { return 0; }
@@ -66,6 +70,11 @@ static inline uint64_t kvm_s390_pv_dmp_get_size_cpu(void) { return 0; }
static inline uint64_t kvm_s390_pv_dmp_get_size_mem_state(void) { return 0; }
static inline uint64_t kvm_s390_pv_dmp_get_size_completion_data(void) { return 0; }
static inline bool kvm_s390_pv_info_basic_valid(void) { return false; }
+static inline int kvm_s390_dump_init(void) { return 0; }
+static inline int kvm_s390_dump_cpu(S390CPU *cpu, void *buff, size_t len) { return 0; }
+static inline int kvm_s390_dump_mem_state(uint64_t addr, size_t len,
+ void *dest) { return 0; }
+static inline int kvm_s390_dump_completion_data(void *buff) { return 0; }
#endif /* CONFIG_KVM */
int s390_pv_kvm_init(ConfidentialGuestSupport *cgs, Error **errp);
--
2.34.1
next prev parent reply other threads:[~2022-10-17 8:53 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-17 8:38 [PATCH v6 00/10] dump: Add arch section and s390x PV dump Janosch Frank
2022-10-17 8:38 ` [PATCH v6 01/10] dump: Use a buffer for ELF section data and headers Janosch Frank
2022-10-17 9:45 ` Marc-André Lureau
2022-10-17 8:38 ` [PATCH v6 02/10] dump: Write ELF section headers right after ELF header Janosch Frank
2022-10-17 9:45 ` Marc-André Lureau
2022-10-17 12:49 ` Marc Hartmayer
2022-10-17 13:59 ` Janosch Frank
2022-10-17 17:12 ` Marc Hartmayer
2022-10-17 8:38 ` [PATCH v6 03/10] dump: Reorder struct DumpState Janosch Frank
2022-10-17 8:38 ` [PATCH v6 04/10] dump: Reintroduce memory_offset and section_offset Janosch Frank
2022-10-17 9:45 ` Marc-André Lureau
2022-10-17 8:38 ` [PATCH v6 05/10] dump: Add architecture section and section string table support Janosch Frank
2022-10-17 9:45 ` Marc-André Lureau
2022-10-17 11:32 ` [PATCH v7] " Janosch Frank
2022-10-17 8:38 ` [PATCH v6 06/10] s390x: Add protected dump cap Janosch Frank
2022-10-17 8:38 ` [PATCH v6 07/10] s390x: Introduce PV query interface Janosch Frank
2022-10-17 8:38 ` [PATCH v6 08/10] RFC: elf.h changes Janosch Frank
2022-10-21 12:28 ` Thomas Huth
2022-10-17 8:38 ` Janosch Frank [this message]
2022-10-20 11:03 ` [PATCH v6 09/10] s390x: Add KVM PV dump interface Steffen Eiden
2022-10-24 18:36 ` Marc-André Lureau
2022-10-25 7:27 ` Janosch Frank
2022-10-17 8:38 ` [PATCH v6 10/10] s390x: pv: Add dump support Janosch Frank
2022-10-20 11:03 ` Steffen Eiden
2022-10-21 12:31 ` [PATCH v6 00/10] dump: Add arch section and s390x PV dump Thomas Huth
2022-10-21 12:48 ` Marc-André Lureau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221017083822.43118-10-frankja@linux.ibm.com \
--to=frankja@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=cohuck@redhat.com \
--cc=imbrenda@linux.ibm.com \
--cc=marcandre.lureau@redhat.com \
--cc=mhartmay@linux.ibm.com \
--cc=pasic@linux.ibm.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=scgl@linux.ibm.com \
--cc=seiden@linux.ibm.com \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).