KVM: x86: Unify pr_fmt to use module name for all KVM modules
authorSean Christopherson <seanjc@google.com>
Wed, 30 Nov 2022 23:09:18 +0000 (23:09 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 29 Dec 2022 20:47:35 +0000 (15:47 -0500)
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>
46 files changed:
arch/arm64/include/asm/kvm_host.h
arch/arm64/include/asm/kvm_mmu.h
arch/arm64/kvm/arch_timer.c
arch/arm64/kvm/mmu.c
arch/arm64/kvm/reset.c
arch/arm64/kvm/sys_regs.c
arch/arm64/kvm/vmid.c
arch/x86/kvm/cpuid.c
arch/x86/kvm/debugfs.c
arch/x86/kvm/emulate.c
arch/x86/kvm/hyperv.c
arch/x86/kvm/i8254.c
arch/x86/kvm/i8259.c
arch/x86/kvm/ioapic.c
arch/x86/kvm/irq.c
arch/x86/kvm/irq_comm.c
arch/x86/kvm/kvm_onhyperv.c
arch/x86/kvm/lapic.c
arch/x86/kvm/mmu/mmu.c
arch/x86/kvm/mmu/page_track.c
arch/x86/kvm/mmu/spte.c
arch/x86/kvm/mmu/spte.h
arch/x86/kvm/mmu/tdp_iter.c
arch/x86/kvm/mmu/tdp_mmu.c
arch/x86/kvm/mtrr.c
arch/x86/kvm/pmu.c
arch/x86/kvm/smm.c
arch/x86/kvm/svm/avic.c
arch/x86/kvm/svm/nested.c
arch/x86/kvm/svm/pmu.c
arch/x86/kvm/svm/sev.c
arch/x86/kvm/svm/svm.c
arch/x86/kvm/svm/svm_onhyperv.c
arch/x86/kvm/svm/svm_onhyperv.h
arch/x86/kvm/vmx/hyperv.c
arch/x86/kvm/vmx/hyperv.h
arch/x86/kvm/vmx/nested.c
arch/x86/kvm/vmx/pmu_intel.c
arch/x86/kvm/vmx/posted_intr.c
arch/x86/kvm/vmx/sgx.c
arch/x86/kvm/vmx/vmcs12.c
arch/x86/kvm/vmx/vmx.c
arch/x86/kvm/vmx/vmx_ops.h
arch/x86/kvm/x86.c
arch/x86/kvm/xen.c
include/kvm/arm_arch_timer.h

index f50951c51d3bae67a89e78578a6452a4c19c8d68..113e20fdbb56bed82b5db0aa2a4a10fc5f3137a6 100644 (file)
@@ -66,8 +66,8 @@ enum kvm_mode kvm_get_mode(void);
 
 DECLARE_STATIC_KEY_FALSE(userspace_irqchip_in_use);
 
-extern unsigned int kvm_sve_max_vl;
-int kvm_arm_init_sve(void);
+extern unsigned int __ro_after_init kvm_sve_max_vl;
+int __init kvm_arm_init_sve(void);
 
 u32 __attribute_const__ kvm_target_cpu(void);
 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);
 
-int kvm_sys_reg_table_init(void);
+int __init kvm_sys_reg_table_init(void);
 
 /* MMIO helpers */
 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,
                            struct kvm_device_attr *attr);
 
-extern unsigned int kvm_arm_vmid_bits;
-int kvm_arm_vmid_alloc_init(void);
-void kvm_arm_vmid_alloc_free(void);
+extern unsigned int __ro_after_init kvm_arm_vmid_bits;
+int __init kvm_arm_vmid_alloc_init(void);
+void __init kvm_arm_vmid_alloc_free(void);
 void kvm_arm_vmid_update(struct kvm_vmid *kvm_vmid);
 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_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
 struct kvm *kvm_arch_alloc_vm(void);
index e4a7e636949983e7331289ba519c6fefcb594cca..7f7c1231679e284530e8c370f5d73064ce2f1b6a 100644 (file)
@@ -163,7 +163,7 @@ int create_hyp_io_mappings(phys_addr_t phys_addr, size_t size,
                           void __iomem **haddr);
 int create_hyp_exec_mappings(phys_addr_t phys_addr, size_t size,
                             void **haddr);
