From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id CC1DB15808B for ; Fri, 8 Apr 2022 13:09:59 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 8A886E0863; Fri, 8 Apr 2022 13:09:58 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 3FEFCE0863 for ; Fri, 8 Apr 2022 13:09:58 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 7201B340F5D for ; Fri, 8 Apr 2022 13:09:56 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id C11CC1BD for ; Fri, 8 Apr 2022 13:09:54 +0000 (UTC) From: "Mike Pagano" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Pagano" Message-ID: <1649423372.90bdc1445c17fabda7246e1e43ee93e26fba1c95.mpagano@gentoo> Subject: [gentoo-commits] proj/linux-patches:5.17 commit in: / X-VCS-Repository: proj/linux-patches X-VCS-Files: 0000_README 2400_mt76-mt7921e-fix-possible-probe-failure-after-reboot.patch 2410_revert-swiotlb-rework-fix-info-leak-with-dma_from_device.patch X-VCS-Directories: / X-VCS-Committer: mpagano X-VCS-Committer-Name: Mike Pagano X-VCS-Revision: 90bdc1445c17fabda7246e1e43ee93e26fba1c95 X-VCS-Branch: 5.17 Date: Fri, 8 Apr 2022 13:09:54 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: a85beed8-4ace-4794-a487-207384b376cd X-Archives-Hash: 13917dfb62909707ab0534ee51435cea commit: 90bdc1445c17fabda7246e1e43ee93e26fba1c95 Author: Mike Pagano gentoo org> AuthorDate: Fri Apr 8 13:09:32 2022 +0000 Commit: Mike Pagano gentoo org> CommitDate: Fri Apr 8 13:09:32 2022 +0000 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=90bdc144 Removed redundant patches Removed: 2400_mt76-mt7921e-fix-possible-probe-failure-after-reboot.patch 2410_revert-swiotlb-rework-fix-info-leak-with-dma_from_device.patch Signed-off-by: Mike Pagano gentoo.org> 0000_README | 8 - ...e-fix-possible-probe-failure-after-reboot.patch | 436 --------------------- ...rework-fix-info-leak-with-dma_from_device.patch | 187 --------- 3 files changed, 631 deletions(-) diff --git a/0000_README b/0000_README index 07650c38..18d9a104 100644 --- a/0000_README +++ b/0000_README @@ -63,14 +63,6 @@ Patch: 2000_BT-Check-key-sizes-only-if-Secure-Simple-Pairing-enabled.patch From: https://lore.kernel.org/linux-bluetooth/20190522070540.48895-1-marcel@holtmann.org/raw Desc: Bluetooth: Check key sizes only when Secure Simple Pairing is enabled. See bug #686758 -Patch: 2400_mt76-mt7921e-fix-possible-probe-failure-after-reboot.patch -From: https://patchwork.kernel.org/project/linux-wireless/patch/70e27cbc652cbdb78277b9c691a3a5ba02653afb.1641540175.git.objelf@gmail.com/ -Desc: mt76: mt7921e: fix possible probe failure after reboot - -Patch: 2410_revert-swiotlb-rework-fix-info-leak-with-dma_from_device.patch -From: https://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git -Desc: Revert swiotlb: rework fix info leak with DMA_FROM_DEVICE - Patch: 2900_tmp513-Fix-build-issue-by-selecting-CONFIG_REG.patch From: https://bugs.gentoo.org/710790 Desc: tmp513 requies REGMAP_I2C to build. Select it by default in Kconfig. See bug #710790. Thanks to Phil Stracchino diff --git a/2400_mt76-mt7921e-fix-possible-probe-failure-after-reboot.patch b/2400_mt76-mt7921e-fix-possible-probe-failure-after-reboot.patch deleted file mode 100644 index 4440e910..00000000 --- a/2400_mt76-mt7921e-fix-possible-probe-failure-after-reboot.patch +++ /dev/null @@ -1,436 +0,0 @@ -From patchwork Fri Jan 7 07:30:03 2022 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Sean Wang -X-Patchwork-Id: 12706336 -X-Patchwork-Delegate: nbd@nbd.name -Return-Path: -X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on - aws-us-west-2-korg-lkml-1.web.codeaurora.org -Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) - by smtp.lore.kernel.org (Postfix) with ESMTP id 21BAFC433F5 - for ; - Fri, 7 Jan 2022 07:30:14 +0000 (UTC) -Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand - id S234590AbiAGHaN (ORCPT - ); - Fri, 7 Jan 2022 02:30:13 -0500 -Received: from mailgw01.mediatek.com ([60.244.123.138]:50902 "EHLO - mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org - with ESMTP id S234589AbiAGHaM (ORCPT - ); - Fri, 7 Jan 2022 02:30:12 -0500 -X-UUID: 13aa3d5f268849bb8556160d0ceca5f3-20220107 -X-UUID: 13aa3d5f268849bb8556160d0ceca5f3-20220107 -Received: from mtkcas10.mediatek.inc [(172.21.101.39)] by - mailgw01.mediatek.com - (envelope-from ) - (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) - with ESMTP id 982418171; Fri, 07 Jan 2022 15:30:06 +0800 -Received: from mtkcas10.mediatek.inc (172.21.101.39) by - mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server - (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.792.3; - Fri, 7 Jan 2022 15:30:05 +0800 -Received: from mtkswgap22.mediatek.inc (172.21.77.33) by mtkcas10.mediatek.inc - (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend - Transport; Fri, 7 Jan 2022 15:30:04 +0800 -From: -To: , -CC: , , - , , - , , - , , - , , - , , - , , - , , - , , - , , , - , , - , - , - "Deren Wu" -Subject: [PATCH] mt76: mt7921e: fix possible probe failure after reboot -Date: Fri, 7 Jan 2022 15:30:03 +0800 -Message-ID: - <70e27cbc652cbdb78277b9c691a3a5ba02653afb.1641540175.git.objelf@gmail.com> -X-Mailer: git-send-email 1.7.9.5 -MIME-Version: 1.0 -X-MTK: N -Precedence: bulk -List-ID: -X-Mailing-List: linux-wireless@vger.kernel.org - -From: Sean Wang - -It doesn't guarantee the mt7921e gets started with ASPM L0 after each -machine reboot on every platform. - -If mt7921e gets started with not ASPM L0, it would be possible that the -driver encounters time to time failure in mt7921_pci_probe, like a -weird chip identifier is read - -[ 215.514503] mt7921e 0000:05:00.0: ASIC revision: feed0000 -[ 216.604741] mt7921e: probe of 0000:05:00.0 failed with error -110 - -or failing to init hardware because the driver is not allowed to access the -register until the device is in ASPM L0 state. So, we call -__mt7921e_mcu_drv_pmctrl in early mt7921_pci_probe to force the device -to bring back to the L0 state for we can safely access registers in any -case. - -In the patch, we move all functions from dma.c to pci.c and register mt76 -bus operation earilier, that is the __mt7921e_mcu_drv_pmctrl depends on. - -Fixes: bf3747ae2e25 ("mt76: mt7921: enable aspm by default") -Reported-by: Kai-Chuan Hsieh -Co-developed-by: Deren Wu -Signed-off-by: Deren Wu -Signed-off-by: Sean Wang ---- - .../net/wireless/mediatek/mt76/mt7921/dma.c | 119 ----------------- - .../wireless/mediatek/mt76/mt7921/mt7921.h | 1 + - .../net/wireless/mediatek/mt76/mt7921/pci.c | 124 ++++++++++++++++++ - .../wireless/mediatek/mt76/mt7921/pci_mcu.c | 18 ++- - 4 files changed, 139 insertions(+), 123 deletions(-) - -diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/dma.c b/drivers/net/wireless/mediatek/mt76/mt7921/dma.c -index cdff1fd52d93..39d6ce4ecddd 100644 ---- a/drivers/net/wireless/mediatek/mt76/mt7921/dma.c -+++ b/drivers/net/wireless/mediatek/mt76/mt7921/dma.c -@@ -78,110 +78,6 @@ static void mt7921_dma_prefetch(struct mt7921_dev *dev) - mt76_wr(dev, MT_WFDMA0_TX_RING17_EXT_CTRL, PREFETCH(0x380, 0x4)); - } - --static u32 __mt7921_reg_addr(struct mt7921_dev *dev, u32 addr) --{ -- static const struct { -- u32 phys; -- u32 mapped; -- u32 size; -- } fixed_map[] = { -- { 0x820d0000, 0x30000, 0x10000 }, /* WF_LMAC_TOP (WF_WTBLON) */ -- { 0x820ed000, 0x24800, 0x0800 }, /* WF_LMAC_TOP BN0 (WF_MIB) */ -- { 0x820e4000, 0x21000, 0x0400 }, /* WF_LMAC_TOP BN0 (WF_TMAC) */ -- { 0x820e7000, 0x21e00, 0x0200 }, /* WF_LMAC_TOP BN0 (WF_DMA) */ -- { 0x820eb000, 0x24200, 0x0400 }, /* WF_LMAC_TOP BN0 (WF_LPON) */ -- { 0x820e2000, 0x20800, 0x0400 }, /* WF_LMAC_TOP BN0 (WF_AGG) */ -- { 0x820e3000, 0x20c00, 0x0400 }, /* WF_LMAC_TOP BN0 (WF_ARB) */ -- { 0x820e5000, 0x21400, 0x0800 }, /* WF_LMAC_TOP BN0 (WF_RMAC) */ -- { 0x00400000, 0x80000, 0x10000 }, /* WF_MCU_SYSRAM */ -- { 0x00410000, 0x90000, 0x10000 }, /* WF_MCU_SYSRAM (configure register) */ -- { 0x40000000, 0x70000, 0x10000 }, /* WF_UMAC_SYSRAM */ -- { 0x54000000, 0x02000, 0x1000 }, /* WFDMA PCIE0 MCU DMA0 */ -- { 0x55000000, 0x03000, 0x1000 }, /* WFDMA PCIE0 MCU DMA1 */ -- { 0x58000000, 0x06000, 0x1000 }, /* WFDMA PCIE1 MCU DMA0 (MEM_DMA) */ -- { 0x59000000, 0x07000, 0x1000 }, /* WFDMA PCIE1 MCU DMA1 */ -- { 0x7c000000, 0xf0000, 0x10000 }, /* CONN_INFRA */ -- { 0x7c020000, 0xd0000, 0x10000 }, /* CONN_INFRA, WFDMA */ -- { 0x7c060000, 0xe0000, 0x10000 }, /* CONN_INFRA, conn_host_csr_top */ -- { 0x80020000, 0xb0000, 0x10000 }, /* WF_TOP_MISC_OFF */ -- { 0x81020000, 0xc0000, 0x10000 }, /* WF_TOP_MISC_ON */ -- { 0x820c0000, 0x08000, 0x4000 }, /* WF_UMAC_TOP (PLE) */ -- { 0x820c8000, 0x0c000, 0x2000 }, /* WF_UMAC_TOP (PSE) */ -- { 0x820cc000, 0x0e000, 0x1000 }, /* WF_UMAC_TOP (PP) */ -- { 0x820cd000, 0x0f000, 0x1000 }, /* WF_MDP_TOP */ -- { 0x820ce000, 0x21c00, 0x0200 }, /* WF_LMAC_TOP (WF_SEC) */ -- { 0x820cf000, 0x22000, 0x1000 }, /* WF_LMAC_TOP (WF_PF) */ -- { 0x820e0000, 0x20000, 0x0400 }, /* WF_LMAC_TOP BN0 (WF_CFG) */ -- { 0x820e1000, 0x20400, 0x0200 }, /* WF_LMAC_TOP BN0 (WF_TRB) */ -- { 0x820e9000, 0x23400, 0x0200 }, /* WF_LMAC_TOP BN0 (WF_WTBLOFF) */ -- { 0x820ea000, 0x24000, 0x0200 }, /* WF_LMAC_TOP BN0 (WF_ETBF) */ -- { 0x820ec000, 0x24600, 0x0200 }, /* WF_LMAC_TOP BN0 (WF_INT) */ -- { 0x820f0000, 0xa0000, 0x0400 }, /* WF_LMAC_TOP BN1 (WF_CFG) */ -- { 0x820f1000, 0xa0600, 0x0200 }, /* WF_LMAC_TOP BN1 (WF_TRB) */ -- { 0x820f2000, 0xa0800, 0x0400 }, /* WF_LMAC_TOP BN1 (WF_AGG) */ -- { 0x820f3000, 0xa0c00, 0x0400 }, /* WF_LMAC_TOP BN1 (WF_ARB) */ -- { 0x820f4000, 0xa1000, 0x0400 }, /* WF_LMAC_TOP BN1 (WF_TMAC) */ -- { 0x820f5000, 0xa1400, 0x0800 }, /* WF_LMAC_TOP BN1 (WF_RMAC) */ -- { 0x820f7000, 0xa1e00, 0x0200 }, /* WF_LMAC_TOP BN1 (WF_DMA) */ -- { 0x820f9000, 0xa3400, 0x0200 }, /* WF_LMAC_TOP BN1 (WF_WTBLOFF) */ -- { 0x820fa000, 0xa4000, 0x0200 }, /* WF_LMAC_TOP BN1 (WF_ETBF) */ -- { 0x820fb000, 0xa4200, 0x0400 }, /* WF_LMAC_TOP BN1 (WF_LPON) */ -- { 0x820fc000, 0xa4600, 0x0200 }, /* WF_LMAC_TOP BN1 (WF_INT) */ -- { 0x820fd000, 0xa4800, 0x0800 }, /* WF_LMAC_TOP BN1 (WF_MIB) */ -- }; -- int i; -- -- if (addr < 0x100000) -- return addr; -- -- for (i = 0; i < ARRAY_SIZE(fixed_map); i++) { -- u32 ofs; -- -- if (addr < fixed_map[i].phys) -- continue; -- -- ofs = addr - fixed_map[i].phys; -- if (ofs > fixed_map[i].size) -- continue; -- -- return fixed_map[i].mapped + ofs; -- } -- -- if ((addr >= 0x18000000 && addr < 0x18c00000) || -- (addr >= 0x70000000 && addr < 0x78000000) || -- (addr >= 0x7c000000 && addr < 0x7c400000)) -- return mt7921_reg_map_l1(dev, addr); -- -- dev_err(dev->mt76.dev, "Access currently unsupported address %08x\n", -- addr); -- -- return 0; --} -- --static u32 mt7921_rr(struct mt76_dev *mdev, u32 offset) --{ -- struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76); -- u32 addr = __mt7921_reg_addr(dev, offset); -- -- return dev->bus_ops->rr(mdev, addr); --} -- --static void mt7921_wr(struct mt76_dev *mdev, u32 offset, u32 val) --{ -- struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76); -- u32 addr = __mt7921_reg_addr(dev, offset); -- -- dev->bus_ops->wr(mdev, addr, val); --} -- --static u32 mt7921_rmw(struct mt76_dev *mdev, u32 offset, u32 mask, u32 val) --{ -- struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76); -- u32 addr = __mt7921_reg_addr(dev, offset); -- -- return dev->bus_ops->rmw(mdev, addr, mask, val); --} -- - static int mt7921_dma_disable(struct mt7921_dev *dev, bool force) - { - if (force) { -@@ -341,23 +237,8 @@ int mt7921_wpdma_reinit_cond(struct mt7921_dev *dev) - - int mt7921_dma_init(struct mt7921_dev *dev) - { -- struct mt76_bus_ops *bus_ops; - int ret; - -- dev->phy.dev = dev; -- dev->phy.mt76 = &dev->mt76.phy; -- dev->mt76.phy.priv = &dev->phy; -- dev->bus_ops = dev->mt76.bus; -- bus_ops = devm_kmemdup(dev->mt76.dev, dev->bus_ops, sizeof(*bus_ops), -- GFP_KERNEL); -- if (!bus_ops) -- return -ENOMEM; -- -- bus_ops->rr = mt7921_rr; -- bus_ops->wr = mt7921_wr; -- bus_ops->rmw = mt7921_rmw; -- dev->mt76.bus = bus_ops; -- - mt76_dma_attach(&dev->mt76); - - ret = mt7921_dma_disable(dev, true); -diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h b/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h -index 8b674e042568..63e3c7ef5e89 100644 ---- a/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h -+++ b/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h -@@ -443,6 +443,7 @@ int mt7921e_mcu_init(struct mt7921_dev *dev); - int mt7921s_wfsys_reset(struct mt7921_dev *dev); - int mt7921s_mac_reset(struct mt7921_dev *dev); - int mt7921s_init_reset(struct mt7921_dev *dev); -+int __mt7921e_mcu_drv_pmctrl(struct mt7921_dev *dev); - int mt7921e_mcu_drv_pmctrl(struct mt7921_dev *dev); - int mt7921e_mcu_fw_pmctrl(struct mt7921_dev *dev); - -diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c -index 1ae0d5826ca7..a0c82d19c4d9 100644 ---- a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c -+++ b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c -@@ -121,6 +121,110 @@ static void mt7921e_unregister_device(struct mt7921_dev *dev) - mt76_free_device(&dev->mt76); - } - -+static u32 __mt7921_reg_addr(struct mt7921_dev *dev, u32 addr) -+{ -+ static const struct { -+ u32 phys; -+ u32 mapped; -+ u32 size; -+ } fixed_map[] = { -+ { 0x820d0000, 0x30000, 0x10000 }, /* WF_LMAC_TOP (WF_WTBLON) */ -+ { 0x820ed000, 0x24800, 0x0800 }, /* WF_LMAC_TOP BN0 (WF_MIB) */ -+ { 0x820e4000, 0x21000, 0x0400 }, /* WF_LMAC_TOP BN0 (WF_TMAC) */ -+ { 0x820e7000, 0x21e00, 0x0200 }, /* WF_LMAC_TOP BN0 (WF_DMA) */ -+ { 0x820eb000, 0x24200, 0x0400 }, /* WF_LMAC_TOP BN0 (WF_LPON) */ -+ { 0x820e2000, 0x20800, 0x0400 }, /* WF_LMAC_TOP BN0 (WF_AGG) */ -+ { 0x820e3000, 0x20c00, 0x0400 }, /* WF_LMAC_TOP BN0 (WF_ARB) */ -+ { 0x820e5000, 0x21400, 0x0800 }, /* WF_LMAC_TOP BN0 (WF_RMAC) */ -+ { 0x00400000, 0x80000, 0x10000 }, /* WF_MCU_SYSRAM */ -+ { 0x00410000, 0x90000, 0x10000 }, /* WF_MCU_SYSRAM (configure register) */ -+ { 0x40000000, 0x70000, 0x10000 }, /* WF_UMAC_SYSRAM */ -+ { 0x54000000, 0x02000, 0x1000 }, /* WFDMA PCIE0 MCU DMA0 */ -+ { 0x55000000, 0x03000, 0x1000 }, /* WFDMA PCIE0 MCU DMA1 */ -+ { 0x58000000, 0x06000, 0x1000 }, /* WFDMA PCIE1 MCU DMA0 (MEM_DMA) */ -+ { 0x59000000, 0x07000, 0x1000 }, /* WFDMA PCIE1 MCU DMA1 */ -+ { 0x7c000000, 0xf0000, 0x10000 }, /* CONN_INFRA */ -+ { 0x7c020000, 0xd0000, 0x10000 }, /* CONN_INFRA, WFDMA */ -+ { 0x7c060000, 0xe0000, 0x10000 }, /* CONN_INFRA, conn_host_csr_top */ -+ { 0x80020000, 0xb0000, 0x10000 }, /* WF_TOP_MISC_OFF */ -+ { 0x81020000, 0xc0000, 0x10000 }, /* WF_TOP_MISC_ON */ -+ { 0x820c0000, 0x08000, 0x4000 }, /* WF_UMAC_TOP (PLE) */ -+ { 0x820c8000, 0x0c000, 0x2000 }, /* WF_UMAC_TOP (PSE) */ -+ { 0x820cc000, 0x0e000, 0x1000 }, /* WF_UMAC_TOP (PP) */ -+ { 0x820cd000, 0x0f000, 0x1000 }, /* WF_MDP_TOP */ -+ { 0x820ce000, 0x21c00, 0x0200 }, /* WF_LMAC_TOP (WF_SEC) */ -+ { 0x820cf000, 0x22000, 0x1000 }, /* WF_LMAC_TOP (WF_PF) */ -+ { 0x820e0000, 0x20000, 0x0400 }, /* WF_LMAC_TOP BN0 (WF_CFG) */ -+ { 0x820e1000, 0x20400, 0x0200 }, /* WF_LMAC_TOP BN0 (WF_TRB) */ -+ { 0x820e9000, 0x23400, 0x0200 }, /* WF_LMAC_TOP BN0 (WF_WTBLOFF) */ -+ { 0x820ea000, 0x24000, 0x0200 }, /* WF_LMAC_TOP BN0 (WF_ETBF) */ -+ { 0x820ec000, 0x24600, 0x0200 }, /* WF_LMAC_TOP BN0 (WF_INT) */ -+ { 0x820f0000, 0xa0000, 0x0400 }, /* WF_LMAC_TOP BN1 (WF_CFG) */ -+ { 0x820f1000, 0xa0600, 0x0200 }, /* WF_LMAC_TOP BN1 (WF_TRB) */ -+ { 0x820f2000, 0xa0800, 0x0400 }, /* WF_LMAC_TOP BN1 (WF_AGG) */ -+ { 0x820f3000, 0xa0c00, 0x0400 }, /* WF_LMAC_TOP BN1 (WF_ARB) */ -+ { 0x820f4000, 0xa1000, 0x0400 }, /* WF_LMAC_TOP BN1 (WF_TMAC) */ -+ { 0x820f5000, 0xa1400, 0x0800 }, /* WF_LMAC_TOP BN1 (WF_RMAC) */ -+ { 0x820f7000, 0xa1e00, 0x0200 }, /* WF_LMAC_TOP BN1 (WF_DMA) */ -+ { 0x820f9000, 0xa3400, 0x0200 }, /* WF_LMAC_TOP BN1 (WF_WTBLOFF) */ -+ { 0x820fa000, 0xa4000, 0x0200 }, /* WF_LMAC_TOP BN1 (WF_ETBF) */ -+ { 0x820fb000, 0xa4200, 0x0400 }, /* WF_LMAC_TOP BN1 (WF_LPON) */ -+ { 0x820fc000, 0xa4600, 0x0200 }, /* WF_LMAC_TOP BN1 (WF_INT) */ -+ { 0x820fd000, 0xa4800, 0x0800 }, /* WF_LMAC_TOP BN1 (WF_MIB) */ -+ }; -+ int i; -+ -+ if (addr < 0x100000) -+ return addr; -+ -+ for (i = 0; i < ARRAY_SIZE(fixed_map); i++) { -+ u32 ofs; -+ -+ if (addr < fixed_map[i].phys) -+ continue; -+ -+ ofs = addr - fixed_map[i].phys; -+ if (ofs > fixed_map[i].size) -+ continue; -+ -+ return fixed_map[i].mapped + ofs; -+ } -+ -+ if ((addr >= 0x18000000 && addr < 0x18c00000) || -+ (addr >= 0x70000000 && addr < 0x78000000) || -+ (addr >= 0x7c000000 && addr < 0x7c400000)) -+ return mt7921_reg_map_l1(dev, addr); -+ -+ dev_err(dev->mt76.dev, "Access currently unsupported address %08x\n", -+ addr); -+ -+ return 0; -+} -+ -+static u32 mt7921_rr(struct mt76_dev *mdev, u32 offset) -+{ -+ struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76); -+ u32 addr = __mt7921_reg_addr(dev, offset); -+ -+ return dev->bus_ops->rr(mdev, addr); -+} -+ -+static void mt7921_wr(struct mt76_dev *mdev, u32 offset, u32 val) -+{ -+ struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76); -+ u32 addr = __mt7921_reg_addr(dev, offset); -+ -+ dev->bus_ops->wr(mdev, addr, val); -+} -+ -+static u32 mt7921_rmw(struct mt76_dev *mdev, u32 offset, u32 mask, u32 val) -+{ -+ struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76); -+ u32 addr = __mt7921_reg_addr(dev, offset); -+ -+ return dev->bus_ops->rmw(mdev, addr, mask, val); -+} -+ - static int mt7921_pci_probe(struct pci_dev *pdev, - const struct pci_device_id *id) - { -@@ -152,6 +256,7 @@ static int mt7921_pci_probe(struct pci_dev *pdev, - .fw_own = mt7921e_mcu_fw_pmctrl, - }; - -+ struct mt76_bus_ops *bus_ops; - struct mt7921_dev *dev; - struct mt76_dev *mdev; - int ret; -@@ -189,6 +294,25 @@ static int mt7921_pci_probe(struct pci_dev *pdev, - - mt76_mmio_init(&dev->mt76, pcim_iomap_table(pdev)[0]); - tasklet_init(&dev->irq_tasklet, mt7921_irq_tasklet, (unsigned long)dev); -+ -+ dev->phy.dev = dev; -+ dev->phy.mt76 = &dev->mt76.phy; -+ dev->mt76.phy.priv = &dev->phy; -+ dev->bus_ops = dev->mt76.bus; -+ bus_ops = devm_kmemdup(dev->mt76.dev, dev->bus_ops, sizeof(*bus_ops), -+ GFP_KERNEL); -+ if (!bus_ops) -+ return -ENOMEM; -+ -+ bus_ops->rr = mt7921_rr; -+ bus_ops->wr = mt7921_wr; -+ bus_ops->rmw = mt7921_rmw; -+ dev->mt76.bus = bus_ops; -+ -+ ret = __mt7921e_mcu_drv_pmctrl(dev); -+ if (ret) -+ return ret; -+ - mdev->rev = (mt7921_l1_rr(dev, MT_HW_CHIPID) << 16) | - (mt7921_l1_rr(dev, MT_HW_REV) & 0xff); - dev_info(mdev->dev, "ASIC revision: %04x\n", mdev->rev); -diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/pci_mcu.c b/drivers/net/wireless/mediatek/mt76/mt7921/pci_mcu.c -index f9e350b67fdc..36669e5aeef3 100644 ---- a/drivers/net/wireless/mediatek/mt76/mt7921/pci_mcu.c -+++ b/drivers/net/wireless/mediatek/mt76/mt7921/pci_mcu.c -@@ -59,10 +59,8 @@ int mt7921e_mcu_init(struct mt7921_dev *dev) - return err; - } - --int mt7921e_mcu_drv_pmctrl(struct mt7921_dev *dev) -+int __mt7921e_mcu_drv_pmctrl(struct mt7921_dev *dev) - { -- struct mt76_phy *mphy = &dev->mt76.phy; -- struct mt76_connac_pm *pm = &dev->pm; - int i, err = 0; - - for (i = 0; i < MT7921_DRV_OWN_RETRY_COUNT; i++) { -@@ -75,9 +73,21 @@ int mt7921e_mcu_drv_pmctrl(struct mt7921_dev *dev) - if (i == MT7921_DRV_OWN_RETRY_COUNT) { - dev_err(dev->mt76.dev, "driver own failed\n"); - err = -EIO; -- goto out; - } - -+ return err; -+} -+ -+int mt7921e_mcu_drv_pmctrl(struct mt7921_dev *dev) -+{ -+ struct mt76_phy *mphy = &dev->mt76.phy; -+ struct mt76_connac_pm *pm = &dev->pm; -+ int err; -+ -+ err = __mt7921e_mcu_drv_pmctrl(dev); -+ if (err < 0) -+ goto out; -+ - mt7921_wpdma_reinit_cond(dev); - clear_bit(MT76_STATE_PM, &mphy->state); - diff --git a/2410_revert-swiotlb-rework-fix-info-leak-with-dma_from_device.patch b/2410_revert-swiotlb-rework-fix-info-leak-with-dma_from_device.patch deleted file mode 100644 index 69476ab1..00000000 --- a/2410_revert-swiotlb-rework-fix-info-leak-with-dma_from_device.patch +++ /dev/null @@ -1,187 +0,0 @@ -From bddac7c1e02ba47f0570e494c9289acea3062cc1 Mon Sep 17 00:00:00 2001 -From: Linus Torvalds -Date: Sat, 26 Mar 2022 10:42:04 -0700 -Subject: Revert "swiotlb: rework "fix info leak with DMA_FROM_DEVICE"" -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -From: Linus Torvalds - -commit bddac7c1e02ba47f0570e494c9289acea3062cc1 upstream. - -This reverts commit aa6f8dcbab473f3a3c7454b74caa46d36cdc5d13. - -It turns out this breaks at least the ath9k wireless driver, and -possibly others. - -What the ath9k driver does on packet receive is to set up the DMA -transfer with: - - int ath_rx_init(..) - .. - bf->bf_buf_addr = dma_map_single(sc->dev, skb->data, - common->rx_bufsize, - DMA_FROM_DEVICE); - -and then the receive logic (through ath_rx_tasklet()) will fetch -incoming packets - - static bool ath_edma_get_buffers(..) - .. - dma_sync_single_for_cpu(sc->dev, bf->bf_buf_addr, - common->rx_bufsize, DMA_FROM_DEVICE); - - ret = ath9k_hw_process_rxdesc_edma(ah, rs, skb->data); - if (ret == -EINPROGRESS) { - /*let device gain the buffer again*/ - dma_sync_single_for_device(sc->dev, bf->bf_buf_addr, - common->rx_bufsize, DMA_FROM_DEVICE); - return false; - } - -and it's worth noting how that first DMA sync: - - dma_sync_single_for_cpu(..DMA_FROM_DEVICE); - -is there to make sure the CPU can read the DMA buffer (possibly by -copying it from the bounce buffer area, or by doing some cache flush). -The iommu correctly turns that into a "copy from bounce bufer" so that -the driver can look at the state of the packets. - -In the meantime, the device may continue to write to the DMA buffer, but -we at least have a snapshot of the state due to that first DMA sync. - -But that _second_ DMA sync: - - dma_sync_single_for_device(..DMA_FROM_DEVICE); - -is telling the DMA mapping that the CPU wasn't interested in the area -because the packet wasn't there. In the case of a DMA bounce buffer, -that is a no-op. - -Note how it's not a sync for the CPU (the "for_device()" part), and it's -not a sync for data written by the CPU (the "DMA_FROM_DEVICE" part). - -Or rather, it _should_ be a no-op. That's what commit aa6f8dcbab47 -broke: it made the code bounce the buffer unconditionally, and changed -the DMA_FROM_DEVICE to just unconditionally and illogically be -DMA_TO_DEVICE. - -[ Side note: purely within the confines of the swiotlb driver it wasn't - entirely illogical: The reason it did that odd DMA_FROM_DEVICE -> - DMA_TO_DEVICE conversion thing is because inside the swiotlb driver, - it uses just a swiotlb_bounce() helper that doesn't care about the - whole distinction of who the sync is for - only which direction to - bounce. - - So it took the "sync for device" to mean that the CPU must have been - the one writing, and thought it meant DMA_TO_DEVICE. ] - -Also note how the commentary in that commit was wrong, probably due to -that whole confusion, claiming that the commit makes the swiotlb code - - "bounce unconditionally (that is, also - when dir == DMA_TO_DEVICE) in order do avoid synchronising back stale - data from the swiotlb buffer" - -which is nonsensical for two reasons: - - - that "also when dir == DMA_TO_DEVICE" is nonsensical, as that was - exactly when it always did - and should do - the bounce. - - - since this is a sync for the device (not for the CPU), we're clearly - fundamentally not coping back stale data from the bounce buffers at - all, because we'd be copying *to* the bounce buffers. - -So that commit was just very confused. It confused the direction of the -synchronization (to the device, not the cpu) with the direction of the -DMA (from the device). - -Reported-and-bisected-by: Oleksandr Natalenko -Reported-by: Olha Cherevyk -Cc: Halil Pasic -Cc: Christoph Hellwig -Cc: Kalle Valo -Cc: Robin Murphy -Cc: Toke Høiland-Jørgensen -Cc: Maxime Bizon -Cc: Johannes Berg -Signed-off-by: Linus Torvalds -Signed-off-by: Greg Kroah-Hartman ---- - Documentation/core-api/dma-attributes.rst | 8 ++++++++ - include/linux/dma-mapping.h | 8 ++++++++ - kernel/dma/swiotlb.c | 23 ++++++++--------------- - 3 files changed, 24 insertions(+), 15 deletions(-) - ---- a/Documentation/core-api/dma-attributes.rst -+++ b/Documentation/core-api/dma-attributes.rst -@@ -130,3 +130,11 @@ accesses to DMA buffers in both privileg - subsystem that the buffer is fully accessible at the elevated privilege - level (and ideally inaccessible or at least read-only at the - lesser-privileged levels). -+ -+DMA_ATTR_OVERWRITE -+------------------ -+ -+This is a hint to the DMA-mapping subsystem that the device is expected to -+overwrite the entire mapped size, thus the caller does not require any of the -+previous buffer contents to be preserved. This allows bounce-buffering -+implementations to optimise DMA_FROM_DEVICE transfers. ---- a/include/linux/dma-mapping.h -+++ b/include/linux/dma-mapping.h -@@ -62,6 +62,14 @@ - #define DMA_ATTR_PRIVILEGED (1UL << 9) - - /* -+ * This is a hint to the DMA-mapping subsystem that the device is expected -+ * to overwrite the entire mapped size, thus the caller does not require any -+ * of the previous buffer contents to be preserved. This allows -+ * bounce-buffering implementations to optimise DMA_FROM_DEVICE transfers. -+ */ -+#define DMA_ATTR_OVERWRITE (1UL << 10) -+ -+/* - * A dma_addr_t can hold any valid DMA or bus address for the platform. It can - * be given to a device to use as a DMA source or target. It is specific to a - * given device and there may be a translation between the CPU physical address ---- a/kernel/dma/swiotlb.c -+++ b/kernel/dma/swiotlb.c -@@ -627,14 +627,10 @@ phys_addr_t swiotlb_tbl_map_single(struc - for (i = 0; i < nr_slots(alloc_size + offset); i++) - mem->slots[index + i].orig_addr = slot_addr(orig_addr, i); - tlb_addr = slot_addr(mem->start, index) + offset; -- /* -- * When dir == DMA_FROM_DEVICE we could omit the copy from the orig -- * to the tlb buffer, if we knew for sure the device will -- * overwirte the entire current content. But we don't. Thus -- * unconditional bounce may prevent leaking swiotlb content (i.e. -- * kernel memory) to user-space. -- */ -- swiotlb_bounce(dev, tlb_addr, mapping_size, DMA_TO_DEVICE); -+ if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC) && -+ (!(attrs & DMA_ATTR_OVERWRITE) || dir == DMA_TO_DEVICE || -+ dir == DMA_BIDIRECTIONAL)) -+ swiotlb_bounce(dev, tlb_addr, mapping_size, DMA_TO_DEVICE); - return tlb_addr; - } - -@@ -701,13 +697,10 @@ void swiotlb_tbl_unmap_single(struct dev - void swiotlb_sync_single_for_device(struct device *dev, phys_addr_t tlb_addr, - size_t size, enum dma_data_direction dir) - { -- /* -- * Unconditional bounce is necessary to avoid corruption on -- * sync_*_for_cpu or dma_ummap_* when the device didn't overwrite -- * the whole lengt of the bounce buffer. -- */ -- swiotlb_bounce(dev, tlb_addr, size, DMA_TO_DEVICE); -- BUG_ON(!valid_dma_direction(dir)); -+ if (dir == DMA_TO_DEVICE || dir == DMA_BIDIRECTIONAL) -+ swiotlb_bounce(dev, tlb_addr, size, DMA_TO_DEVICE); -+ else -+ BUG_ON(dir != DMA_FROM_DEVICE); - } - - void swiotlb_sync_single_for_cpu(struct device *dev, phys_addr_t tlb_addr,