<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux.git/arch/powerpc/include/asm/entry-common.h, branch master</title>
<subtitle>Linux kernel source tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/'/>
<entry>
<title>powerpc/970: fix nap return address corruption on async interrupt exit</title>
<updated>2026-07-28T04:53:31+00:00</updated>
<author>
<name>Mukesh Kumar Chaurasiya (IBM)</name>
<email>mkchauras@gmail.com</email>
</author>
<published>2026-07-07T17:24:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=bddf7540099bf653eaea339e886add6f62555cf3'/>
<id>bddf7540099bf653eaea339e886add6f62555cf3</id>
<content type='text'>
On PowerMac G5 (PPC970, CONFIG_PPC_970_NAP) the system panics shortly
after boot with symptoms including instruction fetch faults, kernel data
access faults, and stack corruption, predominantly on SMP and always
somewhere inside softirq processing.

The PPC970 idle path works by setting _TLF_NAPPING in the current
thread's local flags before entering the MSR_POW nap loop.  When any
async interrupt wakes the CPU, nap_adjust_return() is expected to detect
_TLF_NAPPING, clear it, and rewrite regs-&gt;NIP to power4_idle_nap_return
so that the interrupt returns cleanly to the caller of power4_idle_nap()
rather than back into the nap spin loop.

DEFINE_INTERRUPT_HANDLER_ASYNC generates the following sequence:

    irq_enter_rcu();
    ____func(regs);           /* timer_interrupt / do_IRQ body */
    irq_exit_rcu();           /* softirqs run here, irqs re-enabled */
    arch_interrupt_async_exit_prepare(regs); /* nap_adjust_return was here */
    irqentry_exit(regs, state);

irq_exit_rcu() calls invoke_softirq() -&gt; do_softirq_own_stack(), which
runs softirqs with hardware interrupts re-enabled.  A nested async
interrupt can therefore arrive while _TLF_NAPPING is still set.  That
nested interrupt reaches nap_adjust_return() in its own
arch_interrupt_async_exit_prepare() call, finds _TLF_NAPPING set, and
redirects *its own* regs-&gt;NIP to power4_idle_nap_return.  Returning via
that blr with an unrelated LR on the softirq stack jumps to a garbage
address, causing the observed crashes.

The comment that previously lived in arch_interrupt_async_exit_prepare()
even described this exact hazard ("must come before irq_exit()"), but
nap_adjust_return() was placed after irq_exit_rcu() in the macro, so
the protection was never effective.

Fix this by calling nap_adjust_return() inside DEFINE_INTERRUPT_HANDLER_ASYNC
immediately before irq_exit_rcu(), ensuring _TLF_NAPPING is cleared and
regs-&gt;NIP is adjusted before any code that can re-enable interrupts or
invoke softirqs runs.  Move the explanatory comment into
nap_adjust_return() itself and remove it from arch_interrupt_async_exit_prepare().

Fixes: bee25f97ad24 ("powerpc: Enable GENERIC_ENTRY feature")
Closes: https://lore.kernel.org/all/87wlvazrdy.fsf@igel.home/
Reported-by: Andreas Schwab &lt;schwab@linux-m68k.org&gt;
Signed-off-by: Mukesh Kumar Chaurasiya (IBM) &lt;mkchauras@gmail.com&gt;
Tested-by: John Ogness &lt;john.ogness@linutronix.de&gt;
Signed-off-by: Madhavan Srinivasan &lt;maddy@linux.ibm.com&gt;
Link: https://patch.msgid.link/20260707172430.790040-1-mkchauras@gmail.com

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
On PowerMac G5 (PPC970, CONFIG_PPC_970_NAP) the system panics shortly
after boot with symptoms including instruction fetch faults, kernel data
access faults, and stack corruption, predominantly on SMP and always
somewhere inside softirq processing.

The PPC970 idle path works by setting _TLF_NAPPING in the current
thread's local flags before entering the MSR_POW nap loop.  When any
async interrupt wakes the CPU, nap_adjust_return() is expected to detect
_TLF_NAPPING, clear it, and rewrite regs-&gt;NIP to power4_idle_nap_return
so that the interrupt returns cleanly to the caller of power4_idle_nap()
rather than back into the nap spin loop.

DEFINE_INTERRUPT_HANDLER_ASYNC generates the following sequence:

    irq_enter_rcu();
    ____func(regs);           /* timer_interrupt / do_IRQ body */
    irq_exit_rcu();           /* softirqs run here, irqs re-enabled */
    arch_interrupt_async_exit_prepare(regs); /* nap_adjust_return was here */
    irqentry_exit(regs, state);

irq_exit_rcu() calls invoke_softirq() -&gt; do_softirq_own_stack(), which
runs softirqs with hardware interrupts re-enabled.  A nested async
interrupt can therefore arrive while _TLF_NAPPING is still set.  That
nested interrupt reaches nap_adjust_return() in its own
arch_interrupt_async_exit_prepare() call, finds _TLF_NAPPING set, and
redirects *its own* regs-&gt;NIP to power4_idle_nap_return.  Returning via
that blr with an unrelated LR on the softirq stack jumps to a garbage
address, causing the observed crashes.

The comment that previously lived in arch_interrupt_async_exit_prepare()
even described this exact hazard ("must come before irq_exit()"), but
nap_adjust_return() was placed after irq_exit_rcu() in the macro, so
the protection was never effective.

Fix this by calling nap_adjust_return() inside DEFINE_INTERRUPT_HANDLER_ASYNC
immediately before irq_exit_rcu(), ensuring _TLF_NAPPING is cleared and
regs-&gt;NIP is adjusted before any code that can re-enable interrupts or
invoke softirqs runs.  Move the explanatory comment into
nap_adjust_return() itself and remove it from arch_interrupt_async_exit_prepare().

Fixes: bee25f97ad24 ("powerpc: Enable GENERIC_ENTRY feature")
Closes: https://lore.kernel.org/all/87wlvazrdy.fsf@igel.home/
Reported-by: Andreas Schwab &lt;schwab@linux-m68k.org&gt;
Signed-off-by: Mukesh Kumar Chaurasiya (IBM) &lt;mkchauras@gmail.com&gt;
Tested-by: John Ogness &lt;john.ogness@linutronix.de&gt;
Signed-off-by: Madhavan Srinivasan &lt;maddy@linux.ibm.com&gt;
Link: https://patch.msgid.link/20260707172430.790040-1-mkchauras@gmail.com

</pre>
</div>
</content>
</entry>
<entry>
<title>powerpc/entry: Disable interrupts before irqentry_exit</title>
<updated>2026-06-08T10:28:03+00:00</updated>
<author>
<name>Shrikanth Hegde</name>
<email>sshegde@linux.ibm.com</email>
</author>
<published>2026-06-03T13:10:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=334f3f6d7a1660fd65597bad9960bfa33a716d35'/>
<id>334f3f6d7a1660fd65597bad9960bfa33a716d35</id>
<content type='text'>
Venkat reported a panic on powerpc-next tree where GENERIC_ENTRY has
been enabled.

kernel BUG at kernel/sched/core.c:7512!
NIP  preempt_schedule_irq+0x44/0x118
LR   dynamic_irqentry_exit_cond_resched+0x40/0x1a4
Call Trace:
 dynamic_irqentry_exit_cond_resched+0x40/0x1a4
 do_page_fault+0xc0/0x104
 data_access_common_virt+0x210/0x220

This happens since __do_page_fault ends up enabling the interrupts and
it could take significant time such that need_resched could be set. This
leads to schedule call in irqentry_exit leading to the bug.

There are many such irq handlers which enables the interrupts.
Fix it by disabling the irq before calling irqentry_exit. The same
pattern exists today in interrupt_exit_kernel_prepare.

Fixes: bee25f97ad24 ("powerpc: Enable GENERIC_ENTRY feature")
Reported-by: Venkat Rao Bagalkote &lt;venkat88@linux.ibm.com&gt;
Closes: https://lore.kernel.org/all/7904105b-9dfa-4efd-a5ef-bc0276ed255d@linux.ibm.com/
Signed-off-by: Shrikanth Hegde &lt;sshegde@linux.ibm.com&gt;
Tested-by: Venkat Rao Bagalkote &lt;venkat88@linux.ibm.com&gt;
Reviewed-by: Mukesh Kumar Chaurasiya (IBM) &lt;mkchauras@gmail.com&gt;
Signed-off-by: Madhavan Srinivasan &lt;maddy@linux.ibm.com&gt;
Link: https://patch.msgid.link/20260603131054.216235-1-sshegde@linux.ibm.com

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Venkat reported a panic on powerpc-next tree where GENERIC_ENTRY has
been enabled.

kernel BUG at kernel/sched/core.c:7512!
NIP  preempt_schedule_irq+0x44/0x118
LR   dynamic_irqentry_exit_cond_resched+0x40/0x1a4
Call Trace:
 dynamic_irqentry_exit_cond_resched+0x40/0x1a4
 do_page_fault+0xc0/0x104
 data_access_common_virt+0x210/0x220

This happens since __do_page_fault ends up enabling the interrupts and
it could take significant time such that need_resched could be set. This
leads to schedule call in irqentry_exit leading to the bug.

There are many such irq handlers which enables the interrupts.
Fix it by disabling the irq before calling irqentry_exit. The same
pattern exists today in interrupt_exit_kernel_prepare.

Fixes: bee25f97ad24 ("powerpc: Enable GENERIC_ENTRY feature")
Reported-by: Venkat Rao Bagalkote &lt;venkat88@linux.ibm.com&gt;
Closes: https://lore.kernel.org/all/7904105b-9dfa-4efd-a5ef-bc0276ed255d@linux.ibm.com/
Signed-off-by: Shrikanth Hegde &lt;sshegde@linux.ibm.com&gt;
Tested-by: Venkat Rao Bagalkote &lt;venkat88@linux.ibm.com&gt;
Reviewed-by: Mukesh Kumar Chaurasiya (IBM) &lt;mkchauras@gmail.com&gt;
Signed-off-by: Madhavan Srinivasan &lt;maddy@linux.ibm.com&gt;
Link: https://patch.msgid.link/20260603131054.216235-1-sshegde@linux.ibm.com

</pre>
</div>
</content>
</entry>
<entry>
<title>powerpc: Prepare for IRQ entry exit</title>
<updated>2026-05-20T01:27:14+00:00</updated>
<author>
<name>Mukesh Kumar Chaurasiya</name>
<email>mchauras@linux.ibm.com</email>
</author>
<published>2026-04-27T12:27:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=893082ac769ba92a1338e7552d97de769f352a3e'/>
<id>893082ac769ba92a1338e7552d97de769f352a3e</id>
<content type='text'>
Move interrupt entry and exit helper routines from interrupt.h into the
PowerPC-specific entry-common.h header as a preparatory step for enabling
the generic entry/exit framework.

This consolidation places all PowerPC interrupt entry/exit handling in a
single common header, aligning with the generic entry infrastructure.
The helpers provide architecture-specific handling for interrupt and NMI
entry/exit sequences, including:

 - arch_interrupt_enter/exit_prepare()
 - arch_interrupt_async_enter/exit_prepare()
 - arch_interrupt_nmi_enter/exit_prepare()
 - Supporting helpers such as nap_adjust_return(), check_return_regs_valid(),
   debug register maintenance, and soft mask handling.

The functions are copied verbatim from interrupt.h.Subsequent patches will
integrate these routines into the generic entry/exit flow.

No functional change intended.

Signed-off-by: Mukesh Kumar Chaurasiya &lt;mchauras@linux.ibm.com&gt;
Tested-by: Samir M &lt;samir@linux.ibm.com&gt;
Tested-by: David Gow &lt;davidgow@google.com&gt;
Tested-by: Venkat Rao Bagalkote &lt;venkat88@linux.ibm.com&gt;
Reviewed-by: Shrikanth Hegde &lt;sshegde@linux.ibm.com&gt;
Signed-off-by: Madhavan Srinivasan &lt;maddy@linux.ibm.com&gt;
Link: https://patch.msgid.link/20260427122742.210074-7-mkchauras@gmail.com

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Move interrupt entry and exit helper routines from interrupt.h into the
PowerPC-specific entry-common.h header as a preparatory step for enabling
the generic entry/exit framework.

This consolidation places all PowerPC interrupt entry/exit handling in a
single common header, aligning with the generic entry infrastructure.
The helpers provide architecture-specific handling for interrupt and NMI
entry/exit sequences, including:

 - arch_interrupt_enter/exit_prepare()
 - arch_interrupt_async_enter/exit_prepare()
 - arch_interrupt_nmi_enter/exit_prepare()
 - Supporting helpers such as nap_adjust_return(), check_return_regs_valid(),
   debug register maintenance, and soft mask handling.

The functions are copied verbatim from interrupt.h.Subsequent patches will
integrate these routines into the generic entry/exit flow.

No functional change intended.

