Bug 861345

Summary: RFE: qemu: support usb-uas (USB attached SCSI)
Product: [Community] Virtualization Tools Reporter: Gerd Hoffmann <kraxel>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED DEFERRED QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: armbru, crobinso, cwei, dyuan, jscinoz, juzhang, lcheng, mzhan, weizhan
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 917702 (view as bug list) Environment:
Last Closed: 2020-11-03 16:34:20 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Gerd Hoffmann 2012-09-28 09:35:16 UTC
(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-26 03:38:55 UTC
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 09:23:41 UTC
(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 06:16:18 UTC
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 09:20:47 UTC
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 09:41:18 UTC
usb-uas patchset sent to upstream
https://www.redhat.com/archives/libvir-list/2013-January/msg00870.html

Comment 7 Gunannan Ren 2013-01-14 09:42:02 UTC
(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 09:19:44 UTC
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 09:27:57 UTC
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 12:53:22 UTC
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 13:14:59 UTC
(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 15:21:28 UTC
bug 917702 is for usb-bot support

Comment 16 Peter Krempa 2014-07-25 08:38:08 UTC
usb-serial is already upstream:

v1.0.1-188-ge3a0445

commit e3a04455fa4b867726157ff0a35f61a045c443a3
Author: Guannan Ren <gren>
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 12:40:17 UTC
usb-audio support was added upstream:

commit e260a0e60a5abc48f27d09900ca3150130919d3f
Author: Peter Krempa <pkrempa>
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 18:35:19 UTC
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 05:05:42 UTC
Has there been any movement on this since the last comment posted in late April?

Comment 21 Cole Robinson 2016-12-09 14:05:59 UTC
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-10 03:50:51 UTC
Ah, fair enough, thank you for the update.

Comment 23 Daniel Berrangé 2020-11-03 16:34:20 UTC
Thank you for reporting this issue to the libvirt project. Unfortunately we have been unable to resolve this issue due to insufficient maintainer capacity and it will now be closed. This is not a reflection on the possible validity of the issue, merely the lack of resources to investigate and address it, for which we apologise. If you none the less feel the issue is still important, you may choose to report it again at the new project issue tracker https://gitlab.com/libvirt/libvirt/-/issues The project also welcomes contribution from anyone who believes they can provide a solution.