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
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.
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
On 04/05/16 18:36, Kevin O'Connor wrote:
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.
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.
That sounds great, thanks. I should have thought of CD-ROMs, I guess.
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.
Right, I missed that 512e could be implemented in SeaBIOS itself (and I completely missed that it had been, for CD-ROMs).
Thanks! Laszlo
Thanks for the responses. What you've both said makes total sense. We've tried 512 logical/ 4k physical and it works fine with Seabios. Thanks Laszlo for the OVMF tip, that's totally the route we need to take.
________________________________________ From: Laszlo Ersek lersek@redhat.com Sent: Tuesday, April 5, 2016 12:49 PM To: Kevin O'Connor Cc: James Shimer; Kevin Wolf; seabios@seabios.org Subject: Re: [SeaBIOS] virtio-blk ... block size 4096 is unsupported
On 04/05/16 18:36, Kevin O'Connor wrote:
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.
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.
That sounds great, thanks. I should have thought of CD-ROMs, I guess.
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.
Right, I missed that 512e could be implemented in SeaBIOS itself (and I completely missed that it had been, for CD-ROMs).
Thanks! Laszlo