Skip to contentSkip to conversation

ACPI: Correct \_SB._OSC bit definition for PRM

PATCH Applied Aubrey Li 3 participants 8 messages Jul 2, 2021 ACPI

lore
Share & tools
lore

Aubrey Li

author
#0 lore raw

PATCH 1/2 ACPI: Correct \_SB._OSC bit definition for PRM

Accord to Platform Runtime Mechanism Specification v1.0 [1], Page 42, _OSC bit (BIT 21) is used to indicate OS support of platform runtime mechanism..

[1]: https://uefi.org/sites/default/files/resources/Platform%20Runtime%20Mechanism%20-%20with%20legal%20notice.pdf

Cc Dan Williams <[email protected]>
---
 include/linux/acpi.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/acpi.h +1 -1
index b338613..4df6a81 100644
@@ -551,8 +551,8 @@ acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context);
 #define OSC_SB_OSLPI_SUPPORT			0x00000100
 #define OSC_SB_CPC_DIVERSE_HIGH_SUPPORT		0x00001000
 #define OSC_SB_GENERIC_INITIATOR_SUPPORT	0x00002000
-#define OSC_SB_PRM_SUPPORT			0x00020000
 #define OSC_SB_NATIVE_USB4_SUPPORT		0x00040000
+#define OSC_SB_PRM_SUPPORT			0x00200000
 
 extern bool osc_sb_apei_support_acked;
 extern bool osc_pc_lpi_support_confirmed;
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH 2/2 ACPI: let BIOS fall back to legacy handling if PRM disabled

Based on _OSC PRM bit, BIOS can choose switch from legacy handling to using PRM. So if CONFIG_ACPI_PRMT is disabled, this bit should not be set to let BIOS fall back to the legacy handling (such as SMI).

Cc Dan Williams <[email protected]>
---
 drivers/acpi/bus.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/acpi/bus.c +2 -0
index 60fb6a84..30a3d4a 100644
@@ -303,7 +303,9 @@ static void acpi_bus_osc_negotiate_platform_control(void)
 
 	capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_HOTPLUG_OST_SUPPORT;
 	capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_PCLPI_SUPPORT;
+#ifdef CONFIG_ACPI_PRMT
 	capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_PRM_SUPPORT;
+#endif
 
 #ifdef CONFIG_ARM64
 	capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_GENERIC_INITIATOR_SUPPORT;
Signature · 1 line
2.7.4
#2 lore raw

Re: [PATCH 2/2] ACPI: let BIOS fall back to legacy handling if PRM disabled

Quoted 16 lines · Aubrey Li

Based on _OSC PRM bit, BIOS can choose switch from legacy handling to using PRM. So if CONFIG_ACPI_PRMT is disabled, this bit should not be set to let BIOS fall back to the legacy handling (such as SMI).

Cc Dan Williams <[email protected]>
---
 drivers/acpi/bus.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/acpi/bus.c +0 -0
index 60fb6a84..30a3d4a 100644

drivers/acpi/bus.c static void acpi_bus_osc_negotiate_platform_control(void) · line 308

Quoted 6 lines
drivers/acpi/bus.c +2 -0
@@ -303,7 +303,9 @@ static void acpi_bus_osc_negotiate_platform_control(void)
 
        capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_HOTPLUG_OST_SUPPORT;
        capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_PCLPI_SUPPORT;
+#ifdef CONFIG_ACPI_PRMT
        capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_PRM_SUPPORT;
+#endif

What about using if (IS_ENABLED()) instead of #ifdef?

Quoted 6 lines
drivers/acpi/bus.c +0 -1
 #ifdef CONFIG_ARM64
        capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_GENERIC_INITIATOR_SUPPORT;
--

2.7.4

#3 lore raw

Re: [PATCH 2/2] ACPI: let BIOS fall back to legacy handling if PRM disabled

Quoted 19 lines · Rafael J. Wysocki
Quoted 17 lines · Aubrey Li

Based on _OSC PRM bit, BIOS can choose switch from legacy handling to using PRM. So if CONFIG_ACPI_PRMT is disabled, this bit should not be set to let BIOS fall back to the legacy handling (such as SMI).

Cc Dan Williams <[email protected]>
---
 drivers/acpi/bus.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/acpi/bus.c +0 -0
index 60fb6a84..30a3d4a 100644
@@ -303,7 +303,9 @@ static void acpi_bus_osc_negotiate_platform_control(void)
 
Quoted 7 lines

drivers/acpi/bus.c static void acpi_bus_osc_negotiate_platform_control(void) · line 308

Quoted 5 lines
drivers/acpi/bus.c +2 -0
        capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_HOTPLUG_OST_SUPPORT;
        capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_PCLPI_SUPPORT;
+#ifdef CONFIG_ACPI_PRMT
        capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_PRM_SUPPORT;
+#endif

What about using if (IS_ENABLED()) instead of #ifdef?

I've made this change myself and applied the patch with a rewritten changelog and under a different subject ("ACPI: Do not singal PRM support if not enabled").

Thanks!

#4 lore raw

Re: [PATCH 2/2] ACPI: let BIOS fall back to legacy handling if PRM disabled

In reply to Rafael J. Wysocki
Quoted 18 lines · Rafael J. Wysocki
Quoted 17 lines · Aubrey Li

