diff options
author | marius <marius@FreeBSD.org> | 2007-08-05 11:56:44 +0000 |
---|---|---|
committer | marius <marius@FreeBSD.org> | 2007-08-05 11:56:44 +0000 |
commit | 5a1a2bd9cf95421a0c3026645d8824333a77a4cf (patch) | |
tree | c917da70660ade216479598d5e93f30e756eb31e /sys/sparc64/include | |
parent | 73b31fd6b229633176825dd2f203d59947b34938 (diff) | |
download | FreeBSD-src-5a1a2bd9cf95421a0c3026645d8824333a77a4cf.zip FreeBSD-src-5a1a2bd9cf95421a0c3026645d8824333a77a4cf.tar.gz |
- Divorce the IOTSBs, which so far where handled via a global list
instead of per IOMMU, so we no longer need to program all of them
identically in systems having multiple IOMMUs. This continues the
rototilling of the nexus(4) done about 5 months ago, which amongst
others changed nexus(4) and the drivers for host-to-foo bridges
to provide bus_get_dma_tag methods, allowing to handle DMA tags in
a hierarchical way and to link them with devices.
This still doesn't move the silicon bug workarounds for Sabre (and
in the uncommitted schizo(4) for Tomatillo) bridges into special
bus_dma_tag_create() and bus_dmamap_sync() methods though, as w/o
fully newbus'ified bus_dma_tag_create() and bus_dma_tag_destroy()
this still requires too much hackery, i.e. per-child parent DMA
tags in the parent driver.
- Let the host-to-foo drivers supply the maximum physical address
of the IOMMU accompanying the bridges. Previously iommu(4) hard-
coded an upper limit of 16GB, which actually only applies to the
IOMMUs of the Hummingbird and Sabre bridges. The Psycho variants
as well as the U2S in fact can can translate to up to 2TB, i.e.
translate to 41-bit physical addresses. According to the recently
available Tomatillo documentation these bridges even translate to
43-bit physical addresses and hints at the Schizo bridges doing
43 bits as well.
This fixes the issue the FreeBSD 6.0 todo list item "Max RAM on
sparc64" was refering to and pretty much obsoletes the lack of
support for bounce buffers on sparc64.
Thanks to Nathan Whitehorn for pointing me at the Tomatillo manual.
Approved by: re (kensmith)
Diffstat (limited to 'sys/sparc64/include')
-rw-r--r-- | sys/sparc64/include/iommureg.h | 5 | ||||
-rw-r--r-- | sys/sparc64/include/iommuvar.h | 29 |
2 files changed, 21 insertions, 13 deletions
diff --git a/sys/sparc64/include/iommureg.h b/sys/sparc64/include/iommureg.h index 65d59ce..0218cfa 100644 --- a/sys/sparc64/include/iommureg.h +++ b/sys/sparc64/include/iommureg.h @@ -64,8 +64,7 @@ #define STRBUF_EN 0x0000000000000001UL #define STRBUF_D 0x0000000000000002UL -#define IOMMU_BITS 34 -#define IOMMU_MAXADDR ((1UL << IOMMU_BITS) - 1) +#define IOMMU_MAXADDR(bits) ((1UL << (bits)) - 1) /* * control register bits @@ -121,7 +120,7 @@ /* Accesses to same bus segment? */ #define IOTTE_LOCAL 0x0800000000000000UL /* Let's assume this is correct */ -#define IOTTE_PAMASK 0x000001ffffffe000UL +#define IOTTE_PAMASK 0x000007ffffffe000UL /* Accesses to cacheable space */ #define IOTTE_C 0x0000000000000010UL /* Writeable */ diff --git a/sys/sparc64/include/iommuvar.h b/sys/sparc64/include/iommuvar.h index 9c290c0..792a823 100644 --- a/sys/sparc64/include/iommuvar.h +++ b/sys/sparc64/include/iommuvar.h @@ -40,20 +40,31 @@ #define trunc_io_page(x) trunc_page(x) /* + * LRU queue handling for lazy resource allocation + */ +TAILQ_HEAD(iommu_maplruq_head, bus_dmamap); + +/* * Per-IOMMU state. The parenthesized comments indicate the locking strategy: - * i - protected by iommu_mtx. + * i - protected by is_mtx. * r - read-only after initialization. * * - comment refers to pointer target / target hardware registers * (for bus_addr_t). - * iommu_map_lruq is also locked by iommu_mtx. Elements of iommu_tsb may only - * be accessed from functions operating on the map owning the corresponding - * resource, so the locking the user is required to do to protect the map is - * sufficient. As soon as the TSBs are divorced, these will be moved into struct - * iommu_state, and each state struct will get its own lock. - * iommu_dvma_rman needs to be moved there too, but has its own internal lock. + * is_maplruq is also locked by is_mtx. Elements of is_tsb may only be + * accessed from functions operating on the map owning the corresponding + * resource, so the locking the user is required to do to protect the + * map is sufficient. + * dm_reslist of all maps are locked by is_mtx as well. + * is_dvma_rman has its own internal lock. */ struct iommu_state { + struct mtx is_mtx; + struct rman is_dvma_rman; /* DVMA space rman */ + struct iommu_maplruq_head is_maplruq; /* (i) LRU queue */ + vm_paddr_t is_ptsb; /* (r) TSB physical address */ + u_int64_t *is_tsb; /* (*i) TSB virtual address */ int is_tsbsize; /* (r) 0 = 8K, ... */ + u_int64_t is_pmaxaddr; /* (r) max. physical address */ u_int64_t is_dvmabase; /* (r) */ int64_t is_cr; /* (r) Control reg value */ @@ -85,11 +96,9 @@ struct iommu_state { bus_addr_t is_dva; /* (r, *r) */ /* Tag compare diagnostics access */ bus_addr_t is_dtcmp; /* (r, *r) */ - - STAILQ_ENTRY(iommu_state) is_link; /* (r) */ }; -/* interfaces for PCI/SBUS code */ +/* interfaces for PCI/SBus code */ void iommu_init(char *, struct iommu_state *, int, u_int32_t, int); void iommu_reset(struct iommu_state *); void iommu_decode_fault(struct iommu_state *, vm_offset_t); |