From 4ab729207fe1464b19c6bec609cd545ab717174a Mon Sep 17 00:00:00 2001 From: David Hildenbrand Date: Wed, 30 Sep 2015 13:48:45 +0200 Subject: s390x: reset crypto only on clear reset and QEMU reset Initializing VM crypto in initial cpu reset has multiple problems 1. We call the exact same function #VCPU times, although one time is enough 2. On SIGP initial cpu reset, we exchange the wrapping key while other VCPUs are running. Bad! 3. It is simply wrong. According to the Pop, a reset happens only during a clear reset. So, we have to reset the keys - on modified clear reset - on load clear (QEMU reset - via machine reset) - on qemu start (via machine reset) Reviewed-by: Christian Borntraeger Signed-off-by: David Hildenbrand Signed-off-by: Cornelia Huck --- target-s390x/kvm.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'target-s390x/kvm.c') diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c index 6e488d4420..84dffe9067 100644 --- a/target-s390x/kvm.c +++ b/target-s390x/kvm.c @@ -249,7 +249,7 @@ static void kvm_s390_init_dea_kw(void) } } -static void kvm_s390_init_crypto(void) +void kvm_s390_crypto_reset(void) { kvm_s390_init_aes_kw(); kvm_s390_init_dea_kw(); @@ -301,8 +301,6 @@ void kvm_s390_reset_vcpu(S390CPU *cpu) if (kvm_vcpu_ioctl(cs, KVM_S390_INITIAL_RESET, NULL)) { error_report("Initial CPU reset failed on CPU %i", cs->cpu_index); } - - kvm_s390_init_crypto(); } static int can_sync_regs(CPUState *cs, int regs) -- cgit v1.2.3