CC: Kevin Wolf

Recent versions of the virtio spec describe additional topology
attributes for virtio-blk devices. Revision 3 of the UEFI BlockIo
protocol also introduces some related fields. Map the former to the
latter in VirtioBlkDxe.

Tested with:

(1) ArmVExpress-RTSM-AEMv8Ax4-foundation on the Foundation Model -- no
topology support. Messages logged:

  VirtioBlkInit: LbaSize=0x200[B] NumBlocks=0x1800000[Lba]

(2) OvmfPkg on qemu, default settings, existing F19 VM:

  VirtioBlkInit: LbaSize=0x200[B] NumBlocks=0x1000000[Lba]
  VirtioBlkInit: FirstAligned=0x0[Lba] PhysBlkSize=0x1[Lba]
  VirtioBlkInit: OptimalTransferLengthGranularity=0x0[Lba]
  [...]
   BlockSize : 512
   LastBlock : FFFFFF
   Valid efi partition table header

(The second block of messages comes from the edk2 partition driver.)

(3) OvmfPkg, qemu command line for emulating native 4K sectors:

  P=physical_block_size
  L=logical_block_size
  M=min_io_size

  -device virtio-blk-pci,$P=4096,$L=4096,$M=4096

Messages logged (same virtual disk):

  VirtioBlkInit: LbaSize=0x1000[B] NumBlocks=0x200000[Lba]
  VirtioBlkInit: FirstAligned=0x0[Lba] PhysBlkSize=0x1[Lba]
  VirtioBlkInit: OptimalTransferLengthGranularity=0x0[Lba]
  [...]
   BlockSize : 4096
   LastBlock : 1FFFFF
   Invalid efi partition table header

The previous GPT partition table looks invalid due to the different LBA
size.

(4) OvmfPkg, qemu command line for 512E emulation:

  P=physical_block_size
  L=logical_block_size
  M=min_io_size

  -device virtio-blk-pci,$P=4096,$L=512,$M=512

Messages logged (boot successful):

  VirtioBlkInit: LbaSize=0x200[B] NumBlocks=0x1000000[Lba]
  VirtioBlkInit: FirstAligned=0x0[Lba] PhysBlkSize=0x8[Lba]
  VirtioBlkInit: OptimalTransferLengthGranularity=0x0[Lba]
  [...]
   BlockSize : 512
   LastBlock : FFFFFF
   Valid efi partition table header

Notes:

- The above virtio-blk-pci properties affect the guest side only. Kevin
  is working on qemu host-side support for 512E:
  <http://thread.gmane.org/gmane.comp.emulators.qemu/246738>

- The UEFI BlockIo protocol (rev3) doesn't distinguish "min_io_size"
  ("suggested minimum I/O size in blocks" according to the virtio spec).
  Only "physical_block_exp", "alignment_offset" and "opt_io_size" can be
  passed through. I only specified "min_io_size" above because Kevin
  included it when we discussed the topology fields earlier.

- In the series I separated out the debug messages into the last patch,
  because I know Jordan doesn't like excessive logging. If necessary the
  last patch can be dropped.

Thanks,
Laszlo

Laszlo Ersek (5):
  OvmfPkg: IndustryStandard/VirtioBlk: add extra horizontal whitespace
  OvmfPkg: IndustryStandard/VirtioBlk: introduce topology-related
    definitions
  OvmfPkg/VirtioBlkDxe/VirtioBlk.c: rewrap overlong lines
  OvmfPkg: VirtioBlkInit(): expose virtio-blk topology in BlockIo
  OvmfPkg: VirtioBlkInit(): log topology attributes

 OvmfPkg/Include/IndustryStandard/VirtioBlk.h | 34 +++++++++++------
 OvmfPkg/VirtioBlkDxe/VirtioBlk.c             | 55 +++++++++++++++++++++++++---
 2 files changed, 71 insertions(+), 18 deletions(-)

-- 
1.8.3.1


------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to