Skip to contentSkip to conversation

Update and refactor PTE/PDE decoding

PATCH New Colin Lee 1 participant 1 message Oct 27, 2022

lore
Share & tools
lore

Colin Lee

author
#0 lore raw

PATCH v2 1/1 Update and refactor PTE/PDE decoding

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.

v2:
* Add PTE software field and PDE mtype field
* Include MC offset in PTE-as-PDE lookup case
* Check valid before entering PTE-AS-PDE case

---
 src/app/server.c    |   2 +-
 src/lib/read_vram.c | 399 ++++++++++++++++++++++++++++++++++----------
 src/umr.h           |  16 +-
 3 files changed, 322 insertions(+), 95 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 +310 -89

565 lines not on this page · raw message

src/umr.h +11 -5
index e959d0c..54c9bf4 100644
@@ -364,8 +364,11 @@ typedef struct {
 		system,
 		coherent,
 		pte,
-		further;
-} pde_fields_ai_t;
+		further,
+		tfs_addr,
+		llc_noalloc,
+		mtype;
+} pde_fields_t;
 
 typedef struct {
 	uint64_t
@@ -382,8 +385,11 @@ typedef struct {
 		pde,
 		further,
 		mtype,
-		pte_mask;
-} pte_fields_ai_t;
+		pte_mask,
+		gcr,
+		llc_noalloc,
+		software;
+} pte_fields_t;
 
 struct umr_memory_access_funcs {
 	/** access_sram -- Access System RAM
@@ -422,7 +428,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.25.1