From patchwork Tue Apr 12 13:32:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Elisei X-Patchwork-Id: 12810839 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B1755C433F5 for ; Tue, 12 Apr 2022 13:34:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=cqMhwYKPDvJ9RulPvsCDoP/cgLkAgQ+a670lMJH/E3o=; b=Hu1zqvKRr98DP7 EUBk1foL5KAYeGFbX145gq7bedO4b8RM3DBpfTm8wL7ApnNy16rjDECUghswhrYs+9nu2ro5U8EYe q3MTL0kv1EFDw7ZyK29y2gw6rAPgEgwZ3ANCHlI53WjuZQ5VZK1WDPLfuwRHqjsKUky8LusaCQpFw QRQC/B68SGxCh5xHRgm/suN3qyOWFO6LgH+UuHzPrwH929ocFNz6INL6LBRqAYqXd7PUf4GX59key 8A2sZsNBVMya7H+nyPJUDQBh/MfMvZHnXEQzHhZh1voZXOAu5RrzL0M6JVk1AabKnRomzs9HFGLpg dE89kIcHwhk/TVCLJFZA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1neGeZ-00EcGB-W7; Tue, 12 Apr 2022 13:33:56 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1neGdU-00Ebiw-9A for linux-arm-kernel@lists.infradead.org; Tue, 12 Apr 2022 13:32:50 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 068C11516; Tue, 12 Apr 2022 06:32:47 -0700 (PDT) Received: from e121798.arm.com (unknown [10.57.11.98]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 96E1C3F70D; Tue, 12 Apr 2022 06:32:45 -0700 (PDT) From: Alexandru Elisei To: will@kernel.org, julien.thierry.kdev@gmail.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, maz@kernel.org, james.morse@arm.com, suzuki.poulose@arm.com, mark.rutland@arm.com, andre.przywara@arm.com Subject: [PATCH v3 kvmtool 06/11] arm: Make the PMUv3 emulation code arm64 specific Date: Tue, 12 Apr 2022 14:32:26 +0100 Message-Id: <20220412133231.35355-7-alexandru.elisei@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220412133231.35355-1-alexandru.elisei@arm.com> References: <20220412133231.35355-1-alexandru.elisei@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220412_063248_454982_3AC45307 X-CRM114-Status: GOOD ( 11.83 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org KVM for aarch32 does not exist anymore, PMUv3 is a hardware feature present only on aarch64 CPUs, the command line option to enable the feature for a VCPU is aarch64 specific, the PMU code is called only from an aarch64 function and it compiles to an empty stub when ARCH=arm. There is no reason to have the PMUv3 emulation code in the common code area for arm and arm64, so move it to the arm64 directory, where it can be expanded in the future without fear of breaking aarch32 support. Signed-off-by: Alexandru Elisei --- Makefile | 6 +++--- arm/aarch64/arm-cpu.c | 3 ++- arm/{include/arm-common => aarch64/include/asm}/pmu.h | 6 +++--- arm/{ => aarch64}/pmu.c | 7 ++----- 4 files changed, 10 insertions(+), 12 deletions(-) rename arm/{include/arm-common => aarch64/include/asm}/pmu.h (52%) rename arm/{ => aarch64}/pmu.c (93%) diff --git a/Makefile b/Makefile index e9121dc39d02..31274353656d 100644 --- a/Makefile +++ b/Makefile @@ -159,8 +159,7 @@ endif # ARM OBJS_ARM_COMMON := arm/fdt.o arm/gic.o arm/gicv2m.o arm/ioport.o \ - arm/kvm.o arm/kvm-cpu.o arm/pci.o arm/timer.o \ - arm/pmu.o + arm/kvm.o arm/kvm-cpu.o arm/pci.o arm/timer.o HDRS_ARM_COMMON := arm/include ifeq ($(ARCH), arm) DEFINES += -DCONFIG_ARM @@ -183,6 +182,7 @@ ifeq ($(ARCH), arm64) OBJS += arm/aarch64/kvm-cpu.o OBJS += arm/aarch64/kvm.o OBJS += arm/aarch64/pvtime.o + OBJS += arm/aarch64/pmu.o ARCH_INCLUDE := $(HDRS_ARM_COMMON) ARCH_INCLUDE += -Iarm/aarch64/include @@ -583,4 +583,4 @@ ifneq ($(MAKECMDGOALS),clean) KVMTOOLS-VERSION-FILE: @$(SHELL_PATH) util/KVMTOOLS-VERSION-GEN $(OUTPUT) -endif \ No newline at end of file +endif diff --git a/arm/aarch64/arm-cpu.c b/arm/aarch64/arm-cpu.c index 7e4a3c17c38f..f5c8e1e7a06b 100644 --- a/arm/aarch64/arm-cpu.c +++ b/arm/aarch64/arm-cpu.c @@ -5,7 +5,8 @@ #include "arm-common/gic.h" #include "arm-common/timer.h" -#include "arm-common/pmu.h" + +#include "asm/pmu.h" #include #include diff --git a/arm/include/arm-common/pmu.h b/arm/aarch64/include/asm/pmu.h similarity index 52% rename from arm/include/arm-common/pmu.h rename to arm/aarch64/include/asm/pmu.h index 0085f2545553..38e3154b11b7 100644 --- a/arm/include/arm-common/pmu.h +++ b/arm/aarch64/include/asm/pmu.h @@ -1,8 +1,8 @@ -#ifndef ARM_COMMON__PMU_H -#define ARM_COMMON__PMU_H +#ifndef __ARM_PMU_H__ +#define __ARM_PMU_H__ #define KVM_ARM_PMUv3_PPI 23 void pmu__generate_fdt_nodes(void *fdt, struct kvm *kvm); -#endif /* ARM_COMMON__PMU_H */ +#endif /* __ARM_PMU_H__ */ diff --git a/arm/pmu.c b/arm/aarch64/pmu.c similarity index 93% rename from arm/pmu.c rename to arm/aarch64/pmu.c index 5b058eabb49d..6b190c5e2ae5 100644 --- a/arm/pmu.c +++ b/arm/aarch64/pmu.c @@ -4,9 +4,9 @@ #include "kvm/util.h" #include "arm-common/gic.h" -#include "arm-common/pmu.h" -#ifdef CONFIG_ARM64 +#include "asm/pmu.h" + static int set_pmu_attr(struct kvm *kvm, int vcpu_idx, struct kvm_device_attr *attr) { @@ -71,6 +71,3 @@ void pmu__generate_fdt_nodes(void *fdt, struct kvm *kvm) _FDT(fdt_property(fdt, "interrupts", irq_prop, sizeof(irq_prop))); _FDT(fdt_end_node(fdt)); } -#else -void pmu__generate_fdt_nodes(void *fdt, struct kvm *kvm) { } -#endif