* [PATCH] virtio-blk: fix probe without CONFIG_BLK_DEV_ZONED
@ 2022-12-20 11:23 Michael S. Tsirkin
2022-12-20 19:50 ` Stefan Hajnoczi
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Michael S. Tsirkin @ 2022-12-20 11:23 UTC (permalink / raw)
To: linux-kernel
Cc: Anders Roxell, Jason Wang, Paolo Bonzini, Stefan Hajnoczi,
Jens Axboe, virtualization, linux-block
When building without CONFIG_BLK_DEV_ZONED, VIRTIO_BLK_F_ZONED
is excluded from array of driver features.
As a result virtio_has_feature panics in virtio_check_driver_offered_feature
since that by design verifies that a feature we are checking for
is listed in the feature array.
To fix, replace the call to virtio_has_feature with a stub.
Tested-by: Anders Roxell <anders.roxell@linaro.org>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
drivers/block/virtio_blk.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 88b3639f8536..5ea1dc882a80 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -760,6 +760,10 @@ static int virtblk_probe_zoned_device(struct virtio_device *vdev,
return ret;
}
+static inline bool virtblk_has_zoned_feature(struct virtio_device *vdev)
+{
+ return virtio_has_feature(vdev, VIRTIO_BLK_F_ZONED);
+}
#else
/*
@@ -775,6 +779,11 @@ static inline int virtblk_probe_zoned_device(struct virtio_device *vdev,
{
return -EOPNOTSUPP;
}
+
+static inline bool virtblk_has_zoned_feature(struct virtio_device *vdev)
+{
+ return false;
+}
#endif /* CONFIG_BLK_DEV_ZONED */
/* return id (s/n) string for *disk to *id_str
@@ -1480,7 +1489,7 @@ static int virtblk_probe(struct virtio_device *vdev)
virtblk_update_capacity(vblk, false);
virtio_device_ready(vdev);
- if (virtio_has_feature(vdev, VIRTIO_BLK_F_ZONED)) {
+ if (virtblk_has_zoned_feature(vdev)) {
err = virtblk_probe_zoned_device(vdev, vblk, q);
if (err)
goto out_cleanup_disk;
--
MST
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] virtio-blk: fix probe without CONFIG_BLK_DEV_ZONED
2022-12-20 11:23 [PATCH] virtio-blk: fix probe without CONFIG_BLK_DEV_ZONED Michael S. Tsirkin
@ 2022-12-20 19:50 ` Stefan Hajnoczi
2022-12-20 22:57 ` Chaitanya Kulkarni
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Stefan Hajnoczi @ 2022-12-20 19:50 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: linux-kernel, Anders Roxell, Jason Wang, Paolo Bonzini,
Jens Axboe, virtualization, linux-block
[-- Attachment #1: Type: text/plain, Size: 705 bytes --]
On Tue, Dec 20, 2022 at 06:23:44AM -0500, Michael S. Tsirkin wrote:
> When building without CONFIG_BLK_DEV_ZONED, VIRTIO_BLK_F_ZONED
> is excluded from array of driver features.
> As a result virtio_has_feature panics in virtio_check_driver_offered_feature
> since that by design verifies that a feature we are checking for
> is listed in the feature array.
>
> To fix, replace the call to virtio_has_feature with a stub.
>
> Tested-by: Anders Roxell <anders.roxell@linaro.org>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> drivers/block/virtio_blk.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] virtio-blk: fix probe without CONFIG_BLK_DEV_ZONED
2022-12-20 11:23 [PATCH] virtio-blk: fix probe without CONFIG_BLK_DEV_ZONED Michael S. Tsirkin
2022-12-20 19:50 ` Stefan Hajnoczi
@ 2022-12-20 22:57 ` Chaitanya Kulkarni
2022-12-21 3:23 ` Jason Wang
2022-12-21 19:32 ` Lorenzo Stoakes
3 siblings, 0 replies; 5+ messages in thread
From: Chaitanya Kulkarni @ 2022-12-20 22:57 UTC (permalink / raw)
To: Michael S. Tsirkin, linux-kernel@vger.kernel.org
Cc: Jens Axboe, Anders Roxell,
virtualization@lists.linux-foundation.org,
linux-block@vger.kernel.org, Stefan Hajnoczi, Paolo Bonzini
On 12/20/22 03:23, Michael S. Tsirkin wrote:
> When building without CONFIG_BLK_DEV_ZONED, VIRTIO_BLK_F_ZONED
> is excluded from array of driver features.
> As a result virtio_has_feature panics in virtio_check_driver_offered_feature
> since that by design verifies that a feature we are checking for
> is listed in the feature array.
>
> To fix, replace the call to virtio_has_feature with a stub.
>
> Tested-by: Anders Roxell <anders.roxell@linaro.org>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
-ck
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] virtio-blk: fix probe without CONFIG_BLK_DEV_ZONED
2022-12-20 11:23 [PATCH] virtio-blk: fix probe without CONFIG_BLK_DEV_ZONED Michael S. Tsirkin
2022-12-20 19:50 ` Stefan Hajnoczi
2022-12-20 22:57 ` Chaitanya Kulkarni
@ 2022-12-21 3:23 ` Jason Wang
2022-12-21 19:32 ` Lorenzo Stoakes
3 siblings, 0 replies; 5+ messages in thread
From: Jason Wang @ 2022-12-21 3:23 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: linux-kernel, Anders Roxell, Paolo Bonzini, Stefan Hajnoczi,
Jens Axboe, virtualization, linux-block
On Tue, Dec 20, 2022 at 7:23 PM Michael S. Tsirkin <mst@redhat.com> wrote:
>
> When building without CONFIG_BLK_DEV_ZONED, VIRTIO_BLK_F_ZONED
> is excluded from array of driver features.
> As a result virtio_has_feature panics in virtio_check_driver_offered_feature
> since that by design verifies that a feature we are checking for
> is listed in the feature array.
>
> To fix, replace the call to virtio_has_feature with a stub.
>
> Tested-by: Anders Roxell <anders.roxell@linaro.org>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Thanks
> ---
> drivers/block/virtio_blk.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
> index 88b3639f8536..5ea1dc882a80 100644
> --- a/drivers/block/virtio_blk.c
> +++ b/drivers/block/virtio_blk.c
> @@ -760,6 +760,10 @@ static int virtblk_probe_zoned_device(struct virtio_device *vdev,
> return ret;
> }
>
> +static inline bool virtblk_has_zoned_feature(struct virtio_device *vdev)
> +{
> + return virtio_has_feature(vdev, VIRTIO_BLK_F_ZONED);
> +}
> #else
>
> /*
> @@ -775,6 +779,11 @@ static inline int virtblk_probe_zoned_device(struct virtio_device *vdev,
> {
> return -EOPNOTSUPP;
> }
> +
> +static inline bool virtblk_has_zoned_feature(struct virtio_device *vdev)
> +{
> + return false;
> +}
> #endif /* CONFIG_BLK_DEV_ZONED */
>
> /* return id (s/n) string for *disk to *id_str
> @@ -1480,7 +1489,7 @@ static int virtblk_probe(struct virtio_device *vdev)
> virtblk_update_capacity(vblk, false);
> virtio_device_ready(vdev);
>
> - if (virtio_has_feature(vdev, VIRTIO_BLK_F_ZONED)) {
> + if (virtblk_has_zoned_feature(vdev)) {
> err = virtblk_probe_zoned_device(vdev, vblk, q);
> if (err)
> goto out_cleanup_disk;
> --
> MST
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] virtio-blk: fix probe without CONFIG_BLK_DEV_ZONED
2022-12-20 11:23 [PATCH] virtio-blk: fix probe without CONFIG_BLK_DEV_ZONED Michael S. Tsirkin
` (2 preceding siblings ...)
2022-12-21 3:23 ` Jason Wang
@ 2022-12-21 19:32 ` Lorenzo Stoakes
3 siblings, 0 replies; 5+ messages in thread
From: Lorenzo Stoakes @ 2022-12-21 19:32 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: linux-kernel, Jens Axboe, Anders Roxell, virtualization,
linux-block, Stefan Hajnoczi, Paolo Bonzini
On Tue, Dec 20, 2022 at 06:23:44AM -0500, Michael S. Tsirkin wrote:
> When building without CONFIG_BLK_DEV_ZONED, VIRTIO_BLK_F_ZONED
> is excluded from array of driver features.
> As a result virtio_has_feature panics in virtio_check_driver_offered_feature
> since that by design verifies that a feature we are checking for
> is listed in the feature array.
>
> To fix, replace the call to virtio_has_feature with a stub.
>
> Tested-by: Anders Roxell <anders.roxell@linaro.org>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> drivers/block/virtio_blk.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
> index 88b3639f8536..5ea1dc882a80 100644
> --- a/drivers/block/virtio_blk.c
> +++ b/drivers/block/virtio_blk.c
> @@ -760,6 +760,10 @@ static int virtblk_probe_zoned_device(struct virtio_device *vdev,
> return ret;
> }
>
> +static inline bool virtblk_has_zoned_feature(struct virtio_device *vdev)
> +{
> + return virtio_has_feature(vdev, VIRTIO_BLK_F_ZONED);
> +}
> #else
>
> /*
> @@ -775,6 +779,11 @@ static inline int virtblk_probe_zoned_device(struct virtio_device *vdev,
> {
> return -EOPNOTSUPP;
> }
> +
> +static inline bool virtblk_has_zoned_feature(struct virtio_device *vdev)
> +{
> + return false;
> +}
> #endif /* CONFIG_BLK_DEV_ZONED */
>
> /* return id (s/n) string for *disk to *id_str
> @@ -1480,7 +1489,7 @@ static int virtblk_probe(struct virtio_device *vdev)
> virtblk_update_capacity(vblk, false);
> virtio_device_ready(vdev);
>
> - if (virtio_has_feature(vdev, VIRTIO_BLK_F_ZONED)) {
> + if (virtblk_has_zoned_feature(vdev)) {
> err = virtblk_probe_zoned_device(vdev, vblk, q);
> if (err)
> goto out_cleanup_disk;
> --
> MST
>
> _______________________________________________
> Virtualization mailing list
> Virtualization@lists.linux-foundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Tested-by: Lorenzo Stoakes <lstoakes@gmail.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-12-21 19:32 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-20 11:23 [PATCH] virtio-blk: fix probe without CONFIG_BLK_DEV_ZONED Michael S. Tsirkin
2022-12-20 19:50 ` Stefan Hajnoczi
2022-12-20 22:57 ` Chaitanya Kulkarni
2022-12-21 3:23 ` Jason Wang
2022-12-21 19:32 ` Lorenzo Stoakes
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).