From patchwork Thu Mar 16 11:08:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yi Sun X-Patchwork-Id: 9627863 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 680ED6048C for ; Thu, 16 Mar 2017 11:16:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 60E4E28573 for ; Thu, 16 Mar 2017 11:16:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 559732857D; Thu, 16 Mar 2017 11:16:03 +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 7161A285A1 for ; Thu, 16 Mar 2017 11:16:00 +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 1coTMO-0004j3-SS; Thu, 16 Mar 2017 11:14:24 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1coTMM-0004h1-Ud for xen-devel@lists.xenproject.org; Thu, 16 Mar 2017 11:14:23 +0000 Received: from [85.158.137.68] by server-6.bemta-3.messagelabs.com id 2C/3D-08534-E837AC85; Thu, 16 Mar 2017 11:14:22 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrNLMWRWlGSWpSXmKPExsVywNwkVre3+FS EwZ6Puhbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8bmWcIFa7grbsy+y9zA+J6ji5GLg0XgFpPE 32PHWEAcIYFpjBILTxxm72Lk5JAQ4JU4smwGK4TtLzHt0QpWiKIGRomLx5YwgSTYBNQlHn/tA bNFBJQk7q2azARSxCywk0li3envzCAJYQFviZmbrwNN5QDapyrxojkQJMwr4CExc+NyNogFch Inj00GW8YJFP/Y3g5mCwm4S7zb8Jd9AiPfAkaGVYwaxalFZalFuoYmeklFmekZJbmJmTm6hgb GermpxcWJ6ak5iUnFesn5uZsYgYHCAAQ7GFds9zzEKMnBpCTKW/7jRIQQX1J+SmVGYnFGfFFp TmrxIUYZDg4lCd4jSicjhASLUtNTK9Iyc4AhC5OW4OBREuHNBUnzFhck5hZnpkOkTjEqSonzX gBJCIAkMkrz4NpgcXKJUVZKmJcR6BAhnoLUotzMElT5V4ziHIxKwrybQabwZOaVwE1/BbSYCW jx2w8nQBaXJCKkpBoYZUrzpk27+fx91ppXTrPeXOsqDDToKOXzeSlmEv7zcrRTdEDtx2bb0ym +j5YqHn76/HpzQ3r6ri0Wv1fJfp6+MrHG+DpfD0N7oPuj7evWnk2aeru/f8amBxOitkdys+vO 5Fog6mB34+Ts5MvbthcY1Mzufi8fuK/tSdOxlZP2a2U5LlaLnrxUQ4mlOCPRUIu5qDgRANt7r fqOAgAA X-Env-Sender: yi.y.sun@linux.intel.com X-Msg-Ref: server-2.tower-31.messagelabs.com!1489662818!78881615!15 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 11578 invoked from network); 16 Mar 2017 11:14:21 -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:14:21 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1489662861; x=1521198861; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=VLtCyaZowxtcmv3iJs8jNH/EkIYyUlwL1XIo9lGqo1k=; b=dDKeSvF/LdGhq+6YhaaeEzZu6gdEP93AaAPAvmsJxsjs+DcF1cn2Obdt YmDd6hhlEfhIMNUaxxIV/ymCyR5mrA==; 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:14:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,172,1486454400"; d="scan'208";a="944976646" Received: from vmmmba-s2600wft.bj.intel.com ([10.240.193.63]) by orsmga003.jf.intel.com with ESMTP; 16 Mar 2017 04:14:18 -0700 From: Yi Sun To: xen-devel@lists.xenproject.org Date: Thu, 16 Mar 2017 19:08:06 +0800 Message-Id: <1489662495-5375-17-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 16/25] x86: refactor psr: CDP: implement get value flow. 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 --- v9: - modify the type of 'l3_cdp_get_val' to 'void'. - cos checking has been done in common function so remove related codes in CDP callback function. (suggested by Jan Beulich) - changes about 'uint64_t' to 'uint32_t'. (suggested by Jan Beulich) v5: - remove type check in callback function. (suggested by Jan Beulich) v4: - create this patch to make codes easier to understand. (suggested by Jan Beulich) --- xen/arch/x86/psr.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/xen/arch/x86/psr.c b/xen/arch/x86/psr.c index ba5c7a4..0ce8a6b 100644 --- a/xen/arch/x86/psr.c +++ b/xen/arch/x86/psr.c @@ -521,9 +521,19 @@ static bool l3_cdp_get_feat_info(const struct feat_node *feat, return true; } +static void l3_cdp_get_val(const struct feat_node *feat, unsigned int cos, + enum cbm_type type, uint32_t *val) +{ + if ( type == PSR_CBM_TYPE_L3_DATA ) + *val = get_cdp_data(feat, cos); + else + *val = get_cdp_code(feat, cos); +} + struct feat_ops l3_cdp_ops = { .get_cos_max = cat_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,