From nobody Mon Nov 23 22:32:00 2026 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=1794840129; cv=pass; d=zohomail.com; s=zohoarc; b=S5dBVOwqdHrnGVJYoh0VoZSnRjowevNJAr0RG8zaIP/fQQ6EuaJuBt3aunam2jg0DrM7SMcEPTJC8UpzjjPg2Wv/pRCfNtbja1rcJSML+oiNyFzjrmFhCQimjdYclJfZhNOPBEIXzc9bx5/aeZZ6hyIXtB/cLCNOStayblYE3Bo= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794840129; h=Content-ID:Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=UBIBUcGJqztzbw3PVDcTC84VFIZplOMWbWkzXViCyOk=; b=QuS04pIjPFdHK+UgXGpVChDl1h+fil0urVEXxV0rkr6/NwSlX5HD4l0DD6vHYztpZIa15a9gTbbdX+SwrrXFodfJRuXSDxTclGVwPxqcD23Jzk3ErWx3S0ao2/iXtTGpP59MYOy401+YrI9vL1DFktfSXALp/fK3idwxxmgcVIw= 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 1794840129313326.78969062502085; Mon, 16 Nov 2026 06:42:09 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1491034.1691950 (Exim 4.92) (envelope-from ) id 1xSxtz-0006iz-6u; Mon, 16 Nov 2026 14:41:47 +0000 Received: by outflank-mailman (output) from mailman id 1491034.1691950; Mon, 16 Nov 2026 14:41:47 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xSxtz-0006hJ-2g; Mon, 16 Nov 2026 14:41:47 +0000 Received: by outflank-mailman (input) for mailman id 1491034; Mon, 16 Nov 2026 14:41:46 +0000 Received: from mx.expurgate.net ([194.145.224.20]) by lists.xenproject.org with esmtp (Exim 4.92) id 1xSxtx-0006cg-Pu for xen-devel@lists.xenproject.org; Mon, 16 Nov 2026 14:41:46 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1xSxtx-00BMqu-60 for xen-devel@lists.xenproject.org; Mon, 16 Nov 2026 15:41:45 +0100 Received: from [10.42.69.4] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6afb161a-2eae-0a2a0a5409dd-0a2a4504af3c-40 for ; Mon, 16 Nov 2026 15:41:45 +0100 Received: from [52.101.66.113] (helo=DUZPR83CU001.outbound.protection.outlook.com) by tlsNG-ebf023.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6afb1627-b57f-0a2a45040019-346542718d39-5 for ; Mon, 16 Nov 2026 15:41:45 +0100 Received: from GVXPR03MB11113.eurprd03.prod.outlook.com (2603:10a6:150:2a9::22) by GV2PR03MB11211.eurprd03.prod.outlook.com (2603:10a6:150:30d::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.615.14; Mon, 16 Nov 2026 14:41:38 +0000 Received: from GVXPR03MB11113.eurprd03.prod.outlook.com ([fe80::13a1:97f6:9d2b:f8cf]) by GVXPR03MB11113.eurprd03.prod.outlook.com ([fe80::13a1:97f6:9d2b:f8cf%6]) with mapi id 15.21.0592.012; Mon, 16 Nov 2026 14:41:38 +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" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=epam.com header.i="@epam.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:x-ms-exchange-senderadcheck" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=RNG63pKbt4rSPVUIKkc2oojMFq+PxlQUDwNB51joPtrC55cQbYCERm2EYBIq3WcnDL4deq6WxnpB/djJ19KBl7XsnYrbkDDLgTuksqyLN7+oQSbawslDxp2C3b4Wl1QcDypvIqwqN0eUOxCW05yB5SaHB8xU1vfvf6C9SlqqrD5rL9xT8H4KuAF90wnO1GKBLasSq1bGHbEPt3Fd8XKoqln5SB3YFTFqn78G7M7XpxQ3cLki0EXeXehIspszwT4Y4G/9865ZjtuHv+3CTYwsityUqwpV80teL6/gHeWGXgKt0au+NwDEgoT5+nGIqMB5ZYEot9qhGGKSmEBgVR3euw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=UBIBUcGJqztzbw3PVDcTC84VFIZplOMWbWkzXViCyOk=; b=wDoGmfasBjbngHJGrDPVCgRikMUwkpaPZoLPvTRkXmAUmz3/daNNGIAZAizgeKrcYtbBVIGVHcWBIKP5Hv05ZkwiOZuB6OFgJW0N2Kj/Rk8qfe60zJa94kMRwO6rPsJa4yxvTwjhKzOVCOu2RSkvjA9KzS5ArgAVTm8X51EsDClEZYjDy85lzFRaVZq+lNM2cW0IPbN9l9ejvC4ztWUMZ2ogLUmqRz1Xh3Bg5XiqynqRUWe+PTGg+yrYPTJU+GecgxxTpUGor2Pr61BxUnGH6K29mBD5TzR0AMWZS1W8euaVXUUl8KigY2i9ME26WN56DRcHVT05K6aIDs9mjncvqQ== 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=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UBIBUcGJqztzbw3PVDcTC84VFIZplOMWbWkzXViCyOk=; b=HSrrMJeYPSpRhJkklRjMF61IGJ4ansy7/wttmZsq9spCl7+oD+3dDlFbbsfRFAViWK8ycXrWL9tYDMEaU4W27b+D5PyFS4o1s4hSepVRIVnLf77aupdXDReQUuX+15q+1kBYcnwhouAq/uqMdUM8Vkd9F3Y2wnQ707T58tYS6EbQwjRaq1Z2W/3TNbnNPnm+RK+bRHMBwYl2aKorcrc8ZyblEx8faXL0BbJGn9mu2q5D8aiKUNvfWPzSAWsMDnMbdnfZqA+p3/r5DgNX7gOzsQXKnFL9qbWaXOqdW2tAL91adnXEVnE4K65WlYaoJhrx1oqA9+ABIBgakMdu44dtJw== From: Oleksii Moisieiev To: "xen-devel@lists.xenproject.org" CC: Andrew Cooper , Anthony PERARD , Bertrand Marquis , Jan Beulich , Juergen Gross , Julien Grall , Michal Orzel , Oleksii Moisieiev , =?utf-8?B?Um9nZXIgUGF1IE1vbm7DqQ==?= , Stefano Stabellini , Volodymyr Babchuk , Grygorii Strashko Subject: [PATCH v16 1/6] xen/domctl: chain SCI handling before IOMMU in assign_device domctl Thread-Topic: [PATCH v16 1/6] xen/domctl: chain SCI handling before IOMMU in assign_device domctl Thread-Index: AQHdddiV3QCWsViQvES/fEZHf2wqtg== Date: Mon, 16 Nov 2026 14:41:38 +0000 Message-ID: <7827e528cc3dae6754279d95f90b79efb2451c90.1794839953.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: authentication-results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: GVXPR03MB11113:EE_|GV2PR03MB11211:EE_ x-ms-office365-filtering-correlation-id: e1586117-51e7-4db6-18f6-08df43efb889 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|23010399003|7416014|1800799024|376014|366016|261026140227099003|261026121527099003|261028144727099003|261021121427099003|261022075727099003|261022105027099003|261102123227099003|38070700021|56012099006|11063799006|10067099003|22082099003|18002099003|261009223027099003|6133799003|3023799007; x-microsoft-antispam-message-info: bQfCjRp4Tz6LKNF0IKDPPDu+FInPaun/7rJmks41A2L0Y/rdLtMuBeYbB6Dx278UtM+1oRVwycCQyV+juv+ownK9e1Yj6EyOX25Gub9nuMZcJvk81On2ovEvU/yHdGC9+RQMyxzAWfVQVVpXE8mIQy6tzThNM5xler8cBPAdIW3owvV3kXDEw1DpGC2W5O7xAopk03wGxY/8/FNaFl/K/3fDliKgbX1jdfF9VsgVKi6lDobSOT/eODrpm83WpT5qp0LMpZ2fe3gXeXssonkiVMGojFDtQqNkYJoFRnr/VnTZK2WEf9mpF44EOlwXbYb2QCQlZIUbLpBE9TQFJfgnVVgGYybn3HApobPGo3iu+6dVh/6+CY0V3enR4cnuw/pBau85iTZ6JUuC3uN3Swy0Sj0Tq1rb8MpN25YhHX0paQFjNKvMgceFuT+RjHhDgD4rX5tsjH9scRQOP4/OaQwFsDMQNcfCvaetKKDMkpSRltBBFrJgYQexdorzTwSjU8XvuBSJvWJncyeowunp860E31FqMNVAKf7Fqr1lRDp/1kyjENDnfjqb7cyqDOvrOtwP9lxJ4GSRpUG2VQf2aBc1B560Wg3spghMPPfLF2CbrOrpugnd/tcP0YeWzfzZcK9SdqGUmZ5zeP1b3pBM5+t/Im5Ek7bogW3RMSV7NWuGgii86aEEIapJThGuDMpYW93/xrE7U8CA0Y2oIeNsMHbj7blS9LJxgbOUAZ0ewycyrb0= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:GVXPR03MB11113.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(23010399003)(7416014)(1800799024)(376014)(366016)(261026140227099003)(261026121527099003)(261028144727099003)(261021121427099003)(261022075727099003)(261022105027099003)(261102123227099003)(38070700021)(56012099006)(11063799006)(10067099003)(22082099003)(18002099003)(261009223027099003)(6133799003)(3023799007);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?TGJvbWZ3L1VyRFQ0NllacEgxYkxwVVZYemRia2g0MENkbUVCRkQzWm50TW53?= =?utf-8?B?UWhKSldxRDJVNTAvVFlQZTlKd21OUjE3dVBhNG9UVWVUWlhEdHJ3aUs3UVBB?= =?utf-8?B?YlJrUFRRTXBhSHkvZ2N4S0pvWUk0M0JaY0NXYWx6R0VRUUlZTlExTXdtU0tp?= =?utf-8?B?OCtzY3lGQWxNcDY5SEFIZ1JWOSs3QllkM2FGbkJWMndUOHRyWHJSTjVpZC9x?= =?utf-8?B?dGtmZEw2eFZYMTJQYkwzK3E4MmViM2FJdzJwRVZwMXBORTljR2ZOd3BTaTRT?= =?utf-8?B?WUVnblVEdUd2UmdoOTVMZ1RnVTNuMXBDbW9td3M4cTNmUHpqUm1haUpKT01v?= =?utf-8?B?QVlRckMyMTNBa0dFNmc4czJFWWk3WW9ucTluVHJaajgranNIVTQrd1NES2tE?= =?utf-8?B?c1RvRnJxbDVpZzRYSkd4VjhhUTV5YlVVc1VGeEV5aCtHYlNieHhHUkxkb0hk?= =?utf-8?B?Rm9vTW03QllhZW9TTldkT21ZdlRyMVdFRE5XSUNYck1aMWhPclJJd3BSYmcy?= =?utf-8?B?ZUNOVnJOalVJbEtEVno3bm5LamJ6QXpFUWEzV2taK1MzdW50dXBoYklHM3Ax?= =?utf-8?B?STd5TzFBbDhlQnJUWDRtQkZhWDNsUVJ3M2NTRDFJRmtPNlJEY3NWek5sODhy?= =?utf-8?B?S1M5RXhpTHFkZ1J0dmloRXR5bDltZlpmOTl2VEh4bjZKVGRlOGxlQkJtQkdl?= =?utf-8?B?N21IWVJLcW5xNGN5YzJ5QlhuMnR2TFk0M2hQay8wRTh3bzZvNi95dlgyR2VZ?= =?utf-8?B?Vm5kcTV3R0lUQWRic2llS0NtaHNSSHRJVGNod1hXaTU1cEYyb0FGVDNKcXVM?= =?utf-8?B?L2NZaWY3Zzg5SHZtaldDeVlFb3ZuZkJBRlhuZHZQdStzUVpUdGpsczZWU2Rm?= =?utf-8?B?M1JFZWxSbENVVUxoWFA1NmtRcEdZWTU5aEFFUVM3WGw0ZW14ODlaTGgwOTZD?= =?utf-8?B?eTFZTk1aRnJXZVNuS2xzV3FISjRPY3dxQ2c0NWY5ZkYvY29qSE9IWFU2RytW?= =?utf-8?B?QVViTmpXU1dwTzdOOEs1bW1RSDVySzd1VWdSZGZDelV4bitlQ3JDK2t3bHhw?= =?utf-8?B?YW9zSnhad2h3ZVhUaWNvVlM5cTljdUs2ZTBOREg1RHVqb0RYU3g1SDZ0NHps?= =?utf-8?B?RE5xTTZFUDZTMFdOMm5BUERGYXlraHJBSWVpd2p2a0sySU9ieUs2cUtqNklD?= =?utf-8?B?ZVVsVlJyM3QrU245Smkyd1h6cjVVcDNPbUFkYUZ3ZTR1UGI1OUFTVUplKzI3?= =?utf-8?B?N3RDOHFnd1k3cGd0bWNZU2hGYUVNeENEK0w4aUlQZFZUNWZsZ050aUhjQkQw?= =?utf-8?B?aytFSyt5Q05NSExVQk94V3dMZVNMcW9XUkRoaU1xd3hHTkVJbVhPdU1Nalpl?= =?utf-8?B?a1dlRkJlM2ZrMVUvbkEwY1p0UzQxSjQ1b0FqRlN3NVBjdlhpWWxPNS9KOFFu?= =?utf-8?B?cmp0SVFCTnh2ZmxBL2ovckdqakxTTTdHNVU0SjNnMENpVjJkb0hFUmpNMHpI?= =?utf-8?B?dmNSa1R6d1l3MUIvcVRqLysxM0JvbWZqRjIybk5qZmQ3ek5QekQ4Tk8veHRh?= =?utf-8?B?N0duNUg4bVFqNm9yNlFTaDFDeVVqM20xZVFoVlRLMUUySUY0Yk0za2Q1WG04?= =?utf-8?B?K2dMR1ZJODl5OEVTYTNJV3lLQktWTFVBRUJHZzFiOXExaWFsYUlUNUVKeGFi?= =?utf-8?B?WUh6bmdxTVArSDJlTlZFOStnUzVjNTJ5aUFEYnVRT3N0cEovMzVkOXJLTEJ5?= =?utf-8?B?bi9qRnBmWjF2bFZXbkFFYmQyN3N4TlU1RzJlL2M0aWFUU3Jtc1hCYll0RzdE?= =?utf-8?B?YTJ0YSs3QkdoN1hFQ3gvOFN0UE1lZmpkRzdab0RKYTd6SWU2VklUUDBDS09V?= =?utf-8?B?OTNIb0hLaXR4aVBuaXJHSndMdUlnbHdmK3N4NjVySDExaG9OVy9QTlJJUVdB?= =?utf-8?B?TFlsaUZFaHdYa1JpWng5UnZCQUFwY1IvakZ3SDF2aFVlZC9vcXpwWU5teG9R?= =?utf-8?B?bTdVQmZmbUVGM1lYUjlCZzN1R253bWpDTFZabGJ0TUJKUjZjSXpPL3o4TEVM?= =?utf-8?B?Z0dCbVRaWnY5U3pLUHlhZk1jelhpNzBpakVPems2bWhFZ0lYUDhFNVAvU0Rk?= =?utf-8?B?VVJoTE9ERm5EMXRGWGZ2Q0FRVEpXVHQ3VHRwaC9XWTNNYU9PR2thZUFWaE5K?= =?utf-8?B?bUg3N0UweTVZSnlrNTRIM2hENXN4Z2J4bEVKaldGRWdBUERxeFNxMVlJSlJk?= =?utf-8?B?NUU0eTQ4a2JLeXVjUms0Vko4Smc1VExxUEJIREh1eHJiNllYQXBXUlAzZk91?= =?utf-8?B?ZktMZWRta0RIRUNSVWJKUkx6ZUhtMXl5S0pjOHBpUTNlRk1BNEdNOXR6QTZB?= =?utf-8?Q?zdawudwco5uLOle8=3D?= Content-Type: text/plain; charset="utf-8" Content-ID: <96E20397AE4F0940B28579352C64BE8C@eurprd03.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: epam.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: GVXPR03MB11113.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e1586117-51e7-4db6-18f6-08df43efb889 X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Nov 2026 14:41:38.1347 (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: f78C3n30FWqq+mORxbQLiIAfPRIN9kusLcTxfC9AUvd0i4mdTY/w7PQrXihBMqb7orRo8fElv/L9Z6ODsyLthXqn8tEQY9J6+JAl0uht0mk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV2PR03MB11211 X-purgate-ID: tlsNG-ebf023/1794840105-C2CCFB50-9BEE089A/10/78276251493 X-purgate-type: spam X-purgate-size: 11270 X-ZohoMail-DKIM: pass (identity @epam.com) X-ZM-MESSAGEID: 1794840130750158500 From: Grygorii Strashko Add chained handling of assigned DT devices to support access-controller functionality through SCI framework, so a DT device assign request can be passed to firmware for processing and enabling VM access to the requested device (for example, device power management through SCMI). The SCI access-controller DT device processing is called before the IOMMU path. It runs for any DT-described device (protected or not, and even when the IOMMU is disabled). The IOMMU path remains unchanged for PCI devices; only the DT path is relaxed to permit non-IOMMU devices. This lets xl.cfg:"dtdev" list both IOMMU-protected and non-protected DT devices: dtdev =3D [ "/soc/video@e6ef0000", <- IOMMU protected device "/soc/i2c@e6508000", <- not IOMMU protected device ] The change is done in two parts: 1) call sci_do_domctl() in do_domctl() before IOMMU processing. If sci_do_domctl() reports an error other than -ENXIO, treat it as authoritative and skip the IOMMU path. A return of -ENXIO indicates that SCI did not handle the request and is ignored, allowing the existing IOMMU handling to run unchanged; 2) update iommu_do_dt_domctl() to check for dt_device_is_protected() and not fail if DT device is not protected by IOMMU. iommu_do_pci_domctl doesn't need to be updated because iommu_do_domctl first tries iommu_do_pci_domctl (when CONFIG_HAS_PCI) and falls back to iommu_do_dt_domctl only if PCI returns -ENODEV. The new dt_device_is_protected() bypass in iommu_do_dt_domctl only applies to DT-described devices; SCI parameters are carried via DT nodes. PCI devices handled by iommu_do_pci_domctl do not carry DT/SCI metadata in this path, so there is no notion of =E2=80=9CSCI parameters on a non-IOMMU-protected PCI device=E2=80=9D for it to interpret or to skip. The= PCI path should continue to report errors if assignment cannot be performed by the IOMMU layer. So we should leave iommu_do_pci_domctl unchanged; the SCI/DT-specific relaxations belong only in the DT path. Also SCI handling only exists when DT is present. Signed-off-by: Grygorii Strashko Signed-off-by: Oleksii Moisieiev Reviewed-by: Stefano Stabellini Acked-by: Jan Beulich --- (no changes since v12) Changes in v12: - rebase to the latest staging - add R-Bs from Stefano and Ack from Jan Changes in v10: - remove unused sci_do_domctl stub from sci.h Changes in v9: - treat SCI as a gate for XEN_DOMCTL_*assign_device: abort before IOMMU if sci_do_domctl() returns an error other than -ENXIO, instead of trying to propagate SCI errors after a successful IOMMU operation. This avoids partial success and the need for IOMMU rollback. - remove early return from do_domctl() in the assign_device path to keep RCU handling intact. - change IS_ENABLED(*) to #ifdef in sci_do_domctl quard Changes in v8: - check for CONFIG_ARM_SCI to be ebabled instead of COMFIG_ARM before calling sci_do_domctl - rework sci_do_domctl call to avoid extra checks, improved error handling. - do not propagate ret1 if sci_do_domctl returned positive ret - updated comment in domctl.c code Changes in v7: - update domctl to build on both Arm and x86 platforms - move ret1 declaration to the top of the function as required by code style Changes in v6: - change iommu_do_domctl and sci_do_domctl command order and call sci_do_domctl first which will produce cleaner code path. Also dropped changing return code when iommu was disabled in iommu_do_domctl. Changes in v5: - return -EINVAL if mediator without assign_dt_device was provided - invert return code check for iommu_do_domctl in XEN_DOMCTL_assign_device domctl processing to make cleaner code - change -ENOTSUPP error code to -ENXIO in sci_do_domctl - handle -ENXIO return comde of iommu_do_domctl - leave !dt_device_is_protected check in iommu_do_dt_domctl to make code work the same way it's done in "handle_device" call while creating hwdom(dom0) and "handle_passthrough_prop" call for dom0less creation - drop return check from sci_assign_dt_device call as not needed - do not return EINVAL when addign_dt_device is not set. That is because this callback is optional and not implemented in single-agent driver xen/arch/arm/firmware/sci.c | 36 +++++++++++++++++++++++++ xen/arch/arm/include/asm/firmware/sci.h | 8 ++++++ xen/common/domctl.c | 15 +++++++++++ xen/drivers/passthrough/device_tree.c | 6 +++++ 4 files changed, 65 insertions(+) diff --git a/xen/arch/arm/firmware/sci.c b/xen/arch/arm/firmware/sci.c index f73ed06092..371eca019c 100644 --- a/xen/arch/arm/firmware/sci.c +++ b/xen/arch/arm/firmware/sci.c @@ -126,6 +126,42 @@ int sci_assign_dt_device(struct domain *d, struct dt_d= evice_node *dev) return 0; } =20 +int sci_do_domctl(struct xen_domctl *domctl, struct domain *d, + XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl) +{ + struct dt_device_node *dev; + int ret =3D 0; + + switch ( domctl->cmd ) + { + case XEN_DOMCTL_assign_device: + ret =3D -ENXIO; + if ( domctl->u.assign_device.dev !=3D XEN_DOMCTL_DEV_DT ) + break; + + if ( !cur_mediator ) + break; + + if ( !cur_mediator->assign_dt_device ) + break; + + ret =3D dt_find_node_by_gpath(domctl->u.assign_device.u.dt.path, + domctl->u.assign_device.u.dt.size, &de= v); + if ( ret ) + return ret; + + ret =3D sci_assign_dt_device(d, dev); + + break; + + default: + /* do not fail here as call is chained with iommu handling */ + break; + } + + return ret; +} + static int __init sci_init(void) { struct dt_device_node *np; diff --git a/xen/arch/arm/include/asm/firmware/sci.h b/xen/arch/arm/include= /asm/firmware/sci.h index 1d566be8e2..6d8286b5cb 100644 --- a/xen/arch/arm/include/asm/firmware/sci.h +++ b/xen/arch/arm/include/asm/firmware/sci.h @@ -146,6 +146,14 @@ int sci_dt_finalize(struct domain *d, void *fdt); * control" functionality. */ int sci_assign_dt_device(struct domain *d, struct dt_device_node *dev); + +/* + * SCI domctl handler + * + * Only XEN_DOMCTL_assign_device is handled for now. + */ +int sci_do_domctl(struct xen_domctl *domctl, struct domain *d, + XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl); #else =20 #include diff --git a/xen/common/domctl.c b/xen/common/domctl.c index 83405a766a..1d5b92631c 100644 --- a/xen/common/domctl.c +++ b/xen/common/domctl.c @@ -29,6 +29,9 @@ #include =20 #include +#ifdef CONFIG_ARM +#include +#endif #include #include #include @@ -925,6 +928,18 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_= domctl) case XEN_DOMCTL_assign_device: case XEN_DOMCTL_test_assign_device: case XEN_DOMCTL_deassign_device: + /* + * Chain SCI DT handling ahead of the IOMMU path so an SCI mediator + * can authorise access-controlled DT devices. Unhandled cases rep= ort + * -ENXIO, which is ignored. Any other SCI error aborts before the + * IOMMU path runs. + */ +#ifdef CONFIG_ARM_SCI + ret =3D sci_do_domctl(op, d, u_domctl); + if ( ret < 0 && ret !=3D -ENXIO ) + break; +#endif + ret =3D iommu_do_domctl(op, d, u_domctl); break; =20 diff --git a/xen/drivers/passthrough/device_tree.c b/xen/drivers/passthroug= h/device_tree.c index ab1e07ac99..7c4cf27d32 100644 --- a/xen/drivers/passthrough/device_tree.c +++ b/xen/drivers/passthrough/device_tree.c @@ -379,6 +379,12 @@ int iommu_do_dt_domctl(struct xen_domctl *domctl, stru= ct domain *d, break; } =20 + if ( !dt_device_is_protected(dev) ) + { + ret =3D 0; + break; + } + ret =3D iommu_assign_dt_device(d, dev); =20 if ( ret ) --=20 2.43.0 From nobody Mon Nov 23 22:32:00 2026 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=1794840121; cv=pass; d=zohomail.com; s=zohoarc; b=WuikbQDMRPiGVPgg7iWsDMMt51dPPF94sCIq+MZPv/bCtGckH8hf+k7bLL/N7bYoMnJNUVyZJTSSxKNlI9l2/ykruolyVzU9eh16UFFsKPsecC/j92dFLBqbRIO92uhzkZK3NgsFgChZeWAWI4c9tdLCL/14PH3Z8Tk8TpqWqRM= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794840121; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=HaPlyiQF1WAzVJ67Z+NxO+5WCG19GCRvpAl3HPh9kPA=; b=bfAS8S6/8OyHMg3zDq2joSbLq803+KP1u/MMsJ7CcouN5AAOj4PJvnJKxx1AChoAf/TJB/d4hii4RYLHELM1Gjp0G13rCDGDAki3gAIG4daG9vhNEcqCS1LEbd9EWKHgbfvbjFGbTmWUQjZWCbT40AFLPeY3D2rjn62m3de1UHg= 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 1794840121293427.95967579312105; Mon, 16 Nov 2026 06:42:01 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1491032.1691942 (Exim 4.92) (envelope-from ) id 1xSxty-0006e7-PX; Mon, 16 Nov 2026 14:41:46 +0000 Received: by outflank-mailman (output) from mailman id 1491032.1691942; Mon, 16 Nov 2026 14:41:46 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xSxty-0006e0-MY; Mon, 16 Nov 2026 14:41:46 +0000 Received: by outflank-mailman (input) for mailman id 1491032; Mon, 16 Nov 2026 14:41:45 +0000 Received: from mx.expurgate.net ([194.145.224.20]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xSxtx-0006ca-CG for xen-devel@lists.xenproject.org; Mon, 16 Nov 2026 14:41:45 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1xSxtw-00BMln-Fm for xen-devel@lists.xenproject.org; Mon, 16 Nov 2026 15:41:44 +0100 Received: from [10.42.69.4] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6afb161a-2eae-0a2a0a5409dd-0a2a4504af3c-34 for ; Mon, 16 Nov 2026 15:41:44 +0100 Received: from [52.101.66.113] (helo=DUZPR83CU001.outbound.protection.outlook.com) by tlsNG-ebf023.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6afb1627-b57f-0a2a45040019-346542718d39-3 for ; Mon, 16 Nov 2026 15:41:44 +0100 Received: from GVXPR03MB11113.eurprd03.prod.outlook.com (2603:10a6:150:2a9::22) by GV2PR03MB11211.eurprd03.prod.outlook.com (2603:10a6:150:30d::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.615.14; Mon, 16 Nov 2026 14:41:38 +0000 Received: from GVXPR03MB11113.eurprd03.prod.outlook.com ([fe80::13a1:97f6:9d2b:f8cf]) by GVXPR03MB11113.eurprd03.prod.outlook.com ([fe80::13a1:97f6:9d2b:f8cf%6]) with mapi id 15.21.0592.012; Mon, 16 Nov 2026 14:41:38 +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" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=epam.com header.i="@epam.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:x-ms-exchange-senderadcheck" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Ef4Hd1sfUQ9gc1zQs9GdVj6ZfVc9oTA3kXAfaCvZYYHujzjUK8DlEOtrhki2k4/0teoHr+LWEEzQDYc/eH4Oyxvk/a5xiHNOOunRjhUNx1iwavY56R5MYRpkycWJ4SIZiSPUhHioSnWdUUY5ASsSZ+WdhqV3CXKInV/6hd792u69uh3LzGGUIpFrQ16aagk55pzKKw02Xyi7Bc8DVhbBddkxYd/fGMdRYWvaXxGyRB1WL8sc/DkfnJsWvVfLSPsXlI//IHVEdxQt71gJ8zyGuN2oM7aahG0At8LkOYRsqOdjaiuFb+bS2vquA7yz0aO9udytDSJqwCXhDt7mIgGGZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=HaPlyiQF1WAzVJ67Z+NxO+5WCG19GCRvpAl3HPh9kPA=; b=HXCRcotoZRM/GgfaDN5K1cepmBjNa/KhmU/xIYZdaVXZo/AxmquI9999mWZnyYjDM49NkE4wjnhRzez024WaAjojaEeneelIVT4wpQUsiYUw5+z853DUmUvRzppO3lz8kgVKuSALDHpE5cmI+IpPKiVz97q2X/f9EEKZlnXcOnxW/rW9d8ruGM+/Gj12GqDnzi5Jl7oRHoEnBJAwrpvsydo0pihMSq4OjCruGfYY9WNhh7yfp572l5o4dmQ9Ossz0qXp6VElregnsrv7mRamG/URYDy9ToYc4o7D4x80FCxi7UOc8awURajdRubXfwtgge+30mQjxeSFmXG2CvmTeQ== 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=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HaPlyiQF1WAzVJ67Z+NxO+5WCG19GCRvpAl3HPh9kPA=; b=qdeyFvXgGwsB3qoj2CICqJ1w+VEZJsXHPkYAz1wOfmBXh75JeXTrSSf+TP08G1x/N6PM29kUTmqPL9l8PTaEKzoWo14lqJ9+eCfYn3qn5qy3qfQwByDQ4Wk6K7A9+Hf0h9LGytNhhQm/hI2Qtzu2To/43xXJuozIQ+J2oq8ub1JkY5WLWs3sme+U3nVPGp33pMPD97BGHsVVWgWyFXe+87ziC5pq0paMuPGvSw/+BpOFL3uze+6oK1+Gv5vLdSpW3GZCy0e2C/67WdYrAr3KG14k9icHU3r+dirTUiYm2CMIcqLRK3cT9YmmXUOuFwJDOTely+9BDLfq+Sc5vxneaA== From: Oleksii Moisieiev To: "xen-devel@lists.xenproject.org" CC: Andrew Cooper , Anthony PERARD , Bertrand Marquis , Jan Beulich , Juergen Gross , Julien Grall , Michal Orzel , Oleksii Moisieiev , =?iso-8859-1?Q?Roger_Pau_Monn=E9?= , Stefano Stabellini , Volodymyr Babchuk , Grygorii Strashko Subject: [PATCH v16 2/6] xen: arm: smccc: add INVALID_PARAMETER error code Thread-Topic: [PATCH v16 2/6] xen: arm: smccc: add INVALID_PARAMETER error code Thread-Index: AQHdddiWzgUZD4G1o0yyIuz2iSLpdg== Date: Mon, 16 Nov 2026 14:41:38 +0000 Message-ID: <0d3ea7f0726fa9feed4c108ce9217b52b1b3c899.1794839953.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: authentication-results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: GVXPR03MB11113:EE_|GV2PR03MB11211:EE_ x-ms-office365-filtering-correlation-id: 08c064f1-6ccd-4ad1-252a-08df43efb8da x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|23010399003|7416014|1800799024|376014|366016|261026121527099003|261021121427099003|261102123227099003|38070700021|56012099006|11063799006|10067099003|22082099003|18002099003|261009223027099003|3023799007; x-microsoft-antispam-message-info: X8Rv978a+BrSxrsgDDEphAFKgs2aCqy9ff3zgaLoseZviAHVo3XCtMOY3GZAkRIwb3aTpe5eWAOp2wV/yyf6UOwwsLfiLKcd42tZsAoUAvyIZlFLy1oi+tOQiF9vlPMJe4TacE9SyXVvlgln3dRkv/HlOce4QkCn4P6kXjQNd1CCKo3uGScxRAz0Tvbr0+7xB7f+GGakpJdzUGuPLoJXEpNWCCZT9zUJ33yL2+bFHAoZ+GsCi3koMb5VP6Lq1JhDYbW3Fp0yoyX/Oz/elwuzm4tEBQYBXvyurQa/2lUKcQ3diOu0Z6NFRkcJVyf/jDk/Z1qw5OX819GOrLiyyzhNw/ycyrFlXSgxtV9G+39YDvcbVaFFCBfR11GFGoz7Snsa20Mx+RWrNu2PUkQlgpUQ2+X+VLCeeR3WJ7N2z7Y2NA+vevp6ve1p5EW6pxRYzeR4C1UaqmmBYWnWC8/E09L4hK/584yloBgYQP+dE876LG+vpbP4SeJOGTNNcygoWwA+Ra0Tf6MkV/bZSP2/Ipg2e8n6Q1INn35mONoFLNc0d1MDdwtTAcD/kYf6NX6lu/N2oa7Mrh3lpvLDlhJFK6FQvYVnWGoCHiHwM20mIB+0evwrdAkwMFQvL6TNGtVhWYXXcX8dwwAqILyXdZgS3/4PfCBwYfuZuy3Z7x48nHzOouU= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:GVXPR03MB11113.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(23010399003)(7416014)(1800799024)(376014)(366016)(261026121527099003)(261021121427099003)(261102123227099003)(38070700021)(56012099006)(11063799006)(10067099003)(22082099003)(18002099003)(261009223027099003)(3023799007);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?xV23Oi8Xogyk/XY2esINLMso2N6Zf3em7XwQEW0hGEggVR2lgj4n6fTBrT?= =?iso-8859-1?Q?ugnEwB/+TBUQBPoMMnU6/7ifoHfk/AtxZNXKBdeveAusOj+pcrc8+lg4TN?= =?iso-8859-1?Q?9bjFkrW1O+3H4zM3Mtyn1tCStI/NJHAZWMY6ijyZYth8/3e4AmO1kuEi5N?= =?iso-8859-1?Q?J9R2PwEtAvbrWpnq/2xdCoUbeZpTGkum8kP0Mde2TgcEG4YgDwi2qvQolm?= =?iso-8859-1?Q?fz2nsOJpHnvWTz+Du0j3RNwUDD44uTulBuFuI7uDx0CMEG8K3xxAVZojjm?= =?iso-8859-1?Q?0+jFQbArOnrTUptlJxxlhD4HiPMJHe5ZxePQo84FhHC7p5Lv0lH4ljk4N9?= =?iso-8859-1?Q?yd9MKXOgK8CDdt3zl34YKHGNHnFmXmGfmEeBSrNJ23SsRV6r9CHTaG9ViT?= =?iso-8859-1?Q?aLnnIDzjwTmvoj0Yl1Knz2lozq3MAk1cgUvqXXMyE4z7K9DNnKsJ5hkfYZ?= =?iso-8859-1?Q?G9ZjV+zRkP+mru2jmXixcaOB+P26sB6FX7rf52v5hqT6+8n35nytBDIfYA?= =?iso-8859-1?Q?0CKN6htiSHVa9R4q7rzuM6swORu/oHE6xrzkThxkI56eQKuWo7+XoGxbjx?= =?iso-8859-1?Q?cwIHYkaUEWyqgLIwS3yWTxzR8YzMVwRHYorNEuPojvScZQoBmguJ9ps9iv?= =?iso-8859-1?Q?G9Yu5JL18jdtIvVVQ55uU6fbGuJYvPanNMhV2p1mM3yfcN5cXJ6p5a/kDK?= =?iso-8859-1?Q?rGviECHC02Zv79M323nnALE6OWME2mtxo71e7t4b5JViBE4j++emab8Ho5?= =?iso-8859-1?Q?ubfOXFEy5QWwSOoJCdamXz+CylqIEd7aLNSfQTArAFrBc/mjgUbch4lPlH?= =?iso-8859-1?Q?N7D7TmHhHKsL6+kvOptls6pHxZPCtOSCRHNZc0XITyj8uRXB3610EnoSpF?= =?iso-8859-1?Q?jo0pCAK4z087mFQwftE8fPh0iIosKjCQt03hsoILo6xHaiDVepcCAqnOdN?= =?iso-8859-1?Q?YspctZfuexiAcwf+FXDnsz360ObQpB9oFytUG+zAaEyngePJei9ieCjnBy?= =?iso-8859-1?Q?Dxrd1NU8md7JcOnz3vKPTTbtRcwJ1kqEmuRzN3DO7/etm7bj9slYBZuY5P?= =?iso-8859-1?Q?dfIs9cyEKMNU1nLDbIfzpDkOS0KsknJC6OhYXgaESYtMtEznP87Ps3WF0X?= =?iso-8859-1?Q?UqEdMd6JlxjGJH+5Q4jsByQNiSX6mPZxJYyt9YZiInMRl/FwsJZ4ok6uLm?= =?iso-8859-1?Q?ECmxfgCR1Qvc18aPHKWEXvUB5Sa/jZAHCzt6DmSyjWiAhCm9Ho4S2QG2NE?= =?iso-8859-1?Q?s4koeMA09JHJXXYm8y4P1iIt7uSlU7BXrM/Qd40j9wjOn6HkRbzmqAWjmc?= =?iso-8859-1?Q?0s7N1ayMFxSDYBX33yKMA1QslCf7HE5PMsFXniGXVInssuU7pqm05j0muf?= =?iso-8859-1?Q?eLaHsKf7WQaPZHTXLGs2SdoIKUyO21DU4z1ZvZrYVlTlvd98o/Zio317nP?= =?iso-8859-1?Q?WhUJFJy71VMA7i4JJCGQXfJj6zHVlAPRTzcucbd1sTNuHFs6lq9zB7//xs?= =?iso-8859-1?Q?oB7fFG573v56BN/mcaxSttlVqA44LpRQMPIVs3SOP1noFeolpbCruRswEJ?= =?iso-8859-1?Q?1RaNlftyzoVfrEt5QgD5Ei32UgDbIxkO3TUf+fvI2QsRmnWFQ1yqq8uyHX?= =?iso-8859-1?Q?iXcRr0sJZu6sIkMkQFeX7uI7AhIonM569FkNZJ1WhxbyrJgsXbpJaTJEwZ?= =?iso-8859-1?Q?GEujdI4zepPND+yggUOAGoYxK069RLZw490fRuF4g0ILyj6k72Pdj81ESh?= =?iso-8859-1?Q?gzClsLhHDEcmhCPet64Ptjw/RWv0gmiapnd00k9aCFhaXVgBklQfFJjclE?= =?iso-8859-1?Q?Nn/Q4wdGNgcBLPlw1FfmXHRE5zfhDB8=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: GVXPR03MB11113.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 08c064f1-6ccd-4ad1-252a-08df43efb8da X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Nov 2026 14:41:38.7022 (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: AClJXeCpOEY5Q62p1KDdWDQ9FGq+CLXLgfe1awF/BJNT7Bq//Sj4gNXsnVso8DxSHQuCzxnW+6LijMc0LgnKU448fw0mcZesLFsSkUqS1Uc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV2PR03MB11211 X-purgate-ID: tlsNG-ebf023/1794840104-502E4B50-CC9E6AC7/0/0 X-purgate-type: clean X-purgate-size: 1118 X-ZohoMail-DKIM: pass (identity @epam.com) X-ZM-MESSAGEID: 1794840122671158500 Content-Type: text/plain; charset="utf-8" According to the "7.1 Return Codes" section of DEN0028 [1] INVALID_PARAMETER code (-3) is returned when one of the call parameters has a non-supported value. Adding this error code to the common smccc header file. [1]: https://documentation-service.arm.com/static/5f8edaeff86e16515cdbe4c6 Signed-off-by: Oleksii Moisieiev Acked-by: Stefano Stabellini --- (no changes since v12) Changes in v12: - add missed Ack. xen/arch/arm/include/asm/smccc.h | 1 + 1 file changed, 1 insertion(+) diff --git a/xen/arch/arm/include/asm/smccc.h b/xen/arch/arm/include/asm/sm= ccc.h index c7763acd7f..91c9bc1186 100644 --- a/xen/arch/arm/include/asm/smccc.h +++ b/xen/arch/arm/include/asm/smccc.h @@ -381,6 +381,7 @@ void arm_smccc_1_2_smc(const struct arm_smccc_1_2_regs = *args, 0x3FFF) =20 /* SMCCC error codes */ +#define ARM_SMCCC_INVALID_PARAMETER (-3) #define ARM_SMCCC_NOT_REQUIRED (-2) #define ARM_SMCCC_ERR_UNKNOWN_FUNCTION (-1) #define ARM_SMCCC_NOT_SUPPORTED (-1) --=20 2.43.0 From nobody Mon Nov 23 22:32:00 2026 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=1794840137; cv=pass; d=zohomail.com; s=zohoarc; b=RKGoJIAVfCoRfYUSRtlEpwYYZmhKJq15fDL1u6yFJ09dnm+ekRaBunhvsPbvtYV7L3PAkJf8MbBtXaVmul4dp0BqrxPkvW83K1hn9XZzx5Q1pOmLnFh8ui4nvh4bM1uPwE2c2Kq8CGFHF4HzkAoNkMovoVo81h10KKwT2XSQrRQ= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794840137; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Fgg9cHMriHhGOg+Y24vzMOHf2dI+HJEpVRu9jm6g36M=; b=K5sbeWfbU1RdwlW9fvWKItxSBng5Eobl58GjgQ161d+aROdd2z+c72Hfn+Wu0WNePgKIJPGMRC/eK/IWTPXsA0GF5wMQ8fTe3q7Z5z0ob+ZKNxit0gpxuGZBLz5sNGId0LBIunHkaERsgitlkWma8pYXE+cyJsCgCpO1+Us9XzU= 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 179484013749318.057168683139594; Mon, 16 Nov 2026 06:42:17 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1491033.1691948 (Exim 4.92) (envelope-from ) id 1xSxtz-0006gV-2J; Mon, 16 Nov 2026 14:41:47 +0000 Received: by outflank-mailman (output) from mailman id 1491033.1691948; Mon, 16 Nov 2026 14:41:47 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xSxty-0006gK-Ss; Mon, 16 Nov 2026 14:41:46 +0000 Received: by outflank-mailman (input) for mailman id 1491033; Mon, 16 Nov 2026 14:41:45 +0000 Received: from mx.expurgate.net ([194.145.224.20]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xSxtx-0006cb-FV for xen-devel@lists.xenproject.org; Mon, 16 Nov 2026 14:41:45 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1xSxtw-00BMqu-Rr for xen-devel@lists.xenproject.org; Mon, 16 Nov 2026 15:41:44 +0100 Received: from [10.42.69.4] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6afb161a-2eae-0a2a0a5409dd-0a2a4504af3c-38 for ; Mon, 16 Nov 2026 15:41:44 +0100 Received: from [52.101.66.113] (helo=DUZPR83CU001.outbound.protection.outlook.com) by tlsNG-ebf023.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6afb1627-b57f-0a2a45040019-346542718d39-4 for ; Mon, 16 Nov 2026 15:41:44 +0100 Received: from GVXPR03MB11113.eurprd03.prod.outlook.com (2603:10a6:150:2a9::22) by GV2PR03MB11211.eurprd03.prod.outlook.com (2603:10a6:150:30d::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.615.14; Mon, 16 Nov 2026 14:41:39 +0000 Received: from GVXPR03MB11113.eurprd03.prod.outlook.com ([fe80::13a1:97f6:9d2b:f8cf]) by GVXPR03MB11113.eurprd03.prod.outlook.com ([fe80::13a1:97f6:9d2b:f8cf%6]) with mapi id 15.21.0592.012; Mon, 16 Nov 2026 14:41:39 +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" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=epam.com header.i="@epam.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:x-ms-exchange-senderadcheck" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=w4iQm3nXhvGro7nnfRtCp/5T9lxQ2mxCkeLzXoClAVgqAlGhKXj/GxaXvvJdE877dmqSwMgjH/mJb/nGaBNmfSMupem3dtupnKlGQwNVMS0kVxbbxDintTVo7rKGU2Z9WHFRo9dBLM9t1DHcCmSKTrRB+zdVfIEHRBx/e9fSv6BM/L3LO7fdc8jVykoonXSAGSnabS44kl88Qz5gFzyQigI4NhH1L5fKCIaJkY3zACv50x0GcIAavmOFDkI2ZIhCs0tIIWfgUScDhUcdLrx8ugLeOBx2H8FuiAhZgLGsuRxIZCIeL/2IassOq0ltDNTyWOKMdE0BLnBzTS1sasafNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=Fgg9cHMriHhGOg+Y24vzMOHf2dI+HJEpVRu9jm6g36M=; b=cSYIh13L4h/OmvagLK6wkVMg/B/O2ulfjM3f25KLHNwHyV17xf2U4ShgrTHfO/hV2+Lf0/S2pnu1WPKkh/STSYgJDYs2HpY9XboHxUnbUFWE1fI4syiqMN88Tg5nYYlI1qMNDRs2A0kgZUshPQEC5rDhzeyxso3DvDJzA7VEkWk4x+TRNBCph32SUqEWFVECRBoHYPsz6VAKfBVlIoqqY1cKyIt6hD6LaOd952J/DMRYN1b7iRfRQHklf+TN0ryHlOdLaM/vapAvFhbfJnYCEe40jl3srr9uTzE8lKktj+lwxIjrTccsFzt+HCit2neDOL55MJSEhHY8sVSFmC9PKQ== 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=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Fgg9cHMriHhGOg+Y24vzMOHf2dI+HJEpVRu9jm6g36M=; b=evGRqBLLsBdjxQSXWNT2b0Qe94LBQwuT1G9GSdq3L3OIyobzfoRSXOSo/Y2dsdqUN8usl/VYEC8FqWKEWkh7O9sTXd6vu7rTLGQBDTyYfE2nOkOjHBQ1q6HgaQT2ogBNbrOHOWSgV7OvciyGyxjzjBoijoZOuuayKtoXUfngNX7pHZDbWA1peF4hsYiO9YLF+gObhBN/dS2rGS3kDkfoafdMYgE5HZYAgEVr7moI5ZVlhwpbX5Ik27RYZ1pphLL6Yv9+Z7KAYx1GtcIqT06dgrBoc7BMNlbOeSRgg7YqtD7UyP4KIiKrlgjyH0tXLKb//rXN2ihe5LoovsIVGqom4g== From: Oleksii Moisieiev To: "xen-devel@lists.xenproject.org" CC: Andrew Cooper , Anthony PERARD , Bertrand Marquis , Jan Beulich , Juergen Gross , Julien Grall , Michal Orzel , Oleksii Moisieiev , =?iso-8859-1?Q?Roger_Pau_Monn=E9?= , Stefano Stabellini , Volodymyr Babchuk , Grygorii Strashko Subject: [PATCH v16 3/6] lib/arm: Add I/O memory copy helpers Thread-Topic: [PATCH v16 3/6] lib/arm: Add I/O memory copy helpers Thread-Index: AQHdddiWmb+yVDTzJkawQsEb2R66UQ== Date: Mon, 16 Nov 2026 14:41:39 +0000 Message-ID: <573dcbe8068394042bb4dc89e7392845a8d497cd.1794839953.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: authentication-results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: GVXPR03MB11113:EE_|GV2PR03MB11211:EE_ x-ms-office365-filtering-correlation-id: 9a71b66d-e8b1-4988-54c4-08df43efb927 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|23010399003|7416014|1800799024|376014|366016|261026135527099003|261026140227099003|261026121527099003|261026130827099003|261028144727099003|261021135927099003|261021133027099003|261021121427099003|261021123027099003|261021130227099003|261022075727099003|261022105027099003|261022115727099003|261022113327099003|261102123227099003|38070700021|56012099006|11063799006|10067099003|260925022911599003|260925021311599003|260925021911599003|22082099003|18002099003|261009223027099003|3023799007; x-microsoft-antispam-message-info: Jv/RLNmDY/06uo3NerrJEgsFVPCe24w7ILobmBRsMGDsAD2wbLZgcXpSau0EQ43FtZQ0vM8RABLbMXng6cmUXQJveo6ZsleYLBZRqn/2yrgPBLYbAuU+Q6lR68haInWd6Kefjco/ReRr2LGpaW5gt/u09uVklVlA3o6w/45amGowfswGBT1M/FdHAh8noBKWEpBSbueRQ/NH8OVRaGo+SIOgLLYMpmh/oAqZ8NrhjHM35TVg5zzx4bhn0if+6qzWek7CcptzlIhAv/2W6/fwOK5eswGgPx8rbwswbGVhNc5kzPHLGcuXw4a2k56TVBvfTGlla8nRor1GmFEXa19+vmADpEU/34QUDfDcaWtspqd2q3K14eP8D4yqcTE9espxam9rCQzOSu0UdXK2zMDTp9MWLHaGxbtMrRykdLEz4saqUeQZ1qnPlTj0urhGvd0Pceet7oK7xDMcfUA3Qo4yJcW6xkoK9sYDB/er972WWGwlDwdB12b7vnN7cdP/2Hb2svXTXln/nXo9TJUR5ycEEbJ8GGAz2dmge51zIqIgssiEVLtGTLlWTGaLkWohJ1u3BRFvTFZtkjDhVySOYDKUY1t1pRPlb0Vkfu+RXULiWSmyK4V2YkSDZqMgdflWnVrV+X8pxn0qBo2ZNVlxZjmQdOyHet2+5aWft8Rb4PD37T5AcZWwZJBWnZDwKpPRwd9Fo5suwmmAbcr1UwekiN6KHFBDNmg6QYxwIJJ0iaELcPA= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:GVXPR03MB11113.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(23010399003)(7416014)(1800799024)(376014)(366016)(261026135527099003)(261026140227099003)(261026121527099003)(261026130827099003)(261028144727099003)(261021135927099003)(261021133027099003)(261021121427099003)(261021123027099003)(261021130227099003)(261022075727099003)(261022105027099003)(261022115727099003)(261022113327099003)(261102123227099003)(38070700021)(56012099006)(11063799006)(10067099003)(260925022911599003)(260925021311599003)(260925021911599003)(22082099003)(18002099003)(261009223027099003)(3023799007);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?BZfEf5Xit7WxqURUKfUouVvDTYui/il+D6uL+b7xhjFud+J0uxBGdZEDIp?= =?iso-8859-1?Q?n/23aHrl1lWF1yq03V5fgLhXtrGraLrjQxxkL7XqAPsq9VN7IhWHJ6WxKQ?= =?iso-8859-1?Q?A3Sb1ak1jbbUVRM6emFn38djgmiipUsQNxxc2mLOHyvo7XJS3ClAsOntwf?= =?iso-8859-1?Q?xSnjicG+RttJRkuzENaBgejC9iOwTeSZGHWl6Uf79JDgtzHGN6RJEKmQJh?= =?iso-8859-1?Q?pYbTLHeonF2JAsqQ+4w+XC5nOJLBhCmdWzfSSbtjipUXLjTosLZW8ma7FU?= =?iso-8859-1?Q?VEyUDAdYB8MQuqXOYbLpm1ca9OrJVpLoRKS0NR8SnU55XQoAZVthQwSAlE?= =?iso-8859-1?Q?16OUoCAihGP+enuhkgmp+Idk+YcPnlI8E6tk2ozfz0tMLMmcAr23rtNtrp?= =?iso-8859-1?Q?41rmpuMtpCNt+yXkyHBxNpRP3hywn6Pf8fLw+pQW0yMX49Lj7K9p5u6Bj1?= =?iso-8859-1?Q?0JW8WOTDBgTIPfYfuSqbKyWNa6IpDGyxb126FWN09HKBePFrvG16uqbB6L?= =?iso-8859-1?Q?hAb0/uGhh0Sxq84NjmdSehYNQkcJDKR18Pd5Uj4CHdsbU3EGhJkye/P8MU?= =?iso-8859-1?Q?pbUP4sLpsFp3lfsV4avc1Z8q+LwTuF62wcxK4qB29h8a6qjp25kkQf3AKv?= =?iso-8859-1?Q?HrQCo8d3c5n2vyiFVpFGwy7U7uv5PJbXpucAz3l5tkFDpoggj2vUZJr9Ol?= =?iso-8859-1?Q?s2eRh5KkfvERZvs65HlARG31yG99kLcch14KdxBS3EHyXoZidM7qnHFEZz?= =?iso-8859-1?Q?r1rNg9bYVGRLQ5JRX2K+ih0YMp40hQnbSSDUzIiN9iMgJreiF8sdFqmshu?= =?iso-8859-1?Q?HJdU4XRXwOCh97PxtZrDOv2DvUMM2Djqj92P+jeKndvu4n4837zcjUiDcm?= =?iso-8859-1?Q?FIi6ZxIloPgDR5C3tBv1Mlcpn/LKYw/AET95se15xW12ZH+m+Y3w/I34vp?= =?iso-8859-1?Q?S+xGrXCQQr/0/DT5jk1oBled6ctkIXZBTudGjZyaYjsCX84ducLIrEFH2k?= =?iso-8859-1?Q?i0Ka2WlAH6B4QInWBk4j62wC+583NO57HRq/OKy04jrA6RxsSRLisscJrx?= =?iso-8859-1?Q?2t1/vN8nUkPOXRQ6XSB+q37XB+S+FHYP88WuMnzOMW6ua3GIqJcxxchW2Q?= =?iso-8859-1?Q?C4ajwGOSiKP92sANr/voWjByarBk6qz9R+RTZhqW8VM8cBJWPV6JajAHMD?= =?iso-8859-1?Q?83/WXfDhBM11CpMdOGV3VY317v5PEvJA763UH+L0/yeFNwUEG4RO/k21OF?= =?iso-8859-1?Q?DUdDaFHJV+8h/hXykhJIpZeqIksfCKf0Hle2HtyyctkRzhwexxTJkLQK0Y?= =?iso-8859-1?Q?WuHFEsE6hZe5ZbAQw3/1WwLk4MjrARkB5Y9vXfLKpBFx/AxoAZ8BZ7m/17?= =?iso-8859-1?Q?lIagvNduFyzfFgrb3v7wi2MuhIcEr5OFlrH5Gvjf/NqCbXeld8vSFqp0Aj?= =?iso-8859-1?Q?koueYL3YSJS7pwenNIGb/p1H7fwNs4EjKTDFBcpNLRSvhErVSOLCAtgr+Q?= =?iso-8859-1?Q?czLUa8ZIakOjTg52KRR2p5JW3nx0IIl7sym10ao6wesIwj2gi5ZmWZx0eg?= =?iso-8859-1?Q?uQsg/3vUCOmFU5jWCe4YxZ+1hFOrb+iaDOduss+/LMo9ySEBRBL89BdPEs?= =?iso-8859-1?Q?DdUBAUZn18W14bucqfz6VGyYQuXMbuFXykwb3JDxcVd/d52K0qDC8+eTe0?= =?iso-8859-1?Q?k1oAsH3U4defXFLKZHRUF36evo3TuRdv0k6jabERw/PLVH3e53/CmbfWdk?= =?iso-8859-1?Q?+SNF1dQcAdZC4F73oHFIY1jbJjwY0v1igkIx/ZQWsxeGhC+J3thGXJ4Tbb?= =?iso-8859-1?Q?0YQkhDron29yuj6JHfsswOHpzkJ1t3o=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: GVXPR03MB11113.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9a71b66d-e8b1-4988-54c4-08df43efb927 X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Nov 2026 14:41:39.1880 (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: 6oFk7KGV9T4q1ObrP5zfgovOkLTFmXCKkYyBR1XSOhqb6nsV5o08BFnqirNdSKRpFU9X/lMnELvN6FROBaLXhzMmO7KdVheRg+af4T82TAY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV2PR03MB11211 X-purgate-ID: tlsNG-ebf023/1794840104-50AD8B50-5DDA12FB/0/0 X-purgate-type: clean X-purgate-size: 10172 X-ZohoMail-DKIM: pass (identity @epam.com) X-ZM-MESSAGEID: 1794840138838158500 Content-Type: text/plain; charset="utf-8" Introduce memcpy_fromio() and memcpy_toio() helpers to copy between regular memory and a memory-like I/O region on Arm. The generic prototypes live in io.h so other architectures can provide their own implementations. The helpers copy a byte sequence: byte accesses are used until the I/O pointer is 32-bit aligned and for the trailing count % 4 bytes, the aligned bulk uses 32-bit accesses. Only the I/O pointer is aligned, the regular memory side is accessed through get_unaligned_le32() / put_unaligned_le32(), so the access widths issued on the I/O side do not depend on the alignment of the memory buffer. These _le32 helpers pair with readl()/writel(), which are little endian accessors, hence the byte sequence is preserved on either CPU endianness. The constraints on the I/O region are documented next to the declarations in xen/io.h, the arch-specific access pattern next to the implementation. Signed-off-by: Oleksii Moisieiev Reviewed-by: Stefano Stabellini --- (no changes since v13) Changes in v13: - memcpy_{from,to}io(): align only the I/O pointer and access the regular memory side through get_unaligned_le32()/put_unaligned_le32(). - document the contract of the helpers in xen/io.h - reword the Arm implementation notes to state the concrete access pattern - drop the incorrect claim about avoiding endianness conversion from the commit message; note instead that the _le32 helpers pair with readl()/writel() so the byte sequence is preserved on either endianness Changes in v12: - Add missed R-B - correct the Emacs footer of both files, which asked for 8 column tab indentation while the code is in 4 column Xen style Changes in v10: - removed extra include in memcpy-{to/from}io.c files Changes in v9: - reword commit description to refer to memcpy_fromio and memcpy_toio - ordering obj-y in Makefile - rename ALL_LIBS to ARCH_LIBS - drop io.h and move definitions to the common header, fix comments to be arch neutral - update comments for memcpy_{from/to}io implementation Changes in v8: - switched to ordered accessors to address the ordering and barrier concerns. - updated the documentation to match the implementation and explicitly state the supported access sizes and granularity. - rename memcpy_* implementation files to memcpu-* to follow naming convension - fix indentation to match Xen style - fix intendation to match Xen style - move memcpy-{from/to}io to more convenient library place Changes in v7: - x86 guidance: removed the speculative note; header now just says each arch supplies its own implementation or macro. - name spacing: dropped the double-underscore; the helpers are now memcpy_fromio / memcpy_toio. The header also explicitly allows an arch to define these as macros before including it. - updated io.c to keep 32-bit transfers safe on arm32 - moved to __raw_read*/__raw_write* accessors to avoid endianness conversio= n. - split the helpers into separate compilation units Changes in v6: - sorted objs in Makefile alhabetically - added newline at the end of Makefile - used uint{N}_t intead of u{N} - add comment about why 32 bit IO operations were used - updated cast opertaions to avoid dropping constness which is wrong - move function definitions to generic place so the could be reused by other arch - add SPDX tag to io.c Changes in v5: - move memcpy_toio/fromio to the generic place xen/arch/arm/Makefile | 1 + xen/arch/arm/arch.mk | 1 + xen/arch/arm/lib/Makefile | 2 ++ xen/arch/arm/lib/memcpy-fromio.c | 56 ++++++++++++++++++++++++++++++++ xen/arch/arm/lib/memcpy-toio.c | 56 ++++++++++++++++++++++++++++++++ xen/include/xen/io.h | 25 ++++++++++++++ 6 files changed, 141 insertions(+) create mode 100644 xen/arch/arm/lib/Makefile create mode 100644 xen/arch/arm/lib/memcpy-fromio.c create mode 100644 xen/arch/arm/lib/memcpy-toio.c diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile index cdcec8cd03..ba61f9e5fd 100644 --- a/xen/arch/arm/Makefile +++ b/xen/arch/arm/Makefile @@ -8,6 +8,7 @@ ifneq ($(CONFIG_NO_PLAT),y) obj-y +=3D platforms/ endif obj-y +=3D firmware/ +obj-y +=3D lib/ obj-$(CONFIG_TEE) +=3D tee/ obj-$(CONFIG_HAS_VPCI) +=3D vpci.o =20 diff --git a/xen/arch/arm/arch.mk b/xen/arch/arm/arch.mk index dea8dbd18a..009bb22c45 100644 --- a/xen/arch/arm/arch.mk +++ b/xen/arch/arm/arch.mk @@ -2,6 +2,7 @@ # arm-specific definitions =20 ARCH_LIBS-y +=3D arch/arm/$(ARCH)/lib/lib.a +ARCH_LIBS-y +=3D arch/arm/lib/lib.a =20 $(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS)) $(call cc-option-add,CFLAGS,CC,-Wnested-externs) diff --git a/xen/arch/arm/lib/Makefile b/xen/arch/arm/lib/Makefile new file mode 100644 index 0000000000..07a0d9186c --- /dev/null +++ b/xen/arch/arm/lib/Makefile @@ -0,0 +1,2 @@ +lib-y +=3D memcpy-fromio.o +lib-y +=3D memcpy-toio.o diff --git a/xen/arch/arm/lib/memcpy-fromio.c b/xen/arch/arm/lib/memcpy-fro= mio.c new file mode 100644 index 0000000000..98339a5cfa --- /dev/null +++ b/xen/arch/arm/lib/memcpy-fromio.c @@ -0,0 +1,56 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include +#include + +/* + * Arm implementation notes: + * - Byte accesses are issued until the I/O pointer is 32-bit aligned and + * for the trailing count % 4 bytes; the aligned bulk uses 32-bit + * accesses. No wider accesses are issued. + * - The access widths on the I/O side depend only on the alignment of the + * I/O pointer and on count. The regular memory side is accessed through + * put_unaligned_le32(), so its alignment has no influence on them. + * - put_unaligned_le32() pairs with readl(), which is a little endian + * accessor, so the byte sequence is preserved on either CPU endianness. + * - The I/O region must be mapped with device attributes; ordering is + * provided by the accessors themselves, no extra barriers are added. + */ + +void memcpy_fromio(void *to, const volatile void __iomem *from, + size_t count) +{ + while ( count && !IS_ALIGNED((unsigned long)from, 4) ) + { + *(uint8_t *)to =3D readb(from); + from++; + to++; + count--; + } + + while ( count >=3D 4 ) + { + put_unaligned_le32(readl(from), to); + from +=3D 4; + to +=3D 4; + count -=3D 4; + } + + while ( count ) + { + *(uint8_t *)to =3D readb(from); + from++; + to++; + count--; + } +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */ diff --git a/xen/arch/arm/lib/memcpy-toio.c b/xen/arch/arm/lib/memcpy-toio.c new file mode 100644 index 0000000000..c0be79586d --- /dev/null +++ b/xen/arch/arm/lib/memcpy-toio.c @@ -0,0 +1,56 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include +#include + +/* + * Arm implementation notes: + * - Byte accesses are issued until the I/O pointer is 32-bit aligned and + * for the trailing count % 4 bytes; the aligned bulk uses 32-bit + * accesses. No wider accesses are issued. + * - The access widths on the I/O side depend only on the alignment of the + * I/O pointer and on count. The regular memory side is accessed through + * get_unaligned_le32(), so its alignment has no influence on them. + * - get_unaligned_le32() pairs with writel(), which is a little endian + * accessor, so the byte sequence is preserved on either CPU endianness. + * - The I/O region must be mapped with device attributes; ordering is + * provided by the accessors themselves, no extra barriers are added. + */ + +void memcpy_toio(volatile void __iomem *to, const void *from, + size_t count) +{ + while ( count && !IS_ALIGNED((unsigned long)to, 4) ) + { + writeb(*(const uint8_t *)from, to); + from++; + to++; + count--; + } + + while ( count >=3D 4 ) + { + writel(get_unaligned_le32(from), to); + from +=3D 4; + to +=3D 4; + count -=3D 4; + } + + while ( count ) + { + writeb(*(const uint8_t *)from, to); + from++; + to++; + count--; + } +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */ diff --git a/xen/include/xen/io.h b/xen/include/xen/io.h index 164a20c5d7..0b60be27c1 100644 --- a/xen/include/xen/io.h +++ b/xen/include/xen/io.h @@ -67,4 +67,29 @@ static inline bool write_mmio(volatile void __iomem *mem= , unsigned long data, return true; } =20 +/* + * Copy a sequence of bytes between regular memory and a memory-like I/O + * region, e.g. shared memory placed in RAM or SRAM mapped with device + * attributes. + * + * The I/O region must behave like byte-addressable storage: it has to + * accept 8-bit accesses at any byte address and naturally aligned 32-bit + * accesses, with plain byte-storage semantics in both cases (no side + * effects, no dependency on the access width). An implementation may use + * any of these widths, but never wider ones. The helpers are therefore + * not suitable for device registers with access-width requirements. + * + * Neither pointer needs to be aligned. The access widths issued on the + * I/O side depend only on the alignment of the I/O pointer and on count, + * never on the alignment of the regular memory pointer. + * + * Implementations are architecture-specific and may impose further + * constraints; see the respective arch//lib/memcpy-{from,to}io.c + * for the exact access pattern. + */ +void memcpy_fromio(void *to, const volatile void __iomem *from, + size_t count); +void memcpy_toio(volatile void __iomem *to, const void *from, + size_t count); + #endif /* XEN_IO_H */ --=20 2.43.0 From nobody Mon Nov 23 22:32:00 2026 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=1794840130; cv=pass; d=zohomail.com; s=zohoarc; b=BIfF+BMju9KKE72BGPeoJWUaIn93J42oQPQhXsBq+2ezrfas66FTfNLkX1pzFu/VQFTA7LDxLpS5euGPYkXxw5jTvlCRLD40CUQGhIJ+UbBADjjrbAnF8ZKJpUU6aoOESGivP1xbxcNzUGogNrlOQaYS0qHgoWxHlWfRpfMlayM= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794840130; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=PPbeoBdLxR0jKsM9ClJGzAg/zJ+VggFYKFyOH4PSLK0=; b=LTGdg84ziRc+BpaYN/GgPwJbjOI8z4zdRHkBEr2nAqSt17qDh6t5fUqOSCy7081vnfXCMDs9koJIB7IFDRWeg9PIZYG7rExZWrvm+YjIzjd5QkXLSOBRWrQA+tyBZ7VWRAYfLncQ+7ZvZQHgZTqwTNOVfq/yB1dvOGoeyEBM7UI= 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 1794840130944888.3280127516891; Mon, 16 Nov 2026 06:42:10 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1491036.1691976 (Exim 4.92) (envelope-from ) id 1xSxu1-0007MG-3q; Mon, 16 Nov 2026 14:41:49 +0000 Received: by outflank-mailman (output) from mailman id 1491036.1691976; Mon, 16 Nov 2026 14:41:49 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xSxu0-0007Lo-UD; Mon, 16 Nov 2026 14:41:48 +0000 Received: by outflank-mailman (input) for mailman id 1491036; Mon, 16 Nov 2026 14:41:47 +0000 Received: from mx.expurgate.net ([194.145.224.20]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xSxty-0006eA-UJ for xen-devel@lists.xenproject.org; Mon, 16 Nov 2026 14:41:47 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1xSxty-00BMqu-AT for xen-devel@lists.xenproject.org; Mon, 16 Nov 2026 15:41:46 +0100 Received: from [10.42.69.4] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6afb161a-2eae-0a2a0a5409dd-0a2a4504af3c-46 for ; Mon, 16 Nov 2026 15:41:46 +0100 Received: from [52.101.66.113] (helo=DUZPR83CU001.outbound.protection.outlook.com) by tlsNG-ebf023.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6afb1627-b57f-0a2a45040019-346542718d39-7 for ; Mon, 16 Nov 2026 15:41:46 +0100 Received: from GVXPR03MB11113.eurprd03.prod.outlook.com (2603:10a6:150:2a9::22) by GV2PR03MB11211.eurprd03.prod.outlook.com (2603:10a6:150:30d::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.615.14; Mon, 16 Nov 2026 14:41:41 +0000 Received: from GVXPR03MB11113.eurprd03.prod.outlook.com ([fe80::13a1:97f6:9d2b:f8cf]) by GVXPR03MB11113.eurprd03.prod.outlook.com ([fe80::13a1:97f6:9d2b:f8cf%6]) with mapi id 15.21.0592.012; Mon, 16 Nov 2026 14:41:41 +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" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=epam.com header.i="@epam.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:x-ms-exchange-senderadcheck" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Csf1vF1V7Z99lnwZtHiIMfk2MWVt31l7AKtabf4WIkcxB8KHQhHdX/8FwZYYjK6UzB8aLjyiD65lYzl4d6AWLXf1E+oDPruF0WqMJ9DSysU8PFJqkShV1XMPAibz/Nwz6a6mnz7D+OQnB2x6xEGsJPrrBj5ap9ztOHUv41EeQNsPYTn1frOzkdXL0W5YU47cDg+00AR7l2vVCxUjZCOEEvBes7sYKZiXbQ0+3Ey6HZbAAoC9gkbfYDiZ5aJwJHngqEKSIir59SayzUxGMLxcE0xEwZcVbtPZWZm0qjx9334+cIW3X2JTXHXQo1gzDipVggfifQqsi4dJwalKb2lydg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=PPbeoBdLxR0jKsM9ClJGzAg/zJ+VggFYKFyOH4PSLK0=; b=NqhcU9e8YBd5da6nTims4qwB80fMY63+did4+VZa0oSm/QikxBfaFUMymYN+s/UcbL9qIqwKgjybwTz6a7RdO9vul/GHlgQ5r/Zq913e7z6mcXNUxsSNUkGEXp2X/dIglqqNCL+K97ToBhQGU6rYkwExVWqHRgM9FUX63Xe9xTN+IHmtBpWlZ+5VEE4i13cWVyr5aaWsQR89bP25zxfnr2bWUlUVqXLRtSiPPcEtD7WOP+bm6cFo7n4DBJIz/Lsbj8ROUj6EydsmsjVFgXZFz8K75AJWjkokebM4wqdgyMXxzKV/D1JyEN9iB/LH2w1KVKq8RSeBRpxAaGvV0sQaXA== 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=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PPbeoBdLxR0jKsM9ClJGzAg/zJ+VggFYKFyOH4PSLK0=; b=c0NZyoZSVl4Ij+ZecKihH2XGUoR+zWDpgbxwCWiOFUiv+2iUiK61dDxq8Ld2Egcb2x4KvRPHqe84/6t7KRd3clUh+ildmjf/xxD+Grk/ep3B6OlpFx6aGrTZ1BhaWishfCqkGyaAm978eaG1sUBIm9L5AJqZgMsRAwt6S3z5bQWZqVu0oFiN5k3hKz2Z51BDzM2PnHM3fiy9E5mtUP0+HN+reClEuyfpdJ/DCWYlnULktNA9pEdY1hJGY8wynce7Y+TTcTdjKfYFLcgN7gECZj0evkAHl5CJBIqdTeEUjXwimsOLN2/1Bt2WqD5v+Bv4zn5/QBFYa7GKnOSFW7tVwQ== From: Oleksii Moisieiev To: "xen-devel@lists.xenproject.org" CC: Andrew Cooper , Anthony PERARD , Bertrand Marquis , Jan Beulich , Juergen Gross , Julien Grall , Michal Orzel , Oleksii Moisieiev , =?iso-8859-1?Q?Roger_Pau_Monn=E9?= , Stefano Stabellini , Volodymyr Babchuk , Grygorii Strashko Subject: [PATCH v16 4/6] xen/arm: scmi: introduce SCI SCMI SMC multi-agent driver Thread-Topic: [PATCH v16 4/6] xen/arm: scmi: introduce SCI SCMI SMC multi-agent driver Thread-Index: AQHdddiWXJg4oXa1gEmNDWvyhUvCnw== Date: Mon, 16 Nov 2026 14:41:39 +0000 Message-ID: <1b9d9b424ca6ace85d0c80983baea8dd0812d3f9.1794839953.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: authentication-results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: GVXPR03MB11113:EE_|GV2PR03MB11211:EE_ x-ms-office365-filtering-correlation-id: f7691459-6a29-4763-1863-08df43efba59 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|23010399003|7416014|1800799024|376014|366016|261026135527099003|261026140227099003|261026121527099003|261026130827099003|261028144727099003|261021135927099003|261021133027099003|261021121427099003|261021123027099003|261021130227099003|261022075727099003|261022105027099003|261022115727099003|261022113327099003|261102123227099003|38070700021|5023799004|56012099006|11063799006|10067099003|260925022911599003|260925021311599003|260925021911599003|22082099003|18002099003|261009223027099003|6133799003|3023799007; x-microsoft-antispam-message-info: UItG48SDjzIZrQaInY2wpTK/hDIx6nn5kBBquwuj52BecAZfiQKrISEJ1Bol5QKDCHs/ZsvZ/RspJ3Ou9UAWycqO1Ojv65s1lIFavTGLlUcV9Lw/aSvrMdbhL1prLXqZCTaFQGTzvCMhOJuUwafevMOWvzUgVNWbKcjqhd3H+djeEJ0ockpRJpyg01qmdI6Tisl+7u6NcjzDmHWp6cF/UCB39MxriKegSApXshAVuNHLKOw8jh4MZcbicd5BZo9iIoYVdeEX8u07Q7eYU47yxiKwgW3oyGV9ixCevJh8oG6LyzI1ex575UjOYJTDAcdtVIl4c4dKKLT5ClF66UcmFJOYvn3UUSEGTTcuaq6KjSuqr3Guu469nUhlKFo5Ek/Z3J4k09LfQEjCdySHIMCFRz3qRvH6xIZjB0ZtiOm1lyFmhdGcmjQgMowCqIG8nGnD8Bg+yDLhroaS8Eb5xCr2cikJEUa2ZdqCUt7tnwZ9PUvOcZUL7FHNWfmg+kzM73rFOXHkvjpS8hbpYvZeUy3z/iRVv7a/8n8IBHUMOQk7sKcfVYLwEs6mWwDyoiM9QYqo5eI5rOKuJzoX2v/C6lWbTyOZdCdL/TugTg2xbgW4vpTaYmD2NV9PhA3wkg110WFucSi3AcH7o4alCpGwh4oUTdVTqsVd+kUg1GYuL7VSepY= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:GVXPR03MB11113.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(23010399003)(7416014)(1800799024)(376014)(366016)(261026135527099003)(261026140227099003)(261026121527099003)(261026130827099003)(261028144727099003)(261021135927099003)(261021133027099003)(261021121427099003)(261021123027099003)(261021130227099003)(261022075727099003)(261022105027099003)(261022115727099003)(261022113327099003)(261102123227099003)(38070700021)(5023799004)(56012099006)(11063799006)(10067099003)(260925022911599003)(260925021311599003)(260925021911599003)(22082099003)(18002099003)(261009223027099003)(6133799003)(3023799007);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?Vjz6ZzoeCsk1e4WIWfEYw34P3ZYGyuuq+ZAQ061g731NWaE9zIszzIfh1n?= =?iso-8859-1?Q?BrFSYpu+47yvZKxhVWKBypE2FDdF19kDsme9qaKE6FxMIF+lBSdKuNMtnY?= =?iso-8859-1?Q?Nng8cwykeHWxyBwCpdNRYeD8Fx1IBnEvu0j9HDtY+AI/W+c4qh8Qcb2vE0?= =?iso-8859-1?Q?xG4HqaSUP9pjCLsBopSkKB63fxVwvVONFlwBXT1Zq8jgqdCJKVexLAzBi/?= =?iso-8859-1?Q?nzAt0I5JusMVRspCiCKPHg4HemX5CGYe1fZsayNrOqtIK/oYzcpYOiniH2?= =?iso-8859-1?Q?mfMati6MV8CxPjihcg4vRV5A0oCWN0+VNfftqr7P9i5A3Vq/XE4Xkid+Dx?= =?iso-8859-1?Q?V+HNtG1DxWvbci4qGEzcZm+gk4UXzgggHi6BkKxTdne3Q4F8TFZt8i8gEw?= =?iso-8859-1?Q?/3Qe3jaJ9wB5DK+dYZNUrYRajDMXv8MR71A3TFE3gwIMDnwqkFEWa5TsC3?= =?iso-8859-1?Q?IjLCZETpCcvrUDr2wvpAQCRZG7ncdG8mDufP7rm7MXoBCL2qvWgMXOULmD?= =?iso-8859-1?Q?OF8CleIrR6ZT82IMHiz3AaEqsCdW3oMgmoQbM8kOSXIJkuamVWHyJV8/yQ?= =?iso-8859-1?Q?X3QuTMnyhgPupXvcYYzgcXzNYgxxX9jAZw7PXIBkrEmgBtS4bItQ+YdOTm?= =?iso-8859-1?Q?jI6OAGcE8KYZo+71kEIkeAA+MV0+uZovhOxc4+WzWaEy0dtVbEhmnKC9uT?= =?iso-8859-1?Q?zlzrarcrYPmLlqlK9w+qpFm+NGOaFgdLGBMlIIxScoiiYovz+xsv/zBqLX?= =?iso-8859-1?Q?WXj3UQcMOydIZOHvMA8PiLA5SUhu2980lznKOL6+m+XQuXNTBgg+P3Sfq8?= =?iso-8859-1?Q?dNtTwsb+uAXAujNZcrqrHeYMYTprZm9fclXfuqODmxLrb6Tt8jP8on9/SC?= =?iso-8859-1?Q?urx3x9MEklb1FzVYUgHITTQ/8Ff1/ldz7ZgpBT/6s6Qd3dFK1dE+EmWVSg?= =?iso-8859-1?Q?Bdp0ewyBcf07sb4Ipn4s194yC3ERrrV0oyfA8+egJVQydusqI31uRpnQW4?= =?iso-8859-1?Q?8RIGVJLPsUKrO3lrVo9vWqd2CyFxeFQ0lAR9S7zjxN8gSJtXvKrOOoVqJo?= =?iso-8859-1?Q?543GPTzLvqg83k6NJDUMVHhe6QBW6Xq2ZuTW//gNBAh0uZWqYLk2t6ysyX?= =?iso-8859-1?Q?sWY0cheZqi424nWW7dkEnMt84NvYYrvmQavEi5jVwoJ8KJgFp9Dj1J6b9+?= =?iso-8859-1?Q?I6+dztnAxwWehlxHBaU+LdWmYCGTtLd1GoQptxqud9WNE5MqEbcScBzZmG?= =?iso-8859-1?Q?6JJO5UX27T3TTc/xy/LxjrtWPvMP4CsL2dHvdhxnVFWMPX6AzFcaC9HRVS?= =?iso-8859-1?Q?JGsq9YohQR+I0ro4sAE1E13rU9i9qAbxHqAROZtuBfXHieoqDnJz94NNhN?= =?iso-8859-1?Q?WvUQw6OffvkSOyfcx3qYg/b8RvtKVzJ0pGl0EGp6LwxYj7B/fdAxSTx8s4?= =?iso-8859-1?Q?gIHxZEW2acIsxY432vMgwcpGUbyjElAWcNop6VbfzPS4QpGIccc0k2Qdcm?= =?iso-8859-1?Q?naA8ezZoFCOfatvkYfvMALvI9htITuHG5UvARM8V5+hWNZaTS5GML+YcjT?= =?iso-8859-1?Q?Hhphu4Sap6HJ6Rh36nbw4FIFq2qHY//fZO7x7/6WnEFbxnK3VwECkL5S9x?= =?iso-8859-1?Q?880l7BLvVLnzWG94nVtdq2r9NLfJW47SPH95GJo7WHAyRtjRGfVdG28NTW?= =?iso-8859-1?Q?BBsbAilooECq9CL7fw21PcqD0ENHABiP59Bc1hTb2gDRBYEdDunMOpSCzz?= =?iso-8859-1?Q?P3DxZ/NXO1VdTXCRoJ1PRLKTS3JTOYRhHGbaaL85pyWDqtoLLmYxeNzerS?= =?iso-8859-1?Q?1Qh4+Dt9T1V0MYsAqzmHxs+sIpa0q0Y=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: GVXPR03MB11113.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f7691459-6a29-4763-1863-08df43efba59 X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Nov 2026 14:41:39.6945 (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: cu+NOKyxDh4nnYLzRY9gP9Vp87oDqI8ffQCQFdVlJxkqWXzMvbFUHAhy8NB7vENe7vzzyl3JB9Akh6hO2gH05sB9Z6ExPuJjscaumalMAUg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV2PR03MB11211 X-purgate-ID: tlsNG-ebf023/1794840106-518D18F0-EB411527/0/0 X-purgate-type: clean X-purgate-size: 76617 X-ZohoMail-DKIM: pass (identity @epam.com) X-ZM-MESSAGEID: 1794840132800158500 Content-Type: text/plain; charset="utf-8" Add an SCI mediator for Arm EL3 firmware, such as Trusted Firmware-A (TF-A), that provides a separate SCMI SMC shared-memory channel for each agent. Xen keeps a trusted management agent and assigns secondary agents exclusively to domains, as shown below. +-----------------------------------------+ | | | EL3 TF-A SCMI | +-------+--+-------+--+-------+--+-------++ |shmem1 | |shmem0 | |shmem2 | |shmemX | +-----+-+ +---+---+ +--+----+ +---+---+ smc-id1 | | | | agent1 | | | | +-----v--------+---------+-----------+----+ | | | | | | | Xen | | | +--------------+---------+-----------+----+ smc-id0 | smc-id2| smc-idX| agent0 | agent2 | agentX | | | | +----v---+ +--v-----+ +--v-----+ | | | | | | | Dom0 | | Dom1 | | DomX | | | | | | | | | | | | | +--------+ +--------+ +--------+ Each channel consists of an arm,smc-id doorbell and a shared-memory buffer whose address and nonzero size are Xen page aligned. Xen maps shared memory as Device memory. Guests exchange messages directly through their assigned buffer; Xen checks the SMC function ID before forwarding the call synchronously to EL3. Require BASE_SET_DEVICE_PERMISSIONS support. Query its availability using Base PROTOCOL_MESSAGE_ATTRIBUTES before registering the mediator and fail initialization if the command is unavailable. Firmware must enforce the permissions configured by Xen and prevent untrusted agents from changing other agents' permissions. Keep BASE_RESET_AGENT_CONFIGURATION optional. Request an agent reset through the management channel when relinquishing a domain's resources. Warn if reset fails, explaining that device state and permissions may persist and agent reuse may be unsafe. Unsupported reset permits teardown; other reset errors propagate to the caller. Bind only to the arm,scmi-smc management node inside a xen,sci-compatible node beneath /chosen. Other SCMI nodes, including the host /firmware/scmi, are ignored by the mediator. Describe secondary agents as xen,scmi-agent children of its agents node, with #address-cells =3D <1> and phandle. At least one enabled secondary agent is required. The optional single-cell reg property specifies an agent ID in 0..254. Use a matching hexadecimal unit address for an explicit ID and retain a node label for domain phandle references. For example: / { #address-cells =3D <2>; #size-cells =3D <2>; scmi_shm_0: sram@47ff0000 { compatible =3D "arm,scmi-shmem"; reg =3D <0x0 0x47ff0000 0x0 0x1000>; }; firmware { scmi: scmi { compatible =3D "arm,scmi-smc"; arm,smc-id =3D <0x82000002>; /* Host OSPM agent smc-id */ #address-cells =3D <1>; #size-cells =3D <0>; shmem =3D <&scmi_shm_0>; /* Host OSPM agent shmem */ }; }; chosen { #address-cells =3D <2>; #size-cells =3D <2>; ranges; xen { #address-cells =3D <2>; #size-cells =3D <2>; ranges; xen_scmi_config { compatible =3D "xen,sci"; #address-cells =3D <2>; #size-cells =3D <2>; ranges; xen,dom0-sci-agent =3D <&scmi_agent_dom0>; /* Xen management channel */ scmi_shm_1: sram@47ff1000 { compatible =3D "arm,scmi-shmem"; reg =3D <0x0 0x47ff1000 0x0 0x1000>; }; scmi_shm_2: sram@47ff2000 { compatible =3D "arm,scmi-shmem"; reg =3D <0x0 0x47ff2000 0x0 0x1000>; }; scmi_shm_3: sram@47ff3000 { compatible =3D "arm,scmi-shmem"; reg =3D <0x0 0x47ff3000 0x0 0x1000>; }; scmi_xen: scmi { compatible =3D "arm,scmi-smc"; arm,smc-id =3D <0x82000003>; /* Xen management smc-id */ #address-cells =3D <1>; #size-cells =3D <0>; #access-controller-cells =3D <1>; shmem =3D <&scmi_shm_1>; /* Xen management agent shmem = */ }; agents { #address-cells =3D <1>; #size-cells =3D <0>; scmi_agent_dom0: agent@0 { compatible =3D "xen,scmi-agent"; reg =3D <0>; arm,smc-id =3D <0x82000002>; shmem =3D <&scmi_shm_0>; }; scmi_agent_domu: agent@2 { compatible =3D "xen,scmi-agent"; reg =3D <2>; arm,smc-id =3D <0x82000004>; shmem =3D <&scmi_shm_2>; }; scmi_agent_domu3: agent@3 { compatible =3D "xen,scmi-agent"; reg =3D <3>; arm,smc-id =3D <0x82000005>; shmem =3D <&scmi_shm_3>; }; }; }; }; }; }; To discover the secondary ID from firmware, replace only scmi_agent_domu: agent@2 with the following node. Omit reg and the unit address, but keep the label so the domain phandle still resolves: scmi_agent_domu: agent-domu { compatible =3D "xen,scmi-agent"; arm,smc-id =3D <0x82000004>; shmem =3D <&scmi_shm_2>; }; Xen always discovers its own management agent ID. For secondary agents without reg, send BASE_DISCOVER_AGENT on the channel described by that node's arm,smc-id and shmem. Validate the response before inserting the channel, rejecting invalid IDs, duplicates and clashes with the management agent. Supplying reg skips mapping and probing that secondary channel. Discovery failure aborts initialization rather than guessing an ID from the node name, phandle or SMC function ID. Dom0 selects an enabled secondary agent using xen,dom0-sci-agent in the xen,sci node, as shown above. An absent property disables SCMI for Dom0; an invalid reference warns and disables it. When enabled, Xen copies the host /firmware/scmi description to Dom0 unmodified. Its doorbell and shared memory must match the selected agent's channel. A dom0less guest selects an agent with xen,sci-agent in its xen,domain node. Add this domain configuration to /chosen, alongside the Xen SCMI configuration above: / { chosen { domU1 { compatible =3D "xen,domain"; xen,sci_type =3D "scmi_smc_multiagent"; xen,sci-agent =3D <&scmi_agent_domu>; /* Other domain and boot-module properties go here. */ }; }; }; Both selectors contain phandles to agent nodes, not numeric agent IDs. SCI initialization completes discovery before boot-domain construction. The optional SCI get_agent_id callback, dispatched by sci_get_agent_id(), resolves either phandle to the configured or discovered ID saved with the channel. It does not issue another discovery request. Existing channel acquisition enforces exclusive ownership; invalid dom0less references fail domain construction. Toolstack-created guests continue to select a numeric agent_id through arm_sci, for example: arm_sci =3D "type=3Dscmi_smc_multiagent,agent_id=3D2" iomem =3D [ "47ff2,1@22001" ] The guest's partial DT must describe the corresponding doorbell and guest shared-memory address. Dom0less guests map the same channel through xen,reg in their partial DT. Use Xen's management SCMI node as an access-controller provider. Devices reference scmi_xen, which declares #access-controller-cells =3D <1>: &i2c1 { access-controllers =3D <&scmi_xen 0>; }; Dom0 and dom0less device assignment paths invoke sci_assign_dt_device(). For toolstack-created domains, include all passed-through SCMI-managed devices in xl.cfg's dtdev list, including devices without IOMMU protection. Keep Xen's shared-memory descriptions under xen_scmi_config and leave the host OSPM node and /firmware/scmi unchanged. These descriptions do not reserve RAM. If buffers occupy system RAM, the platform must reserve the whole firmware-owned range separately in /reserved-memory before Xen boots. SRAM outside system RAM does not need a RAM reservation. Factor out the SCMI protocol definitions and shared-memory transport, record the feature in MAINTAINERS and SUPPORT.md, and document the pre-existing scmi-smc-passthrough command-line option. Full host and guest configuration examples are in the binding and hypervisor guide. [0] https://developer.arm.com/documentation/den0056 [1] https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/= tree/Documentation/devicetree/bindings/firmware/arm,scmi.yaml [2] https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/= tree/Documentation/devicetree/bindings/access-controllers/access-controller= s.yaml Signed-off-by: Grygorii Strashko Signed-off-by: Oleksii Moisieiev --- Changes in v16: - didn't add R-B from Volodymyr since changes to commit were made which requires additional review - require BASE_SET_DEVICE_PERMISSIONS support; query it through PROTOCOL_MESSAGE_ATTRIBUTES on the management channel and fail probe before registering the mediator if the command is unavailable - warn when BASE_RESET_AGENT_CONFIGURATION fails, explaining that device state and permissions may persist and agent reuse may be unsafe; keep unsupported reset non-fatal and propagate other reset errors - replace numeric Dom0/dom0less agent selection with xen,dom0-sci-agent and xen,sci-agent phandles to enabled secondary agent nodes - resolve agent phandles through the registered channels so both explicit and firmware-discovered IDs work; reject malformed references and nodes that were not registered as secondary agents - add the optional SCI get_agent_id callback and dispatch both boot-domain selectors through sci_get_agent_id(), keeping domain construction independent of the SCMI driver's private implementation - when reg is absent, discover and save the channel ID during probe; resolve either domain phandle to that saved ID without another SMC - retain secondary agents' optional reg property and the agents node's address/size-cell requirements; add labels for domain phandle references with explicit or discovered IDs - update the boot DT binding and examples for the phandle-based selection and the required permission command Changes in v15: - rename the shared-memory helpers to scmi_put_message() and scmi_get_message(), and remove redundant volatile parameter qualifiers - use writel_relaxed() consistently for the request control fields and explain their Device-memory ordering - retain the naturally aligned shared-memory structure and verify its transport field offsets at compile time instead of adding __packed - correct the SMC diagnostic wording and wrap long lines, retaining the size-error diagnostics as agreed during review - document the limit derived from the Base protocol's eight-bit agent count: platform ID 0 is separate, so 255 agents plus the platform occupy IDs 0..255 and fit in the eight-bit domain configuration field - use paddr_t for channel physical addresses, PRIpaddr for their diagnostics, and uint64_t for DT address and size decoding - initialize channel status through an MMIO accessor - mark free_channel_list() and the Dom0 DT callback as __init - move the response trace before the cleanup label, skip it on send failure, and rename the label to cleanup - use %pd for domain diagnostics Changes in v14: - replace the flat secondary-agent list and its cell-count property with xen,scmi-agent child nodes under agents, using reg for an optional ID - scope secondary-agent parsing to the management channel's xen,sci contain= er - resolve discovered IDs before insertion and reject duplicate or invalid I= Ds - validate shared-memory phandles, addresses and nonzero page-aligned sizes - retain shared-memory nodes under xen_scmi_config and document platform reservations separately, following the review discussion - update binding examples and commit description for the child-node format - match the const-qualified SCI domain_sanitise_config callback interface Changes in v13: - fix typo in commit description Changes in v12: - rebase to the latest staging - return EINVAL if xen,sci_type=3Dscmi_smc_multiagent was set but CONFIG_SCMI_SMC_MA not set - put arm_sci_agent_id after v8r_el1_msa and before pad to preserve order. Reduced pad from uint16_t to uint8_t to fill the gap (was 2 bytes before adding arm_sci_agent_id and left only 1, so used uint8_t to preserve structure size) - fix scmi_handle_call to use arm_smccc_guest_smc helper function - update send_smc_message function to use new format of arm_smccc_1_1_smc - guard the Dom0 SCMI agent id setup in create_dom0() and MA related funcitons with CONFIG_SCMI_SMC_MA - fix the xen_scmi_config example in booting.txt, which placed properties after subnodes and was rejected by dtc with "Properties must precede subnodes" Changes in v10: - Fix tabs in MAINTAINERS file - remove duplicate SPDX tag from scmi-shmem.c - add cast to ARM_SMCCC_INVALID_PARAMETER to settle the sign since ARM_SMCCC_INVALID_PARAMETER is -3 which is part of the spec and resp is the default smccc call structure. - update free_channel_list. Add spinlock to avoid race condition and a comment with a description of the function work - preserve error of smc_create_channel in scmi_probe - check scmi shmem address alignment as wel as it is done for size - check for d->arch.sci_data !=3D NULL in scmi_handle_call - use SCMI_SHMEM_MAPPED size for iomem_permit_access - change len type to unsigned in shmem_{get|put}_message - rename shmem_channel_is_free to shmem_channel_status - add comment about skipping message status when getting message response - Set correct agent_id ranges for dom0less and a toolstack. Agent_id 0 is not binded for dom0 so can be reused. Also mentioned that UINT8_MAX (255) is treated as invalid agent_id. - Split hypervisor and toolstack changes into separate commits - move init list and spin init after initial checks in probe call - fix typo in comments - clean resources when sci_register returns an error. Changes in v9: - sort and refactor MAINTAINERS enties - remove Spurious changes - add extra check to avoid ASSERT when calling unmap_channel_memory from assign device method - set correct tx flag to SCMI_BASE_AGENT_PERMISSIONS_RESET when freeing resources. Flag should be set to 1 according to the section 4.2.2.12 [0]. - fix dt node copmaring - moved channel->shmem check from ASSERT in unmap_memory_channel to "if" statement. This will prevent firing ASSERT if unmap_channel_memory was called twice on the same channel. Changes in v8: - update xen_scmi func_id in commit description - updated documentation with the new DT format - updated opt_dom0_scmi_agent_id setting to avoid it to be equal SCMI_AGENT_ID_INVALID. - changed SCMI_AGENT_ID_INVALID from 0xff to UINT8_MAX which makes code more clear showing that UINT8_MAX is theated like invalid agent_id and couldn't be used. Also excluded SCMI_AGENT_ID_INVALID from acceptable value range - remove outdated xen,config property ignore, added xen,sci compatible to skip_matches in handle_node - add documentation for pre-existing scmi-smc-passthrough command line option in alphabetically correct location (in 's' section) - add note to commit description about documentation for previously undocumented scmi-smc-passthrough - Fix SMC IDs in DT examples (Xen management uses 0x82000003, Dom0 uses 0x8= 2000002) - Add explicit note explaining why Dom0 and Xen channels do not conflict - Document dom0less multi-agent configuration example (xen,sci_type / xen,s= ci-agent-id) - Add scmi_xen node to agent-discovery example with #scmi-secondary-agents-= cells =3D 2 - Drop dom0=3Dsci-agent-id command line handling; Dom0 SCMI is now enabled = via xen,dom0-sci-agent-id in the xen,sci DT container - Refresh docs and examples to mention the DT property instead of the cmdli= ne option Changes in v7: - rework scmi nodes for xen to match on compatible string instead of the direct path Changes in v6: - updated scmi-shmem to use io.h from generic location - update scmi_agent_id parameter to be provided inside dom0=3D parameter list and have the following format "dom0=3Dsci-agent-id=3D0" This change was done as a response for Stefano comment and requires a lot of code changes, but produces much cleaner solution that's why I've added it to the code. - fix file comments and return codes - fix lenght checks in shmem_{get,put}_message to use offsetof - remove len member from scmi_channel structure as it is not used - set scmi-secondary-agents property to be mandatory since if no secondary agents were provided then there is no sence to enable scmi when no secondary agents are populated to the Domains - update documentation in booting.txt, added xen_scmi node to the example - adjust d->arch.sci_enabled value in scmi_domain_destroy - fix lock management in smc_create_channel call - avoid extra map_channel_memory command for Xen management channel because collect_agent_id call unmaps memory if DOMID_XEN is not set. So for Xen management channel we can init domain_id ad DOMID_XEN before calling collect_agent_id so memory shouldn't be unmapped. Changes in v5: - fix device-tree example format in booting.txt, added ";" after "}". - update define in scmi-proto.h - update define in scmi-shmem.h file - scmi_assign_device - do not ignore -EOPNOTSUPP return code of the do_smc_xfer - remove overwriting agent_channel->agent_id after SCMI_BASE_DISCOVER_AGENT call - add multi-agent files to the MAINTAINERS - add SCMI multi-agent description to the SUPPORT.md - handle ARM_SMCCC_INVALID_PARAMETER return code and return -EINVAL for smc call - updated collect_agents function. Set agent_id parameter as optional in scmi-secondary-agents device-tree property - introduce "#scmi-secondary-agents-cells" parameter to set if agent_id was provided - reanme xen,scmi-secondary-agents property to scmi-secondary-agents - move memcpu_toio/fromio for the generic place - update Xen to get management channel from /chosen/xen,config node - get hypervisor channnel from node instead of using hardcoded - update handling scmi and shmem nodes for the domain - Set multi-agent driver to support only Arm64 Changes in v4: - toolstack comments from Anthony PERARD - added dom0less support - added doc for "xen,scmi-secondary-agents" MAINTAINERS | 1 + SUPPORT.md | 11 + docs/misc/arm/device-tree/booting.txt | 215 +++++ xen/arch/arm/dom0less-build.c | 17 + xen/arch/arm/domain_build.c | 40 + xen/arch/arm/firmware/Kconfig | 12 + xen/arch/arm/firmware/Makefile | 1 + xen/arch/arm/firmware/sci.c | 12 + xen/arch/arm/firmware/scmi-proto.h | 183 ++++ xen/arch/arm/firmware/scmi-shmem.c | 129 +++ xen/arch/arm/firmware/scmi-shmem.h | 45 + xen/arch/arm/firmware/scmi-smc-multiagent.c | 875 ++++++++++++++++++++ xen/arch/arm/include/asm/firmware/sci.h | 17 + xen/include/public/arch-arm.h | 5 +- 14 files changed, 1562 insertions(+), 1 deletion(-) create mode 100644 xen/arch/arm/firmware/scmi-proto.h create mode 100644 xen/arch/arm/firmware/scmi-shmem.c create mode 100644 xen/arch/arm/firmware/scmi-shmem.h create mode 100644 xen/arch/arm/firmware/scmi-smc-multiagent.c diff --git a/MAINTAINERS b/MAINTAINERS index c60afc93a5..cd6d1243bd 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -534,6 +534,7 @@ SCI MEDIATORS R: Oleksii Moisieiev S: Supported F: xen/arch/arm/firmware/sci.c +F: xen/arch/arm/firmware/scmi-*.[ch] F: xen/arch/arm/include/asm/firmware/sci.h =20 SEABIOS UPSTREAM diff --git a/SUPPORT.md b/SUPPORT.md index eb07332462..dc41a6b2f3 100644 --- a/SUPPORT.md +++ b/SUPPORT.md @@ -972,6 +972,17 @@ by hwdom. Some platforms use SCMI for access to system= -level resources. =20 Status: Supported =20 +### Arm: SCMI SMC multi-agent support + +Enable support for the multi-agent configuration of the EL3 Firmware, which +allows Xen to provide an SCMI interface to the Domains. +Xen manages access permissions to the HW resources and provides an SCMI in= terface +to the Domains. Each Domain is represented as a separate Agent, which can +communicate with EL3 Firmware using a dedicated shared memory region, and +notifications are passed through by Xen. + + Status, ARM64: Tech Preview + ### ARM: Guest PSCI support =20 Emulated PSCI interface exposed to guests. We support all mandatory diff --git a/docs/misc/arm/device-tree/booting.txt b/docs/misc/arm/device-t= ree/booting.txt index 3787d2e2b6..8ddddd5bf8 100644 --- a/docs/misc/arm/device-tree/booting.txt +++ b/docs/misc/arm/device-tree/booting.txt @@ -331,6 +331,21 @@ with the following properties: Should be used together with scmi-smc-passthrough Xen command line option. =20 + - "scmi_smc_multiagent" + + Enables ARM SCMI SMC multi-agent support for the guest by enabling SCM= I over + SMC calls forwarding from domain to the EL3 firmware (like ARM + Trusted Firmware-A) with a multi SCMI OSPM agent support. + Select the guest's SCMI agent with the "xen,sci-agent" phandle propert= y. + +- xen,sci-agent + + A single phandle to an enabled xen,scmi-agent node in the registered + controller's agents child node. Required when xen,sci_type is + "scmi_smc_multiagent". Xen uses the referenced agent's configured or + discovered ID. Each agent can be assigned to only one domain. Missing, + malformed or invalid references cause domain construction to fail. + - v8r_el1_msa =20 A string property specifying whether, on Armv8-R systems at EL1, a dom= ain @@ -847,3 +862,203 @@ The automatically allocated static shared memory will= get mapped at 0x80000000 in DomU1 guest physical address space, and at 0x90000000 in Dom= U2 guest physical address space. DomU1 is explicitly defined as the owner dom= ain, and DomU2 is the borrower domain. + +SCMI SMC multi-agent support +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D + +To enable SCMI SMC multi-agent support (CONFIG_SCMI_SMC_MA), provide the +Xen-specific agent configuration in the host DT, matching the channels +provided by the EL3 firmware. The configuration must be in a node compatib= le +with "xen,sci" beneath "/chosen" (for example +"/chosen/xen/xen_scmi_config/scmi"). The +Xen SCMI mediator will bind only to the "arm,scmi-smc" node that is a chil= d of +this "xen,sci" node; any other "arm,scmi-smc" nodes (for example under +"/firmware") are ignored to avoid stealing the host's SCMI OSPM instance. + +- agents + + Required child node of xen,sci. Describes the secondary SCMI + agents available for assignment to domains. Set #address-cells =3D <1> + and #size-cells =3D <0> in this node. At least one enabled child with + compatible =3D "xen,scmi-agent" is required. Each such child has: + + - reg: Optional single-cell SCMI agent ID in the range + 0..254. When absent, Xen discovers the ID using BASE_DISCOVER_AGENT + on that channel. A malformed property is rejected. With an explicit + ID, use a matching hexadecimal unit address, for example + scmi_agent_domu: agent@2 { reg =3D <2>; ... }. Without reg, use a no= de + name without a unit address, for example scmi_agent_domu: agent-domu. + Use the label scmi_agent_domu for phandle references in either case. + - arm,smc-id: Required SMC function ID for this agent's doorbell. + - shmem: Required single phandle to an arm,scmi-shmem node. Its address + and nonzero size must be Xen page aligned. + + Agent IDs must be unique, including IDs returned by discovery, and must + not identify Xen's management agent. Children marked disabled are igno= red. + The management arm,scmi-smc node remains a sibling of agents, directly + under xen,sci. + +- xen,dom0-sci-agent + + Optional single phandle in the xen,sci node, selecting an enabled + xen,scmi-agent child of agents for Dom0. When omitted or invalid, SCMI + stays disabled for Dom0; invalid references produce a warning. + The selected agent's arm,smc-id and shared-memory region must match the + host /firmware/scmi channel passed to Dom0. + +Place the SCMI-specific shared-memory nodes inside xen_scmi_config, while = the +platform's existing /firmware/scmi and its shared-memory node stay unchang= ed. +Shared-memory nodes describe channel locations; they do not reserve RAM. +If the channel buffers occupy system RAM, the platform DT must reserve the +whole firmware-owned range in /reserved-memory before Xen boots. One +reservation may cover several channels, including channels not listed in +this configuration. SRAM outside system RAM does not require a RAM +reservation. Moving the channel nodes into /reserved-memory is not require= d. + +BASE_SET_DEVICE_PERMISSIONS is required. Xen checks its availability using +PROTOCOL_MESSAGE_ATTRIBUTES on the management channel before registering +the mediator. Initialization fails if the command is unavailable. +BASE_RESET_AGENT_CONFIGURATION is optional; if it is unsupported, domain +teardown continues with a warning that device state and permissions may +persist. Reusing the agent then requires platform-specific care. + +As an example: + +/ { + #address-cells =3D <2>; + #size-cells =3D <2>; + + scmi_shm_0: sram@47ff0000 { + compatible =3D "arm,scmi-shmem"; + reg =3D <0x0 0x47ff0000 0x0 0x1000>; + }; + + firmware { + scmi: scmi { + compatible =3D "arm,scmi-smc"; + arm,smc-id =3D <0x82000002>; + #address-cells =3D <1>; + #size-cells =3D <0>; + shmem =3D <&scmi_shm_0>; + }; + }; + + chosen { + #address-cells =3D <2>; + #size-cells =3D <2>; + ranges; + + xen { + #address-cells =3D <2>; + #size-cells =3D <2>; + ranges; + + xen_scmi_config { + compatible =3D "xen,sci"; + #address-cells =3D <2>; + #size-cells =3D <2>; + ranges; + xen,dom0-sci-agent =3D <&scmi_agent_dom0>; + + /* Xen management channel */ + scmi_shm_1: sram@47ff1000 { + compatible =3D "arm,scmi-shmem"; + reg =3D <0x0 0x47ff1000 0x0 0x1000>; + }; + + scmi_shm_2: sram@47ff2000 { + compatible =3D "arm,scmi-shmem"; + reg =3D <0x0 0x47ff2000 0x0 0x1000>; + }; + + scmi_shm_3: sram@47ff3000 { + compatible =3D "arm,scmi-shmem"; + reg =3D <0x0 0x47ff3000 0x0 0x1000>; + }; + + scmi_xen: scmi { + compatible =3D "arm,scmi-smc"; /* Xen management agent= func_id */ + arm,smc-id =3D <0x82000003>; + #address-cells =3D <1>; + #size-cells =3D <0>; + #access-controller-cells =3D <1>; + shmem =3D <&scmi_shm_1>; /* Xen management agent shmem= */ + }; + + agents { + #address-cells =3D <1>; + #size-cells =3D <0>; + + scmi_agent_dom0: agent@0 { + compatible =3D "xen,scmi-agent"; + reg =3D <0>; + arm,smc-id =3D <0x82000002>; + shmem =3D <&scmi_shm_0>; + }; + + scmi_agent_domu: agent@2 { + compatible =3D "xen,scmi-agent"; + reg =3D <2>; + arm,smc-id =3D <0x82000004>; + shmem =3D <&scmi_shm_2>; + }; + + scmi_agent_domu3: agent@3 { + compatible =3D "xen,scmi-agent"; + reg =3D <3>; + arm,smc-id =3D <0x82000005>; + shmem =3D <&scmi_shm_3>; + }; + }; + }; + }; + }; +}; + +This keeps the host OSPM channel (SMC 0x82000002, shmem 0x47ff0000) separa= te +from Xen's privileged management channel (SMC 0x82000003, shmem 0x47ff1000= ). +The xen,sci subtree is omitted from Dom0's device tree. + +To discover a secondary agent ID, omit reg and the unit address from its +node. Keep its label so references remain valid. For example, replace only +scmi_agent_domu: agent@2 above with: + +scmi_agent_domu: agent-domu { + compatible =3D "xen,scmi-agent"; + arm,smc-id =3D <0x82000004>; + shmem =3D <&scmi_shm_2>; +}; + +BASE_DISCOVER_AGENT is required on secondary channels only when +reg is omitted. Xen always uses it to discover its management +agent ID. Providing +reg avoids mapping and probing the secondary channel during +initialization. Domain phandles work with both explicit and discovered IDs. + +The xen,dom0-sci-agent and xen,sci-agent values identify nodes, not agent +IDs. When the referenced node has no reg, Xen sends BASE_DISCOVER_AGENT +on that node's arm,smc-id/shmem channel during mediator initialization. +The returned ID is saved with the channel and used by either selector +during domain construction. A discovery error fails initialization; +neither the node name nor the phandle value is used as an agent ID. + +Dom0less example (multi-agent) +------------------------------- + +Use the same Xen SCMI configuration as above. Remove xen,dom0-sci-agent +if Dom0 does not use SCMI. Add xen,sci_type and xen,sci-agent to the +predefined guest's node under /chosen: + +chosen { + domU1 { + compatible =3D "xen,domain"; + xen,sci_type =3D "scmi_smc_multiagent"; + xen,sci-agent =3D <&scmi_agent_domu>; + /* Additional domain properties (memory, cpus, kernels, etc.) */ + }; +}; + +The guest's partial DT and shared-memory mapping must use the SMC function +ID and shared-memory channel associated with scmi_agent_domu in the agents +node. Toolstack-created guests still select a numeric ID using arm_sci in +xl.cfg; they do not reference host DT phandles. diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c index 7bbb2eafb6..8c0adb9ead 100644 --- a/xen/arch/arm/dom0less-build.c +++ b/xen/arch/arm/dom0less-build.c @@ -293,6 +293,23 @@ static int __init domu_dt_sci_parse(struct dt_device_n= ode *node, =20 d_cfg->arch.arm_sci_type =3D XEN_DOMCTL_CONFIG_ARM_SCI_SCMI_SMC; } + else if ( !strcmp(sci_type, "scmi_smc_multiagent") ) + { + uint8_t agent_id; + + if ( !IS_ENABLED(CONFIG_SCMI_SMC_MA) ) + { + printk(XENLOG_ERR "xen,sci_type=3Dscmi_smc_multiagent requeste= d, but CONFIG_SCMI_SMC_MA not set\n"); + return -EINVAL; + } + + ret =3D sci_get_agent_id(node, "xen,sci-agent", &agent_id); + if ( ret ) + return ret; + + d_cfg->arch.arm_sci_type =3D XEN_DOMCTL_CONFIG_ARM_SCI_SCMI_SMC_MA; + d_cfg->arch.arm_sci_agent_id =3D agent_id; + } else { printk(XENLOG_ERR "xen,sci_type in not valid (%s) for domain %s\n", diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 72f6f7539a..bc2a24b71b 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -88,6 +88,36 @@ int __init parse_arch_dom0_param(const char *s, const ch= ar *e) return -EINVAL; } =20 +#ifdef CONFIG_SCMI_SMC_MA +/* SCMI agent ID for Dom0 resolved from a phandle in the xen,sci node. */ +#define SCMI_AGENT_ID_INVALID UINT8_MAX + +static uint8_t __init get_dom0_scmi_agent_id(void) +{ + const struct dt_device_node *config_node; + uint8_t agent_id; + int ret; + + config_node =3D dt_find_compatible_node(NULL, NULL, "xen,sci"); + if ( !config_node ) + return SCMI_AGENT_ID_INVALID; + + if ( !dt_find_property(config_node, "xen,dom0-sci-agent", NULL) ) + return SCMI_AGENT_ID_INVALID; + + ret =3D sci_get_agent_id(config_node, "xen,dom0-sci-agent", &agent_id); + if ( ret ) + { + printk(XENLOG_WARNING + "Invalid xen,dom0-sci-agent (%d), SCMI disabled for Dom0\n", + ret); + return SCMI_AGENT_ID_INVALID; + } + + return agent_id; +} +#endif /* CONFIG_SCMI_SMC_MA */ + /* Override macros from asm/page.h to make them work with mfn_t */ #undef virt_to_mfn #define virt_to_mfn(va) _mfn(__virt_to_mfn(va)) @@ -1480,6 +1510,7 @@ static int __init handle_node(struct domain *d, struc= t kernel_info *kinfo, DT_MATCH_TYPE("memory"), /* The memory mapped timer is not supported by Xen. */ DT_MATCH_COMPATIBLE("arm,armv7-timer-mem"), + DT_MATCH_COMPATIBLE("xen,sci"), { /* sentinel */ }, }; static const struct dt_device_match timer_matches[] __initconst =3D @@ -1975,6 +2006,15 @@ void __init create_dom0(void) dom0_cfg.arch.tee_type =3D tee_get_type(); dom0_cfg.max_vcpus =3D dom0_max_vcpus(); =20 +#ifdef CONFIG_SCMI_SMC_MA + /* Resolve the Dom0 agent phandle provided in the xen,sci node. */ + dom0_cfg.arch.arm_sci_agent_id =3D get_dom0_scmi_agent_id(); + dom0_cfg.arch.arm_sci_type =3D (dom0_cfg.arch.arm_sci_agent_id !=3D + SCMI_AGENT_ID_INVALID) ? + XEN_DOMCTL_CONFIG_ARM_SCI_SCMI_SMC_MA : + XEN_DOMCTL_CONFIG_ARM_SCI_NONE; +#endif + if ( iommu_enabled ) dom0_cfg.flags |=3D XEN_DOMCTL_CDF_iommu; =20 diff --git a/xen/arch/arm/firmware/Kconfig b/xen/arch/arm/firmware/Kconfig index 5c5f0880c4..972cd9b173 100644 --- a/xen/arch/arm/firmware/Kconfig +++ b/xen/arch/arm/firmware/Kconfig @@ -29,6 +29,18 @@ config SCMI_SMC driver domain. Use with EL3 firmware which supports only single SCMI OSPM agent. =20 +config SCMI_SMC_MA + bool "Enable ARM SCMI SMC multi-agent driver" + depends on ARM_64 + select ARM_SCI + help + Enables SCMI SMC/HVC multi-agent in XEN to pass SCMI requests from Doma= ins + to EL3 firmware (TF-A) which supports multi-agent feature. + This feature allows to enable SCMI per Domain using unique SCMI agent_i= d, + so Domain is identified by EL3 firmware as an SCMI Agent and can access + allowed platform resources through dedicated SMC/HVC Shared memory based + transport. + endchoice =20 endmenu diff --git a/xen/arch/arm/firmware/Makefile b/xen/arch/arm/firmware/Makefile index 71bdefc24a..37927e690e 100644 --- a/xen/arch/arm/firmware/Makefile +++ b/xen/arch/arm/firmware/Makefile @@ -1,2 +1,3 @@ obj-$(CONFIG_ARM_SCI) +=3D sci.o obj-$(CONFIG_SCMI_SMC) +=3D scmi-smc.o +obj-$(CONFIG_SCMI_SMC_MA) +=3D scmi-shmem.o scmi-smc-multiagent.o diff --git a/xen/arch/arm/firmware/sci.c b/xen/arch/arm/firmware/sci.c index 371eca019c..d3c143de55 100644 --- a/xen/arch/arm/firmware/sci.c +++ b/xen/arch/arm/firmware/sci.c @@ -29,6 +29,18 @@ int sci_register(const struct sci_mediator_ops *ops) return 0; }; =20 +int __init sci_get_agent_id(const struct dt_device_node *node, + const char *property, uint8_t *agent_id) +{ + if ( !cur_mediator ) + return -ENODEV; + + if ( !cur_mediator->get_agent_id ) + return -EOPNOTSUPP; + + return cur_mediator->get_agent_id(node, property, agent_id); +} + bool sci_handle_call(struct cpu_user_regs *regs) { if ( unlikely(!cur_mediator) ) diff --git a/xen/arch/arm/firmware/scmi-proto.h b/xen/arch/arm/firmware/scm= i-proto.h new file mode 100644 index 0000000000..1c8a170918 --- /dev/null +++ b/xen/arch/arm/firmware/scmi-proto.h @@ -0,0 +1,183 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Arm System Control and Management Interface definitions + * Version 3.0 (DEN0056C) + * + * Copyright (c) 2025 EPAM Systems + */ + +#ifndef ARM_FIRMWARE_SCMI_PROTO_H_ +#define ARM_FIRMWARE_SCMI_PROTO_H_ + +#include + +#define SCMI_SHORT_NAME_MAX_SIZE 16 + +/* SCMI status codes. See section 4.1.4 */ +#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) + +/* Protocol IDs */ +#define SCMI_BASE_PROTOCOL 0x10 + +/* Base protocol message IDs */ +#define SCMI_BASE_PROTOCOL_VERSION 0x0 +#define SCMI_BASE_PROTOCOL_ATTIBUTES 0x1 +#define SCMI_BASE_PROTOCOL_MESSAGE_ATTRIBUTES 0x2 +#define SCMI_BASE_DISCOVER_AGENT 0x7 +#define SCMI_BASE_SET_DEVICE_PERMISSIONS 0x9 +#define SCMI_BASE_RESET_AGENT_CONFIGURATION 0xB + +typedef struct scmi_msg_header { + uint8_t id; + uint8_t type; + uint8_t protocol; + uint32_t status; +} scmi_msg_header_t; + +/* Table 2 Message header format */ +#define SCMI_HDR_ID GENMASK(7, 0) +#define SCMI_HDR_TYPE GENMASK(9, 8) +#define SCMI_HDR_PROTO GENMASK(17, 10) + +#define SCMI_FIELD_GET(_mask, _reg) = \ + ((typeof(_mask))(((_reg) & (_mask)) >> (ffs64(_mask) - 1))) +#define SCMI_FIELD_PREP(_mask, _val) = \ + (((typeof(_mask))(_val) << (ffs64(_mask) - 1)) & (_mask)) + +static inline uint32_t pack_scmi_header(scmi_msg_header_t *hdr) +{ + return SCMI_FIELD_PREP(SCMI_HDR_ID, hdr->id) | + SCMI_FIELD_PREP(SCMI_HDR_TYPE, hdr->type) | + SCMI_FIELD_PREP(SCMI_HDR_PROTO, hdr->protocol); +} + +static inline void unpack_scmi_header(uint32_t msg_hdr, scmi_msg_header_t = *hdr) +{ + hdr->id =3D SCMI_FIELD_GET(SCMI_HDR_ID, msg_hdr); + hdr->type =3D SCMI_FIELD_GET(SCMI_HDR_TYPE, msg_hdr); + hdr->protocol =3D SCMI_FIELD_GET(SCMI_HDR_PROTO, msg_hdr); +} + +static inline int scmi_to_xen_errno(int scmi_status) +{ + if ( scmi_status =3D=3D SCMI_SUCCESS ) + return 0; + + 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; + default: + return -EINVAL; + } +} + +/* PROTOCOL_VERSION */ +#define SCMI_VERSION_MINOR GENMASK(15, 0) +#define SCMI_VERSION_MAJOR GENMASK(31, 16) + +struct scmi_msg_prot_version_p2a { + uint32_t version; +} __packed; + +/* PROTOCOL_MESSAGE_ATTRIBUTES */ +struct scmi_msg_prot_message_attributes_a2p { + uint32_t message_id; +} __packed; + +struct scmi_msg_prot_message_attributes_p2a { + uint32_t attributes; +} __packed; + +/* BASE PROTOCOL_ATTRIBUTES */ +#define SCMI_BASE_ATTR_NUM_PROTO GENMASK(7, 0) +#define SCMI_BASE_ATTR_NUM_AGENT GENMASK(15, 8) + +/* + * DEN0056E, sections 4.2.2.3 and 4.2.2.9: the agent count N occupies + * attributes[15:8], and agent IDs are sequential from 1 through N. + * Platform ID 0 is separate from that count. Thus N =3D 255 allows 256 + * identifiers (0..255), not an ID of 256, so domain configuration can use + * uint8_t. Protocol and channel fields use uint32_t, also accommodating + * the 0xffffffff self-discovery input, which is not an ordinary agent ID. + */ +#define SCMI_MAX_AGENT_ID UINT8_MAX + +struct scmi_msg_base_attributes_p2a { + uint32_t attributes; +} __packed; + +/* + * BASE_DISCOVER_AGENT + */ +#define SCMI_BASE_AGENT_ID_OWN 0xFFFFFFFF + +struct scmi_msg_base_discover_agent_a2p { + uint32_t agent_id; +} __packed; + +struct scmi_msg_base_discover_agent_p2a { + uint32_t agent_id; + char name[SCMI_SHORT_NAME_MAX_SIZE]; +} __packed; + +/* + * BASE_SET_DEVICE_PERMISSIONS + */ +#define SCMI_BASE_DEVICE_ACCESS_ALLOW BIT(0, UL) + +struct scmi_msg_base_set_device_permissions_a2p { + uint32_t agent_id; + uint32_t device_id; + uint32_t flags; +} __packed; + +/* + * BASE_RESET_AGENT_CONFIGURATION + */ +#define SCMI_BASE_AGENT_PERMISSIONS_RESET BIT(0, UL) + +struct scmi_msg_base_reset_agent_cfg_a2p { + uint32_t agent_id; + uint32_t flags; +} __packed; + +#endif /* ARM_FIRMWARE_SCMI_PROTO_H_ */ + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */ diff --git a/xen/arch/arm/firmware/scmi-shmem.c b/xen/arch/arm/firmware/scm= i-shmem.c new file mode 100644 index 0000000000..fd68c8ee1a --- /dev/null +++ b/xen/arch/arm/firmware/scmi-shmem.c @@ -0,0 +1,129 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * SMC/HVC shmem transport implementation used by + * SCI SCMI multi-agent driver. + * + * Oleksii Moisieiev + * Copyright (c) 2025 EPAM Systems + */ + +#include +#include +#include + +#include "scmi-proto.h" +#include "scmi-shmem.h" + +static inline int +shmem_channel_status(const struct scmi_shared_mem __iomem *shmem) +{ + return (readl(&shmem->channel_status) & + SCMI_SHMEM_CHAN_STAT_CHANNEL_FREE) ? 0 : -EBUSY; +} + +int scmi_put_message(struct scmi_shared_mem __iomem *shmem, + scmi_msg_header_t *hdr, void *data, unsigned int len) +{ + int ret; + + /* Keep the transport layout naturally aligned for 32-bit I/O accesses= . */ + BUILD_BUG_ON(offsetof(struct scmi_shared_mem, reserved) !=3D 0x00); + BUILD_BUG_ON(offsetof(struct scmi_shared_mem, channel_status) !=3D 0x0= 4); + BUILD_BUG_ON(offsetof(struct scmi_shared_mem, reserved1) !=3D 0x08); + BUILD_BUG_ON(offsetof(struct scmi_shared_mem, flags) !=3D 0x10); + BUILD_BUG_ON(offsetof(struct scmi_shared_mem, length) !=3D 0x14); + BUILD_BUG_ON(offsetof(struct scmi_shared_mem, msg_header) !=3D 0x18); + BUILD_BUG_ON(offsetof(struct scmi_shared_mem, msg_payload) !=3D 0x1c); + + if ( (len + offsetof(struct scmi_shared_mem, msg_payload)) > + SCMI_SHMEM_MAPPED_SIZE ) + { + printk(XENLOG_ERR + "scmi: Wrong size of the SMC message. Data is invalid\n"); + return -EINVAL; + } + + ret =3D shmem_channel_status(shmem); + if ( ret ) + return ret; + + /* All control fields use Device memory, which preserves write order. = */ + writel_relaxed(0x0, &shmem->channel_status); + /* Writing 0x0 right now, but "shmem"_FLAG_INTR_ENABLED can be set */ + writel_relaxed(0x0, &shmem->flags); + writel_relaxed(sizeof(shmem->msg_header) + len, &shmem->length); + writel_relaxed(pack_scmi_header(hdr), &shmem->msg_header); + + if ( len > 0 && data ) + memcpy_toio(shmem->msg_payload, data, len); + + return 0; +} + +int scmi_get_message(const struct scmi_shared_mem __iomem *shmem, + scmi_msg_header_t *hdr, void *data, unsigned int len) +{ + int recv_len; + int ret; + /* + * First word of msg_payload carries the returned status; exclude it f= rom + * recv_len so only the protocol payload is copied back to the caller. + */ + int pad =3D sizeof(hdr->status); + + if ( len >=3D SCMI_SHMEM_MAPPED_SIZE - + offsetof(struct scmi_shared_mem, msg_payload) ) + { + printk(XENLOG_ERR + "scmi: Wrong size of the input SMC message\n"); + return -EINVAL; + } + + ret =3D shmem_channel_status(shmem); + if ( ret ) + return ret; + + recv_len =3D readl(&shmem->length) - sizeof(shmem->msg_header); + + if ( recv_len < 0 ) + { + printk(XENLOG_ERR + "scmi: Wrong size of the SMC message. Data may be invalid\n= "); + return -EINVAL; + } + + unpack_scmi_header(readl(&shmem->msg_header), hdr); + + hdr->status =3D readl(&shmem->msg_payload); + recv_len =3D recv_len > pad ? recv_len - pad : 0; + + ret =3D scmi_to_xen_errno(hdr->status); + if ( ret ) + { + printk(XENLOG_DEBUG "scmi: Error received: %d\n", ret); + return ret; + } + + if ( recv_len > len ) + { + printk(XENLOG_ERR + "scmi: Not enough buffer for message %d, expecting %d\n", + recv_len, len); + return -EINVAL; + } + + if ( recv_len > 0 ) + memcpy_fromio(data, shmem->msg_payload + pad, recv_len); + + return 0; +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */ diff --git a/xen/arch/arm/firmware/scmi-shmem.h b/xen/arch/arm/firmware/scm= i-shmem.h new file mode 100644 index 0000000000..2577e9c661 --- /dev/null +++ b/xen/arch/arm/firmware/scmi-shmem.h @@ -0,0 +1,45 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Arm System Control and Management Interface definitions + * Version 3.0 (DEN0056C) + * Shared Memory based Transport + * + * Copyright (c) 2024 EPAM Systems + */ + +#ifndef ARM_FIRMWARE_SCMI_SHMEM_H_ +#define ARM_FIRMWARE_SCMI_SHMEM_H_ + +#include + +#define SCMI_SHMEM_CHAN_STAT_CHANNEL_FREE BIT(0, UL) +#define SCMI_SHMEM_CHAN_STAT_CHANNEL_ERROR BIT(1, 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[]; +}; + +#define SCMI_SHMEM_MAPPED_SIZE PAGE_SIZE + +int scmi_put_message(struct scmi_shared_mem __iomem *shmem, + scmi_msg_header_t *hdr, void *data, unsigned int len); + +int scmi_get_message(const struct scmi_shared_mem __iomem *shmem, + scmi_msg_header_t *hdr, void *data, unsigned int len); +#endif /* ARM_FIRMWARE_SCMI_SHMEM_H_ */ + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */ diff --git a/xen/arch/arm/firmware/scmi-smc-multiagent.c b/xen/arch/arm/fir= mware/scmi-smc-multiagent.c new file mode 100644 index 0000000000..c612902321 --- /dev/null +++ b/xen/arch/arm/firmware/scmi-smc-multiagent.c @@ -0,0 +1,875 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * SCI SCMI multi-agent driver, using SMC/HVC shmem as transport. + * + * Oleksii Moisieiev + * Copyright (c) 2025 EPAM Systems + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "scmi-proto.h" +#include "scmi-shmem.h" + +struct scmi_channel { + uint32_t agent_id; + uint32_t func_id; + domid_t domain_id; + paddr_t paddr; + struct scmi_shared_mem __iomem *shmem; + const struct dt_device_node *node; + spinlock_t lock; + struct list_head list; +}; + +struct scmi_data { + struct list_head channel_list; + spinlock_t channel_list_lock; + uint32_t func_id; + bool initialized; + uint32_t shmem_phandle; + uint32_t hyp_channel_agent_id; + struct dt_device_node *dt_dev; +}; + +static struct scmi_data scmi_data; + +static bool scmi_is_under_xen_sci(const struct dt_device_node *node) +{ + const struct dt_device_node *p; + + for ( p =3D node->parent; p; p =3D p->parent ) + if ( dt_device_is_compatible(p, "xen,sci") ) + return true; + + return false; +} + +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; + + ret =3D scmi_put_message(chan_info->shmem, hdr, data, len); + if ( ret ) + return ret; + + resp =3D arm_smccc_1_1_smc(chan_info->func_id, 0, 0, 0, 0, 0, 0, 0); + + if ( resp.a0 =3D=3D (unsigned long)ARM_SMCCC_INVALID_PARAMETER ) + return -EINVAL; + + if ( resp.a0 ) + return -EOPNOTSUPP; + + return 0; +} + +static int do_smc_xfer(struct scmi_channel *chan_info, scmi_msg_header_t *= hdr, + void *tx_data, int tx_size, void *rx_data, int rx_s= ize) +{ + int ret =3D 0; + + ASSERT(chan_info && chan_info->shmem); + + if ( !hdr ) + return -EINVAL; + + spin_lock(&chan_info->lock); + + printk(XENLOG_DEBUG + "scmi: agent_id =3D %d msg_id =3D %x type =3D %d, proto =3D %x\= n", + chan_info->agent_id, hdr->id, hdr->type, hdr->protocol); + + ret =3D send_smc_message(chan_info, hdr, tx_data, tx_size); + if ( ret ) + goto cleanup; + + ret =3D scmi_get_message(chan_info->shmem, hdr, rx_data, rx_size); + + printk(XENLOG_DEBUG + "scmi: get smc response agent_id =3D %d msg_id =3D %x " + "proto =3D %x res=3D%d\n", + chan_info->agent_id, hdr->id, hdr->protocol, ret); + +cleanup: + spin_unlock(&chan_info->lock); + + return ret; +} + +static struct scmi_channel *get_channel_by_id(uint32_t agent_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->agent_id =3D=3D agent_id ) + { + found =3D true; + break; + } + } + + spin_unlock(&scmi_data.channel_list_lock); + if ( found ) + return curr; + + return NULL; +} + +static struct scmi_channel *acquire_scmi_channel(struct domain *d, + uint32_t agent_id) +{ + struct scmi_channel *curr; + struct scmi_channel *ret =3D ERR_PTR(-ENOENT); + + spin_lock(&scmi_data.channel_list_lock); + list_for_each_entry(curr, &scmi_data.channel_list, list) + { + if ( curr->agent_id =3D=3D agent_id ) + { + if ( curr->domain_id !=3D DOMID_INVALID ) + { + ret =3D ERR_PTR(-EEXIST); + break; + } + + curr->domain_id =3D d->domain_id; + ret =3D curr; + break; + } + } + + spin_unlock(&scmi_data.channel_list_lock); + + return ret; +} + +static void relinquish_scmi_channel(struct scmi_channel *channel) +{ + ASSERT(channel !=3D NULL); + + spin_lock(&scmi_data.channel_list_lock); + channel->domain_id =3D DOMID_INVALID; + spin_unlock(&scmi_data.channel_list_lock); +} + +static int map_channel_memory(struct scmi_channel *channel) +{ + ASSERT(channel && channel->paddr); + channel->shmem =3D ioremap_nocache(channel->paddr, SCMI_SHMEM_MAPPED_S= IZE); + if ( !channel->shmem ) + return -ENOMEM; + + writel_relaxed(SCMI_SHMEM_CHAN_STAT_CHANNEL_FREE, + &channel->shmem->channel_status); + printk(XENLOG_DEBUG "scmi: Got shmem %"PRIpaddr" after vmap %p\n", + channel->paddr, channel->shmem); + + return 0; +} + +static void unmap_channel_memory(struct scmi_channel *channel) +{ + ASSERT(channel); + + if ( !channel->shmem ) + return; + + iounmap(channel->shmem); + channel->shmem =3D NULL; +} + +static struct scmi_channel * +smc_create_channel(uint32_t agent_id, uint32_t func_id, paddr_t addr, + const struct dt_device_node *node) +{ + struct scmi_channel *channel, *curr; + + spin_lock(&scmi_data.channel_list_lock); + + /* Check if channel already exists while holding the lock */ + list_for_each_entry(curr, &scmi_data.channel_list, list) + { + if ( curr->agent_id =3D=3D agent_id ) + { + spin_unlock(&scmi_data.channel_list_lock); + return ERR_PTR(-EEXIST); + } + } + + channel =3D xmalloc(struct scmi_channel); + if ( !channel ) + { + spin_unlock(&scmi_data.channel_list_lock); + return ERR_PTR(-ENOMEM); + } + + spin_lock_init(&channel->lock); + channel->agent_id =3D agent_id; + channel->func_id =3D func_id; + channel->domain_id =3D DOMID_INVALID; + channel->shmem =3D NULL; + channel->paddr =3D addr; + channel->node =3D node; + list_add_tail(&channel->list, &scmi_data.channel_list); + + spin_unlock(&scmi_data.channel_list_lock); + return channel; +} + +static int __init scmi_get_agent_id(const struct dt_device_node *node, + const char *property, uint8_t *agent_id) +{ + const struct dt_device_node *agent; + const struct scmi_channel *channel; + uint32_t phandle; + int ret; + + ret =3D dt_property_read_variable_u32_array(node, property, &phandle, = 1, 1); + if ( ret < 0 ) + return ret; + + if ( !phandle || phandle =3D=3D UINT32_MAX ) + return -EINVAL; + + if ( !scmi_data.initialized ) + return -ENODEV; + + agent =3D dt_find_node_by_phandle(phandle); + if ( !agent ) + return -EINVAL; + + /* The channel list is immutable after probe; called only during boot.= */ + list_for_each_entry(channel, &scmi_data.channel_list, list) + { + if ( channel->node =3D=3D agent && channel->domain_id !=3D DOMID_X= EN ) + { + *agent_id =3D channel->agent_id; + return 0; + } + } + + /* Reject disabled agents and nodes outside the registered agents node= . */ + return -EINVAL; +} + +static void __init free_channel_list(void) +{ + struct scmi_channel *curr, *_curr; + /* + * Called only on the __init error path, before any runtime users exis= t, + * so no other thread is iterating channel_list. Keep the lock for the + * whole drain for clarity and to avoid misleading readers about possi= ble + * concurrent access. + */ + spin_lock(&scmi_data.channel_list_lock); + list_for_each_entry_safe(curr, _curr, &scmi_data.channel_list, list) + { + list_del(&curr->list); + xfree(curr); + } + spin_unlock(&scmi_data.channel_list_lock); +} + +static int __init +scmi_dt_read_channel_addr(struct dt_device_node *scmi_node, uint64_t *addr, + uint64_t *size) +{ + struct dt_device_node *shmem_node; + uint32_t phandle; + int ret; + + ret =3D dt_property_read_variable_u32_array(scmi_node, "shmem", &phand= le, + 1, 1); + if ( ret < 0 ) + return ret; + + shmem_node =3D dt_find_node_by_phandle(phandle); + if ( !shmem_node || + !dt_device_is_compatible(shmem_node, "arm,scmi-shmem") ) + return -EINVAL; + + ret =3D dt_device_get_address(shmem_node, 0, addr, size); + if ( ret ) + return ret; + + if ( !*size || !IS_ALIGNED(*size, SCMI_SHMEM_MAPPED_SIZE) || + !IS_ALIGNED(*addr, SCMI_SHMEM_MAPPED_SIZE) ) + { + printk(XENLOG_ERR "scmi: invalid shmem range for %s\n", + scmi_node->full_name); + return -EINVAL; + } + + return 0; +} + +/* + * Handle Dom0 SCMI specific DT nodes + * + * Make a decision on copying SCMI specific nodes into Dom0 device tree. + * For SCMI multi-agent case: + * - shmem nodes will not be copied and generated instead if SCMI + * is enabled for Dom0 + * - scmi node will be copied if SCMI is enabled for Dom0 + */ +static bool __init scmi_dt_handle_node(struct domain *d, + struct dt_device_node *node) +{ + static const struct dt_device_match shmem_matches[] __initconst =3D { + DT_MATCH_COMPATIBLE("arm,scmi-shmem"), + { /* sentinel */ }, + }; + static const struct dt_device_match scmi_matches[] __initconst =3D { + DT_MATCH_PATH("/firmware/scmi"), + { /* sentinel */ }, + }; + + if ( !scmi_data.initialized ) + return false; + + /* skip scmi shmem node for dom0 if scmi not enabled */ + if ( dt_match_node(shmem_matches, node) && !sci_domain_is_enabled(d) ) + { + dt_dprintk(" Skip scmi shmem node\n"); + return true; + } + + /* drop scmi if not enabled */ + if ( dt_match_node(scmi_matches, node) && !sci_domain_is_enabled(d) ) + { + dt_dprintk(" Skip scmi node\n"); + return true; + } + + return false; +} + +static int scmi_assign_device(uint32_t agent_id, uint32_t device_id, + uint32_t flags) +{ + struct scmi_msg_base_set_device_permissions_a2p tx; + struct scmi_channel *channel; + scmi_msg_header_t hdr; + + channel =3D get_channel_by_id(scmi_data.hyp_channel_agent_id); + if ( !channel ) + return -EINVAL; + + hdr.id =3D SCMI_BASE_SET_DEVICE_PERMISSIONS; + hdr.type =3D 0; + hdr.protocol =3D SCMI_BASE_PROTOCOL; + + tx.agent_id =3D agent_id; + tx.device_id =3D device_id; + tx.flags =3D flags; + + return do_smc_xfer(channel, &hdr, &tx, sizeof(tx), NULL, 0); +} + +static int scmi_dt_assign_device(struct domain *d, + struct dt_phandle_args *ac_spec) +{ + struct scmi_channel *agent_channel; + uint32_t scmi_device_id =3D ac_spec->args[0]; + int ret; + + if ( !d->arch.sci_data ) + return 0; + + /* The access-controllers is specified for DT dev, but it's not a SCMI= */ + if ( !scmi_data.dt_dev || + !dt_node_path_is_equal(ac_spec->np, scmi_data.dt_dev->full_name) ) + return 0; + + agent_channel =3D d->arch.sci_data; + + spin_lock(&agent_channel->lock); + + ret =3D scmi_assign_device(agent_channel->agent_id, scmi_device_id, + SCMI_BASE_DEVICE_ACCESS_ALLOW); + if ( ret ) + { + printk(XENLOG_ERR + "scmi: could not assign dev for %pd agent:%d dev_id:%u (%d)= ", + d, agent_channel->agent_id, scmi_device_id, ret); + } + + spin_unlock(&agent_channel->lock); + return ret; +} + +static int collect_agent_id(struct scmi_channel *agent_channel) +{ + int ret; + scmi_msg_header_t hdr; + struct scmi_msg_base_discover_agent_p2a da_rx; + struct scmi_msg_base_discover_agent_a2p da_tx; + + ret =3D map_channel_memory(agent_channel); + if ( ret ) + return ret; + + hdr.id =3D SCMI_BASE_DISCOVER_AGENT; + hdr.type =3D 0; + hdr.protocol =3D SCMI_BASE_PROTOCOL; + + da_tx.agent_id =3D agent_channel->agent_id; + + ret =3D do_smc_xfer(agent_channel, &hdr, &da_tx, sizeof(da_tx), + &da_rx, sizeof(da_rx)); + if ( agent_channel->domain_id !=3D DOMID_XEN ) + unmap_channel_memory(agent_channel); + if ( ret ) + return ret; + + if ( da_rx.agent_id > SCMI_MAX_AGENT_ID ) + return -EINVAL; + + printk(XENLOG_DEBUG "id=3D0x%x name=3D%s\n", da_rx.agent_id, da_rx.nam= e); + agent_channel->agent_id =3D da_rx.agent_id; + return 0; +} + +static int __init collect_agents(struct dt_device_node *scmi_node) +{ + struct dt_device_node *agents, *node; + unsigned int count =3D 0; + + /* Use the configuration containing this management channel. */ + for ( agents =3D scmi_node->parent; agents; agents =3D agents->parent ) + if ( dt_device_is_compatible(agents, "xen,sci") ) + break; + + ASSERT(agents); + + dt_for_each_child_node(agents, node) + if ( dt_node_name_is_equal(node, "agents") ) + break; + + if ( !node ) + { + printk(XENLOG_ERR "scmi: missing agents node\n"); + return -EINVAL; + } + agents =3D node; + + if ( dt_child_n_addr_cells(agents) !=3D 1 || + dt_child_n_size_cells(agents) !=3D 0 ) + return -EINVAL; + + dt_for_each_child_node(agents, node) + { + struct scmi_channel agent =3D { + .agent_id =3D SCMI_BASE_AGENT_ID_OWN, + .domain_id =3D DOMID_INVALID, + }; + struct scmi_channel *channel; + bool discover; + uint32_t len; + uint64_t addr, size; + int ret; + + if ( !dt_device_is_compatible(node, "xen,scmi-agent") || + !dt_device_is_available(node) ) + continue; + + discover =3D !dt_find_property(node, "reg", &len); + if ( !discover ) + { + if ( len !=3D sizeof(uint32_t) || + !dt_property_read_u32(node, "reg", &agent.agent_id) ) + return -EINVAL; + } + + if ( !dt_property_read_u32(node, "arm,smc-id", &agent.func_id) ) + return -EINVAL; + + ret =3D scmi_dt_read_channel_addr(node, &addr, &size); + if ( ret ) + return ret; + agent.paddr =3D addr; + + if ( discover ) + { + /* Resolve the ID before inserting it into the channel list. */ + spin_lock_init(&agent.lock); + ret =3D collect_agent_id(&agent); + if ( ret ) + return ret; + } + + /* UINT8_MAX is reserved as invalid in guest configuration. */ + if ( agent.agent_id >=3D UINT8_MAX ) + return -EINVAL; + + channel =3D smc_create_channel(agent.agent_id, agent.func_id, + agent.paddr, node); + if ( IS_ERR(channel) ) + { + printk(XENLOG_ERR "scmi: Could not create channel for %s: %ld\= n", + node->full_name, PTR_ERR(channel)); + return PTR_ERR(channel); + } + + count++; + printk(XENLOG_DEBUG "scmi: Agent %u SMC %X addr %"PRIpaddr"\n", + channel->agent_id, channel->func_id, channel->paddr); + } + + return count ? 0 : -EINVAL; +} + +static int scmi_domain_init(struct domain *d, + struct xen_domctl_createdomain *config) +{ + struct scmi_channel *channel; + int ret; + + if ( !scmi_data.initialized ) + return 0; + + /* + * SCMI support is configured via: + * - For dom0: xen,dom0-sci-agent phandle under the xen,sci node + * - For dom0less: xen,sci-agent phandle in the domain node + * The config->arch.arm_sci_type and config->arch.arm_sci_agent_id + * are already set by domain_build.c or dom0less-build.c + */ + + if ( config->arch.arm_sci_type =3D=3D XEN_DOMCTL_CONFIG_ARM_SCI_NONE ) + return 0; + + channel =3D acquire_scmi_channel(d, config->arch.arm_sci_agent_id); + if ( IS_ERR(channel) ) + { + printk(XENLOG_ERR + "scmi: Failed to acquire SCMI channel for agent_id %u: %ld\= n", + config->arch.arm_sci_agent_id, PTR_ERR(channel)); + return PTR_ERR(channel); + } + + printk(XENLOG_INFO + "scmi: Acquire channel id =3D 0x%x, domain =3D %pd " + "paddr =3D 0x%"PRIpaddr"\n", + channel->agent_id, d, channel->paddr); + + /* + * Dom0 (if present) needs to have an access to the guest memory range + * to satisfy iomem_access_permitted() check in XEN_DOMCTL_iomem_permi= ssion + * domctl. + */ + if ( hardware_domain && !is_hardware_domain(d) ) + { + ret =3D iomem_permit_access(hardware_domain, paddr_to_pfn(channel-= >paddr), + paddr_to_pfn(channel->paddr + + SCMI_SHMEM_MAPPED_SIZE - 1)); + if ( ret ) + goto error; + } + + d->arch.sci_data =3D channel; + d->arch.sci_enabled =3D true; + + return 0; + +error: + relinquish_scmi_channel(channel); + return ret; +} + +int scmi_domain_sanitise_config(const struct xen_domctl_createdomain *conf= ig) +{ + if ( config->arch.arm_sci_type !=3D XEN_DOMCTL_CONFIG_ARM_SCI_NONE && + config->arch.arm_sci_type !=3D XEN_DOMCTL_CONFIG_ARM_SCI_SCMI_SMC= _MA ) + { + dprintk(XENLOG_INFO, "scmi: Unsupported ARM_SCI type\n"); + return -EINVAL; + } + + return 0; +} + +static int scmi_relinquish_resources(struct domain *d) +{ + int ret; + struct scmi_channel *channel, *agent_channel; + scmi_msg_header_t hdr; + struct scmi_msg_base_reset_agent_cfg_a2p tx; + + if ( !d->arch.sci_data ) + return 0; + + agent_channel =3D d->arch.sci_data; + + spin_lock(&agent_channel->lock); + tx.agent_id =3D agent_channel->agent_id; + spin_unlock(&agent_channel->lock); + + channel =3D get_channel_by_id(scmi_data.hyp_channel_agent_id); + if ( !channel ) + { + printk(XENLOG_ERR + "scmi: Unable to get Hypervisor SCMI channel for %pd\n", d); + return -EINVAL; + } + + hdr.id =3D SCMI_BASE_RESET_AGENT_CONFIGURATION; + hdr.type =3D 0; + hdr.protocol =3D SCMI_BASE_PROTOCOL; + + tx.flags =3D SCMI_BASE_AGENT_PERMISSIONS_RESET; + + ret =3D do_smc_xfer(channel, &hdr, &tx, sizeof(tx), NULL, 0); + if ( ret ) + printk(XENLOG_WARNING + "scmi: WARNING: cannot reset agent %u for %pd (%d).\n" + XENLOG_WARNING + "scmi: Devices may remain active and agent permissions may " + "persist; reusing this agent may be unsafe.\n", + agent_channel->agent_id, d, ret); + + if ( ret =3D=3D -EOPNOTSUPP ) + return 0; + + return ret; +} + +static void scmi_domain_destroy(struct domain *d) +{ + struct scmi_channel *channel; + + if ( !d->arch.sci_data ) + return; + + channel =3D d->arch.sci_data; + spin_lock(&channel->lock); + + relinquish_scmi_channel(channel); + printk(XENLOG_DEBUG "scmi: Free %pd\n", d); + + d->arch.sci_data =3D NULL; + d->arch.sci_enabled =3D false; + + spin_unlock(&channel->lock); +} + +static bool scmi_handle_call(struct cpu_user_regs *regs) +{ + uint32_t fid =3D (uint32_t)get_user_reg(regs, 0); + struct scmi_channel *agent_channel; + struct domain *d =3D current->domain; + bool res =3D false; + + if ( (!sci_domain_is_enabled(d)) || (!d->arch.sci_data) ) + return false; + + agent_channel =3D d->arch.sci_data; + spin_lock(&agent_channel->lock); + + if ( agent_channel->func_id !=3D fid ) + { + res =3D false; + goto unlock; + } + + arm_smccc_guest_smc(regs); + res =3D true; +unlock: + spin_unlock(&agent_channel->lock); + + return res; +} + +static const struct sci_mediator_ops scmi_ops =3D { + .domain_init =3D scmi_domain_init, + .domain_destroy =3D scmi_domain_destroy, + .relinquish_resources =3D scmi_relinquish_resources, + .handle_call =3D scmi_handle_call, + .dom0_dt_handle_node =3D scmi_dt_handle_node, + .domain_sanitise_config =3D scmi_domain_sanitise_config, + .assign_dt_device =3D scmi_dt_assign_device, + .get_agent_id =3D scmi_get_agent_id, +}; + +static int __init scmi_check_smccc_ver(void) +{ + if ( smccc_ver < ARM_SMCCC_VERSION_1_1 ) + { + printk(XENLOG_WARNING + "scmi: No SMCCC 1.1 support, SCMI calls forwarding disabled= \n"); + return -ENOSYS; + } + + return 0; +} + +static int __init scmi_dt_hyp_channel_read(struct dt_device_node *scmi_nod= e, + struct scmi_data *scmi_data, + uint64_t *addr) +{ + uint64_t size; + + if ( !dt_property_read_u32(scmi_node, "arm,smc-id", &scmi_data->func_i= d) ) + { + printk(XENLOG_ERR "scmi: unable to read smc-id from DT\n"); + return -ENOENT; + } + + return scmi_dt_read_channel_addr(scmi_node, addr, &size); +} + +static int __init scmi_check_device_permissions(struct scmi_channel *chann= el) +{ + scmi_msg_header_t hdr =3D { + .id =3D SCMI_BASE_PROTOCOL_MESSAGE_ATTRIBUTES, + .protocol =3D SCMI_BASE_PROTOCOL, + }; + struct scmi_msg_prot_message_attributes_a2p tx =3D { + .message_id =3D SCMI_BASE_SET_DEVICE_PERMISSIONS, + }; + struct scmi_msg_prot_message_attributes_p2a rx; + int ret; + + ret =3D do_smc_xfer(channel, &hdr, &tx, sizeof(tx), &rx, sizeof(rx)); + if ( ret ) + printk(XENLOG_ERR + "scmi: BASE_SET_DEVICE_PERMISSIONS is required for multi-ag= ent " + "support (%d)\n", ret); + + return ret; +} + +static __init int scmi_probe(struct dt_device_node *scmi_node, const void = *data) +{ + uint64_t addr; + int ret; + struct scmi_channel *channel; + unsigned int n_agents; + scmi_msg_header_t hdr; + struct scmi_msg_base_attributes_p2a rx; + + ASSERT(scmi_node !=3D NULL); + + /* + * Only bind to the SCMI node provided by Xen under the xen,sci node + * (e.g. /chosen/xen/xen_scmi_config/scmi). This avoids binding to fir= mware + * SCMI nodes that belong to the host OSPM and keeps the mediator scop= ed to + * Xen-provided configuration only. + */ + if ( !scmi_is_under_xen_sci(scmi_node) ) + return -ENODEV; + + if ( !acpi_disabled ) + { + printk(XENLOG_WARNING "scmi: is not supported when using ACPI\n"); + return -EINVAL; + } + + ret =3D scmi_check_smccc_ver(); + if ( ret ) + return ret; + + ret =3D scmi_dt_hyp_channel_read(scmi_node, &scmi_data, &addr); + if ( ret ) + return ret; + + INIT_LIST_HEAD(&scmi_data.channel_list); + spin_lock_init(&scmi_data.channel_list_lock); + + scmi_data.dt_dev =3D scmi_node; + + channel =3D smc_create_channel(SCMI_BASE_AGENT_ID_OWN, scmi_data.func_= id, + addr, scmi_node); + if ( IS_ERR(channel) ) + { + ret =3D PTR_ERR(channel); + goto out; + } + + /* Mark as Xen management channel before collecting agent ID */ + channel->domain_id =3D DOMID_XEN; + + /* Request agent id for Xen management channel */ + ret =3D collect_agent_id(channel); + if ( ret ) + goto error; + + /* Save the agent id for Xen management channel */ + scmi_data.hyp_channel_agent_id =3D channel->agent_id; + + 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 error; + + n_agents =3D SCMI_FIELD_GET(SCMI_BASE_ATTR_NUM_AGENT, rx.attributes); + printk(XENLOG_DEBUG "scmi: Got agent count %d\n", n_agents); + + ret =3D scmi_check_device_permissions(channel); + if ( ret ) + goto error; + + ret =3D collect_agents(scmi_node); + if ( ret ) + goto error; + + ret =3D sci_register(&scmi_ops); + if ( ret ) + { + printk(XENLOG_ERR "SCMI: mediator already registered (ret =3D %d)\= n", + ret); + goto error; + } + + scmi_data.initialized =3D true; + goto out; + +error: + unmap_channel_memory(channel); + free_channel_list(); +out: + return ret; +} + +static const struct dt_device_match scmi_smc_match[] __initconst =3D { + DT_MATCH_COMPATIBLE("arm,scmi-smc"), + { /* sentinel */ }, +}; + +DT_DEVICE_START(scmi_smc_ma, "SCMI SMC MEDIATOR", DEVICE_FIRMWARE) + .dt_match =3D scmi_smc_match, + .init =3D scmi_probe, +DT_DEVICE_END + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */ diff --git a/xen/arch/arm/include/asm/firmware/sci.h b/xen/arch/arm/include= /asm/firmware/sci.h index 6d8286b5cb..bb4d362590 100644 --- a/xen/arch/arm/include/asm/firmware/sci.h +++ b/xen/arch/arm/include/asm/firmware/sci.h @@ -72,6 +72,13 @@ struct sci_mediator_ops { * Optional. */ int (*assign_dt_device)(struct domain *d, struct dt_phandle_args *ac_s= pec); + + /* + * Resolve a boot-domain agent phandle after mediator initialization. + * Called only during boot. Optional. + */ + int (*get_agent_id)(const struct dt_device_node *node, + const char *property, uint8_t *agent_id); }; =20 =20 @@ -88,6 +95,10 @@ static inline bool sci_domain_is_enabled(struct domain *= d) */ int sci_register(const struct sci_mediator_ops *ops); =20 +/* Optional boot-time callback; returns the configured or discovered ID. */ +int sci_get_agent_id(const struct dt_device_node *node, + const char *property, uint8_t *agent_id); + /* * Initialize SCI functionality for domain if configured. * @@ -158,6 +169,12 @@ int sci_do_domctl(struct xen_domctl *domctl, struct do= main *d, =20 #include =20 +static inline int sci_get_agent_id(const struct dt_device_node *node, + const char *property, uint8_t *agent_id) +{ + return -EOPNOTSUPP; +} + static inline bool sci_domain_is_enabled(struct domain *d) { return false; diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h index 14d51e0746..722c2d2e3a 100644 --- a/xen/include/public/arch-arm.h +++ b/xen/include/public/arch-arm.h @@ -329,6 +329,7 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t); =20 #define XEN_DOMCTL_CONFIG_ARM_SCI_NONE 0 #define XEN_DOMCTL_CONFIG_ARM_SCI_SCMI_SMC 1 +#define XEN_DOMCTL_CONFIG_ARM_SCI_SCMI_SMC_MA 2 =20 #define XEN_DOMCTL_CONFIG_ARM_V8R_EL1_MSA_NONE 0 #define XEN_DOMCTL_CONFIG_ARM_V8R_EL1_MSA_PMSA 1 @@ -347,7 +348,9 @@ struct xen_arch_domainconfig { uint8_t arm_sci_type; /* IN */ uint8_t v8r_el1_msa; - uint16_t pad; + /* IN */ + uint8_t arm_sci_agent_id; + uint8_t pad; }; #endif /* __XEN__ || __XEN_TOOLS__ */ =20 --=20 2.43.0 From nobody Mon Nov 23 22:32:00 2026 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=1794840141; cv=pass; d=zohomail.com; s=zohoarc; b=Ea1XKUsso8z4ER/GJ2TfAN32Lu0HED1hfFnqptyVIwdQmnoul8lbB45myzJsp6jW1brO9LLYlE2yDn8LpDLUnOy+YnZ++gd5PrGh9MAAdhjYJcBb+LYv/LuuaB8D9INo4SZtJadDoZiJMlzWaNSeUhHsbkzEGCO+PGA2bcSElik= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794840141; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=3DYIXbzLMR33EgXn2802OVqeBnV2sN4/5SZ9JohGO9E=; b=MbBYSq1D3SjB1BFb45YqnTzvLe+Ky3380mAAOHG5/9OKm/gWOsvBUvU8b3DOoE6/UQW307ByWTPcAMkZsuS5+2/2wEuijYR/Ej9GPcsyAtIeER6eiwcgaLhho97E1hbnODZHHa8QDcwdBv6PVlg9Qdy/Mjyr2W0b76J6C5FEA28= 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 1794840141237520.5616355923821; Mon, 16 Nov 2026 06:42:21 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1491037.1691981 (Exim 4.92) (envelope-from ) id 1xSxu1-0007Qb-Gd; Mon, 16 Nov 2026 14:41:49 +0000 Received: by outflank-mailman (output) from mailman id 1491037.1691981; Mon, 16 Nov 2026 14:41:49 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xSxu1-0007Q6-8W; Mon, 16 Nov 2026 14:41:49 +0000 Received: by outflank-mailman (input) for mailman id 1491037; Mon, 16 Nov 2026 14:41:47 +0000 Received: from mx.expurgate.net ([194.145.224.20]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xSxtz-0006hm-9P for xen-devel@lists.xenproject.org; Mon, 16 Nov 2026 14:41:47 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1xSxty-00BMqu-Ki for xen-devel@lists.xenproject.org; Mon, 16 Nov 2026 15:41:46 +0100 Received: from [10.42.69.4] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6afb161a-2eae-0a2a0a5409dd-0a2a4504af3c-48 for ; Mon, 16 Nov 2026 15:41:46 +0100 Received: from [52.101.66.113] (helo=DUZPR83CU001.outbound.protection.outlook.com) by tlsNG-ebf023.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6afb1627-b57f-0a2a45040019-346542718d39-8 for ; Mon, 16 Nov 2026 15:41:46 +0100 Received: from GVXPR03MB11113.eurprd03.prod.outlook.com (2603:10a6:150:2a9::22) by GV2PR03MB11211.eurprd03.prod.outlook.com (2603:10a6:150:30d::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.615.14; Mon, 16 Nov 2026 14:41:41 +0000 Received: from GVXPR03MB11113.eurprd03.prod.outlook.com ([fe80::13a1:97f6:9d2b:f8cf]) by GVXPR03MB11113.eurprd03.prod.outlook.com ([fe80::13a1:97f6:9d2b:f8cf%6]) with mapi id 15.21.0592.012; Mon, 16 Nov 2026 14:41:41 +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" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=epam.com header.i="@epam.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:x-ms-exchange-senderadcheck" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=g8S9qF/4GD/VP5fQV5sOJQaCWqWqQ4vJaJpAKAXdtlyfGPllMvNe4tHPzxoTqZiCdGZzrW3IlQ2Ot/YHayTgyxkfXAh/hlHB6a7sO7BW0Pkv7Xkvtjc6jJtD3z2x7QCaQGUzeuL34NHVHCR38RivV6uVCO7Wj/f5nJ6wB+f6pmtW04wrDVwXAbK2kt1MNmnQFAOAwATvWVXYVhMjGXMgIbUE1uy3ovvtdY812x/aq5DiJYDzegvND/okshlzjg2GBbOUEI9C6bgzLvOlRfudY1Z3vaxz4J+paSKw8BwnBn+odpirc3T0abXVVvuqLyO2Jeqk0gP9zd47r31z7e432A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=3DYIXbzLMR33EgXn2802OVqeBnV2sN4/5SZ9JohGO9E=; b=IF6DmR+sGym4WNWg1Lgo/mqFuAk+dhNTSPeQzfROeqfL2/xPn82Ttb68vCUyxEg/m6abw/Vo0e8GlH868cqh+HOvoEp1Yjrmy7QONL2MGqkWvqOaAks/fbH/Y6Ss/q/z3Hjk6Vsmr3SIwSjwzgPxuWvssBgtjWm1Q/V3RoWKcpwLVdwNTEgKuVPZ2aUVi/ch3Puv3al+XyVJ5qAMPgd5kRXLtyf0cQRwXFGh/N0PsKGrGfjuhH4TZjrMfoF46fTU8r3gokM79M/Inc+SSJ3TVsRk0b0hH+Mftn7g5n2MjP3zO8ZtrCLSyZa3a5QFwDqu25+pYiJkJ+eLH8T4SDmK9g== 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=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3DYIXbzLMR33EgXn2802OVqeBnV2sN4/5SZ9JohGO9E=; b=qQsbQvKkCeVb4AZDSI2WVDz8zRZGA4R2KiODMUHTZtKj0Sbkw6b5ZL2CCO+m34+fYybf53GXy17edWrWNPV/b0s0y1idyZ/hDcEqzo5hZOUl97P3MS1oC6HstuPECg83fafRInIla4b2n3uHvpYJYm6zkpQYBGg4umVxe1zhAMi7Mb69aK5LNnmySHmwwCj+cqI4KSLrz6CiEN8Dgf2nQGbahh1EIshI0DQYa0p9No5QUJZmgkkmMuITultnexisnKR2+RoMs08J8r1psg+bqKtib1U4qwcEsuh2rX5HfmX2cK6nhkzQ5hbgMmaxZN3WG9VC59J4uyzybKsV2KXIQQ== From: Oleksii Moisieiev To: "xen-devel@lists.xenproject.org" CC: Andrew Cooper , Anthony PERARD , Bertrand Marquis , Jan Beulich , Juergen Gross , Julien Grall , Michal Orzel , Oleksii Moisieiev , =?iso-8859-1?Q?Roger_Pau_Monn=E9?= , Stefano Stabellini , Volodymyr Babchuk , Grygorii Strashko Subject: [PATCH v16 5/6] tools/xl/libxl: wire up SCMI SMC multi-agent configuration Thread-Topic: [PATCH v16 5/6] tools/xl/libxl: wire up SCMI SMC multi-agent configuration Thread-Index: AQHdddiX8LH/GhthO0m5LuxgjklNCg== Date: Mon, 16 Nov 2026 14:41:40 +0000 Message-ID: <4fedbb5bffdfe96365e530c985e89cd50b61fb5d.1794839953.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: authentication-results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: GVXPR03MB11113:EE_|GV2PR03MB11211:EE_ x-ms-office365-filtering-correlation-id: 080acd82-5cce-491d-8fa0-08df43efba79 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|23010399003|7416014|1800799024|376014|366016|261026140227099003|261026121527099003|261028144727099003|261021121427099003|261021123027099003|261022075727099003|261022105027099003|261102123227099003|38070700021|56012099006|11063799006|10067099003|22082099003|18002099003|261009223027099003|6133799003; x-microsoft-antispam-message-info: 5ZqCR2OgUgbVJNm0FneTzYPhKSGMCxukDPYJDppjv9S0egxeT5Qe6uYXkZXRnDYsbuZ1mcKFodAJoXTr8ZJwWInWYGDakdv8/B0FyKZuUKKWWD7ZDqXQRAw3oghLR9w4N2Xlja8h8YRZwgQ1crmH1W6KXQyNfnTIX2no4e4NcxOAD6ga+e8ktV3LBOIpgyxKxxigqMiGCGGxRO7SRkfhYj7eyltwrtA/wobKjJoHkQ2hhMMlG/X9DXTfH8Cl6O1rekuunbwmDd7t5oBz81F8jr/a+UQGAc7sDUP96NfVv6DW7pu/y9xz7vsmPribDWzdSUC7Mkhq7Sqq6Eias9dCtaqOkjb6VX4hFOJjmK8mfxFQBnchD/Qj73SZEANXKtzn40Qus2k4J3EOa4FJP0gDWiZH6A7D3im+e238mcMBrV2Xq9bxTaEl4iI6FvKP+2d5CVrhwYZkrSimwoV37BGO8Gj38aFKE1UmG1Fnv8Owe1L+jhatBcxqHYPWaDqMpeiLA+/Xo6tN9te44LQ6fzPuTq8vPlrfnxkiq3V7hVdackGTWRNK9u6g7Iey6FkiutGq7VtUgvfRZeSu0iYdpmCWbTNgcbFG/NkpZB/P+sWj7UG0F7Fp0qm7Lt1a47qMMhPgXMn42GsQ9vAsE/xlVO6Xb3LeRD29AkL/Oqy/aE5elXAAmycpIrOXpSpUZlNuPejU1in8MiD86fpokDN2UDHOdMz9FGH5IaAg0WlAYsfOyCM= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:GVXPR03MB11113.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(23010399003)(7416014)(1800799024)(376014)(366016)(261026140227099003)(261026121527099003)(261028144727099003)(261021121427099003)(261021123027099003)(261022075727099003)(261022105027099003)(261102123227099003)(38070700021)(56012099006)(11063799006)(10067099003)(22082099003)(18002099003)(261009223027099003)(6133799003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?rNZJLlW5pX6ex6KcIRfoiYEH9+9TguqtJglD5Lo7uxuCeC5FNjSlJ2JOW/?= =?iso-8859-1?Q?ziDdrZTuDXgqSBoU9xRkgd8mCw8vWxwycnoeRbwydHer7l7ignlLXiRjRR?= =?iso-8859-1?Q?AwlAjQ1wKi/uQpVHqf3nfgy5l0RzIVK+FppRF8C4PxwqiVnLOJ4b0QLxx9?= =?iso-8859-1?Q?kdTfvFWtpH+Myq/mxc13F44wmymOJeZRiM7M7Td2zWDIX4y30f565bfZt5?= =?iso-8859-1?Q?Ex8fnMNtVBh2WXT/PVFQi1I+EJe03ckZNbC9bWUy7JrOQL6F6lqCD0964a?= =?iso-8859-1?Q?sCXnrDl+XXGw4CCiDwPWudcnlj3fLseIcOtY66a3zKgQmEFu+TyEhSWwvx?= =?iso-8859-1?Q?0Lkkuao+eFpFzzkojHA92cKsXr/mgK4eHZuccly5lLqCd/Nue2TWfoTjGB?= =?iso-8859-1?Q?VXImFcpztv8qB6c23rWkJJD93Q0j8Veqc+Qq6f7IXRL8IXnmeMpcImg0SM?= =?iso-8859-1?Q?9gQbk4+JsSR0FgyUHaTTxGYvwlZXONRVaXnjy/tdNZsL7PpYESKCr/AHo2?= =?iso-8859-1?Q?Rl0+EreNgG70Pbx+0X3oGJxzmZbL4kP74kPCXJwrx6o22NFPY7YfXyU/xs?= =?iso-8859-1?Q?z0qaJOBu4+Iev9Zqp9jVHOW+nb2g0awFlY/O8ECU9Kefki3pVWHx4MIAUU?= =?iso-8859-1?Q?fBGoA66rB21dqTi6wiT/Q9XNuMk6kcxzSIB/dGDgYa8rr2QGrs2vA8e79r?= =?iso-8859-1?Q?IgcnFxNcCZujG60pgwYuIUhmqATC2t9eMQhaQBH0Gkf9E0kcLxjjx5ChQi?= =?iso-8859-1?Q?6mJi0Ry18RybOFpM4mZV7EkQOkR/S5KLv3sRqN/zJcUIPHJLmENcaIdR7g?= =?iso-8859-1?Q?I+kIqqhEWE0VRhaqRaDyqXNumOkGUFzpVknhhQ0g2wdjYv8VixwFGcBJy6?= =?iso-8859-1?Q?7Z2v8KutPGv7sqVx5XxB45WMFqwwcv4q2OHtJ3LP5fS5HPUJnwkZKBLMlO?= =?iso-8859-1?Q?PDOGEpxg3QSOzEw6vJXuh1lGF3ybWlXiNA1QIX80lORxEf1Z0TcVLMIjWR?= =?iso-8859-1?Q?8dV59PvrMgalD15IKZB3KSjqFHKZJKoJh/OCGyTlu2X7ALsAcwawms1Ifd?= =?iso-8859-1?Q?eFYft5rqxE6xBdwxyea6z+6A5EfyzrL9OHPe3R9ngQygBLdBWCngVy8KPu?= =?iso-8859-1?Q?nVGRfxhqhY+CjM1rD8/jZGNslrpQaaFtc2KzVMe1z7ITkQ/4ZuQd0C2qGT?= =?iso-8859-1?Q?rLh0tv0Fm8ppdxGqD4+HHNHXWX1FdAlv59pFmFrqI9ku85rFR7Ya1FTMiu?= =?iso-8859-1?Q?9mJvn/hm6DUTNZXkZUBMMSdc5lp36oO/nwKDutKH6BABhieUytyu5GpL+8?= =?iso-8859-1?Q?F6clcE05nsrqRlRvxNkNWvjliOz0eLU23Icr7XfLU3msbSenoOfYKR2PdF?= =?iso-8859-1?Q?jbJBWMKHpafDbKCU23z+WvYIK4XxWhJnslI2jQC75qwWJ8ZRLKMAG6NVEy?= =?iso-8859-1?Q?24AezCmZ9yCZHyq988x5sNHdPrh4oz8NdRfVEbIR6ESTLWv3Ay44I5CBFH?= =?iso-8859-1?Q?XnZ7L07Jgw2d+qJWWlk6HRSufH7MoCOt+E2O+1B7IsVZKwT8VIY8eXJhg6?= =?iso-8859-1?Q?fyVxLbqEKiA2B7F1f27qNYAu4bKglUD2dGQBsZstAjRaOWr1fwvAweSv1B?= =?iso-8859-1?Q?oWQVwNEHIG1xdneTtqkHyvpIkvj0dXMqSROokjCis36tfOkS2DDQQiZKlP?= =?iso-8859-1?Q?ogGsC1yVg1yKjvBHW6qT6EHZFq/3Rxm/45yiQokIVHaxaK8/bi7XBNx8Ts?= =?iso-8859-1?Q?5VOB1YEXxu3LzwRwwI4zyUlG/nipBFeKkxUVUTMU2tn2cCDGT2QMexLS9U?= =?iso-8859-1?Q?xIfQt1FubjGXHaQVOrkrykR+WAodNM4=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: GVXPR03MB11113.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 080acd82-5cce-491d-8fa0-08df43efba79 X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Nov 2026 14:41:40.0775 (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: MYEJN5j6JZXzW/3RH/0xJsxgUwFkDLbTfOIIn7cr+klL52OromRNXyrs8EaAS3nvkdo34VzDbjNNomUnk3spjMgT5C9SDHR4M1rph2d1Heg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV2PR03MB11211 X-purgate-ID: tlsNG-ebf023/1794840106-516D2B50-AAA39C5A/0/0 X-purgate-type: clean X-purgate-size: 7327 X-ZohoMail-DKIM: pass (identity @epam.com) X-ZM-MESSAGEID: 1794840142814158500 Content-Type: text/plain; charset="utf-8" Plumb the SCMI SMC multi-agent type through the toolstack: - Extend libxl_arm_sci_type enumeration with scmi_smc_multiagent (value 2) - Add agent_id field to libxl_arm_sci structure for per-domain agent assign= ment - Update libxl_arm.c to translate libxl config to XEN_DOMCTL_CONFIG_ARM_SCI= _SCMI_SMC_MA and pass agent_id to the hypervisor via xen_domctl_createdomain - Add xl.cfg parsing for arm_sci=3D"type=3Dscmi_smc_multiagent,agent_id=3DN" - Document the new xl.cfg options in xl.cfg.5.pod.in This completes the userspace side of multi-agent SCMI, allowing xl create and dom0less configurations to assign unique agent_id values to domains. Series-changes 12: - reject agent_id in xl.cfg when the ARM_SCI type is not scmi_smc_multiagent, instead of parsing it and discarding it - perform the check after the option loop, as type and agent_id may be given in either order Signed-off-by: Grygorii Strashko Signed-off-by: Oleksii Moisieiev --- (no changes since v11) Changes in v11: - Fix agent_id documentation: clarify it applies to SCMI SMC multi-agent support only, not plain SCMI SMC (reviewer feedback) - Remove "non-zero" from agent_id description to match accepted range [0..254] - Remove "UINT8_MAX (255) is treated as invalid" from user documentation as unnecessary implementation detail - Add LIBXL_HAVE_SCMI_SMC_MULTIAGENT feature macro in libxl.h to advertise the new scmi_smc_multiagent type and agent_id field - Add agent_id validation in libxl__arch_domain_build_info_setdefault() to reject invalid values at the libxl level, not only in xl Changes in v10: - Split hypervisor and toolstack changes into separate commits docs/man/xl.cfg.5.pod.in | 13 +++++++++++++ tools/include/libxl.h | 8 ++++++++ tools/libs/light/libxl_arm.c | 13 +++++++++++++ tools/libs/light/libxl_types.idl | 4 +++- tools/xl/xl_parse.c | 27 +++++++++++++++++++++++++++ 5 files changed, 64 insertions(+), 1 deletion(-) diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in index b19c25c8d1..9d38ac0f7e 100644 --- a/docs/man/xl.cfg.5.pod.in +++ b/docs/man/xl.cfg.5.pod.in @@ -3184,8 +3184,21 @@ single SCMI OSPM agent support. Should be used together with B Xen command line option. =20 +=3Ditem B + +Enables ARM SCMI SMC multi-agent support for the guest by enabling SCMI ov= er +SMC calls forwarding from domain to the EL3 firmware (like Trusted Firmwar= e-A) +with a multi SCMI OSPM agent support. The SCMI B should be +specified for the guest. + =3Dback =20 +=3Ditem B + +Specifies an ARM SCI agent id for the guest. This option is mandatory +if the SCMI SMC multi-agent support is enabled for the guest. The agent id= s of +domains existing on a single host must be unique and in the range [0..254]. + =3Dback =20 =3Dback diff --git a/tools/include/libxl.h b/tools/include/libxl.h index d294fb36bd..be25f23288 100644 --- a/tools/include/libxl.h +++ b/tools/include/libxl.h @@ -326,6 +326,14 @@ */ #define LIBXL_HAVE_BUILDINFO_ARCH_ARM_SCI 1 =20 +/* + * LIBXL_HAVE_SCMI_SMC_MULTIAGENT indicates that the + * LIBXL_ARM_SCI_TYPE_SCMI_SMC_MULTIAGENT value is available in the + * libxl_arm_sci_type enumeration and the agent_id field is available + * in the libxl_arm_sci structure. + */ +#define LIBXL_HAVE_SCMI_SMC_MULTIAGENT 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_arm.c b/tools/libs/light/libxl_arm.c index aa8fa852fc..f92922abea 100644 --- a/tools/libs/light/libxl_arm.c +++ b/tools/libs/light/libxl_arm.c @@ -237,6 +237,10 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc, case LIBXL_ARM_SCI_TYPE_SCMI_SMC: config->arch.arm_sci_type =3D XEN_DOMCTL_CONFIG_ARM_SCI_SCMI_SMC; break; + case LIBXL_ARM_SCI_TYPE_SCMI_SMC_MULTIAGENT: + config->arch.arm_sci_type =3D XEN_DOMCTL_CONFIG_ARM_SCI_SCMI_SMC_M= A; + config->arch.arm_sci_agent_id =3D d_config->b_info.arch_arm.arm_sc= i.agent_id; + break; default: LOG(ERROR, "Unknown ARM_SCI type %d", d_config->b_info.arch_arm.arm_sci.type); @@ -1897,6 +1901,15 @@ int libxl__arch_domain_build_info_setdefault(libxl__= gc *gc, } } =20 + /* Sanitise ARM SCI agent_id parameter */ + if (b_info->arch_arm.arm_sci.type =3D=3D LIBXL_ARM_SCI_TYPE_SCMI_SMC_M= ULTIAGENT && + b_info->arch_arm.arm_sci.agent_id >=3D UINT8_MAX) { + LOG(ERROR, + "Invalid ARM SCI agent_id: %u. Valid range is [0..254]", + b_info->arch_arm.arm_sci.agent_id); + return ERROR_FAIL; + } + if (b_info->type !=3D LIBXL_DOMAIN_TYPE_PV) return 0; =20 diff --git a/tools/libs/light/libxl_types.idl b/tools/libs/light/libxl_type= s.idl index d819955108..9b38c8f6de 100644 --- a/tools/libs/light/libxl_types.idl +++ b/tools/libs/light/libxl_types.idl @@ -555,11 +555,13 @@ libxl_sve_type =3D Enumeration("sve_type", [ =20 libxl_arm_sci_type =3D Enumeration("arm_sci_type", [ (0, "none"), - (1, "scmi_smc") + (1, "scmi_smc"), + (2, "scmi_smc_multiagent") ], init_val =3D "LIBXL_ARM_SCI_TYPE_NONE") =20 libxl_arm_sci =3D Struct("arm_sci", [ ("type", libxl_arm_sci_type), + ("agent_id", uint8) ]) =20 libxl_rdm_reserve =3D Struct("rdm_reserve", [ diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c index 01783731b5..6bb3325c98 100644 --- a/tools/xl/xl_parse.c +++ b/tools/xl/xl_parse.c @@ -1290,6 +1290,7 @@ static int parse_arm_sci_config(XLU_Config *cfg, libx= l_arm_sci *arm_sci, const char *str) { int ret =3D 0; + int agent_id_set =3D 0; char *buf2, *ptr; char *oparg; =20 @@ -1308,9 +1309,35 @@ static int parse_arm_sci_config(XLU_Config *cfg, lib= xl_arm_sci *arm_sci, } } =20 + if (MATCH_OPTION("agent_id", ptr, oparg)) { + unsigned long val =3D parse_ulong(oparg); + + if ( val >=3D UINT8_MAX ) { + fprintf(stderr, "An invalid ARM_SCI agent_id specified (%l= u). Valid range [0..254]\n", + val); + ret =3D ERROR_INVAL; + goto out; + } + arm_sci->agent_id =3D val; + agent_id_set =3D 1; + } + ptr =3D strtok(NULL, ","); } =20 + /* + * agent_id only means something to the multi-agent driver, and + * libxl__arch_domain_prepare_config() only reads it for that type. + * Reject it elsewhere instead of silently dropping it. The check is d= one + * after the loop because the options may be given in any order. + */ + if (agent_id_set && + arm_sci->type !=3D LIBXL_ARM_SCI_TYPE_SCMI_SMC_MULTIAGENT) { + fprintf(stderr, + "ARM_SCI agent_id is only supported with type=3Dscmi_smc_m= ultiagent\n"); + ret =3D ERROR_INVAL; + } + out: free(buf2); return ret; --=20 2.43.0 From nobody Mon Nov 23 22:32:00 2026 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=1794840123; cv=pass; d=zohomail.com; s=zohoarc; b=WttlthmJzdQeVCL6qM8/zmS+cZhowBj5X5gJdODAJBxi6NOlbT/xMVzTwScaXrJQyoJZbNSK+b17pqo8PwemXzoN39IdxJvedQeZ3fVxydIipQuMcRY+wZ/5tXIuKC4GXVjoXQVWdxbctv9di5PnmiH4yGJ2kD/uPV7k2nJ5lUE= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794840123; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=fLhF0hBdemMrW2peTwRF7QB9sqnYHb9jGDObsKmUmKw=; b=J/JEN7KgnSLYrEGXJosc87Q46oM+txV5ekC6BST3JV9iPZqnTzPBfyEqW99SOYqcn98jktSB3GvswihnA2dyZLziKqOlRxaRTCJPUZYRCb2b2yBDLgc3EkS2US7hhQ4kFkcpd2ZYdmxlWnzPyWpMC/ialojyD0bWuj+1U338xdc= 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 1794840123855727.1210969412803; Mon, 16 Nov 2026 06:42:03 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1491038.1691987 (Exim 4.92) (envelope-from ) id 1xSxu1-0007SB-Sn; Mon, 16 Nov 2026 14:41:49 +0000 Received: by outflank-mailman (output) from mailman id 1491038.1691987; Mon, 16 Nov 2026 14:41:49 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xSxu1-0007RC-IE; Mon, 16 Nov 2026 14:41:49 +0000 Received: by outflank-mailman (input) for mailman id 1491038; Mon, 16 Nov 2026 14:41:48 +0000 Received: from mx.expurgate.net ([194.145.224.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xSxtz-0006qa-Sm for xen-devel@lists.xenproject.org; Mon, 16 Nov 2026 14:41:48 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1xSxtz-00CLkE-14 for xen-devel@lists.xenproject.org; Mon, 16 Nov 2026 15:41:47 +0100 Received: from [10.42.69.4] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6afb162a-bab6-0a2a0a5309dd-0a2a450480f8-2 for ; Mon, 16 Nov 2026 15:41:47 +0100 Received: from [52.101.66.113] (helo=DUZPR83CU001.outbound.protection.outlook.com) by tlsNG-ebf023.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6afb1627-b57f-0a2a45040019-346542718d39-9 for ; Mon, 16 Nov 2026 15:41:46 +0100 Received: from GVXPR03MB11113.eurprd03.prod.outlook.com (2603:10a6:150:2a9::22) by GV2PR03MB11211.eurprd03.prod.outlook.com (2603:10a6:150:30d::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.615.14; Mon, 16 Nov 2026 14:41:41 +0000 Received: from GVXPR03MB11113.eurprd03.prod.outlook.com ([fe80::13a1:97f6:9d2b:f8cf]) by GVXPR03MB11113.eurprd03.prod.outlook.com ([fe80::13a1:97f6:9d2b:f8cf%6]) with mapi id 15.21.0592.012; Mon, 16 Nov 2026 14:41:41 +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" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=epam.com header.i="@epam.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:x-ms-exchange-senderadcheck" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=DKRSTlLHB34f/UGIJUoHlf/aTfbHv5vi8VItiX5Au3K2b4ZtfVTLEYr4raazgevLjPfsTuhtwyKRR4gCvSp3aN0elJYAY5CSq9a0TR8sQpMnplBqbo9bUD2mlJ+HyP20QpFjnWKjjA33Ll0e4pg5uvW3xLlgNm7Z77XQuI8yib61rulwFF2E/31SmpuhrCtErONCPIIp948Towmb4y6i++SXSjBCEHaVNNHNY9GufwzCC/ZD07yMC+wGQ76qzsYcMqyHD1beqyZjY4lJqpHrRqGln/c99v3hArPSx5tKjOucTDkM22gbUGgMb/hzCwFC/YSq2i7wPKeSSlyuN86SdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=fLhF0hBdemMrW2peTwRF7QB9sqnYHb9jGDObsKmUmKw=; b=XBn5mjU0eAoa8zcDb2ndhDrS5+izrSEGnjJAJSZvFwiobEP1OsUoV4Wf3+pXA7m920xqZFX1ylB6+Pp4dtvyx3tzjgDeGrexVHIBIp+fNic07yGh5p1h3Iby7xJzFu5xnZ/xWhU6SMgwzJilUJonalfK2OSej+qchajZu6yMvNXPLxvCju86Uc6lAaAtgLi5ceNux9vYbf8E3sHvMdHl1huRm2K0TyqJ3nZvAsQ6FypBGinwAGEdpKz8wi5nHj//MubmYvx1hC7LoyayVoCrRBVlv81qTICkyEuMhP2bZRyN4xdZDW4A4QX++YO6Mm01FbmTgGyEy25UlqCniEBMaA== 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=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fLhF0hBdemMrW2peTwRF7QB9sqnYHb9jGDObsKmUmKw=; b=H9iZwNgeYTtX+zMOZqvHyCrwmSk17fwEni4WgOdSCtCUZiiKM5+fb0ajIf0sFAXN31zy4PGMaDMpxTziL3uKTe2bg2Vxuq7urbnVccL6I5/GoEm9Dbs+FV1uX4v7ZfWQKTc8GZPEdZoJCBmmFxXvKWmDp2GKtru3WajtkdSnP+6DMuU/ZBuXqoG9NWIYrAuDcLBPXzAdQK5qmnv5ZmUPnqfwDJhBPvDzr7cF2HeWLRaX+PSpnecq5TnXTgFfogK0b47sUIVyi+lJx367a4kD2wM76T9KU1ZO2stKw3ghsXnxJCLAqLWzciTNtFOht1+l4sba2JHJfO5G0SLUE8cf8g== From: Oleksii Moisieiev To: "xen-devel@lists.xenproject.org" CC: Andrew Cooper , Anthony PERARD , Bertrand Marquis , Jan Beulich , Juergen Gross , Julien Grall , Michal Orzel , Oleksii Moisieiev , =?iso-8859-1?Q?Roger_Pau_Monn=E9?= , Stefano Stabellini , Volodymyr Babchuk , Grygorii Strashko Subject: [PATCH v16 6/6] docs: arm: add SCI SCMI SMC multi-agent driver docs Thread-Topic: [PATCH v16 6/6] docs: arm: add SCI SCMI SMC multi-agent driver docs Thread-Index: AQHdddiX44qIri7HQEq7yHsaIFo3mg== Date: Mon, 16 Nov 2026 14:41:40 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: GVXPR03MB11113:EE_|GV2PR03MB11211:EE_ x-ms-office365-filtering-correlation-id: 7eea6744-8c31-4b6f-5739-08df43efbaa8 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|23010399003|7416014|1800799024|376014|366016|261026140227099003|261026121527099003|261028144727099003|261021135927099003|261021121427099003|261022075727099003|261022105027099003|261102123227099003|38070700021|5023799004|56012099006|11063799006|10067099003|22082099003|18002099003|261009223027099003|6133799003|3023799007; x-microsoft-antispam-message-info: QETWzJffiNvvjaMD9kZxiVmNAeFLrzThdTXM3N6IfKmxu6k9/lEoWtW+cLmVNZIQdXb+8mit8DUu12QZXDL2Z6+Xjdi7DabwqmMBDO7xh2Koi8e6nERY3MUAv7j+tIVjThsjsOneztR5DrOgeNTRTOTyh4xvapD+zXFt4M2lyEj54ivqhbTfUQSjp4Q8TmYbWtKnj1UXi8NOUjS9ACsCJdQFBp+AMI4X9MWWSFJ6M5QJl4yxYhbN35WJVqGzjxb1xFGhyCzaQ9o63Hx6lKzUkqm71Dnhiv17p9PsY+5wMxBIiC/WNvxg6Cx5T31czKXVn985G5BmWyX4httZPckp4UjkjgA63w3mQ1sbDZmEKlcMfJ6AHCtAU8nTgjplnn4k4aKIwSB6OYvsOUc3zyx3ygOr+UUjgvpttpXUx3jVMgsPf26QdikrAds0yImFdzLMHlUIUTJlsOziBRrIdCN7ldnYgkjah1K+xnoNzpf4h3pHDcblI3vHHKPETBb2pz7lBxIKB00PhBf7ST0TBHQaRPA9WxjRIowL3Bgu2m1ZuQQhbZhCwsOMyXGiyB+3jQN6o88DZWWBrFHlr66JlqsuLOZ9/0Rcodh1pWUBNtppIeBhex9laYvV+1I+GvOLEt9zOSk7//GBZOA62vpQRFcUM6uXJv/myti26fOyybzX/8o= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:GVXPR03MB11113.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(23010399003)(7416014)(1800799024)(376014)(366016)(261026140227099003)(261026121527099003)(261028144727099003)(261021135927099003)(261021121427099003)(261022075727099003)(261022105027099003)(261102123227099003)(38070700021)(5023799004)(56012099006)(11063799006)(10067099003)(22082099003)(18002099003)(261009223027099003)(6133799003)(3023799007);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?OHwwMZiNd++DP2rRwMT0xI6yxxBu2ZiQ7e4zpyxvf1dcuLzUeMHdc9rMCF?= =?iso-8859-1?Q?26mHn6gCz2Iio5NWtvfEP1qt71ByfoB5rkuESx+RWin/aaPYOpsm4mbo5e?= =?iso-8859-1?Q?0NcjV51T4uHDfshdWQlK+zQ/VPxe91ZzyNFhFw4US5w6yq7S5ekp7EJR1z?= =?iso-8859-1?Q?kjzsxcmk3dDUAjQJ8usmVmkgsf1h5JUt3mPCUvR8Ezlx4NOYd2f/k2wdLI?= =?iso-8859-1?Q?BhUpmyqi2UerHPRNYyGmsrjGPHqSsrtijiR3nRZ9GdQGgiR4cFGaDolvWE?= =?iso-8859-1?Q?75+ChrI9lX3AP8VJ5unAdM7bxlHeTX8lsVPV2lWsgpoI2ERCj8UYYocqFd?= =?iso-8859-1?Q?r5+c1oCDlvTXG5QIDe50c5m3Ssr29v6eRKxL/81HDB/efD0efkXr6AjkPC?= =?iso-8859-1?Q?Bgv4gDkkkV1y/jaJiheolRkxodMtbmeshZfFvHVUA0u28X/DkSEQax69e0?= =?iso-8859-1?Q?MA4ffitMbTmKC6SvLb/RSURxr6EfsEWCvQIri8fjpL14gEpWnXU+iUYzL0?= =?iso-8859-1?Q?pHbf67jL7DeAFQ/qFlJsQUL+GQYm9+Kw7Zv93OBmeMFJIoqXCcbV4TLuwi?= =?iso-8859-1?Q?kKnQ9kTZiXhzfrokDRWXCj1NQRg/gnFaklR1cG/8ADHSlAe+EUFTokrAa9?= =?iso-8859-1?Q?0v/MHFcyGYKLUq9ZesfKYXmMIHch5HsisERYyJtD1VW5kfnmGNfCEEnXYr?= =?iso-8859-1?Q?9UkIa/n/U1CSzMbKKk/pniTguetB4Ka26WxYjhAOHI5I4A4aS2Slv6sXZE?= =?iso-8859-1?Q?j540ZzoTgyyET5Cu61h9IY7y6nNKCbn5pDDded5chAJt9Rkva4YPSnIYv2?= =?iso-8859-1?Q?rl1SWFWof1Dcooyg5W3+LYePRtRO5kFlulokMBPetUENpUMgjxZBNMffjr?= =?iso-8859-1?Q?8xwZG6mIJc6uXRCNpR53C7AGPcU/rssZXS5KHzsx2mWNqAeGrlopmBMf/W?= =?iso-8859-1?Q?ByspgFcXZAFrXOxhk0P/v8g6FREAhIy/xGMWK0OUKEcWEeYyRUj+vt4ica?= =?iso-8859-1?Q?1UPFVtTeKxp10JMZVAQRDp+A0/ZzMBWZsYa8NzjKyRxfcKwHEfovlsV638?= =?iso-8859-1?Q?7tGBPY4dTi0LaCQfXMRakHMFbadEwJ+BMZ/Pjf1o++9mCDY91ofRCeoTHE?= =?iso-8859-1?Q?NYcK+/xtPFuG37eAdPrDRCmOxETWxjQmpBWHckymn2sA8TIcy3SVCHYGkv?= =?iso-8859-1?Q?5veVCx/oieZ0JocR9ZBgz2+a/erpiJQJHi4D3wKJWkTNNH24w96zXlTChL?= =?iso-8859-1?Q?pqMohUeXQP2l92wp1Jt8sFo1g1XSXqGgqdaf3gak7fDRUQKPXBPb8NbwQf?= =?iso-8859-1?Q?fTC1nyAE9XimPeLetLy8vY2qFBNSQzWEDQeVXjeA/uHzjfSFMTrzbs2TPU?= =?iso-8859-1?Q?Y+dGwfI5IMopm5KSeXlqAtozkyta9gXMMFSnbtO7NsJxsccyaly/DW1oMu?= =?iso-8859-1?Q?HlKEdEzaFJS7DA58Sey3nkdcqJkN1sL4S85jBYBX9ty/mjLX8pBMGedfag?= =?iso-8859-1?Q?M6t6z0lmwJ3+TmAVuznQztFOkugp173UxeQb11pBGvlUEwdg2qlXRIuVSM?= =?iso-8859-1?Q?wvzQXyTBHaA94GjBYBeA9lgo8UbkjA+B3Io7P/D4swuSDMdscd6TXw90/8?= =?iso-8859-1?Q?ZNg2WynGUB06RPR8SztZEJJU+kMqBGwnp3EmFGRS99rqznxQuerbxbj3D+?= =?iso-8859-1?Q?VJEfI1QUbY3nUHoDzZjtVKRXxTPLRE/jIUCZ4VsWnCB+D5OxgLejG0VxQN?= =?iso-8859-1?Q?nGC5iro87g0dvEUmksYOu5+t/S1OcZVj2KH1NZHAsdLBJhPyea+1xHkRq+?= =?iso-8859-1?Q?zJ7iHApkjWk3exFZIJcKvJ21Y4zvDJc=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: GVXPR03MB11113.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7eea6744-8c31-4b6f-5739-08df43efbaa8 X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Nov 2026 14:41:40.4601 (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: gGVrN/7aYoq2iA45GflhOImGCyCQmnwT9sPZb1teDaacSUfAK13TMjabwl/+0r2f2bojETtPEO9sDvDxQqmVrYBg7jShn7ntX42l0kO4N7I= X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV2PR03MB11211 X-purgate-ID: tlsNG-ebf023/1794840106-536C2B50-8A5935F2/0/0 X-purgate-type: clean X-purgate-size: 20900 X-ZohoMail-DKIM: pass (identity @epam.com) X-ZM-MESSAGEID: 1794840124964158500 Content-Type: text/plain; charset="utf-8" From: Grygorii Strashko Add SCI SCMI SMC multi-agent driver documentation. It includes a detailed description of the SCMI multi-agent driver. This document explains the driver's functionality, configuration, and the compilation process. The Xen SCMI multi-agent driver is designed to provide SCMI access to system resources from different domains. Signed-off-by: Grygorii Strashko Signed-off-by: Oleksii Moisieiev --- Changes in v16: - label Xen in the architecture diagram - document BASE_SET_DEVICE_PERMISSIONS as mandatory and explain the warning and persistent-state implications when agent reset is unavailable - use xen,dom0-sci-agent and xen,sci-agent phandles with DT labels in Dom0 and dom0less examples; retain optional reg in agent nodes and distinguish explicit-ID unit addresses from discovery node names - explain that phandle selection also works with firmware-discovered IDs by resolving the ID collected during probe, and that toolstack configuration continues to use numeric agent_id - correct the access-controller example to reference Xen's management node; fix DTS syntax, section headings and partial-DT examples Changes in v14: - describe secondary agents as xen,scmi-agent nodes under agents - update host, discovery and dom0less examples for the child-node format - clarify shared-memory placement and platform RAM reservations Changes in v10: - rephrase section about /firmware/scmi. Mentioned that this node is taken from Host DT and copied unmodified. - fix xen,reg address for secondary domains for Dom0less configuration Changes in v8: - update documentation to match the last DT format - fixed RST: "... code-block:: dts" -> ".. code-block:: dts" - update documentation with dom0less configuration example - update documentation with new param xen,dom0-sci-agent-id instead of the command line parameter Changes in v7: - update documentation in section of the xen_scmi configuration which is matched by "xen,sci" compatible instead of the direct path. Changes in v6: - remove all HVC mentions from the multi-agent doc - update sci-agent-id parameter description in the documentation - add missing Sign-of - minor fixes across the document Changes in v5: - rework multi-agent driver to leave Host Device-tree unmodified .../arm/firmware/arm-scmi.rst | 437 ++++++++++++++++++ 1 file changed, 437 insertions(+) diff --git a/docs/hypervisor-guide/arm/firmware/arm-scmi.rst b/docs/hypervi= sor-guide/arm/firmware/arm-scmi.rst index d9698f4e4b..06b1e3b3f3 100644 --- a/docs/hypervisor-guide/arm/firmware/arm-scmi.rst +++ b/docs/hypervisor-guide/arm/firmware/arm-scmi.rst @@ -36,6 +36,8 @@ The below sections describe SCMI support options availabl= e for Xen. =20 | [1] `Arm SCMI `_ | [2] `System Control and Management Interface (SCMI) bindings `_ +| [3] `Generic Domain Access Controllers bindings `_ + =20 Simple SCMI over SMC calls forwarding driver (EL3) ------------------------------------------------------ @@ -189,3 +191,438 @@ except explicitly enabling SCMI with "arm_sci" xl.cfg= option. -> xen,reg =3D <0x0 0x47ff0000 0x0 0x1000 0x0 0x22001000>; -> xen,force-assign-without-iommu; }; + +SCMI SMC multi-agent driver (EL3) +--------------------------------- + +The SCMI SMC multi-agent driver supports Arm EL3 firmware, such as Trusted +Firmware-A (TF-A), that provides a separate SCMI transport channel for each +agent, as shown below. + +:: + + +-----------------------------------------+ + | | + | EL3 TF-A SCMI | + +-------+--+-------+--+-------+--+-------++ + |shmem1 | |shmem0 | |shmem2 | |shmemX | + +-----+-+ +---+---+ +--+----+ +---+---+ + smc-id1 | | | | + agent1 | | | | + +-----v--------+---------+-----------+----+ + | | | | | + | | Xen | | | + +--------------+---------+-----------+----+ + smc-id0 | smc-id2| smc-idX| + agent0 | agent2 | agentX | + | | | + +----v---+ +--v-----+ +--v-----+ + | | | | | | + | Dom0 | | Dom1 | | DomX | + | | | | | | + | | | | | | + +--------+ +--------+ +--------+ + +The EL3 firmware must provide an SCMI SMC shared-memory transport channel +for each agent. Each channel consists of: + +- ``arm,smc-id``: the SMC function ID used as a doorbell. +- ``shmem``: the shared-memory buffer used to transfer messages. Its addre= ss + and size must be **Xen page aligned**. Xen maps the buffer as Device mem= ory + using ``MT_DEVICE_nGnRE`` and ``_PAGE_DEVICE``. + +The firmware must provide the following agents: + +- Xen management agent: a trusted agent that has access to Base protocol + commands to configure agent-specific permissions. +- OSPM VM agents: untrusted agents, one for each guest domain that needs + SCMI access. At least one is required, even if only the hardware domain + uses SCMI. + +The firmware must implement these Base protocol messages: + +- ``BASE_DISCOVER_AGENT``: required for Xen and for secondary agents whose + ``reg`` property is omitted. +- ``BASE_SET_DEVICE_PERMISSIONS``: required. Xen checks support through + ``PROTOCOL_MESSAGE_ATTRIBUTES`` during initialization and fails to + initialize the mediator if the command is unavailable. Firmware must + enforce the permissions configured by Xen and prevent untrusted agents + from changing other agents' permissions. For firmware without this + command, use the single-agent driver for the hardware domain. + +``BASE_RESET_AGENT_CONFIGURATION`` is optional. Xen requests a reset when +relinquishing a domain's resources. If the command is unsupported, Xen +prints a warning and continues teardown. Device state and agent permissions +may persist, so platform software must ensure that reusing the agent is +safe. Other reset failures are reported and propagated to the caller. + +The number of agents and the transport channels available depend on the +firmware implementation. + +Compiling with multi-agent support +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +To build the SCMI SMC multi-agent driver, enable the Kconfig option: + +:: + + CONFIG_SCMI_SMC_MA + + +Driver functionality +^^^^^^^^^^^^^^^^^^^^ + +The SCI SCMI SMC multi-agent driver implements the following functionality: + +- The driver is initialized from the Xen SCMI node ``xen_scmi_config`` + under ``/chosen/xen`` (for example ``/chosen/xen/xen_scmi_config/scmi``). + Only one SCMI interface is supported. The SCMI configuration must live u= nder + a node compatible with ``xen,sci`` beneath ``/chosen``. + The Xen SCMI mediator will bind only to the "arm,scmi-smc" node that is = a child of + this "xen,sci" node; any other "arm,scmi-smc" nodes (for example under + "/firmware") are ignored to avoid stealing the host's SCMI OSPM instance. + +.. code-block:: dts + + scmi_shm_1: sram@47ff1000 { + compatible =3D "arm,scmi-shmem"; + reg =3D <0x0 0x47ff1000 0x0 0x1000>; + }; + scmi_xen: scmi { + compatible =3D "arm,scmi-smc"; + arm,smc-id =3D <0x82000003>; /* Xen management agent */ + #address-cells =3D < 1>; + #size-cells =3D < 0>; + #access-controller-cells =3D < 1>; + shmem =3D <&scmi_shm_1>; /* Xen management shared memory */ + }; + +.. note:: + This layout keeps the Host DT unchanged for Dom0 and baremetal Linux by + using func_id 0x82000002 / shmem 0x47ff0000 for Dom0, while Xen uses a + separate privileged channel func_id 0x82000003 / shmem 0x47ff1000. EL3 + firmware enforces permissions per agent_id, so there is no conflict bet= ween + Dom0 and Xen channels. + +- The driver reads secondary agents from an ``agents`` child node of the + ``xen,sci`` node. The ``agents`` node uses ``#address-cells =3D <1>`` and + ``#size-cells =3D <0>``. Each enabled ``xen,scmi-agent`` child node spec= ifies its + doorbell in ``arm,smc-id`` and a single shared-memory phandle in ``shmem= ``. + The optional single-cell ``reg`` property supplies the SCMI + agent ID (0..254). IDs must be unique and distinct from Xen's management + agent. + At least one enabled secondary agent is required. + With an explicit ID, use a unit address matching ``reg``, such as + ``scmi_agent_domu: agent@2``. For discovery, omit ``reg`` and use a node + name without a unit address, retaining the label for phandle references. + + Place the SCMI-specific shared-memory nodes under ``xen_scmi_config``. + Keep the host OSPM shared-memory node and ``/firmware/scmi`` in the plat= form DT. + A shared-memory node describes a channel location and does not reserve R= AM. + If buffers occupy system RAM, the platform must reserve the entire + firmware-owned range in ``/reserved-memory`` before Xen boots. A single + reservation may cover multiple channels, including unused ones. SRAM + outside system RAM does not require a RAM reservation. The channel nodes + do not have to be moved into ``/reserved-memory``. + +.. code-block:: dts + + / { + #address-cells =3D <2>; + #size-cells =3D <2>; + + scmi_shm_0: sram@47ff0000 { + compatible =3D "arm,scmi-shmem"; + reg =3D <0x0 0x47ff0000 0x0 0x1000>; + }; + + firmware { + scmi: scmi { + compatible =3D "arm,scmi-smc"; + arm,smc-id =3D <0x82000002>; /* Host OSPM agent smc-id */ + #address-cells =3D <1>; + #size-cells =3D <0>; + shmem =3D <&scmi_shm_0>; /* Host OSPM agent shmem */ + }; + }; + + chosen { + #address-cells =3D <2>; + #size-cells =3D <2>; + ranges; + + xen { + #address-cells =3D <2>; + #size-cells =3D <2>; + ranges; + + xen_scmi_config { + compatible =3D "xen,sci"; + #address-cells =3D <2>; + #size-cells =3D <2>; + ranges; + xen,dom0-sci-agent =3D <&scmi_agent_dom0>; + + /* Xen management channel */ + scmi_shm_1: sram@47ff1000 { + compatible =3D "arm,scmi-shmem"; + reg =3D <0x0 0x47ff1000 0x0 0x1000>; + }; + + scmi_shm_2: sram@47ff2000 { + compatible =3D "arm,scmi-shmem"; + reg =3D <0x0 0x47ff2000 0x0 0x1000>; + }; + + scmi_shm_3: sram@47ff3000 { + compatible =3D "arm,scmi-shmem"; + reg =3D <0x0 0x47ff3000 0x0 0x1000>; + }; + + scmi_xen: scmi { + compatible =3D "arm,scmi-smc"; + arm,smc-id =3D <0x82000003>; /* Xen management smc= -id */ + #address-cells =3D <1>; + #size-cells =3D <0>; + #access-controller-cells =3D <1>; + shmem =3D <&scmi_shm_1>; /* Xen management agent s= hmem */ + }; + + agents { + #address-cells =3D <1>; + #size-cells =3D <0>; + + scmi_agent_dom0: agent@0 { + compatible =3D "xen,scmi-agent"; + reg =3D <0>; + arm,smc-id =3D <0x82000002>; + shmem =3D <&scmi_shm_0>; + }; + + scmi_agent_domu: agent@2 { + compatible =3D "xen,scmi-agent"; + reg =3D <2>; + arm,smc-id =3D <0x82000004>; + shmem =3D <&scmi_shm_2>; + }; + + scmi_agent_domu3: agent@3 { + compatible =3D "xen,scmi-agent"; + reg =3D <3>; + arm,smc-id =3D <0x82000005>; + shmem =3D <&scmi_shm_3>; + }; + }; + }; + }; + }; + }; + +The ``xen,sci`` subtree is omitted from Dom0's DT. The host OSPM channel is +copied to Dom0 when SCMI is enabled for it. Xen uses its separate privileg= ed +management channel to configure the other agents. + +To discover a secondary agent ID through ``BASE_DISCOVER_AGENT``, omit +``reg`` and the node's unit address. Keep the label so domain references +still resolve. For example, replace only ``scmi_agent_domu: agent@2`` abov= e with: + +.. code-block:: dts + + scmi_agent_domu: agent-domu { + compatible =3D "xen,scmi-agent"; + arm,smc-id =3D <0x82000004>; + shmem =3D <&scmi_shm_2>; + }; + +Providing ``reg`` skips mapping and probing that secondary +channel during initialization. A malformed property is rejected. Xen always +discovers its own management agent ID. Thus ``BASE_DISCOVER_AGENT`` is +mandatory for the management channel and for secondary channels whose +``reg`` is omitted. Use node labels, such as +``scmi_agent_domu``, in phandle references; node names, such as +``agent-domu``, are not labels. + +Neither ``xen,dom0-sci-agent`` nor ``xen,sci-agent`` contains an agent ID. +If the referenced agent node has no ``reg``, Xen sends +``BASE_DISCOVER_AGENT`` through that node's ``arm,smc-id`` and ``shmem`` +channel during mediator initialization. Xen saves the returned ID with the +agent node, then resolves either domain's phandle to that ID when building +the domain. Discovery failure aborts mediator initialization; Xen does not +derive an ID from the node name, phandle value or SMC function ID. + +.. note:: + + Only Xen needs to know about the multi-agent configuration. Each guest + uses its assigned channel as an ordinary SCMI transport. + +- The driver implements the SCI subsystem interface to configure SCMI for + Dom0 and guest domains. Each domain must use a unique agent ID and the + corresponding SCMI SMC transport channel ``[arm,smc-id, shmem]``. + +- Once a domain is configured, it can communicate with the EL3 firmware: + + - zero-copy: the guest writes and reads SCMI messages to/from shared mem= ory; + - the guest issues an SMC using its agent's ``arm,smc-id`` as a doorbell; + - Xen checks the SMC function ID and synchronously forwards the call to = EL3. + +- During domain teardown, Xen sends ``BASE_RESET_AGENT_CONFIGURATION`` + through the management channel to reset the agent's configuration. If + reset is unsupported, Xen warns about the persistent state as described + above. + + +Configuring SCMI for Dom0 +^^^^^^^^^^^^^^^^^^^^^^^^^ + +Add ``xen,dom0-sci-agent`` to the ``xen,sci`` node under ``/chosen``. +Its value is a single phandle to an enabled secondary agent node. Xen +resolves that node to its configured or discovered agent ID. If the +property is absent or invalid, SCMI stays disabled for Dom0 and the SCMI +nodes are removed from Dom0's DT. An invalid reference produces a warning. + +.. code-block:: dts + + chosen { + xen { + ranges; + xen_scmi_config { + compatible =3D "xen,sci"; + xen,dom0-sci-agent =3D <&scmi_agent_dom0>; + /* agents, shared memory and scmi_xen as shown above */ + }; + }; + }; + +When SCMI is enabled for Dom0, Xen copies the host's ``/firmware/scmi`` no= de +to Dom0's DT unmodified. This node must be present and enabled for Dom0's +SCMI driver to use the channel. Xen selects the agent using the ``agents`` +child node and ``xen,dom0-sci-agent`` property under ``xen,sci``. + +.. note:: + + The selected agent's ``arm,smc-id`` and ``shmem`` must match the channel + described by the host's ``/firmware/scmi`` node and provided by EL3 for = Dom0. + +Configuring SCMI for a guest domain with the toolstack +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +* Add the ``arm_sci`` option to the domain's xl.cfg file: + +:: + + arm_sci =3D "type=3Dscmi_smc_multiagent,agent_id=3D2" + +* Use ``iomem`` to map the shared-memory channel associated with the domai= n's + ``agent_id``: + +:: + + iomem =3D [ + "47ff2,1@22001", + ] + +.. note:: The user selects the guest IPA used to map SCMI shared memory. + +* Add SCMI nodes to the guest's partial device tree. ``arm,smc-id`` must + match the channel associated with the assigned ``agent_id``: + +.. code-block:: dts + + passthrough { + #address-cells =3D <2>; + #size-cells =3D <2>; + + scmi_shm_0: sram@22001000 { + compatible =3D "arm,scmi-shmem"; + reg =3D <0x0 0x22001000 0x0 0x1000>; + }; + + firmware { + scmi: scmi { + compatible =3D "arm,scmi-smc"; + arm,smc-id =3D <0x82000004>; /* channel for agent_id=3D2 */ + shmem =3D <&scmi_shm_0>; + }; + }; + }; + +**Device specific access control** + +The Xen SCMI SMC multi-agent driver acts as an access-controller provider. +It uses the required ``BASE_SET_DEVICE_PERMISSIONS`` command to configure +the devices each agent can access. The Xen management SCMI node must have +``#access-controller-cells =3D <1>``. Bind devices to that node using the +Access Controllers bindings [3]. + +For example: + +.. code-block:: dts + + &i2c1 { + access-controllers =3D <&scmi_xen 0>; + }; + +Use ``dtdev`` in the domain's xl.cfg file to assign SCMI-managed devices: + +:: + + dtdev =3D [ + "/soc/i2c@e6508000", + ] + +.. note:: + + ``dtdev`` needs to contain all SCMI-managed devices passed through to + the guest, including devices without IOMMU protection. + +Configuring SCMI for predefined domains (dom0less) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +* Add ``xen,sci_type`` and ``xen,sci-agent`` to the guest's ``xen,domain`` + node. The phandle selects an enabled secondary agent, including one whose + ID is discovered from firmware: + +:: + + xen,sci_type =3D "scmi_smc_multiagent"; + xen,sci-agent =3D <&scmi_agent_domu>; + +* Add SCMI nodes to the guest's partial device tree as in the toolstack + example, and map the shared memory according to the dom0less documentati= on: + +.. code-block:: dts + + scmi_shm_0: sram@22001000 { + compatible =3D "arm,scmi-shmem"; + reg =3D <0x00 0x22001000 0x00 0x1000>; + xen,reg =3D <0x0 0x47ff2000 0x0 0x1000 0x0 0x22001000>; + xen,force-assign-without-iommu; + }; + +* Configure SCMI-managed passthrough devices in the guest's partial DT + according to the dom0less documentation. Set ``xen,path`` to each device= 's + host DT path so Xen can find its ``access-controllers`` property. + +Use the complete Xen SCMI configuration above. Remove +``xen,dom0-sci-agent`` if Dom0 does not use SCMI. The guest selects the +secondary channel labelled ``scmi_agent_domu``: + +.. code-block:: dts + + chosen { + domU1 { + compatible =3D "xen,domain"; + xen,sci_type =3D "scmi_smc_multiagent"; + xen,sci-agent =3D <&scmi_agent_domu>; + /* other domain properties here */ + }; + }; + +.. code-block:: dts + + i2c@e6508000 { + reg =3D <0x00 0xe6508000 0x00 0x1000>; + xen,path =3D "/soc/i2c@e6508000"; + xen,reg =3D <0x0 0xe6508000 0x0 0x1000 0x0 0xe6508000>; + xen,force-assign-without-iommu; + }; --=20 2.43.0