From patchwork Tue Apr 9 03:06:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: FionaLi-oc X-Patchwork-Id: 10890409 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 859B614DB for ; Tue, 9 Apr 2019 03:08:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7228E28737 for ; Tue, 9 Apr 2019 03:08:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 64ADC287C3; Tue, 9 Apr 2019 03:08:29 +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 CBDE528737 for ; Tue, 9 Apr 2019 03:08:28 +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 1hDh5i-0005id-TK; Tue, 09 Apr 2019 03:06:30 +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 1hDh5h-0005iY-PK for xen-devel@lists.xenproject.org; Tue, 09 Apr 2019 03:06:29 +0000 X-Inumbo-ID: 74b1e0da-5a74-11e9-be71-73406346db6d Received: from ZXSHCAS1.zhaoxin.com (unknown [203.148.12.81]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 74b1e0da-5a74-11e9-be71-73406346db6d; Tue, 09 Apr 2019 03:06:26 +0000 (UTC) Received: from zxbjmbx1.zhaoxin.com (10.29.252.163) by ZXSHCAS1.zhaoxin.com (10.28.252.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1261.35; Tue, 9 Apr 2019 11:06:17 +0800 Received: from localhost.localdomain (10.29.8.62) by zxbjmbx1.zhaoxin.com (10.29.252.163) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1261.35; Tue, 9 Apr 2019 11:06:16 +0800 From: FionaLi-oc To: Date: Tue, 9 Apr 2019 11:06:15 +0800 Message-ID: <1554779175-3593-1-git-send-email-fionali-oc@zhaoxin.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [10.29.8.62] X-ClientProxiedBy: zxbjmbx1.zhaoxin.com (10.29.252.163) To zxbjmbx1.zhaoxin.com (10.29.252.163) Subject: [Xen-devel] [PATCH 1/2] acpi/cpufreq: Support CPU frequency driver for Zhaoxin cpu 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: wei.liu2@citrix.com, andrew.cooper3@citrix.com, cobechen@zhaoxin.com, FionaLi-oc , jbeulich@suse.com, roger.pau@citrix.com Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Implementation of Zhaoxin CPU frequency is compatible with Intel. Zhaoxin CPU also supports EST. Signed-off-by: FionaLi-oc --- xen/arch/x86/acpi/cpufreq/cpufreq.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/acpi/cpufreq/cpufreq.c b/xen/arch/x86/acpi/cpufreq/cpufreq.c index 844ab85..9d86fa0 100644 --- a/xen/arch/x86/acpi/cpufreq/cpufreq.c +++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c @@ -60,7 +60,8 @@ static int check_est_cpu(unsigned int cpuid) { struct cpuinfo_x86 *cpu = &cpu_data[cpuid]; - if (cpu->x86_vendor != X86_VENDOR_INTEL || + if ((cpu->x86_vendor != X86_VENDOR_INTEL && + cpu->x86_vendor != X86_VENDOR_SHANGHAI) || !cpu_has(cpu, X86_FEATURE_EIST)) return 0; @@ -600,7 +601,8 @@ acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) /* Check for APERF/MPERF support in hardware * also check for boost support */ - if (c->x86_vendor == X86_VENDOR_INTEL && c->cpuid_level >= 6) + if ((c->x86_vendor == X86_VENDOR_INTEL && c->cpuid_level >= 6) || + (c->x86_vendor == X86_VENDOR_SHANGHAI)) on_selected_cpus(cpumask_of(cpu), feature_detect, policy, 1); /* @@ -646,7 +648,8 @@ static int __init cpufreq_driver_init(void) int ret = 0; if ((cpufreq_controller == FREQCTL_xen) && - (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)) + ((boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) || + (boot_cpu_data.x86_vendor == X86_VENDOR_SHANGHAI))) ret = cpufreq_register_driver(&acpi_cpufreq_driver); else if ((cpufreq_controller == FREQCTL_xen) && (boot_cpu_data.x86_vendor == X86_VENDOR_AMD)) @@ -660,9 +663,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 ShangHai 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_SHANGHAI ) ) ret = cpufreq_add_cpu(cpuid); else ret = -EFAULT;