diff mbox

[PULL,32/38] s390x/kvm: don't enable key wrapping if msa3 is disabled

Message ID 20160906074710.13495-33-cornelia.huck@de.ibm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Cornelia Huck Sept. 6, 2016, 7:47 a.m. UTC
From: David Hildenbrand <dahi@linux.vnet.ibm.com>

As the CPU model now controls msa3, trying to set wrapping keys without
msa3 being around/enable in the kernel will produce misleading errors.

So let's simply not configure key wrapping if msa3 is not enabled and
make compat machines with disabled CPU model work correctly.

Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Message-Id: <20160905085244.99980-25-dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
 target-s390x/cpu_models.c | 3 +++
 target-s390x/kvm.c        | 6 ++++--
 2 files changed, 7 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/target-s390x/cpu_models.c b/target-s390x/cpu_models.c
index 2cb5fd2..32431cb 100644
--- a/target-s390x/cpu_models.c
+++ b/target-s390x/cpu_models.c
@@ -155,6 +155,9 @@  bool s390_has_feat(S390Feat feat)
             if (feat == S390_FEAT_RUNTIME_INSTRUMENTATION) {
                 return kvm_s390_get_ri();
             }
+            if (feat == S390_FEAT_MSA_EXT_3) {
+                return true;
+            }
         }
 #endif
         return 0;
diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c
index 82a07ae..dfaf1ca 100644
--- a/target-s390x/kvm.c
+++ b/target-s390x/kvm.c
@@ -260,8 +260,10 @@  static void kvm_s390_init_dea_kw(void)
 
 void kvm_s390_crypto_reset(void)
 {
-    kvm_s390_init_aes_kw();
-    kvm_s390_init_dea_kw();
+    if (s390_has_feat(S390_FEAT_MSA_EXT_3)) {
+        kvm_s390_init_aes_kw();
+        kvm_s390_init_dea_kw();
+    }
 }
 
 int kvm_arch_init(MachineState *ms, KVMState *s)