-void free_hyp_pgds(void);
+void __init free_hyp_pgds(void);
 
 void stage2_unmap_vm(struct kvm *kvm);
 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_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,
                                           enum arm64_hyp_spectre_vector slot)
index 33fca1a691a53c7382015bd6cbd34e02c152da67..23346585a29429d8dd1ab92b40d618460b738c1b 100644 (file)
@@ -1113,7 +1113,7 @@ static int kvm_irq_init(struct arch_timer_kvm_info *info)
        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;
        int err;
index 31d7fa4c7c140513f6b69034cafd5f23a8a88567..d6c41043b5afb608398c18389a5f5172408558ee 100644 (file)
 static struct kvm_pgtable *hyp_pgtable;
 static DEFINE_MUTEX(kvm_hyp_pgd_mutex);
 
-static unsigned long hyp_idmap_start;
-static unsigned long hyp_idmap_end;
-static phys_addr_t hyp_idmap_vector;
+static unsigned long __ro_after_init hyp_idmap_start;
+static unsigned long __ro_after_init hyp_idmap_end;
+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)
 {
@@ -280,7 +280,7 @@ static void stage2_flush_vm(struct kvm *kvm)
 /**
  * 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);
        if (hyp_pgtable) {
@@ -1665,7 +1665,7 @@ static struct kvm_pgtable_mm_ops kvm_hyp_mm_ops = {
        .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;
        u32 idmap_bits;
index e0267f672b8abec1e72bdf80c7d1abb37518ad33..2bc74739a6df42387598e02b9b31ce4933b1a9e8 100644 (file)
@@ -30,7 +30,7 @@
 #include <asm/virt.h>
 
 /* 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
@@ -41,9 +41,9 @@ static u32 kvm_ipa_limit;
 #define VCPU_RESET_PSTATE_SVC  (PSR_AA32_MODE_SVC | PSR_AA32_A_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()) {
                kvm_sve_max_vl = sve_max_virtualisable_vl();
@@ -352,7 +352,7 @@ u32 get_kvm_ipa_limit(void)
        return kvm_ipa_limit;
 }
 
-int kvm_set_ipa_limit(void)
+int __init kvm_set_ipa_limit(void)
 {
        unsigned int parange;
        u64 mmfr0;
index d5ee52d6bf7326f9254298631ef2fc0824c0e176..1225e9faac0653504503c7e795f33660ab421af1 100644 (file)
@@ -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 */
-static u32 cache_levels;
+static u32 __ro_after_init cache_levels;
 
 /* CSSELR values; used to index KVM_REG_ARM_DEMUX_ID_CCSIDR */
 #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() */
-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_REVIDR_EL1), NULL, get_revidr_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);
 }
 
