lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6-1000-25639-1260344705-9533@rere.qmqm.pl>
Date:	Wed, 9 Dec 2009 06:10:43 +0100
From:	Michał Mirosław  
	<mirq-linux@...e.qmqm.pl>
To:	linux-kernel@...r.kernel.org
Cc:	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>, x86@...nel.org
Subject: [PATCH 5/7] mtrr: use CONFIG_CPU_SUP_* to select MTRR implementations

Use CONFIG_CPU_SUP_* to select MTRR implementations. We let gcc
optimize out the empty switch statement if only generic implementation
is wanted.

Signed-off-by: Michał Mirosław <mirq-linux@...e.qmqm.pl>
---
 arch/x86/kernel/cpu/mtrr/Makefile |    4 +++-
 arch/x86/kernel/cpu/mtrr/main.c   |   10 ++++++++--
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/cpu/mtrr/Makefile b/arch/x86/kernel/cpu/mtrr/Makefile
index f4361b5..d6e8a92 100644
--- a/arch/x86/kernel/cpu/mtrr/Makefile
+++ b/arch/x86/kernel/cpu/mtrr/Makefile
@@ -1,3 +1,5 @@
 obj-y		:= main.o if.o generic.o state.o cleanup.o
-obj-$(CONFIG_X86_32) += amd.o cyrix.o centaur.o
+obj-$(CONFIG_CPU_SUP_AMD_32) += amd.o
+obj-$(CONFIG_CPU_SUP_CENTAUR_32) += centaur.o
+obj-$(CONFIG_CPU_SUP_CYRIX_32) += cyrix.o
 
diff --git a/arch/x86/kernel/cpu/mtrr/main.c b/arch/x86/kernel/cpu/mtrr/main.c
index bc3436e..737780a 100644
--- a/arch/x86/kernel/cpu/mtrr/main.c
+++ b/arch/x86/kernel/cpu/mtrr/main.c
@@ -648,6 +648,7 @@ void __init mtrr_bp_init(void)
 
 			size_or_mask = ~((1ULL << (phys_addr - PAGE_SHIFT)) - 1);
 			size_and_mask = ~size_or_mask & 0xfffff00000ULL;
+#ifdef CONFIG_CPU_SUP_CENTAUR
 		} else if (boot_cpu_data.x86_vendor == X86_VENDOR_CENTAUR &&
 			   boot_cpu_data.x86 == 6) {
 			/*
@@ -657,10 +658,11 @@ void __init mtrr_bp_init(void)
 			size_or_mask = 0xfff00000;		/* 32 bits */
 			size_and_mask = 0;
 			phys_addr = 32;
+#endif
 		}
 	} else {
-#ifdef CONFIG_X86_32
 		switch (boot_cpu_data.x86_vendor) {
+#ifdef CONFIG_CPU_SUP_AMD_32
 		case X86_VENDOR_AMD:
 			if (cpu_has_k6_mtrr) {
 				/* Pre-Athlon (K6) AMD CPU MTRRs */
@@ -669,6 +671,8 @@ void __init mtrr_bp_init(void)
 				size_and_mask = 0;
 			}
 			break;
+#endif
+#ifdef CONFIG_CPU_SUP_CENTAUR_32
 		case X86_VENDOR_CENTAUR:
 			if (cpu_has_centaur_mcr) {
 				mtrr_if = &centaur_mtrr_ops;
@@ -676,6 +680,8 @@ void __init mtrr_bp_init(void)
 				size_and_mask = 0;
 			}
 			break;
+#endif
+#ifdef CONFIG_CPU_SUP_CYRIX_32
 		case X86_VENDOR_CYRIX:
 			if (cpu_has_cyrix_arr) {
 				mtrr_if = &cyrix_mtrr_ops;
@@ -683,10 +689,10 @@ void __init mtrr_bp_init(void)
 				size_and_mask = 0;
 			}
 			break;
+#endif
 		default:
 			break;
 		}
-#endif
 	}
 
 	if (mtrr_if) {
-- 
1.6.4.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