From patchwork Mon Mar 13 13:08:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Cherechesu X-Patchwork-Id: 13172490 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 74F99C7618B for ; Mon, 13 Mar 2023 13:08:48 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.509254.784696 (Exim 4.92) (envelope-from ) id 1pbhui-00085s-Bn; Mon, 13 Mar 2023 13:08:32 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 509254.784696; Mon, 13 Mar 2023 13:08:32 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pbhui-00085l-8t; Mon, 13 Mar 2023 13:08:32 +0000 Received: by outflank-mailman (input) for mailman id 509254; Mon, 13 Mar 2023 13:08:31 +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 1pbhuh-0007qY-45 for xen-devel@lists.xenproject.org; Mon, 13 Mar 2023 13:08:31 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on0601.outbound.protection.outlook.com [2a01:111:f400:fe0d::601]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 2684480d-c1a0-11ed-87f5-c1b5be75604c; Mon, 13 Mar 2023 14:08:30 +0100 (CET) Received: from VI1PR04MB5056.eurprd04.prod.outlook.com (2603:10a6:803:5a::13) by DU2PR04MB8520.eurprd04.prod.outlook.com (2603:10a6:10:2d3::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.24; Mon, 13 Mar 2023 13:08:28 +0000 Received: from VI1PR04MB5056.eurprd04.prod.outlook.com ([fe80::f883:bd6d:18d4:c487]) by VI1PR04MB5056.eurprd04.prod.outlook.com ([fe80::f883:bd6d:18d4:c487%4]) with mapi id 15.20.6178.024; Mon, 13 Mar 2023 13:08:28 +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: 2684480d-c1a0-11ed-87f5-c1b5be75604c ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cYBbjh9zCziNfLx7Kqv+dlOwe2Bt+LRSwO7PRtKi1o/vu0V6BsS4jta6S6/hFJp2IxC7Wli6/fVR0YY4wBOAFLhfGeLWG9zeM8U9eg2iFP9qaGtoqOuAKfab7LglehIPhn7Gl3OyiWTHoejtBXMUsnBIY0hFxpYaSa0vOiE8zAlEWA45y+bG7ODih2ukpXuCdkwUl+YSvmG0xkcVmtdOTNC6QeEG8CBAS5e9KNPmlWpsvCWk/cGamXxt28uTbHmRlW85Z2H+HOsSEEn9R2BqgtbBpmBheyPPtw6dXA8/gkIh0I+oSVyq6uZd6B3ulfoVjdsaJAGqlZKw1FMmkJMR8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=uQNYeJoSq7Q9ZqnSKcAT7DwtkzmkKIujQqNfvAuqlr0=; b=LvCs9hwahRHCh2qbt8fUOYjq4fwtGgmTH/TQcCGJfef33+h9Uv0qEFsFiCqiXiEHYSGsNClgx1Sff7xZp+2DuRAYYiBZ9H/i9QeWjYPQ8Wde8+AYuSyT/oHPkkVfNJYnsLQ058HW8CFo+w4OaiCMOlKuGZQsLTxfJaL3F1JhnoNBOXZANkQonMDJGwf/VIEntxRmOLadQbmAXhW+3OslVXQZqgjfotOJuI6O8RBhELkqzyRqodmMUbBbmUtP58efFPt+YmJPQPbu1wKFkNbtWpKdBhEtVTekA+X8sKMDZWyEqfWReps5SRjm4XLJvwMQXfT2ae58fzYk/TZBibUG9g== 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=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uQNYeJoSq7Q9ZqnSKcAT7DwtkzmkKIujQqNfvAuqlr0=; b=RHu/3XfhBS606kxDz3C7rgzQwNFecSBeM1AVKWDxDgs/ggnBV59B7hLo2VFqGkiMm67kcRRWSfMfub2vF4Waqib6e4+Fn1aX/IX6yvd2bbeFHa+pnd9YJvTvJH6ZsZuzU2bo98+56bHcNlm92ftcYvE4ti0uECG8FBQjJNkKLxA= 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: michal.orzel@amd.com, sstabellini@kernel.org, Bertrand.Marquis@arm.com, julien@xen.org, Volodymyr_Babchuk@epam.com, rahul.singh@arm.com, Andrei Cherechesu , Bertrand Marquis Subject: [PATCH v3 1/2] arch/arm: irq: Add platform_get_irq_byname() implementation Date: Mon, 13 Mar 2023 15:08:02 +0200 Message-Id: <20230313130803.3499098-2-andrei.cherechesu@oss.nxp.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230313130803.3499098-1-andrei.cherechesu@oss.nxp.com> References: <20230313130803.3499098-1-andrei.cherechesu@oss.nxp.com> X-ClientProxiedBy: AM0PR03CA0001.eurprd03.prod.outlook.com (2603:10a6:208:14::14) To VI1PR04MB5056.eurprd04.prod.outlook.com (2603:10a6:803:5a::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5056:EE_|DU2PR04MB8520:EE_ X-MS-Office365-Filtering-Correlation-Id: 9064394f-12b0-4336-5bb0-08db23c40918 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +vIMt+qbAQt3KeSXQuiqxuShSWEIZd4vIBMSEj4/G8JcKQ4mBpbKGcKe+tCbYvly5V7EhSzIFpbQL0J7iuktU99VYE2YVS5tOAd/BRjjGAKbLjPcafgYi+BdnH1iiT0rlnTazGinJKMzh829mhYnhafLOAvUDcEiCn4wMreYr2u6tEt6T7LSOOW+ywnO42uC+AFBXoqe7iVqu262ExG4ToRYFD/SEGFrkz/U2ZrZskdj1P9Cp0Ia4bSuDD5+ibp8X/AyRgP6GRIwBve22xRuC/WClaO/o48CZ+BbeV6/wFv+Ysbm4weIrzft6L737+MLBLO5UTUstpwo1i0fy2CCt3ZsYTolMkuEXNgMLvkK6M6seeyyO0mYjMCjB9mUQ5Cpoh4QjKBM7WN7hie1l2+d7B2hQHhJ5xxRBKf5yfuktyKyqdiHK+lQLLXjAviRidLL1uBkw725p1Tb+XjfU363STzJ/sz5B/+3qiZvWEp4/0HuQc01gzUQubv7hnbuDb0RR6SKij8ePKhqPoyYYdKXR7GqoT8PjpIDiHxs+2wB4CyXL1tYcrcBaQ+8GeO9YEwdEkyBSqAIvNR7IlXJh4Eti3N92NQKR6kRc4Xj9InpGNxNt+1awRCJ6gELDB+gbVNRMC9NvrTJLaHdSPgF8Xe7PBfBZlP/T6R+l9xt44wH7y1fsVWQ3Wi26mh26+KSmwlF33pQVeVmm4uQOORqK9F5Iw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5056.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(346002)(376002)(396003)(136003)(39860400002)(366004)(451199018)(2616005)(186003)(6512007)(26005)(1076003)(6506007)(83380400001)(8936002)(6666004)(38100700002)(5660300002)(6486002)(66556008)(66476007)(8676002)(4326008)(52116002)(38350700002)(6916009)(66946007)(41300700001)(2906002)(478600001)(316002)(54906003)(86362001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: gssfjbbymzR8dHKbGSQXnU1vO0NcpOQPMv8nXLbZ3/I4e2lAgtH/1Pd2gpifrAD+FHSsI+iJT+kaApOArXIePK4/vRWAYtLfl7EGhgbXwwvnC4fPhlFBllB69c3Y/CK7nIPHl5DAhN4pzJYa9y1nndm2WQ1YghC8TjffBgev8uL9WH+0NZZ+pX1bAnf+l3W/gTXk1Snr4jTSmhwUM+Q+44g1lak7eqwn/aBj4Z02MIpcrxCDyoi6cm040bpJsXZZNs5fms+OfD5PHWAeVJUSRKUIGRYrY291JXYwpX+IZWPSnvTod/6ddpF3e3zqOotHs3LYzsN5URJhBmCTy58UylWBFgieX3ny+0UPMEhIQKLzfzJdwx2kCtN0dFg2a/OOxaWajdyX/BxU1eieiZDZ584mE28hGOIiF2x44MPgi8oC2cSpoUtRyOcWku+Jt9VsgnEfOLqAIkEg30jrwUz743v2u2we+bdBhm3p3RdCKqv8NLjXmiQMxULLMs86em5h30EdUbDAZoqQ+rIkrFCQ42OEd+dLfUSruFetDWlC633hhwBq4AG+biS8N2O94cXC65qfo8JfVq7SN435Lbnm7FpB2214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12b0-4336-5bb0-08db23c40918 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5056.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Mar 2023 13:08:27.8710 (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: BhIq6XikF4xyjnHVwZDKialzGi94INt+y4Nr8nAYFTNVdGDvnkha918Rym7OOhUdYkTNjhnIHZB+jF6xm5ZvX+/WlugPnGa8+BgmBl/x0vo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8520 From: Andrei Cherechesu Moved implementation for the function which parses the IRQs of a DT node by the "interrupt-names" property from the SMMU-v3 driver to the IRQ core code and made it non-static to be used as helper. Also changed it to receive a "struct dt_device_node*" as parameter, like its counterpart, platform_get_irq(). Updated its usage inside the SMMU-v3 driver accordingly. Signed-off-by: Andrei Cherechesu Reviewed-by: Bertrand Marquis --- xen/arch/arm/include/asm/irq.h | 2 ++ xen/arch/arm/irq.c | 14 +++++++++++ xen/drivers/passthrough/arm/smmu-v3.c | 35 +++++---------------------- 3 files changed, 22 insertions(+), 29 deletions(-) diff --git a/xen/arch/arm/include/asm/irq.h b/xen/arch/arm/include/asm/irq.h index 245f49dcba..af94f41994 100644 --- a/xen/arch/arm/include/asm/irq.h +++ b/xen/arch/arm/include/asm/irq.h @@ -89,6 +89,8 @@ int irq_set_type(unsigned int irq, unsigned int type); int platform_get_irq(const struct dt_device_node *device, int index); +int platform_get_irq_byname(struct dt_device_node *np, const char *name); + void irq_set_affinity(struct irq_desc *desc, const cpumask_t *cpu_mask); /* diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c index 79718f68e7..ded495792b 100644 --- a/xen/arch/arm/irq.c +++ b/xen/arch/arm/irq.c @@ -718,6 +718,20 @@ int platform_get_irq(const struct dt_device_node *device, int index) return irq; } +int platform_get_irq_byname(struct dt_device_node *np, const char *name) +{ + int index; + + if ( unlikely(!name) ) + return -EINVAL; + + index = dt_property_match_string(np, "interrupt-names", name); + if ( index < 0 ) + return index; + + return platform_get_irq(np, index); +} + /* * Local variables: * mode: C diff --git a/xen/drivers/passthrough/arm/smmu-v3.c b/xen/drivers/passthrough/arm/smmu-v3.c index d58c5cd0bf..bfdb62b395 100644 --- a/xen/drivers/passthrough/arm/smmu-v3.c +++ b/xen/drivers/passthrough/arm/smmu-v3.c @@ -200,30 +200,6 @@ static inline void dev_iommu_priv_set(struct device *dev, void *priv) fwspec->iommu_priv = priv; } -static int platform_get_irq_byname_optional(struct device *dev, - const char *name) -{ - int index, ret; - struct dt_device_node *np = dev_to_dt(dev); - - if (unlikely(!name)) - return -EINVAL; - - index = dt_property_match_string(np, "interrupt-names", name); - if (index < 0) { - dev_info(dev, "IRQ %s not found\n", name); - return index; - } - - ret = platform_get_irq(np, index); - if (ret < 0) { - dev_err(dev, "failed to get irq index %d\n", index); - return -ENODEV; - } - - return ret; -} - /* Start of Linux SMMUv3 code */ static bool disable_bypass = 1; @@ -2434,6 +2410,7 @@ static int arm_smmu_device_probe(struct platform_device *pdev) int irq, ret; paddr_t ioaddr, iosize; struct arm_smmu_device *smmu; + struct dt_device_node *np = dev_to_dt(pdev); smmu = xzalloc(struct arm_smmu_device); if (!smmu) @@ -2451,7 +2428,7 @@ static int arm_smmu_device_probe(struct platform_device *pdev) } /* Base address */ - ret = dt_device_get_address(dev_to_dt(pdev), 0, &ioaddr, &iosize); + ret = dt_device_get_address(np, 0, &ioaddr, &iosize); if (ret) goto out_free_smmu; @@ -2484,19 +2461,19 @@ static int arm_smmu_device_probe(struct platform_device *pdev) /* Interrupt lines */ - irq = platform_get_irq_byname_optional(pdev, "combined"); + irq = platform_get_irq_byname(np, "combined"); if (irq > 0) smmu->combined_irq = irq; else { - irq = platform_get_irq_byname_optional(pdev, "eventq"); + irq = platform_get_irq_byname(np, "eventq"); if (irq > 0) smmu->evtq.q.irq = irq; - irq = platform_get_irq_byname_optional(pdev, "priq"); + irq = platform_get_irq_byname(np, "priq"); if (irq > 0) smmu->priq.q.irq = irq; - irq = platform_get_irq_byname_optional(pdev, "gerror"); + irq = platform_get_irq_byname(np, "gerror"); if (irq > 0) smmu->gerr_irq = irq; } From patchwork Mon Mar 13 13:08:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Cherechesu X-Patchwork-Id: 13172489 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 6EFDAC74A4B for ; Mon, 13 Mar 2023 13:08:48 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.509255.784706 (Exim 4.92) (envelope-from ) id 1pbhuk-0008MK-Me; Mon, 13 Mar 2023 13:08:34 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 509255.784706; Mon, 13 Mar 2023 13:08:34 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pbhuk-0008MD-J3; Mon, 13 Mar 2023 13:08:34 +0000 Received: by outflank-mailman (input) for mailman id 509255; Mon, 13 Mar 2023 13:08:33 +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 1pbhuj-0007qY-64 for xen-devel@lists.xenproject.org; Mon, 13 Mar 2023 13:08:33 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on062b.outbound.protection.outlook.com [2a01:111:f400:fe0d::62b]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 27bdb825-c1a0-11ed-87f5-c1b5be75604c; Mon, 13 Mar 2023 14:08:32 +0100 (CET) Received: from VI1PR04MB5056.eurprd04.prod.outlook.com (2603:10a6:803:5a::13) by DU2PR04MB8520.eurprd04.prod.outlook.com (2603:10a6:10:2d3::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.24; Mon, 13 Mar 2023 13:08:29 +0000 Received: from VI1PR04MB5056.eurprd04.prod.outlook.com ([fe80::f883:bd6d:18d4:c487]) by VI1PR04MB5056.eurprd04.prod.outlook.com ([fe80::f883:bd6d:18d4:c487%4]) with mapi id 15.20.6178.024; Mon, 13 Mar 2023 13:08:29 +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: 27bdb825-c1a0-11ed-87f5-c1b5be75604c ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UWZUlXNTG07dt+BjWWkxWvRibvGI4lRy8+gYAfsbDLZ6BMt42swFZ8Gv/pjXMvUvbUh9Su0ZcYFaVeSeOvSLkbTgsLWuze8JAJI79rkIsbBp9WoALfuQ3N3pxZ02U0SqD/6e32TBF4eNNr2MNQKRXcVtxI1Z9DHmHwy9tolvKRFVP8IM+0gJ7mqZWw4TZQkA/tsl4JVVd9kxKqORl9VHuNFaLQo5OHlhzgXkbFY3Br5JyJgMbTDnLfTU3xRAaA4yg6VRHAFAq1D+8PCh5/XVoGTuzG1xmud1pTgupwvwvC02z7a5WPdPX577W+Mc5v/ehcMTu09rtBvcBbLF6jL8BA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=JPWtOsd8bEyOgAZcfrDEhyFoI+CfhjDjX+52uaAqMtY=; b=XLHiaE+koF80w6fLqy7Pe/Ha6kuOmGaj56h3X0JkRHGigXZvn6jIbBsOvusGPrQzpmsQWNjWWUYuWrlf6R3pVGdoOlfevxONjDAYwD23ssbB2rWU/xsyy7a7cFwTwR3qwr6Nb6baK9ouhJJBXkvD9BUISu7+jz35jjzV4/aLeDHbhtxBQQ34md5ImzBiuylMoa9eOSCn4QRpCgnjIkpYeRQD/3/xxg3tGHRJaNNlbrV4MRCA8C6v1e7c+J+rgubM6inew4wRZu7BL7k/L2iQzTOebYYBBuaH/+BbLHL3V+O+n5Q21jYijVW3PevBfGrvnPagKVbC/q91ci1GsqFJHA== 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=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JPWtOsd8bEyOgAZcfrDEhyFoI+CfhjDjX+52uaAqMtY=; b=ca3eE8gy6O6HWTE6ZXdsPOXGvoFnRsDn+nhbLO9lOAMJ5WustH4OYkJzJoXmWJpklT+NT5r3Ros9EZASpPsRYjV2BEBqY2H/HY7aa9lkfQm/XTvUL8lm3Hf7/HH+PUnknGXOpsNudtjEzEHemjQ/8OK9h8OEat2K0UmozxTUhtU= 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: michal.orzel@amd.com, sstabellini@kernel.org, Bertrand.Marquis@arm.com, julien@xen.org, Volodymyr_Babchuk@epam.com, rahul.singh@arm.com, Andrei Cherechesu Subject: [PATCH v3 2/2] arch/arm: time: Add support for parsing interrupts by names Date: Mon, 13 Mar 2023 15:08:03 +0200 Message-Id: <20230313130803.3499098-3-andrei.cherechesu@oss.nxp.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230313130803.3499098-1-andrei.cherechesu@oss.nxp.com> References: <20230313130803.3499098-1-andrei.cherechesu@oss.nxp.com> X-ClientProxiedBy: AM0PR03CA0001.eurprd03.prod.outlook.com (2603:10a6:208:14::14) To VI1PR04MB5056.eurprd04.prod.outlook.com (2603:10a6:803:5a::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5056:EE_|DU2PR04MB8520:EE_ X-MS-Office365-Filtering-Correlation-Id: cc591c29-5634-4b82-4ae7-08db23c40a10 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zhZ60xI4deaenT1uEApWs8Eyj9aUCo4ERO/Bcy03z6i5UvLxKlA+wCeCFrGqmhGhvDMpbR5SOnqvmFX5HuSx/xDMJPJBNz9L/z/CEGmlr7ICoxR9idqoawiDhFWgU57Wh62je+usp/HzG/+iGR7K9lOpWdbgZtB0xyjKPtHLGPGKirGP9sgCj9Fa3Qf4d5LWC7EemworENqHliCTz2yH3G9d0E/8k2JaWEV5bj+LbEebVajyo16LjkH8i0bN1iMTMgsFi+JKC6p+/iM6CDSXK2c2TnSnS9xumigp2g4V7zFQbT+9l/Z+z1OMGBUFRSD/taNS23sWOYccfbXIbrZFW8RKXx/WbF5agD1kdnEjwEJMrCWCW2csX6Bb7yAmdBb0dfm73HkPq74+shyqowA1z65de+k3h3ioAwjDjc90yXkuKumC+3og3cZXmU5zdjmlt7tsAbjyAEadk8tFBe/9UsTLhl/TzJmJlDlZGd+/ZmKL32kAezxJiPt0llsqsneJbwBBeIeQurv8K9pP1hyGuep6MB/3OFNEDBmKrEx1PnAaGueKdfVklvcoz0waRko/M/CiGmvKxRqVNVkl9nGr8JQEXpnk4UHG+y4h6U2smOZ+N7pGMuOtrKuUIfG3h6NBbHRbU8ftDZdoHhltjMfq2JX9KXi6k11VhPBeUwnVzbQ491meUWj7DqHSg39Xysva X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5056.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(346002)(376002)(396003)(136003)(39860400002)(366004)(451199018)(2616005)(186003)(6512007)(26005)(1076003)(6506007)(83380400001)(8936002)(6666004)(38100700002)(5660300002)(6486002)(66556008)(66476007)(8676002)(4326008)(52116002)(38350700002)(6916009)(66946007)(41300700001)(2906002)(478600001)(316002)(86362001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: r582WB3UeEYYEjVkJzH5ldN2+hGPNaPF842iU3tdZJ4rGE3JA8caIdoAVtFgpi4c3a1hKGDU3jle2LFeZo070nDzIPz8hR4ZNGxvh35z99XuuDBp+tM3sTb1rMxRqGMn9gso3XK75E4na1cvRXIGKZR7Sb4w/BR40Lw7aeaOV2g0BXX+ueRzKe4/mdj0XouIafBUAyiBzd1u+lssXCX85L71wTpPUo10J32dxu2JoFkSurW5652Qknd7Y3VFrPQL6Kx7ccs8npQeo5Sp8w5fFLuzvIE7KmwP2nyvNNLszY7YkgjxrTmuI5uUlDmDN+8NflM0gd5I53voTRfNKem18uFCJw/hcL/TLYjA+ngBqv3k5xIpPubQdwofRgFYZQbTwkTtbKd/sFRK9x0yMtpOUDakJInIeWYlIkHYgTm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jZP+hcOXKa2BCQqSGgpSLWqyhpJuL2ioR6N80HS84A13nOMj1YOgF9SAeAcA/vaiY16TJ7+Sd8oRbEPn6VyN4q2QDtWGejPgzPQ8PZ8epc5SDA== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: cc591c29-5634-4b82-4ae7-08db23c40a10 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5056.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Mar 2023 13:08:29.4490 (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: t256aXf0uQkd9l/UPMtc60fxJZg2d06NPf7xIDGTkzA+9pHj6XwKq3IXpREbJaPUBHsTHaC94Y5Ic6h0nrhR+OG8l1SwkdIv22y1mM89M3g= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8520 From: Andrei Cherechesu Added support for parsing the ARM generic timer interrupts DT node by the "interrupt-names" property, if it is available. If not available, the usual parsing based on the expected IRQ order is performed. Also treated returning 0 as an error case for the platform_get_irq() calls, since it is not a valid PPI ID and treating it as a valid case would only cause Xen to BUG() later, when trying to reserve vIRQ being SGI. Added the "hyp-virt" PPI to the timer PPI list, even though it's currently not in use. If the "hyp-virt" PPI is not found, the hypervisor won't panic. Signed-off-by: Andrei Cherechesu Reviewed-by: Bertrand Marquis Reviewed-by: Michal Orzel --- xen/arch/arm/include/asm/time.h | 3 ++- xen/arch/arm/time.c | 26 ++++++++++++++++++++++---- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/xen/arch/arm/include/asm/time.h b/xen/arch/arm/include/asm/time.h index 4b401c1110..49ad8c1a6d 100644 --- a/xen/arch/arm/include/asm/time.h +++ b/xen/arch/arm/include/asm/time.h @@ -82,7 +82,8 @@ enum timer_ppi TIMER_PHYS_NONSECURE_PPI = 1, TIMER_VIRT_PPI = 2, TIMER_HYP_PPI = 3, - MAX_TIMER_PPI = 4, + TIMER_HYP_VIRT_PPI = 4, + MAX_TIMER_PPI = 5, }; /* diff --git a/xen/arch/arm/time.c b/xen/arch/arm/time.c index 433d7be909..0b482d7db3 100644 --- a/xen/arch/arm/time.c +++ b/xen/arch/arm/time.c @@ -149,15 +149,33 @@ static void __init init_dt_xen_time(void) { int res; unsigned int i; + bool has_names; + static const char * const timer_irq_names[MAX_TIMER_PPI] __initconst = { + [TIMER_PHYS_SECURE_PPI] = "sec-phys", + [TIMER_PHYS_NONSECURE_PPI] = "phys", + [TIMER_VIRT_PPI] = "virt", + [TIMER_HYP_PPI] = "hyp-phys", + [TIMER_HYP_VIRT_PPI] = "hyp-virt", + }; + + has_names = dt_property_read_bool(timer, "interrupt-names"); /* Retrieve all IRQs for the timer */ for ( i = TIMER_PHYS_SECURE_PPI; i < MAX_TIMER_PPI; i++ ) { - res = platform_get_irq(timer, i); - - if ( res < 0 ) + if ( has_names ) + res = platform_get_irq_byname(timer, timer_irq_names[i]); + else + res = platform_get_irq(timer, i); + + if ( res > 0 ) + timer_irq[i] = res; + /* + * Do not panic if "hyp-virt" PPI is not found, since it's not + * currently used. + */ + else if ( i != TIMER_HYP_VIRT_PPI ) panic("Timer: Unable to retrieve IRQ %u from the device tree\n", i); - timer_irq[i] = res; } }