-int kvm_sys_reg_table_init(void)
+int __init kvm_sys_reg_table_init(void)
 {
        bool valid = true;
        unsigned int i;
index d78ae63d7c15f802c3d4796d56daa5e6bde319c2..08978d0672e7e947b0afbca0eb7d5ae0d9be440a 100644 (file)
@@ -16,7 +16,7 @@
 #include <asm/kvm_asm.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 atomic64_t vmid_generation;
@@ -172,7 +172,7 @@ void kvm_arm_vmid_update(struct kvm_vmid *kvm_vmid)
 /*
  * 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();
 
@@ -190,7 +190,7 @@ int kvm_arm_vmid_alloc_init(void)
        return 0;
 }
 
-void kvm_arm_vmid_alloc_free(void)
+void __init kvm_arm_vmid_alloc_free(void)
 {
        kfree(vmid_map);
 }
index 69768e4d53a641716f4075a4de906a68423518a9..4ca16b18a0862782913f8d9c1c79cc686778454c 100644 (file)
@@ -8,6 +8,7 @@
  * Copyright 2011 Red Hat, Inc. and/or its affiliates.
  * Copyright IBM Corporation, 2008
  */
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/kvm_host.h>
 #include <linux/export.h>
index c1390357126ab4668f04087e09a039e7fbf6d987..ee8c4c3496edd050d651f0f1d1863f2c569b040e 100644 (file)
@@ -4,6 +4,8 @@
  *
  * Copyright 2016 Red Hat, Inc. and/or its affiliates.
  */
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/kvm_host.h>
 #include <linux/debugfs.h>
 #include "lapic.h"
index 5cc3efa0e21c17632de33946955bd9a9a6a72238..c3443045cd930992d821411e00038de8a16bb18d 100644 (file)
@@ -17,6 +17,7 @@
  *
  * From: xen-unstable 10676:af9809f51f81a3c43f276f00c81a52ef558afda4
  */
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/kvm_host.h>
 #include "kvm_cache_regs.h"
index 80d082ecd5c57848152642f14521aec02b2baafd..71aff0edc0ed3d947e84c9d469ef868c802d232e 100644 (file)
@@ -17,6 +17,7 @@
  *   Ben-Ami Yassour <benami@il.ibm.com>
  *   Andrey Smetanin <asmetanin@virtuozzo.com>
  */
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include "x86.h"
 #include "lapic.h"
index e0a7a0e7a73c9afd89a3e57660acf2ae83b1beae..cd57a517d04a736df10bae69f8423504750251b2 100644 (file)
@@ -30,7 +30,7 @@
  *   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/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) {
                        pr_info_ratelimited(
-                           "kvm: requested %lld ns "
+                           "requested %lld ns "
                            "i8254 timer period limited to %lld ns\n",
                            ps->period, min_period);
                        ps->period = min_period;
index e1bb6218bb96c35e1ba775aa18ec5b3b2276d32a..4756bcb5724f863fab17474b7d7acbd145077d24 100644 (file)
@@ -26,6 +26,8 @@
  *   Yaozu (Eddie) Dong <Eddie.dong@intel.com>
  *   Port from Qemu.
  */
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/mm.h>
 #include <linux/slab.h>
 #include <linux/bitops.h>
@@ -35,7 +37,7 @@
 #include "trace.h"
 
 #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);
 
index 765943d7cfa562264808a50e31fe411beda56fe5..042dee5561258f166f289276be3376d6130c4a0c 100644 (file)
@@ -26,6 +26,7 @@
  *  Yaozu (Eddie) Dong <eddie.dong@intel.com>
  *  Based on Xen 3.1 code.
  */
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/kvm_host.h>
 #include <linux/kvm.h>
index a70952eca9058196e1bd0b49f2c10be76637dd2b..b2c397dd2bc6620c54f045e7d503a326fedf81b4 100644 (file)
@@ -7,6 +7,7 @@
  * Authors:
  *   Yaozu (Eddie) Dong <Eddie.dong@intel.com>
  */
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/export.h>
 #include <linux/kvm_host.h>
index 3742d9adacfc1a7b01b2b0f5431953ba16fb43ca..16d076a1b91acc65aed41eed3536bad1744a8a1f 100644 (file)
@@ -8,6 +8,7 @@
  *
  * Copyright 2010 Red Hat, Inc. and/or its affiliates.
  */
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/kvm_host.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 &&
            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;
        }
 
@@ -199,7 +200,7 @@ int kvm_request_irq_source_id(struct kvm *kvm)
        irq_source_id = find_first_zero_bit(bitmap, 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;
                goto unlock;
        }
@@ -221,7 +222,7 @@ void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id)
        mutex_lock(&kvm->irq_lock);
        if (irq_source_id < 0 ||
            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;
        }
        clear_bit(irq_source_id, &kvm->arch.irq_sources_bitmap);
index ee4f696a0782d516a1727977d9b8038385fa9d52..482d6639ef8894d089770aecfc2a63b77ad499ea 100644 (file)
@@ -2,6 +2,7 @@
 /*
  * KVM L1 hypervisor optimizations on Hyper-V.
  */
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/kvm_host.h>
 #include <asm/mshyperv.h>
index 4efdb4a4d72c6084f67f00ce8ae06292f68532e6..cfaf1d8c64ca902330fbccf3ed318c5f646960d6 100644 (file)
@@ -15,6 +15,7 @@
  *
  * 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.h>
