From nobody Thu Jul 23 22:29:24 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=epam.com); dmarc=pass(p=quarantine dis=none) header.from=epam.com ARC-Seal: i=2; a=rsa-sha256; t=1781848012; cv=pass; d=zohomail.com; s=zohoarc; b=VG5USW1MsoVYka9SE7MJi16bEOYRDBJsZ0oiksc7ClHcDsqgmFLSKr46T+nlV4nbNdcPggAgH6XGtMXzH/Rq65LlvPaRJDkfyFa5DI9gUlIs5kZ7BhL7j8GFdQxU0mkTeM9nFQTC0ba5n5snCSjTM6OTA9jA/YglYHGyhX0g1kg= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1781848012; 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=oEHoiDLKH9yyQT8ttaqQSBZWLwAtBQLeySpUAj2AFW0=; b=Ll0bMpNC7WgjTyj1ZlKACScg4CGSC24VePOHrTYN2AljyWwGMQNpbAUrZnlROicRqIodyPQJpkOT9VUaUPGLVJCTiMNhOs9fHhhjeFs9MEKbGpN4LPJ2+KqJfS12XTW2aJYvKt50LTd537BlRe1nLXCWwokgwZMrLb2GL/+Va+w= 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 178184801232486.55728995860761; Thu, 18 Jun 2026 22:46:52 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1341679.1601936 (Exim 4.92) (envelope-from ) id 1waS3Q-00089v-KH; Fri, 19 Jun 2026 05:46:12 +0000 Received: by outflank-mailman (output) from mailman id 1341679.1601936; Fri, 19 Jun 2026 05:46:12 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1waS3Q-00089n-FL; Fri, 19 Jun 2026 05:46:12 +0000 Received: by outflank-mailman (input) for mailman id 1341679; Fri, 19 Jun 2026 05:46:10 +0000 Received: from mx.expurgate.net ([194.145.224.20]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1waS3O-00089h-Ky for xen-devel@lists.xenproject.org; Fri, 19 Jun 2026 05:46:10 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1waS3N-00BEP3-A8 for xen-devel@lists.xenproject.org; Fri, 19 Jun 2026 07:46:09 +0200 Received: from [10.42.69.8] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a34d795-e002-0a2a0a5209dd-0a2a4508b500-20 for ; Fri, 19 Jun 2026 07:46:09 +0200 Received: from [52.101.72.73] (helo=AM0PR02CU008.outbound.protection.outlook.com) by tlsNG-c1860d.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.0) (envelope-from ) id 6a34d7a0-9ee7-0a2a45080019-3465484967d3-4 for ; Fri, 19 Jun 2026 07:46:09 +0200 Received: from AS8PR03MB9746.eurprd03.prod.outlook.com (2603:10a6:20b:61d::18) by DB8PR03MB6266.eurprd03.prod.outlook.com (2603:10a6:10:137::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.139.13; Fri, 19 Jun 2026 05:46:06 +0000 Received: from AS8PR03MB9746.eurprd03.prod.outlook.com ([fe80::cf11:309:1384:58f7]) by AS8PR03MB9746.eurprd03.prod.outlook.com ([fe80::cf11:309:1384:58f7%4]) with mapi id 15.21.0139.009; Fri, 19 Jun 2026 05:46:06 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=epam.com header.i="@epam.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=gLsTRnnf8QGnzbeDwYomztBmRYl8i9qW3cq/ajF1oCXzvrxaDIFfidWsU7n8bzhLcQKl3/nuE6NeqvVzE+pCMa42vvNW/vGZYziEw9u7JUPpGqdMDqZZ6FnxRqLPZ/4HG0l08wYZ4qXjdipll7/gk0ZyNhx0XpxdVcSJEb8ws/477uVmVKjWoKxbEQCiOoRsJyLcWDUr1HxVtEY2+P1djqDzTuZeIMmSMroGiNpSfsfGlCgkRuNKhLLo3iGI85KV71PUOxHYy8/85JJlBTb8+C7eInXGZ8N4lIRBEdK4Bx6+2A5psYjmciSIUjmA3blX25rf+BC5Bl9vCcUsnZcFHw== 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=oEHoiDLKH9yyQT8ttaqQSBZWLwAtBQLeySpUAj2AFW0=; b=XwzrADuv5+jZzvChzmp4E2Yo55Aa2SXl8O4PHgOg1uAWFO44RjFZHUjPWPFotKLNn/ipZOkwIIbTcAjFplKXg3JjeCmGVpOVxFhR/L/y8Fs62wd2+rr2pD5ZVZC8oGJ8NlfPe6A3Zq6zcvbFIn8Ks43qWhR+JiAtiv3cV+MRkEsWb96wstC3uocZ1BHVrBkloJXvDKxIsc6A/k+DZhg1z2xbqMs89CAeLbQSE3wDtlnNBZN5h+azK0pC43z4xa5S5GmgTDSObnnPPjAg7RVLEhYoWuAtaunuPpdxGeBMybwwCY+pH6jjX4OrSNrsQNLUUdaabhqOAEnA90vfsrMtPA== 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=oEHoiDLKH9yyQT8ttaqQSBZWLwAtBQLeySpUAj2AFW0=; b=TMEDRX/mSkblDUli4xxIx3rWQEGEthp8bDuKR+nytMfD4VbnSbw8KaXYQtIKDvAZrvVdcCNepLdjU6MJI9q9uoyw61pS3nrAJixVd/egT8pgpAxu44lIZgmIh2aHQ4q9RkzvmsEzNz51iuwYDFrbMErMnPvSkR3UjpC9WVYyJkcdE9rkPIDVQT2SMRZLoVs+aedWQqSKNugs5zA0UO3GG1OCGK+keXUNX6fZNEX999l0jTZ+M2wWu7/9SDD5CCH0IGm5an4W03zyf4E+RkL/zN9xeDFAe9ObDhk28sgBukt2mX9oa7sYGQvvsORANVfuFJm8lUeayePCSnUpVeyFsw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com; From: Mykola Kvach To: xen-devel@lists.xenproject.org Cc: Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , Oleksii Kurochko , Luca Fancellu , Mykola Kvach , Oleksandr Tyshchenko Subject: [PATCH for-4.22 v2.5] xen/arm: gic: defer host LPI allocation until after ITS init Date: Fri, 19 Jun 2026 08:45:52 +0300 Message-ID: <341edd8de63dcd84ccc6e7b6c03e9e8fc7105184.1781847061.git.mykola_kvach@epam.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <112419d3ea48ca328849c8f6647909d3eb667b40.1779922874.git.mykola_kvach@epam.com> References: <112419d3ea48ca328849c8f6647909d3eb667b40.1779922874.git.mykola_kvach@epam.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: FR2P281CA0031.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:14::18) To AS8PR03MB9746.eurprd03.prod.outlook.com (2603:10a6:20b:61d::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR03MB9746:EE_|DB8PR03MB6266:EE_ X-MS-Office365-Filtering-Correlation-Id: 32b6fe1f-5a87-4f30-6941-08decdc60e21 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|23010399003|366016|1800799024|376014|56012099006|11063799006|6133799003|18002099003|22082099003|3023799007; X-Microsoft-Antispam-Message-Info: +YxC1hNi2UYVNSFPs+wHnrbC9ikbflraRs/hvjwQeNZ4YpCz4g51i6T4DAhqddEOGDyrc0mqIz/+Gir9J4e+h1t2Y4OOPsWreFjtTzvEQauAnMRWZDzjl8Q5AvHLNMJ185xS8U/3t202c+/ShY8lsxtfe+rPYzhyiy2kAHUPnHf/4BXfwiPsPi7HTPqphfApLcGWqQIjzwKpIpuMR0vTyObj3310lNragwn+M/44n//nW8swWD2C5GuGSSxudHOjm+P5OP/0N3vs44KfgLIgrGrynRK1qStZxubZIjESQyPN4fNRlne0PQx4I3Hu7feIkshuEA957YrenHLniSwJEr2wcD3Ld7ZbF4OmwUWZu8j5rhMcWsbxOaAKQzjcM9gETblXBa9lD5Al4y7GfohQ2mWaubDOV87Vg+hejuwYHXeXUS7+MDrgEGs7h5umxhYaw0cZF9BlEVGQlGdXIHaULgsH/OJWQt8BKcdyYnzcPALGi3zr5/z4wn91knew9uHjadyyBzo5ckeTzDWAxOXtyo81+E56jdlVp9K2QOYmgbr4pyyNcKD0HoA5jQr9qcL1wDxrexlhEhVA1lc7IAVS7jDDNtLvzHlaUW/B34RuNZ8mdE3hg/hBPyHgOxrxFGrVt8Jdf/ecZUxp7K4BMDbceHMuYKl9JbGjHQ7fy9t04oM= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR03MB9746.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(23010399003)(366016)(1800799024)(376014)(56012099006)(11063799006)(6133799003)(18002099003)(22082099003)(3023799007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?dgHpWQlU0Ih3OTIcrzkBKgi02efj9fZmqF+DN839pB2AbG53vDHt04vGY2Sk?= =?us-ascii?Q?SKkJn7+wilvRFRUZfE/zpPDv/kCENvIGJbY/sc28ssZkZuZkE816CmV8Qj8R?= =?us-ascii?Q?o5OK8u/MjgZIV++zq58xxwHZdVywBzdUMbKdME+dX3j3a4cxZA4+N+bNjQu4?= =?us-ascii?Q?KFLc3mIwsobjbEprVtXRz0XTeOf5TTeyoPBS71S/XyR3cEkyvqrXL6fV4YRn?= =?us-ascii?Q?husmyDxZzyoHtfXgwAXBSyPCPJ8X4d8vRFSha6PtoYaAynksooXMo+dM471S?= =?us-ascii?Q?6/QAwffqSVLT6GRZ3sRlWXjpIJ475tPgiTf4APmB+pZWqrlYb4waDiY12Vyr?= =?us-ascii?Q?n2xajr+W761KJEnsRYN7fPNVXj8JA0Y3VQSRTm24Lppq1MEnV6qtrcvvIlJp?= =?us-ascii?Q?0dFEi3D1cTlv3z/U9JW6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Q?BXyAnCuS784w1h/Q927xwvPf5KOHlVeDAN6vFxxbOyNhampXCdFgbRfl1WGr?= =?us-ascii?Q?zjlLbTvnNv8OOrepTxmem6tnxtwDeJYFh2DELzFt+4Pbe8OWYAVgKC+ewOHF?= =?us-ascii?Q?lzFjQYuO9RWvfhjL9MWDnTpyloPKcsetZk8DpOt4VXdW6ytaZUcCM+tP1oqu?= =?us-ascii?Q?SbRjmDZdD3JCD1ztG4jo+1ZUdJJ+4lkqzA3e68ReeF8DMjEHbB8iWcryZg81?= =?us-ascii?Q?lr/M95V8GbSGBsLHIyCztQOB1uxRESG9IYXPPSW9NMs1OUbb/dG5RGT+Imeo?= =?us-ascii?Q?w6Po/exMnVuOkAhhtIjjxmRBfqtxqlFlhp0XodrYYNFLLrIgUdPi2BQMqfT3?= =?us-ascii?Q?1aS7EzElhTakyEIl9tNclmFN2zcG7B+yTWgQ7PL4jtCc4C/wBKG1mO3bd1z2?= =?us-ascii?Q?afzH7OwYGQ=3D=3D?= X-OriginatorOrg: epam.com X-MS-Exchange-CrossTenant-Network-Message-Id: 32b6fe1f-5a87-4f30-6941-08decdc60e21 X-MS-Exchange-CrossTenant-AuthSource: AS8PR03MB9746.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jun 2026 05:46:05.9347 (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: +6ogyV98xQiFVXSfr9QujjgtRAfnCHmrG0briwRZj5Jatctgmta63ZhuNPf0B02ShRwX7wPiZEcjkw6Q2x1ahg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR03MB6266 X-purgate-ID: tlsNG-c1860d/1781847969-5F9E20FA-2618B11A/0/0 X-purgate-type: clean X-purgate-size: 3519 X-ZohoMail-DKIM: pass (identity @epam.com) X-ZM-MESSAGEID: 1781848014506158500 Content-Type: text/plain; charset="utf-8" gicv3_lpi_init_host_lpis() allocates host LPI state, including the host LPI lookup table, CPU notifier state and the boot CPU pending table. Those allocations use gicv3_its_get_memflags(). ITS quirks are discovered by gicv3_its_init(), so allocating host LPI state from gicv3_dist_init() can happen before the memory restrictions required by the ITS are known. On affected systems this can leave Redistributor LPI state allocated and programmed with the default memory policy. Move host LPI initialization after gicv3_its_init(), and only run it when a host ITS was found. The old call ignored the return value. Now that the call is made from gicv3_init(), check it and panic on failure because Redistributor LPI initialization relies on that state being available. This also narrows the condition for host LPI initialization from "GICD advertises LPIs" to "a host ITS was discovered". This is intentional: Xen currently has no supported LPI path without a host ITS, and gicv3_lpi_init_rdist() already rejects that case with -ENODEV. Therefore, on systems where GICD_TYPE_LPIS is set but no host ITS is present, skipping gicv3_lpi_init_host_lpis() only avoids allocating host LPI state that cannot be used by a supported Xen LPI path. Fixes: dcb6cb263689 ("ARM: GICv3 ITS: introduce host LPI array") Fixes: 751ec850ec1d ("ARM: ITS: implement quirks and add support for Renesa= s Gen4 ITS") Signed-off-by: Mykola Kvach Reviewed-by: Oleksandr Tyshchenko Reviewed-by: Michal Orzel --- Changes in v2.5: - Rework the commit message to explain why host LPI initialization is now tied to the presence of a host ITS. - Document the intentional behavior change from checking GICD_TYPE_LPIS to checking whether a host ITS was discovered. - Add Fixes tags for the host LPI allocation and ITS quirks ordering issues. - No code changes. Changes in v2: - Replace the v1 ITS pre-initialization hook with the less invasive approach suggested during review: move the existing host LPI initialization after gicv3_its_init(). - Check gicv3_lpi_init_host_lpis() and panic on failure, matching the fatal nature of host LPI setup once ITS initialization succeeded. --- xen/arch/arm/gic-v3.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c index 17ff85ef5d..acdac22953 100644 --- a/xen/arch/arm/gic-v3.c +++ b/xen/arch/arm/gic-v3.c @@ -764,9 +764,6 @@ static void __init gicv3_dist_init(void) type =3D readl_relaxed(GICD + GICD_TYPER); nr_lines =3D 32 * ((type & GICD_TYPE_LINES) + 1); =20 - if ( type & GICD_TYPE_LPIS ) - gicv3_lpi_init_host_lpis(GICD_TYPE_ID_BITS(type)); - /* Only 1020 interrupts are supported */ nr_lines =3D min(1020U, nr_lines); gicv3_info.nr_lines =3D nr_lines; @@ -1990,6 +1987,17 @@ static int __init gicv3_init(void) res =3D gicv3_its_init(); if ( res ) panic("GICv3: ITS: initialization failed: %d\n", res); + + /* + * Host LPI allocation uses ITS-derived memory attributes, so defe= r it + * until after gicv3_its_init() has discovered ITS workarounds. + */ + if ( gicv3_its_host_has_its() ) + { + res =3D gicv3_lpi_init_host_lpis(intid_bits); + if ( res ) + panic("GICv3: LPI initialization failed: %d\n", res); + } } =20 res =3D gicv3_cpu_init(); --=20 2.43.0