2021-07-02 07:06:01

by Aubrey Li

[permalink] [raw]
Subject: [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]>
Signed-off-by: Aubrey Li <[email protected]>
---
include/linux/acpi.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index b338613..4df6a81 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -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;
--
2.7.4


2021-07-02 07:06:48

by Aubrey Li

[permalink] [raw]
Subject: [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]>
Signed-off-by: Aubrey Li <[email protected]>
---
drivers/acpi/bus.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 60fb6a84..30a3d4a 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -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;
--
2.7.4

2021-07-02 13:16:28

by Rafael J. Wysocki

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

On Fri, Jul 2, 2021 at 9:03 AM Aubrey Li <[email protected]> wrote:
>
> 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]>
> Signed-off-by: Aubrey Li <[email protected]>
> ---
> drivers/acpi/bus.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
> index 60fb6a84..30a3d4a 100644
> --- a/drivers/acpi/bus.c
> +++ b/drivers/acpi/bus.c
> @@ -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?

>
> #ifdef CONFIG_ARM64
> capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_GENERIC_INITIATOR_SUPPORT;
> --
> 2.7.4
>

2021-07-02 14:03:11

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [PATCH 1/2] ACPI: Correct \_SB._OSC bit definition for PRM

On Fri, Jul 2, 2021 at 9:03 AM Aubrey Li <[email protected]> wrote:
>
> 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]>
> Signed-off-by: Aubrey Li <[email protected]>
> ---
> include/linux/acpi.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/acpi.h b/include/linux/acpi.h
> index b338613..4df6a81 100644
> --- a/include/linux/acpi.h
> +++ b/include/linux/acpi.h
> @@ -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!

2021-07-02 14:04:27

by Rafael J. Wysocki

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

On Fri, Jul 2, 2021 at 1:37 PM Rafael J. Wysocki <[email protected]> wrote:
>
> On Fri, Jul 2, 2021 at 9:03 AM Aubrey Li <[email protected]> wrote:
> >
> > 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]>
> > Signed-off-by: Aubrey Li <[email protected]>
> > ---
> > drivers/acpi/bus.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
> > index 60fb6a84..30a3d4a 100644
> > --- a/drivers/acpi/bus.c
> > +++ b/drivers/acpi/bus.c
> > @@ -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?

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!

2021-07-02 14:05:07

by Li, Aubrey

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

On 7/2/21 7:37 PM, Rafael J. Wysocki wrote:
> On Fri, Jul 2, 2021 at 9:03 AM Aubrey Li <[email protected]> wrote:
>>
>> 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]>
>> Signed-off-by: Aubrey Li <[email protected]>
>> ---
>> drivers/acpi/bus.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
>> index 60fb6a84..30a3d4a 100644
>> --- a/drivers/acpi/bus.c
>> +++ b/drivers/acpi/bus.c
>> @@ -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?

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

Thanks,
-Aubrey

2021-07-02 14:05:48

by Rafael J. Wysocki

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

On Fri, Jul 2, 2021 at 4:02 PM Aubrey Li <[email protected]> wrote:
>
> On 7/2/21 7:37 PM, Rafael J. Wysocki wrote:
> > On Fri, Jul 2, 2021 at 9:03 AM Aubrey Li <[email protected]> wrote:
> >>
> >> 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]>
> >> Signed-off-by: Aubrey Li <[email protected]>
> >> ---
> >> drivers/acpi/bus.c | 2 ++
> >> 1 file changed, 2 insertions(+)
> >>
> >> diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
> >> index 60fb6a84..30a3d4a 100644
> >> --- a/drivers/acpi/bus.c
> >> +++ b/drivers/acpi/bus.c
> >> @@ -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?
>
> aha, sorry, using if (IS_ENABLED()) is better, will come up with a new version soon.

No need (see my other reply).

Thanks!

2021-07-02 14:07:19

by Li, Aubrey

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

On 7/2/21 10:02 PM, Rafael J. Wysocki wrote:
> On Fri, Jul 2, 2021 at 4:02 PM Aubrey Li <[email protected]> wrote:
>>
>> On 7/2/21 7:37 PM, Rafael J. Wysocki wrote:
>>> On Fri, Jul 2, 2021 at 9:03 AM Aubrey Li <[email protected]> wrote:
>>>>
>>>> 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]>
>>>> Signed-off-by: Aubrey Li <[email protected]>
>>>> ---
>>>> drivers/acpi/bus.c | 2 ++
>>>> 1 file changed, 2 insertions(+)
>>>>
>>>> diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
>>>> index 60fb6a84..30a3d4a 100644
>>>> --- a/drivers/acpi/bus.c
>>>> +++ b/drivers/acpi/bus.c
>>>> @@ -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?
>>
>> 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!