@@ -941,8 +942,7 @@ static void kvm_apic_disabled_lapic_found(struct kvm *kvm)
 {
        if (!kvm->arch.disabled_lapic_found) {
                kvm->arch.disabled_lapic_found = true;
-               printk(KERN_INFO
-                      "Disabled LAPIC found during irq injection\n");
+               pr_info("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) {
                        pr_info_ratelimited(
-                           "kvm: vcpu %i: requested %lld ns "
+                           "vcpu %i: requested %lld ns "
                            "lapic timer period limited to %lld ns\n",
                            apic->vcpu->vcpu_id,
                            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;
                        else if (unlikely(deadline > apic->lapic_timer.period)) {
                                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). "
                                    "Using initial count to start timer.\n",
                                    apic->vcpu->vcpu_id,
index 9c7198544195a3733a8caa253a51fd691e0fafc3..aeb240b339f5488d6e79978a8df0100276d1f811 100644 (file)
@@ -14,6 +14,7 @@
  *   Yaniv Kamay  <yaniv@qumranet.com>
  *   Avi Kivity   <avi@qumranet.com>
  */
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include "irq.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) {
-                       printk_once(KERN_WARNING
-                               "kvm: Fast #PF retrying more than 4 times.\n");
+                       pr_warn_once("Fast #PF retrying more than 4 times.\n");
                        break;
                }
 
@@ -6647,7 +6647,7 @@ void kvm_mmu_invalidate_mmio_sptes(struct kvm *kvm, u64 gen)
         * zap all shadow pages.
         */
        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);
        }
 }
index 2e09d1b6249f319f3e3f7e4aa8e4dcfb92457a7c..0a2ac438d6471fe05acf646707ba02ce2b62751f 100644 (file)
@@ -10,6 +10,7 @@
  * Author:
  *   Xiao Guangrong <guangrong.xiao@linux.intel.com>
  */
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/kvm_host.h>
 #include <linux/rculist.h>
index c0fd7e049b4e4b5406e0dbbfbcfa79b3078bd774..fce6f047399fb4aee2a9f28be6fb85eb2f4ebb1d 100644 (file)
@@ -7,7 +7,7 @@
  * Copyright (C) 2006 Qumranet, Inc.
  * Copyright 2020 Red Hat, Inc. and/or its affiliates.
  */
-
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/kvm_host.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 <<
                          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) <<
                SHADOW_ACC_TRACK_SAVED_BITS_SHIFT;
index 6f54dc9409c943f7d148400bbb498185e061cc3e..0d8deefee66ce46938908ee5dafa71448969d50f 100644 (file)
@@ -435,11 +435,11 @@ static inline void check_spte_writable_invariants(u64 spte)
 {
        if (spte & shadow_mmu_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);
        else
                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)
index 39b48e7d7d1a8f825f8915b62f8b3c4f31e1387d..e26e744df1d12b4f353ea6d5a7244d6f523596de 100644 (file)
@@ -1,4 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include "mmu_internal.h"
 #include "tdp_iter.h"
index cc1fb9a65620152249c79cbf1770602a209b1e66..bba33aea0fb00e97660127dc750bac82c2d2ea8d 100644 (file)
@@ -1,4 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include "mmu.h"
 #include "mmu_internal.h"
index a8502e02f47935b983cdbb2b03af400189bcf11e..9fac1ec0346335974fa1fadf0e11f58b3c2bf323 100644 (file)
@@ -13,6 +13,7 @@
  *   Paolo Bonzini <pbonzini@redhat.com>
  *   Xiao Guangrong <guangrong.xiao@linux.intel.com>
  */
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/kvm_host.h>
 #include <asm/mtrr.h>
index eb594620dd75a1f7fe46190d782f80865a6c4dde..d939d3b84e6f3108ccd6cd7d54cb7a0e3ef1a551 100644 (file)
@@ -9,6 +9,7 @@
  *   Gleb Natapov <gleb@redhat.com>
  *   Wei Huang    <wei@redhat.com>
  */
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/types.h>
 #include <linux/kvm_host.h>
