Patchwork [v1,4/4] PCI/ACPI: Advertise HPX type 3 support via _OSC

login
register
mail settings
Submitter Alexandru Gagniuc
Date March 15, 2019, 7:29 p.m.
Message ID <20190315192947.13807-1-mr.nuke.me@gmail.com>
Download mbox | patch
Permalink /patch/749919/
State New
Headers show

Comments

Alexandru Gagniuc - March 15, 2019, 7:29 p.m.
_OSC now has a way to inform firmware that OS has the capability to
interpret HPX type 3 tables. Since ACPI 6.3 deprecated _OSC specifics,
these are now part of the PCI Firmware Specification.

The following is the document describing the changes:
ECN:	_HPX and PCIe Completion Timeout related _OSC Enhancements
Date:	September 12, 2018
Affected Document: PCI Firmware Specification, Rev. 3.2

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
---

This patch is designed to go on top of the following series
"PCI: ACPI: Implement support for _HPX Type 3 tables"
	https://lkml.org/lkml/2019/3/7/790

Although the patch can technically be applied independently, it
doesn't make sense without the rest of the series.

The HPX3 capability bit, to my understanding, is designed to be
informational. i.e. Setting or not setting it would not affect whether
firmware would export HPX3 tables. It may have implications in FFS
systems, where FW might need to make sure things like the completion
timeout value is set correctly throughout the tree.

My understanding is that firmware will prefer to set these with HPX3,
in lieu of firing up SMM on hotplug and other events. Firmware can use
the HPX3 support bit to know how to proceed.

 drivers/acpi/pci_root.c | 2 ++
 include/linux/acpi.h    | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)
Bjorn Helgaas - April 23, 2019, 9:38 p.m.
On Fri, Mar 15, 2019 at 02:29:40PM -0500, Alexandru Gagniuc wrote:
> _OSC now has a way to inform firmware that OS has the capability to
> interpret HPX type 3 tables. Since ACPI 6.3 deprecated _OSC specifics,
> these are now part of the PCI Firmware Specification.
> 
> The following is the document describing the changes:
> ECN:	_HPX and PCIe Completion Timeout related _OSC Enhancements
> Date:	September 12, 2018
> Affected Document: PCI Firmware Specification, Rev. 3.2
> 
> Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

Applied to pci/hotplug for v5.2, thanks!

> ---
> 
> This patch is designed to go on top of the following series
> "PCI: ACPI: Implement support for _HPX Type 3 tables"
> 	https://lkml.org/lkml/2019/3/7/790
> 
> Although the patch can technically be applied independently, it
> doesn't make sense without the rest of the series.
> 
> The HPX3 capability bit, to my understanding, is designed to be
> informational. i.e. Setting or not setting it would not affect whether
> firmware would export HPX3 tables. It may have implications in FFS
> systems, where FW might need to make sure things like the completion
> timeout value is set correctly throughout the tree.
> 
> My understanding is that firmware will prefer to set these with HPX3,
> in lieu of firing up SMM on hotplug and other events. Firmware can use
> the HPX3 support bit to know how to proceed.
> 
>  drivers/acpi/pci_root.c | 2 ++
>  include/linux/acpi.h    | 3 ++-
>  2 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
> index 707aafc7c2aa..0bee23893297 100644
> --- a/drivers/acpi/pci_root.c
> +++ b/drivers/acpi/pci_root.c
> @@ -145,6 +145,7 @@ static struct pci_osc_bit_struct pci_osc_support_bit[] = {
>  	{ OSC_PCI_CLOCK_PM_SUPPORT, "ClockPM" },
>  	{ OSC_PCI_SEGMENT_GROUPS_SUPPORT, "Segments" },
>  	{ OSC_PCI_MSI_SUPPORT, "MSI" },
> +	{ OSC_PCI_HPX_TYPE_3_SUPPORT, "HPX-type3" },
>  };
>  
>  static struct pci_osc_bit_struct pci_osc_control_bit[] = {
> @@ -446,6 +447,7 @@ static void negotiate_os_control(struct acpi_pci_root *root, int *no_aspm,
>  	 * PCI domains, so we indicate this in _OSC support capabilities.
>  	 */
>  	support = OSC_PCI_SEGMENT_GROUPS_SUPPORT;
> +	support |= OSC_PCI_HPX_TYPE_3_SUPPORT;
>  	if (pci_ext_cfg_avail())
>  		support |= OSC_PCI_EXT_CONFIG_SUPPORT;
>  	if (pcie_aspm_support_enabled())
> diff --git a/include/linux/acpi.h b/include/linux/acpi.h
> index 87715f20b69a..028c138b9082 100644
> --- a/include/linux/acpi.h
> +++ b/include/linux/acpi.h
> @@ -508,7 +508,8 @@ extern bool osc_pc_lpi_support_confirmed;
>  #define OSC_PCI_CLOCK_PM_SUPPORT		0x00000004
>  #define OSC_PCI_SEGMENT_GROUPS_SUPPORT		0x00000008
>  #define OSC_PCI_MSI_SUPPORT			0x00000010
> -#define OSC_PCI_SUPPORT_MASKS			0x0000001f
> +#define OSC_PCI_HPX_TYPE_3_SUPPORT		0x00000100
> +#define OSC_PCI_SUPPORT_MASKS			0x0000011f
>  
>  /* PCI Host Bridge _OSC: Capabilities DWORD 3: Control Field */
>  #define OSC_PCI_EXPRESS_NATIVE_HP_CONTROL	0x00000001
> -- 
> 2.19.2
>

Patch

diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index 707aafc7c2aa..0bee23893297 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -145,6 +145,7 @@  static struct pci_osc_bit_struct pci_osc_support_bit[] = {
 	{ OSC_PCI_CLOCK_PM_SUPPORT, "ClockPM" },
 	{ OSC_PCI_SEGMENT_GROUPS_SUPPORT, "Segments" },
 	{ OSC_PCI_MSI_SUPPORT, "MSI" },
+	{ OSC_PCI_HPX_TYPE_3_SUPPORT, "HPX-type3" },
 };
 
 static struct pci_osc_bit_struct pci_osc_control_bit[] = {
@@ -446,6 +447,7 @@  static void negotiate_os_control(struct acpi_pci_root *root, int *no_aspm,
 	 * PCI domains, so we indicate this in _OSC support capabilities.
 	 */
 	support = OSC_PCI_SEGMENT_GROUPS_SUPPORT;
+	support |= OSC_PCI_HPX_TYPE_3_SUPPORT;
 	if (pci_ext_cfg_avail())
 		support |= OSC_PCI_EXT_CONFIG_SUPPORT;
 	if (pcie_aspm_support_enabled())
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 87715f20b69a..028c138b9082 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -508,7 +508,8 @@  extern bool osc_pc_lpi_support_confirmed;
 #define OSC_PCI_CLOCK_PM_SUPPORT		0x00000004
 #define OSC_PCI_SEGMENT_GROUPS_SUPPORT		0x00000008
 #define OSC_PCI_MSI_SUPPORT			0x00000010
-#define OSC_PCI_SUPPORT_MASKS			0x0000001f
+#define OSC_PCI_HPX_TYPE_3_SUPPORT		0x00000100
+#define OSC_PCI_SUPPORT_MASKS			0x0000011f
 
 /* PCI Host Bridge _OSC: Capabilities DWORD 3: Control Field */
 #define OSC_PCI_EXPRESS_NATIVE_HP_CONTROL	0x00000001