Skip to contentSkip to conversation

usb: mtk-xhci: Set the XHCI_NO_64BIT_SUPPORT quirk

PATCH In review Tomasz Figa 3 participants 12 messages Oct 10, 2019 – Nov 7, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: mtk-xhci: Set the XHCI_NO_64BIT_SUPPORT quirk

MediaTek XHCI host controller does not support 64-bit addressing despite the AC64 bit of HCCPARAMS1 register being set. The platform-specific glue sets the DMA mask to 32 bits on its own, but it has no effect, because xhci_gen_setup() overrides it according to hardware capabilities.

Use the XHCI_NO_64BIT_SUPPORT quirk to tell the XHCI core to force 32-bit DMA mask instead.

---
 drivers/usb/host/xhci-mtk.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/usb/host/xhci-mtk.c +5 -5
index b18a6baef204a..4d101d52cc11b 100644
@@ -395,6 +395,11 @@ static void xhci_mtk_quirks(struct device *dev, struct xhci_hcd *xhci)
 	xhci->quirks |= XHCI_SPURIOUS_SUCCESS;
 	if (mtk->lpm_support)
 		xhci->quirks |= XHCI_LPM_SUPPORT;
+	/*
+	 * MTK host controller does not support 64-bit addressing, despite
+	 * having the AC64 bit of the HCCPARAMS1 register set.
+	 */
+	xhci->quirks |= XHCI_NO_64BIT_SUPPORT;
 }
 
 /* called during probe() after chip reset completes */
@@ -488,11 +493,6 @@ static int xhci_mtk_probe(struct platform_device *pdev)
 		goto disable_clk;
 	}
 
-	/* Initialize dma_mask and coherent_dma_mask to 32-bits */
-	ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32));
-	if (ret)
-		goto disable_clk;
-
 	hcd = usb_create_hcd(driver, dev, dev_name(dev));
 	if (!hcd) {
 		ret = -ENOMEM;
Signature · 1 line
2.23.0.581.g78d2f28ef7-goog
maintainer
#1 lore raw

Hi, Tomasz,

Quoted 19 lines · Tomasz Figa

MediaTek XHCI host controller does not support 64-bit addressing despite the AC64 bit of HCCPARAMS1 register being set. The platform-specific glue sets the DMA mask to 32 bits on its own, but it has no effect, because xhci_gen_setup() overrides it according to hardware capabilities.

Use the XHCI_NO_64BIT_SUPPORT quirk to tell the XHCI core to force 32-bit DMA mask instead.

---
 drivers/usb/host/xhci-mtk.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/usb/host/xhci-mtk.c +0 -0
index b18a6baef204a..4d101d52cc11b 100644

drivers/usb/host/xhci-mtk.c static void xhci_mtk_quirks(struct device *dev, struct xhci_hcd *xhci) · line 402

Quoted 8 lines
drivers/usb/host/xhci-mtk.c +5 -0
@@ -395,6 +395,11 @@ static void xhci_mtk_quirks(struct device *dev, struct xhci_hcd *xhci)
 	xhci->quirks |= XHCI_SPURIOUS_SUCCESS;
 	if (mtk->lpm_support)
 		xhci->quirks |= XHCI_LPM_SUPPORT;
+	/*
+	 * MTK host controller does not support 64-bit addressing, despite
+	 * having the AC64 bit of the HCCPARAMS1 register set.
+	 */
+	xhci->quirks |= XHCI_NO_64BIT_SUPPORT;

Somes SoCs support 64bits in fact, so can't support this quirk, do you encounter any issues without this quirk?

Quoted 16 lines
drivers/usb/host/xhci-mtk.c +0 -0
 }
 
 

/* called during probe() after chip reset completes */

drivers/usb/host/xhci-mtk.c +0 -5
@@ -488,11 +493,6 @@ static int xhci_mtk_probe(struct platform_device *pdev)
 		goto disable_clk;
 	}
 
