Re: [PATCH v4 3/3] PCI/ASPM: Fix L1.2 parameters when enable link state

From: Jian-Hong Pan
Date: Wed Apr 24 2024 - 00:28:43 EST


Bjorn Helgaas <helgaas@xxxxxxxxxx> 於 2024年3月2日 週六 上午5:41寫道:
>
> In subject:
>
> PCI/ASPM: Fix L1.2 parameters before enabling L1.2
>
> > + if (state & link->aspm_capable & ASPM_STATE_L1_2_MASK) {
> > + parent_l1ss_cap = aspm_get_l1ss_cap(parent);
> > + child_l1ss_cap = aspm_get_l1ss_cap(child);
> > + aspm_calc_l12_info(link, parent_l1ss_cap, child_l1ss_cap);
>
> Why doesn't this happen already via normal enumeration? It looks like
> this path should do it even without this patch:
>
> pcie_aspm_init_link_state
> pcie_aspm_cap_init
> aspm_l1ss_init

I watch the VMD remapped PCI devices' power states during this path.
Their power states stay at "unknown" until someone sets their power
state to "D0".
And, because their power states stay at "unknown", the L1.2 of the
link between VMD remapped PCIe Root Port and NVMe gets wrong configs
when system goes through this path.
So, system has to calculate the L1.2 information again after set PCI
devices' power state to D0.

Sorry for the late reply. Got my laptop back recently.

Jian-Hong Pan

> > + }
> > pcie_config_aspm_link(link, policy_to_aspm_state(link));
> >
> > link->clkpm_default = (state & PCIE_LINK_STATE_CLKPM) ? 1 : 0;
> > --
> > 2.43.2
> >