Skip to content

Commit 4210459

Browse files
Tony Krowiakborntraeger
authored andcommitted
KVM: s390: interface to clear CRYCB masks
Introduces a new KVM function to clear the APCB0 and APCB1 in the guest's CRYCB. This effectively clears all bits of the APM, AQM and ADM masks configured for the guest. The VCPUs are taken out of SIE to ensure the VCPUs do not get out of sync. Signed-off-by: Tony Krowiak <[email protected]> Acked-by: Halil Pasic <[email protected]> Tested-by: Michael Mueller <[email protected]> Tested-by: Farhan Ali <[email protected]> Tested-by: Pierre Morel <[email protected]> Reviewed-by: Cornelia Huck <[email protected]> Message-Id: <[email protected]> Signed-off-by: Christian Borntraeger <[email protected]>
1 parent 81b2b4b commit 4210459

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

arch/s390/include/asm/kvm_host.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -859,6 +859,8 @@ void kvm_arch_async_page_not_present(struct kvm_vcpu *vcpu,
859859
void kvm_arch_async_page_present(struct kvm_vcpu *vcpu,
860860
struct kvm_async_pf *work);
861861

862+
void kvm_arch_crypto_clear_masks(struct kvm *kvm);
863+
862864
extern int sie64a(struct kvm_s390_sie_block *, u64 *);
863865
extern char sie_exit;
864866

arch/s390/kvm/kvm-s390.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2033,6 +2033,21 @@ static void kvm_s390_set_crycb_format(struct kvm *kvm)
20332033
kvm->arch.crypto.crycbd |= CRYCB_FORMAT1;
20342034
}
20352035

2036+
void kvm_arch_crypto_clear_masks(struct kvm *kvm)
2037+
{
2038+
mutex_lock(&kvm->lock);
2039+
kvm_s390_vcpu_block_all(kvm);
2040+
2041+
memset(&kvm->arch.crypto.crycb->apcb0, 0,
2042+
sizeof(kvm->arch.crypto.crycb->apcb0));
2043+
memset(&kvm->arch.crypto.crycb->apcb1, 0,
2044+
sizeof(kvm->arch.crypto.crycb->apcb1));
2045+
2046+
kvm_s390_vcpu_unblock_all(kvm);
2047+
mutex_unlock(&kvm->lock);
2048+
}
2049+
EXPORT_SYMBOL_GPL(kvm_arch_crypto_clear_masks);
2050+
20362051
static u64 kvm_s390_get_initial_cpuid(void)
20372052
{
20382053
struct cpuid cpuid;

0 commit comments

Comments
 (0)