-	/* Initialize dma_mask and coherent_dma_mask to 32-bits */
-	ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32));
-	if (ret)
-		goto disable_clk;
-
 	hcd = usb_create_hcd(driver, dev, dev_name(dev));
 	if (!hcd) {
 		ret = -ENOMEM;
#2 lore raw

Hi Chunfeng,

Quoted 18 lines · Chunfeng Yun

Hi, Tomasz,

Quoted 14 lines · Tomasz Figa

MediaTek XHCI host controller does not support 64-bit addressing despite the AC64 bit of HCCPARAMS1 register being set. The platform-specific glue sets the DMA mask to 32 bits on its own, but it has no effect, because xhci_gen_setup() overrides it according to hardware capabilities.

Use the XHCI_NO_64BIT_SUPPORT quirk to tell the XHCI core to force 32-bit DMA mask instead.

---
 drivers/usb/host/xhci-mtk.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
Quoted 16 lines

drivers/usb/host/xhci-mtk.c static void xhci_mtk_quirks(struct device *dev, struct xhci_hcd *xhci) · line 402

Quoted 13 lines
drivers/usb/host/xhci-mtk.c +5 -0
index b18a6baef204a..4d101d52cc11b 100644
@@ -395,6 +395,11 @@ static void xhci_mtk_quirks(struct device *dev, struct xhci_hcd *xhci)
      xhci->quirks |= XHCI_SPURIOUS_SUCCESS;
      if (mtk->lpm_support)
              xhci->quirks |= XHCI_LPM_SUPPORT;
+     /*
+      * MTK host controller does not support 64-bit addressing, despite
+      * having the AC64 bit of the HCCPARAMS1 register set.
+      */
+     xhci->quirks |= XHCI_NO_64BIT_SUPPORT;

Somes SoCs support 64bits in fact, so can't support this quirk, do you encounter any issues without this quirk?

Thanks for taking a look at this patch.

Yes, on MT8183 the DMA mask ended up being set to 64 bits, but according to the information I received from MediaTek, the controller on that SoC only supports 32 bits.

If some SoCs support only 32 bits and some support 64 bits, we may either need to use different DT compatible string for them or add a DT property and set the quirk based on that. Right now in upstream we have:

1) "mediatek,mt8173-xhci", used by:
MT8173

2)"mediatek,mtk-xhci", used by:
MT2712
MT7622
MT8183 (not yet upstream, but I suppose it's on the mailing lists)

Would you be able to check which of the SoCs above report 64 bits but support only 32? (and so would need this quirk)

Best regards,
Tomasz

Quoted 18 lines
Quoted 16 lines
drivers/usb/host/xhci-mtk.c +0 -0
 }
 
 

/* called during probe() after chip reset completes */

drivers/usb/host/xhci-mtk.c +0 -5
@@ -488,11 +493,6 @@ static int xhci_mtk_probe(struct platform_device *pdev)
              goto disable_clk;
      }
 
-     /* Initialize dma_mask and coherent_dma_mask to 32-bits */
-     ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32));
-     if (ret)
-             goto disable_clk;
-
      hcd = usb_create_hcd(driver, dev, dev_name(dev));
      if (!hcd) {
              ret = -ENOMEM;
maintainer
#3 lore raw
Quoted 12 lines · Tomasz Figa

Hi Chunfeng,

Quoted 9 lines · Chunfeng Yun

Hi, Tomasz,

Quoted 5 lines · Tomasz Figa

MediaTek XHCI host controller does not support 64-bit addressing despite the AC64 bit of HCCPARAMS1 register being set. The platform-specific glue sets the DMA mask to 32 bits on its own, but it has no effect, because xhci_gen_setup() overrides it according to hardware capabilities.

Yes, this is what I want to do, maybe need remove DMA mask setting in platform-specific.

Quoted 26 lines
Quoted 9 lines
Quoted 9 lines

Use the XHCI_NO_64BIT_SUPPORT quirk to tell the XHCI core to force 32-bit DMA mask instead.

---
 drivers/usb/host/xhci-mtk.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
Quoted 16 lines

drivers/usb/host/xhci-mtk.c static void xhci_mtk_quirks(struct device *dev, struct xhci_hcd *xhci) · line 402

Quoted 13 lines
drivers/usb/host/xhci-mtk.c +5 -0
index b18a6baef204a..4d101d52cc11b 100644
@@ -395,6 +395,11 @@ static void xhci_mtk_quirks(struct device *dev, struct xhci_hcd *xhci)
      xhci->quirks |= XHCI_SPURIOUS_SUCCESS;
      if (mtk->lpm_support)
              xhci->quirks |= XHCI_LPM_SUPPORT;
+     /*
+      * MTK host controller does not support 64-bit addressing, despite
+      * having the AC64 bit of the HCCPARAMS1 register set.
+      */
+     xhci->quirks |= XHCI_NO_64BIT_SUPPORT;

Somes SoCs support 64bits in fact, so can't support this quirk, do you encounter any issues without this quirk?

Quoted 5 lines

Thanks for taking a look at this patch.

Yes, on MT8183 the DMA mask ended up being set to 64 bits, but according to the information I received from MediaTek, the controller on that SoC only supports 32 bits.

As I know, mt8183 doesn't support memory greater than 4G mode.

Quoted 9 lines

If some SoCs support only 32 bits and some support 64 bits, we may either need to use different DT compatible string for them or add a DT property and set the quirk based on that. Right now in upstream we have:

1) "mediatek,mt8173-xhci", used by:
MT8173