index a9c1c2af8d94c21406cb18916bfea52c0f8fc647..cc43638d48a3aff9e578b46c7c547dd9cb172ce9 100644 (file)
@@ -1,4 +1,5 @@
 /* SPDX-License-Identifier: GPL-2.0 */
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/kvm_host.h>
 #include "x86.h"
index 6919dee69f182409701c8ac9fdc20af72f1e058b..f52f5e0dd4658fc15ad430d9e4a9953f2c8f99d3 100644 (file)
@@ -12,7 +12,7 @@
  *   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/hashtable.h>
index bc9cd7086fa972a8c9dd0600f7316278da4029ec..3bfbcb607d807752454f350045174aece64bbc9e 100644 (file)
@@ -12,7 +12,7 @@
  *   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_host.h>
index 0e313fbae0556bab9a16f6246fbcab2e6e639085..1ff068f238412f40ed32cc6e574efc562f472ae3 100644 (file)
@@ -9,6 +9,8 @@
  *
  * Implementation is based on pmu_intel.c file
  */
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/types.h>
 #include <linux/kvm_host.h>
 #include <linux/perf_event.h>
index 86d6897f480684c272a3026e6e9efd7f83cc8464..273cba809328d9f454da23c14970fd7498892b95 100644 (file)
@@ -6,6 +6,7 @@
  *
  * Copyright 2010 Red Hat, Inc. and/or its affiliates.
  */
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/kvm_types.h>
 #include <linux/kvm_host.h>
index 2bb62c3db3b3556aa2fd85e52f181a5c102dd263..f7192a14fc8995f0901346d0900d6fcbabd88646 100644 (file)
@@ -1,4 +1,4 @@
-#define pr_fmt(fmt) "SVM: " fmt
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #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
                 * 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);
 
