Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F167527662
D26906.id78605.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D26906.id78605.diff
View Options
Index: sys/arm64/arm64/gicv3_its.c
===================================================================
--- sys/arm64/arm64/gicv3_its.c
+++ sys/arm64/arm64/gicv3_its.c
@@ -333,6 +333,7 @@
static msi_map_msi_t gicv3_its_map_msi;
#ifdef IOMMU
static msi_iommu_init_t gicv3_iommu_init;
+static msi_iommu_deinit_t gicv3_iommu_deinit;
#endif
static void its_cmd_movi(device_t, struct gicv3_its_irqsrc *);
@@ -367,6 +368,7 @@
DEVMETHOD(msi_map_msi, gicv3_its_map_msi),
#ifdef IOMMU
DEVMETHOD(msi_iommu_init, gicv3_iommu_init),
+ DEVMETHOD(msi_iommu_deinit, gicv3_iommu_deinit),
#endif
/* End */
@@ -1457,6 +1459,16 @@
return (error);
}
+
+static void
+gicv3_iommu_deinit(device_t dev, device_t child)
+{
+ struct iommu_ctx *ctx;
+
+ ctx = iommu_get_dev_ctx(child);
+
+ iommu_unmap_msi(ctx);
+}
#endif
/*
Index: sys/dev/iommu/iommu_gas.c
===================================================================
--- sys/dev/iommu/iommu_gas.c
+++ sys/dev/iommu/iommu_gas.c
@@ -727,6 +727,29 @@
return (error);
}
+void
+iommu_unmap_msi(struct iommu_ctx *ctx)
+{
+ struct iommu_map_entry *entry;
+ struct iommu_domain *domain;
+
+ domain = ctx->domain;
+ entry = domain->msi_entry;
+
+ domain->ops->unmap(domain, entry->start, entry->end -
+ entry->start, IOMMU_PGF_WAITOK);
+
+ IOMMU_DOMAIN_LOCK(domain);
+ iommu_gas_free_space(domain, entry);
+ IOMMU_DOMAIN_UNLOCK(domain);
+
+ iommu_gas_free_entry(domain, entry);
+
+ domain->msi_entry = NULL;
+ domain->msi_base = 0;
+ domain->msi_phys = 0;
+}
+
int
iommu_map_msi(struct iommu_ctx *ctx, iommu_gaddr_t size, int offset,
u_int eflags, u_int flags, vm_page_t *ma)
Index: sys/dev/iommu/iommu_msi.h
===================================================================
--- sys/dev/iommu/iommu_msi.h
+++ sys/dev/iommu/iommu_msi.h
@@ -42,5 +42,6 @@
void iommu_translate_msi(struct iommu_domain *domain, uint64_t *addr);
int iommu_map_msi(struct iommu_ctx *ctx, iommu_gaddr_t size, int offset,
u_int eflags, u_int flags, vm_page_t *ma);
+void iommu_unmap_msi(struct iommu_ctx *ctx);
#endif /* !_DEV_IOMMU_IOMMU_MSI_H_ */
Index: sys/kern/msi_if.m
===================================================================
--- sys/kern/msi_if.m
+++ sys/kern/msi_if.m
@@ -80,3 +80,8 @@
device_t child;
struct iommu_domain **domain;
};
+
+METHOD void iommu_deinit {
+ device_t dev;
+ device_t child;
+};
Index: sys/kern/subr_intr.c
===================================================================
--- sys/kern/subr_intr.c
+++ sys/kern/subr_intr.c
@@ -1375,6 +1375,10 @@
isrc[i] = msi->isrc;
}
+#ifdef IOMMU
+ MSI_IOMMU_DEINIT(pic->pic_dev, child);
+#endif
+
err = MSI_RELEASE_MSI(pic->pic_dev, child, count, isrc);
for (i = 0; i < count; i++) {
@@ -1457,6 +1461,10 @@
return (EINVAL);
}
+#ifdef IOMMU
+ MSI_IOMMU_DEINIT(pic->pic_dev, child);
+#endif
+
err = MSI_RELEASE_MSIX(pic->pic_dev, child, isrc);
intr_unmap_irq(irq);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Aug 23, 12:22 PM (4 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37137621
Default Alt Text
D26906.id78605.diff (2 KB)
Attached To
Mode
D26906: iommu_unmap_msi() added
Attached
Detach File
Event Timeline
Log In to Comment