From fb5f5a17ef0a4c25c8f1110c8f4f3f417dfaba01 Mon Sep 17 00:00:00 2001 From: Peter Grehan Date: Fri, 10 Jul 2020 07:26:50 +0000 Subject: [PATCH] Advertise 64-bit physical-address capability. This fixes a coredump with NetBSD guests when XHCI is configured. On seeing the AC64 flag clear, the NetBSD XHCI driver was only writing to the lower 32-bits of 64-bit physical address registers. The emulation relies on a write to the hi 32-bits to calculate a host virtual address for internal use, and has always supported 64-bit addressing. All other guests were seen to write to both the lo- and hi- address registers, regardless of the AC64 setting. Discussed with: Leon Dang (author) Tested with: Ubuntu 16/18/20, Windows10, OpenBSD UEFI guests. MFC after: 2 weeks. --- usr.sbin/bhyve/pci_xhci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usr.sbin/bhyve/pci_xhci.c b/usr.sbin/bhyve/pci_xhci.c index 06860e8dabe9..7a91a2dc9172 100644 --- a/usr.sbin/bhyve/pci_xhci.c +++ b/usr.sbin/bhyve/pci_xhci.c @@ -2805,7 +2805,8 @@ pci_xhci_init(struct vmctx *ctx, struct pci_devinst *pi, char *opts) sc->hcsparams2 = XHCI_SET_HCSP2_ERSTMAX(XHCI_ERST_MAX) | XHCI_SET_HCSP2_IST(0x04); sc->hcsparams3 = 0; /* no latency */ - sc->hccparams1 = XHCI_SET_HCCP1_NSS(1) | /* no 2nd-streams */ + sc->hccparams1 = XHCI_SET_HCCP1_AC64(1) | /* 64-bit addrs */ + XHCI_SET_HCCP1_NSS(1) | /* no 2nd-streams */ XHCI_SET_HCCP1_SPC(1) | /* short packet */ XHCI_SET_HCCP1_MAXPSA(XHCI_STREAMS_MAX); sc->hccparams2 = XHCI_SET_HCCP2_LEC(1) |