Am 23.09.26 um 10:33 schrieb Janosch Frank:
People doing VM management requested a way to query if a VM is in PV
or not. This of course does never replace attestation, it's merely
QEMU's view of the situation.
Maybe make it more obvious that this is really about the runtime property
(has the guest switched into secure and yet yet switched back via reboot).
Same for set_description, maybe something like "true while the guest runs
in protected virtualization mode (read-only)", plus one line in
docs/system/s390x/protvirt.rst. The docs line matters because read-only
properties don't appear in -M s390-ccw-virtio,help
In any case
Reviewed-by: Christian Borntraeger <[email protected]>
Signed-off-by: Janosch Frank <[email protected]>
CC: Hendrik Brueckner <[email protected]>
---
hw/s390x/s390-virtio-ccw.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index 7fb78d8fa1..42ecfa59f3 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -838,6 +838,13 @@ static inline void machine_set_secure_boot(Object *obj,
bool value,
ms->secure_boot = value;
}
+static inline bool machine_get_pv(Object *obj, Error **errp)
+{
+ S390CcwMachineState *ms = S390_CCW_MACHINE(obj);
+
+ return ms->pv;
+}
+
/*
* S390x-specific global compatibility properties.
*
@@ -919,6 +926,12 @@ static void ccw_machine_class_init(ObjectClass *oc, const
void *data)
machine_set_secure_boot);
object_class_property_set_description(oc, "secure-boot",
"enable/disable secure boot");
+
+ object_class_property_add_bool(oc, "pv",
+ machine_get_pv,
+ NULL);
+ object_class_property_set_description(oc, "pv",
+ "protected virtualization state (read-only)");
}
static inline void s390_machine_initfn(Object *obj)