To prepare for NMI-source reporting, add a source vector argument to the
NMI handler registration interface. Later, this will be used to
register NMI handlers with a unique source vector that can be used to
identify the originator of the NMI.
For now, just extend the interface and pass zero as the source vector
for all handlers. No functional change intended.
Originally-by: Jacob Pan <jacob.jun.pan@xxxxxxxxxxxxxxx>
Signed-off-by: Sohil Mehta <sohil.mehta@xxxxxxxxx>
diff --git a/arch/x86/include/asm/nmi.h b/arch/x86/include/asm/nmi.h
index 79d88d12c8fb..f0a577bf7bba 100644
--- a/arch/x86/include/asm/nmi.h
+++ b/arch/x86/include/asm/nmi.h
@@ -54,6 +54,7 @@ struct nmiaction {
u64 max_duration;
unsigned long flags;
const char *name;
+ u8 source_vector;
};
/**
@@ -62,6 +63,7 @@ struct nmiaction {
* @fn: The NMI handler
* @fg: Flags associated with the NMI handler
* @n: Name of the NMI handler
+ * @src: NMI-source based vector for the NMI handler
* @init: Optional __init* attributes for struct nmiactionPlease keep the line-ending backslashes (\) aligned.
*
* Adds the provided handler to the list of handlers for the specified
@@ -75,13 +77,14 @@ struct nmiaction {
*
* Return: 0 on success, or an error code on failure.
*/
-#define register_nmi_handler(t, fn, fg, n, init...) \
+#define register_nmi_handler(t, fn, fg, n, src, init...) \
({ \
static struct nmiaction init fn##_na = { \
.list = LIST_HEAD_INIT(fn##_na.list), \
.handler = (fn), \
.name = (n), \
.flags = (fg), \
+ .source_vector = (src), \
}; \
__register_nmi_handler((t), &fn##_na); \
})