From patchwork Thu Dec 19 11:23:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Cherechesu X-Patchwork-Id: 13914969 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 571D0E77184 for ; Thu, 19 Dec 2024 11:23:51 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.861110.1273109 (Exim 4.92) (envelope-from ) id 1tOEd3-0008GY-Ps; Thu, 19 Dec 2024 11:23:41 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 861110.1273109; Thu, 19 Dec 2024 11:23:41 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tOEd3-0008G3-JI; Thu, 19 Dec 2024 11:23:41 +0000 Received: by outflank-mailman (input) for mailman id 861110; Thu, 19 Dec 2024 11:23:40 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tOEd2-00089J-QL for xen-devel@lists.xenproject.org; Thu, 19 Dec 2024 11:23:40 +0000 Received: from PA4PR04CU001.outbound.protection.outlook.com (mail-francecentralazlp170130007.outbound.protection.outlook.com [2a01:111:f403:c20a::7]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id b2423776-bdfb-11ef-a0d7-8be0dac302b0; Thu, 19 Dec 2024 12:23:39 +0100 (CET) Received: from PA4SPRMB0023.eurprd04.prod.outlook.com (2603:10a6:102:268::8) by PAWPR04MB9936.eurprd04.prod.outlook.com (2603:10a6:102:38b::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8272.15; Thu, 19 Dec 2024 11:23:37 +0000 Received: from PA4SPRMB0023.eurprd04.prod.outlook.com ([fe80::fd16:4665:bad7:33ce]) by PA4SPRMB0023.eurprd04.prod.outlook.com ([fe80::fd16:4665:bad7:33ce%4]) with mapi id 15.20.8251.015; Thu, 19 Dec 2024 11:23:37 +0000 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: b2423776-bdfb-11ef-a0d7-8be0dac302b0 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=bXq0wmAxhELERVWndeEwt+Nj/om35zrQ+84GeuEKc5n9mcXm37B4Ojz5bsl71e8ph201BrHh5Kiaj9UTv2B/xMy7hquK7OfcL7cGjMtKe7xGWZRGreSfV48vbR+ltw6VgRzZ0pyGwK6qwvgKl0b7hIdpk/Neh01vW5A63XztwX0UY21q2fULiTKeDLzGTTaNpSNuINJIqey/Q+HOvldRN6yl+HKgCUgzqgH+hVw5bIakuri4NNF3bBOzvYypRfnohBHiEKsSkRt2XsZUxfGoIo/SbH1izIgo4lldx02qLas/Ps4nFKjvNS+o0hESXM8Rktc4zphGXAO+6Ili1he8aQ== 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=vl6a2ZFCdB7uSAUka3CQGXl5zPhfOlTYRKt+89VAhOE=; b=UnlXPIGAiagkfEFV9OSUSG9JR7i+b0mHEpuNpjAoai2UhoD8aFasckl/P2dpzQW2SmkwURYZwC/EcY/QmxxTsdGqZC1mF1pxiyVd+YrnLFFyB+epozl/DSlR2brI+o0ZQTWt2Nddefu57cMjgw9IopHvPnFm0yOykjXGzgiLIvTqV0CvWLRercDAPPnwl4mM0oCT5n1q2odMP7ual4i6XywKdjC5LTJOodKDwlfKB2nHke36vH2QimnijeTUJHBaisJRb/KhUgOoSouLMQllYIBHC3JUQr065n68kPqusvxczzd1r6o56s052PokfnHjA2Fg9rQ+xyutzqBp9biiMg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector1-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vl6a2ZFCdB7uSAUka3CQGXl5zPhfOlTYRKt+89VAhOE=; b=IrSZ20TEnqTZxX74TgBNTXBsIxapUBMi0VQVjgmxivTmCuOWZA8Td+f2//ceBxVDMLKxFLDUsaENJ/bA5i83F+a3GVGbNcOeSuYLTjAucm6fLRjvgE5A6Bf6WVDbppL7Fvo+1FFbY9CNqZTbKNgiO794ALK6ezqprpLpVtQ0L3qH0UFTWbuRfAnForxcTs+btPVBoPw2qdL43ApmDiRidUX63gnQX6ov7nJLQXwafIlS4dDT4k+IVD+FJ/cfFhGdHXh+sYFL/OhAcjag+mVSItHlQiU8QT4i7ygK4TbUdjta796WGRYWXKSdbdPGh/ju6qyIuQ1gGIJTUcbIr3hk3A== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; From: "Andrei Cherechesu (OSS)" To: xen-devel@lists.xenproject.org Cc: S32@nxp.com, andrei.cherechesu@oss.nxp.com, Andrei Cherechesu , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , Julien Grall Subject: [PATCH v4 2/6] xen/arm: vsmc: Enable handling SiP-owned SCMI SMC calls Date: Thu, 19 Dec 2024 13:23:11 +0200 Message-ID: <20241219112315.2461048-3-andrei.cherechesu@oss.nxp.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241219112315.2461048-1-andrei.cherechesu@oss.nxp.com> References: <20241219112315.2461048-1-andrei.cherechesu@oss.nxp.com> X-ClientProxiedBy: AM0PR04CA0039.eurprd04.prod.outlook.com (2603:10a6:208:1::16) To PA4SPRMB0023.eurprd04.prod.outlook.com (2603:10a6:102:268::8) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PA4SPRMB0023:EE_|PAWPR04MB9936:EE_ X-MS-Office365-Filtering-Correlation-Id: 09499d96-fb3d-45bb-fe50-08dd201f93a7 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: 9owx1PcL99jevXt75Sfru1/e5yXeizbiVeYLeIAVIEn4HGVSSY136cYlG2CF43m5GXoU8xWlyLUknVchvC/kLJppChLeUqZ7y+d9lUZcKC3Npxn8oCjyXftNzopNV///7cPJXlOZGy0SlaRRdLNZTf6IqF1d/wIGmhSEBsj3v5/97ce4Rn16bEY/7EA4plwifJxvfHxmbEBEHsamxJ97ofWYMaPUAMLfRnZ3Wp3E+KxbgbEWP0WEL0a6/YGB4dBZ193iPYhEgjXEbIBN8cCziZ4rBfNdss7nRXQQKvTlFPyJZPDx7uvz7fXe0FbYctVa/a75lF8iyIIov+P1fZK42M0kHE0XRrtLPxt9IR3cyFDgkcn7RTBVnfQebVAz24wM7ngOvrWQdPc9stDTsKaxqrzmN7SdS/I82R3fYU/LqsMqHhKQcaJPw3hbx+HJAImDtAgtXPtLFcfFk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A4SPRMB0023.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(376014)(1800799024)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Agv5RufhN3Wy3eEeOzXVIycdXX3R6+Y1c6G1TwzTPzl9sfvYnBCCAWEFRk4J5+OFS9uDe3/hA7XJwZGD6RaFHtVpG44wLti7HVzatGzRoV6bg7WrhySO3OMVIVYQPNPH1HbGnvfWNx0P/+NLIGfEIRkB06vqDhE2DHeovoW4LH4+l3BT53Kj7qRCp3B3jdCXG/spLCuyWsOrqvHTeoaxBVJPPIO3hlLGdR6+KB//2zTIBrCMFkYht8eQEdN6xvGoayJlVnRNb8BK76b5Mw3g4e0NH7kts/ksf77FzA4DFBoBnlxzRk1VMn84FXiX3Wi1QBCgYETxYnikrZxdouOVvIRAYtYR107QKJeJ5tRRMBZLqwLW7Zkjxej5QvXWaTl1S8w9Hgan5OcwTPuSlbiTt0WFNJNEaoD3P131ENIftydgkAQxKmYPN4uxVrPDWHnJZkav/IqNE9V9mOMhArNXmsLJ/hTLOweK1K8QfpINBBSdvp4kVI0MYaVPT5kAuXRJcDRleP4i5hTDFls+xdXVgjC8mpgc5iTe3T81eG2XeCHSwvp6vkye/hEDl9xiYn52adK/uHiea3CR5TIxHMh84l2+pNbzVdj27HrZ/2U1BIZdloJkjsK05zLxmQOUXHnhfK5hpypWQQDcN2wlDNvdCPQoVdyAICro8BouZ/Q1vux4fSZ7ZASBsV2o+/jOGCoRWe61wUcLo8TuBTX/GC0N1yb6uQlEXpnnLYuxI9MSZCTUsf1Eryjj1DpfESlgfDh/7kd2DJc6NIOURlRj+IIr1yzrOZLYSNLV2LSl5WfHjrCmZvHwrWtI1994txU6EALKuEtwEQ5gIIbVQcYy/9+lKD3lyajPxdupi+76626J73RBoYjSF3ZqsxEQ1k5fmYlD2MlzHtkGKAppQTebdf1AD9idSLBnpA5raDfKAI/900j5CIvbD1Gp3l2mdyuTZUnFQqnR6tujcStGtC5IvU8OX4ys9DVLBSU5p6M9Jw/Fe/gszFWrYA2oOyRjHu1KgF0ANoPV45XUxHhp9sXAZLt3K9YP0XagtzbXHySDfFH/BN0vvFFXEf0aKQQJxnOqpGg8hVYqwoGx4/zVBX7QoYlUG8vdt+xQD92bvCwJbSRTcQUWj1lbXoqWmCszZKH41b8SWj3iwmcez0XMqbufmYaWS3RFKTgRNYvWne13ntIub8/M3Tc40OuKWmj+eGHihLjHZY3bWPbH4iDExHyfACh6HUDu6d7B3KnrY0d/jj654rIiQBCEzyYZAsWnb57pgLhrC1IPfmfvPAIU+LRAjRrEkJeG6CEVZ+gPKiauAl7RPTMvrDgex0FLifOpKD6K9dn1BcWS/V3VhbU7Wb+WdBHlrHukbKDtZcBj/HNszRAPJwi4vG67TDif42hhkgA+IsUIlRzVlbm4WpS6UNZ7mXcdzS+z9YUanjsK8se7lPz6IIIr40TMgBIDAcPsUy55PosFh1A1Vty10RFW7nQMc7tcswLOYEDIN7IWbwopL5H3Vgqils3c0nEWpU0D0f6qd8/p/P3EYh+dNrqNUxF3cHqxaeRp0zqGoPgX+eefaMpEO4xhkhSj7kK+egmBxKI6TuDH0ukyifbyBB/cpeRFI0qNew== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 09499d96-fb3d-45bb-fe50-08dd201f93a7 X-MS-Exchange-CrossTenant-AuthSource: PA4SPRMB0023.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2024 11:23:35.1356 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: yINuT/MC29Taswd4lu0pbGfsr53IdC5QOesUADz92PIj39aQaffeXz11m1S/5spg3rKLEkmABPL7iD43DDzLeIoNmtUcNuMK1AVpDuI52is= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR04MB9936 From: Andrei Cherechesu Change the handling of SiP SMC calls to be more generic, instead of directly relying on the `platform_smc()` callback implementation. Try to handle the SiP SMC first through the `platform_smc()` callback (if implemented). Otherwise, try to handle it as SCMI message. Signed-off-by: Andrei Cherechesu Reviewed-by: Stefano Stabellini Acked-by: Julien Grall --- xen/arch/arm/vsmc.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/vsmc.c b/xen/arch/arm/vsmc.c index f679cced7f..62d8117a12 100644 --- a/xen/arch/arm/vsmc.c +++ b/xen/arch/arm/vsmc.c @@ -20,6 +20,7 @@ #include #include #include +#include /* Number of functions currently supported by Hypervisor Service. */ #define XEN_SMCCC_FUNCTION_COUNT 3 @@ -224,6 +225,16 @@ static bool handle_sssc(struct cpu_user_regs *regs) } } +/* Secure Calls defined by the Silicon Provider (SiP) */ +static bool handle_sip(struct cpu_user_regs *regs) +{ + /* Firstly, let each platform define custom handling for these SMCs */ + if ( platform_smc(regs) ) + return true; + + return scmi_handle_smc(regs); +} + /* * vsmccc_handle_call() - handle SMC/HVC call according to ARM SMCCC. * returns true if that was valid SMCCC call (even if function number @@ -288,7 +299,7 @@ static bool vsmccc_handle_call(struct cpu_user_regs *regs) handled = handle_sssc(regs); break; case ARM_SMCCC_OWNER_SIP: - handled = platform_smc(regs); + handled = handle_sip(regs); break; case ARM_SMCCC_OWNER_TRUSTED_APP ... ARM_SMCCC_OWNER_TRUSTED_APP_END: case ARM_SMCCC_OWNER_TRUSTED_OS ... ARM_SMCCC_OWNER_TRUSTED_OS_END: