From patchwork Tue May 14 12:30:52 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 2569831 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork1.kernel.org (Postfix) with ESMTP id 58E1D3FC5A for ; Wed, 15 May 2013 04:39:39 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UcEVA-0007Ik-GQ; Tue, 14 May 2013 12:39:02 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UcEOO-0004uC-Dc; Tue, 14 May 2013 12:31:44 +0000 Received: from service87.mimecast.com ([91.220.42.44]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UcEOD-0004q9-Hy for linux-arm-kernel@lists.infradead.org; Tue, 14 May 2013 12:31:35 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Tue, 14 May 2013 13:31:11 +0100 Received: from e102391-lin.cambridge.arm.com ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.0); Tue, 14 May 2013 13:31:08 +0100 From: Marc Zyngier To: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org Subject: [PATCH v2 1/2] ARM: KVM: move GIC/timer code to a common location Date: Tue, 14 May 2013 13:30:52 +0100 Message-Id: <1368534653-23133-2-git-send-email-marc.zyngier@arm.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1368534653-23133-1-git-send-email-marc.zyngier@arm.com> References: <1368534653-23133-1-git-send-email-marc.zyngier@arm.com> X-OriginalArrivalTime: 14 May 2013 12:31:08.0568 (UTC) FILETIME=[E9127980:01CE509E] X-MC-Unique: 113051413311115601 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130514_083134_065166_1839B257 X-CRM114-Status: GOOD ( 12.42 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [91.220.42.44 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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 ++++--- .../include/asm/kvm_arch_timer.h => include/kvm/arm_arch_timer.h | 0 arch/arm/include/asm/kvm_vgic.h => include/kvm/arm_vgic.h | 0 {arch/arm/kvm => virt/kvm/arm}/arch_timer.c | 4 ++-- {arch/arm/kvm => virt/kvm/arm}/vgic.c | 0 6 files changed, 8 insertions(+), 7 deletions(-) rename arch/arm/include/asm/kvm_arch_timer.h => include/kvm/arm_arch_timer.h (100%) rename arch/arm/include/asm/kvm_vgic.h => include/kvm/arm_vgic.h (100%) rename {arch/arm/kvm => virt/kvm/arm}/arch_timer.c (99%) rename {arch/arm/kvm => virt/kvm/arm}/vgic.c (100%) 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 diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h index ff49193..1f3cee2 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 #define KVM_MAX_VCPUS CONFIG_KVM_ARM_MAX_VCPUS #define KVM_USER_MEM_SLOTS 32 @@ -38,7 +38,7 @@ #define KVM_NR_PAGE_SIZES 1 #define KVM_PAGES_PER_HPAGE(x) (1UL<<31) -#include +#include 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..9184a49 100644 --- a/arch/arm/kvm/Makefile +++ b/arch/arm/kvm/Makefile @@ -14,10 +14,11 @@ CFLAGS_mmu.o := -I. AFLAGS_init.o := -Wa,-march=armv7-a$(plus_virt) AFLAGS_interrupts.o := -Wa,-march=armv7-a$(plus_virt) -kvm-arm-y = $(addprefix ../../../virt/kvm/, kvm_main.o coalesced_mmio.o) +KVM := ../../../virt/kvm +kvm-arm-y = $(addprefix $(KVM)/, kvm_main.o coalesced_mmio.o) obj-y += kvm-arm.o init.o interrupts.o obj-y += arm.o handle_exit.o guest.o mmu.o emulate.o reset.o obj-y += coproc.o coproc_a15.o mmio.o psci.o perf.o -obj-$(CONFIG_KVM_ARM_VGIC) += vgic.o -obj-$(CONFIG_KVM_ARM_TIMER) += arch_timer.o +obj-$(CONFIG_KVM_ARM_VGIC) += $(KVM)/arm/vgic.o +obj-$(CONFIG_KVM_ARM_TIMER) += $(KVM)/arm/arch_timer.o diff --git a/arch/arm/include/asm/kvm_arch_timer.h b/include/kvm/arm_arch_timer.h similarity index 100% rename from arch/arm/include/asm/kvm_arch_timer.h rename to include/kvm/arm_arch_timer.h diff --git a/arch/arm/include/asm/kvm_vgic.h b/include/kvm/arm_vgic.h similarity index 100% rename from arch/arm/include/asm/kvm_vgic.h rename to include/kvm/arm_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 c55b608..2d00b29 100644 --- a/arch/arm/kvm/arch_timer.c +++ b/virt/kvm/arm/arch_timer.c @@ -25,8 +25,8 @@ #include #include -#include -#include +#include +#include static struct timecounter *timecounter; static struct workqueue_struct *wqueue;