All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] merge 32 and 64 realmode wakeup code
@ 2011-07-02 17:43 Matthieu CASTET
  2011-07-02 17:43 ` [PATCH 2/2] clean acpi wakeup code after merge Matthieu CASTET
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Matthieu CASTET @ 2011-07-02 17:43 UTC (permalink / raw)
  To: Linux Kernel list, linux-acpi, x86
  Cc: Rafael J. Wysocki, H. Peter Anvin, Matthieu CASTET

- this mean less ifdef in code
- we could remove now unused field in wakeup_header (pmode_*)

Signed-off-by: Matthieu CASTET <castet.matthieu@free.fr>
---
 arch/x86/kernel/acpi/realmode/wakeup.S |   26 --------------------------
 arch/x86/kernel/acpi/sleep.c           |   27 ++++++++++-----------------
 arch/x86/kernel/trampoline_32.S        |    4 ----
 3 files changed, 10 insertions(+), 47 deletions(-)

diff --git a/arch/x86/kernel/acpi/realmode/wakeup.S b/arch/x86/kernel/acpi/realmode/wakeup.S
index ead21b6..150a734 100644
--- a/arch/x86/kernel/acpi/realmode/wakeup.S
+++ b/arch/x86/kernel/acpi/realmode/wakeup.S
@@ -93,36 +93,10 @@ wakeup_code:
 
 	/* Do any other stuff... */
 
-#ifndef CONFIG_64BIT
-	/* This could also be done in C code... */
-	movl	pmode_cr3, %eax
-	movl	%eax, %cr3
-
-	movl	pmode_cr4, %ecx
-	jecxz	1f
-	movl	%ecx, %cr4
-1:
-	movl	pmode_efer, %eax
-	movl	pmode_efer + 4, %edx
-	movl	%eax, %ecx
-	orl	%edx, %ecx
-	jz	1f
-	movl	$MSR_EFER, %ecx
-	wrmsr
-1:
-
-	lgdtl	pmode_gdt
-
-	/* This really couldn't... */
-	movl	pmode_cr0, %eax
-	movl	%eax, %cr0
-	jmp	pmode_return
-#else
 	pushw	$0
 	pushw	trampoline_segment
 	pushw	$0
 	lret
-#endif
 
 bogus_real_magic:
 1:
diff --git a/arch/x86/kernel/acpi/sleep.c b/arch/x86/kernel/acpi/sleep.c
index 18a857b..96719ad 100644
--- a/arch/x86/kernel/acpi/sleep.c
+++ b/arch/x86/kernel/acpi/sleep.c
@@ -20,7 +20,7 @@
 
 unsigned long acpi_realmode_flags;
 
-#if defined(CONFIG_SMP) && defined(CONFIG_64BIT)
+#ifdef CONFIG_SMP
 static char temp_stack[4096];
 #endif
 
@@ -67,34 +67,27 @@ int acpi_suspend_lowlevel(void)
 	header->wakeup_gdt[2] =
 		GDT_ENTRY(0x8093, acpi_wakeup_address, 0xfffff);
 
-#ifndef CONFIG_64BIT
-	store_gdt((struct desc_ptr *)&header->pmode_gdt);
-
-	if (rdmsr_safe(MSR_EFER, &header->pmode_efer_low,
-		       &header->pmode_efer_high))
-		header->pmode_efer_low = header->pmode_efer_high = 0;
-#endif /* !CONFIG_64BIT */
-
 	header->pmode_cr0 = read_cr0();
 	header->pmode_cr4 = read_cr4_safe();
 	header->realmode_flags = acpi_realmode_flags;
 	header->real_magic = 0x12345678;
-
-#ifndef CONFIG_64BIT
-	header->pmode_entry = (u32)&wakeup_pmode_return;
-	header->pmode_cr3 = (u32)__pa(&initial_page_table);
-	saved_magic = 0x12345678;
-#else /* CONFIG_64BIT */
 	header->trampoline_segment = trampoline_address() >> 4;
 #ifdef CONFIG_SMP
 	stack_start = (unsigned long)temp_stack + sizeof(temp_stack);
 	early_gdt_descr.address =
 			(unsigned long)get_cpu_gdt_table(smp_processor_id());
+#ifdef CONFIG_64BIT
 	initial_gs = per_cpu_offset(smp_processor_id());
 #endif
+#endif
+
+#ifdef CONFIG_64BIT
 	initial_code = (unsigned long)wakeup_long64;
-       saved_magic = 0x123456789abcdef0L;
-#endif /* CONFIG_64BIT */
+	saved_magic = 0x123456789abcdef0L;
+#else
+	initial_code = (unsigned long)&wakeup_pmode_return;
+	saved_magic = 0x12345678;
+#endif
 
 	do_suspend_lowlevel();
 	return 0;
diff --git a/arch/x86/kernel/trampoline_32.S b/arch/x86/kernel/trampoline_32.S
index 451c0a7..a726f60 100644
--- a/arch/x86/kernel/trampoline_32.S
+++ b/arch/x86/kernel/trampoline_32.S
@@ -32,8 +32,6 @@
 #include <asm/segment.h>
 #include <asm/page_types.h>
 
-#ifdef CONFIG_SMP
-
 	.section ".x86_trampoline","a"
 	.balign PAGE_SIZE
 	.code16
@@ -79,5 +77,3 @@ ENTRY(trampoline_status)
 
 .globl trampoline_end
 trampoline_end:
-
-#endif /* CONFIG_SMP */
-- 
1.7.5.4

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

* [PATCH 2/2] clean acpi wakeup code after merge
  2011-07-02 17:43 [PATCH 1/2] merge 32 and 64 realmode wakeup code Matthieu CASTET
@ 2011-07-02 17:43 ` Matthieu CASTET
  2011-07-03 21:22   ` [tip:x86/trampoline] x86, suspend: Clean " tip-bot for Matthieu CASTET
  2011-07-02 22:31 ` [PATCH 1/2] merge 32 and 64 realmode wakeup code H. Peter Anvin
  2011-07-03 21:22 ` [tip:x86/trampoline] x86, suspend: Merge 32- and 64-bit " tip-bot for Matthieu CASTET
  2 siblings, 1 reply; 11+ messages in thread
From: Matthieu CASTET @ 2011-07-02 17:43 UTC (permalink / raw)
  To: Linux Kernel list, linux-acpi, x86
  Cc: Rafael J. Wysocki, H. Peter Anvin, Matthieu CASTET

This remove unsued pmode_* entry in wakeup header and saved_*dt
in wakeup_32.

Signed-off-by: Matthieu CASTET <castet.matthieu@free.fr>
Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 arch/x86/kernel/acpi/realmode/wakeup.S |    8 --------
 arch/x86/kernel/acpi/realmode/wakeup.h |   11 +----------
 arch/x86/kernel/acpi/sleep.c           |    2 --
 arch/x86/kernel/acpi/wakeup_32.S       |   24 +-----------------------
 4 files changed, 2 insertions(+), 43 deletions(-)

diff --git a/arch/x86/kernel/acpi/realmode/wakeup.S b/arch/x86/kernel/acpi/realmode/wakeup.S
index 150a734..aefa400 100644
--- a/arch/x86/kernel/acpi/realmode/wakeup.S
+++ b/arch/x86/kernel/acpi/realmode/wakeup.S
@@ -20,14 +20,6 @@ _start:
 		.globl	wakeup_header
 wakeup_header:
 video_mode:	.short	0	/* Video mode number */
-pmode_return:	.byte	0x66, 0xea	/* ljmpl */
-		.long	0	/* offset goes here */
-		.short	__KERNEL_CS
-pmode_cr0:	.long	0	/* Saved %cr0 */
-pmode_cr3:	.long	0	/* Saved %cr3 */
-pmode_cr4:	.long	0	/* Saved %cr4 */
-pmode_efer:	.quad	0	/* Saved EFER */
-pmode_gdt:	.quad	0
 realmode_flags:	.long	0
 real_magic:	.long	0
 trampoline_segment:	.word 0
diff --git a/arch/x86/kernel/acpi/realmode/wakeup.h b/arch/x86/kernel/acpi/realmode/wakeup.h
index e1828c0..5f302e1 100644
--- a/arch/x86/kernel/acpi/realmode/wakeup.h
+++ b/arch/x86/kernel/acpi/realmode/wakeup.h
@@ -12,18 +12,9 @@
 /* This must match data at wakeup.S */
 struct wakeup_header {
 	u16 video_mode;		/* Video mode number */
-	u16 _jmp1;		/* ljmpl opcode, 32-bit only */
-	u32 pmode_entry;	/* Protected mode resume point, 32-bit only */
-	u16 _jmp2;		/* CS value, 32-bit only */
-	u32 pmode_cr0;		/* Protected mode cr0 */
-	u32 pmode_cr3;		/* Protected mode cr3 */
-	u32 pmode_cr4;		/* Protected mode cr4 */
-	u32 pmode_efer_low;	/* Protected mode EFER */
-	u32 pmode_efer_high;
-	u64 pmode_gdt;
 	u32 realmode_flags;
 	u32 real_magic;
-	u16 trampoline_segment;	/* segment with trampoline code, 64-bit only */
+	u16 trampoline_segment;	/* segment with trampoline code */
 	u8  _pad1;
 	u8  wakeup_jmp;
 	u16 wakeup_jmp_off;
diff --git a/arch/x86/kernel/acpi/sleep.c b/arch/x86/kernel/acpi/sleep.c
index 96719ad..c1d322d 100644
--- a/arch/x86/kernel/acpi/sleep.c
+++ b/arch/x86/kernel/acpi/sleep.c
@@ -67,8 +67,6 @@ int acpi_suspend_lowlevel(void)
 	header->wakeup_gdt[2] =
 		GDT_ENTRY(0x8093, acpi_wakeup_address, 0xfffff);
 
-	header->pmode_cr0 = read_cr0();
-	header->pmode_cr4 = read_cr4_safe();
 	header->realmode_flags = acpi_realmode_flags;
 	header->real_magic = 0x12345678;
 	header->trampoline_segment = trampoline_address() >> 4;
diff --git a/arch/x86/kernel/acpi/wakeup_32.S b/arch/x86/kernel/acpi/wakeup_32.S
index 13ab720..56f8de4 100644
--- a/arch/x86/kernel/acpi/wakeup_32.S
+++ b/arch/x86/kernel/acpi/wakeup_32.S
@@ -17,17 +17,7 @@ wakeup_pmode_return:
 	movw	%ax, %fs
 	movw	%ax, %gs
 
-	# reload the gdt, as we need the full 32 bit address
-	lgdt	saved_gdt
-	lidt	saved_idt
-	lldt	saved_ldt
-	ljmp	$(__KERNEL_CS), $1f
-1:
-	movl	%cr3, %eax
-	movl	%eax, %cr3
-	wbinvd
-
-	# and restore the stack ... but you need gdt for this to work
+	# and restore the stack ...
 	movl	saved_context_esp, %esp
 
 	movl	%cs:saved_magic, %eax
@@ -44,11 +34,6 @@ bogus_magic:
 
 
 save_registers:
-	sgdt	saved_gdt
-	sidt	saved_idt
-	sldt	saved_ldt
-	str	saved_tss
-
 	leal	4(%esp), %eax
 	movl	%eax, saved_context_esp
 	movl	%ebx, saved_context_ebx
@@ -91,10 +76,3 @@ ret_point:
 ALIGN
 ENTRY(saved_magic)	.long	0
 ENTRY(saved_eip)	.long	0
-
-# saved registers
-saved_gdt:	.long	0,0
-saved_idt:	.long	0,0
-saved_ldt:	.long	0
-saved_tss:	.long	0
-
-- 
1.7.5.4


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

* Re: [PATCH 1/2] merge 32 and 64 realmode wakeup code
  2011-07-02 17:43 [PATCH 1/2] merge 32 and 64 realmode wakeup code Matthieu CASTET
  2011-07-02 17:43 ` [PATCH 2/2] clean acpi wakeup code after merge Matthieu CASTET
