From patchwork Wed Jan 18 02:02:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yi Sun X-Patchwork-Id: 9522439 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 3C7F96043D for ; Wed, 18 Jan 2017 02:06:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2C0F72094F for ; Wed, 18 Jan 2017 02:06:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1E75528554; Wed, 18 Jan 2017 02:06:09 +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 B24392094F for ; Wed, 18 Jan 2017 02:06:08 +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 1cTfc5-0005xq-Rl; Wed, 18 Jan 2017 02:04:37 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cTfc4-0005us-RQ for xen-devel@lists.xenproject.org; Wed, 18 Jan 2017 02:04:36 +0000 Received: from [85.158.137.68] by server-16.bemta-3.messagelabs.com id 5A/DD-03637-43DCE785; Wed, 18 Jan 2017 02:04:36 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrLLMWRWlGSWpSXmKPExsVywNykQtf4bF2 EwdqN6hbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8a1f5oFjzkq3m+bydzA+Imti5GTQ0igUuLe p53MILaEAK/EkWUzWCFsP4m+KY+gahoYJV5d4gKx2QTUJR5/7WECsUUElCTurZoMZHNxMAt0M 0msfLiVBSQhDNQ8e/NsdhCbRUBV4uzvx2ALeAU8JLas/8YOsUBO4uSxyWDLOIHivedns0Isc5 e4dHot2wRG3gWMDKsYNYpTi8pSi3SNjPSSijLTM0pyEzNzdA0NjPVyU4uLE9NTcxKTivWS83M 3MQKDoZ6BgXEH49QTfocYJTmYlER5Ox7XRgjxJeWnVGYkFmfEF5XmpBYfYpTh4FCS4L13ui5C SLAoNT21Ii0zBxiWMGkJDh4lEd4LIGne4oLE3OLMdIjUKUZFKXHeYyAJAZBERmkeXBssFi4xy koJ8zIyMDAI8RSkFuVmlqDKv2IU52BUEuaVPAM0hSczrwRu+iugxUxAi6/rVIMsLklESEk1MD JwJPden5j16M2RI2ksdfl/Ixad+n+vO+Cten+/2RT9SDaT5c7fghnu2uvtUU6cYvqp4i5/199 M6YWF/aZ57wq/Hnt6LvzMqqo3BVM+7JHZupjNIPITnwyLO4vI8ZnCjhb/BaSnvuvo/LTjO9uq VfmPkk7PSgyTnlMrVFtu6LbA7tkxl5i3E5VYijMSDbWYi4oTAQJvaYGAAgAA X-Env-Sender: yi.y.sun@linux.intel.com X-Msg-Ref: server-8.tower-31.messagelabs.com!1484705037!81141171!16 X-Originating-IP: [192.55.52.120] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.1.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 16250 invoked from network); 18 Jan 2017 02:04:35 -0000 Received: from mga04.intel.com (HELO mga04.intel.com) (192.55.52.120) by server-8.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 18 Jan 2017 02:04:35 -0000 Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP; 17 Jan 2017 18:04:34 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,247,1477983600"; d="scan'208";a="54503395" Received: from vmmmba-s2600wft.bj.intel.com ([10.240.193.63]) by fmsmga005.fm.intel.com with ESMTP; 17 Jan 2017 18:04:32 -0800 From: Yi Sun To: xen-devel@lists.xenproject.org Date: Wed, 18 Jan 2017 10:02:38 +0800 Message-Id: <1484704967-5609-16-git-send-email-yi.y.sun@linux.intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1484704967-5609-1-git-send-email-yi.y.sun@linux.intel.com> References: <1484704967-5609-1-git-send-email-yi.y.sun@linux.intel.com> Cc: wei.liu2@citrix.com, konrad.wilk@oracle.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 Subject: [Xen-devel] [PATCH v5 15/24] x86: refactor psr: implement get value flow for CDP. 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 implements L3 CDP get value callback function. With this patch, 'psr-cat-show' can work for L3 CDP. Signed-off-by: Yi Sun --- xen/arch/x86/psr.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/xen/arch/x86/psr.c b/xen/arch/x86/psr.c index b856761..dc062ff 100644 --- a/xen/arch/x86/psr.c +++ b/xen/arch/x86/psr.c @@ -533,9 +533,25 @@ static bool l3_cdp_get_feat_info(const struct feat_node *feat, return true; } +static bool l3_cdp_get_val(const struct feat_node *feat, unsigned int cos, + enum cbm_type type, uint64_t *val) +{ + if ( cos > feat->info.l3_cdp_info.cos_max ) + /* Use default value. */ + cos = 0; + + if ( type == PSR_CBM_TYPE_L3_DATA ) + *val = get_cdp_data(feat, cos); + else + *val = get_cdp_code(feat, cos); + + return true; +} + struct feat_ops l3_cdp_ops = { .get_cos_max = l3_cdp_get_cos_max, .get_feat_info = l3_cdp_get_feat_info, + .get_val = l3_cdp_get_val, }; static void __init parse_psr_bool(char *s, char *value, char *feature,