Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F178008381
D54647.1795752102.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
D54647.1795752102.diff
View Options
diff --git a/usr.sbin/bhyve/pci_emul.h b/usr.sbin/bhyve/pci_emul.h
--- a/usr.sbin/bhyve/pci_emul.h
+++ b/usr.sbin/bhyve/pci_emul.h
@@ -56,6 +56,7 @@
/* instance creation */
int (*pe_init)(struct pci_devinst *, nvlist_t *);
+ int (*pe_teardown)(struct pci_devinst *);
int (*pe_legacy_config)(nvlist_t *, const char *);
const char *pe_alias;
diff --git a/usr.sbin/bhyve/pci_emul.c b/usr.sbin/bhyve/pci_emul.c
--- a/usr.sbin/bhyve/pci_emul.c
+++ b/usr.sbin/bhyve/pci_emul.c
@@ -1210,6 +1210,33 @@
return (err);
}
+#ifdef __amd64__
+/*
+ * Release all resources held by an emulated PCI device instance.
+ */
+static void
+pci_emul_teardown(struct pci_devinst *pdi)
+{
+ struct businfo *bi;
+ struct pcibar *bp;
+ vmem_t *arena;
+ int i;
+
+ bi = pci_businfo[pdi->pi_bus];
+ for (i = 0; i <= PCI_BARMAX; i++) {
+ bp = &pdi->pi_bar[i];
+ if (bp->type == PCIBAR_NONE)
+ continue;
+ unregister_bar(pdi, i);
+ arena = bi->resources[bp->type];
+ assert(arena != NULL);
+ vmem_free(arena, bp->addr, bp->size);
+ }
+ if (pdi->pi_d->pe_teardown != NULL)
+ (*pdi->pi_d->pe_teardown)(pdi);
+}
+#endif
+
void
pci_populate_msicap(struct msicap *msicap, int msgnum, int nextptr)
{
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 27, 4:01 AM (2 h, 33 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42028961
Default Alt Text
D54647.1795752102.diff (1 KB)
Attached To
Mode
D54647: bhyve/pci_emul.c: Introduce device teardown routines
Attached
Detach File
Event Timeline