From patchwork Thu Feb 27 20:40:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Grimm X-Patchwork-Id: 1246098 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (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 48T4Qz0Ntfz9sRL for ; Fri, 28 Feb 2020 07:44:27 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 48T4Qy2gGFzDr88 for ; Fri, 28 Feb 2020 07:44:26 +1100 (AEDT) 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=none (p=none dis=none) header.from=linux.ibm.com 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 48T4MZ4qrCzDr6W for ; Fri, 28 Feb 2020 07:41:30 +1100 (AEDT) Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 01RKP61D007399 for ; Thu, 27 Feb 2020 15:41:29 -0500 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ydq6jqb41-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 27 Feb 2020 15:41:28 -0500 Received: from m0098410.ppops.net (m0098410.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 01RKP65b007463 for ; Thu, 27 Feb 2020 15:41:28 -0500 Received: from ppma03dal.us.ibm.com (b.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.11]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ydq6jqb3p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 27 Feb 2020 15:41:28 -0500 Received: from pps.filterd (ppma03dal.us.ibm.com [127.0.0.1]) by ppma03dal.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 01RKeibl012354; Thu, 27 Feb 2020 20:41:27 GMT Received: from b01cxnp22035.gho.pok.ibm.com (b01cxnp22035.gho.pok.ibm.com [9.57.198.25]) by ppma03dal.us.ibm.com with ESMTP id 2ydcmm434x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 27 Feb 2020 20:41:27 +0000 Received: from b01ledav001.gho.pok.ibm.com (b01ledav001.gho.pok.ibm.com [9.57.199.106]) by b01cxnp22035.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 01RKfQft46399876 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 27 Feb 2020 20:41:26 GMT Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 409D628059; Thu, 27 Feb 2020 20:41:26 +0000 (GMT) Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C660828058; Thu, 27 Feb 2020 20:41:25 +0000 (GMT) Received: from alain.ibm.com (unknown [9.80.218.175]) by b01ledav001.gho.pok.ibm.com (Postfix) with ESMTP; Thu, 27 Feb 2020 20:41:25 +0000 (GMT) From: Ryan Grimm To: oohall@gmail.com Date: Thu, 27 Feb 2020 15:40:17 -0500 Message-Id: <20200227204023.22125-11-grimm@linux.ibm.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200227204023.22125-1-grimm@linux.ibm.com> References: <20200227204023.22125-1-grimm@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.572 definitions=2020-02-27_06:2020-02-26, 2020-02-27 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 adultscore=0 spamscore=0 impostorscore=0 suspectscore=1 bulkscore=0 mlxlogscore=999 clxscore=1015 priorityscore=1501 malwarescore=0 mlxscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002270140 Subject: [Skiboot] [RFC PATCH v5 10/16] hdata/spira.c: Create ibm, ultravisor dt node 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: , Cc: janani@us.ibm.com, suka@us.ibm.com, skiboot@lists.ozlabs.org Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Create ibm,ultravisor node if secure memory exists. See doc/opal-uv-abi.rst for details. Signed-off-by: Ryan Grimm --- hdata/spira.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/hdata/spira.c b/hdata/spira.c index 7c5918d2..1435d175 100644 --- a/hdata/spira.c +++ b/hdata/spira.c @@ -1712,6 +1712,36 @@ static void update_spirah_addr(void) #endif } +#define UV_LOAD_MAX_SIZE 0x200000 + +static void add_uv(void) +{ + struct dt_node *uv_node, *secure_mem_node, *uv_fw_node; + uint64_t uv_fw_start; + char fw_name[64]; + + secure_mem_node = dt_find_compatible_node_on_chip(dt_root, NULL, + "ibm,secure-memory", 0); + if (!secure_mem_node) { + prlog(PR_DEBUG, "HDAT: No ibm,secure-memory found\n"); + return; + } + + uv_node = dt_new_check(dt_root, "ibm,ultravisor"); + dt_add_property_string(uv_node, "compatible", "ibm,ultravisor"); + dt_add_property_cells(uv_node, "#address-cells", 2); + dt_add_property_cells(uv_node, "#size-cells", 2); + + uv_fw_start = dt_get_address(secure_mem_node, 0, NULL); + + snprintf(fw_name, 64, "firmware@%llx", (unsigned long long)uv_fw_start); + uv_fw_node = dt_new_check(uv_node, fw_name); + dt_add_property_string(uv_fw_node, "compatible", "ibm,uv-firmware"); + dt_add_property_cells(uv_fw_node, "reg", uv_fw_start >> 32, + uv_fw_start & 0xffffffff, UV_LOAD_MAX_SIZE >> 23, + UV_LOAD_MAX_SIZE & 0xffffffff); +} + int parse_hdat(bool is_opal) { cpu_type = PVR_TYPE(mfspr(SPR_PVR)); @@ -1753,6 +1783,9 @@ int parse_hdat(bool is_opal) /* Parse MS VPD */ memory_parse(); + /* Add UV node if secure memory exists */ + add_uv(); + /* Add any FSPs */ fsp_parse();