@@ -4629,7 +4629,7 @@ static bool svm_can_emulate_instruction(struct kvm_vcpu *vcpu, int emul_type,
        smap = cr4 & X86_CR4_SMAP;
        is_user = svm_get_cpl(vcpu) == 3;
        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
@@ -4978,7 +4978,7 @@ static __init int svm_hardware_setup(void)
        }
 
        if (nested) {
-               printk(KERN_INFO "kvm: Nested Virtualization enabled\n");
+               pr_info("Nested Virtualization enabled\n");
                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 */
        kvm_configure_mmu(npt_enabled, get_npt_level(),
                          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 */
        kvm_mmu_set_me_spte_mask(sme_me_mask, sme_me_mask);
index 26a89d0da93e46ba33f2b36164c2e1f751243fa3..7af8422d3382101321cc88c4402dbfa83cb24990 100644 (file)
@@ -2,6 +2,7 @@
 /*
  * KVM L1 hypervisor optimizations on Hyper-V for SVM.
  */
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/kvm_host.h>
 
index 45faf84476cecf5d468ea4937c3e2d147874605b..6981c1e9a809597760cd28592861f008edad2eda 100644 (file)
@@ -34,7 +34,7 @@ static inline void svm_hv_hardware_setup(void)
 {
        if (npt_enabled &&
            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_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) {
                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) {
                        struct hv_vp_assist_page *vp_ap =
                                hv_get_vp_assist_page(cpu);
index f773450fba6e5dac23ec634a117504ad2fed1f23..2a26a0f27d489ceeb84e9dd67988f515638a8322 100644 (file)
@@ -1,6 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
-
-#define pr_fmt(fmt) "kvm/hyper-v: " fmt
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/errno.h>
 #include <linux/smp.h>
index 883102d567c38ebd593d75dd19209315c33bba43..e036929584085781bab397b7cf32203aa9dccf37 100644 (file)
@@ -179,9 +179,7 @@ static __always_inline int get_evmcs_offset(unsigned long field,
 {
        int offset = evmcs_field_offset(field, clean_field);
 
-       WARN_ONCE(offset < 0, "KVM: accessing unsupported EVMCS field %lx\n",
-                 field);
-
+       WARN_ONCE(offset < 0, "accessing unsupported EVMCS field %lx\n", field);
        return offset;
 }
 
index d93c715cda6ab3002d933f6b7111375f03d4fbd5..557b9c4687346b70d6abecc79b74e2927199d399 100644 (file)
@@ -1,4 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/objtool.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. */
        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)
index e5cec07ca8d9574d86793806675f3a26ab23767c..efce9ad70e4e9db43fe6ad595197912e3e53603b 100644 (file)
@@ -8,6 +8,8 @@
  *   Avi Kivity   <avi@redhat.com>
  *   Gleb Natapov <gleb@redhat.com>
  */
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/types.h>
 #include <linux/kvm_host.h>
 #include <linux/perf_event.h>
@@ -762,8 +764,7 @@ void vmx_passthrough_lbr_msrs(struct kvm_vcpu *vcpu)
        return;
 
 warn:
-       pr_warn_ratelimited("kvm: vcpu-%d: fail to passthrough LBR.\n",
-               vcpu->vcpu_id);
+       pr_warn_ratelimited("vcpu-%d: fail to passthrough LBR.\n", vcpu->vcpu_id);
 }
 
 static void intel_pmu_cleanup(struct kvm_vcpu *vcpu)
index 1b56c5e5c9fb3b5f3c86d3b18d8e06bf6080a4d7..94c38bea60e78434c4957cc62db60b8ed13322c2 100644 (file)
@@ -1,4 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/kvm_host.h>
 
 #include <asm/irq_remapping.h>
index b12da2a6dec95644941c67200c242fb2982b0742..aa53c98034bfc8ef08e2229b3e3634414e5a73cd 100644 (file)
@@ -1,5 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 /*  Copyright(c) 2021 Intel Corporation. */
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <asm/sgx.h>
 
@@ -164,7 +165,7 @@ static int __handle_encls_ecreate(struct kvm_vcpu *vcpu,
        if (!vcpu->kvm->arch.sgx_provisioning_allowed &&
            (attributes & 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);
                return 1;
        }
@@ -381,7 +382,7 @@ int handle_encls(struct kvm_vcpu *vcpu)
                        return handle_encls_ecreate(vcpu);
                if (leaf == EINIT)
                        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->hw.hardware_exit_reason = EXIT_REASON_ENCLS;
                return 0;
index 2251b60920f81535131e9e973cc5e262b87f528a..106a72c923ca9e089a93f7c08f613c976be9a69b 100644 (file)
@@ -1,4 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include "vmcs12.h"
 
index daab447d311c21592fa3ad89444570941e8ca719..58eb4dbf64a39b5f79a2de376c3a2d33d9bebfa7 100644 (file)
@@ -12,6 +12,7 @@
  *   Avi Kivity   <avi@qumranet.com>
  *   Yaniv Kamay  <yaniv@qumranet.com>
  */
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/highmem.h>
 #include <linux/hrtimer.h>
@@ -444,36 +445,36 @@ void vmread_error(unsigned long field, bool fault)
        if (fault)
                kvm_spurious_fault();
        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)
 {
-       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));
 }
 
 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));
 }
 
 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));
 }
 
 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);
 }
 
 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);
 }
 
@@ -577,7 +578,7 @@ static __init void hv_init_evmcs(void)
                }
 
                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);
                }
 
@@ -1680,8 +1681,8 @@ static int skip_emulated_instruction(struct kvm_vcpu *vcpu)
                if (!instr_len)
                        goto rip_updated;
 
-               WARN(exit_reason.enclave_mode,
-                    "KVM: skipping instruction after SGX enclave VM-Exit");
+               WARN_ONCE(exit_reason.enclave_mode,
+                         "skipping instruction after SGX enclave VM-Exit");
 
                orig_rip = kvm_rip_read(vcpu);
                rip = orig_rip + instr_len;
@@ -3024,9 +3025,8 @@ static void fix_rmode_seg(int seg, struct kvm_segment *save)
                var.type = 0x3;
                var.avl = 0;
                if (save->base & 0xf)
-                       printk_once(KERN_WARNING "kvm: segment base is not "
-                                       "paragraph aligned when entering "
-                                       "protected mode (seg=%d)", seg);
+                       pr_warn_once("segment base is not paragraph aligned "
+                                    "when entering protected mode (seg=%d)", seg);
        }
 
        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.
         */
        if (!kvm_vmx->tss_addr)
