From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54831) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XRcof-0006NH-Fi for qemu-devel@nongnu.org; Wed, 10 Sep 2014 03:59:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XRcoZ-0006ZW-B2 for qemu-devel@nongnu.org; Wed, 10 Sep 2014 03:59:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36231) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XRcoZ-0006ZQ-2i for qemu-devel@nongnu.org; Wed, 10 Sep 2014 03:59:43 -0400 Message-ID: <541004DF.30405@redhat.com> Date: Wed, 10 Sep 2014 09:59:27 +0200 From: Laszlo Ersek MIME-Version: 1.0 References: <20140909220036.GJ1675@ERROL.INI.CMU.EDU> <1410330668.3389.11.camel@nilsson.home.kraxel.org> In-Reply-To: <1410330668.3389.11.camel@nilsson.home.kraxel.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] OVMF, Q35 and USB keyboard/mouse List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann , "Gabriel L. Somlo" Cc: agraf@suse.de, edk2-devel@lists.sourceforge.net, qemu-devel@nongnu.org, reza.jelveh@tuhh.de On 09/10/14 08:31, Gerd Hoffmann wrote: > Hi, > >> 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 ? > > It's due to the way how usb1 compatibility was implemented when ehci was > introduced ... > > Each usb 2.0 port is linked to both uhci and ehci controller. ehci > controls the port routing (i.e. whenever a device shows up @ uhci or > ehci). There is one global bit and one per-port bit which control the > routing. Is "4.2.1 Port Routing Control via EHCI Configured (CF) Bit" related? The Configured Flag (CF) is the global one apparently, and the Port Owner bit is per port. In "MdeModulePkg/Bus/Pci/EhciDxe/", the CF flag seems to be called CONFIGFLAG_ROUTE_EHC, and Port Owner is PORTSC_OWNER. > The global bit says whenever the ports should be routed to ehci by > default or not. EHCI driver software is supposed to flip that bit at > initialization time to get all devices routed to ehci. Power-on default > is route everything to uhci, so if the OS knows nothing about ehci all > usb devices will show up on the uhci companion. > > The per-port bit should be flipped by the ehci driver for usb1 devices, > so they are handed over to uhci as ehci supports usb2 devices only. > > > In qemu this is implemented by having ehci managing the usb bus and uhci > registering its ports as companion ports. ehci emulation will either > handle the devices itself or call uhci, depending on how the guest has > configured the routing. > > There is even a basic test case for that: tests/usb-hcd-ehci-test.c > > Because ehci manages the bus the usb devices show up on ehci in 'info > qtree', no matter how the port routing is configured. > >> 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). > > Pure uhci working fine hints it most likely is a bug somewhere in the > port routing code. Could be in ovmf, but could be qemu too. You can't > force it from outsize, port routing is guest business. > > What happens if you build ovmf with uhci but without ehci driver? Does > that work? I'm glad I happened to suggest the same. ;) Laszlo