[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 09/12] hw/arm/virt: Move kvm pmu setup to virt_cpu_post_init
From: |
Peter Maydell |
Subject: |
[PULL 09/12] hw/arm/virt: Move kvm pmu setup to virt_cpu_post_init |
Date: |
Thu, 8 Oct 2020 15:25:54 +0100 |
From: Andrew Jones <drjones@redhat.com>
Move the KVM PMU setup part of fdt_add_pmu_nodes() to
virt_cpu_post_init(), which is a more appropriate location. Now
fdt_add_pmu_nodes() is also named more appropriately, because it
no longer does anything but fdt node creation.
No functional change intended.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Andrew Jones <drjones@redhat.com>
Message-id: 20201001061718.101915-5-drjones@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
hw/arm/virt.c | 34 ++++++++++++++++++----------------
1 file changed, 18 insertions(+), 16 deletions(-)
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 524eafe22df..92ab0fd094d 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -521,21 +521,12 @@ static void fdt_add_gic_node(VirtMachineState *vms)
static void fdt_add_pmu_nodes(const VirtMachineState *vms)
{
- CPUState *cpu;
- ARMCPU *armcpu;
+ ARMCPU *armcpu = ARM_CPU(first_cpu);
uint32_t irqflags = GIC_FDT_IRQ_FLAGS_LEVEL_HI;
- CPU_FOREACH(cpu) {
- armcpu = ARM_CPU(cpu);
- if (!arm_feature(&armcpu->env, ARM_FEATURE_PMU)) {
- 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 (!arm_feature(&armcpu->env, ARM_FEATURE_PMU)) {
+ assert(!object_property_get_bool(OBJECT(armcpu), "pmu", NULL));
+ return;
}
if (vms->gic_version == VIRT_GIC_VERSION_2) {
@@ -544,7 +535,6 @@ static void fdt_add_pmu_nodes(const VirtMachineState *vms)
(1 << vms->smp_cpus) - 1);
}
- armcpu = ARM_CPU(qemu_get_cpu(0));
qemu_fdt_add_subnode(vms->fdt, "/pmu");
if (arm_feature(&armcpu->env, ARM_FEATURE_V8)) {
const char compat[] = "arm,armv8-pmuv3";
@@ -1678,11 +1668,23 @@ static void finalize_gic_version(VirtMachineState *vms)
*/
static void virt_cpu_post_init(VirtMachineState *vms)
{
- bool aarch64;
+ bool aarch64, pmu;
+ CPUState *cpu;
aarch64 = object_property_get_bool(OBJECT(first_cpu), "aarch64", NULL);
+ pmu = object_property_get_bool(OBJECT(first_cpu), "pmu", NULL);
- if (!kvm_enabled()) {
+ if (kvm_enabled()) {
+ CPU_FOREACH(cpu) {
+ if (pmu) {
+ assert(arm_feature(&ARM_CPU(cpu)->env, ARM_FEATURE_PMU));
+ if (kvm_irqchip_in_kernel()) {
+ kvm_arm_pmu_set_irq(cpu, PPI(VIRTUAL_PMU_IRQ));
+ }
+ kvm_arm_pmu_init(cpu);
+ }
+ }
+ } else {
if (aarch64 && vms->highmem) {
int requested_pa_size = 64 - clz64(vms->highest_gpa);
int pamax = arm_pamax(ARM_CPU(first_cpu));
--
2.20.1
- [PULL 00/12] target-arm queue, Peter Maydell, 2020/10/08
- [PULL 03/12] hw/arm/sbsa-ref : Fix SMMUv3 Initialisation, Peter Maydell, 2020/10/08
- [PULL 01/12] hw/ssi/npcm7xx_fiu: Fix handling of unsigned integer, Peter Maydell, 2020/10/08
- [PULL 06/12] linux headers: sync to 5.9-rc7, Peter Maydell, 2020/10/08
- [PULL 02/12] hw/arm/fsl-imx25: Fix a typo, Peter Maydell, 2020/10/08
- [PULL 04/12] hw/arm/sbsa-ref : allocate IRQs for SMMUv3, Peter Maydell, 2020/10/08
- [PULL 08/12] hw/arm/virt: Move post cpu realize check into its own function, Peter Maydell, 2020/10/08
- [PULL 07/12] target/arm/kvm: Make uncalled stubs explicitly unreachable, Peter Maydell, 2020/10/08
- [PULL 05/12] hw/char/bcm2835_aux: Allow less than 32-bit accesses, Peter Maydell, 2020/10/08
- [PULL 09/12] hw/arm/virt: Move kvm pmu setup to virt_cpu_post_init,
Peter Maydell <=
- [PULL 10/12] tests/qtest: Restore aarch64 arm-cpu-features test, Peter Maydell, 2020/10/08
- [PULL 11/12] hw/arm/virt: Implement kvm-steal-time, Peter Maydell, 2020/10/08
- [PULL 12/12] target/arm: Make '-cpu max' have a 48-bit PA, Peter Maydell, 2020/10/08