aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp/pnpbios
diff options
context:
space:
mode:
authorZachary Amsden <zach@vmware.com>2006-01-06 03:11:47 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-06 11:33:33 -0500
commit7c4cb60e5b97677424e95baee9c29df54b26e6ba (patch)
treea2ad6e6104e153d15bc4bfbb67f74b0e05fea03c /drivers/pnp/pnpbios
parent599a6e8ca4ff7f453f847217ecc2718d68e3b0f6 (diff)
[PATCH] x86: GDT alignment fix
Make GDT page aligned and page padded to support running inside of a hypervisor. This prevents false sharing of the GDT page with other hot data, which is not allowed in Xen, and causes performance problems in VMware. Rather than go back to the old method of statically allocating the GDT (which wastes unneded space for non-present CPUs), the GDT for APs is allocated dynamically. Signed-off-by: Zachary Amsden <zach@vmware.com> Cc: "Seth, Rohit" <rohit.seth@intel.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/pnp/pnpbios')
-rw-r--r--drivers/pnp/pnpbios/bioscalls.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/drivers/pnp/pnpbios/bioscalls.c b/drivers/pnp/pnpbios/bioscalls.c
index 6b7583f497d0..7cb476ed7f91 100644
--- a/drivers/pnp/pnpbios/bioscalls.c
+++ b/drivers/pnp/pnpbios/bioscalls.c
@@ -69,14 +69,16 @@ __asm__(
69 69
70#define Q_SET_SEL(cpu, selname, address, size) \ 70#define Q_SET_SEL(cpu, selname, address, size) \
71do { \ 71do { \
72set_base(per_cpu(cpu_gdt_table,cpu)[(selname) >> 3], __va((u32)(address))); \ 72struct desc_struct *gdt = get_cpu_gdt_table((cpu)); \
73set_limit(per_cpu(cpu_gdt_table,cpu)[(selname) >> 3], size); \ 73set_base(gdt[(selname) >> 3], __va((u32)(address))); \
74set_limit(gdt[(selname) >> 3], size); \
74} while(0) 75} while(0)
75 76
76#define Q2_SET_SEL(cpu, selname, address, size) \ 77#define Q2_SET_SEL(cpu, selname, address, size) \
77do { \ 78do { \
78set_base(per_cpu(cpu_gdt_table,cpu)[(selname) >> 3], (u32)(address)); \ 79struct desc_struct *gdt = get_cpu_gdt_table((cpu)); \
79set_limit(per_cpu(cpu_gdt_table,cpu)[(selname) >> 3], size); \ 80set_base(gdt[(selname) >> 3], (u32)(address)); \
81set_limit(gdt[(selname) >> 3], size); \
80} while(0) 82} while(0)
81 83
82static struct desc_struct bad_bios_desc = { 0, 0x00409200 }; 84static struct desc_struct bad_bios_desc = { 0, 0x00409200 };
@@ -115,8 +117,8 @@ static inline u16 call_pnp_bios(u16 func, u16 arg1, u16 arg2, u16 arg3,
115 return PNP_FUNCTION_NOT_SUPPORTED; 117 return PNP_FUNCTION_NOT_SUPPORTED;
116 118
117 cpu = get_cpu(); 119 cpu = get_cpu();
118 save_desc_40 = per_cpu(cpu_gdt_table,cpu)[0x40 / 8]; 120 save_desc_40 = get_cpu_gdt_table(cpu)[0x40 / 8];
119 per_cpu(cpu_gdt_table,cpu)[0x40 / 8] = bad_bios_desc; 121 get_cpu_gdt_table(cpu)[0x40 / 8] = bad_bios_desc;
120 122
121 /* On some boxes IRQ's during PnP BIOS calls are deadly. */ 123 /* On some boxes IRQ's during PnP BIOS calls are deadly. */
122 spin_lock_irqsave(&pnp_bios_lock, flags); 124 spin_lock_irqsave(&pnp_bios_lock, flags);
@@ -158,7 +160,7 @@ static inline u16 call_pnp_bios(u16 func, u16 arg1, u16 arg2, u16 arg3,
158 ); 160 );
159 spin_unlock_irqrestore(&pnp_bios_lock, flags); 161 spin_unlock_irqrestore(&pnp_bios_lock, flags);
160 162
161 per_cpu(cpu_gdt_table,cpu)[0x40 / 8] = save_desc_40; 163 get_cpu_gdt_table(cpu)[0x40 / 8] = save_desc_40;
162 put_cpu(); 164 put_cpu();
163 165
164 /* If we get here and this is set then the PnP BIOS faulted on us. */ 166 /* If we get here and this is set then the PnP BIOS faulted on us. */
@@ -535,8 +537,10 @@ void pnpbios_calls_init(union pnp_bios_install_struct *header)
535 537
536 set_base(bad_bios_desc, __va((unsigned long)0x40 << 4)); 538 set_base(bad_bios_desc, __va((unsigned long)0x40 << 4));
537 _set_limit((char *)&bad_bios_desc, 4095 - (0x40 << 4)); 539 _set_limit((char *)&bad_bios_desc, 4095 - (0x40 << 4));
538 for(i=0; i < NR_CPUS; i++) 540 for (i = 0; i < NR_CPUS; i++) {
539 { 541 struct desc_struct *gdt = get_cpu_gdt_table(i);
542 if (!gdt)
543 continue;
540 Q2_SET_SEL(i, PNP_CS32, &pnp_bios_callfunc, 64 * 1024); 544 Q2_SET_SEL(i, PNP_CS32, &pnp_bios_callfunc, 64 * 1024);
541 Q_SET_SEL(i, PNP_CS16, header->fields.pm16cseg, 64 * 1024); 545 Q_SET_SEL(i, PNP_CS16, header->fields.pm16cseg, 64 * 1024);
542 Q_SET_SEL(i, PNP_DS, header->fields.pm16dseg, 64 * 1024); 546 Q_SET_SEL(i, PNP_DS, header->fields.pm16dseg, 64 * 1024);