public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Yi Liu <yi.l.liu@intel.com>
Cc: alex.williamson@redhat.com, kevin.tian@intel.com,
	joro@8bytes.org, robin.murphy@arm.com, cohuck@redhat.com,
	eric.auger@redhat.com, nicolinc@nvidia.com, kvm@vger.kernel.org,
	mjrosato@linux.ibm.com, chao.p.peng@linux.intel.com,
	yi.y.sun@linux.intel.com, peterx@redhat.com, jasowang@redhat.com,
	shameerali.kolothum.thodi@huawei.com, lulu@redhat.com,
	suravee.suthikulpanit@amd.com,
	intel-gvt-dev@lists.freedesktop.org,
	intel-gfx@lists.freedesktop.org, linux-s390@vger.kernel.org,
	xudong.hao@intel.com, yan.y.zhao@intel.com,
	terrence.xu@intel.com, yanting.jiang@intel.com,
	zhenzhong.duan@intel.com, clegoate@redhat.com
Subject: Re: [PATCH v7 8/9] vfio/pci: Extend VFIO_DEVICE_GET_PCI_HOT_RESET_INFO for vfio device cdev
Date: Tue, 13 Jun 2023 08:46:58 -0300	[thread overview]
Message-ID: <ZIhXMmYjCyUdlGxe@nvidia.com> (raw)
In-Reply-To: <20230602121515.79374-9-yi.l.liu@intel.com>

On Fri, Jun 02, 2023 at 05:15:14AM -0700, Yi Liu wrote:
> +/*
> + * Return devid for a device which is affected by hot-reset.
> + * - valid devid > 0 for the device that is bound to the input
> + *   iommufd_ctx.
> + * - devid == VFIO_PCI_DEVID_OWNED for the device that has not
> + *   been bound to any iommufd_ctx but other device within its
> + *   group has been bound to the input iommufd_ctx.
> + * - devid == VFIO_PCI_DEVID_NOT_OWNED for others. e.g. device
> + *   is bound to other iommufd_ctx etc.
> + */
> +int vfio_iommufd_device_hot_reset_devid(struct vfio_device *vdev,
> +					struct iommufd_ctx *ictx)
> +{
> +	struct iommu_group *group;
> +	int devid;
> +
> +	if (vfio_iommufd_device_ictx(vdev) == ictx)
> +		return vfio_iommufd_device_id(vdev);
> +
> +	group = iommu_group_get(vdev->dev);
> +	if (!group)
> +		return VFIO_PCI_DEVID_NOT_OWNED;
> +
> +	if (iommufd_ctx_has_group(ictx, group))
> +		devid = VFIO_PCI_DEVID_OWNED;
> +	else
> +		devid = VFIO_PCI_DEVID_NOT_OWNED;
> +
> +	iommu_group_put(group);
> +
> +	return devid;
> +}
> +EXPORT_SYMBOL_GPL(vfio_iommufd_device_hot_reset_devid);

This function really should not be in the core iommufd.c file - it is
a purely vfio-pci function - why did you have to place it here?

Jason

  parent reply	other threads:[~2023-06-13 11:47 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-02 12:15 [PATCH v7 0/9] Enhance vfio PCI hot reset for vfio cdev device Yi Liu
2023-06-02 12:15 ` [PATCH v7 1/9] vfio/pci: Update comment around group_fd get in vfio_pci_ioctl_pci_hot_reset() Yi Liu
2023-06-02 12:15 ` [PATCH v7 2/9] vfio/pci: Move the existing hot reset logic to be a helper Yi Liu
2023-06-02 12:15 ` [PATCH v7 3/9] iommufd: Reserve all negative IDs in the iommufd xarray Yi Liu
2023-06-13 11:46   ` Jason Gunthorpe
2023-06-02 12:15 ` [PATCH v7 4/9] iommufd: Add iommufd_ctx_has_group() Yi Liu
2023-06-08 21:40   ` Alex Williamson
2023-06-08 23:44     ` Liu, Yi L
2023-06-13 11:46   ` Jason Gunthorpe
2023-06-02 12:15 ` [PATCH v7 5/9] iommufd: Add helper to retrieve iommufd_ctx and devid Yi Liu
2023-06-13 11:47   ` Jason Gunthorpe
2023-06-02 12:15 ` [PATCH v7 6/9] vfio: Mark cdev usage in vfio_device Yi Liu
2023-06-13 17:56   ` Jason Gunthorpe
2023-06-14  5:56     ` Liu, Yi L
2023-06-14 12:11       ` Jason Gunthorpe
2023-06-02 12:15 ` [PATCH v7 7/9] vfio: Add helper to search vfio_device in a dev_set Yi Liu
2023-06-13 11:47   ` Jason Gunthorpe
2023-06-02 12:15 ` [PATCH v7 8/9] vfio/pci: Extend VFIO_DEVICE_GET_PCI_HOT_RESET_INFO for vfio device cdev Yi Liu
2023-06-08 22:26   ` Alex Williamson
2023-06-09  0:04     ` Liu, Yi L
2023-06-13 11:46   ` Jason Gunthorpe [this message]
2023-06-13 12:50     ` Liu, Yi L
2023-06-13 14:32       ` Alex Williamson
2023-06-13 17:40         ` Jason Gunthorpe
2023-06-13 18:23   ` Jason Gunthorpe
2023-06-14 10:35     ` Liu, Yi L
2023-06-14 12:17       ` Jason Gunthorpe
2023-06-14 13:05         ` Liu, Yi L
2023-06-14 13:37           ` Jason Gunthorpe
2023-06-15  3:31             ` Liu, Yi L
2023-06-02 12:15 ` [PATCH v7 9/9] vfio/pci: Allow passing zero-length fd array in VFIO_DEVICE_PCI_HOT_RESET Yi Liu
2023-06-08 22:30   ` Alex Williamson
2023-06-09  0:13     ` Liu, Yi L
2023-06-09 14:38       ` Jason Gunthorpe
2023-06-13 18:09   ` Jason Gunthorpe
2023-06-08  6:59 ` [PATCH v7 0/9] Enhance vfio PCI hot reset for vfio cdev device Jiang, Yanting

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=ZIhXMmYjCyUdlGxe@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=alex.williamson@redhat.com \
    --cc=chao.p.peng@linux.intel.com \
    --cc=clegoate@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=eric.auger@redhat.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-gvt-dev@lists.freedesktop.org \
    --cc=jasowang@redhat.com \
    --cc=joro@8bytes.org \
    --cc=kevin.tian@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=lulu@redhat.com \
    --cc=mjrosato@linux.ibm.com \
    --cc=nicolinc@nvidia.com \
    --cc=peterx@redhat.com \
    --cc=robin.murphy@arm.com \
    --cc=shameerali.kolothum.thodi@huawei.com \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=terrence.xu@intel.com \
    --cc=xudong.hao@intel.com \
    --cc=yan.y.zhao@intel.com \
    --cc=yanting.jiang@intel.com \
    --cc=yi.l.liu@intel.com \
    --cc=yi.y.sun@linux.intel.com \
    --cc=zhenzhong.duan@intel.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