diff options
author | Michael Neuling <mikey@neuling.org> | 2018-04-26 16:27:55 +1000 |
---|---|---|
committer | Stewart Smith <stewart@linux.ibm.com> | 2018-04-29 19:49:22 -0500 |
commit | 0a6a2ff30c9ed47824af455207d1f268feb1ef63 (patch) | |
tree | bf25d0170698b283b3e1ced93438ec400805f3eb /external | |
parent | 8ed37072c07ee0c8be2ed8d9e2ede19333856e86 (diff) | |
download | skiboot-0a6a2ff30c9ed47824af455207d1f268feb1ef63.zip skiboot-0a6a2ff30c9ed47824af455207d1f268feb1ef63.tar.gz skiboot-0a6a2ff30c9ed47824af455207d1f268feb1ef63.tar.bz2 |
mambo: Add persistent memory disk support
This adds support to for mapping disks images using persistent
memory. Disks can be added by setting this ENV variable:
PMEM_DISK="/mydisks/disk1.img,/mydisks/disk2.img"
These will show up in Linux as /dev/pmem0 and /dev/pmem1.
This uses a new feature in mambo "mysim memory mmap .." which is only
available since mambo commit 0131f0fc08 (from 24/4/2018).
This also needs the of_pmem.c driver in Linux which is only available
since v4.17. It works with powernv_defconfig + CONFIG_OF_PMEM. ie
--- a/arch/powerpc/configs/powernv_defconfig
+++ b/arch/powerpc/configs/powernv_defconfig
@@ -238,6 +238,8 @@ CONFIG_RTC_CLASS=y
CONFIG_RTC_DRV_GENERIC=y
CONFIG_VIRTIO_PCI=m
CONFIG_VIRTIO_BALLOON=m
+CONFIG_LIBNVDIMM=y
+# CONFIG_ND_BLK is not set
CONFIG_EXT2_FS=y
CONFIG_EXT2_FS_XATTR=y
CONFIG_EXT2_FS_POSIX_ACL=y
Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Diffstat (limited to 'external')
-rw-r--r-- | external/mambo/skiboot.tcl | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/external/mambo/skiboot.tcl b/external/mambo/skiboot.tcl index 6c40289..9dbcd90 100644 --- a/external/mambo/skiboot.tcl +++ b/external/mambo/skiboot.tcl @@ -227,6 +227,35 @@ if { [info exists env(SKIBOOT_INITRD)] } { mysim of addprop $chosen_node int "linux,initrd-end" $cpio_end } +# Map persistent memory disks +if { [info exists env(PMEM_DISK)] } { + + set pmem_files [split $env(PMEM_DISK) ","] + + 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 + set pmem_start [expr 0x20000000000] + foreach pmem_file $pmem_files { + set pmem_file [string trim $pmem_file] + set pmem_size [file size $pmem_file] + 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 empty "volatile" "" + if {[catch {mysim memory mmap $pmem_start $pmem_size $pmem_file rw}]} { + puts "ERROR: pmem: 'mysim mmap' command needs newer mambo" + exit + } + 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 |