From: Rorie Reyes <rreyes@linux.ibm.com>
To: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org,
kvm@vger.kernel.org
Cc: hca@linux.ibm.com, borntraeger@de.ibm.com,
agordeev@linux.ibm.com, gor@linux.ibm.com, pasic@linux.ibm.com,
jjherne@linux.ibm.com, alex.williamson@redhat.com,
akrowiak@linux.ibm.com, rreyes@linux.ibm.com
Subject: [RFC PATCH v3 2/2] s390/vfio-ap: Adding mdev remove notification
Date: Wed, 26 Feb 2025 13:06:05 -0500 [thread overview]
Message-ID: <20250226180605.15810-3-rreyes@linux.ibm.com> (raw)
In-Reply-To: <20250226180605.15810-1-rreyes@linux.ibm.com>
This patch is based on the s390/features branch.
The first patch, b26ed71f9647, was missing a
notification based on the process to remove a
mediated device from the AP configuration. In
the original patch, b26ed71f9647, the guest is
notified immediately for any AP configuration
changes that are queued during the following
processes:
- assign/unassign_adapter
- assign/unassign_domain
- bind/unbind
However, the original patch, b26ed71f9647, was
missing a notification for the process to remove
the entire mediated device.
This patch addresses the missing notification and
successfully notifies the guest when a mediated device
is removed.
Notes:
- Removed eventfd from vfio_ap_mdev_unset_kvm
- Update and release locks along with the eventfd added
to vfio_ap_mdev_request
Signed-off-by: Rorie Reyes <rreyes@linux.ibm.com>
---
drivers/s390/crypto/vfio_ap_ops.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c
index 9a6845064ff3..e0237ea27d7e 100644
--- a/drivers/s390/crypto/vfio_ap_ops.c
+++ b/drivers/s390/crypto/vfio_ap_ops.c
@@ -2056,6 +2056,14 @@ static void vfio_ap_mdev_request(struct vfio_device *vdev, unsigned int count)
matrix_mdev = container_of(vdev, struct ap_matrix_mdev, vdev);
+ if (matrix_mdev->kvm) {
+ get_update_locks_for_kvm(matrix_mdev->kvm);
+ kvm_arch_crypto_clear_masks(matrix_mdev->kvm);
+ signal_guest_ap_cfg_changed(matrix_mdev);
+ } else {
+ mutex_lock(&matrix_dev->mdevs_lock);
+ }
+
if (matrix_mdev->req_trigger) {
if (!(count % 10))
dev_notice_ratelimited(dev,
@@ -2067,6 +2075,12 @@ static void vfio_ap_mdev_request(struct vfio_device *vdev, unsigned int count)
dev_notice(dev,
"No device request registered, blocked until released by user\n");
}
+
+ if (matrix_mdev->kvm)
+ release_update_locks_for_kvm(matrix_mdev->kvm);
+ else
+ mutex_unlock(&matrix_dev->mdevs_lock);
+
}
static int vfio_ap_mdev_get_device_info(unsigned long arg)
--
2.48.1
prev parent reply other threads:[~2025-02-26 18:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-26 18:06 [RFC PATCH v3 0/2] Eventfd signal on guest AP configuration change Rorie Reyes
2025-02-26 18:06 ` [RFC PATCH v3 1/2] s390/vfio-ap: Signal eventfd when guest AP configuration is changed Rorie Reyes
2025-02-26 18:06 ` Rorie Reyes [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250226180605.15810-3-rreyes@linux.ibm.com \
--to=rreyes@linux.ibm.com \
--cc=agordeev@linux.ibm.com \
--cc=akrowiak@linux.ibm.com \
--cc=alex.williamson@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=jjherne@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=pasic@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox