>From 17e5319419d845fc5a5e95b1577c38bc2958d633 Mon Sep 17 00:00:00 2001 From: Wei Huang Date: Mon, 16 Feb 2015 16:56:12 -0500 Subject: [mach-virt GPIO RFC 2/2] arm: Hook up QEMU powerdown notifier to GPIO interrupt line Currently mach-virt model doesn't support powerdown request. Guest VM doesn't react to system_powerdown from monitor console (or QMP) because there is no communication mechanism for such requests. This patch registers GPIO IRQ with powerdown notification. So guest VM can receive notification when such powerdown request is triggered. Signed-off-by: Wei Huang --- hw/arm/virt.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 1e5d792..7234044 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -440,6 +440,16 @@ static void create_rtc(const VirtBoardInfo *vbi, qemu_irq *pic) g_free(nodename); } +static qemu_irq virt_system_powerdown; +static void virt_powerdown_req(Notifier *n, void *opaque) +{ + qemu_irq_raise(virt_system_powerdown); +} + +static Notifier virt_system_powerdown_notifier = { + .notify = virt_powerdown_req +}; + static void create_gpio(const VirtBoardInfo *vbi, qemu_irq *pic) { char *nodename; @@ -461,6 +471,10 @@ static void create_gpio(const VirtBoardInfo *vbi, qemu_irq *pic) qemu_fdt_setprop_cell(vbi->fdt, nodename, "clocks", vbi->clock_phandle); qemu_fdt_setprop_string(vbi->fdt, nodename, "clock-names", "apb_pclk"); + /* connect powerdown request */ + virt_system_powerdown = pic[irq]; + qemu_register_powerdown_notifier(&virt_system_powerdown_notifier); + g_free(nodename); } -- 1.8.3.1