Commit 37e88224 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'x86-cleanups-2020-08-03' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 cleanups from Ingo Molnar:
 "Misc cleanups all around the place"

* tag 'x86-cleanups-2020-08-03' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/ioperm: Initialize pointer bitmap with NULL rather than 0
  x86: uv: uv_hub.h: Delete duplicated word
  x86: cmpxchg_32.h: Delete duplicated word
  x86: bootparam.h: Delete duplicated word
  x86/mm: Remove the unused mk_kernel_pgd() #define
  x86/tsc: Remove unused "US_SCALE" and "NS_SCALE" leftover macros
  x86/ioapic: Remove unused "IOAPIC_AUTO" define
  x86/mm: Drop unused MAX_PHYSADDR_BITS
  x86/msr: Move the F15h MSRs where they belong
  x86/idt: Make idt_descr static
  initrd: Remove erroneous comment
  x86/mm/32: Fix -Wmissing prototypes warnings for init.c
  cpu/speculation: Add prototype for cpu_show_srbds()
  x86/mm: Fix -Wmissing-prototypes warnings for arch/x86/mm/init.c
  x86/asm: Unify __ASSEMBLY__ blocks
  x86/cpufeatures: Mark two free bits in word 3
  x86/msr: Lift AMD family 0x15 power-specific MSRs
