From patchwork Wed Jun 19 17:53:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Volodymyr Babchuk X-Patchwork-Id: 11004989 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 B4406924 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 A1394285CE for ; Wed, 19 Jun 2019 17:56:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9EBCD285D9; Wed, 19 Jun 2019 17:56:39 +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 D45B2285CE 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 1hdemW-0007uj-HR; Wed, 19 Jun 2019 17:54:00 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hdemU-0007ue-Q3 for xen-devel@lists.xenproject.org; Wed, 19 Jun 2019 17:53:59 +0000 X-Inumbo-ID: 35425469-92bb-11e9-8980-bc764e045a96 Received: from EUR02-VE1-obe.outbound.protection.outlook.com (unknown [2a01:111:f400:fe06::619]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 35425469-92bb-11e9-8980-bc764e045a96; Wed, 19 Jun 2019 17:53:57 +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=X30nhnABw1J/U60XV9TMhYY/sW+N6ZWcWi4VqjwdXGY=; b=UlsmDrFmULEoGpiopuQ1dudQLoLR+a+g/XrYM3A9y8QMGVPMhEECTYSuEoHeTFuQO5APvradT37sBfx+mGxX6Wymr5WCO4iCzYhZJ4ceQ39v9RclykTw/jwcX3/snIe64HT26jPhVaUyVIk/jBycNpZz9Rbi35gC3yHQbMsK4t5elYYlffcMBfQKZ/aMzg/ALNfri/gIOoTfkbKDVXsn9ZTmHvH+fjAo9WzlZMnolu/v6g7N+VK+yISN1mHaYa6dwjktHrb2vETQCObz3Sr/TsvtDfVFWwLafj3W6o8AeuBqhG48hACzpi6eKC8S0VDtltw3c+5zbAs/ytrm2Wnh/A== 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:53:54 +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:53:54 +0000 From: Volodymyr Babchuk To: "xen-devel@lists.xenproject.org" Thread-Topic: [PATCH v7 0/5] TEE mediator (and OP-TEE) support in XEN Thread-Index: AQHVJsf122+ynJomNU+/Y8TohUcOOw== Date: Wed, 19 Jun 2019 17:53:54 +0000 Message-ID: <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: 912eff33-359a-4669-7b4f-08d6f4df187a 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-ms-exchange-purlcount: 4 x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:10000; 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)(71190400001)(476003)(102836004)(68736007)(66476007)(71200400001)(99286004)(53936002)(6512007)(7736002)(6306002)(86362001)(8676002)(966005)(25786009)(73956011)(305945005)(316002)(2501003)(66066001)(14444005)(6116002)(478600001)(256004)(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: BdSTZgy38jZJL5rFs2fK99CfH7WQ0NN13jZRG+0+2pqKel/VnVgXj2lgsk40yHXMzgfz5x2ON/ELIzh+FTtfxyWAtHHUCLFe/p4YTfvET7pdKuPAAtfg2tczRY4VY6d7U1u0vAF1d0b12weje1hqmYv+aXS99O+AAXZyCNyyzZQPL00EwabdIZJ+EVQALmD9pYSV1iIrDXZKwXLbFSvj9EdmcCGJNDmvIh0sZGzNGyxTsFz/r3/SPCKF70qBXDdI8hIwkvwlCI44NvN+BxnDcsb8I/NRCsbZCAWQDYQwIc5Z7yIsrRBC511U1Q/1oRNckfBWfoocjfv+wihDi/pMu/qE0gtTwHhIX0KPdwMqM2vFHzrXY3KGeTSHAlsR5/05kpOwHtYGmNvvR0bcle/VvOC1CS1ZFeyUjpKr29werBU= MIME-Version: 1.0 X-OriginatorOrg: epam.com X-MS-Exchange-CrossTenant-Network-Message-Id: 912eff33-359a-4669-7b4f-08d6f4df187a X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Jun 2019 17:53:54.3769 (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 0/5] TEE mediator (and OP-TEE) support in XEN 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: Stefano Stabellini , Wei Liu , Ian Jackson , "tee-dev@lists.linaro.org" , Julien Grall , Volodymyr Babchuk Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Hello community, Please find new version of OP-TEE patch series. This is the kind of follow-up for the previous version, as most of the patches of the previous version were commited. This series includes leftovers of the prev. version and three new patches. One of the new patches adds a way to detect if OP-TEE were build with virtualization support and two others bear cosmetic changes to Kconfig files. This patches also can be pulled from [4] == Changes in v7: - 8 of 10 patches were commited - New patch "xen/arm: tee: place OP-TEE Kconfig option right after TEE" places options in menuconfig in more natural way - New patch "xen/arm: optee: check if OP-TEE is virtualization-aware" ensues that OP-TEE is virtualization-aware - New patch "xen/arm: optee: document OPTEE option in tee/Kconfig" add short description of OP-TEE mediator - Documentation in "tools/arm: tee: add "tee" option for xl.cfg" was updated === Changes in v6: - Series rebased to staging branch instead of master one. - OP-TEE protocol headers was taken from OP-TEE tree instead of Linux one - Added acked-by tags - Fixed (and tested) issue when XEN would not boot if it is build with CONFIG_TEE=n ==== Changes in v5: - Substantial rework of OP-TEE mediator. Now it tries to return meaningful error codes back to the guest. - OP-TEE mediator does not use struct cpu_user_regs as a storage for parameters and return values when calling OP-TEE. This makes it compatbile with requirement from SMCCC. - tee=native option replaced with tee=optee - Authorship and s-o-b tag reset to my EPAM mail address ==== Changes in v4: - Patch "arm: add tee_enabled flag to xen_arch_domainconfig" was squashed into "xen/arm: add generic TEE mediator framework" - I implemented more elaborate error repoting to a guest. Now guest will get meaningful error codes instead of generic ARM_SMCCC_ERR_UNKNOWN_FUNCTION. ==== Changes in v3: - Use domain flags insted of domctl interface to enable optee for guests - Remove patch "libxc: add xc_dom_tee_enable(...) function" because of previous change - Mediator now stores own context in arch part of struct domain, so I removed patch "optee: add domain contexts" ==== Changes in v2: This is v2 of patch series for OP-TEE mediator support in XEN. Changes from v1: - Added domctl interface, so now xl decides what domain should work with TEE - Removed XSM support due to change described above - Patch with OP-TEE mediator was splited to 7 separate patches - Removed patch with call_smccc() function. Now this series depend on Julien Grall's series "xen/arm: SMCCC fixup and improvement" [3] ===== v1: This is follow for patch series [1]. There was lots of discussions for that series and I tried to address all of them in this new patchset. Currently, I had a working solution for OP-TEE virtualization and it is being upstreamed right now ([2]). So, I think it is a good time to introduce support in XEN as well. This series include generic TEE mediator framework and full-scale OP-TEE mediator which is working with mentioned chages in OP-TEE. So, multiple domains can work simultaneously with OP-TEE. I added XSM support, so now it is possible to control which domains can work with TEEs. Also I changed way how TEE discovery is done. Now it is very generic and should support any platform. [1] https://lists.xenproject.org/archives/html/xen-devel/2017-10/msg01451.html [2] https://github.com/OP-TEE/optee_os/pull/2370 [3] https://lists.xenproject.org/archives/html/xen-devel/2018-08/msg02138.html [4] https://github.com/lorc/xen/tree/optee_v7 Volodymyr Babchuk (5): tools/arm: tee: add "tee" option for xl.cfg tools/arm: optee: create optee firmware node in DT if tee=optee xen/arm: tee: place OP-TEE Kconfig option right after TEE xen/arm: optee: check if OP-TEE is virtualization-aware xen/arm: optee: document OPTEE option in tee/Kconfig docs/man/xl.cfg.5.pod.in | 29 +++++++++++++++++++++++++ tools/libxl/libxl.h | 5 +++++ tools/libxl/libxl_arm.c | 42 +++++++++++++++++++++++++++++++++++++ tools/libxl/libxl_types.idl | 6 ++++++ tools/xl/xl_parse.c | 9 ++++++++ xen/arch/arm/Kconfig | 4 ++-- xen/arch/arm/tee/Kconfig | 5 +++++ xen/arch/arm/tee/optee.c | 10 +++++++++ 8 files changed, 108 insertions(+), 2 deletions(-)