Quoted 7 lines

2)"mediatek,mtk-xhci", used by:
MT2712
MT7622
MT8183 (not yet upstream, but I suppose it's on the mailing lists)

Would you be able to check which of the SoCs above report 64 bits but support only 32? (and so would need this quirk)

I'm afraid I can't, almost all MTK SoCs supporting xHCI are using this driver, AC64 should be set rightly according to addressing capability.

Quoted 22 lines

Best regards,
Tomasz

Quoted 18 lines
Quoted 16 lines
drivers/usb/host/xhci-mtk.c +0 -0
 }
 
 

/* called during probe() after chip reset completes */

drivers/usb/host/xhci-mtk.c +0 -5
@@ -488,11 +493,6 @@ static int xhci_mtk_probe(struct platform_device *pdev)
              goto disable_clk;
      }
 
-     /* Initialize dma_mask and coherent_dma_mask to 32-bits */
-     ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32));
-     if (ret)
-             goto disable_clk;
-
      hcd = usb_create_hcd(driver, dev, dev_name(dev));
      if (!hcd) {
              ret = -ENOMEM;
#4 lore raw
Quoted 43 lines · Chunfeng Yun
Quoted 12 lines · Tomasz Figa

Hi Chunfeng,

Quoted 9 lines · Chunfeng Yun

Hi, Tomasz,

Quoted 5 lines · Tomasz Figa

MediaTek XHCI host controller does not support 64-bit addressing despite the AC64 bit of HCCPARAMS1 register being set. The platform-specific glue sets the DMA mask to 32 bits on its own, but it has no effect, because xhci_gen_setup() overrides it according to hardware capabilities.

Yes, this is what I want to do, maybe need remove DMA mask setting in platform-specific.

Quoted 26 lines
Quoted 25 lines
Quoted 14 lines

Use the XHCI_NO_64BIT_SUPPORT quirk to tell the XHCI core to force 32-bit DMA mask instead.

---
 drivers/usb/host/xhci-mtk.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/usb/host/xhci-mtk.c +0 -0
index b18a6baef204a..4d101d52cc11b 100644

drivers/usb/host/xhci-mtk.c static void xhci_mtk_quirks(struct device *dev, struct xhci_hcd *xhci) · line 402

Quoted 8 lines
drivers/usb/host/xhci-mtk.c +5 -0
@@ -395,6 +395,11 @@ static void xhci_mtk_quirks(struct device *dev, struct xhci_hcd *xhci)
      xhci->quirks |= XHCI_SPURIOUS_SUCCESS;
      if (mtk->lpm_support)
              xhci->quirks |= XHCI_LPM_SUPPORT;
+     /*
+      * MTK host controller does not support 64-bit addressing, despite
+      * having the AC64 bit of the HCCPARAMS1 register set.
+      */
+     xhci->quirks |= XHCI_NO_64BIT_SUPPORT;

Somes SoCs support 64bits in fact, so can't support this quirk, do you encounter any issues without this quirk?

Quoted 7 lines
Quoted 5 lines

Thanks for taking a look at this patch.

Yes, on MT8183 the DMA mask ended up being set to 64 bits, but according to the information I received from MediaTek, the controller on that SoC only supports 32 bits.

As I know, mt8183 doesn't support memory greater than 4G mode.

We have 4GB of DRAM at 0x40000000-0x140000000 on our board with MT8183. What happens if you attempt to use the memory from 0x100000000-0x140000000 with the XHCI controller on this SoC?

Quoted 14 lines
Quoted 14 lines

If some SoCs support only 32 bits and some support 64 bits, we may either need to use different DT compatible string for them or add a DT property and set the quirk based on that. Right now in upstream we have:

1) "mediatek,mt8173-xhci", used by:
MT8173

