~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/loongarch/kernel/irq.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0
  2 /*
  3  * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
  4  */
  5 #include <linux/kernel.h>
  6 #include <linux/acpi.h>
  7 #include <linux/atomic.h>
  8 #include <linux/delay.h>
  9 #include <linux/init.h>
 10 #include <linux/interrupt.h>
 11 #include <linux/irqchip.h>
 12 #include <linux/kernel_stat.h>
 13 #include <linux/proc_fs.h>
 14 #include <linux/mm.h>
 15 #include <linux/sched.h>
 16 #include <linux/seq_file.h>
 17 #include <linux/kallsyms.h>
 18 #include <linux/uaccess.h>
 19 
 20 #include <asm/irq.h>
 21 #include <asm/loongson.h>
 22 #include <asm/setup.h>
 23 
 24 DEFINE_PER_CPU(unsigned long, irq_stack);
 25 DEFINE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat);
 26 EXPORT_PER_CPU_SYMBOL(irq_stat);
 27 
 28 struct acpi_vector_group pch_group[MAX_IO_PICS];
 29 struct acpi_vector_group msi_group[MAX_IO_PICS];
 30 /*
 31  * 'what should we do if we get a hw irq event on an illegal vector'.
 32  * each architecture has to answer this themselves.
 33  */
 34 void ack_bad_irq(unsigned int irq)
 35 {
 36         pr_warn("Unexpected IRQ # %d\n", irq);
 37 }
 38 
 39 atomic_t irq_err_count;
 40 
 41 asmlinkage void spurious_interrupt(void)
 42 {
 43         atomic_inc(&irq_err_count);
 44 }
 45 
 46 int arch_show_interrupts(struct seq_file *p, int prec)
 47 {
 48 #ifdef CONFIG_SMP
 49         show_ipi_list(p, prec);
 50 #endif
 51         seq_printf(p, "%*s: %10u\n", prec, "ERR", atomic_read(&irq_err_count));
 52         return 0;
 53 }
 54 
 55 static int __init early_pci_mcfg_parse(struct acpi_table_header *header)
 56 {
 57         struct acpi_table_mcfg *mcfg;
 58         struct acpi_mcfg_allocation *mptr;
 59         int i, n;
 60 
 61         if (header->length < sizeof(struct acpi_table_mcfg))
 62                 return -EINVAL;
 63 
 64         n = (header->length - sizeof(struct acpi_table_mcfg)) /
 65                                         sizeof(struct acpi_mcfg_allocation);
 66         mcfg = (struct acpi_table_mcfg *)header;
 67         mptr = (struct acpi_mcfg_allocation *) &mcfg[1];
 68 
 69         for (i = 0; i < n; i++, mptr++) {
 70                 msi_group[i].pci_segment = mptr->pci_segment;
 71                 pch_group[i].node = msi_group[i].node = (mptr->address >> 44) & 0xf;
 72         }
 73 
 74         return 0;
 75 }
 76 
 77 static void __init init_vec_parent_group(void)
 78 {
 79         int i;
 80 
 81         for (i = 0; i < MAX_IO_PICS; i++) {
 82                 msi_group[i].pci_segment = -1;
 83                 msi_group[i].node = -1;
 84                 pch_group[i].node = -1;
 85         }
 86 
 87         acpi_table_parse(ACPI_SIG_MCFG, early_pci_mcfg_parse);
 88 }
 89 
 90 void __init init_IRQ(void)
 91 {
 92         int i;
 93         unsigned int order = get_order(IRQ_STACK_SIZE);
 94         struct page *page;
 95 
 96         clear_csr_ecfg(ECFG0_IM);
 97         clear_csr_estat(ESTATF_IP);
 98 
 99         init_vec_parent_group();
100         irqchip_init();
101 #ifdef CONFIG_SMP
102         mp_ops.init_ipi();
103 #endif
104 
105         for_each_possible_cpu(i) {
106                 page = alloc_pages_node(cpu_to_node(i), GFP_KERNEL, order);
107 
108                 per_cpu(irq_stack, i) = (unsigned long)page_address(page);
109                 pr_debug("CPU%d IRQ stack at 0x%lx - 0x%lx\n", i,
110                         per_cpu(irq_stack, i), per_cpu(irq_stack, i) + IRQ_STACK_SIZE);
111         }
112 
113         set_csr_ecfg(ECFGF_SIP0 | ECFGF_IP0 | ECFGF_IP1 | ECFGF_IP2 | ECFGF_IPI | ECFGF_PMC);
114 }
115 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php