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

[Xen-devel] [PATCH 1/5] x86: detect Intel CDP feature



Detect Intel Code/Data Prioritization(CDP) feature and store cpuid
information for later use. CDP feature is based on CAT, note that all
sockets in the platform must have CDP either enabled or disabled, not
a mix. cdp_socket_avail saves CDP capability of every socket so that
we can determine if CDP is supported in the platform.

Signed-off-by: He Chen <he.chen@xxxxxxxxxxxxxxx>
---
 xen/arch/x86/psr.c        | 13 ++++++++++++-
 xen/include/asm-x86/psr.h |  4 ++++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/psr.c b/xen/arch/x86/psr.c
index c0daa2e..b357816 100644
--- a/xen/arch/x86/psr.c
+++ b/xen/arch/x86/psr.c
@@ -43,6 +43,7 @@ struct psr_cmt *__read_mostly psr_cmt;
 
 static unsigned long *__read_mostly cat_socket_enable;
 static struct psr_cat_socket_info *__read_mostly cat_socket_info;
+static unsigned long *__read_mostly cdp_socket_avail;
 
 static unsigned int __initdata opt_psr;
 static unsigned int __initdata opt_rmid_max = 255;
@@ -498,6 +499,13 @@ static void cat_cpu_init(void)
         printk(XENLOG_INFO "CAT: enabled on socket %u, cos_max:%u, 
cbm_len:%u\n",
                socket, info->cos_max, info->cbm_len);
     }
+
+    if ( ecx & PSR_CAT_CDP_CAPABILITY )
+    {
+        set_bit(socket, cdp_socket_avail);
+        printk(XENLOG_INFO "CDP: available on socket %u\n",  socket);
+    }
+
 }
 
 static void cat_cpu_fini(unsigned int cpu)
@@ -523,6 +531,8 @@ static void __init psr_cat_free(void)
     cat_socket_enable = NULL;
     xfree(cat_socket_info);
     cat_socket_info = NULL;
+    xfree(cdp_socket_avail);
+    cdp_socket_avail = NULL;
 }
 
 static void __init init_psr_cat(void)
@@ -535,8 +545,9 @@ static void __init init_psr_cat(void)
 
     cat_socket_enable = xzalloc_array(unsigned long, 
BITS_TO_LONGS(nr_sockets));
     cat_socket_info = xzalloc_array(struct psr_cat_socket_info, nr_sockets);
+    cdp_socket_avail = xzalloc_array(unsigned long, BITS_TO_LONGS(nr_sockets));
 
-    if ( !cat_socket_enable || !cat_socket_info )
+    if ( !cat_socket_enable || !cat_socket_info || !cdp_socket_avail )
         psr_cat_free();
 }
 
diff --git a/xen/include/asm-x86/psr.h b/xen/include/asm-x86/psr.h
index 081750f..a6b83df 100644
--- a/xen/include/asm-x86/psr.h
+++ b/xen/include/asm-x86/psr.h
@@ -27,6 +27,10 @@
 /* L3 Monitoring Features */
 #define PSR_CMT_L3_OCCUPANCY           0x1
 
+/* CDP Capability */
+#define PSR_CAT_CDP_CAPABILITY       0x4
+
+
 struct psr_cmt_l3 {
     unsigned int features;
     unsigned int upscaling_factor;
-- 
1.9.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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