Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86/gdt: Get rid of the get_*_gdt_*_vaddr() helpers

There's a single caller that is only there because it's passing a
pointer into a function (vmcs_writel()) that takes an unsigned long.
Let's just cast it in place rather than having a bunch of trivial
helpers.

Signed-off-by: Andy Lutomirski <luto@kernel.org>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Garnier <thgarnie@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/46108fb35e1699252b1b6a85039303ff562c9836.1490218061.git.luto@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>

authored by

Andy Lutomirski and committed by
Ingo Molnar
59c58ceb 23b2a4dd

+2 -22
-20
arch/x86/include/asm/desc.h
··· 53 53 return per_cpu(gdt_page, cpu).gdt; 54 54 } 55 55 56 - static inline unsigned long get_cpu_gdt_rw_vaddr(unsigned int cpu) 57 - { 58 - return (unsigned long)get_cpu_gdt_rw(cpu); 59 - } 60 - 61 56 /* Provide the current original GDT */ 62 57 static inline struct desc_struct *get_current_gdt_rw(void) 63 58 { 64 59 return this_cpu_ptr(&gdt_page)->gdt; 65 - } 66 - 67 - static inline unsigned long get_current_gdt_rw_vaddr(void) 68 - { 69 - return (unsigned long)get_current_gdt_rw(); 70 60 } 71 61 72 62 /* Get the fixmap index for a specific processor */ ··· 72 82 return (struct desc_struct *)__fix_to_virt(idx); 73 83 } 74 84 75 - static inline unsigned long get_cpu_gdt_ro_vaddr(int cpu) 76 - { 77 - return (unsigned long)get_cpu_gdt_ro(cpu); 78 - } 79 - 80 85 /* Provide the current read-only GDT */ 81 86 static inline struct desc_struct *get_current_gdt_ro(void) 82 87 { 83 88 return get_cpu_gdt_ro(smp_processor_id()); 84 - } 85 - 86 - static inline unsigned long get_current_gdt_ro_vaddr(void) 87 - { 88 - return (unsigned long)get_current_gdt_ro(); 89 89 } 90 90 91 91 /* Provide the physical address of the GDT page. */
+2 -2
arch/x86/kvm/vmx.c
··· 2264 2264 } 2265 2265 2266 2266 if (!already_loaded) { 2267 - unsigned long gdt = get_current_gdt_ro_vaddr(); 2267 + void *gdt = get_current_gdt_ro(); 2268 2268 unsigned long sysenter_esp; 2269 2269 2270 2270 kvm_make_request(KVM_REQ_TLB_FLUSH, vcpu); ··· 2275 2275 */ 2276 2276 vmcs_writel(HOST_TR_BASE, 2277 2277 (unsigned long)this_cpu_ptr(&cpu_tss)); 2278 - vmcs_writel(HOST_GDTR_BASE, gdt); /* 22.2.4 */ 2278 + vmcs_writel(HOST_GDTR_BASE, (unsigned long)gdt); /* 22.2.4 */ 2279 2279 2280 2280 /* 2281 2281 * VM exits change the host TR limit to 0x67 after a VM