From patchwork Tue Oct 24 09:10:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yi Sun X-Patchwork-Id: 10023855 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 51BD560381 for ; Tue, 24 Oct 2017 09:35:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 49E66289BA for ; Tue, 24 Oct 2017 09:35:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3E7F0289D8; Tue, 24 Oct 2017 09:35:23 +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 08B59289BA for ; Tue, 24 Oct 2017 09:35:22 +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 1e6vZm-0007cq-Ex; Tue, 24 Oct 2017 09:32:46 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e6vZk-0007bx-E6 for xen-devel@lists.xenproject.org; Tue, 24 Oct 2017 09:32:44 +0000 Received: from [85.158.139.211] by server-11.bemta-5.messagelabs.com id 0E/E5-17628-BB80FE95; Tue, 24 Oct 2017 09:32:43 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrPIsWRWlGSWpSXmKPExsXS1tYhobuL432 kQdsPM4vvWyYzOTB6HP5whSWAMYo1My8pvyKBNWPKogWMBSeWMFZM65/C2sC4r6yLkYtDSGA6 o8Tn7/9Zuxg5OSQEeCWOLJsBZftL/L9zjx2iqIFR4mTvJhaQBJuAusTjrz1MILaIgJLEvVWTm UCKmAXOM0l83HoPLCEskCZx5/4DNhCbRUBVYtnsI2BxXgEPib9T/rNAbJCTOHlsMtg2TqD4kX 8zGUFsIQF3iVv7VrJB1AtKnJz5BKieA2iBusT6eUIgYWYBeYnmrbOZJzAKzEJSNQuhahaSqgW MzKsYNYpTi8pSi3QNzfWSijLTM0pyEzNzdA0NTPVyU4uLE9NTcxKTivWS83M3MQIDlAEIdjBe PO15iFGSg0lJlPff+3eRQnxJ+SmVGYnFGfFFpTmpxYcYZTg4lCR4OYABLyRYlJqeWpGWmQOMF Zi0BAePkghvADtQmre4IDG3ODMdInWK0ZLj2KbLf5g4Om7eBZLPZr5uYBZiycvPS5US5xUFmS cA0pBRmgc3DhbPlxhlpYR5GYEOFOIpSC3KzSxBlX/FKM7BqCTM+xxkLU9mXgnc1ldABzEBHSR r/wbkoJJEhJRUA6Od1YZ7v+oVtwd/YfM7VrJEt46J4/6NFheV48U/YrfcP8PwY/t1lj8KfC6H bf+s8nxxKsHp7kaeN19PVyrWbi1/KsT88mWmePxShnvpDxiXvFRde9e5Vd6HX0y41cRK47XD3 wpfIb+trrK/m3QdZ//X2XTO2adtS92at/H1JqISNufEeI7FRCmxFGckGmoxFxUnAgA8Mxq64g IAAA== X-Env-Sender: yi.y.sun@linux.intel.com X-Msg-Ref: server-4.tower-206.messagelabs.com!1508837560!108342177!1 X-Originating-IP: [134.134.136.24] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTM0LjEzNC4xMzYuMjQgPT4gMzkwOTcx\n X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 55153 invoked from network); 24 Oct 2017 09:32:42 -0000 Received: from mga09.intel.com (HELO mga09.intel.com) (134.134.136.24) by server-4.tower-206.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 24 Oct 2017 09:32:42 -0000 Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Oct 2017 02:32:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,427,1503385200"; d="scan'208";a="166337896" Received: from vmmmba-s2600wft.bj.intel.com ([10.240.193.75]) by fmsmga005.fm.intel.com with ESMTP; 24 Oct 2017 02:32:35 -0700 From: Yi Sun To: xen-devel@lists.xenproject.org Date: Tue, 24 Oct 2017 17:10:56 +0800 Message-Id: <1508836256-36922-1-git-send-email-yi.y.sun@linux.intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1508488108-7071-3-git-send-email-yi.y.sun@linux.intel.com> References: <1508488108-7071-3-git-send-email-yi.y.sun@linux.intel.com> MIME-Version: 1.0 Cc: Yi Sun , Andrew Cooper , Ian Jackson , Jan Beulich , Chao Peng , Wei Liu , Daniel De Graaf , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [Xen-devel] [PATCH v9.1 02/16] Rename PSR sysctl/domctl interfaces and xsm policy to make them be general 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: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP This patch renames PSR sysctl/domctl interfaces and related xsm policy to make them be general for all resource allocation features but not only for CAT. Then, we can resuse the interfaces for all allocation features. Basically, it changes 'psr_cat_op' to 'psr_alloc', and remove 'CAT_' from some macros. E.g.: 1. psr_cat_op -> psr_alloc 2. XEN_DOMCTL_psr_cat_op -> XEN_DOMCTL_psr_alloc 3. XEN_SYSCTL_psr_cat_op -> XEN_SYSCTL_psr_alloc 4. XEN_DOMCTL_PSR_CAT_SET_L3_CBM -> XEN_DOMCTL_PSR_SET_L3_CBM 5. XEN_SYSCTL_PSR_CAT_get_l3_info -> XEN_SYSCTL_PSR_get_l3_info Signed-off-by: Yi Sun Reviewed-by: Wei Liu Reviewed-by: Roger Pau Monné Acked-by: Jan Beulich Acked-by: Daniel De Graaf Acked-by: Daniel De Graaf --- CC: Jan Beulich CC: Andrew Cooper CC: Wei Liu CC: Ian Jackson CC: Daniel De Graaf CC: Roger Pau Monné CC: Chao Peng v9: - rename 'psr_cat_op' to 'psr_alloc' in xen.if. v7: - add single trailing underscore for internal variabled in macro. (suggested by Jan Beulich) - add parentheses for input parameters of marcro. (suggested by Jan Beulich) - adjust the postion of macro. (suggested by Jan Beulich) v6: - move macro definition into the function and undefine it after use. (suggested by Roger Pau Monné) - do not bump sysctl version because it has been bumped for 4.10. (suggested by Roger Pau Monné) v5: - remove domctl version number upgrade. (suggested by Jan Beulich) - restore 'XEN_SYSCTL_PSR_CAT_L3_CDP'. (suggested by Jan Beulich) - define a local macro to complete psr get value flow. (suggested by Roger Pau Monné) - remove 'Reviewed-by' and 'Acked-by'. (suggested by Wei Liu) v4: - remove 'ALLOC_' from names. (suggested by Roger Pau Monné) - fix comments. (suggested by Roger Pau Monné) v3: - remove 'op/OP' from names and modify some names from 'PSR_CAT' to 'PSR_ALLOC'. (suggested by Roger Pau Monné) v1: - add description about what to be changed in commit message. (suggested by Wei Liu) - bump sysctl/domctl version numbers. (suggested by Wei Liu) --- tools/flask/policy/modules/dom0.te | 4 +-- tools/flask/policy/modules/xen.if | 2 +- tools/libxc/xc_psr.c | 50 +++++++++++++------------- xen/arch/x86/domctl.c | 71 ++++++++++++++++++------------------- xen/arch/x86/sysctl.c | 28 +++++++-------- xen/include/public/domctl.h | 24 ++++++------- xen/include/public/sysctl.h | 12 +++---- xen/xsm/flask/hooks.c | 8 ++--- xen/xsm/flask/policy/access_vectors | 8 ++--- 9 files changed, 103 insertions(+), 104 deletions(-) diff --git a/tools/flask/policy/modules/dom0.te b/tools/flask/policy/modules/dom0.te index 1643b40..07de3d5 100644 --- a/tools/flask/policy/modules/dom0.te +++ b/tools/flask/policy/modules/dom0.te @@ -14,7 +14,7 @@ allow dom0_t xen_t:xen { tmem_control getscheduler setscheduler }; allow dom0_t xen_t:xen2 { - resource_op psr_cmt_op psr_cat_op pmu_ctrl get_symbol + resource_op psr_cmt_op psr_alloc pmu_ctrl get_symbol get_cpu_levelling_caps get_cpu_featureset livepatch_op gcov_op set_parameter }; @@ -39,7 +39,7 @@ allow dom0_t dom0_t:domain { }; allow dom0_t dom0_t:domain2 { set_cpuid gettsc settsc setscheduler set_max_evtchn set_vnumainfo - get_vnumainfo psr_cmt_op psr_cat_op set_gnttab_limits + get_vnumainfo psr_cmt_op psr_alloc set_gnttab_limits }; allow dom0_t dom0_t:resource { add remove }; diff --git a/tools/flask/policy/modules/xen.if b/tools/flask/policy/modules/xen.if index 5543749..cb48a6c 100644 --- a/tools/flask/policy/modules/xen.if +++ b/tools/flask/policy/modules/xen.if @@ -52,7 +52,7 @@ define(`create_domain_common', ` settime setdomainhandle getvcpucontext set_misc_info }; allow $1 $2:domain2 { set_cpuid settsc setscheduler setclaim set_max_evtchn set_vnumainfo get_vnumainfo cacheflush - psr_cmt_op psr_cat_op soft_reset set_gnttab_limits }; + psr_cmt_op psr_alloc soft_reset set_gnttab_limits }; allow $1 $2:security check_context; allow $1 $2:shadow enable; allow $1 $2:mmu { map_read map_write adjust memorymap physmap pinpage mmuext_op updatemp }; diff --git a/tools/libxc/xc_psr.c b/tools/libxc/xc_psr.c index edec4d1..78deba0 100644 --- a/tools/libxc/xc_psr.c +++ b/tools/libxc/xc_psr.c @@ -258,27 +258,27 @@ int xc_psr_cat_set_domain_data(xc_interface *xch, uint32_t domid, switch ( type ) { case XC_PSR_CAT_L3_CBM: - cmd = XEN_DOMCTL_PSR_CAT_OP_SET_L3_CBM; + cmd = XEN_DOMCTL_PSR_SET_L3_CBM; break; case XC_PSR_CAT_L3_CBM_CODE: - cmd = XEN_DOMCTL_PSR_CAT_OP_SET_L3_CODE; + cmd = XEN_DOMCTL_PSR_SET_L3_CODE; break; case XC_PSR_CAT_L3_CBM_DATA: - cmd = XEN_DOMCTL_PSR_CAT_OP_SET_L3_DATA; + cmd = XEN_DOMCTL_PSR_SET_L3_DATA; break; case XC_PSR_CAT_L2_CBM: - cmd = XEN_DOMCTL_PSR_CAT_OP_SET_L2_CBM; + cmd = XEN_DOMCTL_PSR_SET_L2_CBM; break; default: errno = EINVAL; return -1; } - domctl.cmd = XEN_DOMCTL_psr_cat_op; + domctl.cmd = XEN_DOMCTL_psr_alloc; domctl.domain = domid; - domctl.u.psr_cat_op.cmd = cmd; - domctl.u.psr_cat_op.target = target; - domctl.u.psr_cat_op.data = data; + domctl.u.psr_alloc.cmd = cmd; + domctl.u.psr_alloc.target = target; + domctl.u.psr_alloc.data = data; return do_domctl(xch, &domctl); } @@ -294,31 +294,31 @@ int xc_psr_cat_get_domain_data(xc_interface *xch, uint32_t domid, switch ( type ) { case XC_PSR_CAT_L3_CBM: - cmd = XEN_DOMCTL_PSR_CAT_OP_GET_L3_CBM; + cmd = XEN_DOMCTL_PSR_GET_L3_CBM; break; case XC_PSR_CAT_L3_CBM_CODE: - cmd = XEN_DOMCTL_PSR_CAT_OP_GET_L3_CODE; + cmd = XEN_DOMCTL_PSR_GET_L3_CODE; break; case XC_PSR_CAT_L3_CBM_DATA: - cmd = XEN_DOMCTL_PSR_CAT_OP_GET_L3_DATA; + cmd = XEN_DOMCTL_PSR_GET_L3_DATA; break; case XC_PSR_CAT_L2_CBM: - cmd = XEN_DOMCTL_PSR_CAT_OP_GET_L2_CBM; + cmd = XEN_DOMCTL_PSR_GET_L2_CBM; break; default: errno = EINVAL; return -1; } - domctl.cmd = XEN_DOMCTL_psr_cat_op; + domctl.cmd = XEN_DOMCTL_psr_alloc; domctl.domain = domid; - domctl.u.psr_cat_op.cmd = cmd; - domctl.u.psr_cat_op.target = target; + domctl.u.psr_alloc.cmd = cmd; + domctl.u.psr_alloc.target = target; rc = do_domctl(xch, &domctl); if ( !rc ) - *data = domctl.u.psr_cat_op.data; + *data = domctl.u.psr_alloc.data; return rc; } @@ -329,29 +329,29 @@ int xc_psr_cat_get_info(xc_interface *xch, uint32_t socket, unsigned int lvl, int rc = -1; DECLARE_SYSCTL; - sysctl.cmd = XEN_SYSCTL_psr_cat_op; - sysctl.u.psr_cat_op.target = socket; + sysctl.cmd = XEN_SYSCTL_psr_alloc; + sysctl.u.psr_alloc.target = socket; switch ( lvl ) { case 2: - sysctl.u.psr_cat_op.cmd = XEN_SYSCTL_PSR_CAT_get_l2_info; + sysctl.u.psr_alloc.cmd = XEN_SYSCTL_PSR_get_l2_info; rc = xc_sysctl(xch, &sysctl); if ( !rc ) { - *cos_max = sysctl.u.psr_cat_op.u.cat_info.cos_max; - *cbm_len = sysctl.u.psr_cat_op.u.cat_info.cbm_len; + *cos_max = sysctl.u.psr_alloc.u.cat_info.cos_max; + *cbm_len = sysctl.u.psr_alloc.u.cat_info.cbm_len; *cdp_enabled = false; } break; case 3: - sysctl.u.psr_cat_op.cmd = XEN_SYSCTL_PSR_CAT_get_l3_info; + sysctl.u.psr_alloc.cmd = XEN_SYSCTL_PSR_get_l3_info; rc = xc_sysctl(xch, &sysctl); if ( !rc ) { - *cos_max = sysctl.u.psr_cat_op.u.cat_info.cos_max; - *cbm_len = sysctl.u.psr_cat_op.u.cat_info.cbm_len; - *cdp_enabled = sysctl.u.psr_cat_op.u.cat_info.flags & + *cos_max = sysctl.u.psr_alloc.u.cat_info.cos_max; + *cbm_len = sysctl.u.psr_alloc.u.cat_info.cbm_len; + *cdp_enabled = sysctl.u.psr_alloc.u.cat_info.flags & XEN_SYSCTL_PSR_CAT_L3_CDP; } break; diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c index 80b4df9..64bb79c 100644 --- a/xen/arch/x86/domctl.c +++ b/xen/arch/x86/domctl.c @@ -1438,67 +1438,66 @@ long arch_do_domctl( } break; - case XEN_DOMCTL_psr_cat_op: - switch ( domctl->u.psr_cat_op.cmd ) + case XEN_DOMCTL_psr_alloc: + switch ( domctl->u.psr_alloc.cmd ) { - uint32_t val32; - - case XEN_DOMCTL_PSR_CAT_OP_SET_L3_CBM: - ret = psr_set_val(d, domctl->u.psr_cat_op.target, - domctl->u.psr_cat_op.data, + case XEN_DOMCTL_PSR_SET_L3_CBM: + ret = psr_set_val(d, domctl->u.psr_alloc.target, + domctl->u.psr_alloc.data, PSR_CBM_TYPE_L3); break; - case XEN_DOMCTL_PSR_CAT_OP_SET_L3_CODE: - ret = psr_set_val(d, domctl->u.psr_cat_op.target, - domctl->u.psr_cat_op.data, + case XEN_DOMCTL_PSR_SET_L3_CODE: + ret = psr_set_val(d, domctl->u.psr_alloc.target, + domctl->u.psr_alloc.data, PSR_CBM_TYPE_L3_CODE); break; - case XEN_DOMCTL_PSR_CAT_OP_SET_L3_DATA: - ret = psr_set_val(d, domctl->u.psr_cat_op.target, - domctl->u.psr_cat_op.data, + case XEN_DOMCTL_PSR_SET_L3_DATA: + ret = psr_set_val(d, domctl->u.psr_alloc.target, + domctl->u.psr_alloc.data, PSR_CBM_TYPE_L3_DATA); break; - case XEN_DOMCTL_PSR_CAT_OP_SET_L2_CBM: - ret = psr_set_val(d, domctl->u.psr_cat_op.target, - domctl->u.psr_cat_op.data, + case XEN_DOMCTL_PSR_SET_L2_CBM: + ret = psr_set_val(d, domctl->u.psr_alloc.target, + domctl->u.psr_alloc.data, PSR_CBM_TYPE_L2); break; - case XEN_DOMCTL_PSR_CAT_OP_GET_L3_CBM: - ret = psr_get_val(d, domctl->u.psr_cat_op.target, - &val32, PSR_CBM_TYPE_L3); - domctl->u.psr_cat_op.data = val32; - copyback = true; +#define domctl_psr_get_val(d, domctl, type, copyback) ({ \ + uint32_t v_; \ + int r_ = psr_get_val((d), (domctl)->u.psr_alloc.target, \ + &v_, (type)); \ + \ + (domctl)->u.psr_alloc.data = v_; \ + (copyback) = true; \ + r_; \ +}) + + case XEN_DOMCTL_PSR_GET_L3_CBM: + ret = domctl_psr_get_val(d, domctl, PSR_CBM_TYPE_L3, copyback); break; - case XEN_DOMCTL_PSR_CAT_OP_GET_L3_CODE: - ret = psr_get_val(d, domctl->u.psr_cat_op.target, - &val32, PSR_CBM_TYPE_L3_CODE); - domctl->u.psr_cat_op.data = val32; - copyback = true; + case XEN_DOMCTL_PSR_GET_L3_CODE: + ret = domctl_psr_get_val(d, domctl, PSR_CBM_TYPE_L3_CODE, copyback); break; - case XEN_DOMCTL_PSR_CAT_OP_GET_L3_DATA: - ret = psr_get_val(d, domctl->u.psr_cat_op.target, - &val32, PSR_CBM_TYPE_L3_DATA); - domctl->u.psr_cat_op.data = val32; - copyback = true; + case XEN_DOMCTL_PSR_GET_L3_DATA: + ret = domctl_psr_get_val(d, domctl, PSR_CBM_TYPE_L3_DATA, copyback); break; - case XEN_DOMCTL_PSR_CAT_OP_GET_L2_CBM: - ret = psr_get_val(d, domctl->u.psr_cat_op.target, - &val32, PSR_CBM_TYPE_L2); - domctl->u.psr_cat_op.data = val32; - copyback = true; + case XEN_DOMCTL_PSR_GET_L2_CBM: + ret = domctl_psr_get_val(d, domctl, PSR_CBM_TYPE_L2, copyback); break; +#undef domctl_psr_get_val + default: ret = -EOPNOTSUPP; break; } + break; case XEN_DOMCTL_disable_migrate: diff --git a/xen/arch/x86/sysctl.c b/xen/arch/x86/sysctl.c index 6ba823c..8ae6747 100644 --- a/xen/arch/x86/sysctl.c +++ b/xen/arch/x86/sysctl.c @@ -171,45 +171,45 @@ long arch_do_sysctl( break; - case XEN_SYSCTL_psr_cat_op: - switch ( sysctl->u.psr_cat_op.cmd ) + case XEN_SYSCTL_psr_alloc: + switch ( sysctl->u.psr_alloc.cmd ) { uint32_t data[PSR_INFO_ARRAY_SIZE]; - case XEN_SYSCTL_PSR_CAT_get_l3_info: + case XEN_SYSCTL_PSR_get_l3_info: { - ret = psr_get_info(sysctl->u.psr_cat_op.target, + ret = psr_get_info(sysctl->u.psr_alloc.target, PSR_CBM_TYPE_L3, data, ARRAY_SIZE(data)); if ( ret ) break; - sysctl->u.psr_cat_op.u.cat_info.cos_max = + sysctl->u.psr_alloc.u.cat_info.cos_max = data[PSR_INFO_IDX_COS_MAX]; - sysctl->u.psr_cat_op.u.cat_info.cbm_len = + sysctl->u.psr_alloc.u.cat_info.cbm_len = data[PSR_INFO_IDX_CAT_CBM_LEN]; - sysctl->u.psr_cat_op.u.cat_info.flags = + sysctl->u.psr_alloc.u.cat_info.flags = data[PSR_INFO_IDX_CAT_FLAG]; - if ( __copy_field_to_guest(u_sysctl, sysctl, u.psr_cat_op) ) + if ( __copy_field_to_guest(u_sysctl, sysctl, u.psr_alloc) ) ret = -EFAULT; break; } - case XEN_SYSCTL_PSR_CAT_get_l2_info: + case XEN_SYSCTL_PSR_get_l2_info: { - ret = psr_get_info(sysctl->u.psr_cat_op.target, + ret = psr_get_info(sysctl->u.psr_alloc.target, PSR_CBM_TYPE_L2, data, ARRAY_SIZE(data)); if ( ret ) break; - sysctl->u.psr_cat_op.u.cat_info.cos_max = + sysctl->u.psr_alloc.u.cat_info.cos_max = data[PSR_INFO_IDX_COS_MAX]; - sysctl->u.psr_cat_op.u.cat_info.cbm_len = + sysctl->u.psr_alloc.u.cat_info.cbm_len = data[PSR_INFO_IDX_CAT_CBM_LEN]; - sysctl->u.psr_cat_op.u.cat_info.flags = + sysctl->u.psr_alloc.u.cat_info.flags = data[PSR_INFO_IDX_CAT_FLAG]; - if ( __copy_field_to_guest(u_sysctl, sysctl, u.psr_cat_op) ) + if ( __copy_field_to_guest(u_sysctl, sysctl, u.psr_alloc) ) ret = -EFAULT; break; } diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h index 70027ab..eaff9b3 100644 --- a/xen/include/public/domctl.h +++ b/xen/include/public/domctl.h @@ -1065,16 +1065,16 @@ struct xen_domctl_monitor_op { } u; }; -struct xen_domctl_psr_cat_op { -#define XEN_DOMCTL_PSR_CAT_OP_SET_L3_CBM 0 -#define XEN_DOMCTL_PSR_CAT_OP_GET_L3_CBM 1 -#define XEN_DOMCTL_PSR_CAT_OP_SET_L3_CODE 2 -#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_SET_L2_CBM 6 -#define XEN_DOMCTL_PSR_CAT_OP_GET_L2_CBM 7 - uint32_t cmd; /* IN: XEN_DOMCTL_PSR_CAT_OP_* */ +struct xen_domctl_psr_alloc { +#define XEN_DOMCTL_PSR_SET_L3_CBM 0 +#define XEN_DOMCTL_PSR_GET_L3_CBM 1 +#define XEN_DOMCTL_PSR_SET_L3_CODE 2 +#define XEN_DOMCTL_PSR_SET_L3_DATA 3 +#define XEN_DOMCTL_PSR_GET_L3_CODE 4 +#define XEN_DOMCTL_PSR_GET_L3_DATA 5 +#define XEN_DOMCTL_PSR_SET_L2_CBM 6 +#define XEN_DOMCTL_PSR_GET_L2_CBM 7 + uint32_t cmd; /* IN: XEN_DOMCTL_PSR_* */ uint32_t target; /* IN */ uint64_t data; /* IN/OUT */ }; @@ -1180,7 +1180,7 @@ struct xen_domctl { #define XEN_DOMCTL_setvnumainfo 74 #define XEN_DOMCTL_psr_cmt_op 75 #define XEN_DOMCTL_monitor_op 77 -#define XEN_DOMCTL_psr_cat_op 78 +#define XEN_DOMCTL_psr_alloc 78 #define XEN_DOMCTL_soft_reset 79 #define XEN_DOMCTL_set_gnttab_limits 80 #define XEN_DOMCTL_vuart_op 81 @@ -1245,7 +1245,7 @@ struct xen_domctl { struct xen_domctl_vnuma vnuma; struct xen_domctl_psr_cmt_op psr_cmt_op; struct xen_domctl_monitor_op monitor_op; - struct xen_domctl_psr_cat_op psr_cat_op; + struct xen_domctl_psr_alloc psr_alloc; struct xen_domctl_set_gnttab_limits set_gnttab_limits; struct xen_domctl_vuart_op vuart_op; uint8_t pad[128]; diff --git a/xen/include/public/sysctl.h b/xen/include/public/sysctl.h index 6140f1a..a50e345 100644 --- a/xen/include/public/sysctl.h +++ b/xen/include/public/sysctl.h @@ -696,10 +696,10 @@ struct xen_sysctl_pcitopoinfo { XEN_GUEST_HANDLE_64(uint32) nodes; }; -#define XEN_SYSCTL_PSR_CAT_get_l3_info 0 -#define XEN_SYSCTL_PSR_CAT_get_l2_info 1 -struct xen_sysctl_psr_cat_op { - uint32_t cmd; /* IN: XEN_SYSCTL_PSR_CAT_* */ +#define XEN_SYSCTL_PSR_get_l3_info 0 +#define XEN_SYSCTL_PSR_get_l2_info 1 +struct xen_sysctl_psr_alloc { + uint32_t cmd; /* IN: XEN_SYSCTL_PSR_* */ uint32_t target; /* IN */ union { struct { @@ -1068,7 +1068,7 @@ struct xen_sysctl { #define XEN_SYSCTL_gcov_op 20 #define XEN_SYSCTL_psr_cmt_op 21 #define XEN_SYSCTL_pcitopoinfo 22 -#define XEN_SYSCTL_psr_cat_op 23 +#define XEN_SYSCTL_psr_alloc 23 #define XEN_SYSCTL_tmem_op 24 #define XEN_SYSCTL_get_cpu_levelling_caps 25 #define XEN_SYSCTL_get_cpu_featureset 26 @@ -1097,7 +1097,7 @@ struct xen_sysctl { struct xen_sysctl_scheduler_op scheduler_op; struct xen_sysctl_gcov_op gcov_op; struct xen_sysctl_psr_cmt_op psr_cmt_op; - struct xen_sysctl_psr_cat_op psr_cat_op; + struct xen_sysctl_psr_alloc psr_alloc; struct xen_sysctl_tmem_op tmem_op; struct xen_sysctl_cpu_levelling_caps cpu_levelling_caps; struct xen_sysctl_cpu_featureset cpu_featureset; diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c index f01b4cf..d725e56 100644 --- a/xen/xsm/flask/hooks.c +++ b/xen/xsm/flask/hooks.c @@ -743,8 +743,8 @@ static int flask_domctl(struct domain *d, int cmd) case XEN_DOMCTL_psr_cmt_op: return current_has_perm(d, SECCLASS_DOMAIN2, DOMAIN2__PSR_CMT_OP); - case XEN_DOMCTL_psr_cat_op: - return current_has_perm(d, SECCLASS_DOMAIN2, DOMAIN2__PSR_CAT_OP); + case XEN_DOMCTL_psr_alloc: + return current_has_perm(d, SECCLASS_DOMAIN2, DOMAIN2__PSR_ALLOC); case XEN_DOMCTL_soft_reset: return current_has_perm(d, SECCLASS_DOMAIN2, DOMAIN2__SOFT_RESET); @@ -810,9 +810,9 @@ static int flask_sysctl(int cmd) case XEN_SYSCTL_psr_cmt_op: return avc_current_has_perm(SECINITSID_XEN, SECCLASS_XEN2, XEN2__PSR_CMT_OP, NULL); - case XEN_SYSCTL_psr_cat_op: + case XEN_SYSCTL_psr_alloc: return avc_current_has_perm(SECINITSID_XEN, SECCLASS_XEN2, - XEN2__PSR_CAT_OP, NULL); + XEN2__PSR_ALLOC, NULL); case XEN_SYSCTL_tmem_op: return domain_has_xen(current->domain, XEN__TMEM_CONTROL); diff --git a/xen/xsm/flask/policy/access_vectors b/xen/xsm/flask/policy/access_vectors index 3a2d863..d0a1ec5 100644 --- a/xen/xsm/flask/policy/access_vectors +++ b/xen/xsm/flask/policy/access_vectors @@ -85,8 +85,8 @@ class xen2 resource_op # XEN_SYSCTL_psr_cmt_op psr_cmt_op -# XEN_SYSCTL_psr_cat_op - psr_cat_op +# XEN_SYSCTL_psr_alloc + psr_alloc # XENPF_get_symbol get_symbol # PMU control @@ -246,8 +246,8 @@ class domain2 mem_paging # XENMEM_sharing_op mem_sharing -# XEN_DOMCTL_psr_cat_op - psr_cat_op +# XEN_DOMCTL_psr_alloc + psr_alloc # XEN_DOMCTL_set_gnttab_limits set_gnttab_limits }