hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/arch/powerpc/kernel/dbell.c
....@@ -1,12 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Author: Kumar Gala <galak@kernel.crashing.org>
34 *
45 * Copyright 2009 Freescale Semiconductor Inc.
5
- *
6
- * This program is free software; you can redistribute it and/or modify it
7
- * under the terms of the GNU General Public License as published by the
8
- * Free Software Foundation; either version 2 of the License, or (at your
9
- * option) any later version.
106 */
117
128 #include <linux/stddef.h>
....@@ -18,69 +14,16 @@
1814 #include <asm/dbell.h>
1915 #include <asm/irq_regs.h>
2016 #include <asm/kvm_ppc.h>
17
+#include <asm/trace.h>
2118
2219 #ifdef CONFIG_SMP
23
-
24
-/*
25
- * Doorbells must only be used if CPU_FTR_DBELL is available.
26
- * msgsnd is used in HV, and msgsndp is used in !HV.
27
- *
28
- * These should be used by platform code that is aware of restrictions.
29
- * Other arch code should use ->cause_ipi.
30
- *
31
- * doorbell_global_ipi() sends a dbell to any target CPU.
32
- * Must be used only by architectures that address msgsnd target
33
- * by PIR/get_hard_smp_processor_id.
34
- */
35
-void doorbell_global_ipi(int cpu)
36
-{
37
- u32 tag = get_hard_smp_processor_id(cpu);
38
-
39
- kvmppc_set_host_ipi(cpu);
40
- /* Order previous accesses vs. msgsnd, which is treated as a store */
41
- ppc_msgsnd_sync();
42
- ppc_msgsnd(PPC_DBELL_MSGTYPE, 0, tag);
43
-}
44
-
45
-/*
46
- * doorbell_core_ipi() sends a dbell to a target CPU in the same core.
47
- * Must be used only by architectures that address msgsnd target
48
- * by TIR/cpu_thread_in_core.
49
- */
50
-void doorbell_core_ipi(int cpu)
51
-{
52
- u32 tag = cpu_thread_in_core(cpu);
53
-
54
- kvmppc_set_host_ipi(cpu);
55
- /* Order previous accesses vs. msgsnd, which is treated as a store */
56
- ppc_msgsnd_sync();
57
- ppc_msgsnd(PPC_DBELL_MSGTYPE, 0, tag);
58
-}
59
-
60
-/*
61
- * Attempt to cause a core doorbell if destination is on the same core.
62
- * Returns 1 on success, 0 on failure.
63
- */
64
-int doorbell_try_core_ipi(int cpu)
65
-{
66
- int this_cpu = get_cpu();
67
- int ret = 0;
68
-
69
- if (cpumask_test_cpu(cpu, cpu_sibling_mask(this_cpu))) {
70
- doorbell_core_ipi(cpu);
71
- ret = 1;
72
- }
73
-
74
- put_cpu();
75
-
76
- return ret;
77
-}
7820
7921 void doorbell_exception(struct pt_regs *regs)
8022 {
8123 struct pt_regs *old_regs = set_irq_regs(regs);
8224
8325 irq_enter();
26
+ trace_doorbell_entry(regs);
8427
8528 ppc_msgsync();
8629
....@@ -91,6 +34,7 @@
9134
9235 smp_ipi_demux_relaxed(); /* already performed the barrier */
9336
37
+ trace_doorbell_exit(regs);
9438 irq_exit();
9539 set_irq_regs(old_regs);
9640 }