* [PATCH RESEND] xhci: also avoid the XHCI_ZERO_64B_REGS quirk with a passthrough iommu
@ 2023-03-15 18:14 D Scott Phillips
2023-03-16 9:11 ` Marc Zyngier
0 siblings, 1 reply; 3+ messages in thread
From: D Scott Phillips @ 2023-03-15 18:14 UTC (permalink / raw)
To: linux-usb; +Cc: Mathias Nyman, Greg Kroah-Hartman, Marc Zyngier, linux-kernel
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: 12de0a35c996 ("xhci: Add quirk to zero 64bit registers on Renesas PCIe controllers")
Signed-off-by: D Scott Phillips <scott@os.amperecomputing.com>
---
drivers/usb/host/xhci.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 6183ce8574b1..bdb6dd819a3b 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -9,6 +9,7 @@
*/
#include <linux/pci.h>
+#include <linux/iommu.h>
#include <linux/iopoll.h>
#include <linux/irq.h>
#include <linux/log2.h>
@@ -228,6 +229,7 @@ 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;
+ struct iommu_domain *domain;
int err, i;
u64 val;
u32 intrs;
@@ -246,7 +248,9 @@ static void xhci_zero_64b_regs(struct xhci_hcd *xhci)
* an iommu. Doing anything when there is no iommu is definitely
* unsafe...
*/
- if (!(xhci->quirks & XHCI_ZERO_64B_REGS) || !device_iommu_mapped(dev))
+ domain = iommu_get_domain_for_dev(dev);
+ if (!(xhci->quirks & XHCI_ZERO_64B_REGS) || !domain ||
+ domain->type == IOMMU_DOMAIN_IDENTITY)
return;
xhci_info(xhci, "Zeroing 64bit base registers, expecting fault\n");
--
2.39.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH RESEND] xhci: also avoid the XHCI_ZERO_64B_REGS quirk with a passthrough iommu
2023-03-15 18:14 [PATCH RESEND] xhci: also avoid the XHCI_ZERO_64B_REGS quirk with a passthrough iommu D Scott Phillips
@ 2023-03-16 9:11 ` Marc Zyngier
2023-03-17 15:18 ` Mathias Nyman
0 siblings, 1 reply; 3+ messages in thread
From: Marc Zyngier @ 2023-03-16 9:11 UTC (permalink / raw)
To: D Scott Phillips
Cc: linux-usb, Mathias Nyman, Greg Kroah-Hartman, linux-kernel
On Wed, 15 Mar 2023 18:14:40 +0000,
D Scott Phillips <scott@os.amperecomputing.com> wrote:
>
> 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: 12de0a35c996 ("xhci: Add quirk to zero 64bit registers on Renesas PCIe controllers")
> Signed-off-by: D Scott Phillips <scott@os.amperecomputing.com>
Acked-by: Marc Zyngier <maz@kernel.org>
M.
--
Without deviation from the norm, progress is not possible.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH RESEND] xhci: also avoid the XHCI_ZERO_64B_REGS quirk with a passthrough iommu
2023-03-16 9:11 ` Marc Zyngier
@ 2023-03-17 15:18 ` Mathias Nyman
0 siblings, 0 replies; 3+ messages in thread
From: Mathias Nyman @ 2023-03-17 15:18 UTC (permalink / raw)
To: Marc Zyngier, D Scott Phillips
Cc: linux-usb, Mathias Nyman, Greg Kroah-Hartman, linux-kernel
On 16.3.2023 11.11, Marc Zyngier wrote:
> On Wed, 15 Mar 2023 18:14:40 +0000,
> D Scott Phillips <scott@os.amperecomputing.com> wrote:
>>
>> 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: 12de0a35c996 ("xhci: Add quirk to zero 64bit registers on Renesas PCIe controllers")
>> Signed-off-by: D Scott Phillips <scott@os.amperecomputing.com>
>
> Acked-by: Marc Zyngier <maz@kernel.org>
>
> M.
Thanks, adding to queue
-Mathias
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-03-17 15:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-15 18:14 [PATCH RESEND] xhci: also avoid the XHCI_ZERO_64B_REGS quirk with a passthrough iommu D Scott Phillips
2023-03-16 9:11 ` Marc Zyngier
2023-03-17 15:18 ` Mathias Nyman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.