SpacemiT: legacy: Add hwmon support and fix sigaltstack
This commit is contained in:
parent
e81998fa81
commit
c25ed85fe9
@ -0,0 +1,45 @@
|
||||
From fac08e8e9cfe99d24f498e239b6adf9fefdbd1fd Mon Sep 17 00:00:00 2001
|
||||
From: Andy Chiu <andy.chiu@sifive.com>
|
||||
Date: Thu, 6 Jun 2024 03:25:25 -0400
|
||||
Subject: [PATCH] riscv: signal: fix sigaltstack frame size checking
|
||||
|
||||
The alternative stack checking in get_sigframe introduced by the Vector
|
||||
support is not needed and has a problem. It is not needed as we have
|
||||
already validate it at the beginning of the function if we are already
|
||||
on an altstack. If not, the size of an altstack is always validated at
|
||||
its allocation stage with sigaltstack_size_valid().
|
||||
|
||||
Besides, we must only regard the size of an altstack if the handler of a
|
||||
signal is registered with SA_ONSTACK. So, blindly checking overflow of
|
||||
an altstack if sas_ss_size not equals to zero will check against wrong
|
||||
signal handlers if only a subset of signals are registered with
|
||||
SA_ONSTACK.
|
||||
|
||||
Fixes: 8ee0b41 ("riscv: signal: Add sigcontext save/restore for vector")
|
||||
Reported-by: Prashanth Swaminathan <prashanthsw@google.com>
|
||||
Signed-off-by: Andy Chiu <andy.chiu@sifive.com>
|
||||
---
|
||||
arch/riscv/kernel/signal.c | 7 -------
|
||||
1 file changed, 7 deletions(-)
|
||||
|
||||
diff --git a/arch/riscv/kernel/signal.c b/arch/riscv/kernel/signal.c
|
||||
index ffde81cfa..f5348292a 100644
|
||||
--- a/arch/riscv/kernel/signal.c
|
||||
+++ b/arch/riscv/kernel/signal.c
|
||||
@@ -309,13 +309,6 @@ static inline void __user *get_sigframe(struct ksignal *ksig,
|
||||
/* Align the stack frame. */
|
||||
sp &= ~0xfUL;
|
||||
|
||||
- /*
|
||||
- * Fail if the size of the altstack is not large enough for the
|
||||
- * sigframe construction.
|
||||
- */
|
||||
- if (current->sas_ss_size && sp < current->sas_ss_sp)
|
||||
- return (void __user __force *)-1UL;
|
||||
-
|
||||
return (void __user *)sp;
|
||||
}
|
||||
|
||||
--
|
||||
2.39.2
|
||||
|
||||
@ -0,0 +1,56 @@
|
||||
From daf6e1688618c92ef2c873c9baaafb5262fcb4d4 Mon Sep 17 00:00:00 2001
|
||||
From: Luca Barbato <noone@nowhere.com>
|
||||
Date: Thu, 6 Jun 2024 03:49:34 -0400
|
||||
Subject: [PATCH] add minimal hwmon support
|
||||
|
||||
Signed-off-by: Luca Barbato
|
||||
---
|
||||
drivers/thermal/k1x-thermal.c | 22 ++++++++++++++++------
|
||||
1 file changed, 16 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/drivers/thermal/k1x-thermal.c b/drivers/thermal/k1x-thermal.c
|
||||
index 02b8a577d..7e10b5b6e 100644
|
||||
--- a/drivers/thermal/k1x-thermal.c
|
||||
+++ b/drivers/thermal/k1x-thermal.c
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <linux/thermal.h>
|
||||
#include <linux/reset.h>
|
||||
#include "k1x-thermal.h"
|
||||
+#include "thermal_hwmon.h"
|
||||
|
||||
#define MAX_SENSOR_NUMBER 5
|
||||
|
||||
@@ -286,15 +287,24 @@ static int k1x_thermal_probe(struct platform_device *pdev)
|
||||
for (i = s->sr[0]; i <= s->sr[1]; ++i) {
|
||||
s->sdesc[i].base = s->base;
|
||||
|
||||
- s->sdesc[i].tzd = devm_thermal_of_zone_register(dev,
|
||||
- i, s->sdesc + i, &k1x_of_thermal_ops);
|
||||
- if (IS_ERR(s->sdesc[i].tzd)) {
|
||||
- ret = PTR_ERR(s->sdesc[i].tzd);
|
||||
- dev_err(dev, "faild to register sensor id %d: %d\n",
|
||||
- i, ret);
|
||||
+ struct thermal_zone_device *tzd =
|
||||
+ devm_thermal_of_zone_register(dev, i, s->sdesc + i, &k1x_of_thermal_ops);
|
||||
+ if (IS_ERR(tzd)) {
|
||||
+ ret = PTR_ERR(tzd);
|
||||
+ dev_err_probe(dev, ret, "faild to register sensor id %d", i);
|
||||
return ret;
|
||||
}
|
||||
|
||||
+ tzd->tzp->no_hwmon = false;
|
||||
+
|
||||
+ ret = devm_thermal_add_hwmon_sysfs(tzd);
|
||||
+ if (ret < 0) {
|
||||
+ dev_err_probe(dev, ret, "failed to register the hwmon entry");
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ s->sdesc[i].tzd = tzd;
|
||||
+
|
||||
ret = devm_request_threaded_irq(dev, s->irq, k1x_thermal_irq,
|
||||
k1x_thermal_irq_thread, IRQF_SHARED,
|
||||
dev_name(&s->sdesc[i].tzd->device), s->sdesc + i);
|
||||
--
|
||||
2.39.2
|
||||
|
||||
Loading…
Reference in New Issue
Block a user