public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: David Matlack <dmatlack@google.com>
To: Rubin Du <rubind@nvidia.com>
Cc: Alex Williamson <alex@shazbot.org>, Shuah Khan <shuah@kernel.org>,
	kvm@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v11 1/3] selftests/vfio: Add memcpy chunking and PCI command helpers
Date: Fri, 3 Apr 2026 22:42:32 +0000	[thread overview]
Message-ID: <adBCWCXl42YJ0FRZ@google.com> (raw)
In-Reply-To: <20260331172241.50456-2-rubind@nvidia.com>

On 2026-03-31 10:22 AM, Rubin Du wrote:

> --- a/tools/testing/selftests/vfio/lib/include/libvfio/vfio_pci_device.h
> +++ b/tools/testing/selftests/vfio/lib/include/libvfio/vfio_pci_device.h
> @@ -122,4 +122,14 @@ static inline bool vfio_pci_device_match(struct vfio_pci_device *device,
>  
>  const char *vfio_pci_get_cdev_path(const char *bdf);
>  
> +#define vfio_pci_cmd_set(_device, _bits) do {				\
> +	u16 __cmd = vfio_pci_config_readw((_device), PCI_COMMAND);	\
> +	vfio_pci_config_writew((_device), PCI_COMMAND, __cmd | (_bits));\
> +} while (0)
> +
> +#define vfio_pci_cmd_clear(_device, _bits) do {				\
> +	u16 __cmd = vfio_pci_config_readw((_device), PCI_COMMAND);	\
> +	vfio_pci_config_writew((_device), PCI_COMMAND, __cmd & ~(_bits));\
> +} while (0)

Please add these in their own commit, and also put them up next to the
other vfio_pci_config_*() routines.

> @@ -221,13 +221,15 @@ TEST_F_TIMEOUT(vfio_pci_driver_test, memcpy_storm, 60)
>  	 * will take too long.
>  	 */
>  	total_size = 250UL * SZ_1G;
> -	count = min(total_size / self->size, driver->max_memcpy_count);
> +	count = min(total_size / driver->max_memcpy_size,
> +		    driver->max_memcpy_count);
>  
> -	printf("Kicking off %lu memcpys of size 0x%lx\n", count, self->size);
> +	printf("Kicking off %lu memcpys of size 0x%lx\n", count,
> +	       driver->max_memcpy_size);
>  	vfio_pci_driver_memcpy_start(self->device,
>  				     self->src_iova,
>  				     self->dst_iova,
> -				     self->size, count);
> +				     driver->max_memcpy_size, count);

The memcpy size needs to capped at self->memcpy_region.size / 2 (here
and in the calculation above for count).

  reply	other threads:[~2026-04-03 22:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-31 17:22 [PATCH v11 0/3] selftests/vfio: Add NVIDIA GPU Falcon DMA test driver Rubin Du
2026-03-31 17:22 ` [PATCH v11 1/3] selftests/vfio: Add memcpy chunking and PCI command helpers Rubin Du
2026-04-03 22:42   ` David Matlack [this message]
2026-03-31 17:22 ` [PATCH v11 2/3] selftests/vfio: Allow drivers without send_msi() support Rubin Du
2026-03-31 17:22 ` [PATCH v11 3/3] selftests/vfio: Add NVIDIA Falcon driver for DMA testing Rubin Du

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=adBCWCXl42YJ0FRZ@google.com \
    --to=dmatlack@google.com \
    --cc=alex@shazbot.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=rubind@nvidia.com \
    --cc=shuah@kernel.org \
    /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