[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20250324023450.109312-1-justin.he@arm.com>
Date: Mon, 24 Mar 2025 02:34:50 +0000
From: Jia He <justin.he@....com>
To: Marc Zyngier <maz@...nel.org>,
Oliver Upton <oliver.upton@...ux.dev>,
linux-arm-kernel@...ts.infradead.org,
kvmarm@...ts.linux.dev
Cc: Joey Gouly <joey.gouly@....com>,
Suzuki K Poulose <suzuki.poulose@....com>,
Zenghui Yu <yuzenghui@...wei.com>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>,
linux-kernel@...r.kernel.org,
Jia He <justin.he@....com>
Subject: [PATCH v2] KVM: arm64: Skip the KVM pmu initialization when hyp is unavailable
When Hyp mode is unavailable (e.g., the kernel boots from EL1), skip the
unnecessary KVM pmu initialization.
Signed-off-by: Jia He <justin.he@....com>
---
v2:
- Utilize is_hyp_mode_available() for improved accuracy when detecting the
guest VM case, as it accounts for scenarios where the kernel boots from EL1.
arch/arm64/kvm/pmu-emul.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/arch/arm64/kvm/pmu-emul.c b/arch/arm64/kvm/pmu-emul.c
index 6c5950b9ceac..81b1a84ee1b3 100644
--- a/arch/arm64/kvm/pmu-emul.c
+++ b/arch/arm64/kvm/pmu-emul.c
@@ -779,6 +779,13 @@ void kvm_host_pmu_init(struct arm_pmu *pmu)
{
struct arm_pmu_entry *entry;
+ /*
+ * When Hyp mode is unavailable (e.g., the kernel boots from EL1),
+ * skip the unnecessary KVM PMU initialization.
+ */
+ if (!is_hyp_mode_available())
+ return;
+
/*
* Check the sanitised PMU version for the system, as KVM does not
* support implementations where PMUv3 exists on a subset of CPUs.
--
2.34.1
Powered by blists - more mailing lists