From patchwork Wed Aug 26 18:37:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Grimm X-Patchwork-Id: 1352082 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BcF5Q0lv7z9sTS for ; Thu, 27 Aug 2020 04:39:38 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=KIq8pMs2; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4BcF5P6LmGzDqSd for ; Thu, 27 Aug 2020 04:39:37 +1000 (AEST) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linux.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=grimm@linux.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=KIq8pMs2; dkim-atps=neutral Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4BcF3d0Td3zDqQs for ; Thu, 27 Aug 2020 04:38:04 +1000 (AEST) Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 07QIXXo7105824 for ; Wed, 26 Aug 2020 14:38:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : subject : date : message-id : in-reply-to : references; s=pp1; bh=r9DGd2Cvz8Y/zRYlGcYkM6LoZQGrXVF1ONXZ5X2xxo0=; b=KIq8pMs2J10zaRvDNA4pncT5tNu2SThBmgoXBa9wSppY/rWnzCnXmnnioYosMD5AoMGT /kqaJa4Vu5MiE8tDebcV79vppahvLkG2Fds/oYGX85lm/PyzyB9eW1l/QzXSfC/drtA0 9b2M7HxUklAJ+TRmxCZrg3hsCcbLrDM8jX9a4+orDjWIoauUphgaTR7nSQkHKrZFc4os TvgM/DDQFVZkywf9c++DEqfhXFVYS0uUfmSyrVPi47PxPLEIiXdwFXxv3xl6KwyFtHUh Ct4Ew5Lj2it0HokCJKRpm7NiPwAJqT2OKMR5JkVRaula8cFExjiq6j20BTaZRP4V6V55 mg== Received: from ppma04wdc.us.ibm.com (1a.90.2fa9.ip4.static.sl-reverse.com [169.47.144.26]) by mx0a-001b2d01.pphosted.com with ESMTP id 335vh097q7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 26 Aug 2020 14:38:02 -0400 Received: from pps.filterd (ppma04wdc.us.ibm.com [127.0.0.1]) by ppma04wdc.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 07QIX4on030832 for ; Wed, 26 Aug 2020 18:38:01 GMT Received: from b01cxnp22035.gho.pok.ibm.com (b01cxnp22035.gho.pok.ibm.com [9.57.198.25]) by ppma04wdc.us.ibm.com with ESMTP id 332ujev10s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 26 Aug 2020 18:38:01 +0000 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp22035.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 07QIc1aM52035902 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 26 Aug 2020 18:38:01 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2F170B2064 for ; Wed, 26 Aug 2020 18:38:01 +0000 (GMT) Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 01ED5B205F for ; Wed, 26 Aug 2020 18:38:00 +0000 (GMT) Received: from alain.ibm.com (unknown [9.160.10.71]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP for ; Wed, 26 Aug 2020 18:38:00 +0000 (GMT) From: Ryan Grimm To: skiboot@lists.ozlabs.org Date: Wed, 26 Aug 2020 14:37:40 -0400 Message-Id: <20200826183749.143980-3-grimm@linux.ibm.com> X-Mailer: git-send-email 2.18.4 In-Reply-To: <20200826183749.143980-1-grimm@linux.ibm.com> References: <20200826183749.143980-1-grimm@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-08-26_10:2020-08-26, 2020-08-26 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 priorityscore=1501 clxscore=1015 impostorscore=0 phishscore=0 malwarescore=0 adultscore=0 lowpriorityscore=0 suspectscore=13 mlxlogscore=999 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2008260134 Subject: [Skiboot] [PATCH v8 02/11] skiboot.tcl: ultravisor support X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" This tcl code turns on the S bit in MSR and sets up SMFCTRL and SIM_CTRL if MAMBO_ENABLE_SMF is set. Skiboot will run its exit_uv_mode function because there's no ibm,utlravisor device tree node. If ULTRA_IMAGE is set, it loads the image at 0xc0000000 and sets up the ibm,ultravisor device tree node. This can be tested using this (hacked) skiboot as the ultravisor image with: export SKIBOOT=skiboot.lid export ULTRA_IMAGE=$SKIBOOT export ULTRA_ENTRY=$(grep exit_uv_mode skiboot.map|cut -f1 -d " ") export MAMBO_ENABLE_SMF=1 Although you need to hack up exit_uv_mode to ignore the fdt pointer and treat as primary thread. Signed-off-by: Ryan Grimm --- external/mambo/skiboot.tcl | 74 +++++++++++++++++++++++++++++++++++++- 1 file changed, 73 insertions(+), 1 deletion(-) diff --git a/external/mambo/skiboot.tcl b/external/mambo/skiboot.tcl index 6003fcbe..c823985a 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 enable_smf MAMBO_ENABLE_SMF none + +mconfig ultra_image ULTRA_IMAGE none + +mconfig ultra_src_addr ULTRA_SRC_ADDR 0xc0000000; + +mconfig spr_urmor ULTRA_URMOR 0xe0000000 + +mconfig ultra_entry ULTRA_ENTRY 0; + mconfig linux_cmdline LINUX_CMDLINE "" # Paylod: Memory location for a Linux style ramdisk/initrd @@ -140,6 +150,11 @@ if { $default_config == "P9" } { if { $mconf(numa) } { myconf config memory_region_id_shift 45 } + + if { $mconf(enable_smf) != "none" } { + myconf config processor/initial/SMFCTRL 0x8000000000000002 + myconf config processor/initial/SIM_CTRL1 0x4228100404004000 + } } if { $mconf(numa) } { @@ -507,12 +522,16 @@ 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) != "none" } { + mysim mcm 0 cpu $c thread $t set spr msr 0x9000000000400000 + } } mysim of addprop $cpu_node array "ibm,ppc-interrupt-server#s" irqreg } #Add In-Memory Collection Counter nodes -if { $default_config == "P9" } { +#if { $default_config == "P9" && $mconf(enable_ultra) == "none" } { +if { $default_config == "P9" && $mconf(ultra_image) == "none" } { #Add the base node "imc-counters" set imc_c [mysim of addchild $root_node "imc-counters" ""] mysim of addprop $imc_c string "compatible" "ibm,opal-in-memory-counters" @@ -669,6 +688,59 @@ if { [info exists env(SKIBOOT_ENABLE_MAMBO_STB)] } { } } +if {$mconf(ultra_image) != "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 range [list] + lappend range $mconf(spr_urmor) + lappend range [expr [mysim display memory_size] - $mconf(spr_urmor)] + mysim of addprop $uv_fw_node array64 "secure-memory-ranges" range + + + set start $mconf(spr_urmor) + + if {[file exists $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 reg [list [expr $start >> 32] [expr $start & 0xffffffff] [expr $ultra_size >> 32] [expr $ultra_size & 0xffffffff]] + mysim of addprop $uv_fw_node array "reg" reg + + #secure-memory node + set start_hex [format %x $start] + set size [expr [mysim display memory_size] - $mconf(spr_urmor)] + set secure_mem_node [mysim of addchild $root_node "secure-memory@$start_hex" ""] + mysim of addprop $secure_mem_node string "compatible" "ibm,secure-memory" + set reg [list [expr $start >> 32] [expr $start & 0xffffffff] [expr $size >> 32] [expr $size & 0xffffffff]] + 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 + + 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" #