2)"mediatek,mtk-xhci", used by:
MT2712
MT7622
MT8183 (not yet upstream, but I suppose it's on the mailing lists)

Quoted 5 lines
Quoted 2 lines

Would you be able to check which of the SoCs above report 64 bits but support only 32? (and so would need this quirk)

I'm afraid I can't, almost all MTK SoCs supporting xHCI are using this driver, AC64 should be set rightly according to addressing capability.

Does it mean that only MT8183 may be the only SoC with a problem with this capability bit?

Matthias, do you have access to MT2712 and MT7622 devices? I have MT8173 and MT8183, so I can check them, but would be good to check this on the other ones too.

Best regards,
Tomasz

maintainer
#5 lore raw
Quoted 49 lines · Tomasz Figa
Quoted 48 lines · Chunfeng Yun
Quoted 12 lines · Tomasz Figa

Hi Chunfeng,

Quoted 9 lines · Chunfeng Yun

Hi, Tomasz,

Quoted 5 lines · Tomasz Figa

MediaTek XHCI host controller does not support 64-bit addressing despite the AC64 bit of HCCPARAMS1 register being set. The platform-specific glue sets the DMA mask to 32 bits on its own, but it has no effect, because xhci_gen_setup() overrides it according to hardware capabilities.

Yes, this is what I want to do, maybe need remove DMA mask setting in platform-specific.

Quoted 31 lines
Quoted 9 lines
Quoted 9 lines

Use the XHCI_NO_64BIT_SUPPORT quirk to tell the XHCI core to force 32-bit DMA mask instead.

---
 drivers/usb/host/xhci-mtk.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
Quoted 16 lines

drivers/usb/host/xhci-mtk.c static void xhci_mtk_quirks(struct device *dev, struct xhci_hcd *xhci) · line 402

Quoted 13 lines
drivers/usb/host/xhci-mtk.c +5 -0
index b18a6baef204a..4d101d52cc11b 100644
@@ -395,6 +395,11 @@ static void xhci_mtk_quirks(struct device *dev, struct xhci_hcd *xhci)
      xhci->quirks |= XHCI_SPURIOUS_SUCCESS;
      if (mtk->lpm_support)
              xhci->quirks |= XHCI_LPM_SUPPORT;
+     /*
+      * MTK host controller does not support 64-bit addressing, despite
+      * having the AC64 bit of the HCCPARAMS1 register set.
+      */
+     xhci->quirks |= XHCI_NO_64BIT_SUPPORT;

Somes SoCs support 64bits in fact, so can't support this quirk, do you encounter any issues without this quirk?

Thanks for taking a look at this patch.

Yes, on MT8183 the DMA mask ended up being set to 64 bits, but according to the information I received from MediaTek, the controller on that SoC only supports 32 bits.

Quoted 6 lines
Quoted 2 lines

As I know, mt8183 doesn't support memory greater than 4G mode.

We have 4GB of DRAM at 0x40000000-0x140000000 on our board with MT8183. What happens if you attempt to use the memory from 0x100000000-0x140000000 with the XHCI controller on this SoC?

Ok, I'll contact USB SA of MT8183, and discuss this problem. I guess MT8183 don't plan to support 4G mode when kick off.

Quoted 15 lines
Quoted 15 lines
Quoted 15 lines

If some SoCs support only 32 bits and some support 64 bits, we may either need to use different DT compatible string for them or add a DT property and set the quirk based on that. Right now in upstream we have:

1) "mediatek,mt8173-xhci", used by:
MT8173

