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 6/7] mtrr: introduce HAVE_MTRR_VENDOR_SPECIFIC
Date: Wed, 9 Dec 2009 06:17:52 +0100	[thread overview]
Message-ID: <7-1000-25639-1260344705-9533@rere.qmqm.pl> (raw)
In-Reply-To: <1-1000-25639-1260344705-9533@rere.qmqm.pl>

In case that only generic MTRR implementation is needed, tell gcc
to optimize out tests for other implementations. Also remove .vendor
from mtrr_ops in this configuration.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
 arch/x86/Kconfig                |    3 +++
 arch/x86/Kconfig.cpu            |    3 +++
 arch/x86/kernel/cpu/mtrr/mtrr.h |   12 +++++++++++-
 3 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 32a1918..91422d0 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1367,6 +1367,9 @@ config MTRR
 
 	  See <file:Documentation/x86/mtrr.txt> for more information.
 
+config HAVE_MTRR_VENDOR_SPECIFIC
+	def_bool n
+
 config MTRR_SANITIZER
 	def_bool y
 	prompt "MTRR cleanup support"
diff --git a/arch/x86/Kconfig.cpu b/arch/x86/Kconfig.cpu
index bae1193..d7a6838 100644
--- a/arch/x86/Kconfig.cpu
+++ b/arch/x86/Kconfig.cpu
@@ -439,6 +439,7 @@ config CPU_SUP_CYRIX_32
 	default y
 	bool "Support Cyrix processors" if PROCESSOR_SELECT
 	depends on !64BIT
+	select HAVE_MTRR_VENDOR_SPECIFIC
 	---help---
 	  This enables detection, tunings and quirks for Cyrix processors
 
@@ -464,6 +465,7 @@ config CPU_SUP_AMD
 
 config CPU_SUP_AMD_32
 	def_bool y if CPU_SUP_AMD && !64BIT
+	select HAVE_MTRR_VENDOR_SPECIFIC
 
 config CPU_SUP_CENTAUR
 	default y
@@ -480,6 +482,7 @@ config CPU_SUP_CENTAUR
 
 config CPU_SUP_CENTAUR_32
 	def_bool y if CPU_SUP_CENTAUR && !64BIT
+	select HAVE_MTRR_VENDOR_SPECIFIC
 
 config CPU_SUP_TRANSMETA_32
 	default y
diff --git a/arch/x86/kernel/cpu/mtrr/mtrr.h b/arch/x86/kernel/cpu/mtrr/mtrr.h
index 562e2e3..7a87e65 100644
--- a/arch/x86/kernel/cpu/mtrr/mtrr.h
+++ b/arch/x86/kernel/cpu/mtrr/mtrr.h
@@ -12,7 +12,9 @@
 extern unsigned int mtrr_usage_table[MTRR_MAX_VAR_RANGES];
 
 struct mtrr_ops {
+#ifdef CONFIG_HAVE_MTRR_VENDOR_SPECIFIC
 	u32	vendor;
+#endif
 	void	(*set)(unsigned int reg, unsigned long base,
 		       unsigned long size, mtrr_type type);
 	void	(*set_all)(void);
@@ -32,7 +34,7 @@ extern int generic_validate_add_page(unsigned long base, unsigned long size,
 				     unsigned int type);
 
 extern const struct mtrr_ops generic_mtrr_ops;
-#ifdef CONFIG_X86_32
+#ifdef CONFIG_HAVE_MTRR_VENDOR_SPECIFIC
 extern const struct mtrr_ops amd_mtrr_ops;
 extern const struct mtrr_ops centaur_mtrr_ops;
 extern const struct mtrr_ops cyrix_mtrr_ops;
@@ -60,8 +62,16 @@ void get_mtrr_state(void);
 extern u64 size_or_mask, size_and_mask;
 extern const struct mtrr_ops *mtrr_if;
 
+#ifdef CONFIG_HAVE_MTRR_VENDOR_SPECIFIC
+
 #define is_cpu(vnd)	(mtrr_if && mtrr_if->vendor == X86_VENDOR_##vnd)
 
+#else
+
+#define is_cpu(vnd)	(mtrr_if && 0 == X86_VENDOR_##vnd)
+
+#endif
+
 extern unsigned int num_var_ranges;
 extern u64 mtrr_tom2;
 extern struct mtrr_state_type mtrr_state;
-- 
1.6.4.4


  parent reply	other threads:[~2009-12-09  7:55 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 ` [PATCH 5/7] mtrr: use CONFIG_CPU_SUP_* to select MTRR implementations Michał Mirosław 
2009-12-09  5:17 ` Michał Mirosław  [this message]
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=7-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).