bhyve: add helper for passthru specific mmio ranges
Intel GPUs have two special memory regions. They are called Graphics Stolen Memory and OpRegion. bhyve has to emulate both of them. In order to keep track of those special regions, add generic mmio ranges to the passthru emulation. Reviewed by: markj MFC after: 1 week Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D40036
This commit is contained in:
parent
99aeb28b2f
commit
93cf93179c
@ -78,6 +78,8 @@ __FBSDID("$FreeBSD$");
|
||||
#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 @@ struct passthru_softc {
|
||||
} 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 @@ cfginit(struct pci_devinst *pi, int bus, int slot, int func)
|
||||
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)
|
||||
{
|
||||
|
@ -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 passthru_cfgread_emulate(struct passthru_softc *sc, struct pci_devinst *pi,
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user