From 37f49e37ab4cb5d0bc4c60eb5c6d4dd57db767bb Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Fri, 10 May 2024 07:44:59 +0000
Subject: [PATCH] gmac get mac form eeprom
---
kernel/drivers/soc/rockchip/fiq_debugger/fiq_debugger.c | 47 +++++++++++++++++++++++++++++++++--------------
1 files changed, 33 insertions(+), 14 deletions(-)
diff --git a/kernel/drivers/soc/rockchip/fiq_debugger/fiq_debugger.c b/kernel/drivers/soc/rockchip/fiq_debugger/fiq_debugger.c
index e36d211..4647144 100644
--- a/kernel/drivers/soc/rockchip/fiq_debugger/fiq_debugger.c
+++ b/kernel/drivers/soc/rockchip/fiq_debugger/fiq_debugger.c
@@ -50,6 +50,7 @@
#endif
#include <linux/uaccess.h>
+#include <linux/cpuhotplug.h>
#include "fiq_debugger.h"
#include "fiq_debugger_priv.h"
@@ -148,10 +149,7 @@
static bool initial_console_enable;
#endif
-#ifdef CONFIG_FIQ_DEBUGGER_TRUST_ZONE
-static struct fiq_debugger_state *state_tf;
-#endif
-
+static struct fiq_debugger_state *g_state;
static bool fiq_kgdb_enable;
static bool fiq_debugger_disable;
@@ -263,10 +261,11 @@
{
char buf[512];
size_t len;
- struct kmsg_dumper_iter dumper = { .active = true };
+ struct kmsg_dumper dumper = { .active = true };
- kmsg_dump_rewind(&dumper);
- while (kmsg_dump_get_line(&dumper, true, buf,
+
+ kmsg_dump_rewind_nolock(&dumper);
+ while (kmsg_dump_get_line_nolock(&dumper, true, buf,
sizeof(buf) - 1, &len)) {
buf[len] = 0;
fiq_debugger_puts(state, buf);
@@ -1076,7 +1075,7 @@
#ifdef CONFIG_FIQ_DEBUGGER_TRUST_ZONE
void fiq_debugger_fiq(void *regs, u32 cpu)
{
- struct fiq_debugger_state *state = state_tf;
+ struct fiq_debugger_state *state = g_state;
bool need_irq;
if (!state)
@@ -1443,6 +1442,18 @@
return 0;
}
+static int fiq_debugger_cpu_offine_migrate_irq(unsigned int cpu)
+{
+ if (g_state && cpu == g_state->current_cpu) {
+ unsigned int new_cpu = cpumask_any_but(cpu_online_mask, cpu);
+
+ if (new_cpu < nr_cpu_ids)
+ g_state->current_cpu = new_cpu;
+ }
+
+ return 0;
+}
+
static int fiq_debugger_probe(struct platform_device *pdev)
{
int ret;
@@ -1450,6 +1461,7 @@
struct fiq_debugger_state *state;
int fiq;
int uart_irq;
+ enum cpuhp_state cs = -1;
if (pdev->id >= MAX_FIQ_DEBUGGER_PORTS)
return -EINVAL;
@@ -1555,7 +1567,7 @@
pr_err("%s: could not install nmi irq handler\n", __func__);
irq_clear_status_flags(state->uart_irq, IRQ_NOAUTOEN);
ret = request_irq(state->uart_irq, fiq_debugger_uart_irq,
- IRQF_NO_SUSPEND, "debug", state);
+ IRQF_NO_SUSPEND | IRQF_NOBALANCING, "debug", state);
} else {
enable_nmi(state->uart_irq);
}
@@ -1569,6 +1581,15 @@
* can.
*/
enable_irq_wake(state->uart_irq);
+
+ ret = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN,
+ "soc/fiq_debugger",
+ NULL,
+ fiq_debugger_cpu_offine_migrate_irq);
+ if (ret < 0)
+ pr_err("%s: could not setup cpu offine handler\n", __func__);
+ else
+ cs = ret;
}
if (state->signal_irq >= 0) {
@@ -1599,10 +1620,6 @@
if (state->no_sleep)
fiq_debugger_handle_wakeup(state);
-#ifdef CONFIG_FIQ_DEBUGGER_TRUST_ZONE
- state_tf = state;
-#endif
-
if (pdata->uart_init) {
ret = pdata->uart_init(pdev);
if (ret)
@@ -1629,7 +1646,7 @@
/* switch to cpu0 default */
fiq_debugger_switch_cpu(state, 0);
-
+ g_state = state;
return 0;
err_register_irq:
@@ -1640,6 +1657,8 @@
clk_disable(state->clk);
if (state->clk)
clk_put(state->clk);
+ if (cs >= 0)
+ cpuhp_remove_state_nocalls(cs);
wakeup_source_remove(&state->debugger_wake_src);
__pm_relax(&state->debugger_wake_src);
platform_set_drvdata(pdev, NULL);
--
Gitblit v1.6.2