1 // SPDX-License-Identifier: GPL-2.0
2 #include <linux/hardirq.h>
4 #include <asm/x86_init.h>
6 #include <xen/interface/xen.h>
7 #include <xen/interface/sched.h>
8 #include <xen/interface/vcpu.h>
9 #include <xen/features.h>
10 #include <xen/events.h>
12 #include <asm/xen/hypercall.h>
13 #include <asm/xen/hypervisor.h>
18 * Force a proper event-channel callback from Xen after clearing the
19 * callback mask. We do this in a very simple manner, by making a call
20 * down into Xen. The pending flag will be checked by Xen on return.
22 noinstr
void xen_force_evtchn_callback(void)
24 (void)HYPERVISOR_xen_version(0, NULL
);
27 static noinstr
void xen_safe_halt(void)
29 /* Blocking includes an implicit local_irq_enable(). */
30 if (HYPERVISOR_sched_op(SCHEDOP_block
, NULL
) != 0)
34 static void xen_halt(void)
37 HYPERVISOR_vcpu_op(VCPUOP_down
,
38 xen_vcpu_nr(smp_processor_id()), NULL
);
43 static const typeof(pv_ops
) xen_irq_ops __initconst
= {
45 /* Initial interrupt flag handling only called while interrupts off. */
46 .save_fl
= __PV_IS_CALLEE_SAVE(paravirt_ret0
),
47 .irq_disable
= __PV_IS_CALLEE_SAVE(paravirt_nop
),
48 .irq_enable
= __PV_IS_CALLEE_SAVE(BUG_func
),
50 .safe_halt
= xen_safe_halt
,
55 void __init
xen_init_irq_ops(void)
57 pv_ops
.irq
= xen_irq_ops
.irq
;
58 x86_init
.irqs
.intr_init
= xen_init_IRQ
;