File tree Expand file tree Collapse file tree 4 files changed +47
-0
lines changed Expand file tree Collapse file tree 4 files changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -838,6 +838,7 @@ config JAILHOUSE_GUEST
838
838
config ACRN_GUEST
839
839
bool "ACRN Guest support"
840
840
depends on X86_64
841
+ select X86_HV_CALLBACK_VECTOR
841
842
help
842
843
This option allows to run Linux as guest in the ACRN hypervisor. ACRN is
843
844
a flexible, lightweight reference open-source hypervisor, built with
Original file line number Diff line number Diff line change @@ -1142,6 +1142,11 @@ apicinterrupt3 HYPERV_STIMER0_VECTOR \
1142
1142
hv_stimer0_callback_vector hv_stimer0_vector_handler
1143
1143
#endif /* CONFIG_HYPERV */
1144
1144
1145
+ #if IS_ENABLED(CONFIG_ACRN_GUEST)
1146
+ apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \
1147
+ acrn_hv_callback_vector acrn_hv_vector_handler
1148
+ #endif
1149
+
1145
1150
idtentry debug do_debug has_error_code =0 paranoid =1 shift_ist = IST_INDEX_DB ist_offset = DB_STACK_OFFSET
1146
1151
idtentry int3 do_int3 has_error_code =0 create_gap =1
1147
1152
idtentry stack_segment do_stack_segment has_error_code =1
Original file line number Diff line number Diff line change
1
+ /* SPDX-License-Identifier: GPL-2.0 */
2
+ #ifndef _ASM_X86_ACRN_H
3
+ #define _ASM_X86_ACRN_H
4
+
5
+ extern void acrn_hv_callback_vector (void );
6
+ #ifdef CONFIG_TRACING
7
+ #define trace_acrn_hv_callback_vector acrn_hv_callback_vector
8
+ #endif
9
+
10
+ extern void acrn_hv_vector_handler (struct pt_regs * regs );
11
+ #endif /* _ASM_X86_ACRN_H */
Original file line number Diff line number Diff line change 9
9
*
10
10
*/
11
11
12
+ #include <linux/interrupt.h>
13
+ #include <asm/acrn.h>
14
+ #include <asm/apic.h>
15
+ #include <asm/desc.h>
12
16
#include <asm/hypervisor.h>
17
+ #include <asm/irq_regs.h>
13
18
14
19
static uint32_t __init acrn_detect (void )
15
20
{
@@ -18,6 +23,8 @@ static uint32_t __init acrn_detect(void)
18
23
19
24
static void __init acrn_init_platform (void )
20
25
{
26
+ /* Setup the IDT for ACRN hypervisor callback */
27
+ alloc_intr_gate (HYPERVISOR_CALLBACK_VECTOR , acrn_hv_callback_vector );
21
28
}
22
29
23
30
static bool acrn_x2apic_available (void )
@@ -30,6 +37,29 @@ static bool acrn_x2apic_available(void)
30
37
return false;
31
38
}
32
39
40
+ static void (* acrn_intr_handler )(void );
41
+
42
+ __visible void __irq_entry acrn_hv_vector_handler (struct pt_regs * regs )
43
+ {
44
+ struct pt_regs * old_regs = set_irq_regs (regs );
45
+
46
+ /*
47
+ * The hypervisor requires that the APIC EOI should be acked.
48
+ * If the APIC EOI is not acked, the APIC ISR bit for the
49
+ * HYPERVISOR_CALLBACK_VECTOR will not be cleared and then it
50
+ * will block the interrupt whose vector is lower than
51
+ * HYPERVISOR_CALLBACK_VECTOR.
52
+ */
53
+ entering_ack_irq ();
54
+ inc_irq_stat (irq_hv_callback_count );
55
+
56
+ if (acrn_intr_handler )
57
+ acrn_intr_handler ();
58
+
59
+ exiting_irq ();
60
+ set_irq_regs (old_regs );
61
+ }
62
+
33
63
const __initconst struct hypervisor_x86 x86_hyper_acrn = {
34
64
.name = "ACRN" ,
35
65
.detect = acrn_detect ,
You can’t perform that action at this time.
0 commit comments