From: Igor Torrente <igor.torrente@collabora.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: "sami.md.ko" <sami.md.ko@gmail.com>,
"virtualization" <virtualization@lists.linux.dev>,
"linux-kernel" <linux-kernel@vger.kernel.org>,
"eperezma" <eperezma@redhat.com>,
"xuanzhuo" <xuanzhuo@linux.alibaba.com>,
"jasowang" <jasowang@redhat.com>,
"dmitry.osipenko" <dmitry.osipenko@collabora.com>
Subject: Re: [PATCH v2] Revert "virtio: reject shm region if length is zero"
Date: Fri, 08 Aug 2025 12:21:15 -0300 [thread overview]
Message-ID: <1988a45a0a2.802c54fc2698695.3285632374822658409@collabora.com> (raw)
In-Reply-To: <20250808072533-mutt-send-email-mst@kernel.org>
---- El vie., 08 ago. 2025 08:26:08 -0300, Michael S. Tsirkin <mst@redhat.com> escribió ----
> On Thu, Aug 07, 2025 at 10:03:29AM -0300, Igor Torrente wrote:
> > The commit 206cc44588f7 ("virtio: reject shm region if length is zero")
> > breaks the Virtio-gpu `host_visible` feature.
> >
> > Right now in the Virtio-gpu code, `host_visible_region.len` is zero because
> > the struct comes directly from the `kzalloc` allocation. And Virtio-gpu
> > is using the `vm_get_shm_region` (drivers/virtio/virtio_mmio.c:536) to read
> > the `addr` and `len` from Qemu/Crosvm.
> >
> > ```
> > drivers/gpu/drm/virtio/virtgpu_kms.c
> > 132 vgdev = drmm_kzalloc(dev, sizeof(struct virtio_gpu_device), GFP_KERNEL);
> > [...]
> > 177 if (virtio_get_shm_region(vgdev->vdev, &vgdev->host_visible_region,
> > 178 VIRTIO_GPU_SHM_ID_HOST_VISIBLE)) {
> > ```
> > Now it always fails.
> >
> > As the Virtio-gpu relies on the previous behavior, this patch reverts
> > the offending commit.
> >
> > Fixes: 206cc44588f7 ("virtio: reject shm region if length is zero` breaks the Virtio-gpu `host_visible")
> >
> > This reverts commit 206cc44588f72b49ad4d7e21a7472ab2a72a83df.
> >
> > Signed-off-by: Igor Torrente <igor.torrente@collabora.com>
>
>
> Fixes has to be adjacent to Signed-off-by.
Ohh, I will pay attention to this next time.
> But anyway, I already included v1 in my tree, pls check it out
> and tell me if more fixes are needed.
I tested here your branch, and it's working fine.
```
[ 0.298365] [drm] pci: virtio-gpu-pci detected at 0000:00:04.0
[ 0.298506] [drm] Host memory window: 0x200000000 +0x200000000
[ 0.298510] [drm] features: +virgl +edid +resource_blob +host_visible
```
```
Linux debian-arm64-vm-chromebook 6.16.0mst_virt_repo_linux-next+ #159 SMP PREEMPT_DYNAMIC Fri Aug 8 11:53:04 -03 2025 aarch64 GNU/Linux
```
Thanks for applying it,
---
Igor Torrente
>
> > ---
> > v2: Improve the commit message (Michael S. Tsirkin)
> >
> > include/linux/virtio_config.h | 2 --
> > 1 file changed, 2 deletions(-)
> >
> > diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
> > index b3e1d30c765b..169c7d367fac 100644
> > --- a/include/linux/virtio_config.h
> > +++ b/include/linux/virtio_config.h
> > @@ -329,8 +329,6 @@ static inline
> > bool virtio_get_shm_region(struct virtio_device *vdev,
> > struct virtio_shm_region *region, u8 id)
> > {
> > - if (!region->len)
> > - return false;
> > if (!vdev->config->get_shm_region)
> > return false;
> > return vdev->config->get_shm_region(vdev, region, id);
> > --
> > 2.49.0
>
>
prev parent reply other threads:[~2025-08-08 15:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-07 13:03 Igor Torrente
2025-08-08 11:26 ` Michael S. Tsirkin
2025-08-08 15:21 ` Igor Torrente [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=1988a45a0a2.802c54fc2698695.3285632374822658409@collabora.com \
--to=igor.torrente@collabora.com \
--cc=dmitry.osipenko@collabora.com \
--cc=eperezma@redhat.com \
--cc=jasowang@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=sami.md.ko@gmail.com \
--cc=virtualization@lists.linux.dev \
--cc=xuanzhuo@linux.alibaba.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
all inboxes | Powered by JetHome®