ping
On Thu, May 15, 2025 at 9:32 AM Yuri Benditovich <yuri.benditov...@daynix.com> wrote: > > virtio processes indirect descriptors even if the respected > feature VIRTIO_RING_F_INDIRECT_DESC was not negotiated. > If qemu is used with reduced set of features to emulate the > hardware device that does not support indirect descriptors, > the will probably trigger problematic flows on the hardware > setup but do not reveal the mistake on qemu. > Add LOG_GUEST_ERROR for such case. This will issue logs with > '-d guest_errors' in the command line > > Signed-off-by: Yuri Benditovich <yuri.benditov...@daynix.com> > --- > hw/virtio/virtio.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c > index 480c2e5036..8d185f282a 100644 > --- a/hw/virtio/virtio.c > +++ b/hw/virtio/virtio.c > @@ -205,6 +205,15 @@ static const char *virtio_id_to_name(uint16_t device_id) > return name; > } > > +static void virtio_check_indirect_feature(VirtIODevice *vdev) > +{ > + if (!virtio_vdev_has_feature(vdev, VIRTIO_RING_F_INDIRECT_DESC)) { > + qemu_log_mask(LOG_GUEST_ERROR, > + "Device %s: indirect_desc was not negotiated!\n", > + vdev->name); > + } > +} > + > /* Called within call_rcu(). */ > static void virtio_free_region_cache(VRingMemoryRegionCaches *caches) > { > @@ -1733,6 +1742,7 @@ static void *virtqueue_split_pop(VirtQueue *vq, size_t > sz) > virtio_error(vdev, "Invalid size for indirect buffer table"); > goto done; > } > + virtio_check_indirect_feature(vdev); > > /* loop over the indirect descriptor table */ > len = address_space_cache_init(&indirect_desc_cache, vdev->dma_as, > @@ -1870,6 +1880,7 @@ static void *virtqueue_packed_pop(VirtQueue *vq, size_t > sz) > virtio_error(vdev, "Invalid size for indirect buffer table"); > goto done; > } > + virtio_check_indirect_feature(vdev); > > /* loop over the indirect descriptor table */ > len = address_space_cache_init(&indirect_desc_cache, vdev->dma_as, > -- > 2.40.1 >