This patch implements L2 CAT get value callback function and interface in domctl.
Signed-off-by: Yi Sun <yi.y....@linux.intel.com> --- xen/arch/x86/domctl.c | 7 +++++++ xen/arch/x86/psr.c | 16 ++++++++++++++++ xen/include/public/domctl.h | 1 + 3 files changed, 24 insertions(+) diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c index 8e5502a..e5aa932 100644 --- a/xen/arch/x86/domctl.c +++ b/xen/arch/x86/domctl.c @@ -1424,6 +1424,13 @@ long arch_do_domctl( copyback = 1; break; + case XEN_DOMCTL_PSR_CAT_OP_GET_L2_CBM: + ret = psr_get_val(d, domctl->u.psr_cat_op.target, + &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 6de0abf..0886a01 100644 --- a/xen/arch/x86/psr.c +++ b/xen/arch/x86/psr.c @@ -787,10 +787,26 @@ static bool l2_cat_get_feat_info(const struct feat_node *feat, return true; } +static bool l2_cat_get_val(const struct feat_node *feat, unsigned int cos, + enum cbm_type type, uint64_t *val) +{ + if ( type != PSR_CBM_TYPE_L2 ) + return false; + + if ( cos > feat->info.l2_cat_info.cos_max ) + cos = 0; + + /* L2 CAT */ + *val = feat->cos_reg_val[cos]; + + return true; +} + struct feat_ops l2_cat_ops = { .init_feature = l2_cat_init_feature, .get_max_cos_max = l2_cat_get_max_cos_max, .get_feat_info = l2_cat_get_feat_info, + .get_val = l2_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 177319d..d04e318 100644 --- a/xen/include/public/domctl.h +++ b/xen/include/public/domctl.h @@ -1137,6 +1137,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 */ -- 1.9.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel