• Michael S. Tsirkin's avatar
    Revert "virtio-blk: Add validation for block size in config space" · ff631988
    Michael S. Tsirkin authored
    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 82e89ea0 ("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: 82e89ea0 ("virtio-blk: Add validation for block size in config space")
    Cc: Xie Yongji <xieyongji@bytedance.com>
    Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
    ff631988
virtio_blk.c 25.6 KB