73 lines
2.7 KiB
Diff
73 lines
2.7 KiB
Diff
|
|
From 85e8e1ee8560e587845142342f81b218e44cba6a Mon Sep 17 00:00:00 2001
|
||
|
|
From: Keqian Zhu <zhukeqian1@huawei.com>
|
||
|
|
Date: Tue, 26 Mar 2024 22:07:33 +0800
|
||
|
|
Subject: [PATCH] arm/kvm: Set psci smccc filter only with vcpu hotplug
|
||
|
|
|
||
|
|
The smccc filter mechanism is supported by newer Linux kernel,
|
||
|
|
don't try to do it unconditionaly.
|
||
|
|
|
||
|
|
Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com>
|
||
|
|
---
|
||
|
|
hw/arm/virt.c | 4 +++-
|
||
|
|
target/arm/kvm.c | 21 ++++++++++++---------
|
||
|
|
2 files changed, 15 insertions(+), 10 deletions(-)
|
||
|
|
|
||
|
|
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
|
||
|
|
index e60f3431f9..38b5d214a1 100644
|
||
|
|
--- a/hw/arm/virt.c
|
||
|
|
+++ b/hw/arm/virt.c
|
||
|
|
@@ -2366,8 +2366,10 @@ static void machvirt_init(MachineState *machine)
|
||
|
|
finalize_gic_version(vms);
|
||
|
|
if (tcg_enabled() || hvf_enabled() || qtest_enabled() ||
|
||
|
|
(vms->gic_version < VIRT_GIC_VERSION_3)) {
|
||
|
|
- machine->smp.max_cpus = smp_cpus;
|
||
|
|
mc->has_hotpluggable_cpus = false;
|
||
|
|
+ }
|
||
|
|
+ if (!mc->has_hotpluggable_cpus) {
|
||
|
|
+ machine->smp.max_cpus = smp_cpus;
|
||
|
|
warn_report("cpu hotplug feature has been disabled");
|
||
|
|
}
|
||
|
|
|
||
|
|
diff --git a/target/arm/kvm.c b/target/arm/kvm.c
|
||
|
|
index 66caf9e5e7..19783d567f 100644
|
||
|
|
--- a/target/arm/kvm.c
|
||
|
|
+++ b/target/arm/kvm.c
|
||
|
|
@@ -259,6 +259,7 @@ int kvm_arch_get_default_type(MachineState *ms)
|
||
|
|
|
||
|
|
int kvm_arch_init(MachineState *ms, KVMState *s)
|
||
|
|
{
|
||
|
|
+ MachineClass *mc = MACHINE_GET_CLASS(ms);
|
||
|
|
int ret = 0;
|
||
|
|
|
||
|
|
/* For ARM interrupt delivery is always asynchronous,
|
||
|
|
@@ -316,15 +317,17 @@ int kvm_arch_init(MachineState *ms, KVMState *s)
|
||
|
|
* filter in the Host KVM. This is required to support features like
|
||
|
|
* virtual CPU Hotplug on ARM platforms.
|
||
|
|
*/
|
||
|
|
- if (kvm_arm_set_smccc_filter(PSCI_0_2_FN64_CPU_ON,
|
||
|
|
- KVM_SMCCC_FILTER_FWD_TO_USER)) {
|
||
|
|
- error_report("CPU On PSCI-to-user-space fwd filter install failed");
|
||
|
|
- abort();
|
||
|
|
- }
|
||
|
|
- if (kvm_arm_set_smccc_filter(PSCI_0_2_FN_CPU_OFF,
|
||
|
|
- KVM_SMCCC_FILTER_FWD_TO_USER)) {
|
||
|
|
- error_report("CPU Off PSCI-to-user-space fwd filter install failed");
|
||
|
|
- abort();
|
||
|
|
+ if (mc->has_hotpluggable_cpus && ms->smp.max_cpus > ms->smp.cpus) {
|
||
|
|
+ if (kvm_arm_set_smccc_filter(PSCI_0_2_FN64_CPU_ON,
|
||
|
|
+ KVM_SMCCC_FILTER_FWD_TO_USER)) {
|
||
|
|
+ error_report("CPU On PSCI-to-user-space fwd filter install failed");
|
||
|
|
+ mc->has_hotpluggable_cpus = false;
|
||
|
|
+ }
|
||
|
|
+ if (kvm_arm_set_smccc_filter(PSCI_0_2_FN_CPU_OFF,
|
||
|
|
+ KVM_SMCCC_FILTER_FWD_TO_USER)) {
|
||
|
|
+ error_report("CPU Off PSCI-to-user-space fwd filter install failed");
|
||
|
|
+ mc->has_hotpluggable_cpus = false;
|
||
|
|
+ }
|
||
|
|
}
|
||
|
|
|
||
|
|
kvm_arm_init_debug(s);
|
||
|
|
--
|
||
|
|
2.27.0
|
||
|
|
|