Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F133427764
D25852.id75077.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
6 KB
Referenced Files
None
Subscribers
None
D25852.id75077.diff
View Options
Index: head/sys/dev/iommu/busdma_iommu.c
===================================================================
--- head/sys/dev/iommu/busdma_iommu.c
+++ head/sys/dev/iommu/busdma_iommu.c
@@ -299,7 +299,7 @@
}
bool
-bus_dma_dmar_set_buswide(device_t dev)
+bus_dma_iommu_set_buswide(device_t dev)
{
struct iommu_unit *unit;
device_t parent;
@@ -317,12 +317,12 @@
if (slot != 0 || func != 0) {
if (bootverbose) {
device_printf(dev,
- "dmar%d pci%d:%d:%d requested buswide busdma\n",
+ "iommu%d pci%d:%d:%d requested buswide busdma\n",
unit->unit, busno, slot, func);
}
return (false);
}
- dmar_set_buswide_ctx(unit, busno);
+ iommu_set_buswide_ctx(unit, busno);
return (true);
}
@@ -987,7 +987,7 @@
}
int
-bus_dma_dmar_load_ident(bus_dma_tag_t dmat, bus_dmamap_t map1,
+bus_dma_iommu_load_ident(bus_dma_tag_t dmat, bus_dmamap_t map1,
vm_paddr_t start, vm_size_t length, int flags)
{
struct bus_dma_tag_common *tc;
Index: head/sys/dev/iommu/iommu.h
===================================================================
--- head/sys/dev/iommu/iommu.h
+++ head/sys/dev/iommu/iommu.h
@@ -34,12 +34,14 @@
#ifndef _SYS_IOMMU_H_
#define _SYS_IOMMU_H_
+#include <sys/types.h>
#include <sys/queue.h>
#include <sys/sysctl.h>
#include <sys/taskqueue.h>
#include <sys/tree.h>
-#include <sys/types.h>
+#include <dev/pci/pcireg.h>
+
/* Host or physical memory address, after translation. */
typedef uint64_t iommu_haddr_t;
/* Guest or bus address, before translation. */
@@ -96,6 +98,14 @@
struct task dmamap_load_task;
TAILQ_HEAD(, bus_dmamap_iommu) delayed_maps;
struct taskqueue *delayed_taskqueue;
+
+ /*
+ * Bitmap of buses for which context must ignore slot:func,
+ * duplicating the page table pointer into all context table
+ * entries. This is a client-controlled quirk to support some
+ * NTBs.
+ */
+ uint32_t buswide_ctxs[(PCI_BUSMAX + 1) / NBBY / sizeof(uint32_t)];
};
/*
Index: head/sys/dev/ntb/ntb_hw/ntb_hw_intel.c
===================================================================
--- head/sys/dev/ntb/ntb_hw/ntb_hw_intel.c
+++ head/sys/dev/ntb/ntb_hw/ntb_hw_intel.c
@@ -811,7 +811,7 @@
device_printf(ntb->device, "Unable to create BAR0 map\n");
return (ENOMEM);
}
- if (bus_dma_dmar_load_ident(ntb->bar0_dma_tag, ntb->bar0_dma_map,
+ if (bus_dma_iommu_load_ident(ntb->bar0_dma_tag, ntb->bar0_dma_map,
bar->pbase, bar->size, 0)) {
device_printf(ntb->device, "Unable to load BAR0 map\n");
return (ENOMEM);
Index: head/sys/dev/ntb/ntb_hw/ntb_hw_plx.c
===================================================================
--- head/sys/dev/ntb/ntb_hw/ntb_hw_plx.c
+++ head/sys/dev/ntb/ntb_hw/ntb_hw_plx.c
@@ -343,7 +343,7 @@
* The device occupies whole bus. In translated TLP slot field
* keeps LUT index (original bus/slot), function is passed through.
*/
- bus_dma_dmar_set_buswide(dev);
+ bus_dma_iommu_set_buswide(dev);
/* Identify chip port we are connected to. */
val = bus_read_4(sc->conf_res, 0x360);
Index: head/sys/x86/include/bus_dma.h
===================================================================
--- head/sys/x86/include/bus_dma.h
+++ head/sys/x86/include/bus_dma.h
@@ -192,8 +192,8 @@
}
#ifdef _KERNEL
-bool bus_dma_dmar_set_buswide(device_t dev);
-int bus_dma_dmar_load_ident(bus_dma_tag_t dmat, bus_dmamap_t map,
+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
Index: head/sys/x86/iommu/intel_ctx.c
===================================================================
--- head/sys/x86/iommu/intel_ctx.c
+++ head/sys/x86/iommu/intel_ctx.c
@@ -196,7 +196,7 @@
IOMMU_PGF_NOALLOC);
}
- if (dmar_is_buswide_ctx(unit, busno)) {
+ if (iommu_is_buswide_ctx((struct iommu_unit *)unit, busno)) {
MPASS(!move);
for (i = 0; i <= PCI_BUSMAX; i++) {
ctx_id_entry_init_one(&ctxp[i], domain, ctx_root);
@@ -464,6 +464,7 @@
{
struct dmar_domain *domain, *domain1;
struct dmar_ctx *ctx, *ctx1;
+ struct iommu_unit *unit;
dmar_ctx_entry_t *ctxp;
struct sf_buf *sf;
int bus, slot, func, error;
@@ -480,9 +481,10 @@
}
enable = false;
TD_PREP_PINNED_ASSERT;
+ unit = (struct iommu_unit *)dmar;
DMAR_LOCK(dmar);
- KASSERT(!dmar_is_buswide_ctx(dmar, bus) || (slot == 0 && func == 0),
- ("dmar%d pci%d:%d:%d get_ctx for buswide", dmar->iommu.unit, bus,
+ KASSERT(!iommu_is_buswide_ctx(unit, bus) || (slot == 0 && func == 0),
+ ("iommu%d pci%d:%d:%d get_ctx for buswide", dmar->iommu.unit, bus,
slot, func));
ctx = dmar_find_ctx_locked(dmar, rid);
error = 0;
Index: head/sys/x86/iommu/intel_dmar.h
===================================================================
--- head/sys/x86/iommu/intel_dmar.h
+++ head/sys/x86/iommu/intel_dmar.h
@@ -167,15 +167,6 @@
struct iommu_map_entries_tailq tlb_flush_entries;
struct task qi_task;
struct taskqueue *qi_taskqueue;
-
- /*
- * Bitmap of buses for which context must ignore slot:func,
- * duplicating the page table pointer into all context table
- * entries. This is a client-controlled quirk to support some
- * NTBs.
- */
- uint32_t buswide_ctxs[(PCI_BUSMAX + 1) / NBBY / sizeof(uint32_t)];
-
};
#define DMAR_LOCK(dmar) mtx_lock(&(dmar)->iommu.lock)
@@ -290,8 +281,8 @@
int dmar_init_irt(struct dmar_unit *unit);
void dmar_fini_irt(struct dmar_unit *unit);
-void dmar_set_buswide_ctx(struct iommu_unit *unit, u_int busno);
-bool dmar_is_buswide_ctx(struct dmar_unit *unit, u_int busno);
+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;
Index: head/sys/x86/iommu/intel_drv.c
===================================================================
--- head/sys/x86/iommu/intel_drv.c
+++ head/sys/x86/iommu/intel_drv.c
@@ -593,21 +593,18 @@
MODULE_DEPEND(dmar, acpi, 1, 1, 1);
void
-dmar_set_buswide_ctx(struct iommu_unit *unit, u_int busno)
+iommu_set_buswide_ctx(struct iommu_unit *unit, u_int busno)
{
- struct dmar_unit *dmar;
- dmar = (struct dmar_unit *)unit;
-
MPASS(busno <= PCI_BUSMAX);
- DMAR_LOCK(dmar);
- dmar->buswide_ctxs[busno / NBBY / sizeof(uint32_t)] |=
+ IOMMU_LOCK(unit);
+ unit->buswide_ctxs[busno / NBBY / sizeof(uint32_t)] |=
1 << (busno % (NBBY * sizeof(uint32_t)));
- DMAR_UNLOCK(dmar);
+ IOMMU_UNLOCK(unit);
}
bool
-dmar_is_buswide_ctx(struct dmar_unit *unit, u_int busno)
+iommu_is_buswide_ctx(struct iommu_unit *unit, u_int busno)
{
MPASS(busno <= PCI_BUSMAX);
Index: head/sys/x86/x86/busdma_machdep.c
===================================================================
--- head/sys/x86/x86/busdma_machdep.c
+++ head/sys/x86/x86/busdma_machdep.c
@@ -301,13 +301,13 @@
#ifndef ACPI_DMAR
bool
-bus_dma_dmar_set_buswide(device_t dev)
+bus_dma_iommu_set_buswide(device_t dev)
{
return (false);
}
int
-bus_dma_dmar_load_ident(bus_dma_tag_t dmat, bus_dmamap_t map,
+bus_dma_iommu_load_ident(bus_dma_tag_t dmat, bus_dmamap_t map,
vm_paddr_t start, vm_size_t length, int flags)
{
return (0);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Oct 26, 5:38 PM (14 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
24233440
Default Alt Text
D25852.id75077.diff (6 KB)
Attached To
Mode
D25852: make set_buswide() generic
Attached
Detach File
Event Timeline
Log In to Comment