Notification area is a Virtio feature that require to be negotiated because not all devices support it. Currently, it is tried to be initialized as soon as the backend implements the callback, so it assumes all Vhost-vDPA devices support it.
This patch skips calling the notification area map callback if the device does not advertise its support. Fixes: 0fd2782660c8 ("net/virtio-user: support notification area mapping") Signed-off-by: Maxime Coquelin <maxime.coque...@redhat.com> --- drivers/net/virtio/virtio_user/virtio_user_dev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c index 0b5db12886..b2e361ef3b 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c @@ -433,8 +433,9 @@ virtio_user_dev_init_notify(struct virtio_user_dev *dev) dev->kickfds[i] = kickfd; } - if (dev->ops->map_notification_area) - if (dev->ops->map_notification_area(dev)) + if (dev->device_features & (1ULL << VIRTIO_F_NOTIFICATION_DATA)) + if (dev->ops->map_notification_area && + dev->ops->map_notification_area(dev)) goto err; return 0; -- 2.44.0