mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-12-29 17:25:38 +00:00
x86/cleanups changes for v6.8:
- A micro-optimization got misplaced as a cleanup: - Micro-optimize the asm code in secondary_startup_64_no_verify() - Change global variables to local - Add missing kernel-doc function parameter descriptions - Remove unused parameter from a macro - Remove obsolete Kconfig entry - Fix comments - Fix typos, mostly scripted, manually reviewed Signed-off-by: Ingo Molnar <mingo@kernel.org> -----BEGIN PGP SIGNATURE----- iQJFBAABCgAvFiEEBpT5eoXrXCwVQwEKEnMQ0APhK1gFAmWb2i8RHG1pbmdvQGtl cm5lbC5vcmcACgkQEnMQ0APhK1iFIQ//RjqKWmEBfv0UVCNgtRgkUKOvYVkfhC1R FykHWbSE+/oDODS7B+gbWqzl9Fq2Oxx9re4KZuMfnojE96KZ6H1flQn7z3UVRUrf pfMx13E+uyf7qbVZktqH38lUS4s/AHdX2PKCiXlU/0hIkiBdjbAl3ylyqMv7ytIL Fi2N9iYJN+eLlMkc3A5IK83xNiU8rb0gO6Uywn3nUbqadY/YX2gDpND5kfzRIneR lTKy4rX3+E65qYB2Ly1wDr7e0Q0rgaTzPctx6twFrxQXK+MsHiartJhM5juND/tU DEjSW9ISOHlitKEJI/zbdrvJlr5AKDNy2zHYmQQuqY6+YHRamCKqwIjLIPkKj52g lAbosNwvp/o8W3zUHgUfVZR5hVxN863zV2qa/ehoQ3b/9kNjQC8actILjYEgIVu9 av1sd+nETbjCUABIF9H9uAoRbgc+wQs2nupJZrjvginFz8+WVhgaBdJDMYCNAmjc fNMjGtRS7YXiIMj09ZAXFThVW302FdbTgggDh/qlQlDOXFu5HRbyuWR+USr4/jkP qs2G6m/BHDs9HxDRo/no+ccSrUBV5phfhZbO7qwjTf2NJJvPHW+cxGpT00zU2v8A lgfVI7SDkxwbyi1gacJ054GqEhsWuEdi40ikqxjhL8Oq4xwwsey/PiaIxjkDQx92 Gj3XUSDnGEs= =kUav -----END PGP SIGNATURE----- Merge tag 'x86-cleanups-2024-01-08' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip Pull x86 cleanups from Ingo Molnar: - Change global variables to local - Add missing kernel-doc function parameter descriptions - Remove unused parameter from a macro - Remove obsolete Kconfig entry - Fix comments - Fix typos, mostly scripted, manually reviewed and a micro-optimization got misplaced as a cleanup: - Micro-optimize the asm code in secondary_startup_64_no_verify() * tag 'x86-cleanups-2024-01-08' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: arch/x86: Fix typos x86/head_64: Use TESTB instead of TESTL in secondary_startup_64_no_verify() x86/docs: Remove reference to syscall trampoline in PTI x86/Kconfig: Remove obsolete config X86_32_SMP x86/io: Remove the unused 'bw' parameter from the BUILDIO() macro x86/mtrr: Document missing function parameters in kernel-doc x86/setup: Make relocated_ramdisk a local variable of relocate_initrd()
This commit is contained in:
commit
b51cc5d028
@ -81,11 +81,9 @@ this protection comes at a cost:
|
||||
and exit (it can be skipped when the kernel is interrupted,
|
||||
though.) Moves to CR3 are on the order of a hundred
|
||||
cycles, and are required at every entry and exit.
|
||||
b. A "trampoline" must be used for SYSCALL entry. This
|
||||
trampoline depends on a smaller set of resources than the
|
||||
non-PTI SYSCALL entry code, so requires mapping fewer
|
||||
things into the userspace page tables. The downside is
|
||||
that stacks must be switched at entry time.
|
||||
b. Percpu TSS is mapped into the user page tables to allow SYSCALL64 path
|
||||
to work under PTI. This doesn't have a direct runtime cost but it can
|
||||
be argued it opens certain timing attack scenarios.
|
||||
c. Global pages are disabled for all kernel structures not
|
||||
mapped into both kernel and userspace page tables. This
|
||||
feature of the MMU allows different processes to share TLB
|
||||
@ -167,7 +165,7 @@ that are worth noting here.
|
||||
* Failures of the selftests/x86 code. Usually a bug in one of the
|
||||
more obscure corners of entry_64.S
|
||||
* Crashes in early boot, especially around CPU bringup. Bugs
|
||||
in the trampoline code or mappings cause these.
|
||||
in the mappings cause these.
|
||||
* Crashes at the first interrupt. Caused by bugs in entry_64.S,
|
||||
like screwing up a page table switch. Also caused by
|
||||
incorrectly mapping the IRQ handler entry code.
|
||||
|
@ -384,10 +384,6 @@ config HAVE_INTEL_TXT
|
||||
def_bool y
|
||||
depends on INTEL_IOMMU && ACPI
|
||||
|
||||
config X86_32_SMP
|
||||
def_bool y
|
||||
depends on X86_32 && SMP
|
||||
|
||||
config X86_64_SMP
|
||||
def_bool y
|
||||
depends on X86_64 && SMP
|
||||
|
@ -53,7 +53,7 @@ KBUILD_CFLAGS += -D__DISABLE_EXPORTS
|
||||
KBUILD_CFLAGS += $(call cc-option,-Wa$(comma)-mrelax-relocations=no)
|
||||
KBUILD_CFLAGS += -include $(srctree)/include/linux/hidden.h
|
||||
|
||||
# sev.c indirectly inludes inat-table.h which is generated during
|
||||
# sev.c indirectly includes inat-table.h which is generated during
|
||||
# compilation and stored in $(objtree). Add the directory to the includes so
|
||||
# that the compiler finds it even with out-of-tree builds (make O=/some/path).
|
||||
CFLAGS_sev.o += -I$(objtree)/arch/x86/lib/
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
/*
|
||||
* accept_memory() and process_unaccepted_memory() called from EFI stub which
|
||||
* runs before decompresser and its early_tdx_detect().
|
||||
* runs before decompressor and its early_tdx_detect().
|
||||
*
|
||||
* Enumerate TDX directly from the early users.
|
||||
*/
|
||||
|
@ -887,7 +887,7 @@ void __init tdx_early_init(void)
|
||||
* there.
|
||||
*
|
||||
* Intel-TDX has a secure RDMSR hypercall, but that needs to be
|
||||
* implemented seperately in the low level startup ASM code.
|
||||
* implemented separately in the low level startup ASM code.
|
||||
* Until that is in place, disable parallel bringup for TDX.
|
||||
*/
|
||||
x86_cpuinit.parallel_bringup = false;
|
||||
|
@ -666,7 +666,7 @@ ALL_F: .octa 0xffffffffffffffffffffffffffffffff
|
||||
|
||||
.ifc \operation, dec
|
||||
movdqa %xmm1, %xmm3
|
||||
pxor %xmm1, %xmm9 # Cyphertext XOR E(K, Yn)
|
||||
pxor %xmm1, %xmm9 # Ciphertext XOR E(K, Yn)
|
||||
|
||||
mov \PLAIN_CYPH_LEN, %r10
|
||||
add %r13, %r10
|
||||
|
@ -747,7 +747,7 @@ VARIABLE_OFFSET = 16*8
|
||||
|
||||
.if \ENC_DEC == DEC
|
||||
vmovdqa %xmm1, %xmm3
|
||||
pxor %xmm1, %xmm9 # Cyphertext XOR E(K, Yn)
|
||||
pxor %xmm1, %xmm9 # Ciphertext XOR E(K, Yn)
|
||||
|
||||
mov \PLAIN_CYPH_LEN, %r10
|
||||
add %r13, %r10
|
||||
|
@ -184,7 +184,7 @@ SYM_FUNC_START(crc_pcl)
|
||||
xor crc1,crc1
|
||||
xor crc2,crc2
|
||||
|
||||
# Fall thruogh into top of crc array (crc_128)
|
||||
# Fall through into top of crc array (crc_128)
|
||||
|
||||
################################################################
|
||||
## 3) CRC Array:
|
||||
|
@ -84,7 +84,7 @@ frame_size = frame_WK + WK_SIZE
|
||||
|
||||
# Useful QWORD "arrays" for simpler memory references
|
||||
# MSG, DIGEST, K_t, W_t are arrays
|
||||
# WK_2(t) points to 1 of 2 qwords at frame.WK depdending on t being odd/even
|
||||
# WK_2(t) points to 1 of 2 qwords at frame.WK depending on t being odd/even
|
||||
|
||||
# Input message (arg1)
|
||||
#define MSG(i) 8*i(msg)
|
||||
|
@ -82,7 +82,7 @@ frame_size = frame_WK + WK_SIZE
|
||||
|
||||
# Useful QWORD "arrays" for simpler memory references
|
||||
# MSG, DIGEST, K_t, W_t are arrays
|
||||
# WK_2(t) points to 1 of 2 qwords at frame.WK depdending on t being odd/even
|
||||
# WK_2(t) points to 1 of 2 qwords at frame.WK depending on t being odd/even
|
||||
|
||||
# Input message (arg1)
|
||||
#define MSG(i) 8*i(msg)
|
||||
|
@ -125,7 +125,7 @@ int amd_brs_hw_config(struct perf_event *event)
|
||||
* Where X is the number of taken branches due to interrupt
|
||||
* skid. Skid is large.
|
||||
*
|
||||
* Where Y is the occurences of the event while BRS is
|
||||
* Where Y is the occurrences of the event while BRS is
|
||||
* capturing the lbr_nr entries.
|
||||
*
|
||||
* By using retired taken branches, we limit the impact on the
|
||||
|
@ -1184,7 +1184,7 @@ static void amd_put_event_constraints_f17h(struct cpu_hw_events *cpuc,
|
||||
* period of each one and given that the BRS saturates, it would not be possible
|
||||
* to guarantee correlated content for all events. Therefore, in situations
|
||||
* where multiple events want to use BRS, the kernel enforces mutual exclusion.
|
||||
* Exclusion is enforced by chosing only one counter for events using BRS.
|
||||
* Exclusion is enforced by choosing only one counter for events using BRS.
|
||||
* The event scheduling logic will then automatically multiplex the
|
||||
* events and ensure that at most one event is actively using BRS.
|
||||
*
|
||||
|
@ -4027,7 +4027,7 @@ static int intel_pmu_hw_config(struct perf_event *event)
|
||||
|
||||
/*
|
||||
* Currently, the only caller of this function is the atomic_switch_perf_msrs().
|
||||
* The host perf conext helps to prepare the values of the real hardware for
|
||||
* The host perf context helps to prepare the values of the real hardware for
|
||||
* a set of msrs that need to be switched atomically in a vmx transaction.
|
||||
*
|
||||
* For example, the pseudocode needed to add a new msr should look like:
|
||||
|
@ -209,7 +209,7 @@ static bool __send_ipi_mask(const struct cpumask *mask, int vector,
|
||||
|
||||
/*
|
||||
* This particular version of the IPI hypercall can
|
||||
* only target upto 64 CPUs.
|
||||
* only target up to 64 CPUs.
|
||||
*/
|
||||
if (vcpu >= 64)
|
||||
goto do_ex_hypercall;
|
||||
|
@ -212,7 +212,7 @@ static void hv_irq_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
|
||||
* This interrupt is already mapped. Let's unmap first.
|
||||
*
|
||||
* We don't use retarget interrupt hypercalls here because
|
||||
* Microsoft Hypervisor doens't allow root to change the vector
|
||||
* Microsoft Hypervisor doesn't allow root to change the vector
|
||||
* or specify VPs outside of the set that is initially used
|
||||
* during mapping.
|
||||
*/
|
||||
|
@ -144,7 +144,7 @@ void __noreturn hv_ghcb_terminate(unsigned int set, unsigned int reason)
|
||||
/* Tell the hypervisor what went wrong. */
|
||||
val |= GHCB_SEV_TERM_REASON(set, reason);
|
||||
|
||||
/* Request Guest Termination from Hypvervisor */
|
||||
/* Request Guest Termination from Hypervisor */
|
||||
wr_ghcb_msr(val);
|
||||
VMGEXIT();
|
||||
|
||||
|
@ -104,7 +104,7 @@ static inline bool amd_gart_present(void)
|
||||
if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD)
|
||||
return false;
|
||||
|
||||
/* GART present only on Fam15h, upto model 0fh */
|
||||
/* GART present only on Fam15h, up to model 0fh */
|
||||
if (boot_cpu_data.x86 == 0xf || boot_cpu_data.x86 == 0x10 ||
|
||||
(boot_cpu_data.x86 == 0x15 && boot_cpu_data.x86_model < 0x10))
|
||||
return true;
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
/*
|
||||
* Our IMM is signed, as such it must live at the top end of the word. Also,
|
||||
* since C99 hex constants are of ambigious type, force cast the mask to 'int'
|
||||
* since C99 hex constants are of ambiguous type, force cast the mask to 'int'
|
||||
* so that FIELD_GET() will DTRT and sign extend the value when it extracts it.
|
||||
*/
|
||||
#define EX_DATA_TYPE_MASK ((int)0x000000FF)
|
||||
|
@ -415,7 +415,7 @@ struct fpu_state_perm {
|
||||
*
|
||||
* This master permission field is only to be used when
|
||||
* task.fpu.fpstate based checks fail to validate whether the task
|
||||
* is allowed to expand it's xfeatures set which requires to
|
||||
* is allowed to expand its xfeatures set which requires to
|
||||
* allocate a larger sized fpstate buffer.
|
||||
*
|
||||
* Do not access this field directly. Use the provided helper
|
||||
|
@ -242,7 +242,7 @@ static inline void slow_down_io(void)
|
||||
|
||||
#endif
|
||||
|
||||
#define BUILDIO(bwl, bw, type) \
|
||||
#define BUILDIO(bwl, type) \
|
||||
static inline void out##bwl##_p(type value, u16 port) \
|
||||
{ \
|
||||
out##bwl(value, port); \
|
||||
@ -288,9 +288,9 @@ static inline void ins##bwl(u16 port, void *addr, unsigned long count) \
|
||||
} \
|
||||
}
|
||||
|
||||
BUILDIO(b, b, u8)
|
||||
BUILDIO(w, w, u16)
|
||||
BUILDIO(l, , u32)
|
||||
BUILDIO(b, u8)
|
||||
BUILDIO(w, u16)
|
||||
BUILDIO(l, u32)
|
||||
#undef BUILDIO
|
||||
|
||||
#define inb_p inb_p
|
||||
|
@ -111,7 +111,7 @@ int iosf_mbi_modify(u8 port, u8 opcode, u32 offset, u32 mdr, u32 mask);
|
||||
* This function will block all kernel access to the PMIC I2C bus, so that the
|
||||
* P-Unit can safely access the PMIC over the shared I2C bus.
|
||||
*
|
||||
* Note on these systems the i2c-bus driver will request a sempahore from the
|
||||
* Note on these systems the i2c-bus driver will request a semaphore from the
|
||||
* P-Unit for exclusive access to the PMIC bus when i2c drivers are accessing
|
||||
* it, but this does not appear to be sufficient, we still need to avoid making
|
||||
* certain P-Unit requests during the access window to avoid problems.
|
||||
|
@ -1652,7 +1652,7 @@ struct kvm_x86_ops {
|
||||
/* Whether or not a virtual NMI is pending in hardware. */
|
||||
bool (*is_vnmi_pending)(struct kvm_vcpu *vcpu);
|
||||
/*
|
||||
* Attempt to pend a virtual NMI in harware. Returns %true on success
|
||||
* Attempt to pend a virtual NMI in hardware. Returns %true on success
|
||||
* to allow using static_call_ret0 as the fallback.
|
||||
*/
|
||||
bool (*set_vnmi_pending)(struct kvm_vcpu *vcpu);
|
||||
|
@ -49,7 +49,7 @@
|
||||
* but there is still a cushion vs. the RSB depth. The algorithm does not
|
||||
* claim to be perfect and it can be speculated around by the CPU, but it
|
||||
* is considered that it obfuscates the problem enough to make exploitation
|
||||
* extremly difficult.
|
||||
* extremely difficult.
|
||||
*/
|
||||
#define RET_DEPTH_SHIFT 5
|
||||
#define RSB_RET_STUFF_LOOPS 16
|
||||
@ -208,7 +208,7 @@
|
||||
|
||||
/*
|
||||
* Abuse ANNOTATE_RETPOLINE_SAFE on a NOP to indicate UNRET_END, should
|
||||
* eventually turn into it's own annotation.
|
||||
* eventually turn into its own annotation.
|
||||
*/
|
||||
.macro VALIDATE_UNRET_END
|
||||
#if defined(CONFIG_NOINSTR_VALIDATION) && \
|
||||
|
@ -203,7 +203,7 @@ static inline void native_pgd_clear(pgd_t *pgd)
|
||||
* F (2) in swp entry is used to record when a pagetable is
|
||||
* writeprotected by userfaultfd WP support.
|
||||
*
|
||||
* E (3) in swp entry is used to rememeber PG_anon_exclusive.
|
||||
* E (3) in swp entry is used to remember PG_anon_exclusive.
|
||||
*
|
||||
* Bit 7 in swp entry should be 0 because pmd_present checks not only P,
|
||||
* but also L and G.
|
||||
|
@ -31,8 +31,6 @@
|
||||
#include <asm/bootparam.h>
|
||||
#include <asm/x86_init.h>
|
||||
|
||||
extern u64 relocated_ramdisk;
|
||||
|
||||
/* Interrupt control for vSMPowered x86_64 systems */
|
||||
#ifdef CONFIG_X86_64
|
||||
void vsmp_init(void);
|
||||
|
@ -653,7 +653,7 @@ static inline int uv_blade_to_node(int blade)
|
||||
return uv_socket_to_node(blade);
|
||||
}
|
||||
|
||||
/* Blade number of current cpu. Numnbered 0 .. <#blades -1> */
|
||||
/* Blade number of current cpu. Numbered 0 .. <#blades -1> */
|
||||
static inline int uv_numa_blade_id(void)
|
||||
{
|
||||
return uv_hub_info->numa_blade_id;
|
||||
|
@ -321,7 +321,7 @@ static __always_inline
|
||||
u64 vdso_calc_delta(u64 cycles, u64 last, u64 mask, u32 mult)
|
||||
{
|
||||
/*
|
||||
* Due to the MSB/Sign-bit being used as invald marker (see
|
||||
* Due to the MSB/Sign-bit being used as invalid marker (see
|
||||
* arch_vdso_cycles_valid() above), the effective mask is S64_MAX.
|
||||
*/
|
||||
u64 delta = (cycles - last) & S64_MAX;
|
||||
|
@ -61,7 +61,7 @@
|
||||
* RING1 -> RING3 kernel mode.
|
||||
* RING2 -> RING3 kernel mode.
|
||||
* RING3 -> RING3 user mode.
|
||||
* However RING0 indicates that the guest kernel should return to iteself
|
||||
* However RING0 indicates that the guest kernel should return to itself
|
||||
* directly with
|
||||
* orb $3,1*8(%rsp)
|
||||
* iretq
|
||||
|
@ -238,7 +238,7 @@ static const struct hsmp_msg_desc hsmp_msg_desc_table[] = {
|
||||
/*
|
||||
* HSMP_GET_DIMM_THERMAL, num_args = 1, response_sz = 1
|
||||
* input: args[0] = DIMM address[7:0]
|
||||
* output: args[0] = temperature in degree celcius[31:21] + update rate in ms[16:8] +
|
||||
* output: args[0] = temperature in degree celsius[31:21] + update rate in ms[16:8] +
|
||||
* DIMM address[7:0]
|
||||
*/
|
||||
{1, 1, HSMP_GET},
|
||||
|
@ -1906,7 +1906,7 @@ static void *__text_poke(text_poke_f func, void *addr, const void *src, size_t l
|
||||
* Note that the caller must ensure that if the modified code is part of a
|
||||
* module, the module would not be removed during poking. This can be achieved
|
||||
* by registering a module notifier, and ordering module removal and patching
|
||||
* trough a mutex.
|
||||
* through a mutex.
|
||||
*/
|
||||
void *text_poke(void *addr, const void *opcode, size_t len)
|
||||
{
|
||||
|
@ -776,7 +776,7 @@ int __init gart_iommu_init(void)
|
||||
iommu_size >> PAGE_SHIFT);
|
||||
/*
|
||||
* Tricky. The GART table remaps the physical memory range,
|
||||
* so the CPU wont notice potential aliases and if the memory
|
||||
* so the CPU won't notice potential aliases and if the memory
|
||||
* is remapped to UC later on, we might surprise the PCI devices
|
||||
* with a stray writeout of a cacheline. So play it sure and
|
||||
* do an explicit, full-scale wbinvd() _after_ having marked all
|
||||
|
@ -4,7 +4,7 @@
|
||||
#
|
||||
|
||||
# Leads to non-deterministic coverage that is not a function of syscall inputs.
|
||||
# In particualr, smp_apic_timer_interrupt() is called in random places.
|
||||
# In particular, smp_apic_timer_interrupt() is called in random places.
|
||||
KCOV_INSTRUMENT := n
|
||||
|
||||
obj-$(CONFIG_X86_LOCAL_APIC) += apic.o apic_common.o apic_noop.o ipi.o vector.o init.o
|
||||
|
@ -782,7 +782,7 @@ bool __init apic_needs_pit(void)
|
||||
|
||||
/*
|
||||
* If interrupt delivery mode is legacy PIC or virtual wire without
|
||||
* configuration, the local APIC timer wont be set up. Make sure
|
||||
* configuration, the local APIC timer won't be set up. Make sure
|
||||
* that the PIT is initialized.
|
||||
*/
|
||||
if (apic_intr_mode == APIC_PIC ||
|
||||
|
@ -738,8 +738,8 @@ int __init arch_probe_nr_irqs(void)
|
||||
void lapic_assign_legacy_vector(unsigned int irq, bool replace)
|
||||
{
|
||||
/*
|
||||
* Use assign system here so it wont get accounted as allocated
|
||||
* and moveable in the cpu hotplug check and it prevents managed
|
||||
* Use assign system here so it won't get accounted as allocated
|
||||
* and movable in the cpu hotplug check and it prevents managed
|
||||
* irq reservation from touching it.
|
||||
*/
|
||||
irq_matrix_assign_system(vector_matrix, ISA_IRQ_VECTOR(irq), replace);
|
||||
|
@ -428,6 +428,10 @@ void __init mtrr_copy_map(void)
|
||||
* from the x86_init.hyper.init_platform() hook. It can be called only once.
|
||||
* The MTRR state can't be changed afterwards. To ensure that, X86_FEATURE_MTRR
|
||||
* is cleared.
|
||||
*
|
||||
* @var: MTRR variable range array to use
|
||||
* @num_var: length of the @var array
|
||||
* @def_type: default caching type
|
||||
*/
|
||||
void mtrr_overwrite_state(struct mtrr_var_range *var, unsigned int num_var,
|
||||
mtrr_type def_type)
|
||||
@ -492,13 +496,15 @@ static u8 type_merge(u8 type, u8 new_type, u8 *uniform)
|
||||
/**
|
||||
* mtrr_type_lookup - look up memory type in MTRR
|
||||
*
|
||||
* @start: Begin of the physical address range
|
||||
* @end: End of the physical address range
|
||||
* @uniform: output argument:
|
||||
* - 1: the returned MTRR type is valid for the whole region
|
||||
* - 0: otherwise
|
||||
*
|
||||
* Return Values:
|
||||
* MTRR_TYPE_(type) - The effective MTRR type for the region
|
||||
* MTRR_TYPE_INVALID - MTRR is disabled
|
||||
*
|
||||
* Output Argument:
|
||||
* uniform - Set to 1 when the returned MTRR type is valid for the whole
|
||||
* region, set to 0 else.
|
||||
*/
|
||||
u8 mtrr_type_lookup(u64 start, u64 end, u8 *uniform)
|
||||
{
|
||||
|
@ -581,7 +581,7 @@ static int sgx_encl_init(struct sgx_encl *encl, struct sgx_sigstruct *sigstruct,
|
||||
*
|
||||
* Flush any outstanding enqueued EADD operations and perform EINIT. The
|
||||
* Launch Enclave Public Key Hash MSRs are rewritten as necessary to match
|
||||
* the enclave's MRSIGNER, which is caculated from the provided sigstruct.
|
||||
* the enclave's MRSIGNER, which is calculated from the provided sigstruct.
|
||||
*
|
||||
* Return:
|
||||
* - 0: Success.
|
||||
|
@ -308,7 +308,7 @@ EXPORT_SYMBOL_GPL(fpu_update_guest_xfd);
|
||||
* Must be invoked from KVM after a VMEXIT before enabling interrupts when
|
||||
* XFD write emulation is disabled. This is required because the guest can
|
||||
* freely modify XFD and the state at VMEXIT is not guaranteed to be the
|
||||
* same as the state on VMENTER. So software state has to be udpated before
|
||||
* same as the state on VMENTER. So software state has to be updated before
|
||||
* any operation which depends on it can take place.
|
||||
*
|
||||
* Note: It can be invoked unconditionally even when write emulation is
|
||||
|
@ -204,7 +204,7 @@ SYM_INNER_LABEL(secondary_startup_64_no_verify, SYM_L_GLOBAL)
|
||||
/* Enable PAE mode, PSE, PGE and LA57 */
|
||||
orl $(X86_CR4_PAE | X86_CR4_PSE | X86_CR4_PGE), %ecx
|
||||
#ifdef CONFIG_X86_5LEVEL
|
||||
testl $1, __pgtable_l5_enabled(%rip)
|
||||
testb $1, __pgtable_l5_enabled(%rip)
|
||||
jz 1f
|
||||
orl $X86_CR4_LA57, %ecx
|
||||
1:
|
||||
@ -218,9 +218,9 @@ SYM_INNER_LABEL(secondary_startup_64_no_verify, SYM_L_GLOBAL)
|
||||
* Switch to new page-table
|
||||
*
|
||||
* For the boot CPU this switches to early_top_pgt which still has the
|
||||
* indentity mappings present. The secondary CPUs will switch to the
|
||||
* identity mappings present. The secondary CPUs will switch to the
|
||||
* init_top_pgt here, away from the trampoline_pgd and unmap the
|
||||
* indentity mapped ranges.
|
||||
* identity mapped ranges.
|
||||
*/
|
||||
movq %rax, %cr3
|
||||
|
||||
|
@ -707,7 +707,7 @@ static void __init hpet_select_clockevents(void)
|
||||
|
||||
hpet_base.nr_clockevents = 0;
|
||||
|
||||
/* No point if MSI is disabled or CPU has an Always Runing APIC Timer */
|
||||
/* No point if MSI is disabled or CPU has an Always Running APIC Timer */
|
||||
if (hpet_msi_disable || boot_cpu_has(X86_FEATURE_ARAT))
|
||||
return;
|
||||
|
||||
@ -965,7 +965,7 @@ static bool __init mwait_pc10_supported(void)
|
||||
* and per CPU timer interrupts.
|
||||
*
|
||||
* The probability that this problem is going to be solved in the
|
||||
* forseeable future is close to zero, so the kernel has to be cluttered
|
||||
* foreseeable future is close to zero, so the kernel has to be cluttered
|
||||
* with heuristics to keep up with the ever growing amount of hardware and
|
||||
* firmware trainwrecks. Hopefully some day hardware people will understand
|
||||
* that the approach of "This can be fixed in software" is not sustainable.
|
||||
|
@ -942,7 +942,7 @@ static void __init kvm_init_platform(void)
|
||||
* Reset the host's shared pages list related to kernel
|
||||
* specific page encryption status settings before we load a
|
||||
* new kernel by kexec. Reset the page encryption status
|
||||
* during early boot intead of just before kexec to avoid SMP
|
||||
* during early boot instead of just before kexec to avoid SMP
|
||||
* races during kvm_pv_guest_cpu_reboot().
|
||||
* NOTE: We cannot reset the complete shared pages list
|
||||
* here as we need to retain the UEFI/OVMF firmware
|
||||
|
@ -42,7 +42,7 @@ static int __init parse_no_kvmclock_vsyscall(char *arg)
|
||||
}
|
||||
early_param("no-kvmclock-vsyscall", parse_no_kvmclock_vsyscall);
|
||||
|
||||
/* Aligned to page sizes to match whats mapped via vsyscalls to userspace */
|
||||
/* Aligned to page sizes to match what's mapped via vsyscalls to userspace */
|
||||
#define HVC_BOOT_ARRAY_SIZE \
|
||||
(PAGE_SIZE / sizeof(struct pvclock_vsyscall_time_info))
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
* This handles calls from both 32bit and 64bit mode.
|
||||
*
|
||||
* Lock order:
|
||||
* contex.ldt_usr_sem
|
||||
* context.ldt_usr_sem
|
||||
* mmap_lock
|
||||
* context.lock
|
||||
*/
|
||||
@ -49,7 +49,7 @@ void load_mm_ldt(struct mm_struct *mm)
|
||||
/*
|
||||
* Any change to mm->context.ldt is followed by an IPI to all
|
||||
* CPUs with the mm active. The LDT will not be freed until
|
||||
* after the IPI is handled by all such CPUs. This means that,
|
||||
* after the IPI is handled by all such CPUs. This means that
|
||||
* if the ldt_struct changes before we return, the values we see
|
||||
* will be safe, and the new values will be loaded before we run
|
||||
* any user code.
|
||||
@ -685,7 +685,7 @@ SYSCALL_DEFINE3(modify_ldt, int , func , void __user * , ptr ,
|
||||
}
|
||||
/*
|
||||
* The SYSCALL_DEFINE() macros give us an 'unsigned long'
|
||||
* return type, but tht ABI for sys_modify_ldt() expects
|
||||
* return type, but the ABI for sys_modify_ldt() expects
|
||||
* 'int'. This cast gives us an int-sized value in %rax
|
||||
* for the return code. The 'unsigned' is necessary so
|
||||
* the compiler does not try to sign-extend the negative
|
||||
|
@ -477,7 +477,7 @@ void native_tss_update_io_bitmap(void)
|
||||
/*
|
||||
* Make sure that the TSS limit is covering the IO bitmap. It might have
|
||||
* been cut down by a VMEXIT to 0x67 which would cause a subsequent I/O
|
||||
* access from user space to trigger a #GP because tbe bitmap is outside
|
||||
* access from user space to trigger a #GP because the bitmap is outside
|
||||
* the TSS limit.
|
||||
*/
|
||||
refresh_tss_limit();
|
||||
|
@ -226,8 +226,6 @@ static void __init reserve_brk(void)
|
||||
_brk_start = 0;
|
||||
}
|
||||
|
||||
u64 relocated_ramdisk;
|
||||
|
||||
#ifdef CONFIG_BLK_DEV_INITRD
|
||||
|
||||
static u64 __init get_ramdisk_image(void)
|
||||
@ -261,7 +259,7 @@ static void __init relocate_initrd(void)
|
||||
u64 area_size = PAGE_ALIGN(ramdisk_size);
|
||||
|
||||
/* We need to move the initrd down into directly mapped mem */
|
||||
relocated_ramdisk = memblock_phys_alloc_range(area_size, PAGE_SIZE, 0,
|
||||
u64 relocated_ramdisk = memblock_phys_alloc_range(area_size, PAGE_SIZE, 0,
|
||||
PFN_PHYS(max_pfn_mapped));
|
||||
if (!relocated_ramdisk)
|
||||
panic("Cannot find place for new RAMDISK of size %lld\n",
|
||||
|
@ -96,7 +96,7 @@ static void __noreturn sev_es_terminate(unsigned int set, unsigned int reason)
|
||||
/* Tell the hypervisor what went wrong. */
|
||||
val |= GHCB_SEV_TERM_REASON(set, reason);
|
||||
|
||||
/* Request Guest Termination from Hypvervisor */
|
||||
/* Request Guest Termination from Hypervisor */
|
||||
sev_es_wr_ghcb_msr(val);
|
||||
VMGEXIT();
|
||||
|
||||
|
@ -105,7 +105,7 @@ static inline struct kvm_cpuid_entry2 *cpuid_entry2_find(
|
||||
|
||||
/*
|
||||
* If the index isn't significant, use the first entry with a
|
||||
* matching function. It's userspace's responsibilty to not
|
||||
* matching function. It's userspace's responsibility to not
|
||||
* provide "duplicate" entries in all cases.
|
||||
*/
|
||||
if (!(e->flags & KVM_CPUID_FLAG_SIGNIFCANT_INDEX) || e->index == index)
|
||||
|
@ -987,7 +987,7 @@ static void pte_list_desc_remove_entry(struct kvm *kvm,
|
||||
|
||||
/*
|
||||
* The head descriptor is empty. If there are no tail descriptors,
|
||||
* nullify the rmap head to mark the list as emtpy, else point the rmap
|
||||
* nullify the rmap head to mark the list as empty, else point the rmap
|
||||
* head at the next descriptor, i.e. the new head.
|
||||
*/
|
||||
if (!head_desc->more)
|
||||
@ -6544,7 +6544,7 @@ void kvm_mmu_try_split_huge_pages(struct kvm *kvm,
|
||||
kvm_tdp_mmu_try_split_huge_pages(kvm, memslot, start, end, target_level, false);
|
||||
|
||||
/*
|
||||
* A TLB flush is unnecessary at this point for the same resons as in
|
||||
* A TLB flush is unnecessary at this point for the same reasons as in
|
||||
* kvm_mmu_slot_try_split_huge_pages().
|
||||
*/
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ static bool try_step_up(struct tdp_iter *iter)
|
||||
* Step to the next SPTE in a pre-order traversal of the paging structure.
|
||||
* To get to the next SPTE, the iterator either steps down towards the goal
|
||||
* GFN, if at a present, non-last-level SPTE, or over to a SPTE mapping a
|
||||
* highter GFN.
|
||||
* higher GFN.
|
||||
*
|
||||
* The basic algorithm is as follows:
|
||||
* 1. If the current SPTE is a non-last-level SPTE, step down into the page
|
||||
|
@ -4744,7 +4744,7 @@ static int svm_check_emulate_instruction(struct kvm_vcpu *vcpu, int emul_type,
|
||||
* Emulation is possible for SEV guests if and only if a prefilled
|
||||
* buffer containing the bytes of the intercepted instruction is
|
||||
* available. SEV guest memory is encrypted with a guest specific key
|
||||
* and cannot be decrypted by KVM, i.e. KVM would read cyphertext and
|
||||
* and cannot be decrypted by KVM, i.e. KVM would read ciphertext and
|
||||
* decode garbage.
|
||||
*
|
||||
* If KVM is NOT trying to simply skip an instruction, inject #UD if
|
||||
|
@ -6561,7 +6561,7 @@ static int vmx_set_nested_state(struct kvm_vcpu *vcpu,
|
||||
* code was changed such that flag signals vmcs12 should
|
||||
* be copied into eVMCS in guest memory.
|
||||
*
|
||||
* To preserve backwards compatability, allow user
|
||||
* To preserve backwards compatibility, allow user
|
||||
* to set this flag even when there is no VMXON region.
|
||||
*/
|
||||
if (kvm_state->flags & ~KVM_STATE_NESTED_EVMCS)
|
||||
|
@ -1809,7 +1809,7 @@ static void vmx_inject_exception(struct kvm_vcpu *vcpu)
|
||||
* do generate error codes with bits 31:16 set, and so KVM's
|
||||
* ABI lets userspace shove in arbitrary 32-bit values. Drop
|
||||
* the upper bits to avoid VM-Fail, losing information that
|
||||
* does't really exist is preferable to killing the VM.
|
||||
* doesn't really exist is preferable to killing the VM.
|
||||
*/
|
||||
vmcs_write32(VM_ENTRY_EXCEPTION_ERROR_CODE, (u16)ex->error_code);
|
||||
intr_info |= INTR_INFO_DELIVER_CODE_MASK;
|
||||
|
@ -10165,7 +10165,7 @@ static void kvm_inject_exception(struct kvm_vcpu *vcpu)
|
||||
*
|
||||
* But, if a VM-Exit occurs during instruction execution, and KVM does NOT skip
|
||||
* the instruction or inject an exception, then KVM can incorrecty inject a new
|
||||
* asynchrounous event if the event became pending after the CPU fetched the
|
||||
* asynchronous event if the event became pending after the CPU fetched the
|
||||
* instruction (in the guest). E.g. if a page fault (#PF, #NPF, EPT violation)
|
||||
* occurs and is resolved by KVM, a coincident NMI, SMI, IRQ, etc... can be
|
||||
* injected on the restarted instruction instead of being deferred until the
|
||||
@ -10186,7 +10186,7 @@ static int kvm_check_and_inject_events(struct kvm_vcpu *vcpu,
|
||||
int r;
|
||||
|
||||
/*
|
||||
* Process nested events first, as nested VM-Exit supercedes event
|
||||
* Process nested events first, as nested VM-Exit supersedes event
|
||||
* re-injection. If there's an event queued for re-injection, it will
|
||||
* be saved into the appropriate vmc{b,s}12 fields on nested VM-Exit.
|
||||
*/
|
||||
@ -10884,7 +10884,7 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
|
||||
/*
|
||||
* Assert that vCPU vs. VM APICv state is consistent. An APICv
|
||||
* update must kick and wait for all vCPUs before toggling the
|
||||
* per-VM state, and responsing vCPUs must wait for the update
|
||||
* per-VM state, and responding vCPUs must wait for the update
|
||||
* to complete before servicing KVM_REQ_APICV_UPDATE.
|
||||
*/
|
||||
WARN_ON_ONCE((kvm_vcpu_apicv_activated(vcpu) != kvm_vcpu_apicv_active(vcpu)) &&
|
||||
|
@ -128,7 +128,7 @@ static void delay_halt_mwaitx(u64 unused, u64 cycles)
|
||||
|
||||
delay = min_t(u64, MWAITX_MAX_WAIT_CYCLES, cycles);
|
||||
/*
|
||||
* Use cpu_tss_rw as a cacheline-aligned, seldomly accessed per-cpu
|
||||
* Use cpu_tss_rw as a cacheline-aligned, seldom accessed per-cpu
|
||||
* variable as the monitor target.
|
||||
*/
|
||||
__monitorx(raw_cpu_ptr(&cpu_tss_rw), 0, 0);
|
||||
|
@ -1013,7 +1013,7 @@ static void __meminit free_pte_table(pte_t *pte_start, pmd_t *pmd)
|
||||
return;
|
||||
}
|
||||
|
||||
/* free a pte talbe */
|
||||
/* free a pte table */
|
||||
free_pagetable(pmd_page(*pmd), 0);
|
||||
spin_lock(&init_mm.page_table_lock);
|
||||
pmd_clear(pmd);
|
||||
@ -1031,7 +1031,7 @@ static void __meminit free_pmd_table(pmd_t *pmd_start, pud_t *pud)
|
||||
return;
|
||||
}
|
||||
|
||||
/* free a pmd talbe */
|
||||
/* free a pmd table */
|
||||
free_pagetable(pud_page(*pud), 0);
|
||||
spin_lock(&init_mm.page_table_lock);
|
||||
pud_clear(pud);
|
||||
@ -1049,7 +1049,7 @@ static void __meminit free_pud_table(pud_t *pud_start, p4d_t *p4d)
|
||||
return;
|
||||
}
|
||||
|
||||
/* free a pud talbe */
|
||||
/* free a pud table */
|
||||
free_pagetable(p4d_page(*p4d), 0);
|
||||
spin_lock(&init_mm.page_table_lock);
|
||||
p4d_clear(p4d);
|
||||
|
@ -14,7 +14,7 @@
|
||||
* memory ranges: uncached, write-combining, write-through, write-protected,
|
||||
* and the most commonly used and default attribute: write-back caching.
|
||||
*
|
||||
* PAT support supercedes and augments MTRR support in a compatible fashion: MTRR is
|
||||
* PAT support supersedes and augments MTRR support in a compatible fashion: MTRR is
|
||||
* a hardware interface to enumerate a limited number of physical memory ranges
|
||||
* and set their caching attributes explicitly, programmed into the CPU via MSRs.
|
||||
* Even modern CPUs have MTRRs enabled - but these are typically not touched
|
||||
|
@ -1621,7 +1621,7 @@ static int __change_page_attr(struct cpa_data *cpa, int primary)
|
||||
|
||||
/*
|
||||
* We need to keep the pfn from the existing PTE,
|
||||
* after all we're only going to change it's attributes
|
||||
* after all we're only going to change its attributes
|
||||
* not the memory it points to
|
||||
*/
|
||||
new_pte = pfn_pte(pfn, new_prot);
|
||||
@ -2447,7 +2447,7 @@ int __init kernel_unmap_pages_in_pgd(pgd_t *pgd, unsigned long address,
|
||||
/*
|
||||
* The typical sequence for unmapping is to find a pte through
|
||||
* lookup_address_in_pgd() (ideally, it should never return NULL because
|
||||
* the address is already mapped) and change it's protections. As pfn is
|
||||
* the address is already mapped) and change its protections. As pfn is
|
||||
* the *target* of a mapping, it's not useful while unmapping.
|
||||
*/
|
||||
struct cpa_data cpa = {
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* https://github.com/IAIK/KAISER
|
||||
*
|
||||
* The original work was written by and and signed off by for the Linux
|
||||
* The original work was written by and signed off by for the Linux
|
||||
* kernel by:
|
||||
*
|
||||
* Signed-off-by: Richard Fellner <richard.fellner@student.tugraz.at>
|
||||
|
@ -355,7 +355,7 @@ static void l1d_flush_evaluate(unsigned long prev_mm, unsigned long next_mm,
|
||||
|
||||
/*
|
||||
* Validate that it is not running on an SMT sibling as this would
|
||||
* make the excercise pointless because the siblings share L1D. If
|
||||
* make the exercise pointless because the siblings share L1D. If
|
||||
* it runs on a SMT sibling, notify it with SIGBUS on return to
|
||||
* user/guest
|
||||
*/
|
||||
|
@ -2143,7 +2143,7 @@ static void save_args(const struct btf_func_model *m, u8 **prog,
|
||||
} else {
|
||||
/* Only copy the arguments on-stack to current
|
||||
* 'stack_size' and ignore the regs, used to
|
||||
* prepare the arguments on-stack for orign call.
|
||||
* prepare the arguments on-stack for origin call.
|
||||
*/
|
||||
if (for_call_origin) {
|
||||
nr_regs += arg_regs;
|
||||
|
@ -1194,7 +1194,7 @@ struct jit_context {
|
||||
#define PROLOGUE_SIZE 35
|
||||
|
||||
/*
|
||||
* Emit prologue code for BPF program and check it's size.
|
||||
* Emit prologue code for BPF program and check its size.
|
||||
* bpf_tail_call helper will skip it while jumping into another program.
|
||||
*/
|
||||
static void emit_prologue(u8 **pprog, u32 stack_depth)
|
||||
|
@ -6,7 +6,7 @@
|
||||
* Copyright(c) 2015 Bryan O'Donoghue <pure.logic@nexus-software.ie>
|
||||
*
|
||||
* IMR self test. The purpose of this module is to run a set of tests on the
|
||||
* IMR API to validate it's sanity. We check for overlapping, reserved
|
||||
* IMR API to validate its sanity. We check for overlapping, reserved
|
||||
* addresses and setup/teardown sanity.
|
||||
*
|
||||
*/
|
||||
|
@ -42,7 +42,7 @@
|
||||
* Bit 8 (TF) must be cleared. Other bits are all unspecified.
|
||||
*
|
||||
* All other processor registers and flag bits are unspecified. The OS is in
|
||||
* charge of setting up it's own stack, GDT and IDT.
|
||||
* charge of setting up its own stack, GDT and IDT.
|
||||
*/
|
||||
|
||||
#define PVH_GDT_ENTRY_CS 1
|
||||
|
@ -741,7 +741,7 @@ static void uv_nmi_dump_state_cpu(int cpu, struct pt_regs *regs)
|
||||
this_cpu_write(uv_cpu_nmi.state, UV_NMI_STATE_DUMP_DONE);
|
||||
}
|
||||
|
||||
/* Trigger a slave CPU to dump it's state */
|
||||
/* Trigger a slave CPU to dump its state */
|
||||
static void uv_nmi_trigger_dump(int cpu)
|
||||
{
|
||||
int retry = uv_nmi_trigger_delay;
|
||||
|
@ -270,7 +270,7 @@ static int uv_rtc_unset_timer(int cpu, int force)
|
||||
* Read the RTC.
|
||||
*
|
||||
* Starting with HUB rev 2.0, the UV RTC register is replicated across all
|
||||
* cachelines of it's own page. This allows faster simultaneous reads
|
||||
* cachelines of its own page. This allows faster simultaneous reads
|
||||
* from a given socket.
|
||||
*/
|
||||
static u64 uv_read_rtc(struct clocksource *cs)
|
||||
|
@ -61,7 +61,7 @@ void __init reserve_real_mode(void)
|
||||
set_real_mode_mem(mem);
|
||||
|
||||
/*
|
||||
* Unconditionally reserve the entire fisrt 1M, see comment in
|
||||
* Unconditionally reserve the entire first 1M, see comment in
|
||||
* setup_arch().
|
||||
*/
|
||||
memblock_reserve(0, SZ_1M);
|
||||
|
@ -34,7 +34,7 @@
|
||||
* would need to validate the whole pagetable before going on.
|
||||
* Naturally, this is quite slow. The solution is to "pin" a
|
||||
* pagetable, which enforces all the constraints on the pagetable even
|
||||
* when it is not actively in use. This menas that Xen can be assured
|
||||
* when it is not actively in use. This means that Xen can be assured
|
||||
* that it is still valid when you do load it into %cr3, and doesn't
|
||||
* need to revalidate it.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user