Re: [PATCH] i386: init early_gdt_descr and idle task properly onvoyager

From: James Bottomley
Date: Mon Apr 30 2007 - 14:27:24 EST


On Sat, 2007-04-28 at 17:21 -0700, Jeremy Fitzhardinge wrote:
> Initialize early_gdt_descr and idle task properly.
>
> [ Incremental fix for "i386: introduce voyager smp_ops, fix voyager build" ]

Still not quite enough. this is what I need to complete the build:

James

Index: voyager-2.6/arch/i386/kernel/cpu/common.c
===================================================================
--- voyager-2.6.orig/arch/i386/kernel/cpu/common.c 2007-04-30 12:49:45.000000000 -0500
+++ voyager-2.6/arch/i386/kernel/cpu/common.c 2007-04-30 13:03:42.000000000 -0500
@@ -21,6 +21,9 @@

#include "cpu.h"

+DEFINE_PER_CPU(unsigned long, this_cpu_off);
+EXPORT_PER_CPU_SYMBOL(this_cpu_off);
+
DEFINE_PER_CPU(struct gdt_page, gdt_page) = { .gdt = {
[GDT_ENTRY_KERNEL_CS] = { 0x0000ffff, 0x00cf9a00 },
[GDT_ENTRY_KERNEL_DS] = { 0x0000ffff, 0x00cf9200 },
@@ -650,6 +653,22 @@ void switch_to_new_gdt(void)
asm("mov %0, %%fs" : : "r" (__KERNEL_PERCPU) : "memory");
}

+/* Initialize the CPU's GDT. This is either the boot CPU doing itself
+ (still using the master per-cpu area), or a CPU doing it for a
+ secondary which will soon come up. */
+__cpuinit void init_gdt(int cpu)
+{
+ struct desc_struct *gdt = get_cpu_gdt_table(cpu);
+
+ pack_descriptor((u32 *)&gdt[GDT_ENTRY_PERCPU].a,
+ (u32 *)&gdt[GDT_ENTRY_PERCPU].b,
+ __per_cpu_offset[cpu], 0xFFFFF,
+ 0x80 | DESCTYPE_S | 0x2, 0x8);
+
+ per_cpu(this_cpu_off, cpu) = __per_cpu_offset[cpu];
+ per_cpu(cpu_number, cpu) = cpu;
+}
+
/*
* cpu_init() initializes state that is per-CPU. Some data is already
* initialized (naturally) in the bootstrap process, such as the GDT
Index: voyager-2.6/arch/i386/kernel/smpboot.c
===================================================================
--- voyager-2.6.orig/arch/i386/kernel/smpboot.c 2007-04-30 12:49:45.000000000 -0500
+++ voyager-2.6/arch/i386/kernel/smpboot.c 2007-04-30 13:03:45.000000000 -0500
@@ -99,9 +99,6 @@ EXPORT_SYMBOL(x86_cpu_to_apicid);

u8 apicid_2_node[MAX_APICID];

-DEFINE_PER_CPU(unsigned long, this_cpu_off);
-EXPORT_PER_CPU_SYMBOL(this_cpu_off);
-
/*
* Trampoline 80x86 program as an array.
*/
@@ -764,25 +761,6 @@ static inline struct task_struct * alloc
#define alloc_idle_task(cpu) fork_idle(cpu)
#endif

-/* Initialize the CPU's GDT. This is either the boot CPU doing itself
- (still using the master per-cpu area), or a CPU doing it for a
- secondary which will soon come up. */
-static __cpuinit void init_gdt(int cpu)
-{
- struct desc_struct *gdt = get_cpu_gdt_table(cpu);
-
- pack_descriptor((u32 *)&gdt[GDT_ENTRY_PERCPU].a,
- (u32 *)&gdt[GDT_ENTRY_PERCPU].b,
- __per_cpu_offset[cpu], 0xFFFFF,
- 0x80 | DESCTYPE_S | 0x2, 0x8);
-
- per_cpu(this_cpu_off, cpu) = __per_cpu_offset[cpu];
- per_cpu(cpu_number, cpu) = cpu;
-}
-
-/* Defined in head.S */
-extern struct Xgt_desc_struct early_gdt_descr;
-
static int __cpuinit do_boot_cpu(int apicid, int cpu)
/*
* NOTE - on most systems this is a PHYSICAL apic ID, but on multiquad
Index: voyager-2.6/include/asm-i386/processor.h
===================================================================
--- voyager-2.6.orig/include/asm-i386/processor.h 2007-04-30 12:49:45.000000000 -0500
+++ voyager-2.6/include/asm-i386/processor.h 2007-04-30 12:54:47.000000000 -0500
@@ -749,6 +749,10 @@ extern unsigned long boot_option_idle_ov
extern void enable_sep_cpu(void);
extern int sysenter_setup(void);

+/* Defined in head.S */
+extern struct Xgt_desc_struct early_gdt_descr;
+
+extern void init_gdt(int cpu);
extern void cpu_set_gdt(int);
extern void switch_to_new_gdt(void);
extern void cpu_init(void);


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/