Skip to contentSkip to conversation

x86/CPU: Add native CPUID variants returning a single datum

PATCH In review Evalds Iodzevics 2 participants 8 messages Apr 19, 2020 – Apr 20, 2020 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 x86/CPU: Add native CPUID variants returning a single datum

From: Borislav Petkov <[email protected]>

... similarly to the cpuid_<reg>() variants.

---
 arch/x86/include/asm/processor.h | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
arch/x86/include/asm/processor.h +18 -0
index cac54e61c299..048942d53988 100644
@@ -212,6 +212,24 @@ static inline void native_cpuid(unsigned int *eax, unsigned int *ebx,
 	    : "memory");
 }
 
+#define native_cpuid_reg(reg)					\
+static inline unsigned int native_cpuid_##reg(unsigned int op)	\
+{								\
+	unsigned int eax = op, ebx, ecx = 0, edx;		\
+								\
+	native_cpuid(&eax, &ebx, &ecx, &edx);			\
+								\
+	return reg;						\
+}
+
+/*
+ * Native CPUID functions returning a single datum.
+ */
+native_cpuid_reg(eax)
+native_cpuid_reg(ebx)
+native_cpuid_reg(ecx)
+native_cpuid_reg(edx)
+
 static inline void load_cr3(pgd_t *pgdir)
 {
 	write_cr3(__pa(pgdir));
Signature · 1 line
2.17.4
#1 lore raw

PATCH 2/2 Fixed broken microcode early loading on 32 bit platforms because it always jumps past cpuid in sync_core() as data structure boot_cpu_data are not populated so early in boot. This is for 4.4. Should be done for 4.9 too

---
 arch/x86/include/asm/microcode_intel.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/include/asm/microcode_intel.h +1 -1
index 90343ba50485..92ce9c8a508b 100644
@@ -60,7 +60,7 @@ static inline u32 intel_get_microcode_revision(void)
 	native_wrmsrl(MSR_IA32_UCODE_REV, 0);
 
 	/* As documented in the SDM: Do a CPUID 1 here */
-	sync_core();
+	native_cpuid_eax(1);
 
 	/* get the current revision from MSR 0x8B */
 	native_rdmsr(MSR_IA32_UCODE_REV, dummy, rev);
Signature · 1 line
2.17.4
#2 lore raw

Re: [PATCH 2/2] Fixed broken microcode early loading on 32 bit platforms because it always jumps past cpuid in sync_core() as data structure boot_cpu_data are not populated so early in boot. This is for 4.4. Should be done for 4.9 too

Quoted 3 lines · Evalds Iodzevics
---
 arch/x86/include/asm/microcode_intel.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Your subject line is really confused :(

#3 lore raw

Re: [PATCH 2/2] Fixed broken microcode early loading on 32 bit platforms because it always jumps past cpuid in sync_core() as data structure boot_cpu_data are not populated so early in boot. This is for 4.4. Should be done for 4.9 too

Yeah, basically its a fix for early microcode load on x86 for 4.4 longterm Just tried to say same problem exists on 4.9 too

Quoted 8 lines · Greg KH
Quoted 3 lines · Evalds Iodzevics
---
 arch/x86/include/asm/microcode_intel.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Your subject line is really confused :(

#4 lore raw

Re: [PATCH 2/2] Fixed broken microcode early loading on 32 bit platforms because it always jumps past cpuid in sync_core() as data structure boot_cpu_data are not populated so early in boot. This is for 4.4. Should be done for 4.9 too

Quoted 2 lines · Evalds Iodzevics

Yeah, basically its a fix for early microcode load on x86 for 4.4 longterm Just tried to say same problem exists on 4.9 too

<formletter>

This is not the correct way to submit patches for inclusion in the stable kernel tree. Please read:
https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.

</formletter>

#6 lore raw

The second patch depends on this commit by Borislav so i included this, probably I should have just mentioned it in my comment?

Quoted 14 lines · Greg KH
Quoted 10 lines · Evalds Iodzevics

From: Borislav Petkov <[email protected]>

... similarly to the cpuid_<reg>() variants.

---
 arch/x86/include/asm/processor.h | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

Why are you resending patches from someone else?

#7 lore raw

A: http://en.wikipedia.org/wiki/Top_post
Q: Were do I find info about this thing called top-posting?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

A: No.
Q: Should I include quotations after my reply?

http://daringfireball.net/2007/07/on_top

Quoted 2 lines · Evalds Iodzevics

The second patch depends on this commit by Borislav so i included this, probably I should have just mentioned it in my comment?

I really do not understand this sentence at all. I have no context as to what you are trying to do.

greg k-h