linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michał Mirosław " <mirq-linux@rere.qmqm.pl>
To: linux-kernel@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org
Subject: [PATCH 5/7] mtrr: use CONFIG_CPU_SUP_* to select MTRR implementations
Date: Wed, 9 Dec 2009 06:10:43 +0100	[thread overview]
Message-ID: <6-1000-25639-1260344705-9533@rere.qmqm.pl> (raw)
In-Reply-To: <1-1000-25639-1260344705-9533@rere.qmqm.pl>

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@rere.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


  parent reply	other threads:[~2009-12-09  7:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-09  7:34 [PATCH 0/7] mtrr: cleanups and CONFIG_EMBEDDED usage Michał Mirosław 
2009-12-09  4:51 ` [PATCH 1/7] x86/mtrr: Remove mtrr_ops[] Michał Mirosław 
2009-12-09  4:57 ` [PATCH 2/7] mtrr: constify struct mtrr_ops Michał Mirosław 
2009-12-09  5:00 ` [PATCH 3/7] mtrr: Remove use_intel() Michał Mirosław 
2009-12-09  8:10   ` Yinghai Lu
2009-12-09  8:34     ` Michał Mirosław
2009-12-09  8:52     ` Ingo Molnar
2009-12-09 18:32       ` Yinghai Lu
2009-12-09 19:03         ` H. Peter Anvin
2009-12-09  5:04 ` [PATCH 4/7] x86/Kconfig.cpu: add CPU_SUP_AMD_32 and CPU_SUP_CENTAUR_32 Michał Mirosław 
2009-12-09  5:10 ` Michał Mirosław  [this message]
2009-12-09  5:17 ` [PATCH 6/7] mtrr: introduce HAVE_MTRR_VENDOR_SPECIFIC Michał Mirosław 
2009-12-09  7:32 ` [PATCH 7/7] mtrr: mark mtrr_if as __read_mostly Michał Mirosław 

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6-1000-25639-1260344705-9533@rere.qmqm.pl \
    --to=mirq-linux@rere.qmqm.pl \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).