Bug 861345 - RFE: qemu: support usb-uas (USB attached SCSI)
RFE: qemu: support usb-uas (USB attached SCSI)
Status: NEW
Product: Virtualization Tools
Classification: Community
Component: libvirt (Show other bugs)
unspecified
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Libvirt Maintainers
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-09-28 05:35 EDT by Gerd Hoffmann
Modified: 2016-12-09 22:50 EST (History)
10 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 917702 (view as bug list)
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Gerd Hoffmann 2012-09-28 05:35:16 EDT
(1) usb network support:

    <interface type='network'>
       [ ... ]
       <model type='usb-net'/>
       <address type='usb' ... />
    </interface>

(2) usb audio support:

    <sound model='usb-audio'>
       <address type='usb' ... />
    </sound>

(3) uas (usb attached scsi) support:

    <controller type='scsi' model='usb-uas'>
       <address type='usb' ... />
    </controller>

    Supports one scsi target with up to 256 luns.

(4) usb serial support:

    [ dunno how to do that best ]
Comment 1 Gunannan Ren 2012-12-25 22:38:55 EST
Hi Gerd

When I trid to implement usb-uas, I used qemu upstream code and following qemu commandline, the guest could boot up without any error, but using "fdisk -l" couldn't be able to have the second scsi disk printed . Did I miss something critical?