2)"mediatek,mtk-xhci", used by:
MT2712
MT7622
MT8183 (not yet upstream, but I suppose it's on the mailing lists)

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Would you be able to check which of the SoCs above report 64 bits but support only 32? (and so would need this quirk)

I'm afraid I can't, almost all MTK SoCs supporting xHCI are using this driver, AC64 should be set rightly according to addressing capability.

Does it mean that only MT8183 may be the only SoC with a problem with this capability bit?

Maybe, I'll check it with USB DE.

Thanks

Quoted 7 lines

Matthias, do you have access to MT2712 and MT7622 devices? I have MT8173 and MT8183, so I can check them, but would be good to check this on the other ones too.

Best regards,
Tomasz

maintainer
#6 lore raw
In reply to Tomasz Figa

Hi Tomasz,

Quoted 49 lines · Tomasz Figa
Quoted 48 lines · Chunfeng Yun
Quoted 12 lines · Tomasz Figa

Hi Chunfeng,

Quoted 9 lines · Chunfeng Yun

Hi, Tomasz,

Quoted 5 lines · Tomasz Figa

MediaTek XHCI host controller does not support 64-bit addressing despite the AC64 bit of HCCPARAMS1 register being set. The platform-specific glue sets the DMA mask to 32 bits on its own, but it has no effect, because xhci_gen_setup() overrides it according to hardware capabilities.

Yes, this is what I want to do, maybe need remove DMA mask setting in platform-specific.

Quoted 31 lines
Quoted 9 lines
Quoted 9 lines

Use the XHCI_NO_64BIT_SUPPORT quirk to tell the XHCI core to force 32-bit DMA mask instead.

---
 drivers/usb/host/xhci-mtk.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
Quoted 16 lines

drivers/usb/host/xhci-mtk.c static void xhci_mtk_quirks(struct device *dev, struct xhci_hcd *xhci) · line 402

Quoted 13 lines
drivers/usb/host/xhci-mtk.c +5 -0
index b18a6baef204a..4d101d52cc11b 100644
@@ -395,6 +395,11 @@ static void xhci_mtk_quirks(struct device *dev, struct xhci_hcd *xhci)
      xhci->quirks |= XHCI_SPURIOUS_SUCCESS;
      if (mtk->lpm_support)
              xhci->quirks |= XHCI_LPM_SUPPORT;
+     /*
+      * MTK host controller does not support 64-bit addressing, despite
+      * having the AC64 bit of the HCCPARAMS1 register set.
+      */
+     xhci->quirks |= XHCI_NO_64BIT_SUPPORT;

Somes SoCs support 64bits in fact, so can't support this quirk, do you encounter any issues without this quirk?

Thanks for taking a look at this patch.

Yes, on MT8183 the DMA mask ended up being set to 64 bits, but according to the information I received from MediaTek, the controller on that SoC only supports 32 bits.

Quoted 6 lines
Quoted 2 lines

As I know, mt8183 doesn't support memory greater than 4G mode.

We have 4GB of DRAM at 0x40000000-0x140000000 on our board with MT8183. What happens if you attempt to use the memory from 0x100000000-0x140000000 with the XHCI controller on this SoC?

Sorry for the late reply.

I've checked it with USB DE, USB IP supports 64bit on MT8183, so no need set XHCI_NO_64BIT_SUPPORT.
Would you please help to send a new patch to remove local dma mask setting, no need set it.

Thanks a lot

Quoted 32 lines
Quoted 15 lines
Quoted 15 lines

If some SoCs support only 32 bits and some support 64 bits, we may either need to use different DT compatible string for them or add a DT property and set the quirk based on that. Right now in upstream we have:

1) "mediatek,mt8173-xhci", used by:
MT8173

