Skip to contentSkip to conversation

xhci: Remove iommu condition for Renesas PCIe controllers

PATCH RESEND In review gehao 2 participants 2 messages Nov 2, 2022

Subsystems (2)
lore
Share & tools
lore

gehao

author
#0 lore raw

PATCH RESEND 1/1 xhci: Remove iommu condition for Renesas PCIe controllers

When we use uPD720201 USB 3.0 Host Controller passthrough to VM guest os will report follow errors and it can not working.

xhci_hcd 0000:09:00.0: Host took too long to start, waited 16000 microseconds.
xhci_hcd 0000:09:00.0: startup error -19.

Renesas controllers preserve the top half of the address in internal, non visible registers,and end up with half the address coming from the kernel, and the other half coming from the firmware.

For guest os,although our dev->iommu_group = NULL,but we are still under iommu control.

This condition is not necessary,because for os with noiommu,doing anything when there is no iommu is definitely,and when our os with iommu,it is safe.

---
 drivers/usb/host/xhci.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/usb/host/xhci.c +1 -6
index 79d7931c048a..589d54ecd2a4 100644
@@ -227,7 +227,6 @@ int xhci_reset(struct xhci_hcd *xhci, u64 timeout_us)
 
 static void xhci_zero_64b_regs(struct xhci_hcd *xhci)
 {
-	struct device *dev = xhci_to_hcd(xhci)->self.sysdev;
 	int err, i;
 	u64 val;
 	u32 intrs;
@@ -241,12 +240,8 @@ static void xhci_zero_64b_regs(struct xhci_hcd *xhci)
 	 * changing the programming leads to extra accesses even if the
 	 * controller is supposed to be halted. The controller ends up with
 	 * a fatal fault, and is then ripe for being properly reset.
-	 *
-	 * Special care is taken to only apply this if the device is behind
-	 * an iommu. Doing anything when there is no iommu is definitely
-	 * unsafe...
 	 */
-	if (!(xhci->quirks & XHCI_ZERO_64B_REGS) || !device_iommu_mapped(dev))
+	if (!(xhci->quirks & XHCI_ZERO_64B_REGS))
 		return;
 
 	xhci_info(xhci, "Zeroing 64bit base registers, expecting fault\n");
Signature · 5 lines
2.25.1


No virus found
		Checked by Hillstone Network AntiVirus
maintainer
#1 lore raw
Quoted 5 lines · gehao

When we use uPD720201 USB 3.0 Host Controller passthrough to VM guest os will report follow errors and it can not working.

xhci_hcd 0000:09:00.0: Host took too long to start, waited 16000 microseconds.

No need to wrap this line.

Quoted 6 lines

xhci_hcd 0000:09:00.0: startup error -19.

Renesas controllers preserve the top half of the address in internal, non visible registers,and end up with half the address coming from the kernel, and the other half coming from the firmware.

Quoted 8 lines

For guest os,although our dev->iommu_group = NULL,but we are still under iommu control.

This condition is not necessary,because for os with noiommu,doing anything when there is no iommu is definitely,and when our os with iommu,it is safe.

I need a "full" name please, what you use to sign documents.

Also, your email fails to validate, so it looks like it was faked. Please fix your email system to properly send validated emails.

Quoted 17 lines
---
 drivers/usb/host/xhci.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/usb/host/xhci.c +0 -1
index 79d7931c048a..589d54ecd2a4 100644
@@ -227,7 +227,6 @@ int xhci_reset(struct xhci_hcd *xhci, u64 timeout_us)
 
 static void xhci_zero_64b_regs(struct xhci_hcd *xhci)
 {
-	struct device *dev = xhci_to_hcd(xhci)->self.sysdev;
 	int err, i;
 	u64 val;
 	u32 intrs;

drivers/usb/host/xhci.c static void xhci_zero_64b_regs(struct xhci_hcd *xhci) · line 244

Quoted 10 lines
drivers/usb/host/xhci.c +1 -5
@@ -241,12 +240,8 @@ static void xhci_zero_64b_regs(struct xhci_hcd *xhci)
 	 * changing the programming leads to extra accesses even if the
 	 * controller is supposed to be halted. The controller ends up with
 	 * a fatal fault, and is then ripe for being properly reset.
-	 *
-	 * Special care is taken to only apply this if the device is behind
-	 * an iommu. Doing anything when there is no iommu is definitely
-	 * unsafe...
 	 */
-	if (!(xhci->quirks & XHCI_ZERO_64B_REGS) || !device_iommu_mapped(dev))
+	if (!(xhci->quirks & XHCI_ZERO_64B_REGS))

I thought this got rejected as it will break systems. What changed from that?

thanks,

greg k-h