From b64596e9cbb6c4a867269f8f6704db3faffefae1 Mon Sep 17 00:00:00 2001 From: Yi Sun Date: Tue, 1 Aug 2017 11:04:00 +0200 Subject: [PATCH] x86: refactor psr: CDP: implement get hw info flow. This patch implements get HW info flow for CDP including L3 CDP callback function. The flow is almost same as L3 CAT. With this patch, 'psr-hwinfo' can work for L3 CDP. Signed-off-by: Yi Sun Reviewed-by: Jan Beulich --- xen/arch/x86/psr.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/psr.c b/xen/arch/x86/psr.c index 0dccb92534..b86271c5cc 100644 --- a/xen/arch/x86/psr.c +++ b/xen/arch/x86/psr.c @@ -222,7 +222,21 @@ static enum psr_feat_type psr_cbm_type_to_feat_type(enum cbm_type type) { case PSR_CBM_TYPE_L3: feat_type = FEAT_TYPE_L3_CAT; + + /* + * If type is L3 CAT but we cannot find it in feat_props array, + * try CDP. + */ + if ( !feat_props[feat_type] ) + feat_type = FEAT_TYPE_L3_CDP; + + break; + + case PSR_CBM_TYPE_L3_DATA: + case PSR_CBM_TYPE_L3_CODE: + feat_type = FEAT_TYPE_L3_CDP; break; + default: ASSERT_UNREACHABLE(); } @@ -350,7 +364,12 @@ static const struct feat_props l3_cat_props = { static bool l3_cdp_get_feat_info(const struct feat_node *feat, uint32_t data[], uint32_t array_len) { - return false; + if ( !cat_get_feat_info(feat, data, array_len) ) + return false; + + data[PSR_INFO_IDX_CAT_FLAG] |= XEN_SYSCTL_PSR_CAT_L3_CDP; + + return true; } static void l3_cdp_write_msr(unsigned int cos, uint32_t val, enum cbm_type type) -- 2.30.2