diff options
Diffstat (limited to 'virt')
| -rw-r--r-- | virt/kvm/Kconfig | 18 | ||||
| -rw-r--r-- | virt/kvm/Makefile.kvm | 9 | ||||
| -rw-r--r-- | virt/kvm/async_pf.c | 5 | ||||
| -rw-r--r-- | virt/kvm/coalesced_mmio.c | 4 | ||||
| -rw-r--r-- | virt/kvm/coalesced_mmio.h | 2 | ||||
| -rw-r--r-- | virt/kvm/eventfd.c | 3 | ||||
| -rw-r--r-- | virt/kvm/kvm_main.c | 44 |
7 files changed, 41 insertions, 44 deletions
diff --git a/virt/kvm/Kconfig b/virt/kvm/Kconfig index a0678ef8ee3f..c5bfaa1f7749 100644 --- a/virt/kvm/Kconfig +++ b/virt/kvm/Kconfig @@ -40,9 +40,6 @@ config NEED_KVM_DIRTY_RING_WITH_BITMAP bool depends on HAVE_KVM_DIRTY_RING -config KVM_MMIO - bool - config KVM_ASYNC_PF bool @@ -50,21 +47,12 @@ config KVM_ASYNC_PF config KVM_ASYNC_PF_SYNC bool -config HAVE_KVM_MSI - bool - -config HAVE_KVM_READONLY_MEM - bool - config HAVE_KVM_CPU_RELAX_INTERCEPT bool config KVM_VFIO bool -config HAVE_KVM_INVALID_WAKEUPS - bool - config KVM_GENERIC_DIRTYLOG_READ_PROTECT bool @@ -79,12 +67,6 @@ config HAVE_KVM_IRQ_BYPASS tristate select IRQ_BYPASS_MANAGER -config HAVE_KVM_VCPU_RUN_PID_CHANGE - bool - -config HAVE_KVM_NO_POLL - bool - config VIRT_XFER_TO_GUEST_WORK bool diff --git a/virt/kvm/Makefile.kvm b/virt/kvm/Makefile.kvm index d047d4cf58c9..ec7da5942354 100644 --- a/virt/kvm/Makefile.kvm +++ b/virt/kvm/Makefile.kvm @@ -5,9 +5,14 @@ KVM ?= ../../../virt/kvm -kvm-y := $(KVM)/kvm_main.o $(KVM)/eventfd.o $(KVM)/binary_stats.o +KVM_DEV_NAME ?= kvm +KVM_DEV_MINOR ?= KVM_MINOR + +ccflags-y +=-DKVM_DEV_NAME=$(KVM_DEV_NAME) -DKVM_DEV_MINOR=$(KVM_DEV_MINOR) + +kvm-y := $(KVM)/kvm_main.o $(KVM)/eventfd.o $(KVM)/binary_stats.o \ + $(KVM)/coalesced_mmio.o kvm-$(CONFIG_KVM_VFIO) += $(KVM)/vfio.o -kvm-$(CONFIG_KVM_MMIO) += $(KVM)/coalesced_mmio.o kvm-$(CONFIG_KVM_ASYNC_PF) += $(KVM)/async_pf.o kvm-$(CONFIG_HAVE_KVM_IRQ_ROUTING) += $(KVM)/irqchip.o kvm-$(CONFIG_HAVE_KVM_DIRTY_RING) += $(KVM)/dirty_ring.o diff --git a/virt/kvm/async_pf.c b/virt/kvm/async_pf.c index b8aaa96b799b..6b3b6353cb9d 100644 --- a/virt/kvm/async_pf.c +++ b/virt/kvm/async_pf.c @@ -21,7 +21,10 @@ static struct kmem_cache *async_pf_cache; int kvm_async_pf_init(void) { - async_pf_cache = KMEM_CACHE(kvm_async_pf, 0); + async_pf_cache = kmem_cache_create(KVM_DEV_STRING(async_pf), + sizeof(struct kvm_async_pf), + __alignof__(struct kvm_async_pf), + 0, NULL); if (!async_pf_cache) return -ENOMEM; diff --git a/virt/kvm/coalesced_mmio.c b/virt/kvm/coalesced_mmio.c index 6b1d90161099..3b5430036cae 100644 --- a/virt/kvm/coalesced_mmio.c +++ b/virt/kvm/coalesced_mmio.c @@ -15,6 +15,8 @@ #include <linux/slab.h> #include <linux/kvm.h> +#ifndef __KVM_NO_MMIO + #include "coalesced_mmio.h" static inline struct kvm_coalesced_mmio_dev *to_mmio(struct kvm_io_device *dev) @@ -188,3 +190,5 @@ int kvm_vm_ioctl_unregister_coalesced_mmio(struct kvm *kvm, */ return 0; } + +#endif /* !__KVM_NO_MMIO */ diff --git a/virt/kvm/coalesced_mmio.h b/virt/kvm/coalesced_mmio.h index 36f84264ed25..77b811dee27c 100644 --- a/virt/kvm/coalesced_mmio.h +++ b/virt/kvm/coalesced_mmio.h @@ -11,7 +11,7 @@ * */ -#ifdef CONFIG_KVM_MMIO +#ifndef __KVM_NO_MMIO #include <linux/list.h> diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c index 93ad2ebc963f..f43b8b25bc85 100644 --- a/virt/kvm/eventfd.c +++ b/virt/kvm/eventfd.c @@ -711,7 +711,8 @@ bool kvm_notify_irqfd_resampler(struct kvm *kvm, */ int kvm_irqfd_init(void) { - irqfd_cleanup_wq = alloc_workqueue("kvm-irqfd-cleanup", WQ_PERCPU, 0); + irqfd_cleanup_wq = alloc_workqueue(__stringify(KVM_DEV_NAME) "-irqfd-cleanup", + WQ_PERCPU, 0); if (!irqfd_cleanup_wq) return -ENOMEM; diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 415cc5f2a16e..a97aa5b92616 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -10,6 +10,8 @@ * Yaniv Kamay <yaniv@qumranet.com> */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <kvm/iodev.h> #include <linux/kvm_host.h> @@ -1031,7 +1033,7 @@ static int kvm_create_vm_debugfs(struct kvm *kvm, const char *fdname) mutex_lock(&kvm_debugfs_lock); dent = debugfs_lookup(dir_name, kvm_debugfs_dir); if (dent) { - pr_warn_ratelimited("KVM: debugfs: duplicate directory %s\n", dir_name); + pr_warn_ratelimited("debugfs: duplicate directory %s\n", dir_name); dput(dent); mutex_unlock(&kvm_debugfs_lock); return 0; @@ -4153,7 +4155,7 @@ static vm_fault_t kvm_vcpu_fault(struct vm_fault *vmf) else if (vmf->pgoff == KVM_PIO_PAGE_OFFSET) page = virt_to_page(vcpu->arch.pio_data); #endif -#ifdef CONFIG_KVM_MMIO +#ifndef __KVM_NO_MMIO else if (vmf->pgoff == KVM_COALESCED_MMIO_PAGE_OFFSET) page = virt_to_page(vcpu->kvm->coalesced_mmio_ring); #endif @@ -4207,9 +4209,9 @@ static struct file_operations kvm_vcpu_fops = { */ static int create_vcpu_fd(struct kvm_vcpu *vcpu) { - char name[8 + 1 + ITOA_MAX_LEN + 1]; + char name[sizeof(__stringify(KVM_DEV_NAME) "-vcpu:") + ITOA_MAX_LEN + 1]; - snprintf(name, sizeof(name), "kvm-vcpu:%d", vcpu->vcpu_id); + snprintf(name, sizeof(name), __stringify(KVM_DEV_NAME) "-vcpu:%d", vcpu->vcpu_id); return anon_inode_getfd(name, &kvm_vcpu_fops, vcpu, O_RDWR | O_CLOEXEC); } @@ -4403,9 +4405,9 @@ static int kvm_vcpu_ioctl_get_stats_fd(struct kvm_vcpu *vcpu) { int fd; struct file *file; - char name[15 + ITOA_MAX_LEN + 1]; + char name[sizeof(__stringify(KVM_DEV_NAME) "-vcpu-stats:") + ITOA_MAX_LEN + 1]; - snprintf(name, sizeof(name), "kvm-vcpu-stats:%d", vcpu->vcpu_id); + snprintf(name, sizeof(name), __stringify(KVM_DEV_NAME) "-vcpu-stats:%d", vcpu->vcpu_id); fd = get_unused_fd_flags(O_CLOEXEC); if (fd < 0) @@ -4972,7 +4974,7 @@ static int kvm_vm_ioctl_check_extension_generic(struct kvm *kvm, long arg) case KVM_CAP_DESTROY_MEMORY_REGION_WORKS: case KVM_CAP_JOIN_MEMORY_REGIONS_WORKS: case KVM_CAP_INTERNAL_ERROR_DATA: -#ifdef CONFIG_HAVE_KVM_MSI +#ifdef __KVM_HAVE_MSI case KVM_CAP_SIGNAL_MSI: #endif #ifdef CONFIG_HAVE_KVM_IRQCHIP @@ -4983,7 +4985,7 @@ static int kvm_vm_ioctl_check_extension_generic(struct kvm *kvm, long arg) case KVM_CAP_ENABLE_CAP_VM: case KVM_CAP_HALT_POLL: return 1; -#ifdef CONFIG_KVM_MMIO +#ifndef __KVM_NO_MMIO case KVM_CAP_COALESCED_MMIO: return KVM_COALESCED_MMIO_PAGE_OFFSET; case KVM_CAP_COALESCED_PIO: @@ -5231,7 +5233,7 @@ static int kvm_vm_ioctl_get_stats_fd(struct kvm *kvm) if (fd < 0) return fd; - file = anon_inode_getfile_fmode("kvm-vm-stats", + file = anon_inode_getfile_fmode(__stringify(KVM_DEV_NAME) "-vm-stats", &kvm_vm_stats_fops, kvm, O_RDONLY, FMODE_PREAD); if (IS_ERR(file)) { put_unused_fd(fd); @@ -5329,7 +5331,7 @@ static long kvm_vm_ioctl(struct file *filp, break; } #endif -#ifdef CONFIG_KVM_MMIO +#ifndef __KVM_NO_MMIO case KVM_REGISTER_COALESCED_MMIO: { struct kvm_coalesced_mmio_zone zone; @@ -5367,7 +5369,7 @@ static long kvm_vm_ioctl(struct file *filp, r = kvm_ioeventfd(kvm, &data); break; } -#ifdef CONFIG_HAVE_KVM_MSI +#ifdef __KVM_HAVE_MSI case KVM_SIGNAL_MSI: { struct kvm_msi msi; @@ -5608,7 +5610,7 @@ static int kvm_dev_ioctl_create_vm(unsigned long type) goto put_fd; } - file = anon_inode_getfile("kvm-vm", &kvm_vm_fops, kvm, O_RDWR); + file = anon_inode_getfile(__stringify(KVM_DEV_NAME) "-vm", &kvm_vm_fops, kvm, O_RDWR); if (IS_ERR(file)) { r = PTR_ERR(file); goto put_kvm; @@ -5658,7 +5660,7 @@ static long kvm_dev_ioctl(struct file *filp, #ifdef CONFIG_X86 r += PAGE_SIZE; /* pio data page */ #endif -#ifdef CONFIG_KVM_MMIO +#ifndef __KVM_NO_MMIO r += PAGE_SIZE; /* coalesced mmio ring page */ #endif break; @@ -5676,8 +5678,8 @@ static struct file_operations kvm_chardev_ops = { }; static struct miscdevice kvm_dev = { - KVM_MINOR, - "kvm", + KVM_DEV_MINOR, + __stringify(KVM_DEV_NAME), &kvm_chardev_ops, }; @@ -5711,7 +5713,7 @@ static int kvm_enable_virtualization_cpu(void) return 0; if (kvm_arch_enable_virtualization_cpu()) { - pr_info("kvm: enabling virtualization on CPU%d failed\n", + pr_info("enabling virtualization on CPU%d failed\n", raw_smp_processor_id()); return -EIO; } @@ -5758,7 +5760,7 @@ static void kvm_shutdown(void *data) * is used for both shutdown and reboot scenarios, i.e. neither name is * 100% comprehensive. */ - pr_info("kvm: exiting hardware virtualization\n"); + pr_info("exiting hardware virtualization\n"); on_each_cpu(kvm_disable_virtualization_cpu, NULL, 1); } @@ -6169,7 +6171,7 @@ int kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx, * attached devices. Otherwise, destroy the caller's device only. */ if (!new_bus) { - pr_err("kvm: failed to shrink bus, removing it completely\n"); + pr_err("failed to shrink bus, removing it completely\n"); kvm_io_bus_destroy(bus); return -ENOMEM; } @@ -6456,7 +6458,7 @@ static void kvm_init_debug(void) const struct kvm_stats_desc *pdesc; int i; - kvm_debugfs_dir = debugfs_create_dir("kvm", NULL); + kvm_debugfs_dir = debugfs_create_dir(__stringify(KVM_DEV_NAME), NULL); for (i = 0; i < kvm_vm_stats_header.num_desc; ++i) { pdesc = &kvm_vm_stats_desc[i]; @@ -6601,7 +6603,7 @@ int kvm_init(unsigned vcpu_size, unsigned vcpu_align, struct module *module) if (!vcpu_align) vcpu_align = __alignof__(struct kvm_vcpu); kvm_vcpu_cache = - kmem_cache_create_usercopy("kvm_vcpu", vcpu_size, vcpu_align, + kmem_cache_create_usercopy(KVM_DEV_STRING(vcpu), vcpu_size, vcpu_align, SLAB_ACCOUNT, offsetof(struct kvm_vcpu, arch), offsetofend(struct kvm_vcpu, stats_id) @@ -6655,7 +6657,7 @@ int kvm_init(unsigned vcpu_size, unsigned vcpu_align, struct module *module) */ r = misc_register(&kvm_dev); if (r) { - pr_err("kvm: misc device register failed\n"); + pr_err("misc device register failed\n"); goto err_register; } |