-               printk_once(KERN_WARNING "kvm: KVM_SET_TSS_ADDR need to be "
-                            "called before entering vcpu\n");
+               pr_warn_once("KVM_SET_TSS_ADDR needs to be called before running vCPU\n");
 
        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;
 
        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;
 
        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) ||
            !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;
        }
 
@@ -7539,8 +7538,7 @@ static int __init vmx_check_processor_compat(void)
        if (nested)
                nested_vmx_setup_ctls_msrs(&vmcs_conf, vmx_cap.ept);
        if (memcmp(&vmcs_config, &vmcs_conf, sizeof(struct vmcs_config)) != 0) {
-               printk(KERN_ERR "kvm: CPU %d feature inconsistency!\n",
-                               smp_processor_id());
+               pr_err("CPU %d feature inconsistency!\n", smp_processor_id());
                return -EIO;
        }
        return 0;
@@ -8365,7 +8363,7 @@ static __init int hardware_setup(void)
                return -EIO;
 
        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");
 
        if (boot_cpu_has(X86_FEATURE_NX))
@@ -8373,7 +8371,7 @@ static __init int hardware_setup(void)
 
        if (boot_cpu_has(X86_FEATURE_MPX)) {
                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())
@@ -8392,7 +8390,7 @@ static __init int hardware_setup(void)
 
        /* NX support is required for shadow paging. */
        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;
        }
 
index 842dc898c972876067bc8de27f5eef3cf506a7c9..a5282014616c32b65396d011148f5bc7b7e3c277 100644 (file)
@@ -100,8 +100,8 @@ static __always_inline unsigned long __vmcs_readl(unsigned long field)
        return value;
 
 do_fail:
-       WARN_ONCE(1, "kvm: vmread failed: field=%lx\n", field);
-       pr_warn_ratelimited("kvm: vmread failed: field=%lx\n", field);
+       WARN_ONCE(1, KBUILD_MODNAME ": vmread failed: field=%lx\n", field);
+       pr_warn_ratelimited(KBUILD_MODNAME ": vmread failed: field=%lx\n", field);
        return 0;
 
 do_exception:
index 17cbd17c90779ff6546568901ec77a16afc235a6..4c40bbec372ab0cd73166ee1cc313c9b8e9267e2 100644 (file)
@@ -15,6 +15,7 @@
  *   Amit Shah    <amit.shah@qumranet.com>
  *   Ben-Ami Yassour <benami@il.ibm.com>
  */
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/kvm_host.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))
                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);
 }
 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_hi = adjust_tsc_khz(tsc_khz, tsc_tolerance_ppm);
        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;
        }
        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;
 
 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);
 }
@@ -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);
        if (!ctxt) {
-               pr_err("kvm: failed to allocate vcpu's emulator\n");
+               pr_err("failed to allocate vcpu's emulator\n");
                return NULL;
        }
 
@@ -9324,17 +9326,17 @@ static int __kvm_x86_vendor_init(struct kvm_x86_init_ops *ops)
        int r, cpu;
 
        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;
        }
 
        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);
                return -EOPNOTSUPP;
        }
        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);
                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.
         */
        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;
        }
 
@@ -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) ||
            (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;
        }
 
        x86_emulator_cache = kvm_alloc_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;
        }
 
        user_return_msrs = alloc_percpu(struct kvm_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;
                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)
 {
        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");
 
        if (!kvm->arch.max_vcpu_ids)
@@ -11724,7 +11726,7 @@ int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu)
                goto free_wbinvd_dirty_mask;
 
        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;
        }
 
index 2e29bdc2949ca9fd456eb83993bd200c93c280cf..0bd5d171df57821cc95887b9ebf552485b0640ce 100644 (file)
@@ -5,6 +5,7 @@
  *
  * KVM Xen emulation
  */
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include "x86.h"
 #include "xen.h"
index 1638418f72dd9b55e0c7ef7616613ade6c1c7c8d..71916de7c6c4de30259b77a2b723e4947128b2fa 100644 (file)
@@ -60,7 +60,7 @@ struct arch_timer_cpu {
        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_vcpu_reset(struct kvm_vcpu *vcpu);
 void kvm_timer_vcpu_init(struct kvm_vcpu *vcpu);