From: Bjorn Helgaas <helgaas@kernel.org>
To: "Saheed O. Bolarinwa" <refactormyself@gmail.com>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH v2 3/7] PCI/ASPM: Compute the value of aspm_register_info.support directly
Date: Thu, 24 Sep 2020 17:36:36 -0500 [thread overview]
Message-ID: <20200924223636.GA2366261@bjorn-Precision-5520> (raw)
In-Reply-To: <20200924142443.260861-4-refactormyself@gmail.com>
On Thu, Sep 24, 2020 at 04:24:39PM +0200, Saheed O. Bolarinwa wrote:
> - Calculate aspm_register_info.support inside aspm_support()
> - Replace references to aspm_register_info.support with aspm_support().
> - In pcie_get_aspm_reg() remove assignment to aspm_register_info.support
> - Remove aspm_register_info.support
>
> Signed-off-by: Saheed O. Bolarinwa <refactormyself@gmail.com>
> ---
> drivers/pci/pcie/aspm.c | 22 +++++++++++++---------
> 1 file changed, 13 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
> index 5f7cf47b6a40..321b328347c1 100644
> --- a/drivers/pci/pcie/aspm.c
> +++ b/drivers/pci/pcie/aspm.c
> @@ -383,7 +383,6 @@ static void encode_l12_threshold(u32 threshold_us, u32 *scale, u32 *value)
> }
>
> struct aspm_register_info {
> - u32 support:2;
> u32 enabled:2;
>
> /* L1 substates */
> @@ -396,12 +395,10 @@ struct aspm_register_info {
> static void pcie_get_aspm_reg(struct pci_dev *pdev,
> struct aspm_register_info *info)
> {
> - u16 reg16;
> - u32 reg32 = pdev->lnkcap;
> + u16 ctl;
Don't include unrelated changes. The change from "reg16" to "ctl" is
gratuitous, and it makes this patch harder to read. I think you
remove it later anyway.
> - info->support = (reg32 & PCI_EXP_LNKCAP_ASPMS) >> 10;
> - pcie_capability_read_word(pdev, PCI_EXP_LNKCTL, ®16);
> - info->enabled = reg16 & PCI_EXP_LNKCTL_ASPMC;
> + pcie_capability_read_word(pdev, PCI_EXP_LNKCTL, &ctl);
> + info->enabled = ctl & PCI_EXP_LNKCTL_ASPMC;
>
> /* Read L1 PM substate capabilities */
> info->l1ss_cap = info->l1ss_ctl1 = info->l1ss_ctl2 = 0;
> @@ -540,6 +537,11 @@ static void aspm_calc_l1ss_info(struct pcie_link_state *link,
> link->l1ss.ctl1 |= t_common_mode << 8 | scale << 29 | value << 16;
> }
>
> +static void aspm_support(struct pci_dev *pdev)
> +{
> + return (pdev->lnkcap & PCI_EXP_LNKCAP_ASPMS) >> 10;
Oops, this doesn't build! Should return a u32.
> +}
> +
> static void pcie_aspm_cap_init(struct pcie_link_state *link, int blacklist)
> {
> struct pci_dev *child = link->downstream, *parent = link->pdev;
> @@ -561,7 +563,7 @@ static void pcie_aspm_cap_init(struct pcie_link_state *link, int blacklist)
> * If ASPM not supported, don't mess with the clocks and link,
> * bail out now.
> */
> - if (!(upreg.support & dwreg.support))
> + if (!(aspm_support(parent) & aspm_support(child)))
> return;
>
> /* Configure common clock before checking latencies */
> @@ -581,8 +583,9 @@ static void pcie_aspm_cap_init(struct pcie_link_state *link, int blacklist)
> * given link unless components on both sides of the link each
> * support L0s.
> */
> - if (dwreg.support & upreg.support & PCIE_LINK_STATE_L0S)
> + if (aspm_support(parent) & aspm_support(child) & PCIE_LINK_STATE_L0S)
> link->aspm_support |= ASPM_STATE_L0S;
> +
> if (dwreg.enabled & PCIE_LINK_STATE_L0S)
> link->aspm_enabled |= ASPM_STATE_L0S_UP;
> if (upreg.enabled & PCIE_LINK_STATE_L0S)
> @@ -591,8 +594,9 @@ static void pcie_aspm_cap_init(struct pcie_link_state *link, int blacklist)
> link->latency_dw.l0s = calc_l0s_latency(child);
>
> /* Setup L1 state */
> - if (upreg.support & dwreg.support & PCIE_LINK_STATE_L1)
> + if (aspm_support(parent) & aspm_support(child) & PCIE_LINK_STATE_L1)
> link->aspm_support |= ASPM_STATE_L1;
> +
> if (upreg.enabled & dwreg.enabled & PCIE_LINK_STATE_L1)
> link->aspm_enabled |= ASPM_STATE_L1;
> link->latency_up.l1 = calc_l1_latency(parent);
> --
> 2.18.4
>
next prev parent reply other threads:[~2020-09-24 22:36 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-24 14:24 [PATCH v2 0/7] PCI/ASPM: Move some ASPM info to struct pci_dev Saheed O. Bolarinwa
2020-09-24 14:24 ` [PATCH v2 1/7] PCI/ASPM: Cache device's ASPM link capability in " Saheed O. Bolarinwa
2020-09-24 22:28 ` Bjorn Helgaas
2020-09-24 22:32 ` Bjorn Helgaas
2020-09-24 22:53 ` Bjorn Helgaas
2020-09-24 14:24 ` [PATCH v2 2/7] PCI/ASPM: Rework calc_l*_latency() to take a " Saheed O. Bolarinwa
2020-09-24 14:24 ` [PATCH v2 3/7] PCI/ASPM: Compute the value of aspm_register_info.support directly Saheed O. Bolarinwa
2020-09-24 22:36 ` Bjorn Helgaas [this message]
2020-09-25 4:22 ` kernel test robot
2020-09-24 14:24 ` [PATCH v2 4/7] PCI/ASPM: Replace aspm_register_info.l1ss_cap* Saheed O. Bolarinwa
2020-09-24 22:45 ` Bjorn Helgaas
2020-09-24 14:24 ` [PATCH v2 5/7] PCI/ASPM: Remove aspm_register_info.l1ss_ctl* Saheed O. Bolarinwa
2020-09-24 14:24 ` [PATCH v2 6/7] PCI/ASPM: Remove struct aspm_register_info and pcie_get_aspm_reg() Saheed O. Bolarinwa
2020-09-24 22:51 ` Bjorn Helgaas
2020-09-24 14:24 ` [PATCH v2 7/7] PCI/ASPM: Remove struct pcie_link_state.l1ss Saheed O. Bolarinwa
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=20200924223636.GA2366261@bjorn-Precision-5520 \
--to=helgaas@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=refactormyself@gmail.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