Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
microblaze: Enable experimental SMP functionality
This code requires: - MicroBlaze v8.50.a or later - AXI Intc v1.04.a or later - System cache v2.00.a or later - Per cpu interrupt controllers - One global timer followed by per cpu timers - Interrupt controllers with 4 software interrupts for ipi - Identical interrupt assignments to all interrupt controllers - Secondary cpu cores in sleep mode, jumping to kernel at wakeup Secondary cpus are wakeup through software interrupts which are enabled when interrupt controller driver is probed. All interrupts are setup as per cpu one because there is missing handling for distribution among cpus. Allocating certain irq to certain cpu is not supported now. Signed-off-by: Stefan Asserhall <stefan.asserhall@xilinx.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com> State: pending [michals: v5.15 update microblaze: Add missing cacheflush.h for smp.c ]
- Loading branch information
Showing
12 changed files
with
716 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| /* SPDX-License-Identifier: GPL-2.0-only */ | ||
| /* | ||
| * Copyright (C) 2020 Xilinx, Inc. | ||
| * Copyright (C) 2012 ARM Ltd. | ||
| */ | ||
| #ifndef _ASM_MICROBLAZE_HARDIRQ_H | ||
| #define _ASM_MICROBLAZE_HARDIRQ_H | ||
|
|
||
| # ifndef CONFIG_SMP | ||
| #include <asm-generic/hardirq.h> | ||
| # else | ||
| #include <linux/cache.h> | ||
| #include <linux/percpu.h> | ||
| #include <linux/threads.h> | ||
| #include <asm/irq.h> | ||
| #include <linux/irq.h> | ||
|
|
||
| typedef struct { | ||
| unsigned int __softirq_pending; | ||
| unsigned int ipi_irqs[MICROBLAZE_NUM_IPIS]; | ||
| } ____cacheline_aligned irq_cpustat_t; | ||
|
|
||
| #define __ARCH_IRQ_STAT | ||
| DECLARE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat); | ||
|
|
||
| #define local_softirq_pending_ref irq_stat.__softirq_pending | ||
|
|
||
| #define __inc_irq_stat(cpu, member) this_cpu_inc(irq_stat.member) | ||
| #define __get_irq_stat(cpu, member) this_cpu_read(irq_stat.member) | ||
|
|
||
| u64 smp_irq_stat_cpu(unsigned int cpu); | ||
| #define arch_irq_stat_cpu smp_irq_stat_cpu | ||
|
|
||
| extern unsigned long irq_err_count; | ||
|
|
||
| static inline void ack_bad_irq(unsigned int irq) | ||
| { | ||
| irq_err_count++; | ||
| } | ||
| # endif /* CONFIG_MMU */ | ||
|
|
||
| #endif /* _ASM_MICROBLAZE_HARDIRQ_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| /* SPDX-License-Identifier: GPL-2.0-or-later */ | ||
| /* | ||
| * smp.h: MicroBlaze-specific SMP code | ||
| * | ||
| * Original was a copy of PowerPC smp.h, which was a copy of | ||
| * sparc smp.h. Now heavily modified for PPC. | ||
| * | ||
| * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) | ||
| * Copyright (C) 1996-2001 Cort Dougan <cort@fsmlabs.com> | ||
| * Copyright (C) 2013-2020 Xilinx, Inc. | ||
| */ | ||
|
|
||
| #ifndef _ASM_MICROBLAZE_SMP_H | ||
| #define _ASM_MICROBLAZE_SMP_H | ||
|
|
||
| #include <linux/threads.h> | ||
| #include <linux/cpumask.h> | ||
| #include <linux/kernel.h> | ||
|
|
||
| #include <asm/percpu.h> | ||
|
|
||
| void handle_IPI(int ipinr, struct pt_regs *regs); | ||
|
|
||
| void set_smp_cross_call(void (*)(unsigned int, unsigned int)); | ||
|
|
||
| void smp_send_debugger_break(void); | ||
|
|
||
| #define raw_smp_processor_id() (current_thread_info()->cpu) | ||
|
|
||
| enum microblaze_msg { | ||
| MICROBLAZE_MSG_RESCHEDULE = 0, | ||
| MICROBLAZE_MSG_CALL_FUNCTION, | ||
| MICROBLAZE_MSG_CALL_FUNCTION_SINGLE, | ||
| MICROBLAZE_MSG_DEBUGGER_BREAK, | ||
| MICROBLAZE_NUM_IPIS | ||
| }; | ||
|
|
||
| void start_secondary(void); | ||
| extern struct thread_info *secondary_ti; | ||
| void secondary_machine_init(void); | ||
|
|
||
| void arch_send_call_function_single_ipi(int cpu); | ||
| void arch_send_call_function_ipi_mask(const struct cpumask *mask); | ||
|
|
||
| #endif /* _ASM_MICROBLAZE_SMP_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.