From patchwork Thu Mar 16 11:08:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yi Sun X-Patchwork-Id: 9627857 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 C174E6048C for ; Thu, 16 Mar 2017 11:16:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B96F428573 for ; Thu, 16 Mar 2017 11:16:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ADA7D28644; Thu, 16 Mar 2017 11:16:01 +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 1C9FE28573 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 1coTMb-0004zj-1d; Thu, 16 Mar 2017 11:14: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 1coTMZ-0004wm-5d for xen-devel@lists.xenproject.org; Thu, 16 Mar 2017 11:14:35 +0000 Received: from [85.158.137.68] by server-8.bemta-3.messagelabs.com id 48/52-00609-A937AC85; Thu, 16 Mar 2017 11:14:34 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrLLMWRWlGSWpSXmKPExsVywNwkVndm8ak Igw3fLSy+b5nM5MDocfjDFZYAxijWzLyk/IoE1owjXVtYC/YIVhy8+p21gXENbxcjFweLwC0m iZ+f/7ODOEIC0xglvh9/zdLFyMkhIcArcWTZDFYI21+ip28PG0RRA6PE2Q/LwRJsAuoSj7/2M IHYIgJKEvdWTWYCKWIW2Mkkse70d2aQhLCAg8TiA0fBbBYBVYmGCyvBNvAKeEhc6V0JtUFO4u SxyWA2J1D8Y3s7mC0k4C7xbsNf9gmMfAsYGVYxahSnFpWlFukamuglFWWmZ5TkJmbm6BoaGOv lphYXJ6an5iQmFesl5+duYgQGCwMQ7GBcsd3zEKMkB5OSKG/5jxMRQnxJ+SmVGYnFGfFFpTmp xYcYZTg4lCR4jyidjBASLEpNT61Iy8wBhi1MWoKDR0mENxckzVtckJhbnJkOkTrFqCglznsBJ CEAksgozYNrg8XKJUZZKWFeRqBDhHgKUotyM0tQ5V8xinMwKgnzbgaZwpOZVwI3/RXQYiagxW 8/nABZXJKIkJJqYGwR83maZSE7vV5ZQPr9jq0eHH5zLgVZvwhNnfm1PenZlQCBNfqPtJYGlz1 vctwd8Ntow72z3wxuGn5LFO2NvHqnaUrz4brdJgzn/x82z76epFLk+o3v/4cvB55zMbMHHrod Hy5/tqHinrPINTbjxCOFWooKz0Rm7bQKd1JunxK1jf/j15mpJ5RYijMSDbWYi4oTAbito4qQA gAA X-Env-Sender: yi.y.sun@linux.intel.com X-Msg-Ref: server-2.tower-31.messagelabs.com!1489662818!78881615!19 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 14184 invoked from network); 16 Mar 2017 11:14:33 -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:33 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1489662873; x=1521198873; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=rH/UNzUzuKBGAmtmDo8koLD1A5QbCakTuMwH/LBNy2A=; b=i6fYg62ELOapSM8dTzEV1V4OnGXz+OB+Xn0RE6rkqNYysCFSQFcB9dlQ Ix1j9pt2bErmldqzubBgNncS1H8k1Q==; 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:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,172,1486454400"; d="scan'208";a="944976760" Received: from vmmmba-s2600wft.bj.intel.com ([10.240.193.63]) by orsmga003.jf.intel.com with ESMTP; 16 Mar 2017 04:14:29 -0700 From: Yi Sun To: xen-devel@lists.xenproject.org Date: Thu, 16 Mar 2017 19:08:10 +0800 Message-Id: <1489662495-5375-21-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 20/25] x86: L2 CAT: 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 L2 CAT get value callback function and interface in domctl. Signed-off-by: Yi Sun --- v9: - reuse 'cat_get_val' for L2 CAT to reduce redundant codes (suggested by Roger Pau) - 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 because of codes architecture change. (suggested by Jan Beulich) --- xen/arch/x86/domctl.c | 8 ++++++++ xen/arch/x86/psr.c | 1 + xen/include/public/domctl.h | 1 + 3 files changed, 10 insertions(+) diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c index 76923c8..7f55cfd 100644 --- a/xen/arch/x86/domctl.c +++ b/xen/arch/x86/domctl.c @@ -1478,6 +1478,14 @@ long arch_do_domctl( copyback = 1; break; + case XEN_DOMCTL_PSR_CAT_OP_GET_L2_CBM: + domctl->u.psr_cat_op.data = 0; + ret = psr_get_val(d, domctl->u.psr_cat_op.target, + (uint32_t *)&domctl->u.psr_cat_op.data, + PSR_CBM_TYPE_L2); + copyback = 1; + break; + default: ret = -EOPNOTSUPP; break; diff --git a/xen/arch/x86/psr.c b/xen/arch/x86/psr.c index 39f249e..4cbcbe0 100644 --- a/xen/arch/x86/psr.c +++ b/xen/arch/x86/psr.c @@ -639,6 +639,7 @@ struct feat_ops l3_cdp_ops = { struct feat_ops l2_cat_ops = { .get_cos_max = cat_get_cos_max, .get_feat_info = cat_get_feat_info, + .get_val = cat_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 85cbb7c..8c183ba 100644 --- a/xen/include/public/domctl.h +++ b/xen/include/public/domctl.h @@ -1138,6 +1138,7 @@ struct xen_domctl_psr_cat_op { #define XEN_DOMCTL_PSR_CAT_OP_SET_L3_DATA 3 #define XEN_DOMCTL_PSR_CAT_OP_GET_L3_CODE 4 #define XEN_DOMCTL_PSR_CAT_OP_GET_L3_DATA 5 +#define XEN_DOMCTL_PSR_CAT_OP_GET_L2_CBM 7 uint32_t cmd; /* IN: XEN_DOMCTL_PSR_CAT_OP_* */ uint32_t target; /* IN */ uint64_t data; /* IN/OUT */