Skip to content

Commit 916bf7f

Browse files
pmjphilmd
authored andcommitted
hw/usb/hcd-xhci: Unimplemented/guest error logging for port MMIO
The XHCI device code uses tracing rather than logging on various code paths that are so far unimplemented. In some cases, these code paths actually indicate faulty guest software. This patch switches instances in the read and write handlers for the port MMIO region to use qemu_log_mask() with LOG_UNIMP or LOG_GUEST_ERROR, as appropriate in each case. Signed-off-by: Phil Dennis-Jordan <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Message-ID: <[email protected]> Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
1 parent 92270bd commit 916bf7f

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

hw/usb/hcd-xhci.c

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2810,9 +2810,15 @@ static uint64_t xhci_port_read(void *ptr, hwaddr reg, unsigned size)
28102810
case 0x08: /* PORTLI */
28112811
ret = 0;
28122812
break;
2813-
case 0x0c: /* reserved */
2813+
case 0x0c: /* PORTHLPMC */
2814+
ret = 0;
2815+
qemu_log_mask(LOG_UNIMP, "%s: read from port register PORTHLPMC",
2816+
__func__);
2817+
break;
28142818
default:
2815-
trace_usb_xhci_unimplemented("port read", reg);
2819+
qemu_log_mask(LOG_GUEST_ERROR,
2820+
"%s: read from port offset 0x%" HWADDR_PRIx,
2821+
__func__, reg);
28162822
ret = 0;
28172823
}
28182824

@@ -2881,9 +2887,22 @@ static void xhci_port_write(void *ptr, hwaddr reg,
28812887
}
28822888
break;
28832889
case 0x04: /* PORTPMSC */
2890+
case 0x0c: /* PORTHLPMC */
2891+
qemu_log_mask(LOG_UNIMP,
2892+
"%s: write 0x%" PRIx64
2893+
" (%u bytes) to port register at offset 0x%" HWADDR_PRIx,
2894+
__func__, val, size, reg);
2895+
break;
28842896
case 0x08: /* PORTLI */
2897+
qemu_log_mask(LOG_GUEST_ERROR, "%s: Write to read-only PORTLI register",
2898+
__func__);
2899+
break;
28852900
default:
2886-
trace_usb_xhci_unimplemented("port write", reg);
2901+
qemu_log_mask(LOG_GUEST_ERROR,
2902+
"%s: write 0x%" PRIx64 " (%u bytes) to unknown port "
2903+
"register at offset 0x%" HWADDR_PRIx,
2904+
__func__, val, size, reg);
2905+
break;
28872906
}
28882907
}
28892908

0 commit comments

Comments
 (0)