@ 2011-07-02 22:31 ` H. Peter Anvin
  2011-07-03  6:50   ` Rafael J. Wysocki
  2011-07-03 21:22 ` [tip:x86/trampoline] x86, suspend: Merge 32- and 64-bit " tip-bot for Matthieu CASTET
  2 siblings, 1 reply; 11+ messages in thread
From: H. Peter Anvin @ 2011-07-02 22:31 UTC (permalink / raw)
  To: Matthieu CASTET; +Cc: Linux Kernel list, linux-acpi, x86, Rafael J. Wysocki

On 07/02/2011 10:43 AM, Matthieu CASTET wrote:
> - this mean less ifdef in code
> - we could remove now unused field in wakeup_header (pmode_*)
> 
> Signed-off-by: Matthieu CASTET <castet.matthieu@free.fr>
> ---
>  arch/x86/kernel/acpi/realmode/wakeup.S |   26 --------------------------
>  arch/x86/kernel/acpi/sleep.c           |   27 ++++++++++-----------------
>  arch/x86/kernel/trampoline_32.S        |    4 ----
>  3 files changed, 10 insertions(+), 47 deletions(-)
> 

Looks great to me.  Rafael?

	-hpa


-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


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

* Re: [PATCH 1/2] merge 32 and 64 realmode wakeup code
  2011-07-02 22:31 ` [PATCH 1/2] merge 32 and 64 realmode wakeup code H. Peter Anvin
