[SeaBIOS] virtio-blk ... block size 4096 is unsupported

Laszlo Ersek lersek at redhat.com
Tue Apr 5 14:31:53 CEST 2016


On 04/05/16 06:25, James Shimer wrote:
> 
> Hi,  
> 
> I've been doing some testing if KVM with 4K physical sector virtio
> disks and they work with KVM as a none boot disk.  We'd like to be
> able to boot a 4k physical sector disk in KVM, is there 4K support in
> any seabios newer/upcoming releases, or is there a way to configure
> for 4k sectors?
> 
> reference from master
> src/hw/virtio-blk.c lin 142
> 
>        if (vdrive->drive.blksize != DISK_SECTOR_SIZE) {
>             dprintf(1, "virtio-blk %pP block size %d is unsupported\n",
>                     pci, vdrive->drive.blksize);
>             goto fail;
>         }

This code dates back to 4030db0d2c5a7.

I'm not an expert, but I think BIOS interfaces don't support a sector
size different from 512 B. It seems that a drive with 4096 B physical
sectors should enable (the emulation of) a 512 B logical sector size, so
that it can work with code that assumes an 512 B sector size.

  https://en.wikipedia.org/wiki/Advanced_Format#512e

I guess for a virtio-blk disk, that means:

  -device virtio-blk-pci,physical_block_size=4096,logical_block_size=512

If your virtio disk is "4K native":

  https://en.wikipedia.org/wiki/Advanced_Format#4K_native

(which I think corresponds to the following QEMU command line option
(based on advice I had received earlier from Kevin Wolf):

  -device virtio-blk-pci,physical_block_size=4096,\
                         logical_block_size=4096,\
                         min_io_size=4096
)

then I believe BIOS interfaces / booting might not support the disk, by
design, at all.

And for that reason, I'll make an exception, and "peddle" OVMF (sorry --
I feel bad about doing this on the SeaBIOS list). UEFI (and GPT) support
"4K native" by design, and OVMF supports it for virtio-blk devices.
(OVMF also supports 512e.)

I suggest that you repeat your test with a guest OS that you install
afresh on top of OVMF.

You can find pre-built OVMF binaries (RPMs) at
<https://www.kraxel.org/repos/>. I recommend using them with libvirt:
<https://fedoraproject.org/wiki/Using_UEFI_with_QEMU#Install_a_Fedora_VM_with_UEFI>.

If you have questions about OVMF, please let's continue on edk2-devel,
to keep the noise down on the SeaBIOS list. (Note: you will have to
subscribe to edk2-devel first, before you can post. Please see
<https://lists.01.org/mailman/listinfo/edk2-devel>.)

Thanks
Laszlo



More information about the SeaBIOS mailing list