Signed-off-by: Mukesh Kumar Chaurasiya &lt;mchauras@linux.ibm.com&gt;
Tested-by: Samir M &lt;samir@linux.ibm.com&gt;
Tested-by: David Gow &lt;davidgow@google.com&gt;
Tested-by: Venkat Rao Bagalkote &lt;venkat88@linux.ibm.com&gt;
Reviewed-by: Shrikanth Hegde &lt;sshegde@linux.ibm.com&gt;
Signed-off-by: Madhavan Srinivasan &lt;maddy@linux.ibm.com&gt;
Link: https://patch.msgid.link/20260427122742.210074-7-mkchauras@gmail.com

</pre>
</div>
</content>
</entry>
<entry>
<title>powerpc: Introduce syscall exit arch functions</title>
<updated>2026-05-20T01:27:14+00:00</updated>
<author>
<name>Mukesh Kumar Chaurasiya</name>
<email>mchauras@linux.ibm.com</email>
</author>
<published>2026-04-27T12:27:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=02565a782c1ee7e8ada38ad24a698e01d6ea9ff8'/>
<id>02565a782c1ee7e8ada38ad24a698e01d6ea9ff8</id>
<content type='text'>
Add PowerPC-specific implementations of the generic syscall exit hooks
used by the generic entry/exit framework:

 - arch_exit_to_user_mode_work_prepare()
 - arch_exit_to_user_mode_work()

These helpers handle user state restoration when returning from the
kernel to userspace, including FPU/VMX/VSX state, transactional memory,
KUAP restore, and per-CPU accounting.

Additionally, move check_return_regs_valid() from interrupt.c to
interrupt.h so it can be shared by the new entry/exit logic.

No functional change is intended with this patch.

Signed-off-by: Mukesh Kumar Chaurasiya &lt;mchauras@linux.ibm.com&gt;
Tested-by: Samir M &lt;samir@linux.ibm.com&gt;
Tested-by: David Gow &lt;davidgow@google.com&gt;
Tested-by: Venkat Rao Bagalkote &lt;venkat88@linux.ibm.com&gt;
Reviewed-by: Shrikanth Hegde &lt;sshegde@linux.ibm.com&gt;
Signed-off-by: Madhavan Srinivasan &lt;maddy@linux.ibm.com&gt;
Link: https://patch.msgid.link/20260427122742.210074-5-mkchauras@gmail.com

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add PowerPC-specific implementations of the generic syscall exit hooks
used by the generic entry/exit framework:

 - arch_exit_to_user_mode_work_prepare()
 - arch_exit_to_user_mode_work()

These helpers handle user state restoration when returning from the
kernel to userspace, including FPU/VMX/VSX state, transactional memory,
KUAP restore, and per-CPU accounting.

Additionally, move check_return_regs_valid() from interrupt.c to
interrupt.h so it can be shared by the new entry/exit logic.

No functional change is intended with this patch.

Signed-off-by: Mukesh Kumar Chaurasiya &lt;mchauras@linux.ibm.com&gt;
Tested-by: Samir M &lt;samir@linux.ibm.com&gt;
Tested-by: David Gow &lt;davidgow@google.com&gt;
Tested-by: Venkat Rao Bagalkote &lt;venkat88@linux.ibm.com&gt;
Reviewed-by: Shrikanth Hegde &lt;sshegde@linux.ibm.com&gt;
Signed-off-by: Madhavan Srinivasan &lt;maddy@linux.ibm.com&gt;
Link: https://patch.msgid.link/20260427122742.210074-5-mkchauras@gmail.com

</pre>
</div>
</content>
</entry>
<entry>
<title>powerpc: introduce arch_enter_from_user_mode</title>
<updated>2026-05-20T01:27:13+00:00</updated>
<author>
<name>Mukesh Kumar Chaurasiya</name>
<email>mchauras@linux.ibm.com</email>
</author>
<published>2026-04-27T12:27:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=09a9d3a8499db606563eb5e75a993419f4d1901e'/>
<id>09a9d3a8499db606563eb5e75a993419f4d1901e</id>
<content type='text'>
Implement the arch_enter_from_user_mode() hook required by the generic
entry/exit framework. This helper prepares the CPU state when entering
the kernel from userspace, ensuring correct handling of KUAP/KUEP,
transactional memory, and debug register state.

This patch contains no functional changes, it is purely preparatory for
enabling the generic syscall and interrupt entry path on PowerPC.

