freebsd-dev/usr.sbin/bhyve
Corvin Köhne 1b0e2f0b60 bhyve: ignore low bits of CFGADR
Bhyve could emulate wrong PCI registers.
In the best case, the guest reads wrong registers and the device driver would
report some errors.
In the worst case, the guest writes to wrong PCI registers and could brick
hardware when using PCI passthrough.

According to Intels specification, low bits of CFGADR should be
ignored. Some OS like linux may rely on it. Otherwise, bhyve could
emulate a wrong PCI register.

E.g.
If linux would like to read 2 bytes from offset 0x02, following would
happen.
linux:
	outl 0x80000002 at CFGADR
	inw  at CFGDAT + 2
bhyve:
	cfgoff = 0x80000002 & 0xFF = 0x02
	coff   = cfgoff + (port - CFGDAT) = 0x02 + 0x02 = 0x04
Bhyve would emulate the register at offset 0x04 not 0x02.

Reviewed By: #bhyve, grehan
Differential Revision: https://reviews.freebsd.org/D31819
Sponsored by:	       Beckhoff Automation GmbH & Co. KG
2021-10-15 09:29:45 +02:00
..
acpi.c bhyve(8): Add VM Generation Counter ACPI device 2020-04-15 02:00:17 +00:00
acpi.h bhyve(8): Add VM Generation Counter ACPI device 2020-04-15 02:00:17 +00:00
ahci.h Fix style(9) space vs tab. 2018-06-14 01:34:53 +00:00
atkbdc.c Initial support for bhyve save and restore. 2020-05-05 00:02:04 +00:00
atkbdc.h Initial support for bhyve save and restore. 2020-05-05 00:02:04 +00:00
audio.c bhyve: add wrapper for debug printf statements 2020-01-08 22:55:22 +00:00
audio.h Add SPDX tags to bhyve(8) HD Audio device. 2019-06-25 06:24:56 +00:00
bhyve_config.5 bhyve_config.5: Document gdb.address. 2021-09-25 10:07:18 -07:00
bhyve.8 bhyve: Update usage and synopsis for the -k flag 2021-10-13 08:39:57 +02:00
bhyvegc.c When this code was introduced at r300829 the author forgot to add 2018-06-13 04:00:21 +00:00
bhyvegc.h Add SPDX tags to bhyve(8). 2018-06-13 03:22:08 +00:00
bhyverun.c bhyve: Update usage and synopsis for the -k flag 2021-10-13 08:39:57 +02:00
bhyverun.h Refactor configuration management in bhyve. 2021-03-18 16:30:26 -07:00
block_if.c bhyve: Use fspacectl(2) for BOP_DELETE on regular file images 2021-08-07 17:10:30 +08:00
block_if.h bhyve: Add support for handling disk resize events to block_if. 2021-06-11 18:00:24 -07:00
bootrom.c bhyve(8): Add bootrom allocation abstraction 2020-04-15 01:58:51 +00:00
bootrom.h bhyve(8): Add bootrom allocation abstraction 2020-04-15 01:58:51 +00:00
config.c Refactor configuration management in bhyve. 2021-03-18 16:30:26 -07:00
config.h Refactor configuration management in bhyve. 2021-03-18 16:30:26 -07:00
console.c Append Keyboard Layout specified option for using VNC. 2021-04-21 12:40:44 +02:00
console.h Append Keyboard Layout specified option for using VNC. 2021-04-21 12:40:44 +02:00
debug.h bhyve: add wrapper for debug printf statements 2020-01-08 22:55:22 +00:00
fwctl.c Always treat firmware request and response sizes as unsigned. 2018-12-04 18:28:25 +00:00
fwctl.h Add SPDX tags to bhyve(8). 2018-06-13 03:22:08 +00:00
gdb.c bhyve: change a default address from ANY to localhost 2021-08-21 19:43:17 +02:00
gdb.h byhve: add option to specify IP address for gdb 2021-08-21 19:43:17 +02:00
hda_codec.c Refactor configuration management in bhyve. 2021-03-18 16:30:26 -07:00
hda_reg.h Add SPDX tags to bhyve(8) HD Audio device. 2019-06-25 06:24:56 +00:00
hdac_reg.h Add SPDX tags to bhyve(8) HD Audio device. 2019-06-25 06:24:56 +00:00
inout.c Refactor configuration management in bhyve. 2021-03-18 16:30:26 -07:00
inout.h Refactor configuration management in bhyve. 2021-03-18 16:30:26 -07:00
ioapic.c
ioapic.h
iov.c bhyve: enable virtio-net mergeable rx buffers for tap(4) 2020-02-20 21:07:23 +00:00
iov.h bhyve: enable virtio-net mergeable rx buffers for tap(4) 2020-02-20 21:07:23 +00:00
kernemu_dev.c vmm(4), bhyve(8): Expose kernel-emulated special devices to userspace 2020-05-15 15:54:22 +00:00
kernemu_dev.h vmm(4), bhyve(8): Expose kernel-emulated special devices to userspace 2020-05-15 15:54:22 +00:00
Makefile Add a virtio-input device emulation. 2021-06-08 19:05:09 +10:00
Makefile.depend Initial support for bhyve save and restore. 2020-05-05 00:02:04 +00:00
Makefile.depend.options Add Makefile.depend.options 2019-12-11 17:37:37 +00:00
mem.c bhyve: enhance debug info for memory range clash 2021-06-13 16:41:45 -06:00
mem.h Add support for writing to guest memory in the debug server. 2019-05-24 00:34:13 +00:00
mevent_test.c Refactor configuration management in bhyve. 2021-03-18 16:30:26 -07:00
mevent.c bhyve: Add an empty case for event types in mevent_kq_fflags(). 2021-09-25 11:25:25 -07:00
mevent.h bhyve: Add support for EVFILT_VNODE mevents. 2021-06-11 18:00:24 -07:00
mptbl.c bhyve: add wrapper for debug printf statements 2020-01-08 22:55:22 +00:00
mptbl.h
net_backends.c bhyve: net_backends, automatically IFF_UP tap devices 2021-08-01 20:50:53 +00:00
net_backends.h Refactor configuration management in bhyve. 2021-03-18 16:30:26 -07:00
net_utils.c Refactor configuration management in bhyve. 2021-03-18 16:30:26 -07:00
net_utils.h Refactor configuration management in bhyve. 2021-03-18 16:30:26 -07:00
pci_ahci.c Refactor configuration management in bhyve. 2021-03-18 16:30:26 -07:00
pci_e82545.c Refactor configuration management in bhyve. 2021-03-18 16:30:26 -07:00
pci_emul.c bhyve: ignore low bits of CFGADR 2021-10-15 09:29:45 +02:00
pci_emul.h bhyve: Map the MSI-X table unconditionally for passthrough 2021-10-09 11:36:19 -04:00
pci_fbuf.c bhyve: support relocating fbuf and passthru data BARs 2021-03-19 11:04:36 +08:00
pci_hda.c Refactor configuration management in bhyve. 2021-03-18 16:30:26 -07:00
pci_hda.h Refactor configuration management in bhyve. 2021-03-18 16:30:26 -07:00
pci_hostbridge.c bhyve hostbridge: Rename "device" property to "devid". 2021-03-24 09:29:15 -07:00
pci_irq.c Add SPDX tags to bhyve(8). 2018-06-13 03:22:08 +00:00
pci_irq.h Add SPDX tags to bhyve(8). 2018-06-13 03:22:08 +00:00
pci_lpc.c Refactor configuration management in bhyve. 2021-03-18 16:30:26 -07:00
pci_lpc.h Add -s "help" and -l "help" to print a list of supported PCI and LPC devices. 2018-08-22 20:23:08 +00:00
pci_nvme.c bhyve: Nuke double-semicolons 2021-08-30 15:31:04 +08:00
pci_passthru.c bhyve: Map the MSI-X table unconditionally for passthrough 2021-10-09 11:36:19 -04:00
pci_uart.c Refactor configuration management in bhyve. 2021-03-18 16:30:26 -07:00
pci_virtio_9p.c bhyve: Fix vq_getchain() error handling bugs in various device models 2021-08-24 14:29:13 -04:00
pci_virtio_block.c bhyve: Support setting the disk serial number for VirtIO block devices. 2021-09-17 09:55:48 -07:00
pci_virtio_console.c bhyve: Fix vq_getchain() error handling bugs in various device models 2021-08-24 14:29:13 -04:00
pci_virtio_input.c Add a virtio-input device emulation. 2021-06-08 19:05:09 +10:00
pci_virtio_net.c bhyve: change vq_getchain to return iovecs in both directions 2021-03-30 16:44:07 +08:00
pci_virtio_rnd.c bhyve: Fix vq_getchain() error handling bugs in various device models 2021-08-24 14:29:13 -04:00
pci_virtio_scsi.c bhyve: Nuke double-semicolons 2021-08-30 15:31:04 +08:00
pci_xhci.c Fix typo in xhci nvlist node name, and also increment device counter. 2021-04-03 14:32:54 +10:00
pci_xhci.h Add SPDX tags to bhyve(8). 2018-06-13 03:22:08 +00:00
pctestdev.c Refactor configuration management in bhyve. 2021-03-18 16:30:26 -07:00
pctestdev.h Refactor configuration management in bhyve. 2021-03-18 16:30:26 -07:00
pm.c Silence ACPI RTC error/warning in Linux guests. 2020-07-06 08:36:14 +00:00
post.c
ps2kbd.c Append Keyboard Layout specified option for using VNC. 2021-04-21 12:40:44 +02:00
ps2kbd.h Initial support for bhyve save and restore. 2020-05-05 00:02:04 +00:00
ps2mouse.c Initial support for bhyve save and restore. 2020-05-05 00:02:04 +00:00
ps2mouse.h Initial support for bhyve save and restore. 2020-05-05 00:02:04 +00:00
rfb.c Append Keyboard Layout specified option for using VNC. 2021-04-21 12:40:44 +02:00
rfb.h Add SPDX tags to bhyve(8). 2018-06-13 03:22:08 +00:00
rtc.c Refactor configuration management in bhyve. 2021-03-18 16:30:26 -07:00
rtc.h Refactor configuration management in bhyve. 2021-03-18 16:30:26 -07:00
smbiostbl.c bhyve: add SMBIOS Baseboard Information 2021-04-12 08:09:52 -07:00
smbiostbl.h
snapshot.c bhyve/snapshot: split up mutex/cond initialization from socket creation 2021-05-21 11:23:06 -08:00
snapshot.h bhyve/snapshot: split up mutex/cond initialization from socket creation 2021-05-21 11:23:06 -08:00
sockstream.c Fix style(9) space vs tab. 2018-06-14 01:34:53 +00:00
sockstream.h Add SPDX tags to bhyve(8). 2018-06-13 03:22:08 +00:00
spinup_ap.c
spinup_ap.h
task_switch.c bhyve: add wrapper for debug printf statements 2020-01-08 22:55:22 +00:00
uart_emul.c Refactor configuration management in bhyve. 2021-03-18 16:30:26 -07:00
uart_emul.h Refactor configuration management in bhyve. 2021-03-18 16:30:26 -07:00
usb_emul.c Refactor configuration management in bhyve. 2021-03-18 16:30:26 -07:00
usb_emul.h Refactor configuration management in bhyve. 2021-03-18 16:30:26 -07:00
usb_mouse.c Refactor configuration management in bhyve. 2021-03-18 16:30:26 -07:00
vga.c Add SPDX tags to bhyve(8). 2018-06-13 03:22:08 +00:00
vga.h Fix style(9) space vs tab. 2018-06-14 01:34:53 +00:00
virtio.c Add a virtio-input device emulation. 2021-06-08 19:05:09 +10:00
virtio.h bhyve: Split out a lower-level helper for VirtIO interrupts. 2021-06-11 18:00:25 -07:00
vmgenc.c bhyve(8): Correct copyright boilerplate for r359950 2020-04-15 05:55:14 +00:00
vmgenc.h bhyve(8): Correct copyright boilerplate for r359950 2020-04-15 05:55:14 +00:00
xmsr.c bhyve: implement rdmsr for MSR_IA32_FEATURE_CONTROL 2021-04-15 13:49:19 +10:00
xmsr.h