On Wed Jan 29, 2025 at 8:52 AM AEST, Paul Mackerras wrote:
> This uses the 'wait' instruction to pause instruction execution when
> idle until an interrupt occurs.
>
> Signed-off-by: Paul Mackerras <pau...@ozlabs.org>
> ---
>  arch/powerpc/platforms/microwatt/setup.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/arch/powerpc/platforms/microwatt/setup.c 
> b/arch/powerpc/platforms/microwatt/setup.c
> index 5e1c0997170d..97828a99780d 100644
> --- a/arch/powerpc/platforms/microwatt/setup.c
> +++ b/arch/powerpc/platforms/microwatt/setup.c
> @@ -34,10 +34,19 @@ static void __init microwatt_setup_arch(void)
>       microwatt_rng_init();
>  }
>  
> +static void microwatt_idle(void)
> +{
> +     if (!prep_irq_for_idle())
> +             return;
> +
> +     __asm__ __volatile__ ("wait");
> +}

Does wait cause MSR[EE] to be set? If not, do you need to use
prep_irq_for_idle_irqsoff() here maybe?

Thanks,
Nick

> +
>  define_machine(microwatt) {
>       .name                   = "microwatt",
>       .compatible             = "microwatt-soc",
>       .init_IRQ               = microwatt_init_IRQ,
>       .setup_arch             = microwatt_setup_arch,
>       .progress               = udbg_progress,
> +     .power_save             = microwatt_idle,
>  };


Reply via email to