[PATCH v2 09/10] target-arm/kvm.c: better error reporting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Alex Bennée <alex@xxxxxxxxxx>

When we have a problem syncing CP registers between kvm<->qemu it's a
lot more useful to have the names of the registers in the log than just
a random abort() and core dump.

Signed-off-by: Alex Bennée <alex.bennee@xxxxxxxxxx>

---
v2
  - less verbose log message
  - fix checkpatch warnings

diff --git a/target-arm/kvm.c b/target-arm/kvm.c
index 319784d..72e242d 100644
--- a/target-arm/kvm.c
+++ b/target-arm/kvm.c
@@ -279,6 +279,16 @@ void kvm_arm_register_device(MemoryRegion *mr, uint64_t devid, uint64_t group,
     memory_region_ref(kd->mr);
 }
 
+static void failed_cpreg_operation(ARMCPU *cpu, uint64_t regidx, int ret,
+                                   const char *func)
+{
+    uint32_t cpreg_id = kvm_to_cpreg_id(regidx);
+    ARMCPRegInfo *cpreg = g_hash_table_lookup(cpu->cp_regs, &cpreg_id);
+    qemu_log_mask(LOG_UNIMP,
+                  "%s: failed (%d) KVM reg op %"PRIx64" (%s)\n",
+                  func, ret, regidx, cpreg ? cpreg->name : "unknown");
+}
+
 bool write_kvmstate_to_list(ARMCPU *cpu)
 {
     CPUState *cs = CPU(cpu);
@@ -309,6 +319,7 @@ bool write_kvmstate_to_list(ARMCPU *cpu)
             abort();
         }
         if (ret) {
+            failed_cpreg_operation(cpu, regidx, ret, __func__);
             ok = false;
         }
     }
@@ -345,6 +356,7 @@ bool write_list_to_kvmstate(ARMCPU *cpu)
              * "you tried to set a register which is constant with
              * a different value from what it actually contains".
              */
+            failed_cpreg_operation(cpu, regidx, ret, __func__);
             ok = false;
         }
     }
-- 
2.0.1

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux