From patchwork Wed Jun 14 01:12:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yi Sun X-Patchwork-Id: 9785119 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 BC5CD6038E for ; Wed, 14 Jun 2017 01:27:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AF13926E75 for ; Wed, 14 Jun 2017 01:27:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A3F9628472; Wed, 14 Jun 2017 01:27:47 +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.2 required=2.0 tests=BAYES_00, 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 AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4752426E75 for ; Wed, 14 Jun 2017 01:27:47 +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 1dKx3f-0007E3-E3; Wed, 14 Jun 2017 01:25:19 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dKx3e-0007Dq-Od for xen-devel@lists.xenproject.org; Wed, 14 Jun 2017 01:25:18 +0000 Received: from [85.158.139.211] by server-3.bemta-5.messagelabs.com id 54/5D-02022-E7090495; Wed, 14 Jun 2017 01:25:18 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrPLMWRWlGSWpSXmKPExsVywNykWLd2gkO kwaqPShbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8a6pc4Fy/krprQdZWtg3M7TxcjFISQwjVHi ctt3ti5GTg4JAV6JI8tmsELYfhKr+o6wQhQ1MEo8XrmFHSTBJqAu8fhrDxOILSKgJHFv1WQmk CJmgZ1MEutOf2cGSQgLBEk8fNgLNpVFQFXiz94XYFN5BTwkzixfyQSxQU7i5LHJYHFOAU+J7t fPwOJCQDU/r0xlmsDIu4CRYRWjRnFqUVlqka6RoV5SUWZ6RkluYmaOrqGBqV5uanFxYnpqTmJ SsV5yfu4mRmBA1DMwMO5gvDvZ7xCjJAeTkijvEjuHSCG+pPyUyozE4oz4otKc1OJDjDIcHEoS vG/6gHKCRanpqRVpmTnA0IRJS3DwKInw1rYBpXmLCxJzizPTIVKnGBWlxHlPgfQJgCQySvPg2 mDxcIlRVkqYl5GBgUGIpyC1KDezBFX+FaM4B6OSMO/xfqApPJl5JXDTXwEtZgJafP2KDcjikk SElFQDo0q9+K4TuoGX6z8HaE5zD570KdFyIrva3B/2fhPziifn3udeKxd7rPCAsZN4+9vka5N jnmfXezmxT0rLsXh4lyflycTuKTM0VSQOP6y/Y+/6IHHj6lbVk1Jc+UfefZgRJhm58XCL34kF XQctZ+bM4+xhXKQWNeHs3lvBW6MFymRdOAvnlylUKrEUZyQaajEXFScCAF4z0liCAgAA X-Env-Sender: yi.y.sun@linux.intel.com X-Msg-Ref: server-16.tower-206.messagelabs.com!1497403511!87398197!3 X-Originating-IP: [192.55.52.115] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.19; banners=-,-,- X-VirusChecked: Checked Received: (qmail 47460 invoked from network); 14 Jun 2017 01:25:17 -0000 Received: from mga14.intel.com (HELO mga14.intel.com) (192.55.52.115) by server-16.tower-206.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 14 Jun 2017 01:25:17 -0000 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Jun 2017 18:25:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,340,1493708400"; d="scan'208";a="99173764" Received: from vmmmba-s2600wft.bj.intel.com ([10.240.193.64]) by orsmga002.jf.intel.com with ESMTP; 13 Jun 2017 18:25:13 -0700 From: Yi Sun To: xen-devel@lists.xenproject.org Date: Wed, 14 Jun 2017 09:12:35 +0800 Message-Id: <1497402776-22348-3-git-send-email-yi.y.sun@linux.intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1497402776-22348-1-git-send-email-yi.y.sun@linux.intel.com> References: <1497402776-22348-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 v12 02/23] 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 1c6a6c6..a4a0c4c 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 75632d9..9283fe6 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 @@ -264,6 +265,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;