]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
ACPI: bus: Avoid using CPPC if not supported by firmware
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 16 Mar 2022 12:39:03 +0000 (13:39 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 17 Mar 2022 13:51:53 +0000 (14:51 +0100)
If the platform firmware indicates that it does not support CPPC by
clearing the OSC_SB_CPC_SUPPORT and OSC_SB_CPCV2_SUPPORT bits in the
platform _OSC capabilities mask, avoid attempting to evaluate _CPC
which may fail in that case.

Because the OSC_SB_CPC_SUPPORT and OSC_SB_CPCV2_SUPPORT bits are only
added to the supported platform capabilities mask on x86, when
X86_FEATURE_HWP is supported, allow _CPC to be evaluated regardless
in the other cases.

Link: https://lore.kernel.org/linux-acpi/CAJZ5v0i=ecAksq0TV+iLVObm-=fUfdqPABzzkgm9K6KxO1ZCcg@mail.gmail.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Tested-by: Mario Limonciello <mario.limonciello@amd.com>
Acked-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
drivers/acpi/bus.c
drivers/acpi/cppc_acpi.c
include/linux/acpi.h

index c7670d441ad9e133c722549ecdb5fdd0c5b5016d..8aa7860602e7ab55afecacff458b600733e5c0ca 100644 (file)
@@ -283,6 +283,8 @@ EXPORT_SYMBOL_GPL(osc_pc_lpi_support_confirmed);
 bool osc_sb_native_usb4_support_confirmed;
 EXPORT_SYMBOL_GPL(osc_sb_native_usb4_support_confirmed);
 
+bool osc_sb_cppc_not_supported;
+
 static u8 sb_uuid_str[] = "0811B06E-4A27-44F9-8D60-3CBBC22E7B48";
 static void acpi_bus_osc_negotiate_platform_control(void)
 {
@@ -338,6 +340,12 @@ static void acpi_bus_osc_negotiate_platform_control(void)
                return;
        }
 
+#ifdef CONFIG_X86
+       if (boot_cpu_has(X86_FEATURE_HWP))
+               osc_sb_cppc_not_supported = !(capbuf_ret[OSC_SUPPORT_DWORD] &
+                               (OSC_SB_CPC_SUPPORT | OSC_SB_CPCV2_SUPPORT));
+#endif
+
        /*
         * Now run _OSC again with query flag clear and with the caps
         * supported by both the OS and the platform.
index 866560cbb082cd7b14caf384e3a5fba465dfa778..3e89ad246b60fae9ae7b8a8a233354f4e9ccf275 100644 (file)
@@ -656,6 +656,9 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr)
        acpi_status status;
        int ret = -EFAULT;
 
+       if (osc_sb_cppc_not_supported)
+               return -ENODEV;
+
        /* Parse the ACPI _CPC table for this CPU. */
        status = acpi_evaluate_object_typed(handle, "_CPC", NULL, &output,
                        ACPI_TYPE_PACKAGE);
index 6274758648e37db4166444f67f83099a1f040908..690b0533104ae07ae47fc9e2a1dc6f06088475d8 100644 (file)
@@ -580,6 +580,7 @@ acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context);
 extern bool osc_sb_apei_support_acked;
 extern bool osc_pc_lpi_support_confirmed;
 extern bool osc_sb_native_usb4_support_confirmed;
+extern bool osc_sb_cppc_not_supported;
 
 /* USB4 Capabilities */
 #define OSC_USB_USB3_TUNNELING                 0x00000001