Skip to contentSkip to conversation

tools/libxc: Add xstate cpuid leaf of avx512

PATCH In review Luwei Kang 4 participants 6 messages Nov 4, 2016

lore
Share & tools
lore

Luwei Kang

author
#0 lore raw

PATCH 1/1 tools/libxc: Add xstate cpuid leaf of avx512

Enable get xstate cpuid leaf information regarding avx512 in guest.

---
 tools/libxc/xc_cpuid_x86.c | 6 ++++++
 1 file changed, 6 insertions(+)
tools/libxc/xc_cpuid_x86.c +6 -0
index de06b32..d761805 100644
@@ -406,6 +406,9 @@ static void intel_xc_cpuid_policy(xc_interface *xch,
 #define X86_XCR0_AVX    (1ULL <<  2)
 #define X86_XCR0_BNDREG (1ULL <<  3)
 #define X86_XCR0_BNDCSR (1ULL <<  4)
+#define X86_XCR0_OPMASK (1ULL <<  5)
+#define X86_XCR0_ZMM    (1ULL <<  6)
+#define X86_XCR0_HI_ZMM (1ULL <<  7)
 #define X86_XCR0_PKRU   (1ULL <<  9)
 #define X86_XCR0_LWP    (1ULL << 62)
 
@@ -437,6 +440,9 @@ static void xc_cpuid_config_xsave(xc_interface *xch,
     if ( test_bit(X86_FEATURE_MPX, info->featureset) )
         guest_xfeature_mask |= X86_XCR0_BNDREG | X86_XCR0_BNDCSR;
 
+    if ( test_bit(X86_FEATURE_AVX512F, info->featureset) )
+        guest_xfeature_mask |= X86_XCR0_OPMASK | X86_XCR0_ZMM | X86_XCR0_HI_ZMM;
+
     if ( test_bit(X86_FEATURE_PKU, info->featureset) )
         guest_xfeature_mask |= X86_XCR0_PKRU;
 
Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Luwei Kang

Enable get xstate cpuid leaf information regarding avx512 in guest.

Quoted 19 lines
---
 tools/libxc/xc_cpuid_x86.c | 6 ++++++
 1 file changed, 6 insertions(+)
tools/libxc/xc_cpuid_x86.c +3 -0
index de06b32..d761805 100644
@@ -406,6 +406,9 @@ static void intel_xc_cpuid_policy(xc_interface *xch,
 #define X86_XCR0_AVX    (1ULL <<  2)
 #define X86_XCR0_BNDREG (1ULL <<  3)
 #define X86_XCR0_BNDCSR (1ULL <<  4)
+#define X86_XCR0_OPMASK (1ULL <<  5)
+#define X86_XCR0_ZMM    (1ULL <<  6)
+#define X86_XCR0_HI_ZMM (1ULL <<  7)
 #define X86_XCR0_PKRU   (1ULL <<  9)
 #define X86_XCR0_LWP    (1ULL << 62)
 

tools/libxc/xc_cpuid_x86.c static void xc_cpuid_config_xsave(xc_interface *xch, · line 448

Quoted 9 lines
tools/libxc/xc_cpuid_x86.c +3 -0
@@ -437,6 +440,9 @@ static void xc_cpuid_config_xsave(xc_interface *xch,
     if ( test_bit(X86_FEATURE_MPX, info->featureset) )
         guest_xfeature_mask |= X86_XCR0_BNDREG | X86_XCR0_BNDCSR;
 
+    if ( test_bit(X86_FEATURE_AVX512F, info->featureset) )
+        guest_xfeature_mask |= X86_XCR0_OPMASK | X86_XCR0_ZMM | X86_XCR0_HI_ZMM;
+
     if ( test_bit(X86_FEATURE_PKU, info->featureset) )
         guest_xfeature_mask |= X86_XCR0_PKRU;
 

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#5 lore raw
In reply to Luwei Kang

CC x86 maintainers. I will defer this patch to them.

Quoted 34 lines · Luwei Kang

Enable get xstate cpuid leaf information regarding avx512 in guest.

---
 tools/libxc/xc_cpuid_x86.c | 6 ++++++
 1 file changed, 6 insertions(+)
tools/libxc/xc_cpuid_x86.c +6 -0
index de06b32..d761805 100644
@@ -406,6 +406,9 @@ static void intel_xc_cpuid_policy(xc_interface *xch,
 #define X86_XCR0_AVX    (1ULL <<  2)
 #define X86_XCR0_BNDREG (1ULL <<  3)
 #define X86_XCR0_BNDCSR (1ULL <<  4)
+#define X86_XCR0_OPMASK (1ULL <<  5)
+#define X86_XCR0_ZMM    (1ULL <<  6)
+#define X86_XCR0_HI_ZMM (1ULL <<  7)
 #define X86_XCR0_PKRU   (1ULL <<  9)
 #define X86_XCR0_LWP    (1ULL << 62)
 
@@ -437,6 +440,9 @@ static void xc_cpuid_config_xsave(xc_interface *xch,
     if ( test_bit(X86_FEATURE_MPX, info->featureset) )
         guest_xfeature_mask |= X86_XCR0_BNDREG | X86_XCR0_BNDCSR;
 
+    if ( test_bit(X86_FEATURE_AVX512F, info->featureset) )
+        guest_xfeature_mask |= X86_XCR0_OPMASK | X86_XCR0_ZMM | X86_XCR0_HI_ZMM;
+
     if ( test_bit(X86_FEATURE_PKU, info->featureset) )
         guest_xfeature_mask |= X86_XCR0_PKRU;
 
Signature · 1 line
2.7.4

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#2 lore raw
In reply to Andrew Cooper
Quoted 7 lines · Andrew Cooper
Quoted 3 lines · Luwei Kang

Enable get xstate cpuid leaf information regarding avx512 in guest.

Oops, should have read all the entire thread.

I think we can sneak this in for 4.8 if we have some free cycles, otherwise I will queue it up for -next.

Quoted 22 lines
Quoted 22 lines
---
 tools/libxc/xc_cpuid_x86.c | 6 ++++++
 1 file changed, 6 insertions(+)
tools/libxc/xc_cpuid_x86.c +3 -0
index de06b32..d761805 100644
@@ -406,6 +406,9 @@ static void intel_xc_cpuid_policy(xc_interface *xch,
 #define X86_XCR0_AVX    (1ULL <<  2)
 #define X86_XCR0_BNDREG (1ULL <<  3)
 #define X86_XCR0_BNDCSR (1ULL <<  4)
+#define X86_XCR0_OPMASK (1ULL <<  5)
+#define X86_XCR0_ZMM    (1ULL <<  6)
+#define X86_XCR0_HI_ZMM (1ULL <<  7)
 #define X86_XCR0_PKRU   (1ULL <<  9)
 #define X86_XCR0_LWP    (1ULL << 62)
 
@@ -437,6 +440,9 @@ static void xc_cpuid_config_xsave(xc_interface *xch,
     if ( test_bit(X86_FEATURE_MPX, info->featureset) )
         guest_xfeature_mask |= X86_XCR0_BNDREG | X86_XCR0_BNDCSR;
 
Quoted 7 lines

tools/libxc/xc_cpuid_x86.c static void xc_cpuid_config_xsave(xc_interface *xch, · line 448

Quoted 6 lines
tools/libxc/xc_cpuid_x86.c +3 -0
+    if ( test_bit(X86_FEATURE_AVX512F, info->featureset) )
+        guest_xfeature_mask |= X86_XCR0_OPMASK | X86_XCR0_ZMM | X86_XCR0_HI_ZMM;
+
     if ( test_bit(X86_FEATURE_PKU, info->featureset) )
         guest_xfeature_mask |= X86_XCR0_PKRU;
 

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#3 lore raw
Quoted 6 lines · Wei Liu
Quoted 5 lines · Andrew Cooper
Quoted 3 lines · Luwei Kang

Enable get xstate cpuid leaf information regarding avx512 in guest.

Quoted 7 lines
Quoted 2 lines

Oops, should have read all the entire thread.

I think we can sneak this in for 4.8 if we have some free cycles, otherwise I will queue it up for -next.

It would be good to get it in as it provides some nice performance benefits for guests.

Quoted 31 lines
Quoted 23 lines
Quoted 23 lines
---
 tools/libxc/xc_cpuid_x86.c | 6 ++++++
 1 file changed, 6 insertions(+)
tools/libxc/xc_cpuid_x86.c +3 -0
index de06b32..d761805 100644
@@ -406,6 +406,9 @@ static void intel_xc_cpuid_policy(xc_interface *xch,
 #define X86_XCR0_AVX    (1ULL <<  2)
 #define X86_XCR0_BNDREG (1ULL <<  3)
 #define X86_XCR0_BNDCSR (1ULL <<  4)
+#define X86_XCR0_OPMASK (1ULL <<  5)
+#define X86_XCR0_ZMM    (1ULL <<  6)
+#define X86_XCR0_HI_ZMM (1ULL <<  7)
 #define X86_XCR0_PKRU   (1ULL <<  9)
 #define X86_XCR0_LWP    (1ULL << 62)
 
@@ -437,6 +440,9 @@ static void xc_cpuid_config_xsave(xc_interface *xch,
     if ( test_bit(X86_FEATURE_MPX, info->featureset) )
         guest_xfeature_mask |= X86_XCR0_BNDREG | X86_XCR0_BNDCSR;
 
Quoted 7 lines

tools/libxc/xc_cpuid_x86.c static void xc_cpuid_config_xsave(xc_interface *xch, · line 448

Quoted 6 lines
tools/libxc/xc_cpuid_x86.c +3 -0
+    if ( test_bit(X86_FEATURE_AVX512F, info->featureset) )
+        guest_xfeature_mask |= X86_XCR0_OPMASK | X86_XCR0_ZMM | X86_XCR0_HI_ZMM;
+
     if ( test_bit(X86_FEATURE_PKU, info->featureset) )
         guest_xfeature_mask |= X86_XCR0_PKRU;
 
Quoted 4 lines

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#4 lore raw
Quoted 10 lines · Konrad Rzeszutek Wilk
Quoted 9 lines · Wei Liu
Quoted 7 lines · Andrew Cooper
Quoted 3 lines · Luwei Kang

Enable get xstate cpuid leaf information regarding avx512 in guest.

Quoted 8 lines
Quoted 4 lines

Oops, should have read all the entire thread.

I think we can sneak this in for 4.8 if we have some free cycles, otherwise I will queue it up for -next.

It would be good to get it in as it provides some nice performance benefits for guests.

Given that the queue is empty at the moment, I've pushed this patch.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel