[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH RFC V3 08/29] arm/virt: Init PMU at host for all possible vcpus
From: |
Salil Mehta |
Subject: |
[PATCH RFC V3 08/29] arm/virt: Init PMU at host for all possible vcpus |
Date: |
Fri, 14 Jun 2024 00:36:18 +0100 |
PMU for all possible vCPUs must be initialized at the VM initialization time.
Refactor existing code to accomodate possible vCPUs. This also assumes that all
processor being used are identical.
Past discussion for reference:
Link: https://lists.gnu.org/archive/html/qemu-devel/2020-06/msg00131.html
Co-developed-by: Salil Mehta <salil.mehta@huawei.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
Co-developed-by: Keqian Zhu <zhukeqian1@huawei.com>
Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
---
hw/arm/virt.c | 12 ++++++++----
include/hw/arm/virt.h | 1 +
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index ac53bfadca..57ec429022 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -2045,12 +2045,14 @@ static void finalize_gic_version(VirtMachineState *vms)
*/
static void virt_cpu_post_init(VirtMachineState *vms, MemoryRegion *sysmem)
{
+ CPUArchIdList *possible_cpus = vms->parent.possible_cpus;
int max_cpus = MACHINE(vms)->smp.max_cpus;
- bool aarch64, pmu, steal_time;
+ bool aarch64, steal_time;
CPUState *cpu;
+ int n;
aarch64 = object_property_get_bool(OBJECT(first_cpu), "aarch64", NULL);
- pmu = object_property_get_bool(OBJECT(first_cpu), "pmu", NULL);
+ vms->pmu = object_property_get_bool(OBJECT(first_cpu), "pmu", NULL);
steal_time = object_property_get_bool(OBJECT(first_cpu),
"kvm-steal-time", NULL);
@@ -2077,8 +2079,10 @@ static void virt_cpu_post_init(VirtMachineState *vms,
MemoryRegion *sysmem)
memory_region_add_subregion(sysmem, pvtime_reg_base, pvtime);
}
- CPU_FOREACH(cpu) {
- if (pmu) {
+ for (n = 0; n < possible_cpus->len; n++) {
+ cpu = qemu_get_possible_cpu(n);
+
+ if (vms->pmu) {
assert(arm_feature(&ARM_CPU(cpu)->env, ARM_FEATURE_PMU));
if (kvm_irqchip_in_kernel()) {
kvm_arm_pmu_set_irq(ARM_CPU(cpu), VIRTUAL_PMU_IRQ);
diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h
index 36ac5ff4a2..d8dcc89a0d 100644
--- a/include/hw/arm/virt.h
+++ b/include/hw/arm/virt.h
@@ -155,6 +155,7 @@ struct VirtMachineState {
bool ras;
bool mte;
bool dtb_randomness;
+ bool pmu;
OnOffAuto acpi;
VirtGICType gic_version;
VirtIOMMUType iommu;
--
2.34.1
- [PATCH RFC V3 00/29] Support of Virtual CPU Hotplug for ARMv8 Arch, Salil Mehta, 2024/06/13
- [PATCH RFC V3 01/29] arm/virt, target/arm: Add new ARMCPU {socket, cluster, core, thread}-id property, Salil Mehta, 2024/06/13
- [PATCH RFC V3 02/29] cpu-common: Add common CPU utility for possible vCPUs, Salil Mehta, 2024/06/13
- [PATCH RFC V3 03/29] hw/arm/virt: Limit number of possible vCPUs for unsupported Accel or GIC Type, Salil Mehta, 2024/06/13
- [PATCH RFC V3 04/29] hw/arm/virt: Move setting of common CPU properties in a function, Salil Mehta, 2024/06/13
- [PATCH RFC V3 05/29] arm/virt, target/arm: Machine init time change common to vCPU {cold|hot}-plug, Salil Mehta, 2024/06/13
- [PATCH RFC V3 06/29] arm/virt, kvm: Pre-create disabled possible vCPUs @machine init, Salil Mehta, 2024/06/13
- [PATCH RFC V3 07/29] arm/virt, gicv3: Changes to pre-size GIC with possible vcpus @machine init, Salil Mehta, 2024/06/13
- [PATCH RFC V3 08/29] arm/virt: Init PMU at host for all possible vcpus,
Salil Mehta <=
- [PATCH RFC V3 09/29] arm/acpi: Enable ACPI support for vcpu hotplug, Salil Mehta, 2024/06/13
- [PATCH RFC V3 10/29] arm/virt: Add cpu hotplug events to GED during creation, Salil Mehta, 2024/06/13
- [PATCH RFC V3 11/29] arm/virt: Create GED dev before *disabled* CPU Objs are destroyed, Salil Mehta, 2024/06/13
- [PATCH RFC V3 12/29] arm/virt/acpi: Build CPUs AML with CPU Hotplug support, Salil Mehta, 2024/06/13
- [PATCH RFC V3 13/29] arm/virt: Make ARM vCPU *present* status ACPI *persistent*, Salil Mehta, 2024/06/13
- [PATCH RFC V3 14/29] hw/acpi: ACPI/AML Changes to reflect the correct _STA.{PRES, ENA} Bits to Guest, Salil Mehta, 2024/06/13
- [PATCH RFC V3 15/29] hw/arm: MADT Tbl change to size the guest with possible vCPUs, Salil Mehta, 2024/06/13
- [PATCH RFC V3 16/29] hw/acpi: Make _MAT method optional, Salil Mehta, 2024/06/13
- [PATCH RFC V3 17/29] arm/virt: Release objects for *disabled* possible vCPUs after init, Salil Mehta, 2024/06/13
- [PATCH RFC V3 18/29] arm/virt: Add/update basic hot-(un)plug framework, Salil Mehta, 2024/06/13