Update VM ID print format to hexadecimal
Provided VM IDs are partitioned to non-secure and secure VM IDs (bit 15
clear/set), the VM ID print format looks nicer in the debug logs by
displaying an hexadecimal value rather than a decimal integer (one can
quickly determine if the mentioned ID is a VM or SP and get the ID from
the lower part of the value). This change updates print format strings
to use hex in place of decimal for VM IDs.
Change-Id: I1b957bf79fa824e7759ce88dc15e13cb72764aca
Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
diff --git a/src/api.c b/src/api.c
index 46d8a88..226b4e7 100644
--- a/src/api.c
+++ b/src/api.c
@@ -292,7 +292,7 @@
{
struct ffa_value ret = ffa_error(FFA_ABORTED);
- dlog_notice("Aborting VM %u vCPU %u\n", current->vm->id,
+ dlog_notice("Aborting VM %#x vCPU %u\n", current->vm->id,
vcpu_index(current));
if (current->vm->id == HF_PRIMARY_VM_ID) {
@@ -580,7 +580,7 @@
if (atomic_load_explicit(&vcpu->vm->aborting, memory_order_relaxed)) {
if (vcpu->state != VCPU_STATE_ABORTED) {
- dlog_notice("Aborting VM %u vCPU %u\n", vcpu->vm->id,
+ dlog_notice("Aborting VM %#x vCPU %u\n", vcpu->vm->id,
vcpu_index(vcpu));
vcpu->state = VCPU_STATE_ABORTED;
}
@@ -1518,9 +1518,9 @@
target_vcpu = vm_get_vcpu(target_vm, target_vcpu_idx);
- dlog_info("Injecting IRQ %d for VM %d vCPU %d from VM %d vCPU %d\n",
+ dlog_info("Injecting IRQ %u for VM %#x vCPU %u from VM %#x vCPU %u\n",
intid, target_vm_id, target_vcpu_idx, current->vm->id,
- current->cpu->id);
+ vcpu_index(current));
return internal_interrupt_inject(target_vcpu, intid, current, next);
}
@@ -1680,7 +1680,7 @@
if (atomic_load_explicit(&receiver_vcpu->vm->aborting,
memory_order_relaxed)) {
if (receiver_vcpu->state != VCPU_STATE_ABORTED) {
- dlog_notice("Aborting VM %u vCPU %u\n",
+ dlog_notice("Aborting VM %#x vCPU %u\n",
receiver_vcpu->vm->id,
vcpu_index(receiver_vcpu));
receiver_vcpu->state = VCPU_STATE_ABORTED;
diff --git a/src/arch/aarch64/hypervisor/handler.c b/src/arch/aarch64/hypervisor/handler.c
index c10f77e..b33298c 100644
--- a/src/arch/aarch64/hypervisor/handler.c
+++ b/src/arch/aarch64/hypervisor/handler.c
@@ -318,7 +318,7 @@
}
}
- dlog_notice("SMC %#010x attempted from VM %d, blocked=%d\n", func,
+ dlog_notice("SMC %#010x attempted from VM %#x, blocked=%u\n", func,
vm->id, block_by_default);
/* Access is still allowed in permissive mode. */
@@ -730,7 +730,7 @@
uintreg_t esr_el1_value = GET_ESR_ISS(esr_el2) | GET_ESR_IL(esr_el2) |
(EC_DATA_ABORT_SAME_EL << ESR_EC_OFFSET);
- dlog_notice("Injecting Data Abort exception into VM%d.\n",
+ dlog_notice("Injecting Data Abort exception into VM %#x.\n",
vcpu->vm->id);
inject_el1_exception(vcpu, esr_el1_value, far_el2);
@@ -752,7 +752,7 @@
GET_ESR_ISS(esr_el2) | GET_ESR_IL(esr_el2) |
(EC_INSTRUCTION_ABORT_SAME_EL << ESR_EC_OFFSET);
- dlog_notice("Injecting Instruction Abort exception into VM%d.\n",
+ dlog_notice("Injecting Instruction Abort exception into VM %#x.\n",
vcpu->vm->id);
inject_el1_exception(vcpu, esr_el1_value, far_el2);
@@ -781,7 +781,7 @@
GET_ISS_CRN(esr_el2), GET_ISS_CRM(esr_el2),
GET_ISS_OP2(esr_el2), GET_ISS_RT(esr_el2));
- dlog_notice("Injecting Unknown Reason exception into VM%d.\n",
+ dlog_notice("Injecting Unknown Reason exception into VM %#x.\n",
vcpu->vm->id);
inject_el1_exception(vcpu, esr_el1_value, far_el1_value);
diff --git a/src/ffa_memory.c b/src/ffa_memory.c
index 53130f2..661647c 100644
--- a/src/ffa_memory.c
+++ b/src/ffa_memory.c
@@ -328,7 +328,8 @@
return;
}
- dlog("from VM %d, attributes %#x, flags %#x, handle %#x, tag %d, to %d "
+ dlog("from VM %#x, attributes %#x, flags %#x, handle %#x, tag %u, to "
+ "%u "
"recipients [",
memory_region->sender, memory_region->attributes,
memory_region->flags, memory_region->handle, memory_region->tag,
@@ -337,7 +338,7 @@
if (i != 0) {
dlog(", ");
}
- dlog("VM %d: %#x (offset %d)",
+ dlog("VM %#x: %#x (offset %u)",
memory_region->receivers[i].receiver_permissions.receiver,
memory_region->receivers[i]
.receiver_permissions.permissions,
@@ -2593,8 +2594,8 @@
if (to_locked.vm->id != memory_region->sender) {
dlog_verbose(
- "VM %d attempted to reclaim memory handle %#x "
- "originally sent by VM %d.\n",
+ "VM %#x attempted to reclaim memory handle %#x "
+ "originally sent by VM %#x.\n",
to_locked.vm->id, handle, memory_region->sender);
ret = ffa_error(FFA_INVALID_PARAMETERS);
goto out;
@@ -2763,8 +2764,8 @@
/* The original sender must match the caller. */
if (to_locked.vm->id != memory_region->sender) {
dlog_verbose(
- "VM %d attempted to reclaim memory handle %#x "
- "originally sent by VM %d.\n",
+ "VM %#x attempted to reclaim memory handle %#x "
+ "originally sent by VM %#x.\n",
to_locked.vm->id, handle, memory_region->sender);
return ffa_error(FFA_INVALID_PARAMETERS);
}