Projectname large_stringclasses 15
values | Filepath large_stringlengths 4 106 ⌀ | Function large_stringlengths 11 3.45k | Label list |
|---|---|---|---|
Linux Kernel | arch/x86/kvm/vmx/vmx_ops.h |
static __always_inline void vmcs_write32(unsigned long field, u32 value) {
vmcs_check32(field);
if (static_branch_unlikely(&enable_evmcs))
return evmcs_write32(field, value);
__vmcs_writel(field, value);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/vmx/vmx_ops.h |
static __always_inline void vmcs_writel(unsigned long field,
unsigned long value) {
vmcs_checkl(field);
if (static_branch_unlikely(&enable_evmcs))
return evmcs_write64(field, value);
__vmcs_writel(field, value);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/vmx/vmx_ops.h |
static inline void vpid_sync_vcpu_global(void) {
__invvpid(VMX_VPID_EXTENT_ALL_CONTEXT, 0, 0);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/vmx/vmx_ops.h |
static inline void ept_sync_global(void) {
__invept(VMX_EPT_EXTENT_GLOBAL, 0, 0);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c | static bool kvm_msr_ignored_check(u32 msr, u64 data, bool write) {
const char *op = write ? "wrmsr" : "rdmsr";
if (ignore_msrs) {
if (report_ignored_msrs)
kvm_pr_unimpl("ignored %s: 0x%x data 0x%llx\n", op, msr, data);
return true;
} else {
kvm_debug_ratelimited("unhandled %s: 0x%x data 0x%llx... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c | static void kvm_on_user_return(struct user_return_notifier *urn) {
unsigned slot;
struct kvm_user_return_msrs *msrs =
container_of(urn, struct kvm_user_return_msrs, urn);
struct kvm_user_return_msr_values *values;
unsigned long flags;
local_irq_save(flags);
if (msrs->registered) {
msrs->registere... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
int kvm_find_user_return_msr(u32 msr) {
int i;
for (i = 0; i < kvm_nr_uret_msrs; ++i) {
if (kvm_uret_msrs_list[i] == msr)
return i;
}
return -1;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
static void kvm_user_return_msr_cpu_online(void) {
unsigned int cpu = smp_processor_id();
struct kvm_user_return_msrs *msrs = per_cpu_ptr(user_return_msrs, cpu);
u64 value;
int i;
for (i = 0; i < kvm_nr_uret_msrs; ++i) {
rdmsrl_safe(kvm_uret_msrs_list[i], &value);
msrs->values[i].host = value;
m... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/x86.c | noinstr void kvm_spurious_fault(void) { BUG_ON(!kvm_rebooting); } | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
int kvm_complete_insn_gp(struct kvm_vcpu *vcpu, int err) {
if (err)
kvm_inject_gp(vcpu, 0);
else
return kvm_skip_emulated_instruction(vcpu);
return 1;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
void kvm_inject_nmi(struct kvm_vcpu *vcpu) {
atomic_inc(&vcpu->arch.nmi_queued);
kvm_make_request(KVM_REQ_NMI, vcpu);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c | int load_pdptrs(struct kvm_vcpu *vcpu, unsigned long cr3) {
struct kvm_mmu *mmu = vcpu->arch.walk_mmu;
gfn_t pdpt_gfn = cr3 >> PAGE_SHIFT;
gpa_t real_gpa;
int i;
int ret;
u64 pdpte[ARRAY_SIZE(mmu->pdptrs)];
real_gpa = kvm_translate_gpa(vcpu, mmu, gfn_to_gpa(pdpt_gfn),
PFERR... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/x86.c | void kvm_load_guest_xsave_state(struct kvm_vcpu *vcpu) {
if (vcpu->arch.guest_state_protected)
return;
if (kvm_read_cr4_bits(vcpu, X86_CR4_OSXSAVE)) {
if (vcpu->arch.xcr0 != host_xcr0)
xsetbv(XCR_XFEATURE_ENABLED_MASK, vcpu->arch.xcr0);
if (vcpu->arch.xsaves_enabled && vcpu->arch.ia32_xss != ho... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/x86.c | int kvm_emulate_xsetbv(struct kvm_vcpu *vcpu) {
if (static_call(kvm_x86_get_cpl)(vcpu) != 0 ||
__kvm_set_xcr(vcpu, kvm_rcx_read(vcpu), kvm_read_edx_eax(vcpu))) {
kvm_inject_gp(vcpu, 0);
return 1;
}
return kvm_skip_emulated_instruction(vcpu);
} | [
1,
0
] |
Linux Kernel | arch/x86/kvm/x86.c | int kvm_set_cr3(struct kvm_vcpu *vcpu, unsigned long cr3) {
bool skip_tlb_flush = false;
unsigned long pcid = 0;
#ifdef CONFIG_X86_64
bool pcid_enabled = kvm_read_cr4_bits(vcpu, X86_CR4_PCIDE);
if (pcid_enabled) {
skip_tlb_flush = cr3 & X86_CR3_PCID_NOFLUSH;
cr3 &= ~X86_CR3_PCID_NOFLUSH;
pcid = cr3... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
static u64 kvm_dr6_fixed(struct kvm_vcpu *vcpu) {
u64 fixed = DR6_FIXED_1;
if (!guest_cpuid_has(vcpu, X86_FEATURE_RTM))
fixed |= DR6_RTM;
if (!guest_cpuid_has(vcpu, X86_FEATURE_BUS_LOCK_DETECT))
fixed |= DR6_BUS_LOCK;
return fixed;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c | int kvm_set_dr(struct kvm_vcpu *vcpu, int dr, unsigned long val) {
size_t size = ARRAY_SIZE(vcpu->arch.db);
switch (dr) {
case 0 ... 3:
vcpu->arch.db[array_index_nospec(dr, size)] = val;
if (!(vcpu->guest_debug & KVM_GUESTDBG_USE_HW_BP))
vcpu->arch.eff_db[dr] = val;
break;
case 4:
case 6:
... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
int kvm_emulate_rdpmc(struct kvm_vcpu *vcpu) {
u32 ecx = kvm_rcx_read(vcpu);
u64 data;
if (kvm_pmu_rdpmc(vcpu, ecx, &data)) {
kvm_inject_gp(vcpu, 0);
return 1;
}
kvm_rax_write(vcpu, (u32)data);
kvm_rdx_write(vcpu, data >> 32);
return kvm_skip_emulated_instruction(vcpu);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
static int kvm_get_msr_feature(struct kvm_msr_entry *msr) {
switch (msr->index) {
case MSR_IA32_ARCH_CAPABILITIES:
msr->data = kvm_get_arch_capabilities();
break;
case MSR_IA32_UCODE_REV:
rdmsrl_safe(msr->index, &msr->data);
break;
default:
return static_call(kvm_x86_get_msr_feature)(msr);
... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
static bool __kvm_valid_efer(struct kvm_vcpu *vcpu, u64 efer) {
if (efer & EFER_FFXSR && !guest_cpuid_has(vcpu, X86_FEATURE_FXSR_OPT))
return false;
if (efer & EFER_SVME && !guest_cpuid_has(vcpu, X86_FEATURE_SVM))
return false;
if (efer & (EFER_LME | EFER_LMA) && !guest_cpuid_has(vcpu, X86_FEATURE_LM))... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/x86.c | bool kvm_msr_allowed(struct kvm_vcpu *vcpu, u32 index, u32 type) {
struct kvm_x86_msr_filter *msr_filter;
struct msr_bitmap_range *ranges;
struct kvm *kvm = vcpu->kvm;
bool allowed;
int idx;
u32 i;
if (index >= 0x800 && index <= 0x8ff)
return true;
idx = srcu_read_lock(&kvm->srcu);
msr_filter =... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
static int kvm_set_msr_with_filter(struct kvm_vcpu *vcpu, u32 index, u64 data) {
if (!kvm_msr_allowed(vcpu, index, KVM_MSR_FILTER_WRITE))
return KVM_MSR_RET_FILTERED;
return kvm_set_msr_ignored_check(vcpu, index, data, false);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
static void complete_userspace_rdmsr(struct kvm_vcpu *vcpu) {
if (!vcpu->run->msr.error) {
kvm_rax_write(vcpu, (u32)vcpu->run->msr.data);
kvm_rdx_write(vcpu, vcpu->run->msr.data >> 32);
}
} | [
1,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
static int complete_emulated_rdmsr(struct kvm_vcpu *vcpu) {
complete_userspace_rdmsr(vcpu);
return complete_emulated_msr_access(vcpu);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c | int kvm_emulate_wrmsr(struct kvm_vcpu *vcpu) {
u32 ecx = kvm_rcx_read(vcpu);
u64 data = kvm_read_edx_eax(vcpu);
int r;
r = kvm_set_msr_with_filter(vcpu, ecx, data);
if (!r) {
trace_kvm_msr_write(ecx, data);
} else {
if (kvm_msr_user_space(vcpu, ecx, KVM_EXIT_X86_WRMSR, data,
... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
int kvm_emulate_as_nop(struct kvm_vcpu *vcpu) {
return kvm_skip_emulated_instruction(vcpu);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c | int kvm_emulate_invd(struct kvm_vcpu *vcpu) { return kvm_emulate_as_nop(vcpu); } | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
fastpath_t handle_fastpath_set_msr_irqoff(struct kvm_vcpu *vcpu) {
u32 msr = kvm_rcx_read(vcpu);
u64 data;
fastpath_t ret = EXIT_FASTPATH_NONE;
switch (msr) {
case APIC_BASE_MSR + (APIC_ICR >> 4):
data = kvm_read_edx_eax(vcpu);
if (!handle_fastpath_set_x2apic_icr_irqoff(vcpu, data)) {
kvm_skip... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c | static s64 get_kvmclock_base_ns(void) {
return ktime_to_ns(ktime_add(ktime_get_raw(), pvclock_gtod_data.offs_boot));
}
#else | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c | static void kvm_write_wall_clock(struct kvm *kvm, gpa_t wall_clock,
int sec_hi_ofs) {
int version;
int r;
struct pvclock_wall_clock wc;
u32 wc_sec_hi;
u64 wall_nsec;
if (!wall_clock)
return;
r = kvm_read_guest(kvm, wall_clock, &version, sizeof(version));
if (r)
... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/x86.c | static void kvm_write_system_time(struct kvm_vcpu *vcpu, gpa_t system_time,
bool old_msr, bool host_initiated) {
struct kvm_arch *ka = &vcpu->kvm->arch;
if (vcpu->vcpu_id == 0 && !host_initiated) {
if (ka->boot_vcpu_runs_old_kvmclock != old_msr)
kvm_make_request(KVM_REQ_... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/x86.c | static inline u64 __scale_tsc(u64 ratio, u64 tsc) {
return mul_u64_u64_shr(tsc, ratio, kvm_caps.tsc_scaling_ratio_frac_bits);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c | static void kvm_vcpu_write_tsc_offset(struct kvm_vcpu *vcpu, u64 l1_offset) {
trace_kvm_write_tsc_offset(vcpu->vcpu_id, vcpu->arch.l1_tsc_offset,
l1_offset);
vcpu->arch.l1_tsc_offset = l1_offset;
if (is_guest_mode(vcpu))
vcpu->arch.tsc_offset = kvm_calc_nested_tsc_offset(
... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c | static void kvm_synchronize_tsc(struct kvm_vcpu *vcpu, u64 data) {
struct kvm *kvm = vcpu->kvm;
u64 offset, ns, elapsed;
unsigned long flags;
bool matched = false;
bool synchronizing = false;
raw_spin_lock_irqsave(&kvm->arch.tsc_write_lock, flags);
offset = kvm_compute_l1_tsc_offset(vcpu, data);
ns = g... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/x86.c | static u64 read_tsc(void) {
u64 ret = (u64)rdtsc_ordered();
u64 last = pvclock_gtod_data.clock.cycle_last;
if (likely(ret >= last))
return ret;
asm volatile("");
return last;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
static int do_monotonic_raw(s64 *t, u64 *tsc_timestamp) {
struct pvclock_gtod_data *gtod = &pvclock_gtod_data;
unsigned long seq;
int mode;
u64 ns;
do {
seq = read_seqcount_begin(>od->seq);
ns = gtod->raw_clock.base_cycles;
ns += vgettsc(>od->raw_clock, tsc_timestamp, &mode);
ns >>= gtod... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
static void get_kvmclock(struct kvm *kvm, struct kvm_clock_data *data) {
struct kvm_arch *ka = &kvm->arch;
unsigned seq;
do {
seq = read_seqcount_begin(&ka->pvclock_sc);
__get_kvmclock(kvm, data);
} while (read_seqcount_retry(&ka->pvclock_sc, seq));
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
static void kvm_gen_kvmclock_update(struct kvm_vcpu *v) {
struct kvm *kvm = v->kvm;
kvm_make_request(KVM_REQ_CLOCK_UPDATE, v);
schedule_delayed_work(&kvm->arch.kvmclock_update_work, KVMCLOCK_UPDATE_DELAY);
}
#define KVMCLOCK_SYNC_PERIOD (300 * HZ) | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
static void kvmclock_sync_fn(struct work_struct *work) {
struct delayed_work *dwork = to_delayed_work(work);
struct kvm_arch *ka =
container_of(dwork, struct kvm_arch, kvmclock_sync_work);
struct kvm *kvm = container_of(ka, struct kvm, arch);
if (!kvmclock_periodic_sync)
return;
schedule_delayed_... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c | static bool is_mci_control_msr(u32 msr) { return (msr & 3) == 0; } | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
static inline bool kvm_pv_async_pf_enabled(struct kvm_vcpu *vcpu) {
u64 mask = KVM_ASYNC_PF_ENABLED | KVM_ASYNC_PF_DELIVERY_AS_INT;
return (vcpu->arch.apf.msr_en_val & mask) == mask;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
static int get_msr_mce(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata, bool host) {
u64 data;
u64 mcg_cap = vcpu->arch.mcg_cap;
unsigned bank_num = mcg_cap & 0xff;
u32 offset, last_msr;
switch (msr) {
case MSR_IA32_P5_MC_ADDR:
case MSR_IA32_P5_MC_TYPE:
data = 0;
break;
case MSR_IA32_MCG_CAP:
d... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
static int kvm_x86_dev_get_attr(struct kvm_device_attr *attr) {
u64 __user *uaddr = kvm_get_attr_addr(attr);
if (attr->group)
return -ENXIO;
if (IS_ERR(uaddr))
return PTR_ERR(uaddr);
switch (attr->attr) {
case KVM_X86_XCOMP_GUEST_SUPP:
if (put_user(kvm_caps.supported_xcr0, uaddr))
return... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
static int kvm_x86_dev_has_attr(struct kvm_device_attr *attr) {
if (attr->group)
return -ENXIO;
switch (attr->attr) {
case KVM_X86_XCOMP_GUEST_SUPP:
return 0;
default:
return -ENXIO;
}
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c | static void kvm_steal_time_set_preempted(struct kvm_vcpu *vcpu) {
struct gfn_to_hva_cache *ghc = &vcpu->arch.st.cache;
struct kvm_steal_time __user *st;
struct kvm_memslots *slots;
static const u8 preempted = KVM_VCPU_PREEMPTED;
gpa_t gpa = vcpu->arch.st.msr_val & KVM_STEAL_VALID_BITS;
if (!vcpu->arch.at_i... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
static int kvm_vcpu_ioctl_get_lapic(struct kvm_vcpu *vcpu,
struct kvm_lapic_state *s) {
static_call_cond(kvm_x86_sync_pir_to_irr)(vcpu);
return kvm_apic_get_state(vcpu, s);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
static int kvm_vcpu_ioctl_set_lapic(struct kvm_vcpu *vcpu,
struct kvm_lapic_state *s) {
int r;
r = kvm_apic_set_state(vcpu, s);
if (r)
return r;
update_cr8_intercept(vcpu);
return 0;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c | static int kvm_vcpu_ready_for_interrupt_injection(struct kvm_vcpu *vcpu) {
return (kvm_arch_interrupt_allowed(vcpu) && kvm_cpu_accept_dm_intr(vcpu) &&
!kvm_event_needs_reinjection(vcpu) &&
!kvm_is_exception_pending(vcpu));
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
static int vcpu_ioctl_tpr_access_reporting(struct kvm_vcpu *vcpu,
struct kvm_tpr_access_ctl *tac) {
if (tac->flags)
return -EINVAL;
vcpu->arch.tpr_access_reporting = !!tac->enabled;
return 0;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c | static int kvm_vcpu_ioctl_x86_setup_mce(struct kvm_vcpu *vcpu, u64 mcg_cap) {
int r;
unsigned bank_num = mcg_cap & 0xff, bank;
r = -EINVAL;
if (!bank_num || bank_num > KVM_MAX_MCE_BANKS)
goto out;
if (mcg_cap & ~(kvm_caps.supported_mce_cap | 0xff | 0xff0000))
goto out;
r = 0;
vcpu->arch.mcg_cap =... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
static void kvm_vcpu_ioctl_x86_get_debugregs(struct kvm_vcpu *vcpu,
struct kvm_debugregs *dbgregs) {
unsigned long val;
memcpy(dbgregs->db, vcpu->arch.db, sizeof(vcpu->arch.db));
kvm_get_dr(vcpu, 6, &val);
dbgregs->dr6 = val;
dbgregs->dr7 = vcpu->arch.dr7;
dbgr... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
static int kvm_vcpu_ioctl_x86_set_debugregs(struct kvm_vcpu *vcpu,
struct kvm_debugregs *dbgregs) {
if (dbgregs->flags)
return -EINVAL;
if (!kvm_dr6_valid(dbgregs->dr6))
return -EINVAL;
if (!kvm_dr7_valid(dbgregs->dr7))
return -EINVAL;
memcpy(vcpu->arch... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/x86.c | static int kvm_set_guest_paused(struct kvm_vcpu *vcpu) {
if (!vcpu->arch.pv_time.active)
return -EINVAL;
vcpu->arch.pvclock_set_guest_stopped_request = true;
kvm_make_request(KVM_REQ_CLOCK_UPDATE, vcpu);
return 0;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
static int kvm_arch_tsc_set_attr(struct kvm_vcpu *vcpu,
struct kvm_device_attr *attr) {
u64 __user *uaddr = kvm_get_attr_addr(attr);
struct kvm *kvm = vcpu->kvm;
int r;
if (IS_ERR(uaddr))
return PTR_ERR(uaddr);
switch (attr->attr) {
case KVM_VCPU_TSC_OFFSET: {
u64... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
static unsigned long kvm_vm_ioctl_get_nr_mmu_pages(struct kvm *kvm) {
return kvm->arch.n_max_mmu_pages;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
static int kvm_vm_ioctl_get_pit2(struct kvm *kvm, struct kvm_pit_state2 *ps) {
mutex_lock(&kvm->arch.vpit->pit_state.lock);
memcpy(ps->channels, &kvm->arch.vpit->pit_state.channels,
sizeof(ps->channels));
ps->flags = kvm->arch.vpit->pit_state.flags;
mutex_unlock(&kvm->arch.vpit->pit_state.lock);
mem... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
static int kvm_vm_ioctl_set_pit2(struct kvm *kvm, struct kvm_pit_state2 *ps) {
int start = 0;
int i;
u32 prev_legacy, cur_legacy;
struct kvm_pit *pit = kvm->arch.vpit;
mutex_lock(&pit->pit_state.lock);
prev_legacy = pit->pit_state.flags & KVM_PIT_FLAGS_HPET_LEGACY;
cur_legacy = ps->flags & KVM_PIT_FLAGS... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
static int kvm_vm_ioctl_get_clock(struct kvm *kvm, void __user *argp) {
struct kvm_clock_data data = {0};
get_kvmclock(kvm, &data);
if (copy_to_user(argp, &data, sizeof(data)))
return -EFAULT;
return 0;
} | [
1,
0
] |
Linux Kernel | arch/x86/kvm/x86.c | gpa_t translate_nested_gpa(struct kvm_vcpu *vcpu, gpa_t gpa, u64 access,
struct x86_exception *exception) {
struct kvm_mmu *mmu = vcpu->arch.mmu;
gpa_t t_gpa;
BUG_ON(!mmu_is_nested(vcpu));
access |= PFERR_USER_MASK;
t_gpa = mmu->gva_to_gpa(vcpu, mmu, gpa, access, exception);
re... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c | int kvm_read_guest_virt(struct kvm_vcpu *vcpu, gva_t addr, void *val,
unsigned int bytes, struct x86_exception *exception) {
u64 access = (static_call(kvm_x86_get_cpl)(vcpu) == 3) ? PFERR_USER_MASK : 0;
/*
* FIXME: this should call handle_emulation_failure if X86EMUL_IO_NEEDED
* is re... | [
1,
1
] |
Linux Kernel | arch/x86/kvm/x86.c | static int vcpu_is_mmio_gpa(struct kvm_vcpu *vcpu, unsigned long gva, gpa_t gpa,
bool write) {
if ((gpa & PAGE_MASK) == APIC_DEFAULT_PHYS_BASE)
return 1;
if (vcpu_match_mmio_gpa(vcpu, gpa)) {
trace_vcpu_match_mmio(gva, gpa, write, true);
return 1;
}
return 0;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
static int write_emulate(struct kvm_vcpu *vcpu, gpa_t gpa, void *val,
int bytes) {
return emulator_write_phys(vcpu, gpa, val, bytes);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
static int emulator_read_emulated(struct x86_emulate_ctxt *ctxt,
unsigned long addr, void *val,
unsigned int bytes,
struct x86_exception *exception) {
return emulator_read_write(ctxt, addr, val, bytes, exception, &r... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
static int emulator_write_emulated(struct x86_emulate_ctxt *ctxt,
unsigned long addr, const void *val,
unsigned int bytes,
struct x86_exception *exception) {
return emulator_read_write(ctxt, addr, (void *)val, by... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
static int emulator_pio_in(struct kvm_vcpu *vcpu, int size, unsigned short port,
void *val, unsigned int count) {
int r = emulator_pio_in_out(vcpu, size, port, val, count, true);
if (r)
trace_kvm_pio(KVM_PIO_IN, port, size, count, val);
return r;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
static void complete_emulator_pio_in(struct kvm_vcpu *vcpu, void *val) {
int size = vcpu->arch.pio.size;
unsigned int count = vcpu->arch.pio.count;
memcpy(val, vcpu->arch.pio_data, size * count);
trace_kvm_pio(KVM_PIO_IN, vcpu->arch.pio.port, size, count,
vcpu->arch.pio_data);
vcpu->arch.pio.... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
static void emulator_invlpg(struct x86_emulate_ctxt *ctxt, ulong address) {
kvm_mmu_invlpg(emul_to_vcpu(ctxt), address);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
static int kvm_emulate_wbinvd_noskip(struct kvm_vcpu *vcpu) {
if (!need_emulate_wbinvd(vcpu))
return X86EMUL_CONTINUE;
if (static_call(kvm_x86_has_wbinvd_exit)()) {
int cpu = get_cpu();
cpumask_set_cpu(cpu, vcpu->arch.wbinvd_dirty_mask);
on_each_cpu_mask(vcpu->arch.wbinvd_dirty_mask, wbinvd_ipi, ... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
static int emulator_get_cpl(struct x86_emulate_ctxt *ctxt) {
return static_call(kvm_x86_get_cpl)(emul_to_vcpu(ctxt));
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
static void emulator_set_gdt(struct x86_emulate_ctxt *ctxt,
struct desc_ptr *dt) {
static_call(kvm_x86_set_gdt)(emul_to_vcpu(ctxt), dt);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
static int emulator_get_msr_with_filter(struct x86_emulate_ctxt *ctxt,
u32 msr_index, u64 *pdata) {
struct kvm_vcpu *vcpu = emul_to_vcpu(ctxt);
int r;
r = kvm_get_msr_with_filter(vcpu, msr_index, pdata);
if (r < 0)
return X86EMUL_UNHANDLEABLE;
if (r) {
if (kv... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
static int emulator_read_pmc(struct x86_emulate_ctxt *ctxt, u32 pmc,
u64 *pdata) {
return kvm_pmu_rdpmc(emul_to_vcpu(ctxt), pmc, pdata);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
static void emulator_vm_bugged(struct x86_emulate_ctxt *ctxt) {
struct kvm *kvm = emul_to_vcpu(ctxt)->kvm;
if (!kvm->vm_bugged)
kvm_vm_bugged(kvm);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
static struct x86_emulate_ctxt *alloc_emulate_ctxt(struct kvm_vcpu *vcpu) {
struct x86_emulate_ctxt *ctxt;
ctxt = kmem_cache_zalloc(x86_emulator_cache, GFP_KERNEL_ACCOUNT);
if (!ctxt) {
pr_err("kvm: failed to allocate vcpu's emulator\n");
return NULL;
}
ctxt->vcpu = vcpu;
ctxt->ops = &emulate_ops... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
static void prepare_emulation_ctxt_failure_exit(struct kvm_vcpu *vcpu) {
struct x86_emulate_ctxt *ctxt = vcpu->arch.emulate_ctxt;
prepare_emulation_failure_exit(vcpu, NULL, 0, ctxt->fetch.data,
ctxt->fetch.end - ctxt->fetch.data);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
void __kvm_prepare_emulation_failure_exit(struct kvm_vcpu *vcpu, u64 *data,
u8 ndata) {
prepare_emulation_failure_exit(vcpu, data, ndata, NULL, 0);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
void kvm_prepare_emulation_failure_exit(struct kvm_vcpu *vcpu) {
__kvm_prepare_emulation_failure_exit(vcpu, NULL, 0);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c | static bool retry_instruction(struct x86_emulate_ctxt *ctxt, gpa_t cr2_or_gpa,
int emulation_type) {
struct kvm_vcpu *vcpu = emul_to_vcpu(ctxt);
unsigned long last_retry_eip, last_retry_addr, gpa = cr2_or_gpa;
last_retry_eip = vcpu->arch.last_retry_eip;
last_retry_addr = vcpu->arc... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
static int kvm_vcpu_do_singlestep(struct kvm_vcpu *vcpu) {
struct kvm_run *kvm_run = vcpu->run;
if (vcpu->guest_debug & KVM_GUESTDBG_SINGLESTEP) {
kvm_run->debug.arch.dr6 = DR6_BS | DR6_ACTIVE_LOW;
kvm_run->debug.arch.pc = kvm_get_linear_rip(vcpu);
kvm_run->debug.arch.exception = DB_VECTOR;
kvm_ru... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c | int kvm_skip_emulated_instruction(struct kvm_vcpu *vcpu) {
unsigned long rflags = static_call(kvm_x86_get_rflags)(vcpu);
int r;
r = static_call(kvm_x86_skip_emulated_instruction)(vcpu);
if (unlikely(!r))
return 0;
kvm_pmu_trigger_event(vcpu, PERF_COUNT_HW_INSTRUCTIONS);
if (unlikely(rflags & X86_EFLA... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/x86.c | int x86_decode_emulated_instruction(struct kvm_vcpu *vcpu, int emulation_type,
void *insn, int insn_len) {
struct x86_emulate_ctxt *ctxt = vcpu->arch.emulate_ctxt;
int r;
init_emulate_ctxt(vcpu);
r = x86_decode_insn(ctxt, insn, insn_len, emulation_type);
trace_kvm_emulat... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
static int complete_fast_pio_out_port_0x7e(struct kvm_vcpu *vcpu) {
vcpu->arch.pio.count = 0;
return 1;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c | static int kvm_fast_pio_out(struct kvm_vcpu *vcpu, int size,
unsigned short port) {
unsigned long val = kvm_rax_read(vcpu);
int ret = emulator_pio_out(vcpu, size, port, &val, 1);
if (ret)
return ret;
if (port == 0x7e &&
kvm_check_has_quirk(vcpu->kvm, KVM_X86_QUIRK_OUT_7E_... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
static int kvmclock_cpufreq_notifier(struct notifier_block *nb,
unsigned long val, void *data) {
struct cpufreq_freqs *freq = data;
int cpu;
if (val == CPUFREQ_PRECHANGE && freq->old > freq->new)
return 0;
if (val == CPUFREQ_POSTCHANGE && freq->old < freq->new)
ret... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/x86.c | static void pvclock_irq_work_fn(struct irq_work *w) {
queue_work(system_long_wq, &pvclock_gtod_work);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
void kvm_arch_exit(void) {
#ifdef CONFIG_X86_64
if (hypervisor_is_type(X86_HYPER_MS_HYPERV))
clear_hv_tscchange_cb();
#endif
kvm_lapic_exit();
if (!boot_cpu_has(X86_FEATURE_CONSTANT_TSC))
cpufreq_unregister_notifier(&kvmclock_cpufreq_notifier_block,
CPUFREQ_TRANSITION_NOT... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
int kvm_emulate_halt_noskip(struct kvm_vcpu *vcpu) {
return __kvm_emulate_halt(vcpu, KVM_MP_STATE_HALTED, KVM_EXIT_HLT);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c | static int kvm_pv_clock_pairing(struct kvm_vcpu *vcpu, gpa_t paddr,
unsigned long clock_type) {
struct kvm_clock_pairing clock_pairing;
struct timespec64 ts;
u64 cycle;
int ret;
if (clock_type != KVM_CLOCK_PAIRING_WALLCLOCK)
return -KVM_EOPNOTSUPP;
if (vcpu->arch.tsc_al... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/x86.c | static int emulator_fix_hypercall(struct x86_emulate_ctxt *ctxt) {
struct kvm_vcpu *vcpu = emul_to_vcpu(ctxt);
char instruction[3];
unsigned long rip = kvm_rip_read(vcpu);
if (!kvm_check_has_quirk(vcpu->kvm, KVM_X86_QUIRK_FIX_HYPERCALL_INSN)) {
ctxt->exception.error_code_valid = false;
ctxt->exception.... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
static int dm_request_for_irq_injection(struct kvm_vcpu *vcpu) {
return vcpu->run->request_interrupt_window &&
likely(!pic_in_kernel(vcpu->kvm));
} | [
1,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
static void kvm_inject_exception(struct kvm_vcpu *vcpu) {
trace_kvm_inj_exception(
vcpu->arch.exception.vector, vcpu->arch.exception.has_error_code,
vcpu->arch.exception.error_code, vcpu->arch.exception.injected);
if (vcpu->arch.exception.error_code && !is_protmode(vcpu))
vcpu->arch.exception.erro... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
static u32 enter_smm_get_segment_flags(struct kvm_segment *seg) {
u32 flags = 0;
flags |= seg->g << 23;
flags |= seg->db << 22;
flags |= seg->l << 21;
flags |= seg->avl << 20;
flags |= seg->present << 15;
flags |= seg->dpl << 13;
flags |= seg->s << 12;
flags |= seg->type << 8;
return flags;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
void kvm_make_scan_ioapic_request(struct kvm *kvm) {
kvm_make_all_cpus_request(kvm, KVM_REQ_SCAN_IOAPIC);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
static void vcpu_scan_ioapic(struct kvm_vcpu *vcpu) {
if (!kvm_apic_present(vcpu))
return;
bitmap_zero(vcpu->arch.ioapic_handled_vectors, 256);
if (irqchip_split(vcpu->kvm))
kvm_scan_ioapic_routes(vcpu, vcpu->arch.ioapic_handled_vectors);
else {
static_call_cond(kvm_x86_sync_pir_to_irr)(vcpu);
... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
static void __set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs) {
vcpu->arch.emulate_regs_need_sync_from_vcpu = true;
vcpu->arch.emulate_regs_need_sync_to_vcpu = false;
kvm_rax_write(vcpu, regs->rax);
kvm_rbx_write(vcpu, regs->rbx);
kvm_rcx_write(vcpu, regs->rcx);
kvm_rdx_write(vcpu, regs->rdx);
kv... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
int kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu,
struct kvm_mp_state *mp_state) {
int r;
vcpu_load(vcpu);
if (kvm_mpx_supported())
kvm_load_guest_fpu(vcpu);
r = kvm_apic_accept_events(vcpu);
if (r < 0)
goto out;
r = 0;
if ((vcpu->arch.mp_state == K... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
int kvm_task_switch(struct kvm_vcpu *vcpu, u16 tss_selector, int idt_index,
int reason, bool has_error_code, u32 error_code) {
struct x86_emulate_ctxt *ctxt = vcpu->arch.emulate_ctxt;
int ret;
init_emulate_ctxt(vcpu);
ret = emulator_task_switch(ctxt, tss_selector, idt_index, reason,
... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
static int __set_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs) {
int pending_vec, max_bits;
int mmu_reset_needed = 0;
int ret = __set_sregs_common(vcpu, sregs, &mmu_reset_needed, true);
if (ret)
return ret;
if (mmu_reset_needed)
kvm_mmu_reset_context(vcpu);
max_bits = KVM_NR_INTERRUPTS;
... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c | int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu,
struct kvm_guest_debug *dbg) {
unsigned long rflags;
int i, r;
if (vcpu->arch.guest_state_protected)
return -EINVAL;
vcpu_load(vcpu);
if (dbg->control & (KVM_GUESTDBG_INJECT_DB | KVM_GUESTDBG_INJECT_B... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/x86.c |
int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu) {
struct fxregs_state *fxsave;
if (fpstate_is_confidential(&vcpu->arch.guest_fpu))
return 0;
vcpu_load(vcpu);
fxsave = &vcpu->arch.guest_fpu.fpstate->regs.fxsave;
memcpy(fpu->fpr, fxsave->st_space, 128);
fpu->fcw = fxsave->c... | [
1,
0
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.