@ 2011-07-03  6:50   ` Rafael J. Wysocki
  2011-07-03 20:52       ` matthieu castet
  0 siblings, 1 reply; 11+ messages in thread
From: Rafael J. Wysocki @ 2011-07-03  6:50 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: Matthieu CASTET, Linux Kernel list, linux-acpi, x86

On Sunday, July 03, 2011, H. Peter Anvin wrote:
> On 07/02/2011 10:43 AM, Matthieu CASTET wrote:
> > - this mean less ifdef in code
> > - we could remove now unused field in wakeup_header (pmode_*)
> > 
> > Signed-off-by: Matthieu CASTET <castet.matthieu@free.fr>
> > ---
> >  arch/x86/kernel/acpi/realmode/wakeup.S |   26 --------------------------
> >  arch/x86/kernel/acpi/sleep.c           |   27 ++++++++++-----------------
> >  arch/x86/kernel/trampoline_32.S        |    4 ----
> >  3 files changed, 10 insertions(+), 47 deletions(-)
> > 
> 
> Looks great to me.  Rafael?

I don't have any immediate complaints.  Please feel free to add my ACK
to the patches.

Thanks,
Rafael

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

* Re: [PATCH 1/2] merge 32 and 64 realmode wakeup code
  2011-07-03  6:50   ` Rafael J. Wysocki
@ 2011-07-03 20:52       ` matthieu castet
  0 siblings, 0 replies; 11+ messages in thread
From: matthieu castet @ 2011-07-03 20:52 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: H. Peter Anvin, Linux Kernel list, linux-acpi, x86

Hi,

