mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-25 04:50:57 +07:00
ac8fd122e0
request_irq() is preferred over setup_irq(). Invocations of setup_irq() occur after memory allocators are ready. Per tglx[1], setup_irq() existed in olden days when allocators were not ready by the time early interrupts were initialized. Hence replace setup_irq() by request_irq(). remove_irq() has been replaced by free_irq() as well. There were build error's during previous version, couple of which was reported by kbuild test robot <lkp@intel.com> of which one was reported by Thomas Bogendoerfer <tsbogend@alpha.franken.de> as well. There were a few more issues including build errors, those also have been fixed. [1] https://lkml.kernel.org/r/alpine.DEB.2.20.1710191609480.1971@nanos Signed-off-by: afzal mohammed <afzal.mohd.ma@gmail.com> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
66 lines
1.5 KiB
C
66 lines
1.5 KiB
C
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
/*
|
|
* Copyright (C) 2007 Lemote Inc. & Institute of Computing Technology
|
|
* Author: Fuxin Zhang, zhangfx@lemote.com
|
|
*/
|
|
#include <linux/interrupt.h>
|
|
|
|
#include <asm/irq_cpu.h>
|
|
#include <asm/i8259.h>
|
|
|
|
#include <loongson.h>
|
|
|
|
static void i8259_irqdispatch(void)
|
|
{
|
|
int irq;
|
|
|
|
irq = i8259_irq();
|
|
if (irq >= 0)
|
|
do_IRQ(irq);
|
|
else
|
|
spurious_interrupt();
|
|
}
|
|
|
|
asmlinkage void mach_irq_dispatch(unsigned int pending)
|
|
{
|
|
if (pending & CAUSEF_IP7)
|
|
do_IRQ(MIPS_CPU_IRQ_BASE + 7);
|
|
else if (pending & CAUSEF_IP6) /* perf counter loverflow */
|
|
do_perfcnt_IRQ();
|
|
else if (pending & CAUSEF_IP5)
|
|
i8259_irqdispatch();
|
|
else if (pending & CAUSEF_IP2)
|
|
bonito_irqdispatch();
|
|
else
|
|
spurious_interrupt();
|
|
}
|
|
|
|
void __init mach_init_irq(void)
|
|
{
|
|
int irq;
|
|
|
|
/* init all controller
|
|
* 0-15 ------> i8259 interrupt
|
|
* 16-23 ------> mips cpu interrupt
|
|
* 32-63 ------> bonito irq
|
|
*/
|
|
|
|
/* most bonito irq should be level triggered */
|
|
LOONGSON_INTEDGE = LOONGSON_ICU_SYSTEMERR | LOONGSON_ICU_MASTERERR |
|
|
LOONGSON_ICU_RETRYERR | LOONGSON_ICU_MBOXES;
|
|
|
|
/* Sets the first-level interrupt dispatcher. */
|
|
mips_cpu_irq_init();
|
|
init_i8259_irqs();
|
|
bonito_irq_init();
|
|
|
|
/* bonito irq at IP2 */
|
|
irq = MIPS_CPU_IRQ_BASE + 2;
|
|
if (request_irq(irq, no_action, IRQF_NO_THREAD, "cascade", NULL))
|
|
pr_err("Failed to request irq %d (cascade)\n", irq);
|
|
/* 8259 irq at IP5 */
|
|
irq = MIPS_CPU_IRQ_BASE + 5;
|
|
if (request_irq(irq, no_action, IRQF_NO_THREAD, "cascade", NULL))
|
|
pr_err("Failed to request irq %d (cascade)\n", irq);
|
|
}
|