@@ -71,22 +71,19 @@ int32_t hcall_get_api_version(struct vm *vm, uint64_t param)
71
71
*@pre Pointer vm shall point to VM0
72
72
*/
73
73
static void
74
- handle_vpic_irqline (struct vm * vm , uint32_t irq , enum irq_mode mode )
74
+ handle_vpic_irqline (struct vm * vm , uint32_t irq , uint32_t operation )
75
75
{
76
-
77
- switch (mode ) {
78
- case IRQ_ASSERT :
76
+ switch (operation ) {
77
+ case GSI_SET_HIGH :
79
78
vpic_assert_irq (vm , irq );
80
79
break ;
81
- case IRQ_DEASSERT :
80
+ case GSI_SET_LOW :
82
81
vpic_deassert_irq (vm , irq );
83
82
break ;
84
- case IRQ_PULSE :
83
+ case GSI_RAISING_PULSE :
85
84
vpic_pulse_irq (vm , irq );
86
85
default :
87
86
/*
88
- * In this switch statement, mode shall either be IRQ_ASSERT or
89
- * IRQ_DEASSERT or IRQ_PULSE.
90
87
* Gracefully return if prior case clauses have not been met.
91
88
*/
92
89
break ;
@@ -97,22 +94,20 @@ handle_vpic_irqline(struct vm *vm, uint32_t irq, enum irq_mode mode)
97
94
*@pre Pointer vm shall point to VM0
98
95
*/
99
96
static void
100
- handle_vioapic_irqline (struct vm * vm , uint32_t irq , enum irq_mode mode )
97
+ handle_vioapic_irqline (struct vm * vm , uint32_t irq , uint32_t operation )
101
98
{
102
- switch (mode ) {
103
- case IRQ_ASSERT :
99
+ switch (operation ) {
100
+ case GSI_SET_HIGH :
104
101
vioapic_assert_irq (vm , irq );
105
102
break ;
106
- case IRQ_DEASSERT :
103
+ case GSI_SET_LOW :
107
104
vioapic_deassert_irq (vm , irq );
108
105
break ;
109
- case IRQ_PULSE :
106
+ case GSI_RAISING_PULSE :
110
107
vioapic_pulse_irq (vm , irq );
111
108
break ;
112
109
default :
113
110
/*
114
- * In this switch statement, mode shall either be IRQ_ASSERT or
115
- * IRQ_DEASSERT or IRQ_PULSE.
116
111
* Gracefully return if prior case clauses have not been met.
117
112
*/
118
113
break ;
@@ -124,7 +119,7 @@ handle_vioapic_irqline(struct vm *vm, uint32_t irq, enum irq_mode mode)
124
119
*/
125
120
static int32_t
126
121
handle_virt_irqline (struct vm * vm , uint16_t target_vmid ,
127
- struct acrn_irqline * param , enum irq_mode mode )
122
+ struct acrn_irqline * param , uint32_t operation )
128
123
{
129
124
int32_t ret = 0 ;
130
125
uint32_t intr_type ;
@@ -152,19 +147,19 @@ handle_virt_irqline(struct vm *vm, uint16_t target_vmid,
152
147
switch (intr_type ) {
153
148
case ACRN_INTR_TYPE_ISA :
154
149
/* Call vpic for pic injection */
155
- handle_vpic_irqline (target_vm , param -> pic_irq , mode );
150
+ handle_vpic_irqline (target_vm , param -> pic_irq , operation );
156
151
157
152
/* call vioapic for ioapic injection if ioapic_irq != ~0U*/
158
153
if (param -> ioapic_irq != (~0U )) {
159
154
/* handle IOAPIC irqline */
160
155
handle_vioapic_irqline (target_vm ,
161
- param -> ioapic_irq , mode );
156
+ param -> ioapic_irq , operation );
162
157
}
163
158
break ;
164
159
case ACRN_INTR_TYPE_IOAPIC :
165
160
/* handle IOAPIC irqline */
166
161
handle_vioapic_irqline (target_vm ,
167
- param -> ioapic_irq , mode );
162
+ param -> ioapic_irq , operation );
168
163
break ;
169
164
default :
170
165
dev_dbg (ACRN_DBG_HYCALL , "vINTR inject failed. type=%d" ,
@@ -309,7 +304,7 @@ int32_t hcall_assert_irqline(struct vm *vm, uint16_t vmid, uint64_t param)
309
304
pr_err ("%s: Unable copy param to vm\n" , __func__ );
310
305
return -1 ;
311
306
}
312
- ret = handle_virt_irqline (vm , vmid , & irqline , IRQ_ASSERT );
307
+ ret = handle_virt_irqline (vm , vmid , & irqline , GSI_SET_HIGH );
313
308
314
309
return ret ;
315
310
}
@@ -326,7 +321,7 @@ int32_t hcall_deassert_irqline(struct vm *vm, uint16_t vmid, uint64_t param)
326
321
pr_err ("%s: Unable copy param to vm\n" , __func__ );
327
322
return -1 ;
328
323
}
329
- ret = handle_virt_irqline (vm , vmid , & irqline , IRQ_DEASSERT );
324
+ ret = handle_virt_irqline (vm , vmid , & irqline , GSI_SET_LOW );
330
325
331
326
return ret ;
332
327
}
@@ -343,11 +338,38 @@ int32_t hcall_pulse_irqline(struct vm *vm, uint16_t vmid, uint64_t param)
343
338
pr_err ("%s: Unable copy param to vm\n" , __func__ );
344
339
return -1 ;
345
340
}
346
- ret = handle_virt_irqline (vm , vmid , & irqline , IRQ_PULSE );
341
+ ret = handle_virt_irqline (vm , vmid , & irqline , GSI_RAISING_PULSE );
347
342
348
343
return ret ;
349
344
}
350
345
346
+ /**
347
+ *@pre Pointer vm shall point to VM0
348
+ */
349
+ int32_t hcall_set_irqline (struct vm * vm , uint16_t vmid ,
350
+ struct acrn_irqline_ops * ops )
351
+ {
352
+ struct vm * target_vm = get_vm_from_vmid (vmid );
353
+
354
+ if (target_vm == NULL ) {
355
+ return - EINVAL ;
356
+ }
357
+
358
+ if (ops -> nr_gsi >= vioapic_pincount (vm )) {
359
+ return - EINVAL ;
360
+ }
361
+
362
+ if (ops -> nr_gsi < vpic_pincount ()) {
363
+ /* Call vpic for pic injection */
364
+ handle_vpic_irqline (target_vm , ops -> nr_gsi , ops -> op );
365
+ }
366
+
367
+ /* handle IOAPIC irqline */
368
+ handle_vioapic_irqline (target_vm , ops -> nr_gsi , ops -> op );
369
+
370
+ return 0 ;
371
+ }
372
+
351
373
/**
352
374
*@pre Pointer vm shall point to VM0
353
375
*/
0 commit comments