Skip to content

Commit ecaa490

Browse files
D Scott Phillipsgregkh
authored andcommitted
xhci: also avoid the XHCI_ZERO_64B_REGS quirk with a passthrough iommu
Previously the quirk was skipped when no iommu was present. The same rationale for skipping the quirk also applies in the iommu.passthrough=1 case. Skip applying the XHCI_ZERO_64B_REGS quirk if the device's iommu domain is passthrough. Fixes: 12de0a3 ("xhci: Add quirk to zero 64bit registers on Renesas PCIe controllers") Cc: stable <[email protected]> Signed-off-by: D Scott Phillips <[email protected]> Acked-by: Marc Zyngier <[email protected]> Signed-off-by: Mathias Nyman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 4c7f9d2 commit ecaa490

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/usb/host/xhci.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*/
1010

1111
#include <linux/pci.h>
12+
#include <linux/iommu.h>
1213
#include <linux/iopoll.h>
1314
#include <linux/irq.h>
1415
#include <linux/log2.h>
@@ -228,6 +229,7 @@ int xhci_reset(struct xhci_hcd *xhci, u64 timeout_us)
228229
static void xhci_zero_64b_regs(struct xhci_hcd *xhci)
229230
{
230231
struct device *dev = xhci_to_hcd(xhci)->self.sysdev;
232+
struct iommu_domain *domain;
231233
int err, i;
232234
u64 val;
233235
u32 intrs;
@@ -246,7 +248,9 @@ static void xhci_zero_64b_regs(struct xhci_hcd *xhci)
246248
* an iommu. Doing anything when there is no iommu is definitely
247249
* unsafe...
248250
*/
249-
if (!(xhci->quirks & XHCI_ZERO_64B_REGS) || !device_iommu_mapped(dev))
251+
domain = iommu_get_domain_for_dev(dev);
252+
if (!(xhci->quirks & XHCI_ZERO_64B_REGS) || !domain ||
253+
domain->type == IOMMU_DOMAIN_IDENTITY)
250254
return;
251255

252256
xhci_info(xhci, "Zeroing 64bit base registers, expecting fault\n");

0 commit comments

Comments
 (0)