Re: EHCI/xHCI port switching issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

On 23.01.2015 13:02, Adrian-Ken Rueegsegger wrote:
> Hello,
> 
> We run Linux as a VM on top of the Muen Separation Kernel [1] where we
> have implemented PCI device passthrough using VT-d.
> 
> I have come across an issue where USB ports of an assigned xHCI
> controller are no longer being enabled in recent kernels (tested with
> v3.18.3 and v3.19-rc5) while it is working in v3.11. I did a bisect and
> identified commit 26b7679 ("Intel xhci: refactor EHCI/xHCI port
> switching") as the cause. Upon closer inspection the relevant part of
> the change seems to be in drivers/usb/host/pci-quirks.c:
> 
> void usb_enable_intel_xhci_ports(struct pci_dev *xhci_pdev)
> {
> ...
>     /* make sure an intel EHCI controller exists */
>     for_each_pci_dev(companion) {
>         if (companion->class == PCI_CLASS_SERIAL_USB_EHCI &&
>             companion->vendor == PCI_VENDOR_ID_INTEL) {
>             ehci_found = true;
>             break;
>         }
>     }
> 
>     if (!ehci_found)
>         return;
> ...
> }
> 
> In our test case we only grant Linux access to the xHCI but *not* the
> EHCI controller. Since ehci_found is never true in this case the xHCI
> ports will not be enabled. Commenting out the return statement results
> in working xHCI ports.
> 
> Is there a different way to decide whether xHCI ports should be enabled
> instead of looking for a companion EHCI controller or must the xHCI and
> EHCI controllers always be accessible at the same time?
> 
> I suspect that the issue is also relevant for other hypervisors that
> allow PCI passthrough in a similar fashion.
> 

We don't really need to access the ehci for doing the portswitching.
Checking that ehci exists is a way to check if switching ports from ehci to xhci
makes sense at all. 

But we didn't consider a case like this.

I don't know what will happend if we try to write to xhci portswitching registers
on platforms with xhci only, so just removing the ehci check is a bit risky considering future platforms.

I need to ask around internally and see if we can detect the portswitching feature from
inside xhci, (digging around its pci config space before loading the driver), or if there's
any harm in always trying to do the portswitch on intel xhci controllers.

Switching the ports means your host os might lose all the ehci usb2 ports

-Mathias
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux