Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1313942 > unrolled thread

[PATCH] x86: use enum cpuid_leafs instead of magic numbers

Started byHuaitong Han <huaitong.han@intel.com>
First post2016-01-21 07:30 +0100
Last post2016-01-21 10:40 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] x86: use enum cpuid_leafs instead of magic numbers Huaitong Han <huaitong.han@intel.com> - 2016-01-21 07:30 +0100
    Re: [PATCH] x86: use enum cpuid_leafs instead of magic numbers Borislav Petkov <bp@alien8.de> - 2016-01-21 10:40 +0100

#1313942 — [PATCH] x86: use enum cpuid_leafs instead of magic numbers

FromHuaitong Han <huaitong.han@intel.com>
Date2016-01-21 07:30 +0100
Subject[PATCH] x86: use enum cpuid_leafs instead of magic numbers
Message-ID<qTgUO-1hr-5@gated-at.bofh.it>
Signed-off-by: Huaitong Han <huaitong.han@intel.com>
---
 arch/x86/include/asm/elf.h | 2 +-
 arch/x86/kernel/mpparse.c  | 2 +-
 arch/x86/lguest/boot.c     | 2 +-
 arch/x86/xen/enlighten.c   | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/include/asm/elf.h b/arch/x86/include/asm/elf.h
index 1514753..15340e3 100644
--- a/arch/x86/include/asm/elf.h
+++ b/arch/x86/include/asm/elf.h
@@ -256,7 +256,7 @@ extern int force_personality32;
    instruction set this CPU supports.  This could be done in user space,
    but it's not easy, and we've already done it here.  */
 
-#define ELF_HWCAP		(boot_cpu_data.x86_capability[0])
+#define ELF_HWCAP		(boot_cpu_data.x86_capability[CPUID_1_EDX])
 
 /* This yields a string that ld.so will use to load implementation
    specific libraries for optimization.  This is more specific in
diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c
index 30ca760..97340f2 100644
--- a/arch/x86/kernel/mpparse.c
+++ b/arch/x86/kernel/mpparse.c
@@ -408,7 +408,7 @@ static inline void __init construct_default_ISA_mptable(int mpc_default_type)
 	processor.cpuflag = CPU_ENABLED;
 	processor.cpufeature = (boot_cpu_data.x86 << 8) |
 	    (boot_cpu_data.x86_model << 4) | boot_cpu_data.x86_mask;
-	processor.featureflag = boot_cpu_data.x86_capability[0];
+	processor.featureflag = boot_cpu_data.x86_capability[CPUID_1_EDX];
 	processor.reserved[0] = 0;
 	processor.reserved[1] = 0;
 	for (i = 0; i < 2; i++) {
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c
index 4ba229a..a9033ae 100644
--- a/arch/x86/lguest/boot.c
+++ b/arch/x86/lguest/boot.c
@@ -1535,7 +1535,7 @@ __init void lguest_init(void)
 	 */
 	cpu_detect(&new_cpu_data);
 	/* head.S usually sets up the first capability word, so do it here. */
-	new_cpu_data.x86_capability[0] = cpuid_edx(1);
+	new_cpu_data.x86_capability[CPUID_1_EDX] = cpuid_edx(1);
 
 	/* Math is always hard! */
 	set_cpu_cap(&new_cpu_data, X86_FEATURE_FPU);
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index d09e4c9..2c26108 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1654,7 +1654,7 @@ asmlinkage __visible void __init xen_start_kernel(void)
 	cpu_detect(&new_cpu_data);
 	set_cpu_cap(&new_cpu_data, X86_FEATURE_FPU);
 	new_cpu_data.wp_works_ok = 1;
-	new_cpu_data.x86_capability[0] = cpuid_edx(1);
+	new_cpu_data.x86_capability[CPUID_1_EDX] = cpuid_edx(1);
 #endif
 
 	if (xen_start_info->mod_start) {
-- 
2.4.3

[toc] | [next] | [standalone]


#1314031

FromBorislav Petkov <bp@alien8.de>
Date2016-01-21 10:40 +0100
Message-ID<qTjSG-3ll-5@gated-at.bofh.it>
In reply to#1313942
On Thu, Jan 21, 2016 at 02:28:53PM +0800, Huaitong Han wrote:
> Signed-off-by: Huaitong Han <huaitong.han@intel.com>
> ---
>  arch/x86/include/asm/elf.h | 2 +-
>  arch/x86/kernel/mpparse.c  | 2 +-
>  arch/x86/lguest/boot.c     | 2 +-
>  arch/x86/xen/enlighten.c   | 2 +-
>  4 files changed, 4 insertions(+), 4 deletions(-)

Please add a commit message, albeit a trivial one.

Looks ok otherwise.

Thanks.

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web