Le Sun, 3 Jul 2011 08:50:32 +0200,
"Rafael J. Wysocki" <rjw@sisk.pl> a écrit :

> On Sunday, July 03, 2011, H. Peter Anvin wrote:
> > On 07/02/2011 10:43 AM, Matthieu CASTET wrote:
> > > - this mean less ifdef in code
> > > - we could remove now unused field in wakeup_header (pmode_*)
> > > 
> > > Signed-off-by: Matthieu CASTET <castet.matthieu@free.fr>
> > > ---
> > >  arch/x86/kernel/acpi/realmode/wakeup.S |   26
> > > -------------------------- arch/x86/kernel/acpi/sleep.c
> > > |   27 ++++++++++-----------------
> > > arch/x86/kernel/trampoline_32.S        |    4 ---- 3 files
> > > changed, 10 insertions(+), 47 deletions(-)
> > > 
> > 
> > Looks great to me.  Rafael?
> 
> I don't have any immediate complaints.  Please feel free to add my ACK
> to the patches.
> 
Thanks,

Should I repost the patches with our ack somewhere ?


Matthieu
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 1/2] merge 32 and 64 realmode wakeup code
@ 2011-07-03 20:52       ` matthieu castet
  0 siblings, 0 replies; 11+ messages in thread
From: matthieu castet @ 2011-07-03 20:52 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: H. Peter Anvin, Linux Kernel list, linux-acpi, x86

Hi,

Le Sun, 3 Jul 2011 08:50:32 +0200,
"Rafael J. Wysocki" <rjw@sisk.pl> a écrit :

> On Sunday, July 03, 2011, H. Peter Anvin wrote:
> > On 07/02/2011 10:43 AM, Matthieu CASTET wrote:
> > > - this mean less ifdef in code
> > > - we could remove now unused field in wakeup_header (pmode_*)
> > > 
> > > Signed-off-by: Matthieu CASTET <castet.matthieu@free.fr>
> > > ---
> > >  arch/x86/kernel/acpi/realmode/wakeup.S |   26
> > > -------------------------- arch/x86/kernel/acpi/sleep.c
> > > |   27 ++++++++++-----------------
> > > arch/x86/kernel/trampoline_32.S        |    4 ---- 3 files
> > > changed, 10 insertions(+), 47 deletions(-)
> > > 
> > 
> > Looks great to me.  Rafael?
> 
> I don't have any immediate complaints.  Please feel free to add my ACK
> to the patches.
> 
Thanks,

Should I repost the patches with our ack somewhere ?


Matthieu

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

* Re: [PATCH 1/2] merge 32 and 64 realmode wakeup code
  2011-07-03 20:52       ` matthieu castet
  (?)
