12874c5fdSThomas Gleixner // SPDX-License-Identifier: GPL-2.0-or-later 2620165f9SKumar Gala /* 3620165f9SKumar Gala * Author: Kumar Gala <galak@kernel.crashing.org> 4620165f9SKumar Gala * 5620165f9SKumar Gala * Copyright 2009 Freescale Semiconductor Inc. 6620165f9SKumar Gala */ 7620165f9SKumar Gala 8620165f9SKumar Gala #include <linux/stddef.h> 9620165f9SKumar Gala #include <linux/kernel.h> 10620165f9SKumar Gala #include <linux/smp.h> 11620165f9SKumar Gala #include <linux/threads.h> 1223d72bfdSMilton Miller #include <linux/hardirq.h> 13620165f9SKumar Gala 14620165f9SKumar Gala #include <asm/dbell.h> 153a96570fSNicholas Piggin #include <asm/interrupt.h> 160e37d259SDavid Gibson #include <asm/irq_regs.h> 17755563bcSPaul Mackerras #include <asm/kvm_ppc.h> 185b2a1529SAnton Blanchard #include <asm/trace.h> 19620165f9SKumar Gala 20620165f9SKumar Gala #ifdef CONFIG_SMP 21b9f1cd71SBenjamin Herrenschmidt DEFINE_INTERRUPT_HANDLER_ASYNC(doorbell_exception)223a96570fSNicholas PigginDEFINE_INTERRUPT_HANDLER_ASYNC(doorbell_exception) 23e3145b38SBenjamin Herrenschmidt { 240e37d259SDavid Gibson struct pt_regs *old_regs = set_irq_regs(regs); 25e3145b38SBenjamin Herrenschmidt 265b2a1529SAnton Blanchard trace_doorbell_entry(regs); 27b9f1cd71SBenjamin Herrenschmidt 28b87ac021SNicholas Piggin ppc_msgsync(); 29b87ac021SNicholas Piggin 30*c2854801SNicholas Piggin if (should_hard_irq_enable(regs)) 310faf20a1SNicholas Piggin do_hard_irq_enable(); 327230c564SBenjamin Herrenschmidt 333a83f677SMichael Roth kvmppc_clear_host_ipi(smp_processor_id()); 3469111bacSChristoph Lameter __this_cpu_inc(irq_stat.doorbell_irqs); 35a6a058e5SIan Munsie 36b87ac021SNicholas Piggin smp_ipi_demux_relaxed(); /* already performed the barrier */ 37e3145b38SBenjamin Herrenschmidt 385b2a1529SAnton Blanchard trace_doorbell_exit(regs); 391b1b6a6fSNicholas Piggin 400e37d259SDavid Gibson set_irq_regs(old_regs); 41e3145b38SBenjamin Herrenschmidt } 42e3145b38SBenjamin Herrenschmidt #else /* CONFIG_SMP */ DEFINE_INTERRUPT_HANDLER_ASYNC(doorbell_exception)433a96570fSNicholas PigginDEFINE_INTERRUPT_HANDLER_ASYNC(doorbell_exception) 44e3145b38SBenjamin Herrenschmidt { 45e3145b38SBenjamin Herrenschmidt printk(KERN_WARNING "Received doorbell on non-smp system\n"); 46e3145b38SBenjamin Herrenschmidt } 47e3145b38SBenjamin Herrenschmidt #endif /* CONFIG_SMP */ 48