* [PATCH] wifi: rtw89: pci: early chips only enable 36-bit DMA on specific PCI hosts
@ 2024-09-24 2:16 Ping-Ke Shih
2024-09-27 1:34 ` Ping-Ke Shih
2024-10-17 14:23 ` Kalle Valo
0 siblings, 2 replies; 6+ messages in thread
From: Ping-Ke Shih @ 2024-09-24 2:16 UTC (permalink / raw)
To: linux-wireless; +Cc: mweissenbach
The early chips including RTL8852A, RTL8851B, RTL8852B and RTL8852BT have
interoperability problems of 36-bit DMA with some PCI hosts. Rollback
to 32-bit DMA by default, and only enable 36-bit DMA for tested platforms.
Since all Intel platforms we have can work correctly, add the vendor ID to
white list. Otherwise, list vendor/device ID of bridge we have tested.
Fixes: 1fd4b3fe52ef ("wifi: rtw89: pci: support 36-bit PCI DMA address")
Reported-by: Marcel Weißenbach <mweissenbach@ignaz.org>
Closes: https://lore.kernel.org/linux-wireless/20240918073237.Horde.VLueh0_KaiDw-9asEEcdM84@ignaz.org/T/#m07c5694df1acb173a42e1a0bab7ac22bd231a2b8
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
drivers/net/wireless/realtek/rtw89/pci.c | 48 ++++++++++++++++++++----
1 file changed, 41 insertions(+), 7 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtw89/pci.c b/drivers/net/wireless/realtek/rtw89/pci.c
index 02afeb3acce4..5aef7fa37878 100644
--- a/drivers/net/wireless/realtek/rtw89/pci.c
+++ b/drivers/net/wireless/realtek/rtw89/pci.c
@@ -3026,24 +3026,54 @@ static void rtw89_pci_declaim_device(struct rtw89_dev *rtwdev,
pci_disable_device(pdev);
}
-static void rtw89_pci_cfg_dac(struct rtw89_dev *rtwdev)
+static bool rtw89_pci_chip_is_manual_dac(struct rtw89_dev *rtwdev)
{
- struct rtw89_pci *rtwpci = (struct rtw89_pci *)rtwdev->priv;
const struct rtw89_chip_info *chip = rtwdev->chip;
- if (!rtwpci->enable_dac)
- return;
-
switch (chip->chip_id) {
case RTL8852A:
case RTL8852B:
case RTL8851B:
case RTL8852BT:
- break;
+ return true;
default:
- return;
+ return false;
+ }
+}
+
+static bool rtw89_pci_is_dac_compatible_bridge(struct rtw89_dev *rtwdev)
+{
+ struct rtw89_pci *rtwpci = (struct rtw89_pci *)rtwdev->priv;
+ struct pci_dev *bridge = pci_upstream_bridge(rtwpci->pdev);
+
+ if (!rtw89_pci_chip_is_manual_dac(rtwdev))
+ return true;
+
+ if (!bridge)
+ return false;
+
+ switch (bridge->vendor) {
+ case PCI_VENDOR_ID_INTEL:
+ return true;
+ case PCI_VENDOR_ID_ASMEDIA:
+ if (bridge->device == 0x2806)
+ return true;
+ break;
}
+ return false;
+}
+
+static void rtw89_pci_cfg_dac(struct rtw89_dev *rtwdev)
+{
+ struct rtw89_pci *rtwpci = (struct rtw89_pci *)rtwdev->priv;
+
+ if (!rtwpci->enable_dac)
+ return;
+
+ if (!rtw89_pci_chip_is_manual_dac(rtwdev))
+ return;
+
rtw89_pci_config_byte_set(rtwdev, RTW89_PCIE_L1_CTRL, RTW89_PCIE_BIT_EN_64BITS);
}
@@ -3061,6 +3091,9 @@ static int rtw89_pci_setup_mapping(struct rtw89_dev *rtwdev,
goto err;
}
+ if (!rtw89_pci_is_dac_compatible_bridge(rtwdev))
+ goto no_dac;
+
ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(36));
if (!ret) {
rtwpci->enable_dac = true;
@@ -3073,6 +3106,7 @@ static int rtw89_pci_setup_mapping(struct rtw89_dev *rtwdev,
goto err_release_regions;
}
}
+no_dac:
resource_len = pci_resource_len(pdev, bar_id);
rtwpci->mmap = pci_iomap(pdev, bar_id, resource_len);
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* RE: [PATCH] wifi: rtw89: pci: early chips only enable 36-bit DMA on specific PCI hosts
2024-09-24 2:16 [PATCH] wifi: rtw89: pci: early chips only enable 36-bit DMA on specific PCI hosts Ping-Ke Shih
@ 2024-09-27 1:34 ` Ping-Ke Shih
2024-09-28 11:19 ` Kalle Valo
2024-10-17 14:23 ` Kalle Valo
1 sibling, 1 reply; 6+ messages in thread
From: Ping-Ke Shih @ 2024-09-27 1:34 UTC (permalink / raw)
To: Kalle Valo, linux-wireless@vger.kernel.org; +Cc: mweissenbach@ignaz.org
Hi Kalle,
Ping-Ke Shih <pkshih@realtek.com> wrote:
>
> The early chips including RTL8852A, RTL8851B, RTL8852B and RTL8852BT have
> interoperability problems of 36-bit DMA with some PCI hosts. Rollback
> to 32-bit DMA by default, and only enable 36-bit DMA for tested platforms.
>
> Since all Intel platforms we have can work correctly, add the vendor ID to
> white list. Otherwise, list vendor/device ID of bridge we have tested.
>
> Fixes: 1fd4b3fe52ef ("wifi: rtw89: pci: support 36-bit PCI DMA address")
> Reported-by: Marcel Weißenbach <mweissenbach@ignaz.org>
> Closes:
> https://lore.kernel.org/linux-wireless/20240918073237.Horde.VLueh0_KaiDw-9asEEcdM84@ignaz.org/T/#m07c5
> 694df1acb173a42e1a0bab7ac22bd231a2b8
> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Could you please queue this patch to wireless tree? Because RTL8852BE becomes
unusable for some users. I assigned this patch to you in patchwork, if you
don't think so and have other suggestions, please let me know. Thanks.
The user has reported this patch works as expected [1], so add his tested-by:
Tested-by: Marcel Weißenbach <mweissenbach@ignaz.org>
Also, I think this should Cc stable, so
Cc: stable@vger.kernel.org
[1] https://lore.kernel.org/linux-wireless/20240927012001.Horde.vJNTbT576lzyFGWprtGx7R0@IgnazServer/T/#m01470ad9bba13e46ce9a0dd6efaffe1e176ad05e
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] wifi: rtw89: pci: early chips only enable 36-bit DMA on specific PCI hosts
2024-09-27 1:34 ` Ping-Ke Shih
@ 2024-09-28 11:19 ` Kalle Valo
2024-10-07 12:25 ` Marcel Weißenbach
0 siblings, 1 reply; 6+ messages in thread
From: Kalle Valo @ 2024-09-28 11:19 UTC (permalink / raw)
To: Ping-Ke Shih; +Cc: linux-wireless@vger.kernel.org, mweissenbach@ignaz.org
Ping-Ke Shih <pkshih@realtek.com> writes:
> Ping-Ke Shih <pkshih@realtek.com> wrote:
>>
>> The early chips including RTL8852A, RTL8851B, RTL8852B and RTL8852BT have
>> interoperability problems of 36-bit DMA with some PCI hosts. Rollback
>> to 32-bit DMA by default, and only enable 36-bit DMA for tested platforms.
>>
>> Since all Intel platforms we have can work correctly, add the vendor ID to
>> white list. Otherwise, list vendor/device ID of bridge we have tested.
>>
>> Fixes: 1fd4b3fe52ef ("wifi: rtw89: pci: support 36-bit PCI DMA address")
>> Reported-by: Marcel Weißenbach <mweissenbach@ignaz.org>
>> Closes:
>> https://lore.kernel.org/linux-wireless/20240918073237.Horde.VLueh0_KaiDw-9asEEcdM84@ignaz.org/T/#m07c5
>> 694df1acb173a42e1a0bab7ac22bd231a2b8
>> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
>
> Could you please queue this patch to wireless tree? Because RTL8852BE becomes
> unusable for some users. I assigned this patch to you in patchwork, if you
> don't think so and have other suggestions, please let me know. Thanks.
>
> The user has reported this patch works as expected [1], so add his tested-by:
> Tested-by: Marcel Weißenbach <mweissenbach@ignaz.org>
>
> Also, I think this should Cc stable, so
> Cc: stable@vger.kernel.org
Ok, I'll add all that.
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] wifi: rtw89: pci: early chips only enable 36-bit DMA on specific PCI hosts
2024-09-28 11:19 ` Kalle Valo
@ 2024-10-07 12:25 ` Marcel Weißenbach
2024-10-11 12:43 ` Kalle Valo
0 siblings, 1 reply; 6+ messages in thread
From: Marcel Weißenbach @ 2024-10-07 12:25 UTC (permalink / raw)
To: Ping-Ke Shih, Kalle Valo; +Cc: linux-wireless
Hi there,
just wanted to kindly ask in which Kernel Version this patch will be implemented (given it is not yet).
I assume it did not make it into 6.11.2, or?
"Kalle Valo" kvalo@kernel.org – 2024年9月28日 20:19
> Ping-Ke Shih <pkshih@realtek.com> writes:
>
> > Ping-Ke Shih <pkshih@realtek.com> wrote:
> >>
> >> The early chips including RTL8852A, RTL8851B, RTL8852B and RTL8852BT have
> >> interoperability problems of 36-bit DMA with some PCI hosts. Rollback
> >> to 32-bit DMA by default, and only enable 36-bit DMA for tested platforms.
> >>
> >> Since all Intel platforms we have can work correctly, add the vendor ID to
> >> white list. Otherwise, list vendor/device ID of bridge we have tested.
> >>
> >> Fixes: 1fd4b3fe52ef ("wifi: rtw89: pci: support 36-bit PCI DMA address")
> >> Reported-by: Marcel Weißenbach <mweissenbach@ignaz.org>
> >> Closes:
> >> https://lore.kernel.org/linux-wireless/20240918073237.Horde.VLueh0_KaiDw-9asEEcdM84@ignaz.org/T/#m07c5
> >> 694df1acb173a42e1a0bab7ac22bd231a2b8
> >> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
> >
> > Could you please queue this patch to wireless tree? Because RTL8852BE becomes
> > unusable for some users. I assigned this patch to you in patchwork, if you
> > don't think so and have other suggestions, please let me know. Thanks.
> >
> > The user has reported this patch works as expected [1], so add his tested-by:
> > Tested-by: Marcel Weißenbach <mweissenbach@ignaz.org>
> >
> > Also, I think this should Cc stable, so
> > Cc: stable@vger.kernel.org
>
> Ok, I'll add all that.
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] wifi: rtw89: pci: early chips only enable 36-bit DMA on specific PCI hosts
2024-10-07 12:25 ` Marcel Weißenbach
@ 2024-10-11 12:43 ` Kalle Valo
0 siblings, 0 replies; 6+ messages in thread
From: Kalle Valo @ 2024-10-11 12:43 UTC (permalink / raw)
To: Marcel Weißenbach; +Cc: Ping-Ke Shih, linux-wireless
Marcel Weißenbach <mweissenbach@ignaz.org> writes:
> Hi there,
Please don't top post.
> just wanted to kindly ask in which Kernel Version this patch will be implemented (given it is not yet).
This is not yet applied because I have been busy.
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] wifi: rtw89: pci: early chips only enable 36-bit DMA on specific PCI hosts
2024-09-24 2:16 [PATCH] wifi: rtw89: pci: early chips only enable 36-bit DMA on specific PCI hosts Ping-Ke Shih
2024-09-27 1:34 ` Ping-Ke Shih
@ 2024-10-17 14:23 ` Kalle Valo
1 sibling, 0 replies; 6+ messages in thread
From: Kalle Valo @ 2024-10-17 14:23 UTC (permalink / raw)
To: Ping-Ke Shih; +Cc: linux-wireless, mweissenbach
Ping-Ke Shih <pkshih@realtek.com> wrote:
> The early chips including RTL8852A, RTL8851B, RTL8852B and RTL8852BT have
> interoperability problems of 36-bit DMA with some PCI hosts. Rollback
> to 32-bit DMA by default, and only enable 36-bit DMA for tested platforms.
>
> Since all Intel platforms we have can work correctly, add the vendor ID to
> white list. Otherwise, list vendor/device ID of bridge we have tested.
>
> Fixes: 1fd4b3fe52ef ("wifi: rtw89: pci: support 36-bit PCI DMA address")
> Reported-by: Marcel Weißenbach <mweissenbach@ignaz.org>
> Closes: https://lore.kernel.org/linux-wireless/20240918073237.Horde.VLueh0_KaiDw-9asEEcdM84@ignaz.org/T/#m07c5694df1acb173a42e1a0bab7ac22bd231a2b8
> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
> Tested-by: Marcel Weißenbach <mweissenbach@ignaz.org>
Patch applied to wireless.git, thanks.
aa70ff0945fe wifi: rtw89: pci: early chips only enable 36-bit DMA on specific PCI hosts
--
https://patchwork.kernel.org/project/linux-wireless/patch/20240924021633.19861-1-pkshih@realtek.com/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-10-17 14:23 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-24 2:16 [PATCH] wifi: rtw89: pci: early chips only enable 36-bit DMA on specific PCI hosts Ping-Ke Shih
2024-09-27 1:34 ` Ping-Ke Shih
2024-09-28 11:19 ` Kalle Valo
2024-10-07 12:25 ` Marcel Weißenbach
2024-10-11 12:43 ` Kalle Valo
2024-10-17 14:23 ` Kalle Valo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).