Skip to content

Commit

Permalink
target/arm/kvm: Have kvm_arm_set_device_attr take a ARMCPU argument
Browse files Browse the repository at this point in the history
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-7-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 d633928 commit e77034f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions target/arm/kvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1689,18 +1689,18 @@ void kvm_arch_remove_all_hw_breakpoints(void)
}
}

static bool kvm_arm_set_device_attr(CPUState *cs, struct kvm_device_attr *attr,
static bool kvm_arm_set_device_attr(ARMCPU *cpu, struct kvm_device_attr *attr,
const char *name)
{
int err;

err = kvm_vcpu_ioctl(cs, KVM_HAS_DEVICE_ATTR, attr);
err = kvm_vcpu_ioctl(CPU(cpu), KVM_HAS_DEVICE_ATTR, attr);
if (err != 0) {
error_report("%s: KVM_HAS_DEVICE_ATTR: %s", name, strerror(-err));
return false;
}

err = kvm_vcpu_ioctl(cs, KVM_SET_DEVICE_ATTR, attr);
err = kvm_vcpu_ioctl(CPU(cpu), KVM_SET_DEVICE_ATTR, attr);
if (err != 0) {
error_report("%s: KVM_SET_DEVICE_ATTR: %s", name, strerror(-err));
return false;
Expand All @@ -1719,7 +1719,7 @@ void kvm_arm_pmu_init(CPUState *cs)
if (!ARM_CPU(cs)->has_pmu) {
return;
}
if (!kvm_arm_set_device_attr(cs, &attr, "PMU")) {
if (!kvm_arm_set_device_attr(ARM_CPU(cs), &attr, "PMU")) {
error_report("failed to init PMU");
abort();
}
Expand All @@ -1736,7 +1736,7 @@ void kvm_arm_pmu_set_irq(CPUState *cs, int irq)
if (!ARM_CPU(cs)->has_pmu) {
return;
}
if (!kvm_arm_set_device_attr(cs, &attr, "PMU")) {
if (!kvm_arm_set_device_attr(ARM_CPU(cs), &attr, "PMU")) {
error_report("failed to set irq for PMU");
abort();
}
Expand All @@ -1753,7 +1753,7 @@ void kvm_arm_pvtime_init(CPUState *cs, uint64_t ipa)
if (ARM_CPU(cs)->kvm_steal_time == ON_OFF_AUTO_OFF) {
return;
}
if (!kvm_arm_set_device_attr(cs, &attr, "PVTIME IPA")) {
if (!kvm_arm_set_device_attr(ARM_CPU(cs), &attr, "PVTIME IPA")) {
error_report("failed to init PVTIME IPA");
abort();
}
Expand Down

0 comments on commit e77034f

Please sign in to comment.