Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 19 Sep 2020 14:18:03 -0700
From:      Mark Millard <marklmi@yahoo.com>
To:        Hans Petter Selasky <hps@selasky.org>
Cc:        freebsd-arm <freebsd-arm@freebsd.org>
Subject:   Re: Comment #135 for bugzilla 237666 : a USB3-handling problem with a investigatory fix for a cortex-a72 context
Message-ID:  <8BAF3798-4BB4-4C5E-87FC-ECD1458910A2@yahoo.com>
In-Reply-To: <47D6CA1E-F842-47B6-97E0-C87B33610C64@yahoo.com>
References:  <6E618C3D-12DF-429E-A249-5BAB90FC6B15.ref@yahoo.com> <6E618C3D-12DF-429E-A249-5BAB90FC6B15@yahoo.com> <866bd652-5a8b-7500-b1e0-7528c035048b@selasky.org> <F9E8A6A0-619B-4C6F-8485-032B8358B780@yahoo.com> <578faf26-6042-91ec-c639-2bca17105fae@selasky.org> <723E6915-94F5-417C-B4AF-EEEBFBDF6162@yahoo.com> <565258A0-BEE1-48F8-9851-E6C7CF7ADAE7@yahoo.com> <D28FEE99-A2CA-484E-A5E9-312334CF3FE3@yahoo.com> <75af04ec-0021-3575-40bf-c5ab9b6d4703@selasky.org> <CE9D7856-0179-4C9B-8367-AFBD8EAD4CC2@yahoo.com> <9cf87718-9d4a-60ca-004f-5818371c937b@selasky.org> <47D6CA1E-F842-47B6-97E0-C87B33610C64@yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2020-Sep-19, at 13:54, Mark Millard <marklmi at yahoo.com> wrote:

. . .
>=20
> As stands, in my head -r363590 based context, the patch set for this
> overall currently looks like (up to E-mail variability in spaces):
>=20
> # svnlite diff /usr/src/sys/dev/usb/usb_busdma.c =
/usr/src/sys/dev/usb/controller/xhci.c
> Index: /usr/src/sys/dev/usb/usb_busdma.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- /usr/src/sys/dev/usb/usb_busdma.c	(revision 363590)
> +++ /usr/src/sys/dev/usb/usb_busdma.c	(working copy)
> @@ -737,6 +737,9 @@
> 	 */
> 	bus_dmamap_sync(pc->tag, pc->map, BUS_DMASYNC_POSTREAD);
> 	bus_dmamap_sync(pc->tag, pc->map, BUS_DMASYNC_PREREAD);
> +#ifdef __aarch64__
> +__asm __volatile("dsb ld" : : : "memory");
> +#endif
> }
>=20
> =
/*------------------------------------------------------------------------=
*
> @@ -750,6 +753,9 @@
> 		return;
> 	}
> 	bus_dmamap_sync(pc->tag, pc->map, BUS_DMASYNC_PREWRITE);
> +#ifdef __aarch64__
> +__asm __volatile("dsb st" : : : "memory");
> +#endif
> }
>=20

Looking at the lower level code it looked like DSB SY is used for
the above two automatically and it should be a valid sustitute
for DSB ST and DSB LD, even if overkill. So I'm testing with
dev/usb/usb_busdma.c reverted. (See later below.)

> =
/*------------------------------------------------------------------------=
*
> Index: /usr/src/sys/dev/usb/controller/xhci.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- /usr/src/sys/dev/usb/controller/xhci.c	(revision 363590)
> +++ /usr/src/sys/dev/usb/controller/xhci.c	(working copy)
> @@ -431,6 +431,7 @@
>=20
> 	phwr->hwr_ring_seg[0].qwEvrsTablePtr =3D htole64(addr);
> 	phwr->hwr_ring_seg[0].dwEvrsTableSize =3D =
htole32(XHCI_MAX_EVENTS);
> +	usb_bus_mem_flush_all(&sc->sc_bus, &xhci_iterate_hw_softc);
>=20
> 	DPRINTF("ERDP(0)=3D0x%016llx\n", (unsigned long long)addr);
>=20
>=20

The test booted just fine, no "Resetting controller" notices or the
like. So now I have just:

# svnlite diff /usr/src/sys/dev/usb/controller/xhci.c
Index: /usr/src/sys/dev/usb/controller/xhci.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- /usr/src/sys/dev/usb/controller/xhci.c	(revision 363590)
+++ /usr/src/sys/dev/usb/controller/xhci.c	(working copy)
@@ -431,6 +431,7 @@
=20
 	phwr->hwr_ring_seg[0].qwEvrsTablePtr =3D htole64(addr);
 	phwr->hwr_ring_seg[0].dwEvrsTableSize =3D =
htole32(XHCI_MAX_EVENTS);
+	usb_bus_mem_flush_all(&sc->sc_bus, &xhci_iterate_hw_softc);
=20
 	DPRINTF("ERDP(0)=3D0x%016llx\n", (unsigned long long)addr);
=20

for the issue. (So my earlier powerpc* SYNC comments are likely junk.)

=3D=3D=3D
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8BAF3798-4BB4-4C5E-87FC-ECD1458910A2>