public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* PATCH: 2.5.29 Fix pnpbios
@ 2002-07-28  0:47 Alan Cox
  2002-07-28  4:53 ` [OOPS] " Nathaniel
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Cox @ 2002-07-28  0:47 UTC (permalink / raw)
  To: torvalds, linux-kernel

This should do the trick for pnpbios - we load the initial gdt into each
gdt, and we load the parameters into the gdt of the cpu making the call 
relying on the spinlock to avoid bouncing cpu due to pre-empt

diff -u --exclude-from /usr/src/exclude --new-file --recursive linux-2.5.29/drivers/pnp/pnpbios_core.c linux-2.5.29-ac1/drivers/pnp/pnpbios_core.c
--- linux-2.5.29/drivers/pnp/pnpbios_core.c	2002-07-20 20:11:06.000000000 +0100
+++ linux-2.5.29-ac1/drivers/pnp/pnpbios_core.c	2002-07-28 00:35:17.000000000 +0100
@@ -124,13 +124,13 @@
 	".previous		\n"
 );
 
-#define Q_SET_SEL(selname, address, size) \
-set_base (gdt [(selname) >> 3], __va((u32)(address))); \
-set_limit (gdt [(selname) >> 3], size)
-
-#define Q2_SET_SEL(selname, address, size) \
-set_base (gdt [(selname) >> 3], (u32)(address)); \
-set_limit (gdt [(selname) >> 3], size)
+#define Q_SET_SEL(cpu, selname, address, size) \
+set_base(cpu_gdt_table[cpu][(selname) >> 3], __va((u32)(address))); \
+_set_limit(&cpu_gdt_table[cpu][(selname) >> 3], size)
+
+#define Q2_SET_SEL(cpu, selname, address, size) \
+set_base(cpu_gdt_table[cpu][(selname) >> 3], (u32)(address)); \
+_set_limit((char *)&cpu_gdt_table[cpu][(selname) >> 3], size)
 
 /*
  * At some point we want to use this stack frame pointer to unwind
@@ -161,10 +161,11 @@
 	/* On some boxes IRQ's during PnP BIOS calls are deadly.  */
 	spin_lock_irqsave(&pnp_bios_lock, flags);
 
+	/* The lock prevents us bouncing CPU here */
 	if (ts1_size)
-		Q2_SET_SEL(PNP_TS1, ts1_base, ts1_size);
+		Q2_SET_SEL(smp_processor_id(), PNP_TS1, ts1_base, ts1_size);
 	if (ts2_size)
-		Q2_SET_SEL(PNP_TS2, ts2_base, ts2_size);
+		Q2_SET_SEL(smp_processor_id(), PNP_TS2, ts2_base, ts2_size);
 
 	__asm__ __volatile__(
 	        "pushl %%ebp\n\t"
@@ -1265,12 +1266,16 @@
                        check->fields.version >> 4, check->fields.version & 15,
 		       check->fields.pm16cseg, check->fields.pm16offset,
 		       check->fields.pm16dseg);
-		Q2_SET_SEL(PNP_CS32, &pnp_bios_callfunc, 64 * 1024);
-		Q_SET_SEL(PNP_CS16, check->fields.pm16cseg, 64 * 1024);
-		Q_SET_SEL(PNP_DS, check->fields.pm16dseg, 64 * 1024);
 		pnp_bios_callpoint.offset = check->fields.pm16offset;
 		pnp_bios_callpoint.segment = PNP_CS16;
 		pnp_bios_hdr = check;
+
+		for(i=0; i < NR_CPUS; i++)
+		{
+			Q2_SET_SEL(i, PNP_CS32, &pnp_bios_callfunc, 64 * 1024);
+			Q_SET_SEL(i, PNP_CS16, check->fields.pm16cseg, 64 * 1024);
+			Q_SET_SEL(i, PNP_DS, check->fields.pm16dseg, 64 * 1024);
+		}
 		break;
 	}
 	if (!pnp_bios_present())

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [OOPS] Re: PATCH: 2.5.29 Fix pnpbios
  2002-07-28  0:47 PATCH: 2.5.29 Fix pnpbios Alan Cox
@ 2002-07-28  4:53 ` Nathaniel
  2002-07-28 20:08   ` Alan Cox
  0 siblings, 1 reply; 3+ messages in thread
From: Nathaniel @ 2002-07-28  4:53 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-kernel

Alan Cox wrote:
> This should do the trick for pnpbios - we load the initial gdt into each
> gdt, and we load the parameters into the gdt of the cpu making the call 
> relying on the spinlock to avoid bouncing cpu due to pre-empt

I get the following (hand-transcribed) oops at bootup on a patched (see below) 2.5.29 on a UP Athlon 900Mhz system with an ASUS K7V (unsure about the V) motherboard.

PnPBIOS: Found PnP BIOS intallation structure at 0xc00fc2b0
PnPBIOS: PnP Version 1.0, entry 0xf0000:0xc2e0
general protection fault: 0000
CPU: 
0
EIP: 
0060:[<00000004>] 
Not tainted
EFLAGS: 
00010082
eax: 00000000 ebx: 00020078 ecx: 00700078 edx: 00000000
esi: 00000246 edi: 00020078 ebp: c12abf84 esp: c12abf00
ds: 0018 es: 0018 ss: 0018
Process swapper (pid: 1, threadinfo=c12aa000 task=c12a9040)
Stack: 00000000 00020078 00700078 00000000 c01f63e8 00000010 00000082 00000000
        00000000 00000018 00000018 00000246 00020078 c12abf84 c12abf84 000000a0
        c02a13da 00000000 c12aa000 00000000 c01f645b c12abf84 c12abf84 c02edee8
Call trace: [<c01f63e8>] [<c01f645b>] [<c0105088>] [<c105688>]
Code: Bad EIP value.
  <0> Kernel panic: attempted to kill init!
  Spurious 8295A interrupt: IRQ7.


 >>EIP; 00000004 Before first symbol   <=====

 >>ebx; 00020078 Before first symbol
 >>ecx; 00700078 Before first symbol
 >>edi; 00020078 Before first symbol
 >>ebp; c12abf84 <END_OF_CODE+f7c5d8/????>
 >>esp; c12abf00 <END_OF_CODE+f7c554/????>

Trace; c01f63e8 <__pnp_bios_dev_node_info+d8/140>
Trace; c01f645b <pnp_bios_dev_node_info+b/30>
Trace; c0105088 <init+28/170>
Trace; 0c105688 Before first symbol


I hope that is accurate and means something to somebody.

Patches applied to this tree:

acpi_system.c_needs_interrupt.h.patch
lkml-alan-fix_pnpbios.patch
lkml-mingo-AFTER-RR-FIX_CPUHP-scheduler_migration_fix.diff
lkml-mingo-fix_serial_irq_oopses
lkml-peter_osterlund-fix_LDM_config.patch
lkml-rr-fix_cpuhp_smp.patch
lkml-rr-fix_cpuhp_smp2.patch
lkml-wli-PAE_compile_fix.patch
netdev-random-core-rml-2.5.19-1.patch
netdev-random-drivers-rml-2.5.19-1.patch

None of these touch pnp except Alan's.

--Nathan



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [OOPS] Re: PATCH: 2.5.29 Fix pnpbios
  2002-07-28  4:53 ` [OOPS] " Nathaniel
@ 2002-07-28 20:08   ` Alan Cox
  0 siblings, 0 replies; 3+ messages in thread
From: Alan Cox @ 2002-07-28 20:08 UTC (permalink / raw)
  To: Nathaniel; +Cc: linux-kernel

On Sun, 2002-07-28 at 05:53, Nathaniel wrote:
> Alan Cox wrote:
> > This should do the trick for pnpbios - we load the initial gdt into each
> > gdt, and we load the parameters into the gdt of the cpu making the call 
> > relying on the spinlock to avoid bouncing cpu due to pre-empt
> 
> I get the following (hand-transcribed) oops at bootup on a patched (see below) 2.5.29 on a UP Athlon 900Mhz system with an ASUS K7V (unsure about the V) motherboard.

It blew up making the initial PnPBIOS call. That certainly smells of
incorrectly set up GDT segments. I'll take a look


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-07-28 18:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-07-28  0:47 PATCH: 2.5.29 Fix pnpbios Alan Cox
2002-07-28  4:53 ` [OOPS] " Nathaniel
2002-07-28 20:08   ` Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox