Re: [virtio-dev] A simple example of virtio blk driver

From
Ian Campbell <>
Date
2016-06-08T11:10:08+00:00
ID
Thread
Re: [virtio-dev] A simple example of virtio blk driver
On Wed, 2016-06-08 at 07:06 -0400, Paolo Bonzini wrote:
> > 
> > > 
> > > > 
> > > > I am studying the virtio spec 1.0 and trying to write a virtio
> > > > blk
> > > > driver.
> > > > 
> > > > Is there anywhere a simple example virtio blk driver can be
> > > > found,
> > > > which may be written with conformance to virtio spec 1.0?
> > > > I would like to understand a simple virtio blk driver, how it
> > > > is
> > > > written.
> > > > 
> > > > Better if there is any clear document available regarding a
> > > > virtio
> > > > blk driver implementation.
> > > If you want to see a minimal driver, look at the SeaBIOS
> > > src/hw/virtio-blk.c driver.  It only uses a subset of virtio-blk
> > > functionality.
> > > 
> > > https://github.com/qemu/seabios/blob/master/src/hw/virtio-blk.c
> > There's also a reasonably small/simple implementation in the
> > FreeBSD
> > bhyve stuff, e.g.
> > 
> > https://github.com/freebsd/freebsd/blob/master/usr.sbin/bhyve/pci_v
> > irtio_block.c
> This is an implementation of the device though, not the driver. :)

Oh yes, ENOTENOUGHCOFFEE.

> It's not 100% clear from Srinivas message whether he wanted a
> device or a driver.

Reading back I think he probably did mean a driver. My point about the
low level "smarts" being in common code still stands ;-)

Ian.