1 // SPDX-License-Identifier: GPL-2.0
3 * Enable PCIe link L0s/L1 state and Clock Power Management
5 * Copyright (C) 2007 Intel
6 * Copyright (C) Zhang Yanmin (yanmin.zhang@intel.com)
7 * Copyright (C) Shaohua Li (shaohua.li@intel.com)
10 #include <linux/kernel.h>
11 #include <linux/module.h>
12 #include <linux/moduleparam.h>
13 #include <linux/pci.h>
14 #include <linux/pci_regs.h>
15 #include <linux/errno.h>
17 #include <linux/init.h>
18 #include <linux/slab.h>
19 #include <linux/jiffies.h>
20 #include <linux/delay.h>
23 #ifdef MODULE_PARAM_PREFIX
24 #undef MODULE_PARAM_PREFIX
26 #define MODULE_PARAM_PREFIX "pcie_aspm."
28 /* Note: those are not register definitions */
29 #define ASPM_STATE_L0S_UP (1) /* Upstream direction L0s state */
30 #define ASPM_STATE_L0S_DW (2) /* Downstream direction L0s state */
31 #define ASPM_STATE_L1 (4) /* L1 state */
32 #define ASPM_STATE_L1_1 (8) /* ASPM L1.1 state */
33 #define ASPM_STATE_L1_2 (0x10) /* ASPM L1.2 state */
34 #define ASPM_STATE_L1_1_PCIPM (0x20) /* PCI PM L1.1 state */
35 #define ASPM_STATE_L1_2_PCIPM (0x40) /* PCI PM L1.2 state */
36 #define ASPM_STATE_L1_SS_PCIPM (ASPM_STATE_L1_1_PCIPM | ASPM_STATE_L1_2_PCIPM)
37 #define ASPM_STATE_L1_2_MASK (ASPM_STATE_L1_2 | ASPM_STATE_L1_2_PCIPM)
38 #define ASPM_STATE_L1SS (ASPM_STATE_L1_1 | ASPM_STATE_L1_1_PCIPM |\
40 #define ASPM_STATE_L0S (ASPM_STATE_L0S_UP | ASPM_STATE_L0S_DW)
41 #define ASPM_STATE_ALL (ASPM_STATE_L0S | ASPM_STATE_L1 | \
45 u32 l0s; /* L0s latency (nsec) */
46 u32 l1; /* L1 latency (nsec) */
49 struct pcie_link_state {
50 struct pci_dev *pdev; /* Upstream component of the Link */
51 struct pci_dev *downstream; /* Downstream component, function 0 */
52 struct pcie_link_state *root; /* pointer to the root port link */
53 struct pcie_link_state *parent; /* pointer to the parent Link state */
54 struct list_head sibling; /* node in link_list */
57 u32 aspm_support:7; /* Supported ASPM state */
58 u32 aspm_enabled:7; /* Enabled ASPM state */
59 u32 aspm_capable:7; /* Capable ASPM state with latency */
60 u32 aspm_default:7; /* Default ASPM state by BIOS */
61 u32 aspm_disable:7; /* Disabled ASPM state */
64 u32 clkpm_capable:1; /* Clock PM capable? */
65 u32 clkpm_enabled:1; /* Current Clock PM state */
66 u32 clkpm_default:1; /* Default Clock PM state by BIOS */
67 u32 clkpm_disable:1; /* Clock PM disabled */
70 struct aspm_latency latency_up; /* Upstream direction exit latency */
71 struct aspm_latency latency_dw; /* Downstream direction exit latency */
73 * Endpoint acceptable latencies. A pcie downstream port only
74 * has one slot under it, so at most there are 8 functions.
76 struct aspm_latency acceptable[8];
78 /* L1 PM Substate info */
80 u32 ctl1; /* value to be programmed in ctl1 */
81 u32 ctl2; /* value to be programmed in ctl2 */
85 static int aspm_disabled, aspm_force;
86 static bool aspm_support_enabled = true;
87 static DEFINE_MUTEX(aspm_lock);
88 static LIST_HEAD(link_list);
90 #define POLICY_DEFAULT 0 /* BIOS default setting */
91 #define POLICY_PERFORMANCE 1 /* high performance */
92 #define POLICY_POWERSAVE 2 /* high power saving */
93 #define POLICY_POWER_SUPERSAVE 3 /* possibly even more power saving */
95 #ifdef CONFIG_PCIEASPM_PERFORMANCE
96 static int aspm_policy = POLICY_PERFORMANCE;
97 #elif defined CONFIG_PCIEASPM_POWERSAVE
98 static int aspm_policy = POLICY_POWERSAVE;
99 #elif defined CONFIG_PCIEASPM_POWER_SUPERSAVE
100 static int aspm_policy = POLICY_POWER_SUPERSAVE;
102 static int aspm_policy;
105 static const char *policy_str[] = {
106 [POLICY_DEFAULT] = "default",
107 [POLICY_PERFORMANCE] = "performance",
108 [POLICY_POWERSAVE] = "powersave",
109 [POLICY_POWER_SUPERSAVE] = "powersupersave"
112 #define LINK_RETRAIN_TIMEOUT HZ
114 static int policy_to_aspm_state(struct pcie_link_state *link)
116 switch (aspm_policy) {
117 case POLICY_PERFORMANCE:
118 /* Disable ASPM and Clock PM */
120 case POLICY_POWERSAVE:
121 /* Enable ASPM L0s/L1 */
122 return (ASPM_STATE_L0S | ASPM_STATE_L1);
123 case POLICY_POWER_SUPERSAVE:
124 /* Enable Everything */
125 return ASPM_STATE_ALL;
127 return link->aspm_default;
132 static int policy_to_clkpm_state(struct pcie_link_state *link)
134 switch (aspm_policy) {
135 case POLICY_PERFORMANCE:
136 /* Disable ASPM and Clock PM */
138 case POLICY_POWERSAVE:
139 case POLICY_POWER_SUPERSAVE:
140 /* Enable Clock PM */
143 return link->clkpm_default;
148 static void pcie_set_clkpm_nocheck(struct pcie_link_state *link, int enable)
150 struct pci_dev *child;
151 struct pci_bus *linkbus = link->pdev->subordinate;
152 u32 val = enable ? PCI_EXP_LNKCTL_CLKREQ_EN : 0;
154 list_for_each_entry(child, &linkbus->devices, bus_list)
155 pcie_capability_clear_and_set_word(child, PCI_EXP_LNKCTL,
156 PCI_EXP_LNKCTL_CLKREQ_EN,
158 link->clkpm_enabled = !!enable;
161 static void pcie_set_clkpm(struct pcie_link_state *link, int enable)
164 * Don't enable Clock PM if the link is not Clock PM capable
165 * or Clock PM is disabled
167 if (!link->clkpm_capable || link->clkpm_disable)
169 /* Need nothing if the specified equals to current state */
170 if (link->clkpm_enabled == enable)
172 pcie_set_clkpm_nocheck(link, enable);
175 static void pcie_clkpm_cap_init(struct pcie_link_state *link, int blacklist)
177 int capable = 1, enabled = 1;
180 struct pci_dev *child;
181 struct pci_bus *linkbus = link->pdev->subordinate;
183 /* All functions should have the same cap and state, take the worst */
184 list_for_each_entry(child, &linkbus->devices, bus_list) {
185 pcie_capability_read_dword(child, PCI_EXP_LNKCAP, ®32);
186 if (!(reg32 & PCI_EXP_LNKCAP_CLKPM)) {
191 pcie_capability_read_word(child, PCI_EXP_LNKCTL, ®16);
192 if (!(reg16 & PCI_EXP_LNKCTL_CLKREQ_EN))
195 link->clkpm_enabled = enabled;
196 link->clkpm_default = enabled;
197 link->clkpm_capable = capable;
198 link->clkpm_disable = blacklist ? 1 : 0;
201 static bool pcie_retrain_link(struct pcie_link_state *link)
203 struct pci_dev *parent = link->pdev;
204 unsigned long end_jiffies;
207 pcie_capability_read_word(parent, PCI_EXP_LNKCTL, ®16);
208 reg16 |= PCI_EXP_LNKCTL_RL;
209 pcie_capability_write_word(parent, PCI_EXP_LNKCTL, reg16);
210 if (parent->clear_retrain_link) {
212 * Due to an erratum in some devices the Retrain Link bit
213 * needs to be cleared again manually to allow the link
214 * training to succeed.
216 reg16 &= ~PCI_EXP_LNKCTL_RL;
217 pcie_capability_write_word(parent, PCI_EXP_LNKCTL, reg16);
220 /* Wait for link training end. Break out after waiting for timeout */
221 end_jiffies = jiffies + LINK_RETRAIN_TIMEOUT;
223 pcie_capability_read_word(parent, PCI_EXP_LNKSTA, ®16);
224 if (!(reg16 & PCI_EXP_LNKSTA_LT))
227 } while (time_before(jiffies, end_jiffies));
228 return !(reg16 & PCI_EXP_LNKSTA_LT);
232 * pcie_aspm_configure_common_clock: check if the 2 ends of a link
233 * could use common clock. If they are, configure them to use the
234 * common clock. That will reduce the ASPM state exit latency.
236 static void pcie_aspm_configure_common_clock(struct pcie_link_state *link)
239 u16 reg16, parent_reg, child_reg[8];
240 struct pci_dev *child, *parent = link->pdev;
241 struct pci_bus *linkbus = parent->subordinate;
243 * All functions of a slot should have the same Slot Clock
244 * Configuration, so just check one function
246 child = list_entry(linkbus->devices.next, struct pci_dev, bus_list);
247 BUG_ON(!pci_is_pcie(child));
249 /* Check downstream component if bit Slot Clock Configuration is 1 */
250 pcie_capability_read_word(child, PCI_EXP_LNKSTA, ®16);
251 if (!(reg16 & PCI_EXP_LNKSTA_SLC))
254 /* Check upstream component if bit Slot Clock Configuration is 1 */
255 pcie_capability_read_word(parent, PCI_EXP_LNKSTA, ®16);
256 if (!(reg16 & PCI_EXP_LNKSTA_SLC))
259 /* Port might be already in common clock mode */
260 pcie_capability_read_word(parent, PCI_EXP_LNKCTL, ®16);
261 if (same_clock && (reg16 & PCI_EXP_LNKCTL_CCC)) {
262 bool consistent = true;
264 list_for_each_entry(child, &linkbus->devices, bus_list) {
265 pcie_capability_read_word(child, PCI_EXP_LNKCTL,
267 if (!(reg16 & PCI_EXP_LNKCTL_CCC)) {
274 pci_info(parent, "ASPM: current common clock configuration is inconsistent, reconfiguring\n");
277 /* Configure downstream component, all functions */
278 list_for_each_entry(child, &linkbus->devices, bus_list) {
279 pcie_capability_read_word(child, PCI_EXP_LNKCTL, ®16);
280 child_reg[PCI_FUNC(child->devfn)] = reg16;
282 reg16 |= PCI_EXP_LNKCTL_CCC;
284 reg16 &= ~PCI_EXP_LNKCTL_CCC;
285 pcie_capability_write_word(child, PCI_EXP_LNKCTL, reg16);
288 /* Configure upstream component */
289 pcie_capability_read_word(parent, PCI_EXP_LNKCTL, ®16);
292 reg16 |= PCI_EXP_LNKCTL_CCC;
294 reg16 &= ~PCI_EXP_LNKCTL_CCC;
295 pcie_capability_write_word(parent, PCI_EXP_LNKCTL, reg16);
297 if (pcie_retrain_link(link))
300 /* Training failed. Restore common clock configurations */
301 pci_err(parent, "ASPM: Could not configure common clock\n");
302 list_for_each_entry(child, &linkbus->devices, bus_list)
303 pcie_capability_write_word(child, PCI_EXP_LNKCTL,
304 child_reg[PCI_FUNC(child->devfn)]);
305 pcie_capability_write_word(parent, PCI_EXP_LNKCTL, parent_reg);
308 /* Convert L0s latency encoding to ns */
309 static u32 calc_l0s_latency(u32 lnkcap)
311 u32 encoding = (lnkcap & PCI_EXP_LNKCAP_L0SEL) >> 12;
314 return (5 * 1000); /* > 4us */
315 return (64 << encoding);
318 /* Convert L0s acceptable latency encoding to ns */
319 static u32 calc_l0s_acceptable(u32 encoding)
323 return (64 << encoding);
326 /* Convert L1 latency encoding to ns */
327 static u32 calc_l1_latency(u32 lnkcap)
329 u32 encoding = (lnkcap & PCI_EXP_LNKCAP_L1EL) >> 15;
332 return (65 * 1000); /* > 64us */
333 return (1000 << encoding);
336 /* Convert L1 acceptable latency encoding to ns */
337 static u32 calc_l1_acceptable(u32 encoding)
341 return (1000 << encoding);
344 /* Convert L1SS T_pwr encoding to usec */
345 static u32 calc_l1ss_pwron(struct pci_dev *pdev, u32 scale, u32 val)
355 pci_err(pdev, "%s: Invalid T_PwrOn scale: %u\n", __func__, scale);
359 static void encode_l12_threshold(u32 threshold_us, u32 *scale, u32 *value)
361 u32 threshold_ns = threshold_us * 1000;
363 /* See PCIe r3.1, sec 7.33.3 and sec 6.18 */
364 if (threshold_ns < 32) {
366 *value = threshold_ns;
367 } else if (threshold_ns < 1024) {
369 *value = threshold_ns >> 5;
370 } else if (threshold_ns < 32768) {
372 *value = threshold_ns >> 10;
373 } else if (threshold_ns < 1048576) {
375 *value = threshold_ns >> 15;
376 } else if (threshold_ns < 33554432) {
378 *value = threshold_ns >> 20;
381 *value = threshold_ns >> 25;
385 struct aspm_register_info {
392 static void pcie_get_aspm_reg(struct pci_dev *pdev,
393 struct aspm_register_info *info)
395 /* Read L1 PM substate capabilities */
396 info->l1ss_cap = info->l1ss_ctl1 = info->l1ss_ctl2 = 0;
401 pci_read_config_dword(pdev, pdev->l1ss + PCI_L1SS_CAP,
403 if (!(info->l1ss_cap & PCI_L1SS_CAP_L1_PM_SS)) {
408 pci_read_config_dword(pdev, pdev->l1ss + PCI_L1SS_CTL1,
410 pci_read_config_dword(pdev, pdev->l1ss + PCI_L1SS_CTL2,
414 static void pcie_aspm_check_latency(struct pci_dev *endpoint)
416 u32 latency, l1_switch_latency = 0;
417 struct aspm_latency *acceptable;
418 struct pcie_link_state *link;
420 /* Device not in D0 doesn't need latency check */
421 if ((endpoint->current_state != PCI_D0) &&
422 (endpoint->current_state != PCI_UNKNOWN))
425 link = endpoint->bus->self->link_state;
426 acceptable = &link->acceptable[PCI_FUNC(endpoint->devfn)];
429 /* Check upstream direction L0s latency */
430 if ((link->aspm_capable & ASPM_STATE_L0S_UP) &&
431 (link->latency_up.l0s > acceptable->l0s))
432 link->aspm_capable &= ~ASPM_STATE_L0S_UP;
434 /* Check downstream direction L0s latency */
435 if ((link->aspm_capable & ASPM_STATE_L0S_DW) &&
436 (link->latency_dw.l0s > acceptable->l0s))
437 link->aspm_capable &= ~ASPM_STATE_L0S_DW;
440 * Every switch on the path to root complex need 1
441 * more microsecond for L1. Spec doesn't mention L0s.
443 * The exit latencies for L1 substates are not advertised
444 * by a device. Since the spec also doesn't mention a way
445 * to determine max latencies introduced by enabling L1
446 * substates on the components, it is not clear how to do
447 * a L1 substate exit latency check. We assume that the
448 * L1 exit latencies advertised by a device include L1
449 * substate latencies (and hence do not do any check).
451 latency = max_t(u32, link->latency_up.l1, link->latency_dw.l1);
452 if ((link->aspm_capable & ASPM_STATE_L1) &&
453 (latency + l1_switch_latency > acceptable->l1))
454 link->aspm_capable &= ~ASPM_STATE_L1;
455 l1_switch_latency += 1000;
462 * The L1 PM substate capability is only implemented in function 0 in a
463 * multi function device.
465 static struct pci_dev *pci_function_0(struct pci_bus *linkbus)
467 struct pci_dev *child;
469 list_for_each_entry(child, &linkbus->devices, bus_list)
470 if (PCI_FUNC(child->devfn) == 0)
475 static void pci_clear_and_set_dword(struct pci_dev *pdev, int pos,
480 pci_read_config_dword(pdev, pos, &val);
483 pci_write_config_dword(pdev, pos, val);
486 /* Calculate L1.2 PM substate timing parameters */
487 static void aspm_calc_l1ss_info(struct pcie_link_state *link,
488 struct aspm_register_info *upreg,
489 struct aspm_register_info *dwreg)
491 struct pci_dev *child = link->downstream, *parent = link->pdev;
492 u32 val1, val2, scale1, scale2;
493 u32 t_common_mode, t_power_on, l1_2_threshold, scale, value;
495 link->l1ss.ctl1 = link->l1ss.ctl2 = 0;
497 if (!(link->aspm_support & ASPM_STATE_L1_2_MASK))
500 /* Choose the greater of the two Port Common_Mode_Restore_Times */
501 val1 = (upreg->l1ss_cap & PCI_L1SS_CAP_CM_RESTORE_TIME) >> 8;
502 val2 = (dwreg->l1ss_cap & PCI_L1SS_CAP_CM_RESTORE_TIME) >> 8;
503 t_common_mode = max(val1, val2);
505 /* Choose the greater of the two Port T_POWER_ON times */
506 val1 = (upreg->l1ss_cap & PCI_L1SS_CAP_P_PWR_ON_VALUE) >> 19;
507 scale1 = (upreg->l1ss_cap & PCI_L1SS_CAP_P_PWR_ON_SCALE) >> 16;
508 val2 = (dwreg->l1ss_cap & PCI_L1SS_CAP_P_PWR_ON_VALUE) >> 19;
509 scale2 = (dwreg->l1ss_cap & PCI_L1SS_CAP_P_PWR_ON_SCALE) >> 16;
511 if (calc_l1ss_pwron(parent, scale1, val1) >
512 calc_l1ss_pwron(child, scale2, val2)) {
513 link->l1ss.ctl2 |= scale1 | (val1 << 3);
514 t_power_on = calc_l1ss_pwron(parent, scale1, val1);
516 link->l1ss.ctl2 |= scale2 | (val2 << 3);
517 t_power_on = calc_l1ss_pwron(child, scale2, val2);
521 * Set LTR_L1.2_THRESHOLD to the time required to transition the
522 * Link from L0 to L1.2 and back to L0 so we enter L1.2 only if
523 * downstream devices report (via LTR) that they can tolerate at
524 * least that much latency.
526 * Based on PCIe r3.1, sec 5.5.3.3.1, Figures 5-16 and 5-17, and
527 * Table 5-11. T(POWER_OFF) is at most 2us and T(L1.2) is at
530 l1_2_threshold = 2 + 4 + t_common_mode + t_power_on;
531 encode_l12_threshold(l1_2_threshold, &scale, &value);
532 link->l1ss.ctl1 |= t_common_mode << 8 | scale << 29 | value << 16;
535 static void pcie_aspm_cap_init(struct pcie_link_state *link, int blacklist)
537 struct pci_dev *child = link->downstream, *parent = link->pdev;
538 u32 parent_lnkcap, child_lnkcap;
539 u16 parent_lnkctl, child_lnkctl;
540 struct pci_bus *linkbus = parent->subordinate;
541 struct aspm_register_info upreg, dwreg;
544 /* Set enabled/disable so that we will disable ASPM later */
545 link->aspm_enabled = ASPM_STATE_ALL;
546 link->aspm_disable = ASPM_STATE_ALL;
551 * If ASPM not supported, don't mess with the clocks and link,
554 pcie_capability_read_dword(parent, PCI_EXP_LNKCAP, &parent_lnkcap);
555 pcie_capability_read_dword(child, PCI_EXP_LNKCAP, &child_lnkcap);
556 if (!(parent_lnkcap & child_lnkcap & PCI_EXP_LNKCAP_ASPMS))
559 /* Configure common clock before checking latencies */
560 pcie_aspm_configure_common_clock(link);
563 * Re-read upstream/downstream components' register state after
564 * clock configuration. L0s & L1 exit latencies in the otherwise
565 * read-only Link Capabilities may change depending on common clock
566 * configuration (PCIe r5.0, sec 7.5.3.6).
568 pcie_capability_read_dword(parent, PCI_EXP_LNKCAP, &parent_lnkcap);
569 pcie_capability_read_dword(child, PCI_EXP_LNKCAP, &child_lnkcap);
570 pcie_capability_read_word(parent, PCI_EXP_LNKCTL, &parent_lnkctl);
571 pcie_capability_read_word(child, PCI_EXP_LNKCTL, &child_lnkctl);
572 pcie_get_aspm_reg(parent, &upreg);
573 pcie_get_aspm_reg(child, &dwreg);
578 * Note that we must not enable L0s in either direction on a
579 * given link unless components on both sides of the link each
582 if (parent_lnkcap & child_lnkcap & PCI_EXP_LNKCAP_ASPM_L0S)
583 link->aspm_support |= ASPM_STATE_L0S;
585 if (child_lnkctl & PCI_EXP_LNKCTL_ASPM_L0S)
586 link->aspm_enabled |= ASPM_STATE_L0S_UP;
587 if (parent_lnkctl & PCI_EXP_LNKCTL_ASPM_L0S)
588 link->aspm_enabled |= ASPM_STATE_L0S_DW;
589 link->latency_up.l0s = calc_l0s_latency(parent_lnkcap);
590 link->latency_dw.l0s = calc_l0s_latency(child_lnkcap);
593 if (parent_lnkcap & child_lnkcap & PCI_EXP_LNKCAP_ASPM_L1)
594 link->aspm_support |= ASPM_STATE_L1;
596 if (parent_lnkctl & child_lnkctl & PCI_EXP_LNKCTL_ASPM_L1)
597 link->aspm_enabled |= ASPM_STATE_L1;
598 link->latency_up.l1 = calc_l1_latency(parent_lnkcap);
599 link->latency_dw.l1 = calc_l1_latency(child_lnkcap);
602 * If we don't have LTR for the entire path from the Root Complex
603 * to this device, we can't use ASPM L1.2 because it relies on the
604 * LTR_L1.2_THRESHOLD. See PCIe r4.0, secs 5.5.4, 6.18.
606 if (!child->ltr_path)
607 dwreg.l1ss_cap &= ~PCI_L1SS_CAP_ASPM_L1_2;
609 if (upreg.l1ss_cap & dwreg.l1ss_cap & PCI_L1SS_CAP_ASPM_L1_1)
610 link->aspm_support |= ASPM_STATE_L1_1;
611 if (upreg.l1ss_cap & dwreg.l1ss_cap & PCI_L1SS_CAP_ASPM_L1_2)
612 link->aspm_support |= ASPM_STATE_L1_2;
613 if (upreg.l1ss_cap & dwreg.l1ss_cap & PCI_L1SS_CAP_PCIPM_L1_1)
614 link->aspm_support |= ASPM_STATE_L1_1_PCIPM;
615 if (upreg.l1ss_cap & dwreg.l1ss_cap & PCI_L1SS_CAP_PCIPM_L1_2)
616 link->aspm_support |= ASPM_STATE_L1_2_PCIPM;
618 if (upreg.l1ss_ctl1 & dwreg.l1ss_ctl1 & PCI_L1SS_CTL1_ASPM_L1_1)
619 link->aspm_enabled |= ASPM_STATE_L1_1;
620 if (upreg.l1ss_ctl1 & dwreg.l1ss_ctl1 & PCI_L1SS_CTL1_ASPM_L1_2)
621 link->aspm_enabled |= ASPM_STATE_L1_2;
622 if (upreg.l1ss_ctl1 & dwreg.l1ss_ctl1 & PCI_L1SS_CTL1_PCIPM_L1_1)
623 link->aspm_enabled |= ASPM_STATE_L1_1_PCIPM;
624 if (upreg.l1ss_ctl1 & dwreg.l1ss_ctl1 & PCI_L1SS_CTL1_PCIPM_L1_2)
625 link->aspm_enabled |= ASPM_STATE_L1_2_PCIPM;
627 if (link->aspm_support & ASPM_STATE_L1SS)
628 aspm_calc_l1ss_info(link, &upreg, &dwreg);
630 /* Save default state */
631 link->aspm_default = link->aspm_enabled;
633 /* Setup initial capable state. Will be updated later */
634 link->aspm_capable = link->aspm_support;
636 /* Get and check endpoint acceptable latencies */
637 list_for_each_entry(child, &linkbus->devices, bus_list) {
639 struct aspm_latency *acceptable =
640 &link->acceptable[PCI_FUNC(child->devfn)];
642 if (pci_pcie_type(child) != PCI_EXP_TYPE_ENDPOINT &&
643 pci_pcie_type(child) != PCI_EXP_TYPE_LEG_END)
646 pcie_capability_read_dword(child, PCI_EXP_DEVCAP, ®32);
647 /* Calculate endpoint L0s acceptable latency */
648 encoding = (reg32 & PCI_EXP_DEVCAP_L0S) >> 6;
649 acceptable->l0s = calc_l0s_acceptable(encoding);
650 /* Calculate endpoint L1 acceptable latency */
651 encoding = (reg32 & PCI_EXP_DEVCAP_L1) >> 9;
652 acceptable->l1 = calc_l1_acceptable(encoding);
654 pcie_aspm_check_latency(child);
658 /* Configure the ASPM L1 substates */
659 static void pcie_config_aspm_l1ss(struct pcie_link_state *link, u32 state)
662 struct pci_dev *child = link->downstream, *parent = link->pdev;
664 enable_req = (link->aspm_enabled ^ state) & state;
667 * Here are the rules specified in the PCIe spec for enabling L1SS:
668 * - When enabling L1.x, enable bit at parent first, then at child
669 * - When disabling L1.x, disable bit at child first, then at parent
670 * - When enabling ASPM L1.x, need to disable L1
671 * (at child followed by parent).
672 * - The ASPM/PCIPM L1.2 must be disabled while programming timing
675 * To keep it simple, disable all L1SS bits first, and later enable
679 /* Disable all L1 substates */
680 pci_clear_and_set_dword(child, child->l1ss + PCI_L1SS_CTL1,
681 PCI_L1SS_CTL1_L1SS_MASK, 0);
682 pci_clear_and_set_dword(parent, parent->l1ss + PCI_L1SS_CTL1,
683 PCI_L1SS_CTL1_L1SS_MASK, 0);
685 * If needed, disable L1, and it gets enabled later
686 * in pcie_config_aspm_link().
688 if (enable_req & (ASPM_STATE_L1_1 | ASPM_STATE_L1_2)) {
689 pcie_capability_clear_and_set_word(child, PCI_EXP_LNKCTL,
690 PCI_EXP_LNKCTL_ASPM_L1, 0);
691 pcie_capability_clear_and_set_word(parent, PCI_EXP_LNKCTL,
692 PCI_EXP_LNKCTL_ASPM_L1, 0);
695 if (enable_req & ASPM_STATE_L1_2_MASK) {
697 /* Program T_POWER_ON times in both ports */
698 pci_write_config_dword(parent, parent->l1ss + PCI_L1SS_CTL2,
700 pci_write_config_dword(child, child->l1ss + PCI_L1SS_CTL2,
703 /* Program Common_Mode_Restore_Time in upstream device */
704 pci_clear_and_set_dword(parent, parent->l1ss + PCI_L1SS_CTL1,
705 PCI_L1SS_CTL1_CM_RESTORE_TIME,
708 /* Program LTR_L1.2_THRESHOLD time in both ports */
709 pci_clear_and_set_dword(parent, parent->l1ss + PCI_L1SS_CTL1,
710 PCI_L1SS_CTL1_LTR_L12_TH_VALUE |
711 PCI_L1SS_CTL1_LTR_L12_TH_SCALE,
713 pci_clear_and_set_dword(child, child->l1ss + PCI_L1SS_CTL1,
714 PCI_L1SS_CTL1_LTR_L12_TH_VALUE |
715 PCI_L1SS_CTL1_LTR_L12_TH_SCALE,
720 if (state & ASPM_STATE_L1_1)
721 val |= PCI_L1SS_CTL1_ASPM_L1_1;
722 if (state & ASPM_STATE_L1_2)
723 val |= PCI_L1SS_CTL1_ASPM_L1_2;
724 if (state & ASPM_STATE_L1_1_PCIPM)
725 val |= PCI_L1SS_CTL1_PCIPM_L1_1;
726 if (state & ASPM_STATE_L1_2_PCIPM)
727 val |= PCI_L1SS_CTL1_PCIPM_L1_2;
729 /* Enable what we need to enable */
730 pci_clear_and_set_dword(parent, parent->l1ss + PCI_L1SS_CTL1,
731 PCI_L1SS_CTL1_L1SS_MASK, val);
732 pci_clear_and_set_dword(child, child->l1ss + PCI_L1SS_CTL1,
733 PCI_L1SS_CTL1_L1SS_MASK, val);
736 static void pcie_config_aspm_dev(struct pci_dev *pdev, u32 val)
738 pcie_capability_clear_and_set_word(pdev, PCI_EXP_LNKCTL,
739 PCI_EXP_LNKCTL_ASPMC, val);
742 static void pcie_config_aspm_link(struct pcie_link_state *link, u32 state)
744 u32 upstream = 0, dwstream = 0;
745 struct pci_dev *child = link->downstream, *parent = link->pdev;
746 struct pci_bus *linkbus = parent->subordinate;
748 /* Enable only the states that were not explicitly disabled */
749 state &= (link->aspm_capable & ~link->aspm_disable);
751 /* Can't enable any substates if L1 is not enabled */
752 if (!(state & ASPM_STATE_L1))
753 state &= ~ASPM_STATE_L1SS;
755 /* Spec says both ports must be in D0 before enabling PCI PM substates*/
756 if (parent->current_state != PCI_D0 || child->current_state != PCI_D0) {
757 state &= ~ASPM_STATE_L1_SS_PCIPM;
758 state |= (link->aspm_enabled & ASPM_STATE_L1_SS_PCIPM);
761 /* Nothing to do if the link is already in the requested state */
762 if (link->aspm_enabled == state)
764 /* Convert ASPM state to upstream/downstream ASPM register state */
765 if (state & ASPM_STATE_L0S_UP)
766 dwstream |= PCI_EXP_LNKCTL_ASPM_L0S;
767 if (state & ASPM_STATE_L0S_DW)
768 upstream |= PCI_EXP_LNKCTL_ASPM_L0S;
769 if (state & ASPM_STATE_L1) {
770 upstream |= PCI_EXP_LNKCTL_ASPM_L1;
771 dwstream |= PCI_EXP_LNKCTL_ASPM_L1;
774 if (link->aspm_capable & ASPM_STATE_L1SS)
775 pcie_config_aspm_l1ss(link, state);
778 * Spec 2.0 suggests all functions should be configured the
779 * same setting for ASPM. Enabling ASPM L1 should be done in
780 * upstream component first and then downstream, and vice
781 * versa for disabling ASPM L1. Spec doesn't mention L0S.
783 if (state & ASPM_STATE_L1)
784 pcie_config_aspm_dev(parent, upstream);
785 list_for_each_entry(child, &linkbus->devices, bus_list)
786 pcie_config_aspm_dev(child, dwstream);
787 if (!(state & ASPM_STATE_L1))
788 pcie_config_aspm_dev(parent, upstream);
790 link->aspm_enabled = state;
793 static void pcie_config_aspm_path(struct pcie_link_state *link)
796 pcie_config_aspm_link(link, policy_to_aspm_state(link));
801 static void free_link_state(struct pcie_link_state *link)
803 link->pdev->link_state = NULL;
807 static int pcie_aspm_sanity_check(struct pci_dev *pdev)
809 struct pci_dev *child;
813 * Some functions in a slot might not all be PCIe functions,
814 * very strange. Disable ASPM for the whole slot
816 list_for_each_entry(child, &pdev->subordinate->devices, bus_list) {
817 if (!pci_is_pcie(child))
821 * If ASPM is disabled then we're not going to change
822 * the BIOS state. It's safe to continue even if it's a
830 * Disable ASPM for pre-1.1 PCIe device, we follow MS to use
831 * RBER bit to determine if a function is 1.1 version device
833 pcie_capability_read_dword(child, PCI_EXP_DEVCAP, ®32);
834 if (!(reg32 & PCI_EXP_DEVCAP_RBER) && !aspm_force) {
835 pci_info(child, "disabling ASPM on pre-1.1 PCIe device. You can enable it with 'pcie_aspm=force'\n");
842 static struct pcie_link_state *alloc_pcie_link_state(struct pci_dev *pdev)
844 struct pcie_link_state *link;
846 link = kzalloc(sizeof(*link), GFP_KERNEL);
850 INIT_LIST_HEAD(&link->sibling);
852 link->downstream = pci_function_0(pdev->subordinate);
855 * Root Ports and PCI/PCI-X to PCIe Bridges are roots of PCIe
856 * hierarchies. Note that some PCIe host implementations omit
857 * the root ports entirely, in which case a downstream port on
858 * a switch may become the root of the link state chain for all
859 * its subordinate endpoints.
861 if (pci_pcie_type(pdev) == PCI_EXP_TYPE_ROOT_PORT ||
862 pci_pcie_type(pdev) == PCI_EXP_TYPE_PCIE_BRIDGE ||
863 !pdev->bus->parent->self) {
866 struct pcie_link_state *parent;
868 parent = pdev->bus->parent->self->link_state;
874 link->parent = parent;
875 link->root = link->parent->root;
878 list_add(&link->sibling, &link_list);
879 pdev->link_state = link;
883 static void pcie_aspm_update_sysfs_visibility(struct pci_dev *pdev)
885 struct pci_dev *child;
887 list_for_each_entry(child, &pdev->subordinate->devices, bus_list)
888 sysfs_update_group(&child->dev.kobj, &aspm_ctrl_attr_group);
892 * pcie_aspm_init_link_state: Initiate PCI express link state.
893 * It is called after the pcie and its children devices are scanned.
894 * @pdev: the root port or switch downstream port
896 void pcie_aspm_init_link_state(struct pci_dev *pdev)
898 struct pcie_link_state *link;
899 int blacklist = !!pcie_aspm_sanity_check(pdev);
901 if (!aspm_support_enabled)
904 if (pdev->link_state)
908 * We allocate pcie_link_state for the component on the upstream
909 * end of a Link, so there's nothing to do unless this device is
912 if (!pcie_downstream_port(pdev))
915 /* VIA has a strange chipset, root port is under a bridge */
916 if (pci_pcie_type(pdev) == PCI_EXP_TYPE_ROOT_PORT &&
920 down_read(&pci_bus_sem);
921 if (list_empty(&pdev->subordinate->devices))
924 mutex_lock(&aspm_lock);
925 link = alloc_pcie_link_state(pdev);
929 * Setup initial ASPM state. Note that we need to configure
930 * upstream links also because capable state of them can be
931 * update through pcie_aspm_cap_init().
933 pcie_aspm_cap_init(link, blacklist);
935 /* Setup initial Clock PM state */
936 pcie_clkpm_cap_init(link, blacklist);
939 * At this stage drivers haven't had an opportunity to change the
940 * link policy setting. Enabling ASPM on broken hardware can cripple
941 * it even before the driver has had a chance to disable ASPM, so
942 * default to a safe level right now. If we're enabling ASPM beyond
943 * the BIOS's expectation, we'll do so once pci_enable_device() is
946 if (aspm_policy != POLICY_POWERSAVE &&
947 aspm_policy != POLICY_POWER_SUPERSAVE) {
948 pcie_config_aspm_path(link);
949 pcie_set_clkpm(link, policy_to_clkpm_state(link));
952 pcie_aspm_update_sysfs_visibility(pdev);
955 mutex_unlock(&aspm_lock);
957 up_read(&pci_bus_sem);
960 /* Recheck latencies and update aspm_capable for links under the root */
961 static void pcie_update_aspm_capable(struct pcie_link_state *root)
963 struct pcie_link_state *link;
964 BUG_ON(root->parent);
965 list_for_each_entry(link, &link_list, sibling) {
966 if (link->root != root)
968 link->aspm_capable = link->aspm_support;
970 list_for_each_entry(link, &link_list, sibling) {
971 struct pci_dev *child;
972 struct pci_bus *linkbus = link->pdev->subordinate;
973 if (link->root != root)
975 list_for_each_entry(child, &linkbus->devices, bus_list) {
976 if ((pci_pcie_type(child) != PCI_EXP_TYPE_ENDPOINT) &&
977 (pci_pcie_type(child) != PCI_EXP_TYPE_LEG_END))
979 pcie_aspm_check_latency(child);
984 /* @pdev: the endpoint device */
985 void pcie_aspm_exit_link_state(struct pci_dev *pdev)
987 struct pci_dev *parent = pdev->bus->self;
988 struct pcie_link_state *link, *root, *parent_link;
990 if (!parent || !parent->link_state)
993 down_read(&pci_bus_sem);
994 mutex_lock(&aspm_lock);
996 * All PCIe functions are in one slot, remove one function will remove
997 * the whole slot, so just wait until we are the last function left.
999 if (!list_empty(&parent->subordinate->devices))
1002 link = parent->link_state;
1004 parent_link = link->parent;
1006 /* All functions are removed, so just disable ASPM for the link */
1007 pcie_config_aspm_link(link, 0);
1008 list_del(&link->sibling);
1009 /* Clock PM is for endpoint device */
1010 free_link_state(link);
1012 /* Recheck latencies and configure upstream links */
1014 pcie_update_aspm_capable(root);
1015 pcie_config_aspm_path(parent_link);
1018 mutex_unlock(&aspm_lock);
1019 up_read(&pci_bus_sem);
1022 /* @pdev: the root port or switch downstream port */
1023 void pcie_aspm_pm_state_change(struct pci_dev *pdev)
1025 struct pcie_link_state *link = pdev->link_state;
1027 if (aspm_disabled || !link)
1030 * Devices changed PM state, we should recheck if latency
1031 * meets all functions' requirement
1033 down_read(&pci_bus_sem);
1034 mutex_lock(&aspm_lock);
1035 pcie_update_aspm_capable(link->root);
1036 pcie_config_aspm_path(link);
1037 mutex_unlock(&aspm_lock);
1038 up_read(&pci_bus_sem);
1041 void pcie_aspm_powersave_config_link(struct pci_dev *pdev)
1043 struct pcie_link_state *link = pdev->link_state;
1045 if (aspm_disabled || !link)
1048 if (aspm_policy != POLICY_POWERSAVE &&
1049 aspm_policy != POLICY_POWER_SUPERSAVE)
1052 down_read(&pci_bus_sem);
1053 mutex_lock(&aspm_lock);
1054 pcie_config_aspm_path(link);
1055 pcie_set_clkpm(link, policy_to_clkpm_state(link));
1056 mutex_unlock(&aspm_lock);
1057 up_read(&pci_bus_sem);
1060 static struct pcie_link_state *pcie_aspm_get_link(struct pci_dev *pdev)
1062 struct pci_dev *bridge;
1064 if (!pci_is_pcie(pdev))
1067 bridge = pci_upstream_bridge(pdev);
1068 if (!bridge || !pci_is_pcie(bridge))
1071 return bridge->link_state;
1074 static int __pci_disable_link_state(struct pci_dev *pdev, int state, bool sem)
1076 struct pcie_link_state *link = pcie_aspm_get_link(pdev);
1081 * A driver requested that ASPM be disabled on this device, but
1082 * if we don't have permission to manage ASPM (e.g., on ACPI
1083 * systems we have to observe the FADT ACPI_FADT_NO_ASPM bit and
1084 * the _OSC method), we can't honor that request. Windows has
1085 * a similar mechanism using "PciASPMOptOut", which is also
1086 * ignored in this situation.
1088 if (aspm_disabled) {
1089 pci_warn(pdev, "can't disable ASPM; OS doesn't have ASPM control\n");
1094 down_read(&pci_bus_sem);
1095 mutex_lock(&aspm_lock);
1096 if (state & PCIE_LINK_STATE_L0S)
1097 link->aspm_disable |= ASPM_STATE_L0S;
1098 if (state & PCIE_LINK_STATE_L1)
1099 /* L1 PM substates require L1 */
1100 link->aspm_disable |= ASPM_STATE_L1 | ASPM_STATE_L1SS;
1101 if (state & PCIE_LINK_STATE_L1_1)
1102 link->aspm_disable |= ASPM_STATE_L1_1;
1103 if (state & PCIE_LINK_STATE_L1_2)
1104 link->aspm_disable |= ASPM_STATE_L1_2;
1105 if (state & PCIE_LINK_STATE_L1_1_PCIPM)
1106 link->aspm_disable |= ASPM_STATE_L1_1_PCIPM;
1107 if (state & PCIE_LINK_STATE_L1_2_PCIPM)
1108 link->aspm_disable |= ASPM_STATE_L1_2_PCIPM;
1109 pcie_config_aspm_link(link, policy_to_aspm_state(link));
1111 if (state & PCIE_LINK_STATE_CLKPM)
1112 link->clkpm_disable = 1;
1113 pcie_set_clkpm(link, policy_to_clkpm_state(link));
1114 mutex_unlock(&aspm_lock);
1116 up_read(&pci_bus_sem);
1121 int pci_disable_link_state_locked(struct pci_dev *pdev, int state)
1123 return __pci_disable_link_state(pdev, state, false);
1125 EXPORT_SYMBOL(pci_disable_link_state_locked);
1128 * pci_disable_link_state - Disable device's link state, so the link will
1129 * never enter specific states. Note that if the BIOS didn't grant ASPM
1130 * control to the OS, this does nothing because we can't touch the LNKCTL
1131 * register. Returns 0 or a negative errno.
1134 * @state: ASPM link state to disable
1136 int pci_disable_link_state(struct pci_dev *pdev, int state)
1138 return __pci_disable_link_state(pdev, state, true);
1140 EXPORT_SYMBOL(pci_disable_link_state);
1142 static int pcie_aspm_set_policy(const char *val,
1143 const struct kernel_param *kp)
1146 struct pcie_link_state *link;
1150 i = sysfs_match_string(policy_str, val);
1153 if (i == aspm_policy)
1156 down_read(&pci_bus_sem);
1157 mutex_lock(&aspm_lock);
1159 list_for_each_entry(link, &link_list, sibling) {
1160 pcie_config_aspm_link(link, policy_to_aspm_state(link));
1161 pcie_set_clkpm(link, policy_to_clkpm_state(link));
1163 mutex_unlock(&aspm_lock);
1164 up_read(&pci_bus_sem);
1168 static int pcie_aspm_get_policy(char *buffer, const struct kernel_param *kp)
1171 for (i = 0; i < ARRAY_SIZE(policy_str); i++)
1172 if (i == aspm_policy)
1173 cnt += sprintf(buffer + cnt, "[%s] ", policy_str[i]);
1175 cnt += sprintf(buffer + cnt, "%s ", policy_str[i]);
1176 cnt += sprintf(buffer + cnt, "\n");
1180 module_param_call(policy, pcie_aspm_set_policy, pcie_aspm_get_policy,
1184 * pcie_aspm_enabled - Check if PCIe ASPM has been enabled for a device.
1185 * @pdev: Target device.
1187 * Relies on the upstream bridge's link_state being valid. The link_state
1188 * is deallocated only when the last child of the bridge (i.e., @pdev or a
1189 * sibling) is removed, and the caller should be holding a reference to
1190 * @pdev, so this should be safe.
1192 bool pcie_aspm_enabled(struct pci_dev *pdev)
1194 struct pcie_link_state *link = pcie_aspm_get_link(pdev);
1199 return link->aspm_enabled;
1201 EXPORT_SYMBOL_GPL(pcie_aspm_enabled);
1203 static ssize_t aspm_attr_show_common(struct device *dev,
1204 struct device_attribute *attr,
1205 char *buf, u8 state)
1207 struct pci_dev *pdev = to_pci_dev(dev);
1208 struct pcie_link_state *link = pcie_aspm_get_link(pdev);
1210 return sprintf(buf, "%d\n", (link->aspm_enabled & state) ? 1 : 0);
1213 static ssize_t aspm_attr_store_common(struct device *dev,
1214 struct device_attribute *attr,
1215 const char *buf, size_t len, u8 state)
1217 struct pci_dev *pdev = to_pci_dev(dev);
1218 struct pcie_link_state *link = pcie_aspm_get_link(pdev);
1221 if (strtobool(buf, &state_enable) < 0)
1224 down_read(&pci_bus_sem);
1225 mutex_lock(&aspm_lock);
1228 link->aspm_disable &= ~state;
1229 /* need to enable L1 for substates */
1230 if (state & ASPM_STATE_L1SS)
1231 link->aspm_disable &= ~ASPM_STATE_L1;
1233 link->aspm_disable |= state;
1236 pcie_config_aspm_link(link, policy_to_aspm_state(link));
1238 mutex_unlock(&aspm_lock);
1239 up_read(&pci_bus_sem);
1244 #define ASPM_ATTR(_f, _s) \
1245 static ssize_t _f##_show(struct device *dev, \
1246 struct device_attribute *attr, char *buf) \
1247 { return aspm_attr_show_common(dev, attr, buf, ASPM_STATE_##_s); } \
1249 static ssize_t _f##_store(struct device *dev, \
1250 struct device_attribute *attr, \
1251 const char *buf, size_t len) \
1252 { return aspm_attr_store_common(dev, attr, buf, len, ASPM_STATE_##_s); }
1254 ASPM_ATTR(l0s_aspm, L0S)
1255 ASPM_ATTR(l1_aspm, L1)
1256 ASPM_ATTR(l1_1_aspm, L1_1)
1257 ASPM_ATTR(l1_2_aspm, L1_2)
1258 ASPM_ATTR(l1_1_pcipm, L1_1_PCIPM)
1259 ASPM_ATTR(l1_2_pcipm, L1_2_PCIPM)
1261 static ssize_t clkpm_show(struct device *dev,
1262 struct device_attribute *attr, char *buf)
1264 struct pci_dev *pdev = to_pci_dev(dev);
1265 struct pcie_link_state *link = pcie_aspm_get_link(pdev);
1267 return sprintf(buf, "%d\n", link->clkpm_enabled);
1270 static ssize_t clkpm_store(struct device *dev,
1271 struct device_attribute *attr,
1272 const char *buf, size_t len)
1274 struct pci_dev *pdev = to_pci_dev(dev);
1275 struct pcie_link_state *link = pcie_aspm_get_link(pdev);
1278 if (strtobool(buf, &state_enable) < 0)
1281 down_read(&pci_bus_sem);
1282 mutex_lock(&aspm_lock);
1284 link->clkpm_disable = !state_enable;
1285 pcie_set_clkpm(link, policy_to_clkpm_state(link));
1287 mutex_unlock(&aspm_lock);
1288 up_read(&pci_bus_sem);
1293 static DEVICE_ATTR_RW(clkpm);
1294 static DEVICE_ATTR_RW(l0s_aspm);
1295 static DEVICE_ATTR_RW(l1_aspm);
1296 static DEVICE_ATTR_RW(l1_1_aspm);
1297 static DEVICE_ATTR_RW(l1_2_aspm);
1298 static DEVICE_ATTR_RW(l1_1_pcipm);
1299 static DEVICE_ATTR_RW(l1_2_pcipm);
1301 static struct attribute *aspm_ctrl_attrs[] = {
1302 &dev_attr_clkpm.attr,
1303 &dev_attr_l0s_aspm.attr,
1304 &dev_attr_l1_aspm.attr,
1305 &dev_attr_l1_1_aspm.attr,
1306 &dev_attr_l1_2_aspm.attr,
1307 &dev_attr_l1_1_pcipm.attr,
1308 &dev_attr_l1_2_pcipm.attr,
1312 static umode_t aspm_ctrl_attrs_are_visible(struct kobject *kobj,
1313 struct attribute *a, int n)
1315 struct device *dev = kobj_to_dev(kobj);
1316 struct pci_dev *pdev = to_pci_dev(dev);
1317 struct pcie_link_state *link = pcie_aspm_get_link(pdev);
1318 static const u8 aspm_state_map[] = {
1323 ASPM_STATE_L1_1_PCIPM,
1324 ASPM_STATE_L1_2_PCIPM,
1327 if (aspm_disabled || !link)
1331 return link->clkpm_capable ? a->mode : 0;
1333 return link->aspm_capable & aspm_state_map[n - 1] ? a->mode : 0;
1336 const struct attribute_group aspm_ctrl_attr_group = {
1338 .attrs = aspm_ctrl_attrs,
1339 .is_visible = aspm_ctrl_attrs_are_visible,
1342 static int __init pcie_aspm_disable(char *str)
1344 if (!strcmp(str, "off")) {
1345 aspm_policy = POLICY_DEFAULT;
1347 aspm_support_enabled = false;
1348 printk(KERN_INFO "PCIe ASPM is disabled\n");
1349 } else if (!strcmp(str, "force")) {
1351 printk(KERN_INFO "PCIe ASPM is forcibly enabled\n");
1356 __setup("pcie_aspm=", pcie_aspm_disable);
1358 void pcie_no_aspm(void)
1361 * Disabling ASPM is intended to prevent the kernel from modifying
1362 * existing hardware state, not to clear existing state. To that end:
1363 * (a) set policy to POLICY_DEFAULT in order to avoid changing state
1364 * (b) prevent userspace from changing policy
1367 aspm_policy = POLICY_DEFAULT;
1372 bool pcie_aspm_support_enabled(void)
1374 return aspm_support_enabled;
1376 EXPORT_SYMBOL(pcie_aspm_support_enabled);