@ 2011-07-03 21:19       ` H. Peter Anvin
  -1 siblings, 0 replies; 11+ messages in thread
From: H. Peter Anvin @ 2011-07-03 21:19 UTC (permalink / raw)
  To: matthieu castet; +Cc: Rafael J. Wysocki, Linux Kernel list, linux-acpi, x86

On 07/03/2011 01:52 PM, matthieu castet wrote:
> Thanks,
> 
> Should I repost the patches with our ack somewhere ?

No need.

	-hpa

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

* [tip:x86/trampoline] x86, suspend: Merge 32- and 64-bit realmode wakeup code
  2011-07-02 17:43 [PATCH 1/2] merge 32 and 64 realmode wakeup code Matthieu CASTET
  2011-07-02 17:43 ` [PATCH 2/2] clean acpi wakeup code after merge Matthieu CASTET
  2011-07-02 22:31 ` [PATCH 1/2] merge 32 and 64 realmode wakeup code H. Peter Anvin
@ 2011-07-03 21:22 ` tip-bot for Matthieu CASTET
  2011-08-09 19:34   ` matthieu castet
  2 siblings, 1 reply; 11+ messages in thread
From: tip-bot for Matthieu CASTET @ 2011-07-03 21:22 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, castet.matthieu, tglx, hpa, rjw

Commit-ID:  ababf605370b2c67cc6a37305c5fa17469a4e1f1
Gitweb:     http://git.kernel.org/tip/ababf605370b2c67cc6a37305c5fa17469a4e1f1
Author:     Matthieu CASTET <castet.matthieu@free.fr>
AuthorDate: Sat, 2 Jul 2011 19:43:40 +0200
Committer:  H. Peter Anvin <hpa@linux.intel.com>
CommitDate: Sun, 3 Jul 2011 11:45:44 -0700

x86, suspend: Merge 32- and 64-bit realmode wakeup code

- this mean less ifdef in code
- we could remove now unused field in wakeup_header (pmode_*)

Signed-off-by: Matthieu CASTET <castet.matthieu@free.fr>
Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
Link: http://lkml.kernel.org/r/1309628621-23107-1-git-send-email-castet.matthieu@free.fr
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
---
 arch/x86/kernel/acpi/realmode/wakeup.S |   26 --------------------------
 arch/x86/kernel/acpi/sleep.c           |   27 ++++++++++-----------------
 arch/x86/kernel/trampoline_32.S        |    4 ----
 3 files changed, 10 insertions(+), 47 deletions(-)

diff --git a/arch/x86/kernel/acpi/realmode/wakeup.S b/arch/x86/kernel/acpi/realmode/wakeup.S
index ead21b6..150a734 100644
--- a/arch/x86/kernel/acpi/realmode/wakeup.S
+++ b/arch/x86/kernel/acpi/realmode/wakeup.S
@@ -93,36 +93,10 @@ wakeup_code:
 
 	/* Do any other stuff... */
 
-#ifndef CONFIG_64BIT
-	/* This could also be done in C code... */
-	movl	pmode_cr3, %eax
-	movl	%eax, %cr3
-
-	movl	pmode_cr4, %ecx
-	jecxz	1f
-	movl	%ecx, %cr4
-1:
-	movl	pmode_efer, %eax
-	movl	pmode_efer + 4, %edx
-	movl	%eax, %ecx
-	orl	%edx, %ecx
-	jz	1f
-	movl	$MSR_EFER, %ecx
-	wrmsr
-1:
-
-	lgdtl	pmode_gdt
-
-	/* This really couldn't... */
-	movl	pmode_cr0, %eax
-	movl	%eax, %cr0
-	jmp	pmode_return
-#else
 	pushw	$0
 	pushw	trampoline_segment
 	pushw	$0
 	lret
-#endif
 
 bogus_real_magic:
 1:
diff --git a/arch/x86/kernel/acpi/sleep.c b/arch/x86/kernel/acpi/sleep.c
index 18a857b..96719ad 100644
--- a/arch/x86/kernel/acpi/sleep.c
+++ b/arch/x86/kernel/acpi/sleep.c
@@ -20,7 +20,7 @@
 
 unsigned long acpi_realmode_flags;
 
-#if defined(CONFIG_SMP) && defined(CONFIG_64BIT)
+#ifdef CONFIG_SMP
 static char temp_stack[4096];
 #endif
 
@@ -67,34 +67,27 @@ int acpi_suspend_lowlevel(void)
 	header->wakeup_gdt[2] =
 		GDT_ENTRY(0x8093, acpi_wakeup_address, 0xfffff);
 
-#ifndef CONFIG_64BIT
-	store_gdt((struct desc_ptr *)&header->pmode_gdt);
-
-	if (rdmsr_safe(MSR_EFER, &header->pmode_efer_low,
-		       &header->pmode_efer_high))
-		header->pmode_efer_low = header->pmode_efer_high = 0;
-#endif /* !CONFIG_64BIT */
-
 	header->pmode_cr0 = read_cr0();
 	header->pmode_cr4 = read_cr4_safe();
 	header->realmode_flags = acpi_realmode_flags;
 	header->real_magic = 0x12345678;
-
-#ifndef CONFIG_64BIT
-	header->pmode_entry = (u32)&wakeup_pmode_return;
-	header->pmode_cr3 = (u32)__pa(&initial_page_table);
-	saved_magic = 0x12345678;
-#else /* CONFIG_64BIT */
 	header->trampoline_segment = trampoline_address() >> 4;
 #ifdef CONFIG_SMP
 	stack_start = (unsigned long)temp_stack + sizeof(temp_stack);
 	early_gdt_descr.address =
 			(unsigned long)get_cpu_gdt_table(smp_processor_id());
+#ifdef CONFIG_64BIT
 	initial_gs = per_cpu_offset(smp_processor_id());
 #endif
+#endif
+
+#ifdef CONFIG_64BIT
 	initial_code = (unsigned long)wakeup_long64;
-       saved_magic = 0x123456789abcdef0L;
-#endif /* CONFIG_64BIT */
+	saved_magic = 0x123456789abcdef0L;
+#else
+	initial_code = (unsigned long)&wakeup_pmode_return;
+	saved_magic = 0x12345678;
+#endif
 
 	do_suspend_lowlevel();
 	return 0;
diff --git a/arch/x86/kernel/trampoline_32.S b/arch/x86/kernel/trampoline_32.S
index 451c0a7..a726f60 100644
--- a/arch/x86/kernel/trampoline_32.S
+++ b/arch/x86/kernel/trampoline_32.S
@@ -32,8 +32,6 @@
 #include <asm/segment.h>
 #include <asm/page_types.h>
 
-#ifdef CONFIG_SMP
-
 	.section ".x86_trampoline","a"
 	.balign PAGE_SIZE
 	.code16
@@ -79,5 +77,3 @@ ENTRY(trampoline_status)
 
 .globl trampoline_end
 trampoline_end:
-
-#endif /* CONFIG_SMP */

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

* [tip:x86/trampoline] x86, suspend: Clean acpi wakeup code after merge
  2011-07-02 17:43 ` [PATCH 2/2] clean acpi wakeup code after merge Matthieu CASTET
