x86/acpi: Add Hygon Dhyana support
authorPu Wen <puwen@hygon.cn>
Wed, 12 Jun 2019 12:53:58 +0000 (20:53 +0800)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 12 Jun 2019 12:59:05 +0000 (13:59 +0100)
Add Hygon Dhyana support to the acpi cpufreq and cpuidle subsystems by
using the code path of AMD.

Signed-off-by: Pu Wen <puwen@hygon.cn>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/acpi/cpu_idle.c
xen/arch/x86/acpi/cpufreq/cpufreq.c
xen/arch/x86/acpi/cpufreq/powernow.c

index 8846722bca174fdc866477c76d3e45616eb0b706..5931928d6f3698d3fda1ad9a277b20295606d39e 100644 (file)
@@ -802,7 +802,8 @@ void acpi_dead_idle(void)
             __mwait(cx->address, 0);
         }
     }
-    else if ( current_cpu_data.x86_vendor == X86_VENDOR_AMD &&
+    else if ( (current_cpu_data.x86_vendor &
+               (X86_VENDOR_AMD | X86_VENDOR_HYGON)) &&
               cx->entry_method == ACPI_CSTATE_EM_SYSIO )
     {
         /* Intel prefers not to use SYSIO */
index f4e13e10e8cb14142d95f6201f8e2472c07a9f60..7086d1aa1551bcd062bd704fba972df1791fa0e9 100644 (file)
@@ -649,7 +649,8 @@ static int __init cpufreq_driver_init(void)
         (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL))
         ret = cpufreq_register_driver(&acpi_cpufreq_driver);
     else if ((cpufreq_controller == FREQCTL_xen) &&
-        (boot_cpu_data.x86_vendor == X86_VENDOR_AMD))
+        (boot_cpu_data.x86_vendor &
+         (X86_VENDOR_AMD | X86_VENDOR_HYGON)))
         ret = powernow_register_driver();
 
     return ret;
@@ -660,8 +661,9 @@ int cpufreq_cpu_init(unsigned int cpuid)
 {
     int ret;
 
-    /* Currently we only handle Intel and AMD processor */
-    if ( boot_cpu_data.x86_vendor & (X86_VENDOR_INTEL | X86_VENDOR_AMD) )
+    /* Currently we only handle Intel, AMD and Hygon processor */
+    if ( boot_cpu_data.x86_vendor &
+         (X86_VENDOR_INTEL | X86_VENDOR_AMD | X86_VENDOR_HYGON) )
         ret = cpufreq_add_cpu(cpuid);
     else
         ret = -EFAULT;
index 025b37da03b1096f08e93dec0128fbd6030f2b67..72ab6a1eba51d19e4a45f59a3dbe9f0267cb4d23 100644 (file)
@@ -360,7 +360,7 @@ unsigned int __init powernow_register_driver()
 
     for_each_online_cpu(i) {
         struct cpuinfo_x86 *c = &cpu_data[i];
-        if (c->x86_vendor != X86_VENDOR_AMD)
+        if (!(c->x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON)))
             ret = -ENODEV;
         else
         {