diff mbox series

[v1,1/3] target/s390x: Introduce constant when checking if PV header couldn't be decrypted

Message ID 20250411092233.418164-2-ggala@linux.ibm.com (mailing list archive)
State New
Headers show
Series target/s390x - DIAG 308 extend subcode 10 to return UVC cmd id, RC and RRC values upon failure to enter secure mode | expand

Commit Message

Gautam Gala April 11, 2025, 9:22 a.m. UTC
Introduce a named constant when checking the Set Secure Configuration parameters
UV call return code for the case where no valid host key was found and therefore
the PV header couldn't be decrypted (0x108).

Signed-off-by: Gautam Gala <ggala@linux.ibm.com>
---
 target/s390x/kvm/pv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Steffen Eiden April 14, 2025, 1:34 p.m. UTC | #1
On Fri, Apr 11, 2025 at 11:22:31AM +0200, Gautam Gala wrote:
> Introduce a named constant when checking the Set Secure Configuration parameters
> UV call return code for the case where no valid host key was found and therefore
> the PV header couldn't be decrypted (0x108).
> 
> Signed-off-by: Gautam Gala <ggala@linux.ibm.com>

Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
diff mbox series

Patch

diff --git a/target/s390x/kvm/pv.c b/target/s390x/kvm/pv.c
index b191a4a68a..3a0a971f0b 100644
--- a/target/s390x/kvm/pv.c
+++ b/target/s390x/kvm/pv.c
@@ -147,6 +147,7 @@  bool s390_pv_vm_try_disable_async(S390CcwMachineState *ms)
     return true;
 }
 
+#define DIAG_308_UV_RC_INVAL_HOSTKEY    0x0108
 int s390_pv_set_sec_parms(uint64_t origin, uint64_t length, Error **errp)
 {
     int ret, pvrc;
@@ -158,7 +159,7 @@  int s390_pv_set_sec_parms(uint64_t origin, uint64_t length, Error **errp)
     ret = s390_pv_cmd_pvrc(KVM_PV_SET_SEC_PARMS, &args, &pvrc);
     if (ret) {
         error_setg(errp, "Failed to set secure execution parameters");
-        if (pvrc == 0x108) {
+        if (pvrc == DIAG_308_UV_RC_INVAL_HOSTKEY) {
             error_append_hint(errp, "Please check whether the image is "
                                     "correctly encrypted for this host\n");
         }