[xen master] x86: refactor psr: CDP: implement set value callback function.

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[xen master] x86: refactor psr: CDP: implement set value callback function.

patchbot
commit 99a5d0fd340748ace6585f84fd88c173a31a6a84
Author:     Yi Sun <[hidden email]>
AuthorDate: Tue Aug 1 11:05:00 2017 +0200
Commit:     Jan Beulich <[hidden email]>
CommitDate: Thu Aug 3 12:36:25 2017 +0200

    x86: refactor psr: CDP: implement set value callback function.
   
    This patch implements L3 CDP set value related callback function.
   
    With this patch, 'psr-cat-cbm-set' command can work for L3 CDP.
   
    Signed-off-by: Yi Sun <[hidden email]>
    Reviewed-by: Jan Beulich <[hidden email]>
---
 xen/arch/x86/psr.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/psr.c b/xen/arch/x86/psr.c
index b86271c..1080642 100644
--- a/xen/arch/x86/psr.c
+++ b/xen/arch/x86/psr.c
@@ -374,6 +374,10 @@ static bool l3_cdp_get_feat_info(const struct feat_node *feat,
 
 static void l3_cdp_write_msr(unsigned int cos, uint32_t val, enum cbm_type type)
 {
+    wrmsrl(((type == PSR_CBM_TYPE_L3_DATA) ?
+            MSR_IA32_PSR_L3_MASK_DATA(cos) :
+            MSR_IA32_PSR_L3_MASK_CODE(cos)),
+           val);
 }
 
 static const struct feat_props l3_cdp_props = {
@@ -829,17 +833,27 @@ static int insert_val_into_array(uint32_t val[],
     if ( !psr_check_cbm(feat->cbm_len, new_val) )
         return -EINVAL;
 
-    /* Value setting position is same as feature array. */
+    /*
+     * Value setting position is same as feature array.
+     * For CDP, user may set both DATA and CODE to same value. For such case,
+     * user input 'PSR_CBM_TYPE_L3' as type. The alternative type of CDP is same
+     * as it. So we should set new_val to both of DATA and CODE under such case.
+     */
     for ( i = 0; i < props->cos_num; i++ )
     {
         if ( type == props->type[i] )
         {
             val[i] = new_val;
-            return 0;
+            ret = 0;
+            break;
         }
+        else if ( type == props->alt_type )
+            val[i] = new_val;
+        else
+            ret = -EINVAL;
     }
 
-    return -EINVAL;
+    return ret;
 }
 
 static int compare_val(const uint32_t val[],
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
[hidden email]
https://lists.xenproject.org/xen-changelog