From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marc Zyngier Subject: [RFC PATCH 1/2] ARM: KVM: move GIC/timer code to a common location Date: Fri, 3 May 2013 15:02:52 +0100 Message-ID: <1367589773-5609-2-git-send-email-marc.zyngier@arm.com> References: <1367589773-5609-1-git-send-email-marc.zyngier@arm.com> Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Cc: cdall@cs.columbia.edu, catalin.marinas@arm.com To: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org Return-path: Received: from service87.mimecast.com ([91.220.42.44]:34780 "EHLO service87.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1762472Ab3ECODI (ORCPT ); Fri, 3 May 2013 10:03:08 -0400 In-Reply-To: <1367589773-5609-1-git-send-email-marc.zyngier@arm.com> Sender: kvm-owner@vger.kernel.org List-ID: As KVM/arm64 is looming on the horizon, it makes sense to move some of the common code to a single location in order to reduce duplication. The code could live anywhere. Actually, most of KVM is already built with a bunch of ugly ../../.. hacks in the various Makefiles, so we're not exactly talking about style here. But maybe it is time to start moving into a less ugly direction. The include files must be in a "public" location, as they are accessed from non-KVM files (arch/arm/kernel/asm-offsets.c). For this purpose, introduce two new locations: - virt/kvm/arm/ : x86 and ia64 already share the ioapic code in virt/kvm, so this could be seen as a (very ugly) precedent. - include/kvm/ : there is already an include/xen, and while the intent is slightly different, this seems as good a location as any Eventually, we should probably have independant Makefiles at every levels (just like everywhere else in the kernel), but this is just the first step. Signed-off-by: Marc Zyngier --- arch/arm/include/asm/kvm_host.h | 4 ++-- arch/arm/kvm/Makefile | 7 ++++--- {arch/arm/include/asm =3D> include/kvm}/kvm_arch_timer.h | 0 {arch/arm/include/asm =3D> include/kvm}/kvm_vgic.h | 0 {arch/arm/kvm =3D> virt/kvm/arm}/arch_timer.c | 4 ++-- {arch/arm/kvm =3D> virt/kvm/arm}/vgic.c | 0 6 files changed, 8 insertions(+), 7 deletions(-) rename {arch/arm/include/asm =3D> include/kvm}/kvm_arch_timer.h (100%) rename {arch/arm/include/asm =3D> include/kvm}/kvm_vgic.h (100%) rename {arch/arm/kvm =3D> virt/kvm/arm}/arch_timer.c (99%) rename {arch/arm/kvm =3D> virt/kvm/arm}/vgic.c (100%) diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_hos= t.h index ff49193..4ad51e6 100644 --- a/arch/arm/include/asm/kvm_host.h +++ b/arch/arm/include/asm/kvm_host.h @@ -23,7 +23,7 @@ #include #include #include -#include +#include =20 #define KVM_MAX_VCPUS CONFIG_KVM_ARM_MAX_VCPUS #define KVM_USER_MEM_SLOTS 32 @@ -38,7 +38,7 @@ #define KVM_NR_PAGE_SIZES=091 #define KVM_PAGES_PER_HPAGE(x)=09(1UL<<31) =20 -#include +#include =20 struct kvm_vcpu; u32 *kvm_vcpu_reg(struct kvm_vcpu *vcpu, u8 reg_num, u32 mode); diff --git a/arch/arm/kvm/Makefile b/arch/arm/kvm/Makefile index 53c5ed8..110d6da 100644 --- a/arch/arm/kvm/Makefile +++ b/arch/arm/kvm/Makefile @@ -14,10 +14,11 @@ CFLAGS_mmu.o :=3D -I. AFLAGS_init.o :=3D -Wa,-march=3Darmv7-a$(plus_virt) AFLAGS_interrupts.o :=3D -Wa,-march=3Darmv7-a$(plus_virt) =20 -kvm-arm-y =3D $(addprefix ../../../virt/kvm/, kvm_main.o coalesced_mmio.o) +KVM :=3D ../../../virt/kvm +kvm-arm-y =3D $(addprefix $(KVM)/, kvm_main.o coalesced_mmio.o) =20 obj-y +=3D kvm-arm.o init.o interrupts.o obj-y +=3D arm.o handle_exit.o guest.o mmu.o emulate.o reset.o obj-y +=3D coproc.o coproc_a15.o mmio.o psci.o perf.o -obj-$(CONFIG_KVM_ARM_VGIC) +=3D vgic.o -obj-$(CONFIG_KVM_ARM_TIMER) +=3D arch_timer.o +obj-$(CONFIG_KVM_ARM_VGIC) +=3D $(addprefix $(KVM)/arm/, vgic.o) +obj-$(CONFIG_KVM_ARM_TIMER) +=3D $(addprefix $(KVM)/arm/, arch_timer.o) diff --git a/arch/arm/include/asm/kvm_arch_timer.h b/include/kvm/kvm_arch_t= imer.h similarity index 100% rename from arch/arm/include/asm/kvm_arch_timer.h rename to include/kvm/kvm_arch_timer.h diff --git a/arch/arm/include/asm/kvm_vgic.h b/include/kvm/kvm_vgic.h similarity index 100% rename from arch/arm/include/asm/kvm_vgic.h rename to include/kvm/kvm_vgic.h diff --git a/arch/arm/kvm/arch_timer.c b/virt/kvm/arm/arch_timer.c similarity index 99% rename from arch/arm/kvm/arch_timer.c rename to virt/kvm/arm/arch_timer.c index 49a7516..0728904 100644 --- a/arch/arm/kvm/arch_timer.c +++ b/virt/kvm/arm/arch_timer.c @@ -25,8 +25,8 @@ #include #include =20 -#include -#include +#include +#include =20 static struct timecounter *timecounter; static struct workqueue_struct *wqueue; diff --git a/arch/arm/kvm/vgic.c b/virt/kvm/arm/vgic.c similarity index 100% rename from arch/arm/kvm/vgic.c rename to virt/kvm/arm/vgic.c --=20 1.8.2.1