Commit 83be7d76 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'x86-cpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip

* 'x86-cpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  x86, msr, cpumask: Use struct cpumask rather than the deprecated cpumask_t
  x86, cpuid: Simplify the code in cpuid_open
  x86, cpuid: Remove the bkl from cpuid_open()
  x86, msr: Remove the bkl from msr_open()
  x86: AMD Geode LX optimizations
  x86, msr: Unify rdmsr_on_cpus/wrmsr_on_cpus
parents c2ed69cd 0d0fbbdd
...@@ -406,7 +406,7 @@ config X86_CMPXCHG64 ...@@ -406,7 +406,7 @@ config X86_CMPXCHG64
# generates cmov. # generates cmov.
config X86_CMOV config X86_CMOV
def_bool y def_bool y
depends on (MK8 || MK7 || MCORE2 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MVIAC3_2 || MVIAC7 || MCRUSOE || MEFFICEON || X86_64 || MATOM) depends on (MK8 || MK7 || MCORE2 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MVIAC3_2 || MVIAC7 || MCRUSOE || MEFFICEON || X86_64 || MATOM || MGEODE_LX)
config X86_MINIMUM_CPU_FAMILY config X86_MINIMUM_CPU_FAMILY
int int
......
...@@ -41,7 +41,7 @@ cflags-$(CONFIG_X86_ELAN) += -march=i486 ...@@ -41,7 +41,7 @@ cflags-$(CONFIG_X86_ELAN) += -march=i486
# Geode GX1 support # Geode GX1 support
cflags-$(CONFIG_MGEODEGX1) += -march=pentium-mmx cflags-$(CONFIG_MGEODEGX1) += -march=pentium-mmx
cflags-$(CONFIG_MGEODE_LX) += $(call cc-option,-march=geode,-march=pentium-mmx)
# add at the end to overwrite eventual tuning options from earlier # add at the end to overwrite eventual tuning options from earlier
# cpu entries # cpu entries
cflags-$(CONFIG_X86_GENERIC) += $(call tune,generic,$(call tune,i686)) cflags-$(CONFIG_X86_GENERIC) += $(call tune,generic,$(call tune,i686))
......
...@@ -247,8 +247,8 @@ do { \ ...@@ -247,8 +247,8 @@ do { \
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
int rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h); int rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h);
int wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h); int wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h);
void rdmsr_on_cpus(const cpumask_t *mask, u32 msr_no, struct msr *msrs); void rdmsr_on_cpus(const struct cpumask *mask, u32 msr_no, struct msr *msrs);
void wrmsr_on_cpus(const cpumask_t *mask, u32 msr_no, struct msr *msrs); void wrmsr_on_cpus(const struct cpumask *mask, u32 msr_no, struct msr *msrs);
int rdmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h); int rdmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h);
int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h); int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h);
int rdmsr_safe_regs_on_cpu(unsigned int cpu, u32 regs[8]); int rdmsr_safe_regs_on_cpu(unsigned int cpu, u32 regs[8]);
...@@ -264,12 +264,12 @@ static inline int wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h) ...@@ -264,12 +264,12 @@ static inline int wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
wrmsr(msr_no, l, h); wrmsr(msr_no, l, h);
return 0; return 0;
} }
static inline void rdmsr_on_cpus(const cpumask_t *m, u32 msr_no, static inline void rdmsr_on_cpus(const struct cpumask *m, u32 msr_no,
struct msr *msrs) struct msr *msrs)
{ {
rdmsr_on_cpu(0, msr_no, &(msrs[0].l), &(msrs[0].h)); rdmsr_on_cpu(0, msr_no, &(msrs[0].l), &(msrs[0].h));
} }
static inline void wrmsr_on_cpus(const cpumask_t *m, u32 msr_no, static inline void wrmsr_on_cpus(const struct cpumask *m, u32 msr_no,
struct msr *msrs) struct msr *msrs)
{ {
wrmsr_on_cpu(0, msr_no, msrs[0].l, msrs[0].h); wrmsr_on_cpu(0, msr_no, msrs[0].l, msrs[0].h);
......
...@@ -116,21 +116,16 @@ static int cpuid_open(struct inode *inode, struct file *file) ...@@ -116,21 +116,16 @@ static int cpuid_open(struct inode *inode, struct file *file)
{ {
unsigned int cpu; unsigned int cpu;
struct cpuinfo_x86 *c; struct cpuinfo_x86 *c;
int ret = 0;
lock_kernel();
cpu = iminor(file->f_path.dentry->d_inode); cpu = iminor(file->f_path.dentry->d_inode);
if (cpu >= nr_cpu_ids || !cpu_online(cpu)) { if (cpu >= nr_cpu_ids || !cpu_online(cpu))
ret = -ENXIO; /* No such CPU */ return -ENXIO; /* No such CPU */
goto out;
}
c = &cpu_data(cpu); c = &cpu_data(cpu);
if (c->cpuid_level < 0) if (c->cpuid_level < 0)
ret = -EIO; /* CPUID not supported */ return -EIO; /* CPUID not supported */
out:
unlock_kernel(); return 0;
return ret;
} }
/* /*
......
...@@ -174,21 +174,17 @@ static int msr_open(struct inode *inode, struct file *file) ...@@ -174,21 +174,17 @@ static int msr_open(struct inode *inode, struct file *file)
{ {
unsigned int cpu = iminor(file->f_path.dentry->d_inode); unsigned int cpu = iminor(file->f_path.dentry->d_inode);
struct cpuinfo_x86 *c = &cpu_data(cpu); struct cpuinfo_x86 *c = &cpu_data(cpu);
int ret = 0;
lock_kernel();
cpu = iminor(file->f_path.dentry->d_inode); cpu = iminor(file->f_path.dentry->d_inode);
if (cpu >= nr_cpu_ids || !cpu_online(cpu)) { if (cpu >= nr_cpu_ids || !cpu_online(cpu))
ret = -ENXIO; /* No such CPU */ return -ENXIO; /* No such CPU */
goto out;
}
c = &cpu_data(cpu); c = &cpu_data(cpu);
if (!cpu_has(c, X86_FEATURE_MSR)) if (!cpu_has(c, X86_FEATURE_MSR))
ret = -EIO; /* MSR not supported */ return -EIO; /* MSR not supported */
out:
unlock_kernel(); return 0;
return ret;
} }
/* /*
......
...@@ -71,14 +71,9 @@ int wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h) ...@@ -71,14 +71,9 @@ int wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
} }
EXPORT_SYMBOL(wrmsr_on_cpu); EXPORT_SYMBOL(wrmsr_on_cpu);
/* rdmsr on a bunch of CPUs static void __rwmsr_on_cpus(const struct cpumask *mask, u32 msr_no,
* struct msr *msrs,
* @mask: which CPUs void (*msr_func) (void *info))
* @msr_no: which MSR
* @msrs: array of MSR values
*
*/
void rdmsr_on_cpus(const cpumask_t *mask, u32 msr_no, struct msr *msrs)
{ {
struct msr_info rv; struct msr_info rv;
int this_cpu; int this_cpu;
...@@ -92,11 +87,23 @@ void rdmsr_on_cpus(const cpumask_t *mask, u32 msr_no, struct msr *msrs) ...@@ -92,11 +87,23 @@ void rdmsr_on_cpus(const cpumask_t *mask, u32 msr_no, struct msr *msrs)
this_cpu = get_cpu(); this_cpu = get_cpu();
if (cpumask_test_cpu(this_cpu, mask)) if (cpumask_test_cpu(this_cpu, mask))
__rdmsr_on_cpu(&rv); msr_func(&rv);
smp_call_function_many(mask, __rdmsr_on_cpu, &rv, 1); smp_call_function_many(mask, msr_func, &rv, 1);
put_cpu(); put_cpu();
} }
/* rdmsr on a bunch of CPUs
*
* @mask: which CPUs
* @msr_no: which MSR
* @msrs: array of MSR values
*
*/
void rdmsr_on_cpus(const struct cpumask *mask, u32 msr_no, struct msr *msrs)
{
__rwmsr_on_cpus(mask, msr_no, msrs, __rdmsr_on_cpu);
}
EXPORT_SYMBOL(rdmsr_on_cpus); EXPORT_SYMBOL(rdmsr_on_cpus);
/* /*
...@@ -107,24 +114,9 @@ EXPORT_SYMBOL(rdmsr_on_cpus); ...@@ -107,24 +114,9 @@ EXPORT_SYMBOL(rdmsr_on_cpus);
* @msrs: array of MSR values * @msrs: array of MSR values
* *
*/ */
void wrmsr_on_cpus(const cpumask_t *mask, u32 msr_no, struct msr *msrs) void wrmsr_on_cpus(const struct cpumask *mask, u32 msr_no, struct msr *msrs)
{ {
struct msr_info rv; __rwmsr_on_cpus(mask, msr_no, msrs, __wrmsr_on_cpu);
int this_cpu;
memset(&rv, 0, sizeof(rv));
rv.off = cpumask_first(mask);
rv.msrs = msrs;
rv.msr_no = msr_no;
this_cpu = get_cpu();
if (cpumask_test_cpu(this_cpu, mask))
__wrmsr_on_cpu(&rv);
smp_call_function_many(mask, __wrmsr_on_cpu, &rv, 1);
put_cpu();
} }
EXPORT_SYMBOL(wrmsr_on_cpus); EXPORT_SYMBOL(wrmsr_on_cpus);
......
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