All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: "Gabriel L. Somlo" <gsomlo@gmail.com>, qemu-devel@nongnu.org
Cc: agraf@suse.de, edk2-devel@lists.sourceforge.net,
	kraxel@redhat.com, reza.jelveh@tuhh.de
Subject: Re: [Qemu-devel] OVMF, Q35 and USB keyboard/mouse
Date: Wed, 10 Sep 2014 02:40:55 +0200	[thread overview]
Message-ID: <540F9E17.4000706@redhat.com> (raw)
In-Reply-To: <20140909220036.GJ1675@ERROL.INI.CMU.EDU>

On 09/10/14 00:00, Gabriel L. Somlo wrote:
> Executive summary: OS X (10.9.4) works on Q35 with usb keyboard+mouse when
> booted on SeaBIOS with Chameleon , but not on OVMF [1].
> 
> [1] Recently patched acpi pm timer to boot on Q35, plus a bunch of pending
>     sata patches by Reza, cc-ed.
> 
> Command lines used to test using Fedora 20 live and OS X 10.9
> (with or without OVMF for Fedora, with OVMF or Chameleon for OS X):
> 
> bin/qemu-system-x86_64 -enable-kvm -m 2048 -machine q35 \
>   -device ide-drive,bus=ide.2,drive=CD \
>   -drive id=CD,if=none,snapshot=on,file=./Fed-Live-Desktop-x86_64-20-1.iso \
>   -usb -device usb-kbd -device usb-mouse \
>   [ -bios OVMF.fd ]
> 
> bin/qemu-system-x86_64 -enable-kvm -m 2048 -cpu core2duo -machine q35 \
>   -device isa-applesmc,osk="our...Inc" \
>   -netdev user,id=usr0 -device e1000-82545em,netdev=usr0,id=vnet0 \
>   -device ide-drive,bus=ide.2,drive=MacHDD \
>   -drive id=MacHDD,if=none,snapshot=on,file=./mac_10.9.img \
>   -usb -device usb-kbd -device usb-mouse \
>   [ -kernel ./chameleon_boot | -bios OVMF.fd ]
> 
> In all cases, we get this from "info qtree":
> 
>       dev: ich9-usb-uhci3, id ""
>         masterbus = "usb-bus.0"
>         firstport = 4 (0x4)
>         bandwidth = 1280 (0x500)
>         maxframes = 128 (0x80)
>         addr = 1d.2
>         romfile = ""
>         rombar = 1 (0x1)
>         multifunction = true
>         command_serr_enable = true
>         class USB controller, addr 00:1d.2, pci id 8086:2936 (sub 1af4:1100)
>         bar 4: i/o at 0xc0a0 [0xc0bf]
>       dev: ich9-usb-uhci2, id ""
>         masterbus = "usb-bus.0"
>         firstport = 2 (0x2)
>         bandwidth = 1280 (0x500)
>         maxframes = 128 (0x80)
>         addr = 1d.1
>         romfile = ""
>         rombar = 1 (0x1)
>         multifunction = true
>         command_serr_enable = true
>         class USB controller, addr 00:1d.1, pci id 8086:2935 (sub 1af4:1100)
>         bar 4: i/o at 0xc0c0 [0xc0df]
>       dev: ich9-usb-uhci1, id ""
>         masterbus = "usb-bus.0"
>         firstport = 0 (0x0)
>         bandwidth = 1280 (0x500)
>         maxframes = 128 (0x80)
>         addr = 1d.0
>         romfile = ""
>         rombar = 1 (0x1)
>         multifunction = true
>         command_serr_enable = true
>         class USB controller, addr 00:1d.0, pci id 8086:2934 (sub 1af4:1100)
>         bar 4: i/o at 0xc0e0 [0xc0ff]
>       dev: ich9-usb-ehci1, id ""
>         maxframes = 128 (0x80)
>         addr = 1d.7
>         romfile = ""
>         rombar = 1 (0x1)
>         multifunction = true
>         command_serr_enable = true
>         class USB controller, addr 00:1d.7, pci id 8086:293a (sub 1af4:1100)
>         bar 0: mem at 0x82021000 [0x82021fff]
>         bus: usb-bus.0
>           type usb-bus
>           dev: usb-mouse, id ""
>             port = ""
>             serial = ""
>             full-path = true
>             msos-desc = true
>             addr 0.2, port 2, speed 12, name QEMU USB Mouse, attached
>           dev: usb-kbd, id ""
>             display = ""
>             port = ""
>             serial = ""
>             full-path = true
>             msos-desc = true
>             addr 0.1, port 1, speed 12, name QEMU USB Keyboard, attached
> 
> 
> In all *working* cases (all except OSX+OVMF) the guest os (mac or linux)
> reports the keyboard and mouse as connected to ich9-usb-uhci1 (dev. id 0x2934),
> contradicting the qtree output. On linux I got this out of 'dmesg':
> 
> input: QEMU QEMU USB Keyboard as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1:1.0/input/input3
> hid-generic 0003:0627:0001.0001: input,hidraw0: USB HID v1.11 Keyboard [QEMU QEMU USB Keyboard] on usb-0000:00:1d.0-1/input0
> input: QEMU QEMU USB Mouse as /devices/pci0000:00/0000:00:1d.0/usb2/2-2/2-2:1.0/input/input4
> hid-generic 0003:0627:0001.0002: input,hidraw1: USB HID v0.01 Mouse [QEMU QEMU USB Mouse] on usb-0000:00:1d.0-2/input0
> 
> On OS X (with Chameleon), I get the same results using System Profiler.
> 
> 
> So at this point I'm wondering why guests and "info qtree" are contradictory,
> and whether the combination of OVMF and OS X tickle some qemu usb emulation
> bug differently than all other (working) combinations ?
> 
> 
> BTW, doing something like:
> 
>   -usb -device ich9-usb-uhci1,id=uhci1 -device usb-kbd,bus=uhci1.0 \
>        -device ich9-usb-uhci2,id=uhci2 -device usb-mouse,bus=uhci2.0
> 
> to completely override uhci1 and uhci2, and force the keyboard and mouse
> to connect there causes OS X to start working on OVMF.
> 
> 
> Not sure how I'd force the keyboard and mouse onto the default uhci1 and/or
> uhci2 (from the qtree perspective), since they're given empty IDs by default
> (and my qemu command line kung-fu is weak in this area).
> 
> 
> Any thoughts or comments (or tips for further debugging) much appreciated.

My take is that "MdeModulePkg/Bus/Pci/EhciDxe" does something to the
devices that trips up OSX, but doesn't trip up Linux. Try building OVMF
without this driver, and see what happens.

The following (in the driver's INF file) could be relevant:

#  Note that EhciDxe driver is enhanced to guarantee that the EHCI
#  controller get attached to the EHCI controller before the UHCI driver
#  attaches to the companion UHCI controller.  This way avoids the
#  control transfer on a shared port between EHCI and companion host
#  controller when UHCI gets attached earlier than EHCI and a USB 2.0
#  device inserts.

I think that the qtree output is correct, and the working cases work
because the guests can somehow "downgrade" the devices from 2.0 to 1.1
(or maybe 1.0, no clue). Ie. the mouse / tablet is plugged in a shared
port, and after some fiddling, UHCI wins (in the working cases). OVMF's
EHCI driver probably leaves things in such a state that OSX chokes on them.

Apologies if I just wrote a load of BS. :)

Laszlo

  reply	other threads:[~2014-09-10  0:41 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-09 22:00 [Qemu-devel] OVMF, Q35 and USB keyboard/mouse Gabriel L. Somlo
2014-09-10  0:40 ` Laszlo Ersek [this message]
2014-09-10  6:31 ` Gerd Hoffmann
2014-09-10  7:59   ` Laszlo Ersek
2014-09-10 14:06     ` Gabriel L. Somlo
2014-09-10 23:08       ` [Qemu-devel] [edk2] " Paolo Bonzini
2014-09-11 15:42         ` [Qemu-devel] " Gabriel L. Somlo
2014-09-11 15:49           ` Paolo Bonzini
2014-09-11 16:35             ` Gabriel L. Somlo
2014-09-11 16:40               ` Paolo Bonzini
2014-09-11 17:11                 ` Gabriel L. Somlo
2014-09-11 17:15                   ` [Qemu-devel] [edk2] " Paolo Bonzini
2014-09-11 20:16                 ` [Qemu-devel] " Gabriel L. Somlo
2014-09-11 20:46                   ` Laszlo Ersek
2014-09-11 21:34                     ` Alexander Graf
2014-09-11 23:21                       ` Gabriel L. Somlo
2014-09-12  9:17                         ` BALATON Zoltan
2014-09-12 17:58                           ` Gabriel L. Somlo
2014-09-12  6:46                   ` Gerd Hoffmann
2014-09-12 18:18                     ` Gabriel L. Somlo
2014-09-12 18:26                       ` Paolo Bonzini
2014-09-12 19:59                         ` Gabriel L. Somlo
2014-09-13  5:06                           ` Laszlo Ersek
2014-09-15 14:50                           ` Gabriel L. Somlo
2014-09-15 15:01                             ` Laszlo Ersek
2014-09-15 15:07                               ` Gabriel L. Somlo
2014-09-15 18:02                                 ` Laszlo Ersek
2014-09-15 19:23                                   ` Gabriel L. Somlo
2014-09-15 19:56                                     ` BALATON Zoltan
2014-09-16  8:15                                     ` Gerd Hoffmann
2014-09-21 20:00                                       ` Gabriel L. Somlo
2014-09-21 22:10                                   ` Gabriel L. Somlo
2014-09-21 22:43                                     ` Laszlo Ersek
2014-09-22 16:44                                       ` [Qemu-devel] [edk2] " Paolo Bonzini
2014-09-22 16:59                                         ` Gabriel L. Somlo
2014-09-22 20:40                                         ` Laszlo Ersek
2014-09-24 22:03                                           ` Gabriel L. Somlo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=540F9E17.4000706@redhat.com \
    --to=lersek@redhat.com \
    --cc=agraf@suse.de \
    --cc=edk2-devel@lists.sourceforge.net \
    --cc=gsomlo@gmail.com \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=reza.jelveh@tuhh.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.