[Skiboot] [PATCH] pmem: volatile bindings for the poorly enabled

Balbir singh bsingharora at gmail.com
Tue Jun 19 18:34:07 AEST 2018


PMEM_DISK bindings were added, but they rely on a rather
recent mmap feature. This patch steals from those bindings
to add volatile bindings. I've used these bindings with
PMEM_VOLATILE to launch an instance with the publicly
available systemsim-p9. The bindings are volatile and one
should not expect any data to be saved/retrieved.

Signed-off-by: Balbir singh <bsingharora at gmail.com>
---
 external/mambo/skiboot.tcl | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/external/mambo/skiboot.tcl b/external/mambo/skiboot.tcl
index 7068c802..7f92a53e 100644
--- a/external/mambo/skiboot.tcl
+++ b/external/mambo/skiboot.tcl
@@ -267,6 +267,32 @@ if { [info exists env(PMEM_DISK)] } {
     }
 }
 
+if { [info exists env(PMEM_VOLATILE)] } {
+
+    set pmem_sizes [split $env(PMEM_VOLATILE) ","]
+
+    set pmem_root [mysim of addchild $root_node "pmem" ""]
+    mysim of addprop $pmem_root int "#address-cells" 2
+    mysim of addprop $pmem_root int "#size-cells" 2
+    mysim of addprop $pmem_root empty "ranges" ""
+
+    # Start above where XICS normally is at 0x1A0000000000
+    if (![info exists pmem_start]) {
+        set pmem_start [expr 0x20000000000]
+    }
+
+    foreach pmem_size $pmem_sizes {
+	set pmem_size [string trim $pmem_size]
+	set pmem_start_hex [format %x $pmem_start]
+	set pmem_node [mysim of addchild $pmem_root "pmem@$pmem_start_hex" ""]
+	set reg [list [expr $pmem_start >> 32] [expr $pmem_start & 0xffffffff] [expr $pmem_size >> 32] [expr $pmem_size & 0xffffffff] ]
+	mysim of addprop $pmem_node array "reg" reg
+	mysim of addprop $pmem_node string "compatible" "pmem-region"
+	mysim of addprop $pmem_root int "volatile" 1
+	set pmem_start [expr $pmem_start + $pmem_size]
+    }
+}
+
 # Default NVRAM is blank and will be formatted by Skiboot if no file is provided
 set fake_nvram_start $cpio_end
 set fake_nvram_size 0x40000
-- 
2.17.1



More information about the Skiboot mailing list