Re: [PATCH V6 1/3] PCI/ASPM: Add pci_enable_default_link_state()

From: David E. Box
Date: Tue Mar 01 2022 - 08:31:56 EST


On Tue, 2022-03-01 at 00:13 -0800, Christoph Hellwig wrote:
> On Mon, Feb 28, 2022 at 08:19:41PM -0800, David E. Box wrote:
> > + down_read(&pci_bus_sem);
> > + mutex_lock(&aspm_lock);
> > + link->aspm_default = 0;
> > + if (state & PCIE_LINK_STATE_L0S)
> > + link->aspm_default |= ASPM_STATE_L0S;
> > + if (state & PCIE_LINK_STATE_L1)
> > + /* L1 PM substates require L1 */
> > + link->aspm_default |= ASPM_STATE_L1 | ASPM_STATE_L1SS;
> > + if (state & PCIE_LINK_STATE_L1_1)
> > + link->aspm_default |= ASPM_STATE_L1_1;
> > + if (state & PCIE_LINK_STATE_L1_2)
> > + link->aspm_default |= ASPM_STATE_L1_2;
> > + if (state & PCIE_LINK_STATE_L1_1_PCIPM)
> > + link->aspm_default |= ASPM_STATE_L1_1_PCIPM;
> > + if (state & PCIE_LINK_STATE_L1_2_PCIPM)
> > + link->aspm_default |= ASPM_STATE_L1_2_PCIPM;
> > + pcie_config_aspm_link(link, policy_to_aspm_state(link));
>
> Is there any reason the ASPM_* values aren't passed directly to this
> function?

The ASPM_* macors aren't visible outside of aspm.c whereas the
PCIE_LINK_STATE_* macros are defined in pci.h. This is similar to what
is done for pci_disable_link_state().

David