On Tue, Nov 10, 2026 at 11:02:36AM +0530, Shrikanth Hegde wrote:
> Add a flavour of interrupt disable which could be used in
> multiple places which also takes care of lockdep in both 32 and
> 64 bit archs.
> 
> On PPC64:
> - Disable hard interrupts using hard_irq_disable. It takes care of
>   lockdep and tracing. local_irq_disable only alters softmask's state.
> 
> On PPC32:
> - Interrupts are hard disabled with local_irq_disable. It also takes
>   care of lockdep and tacing.
> 
> Subsequent patch uses this API in KVM code to avoid the warnings.
> Wider use of it is possible, but it will be taken subsequently.
> 
> Suggested-by: Ritesh Harjani (IBM) <[email protected]>
> Signed-off-by: Shrikanth Hegde <[email protected]>
> ---
>  arch/powerpc/include/asm/hw_irq.h | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/arch/powerpc/include/asm/hw_irq.h 
> b/arch/powerpc/include/asm/hw_irq.h
> index b7eee6385ae5..075442366e1e 100644
> --- a/arch/powerpc/include/asm/hw_irq.h
> +++ b/arch/powerpc/include/asm/hw_irq.h
> @@ -516,6 +516,23 @@ static inline unsigned long mtmsr_isync_irqsafe(unsigned 
> long msr)
>  
>  #define ARCH_IRQ_INIT_FLAGS  IRQ_NOREQUEST
>  
> +/*
> + * Hard-disable interrupts while keeping the IRQ tracing state
> + * consistent.
> + *
> + * On PPC64, local_irq_disable() only soft-disables interrupts, leaving
> + * a window where an interrupt can be recorded in irq_happened before
> + * interrupts are hard-disabled.
> + *
> + * On PPC32, hard_irq_disable() does not update the IRQ tracing state, so
> + * use local_irq_disable().
> + */
> +#ifdef CONFIG_PPC64
> +#define ppc_hard_irq_disable()       hard_irq_disable()
> +#else
> +#define ppc_hard_irq_disable()       local_irq_disable()
> +#endif
> +
>  #endif  /* __ASSEMBLER__ */
>  #endif       /* __KERNEL__ */
>  #endif       /* _ASM_POWERPC_HW_IRQ_H */
> -- 
> 2.52.0
> 

Reviewed-by: Mukesh Kumar Chaurasiya (IBM) <[email protected]>

Reply via email to