From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=36924 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OXT9A-0006vl-7w for qemu-devel@nongnu.org; Sat, 10 Jul 2010 02:02:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OXT98-0008Gq-UN for qemu-devel@nongnu.org; Sat, 10 Jul 2010 02:02:44 -0400 Received: from fmmailgate03.web.de ([217.72.192.234]:37650) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OXT98-0008Ga-Go for qemu-devel@nongnu.org; Sat, 10 Jul 2010 02:02:42 -0400 Message-ID: <4C380CF7.1040109@web.de> Date: Sat, 10 Jul 2010 08:02:31 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <1278701410-17963-1-git-send-email-daahern@cisco.com> In-Reply-To: <1278701410-17963-1-git-send-email-daahern@cisco.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig6FDA6D7D4B2031841CC02EFA" Sender: jan.kiszka@web.de Subject: [Qemu-devel] Re: [PATCH] ehci: check controller state when setting list registers List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: David Ahern Cc: qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig6FDA6D7D4B2031841CC02EFA Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable David Ahern wrote: > A prior change prohibited change the periodic and async list registers = if > the respective list was enabled. This check should also have included > whether the controller is in the run state as well. >=20 > Additionally, added a check that the list registers have been set prior= to > using it. >=20 > With this change I can boot a linux guest with device attached at boot,= and I > can boot a linux guest from a physical USB key. e.g., >=20 > qemu-system-x86_64 -m 1024 -smp 2 -enable-kvm -usb -usbdevice host:2.4 >=20 > (A Fedora 13, 64-bit, minimal install boots in ~30 seconds from a USB k= ey!) >=20 > Windows XP is still not happy at boot time with a device attached at bo= ot > (spins on blank screen). The Vista beast is ok which suggests an issue = with > WinXP. Both of these OS access the registers with the lists enabled AND= > the controller in the run state. >=20 Thanks, applied all three patch (with minor trailing whitespace fixup in 1 and 3). They improve disk pass-through for me as well. I'm now also able to boot from some external USB disk. However, applying more heavy load, the disk stops working at some point and even disconnects after a while. The changes also modified the errors disk emulation give. I can attach and write to such images now, but reading back seems to return different data. Jan > Signed-off-by: David Ahern > --- > hw/usb-ehci.c | 27 ++++++++++++++++++--------- > 1 files changed, 18 insertions(+), 9 deletions(-) >=20 > diff --git a/hw/usb-ehci.c b/hw/usb-ehci.c > index ab9a23e..6e455a2 100644 > --- a/hw/usb-ehci.c > +++ b/hw/usb-ehci.c > @@ -778,19 +778,19 @@ static void ehci_mem_writel(void *ptr, target_phy= s_addr_t addr, uint32_t val) > break; > =20 > case PERIODICLISTBASE: > - if (s->usbcmd & USBCMD_PSE) { > - fprintf(stderr, "Guest OS should not be setting the period= ic" > - " list base register while periodic schedule is ena= bled\n"); > - return; > + if ((s->usbcmd & USBCMD_PSE) && (s->usbcmd & USBCMD_RUNSTOP)) = { > + fprintf(stderr,=20 > + "ehci: PERIODIC list base register set while periodic sc= hedule\n" > + " is enabled and HC is enabled\n"); > } > - DPRINTF("ehci_mem_writel: %s set to 0x%08X\n", str, val); > + DPRINTF("ehci_mem_writel: P-LIST BASE set to 0x%08X\n", val); > break; > =20 > case ASYNCLISTADDR: > - if (s->usbcmd & USBCMD_ASE) { > - fprintf(stderr, "Guest OS should not be setting the async = list" > - " address register while async schedule is enabled\= n"); > - return; > + if ((s->usbcmd & USBCMD_ASE) && (s->usbcmd & USBCMD_RUNSTOP)) = { > + fprintf(stderr,=20 > + "ehci: ASYNC list address register set while async sched= ule\n" > + " is enabled and HC is enabled\n"); > } > DPRINTF("ehci_mem_writel: A-LIST ADDR set to 0x%08X\n", val); > break; > @@ -1810,6 +1810,11 @@ static void ehci_advance_async_state(EHCIState *= ehci) > =20 > DPRINTF_ST("ASYNC: waiting for listhead, starting at %08x\n", > ehci->asynclistaddr); > + /* check that address register has been set */ > + if (ehci->asynclistaddr =3D=3D 0) { > + break; > + } > + > ehci->astate =3D ehci_advance_state(ehci, 1, EST_WAITLISTHEAD)= ; > break; > =20 > @@ -1853,6 +1858,10 @@ static void ehci_advance_periodic_state(EHCIStat= e *ehci) > } > =20 > list =3D ehci->periodiclistbase & 0xfffff000; > + /* check that register has been set */ > + if (list =3D=3D 0) { > + break; > + } > list |=3D ((ehci->frindex & 0x1ff8) >> 1); > =20 > cpu_physical_memory_rw(list, (uint8_t *) &entry, sizeof entry,= 0); --------------enig6FDA6D7D4B2031841CC02EFA Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iEYEARECAAYFAkw4DP4ACgkQitSsb3rl5xRIsQCgxvlkIuV8ttN6SzKdFrt2mGe+ vooAn1aIa+l3Gk4WGl/5BWfXr0OZcV+a =lH2h -----END PGP SIGNATURE----- --------------enig6FDA6D7D4B2031841CC02EFA--