2)"mediatek,mtk-xhci", used by:
MT2712
MT7622
MT8183 (not yet upstream, but I suppose it's on the mailing lists)

Quoted 5 lines
Quoted 2 lines

Would you be able to check which of the SoCs above report 64 bits but support only 32? (and so would need this quirk)

I'm afraid I can't, almost all MTK SoCs supporting xHCI are using this driver, AC64 should be set rightly according to addressing capability.

Does it mean that only MT8183 may be the only SoC with a problem with this capability bit?

Matthias, do you have access to MT2712 and MT7622 devices? I have MT8173 and MT8183, so I can check them, but would be good to check this on the other ones too.

Best regards,
Tomasz

#7 lore raw
Quoted 60 lines · Chunfeng Yun

Hi Tomasz,

Quoted 49 lines · Tomasz Figa
Quoted 48 lines · Chunfeng Yun
Quoted 12 lines · Tomasz Figa

Hi Chunfeng,

Quoted 9 lines · Chunfeng Yun

Hi, Tomasz,

Quoted 5 lines · Tomasz Figa

MediaTek XHCI host controller does not support 64-bit addressing despite the AC64 bit of HCCPARAMS1 register being set. The platform-specific glue sets the DMA mask to 32 bits on its own, but it has no effect, because xhci_gen_setup() overrides it according to hardware capabilities.

Yes, this is what I want to do, maybe need remove DMA mask setting in platform-specific.

Quoted 31 lines
Quoted 9 lines
Quoted 9 lines

Use the XHCI_NO_64BIT_SUPPORT quirk to tell the XHCI core to force 32-bit DMA mask instead.

---
 drivers/usb/host/xhci-mtk.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
Quoted 16 lines

drivers/usb/host/xhci-mtk.c static void xhci_mtk_quirks(struct device *dev, struct xhci_hcd *xhci) · line 402

Quoted 13 lines
drivers/usb/host/xhci-mtk.c +5 -0
index b18a6baef204a..4d101d52cc11b 100644
@@ -395,6 +395,11 @@ static void xhci_mtk_quirks(struct device *dev, struct xhci_hcd *xhci)
      xhci->quirks |= XHCI_SPURIOUS_SUCCESS;
      if (mtk->lpm_support)
              xhci->quirks |= XHCI_LPM_SUPPORT;
+     /*
+      * MTK host controller does not support 64-bit addressing, despite
+      * having the AC64 bit of the HCCPARAMS1 register set.
+      */
+     xhci->quirks |= XHCI_NO_64BIT_SUPPORT;

Somes SoCs support 64bits in fact, so can't support this quirk, do you encounter any issues without this quirk?

Thanks for taking a look at this patch.

Yes, on MT8183 the DMA mask ended up being set to 64 bits, but according to the information I received from MediaTek, the controller on that SoC only supports 32 bits.

Quoted 6 lines
Quoted 2 lines

As I know, mt8183 doesn't support memory greater than 4G mode.

We have 4GB of DRAM at 0x40000000-0x140000000 on our board with MT8183. What happens if you attempt to use the memory from 0x100000000-0x140000000 with the XHCI controller on this SoC?

Quoted 9 lines

Sorry for the late reply.

I've checked it with USB DE, USB IP supports 64bit on MT8183, so no need set XHCI_NO_64BIT_SUPPORT.
Would you please help to send a new patch to remove local dma mask setting, no need set it.

Thanks a lot

Thanks Chunfeng. Sounds good then. I'll send a follow-up clean-up patch once I catch up after a conference and vacation. :)

Best regards,
Tomasz

Quoted 35 lines
Quoted 33 lines
Quoted 16 lines
Quoted 16 lines

If some SoCs support only 32 bits and some support 64 bits, we may either need to use different DT compatible string for them or add a DT property and set the quirk based on that. Right now in upstream we have:

1) "mediatek,mt8173-xhci", used by:
MT8173

2)"mediatek,mtk-xhci", used by:
MT2712
MT7622
MT8183 (not yet upstream, but I suppose it's on the mailing lists)

Quoted 5 lines
Quoted 2 lines

Would you be able to check which of the SoCs above report 64 bits but support only 32? (and so would need this quirk)

I'm afraid I can't, almost all MTK SoCs supporting xHCI are using this driver, AC64 should be set rightly according to addressing capability.

Does it mean that only MT8183 may be the only SoC with a problem with this capability bit?

Matthias, do you have access to MT2712 and MT7622 devices? I have MT8173 and MT8183, so I can check them, but would be good to check this on the other ones too.

Best regards,
Tomasz

#8 lore raw
In reply to Tomasz Figa
Quoted 11 lines · Tomasz Figa

MediaTek XHCI host controller does not support 64-bit addressing despite the AC64 bit of HCCPARAMS1 register being set. The platform-specific glue sets the DMA mask to 32 bits on its own, but it has no effect, because xhci_gen_setup() overrides it according to hardware capabilities.

Use the XHCI_NO_64BIT_SUPPORT quirk to tell the XHCI core to force 32-bit DMA mask instead.

Can we add a Fixes: tag for stable backports?
(after addressing the other comments of course)

Quoted 35 lines
---
 drivers/usb/host/xhci-mtk.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/usb/host/xhci-mtk.c +5 -6
index b18a6baef204a..4d101d52cc11b 100644
@@ -395,6 +395,11 @@ static void xhci_mtk_quirks(struct device *dev, struct xhci_hcd *xhci)
        xhci->quirks |= XHCI_SPURIOUS_SUCCESS;
        if (mtk->lpm_support)
                xhci->quirks |= XHCI_LPM_SUPPORT;
+       /*
+        * MTK host controller does not support 64-bit addressing, despite
+        * having the AC64 bit of the HCCPARAMS1 register set.
+        */
+       xhci->quirks |= XHCI_NO_64BIT_SUPPORT;
 }
 
 /* called during probe() after chip reset completes */
