aboutsummaryrefslogtreecommitdiff
path: root/arch/x86/include/uapi
diff options
context:
space:
mode:
authorGravatar Juergen Gross <jgross@suse.com> 2023-05-02 14:09:29 +0200
committerGravatar Borislav Petkov (AMD) <bp@alien8.de> 2023-06-01 15:04:33 +0200
commit973df1942068c0cc72244ce7dce5e5aeca03ad5f (patch)
tree3fc6230c4acde5b2c7ede986d865766d2a765b1f /arch/x86/include/uapi
parentx86/mtrr: Use new cache_map in mtrr_type_lookup() (diff)
downloadlinux-973df1942068c0cc72244ce7dce5e5aeca03ad5f.tar.gz
linux-973df1942068c0cc72244ce7dce5e5aeca03ad5f.tar.bz2
linux-973df1942068c0cc72244ce7dce5e5aeca03ad5f.zip
x86/mtrr: Don't let mtrr_type_lookup() return MTRR_TYPE_INVALID
mtrr_type_lookup() should always return a valid memory type. In case there is no information available, it should return the default UC. This will remove the last case where mtrr_type_lookup() can return MTRR_TYPE_INVALID, so adjust the comment in include/uapi/asm/mtrr.h. Note that removing the MTRR_TYPE_INVALID #define from that header could break user code, so it has to stay. At the same time the mtrr_type_lookup() stub for the !CONFIG_MTRR case should set uniform to 1, as if the memory range would be covered by no MTRR at all. Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Juergen Gross <jgross@suse.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Tested-by: Michael Kelley <mikelley@microsoft.com> Link: https://lore.kernel.org/r/20230502120931.20719-15-jgross@suse.com Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Diffstat (limited to 'arch/x86/include/uapi')
-rw-r--r--arch/x86/include/uapi/asm/mtrr.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/x86/include/uapi/asm/mtrr.h b/arch/x86/include/uapi/asm/mtrr.h
index ab194c831625..3a8a8eb8ac3a 100644
--- a/arch/x86/include/uapi/asm/mtrr.h
+++ b/arch/x86/include/uapi/asm/mtrr.h
@@ -107,9 +107,9 @@ typedef __u8 mtrr_type;
#define MTRR_NUM_TYPES 7
/*
- * Invalid MTRR memory type. mtrr_type_lookup() returns this value when
- * MTRRs are disabled. Note, this value is allocated from the reserved
- * values (0x7-0xff) of the MTRR memory types.
+ * Invalid MTRR memory type. No longer used outside of MTRR code.
+ * Note, this value is allocated from the reserved values (0x7-0xff) of
+ * the MTRR memory types.
*/
#define MTRR_TYPE_INVALID 0xff