aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru Elisei <alexandru.elisei@arm.com>2022-04-12 14:32:26 +0100
committerWill Deacon <will@kernel.org>2022-05-06 14:21:16 +0100
commitf57ce447709232e07e996968bd2df3e5395129a3 (patch)
tree133ac3b6357480da15c4ec931fff207aa258915f
parentb23aed2ae11e8c0a03c53d7e8e63ad1b22e5db1f (diff)
downloadkvmtool-f57ce447709232e07e996968bd2df3e5395129a3.tar.gz
arm: Make the PMUv3 emulation code arm64 specific
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 <alexandru.elisei@arm.com> Link: https://lore.kernel.org/r/20220412133231.35355-7-alexandru.elisei@arm.com Signed-off-by: Will Deacon <will@kernel.org>
-rw-r--r--Makefile6
-rw-r--r--arm/aarch64/arm-cpu.c3
-rw-r--r--arm/aarch64/include/asm/pmu.h (renamed from arm/include/arm-common/pmu.h)6
-rw-r--r--arm/aarch64/pmu.c (renamed from arm/pmu.c)7
4 files changed, 10 insertions, 12 deletions
diff --git a/Makefile b/Makefile
index e9121dc3..31274353 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 7e4a3c17..f5c8e1e7 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 <linux/byteorder.h>
#include <linux/types.h>
diff --git a/arm/include/arm-common/pmu.h b/arm/aarch64/include/asm/pmu.h
index 0085f254..38e3154b 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
index 5b058eab..6b190c5e 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