diff mbox

[v9,20/25] x86: L2 CAT: implement get value flow.

Message ID 1489662495-5375-21-git-send-email-yi.y.sun@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Yi Sun March 16, 2017, 11:08 a.m. UTC
This patch implements L2 CAT get value callback function and
interface in domctl.

Signed-off-by: Yi Sun <yi.y.sun@linux.intel.com>
---
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       | 8 ++++++++
 xen/arch/x86/psr.c          | 1 +
 xen/include/public/domctl.h | 1 +
 3 files changed, 10 insertions(+)

Comments

Jan Beulich March 27, 2017, 2:39 p.m. UTC | #1
>>> On 16.03.17 at 12:08, <yi.y.sun@linux.intel.com> wrote:
> --- 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

Any reason you skip 6 here?

Jan
diff mbox

Patch

diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index 76923c8..7f55cfd 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -1478,6 +1478,14 @@  long arch_do_domctl(
             copyback = 1;
             break;
 
+        case XEN_DOMCTL_PSR_CAT_OP_GET_L2_CBM:
+            domctl->u.psr_cat_op.data = 0;
+            ret = psr_get_val(d, domctl->u.psr_cat_op.target,
+                              (uint32_t *)&domctl->u.psr_cat_op.data,
+                              PSR_CBM_TYPE_L2);
+            copyback = 1;
+            break;
+
         default:
             ret = -EOPNOTSUPP;
             break;
diff --git a/xen/arch/x86/psr.c b/xen/arch/x86/psr.c
index 39f249e..4cbcbe0 100644
--- a/xen/arch/x86/psr.c
+++ b/xen/arch/x86/psr.c
@@ -639,6 +639,7 @@  struct feat_ops l3_cdp_ops = {
 struct feat_ops l2_cat_ops = {
     .get_cos_max = cat_get_cos_max,
     .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 */