From patchwork Wed Jun 19 17:54:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Volodymyr Babchuk X-Patchwork-Id: 11004985 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0C6D614B6 for ; Wed, 19 Jun 2019 17:56:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EE3D8285CC for ; Wed, 19 Jun 2019 17:56:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E05E7285D9; Wed, 19 Jun 2019 17:56:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D44DB285CC for ; Wed, 19 Jun 2019 17:56:37 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hdemu-0007zA-B0; Wed, 19 Jun 2019 17:54:24 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hdems-0007yb-N7 for xen-devel@lists.xenproject.org; Wed, 19 Jun 2019 17:54:22 +0000 X-Inumbo-ID: 441b74f3-92bb-11e9-8980-bc764e045a96 Received: from EUR02-VE1-obe.outbound.protection.outlook.com (unknown [2a01:111:f400:fe06::620]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 441b74f3-92bb-11e9-8980-bc764e045a96; Wed, 19 Jun 2019 17:54:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=epam.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fP8vJPN22b6OLgoR82XgeZN8aCm/Eqc6Z8g29fVGTPY=; b=nsIEIj5ROWE0wq607l2rF/0q2ZETjjUXToPFlGtmub6v30TXVMneRssbY18l7Xeqq+5Al6gyFwJgyDUFSTcPgrdvNKDeD/inOBMdFmRBS35YWr4ug97ssqV2NdyU0ki3XiESSyYDLicdkDfCCK/u95igRBMlBxZgBzjDFtgbEYPqD1eqWFakDk5ai578N6xqSaFH6bIeeUvf9jIxBi6pBLenpOzwF4DHcKKIg5Nm/UNaBmj1BUcElox+wqFPSZCqBzinlViolWKOCxAr8eJNhXccMCPH7NeU3Hu7xeA6iARcMGF+EEzRnh0Cuqyxn10XYCNwsEI7SY74tXTXX9IA+g== Received: from AM0PR03MB4148.eurprd03.prod.outlook.com (20.176.214.210) by AM0PR03MB6051.eurprd03.prod.outlook.com (10.255.31.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1987.11; Wed, 19 Jun 2019 17:54:19 +0000 Received: from AM0PR03MB4148.eurprd03.prod.outlook.com ([fe80::d09e:ef3:88b6:b1eb]) by AM0PR03MB4148.eurprd03.prod.outlook.com ([fe80::d09e:ef3:88b6:b1eb%7]) with mapi id 15.20.1987.013; Wed, 19 Jun 2019 17:54:19 +0000 From: Volodymyr Babchuk To: "xen-devel@lists.xenproject.org" Thread-Topic: [PATCH v7 2/5] tools/arm: optee: create optee firmware node in DT if tee=optee Thread-Index: AQHVJsgFm0lDectG80mAA7GOe+3Yow== Date: Wed, 19 Jun 2019 17:54:19 +0000 Message-ID: <20190619175333.29938-3-volodymyr_babchuk@epam.com> References: <20190619175333.29938-1-volodymyr_babchuk@epam.com> In-Reply-To: <20190619175333.29938-1-volodymyr_babchuk@epam.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Volodymyr_Babchuk@epam.com; x-originating-ip: [85.223.209.22] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: cad1f351-4f6c-4253-5e02-08d6f4df2795 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020); SRVR:AM0PR03MB6051; x-ms-traffictypediagnostic: AM0PR03MB6051: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6430; x-forefront-prvs: 0073BFEF03 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(376002)(396003)(136003)(39860400002)(346002)(189003)(199004)(81156014)(186003)(3846002)(76116006)(26005)(6506007)(14454004)(72206003)(64756008)(6436002)(2616005)(1076003)(2351001)(54906003)(486006)(4326008)(5660300002)(36756003)(6486002)(80792005)(66556008)(8936002)(66446008)(55236004)(66946007)(446003)(71190400001)(476003)(102836004)(68736007)(66476007)(71200400001)(99286004)(53936002)(6512007)(76176011)(7736002)(86362001)(8676002)(25786009)(73956011)(305945005)(316002)(2501003)(66066001)(6116002)(478600001)(256004)(11346002)(2906002)(5640700003)(91956017)(81166006)(6916009); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR03MB6051; H:AM0PR03MB4148.eurprd03.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: epam.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 9EcSxbO1Fd2VcqE5QdwLT3DQ7ilEA+eGe/i1BKu8xBbnKYirxG4N9Ks+0yvEbs6f+QmdWvCekTb6ZJwvBPFuXEvahrf75wzhK8QWtCsJdFGmt6oWpR9ihoy698ZpS5J0ggv9kLx4Zk+Qz1iXbO9SRT+OcgqY6J49S55htOfc83n1Ke+pLAUb4oxsS1O60TjNv+ujJToUAhg6WldIF6GCUD8Z5p8ZdVAKi4WS58JygrGcoiY5ikb1C9+0NXltJZc8OSJZG4hPGGZQBJEtYfB+SZcWFefrRQwbA79amHKYHw3NOofZIfxDHaYT5IwXw2EgkfZhIdYMhfo67g+S6lZpvjohcZ3H9WD/KJgE3H6FLbN8VVQTRR/jhErUUEz/gAqBfBL7Ixktqo+Y9/Ngy/xpcvJ6PnZKX2p8HT52nbAeMzg= MIME-Version: 1.0 X-OriginatorOrg: epam.com X-MS-Exchange-CrossTenant-Network-Message-Id: cad1f351-4f6c-4253-5e02-08d6f4df2795 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Jun 2019 17:54:19.7679 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b41b72d0-4e9f-4c26-8a69-f949f367c91d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Volodymyr_Babchuk@epam.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR03MB6051 Subject: [Xen-devel] [PATCH v7 2/5] tools/arm: optee: create optee firmware node in DT if tee=optee X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: "tee-dev@lists.linaro.org" , Ian Jackson , Julien Grall , Volodymyr Babchuk , Wei Liu Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP If TEE support is enabled with "tee=optee" option in xl.cfg, then we need to inform guest about available TEE, by creating corresponding node in the guest's device tree. Signed-off-by: Volodymyr Babchuk Reviewed-by: Julien Grall Acked-by: Ian Jackson --- This patch depends on patches to optee.c. Changes from v4: - "native" option replaced with "optee" Changes from v3: - "smc" method replaced with "hvc" - Coding style fixes --- tools/libxl/libxl_arm.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c index 6b72c00960..bf31b9b3ca 100644 --- a/tools/libxl/libxl_arm.c +++ b/tools/libxl/libxl_arm.c @@ -420,6 +420,32 @@ static int make_psci_node(libxl__gc *gc, void *fdt) return 0; } +static int make_optee_node(libxl__gc *gc, void *fdt) +{ + int res; + LOG(DEBUG, "Creating OP-TEE node in dtb"); + + res = fdt_begin_node(fdt, "firmware"); + if (res) return res; + + res = fdt_begin_node(fdt, "optee"); + if (res) return res; + + res = fdt_property_compat(gc, fdt, 1, "linaro,optee-tz"); + if (res) return res; + + res = fdt_property_string(fdt, "method", "hvc"); + if (res) return res; + + res = fdt_end_node(fdt); + if (res) return res; + + res = fdt_end_node(fdt); + if (res) return res; + + return 0; +} + static int make_memory_nodes(libxl__gc *gc, void *fdt, const struct xc_dom_image *dom) { @@ -933,6 +959,9 @@ next_resize: if (info->arch_arm.vuart == LIBXL_VUART_TYPE_SBSA_UART) FDT( make_vpl011_uart_node(gc, fdt, ainfo, dom) ); + if (info->tee == LIBXL_TEE_TYPE_OPTEE) + FDT( make_optee_node(gc, fdt) ); + if (pfdt) FDT( copy_partial_fdt(gc, fdt, pfdt) );