Page MenuHomeFreeBSD

D45338.id156882.diff
No OneTemporary

D45338.id156882.diff

diff --git a/usr.sbin/bhyve/amd64/pci_gvt-d.c b/usr.sbin/bhyve/amd64/pci_gvt-d.c
--- a/usr.sbin/bhyve/amd64/pci_gvt-d.c
+++ b/usr.sbin/bhyve/amd64/pci_gvt-d.c
@@ -33,6 +33,7 @@
#define PCI_VENDOR_INTEL 0x8086
#define PCIR_BDSM 0x5C /* Base of Data Stolen Memory register */
+#define PCIR_BDSM_GEN11 0xC0
#define PCIR_ASLS_CTL 0xFC /* Opregion start address register */
#define PCIM_BDSM_GSM_ALIGNMENT \
@@ -63,12 +64,36 @@
return (0);
}
+static int
+set_bdsm_gen11(struct pci_devinst *const pi, vm_paddr_t bdsm_gpa)
+{
+ struct passthru_softc *sc = pi->pi_arg;
+ uint64_t bdsm;
+ int error;
+
+ bdsm = pci_host_read_config(passthru_get_sel(sc), PCIR_BDSM, 8);
+
+ /* Protect the BDSM register in PCI space. */
+ pci_set_cfgdata32(pi, PCIR_BDSM,
+ bdsm_gpa | (bdsm & (PCIM_BDSM_GSM_ALIGNMENT - 1)));
+ pci_set_cfgdata32(pi, PCIR_BDSM + 4, bdsm_gpa >> 32);
+ error = set_pcir_handler(sc, PCIR_BDSM, 8, passthru_cfgread_emulate, passthru_cfgwrite_emulate);
+ if (error) {
+ warnx("%s: Failed to setup handler for BDSM register!\n", __func__);
+ return (error);
+ }
+
+ return (0);
+}
+
struct igd_ops {
int (*set_bdsm)(struct pci_devinst *const pi, vm_paddr_t bdsm_gpa);
};
static struct igd_ops igd_ops_gen3 = { .set_bdsm = set_bdsm_gen3 };
+static struct igd_ops igd_ops_gen11 = { .set_bdsm = set_bdsm_gen11 };
+
struct igd_device {
uint32_t device_id;
struct igd_ops *ops;
@@ -104,6 +129,17 @@
INTEL_CML_IDS(IGD_DEVICE, &igd_ops_gen3),
INTEL_GLK_IDS(IGD_DEVICE, &igd_ops_gen3),
INTEL_CNL_IDS(IGD_DEVICE, &igd_ops_gen3),
+ INTEL_ICL_IDS(IGD_DEVICE, &igd_ops_gen11),
+ INTEL_EHL_IDS(IGD_DEVICE, &igd_ops_gen11),
+ INTEL_JSL_IDS(IGD_DEVICE, &igd_ops_gen11),
+ INTEL_TGL_IDS(IGD_DEVICE, &igd_ops_gen11),
+ INTEL_RKL_IDS(IGD_DEVICE, &igd_ops_gen11),
+ INTEL_ADLS_IDS(IGD_DEVICE, &igd_ops_gen11),
+ INTEL_ADLP_IDS(IGD_DEVICE, &igd_ops_gen11),
+ INTEL_ADLN_IDS(IGD_DEVICE, &igd_ops_gen11),
+ INTEL_RPLS_IDS(IGD_DEVICE, &igd_ops_gen11),
+ INTEL_RPLU_IDS(IGD_DEVICE, &igd_ops_gen11),
+ INTEL_RPLP_IDS(IGD_DEVICE, &igd_ops_gen11),
};
static struct igd_ops *

File Metadata

Mime Type
text/plain
Expires
Wed, Jul 22, 3:22 AM (12 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35345134
Default Alt Text
D45338.id156882.diff (2 KB)

Event Timeline