Re: [PATCH v7 01/15] s390/vfio-ap: Provide function to get the number of queues assigned to mdev
"Jason J. Herne" <[email protected]>
| Newsgroups | org.kernel.vger.linux-s390,org.kernel.vger.kvm,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
On 8/7/26 6:18 PM, Anthony Krowiak wrote: > Provides a function that returns the number of queues that are or will be > passed through to a guest when the mdev is attached to a guest. > > Signed-off-by: Anthony Krowiak <[email protected]> > --- > drivers/s390/crypto/vfio_ap_ops.c | 8 ++++++++ > drivers/s390/crypto/vfio_ap_private.h | 2 ++ > 2 files changed, 10 insertions(+) > > diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c > index 44b3a1dcc1b3..36786d70a88f 100644 > --- a/drivers/s390/crypto/vfio_ap_ops.c > +++ b/drivers/s390/crypto/vfio_ap_ops.c > @@ -2098,6 +2098,14 @@ static void vfio_ap_mdev_request(struct vfio_device *vdev, unsigned int count) > release_update_locks_for_mdev(matrix_mdev); > } > > +int vfio_ap_mdev_get_num_queues(struct ap_matrix *ap_matrix) > +{ > + lockdep_assert_held(&matrix_dev->mdevs_lock); > + > + return bitmap_weight(ap_matrix->apm, AP_DEVICES) * > + bitmap_weight(ap_matrix->aqm, AP_DOMAINS); > +} > + static inline unsigned int bitmap_weight(const unsigned long *src, unsigned int nbits) bitmap_weight returns an unsigned int. I think vfio_ap_mdev_get_num_queues should probably return an unsigned int too, for maximum typw safety? Other than that: Reviewed-by: Jason J. Herne <[email protected]>