Skip to content

Commit fef3a7a

Browse files
yhuang-intelH. Peter Anvin
authored andcommitted
x86, kexec: fix kexec x86 coding style
Impact: Cleanup Fix some coding style issue for kexec x86. Signed-off-by: Huang Ying <ying.huang@intel.com> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1 parent 467c88f commit fef3a7a

4 files changed

Lines changed: 50 additions & 30 deletions

File tree

‎arch/x86/kernel/machine_kexec_32.c‎

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
#include <linux/ftrace.h>
1515
#include <linux/suspend.h>
1616
#include <linux/gfp.h>
17+
#include <linux/io.h>
1718

1819
#include <asm/pgtable.h>
1920
#include <asm/pgalloc.h>
2021
#include <asm/tlbflush.h>
2122
#include <asm/mmu_context.h>
22-
#include <asm/io.h>
2323
#include <asm/apic.h>
2424
#include <asm/cpufeature.h>
2525
#include <asm/desc.h>
@@ -63,7 +63,7 @@ static void load_segments(void)
6363
"\tmovl %%eax,%%fs\n"
6464
"\tmovl %%eax,%%gs\n"
6565
"\tmovl %%eax,%%ss\n"
66-
::: "eax", "memory");
66+
: : : "eax", "memory");
6767
#undef STR
6868
#undef __STR
6969
}
@@ -205,7 +205,8 @@ void machine_kexec(struct kimage *image)
205205

