summaryrefslogtreecommitdiffstats
path: root/sys/modules/hyperv
diff options
context:
space:
mode:
authordexuan <dexuan@FreeBSD.org>2016-11-30 06:20:43 +0000
committerdexuan <dexuan@FreeBSD.org>2016-11-30 06:20:43 +0000
commit93e1e35ef2f30ec3ae26cabc2e61c96dd2f91582 (patch)
treee587806b3b2baeed3e1ff946ecca7da2d69123dc /sys/modules/hyperv
parentf9912752d5f0359cb887482e286b10ab334bb8ce (diff)
downloadFreeBSD-src-93e1e35ef2f30ec3ae26cabc2e61c96dd2f91582.zip
FreeBSD-src-93e1e35ef2f30ec3ae26cabc2e61c96dd2f91582.tar.gz
MFC: 308723-308725,308793-308795,309127
Approved by: sephe (mentor) r308723 hyperv/vmbus: add a new method to get vcpu_id vcpu_id is host's representation of guest CPU. We get the mapping between vcpu_id and FreeBSD kernel's cpu id when VMBus driver is loaded. Later, when a driver, like the coming pcib driver, talks to the host and needs to refer to a guest CPU, the driver must use the vcpu_id. Reviewed by: jhb, sephe Approved by: sephe (mentor) Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8410 r308724 hyperv/vmbus: add new vmbus methods to support PCIe pass-through The new methods will be used by the coming pcib driver. Reviewed by: sephe Approved by: sephe (mentor) Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8409 r308725 hyperv/pcib: enable PCIe pass-through (a.k.a. Discrete Device Assignment) The feature enables us to pass through physical PCIe devices to FreeBSD VM running on Hyper-V (Windows Server 2016) to get near-native performance with low CPU utilization. The patch implements a PCI bridge driver to support the feature: 1) The pcib driver talks to the host to discover device(s) and presents the device(s) to FreeBSD's pci driver via PCI configuration space (note: to access the configuration space, we don't use the standard I/O port 0xCF8/CFC method; instead, we use an MMIO-based method supplied by Hyper-V, which is very similar to the 0xCF8/CFC method). 2) The pcib driver allocates resources for the device(s) and initialize the related BARs, when the device driver's attach method is invoked; 3) The pcib driver talks to the host to create MSI/MSI-X interrupt remapping between the guest and the host; 4) The pcib driver supports device hot add/remove. Reviewed by: sephe Approved by: sephe (mentor) Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8332 r308793 hyperv/pcib: Fix the build for some kernel configs Add the dependency on pci explicitly for the pcib and vmbus drivers. The related Makefiles are updated accordingly too. Reviewed by: sephe Approved by: sephe (mentor) Sponsored by: Microsoft r308794 hyperv/vmbus,pcib: Add MODULE_DEPEND on pci We'd better add this dependency explicitly, though usually the pci driver is built into the kernel by default. Reviewed by: sephe Approved by: sephe (mentor) Sponsored by: Microsoft r308795 hyperv/pcib: change the file name: pcib.c -> vmbus_pcib.c This makes the file name and the variable naming in the file consistent. Reviewed by: sephe Approved by: sephe (mentor) Sponsored by: Microsoft r309127 hyperv/vmbus,pcib: unbreak build in case NEW_PCIB is undefined vmbus_pcib requires NEW_PCIB, but in case that's not defined, we at least shouldn't break build. Reviewed by: sephe Approved by: sephe (mentor) Sponsored by: Microsoft
Diffstat (limited to 'sys/modules/hyperv')
-rw-r--r--sys/modules/hyperv/pcib/Makefile12
-rw-r--r--sys/modules/hyperv/vmbus/Makefile2
2 files changed, 13 insertions, 1 deletions
diff --git a/sys/modules/hyperv/pcib/Makefile b/sys/modules/hyperv/pcib/Makefile
new file mode 100644
index 0000000..1b63a13
--- /dev/null
+++ b/sys/modules/hyperv/pcib/Makefile
@@ -0,0 +1,12 @@
+# $FreeBSD$
+
+.PATH: ${.CURDIR}/../../../dev/hyperv/pcib \
+ ${.CURDIR}/../../../dev/hyperv/vmbus
+
+KMOD= vmbus_pcib
+SRCS= vmbus_pcib.c
+SRCS+= bus_if.h device_if.h pci_if.h pcib_if.h vmbus_if.h
+
+CFLAGS+= -I${.CURDIR}/../../../dev/hyperv/pcib
+
+.include <bsd.kmod.mk>
diff --git a/sys/modules/hyperv/vmbus/Makefile b/sys/modules/hyperv/vmbus/Makefile
index 105b4f5..d6052e5 100644
--- a/sys/modules/hyperv/vmbus/Makefile
+++ b/sys/modules/hyperv/vmbus/Makefile
@@ -13,7 +13,7 @@ SRCS= hyperv.c \
vmbus_et.c \
vmbus_if.c \
vmbus_xact.c
-SRCS+= acpi_if.h bus_if.h device_if.h opt_acpi.h vmbus_if.h
+SRCS+= acpi_if.h bus_if.h device_if.h opt_acpi.h pci_if.h pcib_if.h vmbus_if.h
# XXX: for assym.s
SRCS+= opt_kstack_pages.h opt_nfs.h opt_hwpmc_hooks.h opt_compat.h
OpenPOWER on IntegriCloud