x86: track when in NMI context
authorRoger Pau Monné <roger.pau@citrix.com>
Wed, 26 Feb 2020 16:37:22 +0000 (17:37 +0100)
committerJan Beulich <jbeulich@suse.com>
Wed, 26 Feb 2020 16:37:22 +0000 (17:37 +0100)
commit88f8b8daa96de9062bb05b7d57f8f4ca2a77a834
tree8ddb42cfcb89799baf67e9b7c729847e0348b803
parent67e11bc8675c77bab2b5020acbaf211abd75096b
x86: track when in NMI context

Add helpers to track when running in NMI handler context. This is
modeled after the in_irq helpers.

The SDM states that no NMI can be delivered while handling a NMI
until the processor has executed an iret instruction. It's possible
however that another fault is received while handling the NMI (a #MC
for example), and thus the iret from that fault would allow further
NMIs to be injected while still processing the previous one, and
hence an integer is needed in order to keep track of in service NMIs.
The added macros only track when the execution context is in the NMI
handler, but that doesn't mean NMIs are blocked for the reasons listed
above.

Note that there are no users of in_nmi_handler() introduced by the
change, further users will be added by followup changes.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/traps.c
xen/include/asm-x86/hardirq.h