From patchwork Mon Mar 25 13:30:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pu Wen X-Patchwork-Id: 10869147 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8A3A61390 for ; Mon, 25 Mar 2019 13:36:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7832A2860B for ; Mon, 25 Mar 2019 13:36:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7656B28635; Mon, 25 Mar 2019 13:36:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1697E2860B for ; Mon, 25 Mar 2019 13:36:26 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1h8PkS-0002vo-Ow; Mon, 25 Mar 2019 13:34:44 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1h8PkR-0002vX-M8 for xen-devel@lists.xenproject.org; Mon, 25 Mar 2019 13:34:43 +0000 X-Inumbo-ID: bb23cf4c-4f02-11e9-a94a-ef068bdaa171 Received: from spam2.hygon.cn (unknown [110.188.70.11]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id bb23cf4c-4f02-11e9-a94a-ef068bdaa171; Mon, 25 Mar 2019 13:34:37 +0000 (UTC) Received: from MK-FE.hygon.cn ([172.23.18.61]) by spam2.hygon.cn with ESMTP id x2PDV5FD015724; Mon, 25 Mar 2019 21:31:05 +0800 (GMT-8) (envelope-from puwen@hygon.cn) Received: from cncheex01.Hygon.cn ([172.23.18.10]) by MK-FE.hygon.cn with ESMTP id x2PDV02K001792; Mon, 25 Mar 2019 21:31:00 +0800 (GMT-8) (envelope-from puwen@hygon.cn) Received: from pw-vbox.hygon.cn (172.23.18.44) by cncheex01.Hygon.cn (172.23.18.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1466.3; Mon, 25 Mar 2019 21:31:04 +0800 From: Pu Wen To: Date: Mon, 25 Mar 2019 21:30:57 +0800 Message-ID: <02d4ff1221a5d45aa62548f9c32081946e977a71.1553520193.git.puwen@hygon.cn> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [172.23.18.44] X-ClientProxiedBy: cncheex01.Hygon.cn (172.23.18.10) To cncheex01.Hygon.cn (172.23.18.10) X-MAIL: spam2.hygon.cn x2PDV5FD015724 X-DNSRBL: Subject: [Xen-devel] [PATCH v3 07/14] x86/acpi: Add Hygon Dhyana support X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Pu Wen , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu , Jan Beulich , Andrew Cooper Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Add Hygon Dhyana support to the acpi cpufreq and cpuidle subsystems by using the code path of AMD. Signed-off-by: Pu Wen Acked-by: Jan Beulich --- xen/arch/x86/acpi/cpu_idle.c | 3 ++- xen/arch/x86/acpi/cpufreq/cpufreq.c | 8 +++++--- xen/arch/x86/acpi/cpufreq/powernow.c | 3 ++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c index 654de24..02e4873 100644 --- a/xen/arch/x86/acpi/cpu_idle.c +++ b/xen/arch/x86/acpi/cpu_idle.c @@ -796,7 +796,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..14c18bd 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(&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 || + boot_cpu_data.x86_vendor == X86_VENDOR_HYGON)) ret = powernow_register_driver(); return ret; @@ -660,9 +661,10 @@ int cpufreq_cpu_init(unsigned int cpuid) { int ret; - /* Currently we only handle Intel and AMD processor */ + /* Currently we only handle Intel, AMD and Hygon processor */ if ( (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL ) || - (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 = cpufreq_add_cpu(cpuid); else ret = -EFAULT; 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 = &cpu_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 {