This message is in MIME format
--_=XFMail.1.3.p0.Linux:990117193159:323=_
Content-Type: text/plain; charset=KOI8-R
Hello.
> Do not forget to substitute your RAM size in
>#define WRITE_ALLOCATE_LIMIT
Thanks to Alan Cox's hint - there is no need for manual tuning now.
Attached [new] version of patch (against 2.2.0pre7) should enable write
allocate for AMD K6 model 6/7 processors. On my system it gives 5-7%
increase in speed.
--
With best wishes,
Alexey Vyskubov.
This is a message. Or something silly like that.
--_=XFMail.1.3.p0.Linux:990117193159:323=_
Content-Disposition: attachment; filename="k6-patch"
Content-Description: k6-patch
Content-Type: text/plain; charset=KOI8-R; name=k6-patch; SizeOnDisk=2216
Content-Transfer-Encoding: 7bit
--- linux/arch/i386/kernel/setup.c.was Sun Jan 17 12:17:11 1999
+++ linux/arch/i386/kernel/setup.c Sun Jan 17 19:13:26 1999
@@ -601,6 +601,31 @@
static char *cpu_vendor_names[] __initdata = {
"Intel", "Cyrix", "AMD", "UMC", "NexGen", "Centaur" };
+#define AMD_WHCR 0xc0000082 /* AMD MSR WHCR */
+
+int enable_write_allocate (int size)
+{
+ u32 ra, rd;
+ rd = 0;
+
+ ra = size >> 2; /* EAX = 2*(RAM/4) */
+ ra = (ra << 1) + 1; /* +1 for no memory hole at 15-16MB */
+
+
+#define walloc(msr, val1, val2) __asm__ __volatile__ (" pushf
+ cli
+ wbinvd
+ wrmsr
+ popf"\
+ : /* no outputs */\
+ : "c" (msr),\
+ "a" (val1), "d" (val2))
+ walloc(AMD_WHCR, ra, rd);
+ rdmsr(AMD_WHCR, ra, rd); /* Let's see what's happened */
+ ra = ra & 0xfe; /* Drop last bit (memory hole) */
+ ra = ra << 1;
+ return((int)ra);
+}
__initfunc(void print_cpu_info(struct cpuinfo_x86 *c))
{
@@ -621,8 +646,54 @@
if (c->x86_mask || c->cpuid_level>=0)
printk(" stepping %02x", c->x86_mask);
-
- if(c->x86_vendor == X86_VENDOR_CENTAUR)
+
+ if ( (c->x86_vendor == X86_VENDOR_AMD) &&
+ ((c->x86_model == 6) || (c->x86_model == 7)))
+ {
+
+ u32 ra, rd;
+ u32 ram;
+ int mem;
+
+
+ printk("\nAMD K6 processor, model %d found.", c->x86_model);
+ printk("\nChecking write allocate state... ");
+
+ ram = max_mapnr * (PAGE_SIZE >> 10); /* RAM size in Kb */
+ ram = ram >> 10; /* RAM size in Mb */
+
+ rdmsr(AMD_WHCR, ra, rd);
+ mem = (ra & 0xfe) << 1;
+
+ if (mem) {
+ printk("Write allocate is enabled for %d MB of memory", mem);
+ } else {
+ printk("Write allocate is disabled.");
+ }
+
+ if (!(mem == ram)) {
+ printk("\nTrying to enable write alocate for %d MB of memory", ram);
+ mem = ram;
+ mem = enable_write_allocate(mem);
+
+ if (!(mem == ram)) {
+ printk("\nFailed!!!");
+ }
+ printk("\nWrite allocate is enabled for %d MB of memory", mem);
+ }
+
+ rdmsr(AMD_WHCR, ra, rd);
+
+ if (ra & 0x100) {
+ printk("\nWARNING: WCDE bit is 1.");
+ }
+
+ if (!(ra & 0x1)) {
+ printk("\nWARNING: Memory hole at 15-16M is enabled.");
+ }
+ }
+
+ if (c->x86_vendor == X86_VENDOR_CENTAUR)
{
u32 hv,lv;
rdmsr(0x107, lv, hv);
--_=XFMail.1.3.p0.Linux:990117193159:323=_--
End of MIME message
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/
--_=XFMail.1.3.p0.Linux:990117193159:323=_
Content-Type: text/plain; charset=KOI8-R
Hello.
> Do not forget to substitute your RAM size in
>#define WRITE_ALLOCATE_LIMIT
Thanks to Alan Cox's hint - there is no need for manual tuning now.
Attached [new] version of patch (against 2.2.0pre7) should enable write
allocate for AMD K6 model 6/7 processors. On my system it gives 5-7%
increase in speed.
--
With best wishes,
Alexey Vyskubov.
This is a message. Or something silly like that.
--_=XFMail.1.3.p0.Linux:990117193159:323=_
Content-Disposition: attachment; filename="k6-patch"
Content-Description: k6-patch
Content-Type: text/plain; charset=KOI8-R; name=k6-patch; SizeOnDisk=2216
Content-Transfer-Encoding: 7bit
--- linux/arch/i386/kernel/setup.c.was Sun Jan 17 12:17:11 1999
+++ linux/arch/i386/kernel/setup.c Sun Jan 17 19:13:26 1999
@@ -601,6 +601,31 @@
static char *cpu_vendor_names[] __initdata = {
"Intel", "Cyrix", "AMD", "UMC", "NexGen", "Centaur" };
+#define AMD_WHCR 0xc0000082 /* AMD MSR WHCR */
+
+int enable_write_allocate (int size)
+{
+ u32 ra, rd;
+ rd = 0;
+
+ ra = size >> 2; /* EAX = 2*(RAM/4) */
+ ra = (ra << 1) + 1; /* +1 for no memory hole at 15-16MB */
+
+
+#define walloc(msr, val1, val2) __asm__ __volatile__ (" pushf
+ cli
+ wbinvd
+ wrmsr
+ popf"\
+ : /* no outputs */\
+ : "c" (msr),\
+ "a" (val1), "d" (val2))
+ walloc(AMD_WHCR, ra, rd);
+ rdmsr(AMD_WHCR, ra, rd); /* Let's see what's happened */
+ ra = ra & 0xfe; /* Drop last bit (memory hole) */
+ ra = ra << 1;
+ return((int)ra);
+}
__initfunc(void print_cpu_info(struct cpuinfo_x86 *c))
{
@@ -621,8 +646,54 @@
if (c->x86_mask || c->cpuid_level>=0)
printk(" stepping %02x", c->x86_mask);
-
- if(c->x86_vendor == X86_VENDOR_CENTAUR)
+
+ if ( (c->x86_vendor == X86_VENDOR_AMD) &&
+ ((c->x86_model == 6) || (c->x86_model == 7)))
+ {
+
+ u32 ra, rd;
+ u32 ram;
+ int mem;
+
+
+ printk("\nAMD K6 processor, model %d found.", c->x86_model);
+ printk("\nChecking write allocate state... ");
+
+ ram = max_mapnr * (PAGE_SIZE >> 10); /* RAM size in Kb */
+ ram = ram >> 10; /* RAM size in Mb */
+
+ rdmsr(AMD_WHCR, ra, rd);
+ mem = (ra & 0xfe) << 1;
+
+ if (mem) {
+ printk("Write allocate is enabled for %d MB of memory", mem);
+ } else {
+ printk("Write allocate is disabled.");
+ }
+
+ if (!(mem == ram)) {
+ printk("\nTrying to enable write alocate for %d MB of memory", ram);
+ mem = ram;
+ mem = enable_write_allocate(mem);
+
+ if (!(mem == ram)) {
+ printk("\nFailed!!!");
+ }
+ printk("\nWrite allocate is enabled for %d MB of memory", mem);
+ }
+
+ rdmsr(AMD_WHCR, ra, rd);
+
+ if (ra & 0x100) {
+ printk("\nWARNING: WCDE bit is 1.");
+ }
+
+ if (!(ra & 0x1)) {
+ printk("\nWARNING: Memory hole at 15-16M is enabled.");
+ }
+ }
+
+ if (c->x86_vendor == X86_VENDOR_CENTAUR)
{
u32 hv,lv;
rdmsr(0x107, lv, hv);
--_=XFMail.1.3.p0.Linux:990117193159:323=_--
End of MIME message
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/