Skip to contentSkip to conversation

Update and refactor PTE/PDE decoding

PATCH New Tom St Denis 1 participant 1 message Oct 27, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Update and refactor PTE/PDE decoding

From: Colin Lee <[email protected]>

Newer generations of hardware encode the PDE and PTE bitfields differently. This patch refactors this decoding and printing.

gfx11 hardware introduces TFS addressing relative to PDE0 which this patch also enables.

---
 src/app/server.c    |   2 +-
 src/lib/read_vram.c | 370 ++++++++++++++++++++++++++++++++++----------
 src/umr.h           |  14 +-
 3 files changed, 299 insertions(+), 87 deletions(-)
src/app/server.c +1 -1
index 820d914..aac52ed 100644
@@ -644,7 +644,7 @@ struct {
 } page_table[64];
 int num_page_table_entries;
 
-static void my_va_decode(pde_fields_ai_t *pdes, int num_pde, pte_fields_ai_t pte) {
+static void my_va_decode(pde_fields_t *pdes, int num_pde, pte_fields_t pte) {
 	for (int i = 0; i < num_pde; i++) {
 		page_table[num_page_table_entries].pba = pdes[i].pte_base_addr;
 		page_table[num_page_table_entries].type = i == 0 ? 0 : 1;
src/lib/read_vram.c +289 -81

528 lines not on this page · raw message

src/umr.h +9 -5
index e959d0c..661ffa6 100644
@@ -364,8 +364,10 @@ typedef struct {
 		system,
 		coherent,
 		pte,
-		further;
-} pde_fields_ai_t;
+		further,
+		tfs_addr,
+		llc_noalloc;
+} pde_fields_t;
 
 typedef struct {
 	uint64_t
@@ -382,8 +384,10 @@ typedef struct {
 		pde,
 		further,
 		mtype,
-		pte_mask;
-} pte_fields_ai_t;
+		pte_mask,
+		gcr,
+		llc_noalloc;
+} pte_fields_t;
 
 struct umr_memory_access_funcs {
 	/** access_sram -- Access System RAM
@@ -422,7 +426,7 @@ struct umr_memory_access_funcs {
 	 */
 	int (*vm_message)(const char *fmt, ...);
 
-	void (*va_addr_decode)(pde_fields_ai_t *pdes, int num_pde, pte_fields_ai_t pte);
+	void (*va_addr_decode)(pde_fields_t *pdes, int num_pde, pte_fields_t pte);
 
 	/** data -- opaque pointer the callbacks can use for state tracking */
 	void *data;
Signature · 1 line
2.34.1