x86/mtrr: Remove the mtrr_bp_init() stub
Add an IS_ENABLED() check in setup_arch() and call pat_disable() directly if MTRRs are not supported. This allows to remove the <asm/memtype.h> include in <asm/mtrr.h>, which pull in lowlevel x86 headers that should not be included for UML builds and will cause build warnings with a following patch. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Borislav Petkov <bp@suse.de> Link: https://lore.kernel.org/r/20211215165612.554426-2-hch@lst.de
This commit is contained in:
committed by
Borislav Petkov
parent
c494eb366d
commit
4d5cff69fb
@@ -24,8 +24,8 @@
|
|||||||
#define _ASM_X86_MTRR_H
|
#define _ASM_X86_MTRR_H
|
||||||
|
|
||||||
#include <uapi/asm/mtrr.h>
|
#include <uapi/asm/mtrr.h>
|
||||||
#include <asm/memtype.h>
|
|
||||||
|
|
||||||
|
void mtrr_bp_init(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The following functions are for use by other drivers that cannot use
|
* The following functions are for use by other drivers that cannot use
|
||||||
@@ -43,7 +43,6 @@ extern int mtrr_del(int reg, unsigned long base, unsigned long size);
|
|||||||
extern int mtrr_del_page(int reg, unsigned long base, unsigned long size);
|
extern int mtrr_del_page(int reg, unsigned long base, unsigned long size);
|
||||||
extern void mtrr_centaur_report_mcr(int mcr, u32 lo, u32 hi);
|
extern void mtrr_centaur_report_mcr(int mcr, u32 lo, u32 hi);
|
||||||
extern void mtrr_ap_init(void);
|
extern void mtrr_ap_init(void);
|
||||||
extern void mtrr_bp_init(void);
|
|
||||||
extern void set_mtrr_aps_delayed_init(void);
|
extern void set_mtrr_aps_delayed_init(void);
|
||||||
extern void mtrr_aps_init(void);
|
extern void mtrr_aps_init(void);
|
||||||
extern void mtrr_bp_restore(void);
|
extern void mtrr_bp_restore(void);
|
||||||
@@ -84,11 +83,6 @@ static inline int mtrr_trim_uncached_memory(unsigned long end_pfn)
|
|||||||
static inline void mtrr_centaur_report_mcr(int mcr, u32 lo, u32 hi)
|
static inline void mtrr_centaur_report_mcr(int mcr, u32 lo, u32 hi)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
static inline void mtrr_bp_init(void)
|
|
||||||
{
|
|
||||||
pat_disable("PAT support disabled because CONFIG_MTRR is disabled in the kernel.");
|
|
||||||
}
|
|
||||||
|
|
||||||
#define mtrr_ap_init() do {} while (0)
|
#define mtrr_ap_init() do {} while (0)
|
||||||
#define set_mtrr_aps_delayed_init() do {} while (0)
|
#define set_mtrr_aps_delayed_init() do {} while (0)
|
||||||
#define mtrr_aps_init() do {} while (0)
|
#define mtrr_aps_init() do {} while (0)
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
#include <asm/kasan.h>
|
#include <asm/kasan.h>
|
||||||
#include <asm/kaslr.h>
|
#include <asm/kaslr.h>
|
||||||
#include <asm/mce.h>
|
#include <asm/mce.h>
|
||||||
|
#include <asm/memtype.h>
|
||||||
#include <asm/mtrr.h>
|
#include <asm/mtrr.h>
|
||||||
#include <asm/realmode.h>
|
#include <asm/realmode.h>
|
||||||
#include <asm/olpc_ofw.h>
|
#include <asm/olpc_ofw.h>
|
||||||
@@ -979,7 +980,11 @@ void __init setup_arch(char **cmdline_p)
|
|||||||
max_pfn = e820__end_of_ram_pfn();
|
max_pfn = e820__end_of_ram_pfn();
|
||||||
|
|
||||||
/* update e820 for memory not covered by WB MTRRs */
|
/* update e820 for memory not covered by WB MTRRs */
|
||||||
mtrr_bp_init();
|
if (IS_ENABLED(CONFIG_MTRR))
|
||||||
|
mtrr_bp_init();
|
||||||
|
else
|
||||||
|
pat_disable("PAT support disabled because CONFIG_MTRR is disabled in the kernel.");
|
||||||
|
|
||||||
if (mtrr_trim_uncached_memory(max_pfn))
|
if (mtrr_trim_uncached_memory(max_pfn))
|
||||||
max_pfn = e820__end_of_ram_pfn();
|
max_pfn = e820__end_of_ram_pfn();
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
#include "spte.h"
|
#include "spte.h"
|
||||||
|
|
||||||
#include <asm/e820/api.h>
|
#include <asm/e820/api.h>
|
||||||
|
#include <asm/memtype.h>
|
||||||
#include <asm/vmx.h>
|
#include <asm/vmx.h>
|
||||||
|
|
||||||
static bool __read_mostly enable_mmio_caching = true;
|
static bool __read_mostly enable_mmio_caching = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user