!341 bugfix: 为热插的CPU初始化PMU
From: @imxcc Reviewed-by: @kevinzhu1 Signed-off-by: @kevinzhu1
This commit is contained in:
commit
18493867e7
73
hw-arm-virt-Init-PMU-for-hotplugged-vCPU.patch
Normal file
73
hw-arm-virt-Init-PMU-for-hotplugged-vCPU.patch
Normal file
@ -0,0 +1,73 @@
|
||||
From acc5162f1d1591ee4830f9b67934fc6d8a9ebbc1 Mon Sep 17 00:00:00 2001
|
||||
From: Keqian Zhu <zhukeqian1@huawei.com>
|
||||
Date: Tue, 8 Sep 2020 22:09:44 +0800
|
||||
Subject: [PATCH] hw/arm/virt: Init PMU for hotplugged vCPU
|
||||
|
||||
Factor out PMU init code from fdt_add_pmu_nodes and
|
||||
do PMU init for hotplugged vCPU.
|
||||
|
||||
Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com>
|
||||
---
|
||||
hw/arm/virt.c | 29 +++++++++++++++++++++--------
|
||||
1 file changed, 21 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
|
||||
index 7afc6c5e..7506d0ff 100644
|
||||
--- a/hw/arm/virt.c
|
||||
+++ b/hw/arm/virt.c
|
||||
@@ -605,6 +605,23 @@ static void fdt_add_gic_node(VirtMachineState *vms)
|
||||
g_free(nodename);
|
||||
}
|
||||
|
||||
+static bool virt_cpu_init_pmu(const VirtMachineState *vms, CPUState *cpu)
|
||||
+{
|
||||
+ ARMCPU *armcpu = ARM_CPU(cpu);
|
||||
+
|
||||
+ if (!arm_feature(&armcpu->env, ARM_FEATURE_PMU)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ if (kvm_enabled()) {
|
||||
+ if (kvm_irqchip_in_kernel()) {
|
||||
+ kvm_arm_pmu_set_irq(cpu, PPI(VIRTUAL_PMU_IRQ));
|
||||
+ }
|
||||
+ kvm_arm_pmu_init(cpu);
|
||||
+ }
|
||||
+
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
static void fdt_add_pmu_nodes(const VirtMachineState *vms)
|
||||
{
|
||||
CPUState *cpu;
|
||||
@@ -612,16 +629,9 @@ static void fdt_add_pmu_nodes(const VirtMachineState *vms)
|
||||
uint32_t irqflags = GIC_FDT_IRQ_FLAGS_LEVEL_HI;
|
||||
|
||||
CPU_FOREACH(cpu) {
|
||||
- armcpu = ARM_CPU(cpu);
|
||||
- if (!arm_feature(&armcpu->env, ARM_FEATURE_PMU)) {
|
||||
+ if (!virt_cpu_init_pmu(vms, cpu)) {
|
||||
return;
|
||||
}
|
||||
- if (kvm_enabled()) {
|
||||
- if (kvm_irqchip_in_kernel()) {
|
||||
- kvm_arm_pmu_set_irq(cpu, PPI(VIRTUAL_PMU_IRQ));
|
||||
- }
|
||||
- kvm_arm_pmu_init(cpu);
|
||||
- }
|
||||
}
|
||||
|
||||
if (vms->gic_version == 2) {
|
||||
@@ -2248,6 +2258,9 @@ static void virt_cpu_plug(HotplugHandler *hotplug_dev,
|
||||
agcc->cpu_hotplug_realize(gicv3, ncpu);
|
||||
connect_gic_cpu_irqs(vms, ncpu);
|
||||
|
||||
+ /* Init PMU part */
|
||||
+ virt_cpu_init_pmu(vms, cs);
|
||||
+
|
||||
/* Register CPU reset and trigger it manually */
|
||||
cpu_synchronize_state(cs);
|
||||
cpu_hotplug_register_reset(ncpu);
|
||||
--
|
||||
2.23.0
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Name: qemu
|
||||
Version: 4.1.0
|
||||
Release: 70
|
||||
Release: 71
|
||||
Epoch: 2
|
||||
Summary: QEMU is a generic and open source machine emulator and virtualizer
|
||||
License: GPLv2 and BSD and MIT and CC-BY-SA-4.0
|
||||
@ -414,6 +414,7 @@ Patch0401: vl-Don-t-mismatch-g_strsplit-g_free.patch
|
||||
Patch0402: seqlock-fix-seqlock_write_unlock_impl-function.patch
|
||||
Patch0403: target-i386-kvm-initialize-microcode-revision-from-K.patch
|
||||
Patch0404: target-i386-check-for-availability-of-MSR_IA32_UCODE.patch
|
||||
Patch0405: hw-arm-virt-Init-PMU-for-hotplugged-vCPU.patch
|
||||
|
||||
BuildRequires: flex
|
||||
BuildRequires: gcc
|
||||
@ -808,6 +809,9 @@ getent passwd qemu >/dev/null || \
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Fri Jul 23 2021 imxcc <xingchaochao@huawei.com>
|
||||
- hw/arm/virt: Init PMU for hotplugged vCPU
|
||||
|
||||
* Fri Jul 23 2021 Chen Qun <kuhn.chenqun@huawei.com>
|
||||
- vl: Don't mismatch g_strsplit()/g_free()
|
||||
- seqlock: fix seqlock_write_unlock_impl function
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user