aboutsummaryrefslogtreecommitdiffstats
path: root/mmu.c
diff options
context:
space:
mode:
Diffstat (limited to 'mmu.c')
-rw-r--r--mmu.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/mmu.c b/mmu.c
index 6784b9f..ababef5 100644
--- a/mmu.c
+++ b/mmu.c
@@ -24,7 +24,8 @@ int g_verbose = 0;
24 @param pd_ap PD-type aperture (target address space) for `addr` 24 @param pd_ap PD-type aperture (target address space) for `addr`
25 @return A dereferencable kernel address, or an ERR_PTR-wrapped error 25 @return A dereferencable kernel address, or an ERR_PTR-wrapped error
26 */ 26 */
27static void __iomem *pd_deref(struct nvdebug_state *g, uintptr_t addr, enum PD_TARGET pd_ap) { 27static void __iomem *pd_deref(struct nvdebug_state *g, uintptr_t addr,
28 enum PD_TARGET pd_ap) {
28 struct iommu_domain *dom; 29 struct iommu_domain *dom;
29 phys_addr_t phys; 30 phys_addr_t phys;
30 31
@@ -67,11 +68,11 @@ static void __iomem *pd_deref(struct nvdebug_state *g, uintptr_t addr, enum PD_T
67 68
68// Internal helper for search_page_directory(). 69// Internal helper for search_page_directory().
69uint64_t search_page_directory_subtree(struct nvdebug_state *g, 70uint64_t search_page_directory_subtree(struct nvdebug_state *g,
70 uintptr_t pde_addr, 71 uintptr_t pde_addr,
71 enum PD_TARGET pde_target, 72 enum PD_TARGET pde_target,
72 uint64_t addr_to_find, 73 uint64_t addr_to_find,
73 enum INST_TARGET addr_to_find_aperture, 74 enum INST_TARGET addr_to_find_aperture,
74 uint32_t level) { 75 uint32_t level) {
75 uint64_t res, i; 76 uint64_t res, i;
76 void __iomem *pde_kern; 77 void __iomem *pde_kern;
77 page_dir_entry_t entry; 78 page_dir_entry_t entry;
@@ -110,13 +111,12 @@ uint64_t search_page_directory_subtree(struct nvdebug_state *g,
110} 111}
111 112
112/* GPU Physical address -> Virtual address ("reverse" translation) for V2 tables 113/* GPU Physical address -> Virtual address ("reverse" translation) for V2 tables
113
114 Depth-first search a page directory of the GPU MMU for where a particular 114 Depth-first search a page directory of the GPU MMU for where a particular
115 physical address is mapped. Upon finding a mapping, the virtual address is 115 physical address is mapped. Upon finding a mapping, the virtual address is
116 returned. 116 returned.
117 117
118 The page directory may be located in VID_MEM, SYS_MEM, or some combination of 118 The page directory and tables may be located in VID_MEM, SYS_MEM, or spread
119 the two. 119 across multiple apertures.
120 120
121 @param pd_config Page Directory configuration, containing pointer and 121 @param pd_config Page Directory configuration, containing pointer and
122 aperture for the start of the PDE3 entries 122 aperture for the start of the PDE3 entries
@@ -126,9 +126,9 @@ uint64_t search_page_directory_subtree(struct nvdebug_state *g,
126 mapped into by this page table. (Zero is not a valid virtual address) 126 mapped into by this page table. (Zero is not a valid virtual address)
127*/ 127*/
128uint64_t search_page_directory(struct nvdebug_state *g, 128uint64_t search_page_directory(struct nvdebug_state *g,
129 page_dir_config_t pd_config, 129 page_dir_config_t pd_config,
130 uint64_t addr_to_find, 130 uint64_t addr_to_find,
131 enum INST_TARGET addr_to_find_aperture) { 131 enum INST_TARGET addr_to_find_aperture) {
132 uint64_t res, i; 132 uint64_t res, i;
133 // Make sure that the query is page-aligned 133 // Make sure that the query is page-aligned
134 if (addr_to_find & 0xfff) { 134 if (addr_to_find & 0xfff) {
@@ -147,9 +147,9 @@ uint64_t search_page_directory(struct nvdebug_state *g,
147 (See `search_page_directory()` for documentation.) 147 (See `search_page_directory()` for documentation.)
148 */ 148 */
149uint64_t search_v1_page_directory(struct nvdebug_state *g, 149uint64_t search_v1_page_directory(struct nvdebug_state *g,
150 page_dir_config_t pd_config, 150 page_dir_config_t pd_config,
151 uint64_t addr_to_find, 151 uint64_t addr_to_find,
152 enum INST_TARGET addr_to_find_aperture) { 152 enum INST_TARGET addr_to_find_aperture) {
153 uint64_t j, i = 0; 153 uint64_t j, i = 0;
154 page_dir_entry_v1_t pde; 154 page_dir_entry_v1_t pde;
155 page_tbl_entry_v1_t pte; 155 page_tbl_entry_v1_t pte;