From patchwork Tue Mar 7 10:09:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Cherechesu X-Patchwork-Id: 13163097 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 1C1B8C678D4 for ; Tue, 7 Mar 2023 10:11:08 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.507263.780549 (Exim 4.92) (envelope-from ) id 1pZUHc-0006Ol-Jm; Tue, 07 Mar 2023 10:11:00 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 507263.780549; Tue, 07 Mar 2023 10:11:00 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pZUHc-0006OZ-Gy; Tue, 07 Mar 2023 10:11:00 +0000 Received: by outflank-mailman (input) for mailman id 507263; Tue, 07 Mar 2023 10:10:59 +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 1pZUHb-0006Nh-5X for xen-devel@lists.xenproject.org; Tue, 07 Mar 2023 10:10:59 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2062f.outbound.protection.outlook.com [2a01:111:f400:7e1b::62f]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 597925f7-bcd0-11ed-a550-8520e6686977; Tue, 07 Mar 2023 11:10:56 +0100 (CET) Received: from VI1PR04MB5056.eurprd04.prod.outlook.com (2603:10a6:803:5a::13) by PAXPR04MB8094.eurprd04.prod.outlook.com (2603:10a6:102:1c1::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.29; Tue, 7 Mar 2023 10:10:54 +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.6156.029; Tue, 7 Mar 2023 10:10:54 +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: 597925f7-bcd0-11ed-a550-8520e6686977 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GnIAxOG5Tr4iGrWOVRe5bXYIYJi6xISWNzBCAI+3A7HZmiQZ9Qz25eWaXhrAl3x2h184dSFljXF2gv20BEm69fCXppdL7TupHVvkfytOFEkN7UvSbUO6Scf+W+Z0Mn41G3kRgOXE5+00A8+fpC2E2hfwszPvg3p2dVK9MZDo+MPkuNo6DdKYzfuhPYFaPGkzzRHVDZdW0QnI3jdx0UrAKzHKCfNXrjfDTe4L6KRUA4RmYuuXqk2daK0hYnEtmXADGFAp+xMN20jc3jCCz0yNTE7Tn9we2N/1obLF9OEySKlaTmfzVFLQXemSLCnjhTDyCyB/uTOli6ps1l6U/yjiGg== 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=Tyq86JbXHflsMuSweaOQDMiXi/8wRTSxsXZl4iIFAhs=; b=brcei4ePtvnp831MMkK0VyhdMcOCOUhU/aoAj/HUrHkNoUeJdscKiw2ylMU+qZEZF65UvTGqaFgsmqIJQnb7p7djVFXn1Vs7+pa2Rx5GEOast6XawhKmJ3vR3hSG575tRhuHkKn7TPqocmduB2Y0ULieiYWAc6RpuSoylyKiFLKFDB9ebfGClJslepltKLoEJN7byJHyelYnkCQ0AVPBV5ZY7HBnqSyhEn8W6OLNkVFoC/OxSy15tjqT+2Nor3ZOTGi3qlSh4gd2GUGlcYQPYAGuX2tr7gbd0nvwuOhEfQVRbXBOtI/5FOWrKLeebC1/tb2MHc5McipEJwKadpCdEQ== 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=Tyq86JbXHflsMuSweaOQDMiXi/8wRTSxsXZl4iIFAhs=; b=BD9yj3gMnctJ7+6wK3sXVbUX9MMd65W8g+txHlyOpDU2rn+iV98BAljE31kbvo16TrNhimmEn3Z9cnKbfz4jk5i5SAtl4g4KhvpruJkNbzyq3G7MgJixviemoxTCHflHfyd75QbFsdil5FnNcrdaZSBiAEaxpaOQKzXzdXeRhYk= 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: Andrei Cherechesu Subject: [PATCH v1 1/2] arch/arm: irq: Add platform_get_irq_byname() implementation Date: Tue, 7 Mar 2023 12:09:48 +0200 Message-Id: <20230307100949.9231-2-andrei.cherechesu@oss.nxp.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230307100949.9231-1-andrei.cherechesu@oss.nxp.com> References: <20230307100949.9231-1-andrei.cherechesu@oss.nxp.com> X-ClientProxiedBy: AM9P250CA0006.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:21c::11) 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_|PAXPR04MB8094:EE_ X-MS-Office365-Filtering-Correlation-Id: 12146b3f-9fc9-4667-408e-08db1ef43c4c 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: JF0gh7sPMbTpxgODkZjn63eI6nP4rzrsjoVLCq6v9bvemYms34mKLotXtPLyLTMHBLKn366vmK0UrSki9Nx8z54n2qDM/3uITp7JNIzGZGDFLZUj7+JUWF+99abUJo/TYz5ApIOGRo0BlE/J1j9by7C2Q7di1H6B2AlyVrF5eE4ZsObv2cJhfkGb5Mp6mS0MoXMHESFl//oNyfP1kGTC79lZ0znX6e4sIh7U/stm3YH7Qx99xgMdl9uOIeTXqZqMTMnwpBFsMGmGNh+X9FlCXoiY9jpu7syKh2UwAGJV9hf+l42J2692dk/zgzBE2k+FjTlsNU93zrZN70c3slHqW1H6UXHMR9WMB3Ln8ilrWv60U8mlg1njxcv3P9883TJfKet+Kg9VFUYKWbfkeMwISy3XQZ1iVG4ty0LuC2RWVTQUsHiS8e25AXtQsaEn9AVIpc43uuvlkYiFrWb2ke3F0ZQnyyhg+WXEmRYE7S8I7356kq2BIoRYu2J0sS6BH2c6b3Q+BMtmsG7qET09FfLSbTSp4EOH0RSR2gg4RD3ABz1XAcsd9eg91cLMfkXkkb/noBXjktepy99JLBnl+KrznCeRFbcKU6rWol8xLbk/9ItusXp6+UASyXa+5b2gk9MZHNdmErEHvzMZi3oRBxYwlNdQA3W+0JMNJ5RGYK4lGd6nkjKJ3kPlotyPRBVok5bvucYWSxQpFs1uxshE9PiLgA== 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)(366004)(39860400002)(136003)(451199018)(5660300002)(8936002)(2906002)(41300700001)(4326008)(66946007)(6916009)(66556008)(83380400001)(66476007)(8676002)(316002)(6666004)(478600001)(6486002)(52116002)(1076003)(6512007)(6506007)(86362001)(186003)(38100700002)(26005)(2616005)(38350700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: L0X2VBnQ7m9TkKF7HDOMAUc6BAKmfX2yRxYmTFKjLXrVcrovirw9qD9oTENSSIghaHukTE57A3X6q4kXuSZ9yCghk0i2lXVs6nB6/L/xX6uP6956VIUmHkPkgS2+B9pM1gbD15cwqxzIIBeqewQzLFk9pT+9r/E+7mxbvTQvQ1TZG1rFw2JOhpkqW/WmSoaSS7BD4hVIb+OQjSkopI4K57WE+lkeTvd4A2H8Z9tC+CvmoYbKjrGkjhshfitHoVKYeOVVdtCsPKUoeBDg4oYqMWMvrpT7cApHeovr6NrjoEDqJOBzBzbOdTQU1BemVRl+Z4cVCzDVbTPBv3bl0KpSsAaSjoA6NKb7XApB629n13pkKX6IxSxrxKwWM3DKah3PV2/4J1lMWk4C2sw/qqva7Pc6xaSb7/DTLeTqwf06vvW2bdOBrbGl3Mlzo8F6oqFN/pcP95CviqBrn34c+pkm5+DWOpiGHnaw6y1YqCanBDHf8omPR095rgArUD89N3UokzdjZrtc6Aw/r3UyC6wOeNE/fhWKmh+dYYPsV/TVOsLZbMwW3mDejAIz1/Fwhfwo55A8PSIZb/xqGCysabxAZo3ryM8vQJV149k7yvUxx5KI6oJA6cLsH9unRAC2rtr+e12UNebFlQ39T2DuTZM76EnTHAFCOjPFmz1QN99VAC0feE2QJgZBghYQt8MFEa0ahN30ig9QfmxvJpVQ0HjTldcV9py9bzBRkqLcOu7dwiOhaCK/11/LBlpvFOpanANiOcJF16C+ZNYL5YNkvOLx/C2duD2P/Sha/Gnh4WD4WBC2dHioBzTWakPpETDWhEYUc19WxnZtdqgvB8iI8+gmARiuP118sfHQRLQj/bQsniNYpDWw0KybNzRZo1+ZOxi6MfuboEGRvKUaTDb9M1hDjbuD86s03ELQ4dd/tRCLTx1vywPsu7XmjomVsC+g/i5uQicYJX4a81H+CZtsqQNz1ZmzB02lx99fIwdV+dba6TgkUJI0ICFtVccMlgPTsvWQxjER7kcVrkacvDQZ5QEDpQv2iz3mNanRAqjHscVDly9JMytKE8eStEgCPWLKjPhkI71zCIFPP4FDjorqpfk4YSoyCI1bjKNk3GQkPlxD/dmEdOxAAx5FTBOGeNzeHjWOWMFlEy8POL7lNv1yLulABhiaPAp+jW76WGAB8uINjJuZjsCN337g23sdkb/AdeCEjs+uV0IcxSohiWMNG7Z7JjtC52IdMNvySSYmfK6LmKYGu2lKD0jxuqFDFqD1Z3OUCta1B6I8dyJwIKViEc+yhS/RRGcEWn8xHK1RbmbgrF+eevWNo2gWQS4lgH48BucGg9A2Zbc1kvLX9GYuuk34bUKlcDevUJ8+UoSsDqoP5IZELqbPSMEE/fqIY+2SW94Nu2azT6bxHVouK+mcwhb3d+1bp3SzYVs7uBouvGxvk2kvnABQqTMqe02tlCBOG1rH7ZmiXdsJvQS8tyouyb7bxCo+0sYocmuTHief0S8ls+G8RU78zXsrdg3ckSz7Jil5yUKar75S8CQFKRfLhahrek2WbLbtpdzPeJTK+rApBzGeng6bRtMaT5FpgmFC7KSw/uJUg3gKyQiZiI6poGzQHA== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 12146b3f-9fc9-4667-408e-08db1ef43c4c X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5056.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2023 10:10:53.9134 (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: n/5kjByvuv5osyD6jJwCNwgZKnoPywLCEVpObXeSuwmSW3q54dUNItUrheQ6XJVi5zKeBXGk/qO4OH+p7vo0FA2cTg6YKSil7bWwcbyhnBc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8094 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 Tue Mar 7 10:09:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Cherechesu X-Patchwork-Id: 13163098 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 B8D17C678D5 for ; Tue, 7 Mar 2023 10:11:08 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.507265.780559 (Exim 4.92) (envelope-from ) id 1pZUHd-0006er-V2; Tue, 07 Mar 2023 10:11:01 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 507265.780559; Tue, 07 Mar 2023 10:11:01 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pZUHd-0006ei-QJ; Tue, 07 Mar 2023 10:11:01 +0000 Received: by outflank-mailman (input) for mailman id 507265; Tue, 07 Mar 2023 10:11:00 +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 1pZUHc-0006Nh-Ep for xen-devel@lists.xenproject.org; Tue, 07 Mar 2023 10:11:00 +0000 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on20603.outbound.protection.outlook.com [2a01:111:f400:fe1a::603]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 5ade7ad3-bcd0-11ed-a550-8520e6686977; Tue, 07 Mar 2023 11:10:58 +0100 (CET) Received: from VI1PR04MB5056.eurprd04.prod.outlook.com (2603:10a6:803:5a::13) by AM8PR04MB7921.eurprd04.prod.outlook.com (2603:10a6:20b:247::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.29; Tue, 7 Mar 2023 10:10:56 +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.6156.029; Tue, 7 Mar 2023 10:10:56 +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: 5ade7ad3-bcd0-11ed-a550-8520e6686977 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hxdIJcwQSctzoQSsxT9vzZLcP4ucpRrb1ur3H+MbCwFU3lABQ4GHOo0XvxfbRKwjoysrXufuHDKc4eXBfetVlgY9lzsL9i4Wb6y3VdACY73P5wwWNqUnjmIUGntx20bsgASDYZgCPfRSyhEkTfPC9tpTvyEZP960FuXZW94qZV/e1ezoYOZp60CfqEwAWmhWLsUia0sYh3AO2+ODVo77rm++3wNZuP3Nh3WxqpvBo7E3MKpf78kslrQrbbcON8swGB8vRloOft/aY5LqLogeS5JGMjz2DtbMdQTlCNlZ7JL8xrftHWZTfMslOiI+LQk8J0wVK56xHC4kponP5yDYsQ== 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=ujULk3y1sKw+hpceXjwl0rWf8ealySFr+FKiZ5uJz1k=; b=k3tgYjR1qR2xxaZQUxhgH7YAHANul07u0zbXjZqytrkp57ZASLmwHCilWUwDJ5fHbqYgjNJhngAv44nAongMk9VwEZ9kb3i3te+EEccJG1iK1hzg9C2pmdOI6ZH8Ih94MU15zwdcUz15LQzbhPQ7nxPG1GfuOcNMaiZeGnuUoXhXv1xV04qWRDG1U5mrHqgU2EHJTDIV0XxNEvCuirgE3cpiezzlI7iq/9pw0KZNYWNCzoCXRYDJlqQsEYBPXPi2Tpv1oInj9Bly1Bh85S8gqliOyo/Cj2AU/vGdVl8tzJXFI73A+E16sLesgGZawnvYY6g8RCix7UEUYELKIu1//A== 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=ujULk3y1sKw+hpceXjwl0rWf8ealySFr+FKiZ5uJz1k=; b=XPFeCHSuaf/Maik/y0ickPs3kDmeBO35t8/7+v93NIcM3/IQkPznGWOo+F6bO9x2wS50JH7U6kvM7L0XyWbAyJZgbnNeVxn4GqoYbYUwE/NLJRagcML8Gf8v40ZBsNSTAjR+SGR8swYFsvaxgAQ+68xDp7aeTDO3YUZHGOWbLcE= 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: Andrei Cherechesu Subject: [PATCH v1 2/2] arch/arm: time: Add support for parsing interrupts by names Date: Tue, 7 Mar 2023 12:09:49 +0200 Message-Id: <20230307100949.9231-3-andrei.cherechesu@oss.nxp.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230307100949.9231-1-andrei.cherechesu@oss.nxp.com> References: <20230307100949.9231-1-andrei.cherechesu@oss.nxp.com> X-ClientProxiedBy: AM9P250CA0006.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:21c::11) 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_|AM8PR04MB7921:EE_ X-MS-Office365-Filtering-Correlation-Id: 605580d9-2297-40be-ea7b-08db1ef43de3 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: o64yeR9N+eIHS8LmikWqMxovNJV3eLVOTHrsPYKDlA3JU+pniDRsXertxsnF6sSlVXIMhVZL1FTkaqbXKzfhl1clXqZ8Cy08yVqUza6LRixsxZx+nRucWZXPX4+Cpxae+gIpJG/3/hpoYiTMyhuvLifpxd/wvL5j5dSyZl63rdq5w6c7Di7ISSh/9aI41WPuir7KEDfYvzAJw2qZtdzJsuUAvWXUSP0CMtb7TrSlBCHw9a2qnRzqA8ETfTS6JiFjs6J1yA2wxSUsUCyoLGP2GWNz51CKKezFVJ6fjsDY5nUfF/OF9dy68Vvb0EqFVci4YevQNGx1SizZTYhQ1FcZuMPPVjRJFrCSvleW0rQqGpqHGrKXM7BSz8DDWTMSDiWm4igVQHfYYHW6g2mL0j7zhKaO5tRBhkZ7c9s3WBYXBuwpu2QK9Q1V7WUpHHgejv3gbkhSNFJCFmbxm9Y5Lu0/iCVzZSAizshNK+yoX2Cz0PPENFajf+BSfWPy6XwP3/R2lGSAV2VVuNMPkY8EXIlcZWz9K7v/5q9nDx3SPmiAukq5V5HX5oO+iQQPkQ2x5YGF+sAxQinqbtlVNzBpQv2TDguq2gLTvYPBAJrdDQ0TEQnyExVjaC0/nnsIfKqQ2nKqyYXVumYJgBJVh8C8i32xmlBTgqFW38HdR0nf5O8adxw5BqZ/y/Ond/Pl4LQwRGTQ394Xhv+mT5kbunrh6xri3g== 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)(136003)(376002)(396003)(366004)(39860400002)(451199018)(38350700002)(38100700002)(86362001)(8676002)(6666004)(8936002)(6506007)(5660300002)(2906002)(4326008)(66946007)(41300700001)(66556008)(6916009)(66476007)(186003)(2616005)(83380400001)(6512007)(316002)(478600001)(26005)(1076003)(52116002)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: TYJ/TmdxBe2a/uhqf/wbD5Ey93eechP/sH8L43YsjcuscsJC4qiAI5/ihiH00paqdWCNpDxdtanBSo5mJUAEFV7hf7AOGjYNeMgboMIosWGUnr5+Hgbh06hqjsX7jsHb9nQ0WfS1pwrjGBYFFiGLNCVPJSNlHxz64site/p1cGY6g+k8Am3b+++1ZQ5Ml2NCX/BpdfSoNPp8XPg+XAmhihzUD5WMmCuwDvSOJAureWZpCjvIaQpei8YG15y9TyNoyz5oXWs6mbsnwJHnPZ2B3HVgrLxnFNOfUI/+Oy+FDXHbxUHukOnXdoOM5gECLlGEIyIPw8fbeipNYUMwIjT7h+gDlE1OuoEb/4BYZkH7nsNFqZuV/C0PmL8r4glV6ruJjfx2pvrlm1soYTk2P0saTOJM6Fg988wDoMXgLdgMa8cu4me754jp4M2gYT7QZfahdtTLjsvIfuZLn/ndg0/wHiDBMYiwg4DfP8m2yClNdApWNg9upwxFQlQPnSnnPf+jStAJaB1akU0/GJWevqopALLGRQibwBeQ8p0khlQixTKkS8NDqEhYzXMc9A9Ym+FdaAEaiCedKYLQYhnvH0F3N71iAVif3gWAxFkxVNgLfBxL7B1btNhDl1UTxEPXYwXsVmRD6tS7/OBynQ/d6+xxOuSQuhVhScmzqR+gLV3HUf9aFCDlYTR3wgj225k03bdRvPXbyTLLEnot9gl/4aX7mIw6fdux60HEmRbmQ+1OIdX/Y2JnnkiaZrpcXWer6haJoYixBQJoHYOI1wip7wlUGGYJY15aTZ4WurDcT4wJJ3n83CN0uO4G2+h7B+/iTPziTeF+LLA5Bk+86EyicZfPvl94WJtpv7qM6G3NZW5xAIlCsLrBBobZ6SHr8nDsypGc14gqjiWbbQiiHJXTGmRU6slYVM0br1LTC6krS9Rud+bksx3cceVmT2tLglo4cua967+OB5V3G9x26x4VcxP6Knyl+5lTSuipTQ8ZNsNPBlY4023C0Qmtt5yukCu05DCpokomVy2H0u87ocY/JSPsrUOzfvVyjZ9ERus/fihqaRKolkJBgTWZ17ZEYLIUV1WMlsyACxDorx/4pYiFlQnQPrj6/SPj3iZ13ELqvVVa4WYwk1WIFKjjAnRzw274YqPa4G+f3Hc7l7IgvrEqHnV6BpSyBhUFub0Siap0ffmy48rpiOdvCPtg1qP34pdu1FouOCA3iPyKMjGR9MoLN3R95fyt8o/2/PbpJZstBLV/khueHwIhw4FRxUsck65qJtua1+/JG9pmVi0Cnnf+TTYCGkWNpq42hRpcgEQnbGylb6NmNA1pfWblY0YtwjOyTXafsFULChT1EblAc6cj5r6QT2ALuneG5se/ue5G442v/mcR95h5XLux0+ursizpZUEkEeSawo/3ngkU3hUs+OxDj0NWd1gLIzAlRaAwr6bJfM5MFCrmX7gvPk6VcHmJ98jvYX8OSBtvbKKq9vPaLt+fmfBLOv6tS34UDIghY37ufP+XeVopB51aJzW9yK2p3HikbP7K+wpXxyBK+PHhqqUIvXA3jYo9C2c9FexnqbPMRZrVM82Nssny6bcZOQahkrYsaluaGVZq6YR0cn0F9Fe8gA== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 605580d9-2297-40be-ea7b-08db1ef43de3 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5056.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2023 10:10:56.3663 (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: V0VS2RlksyQqhiEV6H/MdXbNrrljZHWFvHhl458JIuau/l5rwejIACS6mvjiVWF45kHjbeJqybiKfsHrds3j7fhYuuA89+TwHl2d0CJQnzY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7921 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 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 --- 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..794da646d6 100644 --- a/xen/arch/arm/time.c +++ b/xen/arch/arm/time.c @@ -38,6 +38,14 @@ uint32_t __read_mostly timer_dt_clock_frequency; static unsigned int timer_irq[MAX_TIMER_PPI]; +static const char *timer_irq_names[MAX_TIMER_PPI] = { + [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", +}; + unsigned int timer_get_irq(enum timer_ppi ppi) { ASSERT(ppi >= TIMER_PHYS_SECURE_PPI && ppi < MAX_TIMER_PPI); @@ -149,15 +157,25 @@ static void __init init_dt_xen_time(void) { int res; unsigned int i; + bool has_names; + + 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; } }