public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Yishai Hadas <yishaih@nvidia.com>
To: <ankita@nvidia.com>, <jgg@nvidia.com>,
	<alex.williamson@redhat.com>,
	<shameerali.kolothum.thodi@huawei.com>, <kevin.tian@intel.com>,
	<mst@redhat.com>, <eric.auger@redhat.com>, <jgg@ziepe.ca>,
	<oleksandr@natalenko.name>, <clg@redhat.com>,
	<satyanarayana.k.v.p@intel.com>, <brett.creeley@amd.com>,
	<horms@kernel.org>, <shannon.nelson@amd.com>
Cc: <aniketa@nvidia.com>, <cjia@nvidia.com>, <kwankhede@nvidia.com>,
	<targupta@nvidia.com>, <vsethi@nvidia.com>, <acurrid@nvidia.com>,
	<apopple@nvidia.com>, <jhubbard@nvidia.com>, <danw@nvidia.com>,
	<anuaggarwal@nvidia.com>, <mochs@nvidia.com>,
	<kvm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<virtualization@lists.linux-foundation.org>
Subject: Re: [PATCH v18 1/3] vfio/pci: rename and export do_io_rw()
Date: Sun, 18 Feb 2024 13:57:32 +0200	[thread overview]
Message-ID: <c7690b8a-78db-46ba-91fe-a2186eaae8aa@nvidia.com> (raw)
In-Reply-To: <20240216030128.29154-2-ankita@nvidia.com>

