linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Wysocki, Rafael J" <rafael.j.wysocki@intel.com>
To: Kai-Heng Feng <kai.heng.feng@canonical.com>,
	Vidya Sagar <vidyas@nvidia.com>
Cc: <bhelgaas@google.com>,
	<sathyanarayanan.kuppuswamy@linux.intel.com>,
	<enriquezmark36@gmail.com>, <tasev.stefanoska@skynet.be>,
	<linux-pci@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<treding@nvidia.com>, <jonathanh@nvidia.com>, <kthota@nvidia.com>,
	<mmaddireddy@nvidia.com>, <sagar.tv@gmail.com>
Subject: Re: [PATCH V1] PCI/ASPM: Skip L1SS save/restore if not already enabled
Date: Thu, 19 Jan 2023 20:01:37 +0100	[thread overview]
Message-ID: <3da4a67c-75e7-5100-dd8b-eee6a442a8c8@intel.com> (raw)
In-Reply-To: <CAAd53p5R9BHoYpHq6WNgwtUAXmvNQnk6gA=C27JTfqeozRKCzQ@mail.gmail.com>


On 1/19/2023 3:21 PM, Kai-Heng Feng wrote:
> Hi Vidya,
>
> On Thu, Jan 19, 2023 at 5:49 PM Vidya Sagar <vidyas@nvidia.com> wrote:
>> Skip save and restore of ASPM L1 Sub-States specific registers if they
>> are not already enabled in the system. This is to avoid issues observed
>> on certain platforms during restoration process, particularly when
>> restoring the L1SS registers contents.
>>
>> BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=216782
>> Signed-off-by: Vidya Sagar <vidyas@nvidia.com>
>> ---
>>   drivers/pci/pcie/aspm.c | 19 ++++++++++++++++++-
>>   1 file changed, 18 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
>> index 53a1fa306e1e..5d3f09b0a6a9 100644
>> --- a/drivers/pci/pcie/aspm.c
>> +++ b/drivers/pci/pcie/aspm.c
>> @@ -757,15 +757,29 @@ static void pcie_config_aspm_l1ss(struct pcie_link_state *link, u32 state)
>>                                  PCI_L1SS_CTL1_L1SS_MASK, val);
>>   }
>>
>> +static bool skip_l1ss_restore;
> Maybe move it inside "struct pci_dev"?

Yes, it can be different for different devices, so it cannot be static IMV.


>> +
>>   void pci_save_aspm_l1ss_state(struct pci_dev *dev)
>>   {
>>          struct pci_cap_saved_state *save_state;
>>          u16 l1ss = dev->l1ss;
>> -       u32 *cap;
>> +       u32 *cap, val;
>>
>>          if (!l1ss)
>>                  return;
>>
>> +       /*
>> +        * Skip save and restore of L1 Sub-States registers if they are not
>> +        * already enabled in the system
>> +        */
>> +       pci_read_config_dword(dev, l1ss + PCI_L1SS_CTL1, &val);
>> +       if (!(val & PCI_L1SS_CTL1_L1SS_MASK)) {
>> +               skip_l1ss_restore = 1;
>> +               return;
>> +       }
>> +
>> +       skip_l1ss_restore = 0;
>> +
>>          save_state = pci_find_saved_ext_cap(dev, PCI_EXT_CAP_ID_L1SS);
>>          if (!save_state)
>>                  return;
>> @@ -784,6 +798,9 @@ void pci_restore_aspm_l1ss_state(struct pci_dev *dev)
>>          if (!l1ss)
>>                  return;
>>
>> +       if (skip_l1ss_restore)
>> +               return;
>> +
>>          save_state = pci_find_saved_ext_cap(dev, PCI_EXT_CAP_ID_L1SS);
>>          if (!save_state)
>>                  return;
>> --
>> 2.17.1
>>

  reply	other threads:[~2023-01-19 19:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-19  9:49 [PATCH V1] PCI/ASPM: Skip L1SS save/restore if not already enabled Vidya Sagar
2023-01-19 14:21 ` Kai-Heng Feng
2023-01-19 19:01   ` Wysocki, Rafael J [this message]
2023-01-20  9:15 ` [PATCH V2] " Vidya Sagar
2023-01-20 18:41   ` Wysocki, Rafael J
2023-02-08 23:42   ` Bjorn Helgaas
2023-02-10  0:18     ` Bjorn Helgaas
     [not found]       ` <CAKd_mfQyZ4fePBH4Rtg94g00mRoqUcmukWX1EgzwowNLzdhcSg@mail.gmail.com>
2023-02-10 13:39         ` Mark Enriquez
2023-02-10 13:56           ` Bjorn Helgaas
2023-02-10 17:47             ` Mark Enriquez

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=3da4a67c-75e7-5100-dd8b-eee6a442a8c8@intel.com \
    --to=rafael.j.wysocki@intel.com \
    --cc=bhelgaas@google.com \
    --cc=enriquezmark36@gmail.com \
    --cc=jonathanh@nvidia.com \
    --cc=kai.heng.feng@canonical.com \
    --cc=kthota@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mmaddireddy@nvidia.com \
    --cc=sagar.tv@gmail.com \
    --cc=sathyanarayanan.kuppuswamy@linux.intel.com \
    --cc=tasev.stefanoska@skynet.be \
    --cc=treding@nvidia.com \
    --cc=vidyas@nvidia.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;
as well as URLs for NNTP newsgroup(s).