acpi throttling: Use this_cpu_has and simplify code current cpu
With the this_cpu_xx we no longer need to pass an acpi structure to the msr management code. Simplifies code and improves performance. NOTE: This code is x86 specific (see #ifdef CONFIG_X86) but not under arch/x86. Signed-off-by: Christoph Lameter <cl@linux.com> Acked-by: Tejun Heo <tj@kernel.org> Signed-off-by: Tejun Heo <tj@kernel.org>
This commit is contained in:
parent
fe5042138b
commit
9d42a53e0f
|
@ -710,20 +710,14 @@ static int acpi_processor_get_throttling_fadt(struct acpi_processor *pr)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_X86
|
#ifdef CONFIG_X86
|
||||||
static int acpi_throttling_rdmsr(struct acpi_processor *pr,
|
static int acpi_throttling_rdmsr(u64 *value)
|
||||||
u64 *value)
|
|
||||||
{
|
{
|
||||||
struct cpuinfo_x86 *c;
|
|
||||||
u64 msr_high, msr_low;
|
u64 msr_high, msr_low;
|
||||||
unsigned int cpu;
|
|
||||||
u64 msr = 0;
|
u64 msr = 0;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
cpu = pr->id;
|
if ((this_cpu_read(cpu_info.x86_vendor) != X86_VENDOR_INTEL) ||
|
||||||
c = &cpu_data(cpu);
|
!this_cpu_has(X86_FEATURE_ACPI)) {
|
||||||
|
|
||||||
if ((c->x86_vendor != X86_VENDOR_INTEL) ||
|
|
||||||
!cpu_has(c, X86_FEATURE_ACPI)) {
|
|
||||||
printk(KERN_ERR PREFIX
|
printk(KERN_ERR PREFIX
|
||||||
"HARDWARE addr space,NOT supported yet\n");
|
"HARDWARE addr space,NOT supported yet\n");
|
||||||
} else {
|
} else {
|
||||||
|
@ -738,18 +732,13 @@ static int acpi_throttling_rdmsr(struct acpi_processor *pr,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int acpi_throttling_wrmsr(struct acpi_processor *pr, u64 value)
|
static int acpi_throttling_wrmsr(u64 value)
|
||||||
{
|
{
|
||||||
struct cpuinfo_x86 *c;
|
|
||||||
unsigned int cpu;
|
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
u64 msr;
|
u64 msr;
|
||||||
|
|
||||||
cpu = pr->id;
|
if ((this_cpu_read(cpu_info.x86_vendor) != X86_VENDOR_INTEL) ||
|
||||||
c = &cpu_data(cpu);
|
!this_cpu_has(X86_FEATURE_ACPI)) {
|
||||||
|
|
||||||
if ((c->x86_vendor != X86_VENDOR_INTEL) ||
|
|
||||||
!cpu_has(c, X86_FEATURE_ACPI)) {
|
|
||||||
printk(KERN_ERR PREFIX
|
printk(KERN_ERR PREFIX
|
||||||
"HARDWARE addr space,NOT supported yet\n");
|
"HARDWARE addr space,NOT supported yet\n");
|
||||||
} else {
|
} else {
|
||||||
|
@ -761,15 +750,14 @@ static int acpi_throttling_wrmsr(struct acpi_processor *pr, u64 value)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static int acpi_throttling_rdmsr(struct acpi_processor *pr,
|
static int acpi_throttling_rdmsr(u64 *value)
|
||||||
u64 *value)
|
|
||||||
{
|
{
|
||||||
printk(KERN_ERR PREFIX
|
printk(KERN_ERR PREFIX
|
||||||
"HARDWARE addr space,NOT supported yet\n");
|
"HARDWARE addr space,NOT supported yet\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int acpi_throttling_wrmsr(struct acpi_processor *pr, u64 value)
|
static int acpi_throttling_wrmsr(u64 value)
|
||||||
{
|
{
|
||||||
printk(KERN_ERR PREFIX
|
printk(KERN_ERR PREFIX
|
||||||
"HARDWARE addr space,NOT supported yet\n");
|
"HARDWARE addr space,NOT supported yet\n");
|
||||||
|
@ -801,7 +789,7 @@ static int acpi_read_throttling_status(struct acpi_processor *pr,
|
||||||
ret = 0;
|
ret = 0;
|
||||||
break;
|
break;
|
||||||
case ACPI_ADR_SPACE_FIXED_HARDWARE:
|
case ACPI_ADR_SPACE_FIXED_HARDWARE:
|
||||||
ret = acpi_throttling_rdmsr(pr, value);
|
ret = acpi_throttling_rdmsr(value);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printk(KERN_ERR PREFIX "Unknown addr space %d\n",
|
printk(KERN_ERR PREFIX "Unknown addr space %d\n",
|
||||||
|
@ -834,7 +822,7 @@ static int acpi_write_throttling_state(struct acpi_processor *pr,
|
||||||
ret = 0;
|
ret = 0;
|
||||||
break;
|
break;
|
||||||
case ACPI_ADR_SPACE_FIXED_HARDWARE:
|
case ACPI_ADR_SPACE_FIXED_HARDWARE:
|
||||||
ret = acpi_throttling_wrmsr(pr, value);
|
ret = acpi_throttling_wrmsr(value);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printk(KERN_ERR PREFIX "Unknown addr space %d\n",
|
printk(KERN_ERR PREFIX "Unknown addr space %d\n",
|
||||||
|
|
Loading…
Reference in New Issue