Message ID | 20230329195758.7384-1-mario.limonciello@amd.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp663886vqo; Wed, 29 Mar 2023 13:18:17 -0700 (PDT) X-Google-Smtp-Source: AKy350Zs0L9BaSpW49fyBAWCxLXRjJ1LdMaohdLkbQSL74+2gQ9/Do95O39ZKJTqUQNob3s34oOV X-Received: by 2002:a17:906:3485:b0:922:c4f8:806c with SMTP id g5-20020a170906348500b00922c4f8806cmr19871977ejb.60.1680121097406; Wed, 29 Mar 2023 13:18:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1680121097; cv=pass; d=google.com; s=arc-20160816; b=eoD+s+pVGWE/VDbmubUR6K56YxpVyqZ4S7jZGcVjekG94LVo9dVoj7FWSM20qBfMlI sMmdz7orxkPfeM9RD4CWbQTZbKoj1QG6DuvLnItXUOCeLdlmk3cJFiTUKoXxFfGAqZ8y VMU1T9IpenSGmhjqeFbVsBRAMV3OHTfzM2IFfxjsfTzqL8JL7IMBxepQo/PqpsH/mt76 wEVb6Y6o80sBHZX4nzeHxGBXJjhQbt/5gnFTVeYrSu9S4RFacxnEy0bhe+59uWEomj5w NwNRvn2iNaSGAkLLtKPWraHQ31gSJtvvF9FtJC7fYfW3Me7nyN0A0nBhaV3mjCkgEY1J o6Zg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=FNFGl7TALMtvWy3apPkbvlgPa76IuL44/SWQbOr3jtU=; b=lt7ZmC+gFipWCLmAyENJyMqz1H8AWTnJ7EI/sfecUT6BhXACm8/VvtHlmx0TJn+In0 tW6CxXXR8Uf1QRhpOA3UYafNOfsFz3425R8cDaGpLRvJMPYcOGjNJmqIrdlkN8b5su0E slD5MyrvKChBxTwnLx9mE8MkSi1fBSt26ZlUfXtNoOZ9U8ZRDAXxr4qalA1OMwq7vLjF YSUczE+ANUHXdPqh9d6ndMRAdsEE/R86hLUSRneen0OIgIlBpjOt5AF2cd8fGxgqtjEk nMcSK2Pyp3Nzt09vmfco5ydj63rA3SVWM+kQ6I9CJPi2Feimklhnh+pVgZnfUC9LJGaW jWfA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=p6pB9pIO; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u11-20020a170906950b00b009332d9b2a96si24348019ejx.955.2023.03.29.13.17.52; Wed, 29 Mar 2023 13:18:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=p6pB9pIO; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230362AbjC2T6b (ORCPT <rfc822;rua109.linux@gmail.com> + 99 others); Wed, 29 Mar 2023 15:58:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229643AbjC2T63 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 29 Mar 2023 15:58:29 -0400 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2059.outbound.protection.outlook.com [40.107.96.59]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D917A2D4D; Wed, 29 Mar 2023 12:58:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XEY0imW0BQHs0nz4woiTz3Y9GevJechg44GBRlAyei++RUhz/pFb8hlnJp3kkQrJlnghZJ17j+xPUXsT/solzCnYyAeEZtjAnI4M6ZxnlPy81Q/Ulw2ysxdvcwT1cyqPvqmpI0yH4LB796bXiYrl56Pi0pQqD1MFLDrC0sGYOMlJ1Bp2AodivSswcs8/XHRtRNtNSKX06aG4O0W+jogYyyLXr84s+xDbQZO9gEHJLSsKrgsXso+wClf0PAvvYJr8CKuUIp2CbxYz79iDSHYxE74SGhuYvS030kSuK6D2FVlxVCMtimmpyiKuQmYF6cyCS4ozacL4WZbR/Q1lt9mcWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=FNFGl7TALMtvWy3apPkbvlgPa76IuL44/SWQbOr3jtU=; b=jxRcWPCiEHVihAvMVbPHMa6A9v7DwTRm578VHkiUHxAfaLugQGQ/bfLm7Q18dT6iFSFxtNu7++seNFxDbx0UBcc754/Km/A2cFaefCC1Te5oQ6P2clI6isLVb9gabpXUa8oeoiP4/ywvALQS1e/EuVhj/iJgE0b9Ka/Y4earOj93v+dd0IQ0iZNraaRfmhs6VA9kt5nL8T5QjBFT7RujKKTbRPhca8qlYsSg9QZBDlRRGMD9l2edG5sBDDNfuJbtSwke1xcZNoRqU2mGNivPafEKhRKs5itg+7gk62uFX2fp7441vxNL1i7jl1p+IqsaDQBGfIqGcc31U36gTg/htw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nbd.name smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FNFGl7TALMtvWy3apPkbvlgPa76IuL44/SWQbOr3jtU=; b=p6pB9pIOqhDV+XyLqtyzWNt8JeAFoskMlnN5XJvOG30fk0KLtTCy6dSNgK24qvGonONX/iFpPlgi0SzDtn3CkFArfViUTgR/Dd+RoczEI8fNbWnQshlx+ReHGYZCtoDrgnvIYcc8pm91/hBOLFpzuS55yjZdN/mzCwPbytajsDI= Received: from BN9PR03CA0254.namprd03.prod.outlook.com (2603:10b6:408:ff::19) by CY8PR12MB7415.namprd12.prod.outlook.com (2603:10b6:930:5d::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.28; Wed, 29 Mar 2023 19:58:19 +0000 Received: from BN8NAM11FT114.eop-nam11.prod.protection.outlook.com (2603:10b6:408:ff:cafe::2a) by BN9PR03CA0254.outlook.office365.com (2603:10b6:408:ff::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.43 via Frontend Transport; Wed, 29 Mar 2023 19:58:19 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT114.mail.protection.outlook.com (10.13.177.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6222.22 via Frontend Transport; Wed, 29 Mar 2023 19:58:16 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 29 Mar 2023 14:58:14 -0500 From: Mario Limonciello <mario.limonciello@amd.com> To: <nbd@nbd.name>, <lorenzo@kernel.org>, <ryder.lee@mediatek.com>, <shayne.chen@mediatek.com>, <sean.wang@mediatek.com>, Matthias Brugger <matthias.bgg@gmail.com> CC: Mario Limonciello <mario.limonciello@amd.com>, Anson Tsao <anson.tsao@amd.com>, Kalle Valo <kvalo@kernel.org>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, <linux-wireless@vger.kernel.org>, <netdev@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org>, <linux-mediatek@lists.infradead.org>, <linux-kernel@vger.kernel.org> Subject: [PATCH RESEND] wifi: mt76: mt7921e: Set memory space enable in PCI_COMMAND if unset Date: Wed, 29 Mar 2023 14:57:58 -0500 Message-ID: <20230329195758.7384-1-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT114:EE_|CY8PR12MB7415:EE_ X-MS-Office365-Filtering-Correlation-Id: 410c2fd0-d708-465c-1a83-08db308ff000 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ELgMX/NcJQIZfKFBrNswTUnIyYmZfxwDwwizQozyGDOdC4Gd+Mdq7RrByjbahnyK6ngVPt71gC+Y8jhODZnlawliwU6OmwCMUpAshRDFaZA70pgfY6CFQMZtUCfOHb6Gy32Jxy608+wzi0sfnWIAtljNCh6Rz63FHtybzaL5TLc166Z0XRITzLuROJUD3e9q1tzicYW9cRJ0Up4zvZMe4R5Acc0wBMZvpQzMnKqOsECacnBCHcPEkGJdlyMMEt9fbpkZdld79prY9kvA/bP4xyFs3R2cxCWZCzJFZhac1nVTqGBLU/75UbJ0JY+9Wvbztx4/k6Shwn7AUuQV1RlklguMi/Vg5DnLtIQkHgYMEs17D4QraKOJuIfXUblEd4QLYQFqBi7/RK9SPZnmGr/S2jMJk6J/MUA023vr3/Q0XE3sDMcBWhpvoVldPsjq/nI041FrSBzlysyxKTZZ0Qv3OLGDf8g3qbyjLJSKjA6vROix4joG4qOlF6qdBTRoVjhdBIQ/wuC+Ecg+eEIB5lTzUCN8DUrINvWZvrG2Xg/1bb3j3ZCoTTWDw4fqKnLyRqV9CnV4Hgu7aV/HYM3A3TarMZuLZuQzdhErfUHITZA/2zrOH8NbwOfUjj6jnFGvPtXr49QkfLLCx0ETZa7b/SO0yW5Bp1fDNp/9Rv2bZXEc6mTKjFw6KKf3XcsByjXeTT+d9BqQnbjcfTy+ZZyz8NXM7E9/De1GnlG8H/PVK4c0WJ8= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(346002)(39860400002)(396003)(376002)(136003)(451199021)(40470700004)(46966006)(36840700001)(8936002)(47076005)(2906002)(336012)(83380400001)(426003)(2616005)(41300700001)(86362001)(36860700001)(36756003)(40460700003)(82740400003)(5660300002)(81166007)(356005)(40480700001)(966005)(478600001)(7696005)(8676002)(54906003)(70206006)(70586007)(4326008)(7416002)(16526019)(44832011)(6666004)(186003)(82310400005)(1076003)(26005)(316002)(110136005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Mar 2023 19:58:16.7583 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 410c2fd0-d708-465c-1a83-08db308ff000 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT114.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7415 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761734660017450856?= X-GMAIL-MSGID: =?utf-8?q?1761734660017450856?= |
Series |
[RESEND] wifi: mt76: mt7921e: Set memory space enable in PCI_COMMAND if unset
|
|
Commit Message
Mario Limonciello
March 29, 2023, 7:57 p.m. UTC
When the BIOS has been configured for Fast Boot, systems with mt7921e have non-functional wifi. Turning on Fast boot caused both bus master enable and memory space enable bits in PCI_COMMAND not to get configured. The mt7921 driver already sets bus master enable, but explicitly check and set memory access enable as well to fix this problem. Tested-by: Anson Tsao <anson.tsao@amd.com> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> --- Original patch was submitted ~3 weeks ago with no comments. Link: https://lore.kernel.org/all/20230310170002.200-1-mario.limonciello@amd.com/ --- drivers/net/wireless/mediatek/mt76/mt7921/pci.c | 6 ++++++ 1 file changed, 6 insertions(+)
Comments
Hi, On Wed, Mar 29, 2023 at 1:18 PM Mario Limonciello <mario.limonciello@amd.com> wrote: > > When the BIOS has been configured for Fast Boot, systems with mt7921e > have non-functional wifi. Turning on Fast boot caused both bus master > enable and memory space enable bits in PCI_COMMAND not to get configured. > > The mt7921 driver already sets bus master enable, but explicitly check > and set memory access enable as well to fix this problem. > > Tested-by: Anson Tsao <anson.tsao@amd.com> > Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> > --- > Original patch was submitted ~3 weeks ago with no comments. > Link: https://lore.kernel.org/all/20230310170002.200-1-mario.limonciello@amd.com/ > --- > drivers/net/wireless/mediatek/mt76/mt7921/pci.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c > index cb72ded37256..aa1a427b16c2 100644 > --- a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c > +++ b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c > @@ -263,6 +263,7 @@ static int mt7921_pci_probe(struct pci_dev *pdev, > struct mt76_dev *mdev; > u8 features; > int ret; > + u16 cmd; > > ret = pcim_enable_device(pdev); > if (ret) > @@ -272,6 +273,11 @@ static int mt7921_pci_probe(struct pci_dev *pdev, > if (ret) > return ret; > > + pci_read_config_word(pdev, PCI_COMMAND, &cmd); > + if (!(cmd & PCI_COMMAND_MEMORY)) { > + cmd |= PCI_COMMAND_MEMORY; > + pci_write_config_word(pdev, PCI_COMMAND, cmd); > + } If PCI_COMMAND_MEMORY is required in any circumstance, then we don't need to add a conditional check and OR it with PCI_COMMAND_MEMORY. Also, I will try the patch on another Intel machine to see if it worked. Sean > pci_set_master(pdev); > > ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_ALL_TYPES); > -- > 2.34.1 >
On 3/29/2023 18:24, Sean Wang wrote: > Hi, > > On Wed, Mar 29, 2023 at 1:18 PM Mario Limonciello > <mario.limonciello@amd.com> wrote: >> >> When the BIOS has been configured for Fast Boot, systems with mt7921e >> have non-functional wifi. Turning on Fast boot caused both bus master >> enable and memory space enable bits in PCI_COMMAND not to get configured. >> >> The mt7921 driver already sets bus master enable, but explicitly check >> and set memory access enable as well to fix this problem. >> >> Tested-by: Anson Tsao <anson.tsao@amd.com> >> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> >> --- >> Original patch was submitted ~3 weeks ago with no comments. >> Link: https://lore.kernel.org/all/20230310170002.200-1-mario.limonciello@amd.com/ >> --- >> drivers/net/wireless/mediatek/mt76/mt7921/pci.c | 6 ++++++ >> 1 file changed, 6 insertions(+) >> >> diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c >> index cb72ded37256..aa1a427b16c2 100644 >> --- a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c >> +++ b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c >> @@ -263,6 +263,7 @@ static int mt7921_pci_probe(struct pci_dev *pdev, >> struct mt76_dev *mdev; >> u8 features; >> int ret; >> + u16 cmd; >> >> ret = pcim_enable_device(pdev); >> if (ret) >> @@ -272,6 +273,11 @@ static int mt7921_pci_probe(struct pci_dev *pdev, >> if (ret) >> return ret; >> >> + pci_read_config_word(pdev, PCI_COMMAND, &cmd); >> + if (!(cmd & PCI_COMMAND_MEMORY)) { >> + cmd |= PCI_COMMAND_MEMORY; >> + pci_write_config_word(pdev, PCI_COMMAND, cmd); >> + } > > If PCI_COMMAND_MEMORY is required in any circumstance, then we don't > need to add a conditional check and OR it with PCI_COMMAND_MEMORY. Generally it seemed advantageous to avoid an extra PCI write if it's not needed. For example that's how bus mastering works too (see __pci_set_master). > Also, I will try the patch on another Intel machine to see if it worked. Thanks. > > Sean > >> pci_set_master(pdev); >> >> ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_ALL_TYPES); >> -- >> 2.34.1 >>
[Public] > On 3/29/2023 18:24, Sean Wang wrote: > > Hi, > > > > On Wed, Mar 29, 2023 at 1:18 PM Mario Limonciello > > <mario.limonciello@amd.com> wrote: > >> > >> When the BIOS has been configured for Fast Boot, systems with mt7921e > >> have non-functional wifi. Turning on Fast boot caused both bus master > >> enable and memory space enable bits in PCI_COMMAND not to get > configured. > >> > >> The mt7921 driver already sets bus master enable, but explicitly check > >> and set memory access enable as well to fix this problem. > >> > >> Tested-by: Anson Tsao <anson.tsao@amd.com> > >> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> > >> --- > >> Original patch was submitted ~3 weeks ago with no comments. > >> Link: https://lore.kernel.org/all/20230310170002.200-1- > mario.limonciello@amd.com/ > >> --- > >> drivers/net/wireless/mediatek/mt76/mt7921/pci.c | 6 ++++++ > >> 1 file changed, 6 insertions(+) > >> > >> diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c > b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c > >> index cb72ded37256..aa1a427b16c2 100644 > >> --- a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c > >> +++ b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c > >> @@ -263,6 +263,7 @@ static int mt7921_pci_probe(struct pci_dev *pdev, > >> struct mt76_dev *mdev; > >> u8 features; > >> int ret; > >> + u16 cmd; > >> > >> ret = pcim_enable_device(pdev); > >> if (ret) > >> @@ -272,6 +273,11 @@ static int mt7921_pci_probe(struct pci_dev > *pdev, > >> if (ret) > >> return ret; > >> > >> + pci_read_config_word(pdev, PCI_COMMAND, &cmd); > >> + if (!(cmd & PCI_COMMAND_MEMORY)) { > >> + cmd |= PCI_COMMAND_MEMORY; > >> + pci_write_config_word(pdev, PCI_COMMAND, cmd); > >> + } > > > > If PCI_COMMAND_MEMORY is required in any circumstance, then we > don't > > need to add a conditional check and OR it with PCI_COMMAND_MEMORY. > > Generally it seemed advantageous to avoid an extra PCI write if it's not > needed. For example that's how bus mastering works too (see > __pci_set_master). > > > > Also, I will try the patch on another Intel machine to see if it worked. > > Thanks. Did you get a chance to try this on an Intel system? > > > > > Sean > > > >> pci_set_master(pdev); > >> > >> ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_ALL_TYPES); > >> -- > >> 2.34.1 > >>
On Mon, Apr 3, 2023 at 6:42 AM Limonciello, Mario <Mario.Limonciello@amd.com> wrote: > > [Public] > > > On 3/29/2023 18:24, Sean Wang wrote: > > > Hi, > > > > > > On Wed, Mar 29, 2023 at 1:18 PM Mario Limonciello > > > <mario.limonciello@amd.com> wrote: > > >> > > >> When the BIOS has been configured for Fast Boot, systems with mt7921e > > >> have non-functional wifi. Turning on Fast boot caused both bus master > > >> enable and memory space enable bits in PCI_COMMAND not to get > > configured. > > >> > > >> The mt7921 driver already sets bus master enable, but explicitly check > > >> and set memory access enable as well to fix this problem. > > >> > > >> Tested-by: Anson Tsao <anson.tsao@amd.com> > > >> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> > > >> --- > > >> Original patch was submitted ~3 weeks ago with no comments. > > >> Link: https://lore.kernel.org/all/20230310170002.200-1- > > mario.limonciello@amd.com/ > > >> --- > > >> drivers/net/wireless/mediatek/mt76/mt7921/pci.c | 6 ++++++ > > >> 1 file changed, 6 insertions(+) > > >> > > >> diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c > > b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c > > >> index cb72ded37256..aa1a427b16c2 100644 > > >> --- a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c > > >> +++ b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c > > >> @@ -263,6 +263,7 @@ static int mt7921_pci_probe(struct pci_dev *pdev, > > >> struct mt76_dev *mdev; > > >> u8 features; > > >> int ret; > > >> + u16 cmd; > > >> > > >> ret = pcim_enable_device(pdev); > > >> if (ret) > > >> @@ -272,6 +273,11 @@ static int mt7921_pci_probe(struct pci_dev > > *pdev, > > >> if (ret) > > >> return ret; > > >> > > >> + pci_read_config_word(pdev, PCI_COMMAND, &cmd); > > >> + if (!(cmd & PCI_COMMAND_MEMORY)) { > > >> + cmd |= PCI_COMMAND_MEMORY; > > >> + pci_write_config_word(pdev, PCI_COMMAND, cmd); > > >> + } > > > > > > If PCI_COMMAND_MEMORY is required in any circumstance, then we > > don't > > > need to add a conditional check and OR it with PCI_COMMAND_MEMORY. > > > > Generally it seemed advantageous to avoid an extra PCI write if it's not > > needed. For example that's how bus mastering works too (see > > __pci_set_master). > > > > > > > Also, I will try the patch on another Intel machine to see if it worked. > > > > Thanks. > > Did you get a chance to try this on an Intel system? Hi, Sorry for the late response. We have tested the related Intel platform and it worked fine. You can add the tag from me like Acked-by: Sean Wang <sean.wang@mediatek.com> > > > > > > > > > Sean > > > > > >> pci_set_master(pdev); > > >> > > >> ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_ALL_TYPES); > > >> -- > > >> 2.34.1 > > >>
On 4/9/23 19:57, Sean Wang wrote: > On Mon, Apr 3, 2023 at 6:42 AM Limonciello, Mario > <Mario.Limonciello@amd.com> wrote: >> [Public] >> >>> On 3/29/2023 18:24, Sean Wang wrote: >>>> Hi, >>>> >>>> On Wed, Mar 29, 2023 at 1:18 PM Mario Limonciello >>>> <mario.limonciello@amd.com> wrote: >>>>> When the BIOS has been configured for Fast Boot, systems with mt7921e >>>>> have non-functional wifi. Turning on Fast boot caused both bus master >>>>> enable and memory space enable bits in PCI_COMMAND not to get >>> configured. >>>>> The mt7921 driver already sets bus master enable, but explicitly check >>>>> and set memory access enable as well to fix this problem. >>>>> >>>>> Tested-by: Anson Tsao <anson.tsao@amd.com> >>>>> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> >>>>> --- >>>>> Original patch was submitted ~3 weeks ago with no comments. >>>>> Link: https://lore.kernel.org/all/20230310170002.200-1- >>> mario.limonciello@amd.com/ >>>>> --- >>>>> drivers/net/wireless/mediatek/mt76/mt7921/pci.c | 6 ++++++ >>>>> 1 file changed, 6 insertions(+) >>>>> >>>>> diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c >>> b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c >>>>> index cb72ded37256..aa1a427b16c2 100644 >>>>> --- a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c >>>>> +++ b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c >>>>> @@ -263,6 +263,7 @@ static int mt7921_pci_probe(struct pci_dev *pdev, >>>>> struct mt76_dev *mdev; >>>>> u8 features; >>>>> int ret; >>>>> + u16 cmd; >>>>> >>>>> ret = pcim_enable_device(pdev); >>>>> if (ret) >>>>> @@ -272,6 +273,11 @@ static int mt7921_pci_probe(struct pci_dev >>> *pdev, >>>>> if (ret) >>>>> return ret; >>>>> >>>>> + pci_read_config_word(pdev, PCI_COMMAND, &cmd); >>>>> + if (!(cmd & PCI_COMMAND_MEMORY)) { >>>>> + cmd |= PCI_COMMAND_MEMORY; >>>>> + pci_write_config_word(pdev, PCI_COMMAND, cmd); >>>>> + } >>>> If PCI_COMMAND_MEMORY is required in any circumstance, then we >>> don't >>>> need to add a conditional check and OR it with PCI_COMMAND_MEMORY. >>> Generally it seemed advantageous to avoid an extra PCI write if it's not >>> needed. For example that's how bus mastering works too (see >>> __pci_set_master). >>> >>> >>>> Also, I will try the patch on another Intel machine to see if it worked. >>> Thanks. >> Did you get a chance to try this on an Intel system? > Hi, > > Sorry for the late response. We have tested the related Intel platform > and it worked fine. You can add the tag from me like > Acked-by: Sean Wang <sean.wang@mediatek.com> > Thanks! Felix, Lorenzo, or Ryder can you guys please pick this up? Thanks,
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c index cb72ded37256..aa1a427b16c2 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c @@ -263,6 +263,7 @@ static int mt7921_pci_probe(struct pci_dev *pdev, struct mt76_dev *mdev; u8 features; int ret; + u16 cmd; ret = pcim_enable_device(pdev); if (ret) @@ -272,6 +273,11 @@ static int mt7921_pci_probe(struct pci_dev *pdev, if (ret) return ret; + pci_read_config_word(pdev, PCI_COMMAND, &cmd); + if (!(cmd & PCI_COMMAND_MEMORY)) { + cmd |= PCI_COMMAND_MEMORY; + pci_write_config_word(pdev, PCI_COMMAND, cmd); + } pci_set_master(pdev); ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_ALL_TYPES);