KVM: x86: Unify pr_fmt to use module name for all KVM modules
Define pr_fmt using KBUILD_MODNAME for all KVM x86 code so that printks use consistent formatting across common x86, Intel, and AMD code. In addition to providing consistent print formatting, using KBUILD_MODNAME, e.g. kvm_amd and kvm_intel, allows referencing SVM and VMX (and SEV and SGX and ...) as technologies without generating weird messages, and without causing naming conflicts with other kernel code, e.g. "SEV: ", "tdx: ", "sgx: " etc.. are all used by the kernel for non-KVM subsystems. Opportunistically move away from printk() for prints that need to be modified anyways, e.g. to drop a manual "kvm: " prefix. Opportunistically convert a few SGX WARNs that are similarly modified to WARN_ONCE; in the very unlikely event that the WARNs fire, odds are good that they would fire repeatedly and spam the kernel log without providing unique information in each print. Note, defining pr_fmt yields undesirable results for code that uses KVM's printk wrappers, e.g. vcpu_unimpl(). But, that's a pre-existing problem as SVM/kvm_amd already defines a pr_fmt, and thankfully use of KVM's wrappers is relatively limited in KVM x86 code. Signed-off-by: Sean Christopherson <seanjc@google.com> Reviewed-by: Paul Durrant <paul@xen.org> Message-Id: <20221130230934.1014142-35-seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
08a9d59c6a
commit
8d20bd6381
|
@ -66,8 +66,8 @@ enum kvm_mode kvm_get_mode(void);
|
||||||
|
|
||||||
DECLARE_STATIC_KEY_FALSE(userspace_irqchip_in_use);
|
DECLARE_STATIC_KEY_FALSE(userspace_irqchip_in_use);
|
||||||
|
|
||||||
extern unsigned int kvm_sve_max_vl;
|
extern unsigned int __ro_after_init kvm_sve_max_vl;
|
||||||
int kvm_arm_init_sve(void);
|
int __init kvm_arm_init_sve(void);
|
||||||
|
|
||||||
u32 __attribute_const__ kvm_target_cpu(void);
|
u32 __attribute_const__ kvm_target_cpu(void);
|
||||||
int kvm_reset_vcpu(struct kvm_vcpu *vcpu);
|
int kvm_reset_vcpu(struct kvm_vcpu *vcpu);
|
||||||
|
@ -877,7 +877,7 @@ int kvm_handle_cp10_id(struct kvm_vcpu *vcpu);
|
||||||
|
|
||||||
void kvm_reset_sys_regs(struct kvm_vcpu *vcpu);
|
void kvm_reset_sys_regs(struct kvm_vcpu *vcpu);
|
||||||
|
|
||||||
int kvm_sys_reg_table_init(void);
|
int __init kvm_sys_reg_table_init(void);
|
||||||
|
|
||||||
/* MMIO helpers */
|
/* MMIO helpers */
|
||||||
void kvm_mmio_write_buf(void *buf, unsigned int len, unsigned long data);
|
void kvm_mmio_write_buf(void *buf, unsigned int len, unsigned long data);
|
||||||
|
@ -908,9 +908,9 @@ int kvm_arm_pvtime_get_attr(struct kvm_vcpu *vcpu,
|
||||||
int kvm_arm_pvtime_has_attr(struct kvm_vcpu *vcpu,
|
int kvm_arm_pvtime_has_attr(struct kvm_vcpu *vcpu,
|
||||||
struct kvm_device_attr *attr);
|
struct kvm_device_attr *attr);
|
||||||
|
|
||||||
extern unsigned int kvm_arm_vmid_bits;
|
extern unsigned int __ro_after_init kvm_arm_vmid_bits;
|
||||||
int kvm_arm_vmid_alloc_init(void);
|
int __init kvm_arm_vmid_alloc_init(void);
|
||||||
void kvm_arm_vmid_alloc_free(void);
|
void __init kvm_arm_vmid_alloc_free(void);
|
||||||
void kvm_arm_vmid_update(struct kvm_vmid *kvm_vmid);
|
void kvm_arm_vmid_update(struct kvm_vmid *kvm_vmid);
|
||||||
void kvm_arm_vmid_clear_active(void);
|
void kvm_arm_vmid_clear_active(void);
|
||||||
|
|
||||||
|
@ -993,7 +993,7 @@ static inline void kvm_clr_pmu_events(u32 clr) {}
|
||||||
void kvm_vcpu_load_sysregs_vhe(struct kvm_vcpu *vcpu);
|
void kvm_vcpu_load_sysregs_vhe(struct kvm_vcpu *vcpu);
|
||||||
void kvm_vcpu_put_sysregs_vhe(struct kvm_vcpu *vcpu);
|
void kvm_vcpu_put_sysregs_vhe(struct kvm_vcpu *vcpu);
|
||||||
|
|
||||||
int kvm_set_ipa_limit(void);
|
int __init kvm_set_ipa_limit(void);
|
||||||
|
|
||||||
#define __KVM_HAVE_ARCH_VM_ALLOC
|
#define __KVM_HAVE_ARCH_VM_ALLOC
|
||||||
struct kvm *kvm_arch_alloc_vm(void);
|
struct kvm *kvm_arch_alloc_vm(void);
|
||||||
|
|
|
@ -163,7 +163,7 @@ int create_hyp_io_mappings(phys_addr_t phys_addr, size_t size,
|
||||||
void __iomem **haddr);
|
void __iomem **haddr);
|
||||||
int create_hyp_exec_mappings(phys_addr_t phys_addr, size_t size,
|
int create_hyp_exec_mappings(phys_addr_t phys_addr, size_t size,
|
||||||
void **haddr);
|
void **haddr);
|
||||||
void free_hyp_pgds(void);
|
void __init free_hyp_pgds(void);
|
||||||
|
|
||||||
void stage2_unmap_vm(struct kvm *kvm);
|
void stage2_unmap_vm(struct kvm *kvm);
|
||||||
int kvm_init_stage2_mmu(struct kvm *kvm, struct kvm_s2_mmu *mmu, unsigned long type);
|
int kvm_init_stage2_mmu(struct kvm *kvm, struct kvm_s2_mmu *mmu, unsigned long type);
|
||||||
|
@ -175,7 +175,7 @@ int kvm_handle_guest_abort(struct kvm_vcpu *vcpu);
|
||||||
|
|
||||||
phys_addr_t kvm_mmu_get_httbr(void);
|
phys_addr_t kvm_mmu_get_httbr(void);
|
||||||
phys_addr_t kvm_get_idmap_vector(void);
|
phys_addr_t kvm_get_idmap_vector(void);
|
||||||
int kvm_mmu_init(u32 *hyp_va_bits);
|
int __init kvm_mmu_init(u32 *hyp_va_bits);
|
||||||
|
|
||||||
static inline void *__kvm_vector_slot2addr(void *base,
|
static inline void *__kvm_vector_slot2addr(void *base,
|
||||||
enum arm64_hyp_spectre_vector slot)
|
enum arm64_hyp_spectre_vector slot)
|
||||||
|
|
|
@ -1113,7 +1113,7 @@ static int kvm_irq_init(struct arch_timer_kvm_info *info)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int kvm_timer_hyp_init(bool has_gic)
|
int __init kvm_timer_hyp_init(bool has_gic)
|
||||||
{
|
{
|
||||||
struct arch_timer_kvm_info *info;
|
struct arch_timer_kvm_info *info;
|
||||||
int err;
|
int err;
|
||||||
|
|
|
@ -25,11 +25,11 @@
|
||||||
static struct kvm_pgtable *hyp_pgtable;
|
static struct kvm_pgtable *hyp_pgtable;
|
||||||
static DEFINE_MUTEX(kvm_hyp_pgd_mutex);
|
static DEFINE_MUTEX(kvm_hyp_pgd_mutex);
|
||||||
|
|
||||||
static unsigned long hyp_idmap_start;
|
static unsigned long __ro_after_init hyp_idmap_start;
|
||||||
static unsigned long hyp_idmap_end;
|
static unsigned long __ro_after_init hyp_idmap_end;
|
||||||
static phys_addr_t hyp_idmap_vector;
|
static phys_addr_t __ro_after_init hyp_idmap_vector;
|
||||||
|
|
||||||
static unsigned long io_map_base;
|
static unsigned long __ro_after_init io_map_base;
|
||||||
|
|
||||||
static phys_addr_t stage2_range_addr_end(phys_addr_t addr, phys_addr_t end)
|
static phys_addr_t stage2_range_addr_end(phys_addr_t addr, phys_addr_t end)
|
||||||
{
|
{
|
||||||
|
@ -280,7 +280,7 @@ static void stage2_flush_vm(struct kvm *kvm)
|
||||||
/**
|
/**
|
||||||
* free_hyp_pgds - free Hyp-mode page tables
|
* free_hyp_pgds - free Hyp-mode page tables
|
||||||
*/
|
*/
|
||||||
void free_hyp_pgds(void)
|
void __init free_hyp_pgds(void)
|
||||||
{
|
{
|
||||||
mutex_lock(&kvm_hyp_pgd_mutex);
|
mutex_lock(&kvm_hyp_pgd_mutex);
|
||||||
if (hyp_pgtable) {
|
if (hyp_pgtable) {
|
||||||
|
@ -1665,7 +1665,7 @@ static struct kvm_pgtable_mm_ops kvm_hyp_mm_ops = {
|
||||||
.virt_to_phys = kvm_host_pa,
|
.virt_to_phys = kvm_host_pa,
|
||||||
};
|
};
|
||||||
|
|
||||||
int kvm_mmu_init(u32 *hyp_va_bits)
|
int __init kvm_mmu_init(u32 *hyp_va_bits)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
u32 idmap_bits;
|
u32 idmap_bits;
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#include <asm/virt.h>
|
#include <asm/virt.h>
|
||||||
|
|
||||||
/* Maximum phys_shift supported for any VM on this host */
|
/* Maximum phys_shift supported for any VM on this host */
|
||||||
static u32 kvm_ipa_limit;
|
static u32 __ro_after_init kvm_ipa_limit;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ARMv8 Reset Values
|
* ARMv8 Reset Values
|
||||||
|
@ -41,9 +41,9 @@ static u32 kvm_ipa_limit;
|
||||||
#define VCPU_RESET_PSTATE_SVC (PSR_AA32_MODE_SVC | PSR_AA32_A_BIT | \
|
#define VCPU_RESET_PSTATE_SVC (PSR_AA32_MODE_SVC | PSR_AA32_A_BIT | \
|
||||||
PSR_AA32_I_BIT | PSR_AA32_F_BIT)
|
PSR_AA32_I_BIT | PSR_AA32_F_BIT)
|
||||||
|
|
||||||
unsigned int kvm_sve_max_vl;
|
unsigned int __ro_after_init kvm_sve_max_vl;
|
||||||
|
|
||||||
int kvm_arm_init_sve(void)
|
int __init kvm_arm_init_sve(void)
|
||||||
{
|
{
|
||||||
if (system_supports_sve()) {
|
if (system_supports_sve()) {
|
||||||
kvm_sve_max_vl = sve_max_virtualisable_vl();
|
kvm_sve_max_vl = sve_max_virtualisable_vl();
|
||||||
|
@ -352,7 +352,7 @@ u32 get_kvm_ipa_limit(void)
|
||||||
return kvm_ipa_limit;
|
return kvm_ipa_limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
int kvm_set_ipa_limit(void)
|
int __init kvm_set_ipa_limit(void)
|
||||||
{
|
{
|
||||||
unsigned int parange;
|
unsigned int parange;
|
||||||
u64 mmfr0;
|
u64 mmfr0;
|
||||||
|
|
|
@ -82,7 +82,7 @@ void vcpu_write_sys_reg(struct kvm_vcpu *vcpu, u64 val, int reg)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 3 bits per cache level, as per CLIDR, but non-existent caches always 0 */
|
/* 3 bits per cache level, as per CLIDR, but non-existent caches always 0 */
|
||||||
static u32 cache_levels;
|
static u32 __ro_after_init cache_levels;
|
||||||
|
|
||||||
/* CSSELR values; used to index KVM_REG_ARM_DEMUX_ID_CCSIDR */
|
/* CSSELR values; used to index KVM_REG_ARM_DEMUX_ID_CCSIDR */
|
||||||
#define CSSELR_MAX 14
|
#define CSSELR_MAX 14
|
||||||
|
@ -2733,7 +2733,7 @@ static void get_ctr_el0(struct kvm_vcpu *v, const struct sys_reg_desc *r)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ->val is filled in by kvm_sys_reg_table_init() */
|
/* ->val is filled in by kvm_sys_reg_table_init() */
|
||||||
static struct sys_reg_desc invariant_sys_regs[] = {
|
static struct sys_reg_desc invariant_sys_regs[] __ro_after_init = {
|
||||||
{ SYS_DESC(SYS_MIDR_EL1), NULL, get_midr_el1 },
|
{ SYS_DESC(SYS_MIDR_EL1), NULL, get_midr_el1 },
|
||||||
{ SYS_DESC(SYS_REVIDR_EL1), NULL, get_revidr_el1 },
|
{ SYS_DESC(SYS_REVIDR_EL1), NULL, get_revidr_el1 },
|
||||||
{ SYS_DESC(SYS_CLIDR_EL1), NULL, get_clidr_el1 },
|
{ SYS_DESC(SYS_CLIDR_EL1), NULL, get_clidr_el1 },
|
||||||
|
@ -3057,7 +3057,7 @@ int kvm_arm_copy_sys_reg_indices(struct kvm_vcpu *vcpu, u64 __user *uindices)
|
||||||
return write_demux_regids(uindices);
|
return write_demux_regids(uindices);
|
||||||
}
|
}
|
||||||
|
|
||||||
int kvm_sys_reg_table_init(void)
|
int __init kvm_sys_reg_table_init(void)
|
||||||
{
|
{
|
||||||
bool valid = true;
|
bool valid = true;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
#include <asm/kvm_asm.h>
|
#include <asm/kvm_asm.h>
|
||||||
#include <asm/kvm_mmu.h>
|
#include <asm/kvm_mmu.h>
|
||||||
|
|
||||||
unsigned int kvm_arm_vmid_bits;
|
unsigned int __ro_after_init kvm_arm_vmid_bits;
|
||||||
static DEFINE_RAW_SPINLOCK(cpu_vmid_lock);
|
static DEFINE_RAW_SPINLOCK(cpu_vmid_lock);
|
||||||
|
|
||||||
static atomic64_t vmid_generation;
|
static atomic64_t vmid_generation;
|
||||||
|
@ -172,7 +172,7 @@ void kvm_arm_vmid_update(struct kvm_vmid *kvm_vmid)
|
||||||
/*
|
/*
|
||||||
* Initialize the VMID allocator
|
* Initialize the VMID allocator
|
||||||
*/
|
*/
|
||||||
int kvm_arm_vmid_alloc_init(void)
|
int __init kvm_arm_vmid_alloc_init(void)
|
||||||
{
|
{
|
||||||
kvm_arm_vmid_bits = kvm_get_vmid_bits();
|
kvm_arm_vmid_bits = kvm_get_vmid_bits();
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ int kvm_arm_vmid_alloc_init(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void kvm_arm_vmid_alloc_free(void)
|
void __init kvm_arm_vmid_alloc_free(void)
|
||||||
{
|
{
|
||||||
kfree(vmid_map);
|
kfree(vmid_map);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
* Copyright 2011 Red Hat, Inc. and/or its affiliates.
|
* Copyright 2011 Red Hat, Inc. and/or its affiliates.
|
||||||
* Copyright IBM Corporation, 2008
|
* Copyright IBM Corporation, 2008
|
||||||
*/
|
*/
|
||||||
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||||
|
|
||||||
#include <linux/kvm_host.h>
|
#include <linux/kvm_host.h>
|
||||||
#include <linux/export.h>
|
#include <linux/export.h>
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
*
|
*
|
||||||
* Copyright 2016 Red Hat, Inc. and/or its affiliates.
|
* Copyright 2016 Red Hat, Inc. and/or its affiliates.
|
||||||
*/
|
*/
|
||||||
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||||
|
|
||||||
#include <linux/kvm_host.h>
|
#include <linux/kvm_host.h>
|
||||||
#include <linux/debugfs.h>
|
#include <linux/debugfs.h>
|
||||||
#include "lapic.h"
|
#include "lapic.h"
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
*
|
*
|
||||||
* From: xen-unstable 10676:af9809f51f81a3c43f276f00c81a52ef558afda4
|
* From: xen-unstable 10676:af9809f51f81a3c43f276f00c81a52ef558afda4
|
||||||
*/
|
*/
|
||||||
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||||
|
|
||||||
#include <linux/kvm_host.h>
|
#include <linux/kvm_host.h>
|
||||||
#include "kvm_cache_regs.h"
|
#include "kvm_cache_regs.h"
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
* Ben-Ami Yassour <benami@il.ibm.com>
|
* Ben-Ami Yassour <benami@il.ibm.com>
|
||||||
* Andrey Smetanin <asmetanin@virtuozzo.com>
|
* Andrey Smetanin <asmetanin@virtuozzo.com>
|
||||||
*/
|
*/
|
||||||
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||||
|
|
||||||
#include "x86.h"
|
#include "x86.h"
|
||||||
#include "lapic.h"
|
#include "lapic.h"
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
* Based on QEMU and Xen.
|
* Based on QEMU and Xen.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define pr_fmt(fmt) "pit: " fmt
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||||
|
|
||||||
#include <linux/kvm_host.h>
|
#include <linux/kvm_host.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
|
@ -351,7 +351,7 @@ static void create_pit_timer(struct kvm_pit *pit, u32 val, int is_period)
|
||||||
|
|
||||||
if (ps->period < min_period) {
|
if (ps->period < min_period) {
|
||||||
pr_info_ratelimited(
|
pr_info_ratelimited(
|
||||||
"kvm: requested %lld ns "
|
"requested %lld ns "
|
||||||
"i8254 timer period limited to %lld ns\n",
|
"i8254 timer period limited to %lld ns\n",
|
||||||
ps->period, min_period);
|
ps->period, min_period);
|
||||||
ps->period = min_period;
|
ps->period = min_period;
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
* Yaozu (Eddie) Dong <Eddie.dong@intel.com>
|
* Yaozu (Eddie) Dong <Eddie.dong@intel.com>
|
||||||
* Port from Qemu.
|
* Port from Qemu.
|
||||||
*/
|
*/
|
||||||
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||||
|
|
||||||
#include <linux/mm.h>
|
#include <linux/mm.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/bitops.h>
|
#include <linux/bitops.h>
|
||||||
|
@ -35,7 +37,7 @@
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
|
||||||
#define pr_pic_unimpl(fmt, ...) \
|
#define pr_pic_unimpl(fmt, ...) \
|
||||||
pr_err_ratelimited("kvm: pic: " fmt, ## __VA_ARGS__)
|
pr_err_ratelimited("pic: " fmt, ## __VA_ARGS__)
|
||||||
|
|
||||||
static void pic_irq_request(struct kvm *kvm, int level);
|
static void pic_irq_request(struct kvm *kvm, int level);
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
* Yaozu (Eddie) Dong <eddie.dong@intel.com>
|
* Yaozu (Eddie) Dong <eddie.dong@intel.com>
|
||||||
* Based on Xen 3.1 code.
|
* Based on Xen 3.1 code.
|
||||||
*/
|
*/
|
||||||
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||||
|
|
||||||
#include <linux/kvm_host.h>
|
#include <linux/kvm_host.h>
|
||||||
#include <linux/kvm.h>
|
#include <linux/kvm.h>
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
* Authors:
|
* Authors:
|
||||||
* Yaozu (Eddie) Dong <Eddie.dong@intel.com>
|
* Yaozu (Eddie) Dong <Eddie.dong@intel.com>
|
||||||
*/
|
*/
|
||||||
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||||
|
|
||||||
#include <linux/export.h>
|
#include <linux/export.h>
|
||||||
#include <linux/kvm_host.h>
|
#include <linux/kvm_host.h>
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
*
|
*
|
||||||
* Copyright 2010 Red Hat, Inc. and/or its affiliates.
|
* Copyright 2010 Red Hat, Inc. and/or its affiliates.
|
||||||
*/
|
*/
|
||||||
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||||
|
|
||||||
#include <linux/kvm_host.h>
|
#include <linux/kvm_host.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
|
@ -56,7 +57,7 @@ int kvm_irq_delivery_to_apic(struct kvm *kvm, struct kvm_lapic *src,
|
||||||
|
|
||||||
if (irq->dest_mode == APIC_DEST_PHYSICAL &&
|
if (irq->dest_mode == APIC_DEST_PHYSICAL &&
|
||||||
irq->dest_id == 0xff && kvm_lowest_prio_delivery(irq)) {
|
irq->dest_id == 0xff && kvm_lowest_prio_delivery(irq)) {
|
||||||
printk(KERN_INFO "kvm: apic: phys broadcast and lowest prio\n");
|
pr_info("apic: phys broadcast and lowest prio\n");
|
||||||
irq->delivery_mode = APIC_DM_FIXED;
|
irq->delivery_mode = APIC_DM_FIXED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,7 +200,7 @@ int kvm_request_irq_source_id(struct kvm *kvm)
|
||||||
irq_source_id = find_first_zero_bit(bitmap, BITS_PER_LONG);
|
irq_source_id = find_first_zero_bit(bitmap, BITS_PER_LONG);
|
||||||
|
|
||||||
if (irq_source_id >= BITS_PER_LONG) {
|
if (irq_source_id >= BITS_PER_LONG) {
|
||||||
printk(KERN_WARNING "kvm: exhaust allocatable IRQ sources!\n");
|
pr_warn("exhausted allocatable IRQ sources!\n");
|
||||||
irq_source_id = -EFAULT;
|
irq_source_id = -EFAULT;
|
||||||
goto unlock;
|
goto unlock;
|
||||||
}
|
}
|
||||||
|
@ -221,7 +222,7 @@ void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id)
|
||||||
mutex_lock(&kvm->irq_lock);
|
mutex_lock(&kvm->irq_lock);
|
||||||
if (irq_source_id < 0 ||
|
if (irq_source_id < 0 ||
|
||||||
irq_source_id >= BITS_PER_LONG) {
|
irq_source_id >= BITS_PER_LONG) {
|
||||||
printk(KERN_ERR "kvm: IRQ source ID out of range!\n");
|
pr_err("IRQ source ID out of range!\n");
|
||||||
goto unlock;
|
goto unlock;
|
||||||
}
|
}
|
||||||
clear_bit(irq_source_id, &kvm->arch.irq_sources_bitmap);
|
clear_bit(irq_source_id, &kvm->arch.irq_sources_bitmap);
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
/*
|
/*
|
||||||
* KVM L1 hypervisor optimizations on Hyper-V.
|
* KVM L1 hypervisor optimizations on Hyper-V.
|
||||||
*/
|
*/
|
||||||
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||||
|
|
||||||
#include <linux/kvm_host.h>
|
#include <linux/kvm_host.h>
|
||||||
#include <asm/mshyperv.h>
|
#include <asm/mshyperv.h>
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
*
|
*
|
||||||
* Based on Xen 3.1 code, Copyright (c) 2004, Intel Corporation.
|
* Based on Xen 3.1 code, Copyright (c) 2004, Intel Corporation.
|
||||||
*/
|
*/
|
||||||
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||||
|
|
||||||
#include <linux/kvm_host.h>
|
#include <linux/kvm_host.h>
|
||||||
#include <linux/kvm.h>
|
#include <linux/kvm.h>
|
||||||
|
@ -941,8 +942,7 @@ static void kvm_apic_disabled_lapic_found(struct kvm *kvm)
|
||||||
{
|
{
|
||||||
if (!kvm->arch.disabled_lapic_found) {
|
if (!kvm->arch.disabled_lapic_found) {
|
||||||
kvm->arch.disabled_lapic_found = true;
|
kvm->arch.disabled_lapic_found = true;
|
||||||
printk(KERN_INFO
|
pr_info("Disabled LAPIC found during irq injection\n");
|
||||||
"Disabled LAPIC found during irq injection\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1560,7 +1560,7 @@ static void limit_periodic_timer_frequency(struct kvm_lapic *apic)
|
||||||
|
|
||||||
if (apic->lapic_timer.period < min_period) {
|
if (apic->lapic_timer.period < min_period) {
|
||||||
pr_info_ratelimited(
|
pr_info_ratelimited(
|
||||||
"kvm: vcpu %i: requested %lld ns "
|
"vcpu %i: requested %lld ns "
|
||||||
"lapic timer period limited to %lld ns\n",
|
"lapic timer period limited to %lld ns\n",
|
||||||
apic->vcpu->vcpu_id,
|
apic->vcpu->vcpu_id,
|
||||||
apic->lapic_timer.period, min_period);
|
apic->lapic_timer.period, min_period);
|
||||||
|
@ -1845,7 +1845,7 @@ static bool set_target_expiration(struct kvm_lapic *apic, u32 count_reg)
|
||||||
deadline = apic->lapic_timer.period;
|
deadline = apic->lapic_timer.period;
|
||||||
else if (unlikely(deadline > apic->lapic_timer.period)) {
|
else if (unlikely(deadline > apic->lapic_timer.period)) {
|
||||||
pr_info_ratelimited(
|
pr_info_ratelimited(
|
||||||
"kvm: vcpu %i: requested lapic timer restore with "
|
"vcpu %i: requested lapic timer restore with "
|
||||||
"starting count register %#x=%u (%lld ns) > initial count (%lld ns). "
|
"starting count register %#x=%u (%lld ns) > initial count (%lld ns). "
|
||||||
"Using initial count to start timer.\n",
|
"Using initial count to start timer.\n",
|
||||||
apic->vcpu->vcpu_id,
|
apic->vcpu->vcpu_id,
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
* Yaniv Kamay <yaniv@qumranet.com>
|
* Yaniv Kamay <yaniv@qumranet.com>
|
||||||
* Avi Kivity <avi@qumranet.com>
|
* Avi Kivity <avi@qumranet.com>
|
||||||
*/
|
*/
|
||||||
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||||
|
|
||||||
#include "irq.h"
|
#include "irq.h"
|
||||||
#include "ioapic.h"
|
#include "ioapic.h"
|
||||||
|
@ -3456,8 +3457,7 @@ static int fast_page_fault(struct kvm_vcpu *vcpu, struct kvm_page_fault *fault)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (++retry_count > 4) {
|
if (++retry_count > 4) {
|
||||||
printk_once(KERN_WARNING
|
pr_warn_once("Fast #PF retrying more than 4 times.\n");
|
||||||
"kvm: Fast #PF retrying more than 4 times.\n");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6647,7 +6647,7 @@ void kvm_mmu_invalidate_mmio_sptes(struct kvm *kvm, u64 gen)
|
||||||
* zap all shadow pages.
|
* zap all shadow pages.
|
||||||
*/
|
*/
|
||||||
if (unlikely(gen == 0)) {
|
if (unlikely(gen == 0)) {
|
||||||
kvm_debug_ratelimited("kvm: zapping shadow pages for mmio generation wraparound\n");
|
kvm_debug_ratelimited("zapping shadow pages for mmio generation wraparound\n");
|
||||||
kvm_mmu_zap_all_fast(kvm);
|
kvm_mmu_zap_all_fast(kvm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
* Author:
|
* Author:
|
||||||
* Xiao Guangrong <guangrong.xiao@linux.intel.com>
|
* Xiao Guangrong <guangrong.xiao@linux.intel.com>
|
||||||
*/
|
*/
|
||||||
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||||
|
|
||||||
#include <linux/kvm_host.h>
|
#include <linux/kvm_host.h>
|
||||||
#include <linux/rculist.h>
|
#include <linux/rculist.h>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
* Copyright (C) 2006 Qumranet, Inc.
|
* Copyright (C) 2006 Qumranet, Inc.
|
||||||
* Copyright 2020 Red Hat, Inc. and/or its affiliates.
|
* Copyright 2020 Red Hat, Inc. and/or its affiliates.
|
||||||
*/
|
*/
|
||||||
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||||
|
|
||||||
#include <linux/kvm_host.h>
|
#include <linux/kvm_host.h>
|
||||||
#include "mmu.h"
|
#include "mmu.h"
|
||||||
|
@ -352,7 +352,7 @@ u64 mark_spte_for_access_track(u64 spte)
|
||||||
|
|
||||||
WARN_ONCE(spte & (SHADOW_ACC_TRACK_SAVED_BITS_MASK <<
|
WARN_ONCE(spte & (SHADOW_ACC_TRACK_SAVED_BITS_MASK <<
|
||||||
SHADOW_ACC_TRACK_SAVED_BITS_SHIFT),
|
SHADOW_ACC_TRACK_SAVED_BITS_SHIFT),
|
||||||
"kvm: Access Tracking saved bit locations are not zero\n");
|
"Access Tracking saved bit locations are not zero\n");
|
||||||
|
|
||||||
spte |= (spte & SHADOW_ACC_TRACK_SAVED_BITS_MASK) <<
|
spte |= (spte & SHADOW_ACC_TRACK_SAVED_BITS_MASK) <<
|
||||||
SHADOW_ACC_TRACK_SAVED_BITS_SHIFT;
|
SHADOW_ACC_TRACK_SAVED_BITS_SHIFT;
|
||||||
|
|
|
@ -435,11 +435,11 @@ static inline void check_spte_writable_invariants(u64 spte)
|
||||||
{
|
{
|
||||||
if (spte & shadow_mmu_writable_mask)
|
if (spte & shadow_mmu_writable_mask)
|
||||||
WARN_ONCE(!(spte & shadow_host_writable_mask),
|
WARN_ONCE(!(spte & shadow_host_writable_mask),
|
||||||
"kvm: MMU-writable SPTE is not Host-writable: %llx",
|
KBUILD_MODNAME ": MMU-writable SPTE is not Host-writable: %llx",
|
||||||
spte);
|
spte);
|
||||||
else
|
else
|
||||||
WARN_ONCE(is_writable_pte(spte),
|
WARN_ONCE(is_writable_pte(spte),
|
||||||
"kvm: Writable SPTE is not MMU-writable: %llx", spte);
|
KBUILD_MODNAME ": Writable SPTE is not MMU-writable: %llx", spte);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool is_mmu_writable_spte(u64 spte)
|
static inline bool is_mmu_writable_spte(u64 spte)
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0
|
// SPDX-License-Identifier: GPL-2.0
|
||||||
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||||
|
|
||||||
#include "mmu_internal.h"
|
#include "mmu_internal.h"
|
||||||
#include "tdp_iter.h"
|
#include "tdp_iter.h"
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0
|
// SPDX-License-Identifier: GPL-2.0
|
||||||
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||||
|
|
||||||
#include "mmu.h"
|
#include "mmu.h"
|
||||||
#include "mmu_internal.h"
|
#include "mmu_internal.h"
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
* Paolo Bonzini <pbonzini@redhat.com>
|
* Paolo Bonzini <pbonzini@redhat.com>
|
||||||
* Xiao Guangrong <guangrong.xiao@linux.intel.com>
|
* Xiao Guangrong <guangrong.xiao@linux.intel.com>
|
||||||
*/
|
*/
|
||||||
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||||
|
|
||||||
#include <linux/kvm_host.h>
|
#include <linux/kvm_host.h>
|
||||||
#include <asm/mtrr.h>
|
#include <asm/mtrr.h>
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* Gleb Natapov <gleb@redhat.com>
|
* Gleb Natapov <gleb@redhat.com>
|
||||||
* Wei Huang <wei@redhat.com>
|
* Wei Huang <wei@redhat.com>
|
||||||
*/
|
*/
|
||||||
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||||
|
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
#include <linux/kvm_host.h>
|
#include <linux/kvm_host.h>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/* SPDX-License-Identifier: GPL-2.0 */
|
/* SPDX-License-Identifier: GPL-2.0 */
|
||||||
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||||
|
|
||||||
#include <linux/kvm_host.h>
|
#include <linux/kvm_host.h>
|
||||||
#include "x86.h"
|
#include "x86.h"
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
* Avi Kivity <avi@qumranet.com>
|
* Avi Kivity <avi@qumranet.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define pr_fmt(fmt) "SVM: " fmt
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||||
|
|
||||||
#include <linux/kvm_types.h>
|
#include <linux/kvm_types.h>
|
||||||
#include <linux/hashtable.h>
|
#include <linux/hashtable.h>
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
* Avi Kivity <avi@qumranet.com>
|
* Avi Kivity <avi@qumranet.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define pr_fmt(fmt) "SVM: " fmt
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||||
|
|
||||||
#include <linux/kvm_types.h>
|
#include <linux/kvm_types.h>
|
||||||
#include <linux/kvm_host.h>
|
#include <linux/kvm_host.h>
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
*
|
*
|
||||||
* Implementation is based on pmu_intel.c file
|
* Implementation is based on pmu_intel.c file
|
||||||
*/
|
*/
|
||||||
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||||
|
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
#include <linux/kvm_host.h>
|
#include <linux/kvm_host.h>
|
||||||
#include <linux/perf_event.h>
|
#include <linux/perf_event.h>
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
*
|
*
|
||||||
* Copyright 2010 Red Hat, Inc. and/or its affiliates.
|
* Copyright 2010 Red Hat, Inc. and/or its affiliates.
|
||||||
*/
|
*/
|
||||||
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||||
|
|
||||||
#include <linux/kvm_types.h>
|
#include <linux/kvm_types.h>
|
||||||
#include <linux/kvm_host.h>
|
#include <linux/kvm_host.h>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#define pr_fmt(fmt) "SVM: " fmt
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||||
|
|
||||||
#include <linux/kvm_host.h>
|
#include <linux/kvm_host.h>
|
||||||
|
|
||||||
|
@ -2076,7 +2076,7 @@ static void svm_handle_mce(struct kvm_vcpu *vcpu)
|
||||||
* Erratum 383 triggered. Guest state is corrupt so kill the
|
* Erratum 383 triggered. Guest state is corrupt so kill the
|
||||||
* guest.
|
* guest.
|
||||||
*/
|
*/
|
||||||
pr_err("KVM: Guest triggered AMD Erratum 383\n");
|
pr_err("Guest triggered AMD Erratum 383\n");
|
||||||
|
|
||||||
kvm_make_request(KVM_REQ_TRIPLE_FAULT, vcpu);
|
kvm_make_request(KVM_REQ_TRIPLE_FAULT, vcpu);
|
||||||
|
|
||||||
|
@ -4629,7 +4629,7 @@ static bool svm_can_emulate_instruction(struct kvm_vcpu *vcpu, int emul_type,
|
||||||
smap = cr4 & X86_CR4_SMAP;
|
smap = cr4 & X86_CR4_SMAP;
|
||||||
is_user = svm_get_cpl(vcpu) == 3;
|
is_user = svm_get_cpl(vcpu) == 3;
|
||||||
if (smap && (!smep || is_user)) {
|
if (smap && (!smep || is_user)) {
|
||||||
pr_err_ratelimited("KVM: SEV Guest triggered AMD Erratum 1096\n");
|
pr_err_ratelimited("SEV Guest triggered AMD Erratum 1096\n");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the fault occurred in userspace, arbitrarily inject #GP
|
* If the fault occurred in userspace, arbitrarily inject #GP
|
||||||
|
@ -4978,7 +4978,7 @@ static __init int svm_hardware_setup(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nested) {
|
if (nested) {
|
||||||
printk(KERN_INFO "kvm: Nested Virtualization enabled\n");
|
pr_info("Nested Virtualization enabled\n");
|
||||||
kvm_enable_efer_bits(EFER_SVME | EFER_LMSLE);
|
kvm_enable_efer_bits(EFER_SVME | EFER_LMSLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4996,7 +4996,7 @@ static __init int svm_hardware_setup(void)
|
||||||
/* Force VM NPT level equal to the host's paging level */
|
/* Force VM NPT level equal to the host's paging level */
|
||||||
kvm_configure_mmu(npt_enabled, get_npt_level(),
|
kvm_configure_mmu(npt_enabled, get_npt_level(),
|
||||||
get_npt_level(), PG_LEVEL_1G);
|
get_npt_level(), PG_LEVEL_1G);
|
||||||
pr_info("kvm: Nested Paging %sabled\n", npt_enabled ? "en" : "dis");
|
pr_info("Nested Paging %sabled\n", npt_enabled ? "en" : "dis");
|
||||||
|
|
||||||
/* Setup shadow_me_value and shadow_me_mask */
|
/* Setup shadow_me_value and shadow_me_mask */
|
||||||
kvm_mmu_set_me_spte_mask(sme_me_mask, sme_me_mask);
|
kvm_mmu_set_me_spte_mask(sme_me_mask, sme_me_mask);
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
/*
|
/*
|
||||||
* KVM L1 hypervisor optimizations on Hyper-V for SVM.
|
* KVM L1 hypervisor optimizations on Hyper-V for SVM.
|
||||||
*/
|
*/
|
||||||
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||||
|
|
||||||
#include <linux/kvm_host.h>
|
#include <linux/kvm_host.h>
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ static inline void svm_hv_hardware_setup(void)
|
||||||
{
|
{
|
||||||
if (npt_enabled &&
|
if (npt_enabled &&
|
||||||
ms_hyperv.nested_features & HV_X64_NESTED_ENLIGHTENED_TLB) {
|
ms_hyperv.nested_features & HV_X64_NESTED_ENLIGHTENED_TLB) {
|
||||||
pr_info("kvm: Hyper-V enlightened NPT TLB flush enabled\n");
|
pr_info(KBUILD_MODNAME ": Hyper-V enlightened NPT TLB flush enabled\n");
|
||||||
svm_x86_ops.tlb_remote_flush = hv_remote_flush_tlb;
|
svm_x86_ops.tlb_remote_flush = hv_remote_flush_tlb;
|
||||||
svm_x86_ops.tlb_remote_flush_with_range =
|
svm_x86_ops.tlb_remote_flush_with_range =
|
||||||
hv_remote_flush_tlb_with_range;
|
hv_remote_flush_tlb_with_range;
|
||||||
|
@ -43,7 +43,7 @@ static inline void svm_hv_hardware_setup(void)
|
||||||
if (ms_hyperv.nested_features & HV_X64_NESTED_DIRECT_FLUSH) {
|
if (ms_hyperv.nested_features & HV_X64_NESTED_DIRECT_FLUSH) {
|
||||||
int cpu;
|
int cpu;
|
||||||
|
|
||||||
pr_info("kvm: Hyper-V Direct TLB Flush enabled\n");
|
pr_info(KBUILD_MODNAME ": Hyper-V Direct TLB Flush enabled\n");
|
||||||
for_each_online_cpu(cpu) {
|
for_each_online_cpu(cpu) {
|
||||||
struct hv_vp_assist_page *vp_ap =
|
struct hv_vp_assist_page *vp_ap =
|
||||||
hv_get_vp_assist_page(cpu);
|
hv_get_vp_assist_page(cpu);
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0
|
// SPDX-License-Identifier: GPL-2.0
|
||||||
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||||
#define pr_fmt(fmt) "kvm/hyper-v: " fmt
|
|
||||||
|
|
||||||
#include <linux/errno.h>
|
#include <linux/errno.h>
|
||||||
#include <linux/smp.h>
|
#include <linux/smp.h>
|
||||||
|
|
|
@ -179,9 +179,7 @@ static __always_inline int get_evmcs_offset(unsigned long field,
|
||||||
{
|
{
|
||||||
int offset = evmcs_field_offset(field, clean_field);
|
int offset = evmcs_field_offset(field, clean_field);
|
||||||
|
|
||||||
WARN_ONCE(offset < 0, "KVM: accessing unsupported EVMCS field %lx\n",
|
WARN_ONCE(offset < 0, "accessing unsupported EVMCS field %lx\n", field);
|
||||||
field);
|
|
||||||
|
|
||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0
|
// SPDX-License-Identifier: GPL-2.0
|
||||||
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||||
|
|
||||||
#include <linux/objtool.h>
|
#include <linux/objtool.h>
|
||||||
#include <linux/percpu.h>
|
#include <linux/percpu.h>
|
||||||
|
@ -203,7 +204,7 @@ static void nested_vmx_abort(struct kvm_vcpu *vcpu, u32 indicator)
|
||||||
{
|
{
|
||||||
/* TODO: not to reset guest simply here. */
|
/* TODO: not to reset guest simply here. */
|
||||||
kvm_make_request(KVM_REQ_TRIPLE_FAULT, vcpu);
|
kvm_make_request(KVM_REQ_TRIPLE_FAULT, vcpu);
|
||||||
pr_debug_ratelimited("kvm: nested vmx abort, indicator %d\n", indicator);
|
pr_debug_ratelimited("nested vmx abort, indicator %d\n", indicator);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool vmx_control_verify(u32 control, u32 low, u32 high)
|
static inline bool vmx_control_verify(u32 control, u32 low, u32 high)
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
* Avi Kivity <avi@redhat.com>
|
* Avi Kivity <avi@redhat.com>
|
||||||
* Gleb Natapov <gleb@redhat.com>
|
* Gleb Natapov <gleb@redhat.com>
|
||||||
*/
|
*/
|
||||||
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||||
|
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
#include <linux/kvm_host.h>
|
#include <linux/kvm_host.h>
|
||||||
#include <linux/perf_event.h>
|
#include <linux/perf_event.h>
|
||||||
|
@ -762,8 +764,7 @@ void vmx_passthrough_lbr_msrs(struct kvm_vcpu *vcpu)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
warn:
|
warn:
|
||||||
pr_warn_ratelimited("kvm: vcpu-%d: fail to passthrough LBR.\n",
|
pr_warn_ratelimited("vcpu-%d: fail to passthrough LBR.\n", vcpu->vcpu_id);
|
||||||
vcpu->vcpu_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void intel_pmu_cleanup(struct kvm_vcpu *vcpu)
|
static void intel_pmu_cleanup(struct kvm_vcpu *vcpu)
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0-only
|
// SPDX-License-Identifier: GPL-2.0-only
|
||||||
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||||
|
|
||||||
#include <linux/kvm_host.h>
|
#include <linux/kvm_host.h>
|
||||||
|
|
||||||
#include <asm/irq_remapping.h>
|
#include <asm/irq_remapping.h>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0
|
// SPDX-License-Identifier: GPL-2.0
|
||||||
/* Copyright(c) 2021 Intel Corporation. */
|
/* Copyright(c) 2021 Intel Corporation. */
|
||||||
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||||
|
|
||||||
#include <asm/sgx.h>
|
#include <asm/sgx.h>
|
||||||
|
|
||||||
|
@ -164,7 +165,7 @@ static int __handle_encls_ecreate(struct kvm_vcpu *vcpu,
|
||||||
if (!vcpu->kvm->arch.sgx_provisioning_allowed &&
|
if (!vcpu->kvm->arch.sgx_provisioning_allowed &&
|
||||||
(attributes & SGX_ATTR_PROVISIONKEY)) {
|
(attributes & SGX_ATTR_PROVISIONKEY)) {
|
||||||
if (sgx_12_1->eax & SGX_ATTR_PROVISIONKEY)
|
if (sgx_12_1->eax & SGX_ATTR_PROVISIONKEY)
|
||||||
pr_warn_once("KVM: SGX PROVISIONKEY advertised but not allowed\n");
|
pr_warn_once("SGX PROVISIONKEY advertised but not allowed\n");
|
||||||
kvm_inject_gp(vcpu, 0);
|
kvm_inject_gp(vcpu, 0);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -381,7 +382,7 @@ int handle_encls(struct kvm_vcpu *vcpu)
|
||||||
return handle_encls_ecreate(vcpu);
|
return handle_encls_ecreate(vcpu);
|
||||||
if (leaf == EINIT)
|
if (leaf == EINIT)
|
||||||
return handle_encls_einit(vcpu);
|
return handle_encls_einit(vcpu);
|
||||||
WARN(1, "KVM: unexpected exit on ENCLS[%u]", leaf);
|
WARN_ONCE(1, "unexpected exit on ENCLS[%u]", leaf);
|
||||||
vcpu->run->exit_reason = KVM_EXIT_UNKNOWN;
|
vcpu->run->exit_reason = KVM_EXIT_UNKNOWN;
|
||||||
vcpu->run->hw.hardware_exit_reason = EXIT_REASON_ENCLS;
|
vcpu->run->hw.hardware_exit_reason = EXIT_REASON_ENCLS;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0
|
// SPDX-License-Identifier: GPL-2.0
|
||||||
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||||
|
|
||||||
#include "vmcs12.h"
|
#include "vmcs12.h"
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
* Avi Kivity <avi@qumranet.com>
|
* Avi Kivity <avi@qumranet.com>
|
||||||
* Yaniv Kamay <yaniv@qumranet.com>
|
* Yaniv Kamay <yaniv@qumranet.com>
|
||||||
*/
|
*/
|
||||||
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||||
|
|
||||||
#include <linux/highmem.h>
|
#include <linux/highmem.h>
|
||||||
#include <linux/hrtimer.h>
|
#include <linux/hrtimer.h>
|
||||||
|
@ -444,36 +445,36 @@ void vmread_error(unsigned long field, bool fault)
|
||||||
if (fault)
|
if (fault)
|
||||||
kvm_spurious_fault();
|
kvm_spurious_fault();
|
||||||
else
|
else
|
||||||
vmx_insn_failed("kvm: vmread failed: field=%lx\n", field);
|
vmx_insn_failed("vmread failed: field=%lx\n", field);
|
||||||
}
|
}
|
||||||
|
|
||||||
noinline void vmwrite_error(unsigned long field, unsigned long value)
|
noinline void vmwrite_error(unsigned long field, unsigned long value)
|
||||||
{
|
{
|
||||||
vmx_insn_failed("kvm: vmwrite failed: field=%lx val=%lx err=%u\n",
|
vmx_insn_failed("vmwrite failed: field=%lx val=%lx err=%u\n",
|
||||||
field, value, vmcs_read32(VM_INSTRUCTION_ERROR));
|
field, value, vmcs_read32(VM_INSTRUCTION_ERROR));
|
||||||
}
|
}
|
||||||
|
|
||||||
noinline void vmclear_error(struct vmcs *vmcs, u64 phys_addr)
|
noinline void vmclear_error(struct vmcs *vmcs, u64 phys_addr)
|
||||||
{
|
{
|
||||||
vmx_insn_failed("kvm: vmclear failed: %p/%llx err=%u\n",
|
vmx_insn_failed("vmclear failed: %p/%llx err=%u\n",
|
||||||
vmcs, phys_addr, vmcs_read32(VM_INSTRUCTION_ERROR));
|
vmcs, phys_addr, vmcs_read32(VM_INSTRUCTION_ERROR));
|
||||||
}
|
}
|
||||||
|
|
||||||
noinline void vmptrld_error(struct vmcs *vmcs, u64 phys_addr)
|
noinline void vmptrld_error(struct vmcs *vmcs, u64 phys_addr)
|
||||||
{
|
{
|
||||||
vmx_insn_failed("kvm: vmptrld failed: %p/%llx err=%u\n",
|
vmx_insn_failed("vmptrld failed: %p/%llx err=%u\n",
|
||||||
vmcs, phys_addr, vmcs_read32(VM_INSTRUCTION_ERROR));
|
vmcs, phys_addr, vmcs_read32(VM_INSTRUCTION_ERROR));
|
||||||
}
|
}
|
||||||
|
|
||||||
noinline void invvpid_error(unsigned long ext, u16 vpid, gva_t gva)
|
noinline void invvpid_error(unsigned long ext, u16 vpid, gva_t gva)
|
||||||
{
|
{
|
||||||
vmx_insn_failed("kvm: invvpid failed: ext=0x%lx vpid=%u gva=0x%lx\n",
|
vmx_insn_failed("invvpid failed: ext=0x%lx vpid=%u gva=0x%lx\n",
|
||||||
ext, vpid, gva);
|
ext, vpid, gva);
|
||||||
}
|
}
|
||||||
|
|
||||||
noinline void invept_error(unsigned long ext, u64 eptp, gpa_t gpa)
|
noinline void invept_error(unsigned long ext, u64 eptp, gpa_t gpa)
|
||||||
{
|
{
|
||||||
vmx_insn_failed("kvm: invept failed: ext=0x%lx eptp=%llx gpa=0x%llx\n",
|
vmx_insn_failed("invept failed: ext=0x%lx eptp=%llx gpa=0x%llx\n",
|
||||||
ext, eptp, gpa);
|
ext, eptp, gpa);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -577,7 +578,7 @@ static __init void hv_init_evmcs(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enlightened_vmcs) {
|
if (enlightened_vmcs) {
|
||||||
pr_info("KVM: vmx: using Hyper-V Enlightened VMCS\n");
|
pr_info("Using Hyper-V Enlightened VMCS\n");
|
||||||
static_branch_enable(&enable_evmcs);
|
static_branch_enable(&enable_evmcs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1680,8 +1681,8 @@ static int skip_emulated_instruction(struct kvm_vcpu *vcpu)
|
||||||
if (!instr_len)
|
if (!instr_len)
|
||||||
goto rip_updated;
|
goto rip_updated;
|
||||||
|
|
||||||
WARN(exit_reason.enclave_mode,
|
WARN_ONCE(exit_reason.enclave_mode,
|
||||||
"KVM: skipping instruction after SGX enclave VM-Exit");
|
"skipping instruction after SGX enclave VM-Exit");
|
||||||
|
|
||||||
orig_rip = kvm_rip_read(vcpu);
|
orig_rip = kvm_rip_read(vcpu);
|
||||||
rip = orig_rip + instr_len;
|
rip = orig_rip + instr_len;
|
||||||
|
@ -3024,9 +3025,8 @@ static void fix_rmode_seg(int seg, struct kvm_segment *save)
|
||||||
var.type = 0x3;
|
var.type = 0x3;
|
||||||
var.avl = 0;
|
var.avl = 0;
|
||||||
if (save->base & 0xf)
|
if (save->base & 0xf)
|
||||||
printk_once(KERN_WARNING "kvm: segment base is not "
|
pr_warn_once("segment base is not paragraph aligned "
|
||||||
"paragraph aligned when entering "
|
"when entering protected mode (seg=%d)", seg);
|
||||||
"protected mode (seg=%d)", seg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vmcs_write16(sf->selector, var.selector);
|
vmcs_write16(sf->selector, var.selector);
|
||||||
|
@ -3056,8 +3056,7 @@ static void enter_rmode(struct kvm_vcpu *vcpu)
|
||||||
* vcpu. Warn the user that an update is overdue.
|
* vcpu. Warn the user that an update is overdue.
|
||||||
*/
|
*/
|
||||||
if (!kvm_vmx->tss_addr)
|
if (!kvm_vmx->tss_addr)
|
||||||
printk_once(KERN_WARNING "kvm: KVM_SET_TSS_ADDR need to be "
|
pr_warn_once("KVM_SET_TSS_ADDR needs to be called before running vCPU\n");
|
||||||
"called before entering vcpu\n");
|
|
||||||
|
|
||||||
vmx_segment_cache_clear(vmx);
|
vmx_segment_cache_clear(vmx);
|
||||||
|
|
||||||
|
@ -6925,7 +6924,7 @@ static void handle_external_interrupt_irqoff(struct kvm_vcpu *vcpu)
|
||||||
gate_desc *desc = (gate_desc *)host_idt_base + vector;
|
gate_desc *desc = (gate_desc *)host_idt_base + vector;
|
||||||
|
|
||||||
if (KVM_BUG(!is_external_intr(intr_info), vcpu->kvm,
|
if (KVM_BUG(!is_external_intr(intr_info), vcpu->kvm,
|
||||||
"KVM: unexpected VM-Exit interrupt info: 0x%x", intr_info))
|
"unexpected VM-Exit interrupt info: 0x%x", intr_info))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
handle_interrupt_nmi_irqoff(vcpu, gate_offset(desc));
|
handle_interrupt_nmi_irqoff(vcpu, gate_offset(desc));
|
||||||
|
@ -7530,7 +7529,7 @@ static int __init vmx_check_processor_compat(void)
|
||||||
|
|
||||||
if (!this_cpu_has(X86_FEATURE_MSR_IA32_FEAT_CTL) ||
|
if (!this_cpu_has(X86_FEATURE_MSR_IA32_FEAT_CTL) ||
|
||||||
!this_cpu_has(X86_FEATURE_VMX)) {
|
!this_cpu_has(X86_FEATURE_VMX)) {
|
||||||
pr_err("kvm: VMX is disabled on CPU %d\n", smp_processor_id());
|
pr_err("VMX is disabled on CPU %d\n", smp_processor_id());
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7539,8 +7538,7 @@ static int __init vmx_check_processor_compat(void)
|
||||||
if (nested)
|
if (nested)
|
||||||
nested_vmx_setup_ctls_msrs(&vmcs_conf, vmx_cap.ept);
|
nested_vmx_setup_ctls_msrs(&vmcs_conf, vmx_cap.ept);
|
||||||
if (memcmp(&vmcs_config, &vmcs_conf, sizeof(struct vmcs_config)) != 0) {
|
if (memcmp(&vmcs_config, &vmcs_conf, sizeof(struct vmcs_config)) != 0) {
|
||||||
printk(KERN_ERR "kvm: CPU %d feature inconsistency!\n",
|
pr_err("CPU %d feature inconsistency!\n", smp_processor_id());
|
||||||
smp_processor_id());
|
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -8365,7 +8363,7 @@ static __init int hardware_setup(void)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
if (cpu_has_perf_global_ctrl_bug())
|
if (cpu_has_perf_global_ctrl_bug())
|
||||||
pr_warn_once("kvm: VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL "
|
pr_warn_once("VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL "
|
||||||
"does not work properly. Using workaround\n");
|
"does not work properly. Using workaround\n");
|
||||||
|
|
||||||
if (boot_cpu_has(X86_FEATURE_NX))
|
if (boot_cpu_has(X86_FEATURE_NX))
|
||||||
|
@ -8373,7 +8371,7 @@ static __init int hardware_setup(void)
|
||||||
|
|
||||||
if (boot_cpu_has(X86_FEATURE_MPX)) {
|
if (boot_cpu_has(X86_FEATURE_MPX)) {
|
||||||
rdmsrl(MSR_IA32_BNDCFGS, host_bndcfgs);
|
rdmsrl(MSR_IA32_BNDCFGS, host_bndcfgs);
|
||||||
WARN_ONCE(host_bndcfgs, "KVM: BNDCFGS in host will be lost");
|
WARN_ONCE(host_bndcfgs, "BNDCFGS in host will be lost");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cpu_has_vmx_mpx())
|
if (!cpu_has_vmx_mpx())
|
||||||
|
@ -8392,7 +8390,7 @@ static __init int hardware_setup(void)
|
||||||
|
|
||||||
/* NX support is required for shadow paging. */
|
/* NX support is required for shadow paging. */
|
||||||
if (!enable_ept && !boot_cpu_has(X86_FEATURE_NX)) {
|
if (!enable_ept && !boot_cpu_has(X86_FEATURE_NX)) {
|
||||||
pr_err_ratelimited("kvm: NX (Execute Disable) not supported\n");
|
pr_err_ratelimited("NX (Execute Disable) not supported\n");
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,8 +100,8 @@ static __always_inline unsigned long __vmcs_readl(unsigned long field)
|
||||||
return value;
|
return value;
|
||||||
|
|
||||||
do_fail:
|
do_fail:
|
||||||
WARN_ONCE(1, "kvm: vmread failed: field=%lx\n", field);
|
WARN_ONCE(1, KBUILD_MODNAME ": vmread failed: field=%lx\n", field);
|
||||||
pr_warn_ratelimited("kvm: vmread failed: field=%lx\n", field);
|
pr_warn_ratelimited(KBUILD_MODNAME ": vmread failed: field=%lx\n", field);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
do_exception:
|
do_exception:
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
* Amit Shah <amit.shah@qumranet.com>
|
* Amit Shah <amit.shah@qumranet.com>
|
||||||
* Ben-Ami Yassour <benami@il.ibm.com>
|
* Ben-Ami Yassour <benami@il.ibm.com>
|
||||||
*/
|
*/
|
||||||
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||||
|
|
||||||
#include <linux/kvm_host.h>
|
#include <linux/kvm_host.h>
|
||||||
#include "irq.h"
|
#include "irq.h"
|
||||||
|
@ -2087,7 +2088,7 @@ static int kvm_emulate_monitor_mwait(struct kvm_vcpu *vcpu, const char *insn)
|
||||||
!guest_cpuid_has(vcpu, X86_FEATURE_MWAIT))
|
!guest_cpuid_has(vcpu, X86_FEATURE_MWAIT))
|
||||||
return kvm_handle_invalid_op(vcpu);
|
return kvm_handle_invalid_op(vcpu);
|
||||||
|
|
||||||
pr_warn_once("kvm: %s instruction emulated as NOP!\n", insn);
|
pr_warn_once("%s instruction emulated as NOP!\n", insn);
|
||||||
return kvm_emulate_as_nop(vcpu);
|
return kvm_emulate_as_nop(vcpu);
|
||||||
}
|
}
|
||||||
int kvm_emulate_mwait(struct kvm_vcpu *vcpu)
|
int kvm_emulate_mwait(struct kvm_vcpu *vcpu)
|
||||||
|
@ -2434,7 +2435,8 @@ static int kvm_set_tsc_khz(struct kvm_vcpu *vcpu, u32 user_tsc_khz)
|
||||||
thresh_lo = adjust_tsc_khz(tsc_khz, -tsc_tolerance_ppm);
|
thresh_lo = adjust_tsc_khz(tsc_khz, -tsc_tolerance_ppm);
|
||||||
thresh_hi = adjust_tsc_khz(tsc_khz, tsc_tolerance_ppm);
|
thresh_hi = adjust_tsc_khz(tsc_khz, tsc_tolerance_ppm);
|
||||||
if (user_tsc_khz < thresh_lo || user_tsc_khz > thresh_hi) {
|
if (user_tsc_khz < thresh_lo || user_tsc_khz > thresh_hi) {
|
||||||
pr_debug("kvm: requested TSC rate %u falls outside tolerance [%u,%u]\n", user_tsc_khz, thresh_lo, thresh_hi);
|
pr_debug("requested TSC rate %u falls outside tolerance [%u,%u]\n",
|
||||||
|
user_tsc_khz, thresh_lo, thresh_hi);
|
||||||
use_scaling = 1;
|
use_scaling = 1;
|
||||||
}
|
}
|
||||||
return set_tsc_khz(vcpu, user_tsc_khz, use_scaling);
|
return set_tsc_khz(vcpu, user_tsc_khz, use_scaling);
|
||||||
|
@ -7702,7 +7704,7 @@ static int emulator_cmpxchg_emulated(struct x86_emulate_ctxt *ctxt,
|
||||||
return X86EMUL_CONTINUE;
|
return X86EMUL_CONTINUE;
|
||||||
|
|
||||||
emul_write:
|
emul_write:
|
||||||
printk_once(KERN_WARNING "kvm: emulating exchange as write\n");
|
pr_warn_once("emulating exchange as write\n");
|
||||||
|
|
||||||
return emulator_write_emulated(ctxt, addr, new, bytes, exception);
|
return emulator_write_emulated(ctxt, addr, new, bytes, exception);
|
||||||
}
|
}
|
||||||
|
@ -8263,7 +8265,7 @@ static struct x86_emulate_ctxt *alloc_emulate_ctxt(struct kvm_vcpu *vcpu)
|
||||||
|
|
||||||
ctxt = kmem_cache_zalloc(x86_emulator_cache, GFP_KERNEL_ACCOUNT);
|
ctxt = kmem_cache_zalloc(x86_emulator_cache, GFP_KERNEL_ACCOUNT);
|
||||||
if (!ctxt) {
|
if (!ctxt) {
|
||||||
pr_err("kvm: failed to allocate vcpu's emulator\n");
|
pr_err("failed to allocate vcpu's emulator\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9324,17 +9326,17 @@ static int __kvm_x86_vendor_init(struct kvm_x86_init_ops *ops)
|
||||||
int r, cpu;
|
int r, cpu;
|
||||||
|
|
||||||
if (kvm_x86_ops.hardware_enable) {
|
if (kvm_x86_ops.hardware_enable) {
|
||||||
pr_err("kvm: already loaded vendor module '%s'\n", kvm_x86_ops.name);
|
pr_err("already loaded vendor module '%s'\n", kvm_x86_ops.name);
|
||||||
return -EEXIST;
|
return -EEXIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ops->cpu_has_kvm_support()) {
|
if (!ops->cpu_has_kvm_support()) {
|
||||||
pr_err_ratelimited("kvm: no hardware support for '%s'\n",
|
pr_err_ratelimited("no hardware support for '%s'\n",
|
||||||
ops->runtime_ops->name);
|
ops->runtime_ops->name);
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
}
|
}
|
||||||
if (ops->disabled_by_bios()) {
|
if (ops->disabled_by_bios()) {
|
||||||
pr_err_ratelimited("kvm: support for '%s' disabled by bios\n",
|
pr_err_ratelimited("support for '%s' disabled by bios\n",
|
||||||
ops->runtime_ops->name);
|
ops->runtime_ops->name);
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
}
|
}
|
||||||
|
@ -9345,7 +9347,7 @@ static int __kvm_x86_vendor_init(struct kvm_x86_init_ops *ops)
|
||||||
* vCPU's FPU state as a fxregs_state struct.
|
* vCPU's FPU state as a fxregs_state struct.
|
||||||
*/
|
*/
|
||||||
if (!boot_cpu_has(X86_FEATURE_FPU) || !boot_cpu_has(X86_FEATURE_FXSR)) {
|
if (!boot_cpu_has(X86_FEATURE_FPU) || !boot_cpu_has(X86_FEATURE_FXSR)) {
|
||||||
printk(KERN_ERR "kvm: inadequate fpu\n");
|
pr_err("inadequate fpu\n");
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9363,19 +9365,19 @@ static int __kvm_x86_vendor_init(struct kvm_x86_init_ops *ops)
|
||||||
*/
|
*/
|
||||||
if (rdmsrl_safe(MSR_IA32_CR_PAT, &host_pat) ||
|
if (rdmsrl_safe(MSR_IA32_CR_PAT, &host_pat) ||
|
||||||
(host_pat & GENMASK(2, 0)) != 6) {
|
(host_pat & GENMASK(2, 0)) != 6) {
|
||||||
pr_err("kvm: host PAT[0] is not WB\n");
|
pr_err("host PAT[0] is not WB\n");
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
x86_emulator_cache = kvm_alloc_emulator_cache();
|
x86_emulator_cache = kvm_alloc_emulator_cache();
|
||||||
if (!x86_emulator_cache) {
|
if (!x86_emulator_cache) {
|
||||||
pr_err("kvm: failed to allocate cache for x86 emulator\n");
|
pr_err("failed to allocate cache for x86 emulator\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
user_return_msrs = alloc_percpu(struct kvm_user_return_msrs);
|
user_return_msrs = alloc_percpu(struct kvm_user_return_msrs);
|
||||||
if (!user_return_msrs) {
|
if (!user_return_msrs) {
|
||||||
printk(KERN_ERR "kvm: failed to allocate percpu kvm_user_return_msrs\n");
|
pr_err("failed to allocate percpu kvm_user_return_msrs\n");
|
||||||
r = -ENOMEM;
|
r = -ENOMEM;
|
||||||
goto out_free_x86_emulator_cache;
|
goto out_free_x86_emulator_cache;
|
||||||
}
|
}
|
||||||
|
@ -11647,7 +11649,7 @@ static int sync_regs(struct kvm_vcpu *vcpu)
|
||||||
int kvm_arch_vcpu_precreate(struct kvm *kvm, unsigned int id)
|
int kvm_arch_vcpu_precreate(struct kvm *kvm, unsigned int id)
|
||||||
{
|
{
|
||||||
if (kvm_check_tsc_unstable() && kvm->created_vcpus)
|
if (kvm_check_tsc_unstable() && kvm->created_vcpus)
|
||||||
pr_warn_once("kvm: SMP vm created on host with unstable TSC; "
|
pr_warn_once("SMP vm created on host with unstable TSC; "
|
||||||
"guest TSC will not be reliable\n");
|
"guest TSC will not be reliable\n");
|
||||||
|
|
||||||
if (!kvm->arch.max_vcpu_ids)
|
if (!kvm->arch.max_vcpu_ids)
|
||||||
|
@ -11724,7 +11726,7 @@ int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu)
|
||||||
goto free_wbinvd_dirty_mask;
|
goto free_wbinvd_dirty_mask;
|
||||||
|
|
||||||
if (!fpu_alloc_guest_fpstate(&vcpu->arch.guest_fpu)) {
|
if (!fpu_alloc_guest_fpstate(&vcpu->arch.guest_fpu)) {
|
||||||
pr_err("kvm: failed to allocate vcpu's fpu\n");
|
pr_err("failed to allocate vcpu's fpu\n");
|
||||||
goto free_emulate_ctxt;
|
goto free_emulate_ctxt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
*
|
*
|
||||||
* KVM Xen emulation
|
* KVM Xen emulation
|
||||||
*/
|
*/
|
||||||
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||||
|
|
||||||
#include "x86.h"
|
#include "x86.h"
|
||||||
#include "xen.h"
|
#include "xen.h"
|
||||||
|
|
|
@ -60,7 +60,7 @@ struct arch_timer_cpu {
|
||||||
bool enabled;
|
bool enabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
int kvm_timer_hyp_init(bool);
|
int __init kvm_timer_hyp_init(bool has_gic);
|
||||||
int kvm_timer_enable(struct kvm_vcpu *vcpu);
|
int kvm_timer_enable(struct kvm_vcpu *vcpu);
|
||||||
int kvm_timer_vcpu_reset(struct kvm_vcpu *vcpu);
|
int kvm_timer_vcpu_reset(struct kvm_vcpu *vcpu);
|
||||||
void kvm_timer_vcpu_init(struct kvm_vcpu *vcpu);
|
void kvm_timer_vcpu_init(struct kvm_vcpu *vcpu);
|
||||||
|
|
Loading…
Reference in New Issue