[SeaBIOS] [PATCH] fix two issues with virtio-blk

Kevin O'Connor kevin at koconnor.net
Thu May 13 01:25:55 CEST 2010


On Tue, May 11, 2010 at 03:21:09PM +0300, Gleb Natapov wrote:
> 1. Check if blk_size is valid in virtio_blk config.
> 2. Disable interrupt otherwise interrupt may stuck
>    with some guests.
> 
> Signed-off-by: Gleb Natapov <gleb at redhat.com>
> diff --git a/src/virtio-blk.c b/src/virtio-blk.c
> index 6c3f8a5..96334b1 100644
> --- a/src/virtio-blk.c
> +++ b/src/virtio-blk.c
> @@ -138,7 +138,9 @@ virtio_blk_setup(void)
>          struct virtio_blk_config cfg;
>          vp_get(ioaddr, 0, &cfg, sizeof(cfg));
>  
> -        vdrive_g->drive.blksize = cfg.blk_size;
> +        u32 f = vp_get_features(ioaddr);
> +        vdrive_g->drive.blksize = (f & (1 << VIRTIO_BLK_F_BLK_SIZE)) ?
> +            cfg.blk_size : DISK_SECTOR_SIZE;

The blksize needs to be 512, because the BIOS interface that virtio
binds to requires 512 byte sectors.  Shouldn't this look something
like:

          if (cfg.blk_size != DISK_SECTOR_SIZE)
              goto fail;
          vdrive_g->drive.blksize = DISK_SECTOR_SIZE;

-Kevin



More information about the SeaBIOS mailing list