Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F109438945
D40036.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D40036.diff
View Options
diff --git a/usr.sbin/bhyve/pci_passthru.h b/usr.sbin/bhyve/pci_passthru.h
--- a/usr.sbin/bhyve/pci_passthru.h
+++ b/usr.sbin/bhyve/pci_passthru.h
@@ -11,6 +11,14 @@
#include "pci_emul.h"
+struct passthru_mmio_mapping {
+ vm_paddr_t gpa; /* guest physical address */
+ void *gva; /* guest virtual address */
+ vm_paddr_t hpa; /* host physical address */
+ void *hva; /* guest virtual address */
+ vm_paddr_t len;
+};
+
struct passthru_softc;
typedef int (*cfgread_handler)(struct passthru_softc *sc,
@@ -24,6 +32,8 @@
int coff, int bytes, uint32_t *rv);
int passthru_cfgwrite_emulate(struct passthru_softc *sc, struct pci_devinst *pi,
int coff, int bytes, uint32_t val);
+struct passthru_mmio_mapping *passthru_get_mmio(struct passthru_softc *sc,
+ int num);
struct pcisel *passthru_get_sel(struct passthru_softc *sc);
int set_pcir_handler(struct passthru_softc *sc, int reg, int len,
cfgread_handler rhandler, cfgwrite_handler whandler);
diff --git a/usr.sbin/bhyve/pci_passthru.c b/usr.sbin/bhyve/pci_passthru.c
--- a/usr.sbin/bhyve/pci_passthru.c
+++ b/usr.sbin/bhyve/pci_passthru.c
@@ -78,6 +78,8 @@
#define MSIX_TABLE_COUNT(ctrl) (((ctrl) & PCIM_MSIXCTRL_TABLE_SIZE) + 1)
#define MSIX_CAPLEN 12
+#define PASSTHRU_MMIO_MAX 2
+
static int pcifd = -1;
struct passthru_softc {
@@ -94,6 +96,7 @@
} psc_msix;
struct pcisel psc_sel;
+ struct passthru_mmio_mapping psc_mmio_map[PASSTHRU_MMIO_MAX];
cfgread_handler psc_pcir_rhandler[PCI_REGMAX + 1];
cfgwrite_handler psc_pcir_whandler[PCI_REGMAX + 1];
};
@@ -660,6 +663,15 @@
return (error);
}
+struct passthru_mmio_mapping *
+passthru_get_mmio(struct passthru_softc *sc, int num)
+{
+ assert(sc != NULL);
+ assert(num < PASSTHRU_MMIO_MAX);
+
+ return (&sc->psc_mmio_map[num]);
+}
+
struct pcisel *
passthru_get_sel(struct passthru_softc *sc)
{
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Feb 6, 2:01 AM (21 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16484920
Default Alt Text
D40036.diff (1 KB)
Attached To
Mode
D40036: bhyve: add helper for passthru specific mmio ranges
Attached
Detach File
Event Timeline
Log In to Comment