public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Limonciello, Mario" <mario.limonciello@amd.com>
To: Sean Wang <sean.wang@kernel.org>
Cc: nbd@nbd.name, lorenzo@kernel.org, ryder.lee@mediatek.com,
	shayne.chen@mediatek.com, sean.wang@mediatek.com,
	Matthias Brugger <matthias.bgg@gmail.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: Re: [PATCH RESEND] wifi: mt76: mt7921e: Set memory space enable in PCI_COMMAND if unset
Date: Thu, 30 Mar 2023 09:13:37 -0500	[thread overview]
Message-ID: <cdf612bf-96f6-9b4e-a32c-50007892083c@amd.com> (raw)
In-Reply-To: <CAGp9LzrkX4uFAtLwvjH+uUuRgT_YDg3eE8SqgWEXOFmw5r=aMQ@mail.gmail.com>

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
>>


  reply	other threads:[~2023-03-30 14:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-29 19:57 [PATCH RESEND] wifi: mt76: mt7921e: Set memory space enable in PCI_COMMAND if unset Mario Limonciello
2023-03-29 23:24 ` Sean Wang
2023-03-30 14:13   ` Limonciello, Mario [this message]
2023-04-03 13:42     ` Limonciello, Mario
2023-04-10  0:57       ` Sean Wang
2023-04-10  1:04         ` Mario Limonciello

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cdf612bf-96f6-9b4e-a32c-50007892083c@amd.com \
    --to=mario.limonciello@amd.com \
    --cc=anson.tsao@amd.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=kvalo@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lorenzo@kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=nbd@nbd.name \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=ryder.lee@mediatek.com \
    --cc=sean.wang@kernel.org \
    --cc=sean.wang@mediatek.com \
    --cc=shayne.chen@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox