On 11 November 2015 at 06:57, Wei Huang <w...@redhat.com> wrote:
>
>
> On 10/29/2015 09:27 AM, Shannon Zhao wrote:
>> 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 Pin 3 with powerdown notification. So guest VM can receive notification
>> when such powerdown request is triggered.
>>
>> Signed-off-by: Wei Huang <w...@redhat.com>
>> Signed-off-by: Shannon Zhao <zhaoshengl...@huawei.com>
>> Signed-off-by: Shannon Zhao <shannon.z...@linaro.org>
>> ---
>>  hw/arm/virt.c | 17 ++++++++++++++++-
>>  1 file changed, 16 insertions(+), 1 deletion(-)
>>
>> diff --git a/hw/arm/virt.c b/hw/arm/virt.c
>> index 5c505a4..6f1b9d6 100644
>> --- a/hw/arm/virt.c
>> +++ b/hw/arm/virt.c
>> @@ -540,6 +540,18 @@ static void create_rtc(const VirtBoardInfo *vbi, 
>> qemu_irq *pic)
>>      g_free(nodename);
>>  }
>>
>> +static DeviceState *pl061_dev;
>> +static void virt_powerdown_req(Notifier *n, void *opaque)
>> +{
>> +    /* use gpio Pin 3 for power button event */
>> +    qemu_set_irq(qdev_get_gpio_in(pl061_dev, 3), 0);
>> +    qemu_set_irq(qdev_get_gpio_in(pl061_dev, 3), 1);
>
> This pull-down and then pull-up is for extra safety, right? It actually
> also works with only pull-up call. But I am OK with your design here;
> please add additional comments to explain the design.

It's a bit weird though. Usually you use qemu_pulse_irq,
which does a 0->1 then 1->0 transition, if the thing you're
signalling needs an edge. If the thing you're signalling
only cares about level then you just need to set the
level to 1.

thanks
-- PMM

Reply via email to