Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
target/arm/kvm: Have kvm_arm_pmu_init take a ARMCPU argument
Unify the "kvm_arm.h" API: All functions related to ARM vCPUs
take a ARMCPU* argument. Use the CPU() QOM cast macro When
calling the generic vCPU API from "sysemu/kvm.h".

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Gavin Shan <gshan@redhat.com>
Message-id: 20231123183518.64569-9-philmd@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
  • Loading branch information
philmd authored and pm215 committed Dec 19, 2023
1 parent 5550337 commit d344f5b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion hw/arm/virt.c
Expand Up @@ -2000,7 +2000,7 @@ static void virt_cpu_post_init(VirtMachineState *vms, MemoryRegion *sysmem)
if (kvm_irqchip_in_kernel()) {
kvm_arm_pmu_set_irq(cpu, VIRTUAL_PMU_IRQ);
}
kvm_arm_pmu_init(cpu);
kvm_arm_pmu_init(ARM_CPU(cpu));
}
if (steal_time) {
kvm_arm_pvtime_init(ARM_CPU(cpu), pvtime_reg_base
Expand Down
6 changes: 3 additions & 3 deletions target/arm/kvm.c
Expand Up @@ -1709,17 +1709,17 @@ static bool kvm_arm_set_device_attr(ARMCPU *cpu, struct kvm_device_attr *attr,
return true;
}

void kvm_arm_pmu_init(CPUState *cs)
void kvm_arm_pmu_init(ARMCPU *cpu)
{
struct kvm_device_attr attr = {
.group = KVM_ARM_VCPU_PMU_V3_CTRL,
.attr = KVM_ARM_VCPU_PMU_V3_INIT,
};

if (!ARM_CPU(cs)->has_pmu) {
if (!cpu->has_pmu) {
return;
}
if (!kvm_arm_set_device_attr(ARM_CPU(cs), &attr, "PMU")) {
if (!kvm_arm_set_device_attr(cpu, &attr, "PMU")) {
error_report("failed to init PMU");
abort();
}
Expand Down
4 changes: 2 additions & 2 deletions target/arm/kvm_arm.h
Expand Up @@ -200,8 +200,8 @@ int kvm_arm_get_max_vm_ipa_size(MachineState *ms, bool *fixed_ipa);

int kvm_arm_vgic_probe(void);

void kvm_arm_pmu_init(ARMCPU *cpu);
void kvm_arm_pmu_set_irq(CPUState *cs, int irq);
void kvm_arm_pmu_init(CPUState *cs);

/**
* kvm_arm_pvtime_init:
Expand Down Expand Up @@ -263,7 +263,7 @@ static inline void kvm_arm_pmu_set_irq(CPUState *cs, int irq)
g_assert_not_reached();
}

static inline void kvm_arm_pmu_init(CPUState *cs)
static inline void kvm_arm_pmu_init(ARMCPU *cpu)
{
g_assert_not_reached();
}
Expand Down

0 comments on commit d344f5b

Please sign in to comment.