All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandru Elisei <alexandru.elisei@arm.com>
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 v2 kvmtool 05/10] arm: Make the PMUv3 emulation code arm64 specific
Date: Thu, 27 Jan 2022 16:20:28 +0000	[thread overview]
Message-ID: <20220127162033.54290-6-alexandru.elisei@arm.com> (raw)
In-Reply-To: <20220127162033.54290-1-alexandru.elisei@arm.com>

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>
---
 Makefile                                              | 4 ++--
 arm/aarch64/arm-cpu.c                                 | 3 ++-
 arm/{include/arm-common => aarch64/include/asm}/pmu.h | 0
 arm/{ => aarch64}/pmu.c                               | 7 ++-----
 4 files changed, 6 insertions(+), 8 deletions(-)
 rename arm/{include/arm-common => aarch64/include/asm}/pmu.h (100%)
 rename arm/{ => aarch64}/pmu.c (93%)

diff --git a/Makefile b/Makefile
index f25114755701..2fe5fb0fba62 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
@@ -182,6 +181,7 @@ ifeq ($(ARCH), arm64)
 	OBJS		+= arm/aarch64/arm-cpu.o
 	OBJS		+= arm/aarch64/kvm-cpu.o
 	OBJS		+= arm/aarch64/kvm.o
+	OBJS		+= arm/aarch64/pmu.o
 	ARCH_INCLUDE	:= $(HDRS_ARM_COMMON)
 	ARCH_INCLUDE	+= -Iarm/aarch64/include
 
diff --git a/arm/aarch64/arm-cpu.c b/arm/aarch64/arm-cpu.c
index d7572b7790b1..1ec37fa60c50 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
similarity index 100%
rename from arm/include/arm-common/pmu.h
rename to arm/aarch64/include/asm/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
-- 
2.31.1

_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

WARNING: multiple messages have this Message-ID (diff)
From: Alexandru Elisei <alexandru.elisei@arm.com>
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 v2 kvmtool 05/10] arm: Make the PMUv3 emulation code arm64 specific
Date: Thu, 27 Jan 2022 16:20:28 +0000	[thread overview]
Message-ID: <20220127162033.54290-6-alexandru.elisei@arm.com> (raw)
In-Reply-To: <20220127162033.54290-1-alexandru.elisei@arm.com>

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>
---
 Makefile                                              | 4 ++--
 arm/aarch64/arm-cpu.c                                 | 3 ++-
 arm/{include/arm-common => aarch64/include/asm}/pmu.h | 0
 arm/{ => aarch64}/pmu.c                               | 7 ++-----
 4 files changed, 6 insertions(+), 8 deletions(-)
 rename arm/{include/arm-common => aarch64/include/asm}/pmu.h (100%)
 rename arm/{ => aarch64}/pmu.c (93%)

diff --git a/Makefile b/Makefile
index f25114755701..2fe5fb0fba62 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
@@ -182,6 +181,7 @@ ifeq ($(ARCH), arm64)
 	OBJS		+= arm/aarch64/arm-cpu.o
 	OBJS		+= arm/aarch64/kvm-cpu.o
 	OBJS		+= arm/aarch64/kvm.o
+	OBJS		+= arm/aarch64/pmu.o
 	ARCH_INCLUDE	:= $(HDRS_ARM_COMMON)
 	ARCH_INCLUDE	+= -Iarm/aarch64/include
 
diff --git a/arm/aarch64/arm-cpu.c b/arm/aarch64/arm-cpu.c
index d7572b7790b1..1ec37fa60c50 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
similarity index 100%
rename from arm/include/arm-common/pmu.h
rename to arm/aarch64/include/asm/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
-- 
2.31.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2022-01-27 16:20 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-27 16:20 [PATCH v2 kvmtool 00/10] arm64: Improve PMU support on heterogeneous systems Alexandru Elisei
2022-01-27 16:20 ` Alexandru Elisei
2022-01-27 16:20 ` [PATCH v2 kvmtool 01/10] linux/err.h: Add missing stdbool.h include Alexandru Elisei
2022-01-27 16:20   ` Alexandru Elisei
2022-01-27 16:20 ` [PATCH v2 kvmtool 02/10] bitops.h: Include wordsize.h to provide the __WORDSIZE define Alexandru Elisei
2022-01-27 16:20   ` Alexandru Elisei
2022-01-27 16:20 ` [PATCH v2 kvmtool 03/10] arm: Move arch specific VCPU features to the arch specific function Alexandru Elisei
2022-01-27 16:20   ` Alexandru Elisei
2022-01-27 16:20 ` [PATCH v2 kvmtool 04/10] arm: Get rid of the ARM_VCPU_FEATURE_FLAGS() macro Alexandru Elisei
2022-01-27 16:20   ` Alexandru Elisei
2022-01-27 16:20 ` Alexandru Elisei [this message]
2022-01-27 16:20   ` [PATCH v2 kvmtool 05/10] arm: Make the PMUv3 emulation code arm64 specific Alexandru Elisei
2022-01-27 16:20 ` [PATCH v2 kvmtool 06/10] arm64: Rework set_pmu_attr() Alexandru Elisei
2022-01-27 16:20   ` Alexandru Elisei
2022-01-27 16:20 ` [PATCH v2 kvmtool 07/10] Add cpumask functions Alexandru Elisei
2022-01-27 16:20   ` Alexandru Elisei
2022-01-27 16:20 ` [PATCH v2 kvmtool 08/10] update_headers.sh: Sync headers with Linux v5.17-rc1 + SET_PMU attribute Alexandru Elisei
2022-01-27 16:20   ` Alexandru Elisei
2022-01-27 16:20 ` [PATCH v2 kvmtool 09/10] arm64: Add support for KVM_ARM_VCPU_PMU_V3_SET_PMU Alexandru Elisei
2022-01-27 16:20   ` Alexandru Elisei
2022-01-27 16:20 ` [PATCH v2 kvmtool 10/10] arm64: Add --vcpu-affinity command line argument Alexandru Elisei
2022-01-27 16:20   ` Alexandru Elisei
2022-02-14 10:20 ` [PATCH v2 kvmtool 00/10] arm64: Improve PMU support on heterogeneous systems Alexandru Elisei
2022-02-14 10:20   ` Alexandru Elisei

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220127162033.54290-6-alexandru.elisei@arm.com \
    --to=alexandru.elisei@arm.com \
    --cc=andre.przywara@arm.com \
    --cc=james.morse@arm.com \
    --cc=julien.thierry.kdev@gmail.com \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=maz@kernel.org \
    --cc=suzuki.poulose@arm.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.