[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 05/12] target/arm/kvm: spe: Unify device attr operation helper
From: |
Haibo Xu |
Subject: |
[PATCH v2 05/12] target/arm/kvm: spe: Unify device attr operation helper |
Date: |
Tue, 8 Sep 2020 08:13:23 +0000 |
From: Andrew Jones <drjones@redhat.com>
Rename kvm_arm_pmu_set_attr() to kvm_arm_set_device_attr(),
So both the vPMU and vSPE device can share the same API.
Signed-off-by: Andrew Jones <drjones@redhat.com>
---
target/arm/kvm64.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c
index ef1e960285..8ffd31ffdf 100644
--- a/target/arm/kvm64.c
+++ b/target/arm/kvm64.c
@@ -397,19 +397,20 @@ static CPUWatchpoint *find_hw_watchpoint(CPUState *cpu,
target_ulong addr)
return NULL;
}
-static bool kvm_arm_pmu_set_attr(CPUState *cs, struct kvm_device_attr *attr)
+static bool kvm_arm_set_device_attr(CPUState *cs, struct kvm_device_attr *attr,
+ const char *name)
{
int err;
err = kvm_vcpu_ioctl(cs, KVM_HAS_DEVICE_ATTR, attr);
if (err != 0) {
- error_report("PMU: KVM_HAS_DEVICE_ATTR: %s", strerror(-err));
+ error_report("%s: KVM_HAS_DEVICE_ATTR: %s", name, strerror(-err));
return false;
}
err = kvm_vcpu_ioctl(cs, KVM_SET_DEVICE_ATTR, attr);
if (err != 0) {
- error_report("PMU: KVM_SET_DEVICE_ATTR: %s", strerror(-err));
+ error_report("%s: KVM_SET_DEVICE_ATTR: %s", name, strerror(-err));
return false;
}
@@ -426,7 +427,7 @@ void kvm_arm_pmu_init(CPUState *cs)
if (!ARM_CPU(cs)->has_pmu) {
return;
}
- if (!kvm_arm_pmu_set_attr(cs, &attr)) {
+ if (!kvm_arm_set_device_attr(cs, &attr, "PMU")) {
error_report("failed to init PMU");
abort();
}
@@ -443,7 +444,7 @@ void kvm_arm_pmu_set_irq(CPUState *cs, int irq)
if (!ARM_CPU(cs)->has_pmu) {
return;
}
- if (!kvm_arm_pmu_set_attr(cs, &attr)) {
+ if (!kvm_arm_set_device_attr(cs, &attr, "PMU")) {
error_report("failed to set irq for PMU");
abort();
}
--
2.17.1
- [PATCH v2 00/12] target/arm: Add vSPE support to KVM guest, Haibo Xu, 2020/09/08
- [PATCH v2 01/12] update Linux headers with new vSPE macros, Haibo Xu, 2020/09/08
- [PATCH v2 02/12] target/arm/kvm: spe: Add helper to detect SPE when using KVM, Haibo Xu, 2020/09/08
- [PATCH v2 04/12] target/arm: spe: Only enable SPE from 5.2 compat machines., Haibo Xu, 2020/09/08
- [PATCH v2 05/12] target/arm/kvm: spe: Unify device attr operation helper,
Haibo Xu <=
- [PATCH v2 03/12] target/arm/cpu: spe: Add an option to turn on/off vSPE support, Haibo Xu, 2020/09/08
- [PATCH v2 07/12] hw/arm/virt: Move post cpu realize check into its own function, Haibo Xu, 2020/09/08
- [PATCH v2 06/12] target/arm/kvm: spe: Add device init and set_irq operations, Haibo Xu, 2020/09/08
- [PATCH v2 09/12] hw/arm/virt: spe: Add SPE fdt binding for virt machine, Haibo Xu, 2020/09/08