summaryrefslogtreecommitdiffstats
path: root/sys/amd64/vmm/io/ppt.c
diff options
context:
space:
mode:
authorneel <neel@FreeBSD.org>2013-02-01 03:49:09 +0000
committerneel <neel@FreeBSD.org>2013-02-01 03:49:09 +0000
commit81de6f5cc49043ac5e2135ad996dfb05f2bd2a32 (patch)
tree98f2e96d433580504233a3c13ced43451e5611ed /sys/amd64/vmm/io/ppt.c
parent803db8c37c2516174b23103ab861a500599042dc (diff)
downloadFreeBSD-src-81de6f5cc49043ac5e2135ad996dfb05f2bd2a32.zip
FreeBSD-src-81de6f5cc49043ac5e2135ad996dfb05f2bd2a32.tar.gz
Fix a broken assumption in the passthru implementation that the MSI-X table
can only be located at the beginning or the end of the BAR. If the MSI-table is located in the middle of a BAR then we will split the BAR into two and create two mappings - one before the table and one after the table - leaving a hole in place of the table so accesses to it can be trapped and emulated. Obtained from: NetApp
Diffstat (limited to 'sys/amd64/vmm/io/ppt.c')
-rw-r--r--sys/amd64/vmm/io/ppt.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/sys/amd64/vmm/io/ppt.c b/sys/amd64/vmm/io/ppt.c
index d3ec8d1..4a05985 100644
--- a/sys/amd64/vmm/io/ppt.c
+++ b/sys/amd64/vmm/io/ppt.c
@@ -56,9 +56,18 @@ __FBSDID("$FreeBSD$");
/* XXX locking */
#define MAX_PPTDEVS (sizeof(pptdevs) / sizeof(pptdevs[0]))
-#define MAX_MMIOSEGS (PCIR_MAX_BAR_0 + 1)
#define MAX_MSIMSGS 32
+/*
+ * If the MSI-X table is located in the middle of a BAR then that MMIO
+ * region gets split into two segments - one segment above the MSI-X table
+ * and the other segment below the MSI-X table - with a hole in place of
+ * the MSI-X table so accesses to it can be trapped and emulated.
+ *
+ * So, allocate a MMIO segment for each BAR register + 1 additional segment.
+ */
+#define MAX_MMIOSEGS ((PCIR_MAX_BAR_0 + 1) + 1)
+
MALLOC_DEFINE(M_PPTMSIX, "pptmsix", "Passthru MSI-X resources");
struct pptintr_arg { /* pptintr(pptintr_arg) */
OpenPOWER on IntegriCloud