qemu-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: USB devices on guest for virt


From: Sergey Ivanov
Subject: Re: USB devices on guest for virt
Date: Mon, 4 May 2020 15:03:32 +0300

The trouble was in kernel config due
https://bugs.launchpad.net/qemu/+bug/1790975
and pci wasn't working at all.

вт, 28 апр. 2020 г. в 12:12, Sergey Ivanov <address@hidden>:
Hi there.
I'm trying to emulate some USB devices for  "proof-of-concept" under virt machine from Ubuntu 20.04 host and via QEMU emulator version 4.2.0 (Debian 1:4.2-3ubuntu6)
and my command line is:

sudo qemu-system-arm -name QemuHU -M virt,usb=on \
 -device qemu-xhci -device usb-host,vendorid=0x0951,productid=0x1666 -device usb-mouse \
 -cpu cortex-a15 -smp cores=2 -m 256 -boot menu=on \
 -nographic -nodefaults -no-user-config \
 -kernel '$(img_kernel)' -initrd '$(img_rootfs)' \
 -append 'console=ttyAMA0,115200 rootwait root=/dev/ram0 ip=dhcp' \
 -device 'virtio-net-device,netdev=vmnic' -netdev 'user,id=vmnic,hostfwd=tcp::2222-:22' \
 -snapshot -serial mon:stdio

Here is 0x0951:0x1666 my usb stick.
But on the guest I see neither host stick nor fully emulated mouse.

The guest is a custom buildroot for "cortex a9" ARM machine
BR2_arm=y
BR2_cortex_a9=y

with next USB related linux configs:
CONFIG_USB=y
CONFIG_USB_PCI=y
CONFIG_USB_MON=m
CONFIG_USB_OTG=y
CONFIG_USB_XHCI_PCI=y
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_XHCI_MVEBU=y
CONFIG_USB_XHCI_TEGRA=m
CONFIG_USB_EHCI_HCD=y
CONFIG_HAS_DMA=y
CONFIG_HAS_IOMEM=y
CONFIG_USB_EHCI_PCI=y
...

Devices are seem to be correctly added  (from "info qtree" in monitor):
dev: gpex-pcihost, id ""
    gpio-out "sysbus-irq" 4
    mmio ffffffffffffffff/0000000020000000
    mmio ffffffffffffffff/ffffffffffffffff
    mmio 000000003eff0000/0000000000010000
    bus: pcie.0
      type PCIE
      dev: qemu-xhci, id ""
        streams = true
        p2 = 4 (0x4)"
        p3 = 4 (0x4)
        addr = 01.0
        romfile = ""
        rombar = 1 (0x1)
        multifunction = false
        command_serr_enable = true
        x-pcie-lnksta-dllla = true
        x-pcie-extcap-init = true
        failover_pair_id = ""
        class USB controller, addr 00:01.0, pci id 1b36:000d (sub 1af4:1100)
        bar 0: mem at 0xffffffffffffffff [0x3ffe]
        bus: usb-bus.0
          type usb-bus
          dev: usb-mouse, id ""
            usb_version = 2 (0x2)
            port = ""
            serial = ""
            full-path = true
            msos-desc = true
            addr 0.0, port 2, speed 480, name QEMU USB Mouse, attached
          dev: usb-host, id ""
            hostbus = 0 (0x0)
            hostaddr = 0 (0x0)
            hostport = ""
            vendorid = 2385 (0x951)
            productid = 5734 (0x1666)
            isobufs = 4 (0x4)
            isobsize = 32 (0x20)
            guest-reset = true
            guest-resets-all = false
            loglevel = 2 (0x2)
            pipeline = true
            port = ""
            serial = ""
            full-path = true
            msos-desc = true
            addr 0.0, port 1, speed 5000, name DataTraveler 3.0, attached
      dev: gpex-root, id ""
        addr = 00.0
        romfile = ""
        rombar = 1 (0x1)
        multifunction = false
        command_serr_enable = true
        x-pcie-lnksta-dllla = true
        x-pcie-extcap-init = true
        failover_pair_id = ""
        class Host bridge, addr 00:00.0, pci id 1b36:0008 (sub 1af4:1100)

I tried other USB controllers from "qemu-system-arm -M virt -device help" e.g. usb-ehci
with no luck. I also checked guest behaviour while hotplugging usb stick and found the same symptoms as in:
https://bugzilla.redhat.com/show_bug.cgi?id=980415

This is my log from libusb during plug-in back:

[13.186362] [000016f9] libusb: debug [udev_hotplug_event] udev hotplug event. action: add.
[13.186369] [000016f9] libusb: debug [linux_enumerate_device] busnum 2 devaddr 3 session_id 515
[13.186375] [000016f9] libusb: debug [linux_enumerate_device] allocating new device for 2/3 (session 515)
[13.186413] [000016f9] libusb: debug [linux_get_parent_info] Dev 0x7f8838002550 (2-5) has parent 0x55f963b7d730 (usb2) port 5
[13.186449] [000016f5] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[13.186461] [000016f5] libusb: debug [handle_events] poll() 2 fds with timeout in 0ms
[13.186469] [000016f5] libusb: debug [handle_events] poll() returned 1
[13.186475] [000016f5] libusb: debug [handle_events] caught a fish on the event pipe
[13.186480] [000016f5] libusb: debug [handle_events] hotplug message received
[13.198370] [000016f9] libusb: debug [linux_get_device_address] getting address for device: 2-5 detached: 0
[13.198394] [000016f9] libusb: debug [linux_get_device_address] scan 2-5
[13.198447] [000016f9] libusb: debug [linux_get_device_address] bus=2 dev=3
[13.198455] [000016f9] libusb: debug [udev_hotplug_event] udev hotplug event. action: bind.
[13.198459] [000016f9] libusb: error [udev_hotplug_event] ignoring udev action bind


Could you please help me to spot the error: is it buildroot configuration related or qemu one?
--
Kind regards,
Sergey Ivanov


--
Kind regards,
Sergey Ivanov

reply via email to

[Prev in Thread] Current Thread [Next in Thread]