From 830ce1f69238136c0197858242f16cf44e0d6cb9 Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Fri, 01 Nov 2024 03:09:37 +0000
Subject: [PATCH] gpio config
---
kernel/arch/arm/mm/context.c | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/kernel/arch/arm/mm/context.c b/kernel/arch/arm/mm/context.c
index b7525b4..0cf14bd 100644
--- a/kernel/arch/arm/mm/context.c
+++ b/kernel/arch/arm/mm/context.c
@@ -39,7 +39,7 @@
#define ASID_FIRST_VERSION (1ULL << ASID_BITS)
#define NUM_USER_ASIDS ASID_FIRST_VERSION
-static DEFINE_RAW_SPINLOCK(cpu_asid_lock);
+static DEFINE_HARD_SPINLOCK(cpu_asid_lock);
static atomic64_t asid_generation = ATOMIC64_INIT(ASID_FIRST_VERSION);
static DECLARE_BITMAP(asid_map, NUM_USER_ASIDS);
@@ -237,8 +237,11 @@
void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk)
{
unsigned long flags;
- unsigned int cpu = smp_processor_id();
+ unsigned int cpu = raw_smp_processor_id();
+ bool need_flush;
u64 asid;
+
+ WARN_ON_ONCE(dovetail_debug() && !hard_irqs_disabled());
if (unlikely(mm->context.vmalloc_seq != init_mm.context.vmalloc_seq))
__check_vmalloc_seq(mm);
@@ -263,15 +266,16 @@
atomic64_set(&mm->context.id, asid);
}
- if (cpumask_test_and_clear_cpu(cpu, &tlb_flush_pending)) {
- local_flush_bp_all();
- local_flush_tlb_all();
- }
-
+ need_flush = cpumask_test_and_clear_cpu(cpu, &tlb_flush_pending);
atomic64_set(&per_cpu(active_asids, cpu), asid);
cpumask_set_cpu(cpu, mm_cpumask(mm));
raw_spin_unlock_irqrestore(&cpu_asid_lock, flags);
+ if (need_flush) {
+ local_flush_bp_all();
+ local_flush_tlb_all();
+ }
+
switch_mm_fastpath:
cpu_switch_mm(mm->pgd, mm);
}
--
Gitblit v1.6.2