Based on _OSC PRM bit, BIOS can choose switch from legacy handling to using PRM. So if CONFIG_ACPI_PRMT is disabled, this bit should not be set to let BIOS fall back to the legacy handling (such as SMI).

Cc Dan Williams <[email protected]>
---
 drivers/acpi/bus.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/acpi/bus.c +0 -0
index 60fb6a84..30a3d4a 100644
@@ -303,7 +303,9 @@ static void acpi_bus_osc_negotiate_platform_control(void)
 
Quoted 7 lines

drivers/acpi/bus.c static void acpi_bus_osc_negotiate_platform_control(void) · line 308

Quoted 5 lines
drivers/acpi/bus.c +2 -0
        capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_HOTPLUG_OST_SUPPORT;
        capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_PCLPI_SUPPORT;
+#ifdef CONFIG_ACPI_PRMT
        capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_PRM_SUPPORT;
+#endif

What about using if (IS_ENABLED()) instead of #ifdef?

aha, sorry, using if (IS_ENABLED()) is better, will come up with a new version soon.

Thanks,
-Aubrey

#5 lore raw

Re: [PATCH 2/2] ACPI: let BIOS fall back to legacy handling if PRM disabled

Quoted 28 lines · Aubrey Li
Quoted 18 lines · Rafael J. Wysocki
Quoted 17 lines · Aubrey Li

Based on _OSC PRM bit, BIOS can choose switch from legacy handling to using PRM. So if CONFIG_ACPI_PRMT is disabled, this bit should not be set to let BIOS fall back to the legacy handling (such as SMI).

Cc Dan Williams <[email protected]>
---
 drivers/acpi/bus.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/acpi/bus.c +0 -0
index 60fb6a84..30a3d4a 100644
@@ -303,7 +303,9 @@ static void acpi_bus_osc_negotiate_platform_control(void)
 
Quoted 7 lines

drivers/acpi/bus.c static void acpi_bus_osc_negotiate_platform_control(void) · line 308

Quoted 5 lines
drivers/acpi/bus.c +2 -0
        capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_HOTPLUG_OST_SUPPORT;
        capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_PCLPI_SUPPORT;
+#ifdef CONFIG_ACPI_PRMT
        capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_PRM_SUPPORT;
+#endif

What about using if (IS_ENABLED()) instead of #ifdef?

Quoted 1 line

aha, sorry, using if (IS_ENABLED()) is better, will come up with a new version soon.

No need (see my other reply).

Thanks!

#6 lore raw

Re: [PATCH 2/2] ACPI: let BIOS fall back to legacy handling if PRM disabled

Quoted 29 lines · Rafael J. Wysocki
Quoted 28 lines · Aubrey Li
Quoted 25 lines · Rafael J. Wysocki
Quoted 16 lines · Aubrey Li

Based on _OSC PRM bit, BIOS can choose switch from legacy handling to using PRM. So if CONFIG_ACPI_PRMT is disabled, this bit should not be set to let BIOS fall back to the legacy handling (such as SMI).

Cc Dan Williams <[email protected]>
---
 drivers/acpi/bus.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/acpi/bus.c +0 -0
index 60fb6a84..30a3d4a 100644

drivers/acpi/bus.c static void acpi_bus_osc_negotiate_platform_control(void) · line 308

Quoted 6 lines
drivers/acpi/bus.c +2 -0
@@ -303,7 +303,9 @@ static void acpi_bus_osc_negotiate_platform_control(void)
 
        capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_HOTPLUG_OST_SUPPORT;
        capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_PCLPI_SUPPORT;
+#ifdef CONFIG_ACPI_PRMT
        capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_PRM_SUPPORT;
+#endif

What about using if (IS_ENABLED()) instead of #ifdef?

Quoted 6 lines
Quoted 1 line

aha, sorry, using if (IS_ENABLED()) is better, will come up with a new version soon.

No need (see my other reply).

Thanks!

Okay, thanks Rafael!

maintainer Applied
#7 lore raw
In reply to Aubrey Li
Quoted 18 lines · Aubrey Li

Accord to Platform Runtime Mechanism Specification v1.0 [1], Page 42, _OSC bit (BIT 21) is used to indicate OS support of platform runtime mechanism..

[1]: https://uefi.org/sites/default/files/resources/Platform%20Runtime%20Mechanism%20-%20with%20legal%20notice.pdf

Cc Dan Williams <[email protected]>
---
 include/linux/acpi.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/acpi.h +0 -0
index b338613..4df6a81 100644

include/linux/acpi.h acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context);

Quoted 10 lines
include/linux/acpi.h +1 -2
@@ -551,8 +551,8 @@ acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context);
 #define OSC_SB_OSLPI_SUPPORT                   0x00000100
 #define OSC_SB_CPC_DIVERSE_HIGH_SUPPORT                0x00001000
 #define OSC_SB_GENERIC_INITIATOR_SUPPORT       0x00002000
-#define OSC_SB_PRM_SUPPORT                     0x00020000
 #define OSC_SB_NATIVE_USB4_SUPPORT             0x00040000
+#define OSC_SB_PRM_SUPPORT                     0x00200000
 
 extern bool osc_sb_apei_support_acked;
 extern bool osc_pc_lpi_support_confirmed;
--

Applied as 5.14-rc1 material, thanks!