From edf884172e9828c6234b254208af04655855038d Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Sun, 16 Dec 2007 11:02:48 +0200 Subject: [PATCH] KVM: Move arch dependent files to new directory arch/x86/kvm/ This paves the way for multiple architecture support. Note that while ioapic.c could potentially be shared with ia64, it is also moved. Signed-off-by: Avi Kivity --- arch/x86/Kconfig | 2 ++ arch/x86/Makefile | 2 ++ {drivers => arch/x86}/kvm/Kconfig | 0 {drivers => arch/x86}/kvm/Makefile | 7 ++++++- {drivers => arch/x86}/kvm/i8259.c | 3 ++- {drivers => arch/x86}/kvm/ioapic.c | 4 +--- {drivers => arch/x86}/kvm/irq.c | 3 +-- {drivers => arch/x86}/kvm/irq.h | 3 +-- {drivers => arch/x86}/kvm/kvm_svm.h | 2 +- {drivers => arch/x86}/kvm/lapic.c | 4 +--- {drivers => arch/x86}/kvm/mmu.c | 3 +-- {drivers => arch/x86}/kvm/mmu.h | 2 +- {drivers => arch/x86}/kvm/paging_tmpl.h | 0 {drivers => arch/x86}/kvm/segment_descriptor.h | 0 {drivers => arch/x86}/kvm/svm.c | 4 ++-- {drivers => arch/x86}/kvm/svm.h | 0 {drivers => arch/x86}/kvm/vmx.c | 4 +--- {drivers => arch/x86}/kvm/vmx.h | 0 {drivers => arch/x86}/kvm/x86.c | 4 +--- {drivers => arch/x86}/kvm/x86_emulate.c | 5 ++--- drivers/Kconfig | 2 -- drivers/Makefile | 1 - drivers/kvm/iodev.h | 2 +- drivers/kvm/kvm_main.c | 2 +- drivers/kvm/x86.h => include/asm-x86/kvm_host.h | 9 ++++----- .../x86_emulate.h => include/asm-x86/kvm_x86_emulate.h | 0 drivers/kvm/kvm.h => include/linux/kvm_host.h | 8 ++++---- drivers/kvm/types.h => include/linux/kvm_types.h | 0 28 files changed, 35 insertions(+), 41 deletions(-) rename {drivers => arch/x86}/kvm/Kconfig (100%) rename {drivers => arch/x86}/kvm/Makefile (52%) rename {drivers => arch/x86}/kvm/i8259.c (99%) rename {drivers => arch/x86}/kvm/ioapic.c (99%) rename {drivers => arch/x86}/kvm/irq.c (98%) rename {drivers => arch/x86}/kvm/irq.h (99%) rename {drivers => arch/x86}/kvm/kvm_svm.h (96%) rename {drivers => arch/x86}/kvm/lapic.c (99%) rename {drivers => arch/x86}/kvm/mmu.c (99%) rename {drivers => arch/x86}/kvm/mmu.h (96%) rename {drivers => arch/x86}/kvm/paging_tmpl.h (100%) rename {drivers => arch/x86}/kvm/segment_descriptor.h (100%) rename {drivers => arch/x86}/kvm/svm.c (99%) rename {drivers => arch/x86}/kvm/svm.h (100%) rename {drivers => arch/x86}/kvm/vmx.c (99%) rename {drivers => arch/x86}/kvm/vmx.h (100%) rename {drivers => arch/x86}/kvm/x86.c (99%) rename {drivers => arch/x86}/kvm/x86_emulate.c (99%) rename drivers/kvm/x86.h => include/asm-x86/kvm_host.h (99%) rename drivers/kvm/x86_emulate.h => include/asm-x86/kvm_x86_emulate.h (100%) rename drivers/kvm/kvm.h => include/linux/kvm_host.h (98%) rename drivers/kvm/types.h => include/linux/kvm_types.h (100%) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index d289cfcf92c4..65b449134cf7 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -1599,4 +1599,6 @@ source "security/Kconfig" source "crypto/Kconfig" +source "arch/x86/kvm/Kconfig" + source "lib/Kconfig" diff --git a/arch/x86/Makefile b/arch/x86/Makefile index b08f18261df6..da8f4129780b 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -7,6 +7,8 @@ else KBUILD_DEFCONFIG := $(ARCH)_defconfig endif +core-$(CONFIG_KVM) += arch/x86/kvm/ + # BITS is used as extension for files which are available in a 32 bit # and a 64 bit version to simplify shared Makefiles. # e.g.: obj-y += foo_$(BITS).o diff --git a/drivers/kvm/Kconfig b/arch/x86/kvm/Kconfig similarity index 100% rename from drivers/kvm/Kconfig rename to arch/x86/kvm/Kconfig diff --git a/drivers/kvm/Makefile b/arch/x86/kvm/Makefile similarity index 52% rename from drivers/kvm/Makefile rename to arch/x86/kvm/Makefile index cf18ad46e987..880ffe403b35 100644 --- a/drivers/kvm/Makefile +++ b/arch/x86/kvm/Makefile @@ -2,7 +2,12 @@ # Makefile for Kernel-based Virtual Machine module # -kvm-objs := kvm_main.o x86.o mmu.o x86_emulate.o i8259.o irq.o lapic.o ioapic.o +common-objs = $(addprefix ../../../drivers/kvm/, kvm_main.o) + +EXTRA_CFLAGS += -I drivers/kvm + +kvm-objs := $(common-objs) x86.o mmu.o x86_emulate.o i8259.o irq.o lapic.o \ + ioapic.o obj-$(CONFIG_KVM) += kvm.o kvm-intel-objs = vmx.o obj-$(CONFIG_KVM_INTEL) += kvm-intel.o diff --git a/drivers/kvm/i8259.c b/arch/x86/kvm/i8259.c similarity index 99% rename from drivers/kvm/i8259.c rename to arch/x86/kvm/i8259.c index b3cad632f3d5..ab29cf2def47 100644 --- a/drivers/kvm/i8259.c +++ b/arch/x86/kvm/i8259.c @@ -27,7 +27,8 @@ */ #include #include "irq.h" -#include "kvm.h" + +#include /* * set irq level. If an edge is detected, then the IRR is set to 1 diff --git a/drivers/kvm/ioapic.c b/arch/x86/kvm/ioapic.c similarity index 99% rename from drivers/kvm/ioapic.c rename to arch/x86/kvm/ioapic.c index f8236774c1b4..72f12f75495d 100644 --- a/drivers/kvm/ioapic.c +++ b/arch/x86/kvm/ioapic.c @@ -26,9 +26,7 @@ * Based on Xen 3.1 code. */ -#include "kvm.h" -#include "x86.h" - +#include #include #include #include diff --git a/drivers/kvm/irq.c b/arch/x86/kvm/irq.c similarity index 98% rename from drivers/kvm/irq.c rename to arch/x86/kvm/irq.c index 59b47c55fc76..07a09aad4fd6 100644 --- a/drivers/kvm/irq.c +++ b/arch/x86/kvm/irq.c @@ -20,9 +20,8 @@ */ #include +#include -#include "kvm.h" -#include "x86.h" #include "irq.h" /* diff --git a/drivers/kvm/irq.h b/arch/x86/kvm/irq.h similarity index 99% rename from drivers/kvm/irq.h rename to arch/x86/kvm/irq.h index 6e023dc3f848..6316638eec9f 100644 --- a/drivers/kvm/irq.h +++ b/arch/x86/kvm/irq.h @@ -24,9 +24,8 @@ #include #include -#include +#include #include "iodev.h" -#include "kvm.h" struct kvm; struct kvm_vcpu; diff --git a/drivers/kvm/kvm_svm.h b/arch/x86/kvm/kvm_svm.h similarity index 96% rename from drivers/kvm/kvm_svm.h rename to arch/x86/kvm/kvm_svm.h index a0e415daef5b..ecdfe97e4635 100644 --- a/drivers/kvm/kvm_svm.h +++ b/arch/x86/kvm/kvm_svm.h @@ -4,10 +4,10 @@ #include #include #include +#include #include #include "svm.h" -#include "kvm.h" static const u32 host_save_user_msrs[] = { #ifdef CONFIG_X86_64 diff --git a/drivers/kvm/lapic.c b/arch/x86/kvm/lapic.c similarity index 99% rename from drivers/kvm/lapic.c rename to arch/x86/kvm/lapic.c index 8c74bf184a07..4076331b01ee 100644 --- a/drivers/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -17,9 +17,7 @@ * the COPYING file in the top-level directory. */ -#include "kvm.h" -#include "x86.h" - +#include #include #include #include diff --git a/drivers/kvm/mmu.c b/arch/x86/kvm/mmu.c similarity index 99% rename from drivers/kvm/mmu.c rename to arch/x86/kvm/mmu.c index c26d83f86a3a..401eb7ce3207 100644 --- a/drivers/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -18,10 +18,9 @@ */ #include "vmx.h" -#include "kvm.h" -#include "x86.h" #include "mmu.h" +#include #include #include #include diff --git a/drivers/kvm/mmu.h b/arch/x86/kvm/mmu.h similarity index 96% rename from drivers/kvm/mmu.h rename to arch/x86/kvm/mmu.h index cbfc272262df..1fce19ec7a23 100644 --- a/drivers/kvm/mmu.h +++ b/arch/x86/kvm/mmu.h @@ -1,7 +1,7 @@ #ifndef __KVM_X86_MMU_H #define __KVM_X86_MMU_H -#include "kvm.h" +#include static inline void kvm_mmu_free_some_pages(struct kvm_vcpu *vcpu) { diff --git a/drivers/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h similarity index 100% rename from drivers/kvm/paging_tmpl.h rename to arch/x86/kvm/paging_tmpl.h diff --git a/drivers/kvm/segment_descriptor.h b/arch/x86/kvm/segment_descriptor.h similarity index 100% rename from drivers/kvm/segment_descriptor.h rename to arch/x86/kvm/segment_descriptor.h diff --git a/drivers/kvm/svm.c b/arch/x86/kvm/svm.c similarity index 99% rename from drivers/kvm/svm.c rename to arch/x86/kvm/svm.c index e606f6d18669..3d4b71a94440 100644 --- a/drivers/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -13,9 +13,9 @@ * the COPYING file in the top-level directory. * */ -#include "x86.h" +#include + #include "kvm_svm.h" -#include "x86_emulate.h" #include "irq.h" #include "mmu.h" diff --git a/drivers/kvm/svm.h b/arch/x86/kvm/svm.h similarity index 100% rename from drivers/kvm/svm.h rename to arch/x86/kvm/svm.h diff --git a/drivers/kvm/vmx.c b/arch/x86/kvm/vmx.c similarity index 99% rename from drivers/kvm/vmx.c rename to arch/x86/kvm/vmx.c index 11ca2340d38f..fc494aff5d8b 100644 --- a/drivers/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -15,14 +15,12 @@ * */ -#include "kvm.h" -#include "x86.h" -#include "x86_emulate.h" #include "irq.h" #include "vmx.h" #include "segment_descriptor.h" #include "mmu.h" +#include #include #include #include diff --git a/drivers/kvm/vmx.h b/arch/x86/kvm/vmx.h similarity index 100% rename from drivers/kvm/vmx.h rename to arch/x86/kvm/vmx.h diff --git a/drivers/kvm/x86.c b/arch/x86/kvm/x86.c similarity index 99% rename from drivers/kvm/x86.c rename to arch/x86/kvm/x86.c index b37c0093d728..5902c5cbc1bb 100644 --- a/drivers/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -14,9 +14,7 @@ * */ -#include "kvm.h" -#include "x86.h" -#include "x86_emulate.h" +#include #include "segment_descriptor.h" #include "irq.h" #include "mmu.h" diff --git a/drivers/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c similarity index 99% rename from drivers/kvm/x86_emulate.c rename to arch/x86/kvm/x86_emulate.c index 50b133f68743..79586003397a 100644 --- a/drivers/kvm/x86_emulate.c +++ b/arch/x86/kvm/x86_emulate.c @@ -25,12 +25,11 @@ #include #define DPRINTF(_f, _a ...) printf(_f , ## _a) #else -#include "kvm.h" -#include "x86.h" +#include #define DPRINTF(x...) do {} while (0) #endif -#include "x86_emulate.h" #include +#include /* * Opcode effective-address decode tables. diff --git a/drivers/Kconfig b/drivers/Kconfig index f4076d9e9902..08d4ae201597 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig @@ -90,8 +90,6 @@ source "drivers/dca/Kconfig" source "drivers/auxdisplay/Kconfig" -source "drivers/kvm/Kconfig" - source "drivers/uio/Kconfig" source "drivers/virtio/Kconfig" diff --git a/drivers/Makefile b/drivers/Makefile index d92d4d82d001..9e1f808e43cf 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -47,7 +47,6 @@ obj-$(CONFIG_SPI) += spi/ obj-$(CONFIG_PCCARD) += pcmcia/ obj-$(CONFIG_DIO) += dio/ obj-$(CONFIG_SBUS) += sbus/ -obj-$(CONFIG_KVM) += kvm/ obj-$(CONFIG_ZORRO) += zorro/ obj-$(CONFIG_MAC) += macintosh/ obj-$(CONFIG_ATA_OVER_ETH) += block/aoe/ diff --git a/drivers/kvm/iodev.h b/drivers/kvm/iodev.h index eb9e8a71843a..c14e642027b2 100644 --- a/drivers/kvm/iodev.h +++ b/drivers/kvm/iodev.h @@ -16,7 +16,7 @@ #ifndef __KVM_IODEV_H__ #define __KVM_IODEV_H__ -#include "types.h" +#include struct kvm_io_device { void (*read)(struct kvm_io_device *this, diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c index ae2a1bf640bc..4026d7d64296 100644 --- a/drivers/kvm/kvm_main.c +++ b/drivers/kvm/kvm_main.c @@ -15,9 +15,9 @@ * */ -#include "kvm.h" #include "iodev.h" +#include #include #include #include diff --git a/drivers/kvm/x86.h b/include/asm-x86/kvm_host.h similarity index 99% rename from drivers/kvm/x86.h rename to include/asm-x86/kvm_host.h index dfb8091971a9..28940e1a9713 100644 --- a/drivers/kvm/x86.h +++ b/include/asm-x86/kvm_host.h @@ -8,19 +8,18 @@ * */ -#ifndef KVM_X86_H -#define KVM_X86_H +#ifndef ASM_KVM_HOST_H +#define ASM_KVM_HOST_H #include #include #include #include +#include #include -#include "types.h" - #define CR3_PAE_RESERVED_BITS ((X86_CR3_PWT | X86_CR3_PCD) - 1) #define CR3_NONPAE_RESERVED_BITS ((PAGE_SIZE-1) & ~(X86_CR3_PWT | X86_CR3_PCD)) #define CR3_L_MODE_RESERVED_BITS (CR3_NONPAE_RESERVED_BITS|0xFFFFFF0000000000ULL) @@ -102,7 +101,7 @@ enum { VCPU_SREG_LDTR, }; -#include "x86_emulate.h" +#include #define KVM_NR_MEM_OBJS 40 diff --git a/drivers/kvm/x86_emulate.h b/include/asm-x86/kvm_x86_emulate.h similarity index 100% rename from drivers/kvm/x86_emulate.h rename to include/asm-x86/kvm_x86_emulate.h diff --git a/drivers/kvm/kvm.h b/include/linux/kvm_host.h similarity index 98% rename from drivers/kvm/kvm.h rename to include/linux/kvm_host.h index bf6a3b330a3d..a85d5b6943de 100644 --- a/drivers/kvm/kvm.h +++ b/include/linux/kvm_host.h @@ -1,5 +1,5 @@ -#ifndef __KVM_H -#define __KVM_H +#ifndef __KVM_HOST_H +#define __KVM_HOST_H /* * This work is licensed under the terms of the GNU GPL, version 2. See @@ -20,9 +20,9 @@ #include #include -#include "types.h" +#include -#include "x86.h" +#include #define KVM_MAX_VCPUS 4 #define KVM_MEMORY_SLOTS 8 diff --git a/drivers/kvm/types.h b/include/linux/kvm_types.h similarity index 100% rename from drivers/kvm/types.h rename to include/linux/kvm_types.h -- 2.20.1