[CFT] VirtIO SCSI Driver

Bryan Venteicher bryanv at daemoninthecloset.org
Tue Jun 19 07:50:12 UTC 2012


Hi,

----- Original Message -----
> From: "Bryan Venteicher" <bryanv at daemoninthecloset.org>
> To: freebsd-scsi at freebsd.org
> Cc: freebsd-virtualization at freebsd.org
> Sent: Friday, June 8, 2012 1:29:18 AM
> Subject: [CFT] VirtIO SCSI Driver
> 
> Hi,
> 
> VirtIO SCSI is a virtualized HBA that offers a couple of advantages
> over the existing VirtIO block disk devices. Instead of having a
> vtbdX disk, familiar daX and cdX devices are created like from other
> SCSI drivers. A single HBA is able to support multiple devices unlike
> the VirtIO block where there is one disk per PCI device. And SCSI
> devices from the host are able to be passthrough to the guest.
> 

A second patch is available at:
  www.daemoninthecloset.org/~bryanv/patches/freebsd/freebsd_virtio_scsi_2.patch 

Most of the changes are just cleanup; the only noteworthy fix is that
CAM_SCSI_STATUS_ERROR is now reported correctly. With a QEMU patch
provided by the VirtIO SCSI author, bus reset now works. I hope the
patch is committed soon upstream to QEMU.

As I mentioned in my previous email, you need a QEMU with VirtIO SCSI
support. You can check if your QEMU has the support by:
    $ qemu -device ?

and looking for a line like:
     name "virtio-scsi-pci", bus PCI

VirtIO SCSI should be supported by QEMU 1.1 or later. If your
distribution does not provide a new enough QEMU, you'll need to compile
from source.

You'll then need to have QEMU create a VirtIO SCSI disk for the guest.
The CLI sugar to do this is a bit ugly, but will look like:

    -drive file=/vm_images/vtscsi-2.img,if=none,id=drive-scsi0-0-0 \
    -device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x6 \
    -device scsi-disk,bus=scsi0.0,scsi-id=0,drive=drive-scsi0-0-0,id=scsi0-0-0 

AFAIK, this really isn't documented anywhere (the QEMU man page isn't at
all helpful) and took a bit of guessing when I was first getting started
with it.

Bryan

> 
> Should apply cleanly to any recent -current, and probably to a
> -stable
> with minimal work.
> 


More information about the freebsd-virtualization mailing list