[Skiboot] [RFC PATCH v5 05/16] skiboot.tcl: ultravisor support
Ryan Grimm
grimm at linux.ibm.com
Fri Feb 28 07:40:12 AEDT 2020
This tcl code turns on the S bit in MSR and sets up the SMF control
register if MAMBO_ENABLE_SMF is set.
It loads ULTRA_LID at 0xc0000000 and sets up the ibm,ultravisor device
tree node if MAMBO_ENABLE_ULTRA is set.
This can be tested using this skiboot as the ultravisor image with:
export SKIBOOT=skiboot.lid
export ULTRA_LID=$SKIBOOT
export ULTRA_ENTRY=grep exit_uv_mode skiboot.map|cut -f1 -d " "
export MAMBO_ENABLE_ULTRA=1
export MAMBO_ENABLE_SMF=1
All threads will then exit UV mode with SMF off.
Signed-off-by: Ryan Grimm <grimm at linux.ibm.com>
---
external/mambo/skiboot.tcl | 66 ++++++++++++++++++++++++++++++++++++++
1 file changed, 66 insertions(+)
diff --git a/external/mambo/skiboot.tcl b/external/mambo/skiboot.tcl
index 8d1cfc66..39504140 100644
--- a/external/mambo/skiboot.tcl
+++ b/external/mambo/skiboot.tcl
@@ -56,6 +56,16 @@ if { ![info exists env(SKIBOOT_ZIMAGE)] } {
}
mconfig payload PAYLOAD $env(SKIBOOT_ZIMAGE)
+mconfig ultra_image ULTRA_IMG $env(ULTRA_LID)
+
+mconfig ultra_src_addr ULTRA_SRC_ADDR 0xc0000000;
+
+mconfig ultra_entry ULTRA_ENTRY 0;
+
+mconfig enable_smf MAMBO_ENABLE_SMF none
+
+mconfig enable_ultra MAMBO_ENABLE_ULTRA none
+
mconfig linux_cmdline LINUX_CMDLINE ""
# Paylod: Memory location for a Linux style ramdisk/initrd
@@ -140,6 +150,10 @@ if { $default_config == "P9" } {
if { $mconf(numa) } {
myconf config memory_region_id_shift 45
}
+
+ if { $mconf(enable_smf) } {
+ myconf config processor/initial/SMFCTRL 0x8000000000000002
+ }
}
if { $mconf(numa) } {
@@ -496,6 +510,9 @@ for { set c 0 } { $c < $mconf(cpus) } { incr c } {
mysim mcm 0 cpu $c thread $t set spr pir $pir
lappend irqreg $pir
incr pir
+ if { $mconf(enable_smf) } {
+ mysim mcm 0 cpu $c thread $t set spr msr 0x9000000000400000
+ }
}
mysim of addprop $cpu_node array "ibm,ppc-interrupt-server#s" irqreg
}
@@ -658,6 +675,55 @@ if { [info exists env(SKIBOOT_ENABLE_MAMBO_STB)] } {
}
}
+#top half of memory
+mconfig spr_urmor ULTRA_URMOR [format "0x%016X" [expr [mysim display memory_size] / 2]]
+
+if {$mconf(enable_ultra) != "none"} {
+ set uv_node [ mysim of addchild $root_node "ibm,ultravisor" "" ]
+ mysim of addprop $uv_node string "compatible" "ibm,ultravisor"
+ mysim of addprop $uv_node int "#address-cells" 2
+ mysim of addprop $uv_node int "#size-cells" 2
+
+ set uv_fw_node [ mysim of addchild $uv_node "firmware" "" ]
+ mysim of addprop $uv_fw_node string "compatible" "ibm,uv-firmware"
+ set uv_entry $mconf(ultra_entry)
+ set uv_entry_prop [ list [expr $uv_entry >> 32] [expr $uv_entry & 0xffffffff] ]
+ mysim of addprop $uv_fw_node array "uv-entry" uv_entry_prop
+
+ set start $mconf(spr_urmor)
+ set size [expr [mysim display memory_size] - $mconf(spr_urmor)]
+ set reg [list [expr $start >> 32] [expr $start & 0xffffffff] [expr $size >> 32] [expr $size & 0xffffffff]]
+ mysim of addprop $uv_fw_node array "reg" reg
+
+ #secure-memory node
+ set start_hex [format %x $start]
+ set secure_mem_node [mysim of addchild $root_node "secure-memory@$start_hex" ""]
+ mysim of addprop $secure_mem_node string "compatible" "ibm,secure-memory"
+ mysim of addprop $secure_mem_node array "reg" reg
+ mysim of addprop $secure_mem_node string "device_type" "secure-memory"
+ set associativity [list 4 0 0 0 0]
+ mysim of addprop $secure_mem_node "array" "ibm,associativity" associativity
+ set chip_id [format %x 0]
+ mysim of addprop $secure_mem_node array "ibm,chip-id" chip_id
+
+ if {[file exists $mconf(ultra_image)]} {
+ puts "Using ultra from $mconf(ultra_image)"
+ set ultra_file $mconf(ultra_image)
+ } else {
+ puts "ERROR: Could not find ultra: $mconf(ultra_image)"
+ exit
+ }
+
+ set ultra_size [file size $ultra_file]
+ set src_addr $mconf(ultra_src_addr)
+ mysim memory fread $src_addr $ultra_size $ultra_file
+
+ set uv_firmware [mysim of addchild $reserved_memory "ibm,uv-firmware" ""]
+ set reg [list $src_addr $ultra_size]
+ mysim of addprop $uv_firmware array64 "reg" reg
+ mysim of addprop $uv_firmware empty "name" "ibm,uv-firmware"
+}
+
# Kernel command line args, appended to any from the device tree
# e.g.: of::set_bootargs "xmon"
#
--
2.21.0
More information about the Skiboot
mailing list