All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

Commit c0104400 authored by Jan Beulich's avatar Jan Beulich

x86: MTRR cleanup

Remove unused and pointless bits from MTRR handling code. Move some
data items into .data.read_mostly. Adjust some types.
Signed-off-by: default avatarJan Beulich <jbeulich@novell.com>
parent dcad2b15
......@@ -2,4 +2,4 @@ obj-$(x86_32) += amd.o
obj-$(x86_32) += cyrix.o
obj-y += generic.o
obj-y += main.o
obj-y += state.o
obj-$(x86_32) += state.o
......@@ -103,7 +103,7 @@ static int amd_validate_add_page(unsigned long base, unsigned long size, unsigne
return 0;
}
static struct mtrr_ops amd_mtrr_ops = {
static const struct mtrr_ops amd_mtrr_ops = {
.vendor = X86_VENDOR_AMD,
.set = amd_set_mtrr,
.get = amd_get_mtrr,
......
......@@ -359,7 +359,7 @@ cyrix_arr_init(void)
}
#endif
static struct mtrr_ops cyrix_mtrr_ops = {
static const struct mtrr_ops cyrix_mtrr_ops = {
.vendor = X86_VENDOR_CYRIX,
// .init = cyrix_arr_init,
.set_all = cyrix_set_all,
......
......@@ -467,7 +467,7 @@ int positive_have_wrcomb(void)
/* generic structure...
*/
struct mtrr_ops generic_mtrr_ops = {
const struct mtrr_ops generic_mtrr_ops = {
.use_intel_if = 1,
.set_all = generic_set_all,
.get = generic_get_mtrr,
......
......@@ -50,16 +50,15 @@
#define get_cpu() smp_processor_id()
#define put_cpu() do {} while(0)
u32 num_var_ranges = 0;
u32 __read_mostly num_var_ranges = 0;
unsigned int *usage_table;
unsigned int *__read_mostly usage_table;
static DEFINE_MUTEX(mtrr_mutex);
u64 size_or_mask, size_and_mask;
u64 __read_mostly size_or_mask;
u64 __read_mostly size_and_mask;
static struct mtrr_ops * mtrr_ops[X86_VENDOR_NUM] = {};
struct mtrr_ops * mtrr_if = NULL;
const struct mtrr_ops *__read_mostly mtrr_if = NULL;
static void set_mtrr(unsigned int reg, unsigned long base,
unsigned long size, mtrr_type type);
......@@ -70,7 +69,7 @@ extern int arr3_protected;
#define arr3_protected 0
#endif
static const char *mtrr_strings[MTRR_NUM_TYPES] =
static const char *const mtrr_strings[MTRR_NUM_TYPES] =
{
"uncachable", /* 0 */
"write-combining", /* 1 */
......@@ -81,16 +80,20 @@ static const char *mtrr_strings[MTRR_NUM_TYPES] =
"write-back", /* 6 */
};
const char *mtrr_attrib_to_str(int x)
static const char *mtrr_attrib_to_str(int x)
{
return (x <= 6) ? mtrr_strings[x] : "?";
}
void set_mtrr_ops(struct mtrr_ops * ops)
#ifndef CONFIG_X86_64
static const struct mtrr_ops *mtrr_ops[X86_VENDOR_NUM];
void set_mtrr_ops(const struct mtrr_ops * ops)
{
if (ops->vendor && ops->vendor < X86_VENDOR_NUM)
mtrr_ops[ops->vendor] = ops;
}
#endif
/* Returns non-zero if we have the write-combining memory type */
static int have_wrcomb(void)
......@@ -472,7 +475,7 @@ static int mtrr_check(unsigned long base, unsigned long size)
* failures and do not wish system log messages to be sent.
*/
int
int __init
mtrr_add(unsigned long base, unsigned long size, unsigned int type,
char increment)
{
......@@ -565,7 +568,7 @@ int mtrr_del_page(int reg, unsigned long base, unsigned long size)
* code.
*/
int
int __init
mtrr_del(int reg, unsigned long base, unsigned long size)
{
if (mtrr_check(base, size))
......@@ -573,9 +576,6 @@ mtrr_del(int reg, unsigned long base, unsigned long size)
return mtrr_del_page(reg, base >> PAGE_SHIFT, size >> PAGE_SHIFT);
}
EXPORT_SYMBOL(mtrr_add);
EXPORT_SYMBOL(mtrr_del);
/* HACK ALERT!
* These should be called implicitly, but we can't yet until all the initcall
* stuff is done...
......
......@@ -52,7 +52,7 @@ extern int generic_get_free_region(unsigned long base, unsigned long size,
extern int generic_validate_add_page(unsigned long base, unsigned long size,
unsigned int type);
extern struct mtrr_ops generic_mtrr_ops;
extern const struct mtrr_ops generic_mtrr_ops;
extern int positive_have_wrcomb(void);
......@@ -70,10 +70,10 @@ void set_mtrr_prepare_save(struct set_mtrr_context *ctxt);
void get_mtrr_state(void);
extern void set_mtrr_ops(struct mtrr_ops * ops);
extern void set_mtrr_ops(const struct mtrr_ops *);
extern u64 size_or_mask, size_and_mask;
extern struct mtrr_ops * mtrr_if;
extern const struct mtrr_ops *mtrr_if;
#define is_cpu(vnd) (mtrr_if && mtrr_if->vendor == X86_VENDOR_##vnd)
#define use_intel() (mtrr_if && mtrr_if->use_intel_if == 1)
......@@ -81,6 +81,5 @@ extern struct mtrr_ops * mtrr_if;
extern unsigned int num_var_ranges;
void mtrr_state_warn(void);
const char *mtrr_attrib_to_str(int x);
void mtrr_wrmsr(unsigned int msr, uint64_t msr_content);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment