Revert "virtio-blk: Add validation for block size in config space"
authorMichael S. Tsirkin <mst@redhat.com>
Mon, 4 Oct 2021 15:31:00 +0000 (11:31 -0400)
committerMichael S. Tsirkin <mst@redhat.com>
Wed, 13 Oct 2021 12:35:36 +0000 (08:35 -0400)
commitff63198850f33eab54b2da6905380fd4d4fc0739
tree39a992cab53e35abbb0897b9f32ce4c14b1a093c
parent97f854be203883b61d24f230445bd533bbdf770c
Revert "virtio-blk: Add validation for block size in config space"

It turns out that access to config space before completing the feature
negotiation is broken for big endian guests at least with QEMU hosts up
to 6.1 inclusive.  This affects any device that accesses config space in
the validate callback: at the moment that is virtio-net with
VIRTIO_NET_F_MTU but since 82e89ea077b9 ("virtio-blk: Add validation for
block size in config space") that also started affecting virtio-blk with
VIRTIO_BLK_F_BLK_SIZE. Further, unlike VIRTIO_NET_F_MTU which is off by
default on QEMU, VIRTIO_BLK_F_BLK_SIZE is on by default, which resulted
in lots of people not being able to boot VMs on BE.

The spec is very clear that what we are doing is legal so QEMU needs to
be fixed, but given it's been broken for so many years and no one
noticed, we need to give QEMU a bit more time before applying this.

Further, this patch is incomplete (does not check blk size is a power
of two) and it duplicates the logic from nbd.

Revert for now, and we'll reapply a cleaner logic in the next release.

Cc: stable@vger.kernel.org
Fixes: 82e89ea077b9 ("virtio-blk: Add validation for block size in config space")
Cc: Xie Yongji <xieyongji@bytedance.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
drivers/block/virtio_blk.c