svn commit: r363663 - in head/sys: dev/iommu x86/include x86/iommu
Ruslan Bukin
br at FreeBSD.org
Wed Jul 29 13:23:29 UTC 2020
Author: br
Date: Wed Jul 29 13:23:27 2020
New Revision: 363663
URL: https://svnweb.freebsd.org/changeset/base/363663
Log:
o Move iommu_set_buswide_ctx, iommu_is_buswide_ctx to
the generic iommu busdma backend;
o Move bus_dma_iommu_set_buswide, bus_dma_iommu_load_ident
prototypes to iommu.h.
Reviewed by: kib
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D25866
Modified:
head/sys/dev/iommu/busdma_iommu.c
head/sys/dev/iommu/iommu.h
head/sys/x86/include/bus_dma.h
head/sys/x86/iommu/intel_dmar.h
head/sys/x86/iommu/intel_drv.c
Modified: head/sys/dev/iommu/busdma_iommu.c
==============================================================================
--- head/sys/dev/iommu/busdma_iommu.c Wed Jul 29 11:19:57 2020 (r363662)
+++ head/sys/dev/iommu/busdma_iommu.c Wed Jul 29 13:23:27 2020 (r363663)
@@ -326,6 +326,26 @@ bus_dma_iommu_set_buswide(device_t dev)
return (true);
}
+void
+iommu_set_buswide_ctx(struct iommu_unit *unit, u_int busno)
+{
+
+ MPASS(busno <= PCI_BUSMAX);
+ IOMMU_LOCK(unit);
+ unit->buswide_ctxs[busno / NBBY / sizeof(uint32_t)] |=
+ 1 << (busno % (NBBY * sizeof(uint32_t)));
+ IOMMU_UNLOCK(unit);
+}
+
+bool
+iommu_is_buswide_ctx(struct iommu_unit *unit, u_int busno)
+{
+
+ MPASS(busno <= PCI_BUSMAX);
+ return ((unit->buswide_ctxs[busno / NBBY / sizeof(uint32_t)] &
+ (1U << (busno % (NBBY * sizeof(uint32_t))))) != 0);
+}
+
static MALLOC_DEFINE(M_IOMMU_DMAMAP, "iommu_dmamap", "IOMMU DMA Map");
static void iommu_bus_schedule_dmamap(struct iommu_unit *unit,
Modified: head/sys/dev/iommu/iommu.h
==============================================================================
--- head/sys/dev/iommu/iommu.h Wed Jul 29 11:19:57 2020 (r363662)
+++ head/sys/dev/iommu/iommu.h Wed Jul 29 13:23:27 2020 (r363663)
@@ -221,6 +221,13 @@ int iommu_gas_map_region(struct iommu_domain *domain,
int iommu_gas_reserve_region(struct iommu_domain *domain, iommu_gaddr_t start,
iommu_gaddr_t end);
+void iommu_set_buswide_ctx(struct iommu_unit *unit, u_int busno);
+bool iommu_is_buswide_ctx(struct iommu_unit *unit, u_int busno);
+
+bool bus_dma_iommu_set_buswide(device_t dev);
+int bus_dma_iommu_load_ident(bus_dma_tag_t dmat, bus_dmamap_t map,
+ vm_paddr_t start, vm_size_t length, int flags);
+
SYSCTL_DECL(_hw_iommu);
#endif /* !_SYS_IOMMU_H_ */
Modified: head/sys/x86/include/bus_dma.h
==============================================================================
--- head/sys/x86/include/bus_dma.h Wed Jul 29 11:19:57 2020 (r363662)
+++ head/sys/x86/include/bus_dma.h Wed Jul 29 13:23:27 2020 (r363663)
@@ -191,11 +191,5 @@ _bus_dmamap_complete(bus_dma_tag_t dmat, bus_dmamap_t
return (tc->impl->map_complete(dmat, map, segs, nsegs, error));
}
-#ifdef _KERNEL
-bool bus_dma_iommu_set_buswide(device_t dev);
-int bus_dma_iommu_load_ident(bus_dma_tag_t dmat, bus_dmamap_t map,
- vm_paddr_t start, vm_size_t length, int flags);
-#endif
-
#endif /* !_X86_BUS_DMA_H_ */
Modified: head/sys/x86/iommu/intel_dmar.h
==============================================================================
--- head/sys/x86/iommu/intel_dmar.h Wed Jul 29 11:19:57 2020 (r363662)
+++ head/sys/x86/iommu/intel_dmar.h Wed Jul 29 13:23:27 2020 (r363663)
@@ -281,9 +281,6 @@ void dmar_quirks_pre_use(struct iommu_unit *dmar);
int dmar_init_irt(struct dmar_unit *unit);
void dmar_fini_irt(struct dmar_unit *unit);
-void iommu_set_buswide_ctx(struct iommu_unit *unit, u_int busno);
-bool iommu_is_buswide_ctx(struct iommu_unit *unit, u_int busno);
-
extern iommu_haddr_t dmar_high;
extern int haw;
extern int dmar_tbl_pagecnt;
Modified: head/sys/x86/iommu/intel_drv.c
==============================================================================
--- head/sys/x86/iommu/intel_drv.c Wed Jul 29 11:19:57 2020 (r363662)
+++ head/sys/x86/iommu/intel_drv.c Wed Jul 29 13:23:27 2020 (r363663)
@@ -592,26 +592,6 @@ static driver_t dmar_driver = {
DRIVER_MODULE(dmar, acpi, dmar_driver, dmar_devclass, 0, 0);
MODULE_DEPEND(dmar, acpi, 1, 1, 1);
-void
-iommu_set_buswide_ctx(struct iommu_unit *unit, u_int busno)
-{
-
- MPASS(busno <= PCI_BUSMAX);
- IOMMU_LOCK(unit);
- unit->buswide_ctxs[busno / NBBY / sizeof(uint32_t)] |=
- 1 << (busno % (NBBY * sizeof(uint32_t)));
- IOMMU_UNLOCK(unit);
-}
-
-bool
-iommu_is_buswide_ctx(struct iommu_unit *unit, u_int busno)
-{
-
- MPASS(busno <= PCI_BUSMAX);
- return ((unit->buswide_ctxs[busno / NBBY / sizeof(uint32_t)] &
- (1U << (busno % (NBBY * sizeof(uint32_t))))) != 0);
-}
-
static void
dmar_print_path(int busno, int depth, const ACPI_DMAR_PCI_PATH *path)
{
More information about the svn-src-head
mailing list