@@ -488,11 +493,6 @@ static int xhci_mtk_probe(struct platform_device *pdev)
                goto disable_clk;
        }
 
-       /* Initialize dma_mask and coherent_dma_mask to 32-bits */
-       ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32));
-       if (ret)
-               goto disable_clk;
-
        hcd = usb_create_hcd(driver, dev, dev_name(dev));
        if (!hcd) {
                ret = -ENOMEM;
--

2.23.0.581.g78d2f28ef7-goog

#9 lore raw
Quoted 9 lines · Nicolas Boichat
Quoted 7 lines · Tomasz Figa

MediaTek XHCI host controller does not support 64-bit addressing despite the AC64 bit of HCCPARAMS1 register being set. The platform-specific glue sets the DMA mask to 32 bits on its own, but it has no effect, because xhci_gen_setup() overrides it according to hardware capabilities.

Quoted 8 lines
Quoted 4 lines

Use the XHCI_NO_64BIT_SUPPORT quirk to tell the XHCI core to force 32-bit DMA mask instead.

Can we add a Fixes: tag for stable backports?
(after addressing the other comments of course)

The problem with Fixes: is that this patch depends on the quirk being there, but the offending code was merged earlier. Do you know how to handle such cases?

Quoted 36 lines
Quoted 36 lines
---
 drivers/usb/host/xhci-mtk.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/usb/host/xhci-mtk.c +5 -6
index b18a6baef204a..4d101d52cc11b 100644
@@ -395,6 +395,11 @@ static void xhci_mtk_quirks(struct device *dev, struct xhci_hcd *xhci)
        xhci->quirks |= XHCI_SPURIOUS_SUCCESS;
        if (mtk->lpm_support)
                xhci->quirks |= XHCI_LPM_SUPPORT;
+       /*
+        * MTK host controller does not support 64-bit addressing, despite
+        * having the AC64 bit of the HCCPARAMS1 register set.
+        */
+       xhci->quirks |= XHCI_NO_64BIT_SUPPORT;
 }
 
 /* called during probe() after chip reset completes */
@@ -488,11 +493,6 @@ static int xhci_mtk_probe(struct platform_device *pdev)
                goto disable_clk;
        }
 
-       /* Initialize dma_mask and coherent_dma_mask to 32-bits */
-       ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32));
-       if (ret)
-               goto disable_clk;
-
        hcd = usb_create_hcd(driver, dev, dev_name(dev));
        if (!hcd) {
                ret = -ENOMEM;
--

2.23.0.581.g78d2f28ef7-goog

#10 lore raw
Quoted 16 lines · Tomasz Figa
Quoted 14 lines · Nicolas Boichat
Quoted 11 lines · Tomasz Figa

MediaTek XHCI host controller does not support 64-bit addressing despite the AC64 bit of HCCPARAMS1 register being set. The platform-specific glue sets the DMA mask to 32 bits on its own, but it has no effect, because xhci_gen_setup() overrides it according to hardware capabilities.

Use the XHCI_NO_64BIT_SUPPORT quirk to tell the XHCI core to force 32-bit DMA mask instead.

Quoted 7 lines
Quoted 3 lines

Can we add a Fixes: tag for stable backports?
(after addressing the other comments of course)

The problem with Fixes: is that this patch depends on the quirk being there, but the offending code was merged earlier. Do you know how to handle such cases?

Oh, interesting. I think this is documented here:
https://github.com/torvalds/linux/blob/master/Documentation/process/stable-kernel-rules.rst

Something like this:
Cc: <[email protected]> # 3.3.x: a1f84a3: sched: Check for idle
Cc: <[email protected]> # 3.3.x

(Where 3.3.x is the first release that contains the commit indicated in the Fixes tag)

Try that, worst case you'll get automated emails from stable maintainers asking you how to fix the issue.

Quoted 37 lines
Quoted 37 lines
Quoted 37 lines

---
 drivers/usb/host/xhci-mtk.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/usb/host/xhci-mtk.c +5 -6
index b18a6baef204a..4d101d52cc11b 100644
@@ -395,6 +395,11 @@ static void xhci_mtk_quirks(struct device *dev, struct xhci_hcd *xhci)
        xhci->quirks |= XHCI_SPURIOUS_SUCCESS;
        if (mtk->lpm_support)
                xhci->quirks |= XHCI_LPM_SUPPORT;
+       /*
+        * MTK host controller does not support 64-bit addressing, despite
+        * having the AC64 bit of the HCCPARAMS1 register set.
+        */
+       xhci->quirks |= XHCI_NO_64BIT_SUPPORT;
 }
 
 /* called during probe() after chip reset completes */
