Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F152483840
D19904.id56187.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
D19904.id56187.diff
View Options
Index: usr.sbin/bhyve/pci_emul.c
===================================================================
--- usr.sbin/bhyve/pci_emul.c
+++ usr.sbin/bhyve/pci_emul.c
@@ -947,17 +947,30 @@
int err;
struct pciecap pciecap;
- if (type != PCIEM_TYPE_ROOT_PORT)
- return (-1);
+ bzero(&pciecap, sizeof(pciecap));
- bzero(&pciecap, sizeof(pciecap));
+ /*
+ * If the caller is requesting a PCIe capability for an endpoint, but
+ * the device appears to be a part of the root complex (i.e. bus 0),
+ * change the type to integrated endpoint.
+ */
+ if ((type == PCIEM_TYPE_ENDPOINT) && (pi->pi_bus == 0)) {
+ fprintf(stderr, "PCIe Capability for %02x:%02x.%u adjusted to "
+ "Integrated Endpoint\r\n", pi->pi_bus, pi->pi_slot,
+ pi->pi_func);
+ type = PCIEM_TYPE_ROOT_INT_EP;
+ }
pciecap.capid = PCIY_EXPRESS;
- pciecap.pcie_capabilities = PCIECAP_VERSION | PCIEM_TYPE_ROOT_PORT;
- pciecap.link_capabilities = 0x411; /* gen1, x1 */
- pciecap.link_status = 0x11; /* gen1, x1 */
+ pciecap.pcie_capabilities = PCIECAP_VERSION | type;
+
+ if (type != PCIEM_TYPE_ROOT_INT_EP) {
+ pciecap.link_capabilities = 0x411; /* gen1, x1 */
+ pciecap.link_status = 0x11; /* gen1, x1 */
+ }
err = pci_emul_add_capability(pi, (u_char *)&pciecap, sizeof(pciecap));
+
return (err);
}
Index: usr.sbin/bhyve/pci_nvme.c
===================================================================
--- usr.sbin/bhyve/pci_nvme.c
+++ usr.sbin/bhyve/pci_nvme.c
@@ -1925,6 +1925,12 @@
goto done;
}
+ error = pci_emul_add_pciecap(pi, PCIEM_TYPE_ENDPOINT);
+ if (error) {
+ WPRINTF(("%s pci add Express capability failed\r\n", __func__));
+ goto done;
+ }
+
pthread_mutex_init(&sc->mtx, NULL);
sem_init(&sc->iosemlock, 0, sc->ioslots);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Apr 16, 6:11 AM (1 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31583693
Default Alt Text
D19904.id56187.diff (1 KB)
Attached To
Mode
D19904: bhyve: Add Integrated Endpoint to PCIe Capability
Attached
Detach File
Event Timeline
Log In to Comment