]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commitdb4cf7ac7cf97ff77da7f62be02da3fb47ddf6f5
treefe3e3ceaddddd778884646e03eca0ec224f5ee6c
parent10cf8bf616a12341f45bbe369af9f3265c48eaab
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