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

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



commit 99a5d0fd340748ace6585f84fd88c173a31a6a84
Author:     Yi Sun <yi.y.sun@xxxxxxxxxxxxxxx>
AuthorDate: Tue Aug 1 11:05:00 2017 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
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 <yi.y.sun@xxxxxxxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 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
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.