All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] s390x: Expose pv attribute in QOM
@ 2026-09-24 14:27 Janosch Frank
  2026-09-24 15:19 ` Hendrik Brueckner
  2026-09-25 12:42 ` Eric Farman
  0 siblings, 2 replies; 3+ messages in thread
From: Janosch Frank @ 2026-09-24 14:27 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-s390x, brueckner, borntraeger, cohuck, farman, david, iii,
	richard.henderson

People doing VM management requested a way to query if a VM is in PV
or not. So this patch exposes the runtime PV attribute which is true
once the VM successfully made the switch into PV mode (according to
KVM) and did not yet reboot to drop out of it.

This of course does never replace attestation, it's merely QEMU's view
of the situation.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
CC: Hendrik Brueckner <brueckner@linux.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Reviewed-by: Eric Farman <farman@linux.ibm.com>
Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
---

v3: Spelling fixes...

---
 docs/system/s390x/protvirt.rst | 11 +++++++++++
 hw/s390x/s390-virtio-ccw.c     | 13 +++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/docs/system/s390x/protvirt.rst b/docs/system/s390x/protvirt.rst
index aee63ed7ec..7e6c6e10f4 100644
--- a/docs/system/s390x/protvirt.rst
+++ b/docs/system/s390x/protvirt.rst
@@ -65,3 +65,14 @@ metadata. In case this boot method is used, the command line
 options -initrd and -cmdline are ineffective. The preparation of a PVM
 image is done via the ``genprotimg`` tool from the s390-tools
 collection.
+
+
+PV property
+-----------
+
+The s390x-ccw machine exposes the read-only runtime "pv"
+property. This property is true if a guest successfully made the
+transition into PV mode as reported by KVM and hasn't yet exited PV
+mode via a reboot. This does not replace PV attestation which is the
+only authoritative way to get a definitive answer if a guest is truly
+protected.
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index 7fb78d8fa1..9e2db872fb 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",
+            "true while the guest runs in protected virtualization mode (read-only)");
 }
 
 static inline void s390_machine_initfn(Object *obj)
-- 
2.53.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v3] s390x: Expose pv attribute in QOM
  2026-09-24 14:27 [PATCH v3] s390x: Expose pv attribute in QOM Janosch Frank
@ 2026-09-24 15:19 ` Hendrik Brueckner
  2026-09-25 12:42 ` Eric Farman
  1 sibling, 0 replies; 3+ messages in thread
From: Hendrik Brueckner @ 2026-09-24 15:19 UTC (permalink / raw)
  To: Janosch Frank
  Cc: qemu-devel, qemu-s390x, brueckner, borntraeger, cohuck, farman,
	david, iii, richard.henderson

On Thu, Sep 24, 2026 at 02:27:22PM +0000, Janosch Frank wrote:
> People doing VM management requested a way to query if a VM is in PV
> or not. So this patch exposes the runtime PV attribute which is true
> once the VM successfully made the switch into PV mode (according to
> KVM) and did not yet reboot to drop out of it.
> 
> This of course does never replace attestation, it's merely QEMU's view
> of the situation.
> 
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> CC: Hendrik Brueckner <brueckner@linux.ibm.com>
> Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
> Reviewed-by: Eric Farman <farman@linux.ibm.com>
> Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
> ---

Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v3] s390x: Expose pv attribute in QOM
  2026-09-24 14:27 [PATCH v3] s390x: Expose pv attribute in QOM Janosch Frank
  2026-09-24 15:19 ` Hendrik Brueckner
@ 2026-09-25 12:42 ` Eric Farman
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Farman @ 2026-09-25 12:42 UTC (permalink / raw)
  To: Janosch Frank, qemu-devel
  Cc: qemu-s390x, brueckner, borntraeger, cohuck, david, iii,
	richard.henderson



On 9/24/26 10:27 AM, Janosch Frank wrote:
> People doing VM management requested a way to query if a VM is in PV
> or not. So this patch exposes the runtime PV attribute which is true
> once the VM successfully made the switch into PV mode (according to
> KVM) and did not yet reboot to drop out of it.
> 
> This of course does never replace attestation, it's merely QEMU's view
> of the situation.
> 
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> CC: Hendrik Brueckner <brueckner@linux.ibm.com>
> Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
> Reviewed-by: Eric Farman <farman@linux.ibm.com>
> Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>

Applied for 11.2; thank you!


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-09-25 12:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-24 14:27 [PATCH v3] s390x: Expose pv attribute in QOM Janosch Frank
2026-09-24 15:19 ` Hendrik Brueckner
2026-09-25 12:42 ` Eric Farman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.