diff --git a/sys/amd64/amd64/amd64_mem.c b/sys/amd64/amd64/amd64_mem.c index fcff3cee6bd..589fc64721c 100644 --- a/sys/amd64/amd64/amd64_mem.c +++ b/sys/amd64/amd64/amd64_mem.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -60,6 +61,11 @@ static char *mem_owner_bios = "BIOS"; #define mrcopyflags(curr, new) (((curr) & ~MDF_ATTRMASK) | ((new) & MDF_ATTRMASK)) +static int mtrrs_disabled; +TUNABLE_INT("machdep.disable_mtrrs", &mtrrs_disabled); +SYSCTL_INT(_machdep, OID_AUTO, disable_mtrrs, CTLFLAG_RD, + &mtrrs_disabled, 0, "Disable i686 MTRRs."); + static void i686_mrinit(struct mem_range_softc *sc); static int i686_mrset(struct mem_range_softc *sc, struct mem_range_desc *mrd, @@ -601,7 +607,7 @@ static void i686_mem_drvinit(void *unused) { /* Try for i686 MTRRs */ - if ((cpu_feature & CPUID_MTRR) && + if (!mtrrs_disabled && (cpu_feature & CPUID_MTRR) && ((cpu_id & 0xf00) == 0x600 || (cpu_id & 0xf00) == 0xf00) && ((strcmp(cpu_vendor, "GenuineIntel") == 0) || (strcmp(cpu_vendor, "AuthenticAMD") == 0))) { diff --git a/sys/boot/common/help.common b/sys/boot/common/help.common index c97ba414e79..ad30a33cde8 100644 --- a/sys/boot/common/help.common +++ b/sys/boot/common/help.common @@ -256,6 +256,10 @@ Disable the use of the PCI BIOS (i386 only) + set machdep.disable_mtrrs=1 + + Disable the use of i686 MTRRs (i386 only) + set net.inet.tcp.tcbhashsize= TCBHASHSIZE Overrides the compile-time set value of TCBHASHSIZE or diff --git a/sys/boot/common/loader.8 b/sys/boot/common/loader.8 index a76e691031d..a32be170bf4 100644 --- a/sys/boot/common/loader.8 +++ b/sys/boot/common/loader.8 @@ -476,6 +476,8 @@ Note that the NBUF parameter will override this limit. Modifies .Va VM_BCACHE_SIZE_MAX . +.It Va machdep.disable_mtrrs +Disable the use of i686 MTRRs (x86 only). .It Va machdep.pccard.pcic_irq Overrides the IRQ normally assigned to a PCCARD controller. Typically the first available interrupt will be allocated, diff --git a/sys/i386/i386/i686_mem.c b/sys/i386/i386/i686_mem.c index fcff3cee6bd..589fc64721c 100644 --- a/sys/i386/i386/i686_mem.c +++ b/sys/i386/i386/i686_mem.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -60,6 +61,11 @@ static char *mem_owner_bios = "BIOS"; #define mrcopyflags(curr, new) (((curr) & ~MDF_ATTRMASK) | ((new) & MDF_ATTRMASK)) +static int mtrrs_disabled; +TUNABLE_INT("machdep.disable_mtrrs", &mtrrs_disabled); +SYSCTL_INT(_machdep, OID_AUTO, disable_mtrrs, CTLFLAG_RD, + &mtrrs_disabled, 0, "Disable i686 MTRRs."); + static void i686_mrinit(struct mem_range_softc *sc); static int i686_mrset(struct mem_range_softc *sc, struct mem_range_desc *mrd, @@ -601,7 +607,7 @@ static void i686_mem_drvinit(void *unused) { /* Try for i686 MTRRs */ - if ((cpu_feature & CPUID_MTRR) && + if (!mtrrs_disabled && (cpu_feature & CPUID_MTRR) && ((cpu_id & 0xf00) == 0x600 || (cpu_id & 0xf00) == 0xf00) && ((strcmp(cpu_vendor, "GenuineIntel") == 0) || (strcmp(cpu_vendor, "AuthenticAMD") == 0))) {