parents 1ff9b20b 90fc7392
...@@ -13,10 +13,6 @@ ...@@ -13,10 +13,6 @@
#include <asm/cpu_device_id.h> #include <asm/cpu_device_id.h>
#include "../perf_event.h" #include "../perf_event.h"
#define MSR_F15H_CU_PWR_ACCUMULATOR 0xc001007a
#define MSR_F15H_CU_MAX_PWR_ACCUMULATOR 0xc001007b
#define MSR_F15H_PTSC 0xc0010280
/* Event code: LSB 8 bits, passed in attr->config any other bit is reserved. */ /* Event code: LSB 8 bits, passed in attr->config any other bit is reserved. */
#define AMD_POWER_EVENT_MASK 0xFFULL #define AMD_POWER_EVENT_MASK 0xFFULL
......
...@@ -144,7 +144,7 @@ ...@@ -144,7 +144,7 @@
_ASM_PTR (entry); \ _ASM_PTR (entry); \
.popsection .popsection
#else #else /* ! __ASSEMBLY__ */
# define _EXPAND_EXTABLE_HANDLE(x) #x # define _EXPAND_EXTABLE_HANDLE(x) #x
# define _ASM_EXTABLE_HANDLE(from, to, handler) \ # define _ASM_EXTABLE_HANDLE(from, to, handler) \
" .pushsection \"__ex_table\",\"a\"\n" \ " .pushsection \"__ex_table\",\"a\"\n" \
...@@ -164,9 +164,7 @@ ...@@ -164,9 +164,7 @@
_ASM_EXTABLE_HANDLE(from, to, ex_handler_fault) _ASM_EXTABLE_HANDLE(from, to, ex_handler_fault)
/* For C file, we already have NOKPROBE_SYMBOL macro */ /* For C file, we already have NOKPROBE_SYMBOL macro */
#endif
#ifndef __ASSEMBLY__
/* /*
* This output constraint should be used for any inline asm which has a "call" * This output constraint should be used for any inline asm which has a "call"
* instruction. Otherwise the asm may be inserted before the frame pointer * instruction. Otherwise the asm may be inserted before the frame pointer
...@@ -175,6 +173,6 @@ ...@@ -175,6 +173,6 @@
*/ */
register unsigned long current_stack_pointer asm(_ASM_SP); register unsigned long current_stack_pointer asm(_ASM_SP);
#define ASM_CALL_CONSTRAINT "+r" (current_stack_pointer) #define ASM_CALL_CONSTRAINT "+r" (current_stack_pointer)
#endif #endif /* __ASSEMBLY__ */
#endif /* _ASM_X86_ASM_H */ #endif /* _ASM_X86_ASM_H */
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
#define _ASM_X86_CMPXCHG_32_H #define _ASM_X86_CMPXCHG_32_H
/* /*
* Note: if you use set64_bit(), __cmpxchg64(), or their variants, you * Note: if you use set64_bit(), __cmpxchg64(), or their variants,
* you need to test for the feature in boot_cpu_data. * you need to test for the feature in boot_cpu_data.
*/ */
......
...@@ -96,6 +96,7 @@ ...@@ -96,6 +96,7 @@
#define X86_FEATURE_SYSCALL32 ( 3*32+14) /* "" syscall in IA32 userspace */ #define X86_FEATURE_SYSCALL32 ( 3*32+14) /* "" syscall in IA32 userspace */
#define X86_FEATURE_SYSENTER32 ( 3*32+15) /* "" sysenter in IA32 userspace */ #define X86_FEATURE_SYSENTER32 ( 3*32+15) /* "" sysenter in IA32 userspace */
#define X86_FEATURE_REP_GOOD ( 3*32+16) /* REP microcode works well */ #define X86_FEATURE_REP_GOOD ( 3*32+16) /* REP microcode works well */
/* free ( 3*32+17) */
#define X86_FEATURE_LFENCE_RDTSC ( 3*32+18) /* "" LFENCE synchronizes RDTSC */ #define X86_FEATURE_LFENCE_RDTSC ( 3*32+18) /* "" LFENCE synchronizes RDTSC */
#define X86_FEATURE_ACC_POWER ( 3*32+19) /* AMD Accumulated Power Mechanism */ #define X86_FEATURE_ACC_POWER ( 3*32+19) /* AMD Accumulated Power Mechanism */
#define X86_FEATURE_NOPL ( 3*32+20) /* The NOPL (0F 1F) instructions */ #define X86_FEATURE_NOPL ( 3*32+20) /* The NOPL (0F 1F) instructions */
...@@ -107,6 +108,7 @@ ...@@ -107,6 +108,7 @@
#define X86_FEATURE_EXTD_APICID ( 3*32+26) /* Extended APICID (8 bits) */ #define X86_FEATURE_EXTD_APICID ( 3*32+26) /* Extended APICID (8 bits) */
#define X86_FEATURE_AMD_DCM ( 3*32+27) /* AMD multi-node processor */ #define X86_FEATURE_AMD_DCM ( 3*32+27) /* AMD multi-node processor */
#define X86_FEATURE_APERFMPERF ( 3*32+28) /* P-State hardware coordination feedback capability (APERF/MPERF MSRs) */ #define X86_FEATURE_APERFMPERF ( 3*32+28) /* P-State hardware coordination feedback capability (APERF/MPERF MSRs) */
/* free ( 3*32+29) */
#define X86_FEATURE_NONSTOP_TSC_S3 ( 3*32+30) /* TSC doesn't stop in S3 state */ #define X86_FEATURE_NONSTOP_TSC_S3 ( 3*32+30) /* TSC doesn't stop in S3 state */
#define X86_FEATURE_TSC_KNOWN_FREQ ( 3*32+31) /* TSC has known frequency */ #define X86_FEATURE_TSC_KNOWN_FREQ ( 3*32+31) /* TSC has known frequency */
......
...@@ -99,7 +99,6 @@ struct IR_IO_APIC_route_entry { ...@@ -99,7 +99,6 @@ struct IR_IO_APIC_route_entry {
struct irq_alloc_info; struct irq_alloc_info;
struct ioapic_domain_cfg; struct ioapic_domain_cfg;
#define IOAPIC_AUTO -1
#define IOAPIC_EDGE 0 #define IOAPIC_EDGE 0
#define IOAPIC_LEVEL 1 #define IOAPIC_LEVEL 1
......
...@@ -43,9 +43,10 @@ void __init sme_enable(struct boot_params *bp); ...@@ -43,9 +43,10 @@ void __init sme_enable(struct boot_params *bp);
int __init early_set_memory_decrypted(unsigned long vaddr, unsigned long size); int __init early_set_memory_decrypted(unsigned long vaddr, unsigned long size);
int __init early_set_memory_encrypted(unsigned long vaddr, unsigned long size); int __init early_set_memory_encrypted(unsigned long vaddr, unsigned long size);
void __init mem_encrypt_free_decrypted_mem(void);
/* Architecture __weak replacement functions */ /* Architecture __weak replacement functions */
void __init mem_encrypt_init(void); void __init mem_encrypt_init(void);
void __init mem_encrypt_free_decrypted_mem(void);
bool sme_active(void); bool sme_active(void);
bool sev_active(void); bool sev_active(void);
...@@ -77,6 +78,8 @@ early_set_memory_decrypted(unsigned long vaddr, unsigned long size) { return 0; ...@@ -77,6 +78,8 @@ early_set_memory_decrypted(unsigned long vaddr, unsigned long size) { return 0;
static inline int __init static inline int __init
early_set_memory_encrypted(unsigned long vaddr, unsigned long size) { return 0; } early_set_memory_encrypted(unsigned long vaddr, unsigned long size) { return 0; }
static inline void mem_encrypt_free_decrypted_mem(void) { }
#define __bss_decrypted #define __bss_decrypted
#endif /* CONFIG_AMD_MEM_ENCRYPT */ #endif /* CONFIG_AMD_MEM_ENCRYPT */
......
...@@ -434,7 +434,6 @@ ...@@ -434,7 +434,6 @@
#define MSR_AMD64_PATCH_LEVEL 0x0000008b #define MSR_AMD64_PATCH_LEVEL 0x0000008b
#define MSR_AMD64_TSC_RATIO 0xc0000104 #define MSR_AMD64_TSC_RATIO 0xc0000104
#define MSR_AMD64_NB_CFG 0xc001001f #define MSR_AMD64_NB_CFG 0xc001001f
#define MSR_AMD64_CPUID_FN_1 0xc0011004
#define MSR_AMD64_PATCH_LOADER 0xc0010020 #define MSR_AMD64_PATCH_LOADER 0xc0010020
#define MSR_AMD_PERF_CTL 0xc0010062 #define MSR_AMD_PERF_CTL 0xc0010062
#define MSR_AMD_PERF_STATUS 0xc0010063 #define MSR_AMD_PERF_STATUS 0xc0010063
...@@ -443,6 +442,7 @@ ...@@ -443,6 +442,7 @@
#define MSR_AMD64_OSVW_STATUS 0xc0010141 #define MSR_AMD64_OSVW_STATUS 0xc0010141
#define MSR_AMD_PPIN_CTL 0xc00102f0 #define MSR_AMD_PPIN_CTL 0xc00102f0
#define MSR_AMD_PPIN 0xc00102f1 #define MSR_AMD_PPIN 0xc00102f1
#define MSR_AMD64_CPUID_FN_1 0xc0011004
#define MSR_AMD64_LS_CFG 0xc0011020 #define MSR_AMD64_LS_CFG 0xc0011020
#define MSR_AMD64_DC_CFG 0xc0011022 #define MSR_AMD64_DC_CFG 0xc0011022
#define MSR_AMD64_BU_CFG2 0xc001102a #define MSR_AMD64_BU_CFG2 0xc001102a
...@@ -482,6 +482,8 @@ ...@@ -482,6 +482,8 @@
#define MSR_F16H_DR0_ADDR_MASK 0xc0011027 #define MSR_F16H_DR0_ADDR_MASK 0xc0011027
/* Fam 15h MSRs */ /* Fam 15h MSRs */
#define MSR_F15H_CU_PWR_ACCUMULATOR 0xc001007a
#define MSR_F15H_CU_MAX_PWR_ACCUMULATOR 0xc001007b
#define MSR_F15H_PERF_CTL 0xc0010200 #define MSR_F15H_PERF_CTL 0xc0010200
#define MSR_F15H_PERF_CTL0 MSR_F15H_PERF_CTL #define MSR_F15H_PERF_CTL0 MSR_F15H_PERF_CTL
#define MSR_F15H_PERF_CTL1 (MSR_F15H_PERF_CTL + 2) #define MSR_F15H_PERF_CTL1 (MSR_F15H_PERF_CTL + 2)
......
...@@ -999,15 +999,12 @@ extern int direct_gbpages; ...@@ -999,15 +999,12 @@ extern int direct_gbpages;
void init_mem_mapping(void); void init_mem_mapping(void);
void early_alloc_pgt_buf(void); void early_alloc_pgt_buf(void);
extern void memblock_find_dma_reserve(void); extern void memblock_find_dma_reserve(void);
#ifdef CONFIG_X86_64
extern pgd_t trampoline_pgd_entry;
void __init poking_init(void); void __init poking_init(void);
unsigned long init_memory_mapping(unsigned long start, unsigned long init_memory_mapping(unsigned long start,
unsigned long end, pgprot_t prot); unsigned long end, pgprot_t prot);
#ifdef CONFIG_X86_64
extern pgd_t trampoline_pgd_entry;
#endif #endif
/* local pte updates need not use xchg for locking */ /* local pte updates need not use xchg for locking */
......
...@@ -175,16 +175,13 @@ extern void sync_global_pgds(unsigned long start, unsigned long end); ...@@ -175,16 +175,13 @@ extern void sync_global_pgds(unsigned long start, unsigned long end);
* and a page entry and page directory to the page they refer to. * and a page entry and page directory to the page they refer to.
*/ */
/* /* PGD - Level 4 access */
* Level 4 access.
*/
#define mk_kernel_pgd(address) __pgd((address) | _KERNPG_TABLE)
/* PUD - Level3 access */ /* PUD - Level 3 access */
/* PMD - Level 2 access */ /* PMD - Level 2 access */
/* PTE - Level 1 access. */ /* PTE - Level 1 access */
/* /*
* Encode and de-code a swap entry * Encode and de-code a swap entry
......
...@@ -10,24 +10,20 @@ ...@@ -10,24 +10,20 @@
* field of the struct page * field of the struct page
* *
* SECTION_SIZE_BITS 2^n: size of each section * SECTION_SIZE_BITS 2^n: size of each section
* MAX_PHYSADDR_BITS 2^n: max size of physical address space * MAX_PHYSMEM_BITS 2^n: max size of physical address space
* MAX_PHYSMEM_BITS 2^n: how much memory we can have in that space
* *
*/ */
#ifdef CONFIG_X86_32 #ifdef CONFIG_X86_32
# ifdef CONFIG_X86_PAE # ifdef CONFIG_X86_PAE
# define SECTION_SIZE_BITS 29 # define SECTION_SIZE_BITS 29
# define MAX_PHYSADDR_BITS 36
# define MAX_PHYSMEM_BITS 36 # define MAX_PHYSMEM_BITS 36
# else # else
# define SECTION_SIZE_BITS 26 # define SECTION_SIZE_BITS 26
# define MAX_PHYSADDR_BITS 32
# define MAX_PHYSMEM_BITS 32 # define MAX_PHYSMEM_BITS 32
# endif # endif
#else /* CONFIG_X86_32 */ #else /* CONFIG_X86_32 */
# define SECTION_SIZE_BITS 27 /* matt - 128 is convenient right now */ # define SECTION_SIZE_BITS 27 /* matt - 128 is convenient right now */
# define MAX_PHYSADDR_BITS (pgtable_l5_enabled() ? 52 : 44)
# define MAX_PHYSMEM_BITS (pgtable_l5_enabled() ? 52 : 46) # define MAX_PHYSMEM_BITS (pgtable_l5_enabled() ? 52 : 46)
#endif #endif
......
...@@ -7,9 +7,6 @@ ...@@ -7,9 +7,6 @@
#include <asm/processor.h> #include <asm/processor.h>
#define NS_SCALE 10 /* 2^10, carefully chosen */
#define US_SCALE 32 /* 2^32, arbitralrily chosen */
/* /*
* Standard way to access the cycle counter. * Standard way to access the cycle counter.
*/ */
......
...@@ -682,7 +682,7 @@ static inline int uv_node_to_blade_id(int nid) ...@@ -682,7 +682,7 @@ static inline int uv_node_to_blade_id(int nid)
return nid; return nid;
} }
/* Convert a cpu number to the the UV blade number */ /* Convert a CPU number to the UV blade number */
static inline int uv_cpu_to_blade_id(int cpu) static inline int uv_cpu_to_blade_id(int cpu)
{ {
return uv_node_to_blade_id(cpu_to_node(cpu)); return uv_node_to_blade_id(cpu_to_node(cpu));
......
...@@ -255,7 +255,7 @@ struct boot_params { ...@@ -255,7 +255,7 @@ struct boot_params {
* currently supportd through this PV boot path. * currently supportd through this PV boot path.
* @X86_SUBARCH_INTEL_MID: Used for Intel MID (Mobile Internet Device) platform * @X86_SUBARCH_INTEL_MID: Used for Intel MID (Mobile Internet Device) platform
* systems which do not have the PCI legacy interfaces. * systems which do not have the PCI legacy interfaces.
* @X86_SUBARCH_CE4100: Used for Intel CE media processor (CE4100) SoC for * @X86_SUBARCH_CE4100: Used for Intel CE media processor (CE4100) SoC
* for settop boxes and media devices, the use of a subarch for CE4100 * for settop boxes and media devices, the use of a subarch for CE4100
* is more of a hack... * is more of a hack...
*/ */
......
...@@ -160,7 +160,7 @@ static const __initconst struct idt_data apic_idts[] = { ...@@ -160,7 +160,7 @@ static const __initconst struct idt_data apic_idts[] = {
/* Must be page-aligned because the real IDT is used in the cpu entry area */ /* Must be page-aligned because the real IDT is used in the cpu entry area */
static gate_desc idt_table[IDT_ENTRIES] __page_aligned_bss; static gate_desc idt_table[IDT_ENTRIES] __page_aligned_bss;
struct desc_ptr idt_descr __ro_after_init = { static struct desc_ptr idt_descr __ro_after_init = {
.size = IDT_TABLE_SIZE - 1, .size = IDT_TABLE_SIZE - 1,
.address = (unsigned long) idt_table, .address = (unsigned long) idt_table,
}; };
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <asm/cpufeature.h> #include <asm/cpufeature.h>
#include <asm/pti.h> #include <asm/pti.h>
#include <asm/text-patching.h> #include <asm/text-patching.h>
#include <asm/memtype.h>
/* /*
* We need to define the tracepoints somewhere, and tlb.c * We need to define the tracepoints somewhere, and tlb.c
...@@ -912,8 +913,6 @@ void free_kernel_image_pages(const char *what, void *begin, void *end) ...@@ -912,8 +913,6 @@ void free_kernel_image_pages(const char *what, void *begin, void *end)
set_memory_np_noalias(begin_ul, len_pages); set_memory_np_noalias(begin_ul, len_pages);
} }
void __weak mem_encrypt_free_decrypted_mem(void) { }
void __ref free_initmem(void) void __ref free_initmem(void)
{ {
e820__reallocate_tables(); e820__reallocate_tables();
......
...@@ -376,7 +376,6 @@ bool force_dma_unencrypted(struct device *dev) ...@@ -376,7 +376,6 @@ bool force_dma_unencrypted(struct device *dev)
return false; return false;
} }
/* Architecture __weak replacement functions */
void __init mem_encrypt_free_decrypted_mem(void) void __init mem_encrypt_free_decrypted_mem(void)
{ {
unsigned long vaddr, vaddr_end, npages; unsigned long vaddr, vaddr_end, npages;
...@@ -401,6 +400,7 @@ void __init mem_encrypt_free_decrypted_mem(void) ...@@ -401,6 +400,7 @@ void __init mem_encrypt_free_decrypted_mem(void)
free_init_pages("unused decrypted", vaddr, vaddr_end); free_init_pages("unused decrypted", vaddr, vaddr_end);
} }
/* Architecture __weak replacement functions */
void __init mem_encrypt_init(void) void __init mem_encrypt_init(void)
{ {
if (!sme_me_mask) if (!sme_me_mask)
......
...@@ -873,7 +873,7 @@ static void xen_load_sp0(unsigned long sp0) ...@@ -873,7 +873,7 @@ static void xen_load_sp0(unsigned long sp0)
static void xen_invalidate_io_bitmap(void) static void xen_invalidate_io_bitmap(void)
{ {
struct physdev_set_iobitmap iobitmap = { struct physdev_set_iobitmap iobitmap = {
.bitmap = 0, .bitmap = NULL,
.nr_ports = 0, .nr_ports = 0,
}; };
......
...@@ -41,10 +41,6 @@ MODULE_LICENSE("GPL"); ...@@ -41,10 +41,6 @@ MODULE_LICENSE("GPL");
/* set maximum interval as 1 second */ /* set maximum interval as 1 second */
#define MAX_INTERVAL 1000 #define MAX_INTERVAL 1000
#define MSR_F15H_CU_PWR_ACCUMULATOR 0xc001007a
#define MSR_F15H_CU_MAX_PWR_ACCUMULATOR 0xc001007b
#define MSR_F15H_PTSC 0xc0010280
#define PCI_DEVICE_ID_AMD_15H_M70H_NB_F4 0x15b4 #define PCI_DEVICE_ID_AMD_15H_M70H_NB_F4 0x15b4
struct fam15h_power_data { struct fam15h_power_data {
......
...@@ -64,6 +64,7 @@ extern ssize_t cpu_show_tsx_async_abort(struct device *dev, ...@@ -64,6 +64,7 @@ extern ssize_t cpu_show_tsx_async_abort(struct device *dev,
char *buf); char *buf);
extern ssize_t cpu_show_itlb_multihit(struct device *dev, extern ssize_t cpu_show_itlb_multihit(struct device *dev,
struct device_attribute *attr, char *buf); struct device_attribute *attr, char *buf);
extern ssize_t cpu_show_srbds(struct device *dev, struct device_attribute *attr, char *buf);
extern __printf(4, 5) extern __printf(4, 5)
struct device *cpu_device_create(struct device *parent, void *drvdata, struct device *cpu_device_create(struct device *parent, void *drvdata,
......
...@@ -45,11 +45,6 @@ static int __init early_initrdmem(char *p) ...@@ -45,11 +45,6 @@ static int __init early_initrdmem(char *p)
} }
early_param("initrdmem", early_initrdmem); early_param("initrdmem", early_initrdmem);
/*
* This is here as the initrd keyword has been in use since 11/2018
* on ARM, PowerPC, and MIPS.
* It should not be; it is reserved for bootloaders.
*/
static int __init early_initrd(char *p) static int __init early_initrd(char *p)
{ {
return early_initrdmem(p); return early_initrdmem(p);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment