[SeaBIOS] [PATCH] fix two issues with virtio-blk
Gleb Natapov
gleb at redhat.com
Thu May 13 13:00:24 CEST 2010
On Wed, May 12, 2010 at 07:25:55PM -0400, Kevin O'Connor wrote:
> 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;
>
Hmm, I guess you are right. Boot indeed fails if I configure logical
block size bigger then 512 bytes. But shouldn't BIOS emulate 512 byte
access on top of bigger block size? Future disks will use much large
logical block sizes.
--
Gleb.
More information about the SeaBIOS
mailing list