From patchwork Tue Oct 25 03:41:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yi Sun X-Patchwork-Id: 9393889 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 8ABFC60762 for ; Tue, 25 Oct 2016 02:36:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D2EB28B39 for ; Tue, 25 Oct 2016 02:36:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7182E2927D; Tue, 25 Oct 2016 02:36:12 +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 247A828B39 for ; Tue, 25 Oct 2016 02:36:12 +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 1byrZG-0004k8-5O; Tue, 25 Oct 2016 02:34:22 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1byrZF-0004if-3u for xen-devel@lists.xenproject.org; Tue, 25 Oct 2016 02:34:21 +0000 Received: from [193.109.254.147] by server-2.bemta-6.messagelabs.com id 2F/C6-26478-CA4CE085; Tue, 25 Oct 2016 02:34:20 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrPLMWRWlGSWpSXmKPExsVywNykWHf1Eb4 Ig4PXLCy+b5nM5MDocfjDFZYAxijWzLyk/IoE1oyVNx4xFywVqFi58xt7A+Mj7i5GTg4hgQqJ TUe3soPYEgK8EkeWzWCFsAMkLr6+A2RzAdU0MEqc/zGRCSTBJqAu8fhrD5gtIqAkcW/VZCaQI maB/YwSv14+ZgFJCAvYS8zfNx1sEouAqsTbtXPYQGxeAQ+Jd/+/MkNskJM4eWwyWA0nUPzO3u PsEBe5S/Q1NDFOYORdwMiwilGjOLWoLLVI19BcL6koMz2jJDcxM0fX0MBMLze1uDgxPTUnMal YLzk/dxMjMCAYgGAH4+2NAYcYJTmYlER5Z27iixDiS8pPqcxILM6ILyrNSS0+xCjDwaEkwbv+ MFBOsCg1PbUiLTMHGJowaQkOHiUR3icgad7igsTc4sx0iNQpRkUpcd5FIAkBkERGaR5cGyweL jHKSgnzMgIdIsRTkFqUm1mCKv+KUZyDUUmY9wXIFJ7MvBK46a+AFjMBLRaM5wFZXJKIkJJqYM xsE5+g1J55xKndNjDz4v3G+gcBHXN9VPL7bD+n1cxJ09Vn0FryNeuLcPZCpvSJZ+eclA6v/8j TOSMwc/rUVTL1id7qTj8W+1h/c10VISPwZ5/0p0orC+eIw5N8py0RWBNSLWPNcvVpR5Ua87k7 1lcLdvz+eV7hhHIuX9CP6F3F9y9WO+0OU2Ipzkg01GIuKk4EAIlgUTWCAgAA X-Env-Sender: yi.y.sun@linux.intel.com X-Msg-Ref: server-14.tower-27.messagelabs.com!1477362814!54875270!15 X-Originating-IP: [192.55.52.115] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.0.13; banners=-,-,- X-VirusChecked: Checked Received: (qmail 846 invoked from network); 25 Oct 2016 02:34:19 -0000 Received: from mga14.intel.com (HELO mga14.intel.com) (192.55.52.115) by server-14.tower-27.messagelabs.com with DHE-RSA-CAMELLIA256-SHA encrypted SMTP; 25 Oct 2016 02:34:19 -0000 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP; 24 Oct 2016 19:34:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.31,544,1473145200"; d="scan'208"; a="1049570262" Received: from vmmmba-s2600wft.bj.intel.com ([10.240.193.60]) by orsmga001.jf.intel.com with ESMTP; 24 Oct 2016 19:34:17 -0700 From: Yi Sun To: xen-devel@lists.xenproject.org Date: Tue, 25 Oct 2016 11:41:02 +0800 Message-Id: <1477366863-5246-15-git-send-email-yi.y.sun@linux.intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1477366863-5246-1-git-send-email-yi.y.sun@linux.intel.com> References: <1477366863-5246-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] [PATCH v3 14/15] x86: Add L2 CAT interfaces in sysctl. 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 adds L2 CAT interface to get HW info in sysctl. Signed-off-by: He Chen Signed-off-by: Yi Sun --- xen/arch/x86/sysctl.c | 13 +++++++++++++ xen/include/public/sysctl.h | 6 ++++++ 2 files changed, 19 insertions(+) diff --git a/xen/arch/x86/sysctl.c b/xen/arch/x86/sysctl.c index e82adec..a66f049 100644 --- a/xen/arch/x86/sysctl.c +++ b/xen/arch/x86/sysctl.c @@ -192,6 +192,19 @@ long arch_do_sysctl( ret = -EFAULT; break; } + case XEN_SYSCTL_PSR_CAT_get_l2_info: + { + uint32_t dat[2]; + ret = psr_get_info(sysctl->u.psr_cat_op.target, + PSR_CBM_TYPE_L2, + dat, 2); + sysctl->u.psr_cat_op.u.l2_info.cbm_len = dat[CBM_LEN]; + sysctl->u.psr_cat_op.u.l2_info.cos_max = dat[COS_MAX]; + + if ( !ret && __copy_field_to_guest(u_sysctl, sysctl, u.psr_cat_op) ) + ret = -EFAULT; + break; + } default: ret = -EOPNOTSUPP; break; diff --git a/xen/include/public/sysctl.h b/xen/include/public/sysctl.h index 418f4bb..0a0c9f7 100644 --- a/xen/include/public/sysctl.h +++ b/xen/include/public/sysctl.h @@ -745,6 +745,7 @@ typedef struct xen_sysctl_pcitopoinfo xen_sysctl_pcitopoinfo_t; DEFINE_XEN_GUEST_HANDLE(xen_sysctl_pcitopoinfo_t); #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_* */ uint32_t target; /* IN */ @@ -755,6 +756,11 @@ struct xen_sysctl_psr_cat_op { #define XEN_SYSCTL_PSR_CAT_L3_CDP (1u << 0) uint32_t flags; /* OUT: CAT flags */ } l3_info; + + struct { + uint32_t cbm_len; /* OUT: CBM length */ + uint32_t cos_max; /* OUT: Maximum COS */ + } l2_info; } u; }; typedef struct xen_sysctl_psr_cat_op xen_sysctl_psr_cat_op_t;