aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/bhyve
diff options
context:
space:
mode:
authorNeel Natu <neel@FreeBSD.org>2013-03-11 17:36:37 +0000
committerNeel Natu <neel@FreeBSD.org>2013-03-11 17:36:37 +0000
commit4b5e84f6157bfc013a19fc1f52a8b40b11e2999c (patch)
treed90834066b805f4c9590eabada032fdb405e94a6 /usr.sbin/bhyve
parent5fd81be1fc730ad9f71d5ef927bb6c0171f956fd (diff)
downloadsrc-4b5e84f6157bfc013a19fc1f52a8b40b11e2999c.tar.gz
src-4b5e84f6157bfc013a19fc1f52a8b40b11e2999c.zip
Convert the offset into the bar that contains the MSI-X table to an offset
into the MSI-X table before using it to calculate the table index. In the common case where the MSI-X table is located at the begining of the BAR these two offsets are identical and thus the code was working by accident. This change will fix the case where the MSI-X table is located in the middle or at the end of the BAR that contains it. Obtained from: NetApp
Notes
Notes: svn path=/head/; revision=248171
Diffstat (limited to 'usr.sbin/bhyve')
-rw-r--r--usr.sbin/bhyve/pci_passthru.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/usr.sbin/bhyve/pci_passthru.c b/usr.sbin/bhyve/pci_passthru.c
index 08a9a58354f6..43c542d3c18b 100644
--- a/usr.sbin/bhyve/pci_passthru.c
+++ b/usr.sbin/bhyve/pci_passthru.c
@@ -279,6 +279,7 @@ msix_table_read(struct passthru_softc *sc, uint64_t offset, int size)
int index;
pi = sc->psc_pi;
+ offset -= pi->pi_msix.table_offset;
index = offset / MSIX_TABLE_ENTRY_SIZE;
if (index >= pi->pi_msix.table_count)
@@ -323,6 +324,8 @@ msix_table_write(struct vmctx *ctx, int vcpu, struct passthru_softc *sc,
int error, index;
pi = sc->psc_pi;
+ offset -= pi->pi_msix.table_offset;
+
index = offset / MSIX_TABLE_ENTRY_SIZE;
if (index >= pi->pi_msix.table_count)
return;