s390/vfio-ap: r/w lock for PQAP interception handler function pointer
authorTony Krowiak <akrowiak@linux.ibm.com>
Mon, 23 Aug 2021 21:20:46 +0000 (17:20 -0400)
committerAlex Williamson <alex.williamson@redhat.com>
Tue, 24 Aug 2021 18:14:05 +0000 (12:14 -0600)
commit1e753732bda6dcf888ea0b90b2a91ac1c1a0bae9
treefe3e3ceaddddd778884646e03eca0ec224f5ee6c
parenteb24c1007e6852e024dc33b0dd9617b8500a1291
s390/vfio-ap: r/w lock for PQAP interception handler function pointer

The function pointer to the interception handler for the PQAP instruction
can get changed during the interception process. Let's add a
semaphore to struct kvm_s390_crypto to control read/write access to the
function pointer contained therein.

The semaphore must be locked for write access by the vfio_ap device driver
when notified that the KVM pointer has been set or cleared. It must be
locked for read access by the interception framework when the PQAP
instruction is intercepted.

Signed-off-by: Tony Krowiak <akrowiak@linux.ibm.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Link: https://lore.kernel.org/r/20210823212047.1476436-2-akrowiak@linux.ibm.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
arch/s390/include/asm/kvm_host.h
arch/s390/kvm/kvm-s390.c
arch/s390/kvm/priv.c
drivers/s390/crypto/vfio_ap_ops.c
drivers/s390/crypto/vfio_ap_private.h