powerpc/tau: Check processor type before enabling TAU interrupt
[ Upstream commit5.4-rM2-2.2.x-imx-squashed5e3119e15f
] According to Freescale's documentation, MPC74XX processors have an erratum that prevents the TAU interrupt from working, so don't try to use it when running on those processors. Fixes:1da177e4c3
("Linux-2.6.12-rc2") Signed-off-by: Finn Thain <fthain@telegraphics.com.au> Tested-by: Stan Johnson <userm57@yahoo.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/c281611544768e758bd58fe812cf702a5bd2d042.1599260540.git.fthain@telegraphics.com.au Signed-off-by: Sasha Levin <sashal@kernel.org>
parent
68a8ec0b02
commit
72407b8d08
|
@ -40,6 +40,8 @@ static struct tau_temp
|
||||||
unsigned char grew;
|
unsigned char grew;
|
||||||
} tau[NR_CPUS];
|
} tau[NR_CPUS];
|
||||||
|
|
||||||
|
static bool tau_int_enable;
|
||||||
|
|
||||||
#undef DEBUG
|
#undef DEBUG
|
||||||
|
|
||||||
/* TODO: put these in a /proc interface, with some sanity checks, and maybe
|
/* TODO: put these in a /proc interface, with some sanity checks, and maybe
|
||||||
|
@ -54,22 +56,13 @@ static struct tau_temp
|
||||||
|
|
||||||
static void set_thresholds(unsigned long cpu)
|
static void set_thresholds(unsigned long cpu)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_TAU_INT
|
u32 maybe_tie = tau_int_enable ? THRM1_TIE : 0;
|
||||||
/*
|
|
||||||
* setup THRM1,
|
|
||||||
* threshold, valid bit, enable interrupts, interrupt when below threshold
|
|
||||||
*/
|
|
||||||
mtspr(SPRN_THRM1, THRM1_THRES(tau[cpu].low) | THRM1_V | THRM1_TIE | THRM1_TID);
|
|
||||||
|
|
||||||
/* setup THRM2,
|
/* setup THRM1, threshold, valid bit, interrupt when below threshold */
|
||||||
* threshold, valid bit, enable interrupts, interrupt when above threshold
|
mtspr(SPRN_THRM1, THRM1_THRES(tau[cpu].low) | THRM1_V | maybe_tie | THRM1_TID);
|
||||||
*/
|
|
||||||
mtspr (SPRN_THRM2, THRM1_THRES(tau[cpu].high) | THRM1_V | THRM1_TIE);
|
/* setup THRM2, threshold, valid bit, interrupt when above threshold */
|
||||||
#else
|
mtspr(SPRN_THRM2, THRM1_THRES(tau[cpu].high) | THRM1_V | maybe_tie);
|
||||||
/* same thing but don't enable interrupts */
|
|
||||||
mtspr(SPRN_THRM1, THRM1_THRES(tau[cpu].low) | THRM1_V | THRM1_TID);
|
|
||||||
mtspr(SPRN_THRM2, THRM1_THRES(tau[cpu].high) | THRM1_V);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void TAUupdate(int cpu)
|
static void TAUupdate(int cpu)
|
||||||
|
@ -142,9 +135,8 @@ static void tau_timeout(void * info)
|
||||||
local_irq_save(flags);
|
local_irq_save(flags);
|
||||||
cpu = smp_processor_id();
|
cpu = smp_processor_id();
|
||||||
|
|
||||||
#ifndef CONFIG_TAU_INT
|
if (!tau_int_enable)
|
||||||
TAUupdate(cpu);
|
TAUupdate(cpu);
|
||||||
#endif
|
|
||||||
|
|
||||||
size = tau[cpu].high - tau[cpu].low;
|
size = tau[cpu].high - tau[cpu].low;
|
||||||
if (size > min_window && ! tau[cpu].grew) {
|
if (size > min_window && ! tau[cpu].grew) {
|
||||||
|
@ -225,6 +217,9 @@ static int __init TAU_init(void)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tau_int_enable = IS_ENABLED(CONFIG_TAU_INT) &&
|
||||||
|
!strcmp(cur_cpu_spec->platform, "ppc750");
|
||||||
|
|
||||||
tau_workq = alloc_workqueue("tau", WQ_UNBOUND, 1, 0);
|
tau_workq = alloc_workqueue("tau", WQ_UNBOUND, 1, 0);
|
||||||
if (!tau_workq)
|
if (!tau_workq)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
@ -234,7 +229,7 @@ static int __init TAU_init(void)
|
||||||
queue_work(tau_workq, &tau_work);
|
queue_work(tau_workq, &tau_work);
|
||||||
|
|
||||||
pr_info("Thermal assist unit using %s, shrink_timer: %d ms\n",
|
pr_info("Thermal assist unit using %s, shrink_timer: %d ms\n",
|
||||||
IS_ENABLED(CONFIG_TAU_INT) ? "interrupts" : "workqueue", shrink_timer);
|
tau_int_enable ? "interrupts" : "workqueue", shrink_timer);
|
||||||
tau_initialized = 1;
|
tau_initialized = 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -219,9 +219,8 @@ config TAU
|
||||||
temperature within 2-4 degrees Celsius. This option shows the current
|
temperature within 2-4 degrees Celsius. This option shows the current
|
||||||
on-die temperature in /proc/cpuinfo if the cpu supports it.
|
on-die temperature in /proc/cpuinfo if the cpu supports it.
|
||||||
|
|
||||||
Unfortunately, on some chip revisions, this sensor is very inaccurate
|
Unfortunately, this sensor is very inaccurate when uncalibrated, so
|
||||||
and in many cases, does not work at all, so don't assume the cpu
|
don't assume the cpu temp is actually what /proc/cpuinfo says it is.
|
||||||
temp is actually what /proc/cpuinfo says it is.
|
|
||||||
|
|
||||||
config TAU_INT
|
config TAU_INT
|
||||||
bool "Interrupt driven TAU driver (DANGEROUS)"
|
bool "Interrupt driven TAU driver (DANGEROUS)"
|
||||||
|
|
Loading…
Reference in New Issue