/usr/bin/qemu-system-x86_64 -enable-kvm -m 1024 -drive \
if=ide,file=/var/lib/libvirt/images/rhel6u3raw.img,format=raw \
-drive if=none,file=/var/lib/libvirt/images/seconddisk,id=uas-disk1 \
-device usb-ehci,id=ehci -device usb-uas,id=uas,bus=ehci.0 \
-device scsi-hd,bus=uas.0,scsi-id=0,lun=0,drive=uas-disk1
Comment 3 Gerd Hoffmann 2013-01-03 04:23:41 EST
(In reply to comment #1)
> Hi Gerd
> 
> When I trid to implement usb-uas, I used qemu upstream code and following
> qemu commandline, the guest could boot up without any error, but using
> "fdisk -l" couldn't be able to have the second scsi disk printed . Did I
> miss something critical?
> 
> /usr/bin/qemu-system-x86_64 -enable-kvm -m 1024 -drive \
> if=ide,file=/var/lib/libvirt/images/rhel6u3raw.img,format=raw \
> -drive if=none,file=/var/lib/libvirt/images/seconddisk,id=uas-disk1 \
> -device usb-ehci,id=ehci -device usb-uas,id=uas,bus=ehci.0 \
> -device scsi-hd,bus=uas.0,scsi-id=0,lun=0,drive=uas-disk1

command line looks fine, most likely it is just missing guest support.

seabios: With upstream/rhel7 qemu seabios should be able to see the uas disk (and thus show it in the boot menu).

linux: lsusb should show the device. Fedora has the kernel driver disabled by default though, so you must build your own kernel with CONFIG_USB_UAS=y to have it show up as scsi disk.  Same for rhel7.  rhel6 kernel is too old for uas support.

windows: win8+ reportly has uas support too.  Didn't test (yet) myself.
Comment 4 Gunannan Ren 2013-01-06 01:16:18 EST
Thanks,

I graded linux-3.7.1.tar.bz2 from kernel official website, removing the BROKEN dependency of CONFIG_USB_UAS. Finally I could set it to 'y' and installed on fedora 17 without any error.

The UAS HBA supports only one scsi target, is that right?
The scsi-id has to be set to '0' in my use

Another question is that the scsi target is supposed to support up to 256 luns. But when I set the lun number >= 9, the guest couldn't see the lun any more without any error, is this right?

-device scsi-hd,bus=uas.0,scsi-id=0,lun=0,drive=uas-disk1
Comment 5 Gerd Hoffmann 2013-01-07 04:20:47 EST
Yes, one target, scsi-id must be 0.

luns up to 255 should work, please open a bug if they don't (rhel7/qemu-kvm & assign to me).
Comment 6 Gunannan Ren 2013-01-14 04:41:18 EST
usb-uas patchset sent to upstream
https://www.redhat.com/archives/libvir-list/2013-January/msg00870.html
Comment 7 Gunannan Ren 2013-01-14 04:42:02 EST
(In reply to comment #5)
> Yes, one target, scsi-id must be 0.
> 
> luns up to 255 should work, please open a bug if they don't (rhel7/qemu-kvm
> & assign to me).

bug here:
https://bugzilla.redhat.com/show_bug.cgi?id=895002
Comment 8 hongming 2013-01-31 04:19:44 EST
Hi Gerd 

Is it possible to assign the usb host devices(4 types mentioned in the bug) to guest ? 

Thanks
Comment 9 Gerd Hoffmann 2013-01-31 04:27:57 EST
Yes.  Support for host devices has been in libvirt for quite a while, see
http://www.libvirt.org/formatdomain.html#elementsHostDev
Comment 10 Gerd Hoffmann 2013-02-20 07:53:22 EST
qemu 1.4 got a new usb device: usb-bot (basically usb-storage with a different configuration interface and multi-lun support).

See http://git.qemu.org/?p=qemu.git;a=blob;f=docs/usb-storage.txt, last paragraph.

Can you add support for that one too please?
Comment 11 Gunannan Ren 2013-02-20 08:14:59 EST
(In reply to comment #10)
> qemu 1.4 got a new usb device: usb-bot (basically usb-storage with a
> different configuration interface and multi-lun support).
> 
> See http://git.qemu.org/?p=qemu.git;a=blob;f=docs/usb-storage.txt, last
> paragraph.
> 
> Can you add support for that one too please?

okay, I will do it.
Comment 12 Gunannan Ren 2013-03-04 10:21:28 EST
bug 917702 is for usb-bot support
Comment 16 Peter Krempa 2014-07-25 04:38:08 EDT
usb-serial is already upstream:

v1.0.1-188-ge3a0445

commit e3a04455fa4b867726157ff0a35f61a045c443a3
Author: Guannan Ren <gren@redhat.com>
Date:   Sat Jan 5 13:25:36 2013 +0800

    qemu: add usb-serial support
    
    Add an optional 'type' attribute to <target> element of serial port
    device. There are two choices for its value, 'isa-serial' and
    'usb-serial'. For backward compatibility, when attribute 'type' is
    missing the 'isa-serial' will be chosen as before.
    
    Libvirt XML sample
    
        <serial type='pty'>
          <target type='usb-serial' port='0'/>
          <address type='usb' bus='0' port='1'/>
        </serial>
    
    qemu commandline:
    
    qemu ${other_vm_args}              \
        -chardev pty,id=charserial0    \
        -device usb-serial,chardev=charserial0,id=serial0,bus=usb.0,port=1
Comment 18 Peter Krempa 2014-08-08 08:40:17 EDT
usb-audio support was added upstream:

commit e260a0e60a5abc48f27d09900ca3150130919d3f
Author: Peter Krempa <pkrempa@redhat.com>
Date:   Thu Jul 24 17:32:31 2014 +0200

    conf: Add USB sound card support and implement it for qemu

v1.2.7-23-ge260a0e
Comment 19 Cole Robinson 2016-04-20 14:35:19 EDT
usb-net still isn't in libvirt, so I split out a separate bug to track it: https://bugzilla.redhat.com/show_bug.cgi?id=1328969

FWIW there's more info about usb-uas vs usb-bot in the RHEL bug referenced earlier: https://bugzilla.redhat.com/show_bug.cgi?id=917702
Comment 20 Jack Coulter 2016-12-09 00:05:42 EST
Has there been any movement on this since the last comment posted in late April?
Comment 21 Cole Robinson 2016-12-09 09:05:59 EST
No, no progress on usb-uas. I don't think it's really a priority for the core team at the moment
Comment 22 Jack Coulter 2016-12-09 22:50:51 EST
Ah, fair enough, thank you for the update.

Note You need to log in before you can comment on or make changes to this bug.