From patchwork Thu Mar 16 11:07:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yi Sun X-Patchwork-Id: 9627859 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8C1266048C for ; Thu, 16 Mar 2017 11:16:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 84ED828573 for ; Thu, 16 Mar 2017 11:16:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 78E2D2864B; Thu, 16 Mar 2017 11:16:02 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E4D3A28573 for ; Thu, 16 Mar 2017 11:16:01 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1coTLm-0004AA-DN; Thu, 16 Mar 2017 11:13:46 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1coTLl-00049x-LQ for xen-devel@lists.xenproject.org; Thu, 16 Mar 2017 11:13:45 +0000 Received: from [85.158.137.68] by server-5.bemta-3.messagelabs.com id DB/BF-19998-8637AC85; Thu, 16 Mar 2017 11:13:44 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrDLMWRWlGSWpSXmKPExsVywNwkVjej+FS Ewb3ZMhbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8aGc1OYC37yVUyZeJClgbGPp4uRi4NF4BaT xKV9G9lAHCGBaYwSZz7sBHI4OSQEeCWOLJvBCmH7S1w41ssEUdTAKPHuzFQWkASbgLrE4689T CC2iICSxL1Vk8GKmAV2MkmsO/2dGSQhLBAo8bl9JVgDi4CqxKsnJ4DiHBy8Au4SGx8VQSyQkz h5bDLYMk4BD4mP7e1gthBQybsNf9knMPItYGRYxahRnFpUllqka2iil1SUmZ5RkpuYmaNraGC sl5taXJyYnpqTmFSsl5yfu4kRGCoMQLCDccV2z0OMkhxMSqK85T9ORAjxJeWnVGYkFmfEF5Xm pBYfYpTh4FCS4D2idDJCSLAoNT21Ii0zBxi0MGkJDh4lEd5ckDRvcUFibnFmOkTqFKOilDjvB ZCEAEgiozQPrg0WKZcYZaWEeRmBDhHiKUgtys0sQZV/xSjOwagkzLsZZApPZl4J3PRXQIuZgB a//XACZHFJIkJKqoFR+p1sYtWfu2kNZt/ts1J3mXv4CJ+2nPyy7BV77G3WR6XK/af9gn6rLtZ bxqgrbGEk+u6vz+lnefadv/VsnDt/qkxTqeP1nyF7a81pg/I1Ca9/ePExibTky911ulJsOiG8 vs1BeNn7lz22Of/ZYhjbnN5lfC2aphlctmGz5TeBPRHcv1WPyCuxFGckGmoxFxUnAgAOriNyj wIAAA== X-Env-Sender: yi.y.sun@linux.intel.com X-Msg-Ref: server-2.tower-31.messagelabs.com!1489662818!78881615!3 X-Originating-IP: [192.55.52.93] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTkyLjU1LjUyLjkzID0+IDMyNDY2NQ==\n X-StarScan-Received: X-StarScan-Version: 9.2.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 5377 invoked from network); 16 Mar 2017 11:13:44 -0000 Received: from mga11.intel.com (HELO mga11.intel.com) (192.55.52.93) by server-2.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 16 Mar 2017 11:13:44 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1489662824; x=1521198824; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=qs2eUXRgPynMZ9zYZ3vDcUpG9NYscYZh4m6KzhS1fq0=; b=SyCl2HvgpYT2AeXqKLOC+sKPTIIJ/dZN8GK0LxD0VCP52ueT+2fmxrzE /rOIez8O22z07NE2jdGxzetVQ5P1XQ==; Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Mar 2017 04:13:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,172,1486454400"; d="scan'208";a="944976334" Received: from vmmmba-s2600wft.bj.intel.com ([10.240.193.63]) by orsmga003.jf.intel.com with ESMTP; 16 Mar 2017 04:13:40 -0700 From: Yi Sun To: xen-devel@lists.xenproject.org Date: Thu, 16 Mar 2017 19:07:54 +0800 Message-Id: <1489662495-5375-5-git-send-email-yi.y.sun@linux.intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1489662495-5375-1-git-send-email-yi.y.sun@linux.intel.com> References: <1489662495-5375-1-git-send-email-yi.y.sun@linux.intel.com> Cc: kevin.tian@intel.com, wei.liu2@citrix.com, andrew.cooper3@citrix.com, dario.faggioli@citrix.com, he.chen@linux.intel.com, ian.jackson@eu.citrix.com, Yi Sun , mengxu@cis.upenn.edu, jbeulich@suse.com, chao.p.peng@linux.intel.com, roger.pau@citrix.com Subject: [Xen-devel] [PATCH v9 04/25] x86: move cpuid_count_leaf from cpuid.c to processor.h. X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP This patch moves 'cpuid_count_leaf' from cpuid.c to processor.h to make it available to external codes. Signed-off-by: Yi Sun Acked-by: Jan Beulich --- v9: - create this patch alone to move 'cpuid_count_leaf'. (suggested by Wei Liu) v6: - use 'struct cpuid_leaf' in psr.c. So we have to access 'cpuid_count_leaf' which has to be moved to processor.h. (suggested by Andrew Cooper) --- xen/arch/x86/cpuid.c | 6 ------ xen/include/asm-x86/processor.h | 7 +++++++ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c index d6f6b88..13a28ca 100644 --- a/xen/arch/x86/cpuid.c +++ b/xen/arch/x86/cpuid.c @@ -35,12 +35,6 @@ static void cpuid_leaf(uint32_t leaf, struct cpuid_leaf *data) cpuid(leaf, &data->a, &data->b, &data->c, &data->d); } -static void cpuid_count_leaf(uint32_t leaf, uint32_t subleaf, - struct cpuid_leaf *data) -{ - cpuid_count(leaf, subleaf, &data->a, &data->b, &data->c, &data->d); -} - static void sanitise_featureset(uint32_t *fs) { /* for_each_set_bit() uses unsigned longs. Extend with zeroes. */ diff --git a/xen/include/asm-x86/processor.h b/xen/include/asm-x86/processor.h index dda8b83..2588a1b 100644 --- a/xen/include/asm-x86/processor.h +++ b/xen/include/asm-x86/processor.h @@ -13,6 +13,7 @@ #include #include #include +#include #endif #include @@ -261,6 +262,12 @@ static always_inline unsigned int cpuid_count_ebx( return ebx; } +static always_inline void cpuid_count_leaf(uint32_t leaf, uint32_t subleaf, + struct cpuid_leaf *data) +{ + cpuid_count(leaf, subleaf, &data->a, &data->b, &data->c, &data->d); +} + static inline unsigned long read_cr0(void) { unsigned long cr0;