Skip to contentSkip to conversation

PCIE ASPM support - takes 2

PATCH Shaohua Li 2 participants 3 messages Jan 15, 2008 – Jan 16, 2008 2 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

Shaohua Li

author
#2 lore raw
Quoted 22 lines · Matthew Wilcox
Quoted 5 lines · Shaohua Li
(quoted diff) +5 -0
+	int same_clock = 0;
+
+	/* Check downstream component if bit Slot Clock Configuration is 1 */
+	child_pos = pci_find_capability(child_dev, PCI_CAP_ID_EXP);
+	pci_read_config_word(child_dev, child_pos + PCI_EXP_LNKSTA, &reg16);

Review

Quoted 10 lines
(quoted diff) +10 -0
+	if (reg16 & PCI_EXP_LNKSTA_SLC)
+		same_clock = 1;
+
+	/* Check upstream component if bit Slot Clock Configuration is 1 */
+	pos = pci_find_capability(pdev, PCI_CAP_ID_EXP);
+	pci_read_config_word(pdev, pos + PCI_EXP_LNKSTA, &reg16);
+	if (reg16 & PCI_EXP_LNKSTA_SLC)
+		same_clock &= 1;
+	else
+		same_clock = 0;

This could be done a little neater ... the &= 1 idiom confused me on a quick scan.

How about:

Quoted 11 lines
	int same_clock = 1;

	child_pos = pci_find_capability(child_dev, PCI_CAP_ID_EXP);
	pci_read_config_word(child_dev, child_pos + PCI_EXP_LNKSTA, &reg16);
	if (!(reg16 & PCI_EXP_LNKSTA_SLC))
		same_clock = 0;

	pos = pci_find_capability(pdev, PCI_CAP_ID_EXP);
	pci_read_config_word(pdev, pos + PCI_EXP_LNKSTA, &reg16);
	if (!(reg16 & PCI_EXP_LNKSTA_SLC))
		same_clock = 0;

Thanks, for your time. ok, this is better.

Quoted 10 lines

Review

Quoted 5 lines
(quoted diff) +5 -0
+#ifdef CONFIG_PCIEASPM
+extern int pcie_aspm_init(void);
+#else
+#define pcie_aspm_init() do {} while (0)
+#endif

If pcie_aspm_init() returns a value, then callers may want to check it ... which they can't do for this null definition. How about simply:

#define pcie_aspm_init() 0

ok

Quoted 20 lines
Quoted 20 lines

Index: linux/drivers/pci/pci-acpi.c
===================================================================

drivers/pci/pci-acpi.c +4 -0
@@ -15,6 +15,7 @@
 #include <acpi/acnamesp.h>
 #include <acpi/acresrc.h>
 #include <acpi/acpi_bus.h>
+#include <linux/aspm.h>
 
 #include <linux/pci-acpi.h>
 #include "pci.h"
@@ -349,3 +350,11 @@ static int __init acpi_pci_init(void)
 	return 0;
 }
 arch_initcall(acpi_pci_init);
+
+/* Called after ACPI is enabled */
+static int __init acpi_pcie_support_init(void)
Quoted 8 lines

drivers/pci/pci-acpi.c static int __init acpi_pci_init(void) · line 360

Quoted 5 lines
drivers/pci/pci-acpi.c +5 -0
+{
+	pcie_aspm_init();
+	return 0;
+}
+fs_initcall(acpi_pcie_support_init);

Is there any reason to put this in here instead of just making pcie_aspm_init an initcall?

yes, this will evaluate some ACPI methods, so must be called after ACPI is initialized, which is a sub_system call

Thanks,
Shaohua

#3 lore raw
Quoted 11 lines · Shaohua Li
Quoted 11 lines

Review

Quoted 8 lines
(quoted diff) +8 -0
+
+/* Called after ACPI is enabled */
+static int __init acpi_pcie_support_init(void)
+{
+	pcie_aspm_init();
+	return 0;
+}
+fs_initcall(acpi_pcie_support_init);

Is there any reason to put this in here instead of just making pcie_aspm_init an initcall?

Quoted 2 lines

yes, this will evaluate some ACPI methods, so must be called after ACPI is initialized, which is a sub_system call

I wasn't saying that you should change it from being an fs_initcall. I was saying that you might want to consider deleting this function and adding

fs_initcall(pcie_aspm_init);

in the file that defines pcie_aspm_init.

Signature · 4 lines
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."
author
#4 lore raw
Quoted 15 lines · Matthew Wilcox
Quoted 11 lines · Shaohua Li
Quoted 11 lines

Review

Quoted 8 lines
(quoted diff) +8 -0
+
+/* Called after ACPI is enabled */
+static int __init acpi_pcie_support_init(void)
+{
+	pcie_aspm_init();
+	return 0;
+}
+fs_initcall(acpi_pcie_support_init);

Is there any reason to put this in here instead of just making pcie_aspm_init an initcall?

Quoted 2 lines

yes, this will evaluate some ACPI methods, so must be called after ACPI is initialized, which is a sub_system call

Quoted 7 lines

I wasn't saying that you should change it from being an fs_initcall. I was saying that you might want to consider deleting this function and adding

fs_initcall(pcie_aspm_init);

in the file that defines pcie_aspm_init.

I thought we'd better put all ACPI support bits support in one routine call, like OSC_EXT_PCI_CONFIG_SUPPORT, we didn't do it so far, so I added a new routine. But I might be over thinking.

Thanks,
Shaohua