git: fc98569fc370 - main - bhyve: Do not compile PCI passthrough support on arm64

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Wed, 10 Apr 2024 15:19:15 UTC
The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=fc98569fc370c7f5a2039d472ee3b01f5a78b177

commit fc98569fc370c7f5a2039d472ee3b01f5a78b177
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-04-03 17:11:24 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-04-10 15:17:56 +0000

    bhyve: Do not compile PCI passthrough support on arm64
    
    Some required kernel functionality is not yet implemented.
    
    For now this means that one cannot specify host PCI register values, but
    that functionality is only used by amd64-specific device models for now.
    Note that this limitation is rather artificial; it arises only because
    pci_host_read_config() lives in pci_passthru.c.
    
    Reviewed by:    corvink, andrew, jhb
    MFC after:      2 weeks
    Sponsored by:   Innovate UK
    Differential Revision:  https://reviews.freebsd.org/D41738
---
 usr.sbin/bhyve/Makefile           | 1 -
 usr.sbin/bhyve/amd64/Makefile.inc | 1 +
 usr.sbin/bhyve/pci_emul.c         | 6 +++++-
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/usr.sbin/bhyve/Makefile b/usr.sbin/bhyve/Makefile
index efa5b4acf897..124476ef7d2f 100644
--- a/usr.sbin/bhyve/Makefile
+++ b/usr.sbin/bhyve/Makefile
@@ -40,7 +40,6 @@ SRCS=	\
 	pci_emul.c		\
 	pci_hostbridge.c	\
 	pci_nvme.c		\
-	pci_passthru.c		\
 	pci_virtio_9p.c		\
 	pci_virtio_block.c	\
 	pci_virtio_console.c	\
diff --git a/usr.sbin/bhyve/amd64/Makefile.inc b/usr.sbin/bhyve/amd64/Makefile.inc
index bc0ffa720d31..d281e3cf1581 100644
--- a/usr.sbin/bhyve/amd64/Makefile.inc
+++ b/usr.sbin/bhyve/amd64/Makefile.inc
@@ -15,6 +15,7 @@ SRCS+=	\
 	pci_hda.c	\
 	pci_irq.c	\
 	pci_lpc.c	\
+	pci_passthru.c	\
 	pci_uart.c	\
 	pci_xhci.c	\
 	pctestdev.c	\
diff --git a/usr.sbin/bhyve/pci_emul.c b/usr.sbin/bhyve/pci_emul.c
index e5e9e56cc3c3..9df05fda5866 100644
--- a/usr.sbin/bhyve/pci_emul.c
+++ b/usr.sbin/bhyve/pci_emul.c
@@ -59,8 +59,8 @@
 #ifdef __amd64__
 #include "amd64/pci_irq.h"
 #include "amd64/pci_lpc.h"
-#endif
 #include "pci_passthru.h"
+#endif
 #include "qemu_fwcfg.h"
 
 #define CONF1_ADDR_PORT	   0x0cf8
@@ -381,7 +381,11 @@ pci_config_read_reg(const struct pcisel *const host_sel, nvlist_t *nvl,
 	if (config == NULL) {
 		return def;
 	} else if (host_sel != NULL && strcmp(config, "host") == 0) {
+#ifdef __amd64__
 		return pci_host_read_config(host_sel, reg, size);
+#else
+		errx(1, "cannot fetch host PCI configuration");
+#endif
 	} else {
 		return strtol(config, NULL, 16);
 	}