@ 2011-07-03 21:22   ` tip-bot for Matthieu CASTET
  0 siblings, 0 replies; 11+ messages in thread
From: tip-bot for Matthieu CASTET @ 2011-07-03 21:22 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, castet.matthieu, tglx, hpa, rjw

Commit-ID:  fd5ed43f54270c0a6aedcaf9e46c15cfa1f27a73
Gitweb:     http://git.kernel.org/tip/fd5ed43f54270c0a6aedcaf9e46c15cfa1f27a73
Author:     Matthieu CASTET <castet.matthieu@free.fr>
AuthorDate: Sat, 2 Jul 2011 19:43:41 +0200
Committer:  H. Peter Anvin <hpa@linux.intel.com>
CommitDate: Sun, 3 Jul 2011 11:46:14 -0700

x86, suspend: Clean acpi wakeup code after merge

This remove unsued pmode_* entry in wakeup header and saved_*dt
in wakeup_32.

Signed-off-by: Matthieu CASTET <castet.matthieu@free.fr>
Link: http://lkml.kernel.org/r/1309628621-23107-2-git-send-email-castet.matthieu@free.fr
Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
---
 arch/x86/kernel/acpi/realmode/wakeup.S |    8 --------
 arch/x86/kernel/acpi/realmode/wakeup.h |   11 +----------
 arch/x86/kernel/acpi/sleep.c           |    2 --
 arch/x86/kernel/acpi/wakeup_32.S       |   24 +-----------------------
 4 files changed, 2 insertions(+), 43 deletions(-)

diff --git a/arch/x86/kernel/acpi/realmode/wakeup.S b/arch/x86/kernel/acpi/realmode/wakeup.S
index 150a734..aefa400 100644
--- a/arch/x86/kernel/acpi/realmode/wakeup.S
+++ b/arch/x86/kernel/acpi/realmode/wakeup.S
@@ -20,14 +20,6 @@ _start:
 		.globl	wakeup_header
 wakeup_header:
 video_mode:	.short	0	/* Video mode number */
-pmode_return:	.byte	0x66, 0xea	/* ljmpl */
-		.long	0	/* offset goes here */
-		.short	__KERNEL_CS
-pmode_cr0:	.long	0	/* Saved %cr0 */
-pmode_cr3:	.long	0	/* Saved %cr3 */
-pmode_cr4:	.long	0	/* Saved %cr4 */
-pmode_efer:	.quad	0	/* Saved EFER */
-pmode_gdt:	.quad	0
 realmode_flags:	.long	0
 real_magic:	.long	0
 trampoline_segment:	.word 0
diff --git a/arch/x86/kernel/acpi/realmode/wakeup.h b/arch/x86/kernel/acpi/realmode/wakeup.h
index e1828c0..5f302e1 100644
--- a/arch/x86/kernel/acpi/realmode/wakeup.h
+++ b/arch/x86/kernel/acpi/realmode/wakeup.h
@@ -12,18 +12,9 @@
 /* This must match data at wakeup.S */
 struct wakeup_header {
 	u16 video_mode;		/* Video mode number */
-	u16 _jmp1;		/* ljmpl opcode, 32-bit only */
-	u32 pmode_entry;	/* Protected mode resume point, 32-bit only */
-	u16 _jmp2;		/* CS value, 32-bit only */
-	u32 pmode_cr0;		/* Protected mode cr0 */
-	u32 pmode_cr3;		/* Protected mode cr3 */
-	u32 pmode_cr4;		/* Protected mode cr4 */
-	u32 pmode_efer_low;	/* Protected mode EFER */
-	u32 pmode_efer_high;
-	u64 pmode_gdt;
 	u32 realmode_flags;
 	u32 real_magic;
-	u16 trampoline_segment;	/* segment with trampoline code, 64-bit only */
+	u16 trampoline_segment;	/* segment with trampoline code */
 	u8  _pad1;
 	u8  wakeup_jmp;
 	u16 wakeup_jmp_off;
diff --git a/arch/x86/kernel/acpi/sleep.c b/arch/x86/kernel/acpi/sleep.c
index 96719ad..c1d322d 100644
--- a/arch/x86/kernel/acpi/sleep.c
+++ b/arch/x86/kernel/acpi/sleep.c
@@ -67,8 +67,6 @@ int acpi_suspend_lowlevel(void)
 	header->wakeup_gdt[2] =
 		GDT_ENTRY(0x8093, acpi_wakeup_address, 0xfffff);
 
-	header->pmode_cr0 = read_cr0();
-	header->pmode_cr4 = read_cr4_safe();
 	header->realmode_flags = acpi_realmode_flags;
 	header->real_magic = 0x12345678;
 	header->trampoline_segment = trampoline_address() >> 4;
diff --git a/arch/x86/kernel/acpi/wakeup_32.S b/arch/x86/kernel/acpi/wakeup_32.S
index 13ab720..56f8de4 100644
--- a/arch/x86/kernel/acpi/wakeup_32.S
+++ b/arch/x86/kernel/acpi/wakeup_32.S
@@ -17,17 +17,7 @@ wakeup_pmode_return:
 	movw	%ax, %fs
 	movw	%ax, %gs
 
-	# reload the gdt, as we need the full 32 bit address
-	lgdt	saved_gdt
-	lidt	saved_idt
-	lldt	saved_ldt
-	ljmp	$(__KERNEL_CS), $1f
-1:
-	movl	%cr3, %eax
-	movl	%eax, %cr3
-	wbinvd
-
-	# and restore the stack ... but you need gdt for this to work
+	# and restore the stack ...
 	movl	saved_context_esp, %esp
 
 	movl	%cs:saved_magic, %eax
@@ -44,11 +34,6 @@ bogus_magic:
 
 
 save_registers:
-	sgdt	saved_gdt
-	sidt	saved_idt
-	sldt	saved_ldt
-	str	saved_tss
-
 	leal	4(%esp), %eax
 	movl	%eax, saved_context_esp
 	movl	%ebx, saved_context_ebx
@@ -91,10 +76,3 @@ ret_point:
 ALIGN
 ENTRY(saved_magic)	.long	0
 ENTRY(saved_eip)	.long	0
-
-# saved registers
-saved_gdt:	.long	0,0
-saved_idt:	.long	0,0
-saved_ldt:	.long	0
-saved_tss:	.long	0
-

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

* Re: [tip:x86/trampoline] x86, suspend: Merge 32- and 64-bit realmode wakeup code
  2011-07-03 21:22 ` [tip:x86/trampoline] x86, suspend: Merge 32- and 64-bit " tip-bot for Matthieu CASTET
