On 12/17/20 2:57 PM, Maxim Uvarov wrote:
> Add secure pl061 for reset/power down machine from
> the secure world (Arm Trusted Firmware).
> Use the same gpio 3 and gpio 4 which were used by
> non acpi variant of linux power control gpios.
> 
> Signed-off-by: Maxim Uvarov <[email protected]>
> ---
>  This patch works together with ATF patch:
>       
> https://github.com/muvarov/arm-trusted-firmware/commit/dd4401d8eb8e0f3018b335b81ce7a96d6cb16d0f
>  
> 
>  Previus discussion for reboot issue was here:
>       https://www.mail-archive.com/[email protected]/msg757705.html
> 
>  Regards,
>  Maxim.
> 
> 
>  hw/arm/Kconfig        |  1 +
>  hw/arm/virt.c         | 24 +++++++++++++
>  hw/gpio/Kconfig       |  3 ++
>  hw/gpio/gpio_pwr.c    | 83 +++++++++++++++++++++++++++++++++++++++++++
>  hw/gpio/meson.build   |  1 +
>  include/hw/arm/virt.h |  1 +
>  6 files changed, 113 insertions(+)
>  create mode 100644 hw/gpio/gpio_pwr.c
...

> +static void gpio_pwr_set_irq(void *opaque, int irq, int level)
> +{
> +    GPIO_PWR_State *s = (GPIO_PWR_State *)opaque;
> +
> +    qemu_set_irq(s->irq, 1);
> +
> +    if (level) {
> +        return;
> +    }
> +
> +    switch (irq) {
> +    case 3:
> +        qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);
> +        break;
> +    case 4:
> +        qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
> +        break;
> +    default:
> +        printf("qemu; gpio_pwr: unknown interrupt %d lvl %d\n",
> +               irq, level);

Please use qemu_log_mask(LOG_GUEST_ERROR) (or UNIMP?).

Otherwise patch is good, thanks!

Phil.

Reply via email to