All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH umr] Try /dev/fmem first when reading system memory
@ 2017-03-21 14:20 Tom St Denis
  0 siblings, 0 replies; only message in thread
From: Tom St Denis @ 2017-03-21 14:20 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Tom St Denis

On many platforms /dev/mem is restricted to PCI I/O space
only.  The /dev/fmem device driver can be found
on github and it allows unrestricted access to physical memory.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
---
 src/lib/read_vram.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/lib/read_vram.c b/src/lib/read_vram.c
index 6675dafbe1d0..e2087a252c10 100644
--- a/src/lib/read_vram.c
+++ b/src/lib/read_vram.c
@@ -61,7 +61,9 @@ static int umr_read_sram(uint64_t address, uint32_t size, void *dst)
 {
 	int fd;
 
-	fd = open("/dev/mem", O_RDWR | O_DSYNC);
+	fd = open("/dev/fmem", O_RDWR);
+	if (fd < 0)
+		fd = open("/dev/mem", O_RDWR | O_DSYNC);
 	if (fd >= 0) {
 		memset(dst, 0xFF, size);
 		lseek(fd, address, SEEK_SET);
@@ -192,6 +194,7 @@ static int umr_read_vram_vi(struct umr_asic *asic, uint32_t vmid, uint64_t addre
 		if (pte_fields.system) {
 			if (umr_read_sram(start_addr, chunk_size, pdst) < 0) {
 				fprintf(stderr, "[ERROR] Cannot read system ram, perhaps CONFIG_STRICT_DEVMEM is set in your kernel config?\n");
+				fprintf(stderr, "[ERROR] Alternatively download and install /dev/fmem\n");
 				return -1;
 			}
 		} else {
-- 
2.12.0

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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2017-03-21 14:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-21 14:20 [PATCH umr] Try /dev/fmem first when reading system memory Tom St Denis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.