On Thu, 2022-08-11 at 12:11 +0000, Janosch Frank wrote: > Introduce an interface over which we can get information about UV data. > > Signed-off-by: Janosch Frank <fran...@linux.ibm.com> > Reviewed-by: Steffen Eiden <sei...@linux.ibm.com>
With the below fixed: Reviewed-by: Janis Schoetterl-Glausch <s...@linux.ibm.com> > --- > hw/s390x/pv.c | 61 ++++++++++++++++++++++++++++++++++++++ > hw/s390x/s390-virtio-ccw.c | 6 ++++ > include/hw/s390x/pv.h | 10 +++++++ > 3 files changed, 77 insertions(+) > > diff --git a/hw/s390x/pv.c b/hw/s390x/pv.c > index 401b63d6cb..2b892b45e8 100644 > --- a/hw/s390x/pv.c > +++ b/hw/s390x/pv.c > @@ -20,6 +20,11 @@ > #include "exec/confidential-guest-support.h" > #include "hw/s390x/ipl.h" > #include "hw/s390x/pv.h" > +#include "target/s390x/kvm/kvm_s390x.h" > + > +static bool info_valid; > +static struct kvm_s390_pv_info_vm info_vm; > +static struct kvm_s390_pv_info_dump info_dump; > > static int __s390_pv_cmd(uint32_t cmd, const char *cmdname, void *data) > { > @@ -56,6 +61,42 @@ static int __s390_pv_cmd(uint32_t cmd, const char > *cmdname, void *data) > } \ > } > > +int s390_pv_query_info(void) > +{ > + struct kvm_s390_pv_info info = { > + .header.id = KVM_PV_INFO_VM, > + .header.len_max = sizeof(info.header) + sizeof(info.vm), > + }; > + int rc; > + > + /* Info API's first user is dump so they are bundled */ > + if (!kvm_s390_get_protected_dump()) { > + return 0; > + } > + > + rc = s390_pv_cmd(KVM_PV_INFO, &info); > + if (rc) { > + error_report("KVM PV INFO cmd %x failed: %s", > + info.header.id, strerror(rc)); Should be strerror(-rc). > + return rc; > + } > + memcpy(&info_vm, &info.vm, sizeof(info.vm)); > + > + info.header.id = KVM_PV_INFO_DUMP; > + info.header.len_max = sizeof(info.header) + sizeof(info.dump); > + rc = s390_pv_cmd(KVM_PV_INFO, &info); > + if (rc) { > + error_report("KVM PV INFO cmd %x failed: %s", > + info.header.id, strerror(rc)); Same here. > + return rc; > + } > + > + memcpy(&info_dump, &info.dump, sizeof(info.dump)); > + info_valid = true; > + > + return rc; > +} > + > [...]