From nobody Mon Jan 26 07:40:45 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; 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=1769021082; cv=pass; d=zohomail.com; s=zohoarc; b=niNhcDf4dEVccdS1/N9P87Zh7ZEzzJSkuIxMopnAJvlAO4Wa4YVEskLmpbTc5lequxEYf4o/TGh26Cu7HYoORkQcb6WfXD5XEbEhuJDcyIR1tri4yR9xWh7jO9xhqTn6iKT5puEtfEvF78+zWF61dmu61cbCtMM6XduB7LIOaVw= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769021082; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=bOobHsh0E9gHuvqfUlo0ZCNmxQatFISIpahpkrH2p3o=; b=Huxj0kNKME/H3N6jv/rG4fC0ZnaznOfNmJaKLPgGnwTAAZgkc5BA+b7K0pb9ZCAhvxADGgORRApCNKbTTyPNEcFh+tu/tVrHNgc3MlqAA+t1jHSLtGVrLoXtKuTEmbn3Xs1taeCpn79eS0QEHp60RPC6TcVrZxAKS/cxnMlzFnA= 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 1769021082078532.9090888177593; Wed, 21 Jan 2026 10:44:42 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1210167.1522008 (Exim 4.92) (envelope-from ) id 1vidBg-0000aY-H2; Wed, 21 Jan 2026 18:44:16 +0000 Received: by outflank-mailman (output) from mailman id 1210167.1522008; Wed, 21 Jan 2026 18:44:16 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vidBg-0000aH-DI; Wed, 21 Jan 2026 18:44:16 +0000 Received: by outflank-mailman (input) for mailman id 1210167; Wed, 21 Jan 2026 18:44:15 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vidBf-00083G-Pl for xen-devel@lists.xenproject.org; Wed, 21 Jan 2026 18:44:15 +0000 Received: from AM0PR02CU008.outbound.protection.outlook.com (mail-westeuropeazlp170130006.outbound.protection.outlook.com [2a01:111:f403:c201::6]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 267dabec-f6f9-11f0-9ccf-f158ae23cfc8; Wed, 21 Jan 2026 19:44:00 +0100 (CET) Received: from PAVPR03MB8946.eurprd03.prod.outlook.com (2603:10a6:102:32e::21) by PAVPR03MB8945.eurprd03.prod.outlook.com (2603:10a6:102:322::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9542.9; Wed, 21 Jan 2026 18:43:54 +0000 Received: from PAVPR03MB8946.eurprd03.prod.outlook.com ([fe80::f12d:7394:bbe3:dfc]) by PAVPR03MB8946.eurprd03.prod.outlook.com ([fe80::f12d:7394:bbe3:dfc%5]) with mapi id 15.20.9542.008; Wed, 21 Jan 2026 18:43:54 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 267dabec-f6f9-11f0-9ccf-f158ae23cfc8 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=oVUJqrvO/NYDXN1+VZ5D09D6JCX46NffDGr0Mf7VAzeUI/V+Gn0JL2akZii5k8YbprPxPMAVrPfiPrk+QttNG184RtZUJWlBdTC3ZJtPVu2BwZvGNbXQJf3AlMgx5v5wIn6zvXMlXGDegsyp2aEkrClTtCKg1wERyIV6z+h3PDRYT40M3Q5pL37mPbtdyXY4Y/Fe91Er6nVSIfYVbwLgdVEOt83W3NuPNBQ0OSFwJVj8aNzsX42Ppev29tdxuZ2ALlZyKXEiM7ybXrG1/ZbkxFahzAY+sFuKoi5k3/d98DozCL1R0wKk863Qc4ppjdDttjnCjQUXpcaNmOFJSTKdsQ== 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=bOobHsh0E9gHuvqfUlo0ZCNmxQatFISIpahpkrH2p3o=; b=KbfAFXNKN52oElkRhIVX44+9D+qAWbx8/orlkBszjXMshx21n/swOSYh+En9V6uoxlFbqwcXKOKWTC7GDGEAope/EopuzieNFP+PU10ARFs1J/bcKamdWl1njh+PQ3admg9WH/CGUjXYcbjht/ZTHQRNygtLqBk561sBqYSoxgw+iJaZ1NBlphU89C0gi/1UhBhccd/47qDU5oYLjv8uL2PUgV/R6y8nn2OeN1KwziklrjImZMF41vH/JS5UuOXYZC8U5W0mZOit5nEQKSc0o1E6CaV/p46cPHI9Ccd81rVB0qWUEWFxCXNGdq+VhHvu1xgixtMNuj1N9QH1wc1iZQ== 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=bOobHsh0E9gHuvqfUlo0ZCNmxQatFISIpahpkrH2p3o=; b=GFdSadp2Jb1pMNTFoGznnRa5T5gTxWrIKb+hRvVhOJpzhQAQLG5k9OiAxA0FVyi/lBGroTKQcqKuZb0p6wbrmYM6sXgau0uIrjSShj02wb0ex0eJQoQ5dTQjdo9mLaIzlk/EUyX4RRGX8wBBRT7dsUvcuGoN20US8x9EAhLHchYYpxiF1nY2ztt7nQzmpumPXH8XQtC5Q1d0ptteG8QJX/yObqI9nC3TGF58Xcyw6AxHFxt6ZpDAdulxZPTzmpffq4XX3wxQxsQG+I8KZ1WJHiEjZa6bNZevJh2r9SBqcUq2q7sFyTncrAQsGYqUabogKBpzuvczfB9fo9sA5XCatg== 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 v8 1/5] xen/domctl: chain SCI handling before IOMMU in assign_device domctl Thread-Topic: [PATCH v8 1/5] xen/domctl: chain SCI handling before IOMMU in assign_device domctl Thread-Index: AQHciwXk/uoXY0zPp0qUEySvGl6zVA== Date: Wed, 21 Jan 2026 18:43:54 +0000 Message-ID: <8482f823e945060d1a36469f14f94aa6251e3f71.1769020872.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: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PAVPR03MB8946:EE_|PAVPR03MB8945:EE_ x-ms-office365-filtering-correlation-id: e31b9f11-b8b0-42fa-b271-08de591d073a x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|366016|376014|7416014|1800799024|38070700021; x-microsoft-antispam-message-info: =?utf-8?B?Sk1Gb3RnV1c2eEdYV1FXUjk3blpSUUFuSVZEOGpreDdjSkhndGo2em03ZHhQ?= =?utf-8?B?MXZmWWp6aDJ1ZG9wenZ4djNGWnh1djc4dFBiQlI1d0FBYU9QcnFOTXlCY2RP?= =?utf-8?B?VXVCZkJCWDhqQi95TDhCV0QvOWNFMUo0RE9GbzhuMUxrR1U4eXo2ZDhKbjhT?= =?utf-8?B?QzNqVjExcGw4dDk0ZWZ5a1htU2k2SEVLYUVCc1lEeDU0QkRySnhqWDZjSXg0?= =?utf-8?B?MmQ3SG9YU2QybnRCT2RaU2g5WW1SWlJ1Zmswd0xLUktqa0t4RG1Rd1BvQXlM?= =?utf-8?B?dlF5NWRYRmlQV0hFODJSQjBrbGluclJHS2oxckNOK1k5WDVBZTZJdVh4NFV6?= =?utf-8?B?bkdOWUZpRXhvTk1yb2tXWisxeG1yY2dYaUt2aUxOVU1LYkEyNEdZWkZVVUJP?= =?utf-8?B?bjY4WEN6VHRwSjNkaEwxeTJLcC9hWnVIUTFqTHY0ZDBkWVEzUUxyVzF6N0dp?= =?utf-8?B?cEF4VGpEYlZBbS82MFNkY2VKVGtEeGdDWjllNkJJeUxlYms2MzRFZW9zcitj?= =?utf-8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nBiWk13R3Fl?= =?utf-8?B?S3JIeTVzM2FaUktEN2xpdFRqRFFFNzh6dklscy9WdFRFWUFlVmpBVHZMQ1JX?= =?utf-8?B?dmJ1M3NCMVJ5MERyRnVicDYrVWo2anpaQ292VjhYTk1xMDEyYVowZndUYzhw?= =?utf-8?B?MDRpY3RaZ1daSUZjNGdWZktYOC9FcmhqeEM5SUZUY3U1R00yUkY4cXU3QjVm?= =?utf-8?B?b01SQ2d1Mk5sY0ViQzZ2dFFVTFpxbXNPend0d2p5UVFYd3dRVG0xVjZVYjlR?= =?utf-8?B?Y3owQm1sdm84UERKQ3k3V3g5SUViVXFQdHBPZjNMV3JmVlNpa2RIK3V4MWpk?= =?utf-8?B?QzRQTHZrM2w0UjdCN1Nza29SeGlIZ29tdTlER1lCcTloRHFtOUV6dVBSelAr?= =?utf-8?B?OFZ0bFJZTkdheEtHY3kyN3cyanFSd29OVGVRRkdCdVZBMXZHTm5YMHU3QWNH?= =?utf-8?B?RkRvdGNmbFJzZllsQ09KK0lEd3dna3ppb253UWZJMm9Ua0t5NkVnN2RCcm9L?= =?utf-8?B?N01LcUxlODRpaVFJbkhFVEZuT3hoMGF1N1lUUHZXV3JPbll3dWtpdVU2NE9l?= =?utf-8?B?c2ZpSU1zc0NKaGFZVllTMFQ5OEtIRTBmUy83Y29xSjdZTm5oOXh3aDdmN1Z5?= =?utf-8?B?SEpxSzhvLzRNVjVVM0pmTHBXNVhtQ1ZYWmZ0aVZOVzcrYWZXWDFnUnU3OUlF?= =?utf-8?B?RjA5TlBTREZwSVh0L1ZqQURFQllaa2NHTms5YnM5TTJLeGxSbDFjRDZMaXN3?= =?utf-8?Q?xXfhS7X3YkZ2yvr9PbW1Z+E=3D?= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAVPR03MB8946.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(7416014)(1800799024)(38070700021);D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yZmNMK1BZOGhvTTd3RnFHUVd1aHRhWEdXWjF0U2lqOU5IN1Zr?= =?utf-8?B?enFodEFzWmxvenh6MXB5T25GSVZaM1VmTlE5UkR2WlJESTlJQ1VwUGF0WWFm?= =?utf-8?B?Kysra0NzQ0JlbFpGZ3R2S3RTYkpVdlBsRWJzYVJ0SWNtTVAvSUs0MEhuaUk2?= =?utf-8?B?WXZEaWtKSWQwckRubXdzSEwxWm1oWFZtNjRlcHdNYkFZSkZTSUhtb0s4U0pk?= =?utf-8?B?WEJGWXRybGNBTDFUcEJ0azgwYWkrcWR1L2N3NlhTRU15Y2xiVFlTWm03ZGRZ?= =?utf-8?B?TXRVaEgvNDRWUEhCVTFNM0NBSXhUSnNUWnlTdGZKYUZRUVhPQUxqSWtIQ0hK?= =?utf-8?B?dkRrK2JCdEdFbmJyTXdxSXA3c2xRS0RKdzJLb3lzYzBUdjBnTUs0V0dOWDhj?= =?utf-8?B?NWZIZ2IyYm56bXVFb2FhUU1XcXNJYmZTT0hWUzQ3N2I4T2ZkNXVlWjN1Z2lS?= =?utf-8?B?U1kwam1uY0hsbjRKeStBREhyMzdaK1dTeXhLWU5WQzV5SXo3dFp0aEQrYXJt?= =?utf-8?B?Q3kwOE1RNnQwYlNOYktGSG5OQmtyemFyMWhGaHhFaGhVb1p1eUZnWXNCTUxH?= =?utf-8?B?UjBFTVd2S0UwOE1GMVJKZnJjbXJwYit3aUdIbFVFZDdWQUxDTmEwQU5lYll3?= =?utf-8?Q?GbE7WpNq08JTchN8=3D?= Content-Type: text/plain; charset="utf-8" Content-ID: <3135C440941BC145810BD9B21C77EEB6@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: PAVPR03MB8946.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e31b9f11-b8b0-42fa-b271-08de591d073a X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Jan 2026 18:43:54.2837 (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: CqAEWV69xiC0Azdiw83VoPm8Vubqo/8eJS+0cLaSA+7tm6XsIQH4cCcUr9qbffTpWC3PHvtu/jMCYMfE74i/9ncmywiU8QZOgVcD6xcMSCE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAVPR03MB8945 X-ZohoMail-DKIM: pass (identity @epam.com) X-ZM-MESSAGEID: 1769021083593158500 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 and propagate its error if it fails while the IOMMU path succeeds (unhandled cases return -ENXIO and are ignored); 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 --- 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 | 35 +++++++++++++++++++++++++ xen/arch/arm/include/asm/firmware/sci.h | 14 ++++++++++ xen/common/domctl.c | 26 +++++++++++++++++- xen/drivers/passthrough/device_tree.c | 6 +++++ 4 files changed, 80 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/firmware/sci.c b/xen/arch/arm/firmware/sci.c index aa93cda7f0..31a7e5c28b 100644 --- a/xen/arch/arm/firmware/sci.c +++ b/xen/arch/arm/firmware/sci.c @@ -126,6 +126,41 @@ 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 3500216bc2..a2d314e627 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 static inline bool sci_domain_is_enabled(struct domain *d) @@ -195,6 +203,12 @@ static inline int sci_assign_dt_device(struct domain *= d, return 0; } =20 +static inline int sci_do_domctl(struct xen_domctl *domctl, struct domain *= d, + XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_dom= ctl) +{ + return 0; +} + #endif /* CONFIG_ARM_SCI */ =20 #endif /* __ASM_ARM_SCI_H */ diff --git a/xen/common/domctl.c b/xen/common/domctl.c index 29a7726d32..cd87c15fe6 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 @@ -274,7 +277,7 @@ static bool is_stable_domctl(uint32_t cmd) =20 long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl) { - long ret =3D 0; + long ret =3D 0, ret1 =3D 0; bool copyback =3D false; struct xen_domctl curop, *op =3D &curop; struct domain *d; @@ -833,7 +836,28 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_= domctl) case XEN_DOMCTL_test_assign_device: case XEN_DOMCTL_deassign_device: case XEN_DOMCTL_get_device_group: + /* + * 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. + */ + ret1 =3D -ENXIO; + #if IS_ENABLED(CONFIG_ARM_SCI) + ret1 =3D sci_do_domctl(op, d, u_domctl); + #endif + ret =3D iommu_do_domctl(op, d, u_domctl); + if ( ret < 0 ) + return ret; + + /* + * If IOMMU processing was successful, check for SCI processing re= turn + * code and if it failed then overwrite the return code to propaga= te + * SCI failure back to caller. + */ + if ( ret1 !=3D -ENXIO && ret1 < 0 ) + ret =3D ret1; + break; =20 case XEN_DOMCTL_get_paging_mempool_size: diff --git a/xen/drivers/passthrough/device_tree.c b/xen/drivers/passthroug= h/device_tree.c index f5850a2607..29a44dc773 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.34.1 From nobody Mon Jan 26 07:40:45 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; 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=1769021072; cv=pass; d=zohomail.com; s=zohoarc; b=TdCYp0Lu1UCHF6mygxcyIZHCglmT+hjP3RhscsrUrgP0miUx1/nK0IeH053WFrqGtCtqAZOWm+vnzrdsXuLSXDiuVJJXjme/yAps+ne13+OI4V+LvAtN9Da+tEGz1ERgJCpuXaSsu3cIPvTAHulzi/V8krUvTENDFBmVyDvVaw8= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769021072; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=7Nk1CN+j4B/Mq/rCvZP0747CGWDJEwdX0Pe1Pu44Qbs=; b=ngfD74MUbz0ZnfYT7uPA8e4l+26LTjXr0oTI3zyRvCkorMFqKmVSTEIP/TQa6M+VpNAJzJkEsNdWnNwXMPyayMzfilqNtm4TRLWiubk+iMkijdlfQVOcSQ9t5c5n5wxwvuTisRBp8n84fpDqocQWvxCDtyozXqTUfj61ODVGipw= 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 176902107260666.28960632729127; Wed, 21 Jan 2026 10:44:32 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1210164.1521973 (Exim 4.92) (envelope-from ) id 1vidBa-00086f-Fj; Wed, 21 Jan 2026 18:44:10 +0000 Received: by outflank-mailman (output) from mailman id 1210164.1521973; Wed, 21 Jan 2026 18:44:10 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vidBa-00086a-Cn; Wed, 21 Jan 2026 18:44:10 +0000 Received: by outflank-mailman (input) for mailman id 1210164; Wed, 21 Jan 2026 18:44:09 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vidBZ-00083G-Ka for xen-devel@lists.xenproject.org; Wed, 21 Jan 2026 18:44:09 +0000 Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazlp170110003.outbound.protection.outlook.com [2a01:111:f403:c200::3]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 2b2c8f64-f6f9-11f0-9ccf-f158ae23cfc8; Wed, 21 Jan 2026 19:44:08 +0100 (CET) Received: from PAVPR03MB8946.eurprd03.prod.outlook.com (2603:10a6:102:32e::21) by PAVPR03MB8945.eurprd03.prod.outlook.com (2603:10a6:102:322::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9542.9; Wed, 21 Jan 2026 18:43:56 +0000 Received: from PAVPR03MB8946.eurprd03.prod.outlook.com ([fe80::f12d:7394:bbe3:dfc]) by PAVPR03MB8946.eurprd03.prod.outlook.com ([fe80::f12d:7394:bbe3:dfc%5]) with mapi id 15.20.9542.008; Wed, 21 Jan 2026 18:43:54 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 2b2c8f64-f6f9-11f0-9ccf-f158ae23cfc8 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=XP6YubQ4FqRjxZJkDzUVdL9122ldrKbHl52xcVo33VsQuGQDnDBpcdqzs4343zUej1o63BGCnRBQe2TqvXGWlj8cZBA9JzFGRulNtlj0HAjO3oTdZ5+J2kB3SzRhlU1mAw6DLteG5u4QZ7GEMnQFAYg83HVS60/JUZFdEI90dGlYqCxYHz2rCKzMIp/vxk8WswNKWhQIqre/bT9A8Q/KEY4eey7O4yJk3LduHwgyJMCD4aGq1jTZ04mDgq+KqJvGRENDZCPqlRBLmhnJlAj6wDoJZRfhwpeQGDAYoFGgsIaAAH7asz+uXvM47xmF6zXSG++bGvIneQ2DLLmK7n3otw== 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=7Nk1CN+j4B/Mq/rCvZP0747CGWDJEwdX0Pe1Pu44Qbs=; b=OpIwUcOpc5CUgcjQEtItC+HQdhoKMVDDvUQxnE2ocBsADYn3DCxuJpYbvoi73IimQcxjHiEVd58Ns54eo84cVSitchK1yNUVB7EHC6rKovWnW3GYLjhcsMaqnTbtoeh3xOce4XF3XNDV0emO+HtxNgzH1oeRb/jO241niGoBGleUEj6cPd3LcwVBOAqAGKK1Ohic5qa5+GLtufwOTQuQQ72oayIcmQ0lZAGk66nOWnveGHdEVi2ThKXkG1zvZ/Fa1swwNFUBlD5/00TGK/9eyCf6OD96cuTy4IqWn32DIPwK9/qKKSpXJbbSOp9jPAlIVEsrofG63NbQWtfk04qqVA== 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=7Nk1CN+j4B/Mq/rCvZP0747CGWDJEwdX0Pe1Pu44Qbs=; b=uemVPyneA0ye0XhCsRn/KNp6Yeq5/rntat7Msjiv6tEvcLVj2IIE19u+c1MLbUS/OUNrXYByz4UBvfujvcJXCaHsRIz+tBejSgvCxGzx90CgdFaUeQqT0Ob+56+nLHDTsCVNCnwU4O36k/sFy+IhUBLkzAihB3CjvMZSuZ7awHZoNqaJwCYqH1+n5XZE0wg4D+/vMdWymKzZfAe6tjY1PhUGo20SjzjSF0HgjGrFvKVNYy4+sN9/iL8Banc9CAwDil+tInNO8ctAu4xoDTSE4/ZoCMoLy1nvFsHdKAwi/ohS8vO+S/367u+RhgOg1rzuPf4v6uKVNDTRqrNH/lOEQA== 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 v8 2/5] xen: arm: smccc: add INVALID_PARAMETER error code Thread-Topic: [PATCH v8 2/5] xen: arm: smccc: add INVALID_PARAMETER error code Thread-Index: AQHciwXkoCbVDuwd90KU3/bSFw0oPg== Date: Wed, 21 Jan 2026 18:43:54 +0000 Message-ID: <8b964d9b6a50053d8a2e485a672b0fd3bc2e0c7c.1769020872.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: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PAVPR03MB8946:EE_|PAVPR03MB8945:EE_ x-ms-office365-filtering-correlation-id: 2f37e1db-2e67-4122-d414-08de591d077a x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|366016|376014|7416014|1800799024|38070700021; x-microsoft-antispam-message-info: =?iso-8859-1?Q?c7cQ5AKRjUAWwniKXPiW4OcfEARbbNmeGrjoPPsGTlK6az7hpd0Ru03oRp?= =?iso-8859-1?Q?jovYpNJj2vipQuVOkvjW/Gnqhn7pjkMEw1SD/spWdoPM7fvuRf7vNQ9HdJ?= =?iso-8859-1?Q?BsObRd4hh9sikZBLvDEdcoycV0aM4kK/Ww6ojKki7Pf2O9MOXsP3xuOa5s?= =?iso-8859-1?Q?SgOBwCDrH9gWe4vxYub3TtNro3vgLn8GHQSIbDnkp+kRy+nYUqVIZL2o0i?= =?iso-8859-1?Q?deseXg1DmmH7dhKEfZnNGwV1rUHIeGyRu+Y5nW1ZUjlmb+GSOj8l8J7WbE?= =?iso-8859-1?Q?Dhr6uE/0G9FjsqdNFwVOGsugLmsaPvE+TEOs2dnFboH1rqY6maf1aGgxA0?= =?iso-8859-1?Q?gLyDkuftga4EgWnShgV84/sSPv5zJqV1JEUl1iKycG952sYzwjDkoHMkMO?= =?iso-8859-1?Q?eDhcgV7pcTs1NoFYb/kAD5Nq2g9/wlGFwxMJJj7ak85xlKgu+Z5oCIRcAU?= =?iso-8859-1?Q?s7l4SSa6R+OYGEUVT9bYtcRXRy/BMkcPyGyP7WJEttaITZmCVKGlmmrr19?= =?iso-8859-1?Q?OD1GtYNcdMUHv3FWIlT6UHX4ahsEjGnES30J+kWKKxkaU7dGM3DAkW705b?= =?iso-8859-1?Q?+7Zpzjyyp1f7O7Lme9tnL6YKkTRfVGkzOjsOIcbjrUR+n7tJmHTL4UQu6K?= =?iso-8859-1?Q?LJCOQNS1whWqoARfUKV62MNqd/8oH2ldCnFCJpcm/7B9Wr3pG5KMeneuyX?= =?iso-8859-1?Q?L93LzT1c6pDXe3cJmqilIMfd/eGX2qREaI2c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oEzrTyIkSWHLQI/2r8mNVTmWltqoDsrre86rA0GPWCEzyzPT1uUDcUc2jm?= =?iso-8859-1?Q?1PwxWpC2pghBD5sg+jA=3D?= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAVPR03MB8946.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(7416014)(1800799024)(38070700021);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?jvSNFgD2SIJBrpfxzFJWqwMgyw1UijiwNi3Ccwn+kOsnjf6MjndT8kbU1e?= =?iso-8859-1?Q?H72gPJZRADd+AtBQ0urDm/WpFtgDRcxx7fIrkryNTfLr4elfkfpBY0cyyB?= =?iso-8859-1?Q?KOH0//wjHnZ4N+bmvQIIkv0BlsIGytMystcNj7Pq0tlstmbbR0lomPiebR?= =?iso-8859-1?Q?PWqaFX1H5EMMGiYe3k9H0hRDqkEGhNEXD9e4QGd/TQCQ1fwbXxja87hAkh?= =?iso-8859-1?Q?ttX0zJtwnqahwRigBeRON8Hor2albtILmnOlUWs171PXdF5IkvUqwHWe65?= =?iso-8859-1?Q?XHEG6ttdXD0w2q3INdr2eqFzkkPvt82MQZyLLyWkiDDX/TaLGidMY8y5QW?= =?iso-8859-1?Q?2R3VYmuF4d90eqG74u+8yuajmnkKOJCMF9ioHGvL9VhXgJJt0zAQFfUOB3?= =?iso-8859-1?Q?w6d+ipQ8qzFSRq+fuBIRTUQWH6J20bU7uQyi0+mHTxhiW2eH8HB1vDJK1U?= =?iso-8859-1?Q?S9B0Z+AVJcr/qCtsGF9byQUby2+47dKpLx8g4GdxIajzMxdB6z2vV5p/tQ?= =?iso-8859-1?Q?zsnqXzH3zHHjJH3rjwNz7qAw62/11hIe3Qp3J0AbUNXwoMgmX2H5xpX2TG?= =?iso-8859-1?Q?N0THfplGruMLO5hwTl8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859-1?Q?17O6GGKA0bVKdOf7Q4rtCy//2ZpO9HJRlUq8QEBA4/dQPJqk29aFj3MRO+?= =?iso-8859-1?Q?tXpBmpU9Qsoxufjsnv+vw/pNCpscvo7SAAHvQUSUZLZdl3xrOyNliXrQ1C?= =?iso-8859-1?Q?5sgi8BAJx8+x4s4MIJ1MAc/vlV81khLIDHZCsvt/Ao8wFYMbFlrvO1+cSZ?= =?iso-8859-1?Q?wQqZ8nzbgq4P9suKkks63T7FzRnThSUUq8wC2EJG5yVuwaPQmrj5iwmGiG?= =?iso-8859-1?Q?JCcGpn8YF7EImh/ROlmEiepQB+oqyZLTyfDXCQYURhoKcglYTjEMZRFCJQ?= =?iso-8859-1?Q?l3E1MD8m9QjLpHmAaWaaOEgtoD1WU5I=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: PAVPR03MB8946.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2f37e1db-2e67-4122-d414-08de591d077a X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Jan 2026 18:43:54.7007 (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: xKxNBv+04QIbHYHkFpG3lrHLdOD4wGOpPOshn/3Dd1lq9KFDry1QchT/HONLjr7Frls1jIy7emgMw4QO0SgUwTQaTQ92D/CudHFfUQfzRPU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAVPR03MB8945 X-ZohoMail-DKIM: pass (identity @epam.com) X-ZM-MESSAGEID: 1769021074009158500 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 --- 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 441b3ab65d..478444fb09 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.34.1 From nobody Mon Jan 26 07:40:45 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; 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=1769021079; cv=pass; d=zohomail.com; s=zohoarc; b=QfucbHrJ9+qZh4vNSidHxzMCL7/TaL1UDJIXNSPGsy9xeRH3M8UyLx7iCdsi/Rju0kabjf/Wq0UOPh/arVugxnL4jE2k7cGdg99EqVPm/LsopJfM42oxSSvh0A2drOTkYJfcycbjrKOllMfoAA0hZg5+sH6Qayx2aOGEHSzBKJ0= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769021079; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=lgFnC943YKWfNBpj2PlihUbnDFNiYD7hP1fbiPXbYg0=; b=neV/etJhZb/UYQ0R/qNCUNKGDik9cKULwULKAteACjUJ17nLzrrZSpHeQYVEZnMsu5i5ijPzKy6v5qqScbvER/Ol3vR2rgXqYB/CnDlfhYV6LWfkPpIWaLR0j5COG/Ixjdh0aJB1AqNI2iIU85K7bIGmHBtxXc42SyPJArKyr5c= 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 1769021079233697.3410373011819; Wed, 21 Jan 2026 10:44:39 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1210163.1521967 (Exim 4.92) (envelope-from ) id 1vidBa-00083Y-8A; Wed, 21 Jan 2026 18:44:10 +0000 Received: by outflank-mailman (output) from mailman id 1210163.1521967; Wed, 21 Jan 2026 18:44:10 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vidBa-00083R-5J; Wed, 21 Jan 2026 18:44:10 +0000 Received: by outflank-mailman (input) for mailman id 1210163; Wed, 21 Jan 2026 18:44:09 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vidBZ-00083G-1q for xen-devel@lists.xenproject.org; Wed, 21 Jan 2026 18:44:09 +0000 Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazlp170110003.outbound.protection.outlook.com [2a01:111:f403:c200::3]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 29bb788b-f6f9-11f0-9ccf-f158ae23cfc8; Wed, 21 Jan 2026 19:44:05 +0100 (CET) Received: from PAVPR03MB8946.eurprd03.prod.outlook.com (2603:10a6:102:32e::21) by PAVPR03MB8945.eurprd03.prod.outlook.com (2603:10a6:102:322::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9542.9; Wed, 21 Jan 2026 18:43:57 +0000 Received: from PAVPR03MB8946.eurprd03.prod.outlook.com ([fe80::f12d:7394:bbe3:dfc]) by PAVPR03MB8946.eurprd03.prod.outlook.com ([fe80::f12d:7394:bbe3:dfc%5]) with mapi id 15.20.9542.008; Wed, 21 Jan 2026 18:43:57 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 29bb788b-f6f9-11f0-9ccf-f158ae23cfc8 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=XN3bII5KRrKprbZcdO96keIyguuSczTRGUqeNGkt3fV3gC3DQVQtKpROWFBnAgtD0l3A5BztITaLzJbhg6kyI+L99SlvMNWMpYvF70+1+DXlHw+alRdxvDvky/i9zM7Bc5fRCRIQsK7w9CMuEhS0+Pk/OtS+M/o4/u2s94FYZFaA1Wp2nfUjvadQEUNsjnjeRGIIe0pMR9R+ggWUQ/vjU8knn+nfSmWxWhJQ2PGlQu/75Lj09dNSRYbie5TxyTK6j/Hudd4+d8PLU71UhfBJFooorpCsCnilNH0W+J/Q67fTFGEniSLLK96Uz/TUFucdGS1j952ZJ48Y7d6HwpWIpw== 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=lgFnC943YKWfNBpj2PlihUbnDFNiYD7hP1fbiPXbYg0=; b=T3ILay8laRxweTJ9KWsMA1y3qP8iZMk6b0AAmDf12oJdP719ZVbHqNJYi6rUbc9ui4rifVo29AwI2h2GNAWEvICWGaPkePjacaDIR9Ai5QCoaA6YfGPx584+Z5C6TBtVrbooZ1/9quDBweaS+2idCQoqeWduFo0fjLXTiYTtiyy0biUsuW48KqnGdOvjBGlR2IfBJ1R3hPdaZoEhKSNLydstj1smKGZCdrLRp4kwku5ltg5myiWQUvnLskuf4CLwp3qMSM7xFrbMTG82PxTy6b/d9+zslpz9Vvb4rkn2zRrWknMyvxsnntrdkqD2IKJd7wTmhvFdOWJqJ7SYQ+qSQA== 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=lgFnC943YKWfNBpj2PlihUbnDFNiYD7hP1fbiPXbYg0=; b=lyQhC9ptIvtIFeagZ9/rSkl4JTUB77OEX9NNcl3oxV8Cnvm8ioNO28GQ/CJOyK0WJQD+55D4ekZQhOiRcERRh7W+/8FU3bcCjC5lFqwTfryNk6dEnsOUd+woCYfuKeDAAjlOQXaIYZyEdUUyNhE2ZY3DyeLhIa6up+rAJ7VnYLiATIZhKoS3cK7d15F1Dccylr9+EUVC3BQzXNMnkwaWxA2TZrBSepfXGtDVvKSc6w2oXM1Vuj/VCWu93vw7Y88Ngy216px6r6/qkh+q01kJsg/EhgpI+fK8ADG9707Fl6rQUQqou6d9k5+C6tRR43tlO5Q7ZMamZtaLrTaQYeCedg== 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 v8 3/5] lib/arm: Add I/O memory copy helpers Thread-Topic: [PATCH v8 3/5] lib/arm: Add I/O memory copy helpers Thread-Index: AQHciwXl2jVTGILzyE6wM0DfzctyvA== Date: Wed, 21 Jan 2026 18:43:55 +0000 Message-ID: <07fded74c7bc375a4e77596866072b65a546f8e6.1769020872.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: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PAVPR03MB8946:EE_|PAVPR03MB8945:EE_ x-ms-office365-filtering-correlation-id: 42d3c5c3-9da1-474e-1fad-08de591d08d9 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|366016|376014|7416014|1800799024|38070700021; x-microsoft-antispam-message-info: =?iso-8859-1?Q?nEMRlWtfYkqnh960u5F4I4D8NCtVaEUmTYCllL7yI9h/yf1UW3C79AWujv?= =?iso-8859-1?Q?+R1+3ba3a+jdvNaLHT843fEb6fDM0snGw1IZM/0ToBU0tLsIzqrSF5oVV5?= =?iso-8859-1?Q?L3aSpfxYLrxbhXTxFGRKSAHa1vKKhOob/DFcjyvPLGILCXErSQ0WCXrQEH?= =?iso-8859-1?Q?2u7tw/FI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/4i?= =?iso-8859-1?Q?BVnRBW0qRTGKg0X8YYWyELVOvlSFn929nYwgndTTHsIXTEDsbXjfOS4clE?= =?iso-8859-1?Q?/6sVglVypCLOt56/YabXSwHdFWNOV2DFy68twf5dbIIVqlT6AmaHqIA7N8?= =?iso-8859-1?Q?peOpfvkI2z1HbeUIASFRm3zTWIMTfNbOC3UYbpNlUF3lRasBAMib/hEw9S?= =?iso-8859-1?Q?uIwt1kXho/tvUpah8VhCFntdifkAz/oWePsSmsoXhOgktaBHy6IXYdsoIo?= =?iso-8859-1?Q?7eEnTdrtSbPJUu3h019CybPDTF26qazYEqEQLmTJoJkWN5WMZjac+6HAa5?= =?iso-8859-1?Q?Fd/GYSI/uOYMEDhcjtju3REyCnQUVr0Ofd5LqJ6kfOIBbydrXppyw+DQ60?= =?iso-8859-1?Q?QTI28JDYNbf9YWjZ6wuAqC6Io6v/p7APFvTVaEkvMf5gz5KKyXUrrjZdiV?= =?iso-8859-1?Q?B6b/5dGLbgL5euc9Y5lfe4FCNP+5obKUoJHwRGhBBtxROcvBcogAD9IbuU?= =?iso-8859-1?Q?0urgzxzipZIkNepVzsSXnoDQybnOZRojB0grfs1xlSzrBw70cCXmjwj2YT?= =?iso-8859-1?Q?49+cOk5ocLNL7H7pbODzrGfRk87sytTkxaTBGDG8RIgxSlhANiBiIUgDzT?= =?iso-8859-1?Q?XagD7n0vGXayG+u/cvo=3D?= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAVPR03MB8946.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(7416014)(1800799024)(38070700021);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?tFQ3FhNGapOUWjksGoJo/TQjfOaPWaatW/GCW0YT5uZ7KaHXQMbgqZdjbk?= =?iso-8859-1?Q?XkV++Frh0aKZM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xb1NPPq/A8iJawMss=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: PAVPR03MB8946.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 42d3c5c3-9da1-474e-1fad-08de591d08d9 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Jan 2026 18:43:55.2048 (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: CxOB6Y71XWX4tL8JCES9xcOZ7+fTQcuZBxCz1VY1rn0pd1xXnfXEQaulvEsZxEqLub0NssLc4ymzARTsk+SiBztYie9+mBuqtQZAKxu0DmI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAVPR03MB8945 X-ZohoMail-DKIM: pass (identity @epam.com) X-ZM-MESSAGEID: 1769021079565158500 Content-Type: text/plain; charset="utf-8" This commit introduces two helper functions, `memcpy-fromio` and `memcpy-toio`, to provide a robust mechanism for copying data between standard memory and memory-mapped I/O (MMIO) space for the ARM architecture. These helpers handle alignment safely by using ordered byte accesses for any leading/trailing unaligned bytes and ordered 32-bit accesses for the aligned bulk transfer. Using the ordered `readb/readl` and `writeb/writel` accessors avoids unintended endianness conversion while respecting device ordering requirements on ARM32/ARM64 hardware that may not support 64-bit MMIO atomically. The interface lives in the generic header so other architectures can provide their own implementations (as macros or functions). The ARM implementation is placed under `arch/arm/lib/` (mirroring the x86 reference layout) and is split into separate compilation units added via the architecture-specific lib Makefile. Signed-off-by: Oleksii Moisieiev --- 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 | 48 +++++++++++++++++++++ xen/arch/arm/lib/memcpy-toio.c | 48 +++++++++++++++++++++ xen/include/xen/lib/io.h | 71 ++++++++++++++++++++++++++++++++ 6 files changed, 171 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 create mode 100644 xen/include/xen/lib/io.h diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile index 7494a0f926..bd8638c8a7 100644 --- a/xen/arch/arm/Makefile +++ b/xen/arch/arm/Makefile @@ -10,6 +10,7 @@ endif obj-y +=3D firmware/ obj-$(CONFIG_TEE) +=3D tee/ obj-$(CONFIG_HAS_VPCI) +=3D vpci.o +obj-y +=3D lib/ =20 obj-$(CONFIG_HAS_ALTERNATIVE) +=3D alternative.o obj-y +=3D cpuerrata.o diff --git a/xen/arch/arm/arch.mk b/xen/arch/arm/arch.mk index dea8dbd18a..0c28dbeb87 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 +ALL_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..85377137c3 --- /dev/null +++ b/xen/arch/arm/lib/memcpy-fromio.c @@ -0,0 +1,48 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#include +#include + +/* + * Use ordered 8-bit and 32-bit IO accessors for portability across + * ARM32/ARM64 where 64-bit accesses may not be atomic and some devices + * only support 32-bit aligned accesses. + */ + +void memcpy_fromio(void *to, const volatile void __iomem *from, + size_t count) +{ + while ( count && (!IS_ALIGNED((unsigned long)from, 4) || + !IS_ALIGNED((unsigned long)to, 4)) ) + { + *(uint8_t *)to =3D readb(from); + from++; + to++; + count--; + } + + while ( count >=3D 4 ) + { + *(uint32_t *)to =3D readl(from); + 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: 8 + * tab-width: 8 + * indent-tabs-mode: t + * 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..588497ed0f --- /dev/null +++ b/xen/arch/arm/lib/memcpy-toio.c @@ -0,0 +1,48 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#include +#include + +/* + * Use ordered 8-bit and 32-bit IO accessors for portability across + * ARM32/ARM64 where 64-bit accesses may not be atomic and some devices + * only support 32-bit aligned accesses. + */ + +void memcpy_toio(volatile void __iomem *to, const void *from, + size_t count) +{ + while ( count && (!IS_ALIGNED((unsigned long)to, 4) || + !IS_ALIGNED((unsigned long)from, 4)) ) + { + writeb(*(const uint8_t *)from, to); + from++; + to++; + count--; + } + + while ( count >=3D 4 ) + { + writel(*(const uint32_t *)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: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + */ diff --git a/xen/include/xen/lib/io.h b/xen/include/xen/lib/io.h new file mode 100644 index 0000000000..1c0865401e --- /dev/null +++ b/xen/include/xen/lib/io.h @@ -0,0 +1,71 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Generic I/O memory copy function prototypes. + * + * These functions provide low-level implementation for copying data betwe= en + * regular memory and I/O memory regions. Each architecture must provide i= ts + * own implementation based on the specific requirements of the architectu= re's + * memory model and I/O access patterns. An architecture may supply these = as + * functions or as macros in its own headers before including this file. + * + * Architecture-specific implementations: + * =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=3D=3D=3D=3D=3D=3D=3D=3D=3D + * Each architecture should implement these functions in xen/lib//io= .c + * (or define them as macros) based on their hardware requirements. See + * xen/lib/arm/io.c for an example using explicit I/O accessors. + */ + +#ifndef _XEN_LIB_IO_H +#define _XEN_LIB_IO_H + +#include + +/* + * memcpy_fromio - Copy data from I/O memory space to regular memory + * @to: Destination buffer in regular memory + * @from: Source address in I/O memory space (must be marked __iomem) + * @count: Number of bytes to copy + * + * This function handles copying from memory-mapped I/O regions using + * architecture-appropriate I/O accessor functions (e.g. readb/readl on Ar= m) + * that already impose the required ordering for device accesses. Typical + * implementations may: + * - Handle leading/trailing unaligned bytes with 8-bit accesses + * - Use the widest safe aligned access size supported by the target (often + * 32-bit on Arm where 64-bit MMIO may not be atomic) + * - Rely on MMIO accessors to provide the needed barriers + * + * Limitations: + * - Only suitable for devices that tolerate 8-bit and 32-bit accesses; it= is + * not valid for devices that require strictly 16-bit or 64-bit access s= izes. + * - Callers must ensure the target MMIO region is mapped with appropriate + * device attributes. + */ +extern void memcpy_fromio(void *to, const volatile void __iomem *from, + size_t count); + +/* + * memcpy_toio - Copy data from regular memory to I/O memory space + * @to: Destination address in I/O memory space (must be marked __iomem) + * @from: Source buffer in regular memory + * @count: Number of bytes to copy + * + * This function handles copying to memory-mapped I/O regions using + * architecture-appropriate I/O accessor functions (e.g. writeb/writel on = Arm) + * that already impose the required ordering for device accesses. Typical + * implementations may: + * - Handle leading/trailing unaligned bytes with 8-bit accesses + * - Use the widest safe aligned access size supported by the target (often + * 32-bit on Arm where 64-bit MMIO may not be atomic) + * - Rely on MMIO accessors to provide the needed barriers + * + * Limitations: + * - Only suitable for devices that tolerate 8-bit and 32-bit accesses; it= is + * not valid for devices that require strictly 16-bit or 64-bit access s= izes. + * - Callers must ensure the target MMIO region is mapped with appropriate + * device attributes. + */ +extern void memcpy_toio(volatile void __iomem *to, const void *from, + size_t count); + +#endif /* _XEN_LIB_IO_H */ --=20 2.34.1 From nobody Mon Jan 26 07:40:45 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; 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=1769021085; cv=pass; d=zohomail.com; s=zohoarc; b=NhFPMTnCZrGzwfrfFYJOMO6Hu8NWh89HC9bRkA85hHDfnooDUAkqfTUniwwkqmSM+bJF3QSI15jzy3/DYLXvpP53Xe+PrHc6rOOYg+oRfMcupuHJ+U0AxnMdDexrwk/fIoGO+3TLLt1iK5FHnPPN6MfWouaGUCnYtFidhpxIJ00= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769021085; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=5Fhp/kP8N1NJs9TdCl5nqofZ9x3PA7HOZuf3aahU/X4=; b=kRBs+0LMikngDN8dEzO+UG2IPIQG3976y0+O42kJsIwgUI/s72tLkk1ccVEtAJr/hidOKz0cOLW7wIK7h5B1AbzXBxkBzgnYbOneAPbLDCdQ8RtqCPpy4vP+FeGwrGEjui2WK4IH2h3afx/wI4lKkeY2XJ4OkwrR/AlJBHsBX+U= 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 1769021085094455.8108049851945; Wed, 21 Jan 2026 10:44:45 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1210168.1522018 (Exim 4.92) (envelope-from ) id 1vidBi-0000tE-W6; Wed, 21 Jan 2026 18:44:18 +0000 Received: by outflank-mailman (output) from mailman id 1210168.1522018; Wed, 21 Jan 2026 18:44:18 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vidBi-0000t5-Sd; Wed, 21 Jan 2026 18:44:18 +0000 Received: by outflank-mailman (input) for mailman id 1210168; Wed, 21 Jan 2026 18:44:17 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vidBg-00083G-Pn for xen-devel@lists.xenproject.org; Wed, 21 Jan 2026 18:44:17 +0000 Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazlp170110003.outbound.protection.outlook.com [2a01:111:f403:c200::3]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 2e819d6d-f6f9-11f0-9ccf-f158ae23cfc8; Wed, 21 Jan 2026 19:44:13 +0100 (CET) Received: from PAVPR03MB8946.eurprd03.prod.outlook.com (2603:10a6:102:32e::21) by PAVPR03MB8945.eurprd03.prod.outlook.com (2603:10a6:102:322::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9542.9; Wed, 21 Jan 2026 18:43:57 +0000 Received: from PAVPR03MB8946.eurprd03.prod.outlook.com ([fe80::f12d:7394:bbe3:dfc]) by PAVPR03MB8946.eurprd03.prod.outlook.com ([fe80::f12d:7394:bbe3:dfc%5]) with mapi id 15.20.9542.008; Wed, 21 Jan 2026 18:43:57 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 2e819d6d-f6f9-11f0-9ccf-f158ae23cfc8 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=TNg8Q5QaXqoSnRyThIzFIxGCcugCoXI0Du4YNmXa5D2iWDiZ+CKU+JSX2R2JENbFNUSrpOQDAW9dNkRRcsWZPuhj6wRwRm+Ec7sRKbu1NbAR0eLDRzjmj1N2kx1vEc7LaaFUMT04ZP+jjb060UhhccI4T8h3q20m2R3hbMI5yO/BjxSCpB9YavWfhPmne8XBSyRxcEMO8XTa055qOiTUY+Zg2Q50psLXv8yLYT1b9iKqwJVV+MkUmnmDKqla2ONko1V8pQbszEBACaeD/ZkgNujA0gBkM4ocLxu26yk/4PFTQ2yf1EKugwAI/43KOO3GX2m9eCZ7m7GxPi7TKdxg7Q== 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=5Fhp/kP8N1NJs9TdCl5nqofZ9x3PA7HOZuf3aahU/X4=; b=kvnx13U38DoSN9Ju+8iO8qOTstEovphJrkgUgovvz1MP2gzujXUc5LmIjunChh2pMQH9AjB6H7jT301h4tpOdamKRWkpFiDDXon4jLtVfb35KAPNCV2xqH1IspigeIIX2pygpHNaQr0Jnzbs5YmMtsK8EqRyeiJMecY/HNd7TTZzlJSZo6wUYV2r7NXX5HAhu/JJmXbbwgEemehtWX5h//ph9IIH/Tz51hX0Z82ldqboR3kMMrbPJl+n50hyFQ8MAnAnPtSN3TSEYYvX2Txsn/VYZ0lLROh0GkIMZues4AqOcGBlQpj+Y3dMdawoIs0t43E6zKAlALeUJ6uwRguj0g== 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=5Fhp/kP8N1NJs9TdCl5nqofZ9x3PA7HOZuf3aahU/X4=; b=Zq5jMl1Y3c56c/Y5MGzJEYXl8tGVbsXf+57fbXFwrw6fRIvb6Rhf3qE/rcTh30mFRwHEDMnejaV9BeoqGRsQjTZKWfBYLVruyOlWcu5HDe7ezIZXVuOZO5pedpplZ1PvqvwXgoxhQeTviBPN8xvr652Dw/J3ZQn7b/aNRCgRFR7nCjk0Oe2h0zkhjRRm4/pZwdk+zcOTQBp+2KG1/pNZfxrBD9g3sALKtuxrpr5X6eqYnO5Ywwutkt2NjwatyscFtvpRXodtw6JofarKgr7Z+8cpKAU5V98m5hqBP1O189d8NxQdar/Hh4iUgv2JgU12mQtR+eqxbuBghn9Hys0OjQ== 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 v8 4/5] xen/arm: scmi: introduce SCI SCMI SMC multi-agent driver Thread-Topic: [PATCH v8 4/5] xen/arm: scmi: introduce SCI SCMI SMC multi-agent driver Thread-Index: AQHciwXlwgLiqFlETUSoWi6AzAQyog== Date: Wed, 21 Jan 2026 18:43:55 +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: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PAVPR03MB8946:EE_|PAVPR03MB8945:EE_ x-ms-office365-filtering-correlation-id: d56be86d-225e-4116-0ea7-08de591d090e x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|366016|376014|7416014|1800799024|38070700021; x-microsoft-antispam-message-info: =?iso-8859-1?Q?k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+MSb+me0h9QM/0XuRKDAVIVh?= =?iso-8859-1?Q?dXb2PtBaN15tcOP23KYAkvTdmaUea3hWR4exbXHwrBmHyRZaCSVjdWungt?= =?iso-8859-1?Q?UYzp+7eoTS+3tFGYZDfptGgWBVUW5SB+0gDuyloPFFDeulmH02gquReqTH?= =?iso-8859-1?Q?uLhMZa7eXKnTHE5wdBxT6XRgl3tv3MWW9Cgia0gEk1XIW9WqfC3x1CSrH2?= =?iso-8859-1?Q?mjUVXtjMSLnO82aJQA2dw0iPK77ZDpiuqhNgRarX29FRnjzZZOck4gPxNq?= =?iso-8859-1?Q?maboLXnHr5RyWm939V7WOVA3CKNvrbR1avANuEZCAdED5vgIHHyJ187MF2?= =?iso-8859-1?Q?1W/9laJ2akybwqOrxJ57lI3uCnFypWagqWNXnLFUGgdtvxSxN/rn//R0M1?= =?iso-8859-1?Q?OHxuL1yw31LWTS513RxTcMYI/N9PvlnQvtSbKaP4Q66RJlS1wO0YtaxVaS?= =?iso-8859-1?Q?2lakPeFEb36/i0+K8V2tUHz6nnQLwErRBeMitzwjfokCMbH6Bk0vxSlmOC?= =?iso-8859-1?Q?MW9cbFG9F71VccRO74coz90wFCbWx6WzDX5UsjPuWudSTkjhq+D4T87szF?= =?iso-8859-1?Q?DQa7hPXBfHS2/i2E5YHXV/dTpO3JXLpiw29tDpkhpR+pZlOV1eW+UKQqGK?= =?iso-8859-1?Q?oZETxbfGUcsEqGFj8KshpgczPGvtuZDoNvhgZiTVIY1yUayw23IiL3ysi7?= =?iso-8859-1?Q?WaPerufVzaJU7ZgjJ3kN1v7Uw2DbZjddARUZrA3mt7EIEVKqnIQzsZiWOE?= =?iso-8859-1?Q?9EikpnpXspOF3Cau0MOI/f6ZnBC4uVnzOeK3heHWVLF3MUP5hrDTHZhq6I?= =?iso-8859-1?Q?8tvzAMJdqViuVG71cHs=3D?= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAVPR03MB8946.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(7416014)(1800799024)(38070700021);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?pBjU1zrFJvAtlrY/zX6QWa7QXrjoCRgzZUQX3Uyko7AEDUxJJvQJ8dm1DI?= =?iso-8859-1?Q?Gpg5AAQUlBShMn7iwosjQNztZhf3IpzMwtzVJQFJ0QwGtmizkyA54eXhom?= =?iso-8859-1?Q?sS028dI8bfwn8aP+Ei5FoOeHuyE0JJusfGyo/EXuzeYK4slY6GfhVPraLX?= =?iso-8859-1?Q?Fw7UPpHu6OatCfmSpGW+2Ow8lLtzDoY1COGB3cndGX9+xN4ngyLT/O1bT1?= =?iso-8859-1?Q?W7XXyG7XAnnW69S/3ee8w0Cfy3TQ6EycZSvpFJ4wq2NdtGJd6/rjGOV5lP?= =?iso-8859-1?Q?cN9UuIJZMTreCSQtAvtxh0hsttdSXQdV+RuaLt3SFZQ2H9nWGw//8f0pqT?= =?iso-8859-1?Q?RQqGojsUP73P+y4oBnCQ73qqai0NXvus+aNLs05MnjdCE0sEhwa8tiOaR6?= =?iso-8859-1?Q?QAU8MCsDlVgoPmJLNZYH2tu2OsoPwGaUG6/2znA6lh+KUgV/s67kRadl+W?= =?iso-8859-1?Q?ce58SddbNtmN+vuRApGLoPnGdbmUaFCoF0ctnLV4L75rIiyeDF0RHiCNe0?= =?iso-8859-1?Q?CZZHWopQ2KnkpXv2TYMq8XQLBdEJDP1x4T73Dv+zgmZz5gradzq9s2dzJw?= =?iso-8859-1?Q?eJ6h0ulcJapIK2HRvSocMDatN6CKGp7sBrgnC8SgEEZUVDVXWvWjd0Is3c?= =?iso-8859-1?Q?6zX6zudt0G9i6fnHrmrUzwOHVfeWov06YBlPBnAfzfzyUm6OrE20aKpjJS?= =?iso-8859-1?Q?q71vMBPYYzsBueidR0j6oXSSynBwc9vWsje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iso-8859-1?Q?t76Vkev68fhw/KVkWRMgrGkuk15CYAQpB6v2O/jntE4RYe7ffF7ukT+CqZ?= =?iso-8859-1?Q?CNr+npQm3F5wX6vUt49RnSOdbWCSxlEH++Mx5xJe0YOEV4XqIa1gxv4zEj?= =?iso-8859-1?Q?v/S6ZNN4LLWmok3DmsfHUYoUteg4RAfQo1N6PXAhI+lcsH8Mpx/RB9k1rk?= =?iso-8859-1?Q?MTXFCM5FGk3z7CZXbUgQ9yoYIr1p+a4=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: PAVPR03MB8946.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d56be86d-225e-4116-0ea7-08de591d090e X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Jan 2026 18:43:55.8268 (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: Xg+QSNdIf4bI7RmJVG2U1GJc8l2UbwQyVecS3N0Cd/sYoUqxhSVgiGthiOyeqEAItzR1Plb9Ah0F/VqwMHtaHQaiy5zS/+uc8EoMtihwDnE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAVPR03MB8945 X-ZohoMail-DKIM: pass (identity @epam.com) X-ZM-MESSAGEID: 1769021086467154100 Content-Type: text/plain; charset="utf-8" This patch introduces SCI driver to support for ARM EL3 Trusted Firmware-A (TF-A) which provides SCMI interface with multi-agent support, as shown below. +-----------------------------------------+ | | | EL3 TF-A SCMI | +-------+--+-------+--+-------+--+-------++ |shmem1 | |shmem0 | |shmem2 | |shmemX | +-----+-+ +---+---+ +--+----+ +---+---+ smc-id1 | | | | agent1 | | | | +-----v--------+---------+-----------+----+ | | | | | | | | | | +--------------+---------+-----------+----+ smc-id0 | smc-id2| smc-idX| agent0 | agent2 | agentX | | | | +----v---+ +--v-----+ +--v-----+ | | | | | | | Dom0 | | Dom1 | | DomX | | | | | | | | | | | | | +--------+ +--------+ +--------+ The EL3 SCMI multi-agent firmware is expected to provide SCMI SMC shared memory transport for every Agent in the system. The SCMI Agent transport channel defined by pair: - smc-id: SMC id used for Doorbell - shmem: shared memory for messages transfer, Xen page aligned. Shared memort is mapped with the following flags: MT_DEVICE_nGnRE. The follwoing SCMI Agents are expected to be defined by SCMI FW to enable S= CMI multi-agent functionality under Xen: - Xen management agent: trusted agents that accesses to the Base Protocol commands to configure agent specific permissions - OSPM VM agents: non-trusted agent, one for each Guest domain which is allowed direct HW access. At least one OSPM VM agent has to be provided by FW if HW is handled only by Dom0 or Driver Domain. The EL3 SCMI FW is expected to implement following Base protocol messages: - BASE_DISCOVER_AGENT (optional if agent_id was provided) - BASE_RESET_AGENT_CONFIGURATION (optional) - BASE_SET_DEVICE_PERMISSIONS (optional) The SCI SCMI SMC multi-agent driver implements following functionality: - The driver is initialized from the Xen SCMI container ``xen_scmi_config`` (compatible ``xen,sci``) placed under ``/chosen/xen``. Only the ``arm,scmi-smc`` node that is a child of this container will bind to Xen; other SCMI nodes (for example under ``/firmware``) are ignored to avoid stealing the host OSPM instance. 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 smc-id #address-cells =3D < 1>; #size-cells =3D < 0>; #access-controller-cells =3D < 1>; shmem =3D <&scmi_shm_1>; <--- Xen management agent shmem }; - The driver obtains Xen specific SCMI Agent's configuration from the Host DT, probes Agents and builds SCMI Agents list. The Agents configuration is taken from "scmi-secondary-agents" property where first item is "arm,smc-id", second - "arm,scmi-shmem" phandle and third is optional "agent_id": / { chosen { xen { ranges; xen_scmi_config { compatible =3D "xen,sci"; #address-cells =3D <2>; #size-cells =3D <2>; ranges; scmi_shm_0: sram@47ff0000 { compatible =3D "arm,scmi-shmem"; reg =3D <0x0 0x47ff0000 0x0 0x1000>; }; /* Xen SCMI 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-secondary-agents =3D < 0x82000002 &scmi_shm_0 0 0x82000004 &scmi_shm_2 2 0x82000005 &scmi_shm_3 3>; <--- func_id, shmem, agent_id #scmi-secondary-agents-cells =3D <3>; xen,dom0-sci-agent-id =3D <0>; scmi_xen: scmi { compatible =3D "arm,scmi-smc"; arm,smc-id =3D <0x82000003>; <--- Xen management agent func_id #address-cells =3D <1>; #size-cells =3D <0>; #access-controller-cells =3D <1>; shmem =3D <&scmi_shm_1>; <--- Xen management agent shmem }; }; }; }; }; / { /* * Host SCMI OSPM channel - provided to the Dom0 as is if SCMI * enabled for it, ignored by Xen multi-agent mediator */ scmi_shm: 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>; <--- Host OSPM agent shmem protocol@X{ }; }; }; }; This approach allows defining multiple SCMI Agents by adding Xen-specific properties under the ``/chosen`` node to the Host Device Tree, leaving the main part unchanged. The Host DT SCMI channel will be passed to Dom0. The Xen management agent is described as a ``scmi_xen`` node under the ``xen,sci`` comaptible node, which is used by Xen to control other SCMI Agents in the system. All secondary agents' configurations are provided in the ``scmi-secondary-agents`` property with an optional ``agent_id`` field. The ``agent_id`` from the ``scmi-secondary-agents`` property is used to identify the agent in the system and can be omitted by setting ``#scmi-secondary-agents-cells =3D <2>``, so the Secondary Agents configuration will look like this: / { chosen { xen { xen_scmi_config { compatible =3D "xen,sci"; #address-cells =3D <2>; #size-cells =3D <2>; ranges; /* Shared memory nodes as defined earlier */ scmi-secondary-agents =3D < 0x82000003 &scmi_shm_0 0x82000004 &scmi_shm_2 0x82000005 &scmi_shm_3 0x82000006 &scmi_shm_4>; #scmi-secondary-agents-cells =3D <2>; }; }; }; } In this case, Xen will use the ``SCMI_BASE_DISCOVER_AGENT`` call to discover the ``agent_id`` for each secondary agent. Providing the ``agent_id`` in the ``scmi-secondary-agents`` property allows skipping the discovery call, which is useful when the secondary agent's shared memory is not accessible by Xen or when boot time is important because it allows skipping the agent discovery procedure. Note that Xen is the only one entry in the system which need to know about SCMI multi-agent support. SMC ID Configuration and SCMI Connection Compatibility: The configuration allows the same device tree to work for both baremetal Linux and Linux Dom0. This is achieved because: - Baremetal Linux uses: func_id 0x82000002, scmi-shmem 0x47ff0000 - Dom0 Linux uses: func_id 0x82000002, scmi-shmem 0x47ff0000 - Xen management uses: func_id 0x82000003, scmi-shmem 0x47ff1000 This works because the privileged SCMI connection in EL3 firmware is not tied exclusively to func_id 0x82000002. The EL3 firmware supports multiple SCMI agents with different SMC IDs and shared memory regions. Each agent (Dom0 via 0x82000002, Xen via 0x82000003, other domains via additional func_ids) has an independent communication channel to the firmware. The key distinction is that Xen's management channel (0x82000003) is used for privileged operations like agent configuration and device permissions (BASE_SET_DEVICE_PERMISSIONS, BASE_RESET_AGENT_CONFIGURATION), while Dom0's channel (0x82000002) is used for standard SCMI protocol operations (power, clock, sensor management, etc.). The firmware enforces different permission levels for each agent based on their agent_id, not the SMC ID. Therefore, there is no conflict: Linux Dom0 retains its standard SCMI connection for hardware management, while Xen uses its separate privileged channel for mediating access between multiple domains. - It implements the SCI subsystem interface required for configuring and enabling SCMI functionality for Dom0/hwdom and Guest domains. To enable SCMI functionality for domain it has to be configured with unique supported SCMI Agent_id and use corresponding SCMI SMC shared memory transport [smc-id, shmem] defined for this SCMI Agent_id. - Once Xen domain is configured it can communicate with EL3 SCMI FW: -- zero-copy, the guest domain puts SCMI message in shmem; -- the guest triggers SMC exception with smc-id (doorbell); -- the Xen driver catches exception, do checks and synchronously forwards it to EL3 FW. - the Xen driver sends BASE_RESET_AGENT_CONFIGURATION message to Xen management agent channel on domain destroy event. This allows to reset resources used by domain and so implement use-case like domain reboot. Dom0 Enable SCMI SMC: - set xen,dom0-sci-agent-id=3D under the xen,sci container in the Host DT. If the property is absent, SCMI is disabled for Dom0 and all SCMI nodes are removed from the Dom0 DT. The driver updates the Dom0 DT SCMI node "arm,smc-id" value and fixes up the shmem node according to the assigned agent_id. - pass dom0=3Dsci-agent-id=3D in Xen command line. if not provid= ed SCMI will be disabled for Dom0 and all SCMI nodes removed from Dom0 DT. The driver updates Dom0 DT SCMI node "arm,smc-id" value and fix up shmem node according to assigned agent_id. Guest domains enable SCMI SMC: - xl.cfg: add configuration option as below arm_sci =3D "type=3Dscmi_smc_multiagent,agent_id=3D2" - xl.cfg: enable access to the "arm,scmi-shmem" which should correspond assigned agent_id for the domain, for example: iomem =3D [ "47ff2,1@22001", ] - DT: add SCMI nodes to the Driver domain partial device tree as in the below example. The "arm,smc-id" should correspond assigned agent_id for the domain: passthrough { scmi_shm_0: sram@22001000 { compatible =3D "arm,scmi-shmem"; reg =3D <0x0 0x22001000 0x0 0x1000>; }; firmware { compatible =3D "simple-bus"; scmi: scmi { compatible =3D "arm,scmi-smc"; arm,smc-id =3D <0x82000004>; shmem =3D <&scmi_shm_0>; ... } } } SCMI "4.2.1.1 Device specific access control" The XEN SCI SCMI SMC multi-agent driver performs "access-controller" provider function in case EL3 SCMI FW implements SCMI "4.2.1.1 Device specific access control" and provides the BASE_SET_DEVICE_PERMISSIONS command to configure the devices that an agents have access to. The DT SCMI node should "#access-controller-cells=3D<1>" property and DT devices should be bound to the Xen SCMI. &i2c1 { access-controllers =3D <&scmi 0>; }; The Dom0 and dom0less domains DT devices will be processed automatically through sci_assign_dt_device() call, but to assign SCMI devices from toolstack the xl.cfg:"dtdev" property shall be used: dtdev =3D [ "/soc/i2c@e6508000", ] xl.cfg:dtdev will contain all nodes which are under SCMI management (not only those which are behind IOMMU). Additionally, this patch adds documentation for the pre-existing scmi-smc-passthrough command line option, which was previously undocumented. [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 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 | 4 + SUPPORT.md | 11 + docs/man/xl.cfg.5.pod.in | 13 + docs/misc/arm/device-tree/booting.txt | 196 +++++ docs/misc/xen-command-line.pandoc | 2 +- tools/libs/light/libxl_arm.c | 4 + tools/libs/light/libxl_types.idl | 4 +- tools/xl/xl_parse.c | 12 + xen/arch/arm/dom0less-build.c | 11 + xen/arch/arm/domain_build.c | 41 +- xen/arch/arm/firmware/Kconfig | 12 + xen/arch/arm/firmware/Makefile | 1 + xen/arch/arm/firmware/scmi-proto.h | 164 ++++ xen/arch/arm/firmware/scmi-shmem.c | 115 +++ xen/arch/arm/firmware/scmi-shmem.h | 45 ++ xen/arch/arm/firmware/scmi-smc-multiagent.c | 813 ++++++++++++++++++++ xen/include/public/arch-arm.h | 3 + 17 files changed, 1448 insertions(+), 3 deletions(-) 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 bf00be928c..a6802d5970 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -530,6 +530,10 @@ R: Oleksii Moisieiev S: Supported F: xen/arch/arm/firmware/sci.c F: xen/arch/arm/include/asm/firmware/sci.h +F: xen/arch/arm/firmware/scmi-smc-multiagent.c +F: xen/arch/arm/firmware/scmi-shmem.c +F: xen/arch/arm/firmware/scmi-shmem.h +F: xen/arch/arm/firmware/scmi-proto.h =20 SEABIOS UPSTREAM M: Wei Liu diff --git a/SUPPORT.md b/SUPPORT.md index d441bccf37..03e3985da2 100644 --- a/SUPPORT.md +++ b/SUPPORT.md @@ -956,6 +956,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/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in index 27c455210b..6943ae29ad 100644 --- a/docs/man/xl.cfg.5.pod.in +++ b/docs/man/xl.cfg.5.pod.in @@ -3156,8 +3156,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 a non-zero ARM SCI agent id for the guest. This option is mandat= ory +if the SCMI SMC support is enabled for the guest. The agent ids of domains +existing on a single host must be unique and in the range [1..255]. + =3Dback =20 =3Dback diff --git a/docs/misc/arm/device-tree/booting.txt b/docs/misc/arm/device-t= ree/booting.txt index 977b428608..6b88dae347 100644 --- a/docs/misc/arm/device-tree/booting.txt +++ b/docs/misc/arm/device-tree/booting.txt @@ -322,6 +322,20 @@ 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. + The SCMI agent_id should be specified for the guest with "xen,sci-agen= t-id" + property. + +- "xen,sci-agent-id" + + Specifies ARM SCMI agent id for the guest. This option is mandatory if= the + SCMI SMC "scmi_smc_multiagent" support is enabled for the guest. The a= gent ids + of guest must be unique and in the range [0..255]. + Under the "xen,domain" compatible node, one or more sub-nodes are present for the DomU kernel and ramdisk. =20 @@ -824,3 +838,185 @@ 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 + +For enabling the ARM SCMI SMC multi-agent support (enabled by CONFIG_SCMI_= SMC_MA) +the Xen specific SCMI Agent's configuration shall be provided in the Host = DT +according to the SCMI compliant EL3 Firmware specification with ARM SMC/HVC +transport. The SCMI configuration must live under the Xen SCMI container +"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" container; any other "arm,scmi-smc" nodes (for example under +"/firmware") are ignored to avoid stealing the host's SCMI OSPM instance. + +- scmi-secondary-agents + + Defines a set of SCMI agents configuration supported by SCMI EL3 FW and + available for Xen. Each Agent defined as triple consisting of: + SMC/HVC function_id assigned for the agent transport ("arm,smc-id"), + phandle to SCMI SHM assigned for the agent transport ("arm,scmi-shmem"= ), + SCMI agent_id (optional) if not set - Xen will determine Agent ID for + each provided channel using BASE_DISCOVER_AGENT message. + +- xen,dom0-sci-agent-id + + Optional. Specifies the Dom0/hwdom SCMI agent_id inside the ``xen,sci`` + container. When provided, Dom0 will be configured for SCMI multi-agent + support; when omitted, SCMI remains disabled for Dom0. The value must + match the ``func_id`` and shmem pairing that EL3 firmware exposes for + Dom0 (for example via ``/firmware/scmi``). + +As an example: + +/ { + chosen { + xen { + ranges; + xen_scmi_config { + compatible =3D "xen,sci"; + #address-cells =3D <2>; + #size-cells =3D <2>; + ranges; + + scmi_shm_0: sram@47ff0000 { + compatible =3D "arm,scmi-shmem"; + reg =3D <0x0 0x47ff0000 0x0 0x1000>; + }; + + /* Xen SCMI 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>; + }; + + xen,dom0-sci-agent-id =3D <0>; <--- dom0 agent id + scmi-secondary-agents =3D < + 0x82000002 &scmi_shm_0 0 + 0x82000004 &scmi_shm_2 2 + 0x82000005 &scmi_shm_3 3>; <--- func_id, shmem, agent_= id + #scmi-secondary-agents-cells =3D <3>; + + scmi_xen: scmi { + compatible =3D "arm,scmi-smc"; + arm,smc-id =3D <0x82000003>; <--- Xen management agent= func_id + #address-cells =3D <1>; + #size-cells =3D <0>; + #access-controller-cells =3D <1>; + shmem =3D <&scmi_shm_1>; <--- Xen management agent shm= em + }; + }; + }; + }; +}; + +Note: This example 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 between +Dom0 and Xen channels. + +- #scmi-secondary-agents-cells + + Defines whether Agent_id is set in the "scmi-secondary-agents" propert= y. + Possible values are: 2, 3. + When set to 3 (the default), expect agent_id to be present in the seco= ndary + agents list. + When set to 2, agent_id will be discovered for each channel using + BASE_DISCOVER_AGENT message. + + +Example: + +/ { + chosen { + xen { + ranges; + xen_scmi_config { + compatible =3D "xen,sci"; + #address-cells =3D <2>; + #size-cells =3D <2>; + ranges; + + /* Shared memory nodes as in the previous example */ + + scmi-secondary-agents =3D < + 0x82000002 &scmi_shm_0 + 0x82000004 &scmi_shm_2 + 0x82000005 &scmi_shm_3 + 0x82000006 &scmi_shm_4>; + #scmi-secondary-agents-cells =3D <2>; + + scmi_xen: scmi { + compatible =3D "arm,scmi-smc"; + arm,smc-id =3D <0x82000003>; <--- Xen management agent= func_id + #address-cells =3D <1>; + #size-cells =3D <0>; + #access-controller-cells =3D <1>; + shmem =3D <&scmi_shm_1>; <--- Xen management agent shm= em + }; + }; + }; + }; +}; + +Dom0less example (multi-agent) +------------------------------- + +Below is a minimal dom0less configuration showing how to enable SCMI SMC +multi-agent for a pre-defined guest domain using xen,sci_type and +xen,sci-agent-id, together with the Xen SCMI container: + +chosen { + xen { + ranges; + xen_scmi_config { + compatible =3D "xen,sci"; + #address-cells =3D <2>; + #size-cells =3D <2>; + ranges; + + /* Xen management channel shared memory */ + scmi_shm_1: sram@47ff1000 { + compatible =3D "arm,scmi-shmem"; + reg =3D <0x0 0x47ff1000 0x0 0x1000>; + }; + + scmi_shm_domu: sram@47ff2000 { + compatible =3D "arm,scmi-shmem"; + reg =3D <0x0 0x47ff2000 0x0 0x1000>; + }; + + scmi-secondary-agents =3D < + 0x82000004 &scmi_shm_domu 2>; + #scmi-secondary-agents-cells =3D <3>; + + scmi_xen: scmi { + compatible =3D "arm,scmi-smc"; + arm,smc-id =3D <0x82000003>; + #address-cells =3D <1>; + #size-cells =3D <0>; + #access-controller-cells =3D <1>; + shmem =3D <&scmi_shm_1>; + }; + }; + }; + + xen,domain@1 { + compatible =3D "xen,domain"; + xen,sci_type =3D "scmi_smc_multiagent"; + xen,sci-agent-id =3D <2>; + /* Additional domain properties (memory, cpus, kernels, etc.) */ + }; +}; diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line= .pandoc index 15f7a315a4..268df3010b 100644 --- a/docs/misc/xen-command-line.pandoc +++ b/docs/misc/xen-command-line.pandoc @@ -789,7 +789,7 @@ Specify the bit width of the DMA heap. cpuid-faulting=3D, msr-relaxed=3D, pf-fixup=3D ] (x86) =20 - =3D List of [ sve=3D ] (Arm64) + =3D List of [ sve=3D ] (Arm) =20 Controls for how dom0 is constructed on x86 systems. =20 diff --git a/tools/libs/light/libxl_arm.c b/tools/libs/light/libxl_arm.c index e4407d6e3f..be0e6263ae 100644 --- a/tools/libs/light/libxl_arm.c +++ b/tools/libs/light/libxl_arm.c @@ -240,6 +240,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); diff --git a/tools/libs/light/libxl_types.idl b/tools/libs/light/libxl_type= s.idl index 4a958f69f4..9bfbf09145 100644 --- a/tools/libs/light/libxl_types.idl +++ b/tools/libs/light/libxl_types.idl @@ -554,11 +554,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 1cc41f1bff..0c389d25f9 100644 --- a/tools/xl/xl_parse.c +++ b/tools/xl/xl_parse.c @@ -1306,6 +1306,18 @@ 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 || val > 255) { + fprintf(stderr, "An invalid ARM_SCI agent_id specified (%l= u). Valid range [1..255]\n", + val); + ret =3D ERROR_INVAL; + goto out; + } + arm_sci->agent_id =3D val; + } + ptr =3D strtok(NULL, ","); } =20 diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c index 4181c10538..ddadc89148 100644 --- a/xen/arch/arm/dom0less-build.c +++ b/xen/arch/arm/dom0less-build.c @@ -299,6 +299,17 @@ static int __init domu_dt_sci_parse(struct dt_device_n= ode *node, d_cfg->arch.arm_sci_type =3D XEN_DOMCTL_CONFIG_ARM_SCI_NONE; else if ( !strcmp(sci_type, "scmi_smc") ) d_cfg->arch.arm_sci_type =3D XEN_DOMCTL_CONFIG_ARM_SCI_SCMI_SMC; + else if ( !strcmp(sci_type, "scmi_smc_multiagent") ) + { + uint32_t agent_id =3D 0; + + if ( !dt_property_read_u32(node, "xen,sci-agent-id", &agent_id) || + agent_id > UINT8_MAX ) + return -EINVAL; + + 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 986a456f17..0796561306 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -86,6 +86,37 @@ int __init parse_arch_dom0_param(const char *s, const ch= ar *e) return -EINVAL; } =20 +/* SCMI agent ID for dom0 obtained from xen,sci container */ +#define SCMI_AGENT_ID_INVALID UINT8_MAX + +static uint8_t __init get_dom0_scmi_agent_id(void) +{ + const struct dt_device_node *config_node; + u32 val; + const struct dt_property *prop; + + config_node =3D dt_find_compatible_node(NULL, NULL, "xen,sci"); + if ( !config_node ) + return SCMI_AGENT_ID_INVALID; + + prop =3D dt_find_property(config_node, "xen,dom0-sci-agent-id", NULL); + if ( !prop ) + return SCMI_AGENT_ID_INVALID; + + if ( !dt_property_read_u32(config_node, "xen,dom0-sci-agent-id", &val)= ) + return SCMI_AGENT_ID_INVALID; + + if ( val >=3D SCMI_AGENT_ID_INVALID ) + { + printk(XENLOG_WARNING + "Invalid xen,dom0-sci-agent-id=3D%u, SCMI disabled for Dom0\n= ", + val); + return SCMI_AGENT_ID_INVALID; + } + + return val; +} + /* 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)) @@ -509,7 +540,7 @@ static int __init write_properties(struct domain *d, st= ruct kernel_info *kinfo, dt_property_name_is_equal(prop, "linux,uefi-mmap-start") = || dt_property_name_is_equal(prop, "linux,uefi-mmap-size") || dt_property_name_is_equal(prop, "linux,uefi-mmap-desc-siz= e") || - dt_property_name_is_equal(prop, "linux,uefi-mmap-desc-ver= ")) + dt_property_name_is_equal(prop, "linux,uefi-mmap-desc-ver= ") ) continue; =20 if ( dt_property_name_is_equal(prop, "xen,dom0-bootargs") ) @@ -1459,6 +1490,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 @@ -1947,6 +1979,13 @@ void __init create_dom0(void) dom0_cfg.arch.tee_type =3D tee_get_type(); dom0_cfg.max_vcpus =3D dom0_max_vcpus(); =20 + /* Set up SCMI agent ID if provided in the xen,sci container */ + 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; + 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/scmi-proto.h b/xen/arch/arm/firmware/scm= i-proto.h new file mode 100644 index 0000000000..49f63cfc0a --- /dev/null +++ b/xen/arch/arm/firmware/scmi-proto.h @@ -0,0 +1,164 @@ +/* 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; + +/* BASE PROTOCOL_ATTRIBUTES */ +#define SCMI_BASE_ATTR_NUM_PROTO GENMASK(7, 0) +#define SCMI_BASE_ATTR_NUM_AGENT GENMASK(15, 8) + +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..112507ba2a --- /dev/null +++ b/xen/arch/arm/firmware/scmi-shmem.c @@ -0,0 +1,115 @@ +/* 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 + */ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include +#include +#include + +#include "scmi-proto.h" +#include "scmi-shmem.h" + +static inline int +shmem_channel_is_free(const volatile struct scmi_shared_mem __iomem *shmem) +{ + return (readl(&shmem->channel_status) & + SCMI_SHMEM_CHAN_STAT_CHANNEL_FREE) ? 0 : -EBUSY; +} + +int shmem_put_message(volatile struct scmi_shared_mem __iomem *shmem, + scmi_msg_header_t *hdr, void *data, int len) +{ + int ret; + + if ( (len + offsetof(struct scmi_shared_mem, msg_payload)) > + SCMI_SHMEM_MAPPED_SIZE ) + { + printk(XENLOG_ERR "scmi: Wrong size of smc message. Data is invali= d\n"); + return -EINVAL; + } + + ret =3D shmem_channel_is_free(shmem); + if ( ret ) + return ret; + + 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(pack_scmi_header(hdr), &shmem->msg_header); + + if ( len > 0 && data ) + memcpy_toio(shmem->msg_payload, data, len); + + return 0; +} + +int shmem_get_response(const volatile struct scmi_shared_mem __iomem *shme= m, + scmi_msg_header_t *hdr, void *data, int len) +{ + int recv_len; + int ret; + 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 input smc message. Data may be invalid= \n"); + return -EINVAL; + } + + ret =3D shmem_channel_is_free(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 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..7313cb6b26 --- /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 shmem_put_message(volatile struct scmi_shared_mem __iomem *shmem, + scmi_msg_header_t *hdr, void *data, int len); + +int shmem_get_response(const volatile struct scmi_shared_mem __iomem *shme= m, + scmi_msg_header_t *hdr, void *data, 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..8f68063be9 --- /dev/null +++ b/xen/arch/arm/firmware/scmi-smc-multiagent.c @@ -0,0 +1,813 @@ +/* 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 "scmi-proto.h" +#include "scmi-shmem.h" + +#define SCMI_SECONDARY_AGENTS "scmi-secondary-agents" + +struct scmi_channel { + uint32_t agent_id; + uint32_t func_id; + domid_t domain_id; + uint64_t paddr; + struct scmi_shared_mem __iomem *shmem; + 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 shmem_put_message(chan_info->shmem, hdr, data, len); + if ( ret ) + return ret; + + arm_smccc_1_1_smc(chan_info->func_id, 0, 0, 0, 0, 0, 0, 0, &resp); + + if ( resp.a0 =3D=3D 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 clean; + + ret =3D shmem_get_response(chan_info->shmem, hdr, rx_data, rx_size); + +clean: + 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); + + 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; + + channel->shmem->channel_status =3D SCMI_SHMEM_CHAN_STAT_CHANNEL_FREE; + printk(XENLOG_DEBUG "scmi: Got shmem %lx after vmap %p\n", channel->pa= ddr, + channel->shmem); + + return 0; +} + +static void unmap_channel_memory(struct scmi_channel *channel) +{ + ASSERT(channel && channel->shmem); + iounmap(channel->shmem); + channel->shmem =3D NULL; +} + +static struct scmi_channel *smc_create_channel(uint32_t agent_id, + uint32_t func_id, uint64_t = addr) +{ + 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; + list_add_tail(&channel->list, &scmi_data.channel_list); + + spin_unlock(&scmi_data.channel_list_lock); + return channel; +} + +static void free_channel_list(void) +{ + struct scmi_channel *curr, *_curr; + + list_for_each_entry_safe(curr, _curr, &scmi_data.channel_list, list) + { + list_del(&curr->list); + xfree(curr); + } +} + +static int __init +scmi_dt_read_hyp_channel_addr(struct dt_device_node *scmi_node, u64 *addr, + u64 *size) +{ + struct dt_device_node *shmem_node; + const __be32 *prop; + + prop =3D dt_get_property(scmi_node, "shmem", NULL); + if ( !prop ) + return -EINVAL; + + shmem_node =3D dt_find_node_by_phandle(be32_to_cpu(*prop)); + if ( IS_ERR_OR_NULL(shmem_node) ) + { + printk(XENLOG_ERR + "scmi: Device tree error, can't parse reserved memory %ld\n= ", + PTR_ERR(shmem_node)); + return PTR_ERR(shmem_node); + } + + return dt_device_get_address(shmem_node, 0, addr, size); +} + +/* + * 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 scmi_dt_handle_node(struct domain *d, struct dt_device_node *n= ode) +{ + 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 ( ac_spec->np !=3D scmi_data.dt_dev ) + 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; + + 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 __init int collect_agents(struct dt_device_node *scmi_node) +{ + const struct dt_device_node *config_node; + const __be32 *prop; + uint32_t len; + const __be32 *end; + uint32_t cells_per_entry =3D 3; /* Default to 3 cells if property is a= bsent. */ + + config_node =3D dt_find_compatible_node(NULL, NULL, "xen,sci"); + if ( !config_node ) + { + printk(XENLOG_WARNING "scmi: xen,sci node not found, no agents to = collect.\n"); + return -ENOENT; + } + + /* Check for the optional '#scmi-secondary-agents-cells' property. */ + if ( dt_property_read_u32(config_node, "#scmi-secondary-agents-cells", + &cells_per_entry) ) + { + if ( cells_per_entry !=3D 2 && cells_per_entry !=3D 3 ) + { + printk(XENLOG_ERR "scmi: Invalid #scmi-secondary-agents-cells = value: %u\n", + cells_per_entry); + return -EINVAL; + } + } + + prop =3D dt_get_property(config_node, SCMI_SECONDARY_AGENTS, &len); + if ( !prop ) + { + printk(XENLOG_ERR "scmi: No %s property found, no agents to collec= t.\n", + SCMI_SECONDARY_AGENTS); + return -EINVAL; + } + + /* Validate that the property length is a multiple of the cell size. */ + if ( len =3D=3D 0 || len % (cells_per_entry * sizeof(uint32_t)) !=3D 0= ) + { + printk(XENLOG_ERR "scmi: Invalid length of %s property: %u for %u = cells per entry\n", + SCMI_SECONDARY_AGENTS, len, cells_per_entry); + return -EINVAL; + } + + end =3D (const __be32 *)((const u8 *)prop + len); + + for ( ; prop < end; ) + { + uint32_t agent_id; + uint32_t smc_id; + uint32_t shmem_phandle; + struct dt_device_node *node; + u64 addr, size; + int ret; + struct scmi_channel *agent_channel; + + smc_id =3D be32_to_cpu(*prop++); + shmem_phandle =3D be32_to_cpu(*prop++); + + if ( cells_per_entry =3D=3D 3 ) + agent_id =3D be32_to_cpu(*prop++); + else + agent_id =3D SCMI_BASE_AGENT_ID_OWN; + + node =3D dt_find_node_by_phandle(shmem_phandle); + if ( !node ) + { + printk(XENLOG_ERR "scmi: Could not find shmem node for agent %= u\n", + agent_id); + return -EINVAL; + } + + ret =3D dt_device_get_address(node, 0, &addr, &size); + if ( ret ) + { + printk(XENLOG_ERR + "scmi: Could not read shmem address for agent %u: %d\n", + agent_id, ret); + return ret; + } + + if ( !IS_ALIGNED(size, SCMI_SHMEM_MAPPED_SIZE) ) + { + printk(XENLOG_ERR "scmi: shmem memory is not aligned\n"); + return -EINVAL; + } + + agent_channel =3D smc_create_channel(agent_id, smc_id, addr); + if ( IS_ERR(agent_channel) ) + { + printk(XENLOG_ERR "scmi: Could not create channel for agent %u= : %ld\n", + agent_id, PTR_ERR(agent_channel)); + return PTR_ERR(agent_channel); + } + + if ( cells_per_entry =3D=3D 2 ) + { + ret =3D collect_agent_id(agent_channel); + if ( ret ) + return ret; + } + + printk(XENLOG_DEBUG "scmi: Agent %u SMC %X addr %lx\n", agent_chan= nel->agent_id, + smc_id, (unsigned long)addr); + } + + return 0; +} + +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-id property under the xen,sci contai= ner + * - For dom0less: xen,sci-agent-id 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_id =3D %d paddr =3D = 0x%lx\n", + channel->agent_id, channel->domain_id, 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 + PAGE_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(struct xen_domctl_createdomain *config) +{ + 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 domain %d\= n", + d->domain_id); + return -EINVAL; + } + + hdr.id =3D SCMI_BASE_RESET_AGENT_CONFIGURATION; + hdr.type =3D 0; + hdr.protocol =3D SCMI_BASE_PROTOCOL; + + tx.flags =3D 0; + + ret =3D do_smc_xfer(channel, &hdr, &tx, sizeof(tx), NULL, 0); + 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 domain %d\n", d->domain_id); + + 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; + struct arm_smccc_res resp; + bool res =3D false; + + if ( !sci_domain_is_enabled(d) ) + 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_1_1_smc(fid, + get_user_reg(regs, 1), + get_user_reg(regs, 2), + get_user_reg(regs, 3), + get_user_reg(regs, 4), + get_user_reg(regs, 5), + get_user_reg(regs, 6), + get_user_reg(regs, 7), + &resp); + + set_user_reg(regs, 0, resp.a0); + set_user_reg(regs, 1, resp.a1); + set_user_reg(regs, 2, resp.a2); + set_user_reg(regs, 3, resp.a3); + res =3D true; +unlock: + spin_unlock(&agent_channel->lock); + + return res; +} + +static 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, +}; + +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, + u64 *addr) +{ + int ret; + u64 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; + } + + ret =3D scmi_dt_read_hyp_channel_addr(scmi_node, addr, &size); + if ( IS_ERR_VALUE(ret) ) + return -ENOENT; + + if ( !IS_ALIGNED(size, SCMI_SHMEM_MAPPED_SIZE) ) + { + printk(XENLOG_ERR "scmi: shmem memory is not aligned\n"); + return -EINVAL; + } + + return 0; +} + +static __init int scmi_probe(struct dt_device_node *scmi_node, const void = *data) +{ + u64 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 contai= ner + * (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; + + INIT_LIST_HEAD(&scmi_data.channel_list); + spin_lock_init(&scmi_data.channel_list_lock); + + 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; + + scmi_data.dt_dev =3D scmi_node; + + channel =3D smc_create_channel(SCMI_BASE_AGENT_ID_OWN, scmi_data.func_= id, addr); + if ( IS_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 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); + return ret; + } + + 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/include/public/arch-arm.h b/xen/include/public/arch-arm.h index d30a288592..8f0f68544e 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 struct xen_arch_domainconfig { /* IN/OUT */ @@ -355,6 +356,8 @@ struct xen_arch_domainconfig { uint32_t clock_frequency; /* IN */ uint8_t arm_sci_type; + /* IN */ + uint8_t arm_sci_agent_id; }; #endif /* __XEN__ || __XEN_TOOLS__ */ =20 --=20 2.34.1 From nobody Mon Jan 26 07:40:45 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; 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=1769021080; cv=pass; d=zohomail.com; s=zohoarc; b=GBtzOxOE/ERX/ziB5e1qYYGhARMNqC/IDj+DJW+gGYpbFptpS5FKkw3vL/CtPZ5m3U8INbepxVA6GdoimYgmPnzJPRVX1allpjG8jWy4+RMwPuVElzDiY85+Hp5un2/rpiNG0305fQS0z4LKI6sDgvIYh052lWvvzhtbmcevSJc= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769021080; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=0x5Toi5O1tcXhnydAj6PUK5eC3l3b3k896d9Upmr358=; b=Id+18pzc5ncqsO+j9dgn0FW58rl/JDC+964byE+89JgNlCy79INo3cOojg78FeWR+wXIsnuzC7khwfCpcKvd3YXQpkm+L4cbShb/T8vVnQ/wM9aOQCvOJRp5Mzj0oeQzwbSxUAUjkzqtB0/46+n3yuDTHiIydrdCZAX4T3GdH+4= 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 1769021080053574.0727300417914; Wed, 21 Jan 2026 10:44:40 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1210166.1521998 (Exim 4.92) (envelope-from ) id 1vidBf-0000L4-95; Wed, 21 Jan 2026 18:44:15 +0000 Received: by outflank-mailman (output) from mailman id 1210166.1521998; Wed, 21 Jan 2026 18:44:15 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vidBf-0000Kw-5d; Wed, 21 Jan 2026 18:44:15 +0000 Received: by outflank-mailman (input) for mailman id 1210166; Wed, 21 Jan 2026 18:44:13 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vidBd-00083G-Mf for xen-devel@lists.xenproject.org; Wed, 21 Jan 2026 18:44:13 +0000 Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazlp170110003.outbound.protection.outlook.com [2a01:111:f403:c200::3]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 2d3c95db-f6f9-11f0-9ccf-f158ae23cfc8; Wed, 21 Jan 2026 19:44:11 +0100 (CET) Received: from PAVPR03MB8946.eurprd03.prod.outlook.com (2603:10a6:102:32e::21) by PAVPR03MB8945.eurprd03.prod.outlook.com (2603:10a6:102:322::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9542.9; Wed, 21 Jan 2026 18:43:58 +0000 Received: from PAVPR03MB8946.eurprd03.prod.outlook.com ([fe80::f12d:7394:bbe3:dfc]) by PAVPR03MB8946.eurprd03.prod.outlook.com ([fe80::f12d:7394:bbe3:dfc%5]) with mapi id 15.20.9542.008; Wed, 21 Jan 2026 18:43:58 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 2d3c95db-f6f9-11f0-9ccf-f158ae23cfc8 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=YG80mM+Mdv8mUw4nz956SA4aFCOSzKSa7DPYjCECZYlMjsnmANghzEtDllhVTF6XVCVta5BTAKB8gFffKlLLGkwQb4Wsb9EAMg746TA18YurxC/MsWl8cAbG507bbDOT54qqgvKvZmrJIw0BmRunWzXBuhMTW1GNzUFUaPbY0P1M0ktgPPw2q6h6jgQvDvX/y0xBkbOKw0JoMQySzB4UMoIYWhf2kUEM6ligZ3lktwjrXElKzTXonM4afaZHEpby5Vp2BxPynOpoAjO8TcbwAlPlzn7m5sXs5Grvz0xluXVMfDmiHqg8uhBRvwrxw7uNXylOxEuyxXAKmah3mqJb7w== 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=0x5Toi5O1tcXhnydAj6PUK5eC3l3b3k896d9Upmr358=; b=YSdpvPtupjM/SpMeZSn1BR57Z+fQQ8x/rLsByeeZ8VmkiZrhsLF7Wi38zt+TGfvI69uzjWWu2sb2/DxuHB1Vu+4MbAmsEZsEYS+O9Ivwcg/FzZj8LDDDmp3obkxPRXOkgxDGQb4G6SLqY7b7Lcjol5ptYviiZumFy9/k/cbXCeubtukTxXeyl2fED3TzAubde3+Mb28448uNL/Pg6WBCJWtoX0uk0fEOW97m1P3avP+goonWmwcdrizA25+bWwkxe7UH+kttCYbDF2/uGVlAB9ht+ZNypz9M2KNGAIQcG7kG51Qw94k0W5bz2tXKq2Pn4IMn8mQiHmDU8MnVcgn+hw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=epam.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0x5Toi5O1tcXhnydAj6PUK5eC3l3b3k896d9Upmr358=; b=vJhTxr7mEClSahZ6DSHX1Z+IFs85cvyrOo7qgC8jpDgv91L7gowbt2qL7C9diJSL6FpC6z58kJ8XypFESE9U+hyx3zwQMamzSEvrF2vQFMzVmRrNg9TY5elaSp1ABaAVd32u18W1n2DYTookFcJWLLVo//FWNRj048kuB6uOnqHZS5MZf85kxHYz+zltGNwQYIs8CCJbTDVVg5BAeqt8yHCAotWQ31FFYu6SiN3oRyhm59h7nFl+5vYSsU6W7tQXyaCEKb9Pje0HMCFbqE1i2j+lK0JpdF1Z8+41tory2idpHisr4URHytuAjfOei8CyIU5P4Rc2mYcMO8wyYSdJSA== 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 v8 5/5] docs: arm: add SCI SCMI SMC multi-agent driver docs Thread-Topic: [PATCH v8 5/5] docs: arm: add SCI SCMI SMC multi-agent driver docs Thread-Index: AQHciwXlP9Ogh5hL/k+s7e3EDf9c/Q== Date: Wed, 21 Jan 2026 18:43:56 +0000 Message-ID: <18730683fa731383231fbce51dc188a978304ff0.1769020872.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: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PAVPR03MB8946:EE_|PAVPR03MB8945:EE_ x-ms-office365-filtering-correlation-id: 4548fb3a-79ae-473e-d4d0-08de591d09bf x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|366016|376014|7416014|1800799024|38070700021; x-microsoft-antispam-message-info: =?iso-8859-1?Q?y3g/nDJZoD9IdknXshYQ0+/FFw5YmKJXj5uqeqizpYdQpHnGCoa6uP+3nR?= =?iso-8859-1?Q?aVQd+ZUWrkNk8hzZdOg5O3vhsPUC5K/oNbiV4rHlPGS/J4PgAQbma7kqxg?= =?iso-8859-1?Q?Cl7X7+TuVbA7ojWZq+n8mpPbqCRnvwlBKCzg59AOlYMqtYm5+eUh7gJMr2?= =?iso-8859-1?Q?86SdpqSEaYXpTlqYPqP7mZBPx+IJUe5js0MyX0zsCJeFQ65i4ExQuuNpC9?= =?iso-8859-1?Q?vOb5nilw1k7b3HjooMopQQpfyvJ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?= =?iso-8859-1?Q?OliJfDL2yXz6Qdmjcw758DK+VW1Hm06LY9DfVhRyeKQpXC1zrEKZmHSYO5?= =?iso-8859-1?Q?uxN69yKCH5MNexHmXKqbsp9Zh5H/BvIPnfmwgfzkCPOR1AMSpuhhFC9YfR?= =?iso-8859-1?Q?RlIpbkRrW8a58XttxPpG1L5GrlQ+GmiQTCRpuzb2wYhMv8QLiJ9Q9ha+WT?= =?iso-8859-1?Q?+cslwFPJckBzCB13QjWD6NjIbz3efowquVunjW1JyCL+Iuo64wbUGNh8oM?= =?iso-8859-1?Q?xnqUOHdg86jxDl+Pjxgu2hCVDXnNTVJcnC2hZ56lVMyd4HgKJG1WCZ9PxC?= =?iso-8859-1?Q?ayCLTzkBTHfbCEgbR2lmLuGUGKMYe7AftFzd0tzr1WgNlQjrKfiYdfnr+p?= =?iso-8859-1?Q?DdSCwCp9Gya94Z6d7AQ3loctT5PGW1rqnqFpbiE57Pi8vTobClFmOXN5Nw?= =?iso-8859-1?Q?qWfpqUSgoQLF8BK+N/lXuJdPERSn+Ag/d65OjucGLM5ylYKV9Rn+AReTAX?= =?iso-8859-1?Q?MtaklvRogQCn4kr1nlN6h0zIhQYNlaelQ23hiospxepY6berVNpPkTbyDn?= =?iso-8859-1?Q?jdKv1huBRVUsQw1LZpA=3D?= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAVPR03MB8946.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(7416014)(1800799024)(38070700021);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?OESh/f+GGfO/9CzjGkHGoN1x71px/T2qqpFn2ZPPZaO3NxkdgC5cptI5+B?= =?iso-8859-1?Q?fYa9wwb4K9ZrzPkcvha9srTTkmpT4aU17Dh9stjrt+vKbXC/MmE8VkDSr6?= =?iso-8859-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KmJU72r/RPd6K2jvCQ?= =?iso-8859-1?Q?dPIS1XZ+ixu7JKB4g+ezMjTCqnMc/Gu2FwpvGtyvShPxK412uubcls9XaH?= =?iso-8859-1?Q?k3xGpKZLKCFlND5NxPpaqQy2Auvjr1U/nF3bz2IJ47C/x7q/um1n8D8UDf?= =?iso-8859-1?Q?fJotfGH19MMCzszbNT9+vEdcsBhEPJwkO7FD397M2H4xvtGWuV4v7c0UQi?= =?iso-8859-1?Q?1A0PlTzyXjz2JnwWG021YkkANC8tT9h0vcOib/MkF9DdCboevZEM425O7J?= =?iso-8859-1?Q?WNjJ394hkLSiHm5aOrSAk0GsrWGKPi8SCL4b8zQjDMuRyd3l7loW83blca?= =?iso-8859-1?Q?TcodZsQvS8QXqPz5NjxhaZ5oipYjOsVeAMGxiJHaB9MJiKpbJKxPXm+Fru?= =?iso-8859-1?Q?BwLJOpSj5a5oASW5/ZSbEo6bmhn+wlurLrSDW+7PEbrRRPm2vV7Mc82JYg?= =?iso-8859-1?Q?+IVLepcgSM4HAfpz50WZHXyUPfW6hPSEcqgdfoWJp4GEA+rLbc45pWF3cU?= =?iso-8859-1?Q?XXthsonyY4iS6irPhceHXavyq/9pm5yEMYiBMBXtngYUBsaN+WQCiAD29P?= =?iso-8859-1?Q?PC41y4NXrZUOGzMJ4B5ofPlpMISXVs231QQdJHyA0VJDx6m0E8vIV6S9QT?= =?iso-8859-1?Q?A1bI4Dy7ExKLllPXJum+T7xcmQmmj3K1kpzqdvyXWbTcz8nQvD9P7M+cdE?= =?iso-8859-1?Q?OIDtt4ySgU0aD1PrRNsfb21bJzC+SlWvD1WqEm+nNjOSWEbtlgvjwMFvMV?= =?iso-8859-1?Q?KRpI5/PIGKmAWdRZ5oBjKXOcGLvqQtF6vwZ419N06vo5Jjd8KNFXTdc7pw?= =?iso-8859-1?Q?Yr/hi2YAyktw0jKZEqlgSXK+dQqLlaQ=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: PAVPR03MB8946.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4548fb3a-79ae-473e-d4d0-08de591d09bf X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Jan 2026 18:43:56.3160 (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: 1YOPCModIIRfBGlT+9b09ucyVgXLK027+G3zvae6o94Ty0TFC3Mey+sNYeqef9q/xYE8aJE+1wRb1dGPt25TE6HNkogOcc4IvsPayzvAs0w= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAVPR03MB8945 X-ZohoMail-DKIM: pass (identity @epam.com) X-ZM-MESSAGEID: 1769021081680158500 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 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 | 420 ++++++++++++++++++ 1 file changed, 420 insertions(+) diff --git a/docs/hypervisor-guide/arm/firmware/arm-scmi.rst b/docs/hypervi= sor-guide/arm/firmware/arm-scmi.rst index d9698f4e4b..2497a870f3 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,421 @@ 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 enables support for ARM EL3 Trusted Firmwa= re-A (TF-A) which +provides SCMI interface with multi-agent support, as shown below. + +:: + + +-----------------------------------------+ + | | + | EL3 TF-A SCMI | + +-------+--+-------+--+-------+--+-------++ + |shmem1 | |shmem0 | |shmem2 | |shmemX | + +-----+-+ +---+---+ +--+----+ +---+---+ + smc-id1 | | | | + agent1 | | | | + +-----v--------+---------+-----------+----+ + | | | | | + | | | | | + +--------------+---------+-----------+----+ + smc-id0 | smc-id2| smc-idX| + agent0 | agent2 | agentX | + | | | + +----v---+ +--v-----+ +--v-----+ + | | | | | | + | Dom0 | | Dom1 | | DomX | + | | | | | | + | | | | | | + +--------+ +--------+ +--------+ + +The EL3 SCMI multi-agent firmware is expected to provide SCMI SMC shared-m= emory transport +for every Agent in the system. The SCMI Agent transport channel defined by= pair: + +- smc-id: SMC function id used for Doorbell +- shmem: shared memory for messages transfer, **Xen page aligned**. + Shared memory is mapped with the following flags: MT_DEVICE_nGnRE and _P= AGE_DEVICE, indicating that this + memory is mapped as device memory. + +The following SCMI Agents are expected to be defined by SCMI FW to enable = SCMI multi-agent functionality +under Xen: + +- Xen management agent: trusted agents that accesses to the Base Protocol = commands to configure + agent specific permissions +- OSPM VM agents: non-trusted agent, one for each Guest domain which is a= llowed direct HW access. + At least one OSPM VM agent has to be provided by FW if HW is handled onl= y by Dom0 or Driver Domain. + +The EL3 SCMI FW is expected to implement following Base protocol messages: + +- BASE_DISCOVER_AGENT (optional if agent_id was provided) +- BASE_RESET_AGENT_CONFIGURATION (optional) +- BASE_SET_DEVICE_PERMISSIONS (optional) + +The number of supported SCMI agents and their transport specifications are= SCMI FW implementation +specific. + +Compiling with multi-agent support +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +To build with the SCMI SMC multi-agent driver support, enable Kconfig opti= on: + +:: + + CONFIG_SCMI_SMC_MA + + +Driver functionality +^^^^^^^^^^^^^^^^^^^^ + +The SCI SCMI SMC multi-agent driver implements following functionality: + +- The driver is initialized from the Xen SCMI container ``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 + the Xen SCMI container ``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" container; any other "arm,scmi-smc" nodes (for example un= der + "/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 smc-id + #address-cells =3D < 1>; + #size-cells =3D < 0>; + #access-controller-cells =3D < 1>; + shmem =3D <&scmi_shm_1>; <--- Xen management agent shmem + }; + +.. 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 obtains Xen specific SCMI Agent's configuration from the Host= DT, probes Agents and + builds SCMI Agents list. The Agents configuration is taken from "scmi-se= condary-agents" + property where first item is "arm,smc-id", second - "arm,scmi-shmem" pha= ndle and third is + optional "agent_id": + +.. code-block:: dts + + chosen { + ranges; <--- set default ranges so address can be translated when pa= rsing scmi_shm node + xen { + ranges; + xen_scmi_config { + compatible =3D "xen,sci"; + #address-cells =3D <2>; + #size-cells =3D <2>; + ranges; <--- set default ranges so address can be translated whe= n parsing scmi_shm node + scmi-secondary-agents =3D < + 0x82000002 &scmi_shm_0 0 + 0x82000004 &scmi_shm_2 2 + 0x82000005 &scmi_shm_3 3 + 0x82000006 &scmi_shm_4 4>; + #scmi-secondary-agents-cells =3D <3>; <--- optional, default 3 + xen,dom0-sci-agent-id =3D <0>; /* Dom0 agent ID */ + + scmi_shm_0 : sram@47ff0000 { + compatible =3D "arm,scmi-shmem"; + reg =3D <0x0 0x47ff0000 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_shm_4: sram@47ff4000 { + compatible =3D "arm,scmi-shmem"; + reg =3D <0x0 0x47ff4000 0x0 0x1000>; + }; + + // Xen SCMI management channel + 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 smc-id + #address-cells =3D < 1>; + #size-cells =3D < 0>; + #access-controller-cells =3D < 1>; + shmem =3D <&scmi_shm_1>; <--- Xen management agent shmem + }; + }; + }; + }; + + /{ + // Host SCMI OSPM channel - provided to the Dom0 as is if SCMI ena= bled for it + scmi_shm: 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>; <--- Host OSPM agent shmem + + protocol@X{ + }; + }; + }; + }; + + This approach allows defining multiple SCMI Agents by adding Xen-specifi= c properties under + the ``/chosen`` node to the Host Device Tree, leaving the main part unch= anged. The Host DT + SCMI channel will be passed to Dom0. + + The Xen management agent is described as a ``scmi_xen`` node under the `= `xen,sci`` compatible node, + which is used by Xen to control other SCMI Agents in the system. + + All secondary agents' configurations are provided in the ``scmi-secondar= y-agents`` property with + an optional ``agent_id`` field. + + The ``agent_id`` from the ``scmi-secondary-agents`` property is used to = identify the agent in the + system and can be omitted by setting ``#scmi-secondary-agents-cells =3D = <2>``, so the Secondary + Agents configuration will look like this: + +.. code-block:: dts + + chosen { + xen { + xen_scmi_config { + compatible =3D "xen,sci"; + scmi-secondary-agents =3D < + 0x82000002 &scmi_shm_0 + 0x82000004 &scmi_shm_2 + 0x82000005 &scmi_shm_3 + 0x82000006 &scmi_shm_4>; + #scmi-secondary-agents-cells =3D <2>; + }; + }; + } + + In this case, Xen will use the ``SCMI_BASE_DISCOVER_AGENT`` call to disc= over the ``agent_id`` + for each secondary agent. Providing the ``agent_id`` in the ``scmi-secon= dary-agents`` property + allows skipping the discovery call, which is useful when the secondary a= gent's shared memory is + not accessible by Xen or when boot time is important because it allows s= kipping the agent + discovery procedure. + +.. note:: + + Note that Xen is the only one entry in the system which need to know a= bout SCMI multi-agent support. + +- The driver implements the SCI subsystem interface required for configuri= ng and enabling SCMI + functionality for Dom0/hwdom and Guest domains. To enable SCMI functiona= lity for guest domain + it has to be configured with unique supported SCMI Agent_id and use corr= esponding SCMI SMC + shared-memory transport ``[smc-id, shmem]`` defined for this SCMI Agent_= id. + +- Once Xen domain is configured it can communicate with EL3 SCMI FW: + + - zero-copy, the guest domain puts/gets SCMI message in/from shmem; + - the guest triggers SMC exception with agent "smc-id" (doorbell); + - the Xen driver catches exception, do checks and synchronously forwards= it to EL3 FW. + +- the Xen driver sends BASE_RESET_AGENT_CONFIGURATION message to Xen manag= ement agent channel on + domain destroy event. This allows to reset resources used by domain and = so implement use-case + like domain reboot. + + +Configure SCMI for Dom0 +^^^^^^^^^^^^^^^^^^^^^^^ +Set the Dom0 SCMI agent ID in the device tree using the Xen SCMI container= under ``/chosen``. +Add ``xen,dom0-sci-agent-id`` to the ``xen,sci`` node. If the property is = absent, SCMI stays +disabled for Dom0 and the SCMI nodes are removed from Dom0 DT. + +.. code-block:: dts + + chosen { + xen { + ranges; + xen_scmi_config { + compatible =3D "xen,sci"; + xen,dom0-sci-agent-id =3D <0>; /* Dom0 agent ID */ + /* scmi-secondary-agents and scmi_xen as shown above */ + }; + }; + }; + +Xen utilizes the Host DT ``/firmware/scmi`` node to configure the Dom0 SCM= I agent, leaving the +rest of the Host DT unchanged except for the Xen-specific properties under= ``/chosen``. If the +``/firmware/scmi`` node is missing or disabled, the Dom0 SCMI agent will n= ot be configured. + +.. note:: + + The ``xen,dom0-sci-agent-id`` value must match the ``func_id`` and ``shm= em`` pairing provided by + the EL3 firmware for Dom0 (for example in the ``/firmware/scmi`` node). + +Configure SCMI for for guest domain with toolstack +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +* In domain's xl.cfg file add **"arm_sci"** option as below + +:: + + arm_sci =3D "type=3Dscmi_smc_multiagent,agent_id=3D2" + +* In domain's xl.cfg file enable access to the "arm,scmi-shmem" which shou= ld correspond + assigned "agent_id" for the domain, for example: + +:: + + iomem =3D [ + "47ff2,1@22001", + ] + +.. note:: It's up to the user to select guest IPA for mapping SCMI shared-= memory. + +* Add SCMI nodes to the Driver domain partial device tree as in the below = example. + The "arm,smc-id" should correspond assigned agent_id for the domain: + +.. code:: + + passthrough { + scmi_shm_0: sram@22001000 { + compatible =3D "arm,scmi-shmem"; + reg =3D <0x0 0x22001000 0x0 0x1000>; + }; + + firmware { + compatible =3D "simple-bus"; + scmi: scmi { + compatible =3D "arm,scmi-smc"; + arm,smc-id =3D <0x82000004>; <--- smc-id for agent_id= =3D2 + shmem =3D <&scmi_shm_0>; + ... + } + } + } + +**Device specific access control** + +The XEN SCMI SMC multi-agent driver performs "access-controller" provider = function in case +EL3 SCMI FW implements SCMI "4.2.1.1 Device specific access control" and p= rovides the +BASE_SET_DEVICE_PERMISSIONS command to configure the devices that an agent= s have access to. +The Host DT SCMI node should have "#access-controller-cells=3D<1>" propert= y and DT devices should +be bound to the SCMI node using Access Controllers bindings [3]. + +For example: + +.. code-block:: dts + + &i2c1 { + access-controllers =3D <&scmi 0>; + }; + +Use domain's xl.cfg file **"dtdev"** property to assign SCMI devices from = toolstack to the guest: + +:: + + dtdev =3D [ + "/soc/i2c@e6508000", + ] + +.. note:: + + xl.cfg:"dtdev" need contain all nodes which are under SCMI management = (not only those which are + behind IOMMU) and passed-through to the guest domain. + +Configure SCMI for predefined domains (dom0less) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +* add "xen,sci_type" and "xen,sci-agent-id" properties for required DomU (= "xen,domain") node + +:: + + xen,sci_type=3D"scmi_smc_multiagent" + xen,sci-agent-id=3D2 + +* add scmi nodes to the Driver domain partial device tree the same way as = above (toolstack case) and + enable access to the "arm,scmi-shmem" according to the dom0less document= ation. For example: + +.. code-block:: dts + + scmi_shm_0: sram@22001000 { + compatible =3D "arm,scmi-shmem"; + reg =3D <0x00 0x22001000 0x00 0x1000>; + -> xen,reg =3D <0x0 0x47ff0000 0x0 0x1000 0x0 0x22001000>; + -> xen,force-assign-without-iommu; + }; + +* For SCMI device access control configure pass-through devices in the gue= st partial DT according to + the dom0less documentation and ensure that devices SCMI management has "= xen,path" property set: + +Example (dom0less, multi-agent): + +.. code-block:: dts + + chosen { + xen { + ranges; + xen_scmi_config { + compatible =3D "xen,sci"; + #address-cells =3D <2>; + #size-cells =3D <2>; + ranges; + + /* Xen management channel shared memory */ + scmi_shm_1: sram@47ff1000 { + compatible =3D "arm,scmi-shmem"; + reg =3D <0x0 0x47ff1000 0x0 0x1000>; + }; + + scmi_shm_domu: sram@47ff2000 { + compatible =3D "arm,scmi-shmem"; + reg =3D <0x0 0x47ff2000 0x0 0x1000>; + }; + + scmi-secondary-agents =3D < + 0x82000004 &scmi_shm_domu 2>; + #scmi-secondary-agents-cells =3D <3>; + + scmi_xen: scmi { + compatible =3D "arm,scmi-smc"; + arm,smc-id =3D <0x82000003>; + #address-cells =3D <1>; + #size-cells =3D <0>; + #access-controller-cells =3D <1>; + shmem =3D <&scmi_shm_1>; + }; + }; + }; + + xen,domain@1 { + compatible =3D "xen,domain"; + xen,sci_type =3D "scmi_smc_multiagent"; + xen,sci-agent-id =3D <2>; + /* 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.34.1