On 16/02/2024 5:01, ankita@nvidia.com wrote:
> From: Ankit Agrawal <ankita@nvidia.com>
> 
> do_io_rw() is used to read/write to the device MMIO. The grace hopper
> VFIO PCI variant driver require this functionality to read/write to
> its memory.
> 
> Rename this as vfio_pci_core functions and export as GPL.
> 
> Reviewed-by: Kevin Tian <kevin.tian@intel.com>
> Signed-off-by: Ankit Agrawal <ankita@nvidia.com>
> ---
>   drivers/vfio/pci/vfio_pci_rdwr.c | 16 +++++++++-------
>   include/linux/vfio_pci_core.h    |  5 ++++-
>   2 files changed, 13 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/vfio/pci/vfio_pci_rdwr.c b/drivers/vfio/pci/vfio_pci_rdwr.c
> index 07fea08ea8a2..03b8f7ada1ac 100644
> --- a/drivers/vfio/pci/vfio_pci_rdwr.c
> +++ b/drivers/vfio/pci/vfio_pci_rdwr.c
> @@ -96,10 +96,10 @@ VFIO_IOREAD(32)
>    * reads with -1.  This is intended for handling MSI-X vector tables and
>    * leftover space for ROM BARs.
>    */
> -static ssize_t do_io_rw(struct vfio_pci_core_device *vdev, bool test_mem,
> -			void __iomem *io, char __user *buf,
> -			loff_t off, size_t count, size_t x_start,
> -			size_t x_end, bool iswrite)
> +ssize_t vfio_pci_core_do_io_rw(struct vfio_pci_core_device *vdev, bool test_mem,
> +			       void __iomem *io, char __user *buf,
> +			       loff_t off, size_t count, size_t x_start,
> +			       size_t x_end, bool iswrite)
>   {
>   	ssize_t done = 0;
>   	int ret;
> @@ -201,6 +201,7 @@ static ssize_t do_io_rw(struct vfio_pci_core_device *vdev, bool test_mem,
>   
>   	return done;
>   }
> +EXPORT_SYMBOL_GPL(vfio_pci_core_do_io_rw);
>   
>   int vfio_pci_core_setup_barmap(struct vfio_pci_core_device *vdev, int bar)
>   {
> @@ -279,8 +280,8 @@ ssize_t vfio_pci_bar_rw(struct vfio_pci_core_device *vdev, char __user *buf,
>   		x_end = vdev->msix_offset + vdev->msix_size;
>   	}
>   
> -	done = do_io_rw(vdev, res->flags & IORESOURCE_MEM, io, buf, pos,
> -			count, x_start, x_end, iswrite);
> +	done = vfio_pci_core_do_io_rw(vdev, res->flags & IORESOURCE_MEM, io, buf, pos,
> +				      count, x_start, x_end, iswrite);
>   
>   	if (done >= 0)
>   		*ppos += done;
> @@ -348,7 +349,8 @@ ssize_t vfio_pci_vga_rw(struct vfio_pci_core_device *vdev, char __user *buf,
>   	 * probing, so we don't currently worry about access in relation
>   	 * to the memory enable bit in the command register.
>   	 */
> -	done = do_io_rw(vdev, false, iomem, buf, off, count, 0, 0, iswrite);
> +	done = vfio_pci_core_do_io_rw(vdev, false, iomem, buf, off, count,
> +				      0, 0, iswrite);
>   
>   	vga_put(vdev->pdev, rsrc);
>   
> diff --git a/include/linux/vfio_pci_core.h b/include/linux/vfio_pci_core.h
> index 85e84b92751b..cf9480a31f3e 100644
> --- a/include/linux/vfio_pci_core.h
> +++ b/include/linux/vfio_pci_core.h
> @@ -130,7 +130,10 @@ void vfio_pci_core_finish_enable(struct vfio_pci_core_device *vdev);
>   int vfio_pci_core_setup_barmap(struct vfio_pci_core_device *vdev, int bar);
>   pci_ers_result_t vfio_pci_core_aer_err_detected(struct pci_dev *pdev,
>   						pci_channel_state_t state);
> -
> +ssize_t vfio_pci_core_do_io_rw(struct vfio_pci_core_device *vdev, bool test_mem,
> +			       void __iomem *io, char __user *buf,
> +			       loff_t off, size_t count, size_t x_start,
> +			       size_t x_end, bool iswrite);
>   #define VFIO_IOWRITE_DECLATION(size) \
>   int vfio_pci_core_iowrite##size(struct vfio_pci_core_device *vdev,	\
>   			bool test_mem, u##size val, void __iomem *io);

Reviewed-by: Yishai Hadas <yishaih@nvidia.com>

  reply	other threads:[~2024-02-18 11:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-16  3:01 [PATCH v18 0/3] vfio/nvgrace-gpu: Add vfio pci variant module for grace hopper ankita
2024-02-16  3:01 ` [PATCH v18 1/3] vfio/pci: rename and export do_io_rw() ankita
2024-02-18 11:57   ` Yishai Hadas [this message]
2024-02-16  3:01 ` [PATCH v18 2/3] vfio/pci: rename and export range_intersect_range ankita
2024-02-18 12:07   ` Yishai Hadas
2024-02-19  3:49     ` Ankit Agrawal
2024-02-16  3:01 ` [PATCH v18 3/3] vfio/nvgrace-gpu: Add vfio pci variant module for grace hopper ankita
2024-02-18  1:00   ` Tian, Kevin
2024-02-18 12:46   ` Yishai Hadas
2024-02-19  3:48     ` Ankit Agrawal
2024-02-19  9:28   ` Zhi Wang
2024-02-19  9:36     ` Ankit Agrawal

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=c7690b8a-78db-46ba-91fe-a2186eaae8aa@nvidia.com \
    --to=yishaih@nvidia.com \
    --cc=acurrid@nvidia.com \
    --cc=alex.williamson@redhat.com \
    --cc=aniketa@nvidia.com \
    --cc=ankita@nvidia.com \
    --cc=anuaggarwal@nvidia.com \
    --cc=apopple@nvidia.com \
    --cc=brett.creeley@amd.com \
    --cc=cjia@nvidia.com \
    --cc=clg@redhat.com \
    --cc=danw@nvidia.com \
    --cc=eric.auger@redhat.com \
    --cc=horms@kernel.org \
    --cc=jgg@nvidia.com \
    --cc=jgg@ziepe.ca \
    --cc=jhubbard@nvidia.com \
    --cc=kevin.tian@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=kwankhede@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mochs@nvidia.com \
    --cc=mst@redhat.com \
    --cc=oleksandr@natalenko.name \
    --cc=satyanarayana.k.v.p@intel.com \
    --cc=shameerali.kolothum.thodi@huawei.com \
    --cc=shannon.nelson@amd.com \
    --cc=targupta@nvidia.com \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=vsethi@nvidia.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