[xen master] x86: L2 CAT: implement get hw info flow.

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[xen master] x86: L2 CAT: implement get hw info flow.

patchbot
commit bfee9a8aa3597b5f8994b6f7a18e7fef1aa15061
Author:     Yi Sun <[hidden email]>
AuthorDate: Tue Aug 1 11:05:00 2017 +0200
Commit:     Jan Beulich <[hidden email]>
CommitDate: Thu Aug 3 12:37:21 2017 +0200

    x86: L2 CAT: implement get hw info flow.
   
    This patch implements L2 CAT get HW info flow and interface in sysctl.
   
    Signed-off-by: Yi Sun <[hidden email]>
    Reviewed-by: Jan Beulich <[hidden email]>
---
 xen/arch/x86/psr.c          |  4 ++++
 xen/arch/x86/sysctl.c       | 23 +++++++++++++++++++++--
 xen/include/public/sysctl.h |  1 +
 3 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/psr.c b/xen/arch/x86/psr.c
index 9a91ccd..4dd9112 100644
--- a/xen/arch/x86/psr.c
+++ b/xen/arch/x86/psr.c
@@ -239,6 +239,10 @@ static enum psr_feat_type psr_cbm_type_to_feat_type(enum cbm_type type)
         feat_type = FEAT_TYPE_L3_CDP;
         break;
 
+    case PSR_CBM_TYPE_L2:
+        feat_type = FEAT_TYPE_L2_CAT;
+        break;
+
     default:
         ASSERT_UNREACHABLE();
     }
diff --git a/xen/arch/x86/sysctl.c b/xen/arch/x86/sysctl.c
index a92384b..9aca241 100644
--- a/xen/arch/x86/sysctl.c
+++ b/xen/arch/x86/sysctl.c
@@ -174,10 +174,10 @@ long arch_do_sysctl(
     case XEN_SYSCTL_psr_cat_op:
         switch ( sysctl->u.psr_cat_op.cmd )
         {
-        case XEN_SYSCTL_PSR_CAT_get_l3_info:
-        {
             uint32_t data[PSR_INFO_ARRAY_SIZE];
 
+        case XEN_SYSCTL_PSR_CAT_get_l3_info:
+        {
             ret = psr_get_info(sysctl->u.psr_cat_op.target,
                                PSR_CBM_TYPE_L3, data, ARRAY_SIZE(data));
             if ( ret )
@@ -195,6 +195,25 @@ long arch_do_sysctl(
             break;
         }
 
+        case XEN_SYSCTL_PSR_CAT_get_l2_info:
+        {
+            ret = psr_get_info(sysctl->u.psr_cat_op.target,
+                               PSR_CBM_TYPE_L2, data, ARRAY_SIZE(data));
+            if ( ret )
+                break;
+
+            sysctl->u.psr_cat_op.u.l3_info.cos_max =
+                                      data[PSR_INFO_IDX_COS_MAX];
+            sysctl->u.psr_cat_op.u.l3_info.cbm_len =
+                                      data[PSR_INFO_IDX_CAT_CBM_LEN];
+            sysctl->u.psr_cat_op.u.l3_info.flags =
+                                      data[PSR_INFO_IDX_CAT_FLAG];
+
+            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 ee76a66..4c76d3a 100644
--- a/xen/include/public/sysctl.h
+++ b/xen/include/public/sysctl.h
@@ -744,6 +744,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 */
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
[hidden email]
https://lists.xenproject.org/xen-changelog