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

Kevin O'Connor kevin at koconnor.net
Tue Apr 5 18:36:38 CEST 2016


On Tue, Apr 05, 2016 at 02:31:53PM +0200, Laszlo Ersek wrote:
> On 04/05/16 06:25, James Shimer wrote:
> > 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

The EDD standard ( https://en.wikipedia.org/wiki/Enhanced_Disk_Drive )
allows for 4K blocks.  However, the older BIOS interface (eg, int
1301) only support 512 byte sectors.  This means that the BIOS would
need to emulate 512 byte reads should one of the older interfaces be
called on one of these drives.  This isn't difficult as SeaBIOS
already does this for cdroms.

> I guess for a virtio-blk disk, that means:
> 
>   -device virtio-blk-pci,physical_block_size=4096,logical_block_size=512

In practice, almost all real drives seem to do the above.  So, adding
support for drives that don't has not previously been a priority.

-Kevin



More information about the SeaBIOS mailing list