On Mon, Dec 10, 2012 at 1:36 PM, Kevin Wolf <kw...@redhat.com> wrote: > Hi Keith, > > Am 08.12.2012 20:20, schrieb Keith Busch: >>> IIUC from the website above, NVMe is to be used with SSDs? It would be >>> good to add to the commit message how to actually use the device >>> command-line-wise beyond the obvious -device nvme: I did not spot on >>> brief sight where you expose a bus to add drives (nor a special IF_* >>> interface type to assign to a drive), so others might wonder as well. >> >> Actually the nvme device _is_ the SSD. The emulated controller here >> creates files to use for its backing storage so you don't add >> additional drives, if that makes sense. > > I think the device would be much more useful if you could make it use > the qemu block layer instead of implementing your own functions for only > raw images and only with a given magic file name.
Quick pointers to get started on Kevin's suggestion: bdrv_aio_readv(), bdrv_aio_writev(), bdrv_aio_flush(), and bdrv_aio_discard() provide the block device operations that emulated storage controllers use. Take a look at hw/virtio-blk.c to see how to take a -device nvme,drive=<drive> (internally this is your BlockDriverState*). Stefan