AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tom St Denis <tom.stdenis-5C7GfCeVMHo@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: Tom St Denis <tom.stdenis-5C7GfCeVMHo@public.gmane.org>
Subject: [PATCH umr] Continue reading PDB if V=0 if in vm-decode mode
Date: Mon, 22 Jan 2018 08:57:49 -0500	[thread overview]
Message-ID: <20180122135749.26575-1-tom.stdenis@amd.com> (raw)

This will skip to the next page boundary (assumes page=4K right now) if
in --vm-decode mode.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reported-by: Christian König <christian.koenig@amd.com>
---
 src/lib/read_vram.c | 25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/src/lib/read_vram.c b/src/lib/read_vram.c
index 491a55f69d49..3331b3e66d24 100644
--- a/src/lib/read_vram.c
+++ b/src/lib/read_vram.c
@@ -221,8 +221,15 @@ static int umr_access_vram_vi(struct umr_asic *asic, uint32_t vmid,
 						(int)pde_fields.valid);
 			memcpy(&pde_copy, &pde_fields, sizeof pde_fields);
 
-			if (!pde_fields.valid)
-				return -1;
+			if (!pde_fields.valid) {
+				if (pdst)
+					return -1;
+
+				// if we are vm-decode'ing just jump
+				// to the next page
+				start_addr = address & 0xFFF; // grab page offset so we can advance to next page
+				goto next_page;
+			}
 
 			// now read PTE entry for this page
 			if (umr_read_vram(asic, UMR_LINEAR_HUB, pde_fields.pte_base_addr + pte_idx*8 - vm_fb_base, 8, &pte_entry) < 0)
@@ -273,6 +280,7 @@ static int umr_access_vram_vi(struct umr_asic *asic, uint32_t vmid,
 			start_addr = dma_to_phys(asic, pte_fields.page_base_addr) + (address & 0xFFF);
 		}
 
+next_page:
 		// read upto 4K from it
 		if (((start_addr & 0xFFF) + size) & ~0xFFF) {
 			chunk_size = 0x1000 - (start_addr & 0xFFF);
@@ -528,8 +536,16 @@ static int umr_access_vram_ai(struct umr_asic *asic, uint32_t vmid,
 				if (!pde_fields.system)
 					pde_fields.pte_base_addr -= vm_fb_offset;
 
-				if (!pde_fields.valid)
-					return -1;
+				if (!pde_fields.valid) {
+					if (pdst)
+						return -1;
+					// jump to next page if in
+					// vm-decode mode
+					pte_fields.prt = 0;
+					pte_fields.valid = 0;
+					start_addr = address & 0xFFF; // grab page offset so we can advance to next page
+					goto next_page;
+				}
 
 				// for the next round the address we're decoding is the phys address in the currently decoded PDE
 				--current_depth;
@@ -632,6 +648,7 @@ pde_is_pte:
 			start_addr = dma_to_phys(asic, pte_fields.page_base_addr) + (address & 0xFFF);
 		}
 
+next_page:
 		// read upto 4K from it
 		// TODO: Support page sizes >4KB
 		if (((start_addr & 0xFFF) + size) & ~0xFFF) {
-- 
2.14.3

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

                 reply	other threads:[~2018-01-22 13:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180122135749.26575-1-tom.stdenis@amd.com \
    --to=tom.stdenis-5c7gfcevmho@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox