[PATCH v5 10/13] xhci: translate virtual addresses into the bus's address space

Peter Robinson pbrobinson at gmail.com
Mon Dec 28 23:06:14 CET 2020


On Thu, Dec 24, 2020 at 12:23 PM Nicolas Saenz Julienne
<nsaenzjulienne at suse.de> wrote:
>
> On Wed, 2020-12-23 at 19:55 +0100, Nicolas Saenz Julienne wrote:
> > So far we've been content with passing physical addresses when
> > configuring memory addresses into XHCI controllers, but not all
> > platforms have buses with transparent mappings. Specifically the
> > Raspberry Pi 4 might introduce an offset to memory accesses incoming
> > from its PCIe port.
> >
> > Introduce xhci_virt_to_bus() and xhci_bus_to_virt() to cater with these
> > limitations, and make sure we don't break non DM users.
> >
> > Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne at suse.de>
> > Reviewed-by: Simon Glass <sjg at chromium.org>
> > Reviewed-by: Stefan Roese <sr at denx.de>
> ---
>
> Upon testing this on more RPi4 variants I realized that I'm missing this:
>
> diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
> index eba2b89a88..6b31ad4398 100644
> --- a/drivers/usb/host/xhci-ring.c
> +++ b/drivers/usb/host/xhci-ring.c
> @@ -726,7 +726,7 @@ again:
>                 return -ETIMEDOUT;
>         }
>
> -       if ((uintptr_t)(le64_to_cpu(event->trans_event.buffer))
> +       if ((uintptr_t)(le64_to_cpu(xhci_bus_to_virt(ctrl, event->trans_event.buffer)))
>                         != (uintptr_t)last_transfer_trb_addr) {
>                 available_length -=
>                         (int)EVENT_TRB_LEN(le32_to_cpu(event->trans_event.transfer_len));
>
> Will update the patch on v6.

With the change above that fixes the crash that I was seeing on
various rpi4 devices. With that:
Tested-by: Peter Robinson <pbrobinson at gmail.com>


More information about the U-Boot mailing list