OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

virtio-dev message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


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


Dear Friends,

Many thanks for your links.
I want a driver, not device.

Long back in 2013 I wrote a driver,
following Rusty's paper, "Towards a de facto standard..."
which used to fill only one descriptor chain
(the header-buffer-status chain for blk device) into available ring.
And after kick, when I get an IRQ,
I collect the data and then proceed to fill another such a request.
It felt sequential.

I read that, even before a single kick,
many such chains can be fit into available ring.
And thus getting the benefit of parallel execution of all requests.
Which is parallel.
But I couldn't do it.

And meanwhile that standard 0.95 was obsolete.
Now we have 1.0. Not sure how big the difference it brings.
So wanted to see a driver which takes benefit of parallelism.
And works with IRQ mechanism.

Say, I fill up 4 such requests and fired a single kick.
Will device interrupt me 4 times with IRQ?
I hope so...then only the benefit of parallelism comes...right?
But if so, when driver accesses used ring,
how can device use it to place the next served index?
Can there be a chance of IRQ miss?

Wanted to know about all this...


With thanks and best regards,

Yours sincerely,
Srinivas Nayak

Home: http://www.mathmeth.com/sn/
Blog: http://srinivas-nayak.blogspot.in/

On 06/08/2016 04:40 PM, Ian Campbell wrote:
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.




[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]