@@ -488,11 +493,6 @@ static int xhci_mtk_probe(struct platform_device *pdev)
                goto disable_clk;
        }
 
-       /* Initialize dma_mask and coherent_dma_mask to 32-bits */
-       ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32));
-       if (ret)
-               goto disable_clk;
-
        hcd = usb_create_hcd(driver, dev, dev_name(dev));
        if (!hcd) {
                ret = -ENOMEM;
--

2.23.0.581.g78d2f28ef7-goog

#11 lore raw
Quoted 33 lines · Nicolas Boichat
Quoted 16 lines · Tomasz Figa
Quoted 14 lines · Nicolas Boichat
Quoted 11 lines · Tomasz Figa

MediaTek XHCI host controller does not support 64-bit addressing despite the AC64 bit of HCCPARAMS1 register being set. The platform-specific glue sets the DMA mask to 32 bits on its own, but it has no effect, because xhci_gen_setup() overrides it according to hardware capabilities.

Use the XHCI_NO_64BIT_SUPPORT quirk to tell the XHCI core to force 32-bit DMA mask instead.

Quoted 7 lines
Quoted 3 lines

Can we add a Fixes: tag for stable backports?
(after addressing the other comments of course)

The problem with Fixes: is that this patch depends on the quirk being there, but the offending code was merged earlier. Do you know how to handle such cases?

Oh, interesting. I think this is documented here:
https://github.com/torvalds/linux/blob/master/Documentation/process/stable-kernel-rules.rst

Something like this:
Cc: <[email protected]> # 3.3.x: a1f84a3: sched: Check for idle
Cc: <[email protected]> # 3.3.x

Quoted 6 lines

(Where 3.3.x is the first release that contains the commit indicated in the Fixes tag)

Try that, worst case you'll get automated emails from stable maintainers asking you how to fix the issue.

Oh, great, thanks a lot!

Best regards,
Tomasz

Quoted 37 lines
Quoted 37 lines
Quoted 37 lines
Quoted 37 lines

---
 drivers/usb/host/xhci-mtk.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/usb/host/xhci-mtk.c +5 -6
index b18a6baef204a..4d101d52cc11b 100644
@@ -395,6 +395,11 @@ static void xhci_mtk_quirks(struct device *dev, struct xhci_hcd *xhci)
        xhci->quirks |= XHCI_SPURIOUS_SUCCESS;
        if (mtk->lpm_support)
                xhci->quirks |= XHCI_LPM_SUPPORT;
+       /*
+        * MTK host controller does not support 64-bit addressing, despite
+        * having the AC64 bit of the HCCPARAMS1 register set.
+        */
+       xhci->quirks |= XHCI_NO_64BIT_SUPPORT;
 }
 
 /* called during probe() after chip reset completes */
@@ -488,11 +493,6 @@ static int xhci_mtk_probe(struct platform_device *pdev)
                goto disable_clk;
        }
 
-       /* Initialize dma_mask and coherent_dma_mask to 32-bits */
-       ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32));
-       if (ret)
-               goto disable_clk;
-
        hcd = usb_create_hcd(driver, dev, dev_name(dev));
        if (!hcd) {
                ret = -ENOMEM;
--

2.23.0.581.g78d2f28ef7-goog