From: "Jan Beulich" Subject: [PATCH RFC] x86: support newer Intel CPU models Date: Tue, 27 Jan 2015 17:17:06 +0000 Message-ID: <54C7D6220200007800059FD1@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part3104AF02.2__=" Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YG9lH-0006b7-C2 for xen-devel@lists.xenproject.org; Tue, 27 Jan 2015 17:17:12 +0000 List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Donald D Dugger , Jun Nakajima , Kevin Tian Cc: Andrew Cooper , Keir Fraser , xen-devel List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part3104AF02.2__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline This just follows what the January 2015 edition of the SDM documents. Open issues (RFC reasons): - Broadwell models 0x4f and 0x56 don't cross-reference other tables (and hence get added in commented out fashion only for now). - Xeon Phi model 0x57 lists LASTBRANCH_TOS but not where the actual stack is. Signed-off-by: Jan Beulich --- a/xen/arch/x86/acpi/cpu_idle.c +++ b/xen/arch/x86/acpi/cpu_idle.c @@ -62,6 +62,7 @@ =20 #define GET_HW_RES_IN_NS(msr, val) \ do { rdmsrl(msr, val); val =3D tsc_ticks2ns(val); } while( 0 ) +#define GET_MC6_RES(val) GET_HW_RES_IN_NS(0x664, val) /* Atom E3000 only = */ #define GET_PC2_RES(val) GET_HW_RES_IN_NS(0x60D, val) /* SNB onwards */ #define GET_PC3_RES(val) GET_HW_RES_IN_NS(0x3F8, val) #define GET_PC6_RES(val) GET_HW_RES_IN_NS(0x3F9, val) @@ -73,6 +74,7 @@ #define GET_CC3_RES(val) GET_HW_RES_IN_NS(0x3FC, val) #define GET_CC6_RES(val) GET_HW_RES_IN_NS(0x3FD, val) #define GET_CC7_RES(val) GET_HW_RES_IN_NS(0x3FE, val) /* SNB onwards */ +#define PHI_CC6_RES(val) GET_HW_RES_IN_NS(0x3FF, val) /* Xeon Phi only = */ =20 static void lapic_timer_nop(void) { } void (*__read_mostly lapic_timer_off)(void); @@ -113,6 +115,8 @@ struct acpi_processor_power *__read_most =20 struct hw_residencies { + uint64_t mc0; + uint64_t mc6; uint64_t pc2; uint64_t pc3; uint64_t pc4; @@ -153,8 +157,11 @@ static void do_get_hw_residencies(void * case 0x3C: case 0x3F: case 0x46: - /* future */ + /* Broadwell */ case 0x3D: + /* case 0x4F: */ + /* case 0x56: */ + /* future */ case 0x4E: GET_PC2_RES(hw_res->pc2); GET_CC7_RES(hw_res->cc7); @@ -174,6 +181,16 @@ static void do_get_hw_residencies(void * GET_CC3_RES(hw_res->cc3); GET_CC6_RES(hw_res->cc6); break; + /* next gen Xeon Phi */ + case 0x57: + GET_CC3_RES(hw_res->mc0); /* abusing GET_CC3_RES */ + GET_CC6_RES(hw_res->mc6); /* abusing GET_CC6_RES */ + GET_PC2_RES(hw_res->pc2); + GET_PC3_RES(hw_res->pc3); + GET_PC6_RES(hw_res->pc6); + GET_PC7_RES(hw_res->pc7); + PHI_CC6_RES(hw_res->cc6); + break; /* various Atoms */ case 0x27: GET_PC3_RES(hw_res->pc2); /* abusing GET_PC3_RES */ @@ -182,10 +199,13 @@ static void do_get_hw_residencies(void * break; /* Silvermont */ case 0x37: + GET_MC6_RES(hw_res->mc6); case 0x4A: case 0x4D: case 0x5A: case 0x5D: + /* Airmont */ + case 0x4C: GET_PC7_RES(hw_res->pc6); /* abusing GET_PC7_RES */ GET_CC1_RES(hw_res->cc1); GET_CC6_RES(hw_res->cc6); @@ -209,6 +229,9 @@ static void print_hw_residencies(uint32_ =20 get_hw_residencies(cpu, &hw_res); =20 + if ( hw_res.mc0 | hw_res.mc6 ) + printk("MC0[%"PRIu64"] MC6[%"PRIu64"]\n", + hw_res.mc0, hw_res.mc6); printk("PC2[%"PRIu64"] PC%d[%"PRIu64"] PC6[%"PRIu64"] PC7[%"PRIu64"]\n= ", hw_res.pc2, hw_res.pc4 ? 4 : 3, hw_res.pc4 ?: hw_res.pc3, --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -2055,14 +2055,18 @@ static const struct lbr_info *last_branc case 58: case 62: /* Haswell */ case 60: case 63: case 69: case 70: + /* Broadwell */ + case 61: /* case 79: case 86: */ /* future */ - case 61: case 78: + case 78: return nh_lbr; break; /* Atom */ case 28: case 38: case 39: case 53: case 54: /* Silvermont */ case 55: case 74: case 77: case 90: case 93: + /* Airmont */ + case 0x78: return at_lbr; break; } --- a/xen/arch/x86/hvm/vmx/vpmu_core2.c +++ b/xen/arch/x86/hvm/vmx/vpmu_core2.c @@ -876,9 +876,16 @@ int vmx_vpmu_initialise(struct vcpu *v,=20 case 0x45: case 0x46: =20 - /* future: */ + /* Broadwell */ case 0x3d: + /* case 0x4f: */ + /* case 0x56: */ + + /* future: */ case 0x4e: + + /* next gen Xeon Phi */ + case 0x57: ret =3D core2_vpmu_initialise(v, vpmu_flags); if ( !ret ) vpmu->arch_vpmu_ops =3D &core2_vpmu_ops; --=__Part3104AF02.2__= Content-Type: text/plain; name="x86-Intel-CPU-models.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-Intel-CPU-models.patch" x86: support newer Intel CPU models=0A=0AThis just follows what the = January 2015 edition of the SDM documents.=0A=0AOpen issues (RFC = reasons):=0A- Broadwell models 0x4f and 0x56 don't cross-reference other = tables=0A (and hence get added in commented out fashion only for = now).=0A- Xeon Phi model 0x57 lists LASTBRANCH_TOS but not where the = actual=0A stack is.=0A=0ASigned-off-by: Jan Beulich =0A= =0A--- a/xen/arch/x86/acpi/cpu_idle.c=0A+++ b/xen/arch/x86/acpi/cpu_idle.c= =0A@@ -62,6 +62,7 @@=0A =0A #define GET_HW_RES_IN_NS(msr, val) \=0A do = { rdmsrl(msr, val); val =3D tsc_ticks2ns(val); } while( 0 )=0A+#define = GET_MC6_RES(val) GET_HW_RES_IN_NS(0x664, val) /* Atom E3000 only */=0A = #define GET_PC2_RES(val) GET_HW_RES_IN_NS(0x60D, val) /* SNB onwards = */=0A #define GET_PC3_RES(val) GET_HW_RES_IN_NS(0x3F8, val)=0A #define = GET_PC6_RES(val) GET_HW_RES_IN_NS(0x3F9, val)=0A@@ -73,6 +74,7 @@=0A = #define GET_CC3_RES(val) GET_HW_RES_IN_NS(0x3FC, val)=0A #define = GET_CC6_RES(val) GET_HW_RES_IN_NS(0x3FD, val)=0A #define GET_CC7_RES(val) = GET_HW_RES_IN_NS(0x3FE, val) /* SNB onwards */=0A+#define PHI_CC6_RES(val)= GET_HW_RES_IN_NS(0x3FF, val) /* Xeon Phi only */=0A =0A static void = lapic_timer_nop(void) { }=0A void (*__read_mostly lapic_timer_off)(void);= =0A@@ -113,6 +115,8 @@ struct acpi_processor_power *__read_most=0A =0A = struct hw_residencies=0A {=0A+ uint64_t mc0;=0A+ uint64_t mc6;=0A = uint64_t pc2;=0A uint64_t pc3;=0A uint64_t pc4;=0A@@ -153,8 = +157,11 @@ static void do_get_hw_residencies(void *=0A case 0x3C:=0A = case 0x3F:=0A case 0x46:=0A- /* future */=0A+ /* Broadwell = */=0A case 0x3D:=0A+ /* case 0x4F: */=0A+ /* case 0x56: */=0A+ = /* future */=0A case 0x4E:=0A GET_PC2_RES(hw_res->pc2);=0A = GET_CC7_RES(hw_res->cc7);=0A@@ -174,6 +181,16 @@ static void = do_get_hw_residencies(void *=0A GET_CC3_RES(hw_res->cc3);=0A = GET_CC6_RES(hw_res->cc6);=0A break;=0A+ /* next gen Xeon Phi = */=0A+ case 0x57:=0A+ GET_CC3_RES(hw_res->mc0); /* abusing = GET_CC3_RES */=0A+ GET_CC6_RES(hw_res->mc6); /* abusing GET_CC6_RES = */=0A+ GET_PC2_RES(hw_res->pc2);=0A+ GET_PC3_RES(hw_res->pc3)= ;=0A+ GET_PC6_RES(hw_res->pc6);=0A+ GET_PC7_RES(hw_res->pc7);= =0A+ PHI_CC6_RES(hw_res->cc6);=0A+ break;=0A /* various = Atoms */=0A case 0x27:=0A GET_PC3_RES(hw_res->pc2); /* abusing = GET_PC3_RES */=0A@@ -182,10 +199,13 @@ static void do_get_hw_residencies(vo= id *=0A break;=0A /* Silvermont */=0A case 0x37:=0A+ = GET_MC6_RES(hw_res->mc6);=0A case 0x4A:=0A case 0x4D:=0A case = 0x5A:=0A case 0x5D:=0A+ /* Airmont */=0A+ case 0x4C:=0A = GET_PC7_RES(hw_res->pc6); /* abusing GET_PC7_RES */=0A GET_CC1_RES(= hw_res->cc1);=0A GET_CC6_RES(hw_res->cc6);=0A@@ -209,6 +229,9 @@ = static void print_hw_residencies(uint32_=0A =0A get_hw_residencies(cpu,= &hw_res);=0A =0A+ if ( hw_res.mc0 | hw_res.mc6 )=0A+ printk("MC0= [%"PRIu64"] MC6[%"PRIu64"]\n",=0A+ hw_res.mc0, hw_res.mc6);= =0A printk("PC2[%"PRIu64"] PC%d[%"PRIu64"] PC6[%"PRIu64"] PC7[%"PRIu64"= ]\n",=0A hw_res.pc2,=0A hw_res.pc4 ? 4 : 3, = hw_res.pc4 ?: hw_res.pc3,=0A--- a/xen/arch/x86/hvm/vmx/vmx.c=0A+++ = b/xen/arch/x86/hvm/vmx/vmx.c=0A@@ -2055,14 +2055,18 @@ static const struct = lbr_info *last_branc=0A case 58: case 62:=0A /* Haswell = */=0A case 60: case 63: case 69: case 70:=0A+ /* Broadwell = */=0A+ case 61: /* case 79: case 86: */=0A /* future */=0A- = case 61: case 78:=0A+ case 78:=0A return = nh_lbr;=0A break;=0A /* Atom */=0A case 28: = case 38: case 39: case 53: case 54:=0A /* Silvermont */=0A = case 55: case 74: case 77: case 90: case 93:=0A+ /* Airmont */=0A+ = case 0x78:=0A return at_lbr;=0A break;=0A = }=0A--- a/xen/arch/x86/hvm/vmx/vpmu_core2.c=0A+++ b/xen/arch/x86/hvm/v= mx/vpmu_core2.c=0A@@ -876,9 +876,16 @@ int vmx_vpmu_initialise(struct vcpu = *v, =0A case 0x45:=0A case 0x46:=0A =0A- /* future: = */=0A+ /* Broadwell */=0A case 0x3d:=0A+ /* case = 0x4f: */=0A+ /* case 0x56: */=0A+=0A+ /* future: */=0A = case 0x4e:=0A+=0A+ /* next gen Xeon Phi */=0A+ case = 0x57:=0A ret =3D core2_vpmu_initialise(v, vpmu_flags);=0A = if ( !ret )=0A vpmu->arch_vpmu_ops =3D &core2_vpmu_o= ps;=0A --=__Part3104AF02.2__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__Part3104AF02.2__=--