Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F150714672
D45049.id142047.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D45049.id142047.diff
View Options
diff --git a/usr.sbin/bhyve/bhyve_config.5 b/usr.sbin/bhyve/bhyve_config.5
--- a/usr.sbin/bhyve/bhyve_config.5
+++ b/usr.sbin/bhyve/bhyve_config.5
@@ -157,6 +157,9 @@
This value only works when loaded with UEFI mode for VNC, and
used a VNC client that don't support QEMU Extended Key Event
Message (e.g. TightVNC).
+.It Va pci.enable_bars Ta bool Ta Ta
+Enable and map PCI BARs before executing any guest code.
+This setting is false by default when using a boot ROM and true otherwise.
.It Va tpm.path Ta string Ta Ta
Path to the host TPM device.
This is typically /dev/tpm0.
diff --git a/usr.sbin/bhyve/pci_emul.c b/usr.sbin/bhyve/pci_emul.c
--- a/usr.sbin/bhyve/pci_emul.c
+++ b/usr.sbin/bhyve/pci_emul.c
@@ -48,6 +48,7 @@
#include "acpi.h"
#include "bhyverun.h"
+#include "bootrom.h"
#include "config.h"
#include "debug.h"
#ifdef __amd64__
@@ -853,6 +854,14 @@
TAILQ_INSERT_BEFORE(bar, new_bar, chain);
}
+ /*
+ * Enable PCI BARs only if we don't have a boot ROM, i.e., bhyveload was
+ * used to load the initial guest image. Otherwise, we rely on the boot
+ * ROM to handle this.
+ */
+ if (!get_config_bool_default("pci.enable_bars", !bootrom_boot()))
+ return (0);
+
/*
* pci_passthru devices synchronize their physical and virtual command
* register on init. For that reason, the virtual cmd reg should be
@@ -966,8 +975,19 @@
pci_set_cfgdata32(pdi, PCIR_BAR(idx + 1), bar >> 32);
}
- if (type != PCIBAR_ROM) {
- register_bar(pdi, idx);
+ switch (type) {
+ case PCIBAR_IO:
+ if (porten(pdi))
+ register_bar(pdi, idx);
+ break;
+ case PCIBAR_MEM32:
+ case PCIBAR_MEM64:
+ case PCIBAR_MEMHI64:
+ if (memen(pdi))
+ register_bar(pdi, idx);
+ break;
+ default:
+ break;
}
return (0);
@@ -1140,7 +1160,8 @@
pci_set_cfgdata8(pdi, PCIR_INTLINE, 255);
pci_set_cfgdata8(pdi, PCIR_INTPIN, 0);
- pci_set_cfgdata8(pdi, PCIR_COMMAND, PCIM_CMD_BUSMASTEREN);
+ if (!get_config_bool_default("pci.enable_bars", !bootrom_boot()))
+ pci_set_cfgdata8(pdi, PCIR_COMMAND, PCIM_CMD_BUSMASTEREN);
err = (*pde->pe_init)(pdi, fi->fi_config);
if (err == 0)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Apr 4, 1:51 PM (4 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30821781
Default Alt Text
D45049.id142047.diff (2 KB)
Attached To
Mode
D45049: bhyve: Do not enable PCI BAR decoding if a boot ROM is present
Attached
Detach File
Event Timeline
Log In to Comment