mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
x86: Restrict KVM-induced symbol exports to KVM modules where obvious/possible
Extend KVM's export macro framework to provide EXPORT_SYMBOL_FOR_KVM(), and use the helper macro to export symbols for KVM throughout x86 if and only if KVM will build one or more modules, and only for those modules. To avoid unnecessary exports when CONFIG_KVM=m but kvm.ko will not be built (because no vendor modules are selected), let arch code #define EXPORT_SYMBOL_FOR_KVM to suppress/override the exports. Note, the set of symbols to restrict to KVM was generated by manual search and audit; any "misses" are due to human error, not some grand plan. Signed-off-by: Sean Christopherson <seanjc@google.com> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Acked-by: Kai Huang <kai.huang@intel.com> Tested-by: Kai Huang <kai.huang@intel.com> Link: https://patch.msgid.link/20251112173944.1380633-5-seanjc%40google.com
This commit is contained in:
committed by
Dave Hansen
parent
e6f2d5866c
commit
6276c67f2b
@@ -4,6 +4,7 @@
|
||||
*/
|
||||
|
||||
#include <linux/export.h>
|
||||
#include <linux/kvm_types.h>
|
||||
#include <linux/linkage.h>
|
||||
#include <linux/objtool.h>
|
||||
#include <asm/msr-index.h>
|
||||
@@ -29,8 +30,7 @@ SYM_FUNC_START(write_ibpb)
|
||||
FILL_RETURN_BUFFER %rax, RSB_CLEAR_LOOPS, X86_BUG_IBPB_NO_RET
|
||||
RET
|
||||
SYM_FUNC_END(write_ibpb)
|
||||
/* For KVM */
|
||||
EXPORT_SYMBOL_GPL(write_ibpb);
|
||||
EXPORT_SYMBOL_FOR_KVM(write_ibpb);
|
||||
|
||||
.popsection
|
||||
|
||||
@@ -48,8 +48,7 @@ SYM_CODE_START_NOALIGN(x86_verw_sel)
|
||||
.word __KERNEL_DS
|
||||
.align L1_CACHE_BYTES, 0xcc
|
||||
SYM_CODE_END(x86_verw_sel);
|
||||
/* For KVM */
|
||||
EXPORT_SYMBOL_GPL(x86_verw_sel);
|
||||
EXPORT_SYMBOL_FOR_KVM(x86_verw_sel);
|
||||
|
||||
.popsection
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
* - idtentry: Define exception entry points.
|
||||
*/
|
||||
#include <linux/export.h>
|
||||
#include <linux/kvm_types.h>
|
||||
#include <linux/linkage.h>
|
||||
#include <asm/segment.h>
|
||||
#include <asm/cache.h>
|
||||
@@ -1566,5 +1567,5 @@ SYM_FUNC_START(clear_bhb_loop)
|
||||
pop %rbp
|
||||
RET
|
||||
SYM_FUNC_END(clear_bhb_loop)
|
||||
EXPORT_SYMBOL_GPL(clear_bhb_loop)
|
||||
EXPORT_SYMBOL_FOR_KVM(clear_bhb_loop)
|
||||
STACK_FRAME_NON_STANDARD(clear_bhb_loop)
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
*/
|
||||
|
||||
#include <linux/export.h>
|
||||
#include <linux/kvm_types.h>
|
||||
|
||||
#include <asm/asm.h>
|
||||
#include <asm/fred.h>
|
||||
@@ -146,5 +147,5 @@ SYM_FUNC_START(asm_fred_entry_from_kvm)
|
||||
RET
|
||||
|
||||
SYM_FUNC_END(asm_fred_entry_from_kvm)
|
||||
EXPORT_SYMBOL_GPL(asm_fred_entry_from_kvm);
|
||||
EXPORT_SYMBOL_FOR_KVM(asm_fred_entry_from_kvm);
|
||||
#endif
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include <linux/perf_event.h>
|
||||
#include <linux/jump_label.h>
|
||||
#include <linux/export.h>
|
||||
#include <linux/kvm_types.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/slab.h>
|
||||
@@ -1569,7 +1570,7 @@ void amd_pmu_enable_virt(void)
|
||||
/* Reload all events */
|
||||
amd_pmu_reload_virt();
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(amd_pmu_enable_virt);
|
||||
EXPORT_SYMBOL_FOR_KVM(amd_pmu_enable_virt);
|
||||
|
||||
void amd_pmu_disable_virt(void)
|
||||
{
|
||||
@@ -1586,4 +1587,4 @@ void amd_pmu_disable_virt(void)
|
||||
/* Reload all events */
|
||||
amd_pmu_reload_virt();
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(amd_pmu_disable_virt);
|
||||
EXPORT_SYMBOL_FOR_KVM(amd_pmu_disable_virt);
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <linux/export.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/kdebug.h>
|
||||
#include <linux/kvm_types.h>
|
||||
#include <linux/sched/mm.h>
|
||||
#include <linux/sched/clock.h>
|
||||
#include <linux/uaccess.h>
|
||||
@@ -714,7 +715,7 @@ struct perf_guest_switch_msr *perf_guest_get_msrs(int *nr, void *data)
|
||||
{
|
||||
return static_call(x86_pmu_guest_get_msrs)(nr, data);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(perf_guest_get_msrs);
|
||||
EXPORT_SYMBOL_FOR_KVM(perf_guest_get_msrs);
|
||||
|
||||
/*
|
||||
* There may be PMI landing after enabled=0. The PMI hitting could be before or
|
||||
@@ -3106,7 +3107,7 @@ void perf_get_x86_pmu_capability(struct x86_pmu_capability *cap)
|
||||
cap->events_mask_len = x86_pmu.events_mask_len;
|
||||
cap->pebs_ept = x86_pmu.pebs_ept;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(perf_get_x86_pmu_capability);
|
||||
EXPORT_SYMBOL_FOR_KVM(perf_get_x86_pmu_capability);
|
||||
|
||||
u64 perf_get_hw_event_config(int hw_event)
|
||||
{
|
||||
@@ -3117,4 +3118,4 @@ u64 perf_get_hw_event_config(int hw_event)
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(perf_get_hw_event_config);
|
||||
EXPORT_SYMBOL_FOR_KVM(perf_get_hw_event_config);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include <linux/kvm_types.h>
|
||||
#include <linux/perf_event.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
@@ -1705,7 +1706,7 @@ void x86_perf_get_lbr(struct x86_pmu_lbr *lbr)
|
||||
lbr->info = x86_pmu.lbr_info;
|
||||
lbr->has_callstack = x86_pmu_has_lbr_callstack();
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(x86_perf_get_lbr);
|
||||
EXPORT_SYMBOL_FOR_KVM(x86_perf_get_lbr);
|
||||
|
||||
struct event_constraint vlbr_constraint =
|
||||
__EVENT_CONSTRAINT(INTEL_FIXED_VLBR_EVENT, (1ULL << INTEL_PMC_IDX_FIXED_VLBR),
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <linux/limits.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/kvm_types.h>
|
||||
|
||||
#include <asm/cpuid/api.h>
|
||||
#include <asm/perf_event.h>
|
||||
@@ -82,13 +83,13 @@ u32 intel_pt_validate_cap(u32 *caps, enum pt_capabilities capability)
|
||||
|
||||
return (c & cd->mask) >> shift;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(intel_pt_validate_cap);
|
||||
EXPORT_SYMBOL_FOR_KVM(intel_pt_validate_cap);
|
||||
|
||||
u32 intel_pt_validate_hw_cap(enum pt_capabilities cap)
|
||||
{
|
||||
return intel_pt_validate_cap(pt_pmu.caps, cap);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(intel_pt_validate_hw_cap);
|
||||
EXPORT_SYMBOL_FOR_KVM(intel_pt_validate_hw_cap);
|
||||
|
||||
static ssize_t pt_cap_show(struct device *cdev,
|
||||
struct device_attribute *attr,
|
||||
@@ -1590,7 +1591,7 @@ void intel_pt_handle_vmx(int on)
|
||||
|
||||
local_irq_restore(flags);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(intel_pt_handle_vmx);
|
||||
EXPORT_SYMBOL_FOR_KVM(intel_pt_handle_vmx);
|
||||
|
||||
/*
|
||||
* PMU callbacks
|
||||
|
||||
@@ -10,6 +10,11 @@
|
||||
#define KVM_SUB_MODULES kvm-intel
|
||||
#else
|
||||
#undef KVM_SUB_MODULES
|
||||
/*
|
||||
* Don't export symbols for KVM without vendor modules, as kvm.ko is built iff
|
||||
* at least one vendor module is enabled.
|
||||
*/
|
||||
#define EXPORT_SYMBOL_FOR_KVM(symbol)
|
||||
#endif
|
||||
|
||||
#define KVM_ARCH_NR_OBJS_PER_MEMORY_CACHE 40
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include <linux/dmi.h>
|
||||
#include <linux/smp.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/kvm_types.h>
|
||||
|
||||
#include <xen/xen.h>
|
||||
|
||||
@@ -2316,7 +2317,7 @@ u32 x86_msi_msg_get_destid(struct msi_msg *msg, bool extid)
|
||||
dest |= msg->arch_addr_hi.destid_8_31 << 8;
|
||||
return dest;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(x86_msi_msg_get_destid);
|
||||
EXPORT_SYMBOL_FOR_KVM(x86_msi_msg_get_destid);
|
||||
|
||||
static void __init apic_bsp_up_setup(void)
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
* SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
#include <linux/irq.h>
|
||||
#include <linux/kvm_types.h>
|
||||
#include <asm/apic.h>
|
||||
|
||||
#include "local.h"
|
||||
@@ -25,7 +26,7 @@ u32 default_cpu_present_to_apicid(int mps_cpu)
|
||||
else
|
||||
return BAD_APICID;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(default_cpu_present_to_apicid);
|
||||
EXPORT_SYMBOL_FOR_KVM(default_cpu_present_to_apicid);
|
||||
|
||||
/*
|
||||
* Set up the logical destination ID when the APIC operates in logical
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/elf.h>
|
||||
#include <linux/mm.h>
|
||||
|
||||
#include <linux/kvm_types.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/sched/clock.h>
|
||||
@@ -1310,7 +1310,7 @@ unsigned long amd_get_dr_addr_mask(unsigned int dr)
|
||||
|
||||
return per_cpu(amd_dr_addr_mask[dr], smp_processor_id());
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(amd_get_dr_addr_mask);
|
||||
EXPORT_SYMBOL_FOR_KVM(amd_get_dr_addr_mask);
|
||||
|
||||
static void zenbleed_check_cpu(void *unused)
|
||||
{
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <linux/sched/smt.h>
|
||||
#include <linux/pgtable.h>
|
||||
#include <linux/bpf.h>
|
||||
#include <linux/kvm_types.h>
|
||||
|
||||
#include <asm/spec-ctrl.h>
|
||||
#include <asm/cmdline.h>
|
||||
@@ -178,7 +179,7 @@ DEFINE_STATIC_KEY_FALSE(switch_mm_always_ibpb);
|
||||
|
||||
/* Control IBPB on vCPU load */
|
||||
DEFINE_STATIC_KEY_FALSE(switch_vcpu_ibpb);
|
||||
EXPORT_SYMBOL_GPL(switch_vcpu_ibpb);
|
||||
EXPORT_SYMBOL_FOR_KVM(switch_vcpu_ibpb);
|
||||
|
||||
/* Control CPU buffer clear before idling (halt, mwait) */
|
||||
DEFINE_STATIC_KEY_FALSE(cpu_buf_idle_clear);
|
||||
@@ -197,7 +198,7 @@ DEFINE_STATIC_KEY_FALSE(switch_mm_cond_l1d_flush);
|
||||
* mitigation is required.
|
||||
*/
|
||||
DEFINE_STATIC_KEY_FALSE(cpu_buf_vm_clear);
|
||||
EXPORT_SYMBOL_GPL(cpu_buf_vm_clear);
|
||||
EXPORT_SYMBOL_FOR_KVM(cpu_buf_vm_clear);
|
||||
|
||||
#undef pr_fmt
|
||||
#define pr_fmt(fmt) "mitigations: " fmt
|
||||
@@ -365,7 +366,7 @@ x86_virt_spec_ctrl(u64 guest_virt_spec_ctrl, bool setguest)
|
||||
speculation_ctrl_update(tif);
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(x86_virt_spec_ctrl);
|
||||
EXPORT_SYMBOL_FOR_KVM(x86_virt_spec_ctrl);
|
||||
|
||||
static void x86_amd_ssb_disable(void)
|
||||
{
|
||||
@@ -1031,7 +1032,7 @@ bool gds_ucode_mitigated(void)
|
||||
return (gds_mitigation == GDS_MITIGATION_FULL ||
|
||||
gds_mitigation == GDS_MITIGATION_FULL_LOCKED);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(gds_ucode_mitigated);
|
||||
EXPORT_SYMBOL_FOR_KVM(gds_ucode_mitigated);
|
||||
|
||||
void update_gds_msr(void)
|
||||
{
|
||||
@@ -2858,7 +2859,7 @@ void x86_spec_ctrl_setup_ap(void)
|
||||
}
|
||||
|
||||
bool itlb_multihit_kvm_mitigation;
|
||||
EXPORT_SYMBOL_GPL(itlb_multihit_kvm_mitigation);
|
||||
EXPORT_SYMBOL_FOR_KVM(itlb_multihit_kvm_mitigation);
|
||||
|
||||
#undef pr_fmt
|
||||
#define pr_fmt(fmt) "L1TF: " fmt
|
||||
@@ -2866,11 +2867,9 @@ EXPORT_SYMBOL_GPL(itlb_multihit_kvm_mitigation);
|
||||
/* Default mitigation for L1TF-affected CPUs */
|
||||
enum l1tf_mitigations l1tf_mitigation __ro_after_init =
|
||||
IS_ENABLED(CONFIG_MITIGATION_L1TF) ? L1TF_MITIGATION_AUTO : L1TF_MITIGATION_OFF;
|
||||
#if IS_ENABLED(CONFIG_KVM_INTEL)
|
||||
EXPORT_SYMBOL_GPL(l1tf_mitigation);
|
||||
#endif
|
||||
EXPORT_SYMBOL_FOR_KVM(l1tf_mitigation);
|
||||
enum vmx_l1d_flush_state l1tf_vmx_mitigation = VMENTER_L1D_FLUSH_AUTO;
|
||||
EXPORT_SYMBOL_GPL(l1tf_vmx_mitigation);
|
||||
EXPORT_SYMBOL_FOR_KVM(l1tf_vmx_mitigation);
|
||||
|
||||
/*
|
||||
* These CPUs all support 44bits physical address space internally in the
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/cpuhotplug.h>
|
||||
#include <linux/kvm_types.h>
|
||||
#include <asm/cpu_device_id.h>
|
||||
#include <asm/cmdline.h>
|
||||
#include <asm/traps.h>
|
||||
@@ -289,7 +290,7 @@ bool handle_guest_split_lock(unsigned long ip)
|
||||
force_sig_fault(SIGBUS, BUS_ADRALN, NULL);
|
||||
return false;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(handle_guest_split_lock);
|
||||
EXPORT_SYMBOL_FOR_KVM(handle_guest_split_lock);
|
||||
|
||||
void bus_lock_init(void)
|
||||
{
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/export.h>
|
||||
#include <linux/kvm_types.h>
|
||||
#include <linux/percpu.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/ctype.h>
|
||||
@@ -460,14 +461,14 @@ void cr4_update_irqsoff(unsigned long set, unsigned long clear)
|
||||
__write_cr4(newval);
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL(cr4_update_irqsoff);
|
||||
EXPORT_SYMBOL_FOR_KVM(cr4_update_irqsoff);
|
||||
|
||||
/* Read the CR4 shadow. */
|
||||
unsigned long cr4_read_shadow(void)
|
||||
{
|
||||
return this_cpu_read(cpu_tlbstate.cr4);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cr4_read_shadow);
|
||||
EXPORT_SYMBOL_FOR_KVM(cr4_read_shadow);
|
||||
|
||||
void cr4_init(void)
|
||||
{
|
||||
@@ -722,7 +723,7 @@ void load_direct_gdt(int cpu)
|
||||
gdt_descr.size = GDT_SIZE - 1;
|
||||
load_gdt(&gdt_descr);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(load_direct_gdt);
|
||||
EXPORT_SYMBOL_FOR_KVM(load_direct_gdt);
|
||||
|
||||
/* Load a fixmap remapping of the per-cpu GDT */
|
||||
void load_fixmap_gdt(int cpu)
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <linux/freezer.h>
|
||||
#include <linux/highmem.h>
|
||||
#include <linux/kthread.h>
|
||||
#include <linux/kvm_types.h>
|
||||
#include <linux/miscdevice.h>
|
||||
#include <linux/node.h>
|
||||
#include <linux/pagemap.h>
|
||||
@@ -915,7 +916,7 @@ int sgx_set_attribute(unsigned long *allowed_attributes,
|
||||
*allowed_attributes |= SGX_ATTR_PROVISIONKEY;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(sgx_set_attribute);
|
||||
EXPORT_SYMBOL_FOR_KVM(sgx_set_attribute);
|
||||
|
||||
static int __init sgx_init(void)
|
||||
{
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
* Copyright(c) 2021 Intel Corporation.
|
||||
*/
|
||||
|
||||
#include <linux/kvm_types.h>
|
||||
#include <linux/miscdevice.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/mman.h>
|
||||
@@ -363,7 +364,7 @@ int sgx_virt_ecreate(struct sgx_pageinfo *pageinfo, void __user *secs,
|
||||
WARN_ON_ONCE(ret);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(sgx_virt_ecreate);
|
||||
EXPORT_SYMBOL_FOR_KVM(sgx_virt_ecreate);
|
||||
|
||||
static int __sgx_virt_einit(void __user *sigstruct, void __user *token,
|
||||
void __user *secs)
|
||||
@@ -432,4 +433,4 @@ int sgx_virt_einit(void __user *sigstruct, void __user *token,
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(sgx_virt_einit);
|
||||
EXPORT_SYMBOL_FOR_KVM(sgx_virt_einit);
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <linux/firmware-map.h>
|
||||
#include <linux/sort.h>
|
||||
#include <linux/memory_hotplug.h>
|
||||
#include <linux/kvm_types.h>
|
||||
|
||||
#include <asm/e820/api.h>
|
||||
#include <asm/setup.h>
|
||||
@@ -95,7 +96,7 @@ bool e820__mapped_raw_any(u64 start, u64 end, enum e820_type type)
|
||||
{
|
||||
return _e820__mapped_any(e820_table_firmware, start, end, type);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(e820__mapped_raw_any);
|
||||
EXPORT_SYMBOL_FOR_KVM(e820__mapped_raw_any);
|
||||
|
||||
bool e820__mapped_any(u64 start, u64 end, enum e820_type type)
|
||||
{
|
||||
|
||||
+11
-10
@@ -18,6 +18,7 @@
|
||||
#include <uapi/asm/kvm.h>
|
||||
|
||||
#include <linux/hardirq.h>
|
||||
#include <linux/kvm_types.h>
|
||||
#include <linux/pkeys.h>
|
||||
#include <linux/vmalloc.h>
|
||||
|
||||
@@ -276,7 +277,7 @@ bool fpu_alloc_guest_fpstate(struct fpu_guest *gfpu)
|
||||
|
||||
return true;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(fpu_alloc_guest_fpstate);
|
||||
EXPORT_SYMBOL_FOR_KVM(fpu_alloc_guest_fpstate);
|
||||
|
||||
void fpu_free_guest_fpstate(struct fpu_guest *gfpu)
|
||||
{
|
||||
@@ -291,7 +292,7 @@ void fpu_free_guest_fpstate(struct fpu_guest *gfpu)
|
||||
gfpu->fpstate = NULL;
|
||||
vfree(fpstate);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(fpu_free_guest_fpstate);
|
||||
EXPORT_SYMBOL_FOR_KVM(fpu_free_guest_fpstate);
|
||||
|
||||
/*
|
||||
* fpu_enable_guest_xfd_features - Check xfeatures against guest perm and enable
|
||||
@@ -313,7 +314,7 @@ int fpu_enable_guest_xfd_features(struct fpu_guest *guest_fpu, u64 xfeatures)
|
||||
|
||||
return __xfd_enable_feature(xfeatures, guest_fpu);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(fpu_enable_guest_xfd_features);
|
||||
EXPORT_SYMBOL_FOR_KVM(fpu_enable_guest_xfd_features);
|
||||
|
||||
#ifdef CONFIG_X86_64
|
||||
void fpu_update_guest_xfd(struct fpu_guest *guest_fpu, u64 xfd)
|
||||
@@ -324,7 +325,7 @@ void fpu_update_guest_xfd(struct fpu_guest *guest_fpu, u64 xfd)
|
||||
xfd_update_state(guest_fpu->fpstate);
|
||||
fpregs_unlock();
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(fpu_update_guest_xfd);
|
||||
EXPORT_SYMBOL_FOR_KVM(fpu_update_guest_xfd);
|
||||
|
||||
/**
|
||||
* fpu_sync_guest_vmexit_xfd_state - Synchronize XFD MSR and software state
|
||||
@@ -348,7 +349,7 @@ void fpu_sync_guest_vmexit_xfd_state(void)
|
||||
__this_cpu_write(xfd_state, fpstate->xfd);
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(fpu_sync_guest_vmexit_xfd_state);
|
||||
EXPORT_SYMBOL_FOR_KVM(fpu_sync_guest_vmexit_xfd_state);
|
||||
#endif /* CONFIG_X86_64 */
|
||||
|
||||
int fpu_swap_kvm_fpstate(struct fpu_guest *guest_fpu, bool enter_guest)
|
||||
@@ -390,7 +391,7 @@ int fpu_swap_kvm_fpstate(struct fpu_guest *guest_fpu, bool enter_guest)
|
||||
fpregs_unlock();
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(fpu_swap_kvm_fpstate);
|
||||
EXPORT_SYMBOL_FOR_KVM(fpu_swap_kvm_fpstate);
|
||||
|
||||
void fpu_copy_guest_fpstate_to_uabi(struct fpu_guest *gfpu, void *buf,
|
||||
unsigned int size, u64 xfeatures, u32 pkru)
|
||||
@@ -409,7 +410,7 @@ void fpu_copy_guest_fpstate_to_uabi(struct fpu_guest *gfpu, void *buf,
|
||||
ustate->xsave.header.xfeatures = XFEATURE_MASK_FPSSE;
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(fpu_copy_guest_fpstate_to_uabi);
|
||||
EXPORT_SYMBOL_FOR_KVM(fpu_copy_guest_fpstate_to_uabi);
|
||||
|
||||
int fpu_copy_uabi_to_guest_fpstate(struct fpu_guest *gfpu, const void *buf,
|
||||
u64 xcr0, u32 *vpkru)
|
||||
@@ -439,7 +440,7 @@ int fpu_copy_uabi_to_guest_fpstate(struct fpu_guest *gfpu, const void *buf,
|
||||
|
||||
return copy_uabi_from_kernel_to_xstate(kstate, ustate, vpkru);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(fpu_copy_uabi_to_guest_fpstate);
|
||||
EXPORT_SYMBOL_FOR_KVM(fpu_copy_uabi_to_guest_fpstate);
|
||||
#endif /* CONFIG_KVM */
|
||||
|
||||
void kernel_fpu_begin_mask(unsigned int kfpu_mask)
|
||||
@@ -857,7 +858,7 @@ void switch_fpu_return(void)
|
||||
|
||||
fpregs_restore_userregs();
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(switch_fpu_return);
|
||||
EXPORT_SYMBOL_FOR_KVM(switch_fpu_return);
|
||||
|
||||
void fpregs_lock_and_load(void)
|
||||
{
|
||||
@@ -892,7 +893,7 @@ void fpregs_assert_state_consistent(void)
|
||||
|
||||
WARN_ON_FPU(!fpregs_state_valid(fpu, smp_processor_id()));
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(fpregs_assert_state_consistent);
|
||||
EXPORT_SYMBOL_FOR_KVM(fpregs_assert_state_consistent);
|
||||
#endif
|
||||
|
||||
void fpregs_mark_activate(void)
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <linux/compat.h>
|
||||
#include <linux/cpu.h>
|
||||
#include <linux/mman.h>
|
||||
#include <linux/kvm_types.h>
|
||||
#include <linux/nospec.h>
|
||||
#include <linux/pkeys.h>
|
||||
#include <linux/seq_file.h>
|
||||
@@ -1058,7 +1059,7 @@ void *get_xsave_addr(struct xregs_state *xsave, int xfeature_nr)
|
||||
|
||||
return __raw_xsave_addr(xsave, xfeature_nr);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(get_xsave_addr);
|
||||
EXPORT_SYMBOL_FOR_KVM(get_xsave_addr);
|
||||
|
||||
/*
|
||||
* Given an xstate feature nr, calculate where in the xsave buffer the state is.
|
||||
@@ -1482,7 +1483,7 @@ void fpstate_clear_xstate_component(struct fpstate *fpstate, unsigned int xfeatu
|
||||
if (addr)
|
||||
memset(addr, 0, xstate_sizes[xfeature]);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(fpstate_clear_xstate_component);
|
||||
EXPORT_SYMBOL_FOR_KVM(fpstate_clear_xstate_component);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_X86_64
|
||||
@@ -1818,7 +1819,7 @@ u64 xstate_get_guest_group_perm(void)
|
||||
{
|
||||
return xstate_get_group_perm(true);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(xstate_get_guest_group_perm);
|
||||
EXPORT_SYMBOL_FOR_KVM(xstate_get_guest_group_perm);
|
||||
|
||||
/**
|
||||
* fpu_xstate_prctl - xstate permission operations
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <linux/percpu.h>
|
||||
#include <linux/kdebug.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/kvm_types.h>
|
||||
#include <linux/export.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/smp.h>
|
||||
@@ -489,7 +490,7 @@ void hw_breakpoint_restore(void)
|
||||
set_debugreg(DR6_RESERVED, 6);
|
||||
set_debugreg(__this_cpu_read(cpu_dr7), 7);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(hw_breakpoint_restore);
|
||||
EXPORT_SYMBOL_FOR_KVM(hw_breakpoint_restore);
|
||||
|
||||
/*
|
||||
* Handle debug exception notifications.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user