Skip to content

Commit d22cbe6

Browse files
Shannon ZhaoDavid Vrabel
authored andcommitted
arm/xen: Get event-channel irq through HVM_PARAM when booting with ACPI
The kernel will get the event-channel IRQ through HVM_PARAM_CALLBACK_IRQ. Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Reviewed-by: Julien Grall <julien.grall@arm.com> Tested-by: Julien Grall <julien.grall@arm.com>
1 parent 383ff51 commit d22cbe6

1 file changed

Lines changed: 35 additions & 1 deletion

File tree

‎arch/arm/xen/enlighten.c‎

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include <linux/time64.h>
3131
#include <linux/timekeeping.h>
3232
#include <linux/timekeeper_internal.h>
33+
#include <linux/acpi.h>
3334

3435
#include <linux/mm.h>
3536

@@ -278,6 +279,35 @@ void __init xen_early_init(void)
278279
add_preferred_console("hvc", 0, NULL);
279280
}
280281

282+
static void __init xen_acpi_guest_init(void)
283+
{
284+
#ifdef CONFIG_ACPI
285+
struct xen_hvm_param a;
286+
int interrupt, trigger, polarity;
287+
288+
a.domid = DOMID_SELF;
289+
a.index = HVM_PARAM_CALLBACK_IRQ;
290+
291+
if (HYPERVISOR_hvm_op(HVMOP_get_param, &a)
292+
|| (a.value >> 56) != HVM_PARAM_CALLBACK_TYPE_PPI) {
293+
xen_events_irq = 0;
294+
return;
295+
}
296+
297+
interrupt = a.value & 0xff;
298+
trigger = ((a.value >> 8) & 0x1) ? ACPI_EDGE_SENSITIVE
299+
: ACPI_LEVEL_SENSITIVE;
300+
polarity = ((a.value >> 8) & 0x2) ? ACPI_ACTIVE_LOW
301+
: ACPI_ACTIVE_HIGH;
302+
xen_events_irq = acpi_register_gsi(NULL, interrupt, trigger, polarity);
303+
#endif
304+
}
305+
306+
static void __init xen_dt_guest_init(void)
307+
{
308+
xen_events_irq = irq_of_parse_and_map(xen_node, 0);
309+
}
310+
281311
static int __init xen_guest_init(void)
282312
{
283313
struct xen_add_to_physmap xatp;
@@ -286,7 +316,11 @@ static int __init xen_guest_init(void)
286316
if (!xen_domain())
287317
return 0;
288318

289-
xen_events_irq = irq_of_parse_and_map(xen_node, 0);
319+
if (!acpi_disabled)
320+
xen_acpi_guest_init();
321+
else
322+
xen_dt_guest_init();
323+
290324
if (!xen_events_irq) {
291325
pr_err("Xen event channel interrupt not found\n");
292326
return -ENODEV;

0 commit comments

Comments
 (0)