Re: [Xen-devel] [PATCH 07/15] x86/acpi: Add Hygon Dhyana support
>>> On 15.01.19 at 13:52, wrote: > On 2019/1/15 1:17, Jan Beulich wrote: > On 20.12.18 at 14:14, wrote: >>> if ( (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL ) || >>> + (boot_cpu_data.x86_vendor == X86_VENDOR_HYGON ) || >>>(boot_cpu_data.x86_vendor == X86_VENDOR_AMD ) ) >>> ret = cpufreq_add_cpu(cpuid); >>> else >> >> At the very least here I think you want to change to switch(). > > I think there is no need to change if() to switch(), because if() looks > concise enough here. Also the change will generate a bigger patch. There may not be a strict need, but such recurring comparisons generally read better when coded as switch(). Jan ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH 07/15] x86/acpi: Add Hygon Dhyana support
On 2019/1/15 1:17, Jan Beulich wrote: On 20.12.18 at 14:14, wrote: >> Add Hygon Dhyana support to the acpi cpufreq subsystem by using the code >> path of AMD. > > ... cpufreq and cpuidle subsystems ... Thanks for the correction. >> @@ -660,8 +661,9 @@ int cpufreq_cpu_init(unsigned int cpuid) >> { >> int ret; >> >> -/* Currently we only handle Intel and AMD processor */ >> +/* Currently we only handle Intel and AMD and Hygon processor */ > > Please replace the first "and" by a comma. OK. >> if ( (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL ) || >> + (boot_cpu_data.x86_vendor == X86_VENDOR_HYGON ) || >>(boot_cpu_data.x86_vendor == X86_VENDOR_AMD ) ) >> ret = cpufreq_add_cpu(cpuid); >> else > > At the very least here I think you want to change to switch(). I think there is no need to change if() to switch(), because if() looks concise enough here. Also the change will generate a bigger patch. -- Regards, Pu Wen ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH 07/15] x86/acpi: Add Hygon Dhyana support
>>> On 20.12.18 at 14:14, wrote: > Add Hygon Dhyana support to the acpi cpufreq subsystem by using the code > path of AMD. ... cpufreq and cpuidle subsystems ... > @@ -660,8 +661,9 @@ int cpufreq_cpu_init(unsigned int cpuid) > { > int ret; > > -/* Currently we only handle Intel and AMD processor */ > +/* Currently we only handle Intel and AMD and Hygon processor */ Please replace the first "and" by a comma. > if ( (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL ) || > + (boot_cpu_data.x86_vendor == X86_VENDOR_HYGON ) || > (boot_cpu_data.x86_vendor == X86_VENDOR_AMD ) ) > ret = cpufreq_add_cpu(cpuid); > else At the very least here I think you want to change to switch(). Jan ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
[Xen-devel] [PATCH 07/15] x86/acpi: Add Hygon Dhyana support
Add Hygon Dhyana support to the acpi cpufreq subsystem by using the code path of AMD. Signed-off-by: Pu Wen --- xen/arch/x86/acpi/cpu_idle.c | 3 ++- xen/arch/x86/acpi/cpufreq/cpufreq.c | 6 -- xen/arch/x86/acpi/cpufreq/powernow.c | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c index 14b0278..f57825c 100644 --- a/xen/arch/x86/acpi/cpu_idle.c +++ b/xen/arch/x86/acpi/cpu_idle.c @@ -795,7 +795,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 || + current_cpu_data.x86_vendor == X86_VENDOR_HYGON) && cx->entry_method == ACPI_CSTATE_EM_SYSIO ) { /* Intel prefers not to use SYSIO */ diff --git a/xen/arch/x86/acpi/cpufreq/cpufreq.c b/xen/arch/x86/acpi/cpufreq/cpufreq.c index 844ab85..005f99b 100644 --- a/xen/arch/x86/acpi/cpufreq/cpufreq.c +++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c @@ -649,7 +649,8 @@ static int __init cpufreq_driver_init(void) (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)) ret = cpufreq_register_driver(_cpufreq_driver); else if ((cpufreq_controller == FREQCTL_xen) && -(boot_cpu_data.x86_vendor == X86_VENDOR_AMD)) +(boot_cpu_data.x86_vendor == X86_VENDOR_AMD || + boot_cpu_data.x86_vendor == 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 */ +/* Currently we only handle Intel and AMD and Hygon processor */ if ( (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL ) || + (boot_cpu_data.x86_vendor == X86_VENDOR_HYGON ) || (boot_cpu_data.x86_vendor == X86_VENDOR_AMD ) ) ret = cpufreq_add_cpu(cpuid); else diff --git a/xen/arch/x86/acpi/cpufreq/powernow.c b/xen/arch/x86/acpi/cpufreq/powernow.c index 025b37d..f245908 100644 --- a/xen/arch/x86/acpi/cpufreq/powernow.c +++ b/xen/arch/x86/acpi/cpufreq/powernow.c @@ -360,7 +360,8 @@ unsigned int __init powernow_register_driver() for_each_online_cpu(i) { struct cpuinfo_x86 *c = _data[i]; -if (c->x86_vendor != X86_VENDOR_AMD) +if (c->x86_vendor != X86_VENDOR_AMD && +c->x86_vendor != X86_VENDOR_HYGON) ret = -ENODEV; else { -- 2.7.4 ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel