From patchwork Tue Jan 10 07:42:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yi Sun X-Patchwork-Id: 9506645 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 BEBDB606E1 for ; Tue, 10 Jan 2017 07:45:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B2C1B28156 for ; Tue, 10 Jan 2017 07:45:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A75F528485; Tue, 10 Jan 2017 07:45:54 +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 6227328156 for ; Tue, 10 Jan 2017 07:45:54 +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 1cQr5y-00045V-ES; Tue, 10 Jan 2017 07:43:50 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cQr5w-000430-RF for xen-devel@lists.xenproject.org; Tue, 10 Jan 2017 07:43:48 +0000 Received: from [85.158.137.68] by server-13.bemta-3.messagelabs.com id 9D/F6-25657-4B094785; Tue, 10 Jan 2017 07:43:48 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrPLMWRWlGSWpSXmKPExsVywNykWHfzhJI Ig/4Hchbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8bO/YfZCq4LVux73cnWwLiDt4uRk0NIoFLi 1r1LjCC2hACvxJFlM1ghbH+Jec8msXcxcgHVNDBK3LozDayITUBd4vHXHiYQW0RASeLeqslMI EXMAvsZJeYfP84MkhAWsJa4NGMWC4jNIqAqce7mfLBmXgF3idk/HjBBbJCTOHlsMtg2TgEPiZ ar6xghLnKXaH57n3ECI+8CRoZVjBrFqUVlqUW6xgZ6SUWZ6RkluYmZObqGBsZ6uanFxYnpqTm JScV6yfm5mxiBAVHPwMC4g7HzhN8hRkkOJiVR3hTdkgghvqT8lMqMxOKM+KLSnNTiQ4wyHBxK ErxV/UA5waLU9NSKtMwcYGjCpCU4eJREeFlA0rzFBYm5xZnpEKlTjIpS4ryBIAkBkERGaR5cG yweLjHKSgnzMjIwMAjxFKQW5WaWoMq/YhTnYFQS5nUFmcKTmVcCN/0V0GImoMWRdsUgi0sSEV JSDYxNJUEea//7PF2rf/LiDN2F/pft2WMeXf1QtKK1m8+Az15QxTly3rLeCUqG3uLzdLSZZy2 SfCk+bWfA6d+yVcsyikJEdpzveh14rTxydYGAMUu/yaSpTkf3xtixnLlQ9dVX7ISmSkZm4sI1 c7IeHuA9/rOS1Z778mm3iAds38J3MalGlNUqiyuxFGckGmoxFxUnAgCaFUgWggIAAA== X-Env-Sender: yi.y.sun@linux.intel.com X-Msg-Ref: server-12.tower-31.messagelabs.com!1484034224!62972679!1 X-Originating-IP: [192.55.52.115] 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 32316 invoked from network); 10 Jan 2017 07:43:47 -0000 Received: from mga14.intel.com (HELO mga14.intel.com) (192.55.52.115) by server-12.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 10 Jan 2017 07:43:47 -0000 Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP; 09 Jan 2017 23:43:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,343,1477983600"; d="scan'208";a="211583108" Received: from vmmmba-s2600wft.bj.intel.com ([10.240.193.63]) by fmsmga004.fm.intel.com with ESMTP; 09 Jan 2017 23:43:35 -0800 From: Yi Sun To: xen-devel@lists.xenproject.org Date: Tue, 10 Jan 2017 15:42:27 +0800 Message-Id: <1484034155-4521-9-git-send-email-yi.y.sun@linux.intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1484034155-4521-1-git-send-email-yi.y.sun@linux.intel.com> References: <1484034155-4521-1-git-send-email-yi.y.sun@linux.intel.com> Cc: wei.liu2@citrix.com, he.chen@linux.intel.com, andrew.cooper3@citrix.com, ian.jackson@eu.citrix.com, Yi Sun , jbeulich@suse.com, chao.p.peng@linux.intel.com Subject: [Xen-devel] [RFC 08/16] x86: implement get value flow for MBA. 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 get value callback function and domctl interface for MBA. Signed-off-by: Yi Sun --- xen/arch/x86/domctl.c | 7 +++++++ xen/arch/x86/psr.c | 15 +++++++++++++++ xen/include/public/domctl.h | 1 + 3 files changed, 23 insertions(+) diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c index 1f83ab2..6145cf4 100644 --- a/xen/arch/x86/domctl.c +++ b/xen/arch/x86/domctl.c @@ -1421,6 +1421,13 @@ long arch_do_domctl( copyback = 1; break; + case XEN_DOMCTL_PSR_MBA_OP_GET_THRTL: + ret = psr_get_val(d, domctl->u.psr_alloc_op.target, + &domctl->u.psr_alloc_op.data, + PSR_VAL_TYPE_MBA); + copyback = 1; + break; + default: ret = -EOPNOTSUPP; break; diff --git a/xen/arch/x86/psr.c b/xen/arch/x86/psr.c index 52452a7..fd95a6d 100644 --- a/xen/arch/x86/psr.c +++ b/xen/arch/x86/psr.c @@ -998,10 +998,25 @@ static bool mba_get_feat_info(const struct feat_node *feat, return true; } +static bool mba_get_val(const struct feat_node *feat, unsigned int cos, + enum psr_val_type type, uint64_t *val) +{ + if ( type != PSR_VAL_TYPE_MBA ) + return false; + + if ( cos > feat->info.mba_info.cos_max ) + cos = 0; + + *val = feat->cos_reg_val[cos]; + + return true; +} + struct feat_ops mba_ops = { .init_feature = mba_init_feature, .get_max_cos_max = mba_get_max_cos_max, .get_feat_info = mba_get_feat_info, + .get_val = mba_get_val, }; static void __init parse_psr_bool(char *s, char *value, char *feature, diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h index f5b1466..2de7214 100644 --- a/xen/include/public/domctl.h +++ b/xen/include/public/domctl.h @@ -1140,6 +1140,7 @@ struct xen_domctl_psr_alloc_op { #define XEN_DOMCTL_PSR_CAT_OP_GET_L3_DATA 5 #define XEN_DOMCTL_PSR_CAT_OP_SET_L2_CBM 6 #define XEN_DOMCTL_PSR_CAT_OP_GET_L2_CBM 7 +#define XEN_DOMCTL_PSR_MBA_OP_GET_THRTL 9 uint32_t cmd; /* IN: XEN_DOMCTL_PSR_*_OP_* */ uint32_t target; /* IN */ uint64_t data; /* IN/OUT */