From patchwork Sat Apr 1 13:53:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yi Sun X-Patchwork-Id: 9657949 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 F2F0460349 for ; Sat, 1 Apr 2017 13:56:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E9D3C285C2 for ; Sat, 1 Apr 2017 13:56:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DE77028610; Sat, 1 Apr 2017 13:56:08 +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 70CF5285C2 for ; Sat, 1 Apr 2017 13:56: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 1cuJUD-0006LD-2k; Sat, 01 Apr 2017 13:54: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 1cuJUB-0006IJ-53 for xen-devel@lists.xenproject.org; Sat, 01 Apr 2017 13:54:35 +0000 Received: from [85.158.137.68] by server-4.bemta-3.messagelabs.com id 4A/78-03705-A11BFD85; Sat, 01 Apr 2017 13:54:34 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrDLMWRWlGSWpSXmKPExsXS1tYhoiu58X6 Ewcep5hbft0xmcmD0OPzhCksAYxRrZl5SfkUCa0ZH3x3mggeCFbsnHGFvYNzL28XIxcEicItJ 4tfmVWwgjpDANEaJ+ws3MncxcnJICPBKHFk2gxXC9pe4smE7G4gtJFAv8aX9KpjNJqAu8fhrD xOILSKgJHFv1WQmkEHMAjuZJNad/g42SFjAUeLI4kXsIDaLgKrEu+cnGEFsXgFPid97zjFCLJ CTOHlsMtgyTqD4lRf7WCCWeUismnSJeQIj3wJGhlWMGsWpRWWpRbqGFnpJRZnpGSW5iZk5uoY Gxnq5qcXFiempOYlJxXrJ+bmbGIGhUs/AwLiD8fdpz0OMkhxMSqK834vvRQjxJeWnVGYkFmfE F5XmpBYfYpTh4FCS4FXYcD9CSLAoNT21Ii0zBxi0MGkJDh4lEd5j64HSvMUFibnFmekQqVOMi lLivKkgfQIgiYzSPLg2WKRcYpSVEuZlZGBgEOIpSC3KzSxBlX/FKM7BqCTMKw8yniczrwRu+i ugxUxAiy2+3gVZXJKIkJJqYLTMe6YR6z79XLzmk3SmwCPXyjX8N5VyzWg927qhzHduX2qRz6a KN5PLTwc5efyYsthUZxPj9gw554tuxRcNQ5ms9OuLOyc3edzuVa7YfVncI7dw47Q7WrZFQt2b 9G+Zf5xya2bbtdkrd8/Yun6dVPrvxlneRy68n+39X08166TSvP96Ox2NrJRYijMSDbWYi4oTA a+VHkePAgAA X-Env-Sender: yi.y.sun@linux.intel.com X-Msg-Ref: server-9.tower-31.messagelabs.com!1491054811!37933881!21 X-Originating-IP: [134.134.136.20] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTM0LjEzNC4xMzYuMjAgPT4gMzU1MzU4\n X-StarScan-Received: X-StarScan-Version: 9.2.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 56432 invoked from network); 1 Apr 2017 13:54:33 -0000 Received: from mga02.intel.com (HELO mga02.intel.com) (134.134.136.20) by server-9.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 1 Apr 2017 13:54:33 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1491054873; x=1522590873; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=hHZb2KpWkVLEhbLbwVfDKULiRH/u52Jhom2qiqljS2k=; b=N3Ib1D4H19qkeCVXBj/Fd3/2v+OSNpa5REYTq5zlHvERCLPNdRDSjl6A 9IYsOS+MZmpz6QPnc0n2vWhXL/TXnQ==; Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Apr 2017 06:54:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,258,1486454400"; d="scan'208";a="950545404" Received: from yisun1-ubuntu.bj.intel.com ([10.238.156.112]) by orsmga003.jf.intel.com with ESMTP; 01 Apr 2017 06:54:30 -0700 From: Yi Sun To: xen-devel@lists.xenproject.org Date: Sat, 1 Apr 2017 21:53:51 +0800 Message-Id: <1491054836-30488-21-git-send-email-yi.y.sun@linux.intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1491054836-30488-1-git-send-email-yi.y.sun@linux.intel.com> References: <1491054836-30488-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 v10 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 flow and interface in domctl. Signed-off-by: Yi Sun --- v10: - remove cast in domctl. (suggested by Jan Beulich) 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 | 11 +++++++++++ xen/arch/x86/psr.c | 1 + xen/include/public/domctl.h | 1 + 3 files changed, 13 insertions(+) diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c index 6ed71e2..59d472c 100644 --- a/xen/arch/x86/domctl.c +++ b/xen/arch/x86/domctl.c @@ -1499,6 +1499,17 @@ long arch_do_domctl( break; } + case XEN_DOMCTL_PSR_CAT_OP_GET_L2_CBM: + { + uint32_t val; + + ret = psr_get_val(d, domctl->u.psr_cat_op.target, + &val, PSR_CBM_TYPE_L2); + domctl->u.psr_cat_op.data = val; + copyback = 1; + break; + } + default: ret = -EOPNOTSUPP; break; diff --git a/xen/arch/x86/psr.c b/xen/arch/x86/psr.c index 8114bed..426d725 100644 --- a/xen/arch/x86/psr.c +++ b/xen/arch/x86/psr.c @@ -470,6 +470,7 @@ static struct feat_props l3_cdp_props = { static struct feat_props l2_cat_props = { .cos_num = 1, .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 */