* [PATCH 2/3] Pnp bios gdt fix
@ 2005-09-28 21:43 Zachary Amsden
2005-09-28 23:06 ` Zachary Amsden
0 siblings, 1 reply; 2+ messages in thread
From: Zachary Amsden @ 2005-09-28 21:43 UTC (permalink / raw)
To: Linus Torvalds, Jeffrey Sheldon, Ole Agesen, Shai Fultheim,
Andrew Morton, Jack Lo, Ingo Molnar, Linux Kernel Mailing List,
Virtualization Mailing List, Chris Wright, Martin Bligh,
Pratap Subrahmanyam, Christopher Li, H. Peter Anvin,
Zwane Mwaikambo, Andi Kleen, Zachary Amsden
PnP BIOS for x86 is part of drivers, so I missed it in the initial
GDT page alignment patch. Kudos to Andrew for fixing that.
Unfortunately, fixing the build introduced a kernel panic when
trying to setup the as of yet unallocated GDTs for the APs.
This fixes the problem by setting only the BSP's GDT, then copying
the PnP segments back to the cpu_gdt_table template.
Signed-off-by: Zachary Amsden <zach@vmware.com>
Index: linux-2.6.14-rc2/drivers/pnp/pnpbios/bioscalls.c
===================================================================
--- linux-2.6.14-rc2.orig/drivers/pnp/pnpbios/bioscalls.c 2005-09-28 14:16:34.000000000 -0700
+++ linux-2.6.14-rc2/drivers/pnp/pnpbios/bioscalls.c 2005-09-28 14:23:57.000000000 -0700
@@ -528,17 +528,24 @@ static int pnp_bios_write_escd(char *dat
void pnpbios_calls_init(union pnp_bios_install_struct *header)
{
- int i;
spin_lock_init(&pnp_bios_lock);
pnp_bios_callpoint.offset = header->fields.pm16offset;
pnp_bios_callpoint.segment = PNP_CS16;
set_base(bad_bios_desc, __va((unsigned long)0x40 << 4));
_set_limit((char *)&bad_bios_desc, 4095 - (0x40 << 4));
- for(i=0; i < NR_CPUS; i++)
- {
- Q2_SET_SEL(i, PNP_CS32, &pnp_bios_callfunc, 64 * 1024);
- Q_SET_SEL(i, PNP_CS16, header->fields.pm16cseg, 64 * 1024);
- Q_SET_SEL(i, PNP_DS, header->fields.pm16dseg, 64 * 1024);
- }
+
+ /*
+ * This is awkward; GDT entries needed for this driver must
+ * be set during init on the BSP, but also copied into the
+ * cpu_gdt_table template for the APs to acquire. This is
+ * because APs will not have allocated GDTs until later in
+ * the boot process.
+ */
+ Q2_SET_SEL(0, PNP_CS32, &pnp_bios_callfunc, 64 * 1024);
+ Q_SET_SEL(0, PNP_CS16, header->fields.pm16cseg, 64 * 1024);
+ Q_SET_SEL(0, PNP_DS, header->fields.pm16dseg, 64 * 1024);
+ memcpy(&cpu_gdt_table[GDT_ENTRY_PNPBIOS_BASE],
+ &get_cpu_gdt_table(0)[GDT_ENTRY_PNPBIOS_BASE],
+ 3 * sizeof(struct desc_struct));
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 2/3] Pnp bios gdt fix
2005-09-28 21:43 [PATCH 2/3] Pnp bios gdt fix Zachary Amsden
@ 2005-09-28 23:06 ` Zachary Amsden
0 siblings, 0 replies; 2+ messages in thread
From: Zachary Amsden @ 2005-09-28 23:06 UTC (permalink / raw)
To: Zachary Amsden
Cc: Linus Torvalds, Jeffrey Sheldon, Ole Agesen, Shai Fultheim,
Andrew Morton, Jack Lo, Ingo Molnar, Linux Kernel Mailing List,
Virtualization Mailing List, Chris Wright, Martin Bligh,
Pratap Subrahmanyam, Christopher Li, H. Peter Anvin,
Zwane Mwaikambo, Andi Kleen
[-- Attachment #1: Type: text/plain, Size: 585 bytes --]
Zachary Amsden wrote:
>PnP BIOS for x86 is part of drivers, so I missed it in the initial
>GDT page alignment patch. Kudos to Andrew for fixing that.
>Unfortunately, fixing the build introduced a kernel panic when
>trying to setup the as of yet unallocated GDTs for the APs.
>This fixes the problem by setting only the BSP's GDT, then copying
>the PnP segments back to the cpu_gdt_table template.
>
>
>
Bogus patch! I was just getting lucky and not running PnP BIOS code on
the AP's -- until now. Turns out the fix and the bug were much
simpler. Please apply this instead.
[-- Attachment #2: pnp-bios-gdt-fix --]
[-- Type: text/plain, Size: 1104 bytes --]
PnP BIOS for x86 is part of drivers, so I missed it in the initial
GDT page alignment patch. Kudos to Andrew for fixing that.
Unfortunately, fixing the build introduced a kernel panic when
trying to setup the as of yet unallocated GDTs for the APs.
I totally misdiagnosed this. The problem happens only
when NR_CPUS > physical CPUs. Fix is to ignore missing GDT's.
Signed-off-by: Zachary Amsden <zach@vmware.com>
Index: linux-2.6.14-rc2/drivers/pnp/pnpbios/bioscalls.c
===================================================================
--- linux-2.6.14-rc2.orig/drivers/pnp/pnpbios/bioscalls.c 2005-09-28 15:57:42.000000000 -0700
+++ linux-2.6.14-rc2/drivers/pnp/pnpbios/bioscalls.c 2005-09-28 15:59:37.000000000 -0700
@@ -537,6 +537,8 @@ void pnpbios_calls_init(union pnp_bios_i
_set_limit((char *)&bad_bios_desc, 4095 - (0x40 << 4));
for(i=0; i < NR_CPUS; i++)
{
+ if (!get_cpu_gdt_table(i))
+ continue;
Q2_SET_SEL(i, PNP_CS32, &pnp_bios_callfunc, 64 * 1024);
Q_SET_SEL(i, PNP_CS16, header->fields.pm16cseg, 64 * 1024);
Q_SET_SEL(i, PNP_DS, header->fields.pm16dseg, 64 * 1024);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-09-28 23:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-28 21:43 [PATCH 2/3] Pnp bios gdt fix Zachary Amsden
2005-09-28 23:06 ` Zachary Amsden
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox