usb: xhci: Fix compare to use physical addresses in xhci_bulk_tx()
Subsystems (2)
PATCH 1/1 usb: xhci: Fix compare to use physical addresses in xhci_bulk_tx()
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).
--- drivers/usb/host/xhci-ring.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/host/xhci-ring.c +2 -2
@@ -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);
Signature · 1 line
2.30.0
PATCH 1/1 usb: xhci: Fix compare to use physical addresses in xhci_bulk_tx()
Hi Stefan,
Quoted 23 lines · Stefan Roese
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 <[email protected]>Cc Aaron Williams <[email protected]>Cc Chandrakala Chavva <[email protected]>Cc Ran Wang <[email protected]>Cc Nicolas Saenz Julienne <[email protected]>Cc Marek Vasut <[email protected]>Cc Bin Meng <[email protected]>--- drivers/usb/host/xhci-ring.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/usb/host/xhci-ring.c +0
-0
drivers/usb/host/xhci-ring.c again: · line 727
Quoted 7 lines
drivers/usb/host/xhci-ring.c +2
-2@@ -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)) {
Is last_transfer_trb_addr virtual address? I thought queue_trb() returns physical address?
drivers/usb/host/xhci-ring.c again:
Quoted 4 lines
drivers/usb/host/xhci-ring.c +0
-1available_length -= (int )EVENT_TRB_LEN (le32_to_cpu (event->trans_event.transfer_len));xhci_acknowledge_event (ctrl); --
Regards,
Bin
PATCH 1/1 usb: xhci: Fix compare to use physical addresses in xhci_bulk_tx()
Hi Bin,
Quoted 29 lines · Bin Meng
Hi Stefan,
Quoted 26 lines · Stefan Roese
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 <[email protected]>Cc Aaron Williams <[email protected]>Cc Chandrakala Chavva <[email protected]>Cc Ran Wang <[email protected]>Cc Nicolas Saenz Julienne <[email protected]>Cc Marek Vasut <[email protected]>Cc Bin Meng <[email protected]>--- drivers/usb/host/xhci-ring.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/usb/host/xhci-ring.c +0
-0@@ -723,8 +723,8 @@ again:return -ETIMEDOUT ; }
Quoted 7 lines
drivers/usb/host/xhci-ring.c again: · line 727
Quoted 4 lines
drivers/usb/host/xhci-ring.c +2
-2-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)) {Is
last_transfer_trb_addrvirtual address? I thoughtqueue_trb()returns physical address?
No, queue_trb() returns a virtual address accessible from the CPU.
Thanks,
Stefan
PATCH 1/1 usb: xhci: Fix compare to use physical addresses in xhci_bulk_tx()
In reply to Stefan RoeseQuoted 30 lines · Stefan Roese
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 <[email protected]>Cc Aaron Williams <[email protected]>Cc Chandrakala Chavva <[email protected]>Cc Ran Wang <[email protected]>Cc Nicolas Saenz Julienne <[email protected]>Cc Marek Vasut <[email protected]>Cc Bin Meng <[email protected]>---
?drivers/usb/host/xhci-ring.c | 4 ++--
?1 file changed, 2 insertions(+), 2 deletions(-)drivers/usb/host/xhci-ring.c +0
-0@@ -723,8 +723,8 @@ again: ? return -ETIMEDOUT; ? }?
drivers/usb/host/xhci-ring.c +2
-2-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)) {
Quoted 3 lines
?
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
That said,
Regards,
Nicolas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210115/521c8fae/attachment.sig>
PATCH 1/1 usb: xhci: Fix compare to use physical addresses in xhci_bulk_tx()
Quoted 27 lines · Nicolas Saenz Julienne
Quoted 26 lines · Stefan Roese
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 <[email protected]>Cc Aaron Williams <[email protected]>Cc Chandrakala Chavva <[email protected]>Cc Ran Wang <[email protected]>Cc Nicolas Saenz Julienne <[email protected]>Cc Marek Vasut <[email protected]>Cc Bin Meng <[email protected]>--- ?drivers/usb/host/xhci-ring.c | 4 ++--?1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/host/xhci-ring.c +0
-0@@ -723,8 +723,8 @@ again: ? return -ETIMEDOUT; ? }
Quoted 10 lines
Quoted 7 lines
drivers/usb/host/xhci-ring.c +2
-2-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).
Quoted 3 lines
That said,
Reviewed-by Nicolas Saenz Julienne <[email protected]>
Thanks,
Stefan
PATCH 1/1 usb: xhci: Fix compare to use physical addresses in xhci_bulk_tx()
+Matthias, just so you're aware.
Quoted 40 lines · Stefan Roese
Quoted 28 lines · Nicolas Saenz Julienne
Quoted 27 lines · Stefan Roese
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 <[email protected]>Cc Aaron Williams <[email protected]>Cc Chandrakala Chavva <[email protected]>Cc Ran Wang <[email protected]>Cc Nicolas Saenz Julienne <[email protected]>Cc Marek Vasut <[email protected]>Cc Bin Meng <[email protected]>---
??drivers/usb/host/xhci-ring.c | 4 ++--
??1 file changed, 2 insertions(+), 2 deletions(-)drivers/usb/host/xhci-ring.c +0
-0@@ -723,8 +723,8 @@ again: ?? return -ETIMEDOUT; ?? }??
Quoted 10 lines
Quoted 7 lines
drivers/usb/host/xhci-ring.c +2
-2-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
Quoted 7 lines
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 onlyvirt_to_phys()is used in the USB code and notphys_to_virt(), which does not seem to work correctly on my platform BTW (as I discovered this morning).
Fair enough, I'll rebase my series on top of this once it's picked :).
Regards,
Nicolas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210115/651a7a00/attachment.sig>
PATCH 1/1 usb: xhci: Fix compare to use physical addresses in xhci_bulk_tx()
In reply to Stefan Roese+Matthias, just so you're aware.
Quoted 40 lines · Stefan Roese
Quoted 28 lines · Nicolas Saenz Julienne
Quoted 27 lines · Stefan Roese
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 <[email protected]>Cc Aaron Williams <[email protected]>Cc Chandrakala Chavva <[email protected]>Cc Ran Wang <[email protected]>Cc Nicolas Saenz Julienne <[email protected]>Cc Marek Vasut <[email protected]>Cc Bin Meng <[email protected]>---
??drivers/usb/host/xhci-ring.c | 4 ++--
??1 file changed, 2 insertions(+), 2 deletions(-)drivers/usb/host/xhci-ring.c +0
-0@@ -723,8 +723,8 @@ again: ?? return -ETIMEDOUT; ?? }??
Quoted 10 lines
Quoted 7 lines
drivers/usb/host/xhci-ring.c +2
-2-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
Quoted 7 lines
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 onlyvirt_to_phys()is used in the USB code and notphys_to_virt(), which does not seem to work correctly on my platform BTW (as I discovered this morning).
Fair enough, I'll rebase my series on top of this once it's picked :).
Regards,
Nicolas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210115/43ec2153/attachment.sig>
PATCH 1/1 usb: xhci: Fix compare to use physical addresses in xhci_bulk_tx()
In reply to Stefan RoeseHi Marek,
Hi Bin,
Quoted 6 lines · Stefan Roese
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).
Quoted 7 lines
Signed-off-by Stefan Roese <[email protected]>Cc Aaron Williams <[email protected]>Cc Chandrakala Chavva <[email protected]>Cc Ran Wang <[email protected]>Cc Nicolas Saenz Julienne <[email protected]>Cc Marek Vasut <[email protected]>Cc Bin Meng <[email protected]>
If you see no issues with this patch, can you please pull this in soon'ish?
Thanks,
Stefan
Quoted 10 lines
--- drivers/usb/host/xhci-ring.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/usb/host/xhci-ring.c +0
-0
drivers/usb/host/xhci-ring.c again: · line 730
Quoted 10 lines
drivers/usb/host/xhci-ring.c +2
-2@@ -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);
Viele Gr??e,
Stefan
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de
Marek Vasut
AppliedPATCH 1/1 usb: xhci: Fix compare to use physical addresses in xhci_bulk_tx()
Quoted 9 lines · Stefan Roese
Hi Marek,
Hi Bin,Quoted 5 lines · Stefan Roese
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).
Applied to usb/next (that's still in the pipeline for this release), thanks.