diff mbox series

[v2,13/17] x86/pat: Replace Intel x86_model checks with VFM ones

Message ID 20250211194407.2577252-14-sohil.mehta@intel.com (mailing list archive)
State New
Headers show
Series Prepare for new Intel Family numbers | expand

Commit Message

Sohil Mehta Feb. 11, 2025, 7:44 p.m. UTC
Introduce markers and names for some Family 6 and Family 15 models and
replace x86_model checks with VFM ones.

Signed-off-by: Sohil Mehta <sohil.mehta@intel.com>

---

v2: Get rid of the INTEL_FAM15_START IFM(15, 0x00) define.

---
 arch/x86/include/asm/intel-family.h | 1 +
 arch/x86/mm/pat/memtype.c           | 7 ++++---
 2 files changed, 5 insertions(+), 3 deletions(-)

Comments

Dave Hansen Feb. 11, 2025, 9:09 p.m. UTC | #1
On 2/11/25 11:44, Sohil Mehta wrote:
> +	if (c->x86_vendor == X86_VENDOR_INTEL &&
> +	    ((c->x86_vfm >= INTEL_PENTIUM_PRO && c->x86_vfm <= INTEL_PENTIUM_M_DOTHAN) ||
> +	    (c->x86_vfm >= INTEL_P4_WILLAMETTE && c->x86_vfm <= INTEL_P4_CEDARMILL))) {

Since these are both closed checks and not open-ended, is the

	if (c->x86_vendor == X86_VENDOR_INTEL &&

bit needed or superfluous?

Also, super nit, can you vertically align the two range checks, please?

	    ((c->x86_vfm >= INTEL_PENTIUM_PRO   && c->x86_vfm <=
INTEL_PENTIUM_M_DOTHAN) ||
	     (c->x86_vfm >= INTEL_P4_WILLAMETTE && c->x86_vfm <=
INTEL_P4_CEDARMILL))) {
Sohil Mehta Feb. 11, 2025, 9:42 p.m. UTC | #2
On 2/11/2025 1:09 PM, Dave Hansen wrote:
> On 2/11/25 11:44, Sohil Mehta wrote:
>> +	if (c->x86_vendor == X86_VENDOR_INTEL &&
>> +	    ((c->x86_vfm >= INTEL_PENTIUM_PRO && c->x86_vfm <= INTEL_PENTIUM_M_DOTHAN) ||
>> +	    (c->x86_vfm >= INTEL_P4_WILLAMETTE && c->x86_vfm <= INTEL_P4_CEDARMILL))) {
> 
> Since these are both closed checks and not open-ended, is the
> 
> 	if (c->x86_vendor == X86_VENDOR_INTEL &&
> 
> bit needed or superfluous?
> 

You are right, since it is close ended on both sides we should be able
to remove the X86_VENDOR_INTEL.

I was thinking if we should leave it there to avoid confusion. But,
INTEL_* in the VFM string is a good enough hint that the checks are
Intel specific. Also, it's not like this check is going to be modified
frequently.

> Also, super nit, can you vertically align the two range checks, please?
> 
> 	    ((c->x86_vfm >= INTEL_PENTIUM_PRO   && c->x86_vfm <=
> INTEL_PENTIUM_M_DOTHAN) ||
> 	     (c->x86_vfm >= INTEL_P4_WILLAMETTE && c->x86_vfm <=
> INTEL_P4_CEDARMILL))) {
> 
>
diff mbox series

Patch

diff --git a/arch/x86/include/asm/intel-family.h b/arch/x86/include/asm/intel-family.h
index 9e6a13f03f0e..300dac505d7f 100644
--- a/arch/x86/include/asm/intel-family.h
+++ b/arch/x86/include/asm/intel-family.h
@@ -190,6 +190,7 @@ 
 /* Family 15 - NetBurst */
 #define INTEL_P4_WILLAMETTE		IFM(15, 0x01) /* Also Xeon Foster */
 #define INTEL_P4_PRESCOTT		IFM(15, 0x03)
+#define INTEL_P4_CEDARMILL		IFM(15, 0x06) /* Also Xeon Dempsey */
 
 /* Family 19 */
 #define INTEL_PANTHERCOVE_X		IFM(19, 0x01) /* Diamond Rapids */
diff --git a/arch/x86/mm/pat/memtype.c b/arch/x86/mm/pat/memtype.c
index feb8cc6a12bf..25a8ecbad3a2 100644
--- a/arch/x86/mm/pat/memtype.c
+++ b/arch/x86/mm/pat/memtype.c
@@ -43,6 +43,7 @@ 
 #include <linux/fs.h>
 #include <linux/rbtree.h>
 
+#include <asm/cpu_device_id.h>
 #include <asm/cacheflush.h>
 #include <asm/cacheinfo.h>
 #include <asm/processor.h>
@@ -290,9 +291,9 @@  void __init pat_bp_init(void)
 		return;
 	}
 
-	if ((c->x86_vendor == X86_VENDOR_INTEL) &&
-	    (((c->x86 == 0x6) && (c->x86_model <= 0xd)) ||
-	     ((c->x86 == 0xf) && (c->x86_model <= 0x6)))) {
+	if (c->x86_vendor == X86_VENDOR_INTEL &&
+	    ((c->x86_vfm >= INTEL_PENTIUM_PRO && c->x86_vfm <= INTEL_PENTIUM_M_DOTHAN) ||
+	    (c->x86_vfm >= INTEL_P4_WILLAMETTE && c->x86_vfm <= INTEL_P4_CEDARMILL))) {
 		/*
 		 * PAT support with the lower four entries. Intel Pentium 2,
 		 * 3, M, and 4 are affected by PAT errata, which makes the