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

[Xen-devel] [PATCH v10 15/25] 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 <yi.y.sun@xxxxxxxxxxxxxxx>
---
v10:
    - update renamed macros used by psr_get_info.
      (suggested by Jan Beulich)
    - change 'psr_get_info' flow to cover CDP case to make codes in sysctl
      more simple.
      (suggested by Jan Beulich)
    - remove sysctl redundant codes after applying above changes.
      (suggested by Jan Beulich)
v9:
    - modify commit message to explain flow more clearly.
    - reuse 'cat_get_feat_info' for CDP to reduce redundant codes.
      (suggested by Roger Pau)
    - fix coding style issues.
      (suggested by Wei Liu and Roger Pau)
    - rename macros used by psr_get_info to make them meaningful.
      (suggested by Jan Beulich)
v5:
    - rename 'dat[]' to 'data[]'.
      (suggested by Jan Beulich)
    - remove type check in callback function.
      (suggested by Jan Beulich)
v4:
    - create this patch to make codes easier to understand.
      (suggested by Jan Beulich)
---
 xen/arch/x86/psr.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/xen/arch/x86/psr.c b/xen/arch/x86/psr.c
index 58970fa..f0611ad 100644
--- a/xen/arch/x86/psr.c
+++ b/xen/arch/x86/psr.c
@@ -237,6 +237,10 @@ static enum psr_feat_type psr_cbm_type_to_feat_type(enum 
cbm_type type)
     case PSR_CBM_TYPE_L3:
         feat_type = PSR_SOCKET_L3_CAT;
         break;
+    case PSR_CBM_TYPE_L3_DATA:
+    case PSR_CBM_TYPE_L3_CODE:
+        feat_type = PSR_SOCKET_L3_CDP;
+        break;
     default:
         ASSERT_UNREACHABLE();
     }
@@ -386,8 +390,20 @@ static struct feat_props l3_cat_props = {
 };
 
 /* L3 CDP ops */
+static bool l3_cdp_get_feat_info(const struct feat_node *feat,
+                                 uint32_t data[], uint32_t array_len)
+{
+    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 struct feat_props l3_cdp_props = {
     .cos_num = 2,
+    .get_feat_info = l3_cdp_get_feat_info,
 };
 
 static void __init parse_psr_bool(char *s, char *value, char *feature,
@@ -641,6 +657,14 @@ int psr_get_info(unsigned int socket, enum cbm_type type,
     if ( IS_ERR(feat) )
         return PTR_ERR(feat);
 
+    /* If type is L3 CAT but we cannot find it in feature array, try CDP. */
+    if ( !feat && type == PSR_CBM_TYPE_L3 )
+    {
+        feat = psr_get_feat(socket, PSR_CBM_TYPE_L3_CODE);
+        if ( IS_ERR(feat) )
+            return PTR_ERR(feat);
+    }
+
     if ( !feat )
         return -ENOENT;
 
-- 
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®.