]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.14.112/x86-power-64-use-struct-desc_ptr-for-the-idt-in-stru.patch
Linux 4.9.169
[thirdparty/kernel/stable-queue.git] / releases / 4.14.112 / x86-power-64-use-struct-desc_ptr-for-the-idt-in-stru.patch
1 From 896f9da0c46953beafe93453bd07c497688e78f3 Mon Sep 17 00:00:00 2001
2 From: Andy Lutomirski <luto@kernel.org>
3 Date: Thu, 14 Dec 2017 13:19:05 -0800
4 Subject: x86/power/64: Use struct desc_ptr for the IDT in struct saved_context
5
6 [ Upstream commit 090edbe23ff57940fca7f57d9165ce57a826bd7a ]
7
8 x86_64's saved_context nonsensically used separate idt_limit and
9 idt_base fields and then cast &idt_limit to struct desc_ptr *.
10
11 This was correct (with -fno-strict-aliasing), but it's confusing,
12 served no purpose, and required #ifdeffery. Simplify this by
13 using struct desc_ptr directly.
14
15 No change in functionality.
16
17 Tested-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
18 Signed-off-by: Andy Lutomirski <luto@kernel.org>
19 Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
20 Acked-by: Thomas Gleixner <tglx@linutronix.de>
21 Cc: Borislav Petkov <bpetkov@suse.de>
22 Cc: Josh Poimboeuf <jpoimboe@redhat.com>
23 Cc: Linus Torvalds <torvalds@linux-foundation.org>
24 Cc: Pavel Machek <pavel@ucw.cz>
25 Cc: Peter Zijlstra <peterz@infradead.org>
26 Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
27 Cc: Zhang Rui <rui.zhang@intel.com>
28 Link: http://lkml.kernel.org/r/967909ce38d341b01d45eff53e278e2728a3a93a.1513286253.git.luto@kernel.org
29 Signed-off-by: Ingo Molnar <mingo@kernel.org>
30 Signed-off-by: Sasha Levin <sashal@kernel.org>
31 ---
32 arch/x86/include/asm/suspend_64.h | 3 +--
33 arch/x86/power/cpu.c | 11 +----------
34 2 files changed, 2 insertions(+), 12 deletions(-)
35
36 diff --git a/arch/x86/include/asm/suspend_64.h b/arch/x86/include/asm/suspend_64.h
37 index 7306e911faee..600e9e0aea51 100644
38 --- a/arch/x86/include/asm/suspend_64.h
39 +++ b/arch/x86/include/asm/suspend_64.h
40 @@ -30,8 +30,7 @@ struct saved_context {
41 u16 gdt_pad; /* Unused */
42 struct desc_ptr gdt_desc;
43 u16 idt_pad;
44 - u16 idt_limit;
45 - unsigned long idt_base;
46 + struct desc_ptr idt;
47 u16 ldt;
48 u16 tss;
49 unsigned long tr;
50 diff --git a/arch/x86/power/cpu.c b/arch/x86/power/cpu.c
51 index a51d2dfb57d1..cba2e2c3f89e 100644
52 --- a/arch/x86/power/cpu.c
53 +++ b/arch/x86/power/cpu.c
54 @@ -82,12 +82,8 @@ static void __save_processor_state(struct saved_context *ctxt)
55 /*
56 * descriptor tables
57 */
58 -#ifdef CONFIG_X86_32
59 store_idt(&ctxt->idt);
60 -#else
61 -/* CONFIG_X86_64 */
62 - store_idt((struct desc_ptr *)&ctxt->idt_limit);
63 -#endif
64 +
65 /*
66 * We save it here, but restore it only in the hibernate case.
67 * For ACPI S3 resume, this is loaded via 'early_gdt_desc' in 64-bit
68 @@ -221,12 +217,7 @@ static void notrace __restore_processor_state(struct saved_context *ctxt)
69 * now restore the descriptor tables to their proper values
70 * ltr is done i fix_processor_context().
71 */
72 -#ifdef CONFIG_X86_32
73 load_idt(&ctxt->idt);
74 -#else
75 -/* CONFIG_X86_64 */
76 - load_idt((const struct desc_ptr *)&ctxt->idt_limit);
77 -#endif
78
79 #ifdef CONFIG_X86_64
80 /*
81 --
82 2.19.1
83