qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: Albert Esteve <aesteve@redhat.com>
Cc: qemu-devel@nongnu.org, stevensd@chromium.org,
	jasowang@redhat.com, "Paolo Bonzini" <pbonzini@redhat.com>,
	hi@alyssa.is, "Laurent Vivier" <lvivier@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	david@redhat.com, manos.pitsidianakis@linaro.org,
	"Fabiano Rosas" <farosas@suse.de>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Stefano Garzarella" <sgarzare@redhat.com>,
	slp@redhat.com, dbassey@redhat.com
Subject: Re: [PATCH v9 7/7] vhost-user-device: Add shared memory BAR
Date: Wed, 15 Oct 2025 11:35:45 -0400	[thread overview]
Message-ID: <20251015153545.GC1133221@fedora> (raw)
In-Reply-To: <20251015085930.1517330-8-aesteve@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1439 bytes --]

On Wed, Oct 15, 2025 at 10:59:30AM +0200, Albert Esteve wrote:
> @@ -25,10 +29,37 @@ OBJECT_DECLARE_SIMPLE_TYPE(VHostUserDevicePCI, VHOST_USER_TEST_DEVICE_PCI)
>  static void vhost_user_device_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
>  {
>      VHostUserDevicePCI *dev = VHOST_USER_TEST_DEVICE_PCI(vpci_dev);
> -    DeviceState *vdev = DEVICE(&dev->vub);
> +    DeviceState *dev_state = DEVICE(&dev->vub);
> +    VirtIODevice *vdev = VIRTIO_DEVICE(dev_state);
> +    VirtioSharedMemory *shmem, *next;
> +    uint64_t offset = 0, shmem_size = 0;
>  
> +    vpci_dev->modern_mem_bar_idx = 2;
>      vpci_dev->nvectors = 1;
> -    qdev_realize(vdev, BUS(&vpci_dev->bus), errp);
> +    qdev_realize(dev_state, BUS(&vpci_dev->bus), errp);
> +
> +    QSIMPLEQ_FOREACH_SAFE(shmem, &vdev->shmem_list, entry, next) {
> +        if (shmem->mr.size > UINT64_MAX - shmem_size) {
> +            error_setg(errp, "Total shared memory required overflow");
> +            return;
> +        }
> +        shmem_size = shmem_size + shmem->mr.size;
> +    }
> +    if (shmem_size) {

Let's reject invalid BAR configurations when VIRTIO Shared Memory
Regions are in use:

  if (vpci_dev->flags & VIRTIO_PCI_FLAG_MODERN_PIO_NOTIFY) {
      error_setg(errp, "modern-pio-notify is not supported due to PCI BAR layout limitations");
      return;
  }

Otherwise:

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

      reply	other threads:[~2025-10-15 15:38 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-15  8:59 [PATCH v9 0/7] vhost-user: Add SHMEM_MAP/UNMAP requests Albert Esteve
2025-10-15  8:59 ` [PATCH v9 1/7] vhost-user: Add VirtIO Shared Memory map request Albert Esteve
2025-10-15  9:47   ` Manos Pitsidianakis
2025-10-15 12:29     ` Albert Esteve
2025-10-15 12:45       ` Manos Pitsidianakis
2025-10-16 13:42         ` Albert Esteve
2025-10-16 13:53           ` Manos Pitsidianakis
2025-10-16 14:20             ` Albert Esteve
2025-10-15 15:27   ` Stefan Hajnoczi
2025-10-15  8:59 ` [PATCH v9 2/7] vhost_user.rst: Align VhostUserMsg excerpt members Albert Esteve
2025-10-15  8:59 ` [PATCH v9 3/7] vhost_user.rst: Add SHMEM_MAP/_UNMAP to spec Albert Esteve
2025-10-15  9:29   ` Manos Pitsidianakis
2025-10-15  8:59 ` [PATCH v9 4/7] vhost_user: Add frontend get_shmem_config command Albert Esteve
2025-10-15  8:59 ` [PATCH v9 5/7] vhost_user.rst: Add GET_SHMEM_CONFIG message Albert Esteve
2025-10-15  8:59 ` [PATCH v9 6/7] qmp: add shmem feature map Albert Esteve
2025-10-15  8:59 ` [PATCH v9 7/7] vhost-user-device: Add shared memory BAR Albert Esteve
2025-10-15 15:35   ` Stefan Hajnoczi [this message]

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=20251015153545.GC1133221@fedora \
    --to=stefanha@redhat.com \
    --cc=aesteve@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=david@redhat.com \
    --cc=dbassey@redhat.com \
    --cc=farosas@suse.de \
    --cc=hi@alyssa.is \
    --cc=jasowang@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=manos.pitsidianakis@linaro.org \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sgarzare@redhat.com \
    --cc=slp@redhat.com \
    --cc=stevensd@chromium.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;
as well as URLs for NNTP newsgroup(s).