Skip to content

Commit 12031a6

Browse files
Yinghai LuKAGA-KOKO
authored andcommitted
x86: mtrr cleanup for converting continuous to discrete - auto detect v4
Loop through mtrr chunk_size and gran_size from 1M to 2G to find out the optimal value so user does not need to add mtrr_chunk_size and mtrr_gran_size to the kernel command line. If optimal value is not found, print out all list to help select less optimal value. Add mtrr_spare_reg_nr= so user could set 2 instead of 1, if the card need more entries. v2: find the one with more spare entries v3: fix hole_basek offset v4: tight the compare between range and range_new loop stop with 4g Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Gabriel C <nix.or.die@googlemail.com> Cc: Mika Fischer <mika.fischer@zoopnet.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Ingo Molnar <mingo@elte.hu>
1 parent f5098d6 commit 12031a6

3 files changed

Lines changed: 484 additions & 148 deletions

File tree

‎Documentation/kernel-parameters.txt‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -610,8 +610,17 @@ and is between 256 and 4096 characters. It is defined in the file
610610
that could hold holes aka. UC entries.
611611

612612
mtrr_gran_size=nn[KMG] [X86]
613-
used for mtrr cleanup. It is granity of mtrr block.
614-
Big value could prevent small alignment use up MTRRs.
613+
Used for mtrr cleanup. It is granularity of mtrr block.
614+
Default is 1.
615+
Large value could prevent small alignment from
616+
using up MTRRs.
617+
618+
mtrr_spare_reg_nr=n [X86]
619+
Format: <integer>
620+
Range: 0,7 : spare reg number
621+
Default : 1
622+
Used for mtrr cleanup. It is spare mtrr entries number.
623+
Set to 2 or more if your graphical card needs more.
615624

616625
disable_mtrr_trim [X86, Intel and AMD only]
617626
By default the kernel will trim any uncacheable

‎arch/x86/Kconfig‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,6 +1117,15 @@ config MTRR_SANITIZER_ENABLE_DEFAULT
11171117
help
11181118
Enable mtrr cleanup default value
11191119

1120+
config MTRR_SANITIZER_SPARE_REG_NR_DEFAULT
1121+
int "MTRR cleanup spare reg num (0-7)"
1122+
range 0 7
1123+
default "1"
1124+
depends on MTRR_SANITIZER
1125+
help
1126+
mtrr cleanup spare entries default, it can be changed via
1127+
mtrr_spare_reg_nr=
1128+
11201129
config X86_PAT
11211130
bool
11221131
prompt "x86 PAT support"

0 commit comments

Comments
 (0)