206206
if (image->preserve_context) {
207207
#ifdef CONFIG_X86_IO_APIC
208-
/* We need to put APICs in legacy mode so that we can
208+
/*
209+
* We need to put APICs in legacy mode so that we can
209210
* get timer interrupts in second kernel. kexec/kdump
210211
* paths already have calls to disable_IO_APIC() in
211212
* one form or other. kexec jump path also need
@@ -227,7 +228,8 @@ void machine_kexec(struct kimage *image)
227228
page_list[PA_SWAP_PAGE] = (page_to_pfn(image->swap_page)
228229
<< PAGE_SHIFT);
229230

230-
/* The segment registers are funny things, they have both a
231+
/*
232+
* The segment registers are funny things, they have both a
231233
* visible and an invisible part. Whenever the visible part is
232234
* set to a specific selector, the invisible part is loaded
233235
* with from a table in memory. At no other time is the
@@ -237,11 +239,12 @@ void machine_kexec(struct kimage *image)
237239
* segments, before I zap the gdt with an invalid value.
238240
*/
239241
load_segments();
240-
/* The gdt & idt are now invalid.
242+
/*
243+
* The gdt & idt are now invalid.
241244
* If you want to load them you must set up your own idt & gdt.
242245
*/
243-
set_gdt(phys_to_virt(0),0);
244-
set_idt(phys_to_virt(0),0);
246+
set_gdt(phys_to_virt(0), 0);
247+
set_idt(phys_to_virt(0), 0);
245248

246249
/* now call it */
247250
image->start = relocate_kernel_ptr((unsigned long)image->head,

‎arch/x86/kernel/machine_kexec_64.c‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
#include <linux/reboot.h>
1313
#include <linux/numa.h>
1414
#include <linux/ftrace.h>
15+
#include <linux/io.h>
1516

1617
#include <asm/pgtable.h>
1718
#include <asm/tlbflush.h>
1819
#include <asm/mmu_context.h>
19-
#include <asm/io.h>
2020

2121
static void init_level2_page(pmd_t *level2p, unsigned long addr)
2222
{
@@ -83,9 +83,8 @@ static int init_level4_page(struct kimage *image, pgd_t *level4p,
8383
}
8484
level3p = (pud_t *)page_address(page);
8585
result = init_level3_page(image, level3p, addr, last_addr);
86-
if (result) {
86+
if (result)
8787
goto out;
88-
}
8988
set_pgd(level4p++, __pgd(__pa(level3p) | _KERNPG_TABLE));
9089
addr += PGDIR_SIZE;
9190
}
@@ -242,7 +241,8 @@ void machine_kexec(struct kimage *image)
242241
page_list[PA_TABLE_PAGE] =
243242
(unsigned long)__pa(page_address(image->control_code_page));
244243

245-
/* The segment registers are funny things, they have both a
244+
/*
245+
* The segment registers are funny things, they have both a
246246
* visible and an invisible part. Whenever the visible part is
247247
* set to a specific selector, the invisible part is loaded
248248
* with from a table in memory. At no other time is the
@@ -252,11 +252,12 @@ void machine_kexec(struct kimage *image)
252252
* segments, before I zap the gdt with an invalid value.
253253
*/
254254
load_segments();
255-
/* The gdt & idt are now invalid.
255+
/*
256+
* The gdt & idt are now invalid.
256257
* If you want to load them you must set up your own idt & gdt.
257258
*/
258-
set_gdt(phys_to_virt(0),0);
259-
set_idt(phys_to_virt(0),0);
259+
set_gdt(phys_to_virt(0), 0);
260+
set_idt(phys_to_virt(0), 0);
260261

261262
/* now call it */
262263
relocate_kernel((unsigned long)image->head, (unsigned long)page_list,

‎arch/x86/kernel/relocate_kernel_32.S‎

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717

1818
#define PTR(x) (x << 2)
1919

20-
/* control_page + KEXEC_CONTROL_CODE_MAX_SIZE
20+
/*
21+
* control_page + KEXEC_CONTROL_CODE_MAX_SIZE
2122
* ~ control_page + PAGE_SIZE are used as data storage and stack for
2223
* jumping back
2324
*/
@@ -76,8 +77,10 @@ relocate_kernel:
7677
movl %eax, CP_PA_SWAP_PAGE(%edi)
7778
movl %ebx, CP_PA_BACKUP_PAGES_MAP(%edi)
7879

79-
/* get physical address of control page now */
80-
/* this is impossible after page table switch */
80+
/*
81+
* get physical address of control page now
82+
* this is impossible after page table switch
83+
*/
8184
movl PTR(PA_CONTROL_PAGE)(%ebp), %edi
8285

8386
/* switch to new set of page tables */
@@ -97,7 +100,8 @@ identity_mapped:
97100
/* store the start address on the stack */
98101
pushl %edx
99102

100-
/* Set cr0 to a known state:
103+
/*
104+
* Set cr0 to a known state:
101105
* - Paging disabled
102106
* - Alignment check disabled
103107
* - Write protect disabled
@@ -113,7 +117,8 @@ identity_mapped:
113117
/* clear cr4 if applicable */
114118
testl %ecx, %ecx
115119
jz 1f
116-
/* Set cr4 to a known state:
120+
/*
121+
* Set cr4 to a known state:
117122
* Setting everything to zero seems safe.
118123
*/
119124
xorl %eax, %eax
@@ -132,15 +137,18 @@ identity_mapped:
132137
call swap_pages
133138
addl $8, %esp
134139

135-
/* To be certain of avoiding problems with self-modifying code
140+
/*
141+
* To be certain of avoiding problems with self-modifying code
136142
* I need to execute a serializing instruction here.
137143
* So I flush the TLB, it's handy, and not processor dependent.
138144
*/
139145
xorl %eax, %eax
140146
movl %eax, %cr3
141147

142-
/* set all of the registers to known values */
143-
/* leave %esp alone */
148+
/*
149+
* set all of the registers to known values
150+
* leave %esp alone
151+
*/
144152

145153
testl %esi, %esi
146154
jnz 1f

‎arch/x86/kernel/relocate_kernel_64.S‎

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
.code64
2525
.globl relocate_kernel
2626
relocate_kernel:
27-
/* %rdi indirection_page
27+
/*
28+
* %rdi indirection_page
2829
* %rsi page_list
2930
* %rdx start address
3031
*/
@@ -33,8 +34,10 @@ relocate_kernel:
3334
pushq $0
3435
popfq
3536

36-
/* get physical address of control page now */
37-
/* this is impossible after page table switch */
37+
/*
38+
* get physical address of control page now
39+
* this is impossible after page table switch
40+
*/
3841
movq PTR(PA_CONTROL_PAGE)(%rsi), %r8
3942

4043
/* get physical address of page table now too */
@@ -55,7 +58,8 @@ identity_mapped:
5558
/* store the start address on the stack */
5659
pushq %rdx
5760

58-
/* Set cr0 to a known state:
61+
/*
62+
* Set cr0 to a known state:
5963
* - Paging enabled
6064
* - Alignment check disabled
6165
* - Write protect disabled
@@ -68,7 +72,8 @@ identity_mapped:
6872
orl $(X86_CR0_PG | X86_CR0_PE), %eax
6973
movq %rax, %cr0
7074

71-
/* Set cr4 to a known state:
75+
/*
76+
* Set cr4 to a known state:
7277
* - physical address extension enabled
7378
*/
7479
movq $X86_CR4_PAE, %rax
@@ -117,16 +122,19 @@ identity_mapped:
117122
jmp 0b
118123
3:
119124

120-
/* To be certain of avoiding problems with self-modifying code
125+
/*
126+
* To be certain of avoiding problems with self-modifying code
121127
* I need to execute a serializing instruction here.
122128
* So I flush the TLB by reloading %cr3 here, it's handy,
123129
* and not processor dependent.
124130
*/
125131
movq %cr3, %rax
126132
movq %rax, %cr3
127133

128-
/* set all of the registers to known values */
129-
/* leave %rsp alone */
134+
/*
135+
* set all of the registers to known values
136+
* leave %rsp alone
137+
*/
130138

131139
xorq %rax, %rax
132140
xorq %rbx, %rbx

0 commit comments

Comments
 (0)