Skip to content

Commit 0279aa7

Browse files
committed
Merge tag 'x86-cleanups-2024-09-17' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 cleanups from Thomas Gleixner: "A set of cleanups across x86: - Use memremap() for the EISA probe instead of ioremap(). EISA is strictly memory and not MMIO - Cleanups and enhancement all over the place" * tag 'x86-cleanups-2024-09-17' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/EISA: Dereference memory directly instead of using readl() x86/extable: Remove unused declaration fixup_bug() x86/boot/64: Strip percpu address space when setting up GDT descriptors x86/cpu: Clarify the error message when BIOS does not support SGX x86/kexec: Add comments around swap_pages() assembly to improve readability x86/kexec: Fix a comment of swap_pages() assembly x86/sgx: Fix a W=1 build warning in function comment x86/EISA: Use memremap() to probe for the EISA BIOS signature x86/mtrr: Remove obsolete declaration for mtrr_bp_restore() x86/cpu_entry_area: Annotate percpu_setup_exception_stacks() as __init
2 parents 5ba202a + a678164 commit 0279aa7

File tree

8 files changed

+16
-14
lines changed

8 files changed

+16
-14
lines changed

arch/x86/include/asm/extable.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ struct pt_regs;
3737

3838
extern int fixup_exception(struct pt_regs *regs, int trapnr,
3939
unsigned long error_code, unsigned long fault_addr);
40-
extern int fixup_bug(struct pt_regs *regs, int trapnr);
4140
extern int ex_get_fixup_type(unsigned long ip);
4241
extern void early_fixup_exception(struct pt_regs *regs, int trapnr);
4342

arch/x86/include/asm/mtrr.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ extern int mtrr_add_page(unsigned long base, unsigned long size,
6969
unsigned int type, bool increment);
7070
extern int mtrr_del(int reg, unsigned long base, unsigned long size);
7171
extern int mtrr_del_page(int reg, unsigned long base, unsigned long size);
72-
extern void mtrr_bp_restore(void);
7372
extern int mtrr_trim_uncached_memory(unsigned long end_pfn);
7473
extern int amd_special_default_mtrr(void);
7574
void mtrr_disable(void);
@@ -117,7 +116,6 @@ static inline int mtrr_trim_uncached_memory(unsigned long end_pfn)
117116
return 0;
118117
}
119118
#define mtrr_bp_init() do {} while (0)
120-
#define mtrr_bp_restore() do {} while (0)
121119
#define mtrr_disable() do {} while (0)
122120
#define mtrr_enable() do {} while (0)
123121
#define mtrr_generic_set_state() do {} while (0)

arch/x86/kernel/cpu/feat_ctl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ void init_ia32_feat_ctl(struct cpuinfo_x86 *c)
188188
update_sgx:
189189
if (!(msr & FEAT_CTL_SGX_ENABLED)) {
190190
if (enable_sgx_kvm || enable_sgx_driver)
191-
pr_err_once("SGX disabled by BIOS.\n");
191+
pr_err_once("SGX disabled or unsupported by BIOS.\n");
192192
clear_cpu_cap(c, X86_FEATURE_SGX);
193193
return;
194194
}

arch/x86/kernel/cpu/sgx/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ int arch_memory_failure(unsigned long pfn, int flags)
733733
return 0;
734734
}
735735

736-
/**
736+
/*
737737
* A section metric is concatenated in a way that @low bits 12-31 define the
738738
* bits 12-31 of the metric and @high bits 0-19 define the bits 32-51 of the
739739
* metric.

arch/x86/kernel/eisa.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@
1111

1212
static __init int eisa_bus_probe(void)
1313
{
14-
void __iomem *p;
14+
u32 *p;
1515

1616
if ((xen_pv_domain() && !xen_initial_domain()) || cc_platform_has(CC_ATTR_GUEST_SEV_SNP))
1717
return 0;
1818

19-
p = ioremap(0x0FFFD9, 4);
20-
if (p && readl(p) == 'E' + ('I' << 8) + ('S' << 16) + ('A' << 24))
19+
p = memremap(0x0FFFD9, 4, MEMREMAP_WB);
20+
if (p && *p == 'E' + ('I' << 8) + ('S' << 16) + ('A' << 24))
2121
EISA_bus = 1;
22-
iounmap(p);
22+
memunmap(p);
2323
return 0;
2424
}
2525
subsys_initcall(eisa_bus_probe);

arch/x86/kernel/head64.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,10 +559,11 @@ void early_setup_idt(void)
559559
*/
560560
void __head startup_64_setup_gdt_idt(void)
561561
{
562+
struct desc_struct *gdt = (void *)(__force unsigned long)init_per_cpu_var(gdt_page.gdt);
562563
void *handler = NULL;
563564

564565
struct desc_ptr startup_gdt_descr = {
565-
.address = (unsigned long)&RIP_REL_REF(init_per_cpu_var(gdt_page.gdt)),
566+
.address = (unsigned long)&RIP_REL_REF(*gdt),
566567
.size = GDT_SIZE - 1,
567568
};
568569

arch/x86/kernel/relocate_kernel_64.S

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ SYM_CODE_START_LOCAL_NOALIGN(identity_mapped)
170170
wbinvd
171171
.Lsme_off:
172172

173+
/* Save the preserve_context to %r11 as swap_pages clobbers %rcx. */
173174
movq %rcx, %r11
174175
call swap_pages
175176

@@ -258,7 +259,7 @@ SYM_CODE_END(virtual_mapped)
258259
/* Do the copies */
259260
SYM_CODE_START_LOCAL_NOALIGN(swap_pages)
260261
UNWIND_HINT_END_OF_STACK
261-
movq %rdi, %rcx /* Put the page_list in %rcx */
262+
movq %rdi, %rcx /* Put the indirection_page in %rcx */
262263
xorl %edi, %edi
263264
xorl %esi, %esi
264265
jmp 1f
@@ -289,18 +290,21 @@ SYM_CODE_START_LOCAL_NOALIGN(swap_pages)
289290
movq %rcx, %rsi /* For ever source page do a copy */
290291
andq $0xfffffffffffff000, %rsi
291292

292-
movq %rdi, %rdx
293-
movq %rsi, %rax
293+
movq %rdi, %rdx /* Save destination page to %rdx */
294+
movq %rsi, %rax /* Save source page to %rax */
294295

296+
/* copy source page to swap page */
295297
movq %r10, %rdi
296298
movl $512, %ecx
297299
rep ; movsq
298300

301+
/* copy destination page to source page */
299302
movq %rax, %rdi
300303
movq %rdx, %rsi
301304
movl $512, %ecx
302305
rep ; movsq
303306

307+
/* copy swap page to destination page */
304308
movq %rdx, %rdi
305309
movq %r10, %rsi
306310
movl $512, %ecx

arch/x86/mm/cpu_entry_area.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ static void __init percpu_setup_exception_stacks(unsigned int cpu)
164164
}
165165
}
166166
#else
167-
static inline void percpu_setup_exception_stacks(unsigned int cpu)
167+
static void __init percpu_setup_exception_stacks(unsigned int cpu)
168168
{
169169
struct cpu_entry_area *cea = get_cpu_entry_area(cpu);
170170

0 commit comments

Comments
 (0)