Re: [PATCH 12/20] x86_64: 64bit ACPI wakeup trampoline
Hi! > > ...you'll still keep 80-column rule while keeping it readable. > > > > Thanks. Done the changes in attached patch. > > > > @@ -159,11 +159,11 @@ wakeup_32: > > >*/ > > > > > > /* Finally jump in 64bit mode */ > > > - ljmp*(wakeup_long64_vector - __START_KERNEL_map) > > > +ljmp*(wakeup_long64_vector - wakeup_code)(%esi) > > > > spaces vs. tabs problem. > > > > Thanks. Done the changes in attached patch. ... > o Increased the size of the wakeup routine to 8K. This is required as > wake page tables are on trampoline itself and they got to be at 4K > boundary, hence one page is not sufficient. > > Signed-off-by: Eric W. Biederman <[EMAIL PROTECTED]> > Signed-off-by: Vivek Goyal <[EMAIL PROTECTED]> ACK. Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 12/20] x86_64: 64bit ACPI wakeup trampoline
Hi! ...you'll still keep 80-column rule while keeping it readable. Thanks. Done the changes in attached patch. @@ -159,11 +159,11 @@ wakeup_32: */ /* Finally jump in 64bit mode */ - ljmp*(wakeup_long64_vector - __START_KERNEL_map) +ljmp*(wakeup_long64_vector - wakeup_code)(%esi) spaces vs. tabs problem. Thanks. Done the changes in attached patch. ... o Increased the size of the wakeup routine to 8K. This is required as wake page tables are on trampoline itself and they got to be at 4K boundary, hence one page is not sufficient. Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] Signed-off-by: Vivek Goyal [EMAIL PROTECTED] ACK. Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [Fastboot] [PATCH 12/20] x86_64: 64bit ACPI wakeup trampoline
* Pavel Machek <[EMAIL PROTECTED]> [2007-03-07 23:45]: > > > + if ((_end - _start) > (PAGE_SIZE*2)) > > printk(KERN_CRIT > > - "ACPI: Wakeup code way too big, will crash on attempt to > > suspend\n"); > > + "ACPI: Wakeup code way too big, will crash on attempt" > > + " to suspend\n"); > > Hmm, if you split it like > printk(KERN_CRIT "ACPI: Wakeup code way too big, will crash" > "on attempt to suspend\n"); > > ...you'll still keep 80-column rule while keeping it readable. But I guess with a space after "crash" or before "on" :) Regards, Bernhard - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 12/20] x86_64: 64bit ACPI wakeup trampoline
Hi! > o Moved wakeup_level4_pgt into the wakeup routine so we can > run the kernel above 4G. > > o Now we first go to 64bit mode and continue to run from trampoline and > then then start accessing kernel symbols and restore processor context. > This enables us to resume even in relocatable kernel context when > kernel might not be loaded at physical addr it has been compiled for. > > o Removed the need for modifying any existing kernel page table. > > o Increased the size of the wakeup routine to 8K. This is required as > wake page tables are on trampoline itself and they got to be at 4K > boundary, hence one page is not sufficient. > > Signed-off-by: Eric W. Biederman <[EMAIL PROTECTED]> > Signed-off-by: Vivek Goyal <[EMAIL PROTECTED]> > + if ((_end - _start) > (PAGE_SIZE*2)) > printk(KERN_CRIT > -"ACPI: Wakeup code way too big, will crash on attempt to > suspend\n"); > +"ACPI: Wakeup code way too big, will crash on attempt" > +" to suspend\n"); Hmm, if you split it like printk(KERN_CRIT "ACPI: Wakeup code way too big, will crash" "on attempt to suspend\n"); ...you'll still keep 80-column rule while keeping it readable. > @@ -159,11 +159,11 @@ wakeup_32: >*/ > > /* Finally jump in 64bit mode */ > - ljmp*(wakeup_long64_vector - __START_KERNEL_map) > +ljmp*(wakeup_long64_vector - wakeup_code)(%esi) spaces vs. tabs problem. Otherwise looks good. ACK if it was tested. Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 12/20] x86_64: 64bit ACPI wakeup trampoline
Hi! o Moved wakeup_level4_pgt into the wakeup routine so we can run the kernel above 4G. o Now we first go to 64bit mode and continue to run from trampoline and then then start accessing kernel symbols and restore processor context. This enables us to resume even in relocatable kernel context when kernel might not be loaded at physical addr it has been compiled for. o Removed the need for modifying any existing kernel page table. o Increased the size of the wakeup routine to 8K. This is required as wake page tables are on trampoline itself and they got to be at 4K boundary, hence one page is not sufficient. Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] Signed-off-by: Vivek Goyal [EMAIL PROTECTED] + if ((wakeup_end - wakeup_start) (PAGE_SIZE*2)) printk(KERN_CRIT -ACPI: Wakeup code way too big, will crash on attempt to suspend\n); +ACPI: Wakeup code way too big, will crash on attempt + to suspend\n); Hmm, if you split it like printk(KERN_CRIT ACPI: Wakeup code way too big, will crash on attempt to suspend\n); ...you'll still keep 80-column rule while keeping it readable. @@ -159,11 +159,11 @@ wakeup_32: */ /* Finally jump in 64bit mode */ - ljmp*(wakeup_long64_vector - __START_KERNEL_map) +ljmp*(wakeup_long64_vector - wakeup_code)(%esi) spaces vs. tabs problem. Otherwise looks good. ACK if it was tested. Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [Fastboot] [PATCH 12/20] x86_64: 64bit ACPI wakeup trampoline
* Pavel Machek [EMAIL PROTECTED] [2007-03-07 23:45]: + if ((wakeup_end - wakeup_start) (PAGE_SIZE*2)) printk(KERN_CRIT - ACPI: Wakeup code way too big, will crash on attempt to suspend\n); + ACPI: Wakeup code way too big, will crash on attempt + to suspend\n); Hmm, if you split it like printk(KERN_CRIT ACPI: Wakeup code way too big, will crash on attempt to suspend\n); ...you'll still keep 80-column rule while keeping it readable. But I guess with a space after crash or before on :) Regards, Bernhard - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 12/20] x86_64: 64bit ACPI wakeup trampoline
o Moved wakeup_level4_pgt into the wakeup routine so we can run the kernel above 4G. o Now we first go to 64bit mode and continue to run from trampoline and then then start accessing kernel symbols and restore processor context. This enables us to resume even in relocatable kernel context when kernel might not be loaded at physical addr it has been compiled for. o Removed the need for modifying any existing kernel page table. o Increased the size of the wakeup routine to 8K. This is required as wake page tables are on trampoline itself and they got to be at 4K boundary, hence one page is not sufficient. Signed-off-by: Eric W. Biederman <[EMAIL PROTECTED]> Signed-off-by: Vivek Goyal <[EMAIL PROTECTED]> --- arch/x86_64/kernel/acpi/sleep.c | 22 ++ arch/x86_64/kernel/acpi/wakeup.S | 59 --- arch/x86_64/kernel/head.S|9 - 3 files changed, 41 insertions(+), 49 deletions(-) diff -puN arch/x86_64/kernel/acpi/sleep.c~x86_64-64bit-ACPI-wakeup-trampoline arch/x86_64/kernel/acpi/sleep.c --- linux-2.6.21-rc2-reloc/arch/x86_64/kernel/acpi/sleep.c~x86_64-64bit-ACPI-wakeup-trampoline 2007-03-07 01:28:11.0 +0530 +++ linux-2.6.21-rc2-reloc-root/arch/x86_64/kernel/acpi/sleep.c 2007-03-07 01:28:11.0 +0530 @@ -60,17 +60,6 @@ extern char wakeup_start, wakeup_end; extern unsigned long acpi_copy_wakeup_routine(unsigned long); -static pgd_t low_ptr; - -static void init_low_mapping(void) -{ - pgd_t *slot0 = pgd_offset(current->mm, 0UL); - low_ptr = *slot0; - set_pgd(slot0, *pgd_offset(current->mm, PAGE_OFFSET)); - WARN_ON(num_online_cpus() != 1); - local_flush_tlb(); -} - /** * acpi_save_state_mem - save kernel state * @@ -79,8 +68,6 @@ static void init_low_mapping(void) */ int acpi_save_state_mem(void) { - init_low_mapping(); - memcpy((void *)acpi_wakeup_address, _start, _end - _start); acpi_copy_wakeup_routine(acpi_wakeup_address); @@ -93,8 +80,6 @@ int acpi_save_state_mem(void) */ void acpi_restore_state_mem(void) { - set_pgd(pgd_offset(current->mm, 0UL), low_ptr); - local_flush_tlb(); } /** @@ -107,10 +92,11 @@ void acpi_restore_state_mem(void) */ void __init acpi_reserve_bootmem(void) { - acpi_wakeup_address = (unsigned long)alloc_bootmem_low(PAGE_SIZE); - if ((_end - _start) > PAGE_SIZE) + acpi_wakeup_address = (unsigned long)alloc_bootmem_low(PAGE_SIZE*2); + if ((_end - _start) > (PAGE_SIZE*2)) printk(KERN_CRIT - "ACPI: Wakeup code way too big, will crash on attempt to suspend\n"); + "ACPI: Wakeup code way too big, will crash on attempt" + " to suspend\n"); } static int __init acpi_sleep_setup(char *str) diff -puN arch/x86_64/kernel/acpi/wakeup.S~x86_64-64bit-ACPI-wakeup-trampoline arch/x86_64/kernel/acpi/wakeup.S --- linux-2.6.21-rc2-reloc/arch/x86_64/kernel/acpi/wakeup.S~x86_64-64bit-ACPI-wakeup-trampoline 2007-03-07 01:28:11.0 +0530 +++ linux-2.6.21-rc2-reloc-root/arch/x86_64/kernel/acpi/wakeup.S 2007-03-07 01:28:11.0 +0530 @@ -1,6 +1,7 @@ .text #include #include +#include #include #include @@ -62,12 +63,15 @@ wakeup_code: movb$0xa2, %al ; outb %al, $0x80 - lidt%ds:idt_48a - wakeup_code - xorl%eax, %eax - movw%ds, %ax# (Convert %ds:gdt to a linear ptr) - shll$4, %eax - addl$(gdta - wakeup_code), %eax - movl%eax, gdt_48a +2 - wakeup_code + mov %ds, %ax# Find 32bit wakeup_code addr + movzx %ax, %esi # (Convert %ds:gdt to a liner ptr) + shll$4, %esi + # Fix up the vectors + addl%esi, wakeup_32_vector - wakeup_code + addl%esi, wakeup_long64_vector - wakeup_code + addl%esi, gdt_48a + 2 - wakeup_code # Fixup the gdt pointer + + lidtl %ds:idt_48a - wakeup_code lgdtl %ds:gdt_48a - wakeup_code # load gdt with whatever is # appropriate @@ -80,7 +84,7 @@ wakeup_code: .balign 4 wakeup_32_vector: - .long wakeup_32 - __START_KERNEL_map + .long wakeup_32 - wakeup_code .word __KERNEL32_CS, 0 .code32 @@ -103,10 +107,6 @@ wakeup_32: movl$__KERNEL_DS, %eax movl%eax, %ds - movlsaved_magic - __START_KERNEL_map, %eax - cmpl$0x9abcdef0, %eax - jne bogus_32_magic - movw$0x0e00 + 'i', %ds:(0xb8012) movb$0xa8, %al ; outb %al, $0x80; @@ -120,7 +120,7 @@ wakeup_32: movl%eax, %cr4 /* Setup early boot stage 4 level pagetables */ - movl$(wakeup_level4_pgt - __START_KERNEL_map), %eax + leal
[PATCH 12/20] x86_64: 64bit ACPI wakeup trampoline
o Moved wakeup_level4_pgt into the wakeup routine so we can run the kernel above 4G. o Now we first go to 64bit mode and continue to run from trampoline and then then start accessing kernel symbols and restore processor context. This enables us to resume even in relocatable kernel context when kernel might not be loaded at physical addr it has been compiled for. o Removed the need for modifying any existing kernel page table. o Increased the size of the wakeup routine to 8K. This is required as wake page tables are on trampoline itself and they got to be at 4K boundary, hence one page is not sufficient. Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] Signed-off-by: Vivek Goyal [EMAIL PROTECTED] --- arch/x86_64/kernel/acpi/sleep.c | 22 ++ arch/x86_64/kernel/acpi/wakeup.S | 59 --- arch/x86_64/kernel/head.S|9 - 3 files changed, 41 insertions(+), 49 deletions(-) diff -puN arch/x86_64/kernel/acpi/sleep.c~x86_64-64bit-ACPI-wakeup-trampoline arch/x86_64/kernel/acpi/sleep.c --- linux-2.6.21-rc2-reloc/arch/x86_64/kernel/acpi/sleep.c~x86_64-64bit-ACPI-wakeup-trampoline 2007-03-07 01:28:11.0 +0530 +++ linux-2.6.21-rc2-reloc-root/arch/x86_64/kernel/acpi/sleep.c 2007-03-07 01:28:11.0 +0530 @@ -60,17 +60,6 @@ extern char wakeup_start, wakeup_end; extern unsigned long acpi_copy_wakeup_routine(unsigned long); -static pgd_t low_ptr; - -static void init_low_mapping(void) -{ - pgd_t *slot0 = pgd_offset(current-mm, 0UL); - low_ptr = *slot0; - set_pgd(slot0, *pgd_offset(current-mm, PAGE_OFFSET)); - WARN_ON(num_online_cpus() != 1); - local_flush_tlb(); -} - /** * acpi_save_state_mem - save kernel state * @@ -79,8 +68,6 @@ static void init_low_mapping(void) */ int acpi_save_state_mem(void) { - init_low_mapping(); - memcpy((void *)acpi_wakeup_address, wakeup_start, wakeup_end - wakeup_start); acpi_copy_wakeup_routine(acpi_wakeup_address); @@ -93,8 +80,6 @@ int acpi_save_state_mem(void) */ void acpi_restore_state_mem(void) { - set_pgd(pgd_offset(current-mm, 0UL), low_ptr); - local_flush_tlb(); } /** @@ -107,10 +92,11 @@ void acpi_restore_state_mem(void) */ void __init acpi_reserve_bootmem(void) { - acpi_wakeup_address = (unsigned long)alloc_bootmem_low(PAGE_SIZE); - if ((wakeup_end - wakeup_start) PAGE_SIZE) + acpi_wakeup_address = (unsigned long)alloc_bootmem_low(PAGE_SIZE*2); + if ((wakeup_end - wakeup_start) (PAGE_SIZE*2)) printk(KERN_CRIT - ACPI: Wakeup code way too big, will crash on attempt to suspend\n); + ACPI: Wakeup code way too big, will crash on attempt + to suspend\n); } static int __init acpi_sleep_setup(char *str) diff -puN arch/x86_64/kernel/acpi/wakeup.S~x86_64-64bit-ACPI-wakeup-trampoline arch/x86_64/kernel/acpi/wakeup.S --- linux-2.6.21-rc2-reloc/arch/x86_64/kernel/acpi/wakeup.S~x86_64-64bit-ACPI-wakeup-trampoline 2007-03-07 01:28:11.0 +0530 +++ linux-2.6.21-rc2-reloc-root/arch/x86_64/kernel/acpi/wakeup.S 2007-03-07 01:28:11.0 +0530 @@ -1,6 +1,7 @@ .text #include linux/linkage.h #include asm/segment.h +#include asm/pgtable.h #include asm/page.h #include asm/msr.h @@ -62,12 +63,15 @@ wakeup_code: movb$0xa2, %al ; outb %al, $0x80 - lidt%ds:idt_48a - wakeup_code - xorl%eax, %eax - movw%ds, %ax# (Convert %ds:gdt to a linear ptr) - shll$4, %eax - addl$(gdta - wakeup_code), %eax - movl%eax, gdt_48a +2 - wakeup_code + mov %ds, %ax# Find 32bit wakeup_code addr + movzx %ax, %esi # (Convert %ds:gdt to a liner ptr) + shll$4, %esi + # Fix up the vectors + addl%esi, wakeup_32_vector - wakeup_code + addl%esi, wakeup_long64_vector - wakeup_code + addl%esi, gdt_48a + 2 - wakeup_code # Fixup the gdt pointer + + lidtl %ds:idt_48a - wakeup_code lgdtl %ds:gdt_48a - wakeup_code # load gdt with whatever is # appropriate @@ -80,7 +84,7 @@ wakeup_code: .balign 4 wakeup_32_vector: - .long wakeup_32 - __START_KERNEL_map + .long wakeup_32 - wakeup_code .word __KERNEL32_CS, 0 .code32 @@ -103,10 +107,6 @@ wakeup_32: movl$__KERNEL_DS, %eax movl%eax, %ds - movlsaved_magic - __START_KERNEL_map, %eax - cmpl$0x9abcdef0, %eax - jne bogus_32_magic - movw$0x0e00 + 'i', %ds:(0xb8012) movb$0xa8, %al ; outb %al, $0x80; @@ -120,7 +120,7 @@ wakeup_32: movl%eax, %cr4 /* Setup early boot stage 4 level