From nobody Wed May 1 23:23:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=epam.com); dmarc=pass(p=quarantine dis=none) header.from=epam.com ARC-Seal: i=2; a=rsa-sha256; t=1639474501; cv=pass; d=zohomail.com; s=zohoarc; b=XFiTArdDo4AV/qNa+n8ziE12/Sbdr9JW054r+IwvfUIpMM5IDIUOCTJ+6mKSYc42fsUr6mVd3COPpdjldepCE8aQ+F84K5pkGWGEiQtr6XQvKJqgC5tanJqIpibWjKbWTXKIsOMDBSsEcnEIAZIcwIRytVV0TvGh6wtNv/jdIJk= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639474501; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=XcQmMVoAC0qvNEyr6vX6HHS2XVbpv968VA/fx82VqSA=; b=gy07Byu0Hs7KfpM0zIkRyS0tQCfO1XX4hqdNpzvKpH/1Ft+MC7OJNXfisXqJdXPd50Nd7j/g9un+A69qi/u6M53eg4OeGNvtxMobwprBjxGSL5oQpYhXz2wWYHXz4qNxEBI8Sl46taK9rT4lI2ICPaFBz2HzBYw0R3PLsixuIgE= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=epam.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1639474501310398.6881223803674; Tue, 14 Dec 2021 01:35:01 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.246486.425103 (Exim 4.92) (envelope-from ) id 1mx4Co-0007hE-8t; Tue, 14 Dec 2021 09:34:42 +0000 Received: by outflank-mailman (output) from mailman id 246486.425103; Tue, 14 Dec 2021 09:34:42 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mx4Co-0007gx-2K; Tue, 14 Dec 2021 09:34:42 +0000 Received: by outflank-mailman (input) for mailman id 246486; Tue, 14 Dec 2021 09:34:40 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mx4Cm-0007DW-12 for xen-devel@lists.xenproject.org; Tue, 14 Dec 2021 09:34:40 +0000 Received: from mx0b-0039f301.pphosted.com (mx0b-0039f301.pphosted.com [148.163.137.242]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 0dcb6d22-5cc1-11ec-9e60-abaf8a552007; Tue, 14 Dec 2021 10:34:38 +0100 (CET) Received: from pps.filterd (m0174683.ppops.net [127.0.0.1]) by mx0b-0039f301.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 1BE8mV6p004153; Tue, 14 Dec 2021 09:34:28 GMT Received: from eur03-am5-obe.outbound.protection.outlook.com (mail-am5eur03lp2053.outbound.protection.outlook.com [104.47.8.53]) by mx0b-0039f301.pphosted.com (PPS) with ESMTPS id 3cxr338745-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 14 Dec 2021 09:34:28 +0000 Received: from PA4PR03MB7136.eurprd03.prod.outlook.com (2603:10a6:102:ea::23) by PA4PR03MB6974.eurprd03.prod.outlook.com (2603:10a6:102:e1::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.16; Tue, 14 Dec 2021 09:34:23 +0000 Received: from PA4PR03MB7136.eurprd03.prod.outlook.com ([fe80::85d2:c8aa:2196:21c6]) by PA4PR03MB7136.eurprd03.prod.outlook.com ([fe80::85d2:c8aa:2196:21c6%9]) with mapi id 15.20.4778.018; Tue, 14 Dec 2021 09:34:23 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 0dcb6d22-5cc1-11ec-9e60-abaf8a552007 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=enrWauorJnK5uwQhrawQwKjBFNAwCBs6TxAishYgWeaMlnWEBK5B88W6GIVukomqyWhA6PGuhEpQ9xRf+25k5UUTfZYGCBTaXIgWyIY+3r6q5smLixy1ngc0uUyXpAeWelNZTEuH0wfG14UAY0rGGckA/SiewfEac5dAt+tFklHb3Hq8MaymFMPZl4Yy67dHFeOEIFxUfW95BB+Ly9WDj00hYHzpDOg0CtBJni8AYWQZFUL18XxuZ0lCzNA323+o0x3Tspd75TU+btS5gOpF/LZkG5TbmsxaHYQZzlMusc9Su/8j2XNAwTlj0oBGEPRoDVrjfRgERjcbXRFmtBuAUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=XcQmMVoAC0qvNEyr6vX6HHS2XVbpv968VA/fx82VqSA=; b=A+GM2DkHlK4tC1QvsieeSwkile4+UiRqcuyqssKAbgiyPYFwPl/xU80pPbWRHSSir3RjcIxql9uYlGcPNzcL8GfF7oCLAT3cA01k7vO5eHbQMlAf1yyjhqaXaJ109sz2tHGVoWAtqphWaM1Xcwnsw9wlnXbb9hhFOTKWm8CMnZluqJcPZWHNGZX3xjqObUqTFVF5miB9+9GlxV8mbvtSNJYiTjJIZDMwnwMJAXdyBMpDg7sIALxipC1rfy2CLLdx0nnSMEua4TgoWA1fZpQ6apc2IiaLRWFkicVHLNpFjzPiGP38V1QCGNU9Grkl3eP/6SDza+g+EQ15cUqd2yXufA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=epam.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XcQmMVoAC0qvNEyr6vX6HHS2XVbpv968VA/fx82VqSA=; b=SXF9/50mobbK90OgrrmPFBK7zR2GeLLKcdbyfk62yxkgiF55c39Lf1myt+6X9j9IewHBcUtt34GDA3DOqjak9jihlRPLFzZFmSfmCC9rkh9DvMq0Zn1s5cN0ki+Mc4HMX2d2nJ3OEX5Z3H0HwVbppD44OJcTqlI0MQRzKhhfk/bS6hqNrJTun6kVcDA3+XiTQBRktv7jdpaqzIKXUXBJBIy1SNM8drqmeqCHMNGpgM1DtLl9BhtB7sQnY3wctEbekozG6bK35UB9d/mNYW4eTs8syEZ5k5BLQIQAiNdPYzKhxAEcBntkpLLO9uazb557KQRWhhBdSUFDijcWMAuyFQ== From: Oleksii Moisieiev To: "xen-devel@lists.xenproject.org" CC: Oleksii Moisieiev , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Bertrand Marquis Subject: [RFC v1 1/5] xen/arm: add support for Renesas R-Car Gen3 platform Thread-Topic: [RFC v1 1/5] xen/arm: add support for Renesas R-Car Gen3 platform Thread-Index: AQHX8M3HLq8qFfw2eU2jxqbriRiMpQ== Date: Tue, 14 Dec 2021 09:34:23 +0000 Message-ID: <7ac8512b5479cf192b4aa399fa2501d0bccaaf48.1639472078.git.oleksii_moisieiev@epam.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 4fc9096e-b8d8-4d87-db44-08d9bee4e9c1 x-ms-traffictypediagnostic: PA4PR03MB6974:EE_ x-ld-processed: b41b72d0-4e9f-4c26-8a69-f949f367c91d,ExtAddr x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7219; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: zJ6DATxATVzBRUU688EmLQpPBx4j3peZbO3HZcXd1u8PhHywKb1h4zcM+OdF64lEwHsZQ3mCZ+dQHUXV3/CMKf1OJtLatyRBefAurWv3uLxP2gVyY6ofqbPCfZ7UfvDDZld2rs8vfUPkSQBXSbXok3hPHxjY5NRu5seC5EeiZHW3Q1GpPsK9Qacb4w3iGcGBRSqbTu5PA+VtWR2IRXv/XAQAIS79j5TRPjaB2WKdRUnt00XHDLvVOBUFMyPCcz2elZEQ6ITDooV9PVXFxP6YbjtGyMUsMT2ZN1HRoGFSxgSdnFRxyU5cntH14GhERfCpUHzWXaNt6cAxL9sj19+DqAUDuEmdaD7qXlhx9IyxDK5ZGE/4Rdv1Kl8GuivpsxzFsKMFAJt+xLtkjo5LSEp4mZhd8F9zolqg1TtyF+B7/+zWaAXcvh9i43uRPsaEdjSG561a9gKxIxhDdGwYeIy/c03GvBefbF8A55F2L2yBAosDdSzs/O/eYhub6vPyI7CmOVSHUopAVMPP5ULZIbej3UHbfvmIaP1m7d1MK0Z2e6fbDMuNFLdoucqx0hTk9rONd7fs/nw8C93YZOBhPB6jvbOvD8vo0zMsu+hpS754YBmysUjIUkIZz/40TFSP2U3vSN8ong8g8vjbqEfN78iPGj7UVPsFvqsp7QXO3uMmEl4NIiPxJl3gAOVm9QT3nD1Th9orssyAuir4pUZ1jO+KpN1djglmN8/+xZmRiduL3FA= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PA4PR03MB7136.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(8936002)(66556008)(36756003)(66476007)(316002)(38070700005)(64756008)(54906003)(122000001)(38100700002)(2906002)(91956017)(5660300002)(26005)(6512007)(186003)(4326008)(2616005)(71200400001)(8676002)(66946007)(6486002)(6506007)(86362001)(76116006)(6916009)(508600001)(66446008)(2004002);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?sWxL27xWjsqJnZALrm+e6UpCnlJ0thLJAe11Qvz3mBjR96mFq4MjB6icJb?= =?iso-8859-1?Q?buHxkbH2f5v1+5zdDnEYSDs6Qjg+1znJ6UyYoTXSEw6XDxuMwyXJlPDAGC?= =?iso-8859-1?Q?4LM29A01vjed92eQXYwloyQkw2RTtzDuzKnVpffcnscQtRrziruMZPM05L?= =?iso-8859-1?Q?B9PMDiE0hdh40JkuRTbvLdJ3ckiD0KT7FR0Slb2r6D9x6S5o08krEDDAsX?= =?iso-8859-1?Q?KwVR5XLbTtwlCZVaO0OjJ8iblkJX0xyyoSwQKElzyQdfR3RfXvPQkGlKwW?= =?iso-8859-1?Q?2YJtNCXOWwxXbOxDVVXsVIY6y/J4OoeNDL3PAmHsiw18Du0pfG5pcyOPMW?= =?iso-8859-1?Q?QZ2n12VrBlsj/JaoOizN4kUwRIAFA+ASZaoemZEc/C+fwxSMChAqfPZwAd?= =?iso-8859-1?Q?EWcAfOfPbeCxVs4s0Ib38Q3qqghKxkAIdJwnrC8sWl9IdszeWb3DAxGlok?= =?iso-8859-1?Q?lRG2FNz/oCNiB9BmwKkfKXymeZFgZAFHcBELymS7bxA/i2WTYlQsX+8tWE?= =?iso-8859-1?Q?kLL8xJgYow+aMKqd8NU9+yBd06Dau1l3i7Sn+KdN1xsLQwhAho6OWNUkPa?= =?iso-8859-1?Q?C+snbz7S2/TVMnMY4BW3BqkWEzJaPvRw9c9KVAOisWqiWVFyAbNOm1BXdg?= =?iso-8859-1?Q?hqQ0gkz0Z6qjCJaNnSwA6wrYtFwDOLc/g8mkaCCw4vskRqfLnNUpG5uefO?= =?iso-8859-1?Q?X2AjPVtTyC7Kgo9VfSenlseEAhn+xhRLfS0oqrJFFZ1tyzwmR56H/8o4Xw?= =?iso-8859-1?Q?djq+4lJmyJQ/9l0UyFoFc/fLZBy6T+Y+jc4dt0U6aL7Uch11zs/uKkWn0D?= =?iso-8859-1?Q?cRG5psDyaA7WTc1S0EormlhSFkw1R+vQTiwJNmVoW52JaW2544VomDJiN9?= =?iso-8859-1?Q?fB0fV3AwwasbiiXkIzyimHyalGddYSiGIcPJEi5+ViQXHkIoh91Fsvqe5c?= =?iso-8859-1?Q?QU/8+BVgtK2FRkES8tL/NKXxv+FLEQKVT4+avlYKXFkN+JAbHnGkmTMYbb?= =?iso-8859-1?Q?EgA0f/cEra+i1GH9G5zDu2u/NBZXxM20qvJ5TwkC8T5RSQ8Bcq4GdFcD4W?= =?iso-8859-1?Q?FsCR6QmnybyFZo2hwbJOTMpGRDRc8tkosYsPiagFbcGWnZHVYV8/sIW8hH?= =?iso-8859-1?Q?EFsvm/TYRCuW3H5aDbbBJ2H1nHr4HmcCBK5ARUD2Ogh3LvBEfpX5+GsfZf?= =?iso-8859-1?Q?hQINgdbZrSzk68yH6OdJVLjFZsbOuWvoRp+6q37WwwPsX9ee3GuZS+bJ2U?= =?iso-8859-1?Q?+ix7m2bKjpkyVAiQsHjonL+Cv/YYG+J7bbKY2wqH+V5wwmPBabqh2WqyNx?= =?iso-8859-1?Q?rpcvqQgdW7vWvK6Qs6EhP3d7yQ6Z03jkSaID1rUYU1yDaNiof2SakqqgO2?= =?iso-8859-1?Q?IMg5yD+M4khqSTWdOOSxp+ELnJkB18zYele2W3AqUvqjnJSWMNuc6QaEIX?= =?iso-8859-1?Q?2pWWAK8kx8b4+rcSqHKmba9b8TObFNiUjXIRDGAr4BcXTegNqr8UkaIxfJ?= =?iso-8859-1?Q?9WaaueHHaasa9TklNQNbFTk2Ka0O5Eu8rwqmr+Omj5+bMMN35zDLsosO0b?= =?iso-8859-1?Q?ik7oHAbRDDMiwEAnKm0XSqkHI20ytaVMrAXyO4GnzHkZvC6cVR6JFvctpr?= =?iso-8859-1?Q?Flm85RFwqmjdoTUSp9BCA8xuRlmkQtnUTLE7IIx1W6y516HSmAP6bU4ppy?= =?iso-8859-1?Q?k6KVW9/cckVouW4Q9N17FnI0DBy7JvNluOvCSpqr1cDdqVWWoEk9BTiVSU?= =?iso-8859-1?Q?BHbdzOOerBmRE1GyCUwa4RwOw=3D?= Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: epam.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PA4PR03MB7136.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4fc9096e-b8d8-4d87-db44-08d9bee4e9c1 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Dec 2021 09:34:23.2315 (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: YshgjBnYaHk/DTSfe6ga5fXofPo0uF1HfaHx1e3gNBtZcHiWRbsLbfp6zvv5pTe7lhxjWPk8QQt3ZJ3cXzgi5e2vtwc7IyTQ8GSbkSLc/mA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR03MB6974 X-Proofpoint-ORIG-GUID: ONwttEhYqV61lRlxgB1qmhuOWAZqu6it X-Proofpoint-GUID: ONwttEhYqV61lRlxgB1qmhuOWAZqu6it X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2021-12-14_05,2021-12-13_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=945 mlxscore=0 bulkscore=0 clxscore=1015 priorityscore=1501 lowpriorityscore=0 malwarescore=0 suspectscore=0 adultscore=0 impostorscore=0 phishscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2112140054 X-ZohoMail-DKIM: pass (identity @epam.com) X-ZM-MESSAGEID: 1639474502586100003 Content-Type: text/plain; charset="utf-8" Implementation includes platform-specific smc handler for rcar3 platform. Signed-off-by: Oleksii Moisieiev Reviewed-by: Oleksandr Andrushchenko --- xen/arch/arm/platforms/Makefile | 1 + xen/arch/arm/platforms/rcar3.c | 46 +++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 xen/arch/arm/platforms/rcar3.c diff --git a/xen/arch/arm/platforms/Makefile b/xen/arch/arm/platforms/Makef= ile index 8632f4115f..b64c25de6c 100644 --- a/xen/arch/arm/platforms/Makefile +++ b/xen/arch/arm/platforms/Makefile @@ -4,6 +4,7 @@ obj-$(CONFIG_ALL32_PLAT) +=3D exynos5.o obj-$(CONFIG_ALL32_PLAT) +=3D midway.o obj-$(CONFIG_ALL32_PLAT) +=3D omap5.o obj-$(CONFIG_ALL32_PLAT) +=3D rcar2.o +obj-$(CONFIG_RCAR3) +=3D rcar3.o obj-$(CONFIG_ALL64_PLAT) +=3D seattle.o obj-$(CONFIG_ALL_PLAT) +=3D sunxi.o obj-$(CONFIG_ALL64_PLAT) +=3D thunderx.o diff --git a/xen/arch/arm/platforms/rcar3.c b/xen/arch/arm/platforms/rcar3.c new file mode 100644 index 0000000000..d740145c71 --- /dev/null +++ b/xen/arch/arm/platforms/rcar3.c @@ -0,0 +1,46 @@ +/* + * xen/arch/arm/platforms/rcar3.c + * + * Renesas R-Car Gen3 specific settings + * + * Oleksii Moisieiev + * Copyright (C) 2021 EPAM Systems + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include + +static bool rcar3_smc(struct cpu_user_regs *regs) +{ + return false; +} + +static const char *const rcar3_dt_compat[] __initconst =3D +{ + "renesas,r8a7795", + "renesas,r8a7796", + NULL +}; + +PLATFORM_START(rcar3, "Renesas R-Car Gen3") + .compatible =3D rcar3_dt_compat, + .smc =3D rcar3_smc +PLATFORM_END + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */ --=20 2.27.0 From nobody Wed May 1 23:23:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=epam.com); dmarc=pass(p=quarantine dis=none) header.from=epam.com ARC-Seal: i=2; a=rsa-sha256; t=1639474506; cv=pass; d=zohomail.com; s=zohoarc; b=aiRel+wZKBMY/WEb/9y21NMDLdgwcjiReusDgM8MDqHDDO0KLEAjjDDLhOJmVamsuIRyvg7TpwkvMdDeSdE3zemlVbGADUwUY1fBP7VHHSfyMGUQ8m2B2pAnQvyZRMozxVNwhRr7jNitEa6mrAkxvMvcvfrjPAGMgkxFbDc23Ao= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639474506; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5HKrYB6SvkH+0z8vtwa49lxvxU4I58QQAwDDiPC1Yg8=; b=Ih/ZZPe6uTUfll2jhsCl/jWGdn+U96ObePysf/k0rRRQHKpUbZonY00t2Lxnb80FOoZx+cdrP8qRU+BtW/STnLvfG9jvWYeAsdUO9Z9+iYu1LXGRXZspMeFdmklV05FMKYEH60mMJH0jpnd3fQ3Zft4DLbGGlQ/63N61kJYx0VQ= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=epam.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1639474506768334.4565432352118; Tue, 14 Dec 2021 01:35:06 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.246488.425130 (Exim 4.92) (envelope-from ) id 1mx4Cr-0008VN-BL; Tue, 14 Dec 2021 09:34:45 +0000 Received: by outflank-mailman (output) from mailman id 246488.425130; Tue, 14 Dec 2021 09:34:45 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mx4Cr-0008VC-6s; Tue, 14 Dec 2021 09:34:45 +0000 Received: by outflank-mailman (input) for mailman id 246488; Tue, 14 Dec 2021 09:34:43 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mx4Cp-0007DW-9a for xen-devel@lists.xenproject.org; Tue, 14 Dec 2021 09:34:43 +0000 Received: from mx0b-0039f301.pphosted.com (mx0b-0039f301.pphosted.com [148.163.137.242]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 100e8040-5cc1-11ec-9e60-abaf8a552007; Tue, 14 Dec 2021 10:34:41 +0100 (CET) Received: from pps.filterd (m0174683.ppops.net [127.0.0.1]) by mx0b-0039f301.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 1BE8mM0e003673; Tue, 14 Dec 2021 09:34:31 GMT Received: from eur05-am6-obe.outbound.protection.outlook.com (mail-am6eur05lp2109.outbound.protection.outlook.com [104.47.18.109]) by mx0b-0039f301.pphosted.com (PPS) with ESMTPS id 3cxr33874b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 14 Dec 2021 09:34:31 +0000 Received: from PA4PR03MB7136.eurprd03.prod.outlook.com (2603:10a6:102:ea::23) by PR2PR03MB5162.eurprd03.prod.outlook.com (2603:10a6:101:26::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.16; Tue, 14 Dec 2021 09:34:25 +0000 Received: from PA4PR03MB7136.eurprd03.prod.outlook.com ([fe80::85d2:c8aa:2196:21c6]) by PA4PR03MB7136.eurprd03.prod.outlook.com ([fe80::85d2:c8aa:2196:21c6%9]) with mapi id 15.20.4778.018; Tue, 14 Dec 2021 09:34:25 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 100e8040-5cc1-11ec-9e60-abaf8a552007 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UwMCwwQXqjdWHPoSIBNlXW/2kkQyifJHYa+QPpeSwcRB7t1lx1HlqFsJvsgv9vEakc7Pn2D1k6AMcs7G4T7tQBREewIztTHdaTCXm1yJIQa3xD5qs84q8Dy8hq1e7S27+LevN4pJeX0K7UeJz3bqSiq4fOiRn1UMqKO9RoaCd+gmTSLbf5kUCr2mLU7qzWGAaFOepjw3141inXlNv+BwSREZ7G3PdKv2b6cwMdqdf9dwa/VGMENLgUlcz0nANTlvrb8bRp6OyzL/gQo2cX69Bgt5g+GDnnn/oTaY4w7qBNCJ8C7/1bqcgiNY+MM756/Wf99Zami+PpXE1RGzJitFKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=5HKrYB6SvkH+0z8vtwa49lxvxU4I58QQAwDDiPC1Yg8=; b=exkoGv/nni6YNhrwNCGwJa/o3/hHlAJYN99pZwxec5yZFjuKnQUqi8g4ZL95U//u2DlPJLzL/ePdBw702dvNDGB72jUrE4ne6x3vNgZEyxaaedYPvNTRCHxP8PP1v+y3XNUWbCzBMNaHStRjvWwSlt7QkjlCcSgurnMlFts/D1kzAsTlRPrRIJYtD31Zs7xIaag7ppbZYXfhHGdkitzVfN/5AYM6wEc15ZOEtXJl+dYjD/YXfHS8sQO55BMFSBx3q6VirlO4D2QqB3L2KubVFRiOtKKfXfksd246xhSngqncjEcryKLCNyVuXcE0XecbeVxSZfRpn8W4qLIDhJv+hw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=epam.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5HKrYB6SvkH+0z8vtwa49lxvxU4I58QQAwDDiPC1Yg8=; b=Ty4slgKMwrGKaBsjf+B2udHjXAv2RU8B5k6EkwDLHamKtqSEODDL5b3bUoRWtVngybn/pmeNvTWxqnUOyZKJffFkbrMPEjAa2GHZ6NfdQBiCF9Nk6CN27lE2vyPOyyrneR4e2x0T51wpOxObEu3j/xP4eyUPTsIGBqCTzyFvCFchGnkIKoobPOOT0GqaxoZ0OzBHDBLcQYnhh4x+7KYtudMvMxtTe1ZuWRlgXbV9EWJixgPCAncOuI+GBPX0F5l2f5iIN19HBm0gG3KeKLD6vGqzMm5QcguNXL2hr4KEomNF74by+Gd6HLrdFIgiC7Nd0hLK1BrEF682VnRApcdFOA== From: Oleksii Moisieiev To: "xen-devel@lists.xenproject.org" CC: Oleksii Moisieiev , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu , Volodymyr Babchuk , Bertrand Marquis Subject: [RFC v1 2/5] xen/arm: add generic SCI mediator framework Thread-Topic: [RFC v1 2/5] xen/arm: add generic SCI mediator framework Thread-Index: AQHX8M3IB9WR9OXgbE2xll7qsLGWCw== Date: Tue, 14 Dec 2021 09:34:24 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e8ab3c2b-0600-422c-935b-08d9bee4ead6 x-ms-traffictypediagnostic: PR2PR03MB5162:EE_ x-ld-processed: b41b72d0-4e9f-4c26-8a69-f949f367c91d,ExtAddr x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:10000; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Lr+EizdDW3+1EkhjMTkYs51YyfAHaFeV8ARQ6c+fXlL+W5JJQhTblV2bw7AnzpfyUfx41UUIxf6GErurKQLo9Jzu/NPGbJgf6r2sbmkytup6yZgeAkJ0O7Q3Gc8XsrWMDsXmP+PBTjaR9FPeS+RHbCRv6B5BJUPgxVoVPYwyI4mQ5wYK1MIGQ72tdvuWbLU1WbdAMEOXKyNJ5zgHanrralo3rxTSlxEMREUdSibc47aQzYdXc9kqcfAmBYEsAY8gmsnXjvbz3f4nDltil/oWnaDu6njSn5Zsr6PwnuyoeUEuteAPDE8nn7kskUz4I+UOv39croeIbcyJdG1UUEHA4+Nl0A/lcXIxpWbnufaaPkpxSLhQ8Sf7q2YCqXLF6aVcUtMRZnU/zWXZeT9HsVcXdm4sKIkE0sPfYZl8fkInpD4+7wddZxu9n62vky5PTlSrkktflv/2KI9dv6fXWu5CQxBsriGqi66e2e6dldRVLFPXr0PclJLkJLVR1M/4xAV1NuwgReDmqa3O30nsyJ1lGy3qNJpYdEOVaDbwIWzOxQAbw9GF13mZWTGcVwX/OF52pyNjD8VMspnJU00gxR6MM5db3TuGUjHIo/7Jzr/fB/09btyxbBAugnSYKifrhxu5Xyf305BcYpd3y+UXmEin7SrcUnSUd6U5Q6Gece7+oIlqLEdk6hbYxZcphNQbZXWxjYzUwfuAU5vMNfqVO72SOgrstYvOW8sy+R8V8rv0CGZiCgmvoXbQzFLB5s/I9pTpLJI6/gsaWOqQC2xZYrE3Yw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PA4PR03MB7136.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(508600001)(30864003)(5660300002)(38070700005)(38100700002)(8676002)(4326008)(316002)(122000001)(2616005)(36756003)(54906003)(6512007)(186003)(26005)(66476007)(66556008)(83380400001)(64756008)(66446008)(2906002)(6486002)(71200400001)(76116006)(6506007)(86362001)(8936002)(91956017)(66946007)(6916009)(41533002)(21314003)(2004002);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?PF+a1wDPNITxYzO+CVWLhv6cupeYFD4x4az5b/Fw7baZ2ZiWdNurw3J+Ed?= =?iso-8859-1?Q?lrAyyuJXWs6Y3VcNxhNaqa70WJ3sEUT60ejR8ifTplaf7Wjfz6AhnTQ/xk?= =?iso-8859-1?Q?cCdt1NsnS1SG7EFASg6sPI5rnxUv/F8P2KoD4+QaosXvxiuias0h47hXra?= =?iso-8859-1?Q?ek90V8P/g8xk9xb6nJyIU7JfB9sTd6FXMDv0sH0Xb/DfNzqV1ctI6VKl4U?= =?iso-8859-1?Q?+9yo94sfG2Z7CzjldJn8EdUxQbqv4tw+dfztT298LTsGsFoGjnqLvMk2T6?= =?iso-8859-1?Q?okTp0Jj/VsE1VayD/jQNr7MJ+NIJ1stPOIPUf4qedLwSX0JWJdxlbzwiTt?= =?iso-8859-1?Q?lxBlM0CFinxlqx91ZLoNlwNXg3l2GmYcOcjY/kdxTKeRdEy8f6vqSwQWjT?= =?iso-8859-1?Q?UYVVTyr8KDa6rWggn5PmL2r5mCRmPzIwfGLpPM7oPCmfLfe/0H2icE/rz2?= =?iso-8859-1?Q?UJUkuX9SIZ98jnVf90yZc6WO8CV9BSK0ZXhk+i4zLfl7HG8sUALPQLNgRq?= =?iso-8859-1?Q?StrvVwTTjxEjoZO3m8aj55jZ4/5wxz5rG+OqT6C0wDBDPQI0CEZLKCHwt6?= =?iso-8859-1?Q?Prl+Px8JYf3aAyBqp11HnYaCT+O7LrzxJOS6KQyo+kUL3sRHwRr910oN5F?= =?iso-8859-1?Q?dkj0ibmB0LYPPUVitQIE8/1g2x4pwY7RcijVa16qPCkQeiXEuf8vkZaCOo?= =?iso-8859-1?Q?H9+MrjEr2Vieo3FEuTRxmPBSOvOyRgZNTPKYNaxeAD4s+pekQLd3uqOMvv?= =?iso-8859-1?Q?L9+ztoAxveJRjp5fugJ8lMa1Wtz90ZHFVFCn/b06si7t7tQa4R36bienUS?= =?iso-8859-1?Q?3/gt9UK5AkVjKzg/hQHKP6fDnpHLVYzrW4/p/6cdWxukSOxNXLpdTMsh17?= =?iso-8859-1?Q?LIUh1Sa9LxYFf3rdIVuWKsaPaqYXCtlF9104StSkn4airCPuBo4vt2YdCI?= =?iso-8859-1?Q?vR/vuJn8uCx0xSMmSoMhld8bzqzXva9iaIxfpL30WmjhxEn9AmhgLTIXxR?= =?iso-8859-1?Q?bSK1X3s0ga8GUEIibzDwxfQiFvwxGkuSRHNtHnKD4NQjKmPWmFjYK8/IRz?= =?iso-8859-1?Q?joyifMIFtQ50GGHpxZkXBcrhJsv/DpgAdLN/pmYswnDH1QDsnsnTu0H8Qm?= =?iso-8859-1?Q?YM4mUm0r0z6xFzV/k1RLng6mEtQphDKM0mNyucYXVEjgkiur3Yr7IrPoxo?= =?iso-8859-1?Q?1W385XTfEFRCFHP5VrqfEuBNh+PZW8kTCCVPl3IjAkKP7WCubYIR4V6h7W?= =?iso-8859-1?Q?uI0DZC3WKTsDSqxw/Je6E/zeHLqlRIMypQe+35X6xykRKADwHvlS0YHV8/?= =?iso-8859-1?Q?ZU9X3UOmpN1+zrbYp/z0t9ev47KJWtScb6ZNmFQxLRYjJqmJ3pnwDNi2YR?= =?iso-8859-1?Q?oSncDe0rK2Qzw7GwW0jW+IXS1pIOSMjgvWTZEEcEft1V+q/mVizDo7XjTe?= =?iso-8859-1?Q?ELwTjkKM9Ws7RZem6j6lglK7btpg14EHPe5NqDrY5xKh0y+zVCRsI20MaZ?= =?iso-8859-1?Q?y2cfaAU5kU+VwHOAgwEA7NV1+KLIXp2wx7XkD0a46F7YN6+tE2OX4JMNgS?= =?iso-8859-1?Q?YvG7F5YvQlZh7Q5Wq9EfVkTwjYq1dTZG7DRNAKLsMQ2InWLRLjX3svkLmV?= =?iso-8859-1?Q?9qiyG6bQtBtOBZsHjppKiutPcunHtgmJXEQLChTuzlHGNan7/1/edF+tCO?= =?iso-8859-1?Q?wQu2g7bfa68DLc53hz97m2l7J0hJ1vCa+Hy/ZlTHa+wCRIpaZE2/v2bbBn?= =?iso-8859-1?Q?iG38K3872OWZzugmMthC7nJpY=3D?= Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: epam.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PA4PR03MB7136.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e8ab3c2b-0600-422c-935b-08d9bee4ead6 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Dec 2021 09:34:25.0294 (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: RfqdyPuxzpK6fVl6BWZCRh4B0qxyja2icLr2P17aFoi0M0sb2PDsGY4FW6M9rRx0f1R2uC9DFJUED9BG5sQ7NsCJzR2J7eSLsAKmmjESwPA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR2PR03MB5162 X-Proofpoint-ORIG-GUID: wlhcHQlPM2w9Xz2Hror1NT-CP53P_nvL X-Proofpoint-GUID: wlhcHQlPM2w9Xz2Hror1NT-CP53P_nvL X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2021-12-14_05,2021-12-13_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 mlxscore=0 bulkscore=0 clxscore=1015 priorityscore=1501 lowpriorityscore=0 malwarescore=0 suspectscore=0 adultscore=0 impostorscore=0 phishscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2112140054 X-ZohoMail-DKIM: pass (identity @epam.com) X-ZM-MESSAGEID: 1639474508973100003 Content-Type: text/plain; charset="utf-8" This patch adds the basic framework for SCI mediator. SCI is System Control Interface, which is designed to redirect requests for the Hardware (such as power-domain/clock/resets etc) from the Domains to the firmware. Originally, cpg should be passed to the domain so it can work with power-domains/clocks/resets etc. Considering that cpg can't be split between the Domains, we get the limitation that the devices, which are using power-domains/clocks/resets etc, couldn't be split between the domains. The solution is to move the power-domain/clock/resets etc to the Firmware (such as SCP firmware or ATF) and provide interface for the Domain= s. XEN shoud have an entity, caled SCI-Mediator, which is responsible for mess= ages redirection between Domains and Firmware and for permission handling. This is how it works: user can build XEN with multiple SCI mediators. See the next patches, where SCMI-SMC mediator is introduced. SCI mediator register itself with REGISTER_SCI_MEDIATOR() macro. At run-time, during initialization, framework calls probe for the first matching device in the device-tree. When no device-tree is present - the first registered mediator should be probed. Signed-off-by: Oleksii Moisieiev --- MAINTAINERS | 6 ++ xen/arch/arm/Kconfig | 8 ++ xen/arch/arm/Makefile | 1 + xen/arch/arm/domain.c | 24 +++++ xen/arch/arm/domain_build.c | 11 +++ xen/arch/arm/platforms/rcar3.c | 3 +- xen/arch/arm/sci/Makefile | 1 + xen/arch/arm/sci/sci.c | 128 ++++++++++++++++++++++++++ xen/arch/arm/setup.c | 1 + xen/arch/arm/xen.lds.S | 7 ++ xen/include/asm-arm/domain.h | 4 + xen/include/asm-arm/sci/sci.h | 162 +++++++++++++++++++++++++++++++++ xen/include/public/arch-arm.h | 10 ++ 13 files changed, 365 insertions(+), 1 deletion(-) create mode 100644 xen/arch/arm/sci/Makefile create mode 100644 xen/arch/arm/sci/sci.c create mode 100644 xen/include/asm-arm/sci/sci.h diff --git a/MAINTAINERS b/MAINTAINERS index e43dc0edce..5f96ea35ba 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -512,6 +512,12 @@ S: Supported F: xen/arch/arm/tee/ F: xen/include/asm-arm/tee =20 +SCI MEDIATORS +M: Oleksii Moisieiev +S: Supported +F: xen/arch/arm/sci +F: xen/include/asm-arm/sci + TOOLSTACK M: Wei Liu S: Supported diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig index ecfa6822e4..186e1db389 100644 --- a/xen/arch/arm/Kconfig +++ b/xen/arch/arm/Kconfig @@ -106,6 +106,14 @@ config TEE =20 source "arch/arm/tee/Kconfig" =20 +config SCI + bool "Enable SCI mediators support" + default n + help + This option enables generic SCI (System Control Interface) mediators + support. It allows guests to control system resourcess via one of + SCI mediators implemented in XEN. + endmenu =20 menu "ARM errata workaround via the alternative framework" diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile index 07f634508e..6366ff55e5 100644 --- a/xen/arch/arm/Makefile +++ b/xen/arch/arm/Makefile @@ -8,6 +8,7 @@ obj-y +=3D platforms/ endif obj-$(CONFIG_TEE) +=3D tee/ obj-$(CONFIG_HAS_VPCI) +=3D vpci.o +obj-$(CONFIG_SCI) +=3D sci/ =20 obj-$(CONFIG_HAS_ALTERNATIVE) +=3D alternative.o obj-y +=3D bootfdt.init.o diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index 96e1b23550..80d0a23767 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -688,6 +689,13 @@ int arch_sanitise_domain_config(struct xen_domctl_crea= tedomain *config) return -EINVAL; } =20 + if ( config->arch.sci_type !=3D XEN_DOMCTL_CONFIG_SCI_NONE && + config->arch.sci_type !=3D sci_get_type() ) + { + dprintk(XENLOG_INFO, "Unsupported SCI type\n"); + return -EINVAL; + } + return 0; } =20 @@ -764,6 +772,15 @@ int arch_domain_create(struct domain *d, /* At this stage vgic_reserve_virq should never fail */ if ( !vgic_reserve_virq(d, GUEST_EVTCHN_PPI) ) BUG(); + + if ( config->arch.sci_type !=3D XEN_DOMCTL_CONFIG_SCI_NONE ) + { + if ( (rc =3D sci_domain_init(d, config->arch.sci_type)) !=3D 0) + goto fail; + + if ( (rc =3D sci_get_channel_info(d, &config->arch)) !=3D 0) + goto fail; + } } =20 /* @@ -796,6 +813,7 @@ void arch_domain_destroy(struct domain *d) domain_vgic_free(d); domain_vuart_free(d); free_xenheap_page(d->shared_info); + sci_domain_destroy(d); #ifdef CONFIG_ACPI free_xenheap_pages(d->arch.efi_acpi_table, get_order_from_bytes(d->arch.efi_acpi_len)); @@ -996,6 +1014,7 @@ enum { PROG_xen, PROG_page, PROG_mapping, + PROG_sci, PROG_done, }; =20 @@ -1056,6 +1075,11 @@ int domain_relinquish_resources(struct domain *d) if ( ret ) return ret; =20 + PROGRESS(sci): + ret =3D sci_relinquish_resources(d); + if ( ret ) + return ret; + PROGRESS(done): break; =20 diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index d02bacbcd1..38874615dd 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -1894,6 +1895,10 @@ static int __init handle_device(struct domain *d, st= ruct dt_device_node *dev, return res; } } + + res =3D sci_add_dt_device(d, dev); + if ( res < 0 ) + return res; } =20 res =3D handle_device_interrupts(d, dev, need_mapping); @@ -3075,6 +3080,10 @@ static int __init construct_dom0(struct domain *d) if ( rc < 0 ) return rc; =20 + rc =3D sci_domain_init(d, sci_get_type()); + if ( rc < 0 ) + return rc; + if ( acpi_disabled ) rc =3D prepare_dtb_hwdom(d, &kinfo); else @@ -3109,6 +3118,8 @@ void __init create_dom0(void) dom0_cfg.arch.tee_type =3D tee_get_type(); dom0_cfg.max_vcpus =3D dom0_max_vcpus(); =20 + dom0_cfg.arch.sci_type =3D sci_get_type(); + if ( iommu_enabled ) dom0_cfg.flags |=3D XEN_DOMCTL_CDF_iommu; =20 diff --git a/xen/arch/arm/platforms/rcar3.c b/xen/arch/arm/platforms/rcar3.c index d740145c71..a268b09454 100644 --- a/xen/arch/arm/platforms/rcar3.c +++ b/xen/arch/arm/platforms/rcar3.c @@ -18,10 +18,11 @@ */ =20 #include +#include =20 static bool rcar3_smc(struct cpu_user_regs *regs) { - return false; + return sci_handle_call(current->domain, regs); } =20 static const char *const rcar3_dt_compat[] __initconst =3D diff --git a/xen/arch/arm/sci/Makefile b/xen/arch/arm/sci/Makefile new file mode 100644 index 0000000000..837dc7492b --- /dev/null +++ b/xen/arch/arm/sci/Makefile @@ -0,0 +1 @@ +obj-y +=3D sci.o diff --git a/xen/arch/arm/sci/sci.c b/xen/arch/arm/sci/sci.c new file mode 100644 index 0000000000..5961b4cd5d --- /dev/null +++ b/xen/arch/arm/sci/sci.c @@ -0,0 +1,128 @@ +/* + * xen/arch/arm/sci/sci.c + * + * Generic part of SCI mediator driver + * + * Oleksii Moisieiev + * Copyright (C) 2021, EPAM Systems. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include + +#include + +extern const struct sci_mediator_desc _sscimediator[], _escimediator[]; +static const struct sci_mediator_desc __read_mostly *cur_mediator; + +bool sci_handle_call(struct domain *d, void *args) +{ + if ( unlikely(!cur_mediator) ) + return false; + + return cur_mediator->ops->handle_call(d, args); +} + +int sci_domain_init(struct domain *d, uint16_t sci_type) +{ + if ( sci_type =3D=3D XEN_DOMCTL_CONFIG_SCI_NONE ) + return 0; + + if ( unlikely(!cur_mediator) ) + return -ENODEV; + + if ( cur_mediator->sci_type !=3D sci_type ) + return -EINVAL; + + return cur_mediator->ops->domain_init(d); +} + +void sci_domain_destroy(struct domain *d) +{ + if ( unlikely(!cur_mediator) ) + return; + + cur_mediator->ops->domain_destroy(d); +} + +int sci_relinquish_resources(struct domain *d) +{ + if ( unlikely(!cur_mediator) ) + return 0; + + return cur_mediator->ops->relinquish_resources(d); +} + + +int sci_add_dt_device(struct domain *d, struct dt_device_node *dev) +{ + if ( unlikely(!cur_mediator) ) + return 0; + + return cur_mediator->ops->add_dt_device(d, dev); +} + +int sci_get_channel_info(struct domain *d, + struct xen_arch_domainconfig *config) +{ + if ( unlikely(!cur_mediator) ) + return 0; + + return cur_mediator->ops->get_channel_info(d->arch.sci, config); +} + +uint16_t sci_get_type(void) +{ + if ( unlikely(!cur_mediator) ) + return XEN_DOMCTL_CONFIG_SCI_NONE; + + return cur_mediator->sci_type; +} + +static int __init sci_init(void) +{ + const struct sci_mediator_desc *desc; + struct dt_device_node *dt =3D NULL; + + for ( desc =3D _sscimediator; desc !=3D _escimediator; desc++ ) + { + if ( likely(dt_host) ) + { + dt =3D dt_find_matching_node(dt_host, desc->dt_match); + if ( !dt ) + continue; + } + + if ( desc->ops->probe(dt) ) + { + printk(XENLOG_INFO "Using SCI mediator for %s\n", desc->name); + cur_mediator =3D desc; + return 0; + } + } + + return 0; +} + +__initcall(sci_init); + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */ diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c index d5d0792ed4..201de01411 100644 --- a/xen/arch/arm/setup.c +++ b/xen/arch/arm/setup.c @@ -50,6 +50,7 @@ #include #include #include +#include #include #include #include diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S index 08016948ab..3683f4821f 100644 --- a/xen/arch/arm/xen.lds.S +++ b/xen/arch/arm/xen.lds.S @@ -142,6 +142,13 @@ SECTIONS _eteemediator =3D .; } :text =20 + . =3D ALIGN(8); + .scimediator.info : { + _sscimediator =3D .; + *(.scimediator.info) + _escimediator =3D .; + } :text + . =3D ALIGN(PAGE_SIZE); /* Init code and data */ __init_begin =3D .; .init.text : { diff --git a/xen/include/asm-arm/domain.h b/xen/include/asm-arm/domain.h index 9b3647587a..d9b164017f 100644 --- a/xen/include/asm-arm/domain.h +++ b/xen/include/asm-arm/domain.h @@ -89,6 +89,10 @@ struct arch_domain #ifdef CONFIG_TEE void *tee; #endif + +#ifdef CONFIG_SCI + void *sci; +#endif } __cacheline_aligned; =20 struct arch_vcpu diff --git a/xen/include/asm-arm/sci/sci.h b/xen/include/asm-arm/sci/sci.h new file mode 100644 index 0000000000..aeff689c72 --- /dev/null +++ b/xen/include/asm-arm/sci/sci.h @@ -0,0 +1,162 @@ +/* + * xen/include/asm-arm/sci/sci.h + * + * Generic part of the SCI (System Control Interface) subsystem. + * + * Oleksii Moisieiev + * Copyright (C) 2021, EPAM Systems. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef __ASM_ARM_SCI_H +#define __ASM_ARM_SCI_H + +#include +#include +#include + +#ifdef CONFIG_SCI + +struct sci_mediator_ops { + + /* + * Probe for SCI. Should return true if SCI found and + * mediator is initialized. + */ + bool (*probe)(struct dt_device_node *scmi_node); + + /* + * Called during domain construction if toolstack requests to enable + * SCI support so mediator can inform SCP-firmware about new + * guest and create own structures for the new domain. + */ + int (*domain_init)(struct domain *d); + + /* + * Called during domain destruction, releases all resources, that + * were allocated by the mediator. + */ + void (*domain_destroy)(struct domain *d); + + /* + * Called during parsing partial device-sci for the domain. + * Passing device_node so mediator could process the device and + * mark the device as related to the domain if needed. + */ + int (*add_dt_device)(struct domain *d, struct dt_device_node *dev); + + /* + * Called during domain destruction to relinquish resources used + * by mediator itself. This function can return -ERESTART to indicate + * that it does not finished work and should be called again. + */ + int (*relinquish_resources)(struct domain *d); + + /* Handle call for current domain */ + bool (*handle_call)(struct domain *d, void *regs); + + /* Gets channel configuration and store it in domainconfig */ + int (*get_channel_info)(void *sci_ops, + struct xen_arch_domainconfig *config); + +}; + +struct sci_mediator_desc { + /* Printable name of the SCI. */ + const char *name; + + /* Mediator callbacks as described above. */ + const struct sci_mediator_ops *ops; + + /* + * ID of SCI. Corresponds to xen_arch_domainconfig.sci_type. + * Should be one of XEN_DOMCTL_CONFIG_SCI_xxx + */ + uint16_t sci_type; + + /* Match structure to init mediator */ + const struct dt_device_match *dt_match; + +}; + +int sci_domain_init(struct domain *d, uint16_t sci_type); +void sci_domain_destroy(struct domain *d); +int sci_add_dt_device(struct domain *d, struct dt_device_node *dev); +int sci_relinquish_resources(struct domain *d); +bool sci_handle_call(struct domain *d, void *args); +int sci_get_channel_info(struct domain *d, + struct xen_arch_domainconfig *config); +uint16_t sci_get_type(void); + +#define REGISTER_SCI_MEDIATOR(_name, _namestr, _type, _match, _ops) \ +static const struct sci_mediator_desc __sci_desc_##_name __used \ +__section(".scimediator.info") =3D { \ + .name =3D _namestr, \ + .ops =3D _ops, \ + .sci_type =3D _type, \ + .dt_match =3D _match \ +} + +#else +#include + +static inline int sci_domain_init(struct domain *d, uint16_t sci_type) +{ + if ( likely(sci_type =3D=3D XEN_DOMCTL_CONFIG_SCI_NONE) ) + return 0; + + return -XEN_ENODEV; +} + +static inline void sci_domain_destroy(struct domain *d) +{ +} + +static inline int sci_add_dt_device(struct domain *d, + struct dt_device_node *dev) +{ + return 0; +} + +static inline int sci_relinquish_resources(struct domain *d) +{ + return 0; +} + +static inline bool sci_handle_call(struct domain *d, void *args) +{ + return false; +} + +static inline int sci_get_channel_info(struct domain *d, + struct xen_arch_domainconfig *confi= g) +{ + return 0; +} + +static inline uint16_t sci_get_type(void) +{ + return XEN_DOMCTL_CONFIG_SCI_NONE; +} + +#endif /* CONFIG_SCI */ + +#endif /* __ASM_ARM_SCI_H */ + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */ diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h index 94b31511dd..9180be5e86 100644 --- a/xen/include/public/arch-arm.h +++ b/xen/include/public/arch-arm.h @@ -314,12 +314,16 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t); #define XEN_DOMCTL_CONFIG_TEE_NONE 0 #define XEN_DOMCTL_CONFIG_TEE_OPTEE 1 =20 +#define XEN_DOMCTL_CONFIG_SCI_NONE 0 + struct xen_arch_domainconfig { /* IN/OUT */ uint8_t gic_version; /* IN */ uint16_t tee_type; /* IN */ + uint8_t sci_type; + /* IN */ uint32_t nr_spis; /* * OUT @@ -335,6 +339,12 @@ struct xen_arch_domainconfig { * */ uint32_t clock_frequency; + + /* Sets shared address to sw domains. + * This information is needed to set correct channel in Domain partial + * device-tree + */ + uint64_t sci_agent_paddr; }; #endif /* __XEN__ || __XEN_TOOLS__ */ =20 --=20 2.27.0 From nobody Wed May 1 23:23:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=epam.com); dmarc=pass(p=quarantine dis=none) header.from=epam.com ARC-Seal: i=2; a=rsa-sha256; t=1639474506; cv=pass; d=zohomail.com; s=zohoarc; b=mJH3a3X8ktWmRZbpiiWKDI5eqMCG6yAR8SEoSwVugMhKieW2ph3QoMXG1CsSiOxpOGcqBLFH8vy5NlXzyjsqxIKvYVj9XAWUxqEN0aOfcYciBUHMcNFUfQhRWkieHFn3NKg8ad+16e7rKMl7/pwGm9QHB3kaC/1ss0lTnI773yY= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639474506; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=RqDx/qBEgEJtOnIYy1d9FCWR8MG1fPXkQ1whSTJXTl0=; b=P4cu8WGUhlgcjwtRyRPhBXbKi0764KYtvR3fop9aeQ1LBxjKE0MCNhpqj9OBunWT18SCS+hOG8mSLP6p/s+RgaguXwyroiV6wsS1mhpU5i1W8jzRNLfph5RNHKicgsCRaLtHFboa3LEjOeP9MwEDi8x2b2V07CbCHJ0XLAlpjas= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=epam.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 16394745061441019.7928751224684; Tue, 14 Dec 2021 01:35:06 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.246487.425111 (Exim 4.92) (envelope-from ) id 1mx4Co-0007sx-Rw; Tue, 14 Dec 2021 09:34:42 +0000 Received: by outflank-mailman (output) from mailman id 246487.425111; Tue, 14 Dec 2021 09:34:42 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mx4Co-0007p2-L7; Tue, 14 Dec 2021 09:34:42 +0000 Received: by outflank-mailman (input) for mailman id 246487; Tue, 14 Dec 2021 09:34:41 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mx4Cm-0007JG-Ta for xen-devel@lists.xenproject.org; Tue, 14 Dec 2021 09:34:41 +0000 Received: from mx0b-0039f301.pphosted.com (mx0b-0039f301.pphosted.com [148.163.137.242]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 341575b3-5cc0-11ec-85d3-df6b77346a89; Tue, 14 Dec 2021 10:28:32 +0100 (CET) Received: from pps.filterd (m0174682.ppops.net [127.0.0.1]) by mx0b-0039f301.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 1BE943EG004675; Tue, 14 Dec 2021 09:34:35 GMT Received: from eur05-db8-obe.outbound.protection.outlook.com (mail-db8eur05lp2107.outbound.protection.outlook.com [104.47.17.107]) by mx0b-0039f301.pphosted.com (PPS) with ESMTPS id 3cxraag3uw-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 14 Dec 2021 09:34:35 +0000 Received: from PA4PR03MB7136.eurprd03.prod.outlook.com (2603:10a6:102:ea::23) by PA4PR03MB6976.eurprd03.prod.outlook.com (2603:10a6:102:e4::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Tue, 14 Dec 2021 09:34:27 +0000 Received: from PA4PR03MB7136.eurprd03.prod.outlook.com ([fe80::85d2:c8aa:2196:21c6]) by PA4PR03MB7136.eurprd03.prod.outlook.com ([fe80::85d2:c8aa:2196:21c6%9]) with mapi id 15.20.4778.018; Tue, 14 Dec 2021 09:34:27 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 341575b3-5cc0-11ec-85d3-df6b77346a89 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UwnGUl9bX6i59s6B7qkAKXp2jvEk4m7FzejG+a51nPdxUmLM/UBuMP9Z4IyX3NzazUlxzRvPAm8CsE8l4BrWmg1ZC/s3ine+LIUY5e4ebh2wJ2jawc5NwvluPjX4ZBcrQQ3AwQHmPKTXRLR0CUFA1HYjBzVqE0HgkbwimfbmbDzWS4HubPke9bqMhXvUNKoCp2Sp3V3pgC/MwyvB7vQMJSK0d+9qfXL6xcETr6oxk6IqYKiqEggHDczWqoXFsYb7aXVwDHupBWznBoi+DKqtcjkvLCs0XNr2sUrASSHLyj3nyeJmzcj1ufzpkQRPxjFO4HEDgKN8luqIyxv3Hwbl/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=RqDx/qBEgEJtOnIYy1d9FCWR8MG1fPXkQ1whSTJXTl0=; b=h5II6aVCW9LhIQ0pcInCCgzIW9lD0XJZ+6e/hPWM5IF7INA5AGmj6HMFZ1G/Kj2c/kqT6WpD7d94pbrxw2NeXtZnSGdqkEyS442DNNbK36HTJCo5ChJ71YBoR63M47dj0a6WpyBvWl63sFtMWQVppsp6JGI4sUD85eD7cJ/PwVjYDuUapESz2WUzs0piisObrveiAZqtZPeIFX8jZvY04rSFAQ/Na4JYL+10AE9wzKJK/2mG268hNdh6ggS91n4f6GrJ9COB8bKvB9r5KCANBmpj0dh1ipWxdz5veDCoUCf+oaB3rHup596GhKfbotFZ5AW/aF/OukbPhAgkNtq2TQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=epam.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RqDx/qBEgEJtOnIYy1d9FCWR8MG1fPXkQ1whSTJXTl0=; b=S2qouYjWnD58sLL8Daum0iLSgcv0bumf18ECt3jQopfj51OJx+IdRDc5l7TDqryrN6YQbT//YHOVX4XY6znp+W72rdS2YgrbLKODk4AdOClSuhfu8aUnXRUmROER+T9N6DWU7PPduBmLAhcjowZzVIUuVKDsjsGFugj9wZq8wO4zL23gKfv6CWVA3MQ67XEUhyRgCynnS5SOgGDFwId4Io8+ZzsnoUzIPGROMSJ88dkja2JLX4bGKHHwdmoH/pP4+/lNzlu8bLxwlb4gIbLXhpyCc+eaQen8ppz4WzElGfi4dyYVb1M6qCU5i/+PlwX0Hs9mSdBRTQfC57s8Bk2oKw== From: Oleksii Moisieiev To: "xen-devel@lists.xenproject.org" CC: Oleksii Moisieiev , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Bertrand Marquis Subject: [RFC v1 3/5] xen/arm: introduce SCMI-SMC mediator driver Thread-Topic: [RFC v1 3/5] xen/arm: introduce SCMI-SMC mediator driver Thread-Index: AQHX8M3JF7Ng56/tV0+8/7pODiaWfA== Date: Tue, 14 Dec 2021 09:34:27 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: ca2bd1b1-d2d6-4e69-31af-08d9bee4ec24 x-ms-traffictypediagnostic: PA4PR03MB6976:EE_ x-ld-processed: b41b72d0-4e9f-4c26-8a69-f949f367c91d,ExtAddr x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2512; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: QwNPoH92G8HviE3JqVCX0MMKrkRnBlo95OojdFpOxpxXsoVZb7ZxL7H/ygk4JxkgBoRJQ6b5pp1fIajW4hwT9UHWaXRp79JW9o8s8mMhhA0x0q+nOjdP27JF2ydYhvlnMqUuAGsTxxFFpuWIj+bxUtIK4cOU0a/EAkNUkaKoxPPndinnZod7nuM5MGRyKxsPKfYAiMsj3RhBgDmkJAhvPrRmPOQ3aIqG6px0u8lYeXT01LnNuctFRF9s2vcJPXPp8dIFKAwoWg6+Mnud2Nyz1ZEJtpzyXIn5PBKzpZdgv/0ZIfTBFzbWQftJRcsVuGW+iBZnsoku8ckB7tFedt6Qobjgynd5UYrSxiDF9VnpDwV1jt6Ce1lF4Q1KweMX0TeycvHNeCYKhWrCBBtE6xD7vUl0/68atdi1l/fxRd0porCLQUzR3R7fzNKtAhcJFEoXlL5o1OHB/LCfIfebEiqV5CkPNJOhu7E7sh39xzpCguWgkdJ7BkTtlNOTk8cyPJPhyEb/tWGiMz+5TtrS6CZQ11pvAJmFvyksYAOI1rSD2AI6B9uyD1wJgjylvsje4vEQJO9IFNXpwzOge8rLPJa9sUe3hBvsGkGazQ1BtXEAIVCcDNn5GHLz77CilsrZEFiSxkmFrMMWnzCDdY0OplHZQXWFFPz3qVzPqoAJSA89vcYq1bk5OrdUlzaYusbewIdGhz52t/HeTHHV95ll+m/DKHz0umTQN3PPopKikkk58z4= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PA4PR03MB7136.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(66476007)(64756008)(66556008)(66946007)(26005)(66446008)(76116006)(5660300002)(91956017)(508600001)(86362001)(83380400001)(186003)(30864003)(6916009)(4326008)(2906002)(6486002)(38070700005)(8936002)(2616005)(36756003)(71200400001)(8676002)(38100700002)(122000001)(6512007)(6506007)(316002)(54906003)(2004002)(579004)(559001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?ACcJU8qchTVDnGm/rPhClN22iecsD0+V2QbTOgNWdsKL/Cejigh3DRJ3Pv?= =?iso-8859-1?Q?XIyAesdLAQ6gDvzH5dsc3M5B09HfVVXVq2T4De2gAktQYjykZS3ouW8P9C?= =?iso-8859-1?Q?g3opwMiO8C9wI86nQa1Hsj610D09VQp6u2y41s0868gFLQHoxrar0d+zJ5?= =?iso-8859-1?Q?WTMF5SZ2nPwC6ZJar178KTkDgSZomff0FXmx0IUSH81VPkr/S21aECD2gS?= =?iso-8859-1?Q?xMbf5JhrxndxZGaWCRXBNYhXRc1pK6twGx160H221H7bhKd0R32MN7+4Fg?= =?iso-8859-1?Q?ptuFuud3p1LXL5VjFV8WQijEGSIo2lP2d8TRlbZFthO5JjCzl+PtQpilvB?= =?iso-8859-1?Q?GekbmuzL+C/7cw6AJZ4igt4KS7hYDo6NoXWHK7eBEuKNXZ4RhZUR7Bk6jk?= =?iso-8859-1?Q?0+an3vCkO2hpJmy5WcKwLv64EN+Mpnb4YfPdc1sRDh2cND/rj3rSnlsjaJ?= =?iso-8859-1?Q?RG5N/SgJCO5eTgJYQBsEeedK7iofMmokZIXfQYxLNqqKxzoB7iF2dV8Azz?= =?iso-8859-1?Q?ryOAwfxiO7ck/enc79YIGzHWasu/3mZDGJeXg3uFCjYAWG/zWmoHdGTNmV?= =?iso-8859-1?Q?JQceO4Ctzor8JEWchAR46xx0zFDGK80GGTjxQxgooIr7wjoszL26clKeem?= =?iso-8859-1?Q?n01N+EVJxCKnVHn4iW4y4F1SlXDsDy7IsLIEoEfPBQ153Nn2g+1j41bfrY?= =?iso-8859-1?Q?I2OrxFG1wvjWlUFAPurQetQ90BBx/qsTuTkChFxfFOwap/zM7HeKqjWvAW?= =?iso-8859-1?Q?4dYXaos5V3w3mRtFxbzUXqIVNNtt9/31c0qvV1SJzoqbFiJg3wNzeJ3iAd?= =?iso-8859-1?Q?maRmhLjXfYuF46kVIROqaS4WgF1b+bLKfrymq4xn37XLLRPpvSwlztEtk6?= =?iso-8859-1?Q?5mfZ/YI0sGdL3VwvjqrOdOCS1tpRsLnENA97k4M5T8bWQSZH2ViiEvUsRn?= =?iso-8859-1?Q?7KWsK9BgWSSfDhxXA+R1KYFQTLoy2PCzAUbJ3AUOBnmJNp43Cz8cBals2S?= =?iso-8859-1?Q?xns2rLGKR0mkDpFXA2RWM5KqQc+pgBB2PXNVcGMnOZdk6rQOvOJEUDgdP8?= =?iso-8859-1?Q?JhqaJPh9DwV4xCPABe+ivJTdajly+QRnhiDm0SsTKFs/ZJP2o6Jf6P8s7q?= =?iso-8859-1?Q?ylNqom3IjOpXVPYj5R1DapIQBQJz2nsCs3nUhvqDgYhDMBGZhhDrK0BFyS?= =?iso-8859-1?Q?qYH9U7WWYyyoO721FXhD6nKGI2M6rlnT923RLwhQCSMGTLoxi2KFD7OzJs?= =?iso-8859-1?Q?PVeQ34ZQiHcCujPHSJxswAdOdy+8tvTCJbhom4105LCtw2YPidOHyydeT/?= =?iso-8859-1?Q?gYh13GT2WevJCQZs2LkNmHC4XsmBXIIg3hDvJ8570DbLV8hjH0O1djQAXs?= =?iso-8859-1?Q?+y2IxcCw0sFfUS286qR5uXRI8LWTdrA4ZkB5vRBatX3dBKpEhyipiLKfD/?= =?iso-8859-1?Q?D0aWaI6PhWnIWpiPvFqPy71xCiqxYL/cLqu+YlEjMhDDrmSnWEV6CPSb9V?= =?iso-8859-1?Q?tVZI4DPpX1+1TTBrNNul3Nu8xbZrtMpJ9ibs78QddRoFB333515WJLxsNe?= =?iso-8859-1?Q?pjYS9K0ZYxxCwTU4T2vwpDqNL0WmRspyklpgjw1fzEuyqy7w0ABT5XUm2W?= =?iso-8859-1?Q?n7GHZcyoqL/HD/rulG0TPuIKoLfw4L4yY2kVu4tbups7jSnp/NL0XhvYcT?= =?iso-8859-1?Q?CEv61RpeMkN3x2y79sW+UVPdhdRy6VPTCNKwtz3ixXKk3JtuaGlJDoB/UN?= =?iso-8859-1?Q?MrswuMkvL+lEVJEz9XlcBllJA=3D?= Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: epam.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PA4PR03MB7136.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ca2bd1b1-d2d6-4e69-31af-08d9bee4ec24 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Dec 2021 09:34:27.2470 (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: srjvjyhM4KXgTORbS998EPN9Xp8+YAyT1IeXfJ44QFbEe6qaThdp+G2XjhWMoXb460rZLmaCbQlIVi1SLiJl4vZglk82YAM1byWvxiop6NU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR03MB6976 X-Proofpoint-ORIG-GUID: bnENPmIRLNVAf6yDf1GfFMAyvJYcr5gA X-Proofpoint-GUID: bnENPmIRLNVAf6yDf1GfFMAyvJYcr5gA X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2021-12-14_05,2021-12-13_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 mlxscore=0 bulkscore=0 malwarescore=0 clxscore=1015 lowpriorityscore=0 phishscore=0 priorityscore=1501 suspectscore=0 mlxlogscore=999 spamscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2112140054 X-ZohoMail-DKIM: pass (identity @epam.com) X-ZM-MESSAGEID: 1639474506946100001 Content-Type: text/plain; charset="utf-8" This is the implementation of SCI interface, called SCMI-SMC driver, which works as the mediator between XEN Domains and Firmware (SCP, ATF etc). This allows devices from the Domains to work with clocks, resets and power-domains without access to CPG. The following features are implemented: - request SCMI channels from ATF and pass channels to Domains; - set device permissions for Domains based on the Domain partial device-tree. Devices with permissions are able to work with clocks, resets and power-domains via SCMI; - redirect scmi messages from Domains to ATF. Signed-off-by: Oleksii Moisieiev --- xen/arch/arm/Kconfig | 2 + xen/arch/arm/sci/Kconfig | 10 + xen/arch/arm/sci/Makefile | 1 + xen/arch/arm/sci/scmi_smc.c | 795 ++++++++++++++++++++++++++++++++++ xen/include/public/arch-arm.h | 1 + 5 files changed, 809 insertions(+) create mode 100644 xen/arch/arm/sci/Kconfig create mode 100644 xen/arch/arm/sci/scmi_smc.c diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig index 186e1db389..02d96c6cfc 100644 --- a/xen/arch/arm/Kconfig +++ b/xen/arch/arm/Kconfig @@ -114,6 +114,8 @@ config SCI support. It allows guests to control system resourcess via one of SCI mediators implemented in XEN. =20 +source "arch/arm/sci/Kconfig" + endmenu =20 menu "ARM errata workaround via the alternative framework" diff --git a/xen/arch/arm/sci/Kconfig b/xen/arch/arm/sci/Kconfig new file mode 100644 index 0000000000..9563067ddc --- /dev/null +++ b/xen/arch/arm/sci/Kconfig @@ -0,0 +1,10 @@ +config SCMI_SMC + bool "Enable SCMI-SMC mediator driver" + default n + depends on SCI + ---help--- + + Enables mediator in XEN to pass SCMI requests from Domains to ATF. + This feature allows drivers from Domains to work with System + Controllers (such as power,resets,clock etc.). SCP is used as transport + for communication. diff --git a/xen/arch/arm/sci/Makefile b/xen/arch/arm/sci/Makefile index 837dc7492b..67f2611872 100644 --- a/xen/arch/arm/sci/Makefile +++ b/xen/arch/arm/sci/Makefile @@ -1 +1,2 @@ obj-y +=3D sci.o +obj-$(CONFIG_SCMI_SMC) +=3D scmi_smc.o diff --git a/xen/arch/arm/sci/scmi_smc.c b/xen/arch/arm/sci/scmi_smc.c new file mode 100644 index 0000000000..2eb01ea82d --- /dev/null +++ b/xen/arch/arm/sci/scmi_smc.c @@ -0,0 +1,795 @@ +/* + * xen/arch/arm/sci/scmi_smc.c + * + * SCMI mediator driver, using SCP as transport. + * + * Oleksii Moisieiev + * Copyright (C) 2021, EPAM Systems. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define SCMI_BASE_PROTOCOL 0x10 +#define SCMI_BASE_PROTOCOL_ATTIBUTES 0x1 +#define SCMI_BASE_SET_DEVICE_PERMISSIONS 0x9 +#define SCMI_BASE_RESET_AGENT_CONFIGURATION 0xB +#define SCMI_BASE_DISCOVER_AGENT 0x7 + +/* SCMI return codes. See section 4.1.4 of SCMI spec (DEN0056C) */ +#define SCMI_SUCCESS 0 +#define SCMI_NOT_SUPPORTED (-1) +#define SCMI_INVALID_PARAMETERS (-2) +#define SCMI_DENIED (-3) +#define SCMI_NOT_FOUND (-4) +#define SCMI_OUT_OF_RANGE (-5) +#define SCMI_BUSY (-6) +#define SCMI_COMMS_ERROR (-7) +#define SCMI_GENERIC_ERROR (-8) +#define SCMI_HARDWARE_ERROR (-9) +#define SCMI_PROTOCOL_ERROR (-10) + +#define DT_MATCH_SCMI_SMC DT_MATCH_COMPATIBLE("arm,scmi-smc") + +#define SCMI_SMC_ID "arm,smc-id" +#define SCMI_SHARED_MEMORY "linux,scmi_mem" +#define SCMI_SHMEM "shmem" + +#define HYP_CHANNEL 0x0 + +#define HDR_ID GENMASK(7,0) +#define HDR_TYPE GENMASK(9, 8) +#define HDR_PROTO GENMASK(17, 10) + +/* SCMI protocol, refer to section 4.2.2.2 (DEN0056C) */ +#define MSG_N_AGENTS_MASK GENMASK(15, 8) + +#define FIELD_GET(_mask, _reg)\ + ((typeof(_mask))(((_reg) & (_mask)) >> (ffs64(_mask) - 1))) +#define FIELD_PREP(_mask, _val)\ + (((typeof(_mask))(_val) << (ffs64(_mask) - 1)) & (_mask)) + +typedef struct scmi_msg_header { + uint8_t id; + uint8_t type; + uint8_t protocol; +} scmi_msg_header_t; + +typedef struct scmi_perms_tx { + uint32_t agent_id; + uint32_t device_id; + uint32_t flags; +} scmi_perms_tx_t; + +#define SCMI_SHMEM_CHAN_STAT_CHANNEL_FREE BIT(0, UL) +#define SCMI_SHMEM_CHAN_STAT_CHANNEL_ERROR BIT(1, UL) + +#define SCMI_ALLOW_ACCESS BIT(0, UL) + +struct scmi_shared_mem { + uint32_t reserved; + uint32_t channel_status; + uint32_t reserved1[2]; + uint32_t flags; + uint32_t length; + uint32_t msg_header; + uint8_t msg_payload[]; +}; + +struct scmi_channel { + int chan_id; + int agent_id; + uint32_t func_id; + int domain_id; + uint64_t paddr; + struct scmi_shared_mem *shmem; + spinlock_t lock; + struct list_head list; +}; + +struct scmi_data { + struct list_head channel_list; + spinlock_t channel_list_lock; + bool initialized; + u64 shmem_addr, shmem_size; +}; + +static struct scmi_data scmi_data; + +/* + * pack_scmi_header() - packs and returns 32-bit header + * + * @hdr: pointer to header containing all the information on message id, + * protocol id and type id. + * + * Return: 32-bit packed message header to be sent to the platform. + */ +static inline uint32_t pack_scmi_header(scmi_msg_header_t *hdr) +{ + return FIELD_PREP(HDR_ID, hdr->id) | + FIELD_PREP(HDR_TYPE, hdr->type) | + FIELD_PREP(HDR_PROTO, hdr->protocol); +} + +/* + * unpack_scmi_header() - unpacks and records message and protocol id + * + * @msg_hdr: 32-bit packed message header sent from the platform + * @hdr: pointer to header to fetch message and protocol id. + */ +static inline void unpack_scmi_header(uint32_t msg_hdr, scmi_msg_header_t = *hdr) +{ + hdr->id =3D FIELD_GET(HDR_ID, msg_hdr); + hdr->type =3D FIELD_GET(HDR_TYPE, msg_hdr); + hdr->protocol =3D FIELD_GET(HDR_PROTO, msg_hdr); +} + +static inline int channel_is_free(struct scmi_channel *chan_info) +{ + return ( chan_info->shmem->channel_status + & SCMI_SHMEM_CHAN_STAT_CHANNEL_FREE ) ? 0 : -EBUSY; +} + +static int send_smc_message(struct scmi_channel *chan_info, + scmi_msg_header_t *hdr, void *data, int len) +{ + struct arm_smccc_res resp; + int ret; + + printk(XENLOG_DEBUG "scmi: status =3D%d len=3D%d\n", + chan_info->shmem->channel_status, len); + printk(XENLOG_DEBUG "scmi: header id =3D %d type =3D %d, proto =3D %d\= n", + hdr->id, hdr->type, hdr->protocol); + + ret =3D channel_is_free(chan_info); + if ( IS_ERR_VALUE(ret) ) + return ret; + + chan_info->shmem->channel_status =3D 0x0; + /* Writing 0x0 right now, but SCMI_SHMEM_FLAG_INTR_ENABLED can be set = */ + chan_info->shmem->flags =3D 0x0; + chan_info->shmem->length =3D sizeof(chan_info->shmem->msg_header) + le= n; + chan_info->shmem->msg_header =3D pack_scmi_header(hdr); + + printk(XENLOG_DEBUG "scmi: Writing to shmem address %p\n", + chan_info->shmem); + if ( len > 0 && data ) + memcpy((void *)(chan_info->shmem->msg_payload), data, len); + + arm_smccc_smc(chan_info->func_id, 0, 0, 0, 0, 0, 0, chan_info->chan_id, + &resp); + + printk(XENLOG_DEBUG "scmi: scmccc_smc response %d\n", (int)(resp.a0)); + + if ( resp.a0 ) + return -EOPNOTSUPP; + + return 0; +} + +static int check_scmi_status(int scmi_status) +{ + if ( scmi_status =3D=3D SCMI_SUCCESS ) + return 0; + + printk(XENLOG_DEBUG "scmi: Error received: %d\n", scmi_status); + + switch ( scmi_status ) + { + case SCMI_NOT_SUPPORTED: + return -EOPNOTSUPP; + case SCMI_INVALID_PARAMETERS: + return -EINVAL; + case SCMI_DENIED: + return -EACCES; + case SCMI_NOT_FOUND: + return -ENOENT; + case SCMI_OUT_OF_RANGE: + return -ERANGE; + case SCMI_BUSY: + return -EBUSY; + case SCMI_COMMS_ERROR: + return -ENOTCONN; + case SCMI_GENERIC_ERROR: + return -EIO; + case SCMI_HARDWARE_ERROR: + return -ENXIO; + case SCMI_PROTOCOL_ERROR: + return -EBADMSG; + } + + return -EINVAL; +} + +static int get_smc_response(struct scmi_channel *chan_info, + scmi_msg_header_t *hdr, void *data, int len) +{ + int recv_len; + int ret; + + printk(XENLOG_DEBUG "scmi: get smc responce msgid %d\n", hdr->id); + + ret =3D channel_is_free(chan_info); + if ( IS_ERR_VALUE(ret) ) + return ret; + + recv_len =3D chan_info->shmem->length - sizeof(chan_info->shmem->msg_h= eader); + + if ( recv_len < 0 ) + { + printk(XENLOG_ERR + "scmi: Wrong size of smc message. Data may be invalid\n"); + return -EINVAL; + } + + if ( recv_len > len ) + { + printk(XENLOG_ERR + "scmi: Not enough buffer for message %d, expecting %d\n", + recv_len, len); + return -EINVAL; + } + + unpack_scmi_header(chan_info->shmem->msg_header, hdr); + + if ( recv_len > 0 ) + { + memcpy(data, chan_info->shmem->msg_payload, recv_len); + } + + return 0; +} + +static int do_smc_xfer(struct scmi_channel *channel, scmi_msg_header_t *hd= r, void *tx_data, int tx_size, + void *rx_data, int rx_size) +{ + int ret =3D 0; + + if ( !hdr ) + return -EINVAL; + + spin_lock(&channel->lock); + + ret =3D send_smc_message(channel, hdr, tx_data, tx_size); + if ( ret ) + goto clean; + + ret =3D get_smc_response(channel, hdr, rx_data, rx_size); +clean: + spin_unlock(&channel->lock); + + return ret; +} + +static struct scmi_channel *get_channel_by_id(uint8_t chan_id) +{ + struct scmi_channel *curr; + bool found =3D false; + + spin_lock(&scmi_data.channel_list_lock); + list_for_each_entry(curr, &scmi_data.channel_list, list) + if ( curr->chan_id =3D=3D chan_id ) + { + found =3D true; + break; + } + + spin_unlock(&scmi_data.channel_list_lock); + if ( found ) + return curr; + + return NULL; +} + +static struct scmi_channel *get_channel_by_domain(uint8_t domain_id) +{ + struct scmi_channel *curr; + bool found =3D false; + + spin_lock(&scmi_data.channel_list_lock); + list_for_each_entry(curr, &scmi_data.channel_list, list) + if ( curr->domain_id =3D=3D domain_id ) + { + found =3D true; + break; + } + + spin_unlock(&scmi_data.channel_list_lock); + if ( found ) + return curr; + + return NULL; +} + +static struct scmi_channel *aquire_scmi_channel(int domain_id) +{ + struct scmi_channel *curr; + bool found =3D false; + + ASSERT(domain_id !=3D DOMID_INVALID && domain_id >=3D 0); + + spin_lock(&scmi_data.channel_list_lock); + list_for_each_entry(curr, &scmi_data.channel_list, list) + if ( (curr->domain_id =3D=3D DOMID_INVALID) + && (curr->chan_id !=3D HYP_CHANNEL) ) + { + curr->domain_id =3D domain_id; + found =3D true; + break; + } + + spin_unlock(&scmi_data.channel_list_lock); + if ( found ) + return curr; + + return NULL; +} + +static void relinquish_scmi_channel(struct scmi_channel *channel) +{ + spin_lock(&scmi_data.channel_list_lock); + ASSERT(channel !=3D NULL); + channel->domain_id =3D DOMID_INVALID; + spin_unlock(&scmi_data.channel_list_lock); +} + +static struct scmi_channel *smc_create_channel(uint8_t chan_id, + uint32_t func_id, uint64_t = addr) +{ + struct scmi_channel *channel; + mfn_t mfn; + + channel =3D get_channel_by_id(chan_id); + if ( channel ) + return ERR_PTR(EEXIST); + + channel =3D xmalloc(struct scmi_channel); + if ( !channel ) + return ERR_PTR(ENOMEM); + + channel->chan_id =3D chan_id; + channel->func_id =3D func_id; + channel->domain_id =3D DOMID_INVALID; + mfn =3D maddr_to_mfn(addr); + channel->shmem =3D vmap(&mfn, 1); + if ( !channel->shmem ) + { + xfree(channel); + return ERR_PTR(ENOMEM); + } + + printk(XENLOG_DEBUG "scmi: Got shmem after vmap %p\n", channel->shmem); + channel->paddr =3D addr; + channel->shmem->channel_status =3D SCMI_SHMEM_CHAN_STAT_CHANNEL_FREE; + spin_lock_init(&channel->lock); + spin_lock(&scmi_data.channel_list_lock); + list_add(&channel->list, &scmi_data.channel_list); + spin_unlock(&scmi_data.channel_list_lock); + return channel; +} + +static int map_memory_to_domain(struct domain *d, uint64_t addr, uint64_t = len) +{ + return iomem_permit_access(d, paddr_to_pfn(addr), + paddr_to_pfn(PAGE_ALIGN(addr + len -1))); +} + +static int unmap_memory_from_domain(struct domain *d, uint64_t addr, + uint64_t len) +{ + return iomem_deny_access(d, paddr_to_pfn(addr), + paddr_to_pfn(PAGE_ALIGN(addr + len -1))); +} + +static int dt_update_domain_range(struct domain *d, uint64_t addr, + uint64_t size) +{ + struct dt_device_node *shmem_node; + __be32 *hw_reg; + const struct dt_property *pp; + uint32_t len; + + shmem_node =3D dt_find_compatible_node(NULL, NULL, "arm,scmi-shmem"); + + if ( !shmem_node ) + { + printk(XENLOG_ERR "scmi: Unable to find %s node in DT\n", SCMI_SHM= EM); + return -EINVAL; + } + + pp =3D dt_find_property(shmem_node, "reg", &len); + if ( !pp ) + { + printk(XENLOG_ERR "scmi: Unable to find regs entry in shmem node\n= "); + return -ENOENT; + } + + hw_reg =3D pp->value; + dt_set_range(&hw_reg, shmem_node, addr, size); + + return 0; +} + +static void free_channel_list(void) +{ + struct scmi_channel *curr, *_curr; + + spin_lock(&scmi_data.channel_list_lock); + list_for_each_entry_safe (curr, _curr, &scmi_data.channel_list, list) + { + vunmap(curr->shmem); + list_del(&curr->list); + xfree(curr); + } + + spin_unlock(&scmi_data.channel_list_lock); +} + +static __init bool scmi_probe(struct dt_device_node *scmi_node) +{ + struct dt_device_node *shmem_node; + int ret, i; + struct scmi_channel *channel, *agent_channel; + int n_agents; + scmi_msg_header_t hdr; + struct rx_t { + int32_t status; + uint32_t attributes; + } rx; + + uint32_t func_id; + + ASSERT(scmi_node !=3D NULL); + + INIT_LIST_HEAD(&scmi_data.channel_list); + spin_lock_init(&scmi_data.channel_list_lock); + + if ( !dt_property_read_u32(scmi_node, SCMI_SMC_ID, &func_id) ) + { + printk(XENLOG_ERR "scmi: Unable to read smc-id from DT\n"); + return false; + } + + shmem_node =3D dt_find_node_by_name(NULL, SCMI_SHARED_MEMORY); + if ( IS_ERR_OR_NULL(shmem_node) ) + { + printk(XENLOG_ERR + "scmi: Device tree error, can't parse shmem phandle %ld\n", + PTR_ERR(shmem_node)); + return false; + } + + ret =3D dt_device_get_address(shmem_node, 0, &scmi_data.shmem_addr, + &scmi_data.shmem_size); + if ( IS_ERR_VALUE(ret) ) + return false; + + channel =3D smc_create_channel(HYP_CHANNEL, func_id, scmi_data.shmem_a= ddr); + if ( IS_ERR(channel) ) + return false; + + hdr.id =3D SCMI_BASE_PROTOCOL_ATTIBUTES; + hdr.type =3D 0; + hdr.protocol =3D SCMI_BASE_PROTOCOL; + + ret =3D do_smc_xfer(channel, &hdr, NULL, 0, &rx, sizeof(rx)); + if ( ret ) + goto clean; + + ret =3D check_scmi_status(rx.status); + if ( ret ) + goto clean; + + n_agents =3D FIELD_GET(MSG_N_AGENTS_MASK, rx.attributes); + printk(XENLOG_DEBUG "scmi: Got agent count %d\n", n_agents); + + n_agents =3D (n_agents > scmi_data.shmem_size / PAGE_SIZE) ? + scmi_data.shmem_size / PAGE_SIZE : n_agents; + + for ( i =3D 1; i < n_agents; i++ ) + { + uint32_t tx_agent_id =3D 0xFFFFFFFF; + struct { + int32_t status; + uint32_t agent_id; + char name[16]; + } da_rx; + + agent_channel =3D smc_create_channel(i, func_id, scmi_data.shmem_a= ddr + + i * PAGE_SIZE); + if ( IS_ERR(agent_channel) ) + { + ret =3D PTR_ERR(agent_channel); + goto clean; + } + + hdr.id =3D SCMI_BASE_DISCOVER_AGENT; + hdr.type =3D 0; + hdr.protocol =3D SCMI_BASE_PROTOCOL; + + ret =3D do_smc_xfer(agent_channel, &hdr, &tx_agent_id, + sizeof(tx_agent_id), &da_rx, sizeof(da_rx)); + if ( ret ) + goto clean; + + ret =3D check_scmi_status(da_rx.status); + if ( ret ) + goto clean; + + printk(XENLOG_DEBUG "scmi: status=3D0x%x id=3D0x%x name=3D%s\n", + da_rx.status, da_rx.agent_id, da_rx.name); + + agent_channel->agent_id =3D da_rx.agent_id; + } + + scmi_data.initialized =3D true; + return true; + +clean: + free_channel_list(); + return ret =3D=3D 0; +} + +static int scmi_domain_init(struct domain *d) +{ + struct scmi_channel *channel; + int ret; + + if ( !scmi_data.initialized ) + return 0; + + channel =3D aquire_scmi_channel(d->domain_id); + if ( IS_ERR_OR_NULL(channel) ) + return -ENOENT; + + printk(XENLOG_INFO "scmi: Aquire SCMI channel id =3D 0x%x , domain_id = =3D %d" + "paddr =3D 0x%lx\n", channel->chan_id, channel->domain_id, + channel->paddr); + + if ( is_hardware_domain(d) ) + { + ret =3D map_memory_to_domain(d, scmi_data.shmem_addr, + scmi_data.shmem_size); + if ( IS_ERR_VALUE(ret) ) + goto error; + + ret =3D dt_update_domain_range(d, channel->paddr, PAGE_SIZE); + if ( IS_ERR_VALUE(ret) ) + { + int rc =3D unmap_memory_from_domain(d, scmi_data.shmem_addr, + scmi_data.shmem_size); + if ( rc ) + printk(XENLOG_ERR "Unable to unmap_memory_from_domain\n"); + + goto error; + } + } + + d->arch.sci =3D channel; + + return 0; +error: + relinquish_scmi_channel(channel); + + return ret; +} + +static int scmi_add_device_by_devid(struct domain *d, uint32_t scmi_devid) +{ + struct scmi_channel *channel, *agent_channel; + scmi_msg_header_t hdr; + scmi_perms_tx_t tx; + struct rx_t { + int32_t status; + uint32_t attributes; + } rx; + int ret; + + if ( !scmi_data.initialized ) + return 0; + + printk(XENLOG_DEBUG "scmi: scmi_devid =3D %d\n", scmi_devid); + + agent_channel =3D get_channel_by_domain(d->domain_id); + if ( IS_ERR_OR_NULL(agent_channel) ) + return PTR_ERR(agent_channel); + + channel =3D get_channel_by_id(HYP_CHANNEL); + if ( IS_ERR_OR_NULL(channel) ) + return PTR_ERR(channel); + + hdr.id =3D SCMI_BASE_SET_DEVICE_PERMISSIONS; + hdr.type =3D 0; + hdr.protocol =3D SCMI_BASE_PROTOCOL; + + tx.agent_id =3D agent_channel->agent_id; + tx.device_id =3D scmi_devid; + tx.flags =3D SCMI_ALLOW_ACCESS; + + ret =3D do_smc_xfer(channel, &hdr, &tx, sizeof(tx), &rx, sizeof(&rx)); + if ( IS_ERR_VALUE(ret) ) + return ret; + + ret =3D check_scmi_status(rx.status); + if ( IS_ERR_VALUE(ret) ) + return ret; + + return 0; +} + +static int scmi_add_dt_device(struct domain *d, struct dt_device_node *dev) +{ + uint32_t scmi_devid; + + if ( (!scmi_data.initialized) || (!d->arch.sci) ) + return 0; + + if ( !dt_property_read_u32(dev, "scmi_devid", &scmi_devid) ) + return 0; + + printk(XENLOG_INFO "scmi: dt_node =3D %s\n", dt_node_full_name(dev)); + + return scmi_add_device_by_devid(d, scmi_devid); +} + +static int scmi_relinquish_resources(struct domain *d) +{ + int ret; + struct scmi_channel *channel, *agent_channel; + scmi_msg_header_t hdr; + struct reset_agent_tx { + uint32_t agent_id; + uint32_t flags; + } tx; + uint32_t rx; + + if ( !d->arch.sci ) + return 0; + + agent_channel =3D d->arch.sci; + + spin_lock(&agent_channel->lock); + tx.agent_id =3D agent_channel->agent_id; + spin_unlock(&agent_channel->lock); + + channel =3D get_channel_by_id(HYP_CHANNEL); + if ( !channel ) + { + printk(XENLOG_ERR + "scmi: Unable to get Hypervisor scmi channel for domain %d\= n", + d->domain_id); + return -EINVAL; + } + + hdr.id =3D SCMI_BASE_RESET_AGENT_CONFIGURATION; + hdr.type =3D 0; + hdr.protocol =3D SCMI_BASE_PROTOCOL; + + tx.flags =3D 0; + + ret =3D do_smc_xfer(channel, &hdr, &tx, sizeof(tx), &rx, sizeof(rx)); + if ( ret ) + return ret; + + ret =3D check_scmi_status(rx); + + return ret; +} + +static void scmi_domain_destroy(struct domain *d) +{ + struct scmi_channel *channel; + + if ( !d->arch.sci ) + return; + + channel =3D d->arch.sci; + spin_lock(&channel->lock); + + relinquish_scmi_channel(channel); + printk(XENLOG_DEBUG "scmi: Free domain %d\n", d->domain_id); + + d->arch.sci =3D NULL; + + unmap_memory_from_domain(d, channel->paddr, PAGE_SIZE); + spin_unlock(&channel->lock); + return; +} + +static bool scmi_handle_call(struct domain *d, void *args) +{ + bool res =3D false; + struct scmi_channel *agent_channel; + struct arm_smccc_res resp; + struct cpu_user_regs *regs =3D args; + + if ( !d->arch.sci ) + return false; + + agent_channel =3D d->arch.sci; + spin_lock(&agent_channel->lock); + + if ( agent_channel->func_id !=3D regs->x0 ) + { + printk(XENLOG_ERR "scmi: func_id mismatch, exiting\n"); + goto unlock; + } + + arm_smccc_smc(agent_channel->func_id, 0, 0, 0, 0, 0, 0, + agent_channel->chan_id, &resp); + + set_user_reg(regs, 0, resp.a0); + set_user_reg(regs, 1, resp.a1); + set_user_reg(regs, 2, resp.a2); + set_user_reg(regs, 3, resp.a3); + res =3D true; +unlock: + spin_unlock(&agent_channel->lock); + + return res; +} + +static int scmi_get_channel_paddr(void *scmi_ops, + struct xen_arch_domainconfig *config) +{ + struct scmi_channel *agent_channel =3D scmi_ops; + + if ( !agent_channel ) + return -EINVAL; + + config->sci_agent_paddr =3D agent_channel->paddr; + return 0; +} + +static const struct dt_device_match scmi_smc_match[] __initconst =3D +{ + DT_MATCH_SCMI_SMC, + { /* sentinel */ }, +}; + +static const struct sci_mediator_ops scmi_ops =3D +{ + .probe =3D scmi_probe, + .domain_init =3D scmi_domain_init, + .domain_destroy =3D scmi_domain_destroy, + .add_dt_device =3D scmi_add_dt_device, + .relinquish_resources =3D scmi_relinquish_resources, + .handle_call =3D scmi_handle_call, + .get_channel_info =3D scmi_get_channel_paddr +}; + +REGISTER_SCI_MEDIATOR(scmi_smc, "SCMI-SMC", XEN_DOMCTL_CONFIG_SCI_SCMI_SMC, + scmi_smc_match, &scmi_ops); + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */ diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h index 9180be5e86..a67237942d 100644 --- a/xen/include/public/arch-arm.h +++ b/xen/include/public/arch-arm.h @@ -315,6 +315,7 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t); #define XEN_DOMCTL_CONFIG_TEE_OPTEE 1 =20 #define XEN_DOMCTL_CONFIG_SCI_NONE 0 +#define XEN_DOMCTL_CONFIG_SCI_SCMI_SMC 1 =20 struct xen_arch_domainconfig { /* IN/OUT */ --=20 2.27.0 From nobody Wed May 1 23:23:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=epam.com); dmarc=pass(p=quarantine dis=none) header.from=epam.com ARC-Seal: i=2; a=rsa-sha256; t=1639474501; cv=pass; d=zohomail.com; s=zohoarc; b=WKPKcMKUtsqxWL2xpqEIgPZER0b+JpGKYpJDBCJgv7R5qu+Dh9pNHA1dJ0r9V20Yy/OD+rERVbJtrnP91zQxGQ5DBQ/0tMbdCNygvONZ/YFz3QjsJFWrioTEoziPZZCdVNNn4+5x1ke0a9vjxVwASqwiVQT0ya2JdT331DFMlTY= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639474501; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=iaUWZPBTg2O+gyl1uMnhO6Ep5oxml8YVCINnTiUgzaw=; b=Xx6w12ZLg3vwhOD3r0LsdYvh0St4T+leaajoka6xvp9FTXREDRTJX4INksUl7oiqlzy4M1WMiowIGdlnso1pjQxJra6ZWighWhQeHUh42oZMCA1yatIDBHh07WK7MYsmxx/z+1126fD8VQ5oexwHQEkZP9lgGLfUPdSn+PrL8io= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=epam.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 163947450135613.594482107108092; Tue, 14 Dec 2021 01:35:01 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.246484.425086 (Exim 4.92) (envelope-from ) id 1mx4Cm-0007NC-La; Tue, 14 Dec 2021 09:34:40 +0000 Received: by outflank-mailman (output) from mailman id 246484.425086; Tue, 14 Dec 2021 09:34:40 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mx4Cm-0007N5-HI; Tue, 14 Dec 2021 09:34:40 +0000 Received: by outflank-mailman (input) for mailman id 246484; Tue, 14 Dec 2021 09:34:39 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mx4Ck-0007JG-RD for xen-devel@lists.xenproject.org; Tue, 14 Dec 2021 09:34:39 +0000 Received: from mx0b-0039f301.pphosted.com (mx0b-0039f301.pphosted.com [148.163.137.242]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 32c13a6e-5cc0-11ec-85d3-df6b77346a89; Tue, 14 Dec 2021 10:28:30 +0100 (CET) Received: from pps.filterd (m0174682.ppops.net [127.0.0.1]) by mx0b-0039f301.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 1BE943EF004675; Tue, 14 Dec 2021 09:34:35 GMT Received: from eur05-db8-obe.outbound.protection.outlook.com (mail-db8eur05lp2107.outbound.protection.outlook.com [104.47.17.107]) by mx0b-0039f301.pphosted.com (PPS) with ESMTPS id 3cxraag3uw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 14 Dec 2021 09:34:34 +0000 Received: from PA4PR03MB7136.eurprd03.prod.outlook.com (2603:10a6:102:ea::23) by PA4PR03MB6976.eurprd03.prod.outlook.com (2603:10a6:102:e4::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Tue, 14 Dec 2021 09:34:28 +0000 Received: from PA4PR03MB7136.eurprd03.prod.outlook.com ([fe80::85d2:c8aa:2196:21c6]) by PA4PR03MB7136.eurprd03.prod.outlook.com ([fe80::85d2:c8aa:2196:21c6%9]) with mapi id 15.20.4778.018; Tue, 14 Dec 2021 09:34:28 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 32c13a6e-5cc0-11ec-85d3-df6b77346a89 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ioRt2ZPrDGCVT0oIn/POaFjHyH08hqjuqE8K7AQlE9ayLBu4LuBziJZz376LzDE8Jf/ONKzdiMIMZqaUCwPPe3KpaaowHxEyW/TwBmVzfNZECl+gGfxp25p7eUQsMV4DGWMkMOD62Y8o908hjWfBHArknZsY55aTqVxhOWBMOiia74m/3fLaLHpbcShE1MgqddUAPLtoSIPRytg2d4w0NqzWhPZ0HIP1f+UHmOqQZ2gBvz9SM1NUTtGnBsaOKQdicrdZLTQYYbqjDm6j2E1FXf6v87+uYMKJQ7ALvp/Bl7Nt1EljoNaT+KSXdWWMMdeGdG5HbBRaZAezQ2UZTG3nrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=iaUWZPBTg2O+gyl1uMnhO6Ep5oxml8YVCINnTiUgzaw=; b=dABaXNHdHUTNEz9oop758mpIX/ug6s88TrCMljKHqgOeyJagwmq0EiZu1okpBIsBQfgKcTB1sA2Ik+Gr2GFJ9ceB/fEXdB9ubPorsIZs78hpEhbvLkd1EF+fAXtZIws6NrN/Q5Ls1BlLyCjA6i8GJ1mAqRcB+WEEv6W+5nTfiJFoUms30IRkCXWtmAtitbuEVyNkvLIs6qzvfIf2dj0a/ugoH61MK/SENrwEcgHWStQI8PDSfSmrHRm4jClLvneyzEBimSWUPUK2IqM3UDNo4dcPkheRn86WdhvCihBKxLXfnCC0Z+toDrvAS8iZCJ2QZ49piq8PBXTKpqHap4K1Mg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=epam.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iaUWZPBTg2O+gyl1uMnhO6Ep5oxml8YVCINnTiUgzaw=; b=ADKHM96IC1fMqOM8lI/kVaRaXO7mlw5mSQfwMwdLQtvh86W/0dz3lasrfW6+lev+irLXGpGZIupnJUS+AsfS+WZGO1GDUBn0qV5hrvVaW07w/Fu1mWYWH8adH5t2WV2NE/XR73QlwjaDvPdJ2BkVyx/wnrc8Po1EKT8/tZTw39hEbyWF0H7lpmGOLgqNAidTua2zBg3ZiX0+8bG0vl8Hj20KDra/IUlWZpEFslP0Mao3PZsM8jH3gqfnXzEu3fXUwVFMAfbYsYfW9KSL4+TgCsjssQevvFbXBstA4+Fkui8POhRkEn55+Jkru9exjYR0h8/Z+1lSDEkHAaV33VvGZg== From: Oleksii Moisieiev To: "xen-devel@lists.xenproject.org" CC: Oleksii Moisieiev , Wei Liu , Anthony PERARD , Juergen Gross Subject: [RFC v1 4/5] tools/arm: add "scmi_smc" option to xl.cfg Thread-Topic: [RFC v1 4/5] tools/arm: add "scmi_smc" option to xl.cfg Thread-Index: AQHX8M3K+4k+NJRDpU6TSJ1TAn9Owg== Date: Tue, 14 Dec 2021 09:34:28 +0000 Message-ID: <7aa3e21a3285b3af92ad87a4b039b4bd7696ac88.1639472078.git.oleksii_moisieiev@epam.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 0f4502bb-2d5e-491a-a663-08d9bee4ed06 x-ms-traffictypediagnostic: PA4PR03MB6976:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6790; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: cIalWWULnWtDp2xml+AbZba8QPmRDeawiRzkuWRg1Ii115PWr3Cl85ZpuGwHFOOhslcqfAEupzuUG0WxWeOEzth2mmV0jo7jnBUtStORjVIGsMBly7bluZAZr7/6re0i02f5qpBxyHyug79rUAsaSDZHtnj7M3r8/jt0Nm2s8njNe1FhliMnahTD84mM4S+/MUqO/C2yUhxboTDg7xHg67CHixsjRybEEq25sp0vpzDOeyvKeI4Aw21aD6SjXBWrk/G1fLy6IzNh38rQYa1xMV+HIGNIcBNI41s9WY7bAMK5m7lhxKo3IlthLExLrLVuZR6NqA2JHP5JvAHoZzcbq7u643FwGsxqdikk1MnW2+2pFgzYBt78snO6IpoL1l/najT2esrg1aCQQaSeNSdSWPiEP3rYt98QXmWYMeDXK5JlA99yhgHdjyw2z+YCwQrBZjxx+PX9B+DJ7vsG9Hms6g19h9/Xnd0CpxXthTr5fn/19IoWqOg8zQOmHPpjWa5k0DtupRat3gbplqPm9Idw98CoKBmWIFIxB9AkyaizHH2+Y4Ieete6sIO/AwwnUzpN4eKk/9qwyq7WEbkh1kR88RcVjMB3H7vwFJiNH600BIIlC7NFax9Vd7T5OE6aSyntF/k7LMWpvGKAk2xrqonSu71L7AIWEUbiGswTCqJCMM1KBkt+ORgFJ8pXzAfx+nCxT8N6Hnep942uVTreprZ2fw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PA4PR03MB7136.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(66476007)(64756008)(66556008)(66946007)(26005)(66446008)(76116006)(5660300002)(91956017)(508600001)(86362001)(83380400001)(186003)(6916009)(4326008)(2906002)(6486002)(38070700005)(8936002)(2616005)(36756003)(71200400001)(8676002)(38100700002)(122000001)(6512007)(6506007)(316002)(54906003);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?eOxrMUCJPjffCraXnBT9TP1oAwa0JFYeXrCeaC+qkGIWuQrmsGKeQ1b7hT?= =?iso-8859-1?Q?6M1cJxCIFh//+WnE9T4oQBKLg+lyrDhNepW8KMugwFRtbQ0Mi/kr//ND/X?= =?iso-8859-1?Q?+zHvEEMehTXdXwPwCOTstxpI/7/Skd0C4wZIyxlfoE6vrP7/be1WpGn3OI?= =?iso-8859-1?Q?ngog3jnBONmPtW4vCDBHrkdDhRsw3lT0Zjz9i6I1Pv8Ti8knmQ88JOy43B?= =?iso-8859-1?Q?cHJBBBxXHGU1cpGNBWEmxkDQ7mVCv3XZ7DowVEdyrRwisp+4gitkdFuW3v?= =?iso-8859-1?Q?I74HSaz5mk1D0UNgZ1OgX78PjHv3SYyfj52d/a1aCG6FqqHypeOziSKAk3?= =?iso-8859-1?Q?pAha94+eFAXtS5kn4Oh9y456D4FqVpk+mexH6ZM5eflr0BdZFlNl2iunGX?= =?iso-8859-1?Q?8KSo/Xz/vBEeutdUq9BcwZY2E4kEmxBMy2AJvWF974e+GcRmQ86p1GbCBQ?= =?iso-8859-1?Q?bL9CgoF8PkfwJ753pjUWaLw7vKt41ubkzHQ87KXY15wvJlTuLxRjJuYTDa?= =?iso-8859-1?Q?7TCV4vTVAB+VtfLHI8eOPIhEMXoLjTraYhqY2NVdv/5HfiiKJwBxawiGja?= =?iso-8859-1?Q?PoLSxZk68BFYEubxrRivjddyQD3KOm2Mldkt/Lfl+pPxSDTvjWq+o+KcdT?= =?iso-8859-1?Q?lTM2WaYv6n9Ve9Pn9Kw4lixebyV2LWXVJmYooTd6k7zci/nY4IwgmNjxaV?= =?iso-8859-1?Q?TTly39djEErUmAqq+dHethEU+B3iI9d7jcrpvgf6PxJX+ikye0bPqvwYvH?= =?iso-8859-1?Q?mEkoqEy6kT8wfa3h8R2WEmHYWRKlAm+HoIKq/BAUGcxMWVDxpK8gNFR/D6?= =?iso-8859-1?Q?G21WsDeGYH/RM8Fg+kTxJxs3+4E3BeMD7pEf2IcUCZxT5QR3Yqj02+U8IO?= =?iso-8859-1?Q?TwrZwzmNsSVJM4XmUWwUjqYRv+AKd+Io03ZvnyxOImOHKRS1KZnJ/PVyk1?= =?iso-8859-1?Q?42FT8oNi9vgdi0vMVnP96mX3lbFijcWWh4mbgHCZ+wkqNTFF0oqu7BHr9E?= =?iso-8859-1?Q?380Px/2AU6HJlK/TTZ9f+bgAdBmXYYOV6MJAyjFco6BiE0sda1Ev63Dnv9?= =?iso-8859-1?Q?eQ2/WpVvY5hQGaImXX5WBu04z4wiv17rLllJzeDhmhOnL4FE/NvdouMPBD?= =?iso-8859-1?Q?Q7gxpTrvdi1Ae7ceYuepxZs4e2+6u4FJ26fF5QYNS6dNelwyiKpvgXaBFM?= =?iso-8859-1?Q?xd1mTwxA5/q4qSozn9WE/nSzFBugmvEcscZxx6O/IO3NDArrPgctZRhI6K?= =?iso-8859-1?Q?kRA7vQw2C82Az3jBjDEbIbz+37Xxe/R+wyR177yj7qPWK0oYByz0Mt15vn?= =?iso-8859-1?Q?UR3Q3irPR54M5JvCfX2U7GohwXz6UUj+AgzrKF+vNRHkSShL3O3nUqUuN8?= =?iso-8859-1?Q?G8J6HdicUHNTfA+RfGM1zHGKnP4QXS5xmmojJjJ2/koES02VHlobn6ya7M?= =?iso-8859-1?Q?JjpE8iHCvlkkuS8sjQ88pTdyXq+QZWOeNaF84zPDBlUB+Tqr/Hm9Ir0MeU?= =?iso-8859-1?Q?sn8/+bPVPESCWuIlXzNENJLp7Rsu9ybictygrivlcHptBhUR/6p9GeJ8dJ?= =?iso-8859-1?Q?0QB2Gtudj/wTjrtUcodjgYluf74De1g0SdO8Nhjhmrf9ILQtYSTmfqwI/S?= =?iso-8859-1?Q?T8gqVJ2Rq+XTaHXeZUQHX8am8wFVxkDH1m04K67215K7v7NR3A7IX1qdT5?= =?iso-8859-1?Q?WyLe8eE4K6FzPcSTB1pev8VpCD5AjZyPqR3P7YMv8tk1xt3an0DBcLg5GI?= =?iso-8859-1?Q?fqJj458lzwxCZcJji2E6/IECk=3D?= Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: epam.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PA4PR03MB7136.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0f4502bb-2d5e-491a-a663-08d9bee4ed06 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Dec 2021 09:34:28.7467 (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: r7YxAtrBr9WWk+vi/f6p0876oeSKYUkkyMVot8BKyQm4wFjFqtC+Wd10LtwjYqKSMEMhAOe1rUOCFOL8THi6VPguFrXzB6lcx54nNaKwSKc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR03MB6976 X-Proofpoint-ORIG-GUID: R9AhTlzDXLwOEHHLJle-r0h0shZq5sZ4 X-Proofpoint-GUID: R9AhTlzDXLwOEHHLJle-r0h0shZq5sZ4 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2021-12-14_05,2021-12-13_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 mlxscore=0 bulkscore=0 malwarescore=0 clxscore=1015 lowpriorityscore=0 phishscore=0 priorityscore=1501 suspectscore=0 mlxlogscore=999 spamscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2112140054 X-ZohoMail-DKIM: pass (identity @epam.com) X-ZM-MESSAGEID: 1639474502590100004 Content-Type: text/plain; charset="utf-8" This enumeration sets SCI type for the domain. Currently there is two possible options: either 'none' or 'scmi_smc'. 'none' is the default value and it disables SCI support at all. 'scmi_smc' enables access to the Firmware from the domains using SCMI protocol and SMC as transport. Signed-off-by: Oleksii Moisieiev --- docs/man/xl.cfg.5.pod.in | 22 ++++++++++++++++++++++ tools/include/libxl.h | 5 +++++ tools/libs/light/libxl_types.idl | 6 ++++++ tools/xl/xl_parse.c | 9 +++++++++ 4 files changed, 42 insertions(+) diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in index b98d161398..92d0593875 100644 --- a/docs/man/xl.cfg.5.pod.in +++ b/docs/man/xl.cfg.5.pod.in @@ -1614,6 +1614,28 @@ This feature is a B. =20 =3Dback =20 +=3Ditem B + +B Set SCI type for the guest. SCI is System Control Protocol - +allows domain to manage various functions that are provided by HW platform. + +=3Dover 4 + +=3Ditem B + +Don't allow guest to use SCI if present on the platform. This is the defau= lt +value. + +=3Ditem B + +Enables SCMI-SMC support for the guest. SCMI is System Control Management +Inferface - allows domain to manage various functions that are provided by= HW +platform, such as clocks, resets and power-domains. Xen will mediate acces= s to +clocks, power-domains and resets between Domains and ATF. Disabled by defa= ult. +SMC is used as transport. + +=3Dback + =3Dback =20 =3Dhead2 Paravirtualised (PV) Guest Specific Options diff --git a/tools/include/libxl.h b/tools/include/libxl.h index 2bbbd21f0b..30e5aee119 100644 --- a/tools/include/libxl.h +++ b/tools/include/libxl.h @@ -278,6 +278,11 @@ */ #define LIBXL_HAVE_BUILDINFO_ARCH_ARM_TEE 1 =20 +/* + * libxl_domain_build_info has the arch_arm.sci field. + */ +#define LIBXL_HAVE_BUILDINFO_ARCH_ARM_SCI 1 + /* * LIBXL_HAVE_SOFT_RESET indicates that libxl supports performing * 'soft reset' for domains and there is 'soft_reset' shutdown reason diff --git a/tools/libs/light/libxl_types.idl b/tools/libs/light/libxl_type= s.idl index 2a42da2f7d..9067b509f4 100644 --- a/tools/libs/light/libxl_types.idl +++ b/tools/libs/light/libxl_types.idl @@ -480,6 +480,11 @@ libxl_tee_type =3D Enumeration("tee_type", [ (1, "optee") ], init_val =3D "LIBXL_TEE_TYPE_NONE") =20 +libxl_sci_type =3D Enumeration("sci_type", [ + (0, "none"), + (1, "scmi_smc") + ], init_val =3D "LIBXL_SCI_TYPE_NONE") + libxl_rdm_reserve =3D Struct("rdm_reserve", [ ("strategy", libxl_rdm_reserve_strategy), ("policy", libxl_rdm_reserve_policy), @@ -564,6 +569,7 @@ libxl_domain_build_info =3D Struct("domain_build_info",[ ("apic", libxl_defbool), ("dm_restrict", libxl_defbool), ("tee", libxl_tee_type), + ("sci", libxl_sci_type), ("u", KeyedUnion(None, libxl_domain_type, "type", [("hvm", Struct(None, [("firmware", string), ("bios", libxl_bios_typ= e), diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c index 117fcdcb2b..c37bf6298b 100644 --- a/tools/xl/xl_parse.c +++ b/tools/xl/xl_parse.c @@ -2747,6 +2747,15 @@ skip_usbdev: } } =20 + if (!xlu_cfg_get_string (config, "sci", &buf, 1)) { + e =3D libxl_sci_type_from_string(buf, &b_info->sci); + if (e) { + fprintf(stderr, + "Unknown sci \"%s\" specified\n", buf); + exit(-ERROR_FAIL); + } + } + parse_vkb_list(config, d_config); =20 xlu_cfg_get_defbool(config, "xend_suspend_evtchn_compat", --=20 2.27.0 From nobody Wed May 1 23:23:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=epam.com); dmarc=pass(p=quarantine dis=none) header.from=epam.com ARC-Seal: i=2; a=rsa-sha256; t=1639474507; cv=pass; d=zohomail.com; s=zohoarc; b=M+MhMvNCZ4phWoJH9u07uG6L41PnSZjwyuCHM0Vg8N3lNOOPDvVimOb3oogeXROzC/4YbDxx5feshvG28Ft54ljMMuAdNNPY1Vura95pzwjkBL2towPyR/8vgxOacOU7LRS/DNVkvoVQbo4/quU2NTrmYZ3NBU9TY0ZZH6POzFQ= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639474507; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=NuMyjEbSpSIao6BH2oZdWuIEjdeXmzyuL/4oyil7Wmc=; b=Ff80qrbeyFRxPa8kWlbqpaAi7z53ScniNXsQmisFjxMZ1mpFOPVDRsecfhmaYs9zNIwi9OA64B53BSCNV2RIfKQA8m7q/+lhWTbAbAd1gLJSoyrAeJB4q/qXtFEcpXZ0Ovsdlt/WgoLxTS/HBEHXBz/cbdHpkNLrtOqWxhqBLOI= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=epam.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1639474507495258.47885465285435; Tue, 14 Dec 2021 01:35:07 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.246489.425134 (Exim 4.92) (envelope-from ) id 1mx4Cr-000089-Oh; Tue, 14 Dec 2021 09:34:45 +0000 Received: by outflank-mailman (output) from mailman id 246489.425134; Tue, 14 Dec 2021 09:34:45 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mx4Cr-00006v-KT; Tue, 14 Dec 2021 09:34:45 +0000 Received: by outflank-mailman (input) for mailman id 246489; Tue, 14 Dec 2021 09:34:43 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mx4Cp-0007JG-CQ for xen-devel@lists.xenproject.org; Tue, 14 Dec 2021 09:34:43 +0000 Received: from mx0b-0039f301.pphosted.com (mx0b-0039f301.pphosted.com [148.163.137.242]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 35c0b5fa-5cc0-11ec-85d3-df6b77346a89; Tue, 14 Dec 2021 10:28:35 +0100 (CET) Received: from pps.filterd (m0174682.ppops.net [127.0.0.1]) by mx0b-0039f301.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 1BE943EJ004675; Tue, 14 Dec 2021 09:34:37 GMT Received: from eur05-db8-obe.outbound.protection.outlook.com (mail-db8eur05lp2107.outbound.protection.outlook.com [104.47.17.107]) by mx0b-0039f301.pphosted.com (PPS) with ESMTPS id 3cxraag3uw-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 14 Dec 2021 09:34:37 +0000 Received: from PA4PR03MB7136.eurprd03.prod.outlook.com (2603:10a6:102:ea::23) by PA4PR03MB6976.eurprd03.prod.outlook.com (2603:10a6:102:e4::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Tue, 14 Dec 2021 09:34:30 +0000 Received: from PA4PR03MB7136.eurprd03.prod.outlook.com ([fe80::85d2:c8aa:2196:21c6]) by PA4PR03MB7136.eurprd03.prod.outlook.com ([fe80::85d2:c8aa:2196:21c6%9]) with mapi id 15.20.4778.018; Tue, 14 Dec 2021 09:34:30 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 35c0b5fa-5cc0-11ec-85d3-df6b77346a89 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m48qyoYx/iKZFtFXfcW1CLJyzLSNIh10N2U8F/k9zetZl76mta/xpNhTPtUUvUnW/UM1bm0AtCecbJFMfHYPYl0LnNXU1kWOhDF+CzwQIu3I8EQi0GZcUNSFQr9GHB7qogksEZH+bMkuuf98UkxBlHFPU/NmMeo393wy+cyMx0AmDXcvi7rjq4yjrwmxrKlGwkfBgXcsH8/dB5cxZ9R8tFRTMeN5LTHzON1+v+0YpBoLWiINEy5+yi9rLUO1S6S7jG2Z2ZokwjytCFiASttz5tRkpa+dOn0610SRiz7aWV1DIzRoe49TS5eVl7AKjORGMveixsoNpjOcInSDySo3oQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=NuMyjEbSpSIao6BH2oZdWuIEjdeXmzyuL/4oyil7Wmc=; b=NvSp+ny15CW+7+rDnu9OWE36EmkjdhLCqGkUvf3TCswiP4+yXAE7l+JWNYQxc3sBVMCpnMKcCLFDPIrcHi257/7MyuQjtMiDUvLU4YLNshkDU0//LAlilzUvY5z1tGPFavAbelF1snAe6hkhT37tsBYnxq3hXoXFn+O0xv+b3Mldq5BhUwq/lebVA8kF8/G2WNNl5FnoonPqbFKPFXHtJd/nsuKaiR0RRs8J0AYpdhcQB9piHDsPNxER94n6ySmMde/g2lZiQDVXHkdxJtXx7QrZiaD5dw6B6semlaneXCUckb/cKNHhKl2F4fzlPSyefihc6eqOn75C0TvSlb6eJg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=epam.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NuMyjEbSpSIao6BH2oZdWuIEjdeXmzyuL/4oyil7Wmc=; b=q6W53TiSH1KhwtgXlL9zuELN3xKU1FuvUx3zd4ah+8b+1FEYBquF3Jidii0wt7atZ8we6YSh1mGudUfqmh802rBc9qdLO2512AjDKg5CX/a2k3PTbzs6t/+DxV+JjENvd0LW6ToTWBNYQL1y/eiRkuUbHg2jiaeKqnJdrB5jM+FrsmxsW04GUTWelxloUoFE7YhMISmGKpbcWGZibfHSABu5lX89HYrzWEvrtG7VOuZyaVlilSMBYwxREXACmlA3wk+4YhZMK2RX3P+dzcEmHDLMjH28ZNpWsbvkh52+CRlUS8F8F7gx0J7FJz25wfZtydT6akVHvLY75w+iPJJgwA== From: Oleksii Moisieiev To: "xen-devel@lists.xenproject.org" CC: Oleksii Moisieiev , Wei Liu , Juergen Gross , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini , Anthony PERARD , Volodymyr Babchuk , Bertrand Marquis Subject: [RFC v1 5/5] xen/arm: add SCI mediator support for DomUs Thread-Topic: [RFC v1 5/5] xen/arm: add SCI mediator support for DomUs Thread-Index: AQHX8M3LpzWz4l8PQUiIA2nAUV0H+g== Date: Tue, 14 Dec 2021 09:34:30 +0000 Message-ID: <4469cdf05051bd691a8adff2657d27f6a5f0cefb.1639472078.git.oleksii_moisieiev@epam.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: d782d05e-9d15-4391-20f1-08d9bee4ee01 x-ms-traffictypediagnostic: PA4PR03MB6976:EE_ x-ld-processed: b41b72d0-4e9f-4c26-8a69-f949f367c91d,ExtAddr x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:538; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: LXqwGYCnlvewmBDk77E+vGdGvpUzpOZ9C/YJ1AyI9p4PDaGITyjsMR+i1egcyXDuV6hRpM+Ui9Vesq6I0logEFjbCpFWsN2DHk5tdT/fW/sZ9ctGLPKG8ObJXsyfwuG2whxMhpxgJTp6Q00AkLwuEhW3P+rRFbvDH5iqVJDVNbKal67Fl7Y+8C7VnmpDyQQmWgHy6hSth8FH8LFiHb5lJFvVKSueH7Z94VeaZR3SbkHj2EjU4sDw9wuVN2X+pVUEq61wOLfC2LZtg5NWSAkI1ZriQcNaNjCTppRKbrXhVYQ6a0mb0SNQwWY4vh1SAqnIbg8aD0RqJHQ9kbUj0UkNOOPkpu/x/y681OMFow1rp5U1oPj/dCXICi2ScNfS3uCf9SmVr6H0fF3xlNuadXt6DsAm5HC89QfQNAsE7QnRlqkpzq6TzlgRTONEghEBkqsS92yD/c1+PjVUVz14BVFq0P32bFrdViL4OgleGM7hkFDq0hgfTKJgF0h3NXyakwpdaYUGF+K0Ld5e4igGAbT8BT3zITZnpXJ8oetlrQ7epXsWTB78SmKWt9lR01HXN+o+IFLyZLIlyWfmqrwM2foazkcaY0iktB+V9L3J7sLxlSQm+11vj1LqP9+Lx5sj19w0nX7vIoUHNNPc4nGpnEmb80cd7jJgwXNbL2fc+KywWNOVfor71mjfBl/0we3Y3LmuXjx/xJ31auT0v6/++Zpg+w== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PA4PR03MB7136.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(66476007)(64756008)(66556008)(66946007)(26005)(66446008)(76116006)(5660300002)(91956017)(508600001)(86362001)(83380400001)(186003)(30864003)(7416002)(6916009)(4326008)(2906002)(6486002)(38070700005)(8936002)(2616005)(36756003)(71200400001)(8676002)(38100700002)(122000001)(6512007)(6506007)(316002)(54906003);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?dUH0YfGfqSD0cghep/a3Yx/g38c+7tCWraVMq6y5vOSalZXuoa7MPNVTCu?= =?iso-8859-1?Q?fV41dQRKMDQEuoIaXP7sO2Vt3N/DgxF5KRmA/x9Kl9gz2uDPeRxCAiw2XG?= =?iso-8859-1?Q?wmDRzr38TL/Np37HcwzOxOW0xsqk5ckIgoGFJogXAHuMjp3ZMQJVjBSbt2?= =?iso-8859-1?Q?WEbxB+Cv4FALZaPDCN/03VEQfwRVzjAjn0xBgi6hagreJ9LSaTrIFC4c9P?= =?iso-8859-1?Q?poNcqZoeqzy8ZxWhhrAfnkcgmNFiqgiNgtUs/+izwbhdcp+jRF6RDxfhrS?= =?iso-8859-1?Q?TQMCDyO08tn4zjwCXUlGpxRIJ5Ly3pamSOK9JdGMwOsr/z6ji39F6QGUU8?= =?iso-8859-1?Q?4xdf/E3lD5HDOKLCEUrUpbACTlC57fKIct2o6EVJzt0BQ9FWc+lLJKstYk?= =?iso-8859-1?Q?WW9mlUKsKtZ2UJxWmnHcs1sOWc7sdYuzogHKEsyphpVTW3ijugQcEiJR0D?= =?iso-8859-1?Q?z9LdBKp+0tkJeA72Q8GyzCSDrb562/bW4KfeBnbZSnYmCYOIfFddw0cb1x?= =?iso-8859-1?Q?6eQ3uciIAxh44P6Kk4EDqohq5F2tMqAbjeLW/v6gYSOtamDpS96qSyojo6?= =?iso-8859-1?Q?GnP2pwsLgOe3JqptDQhxoAjn+hT/YNm6csmJB2O2W7YqPWWvRMAOTFrJjs?= =?iso-8859-1?Q?+uoIBtYII7vM8lYmWK3ulz1LWSZwQVeRB0Md8jW3G/7CYlPdfbbSc9YeD5?= =?iso-8859-1?Q?4iLZlBbgye6zqySXactSc7Vd0WLO3/9y8gDfG/tQwmxbY4Nn9gp5FbrDD3?= =?iso-8859-1?Q?lsLvQT+biZH/sedYdYV5+4zjXV9p8pbD1sDlo8XZ+KnO1DtWC8nrbiSomK?= =?iso-8859-1?Q?7y9pGjuhlKpFIkuaqdYYDECq1P6YwsZDASPaLIVYYlm8Hnj0WI31Jsisd5?= =?iso-8859-1?Q?WN7y/RZKczxJl2Iw40Fa72nFioMeVIaNUGCy2ZWVFzDlIpJjRFnGU6ZUFF?= =?iso-8859-1?Q?wBP3ysGFTfSPgyD/cjBti3IdDkJycUnF524HNPq12iKcZvOU9lu8t5bply?= =?iso-8859-1?Q?OkFTcwKUR3d3cyjAGWI7qmzK3dQg00fKZMvXbwzdhAcDRJldCsPiM7p85F?= =?iso-8859-1?Q?v32ktvnR40cwAV1g3EnHB2/se89V4PzGIlIJ14DB2hNNohLN785y8PqD/N?= =?iso-8859-1?Q?/Tr/IcM7n0tuRWSIobZvzdSryVjZxI/CvVfEQ/YJc/TwxGZe83ZcqbLpLn?= =?iso-8859-1?Q?ZDVBoAHUxia1c/CQwzCDk/QWel1QxQi7TPXSwBrFc7tUoxRqsnU9fw4sTd?= =?iso-8859-1?Q?+5DlZ4XX+3Y2YUyAmSiZsS7QXLLXDlpfZa3L10Vip1rVLBRYZdHTJnMQ3N?= =?iso-8859-1?Q?9Tzei7+Hq1ICdGq0A8XJjUoQgQ0TdDisQyShdmvbz+qcN/eMAfgjnZd7Rq?= =?iso-8859-1?Q?5qFsbLkQ6TXdkkj/24wtPvN3A5VSzZ5+YjMFQ5hEzo/9kbNcdnpY2HoD8+?= =?iso-8859-1?Q?ynKnWwKWwkng/wjwy1hsjxEo1BbcWxBKI8MGxwsRM5ctTMlEGXr0gJjSca?= =?iso-8859-1?Q?CG5QW5VTN30DYPV8gT7grbBim9iwsSss98nkdiGGPHEFvEgVxjrczIXiVp?= =?iso-8859-1?Q?dJeoMa5ResJL1Lis5SlcnTNr6FsWNWAAxeRncGMy3fi/G/iA0vZGL4GjTG?= =?iso-8859-1?Q?2XpRsCiPgLOxhvm7FQqFFUfs9VN2empMe7H7DWyxLKJr8ruNOM0d5O+NhY?= =?iso-8859-1?Q?nNb8NVPHfQtIbddH6JLWiMurq8H3CHIo38t92LLFGibbJUMazsfsaJKPjd?= =?iso-8859-1?Q?mnUYjVZrmz50LRJfiJg0GRmaU=3D?= Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: epam.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PA4PR03MB7136.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d782d05e-9d15-4391-20f1-08d9bee4ee01 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Dec 2021 09:34:30.3570 (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: HtACawbFOb6DEVtIJacr+L0gGTFKQD12nO1+eYoQu5syS2t66Y4N8xRYYY2lV0eFlZ1b/syLOxZkOpPuL79k9WILjhr19RroMqKGW2jJL5A= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR03MB6976 X-Proofpoint-ORIG-GUID: CFOXjYvmOTrU-6BM0q3KoB0xKMi33wW- X-Proofpoint-GUID: CFOXjYvmOTrU-6BM0q3KoB0xKMi33wW- X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2021-12-14_05,2021-12-13_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 mlxscore=0 bulkscore=0 malwarescore=0 clxscore=1015 lowpriorityscore=0 phishscore=0 priorityscore=1501 suspectscore=0 mlxlogscore=999 spamscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2112140054 X-ZohoMail-DKIM: pass (identity @epam.com) X-ZM-MESSAGEID: 1639474509057100004 Content-Type: text/plain; charset="utf-8" Integration of the SCMI mediator with xen libs: - add hypercalls to aquire SCI channel and set device permissions for DomUs; - add SCMI_SMC nodes to DomUs device-tree based on partial device-tree; - SCI requests redirection from DomUs to Firmware. Signed-off-by: Oleksii Moisieiev --- tools/include/xenctrl.h | 3 + tools/include/xenguest.h | 2 + tools/libs/ctrl/xc_domain.c | 23 ++++++ tools/libs/guest/xg_dom_arm.c | 5 +- tools/libs/light/libxl_arm.c | 122 +++++++++++++++++++++++++++--- tools/libs/light/libxl_create.c | 54 ++++++++++++- tools/libs/light/libxl_dom.c | 1 + tools/libs/light/libxl_internal.h | 4 + xen/arch/arm/domctl.c | 15 ++++ xen/include/public/domctl.h | 9 +++ 10 files changed, 223 insertions(+), 15 deletions(-) diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h index 07b96e6671..cdd14f465f 100644 --- a/tools/include/xenctrl.h +++ b/tools/include/xenctrl.h @@ -1238,6 +1238,9 @@ int xc_domain_getvnuma(xc_interface *xch, int xc_domain_soft_reset(xc_interface *xch, uint32_t domid); =20 +int xc_domain_add_sci_device(xc_interface *xch, + uint32_t domid, char *path); + #if defined(__i386__) || defined(__x86_64__) /* * PC BIOS standard E820 types and structure. diff --git a/tools/include/xenguest.h b/tools/include/xenguest.h index 61d0a82f48..35c611ac73 100644 --- a/tools/include/xenguest.h +++ b/tools/include/xenguest.h @@ -242,6 +242,8 @@ struct xc_dom_image { =20 /* Number of vCPUs */ unsigned int max_vcpus; + + xen_pfn_t sci_shmem_gfn; }; =20 /* --- arch specific hooks ----------------------------------------- */ diff --git a/tools/libs/ctrl/xc_domain.c b/tools/libs/ctrl/xc_domain.c index b155d6afd2..07bb390e17 100644 --- a/tools/libs/ctrl/xc_domain.c +++ b/tools/libs/ctrl/xc_domain.c @@ -2206,6 +2206,29 @@ int xc_domain_soft_reset(xc_interface *xch, domctl.domain =3D domid; return do_domctl(xch, &domctl); } + +int xc_domain_add_sci_device(xc_interface *xch, + uint32_t domid, char *path) +{ + size_t size =3D strlen(path); + int rc; + DECLARE_DOMCTL; + DECLARE_HYPERCALL_BOUNCE(path, size, XC_HYPERCALL_BUFFER_BOUNCE_IN); + + if ( xc_hypercall_bounce_pre(xch, path) ) + return -1; + + domctl.cmd =3D XEN_DOMCTL_add_sci_device; + domctl.domain =3D domid; + domctl.u.sci_device_op.size =3D size; + set_xen_guest_handle(domctl.u.sci_device_op.path, path); + rc =3D do_domctl(xch, &domctl); + + xc_hypercall_bounce_post(xch, path); + + return rc; +} + /* * Local variables: * mode: C diff --git a/tools/libs/guest/xg_dom_arm.c b/tools/libs/guest/xg_dom_arm.c index 5e3b76355e..368a670c46 100644 --- a/tools/libs/guest/xg_dom_arm.c +++ b/tools/libs/guest/xg_dom_arm.c @@ -25,11 +25,12 @@ =20 #include "xg_private.h" =20 -#define NR_MAGIC_PAGES 4 +#define NR_MAGIC_PAGES 5 #define CONSOLE_PFN_OFFSET 0 #define XENSTORE_PFN_OFFSET 1 #define MEMACCESS_PFN_OFFSET 2 #define VUART_PFN_OFFSET 3 +#define SCI_SHMEM_OFFSET 4 =20 #define LPAE_SHIFT 9 =20 @@ -69,11 +70,13 @@ static int alloc_magic_pages(struct xc_dom_image *dom) dom->console_pfn =3D base + CONSOLE_PFN_OFFSET; dom->xenstore_pfn =3D base + XENSTORE_PFN_OFFSET; dom->vuart_gfn =3D base + VUART_PFN_OFFSET; + dom->sci_shmem_gfn =3D base + SCI_SHMEM_OFFSET; =20 xc_clear_domain_page(dom->xch, dom->guest_domid, dom->console_pfn); xc_clear_domain_page(dom->xch, dom->guest_domid, dom->xenstore_pfn); xc_clear_domain_page(dom->xch, dom->guest_domid, base + MEMACCESS_PFN_= OFFSET); xc_clear_domain_page(dom->xch, dom->guest_domid, dom->vuart_gfn); + xc_clear_domain_page(dom->xch, dom->guest_domid, dom->sci_shmem_gfn); =20 xc_hvm_param_set(dom->xch, dom->guest_domid, HVM_PARAM_CONSOLE_PFN, dom->console_pfn); diff --git a/tools/libs/light/libxl_arm.c b/tools/libs/light/libxl_arm.c index eef1de0939..73ef591822 100644 --- a/tools/libs/light/libxl_arm.c +++ b/tools/libs/light/libxl_arm.c @@ -8,6 +8,8 @@ #include #include =20 +#define SCMI_NODE_PATH "/firmware/scmi" + static const char *gicv_to_string(libxl_gic_version gic_version) { switch (gic_version) { @@ -101,6 +103,19 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc, return ERROR_FAIL; } =20 + switch (d_config->b_info.sci) { + case LIBXL_SCI_TYPE_NONE: + config->arch.sci_type =3D XEN_DOMCTL_CONFIG_SCI_NONE; + break; + case LIBXL_SCI_TYPE_SCMI_SMC: + config->arch.sci_type =3D XEN_DOMCTL_CONFIG_SCI_SCMI_SMC; + break; + default: + LOG(ERROR, "Unknown SCI type %d", + d_config->b_info.sci); + return ERROR_FAIL; + } + return 0; } =20 @@ -122,6 +137,7 @@ int libxl__arch_domain_save_config(libxl__gc *gc, } =20 state->clock_frequency =3D config->arch.clock_frequency; + state->sci_agent_paddr =3D config->arch.sci_agent_paddr; =20 return 0; } @@ -502,9 +518,6 @@ static int make_optee_node(libxl__gc *gc, void *fdt) int res; LOG(DEBUG, "Creating OP-TEE node in dtb"); =20 - res =3D fdt_begin_node(fdt, "firmware"); - if (res) return res; - res =3D fdt_begin_node(fdt, "optee"); if (res) return res; =20 @@ -517,9 +530,6 @@ static int make_optee_node(libxl__gc *gc, void *fdt) res =3D fdt_end_node(fdt); if (res) return res; =20 - res =3D fdt_end_node(fdt); - if (res) return res; - return 0; } =20 @@ -902,10 +912,9 @@ static int copy_node(libxl__gc *gc, void *fdt, void *p= fdt, return 0; } =20 -static int copy_node_by_path(libxl__gc *gc, const char *path, - void *fdt, void *pfdt) +static int get_path_nodeoff(const char *path, void *pfdt) { - int nodeoff, r; + int nodeoff; const char *name =3D strrchr(path, '/'); =20 if (!name) @@ -925,12 +934,101 @@ static int copy_node_by_path(libxl__gc *gc, const ch= ar *path, if (strcmp(fdt_get_name(pfdt, nodeoff, NULL), name)) return -FDT_ERR_NOTFOUND; =20 + return nodeoff; +} + +static int copy_node_by_path(libxl__gc *gc, const char *path, + void *fdt, void *pfdt) +{ + int nodeoff, r; + + nodeoff =3D get_path_nodeoff(path, pfdt); + if (nodeoff < 0) + return nodeoff; + r =3D copy_node(gc, fdt, pfdt, nodeoff, 0); if (r) return r; =20 return 0; } =20 +static int get_node_phandle(const char *path, void *pfdt, uint32_t *phandl= e) +{ + int nodeoff; + const char *name =3D strrchr(path, '/'); + + if (!name) + return -FDT_ERR_INTERNAL; + + name++; + nodeoff =3D fdt_path_offset(pfdt, path); + if (nodeoff < 0) + return nodeoff; + + *phandle =3D fdt_get_phandle(pfdt, nodeoff); + return 0; +} + +static int make_scmi_shmem_node(libxl__gc *gc, void *fdt, void *pfdt, + struct xc_dom_image *dom) +{ + int res; + char buf[64]; + uint32_t phandle =3D 0; + + res =3D get_node_phandle("/scp-shmem", pfdt, &phandle); + if (res) return res; + + snprintf(buf, sizeof(buf), "scp-shmem@%lx", + dom->sci_shmem_gfn << XC_PAGE_SHIFT); + res =3D fdt_begin_node(fdt, buf); + if (res) return res; + + res =3D fdt_property_compat(gc, fdt, 1, "arm,scmi-shmem"); + if (res) return res; + + res =3D fdt_property_regs(gc, fdt, GUEST_ROOT_ADDRESS_CELLS, + GUEST_ROOT_SIZE_CELLS, 1, + dom->sci_shmem_gfn << XC_PAGE_SHIFT, XC_PAGE_SHIFT); + if (res) return res; + + LOG(DEBUG, "scmi: setting phandle =3D %u\n", phandle); + res =3D fdt_property_cell(fdt, "phandle", phandle); + if (res) return res; + + res =3D fdt_end_node(fdt); + if (res) return res; + + return 0; +} + +static int make_firmware_node(libxl__gc *gc, void *fdt, void *pfdt, int te= e, + int sci) +{ + int res; + + if ((tee !=3D LIBXL_TEE_TYPE_OPTEE) && (sci !=3D LIBXL_SCI_TYPE_NONE)) + return 0; + + res =3D fdt_begin_node(fdt, "firmware"); + if (res) return res; + + if (tee =3D=3D LIBXL_TEE_TYPE_OPTEE) { + res =3D make_optee_node(gc, fdt); + if (res) return res; + } + + if (sci =3D=3D LIBXL_SCI_TYPE_SCMI_SMC) { + res =3D copy_node_by_path(gc, SCMI_NODE_PATH, fdt, pfdt); + if (res) return res; + } + + res =3D fdt_end_node(fdt); + if (res) return res; + + return 0; +} + /* * The partial device tree is not copied entirely. Only the relevant bits = are * copied to the guest device tree: @@ -1088,8 +1186,10 @@ next_resize: if (info->arch_arm.vuart =3D=3D LIBXL_VUART_TYPE_SBSA_UART) FDT( make_vpl011_uart_node(gc, fdt, ainfo, dom) ); =20 - if (info->tee =3D=3D LIBXL_TEE_TYPE_OPTEE) - FDT( make_optee_node(gc, fdt) ); + FDT( make_firmware_node(gc, fdt, pfdt, info->tee, info->sci) ); + + if (info->sci =3D=3D LIBXL_SCI_TYPE_SCMI_SMC) + FDT( make_scmi_shmem_node(gc, fdt, pfdt, dom) ); =20 if (d_config->num_pcidevs) FDT( make_vpci_node(gc, fdt, ainfo, dom) ); diff --git a/tools/libs/light/libxl_create.c b/tools/libs/light/libxl_creat= e.c index dcd09d32ba..c7372fd344 100644 --- a/tools/libs/light/libxl_create.c +++ b/tools/libs/light/libxl_create.c @@ -596,6 +596,37 @@ out: return ret; } =20 +static int map_sci_page(libxl__gc *gc, uint32_t domid, uint64_t paddr, + uint64_t guest_addr) +{ + int ret; + uint64_t _paddr_pfn =3D paddr >> XC_PAGE_SHIFT; + uint64_t _guest_pfn =3D guest_addr >> XC_PAGE_SHIFT; + + LOG(DEBUG, "iomem %"PRIx64, _paddr_pfn); + + ret =3D xc_domain_iomem_permission(CTX->xch, domid, _paddr_pfn, 1, 1); + if (ret < 0) { + LOG(ERROR, + "failed give domain access to iomem page %"PRIx64, + _paddr_pfn); + return ret; + } + + ret =3D xc_domain_memory_mapping(CTX->xch, domid, + _guest_pfn, _paddr_pfn, + 1, 1); + if (ret < 0) { + LOG(ERROR, + "failed to map to domain iomem page %"PRIx64 + " to guest address %"PRIx64, + _paddr_pfn, _guest_pfn); + return ret; + } + + return 0; +} + int libxl__domain_make(libxl__gc *gc, libxl_domain_config *d_config, libxl__domain_build_state *state, uint32_t *domid, bool soft_reset) @@ -762,6 +793,16 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_con= fig *d_config, goto out; } =20 + if (state->sci_agent_paddr !=3D 0) { + ret =3D map_sci_page(gc, *domid, state->sci_agent_paddr, + state->sci_shmem_gfn << XC_PAGE_SHIFT); + if (ret < 0) { + LOGED(ERROR, *domid, "map SCI page fail"); + rc =3D ERROR_FAIL; + goto out; + } + } + dom_path =3D libxl__xs_get_dompath(gc, *domid); if (!dom_path) { rc =3D ERROR_FAIL; @@ -1817,17 +1858,24 @@ static void libxl__add_dtdevs(libxl__egc *egc, libx= l__ao *ao, uint32_t domid, { AO_GC; libxl__ao_device *aodev =3D libxl__multidev_prepare(multidev); - int i, rc =3D 0; + int i, rc =3D 0, rc_sci =3D 0; =20 for (i =3D 0; i < d_config->num_dtdevs; i++) { const libxl_device_dtdev *dtdev =3D &d_config->dtdevs[i]; =20 LOGD(DEBUG, domid, "Assign device \"%s\" to domain", dtdev->path); rc =3D xc_assign_dt_device(CTX->xch, domid, dtdev->path); - if (rc < 0) { - LOGD(ERROR, domid, "xc_assign_dtdevice failed: %d", rc); + rc_sci =3D xc_domain_add_sci_device(CTX->xch, domid, dtdev->path); + + if ((rc < 0) && (rc_sci < 0)) { + LOGD(ERROR, domid, "xc_assign_dt_device failed: %d; " + "xc_domain_add_sci_device failed: %d", + rc, rc_sci); goto out; } + + if (rc) + rc =3D rc_sci; } =20 out: diff --git a/tools/libs/light/libxl_dom.c b/tools/libs/light/libxl_dom.c index fe9f760f71..b1d288a8b9 100644 --- a/tools/libs/light/libxl_dom.c +++ b/tools/libs/light/libxl_dom.c @@ -710,6 +710,7 @@ int libxl__build_pv(libxl__gc *gc, uint32_t domid, state->console_mfn =3D dom->console_pfn; state->store_mfn =3D dom->xenstore_pfn; state->vuart_gfn =3D dom->vuart_gfn; + state->sci_shmem_gfn =3D dom->sci_shmem_gfn; } else { state->console_mfn =3D xc_dom_p2m(dom, dom->console_pfn); state->store_mfn =3D xc_dom_p2m(dom, dom->xenstore_pfn); diff --git a/tools/libs/light/libxl_internal.h b/tools/libs/light/libxl_int= ernal.h index 0b4671318c..f9f9cc633a 100644 --- a/tools/libs/light/libxl_internal.h +++ b/tools/libs/light/libxl_internal.h @@ -1407,6 +1407,10 @@ typedef struct { /* Whether this domain is being migrated/restored, or booting fresh. = Only * applicable to the primary domain, not support domains (e.g. stub QE= MU). */ bool restore; + + /* sci channel paddr to be set to device-tree node */ + uint64_t sci_agent_paddr; + xen_pfn_t sci_shmem_gfn; } libxl__domain_build_state; =20 _hidden void libxl__domain_build_state_init(libxl__domain_build_state *s); diff --git a/xen/arch/arm/domctl.c b/xen/arch/arm/domctl.c index 6245af6d0b..ba200407da 100644 --- a/xen/arch/arm/domctl.c +++ b/xen/arch/arm/domctl.c @@ -4,6 +4,7 @@ * Copyright (c) 2012, Citrix Systems */ =20 +#include #include #include #include @@ -175,6 +176,20 @@ long arch_do_domctl(struct xen_domctl *domctl, struct = domain *d, =20 return rc; } + case XEN_DOMCTL_add_sci_device: + { + int rc; + struct dt_device_node *dev; + + rc =3D dt_find_node_by_gpath(domctl->u.sci_device_op.path, + domctl->u.sci_device_op.size, + &dev); + if ( rc ) + return rc; + + return sci_add_dt_device(d, dev); + } + default: { int rc; diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h index b85e6170b0..671c72c3e8 100644 --- a/xen/include/public/domctl.h +++ b/xen/include/public/domctl.h @@ -1177,6 +1177,13 @@ struct xen_domctl_vmtrace_op { #define XEN_DOMCTL_vmtrace_get_option 5 #define XEN_DOMCTL_vmtrace_set_option 6 }; + +/* XEN_DOMCTL_add_sci_device: set sci device permissions */ +struct xen_domctl_sci_device_op { + uint32_t size; /* Length of the path */ + XEN_GUEST_HANDLE_64(char) path; /* path to the device tree node */ +}; + typedef struct xen_domctl_vmtrace_op xen_domctl_vmtrace_op_t; DEFINE_XEN_GUEST_HANDLE(xen_domctl_vmtrace_op_t); =20 @@ -1265,6 +1272,7 @@ struct xen_domctl { #define XEN_DOMCTL_get_cpu_policy 82 #define XEN_DOMCTL_set_cpu_policy 83 #define XEN_DOMCTL_vmtrace_op 84 +#define XEN_DOMCTL_add_sci_device 85 #define XEN_DOMCTL_gdbsx_guestmemio 1000 #define XEN_DOMCTL_gdbsx_pausevcpu 1001 #define XEN_DOMCTL_gdbsx_unpausevcpu 1002 @@ -1326,6 +1334,7 @@ struct xen_domctl { struct xen_domctl_psr_alloc psr_alloc; struct xen_domctl_vuart_op vuart_op; struct xen_domctl_vmtrace_op vmtrace_op; + struct xen_domctl_sci_device_op sci_device_op; uint8_t pad[128]; } u; }; --=20 2.27.0