Skip to content

Commit

Permalink
mambo: Add persistent memory disk support
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
mikey authored and stewartsmith committed Apr 30, 2018
1 parent 8ed3707 commit 0a6a2ff
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions external/mambo/skiboot.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0a6a2ff

Please sign in to comment.