@ 2011-08-09 19:34   ` matthieu castet
  2011-08-09 20:41     ` H. Peter Anvin
  0 siblings, 1 reply; 11+ messages in thread
From: matthieu castet @ 2011-08-09 19:34 UTC (permalink / raw)
  To: mingo, hpa, linux-kernel, castet.matthieu, tglx, rjw, hpa
  Cc: linux-tip-commits, Kees Cook

Note that
https://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=7a3136666bc0f0419f7aaa7b1fabb4b0e0a7fb76
should be reverted for applying the patch.

This is not a problem as the x86_32 trampoline code already does that.

Any idea when it will be merged in the mainline tree ?

Matthieu

Le Sun, 3 Jul 2011 21:22:02 GMT,
tip-bot for Matthieu CASTET <castet.matthieu@free.fr> a écrit :

> Commit-ID:  ababf605370b2c67cc6a37305c5fa17469a4e1f1
> Gitweb:
> http://git.kernel.org/tip/ababf605370b2c67cc6a37305c5fa17469a4e1f1
> Author:     Matthieu CASTET <castet.matthieu@free.fr> AuthorDate:
> Sat, 2 Jul 2011 19:43:40 +0200 Committer:  H. Peter Anvin
> <hpa@linux.intel.com> CommitDate: Sun, 3 Jul 2011 11:45:44 -0700
> 
> x86, suspend: Merge 32- and 64-bit realmode wakeup code
> 
> - this mean less ifdef in code
> - we could remove now unused field in wakeup_header (pmode_*)
> 
> Signed-off-by: Matthieu CASTET <castet.matthieu@free.fr>
> Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
> Link:
> http://lkml.kernel.org/r/1309628621-23107-1-git-send-email-castet.matthieu@free.fr
> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com> ---
>  arch/x86/kernel/acpi/realmode/wakeup.S |   26
> -------------------------- arch/x86/kernel/acpi/sleep.c           |
> 27 ++++++++++----------------- arch/x86/kernel/trampoline_32.S
> |    4 ---- 3 files changed, 10 insertions(+), 47 deletions(-)
> 
> diff --git a/arch/x86/kernel/acpi/realmode/wakeup.S
> b/arch/x86/kernel/acpi/realmode/wakeup.S index ead21b6..150a734 100644
> --- a/arch/x86/kernel/acpi/realmode/wakeup.S
> +++ b/arch/x86/kernel/acpi/realmode/wakeup.S
> @@ -93,36 +93,10 @@ wakeup_code:
>  
>  	/* Do any other stuff... */
>  
> -#ifndef CONFIG_64BIT
> -	/* This could also be done in C code... */
> -	movl	pmode_cr3, %eax
> -	movl	%eax, %cr3
> -
> -	movl	pmode_cr4, %ecx
> -	jecxz	1f
> -	movl	%ecx, %cr4
> -1:
> -	movl	pmode_efer, %eax
> -	movl	pmode_efer + 4, %edx
> -	movl	%eax, %ecx
> -	orl	%edx, %ecx
> -	jz	1f
> -	movl	$MSR_EFER, %ecx
> -	wrmsr
> -1:
> -
> -	lgdtl	pmode_gdt
> -
> -	/* This really couldn't... */
> -	movl	pmode_cr0, %eax
> -	movl	%eax, %cr0
> -	jmp	pmode_return
> -#else
>  	pushw	$0
>  	pushw	trampoline_segment
>  	pushw	$0
>  	lret
> -#endif
>  
>  bogus_real_magic:
>  1:
> diff --git a/arch/x86/kernel/acpi/sleep.c
> b/arch/x86/kernel/acpi/sleep.c index 18a857b..96719ad 100644
> --- a/arch/x86/kernel/acpi/sleep.c
> +++ b/arch/x86/kernel/acpi/sleep.c
> @@ -20,7 +20,7 @@
>  
>  unsigned long acpi_realmode_flags;
>  
> -#if defined(CONFIG_SMP) && defined(CONFIG_64BIT)
> +#ifdef CONFIG_SMP
>  static char temp_stack[4096];
>  #endif
>  
> @@ -67,34 +67,27 @@ int acpi_suspend_lowlevel(void)
>  	header->wakeup_gdt[2] =
>  		GDT_ENTRY(0x8093, acpi_wakeup_address, 0xfffff);
>  
> -#ifndef CONFIG_64BIT
> -	store_gdt((struct desc_ptr *)&header->pmode_gdt);
> -
> -	if (rdmsr_safe(MSR_EFER, &header->pmode_efer_low,
> -		       &header->pmode_efer_high))
> -		header->pmode_efer_low = header->pmode_efer_high = 0;
> -#endif /* !CONFIG_64BIT */
> -
>  	header->pmode_cr0 = read_cr0();
>  	header->pmode_cr4 = read_cr4_safe();
>  	header->realmode_flags = acpi_realmode_flags;
>  	header->real_magic = 0x12345678;
> -
> -#ifndef CONFIG_64BIT
> -	header->pmode_entry = (u32)&wakeup_pmode_return;
> -	header->pmode_cr3 = (u32)__pa(&initial_page_table);
> -	saved_magic = 0x12345678;
> -#else /* CONFIG_64BIT */
>  	header->trampoline_segment = trampoline_address() >> 4;
>  #ifdef CONFIG_SMP
>  	stack_start = (unsigned long)temp_stack + sizeof(temp_stack);
>  	early_gdt_descr.address =
>  			(unsigned
> long)get_cpu_gdt_table(smp_processor_id()); +#ifdef CONFIG_64BIT
>  	initial_gs = per_cpu_offset(smp_processor_id());
>  #endif
> +#endif
> +
> +#ifdef CONFIG_64BIT
>  	initial_code = (unsigned long)wakeup_long64;
> -       saved_magic = 0x123456789abcdef0L;
> -#endif /* CONFIG_64BIT */
> +	saved_magic = 0x123456789abcdef0L;
> +#else
> +	initial_code = (unsigned long)&wakeup_pmode_return;
> +	saved_magic = 0x12345678;
> +#endif
>  
>  	do_suspend_lowlevel();
>  	return 0;
> diff --git a/arch/x86/kernel/trampoline_32.S
> b/arch/x86/kernel/trampoline_32.S index 451c0a7..a726f60 100644
> --- a/arch/x86/kernel/trampoline_32.S
> +++ b/arch/x86/kernel/trampoline_32.S
> @@ -32,8 +32,6 @@
>  #include <asm/segment.h>
>  #include <asm/page_types.h>
>  
> -#ifdef CONFIG_SMP
> -
>  	.section ".x86_trampoline","a"
>  	.balign PAGE_SIZE
>  	.code16
> @@ -79,5 +77,3 @@ ENTRY(trampoline_status)
>  
>  .globl trampoline_end
>  trampoline_end:
> -
> -#endif /* CONFIG_SMP */


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

* Re: [tip:x86/trampoline] x86, suspend: Merge 32- and 64-bit realmode wakeup code
  2011-08-09 19:34   ` matthieu castet
@ 2011-08-09 20:41     ` H. Peter Anvin
  0 siblings, 0 replies; 11+ messages in thread
From: H. Peter Anvin @ 2011-08-09 20:41 UTC (permalink / raw)
  To: matthieu castet
  Cc: mingo, linux-kernel, tglx, rjw, hpa, linux-tip-commits, Kees Cook

On 08/09/2011 02:34 PM, matthieu castet wrote:
> Note that
> https://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=7a3136666bc0f0419f7aaa7b1fabb4b0e0a7fb76
> should be reverted for applying the patch.
> 
> This is not a problem as the x86_32 trampoline code already does that.
> 
> Any idea when it will be merged in the mainline tree ?
> 

3.2 merge window, unless something goes wrong.

	-hpa

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

end of thread, other threads:[~2011-08-09 20:42 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-02 17:43 [PATCH 1/2] merge 32 and 64 realmode wakeup code Matthieu CASTET
2011-07-02 17:43 ` [PATCH 2/2] clean acpi wakeup code after merge Matthieu CASTET
2011-07-03 21:22   ` [tip:x86/trampoline] x86, suspend: Clean " tip-bot for Matthieu CASTET
2011-07-02 22:31 ` [PATCH 1/2] merge 32 and 64 realmode wakeup code H. Peter Anvin
2011-07-03  6:50   ` Rafael J. Wysocki
2011-07-03 20:52     ` matthieu castet
2011-07-03 20:52       ` matthieu castet
2011-07-03 21:19       ` H. Peter Anvin
2011-07-03 21:22 ` [tip:x86/trampoline] x86, suspend: Merge 32- and 64-bit " tip-bot for Matthieu CASTET
2011-08-09 19:34   ` matthieu castet
2011-08-09 20:41     ` H. Peter Anvin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.