From: Christoph Hellwig <hch@lst.de>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: Tony Krowiak <akrowiak@linux.ibm.com>,
Christian Borntraeger <borntraeger@de.ibm.com>,
Harald Freudenberger <freude@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
Heiko Carstens <hca@linux.ibm.com>,
Jason Herne <jjherne@linux.ibm.com>,
linux-s390@vger.kernel.org, Halil Pasic <pasic@linux.ibm.com>,
Alex Williamson <alex.williamson@redhat.com>,
Cornelia Huck <cohuck@redhat.com>, Christoph Hellwig <hch@lst.de>,
kvm@vger.kernel.org
Subject: Re: [PATCH v3] vfio/ap_ops: Convert to use vfio_register_group_dev()
Date: Tue, 10 Aug 2021 10:33:55 +0200 [thread overview]
Message-ID: <20210810083355.GB21036@lst.de> (raw)
In-Reply-To: <0-v3-9f48485c5e22+3cb9-vfio_ap_jgg@nvidia.com>
On Fri, Aug 06, 2021 at 04:51:15PM -0300, Jason Gunthorpe wrote:
> This is straightforward conversion, the ap_matrix_mdev is actually serving as
> the vfio_device and we can replace all the mdev_get_drvdata()'s with a
> simple container_of() or a dev_get_drvdata() for sysfs paths.
>
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> ---
> drivers/s390/crypto/vfio_ap_ops.c | 155 +++++++++++++++-----------
> drivers/s390/crypto/vfio_ap_private.h | 2 +
> 2 files changed, 91 insertions(+), 66 deletions(-)
>
> Alex,
>
> This is after the reflck series and should thus go to the vfio tree. Thanks
>
> v3:
> - Rebase ontop of the reflk patch series
> - Remove module get/put
> - Update commit message
> v2: https://lore.kernel.org/linux-s390/6-v2-7667f42c9bad+935-vfio3_jgg@nvidia.com/
> v1: https://lore.kernel.org/linux-s390/6-v1-d88406ed308e+418-vfio3_jgg@nvidia.com/
>
> diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c
> index cee5626fe0a4ef..0828c188babedf 100644
> --- a/drivers/s390/crypto/vfio_ap_ops.c
> +++ b/drivers/s390/crypto/vfio_ap_ops.c
> @@ -24,8 +24,9 @@
> #define VFIO_AP_MDEV_TYPE_HWVIRT "passthrough"
> #define VFIO_AP_MDEV_NAME_HWVIRT "VFIO AP Passthrough Device"
>
> -static int vfio_ap_mdev_reset_queues(struct mdev_device *mdev);
> +static int vfio_ap_mdev_reset_queues(struct ap_matrix_mdev *matrix_mdev);
> static struct vfio_ap_queue *vfio_ap_find_queue(int apqn);
> +static const struct vfio_device_ops vfio_ap_matrix_dev_ops;
>
> static int match_apqn(struct device *dev, const void *data)
> {
> @@ -335,45 +336,59 @@ static void vfio_ap_matrix_init(struct ap_config_info *info,
> matrix->adm_max = info->apxa ? info->Nd : 15;
> }
>
> -static int vfio_ap_mdev_create(struct mdev_device *mdev)
> +static int vfio_ap_mdev_probe(struct mdev_device *mdev)
> {
> struct ap_matrix_mdev *matrix_mdev;
> + int ret;
>
> if ((atomic_dec_if_positive(&matrix_dev->available_instances) < 0))
> return -EPERM;
>
> matrix_mdev = kzalloc(sizeof(*matrix_mdev), GFP_KERNEL);
> if (!matrix_mdev) {
> - atomic_inc(&matrix_dev->available_instances);
> - return -ENOMEM;
> + ret = -ENOMEM;
> + goto err_atomic;
Nit: the label naming here is very strange. Somethig like
err_dec_avaiable would be much more descriptive.
> +static struct mdev_driver vfio_ap_matrix_driver = {
> + .driver = {
> + .name = "vfio_ap_mdev",
> + .owner = THIS_MODULE,
> + .mod_name = KBUILD_MODNAME,
No need to set mod_name.
Otherwise looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
next prev parent reply other threads:[~2021-08-10 8:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-06 19:51 [PATCH v3] vfio/ap_ops: Convert to use vfio_register_group_dev() Jason Gunthorpe
2021-08-10 8:33 ` Christoph Hellwig [this message]
2021-08-23 14:18 ` Jason Gunthorpe
2021-08-19 13:55 ` Tony Krowiak
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=20210810083355.GB21036@lst.de \
--to=hch@lst.de \
--cc=akrowiak@linux.ibm.com \
--cc=alex.williamson@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=cohuck@redhat.com \
--cc=freude@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=jgg@nvidia.com \
--cc=jjherne@linux.ibm.com \
--cc=kvm@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;
as well as URLs for NNTP newsgroup(s).