From: Stefan Roese Date: Fri, 15 Jan 2021 11:33:50 +0100 Subject: [PATCH] usb: xhci: Fix compare to use physical addresses in xhci_bulk_tx() In-Reply-To: <1360ac0b74a609216dcc55635ce1c147ecad67a5.camel@suse.de> References: <20210115075256.2471223-1-sr@denx.de> <1360ac0b74a609216dcc55635ce1c147ecad67a5.camel@suse.de> Message-ID: <64e5ce80-b718-de12-c4e3-52462dee0624@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 15.01.21 11:27, Nicolas Saenz Julienne wrote: > On Fri, 2021-01-15 at 08:52 +0100, Stefan Roese wrote: >> Testing with v2021.01 on MIPS Octeon has shown, that the latest patch >> for the "short packet event trb handling" did introduce a bug on >> platforms with virtual address != physical address. This patch fixes >> this issue by using the correct address types in the compare (both >> physical in this case). >> >> Signed-off-by: Stefan Roese >> Cc: Aaron Williams >> Cc: Chandrakala Chavva >> Cc: Ran Wang >> Cc: Nicolas Saenz Julienne >> Cc: Marek Vasut >> Cc: Bin Meng >> --- >> ?drivers/usb/host/xhci-ring.c | 4 ++-- >> ?1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c >> index d708fc928b..d6c47d579b 100644 >> --- a/drivers/usb/host/xhci-ring.c >> +++ b/drivers/usb/host/xhci-ring.c >> @@ -723,8 +723,8 @@ again: >> ? return -ETIMEDOUT; >> ? } >> >> >> - if ((uintptr_t)(le64_to_cpu(event->trans_event.buffer)) >> - != (uintptr_t)last_transfer_trb_addr) { >> + if ((uintptr_t)(le64_to_cpu(event->trans_event.buffer)) != >> + (uintptr_t)virt_to_phys(last_transfer_trb_addr)) { >> ? available_length -= >> ? (int)EVENT_TRB_LEN(le32_to_cpu(event->trans_event.transfer_len)); >> ? xhci_acknowledge_event(ctrl); > > FWIW I also addressed this in my Rpi400/CM4 enablement series: > https://lists.denx.de/pipermail/u-boot/2021-January/437150.html Yes, thanks. I've seen your patch and also looked into it while debugging this issue on my MIPS platform this morning. Actually I would prefer my fix, as it uses virt_to_phys() and not the other way around. Currently only virt_to_phys() is used in the USB code and not phys_to_virt(), which does not seem to work correctly on my platform BTW (as I discovered this morning). > That said, > > Reviewed-by: Nicolas Saenz Julienne Thanks, Stefan