[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [RFC 08/16] x86: implement get value flow for MBA.



This patch implements get value callback function and domctl
interface for MBA.

Signed-off-by: Yi Sun <yi.y.sun@xxxxxxxxxxxxxxx>
---
 xen/arch/x86/domctl.c       |  7 +++++++
 xen/arch/x86/psr.c          | 15 +++++++++++++++
 xen/include/public/domctl.h |  1 +
 3 files changed, 23 insertions(+)

diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index 1f83ab2..6145cf4 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -1421,6 +1421,13 @@ long arch_do_domctl(
             copyback = 1;
             break;
 
+        case XEN_DOMCTL_PSR_MBA_OP_GET_THRTL:
+            ret = psr_get_val(d, domctl->u.psr_alloc_op.target,
+                              &domctl->u.psr_alloc_op.data,
+                              PSR_VAL_TYPE_MBA);
+            copyback = 1;
+            break;
+
         default:
             ret = -EOPNOTSUPP;
             break;
diff --git a/xen/arch/x86/psr.c b/xen/arch/x86/psr.c
index 52452a7..fd95a6d 100644
--- a/xen/arch/x86/psr.c
+++ b/xen/arch/x86/psr.c
@@ -998,10 +998,25 @@ static bool mba_get_feat_info(const struct feat_node 
*feat,
     return true;
 }
 
+static bool mba_get_val(const struct feat_node *feat, unsigned int cos,
+                        enum psr_val_type type, uint64_t *val)
+{
+    if ( type != PSR_VAL_TYPE_MBA )
+         return false;
+
+    if ( cos > feat->info.mba_info.cos_max )
+        cos = 0;
+
+    *val = feat->cos_reg_val[cos];
+
+    return true;
+}
+
 struct feat_ops mba_ops = {
     .init_feature = mba_init_feature,
     .get_max_cos_max = mba_get_max_cos_max,
     .get_feat_info = mba_get_feat_info,
+    .get_val = mba_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 f5b1466..2de7214 100644
--- a/xen/include/public/domctl.h
+++ b/xen/include/public/domctl.h
@@ -1140,6 +1140,7 @@ struct xen_domctl_psr_alloc_op {
 #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
+#define XEN_DOMCTL_PSR_MBA_OP_GET_THRTL      9
     uint32_t cmd;       /* IN: XEN_DOMCTL_PSR_*_OP_* */
     uint32_t target;    /* IN */
     uint64_t data;      /* IN/OUT */
-- 
1.9.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.