Signed-off-by: Mukesh Kumar Chaurasiya &lt;mchauras@linux.ibm.com&gt;
Tested-by: Samir M &lt;samir@linux.ibm.com&gt;
Tested-by: David Gow &lt;davidgow@google.com&gt;
Tested-by: Venkat Rao Bagalkote &lt;venkat88@linux.ibm.com&gt;
Reviewed-by: Shrikanth Hegde &lt;sshegde@linux.ibm.com&gt;
Signed-off-by: Madhavan Srinivasan &lt;maddy@linux.ibm.com&gt;
Link: https://patch.msgid.link/20260427122742.210074-4-mkchauras@gmail.com

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Implement the arch_enter_from_user_mode() hook required by the generic
entry/exit framework. This helper prepares the CPU state when entering
the kernel from userspace, ensuring correct handling of KUAP/KUEP,
transactional memory, and debug register state.

This patch contains no functional changes, it is purely preparatory for
enabling the generic syscall and interrupt entry path on PowerPC.

Signed-off-by: Mukesh Kumar Chaurasiya &lt;mchauras@linux.ibm.com&gt;
Tested-by: Samir M &lt;samir@linux.ibm.com&gt;
Tested-by: David Gow &lt;davidgow@google.com&gt;
Tested-by: Venkat Rao Bagalkote &lt;venkat88@linux.ibm.com&gt;
Reviewed-by: Shrikanth Hegde &lt;sshegde@linux.ibm.com&gt;
Signed-off-by: Madhavan Srinivasan &lt;maddy@linux.ibm.com&gt;
Link: https://patch.msgid.link/20260427122742.210074-4-mkchauras@gmail.com

</pre>
</div>
</content>
</entry>
<entry>
<title>powerpc: Prepare to build with generic entry/exit framework</title>
<updated>2026-05-20T01:27:13+00:00</updated>
<author>
<name>Mukesh Kumar Chaurasiya</name>
<email>mchauras@linux.ibm.com</email>
</author>
<published>2026-04-27T12:27:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=dec63ea6fafffb91811381d9a4686d4bc39f01ae'/>
<id>dec63ea6fafffb91811381d9a4686d4bc39f01ae</id>
<content type='text'>
This patch introduces preparatory changes needed to support building
PowerPC with the generic entry/exit (irqentry) framework.

The following infrastructure updates are added:
 - Add a syscall_work field to struct thread_info to hold SYSCALL_WORK_* flags.
 - Provide a stub implementation of arch_syscall_is_vdso_sigreturn(),
   returning false for now.
 - Introduce on_thread_stack() helper to detect if the current stack pointer
   lies within the task’s kernel stack.

These additions enable later integration with the generic entry/exit
infrastructure while keeping existing PowerPC behavior unchanged.

No functional change is intended in this patch.

Signed-off-by: Mukesh Kumar Chaurasiya &lt;mchauras@linux.ibm.com&gt;
Tested-by: Samir M &lt;samir@linux.ibm.com&gt;
Tested-by: David Gow &lt;davidgow@google.com&gt;
Tested-by: Venkat Rao Bagalkote &lt;venkat88@linux.ibm.com&gt;
Reviewed-by: Shrikanth Hegde &lt;sshegde@linux.ibm.com&gt;
Signed-off-by: Madhavan Srinivasan &lt;maddy@linux.ibm.com&gt;
Link: https://patch.msgid.link/20260427122742.210074-3-mkchauras@gmail.com

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch introduces preparatory changes needed to support building
PowerPC with the generic entry/exit (irqentry) framework.

The following infrastructure updates are added:
 - Add a syscall_work field to struct thread_info to hold SYSCALL_WORK_* flags.
 - Provide a stub implementation of arch_syscall_is_vdso_sigreturn(),
   returning false for now.
 - Introduce on_thread_stack() helper to detect if the current stack pointer
   lies within the task’s kernel stack.

These additions enable later integration with the generic entry/exit
infrastructure while keeping existing PowerPC behavior unchanged.

No functional change is intended in this patch.

Signed-off-by: Mukesh Kumar Chaurasiya &lt;mchauras@linux.ibm.com&gt;
Tested-by: Samir M &lt;samir@linux.ibm.com&gt;
Tested-by: David Gow &lt;davidgow@google.com&gt;
Tested-by: Venkat Rao Bagalkote &lt;venkat88@linux.ibm.com&gt;
Reviewed-by: Shrikanth Hegde &lt;sshegde@linux.ibm.com&gt;
Signed-off-by: Madhavan Srinivasan &lt;maddy@linux.ibm.com&gt;
Link: https://patch.msgid.link/20260427122742.210074-3-mkchauras@gmail.com

</pre>
</div>
</content>
</entry>
</feed>
