From nobody Mon Nov 23 22:31:54 2026 Delivered-To: importer@patchew.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=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1795124284; cv=pass; d=zohomail.com; s=zohoarc; b=hpCMxKYnRUfajxaOEAhFH5WKogjF2+dMjehxjsJXnBL97bM7yFfDe7wp/TKqXZENPkGTSH1iaoIR7fe7Y+gIMniUL1SHxcw6bWDX6GqR4DrWgiAwHGcTzybSpO4RxQtwDRAbTEdbd6pyetWUC8HM/ryGd3YInkctpITarmJOex0= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795124284; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=E3EnGaPxpd0s9M8e/84KgfRDiKt9nPjVP0H5T44Ih1Y=; b=JqZx/Bvu/9fVG6MCmjtlIjfh3byztABkzNWPI/iTyNwm5nNsJusukIZWQK9CiRJaIeCmXjdWZVXazejlOZ9MSqGWrl59PmXW2Pn8o0QJXQOjAK0PrSzti/OlxtkGc8vC3uzkb2qfY7wMIvWBF3ajZ0oriSRReF3du4vB1y/OY44= 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=amd.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 1795124284285603.8446914220332; Thu, 19 Nov 2026 13:38:04 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1497456.1695758 (Exim 4.92) (envelope-from ) id 1xU9p4-0004tb-AD; Thu, 19 Nov 2026 21:37:38 +0000 Received: by outflank-mailman (output) from mailman id 1497456.1695758; Thu, 19 Nov 2026 21:37:38 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xU9p4-0004tU-7I; Thu, 19 Nov 2026 21:37:38 +0000 Received: by outflank-mailman (input) for mailman id 1497456; Thu, 19 Nov 2026 21:37:37 +0000 Received: from mx.expurgate.net ([194.145.224.20]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xU9p3-0004tG-E5 for xen-devel@lists.xenproject.org; Thu, 19 Nov 2026 21:37:37 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1xU9p2-009UcD-Qi for xen-devel@lists.xenproject.org; Thu, 19 Nov 2026 22:37:36 +0100 Received: from [10.42.69.8] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6aff6bfc-8faa-0a2a0a5109dd-0a2a4508e95e-42 for ; Thu, 19 Nov 2026 22:37:36 +0100 Received: from [40.107.209.63] (helo=PH8PR06CU001.outbound.protection.outlook.com) by tlsNG-c1860d.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6aff6c1e-f659-0a2a45080019-286bd13fa5d8-3 for ; Thu, 19 Nov 2026 22:37:35 +0100 Received: from CH0PR03CA0395.namprd03.prod.outlook.com (2603:10b6:610:11b::12) by SA1PR12MB999109.namprd12.prod.outlook.com (2603:10b6:806:4a1::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.615.14; Thu, 19 Nov 2026 21:37:31 +0000 Received: from BN2PEPF0000A800.namprd02.prod.outlook.com (2603:10b6:610:11b:cafe::6c) by CH0PR03CA0395.outlook.office365.com (2603:10b6:610:11b::12) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.615.13 via Frontend Transport; Thu, 19 Nov 2026 21:37:30 +0000 Received: from satlexmb08.amd.com (165.204.84.17) by BN2PEPF0000A800.mail.protection.outlook.com (10.167.245.167) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.639.5 via Frontend Transport; Thu, 19 Nov 2026 21:37:30 +0000 Received: from Satlexmb09.amd.com (10.181.42.218) by satlexmb08.amd.com (10.181.42.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Thu, 19 Nov 2026 15:37:27 -0600 Received: from satlexmb08.amd.com (10.181.42.217) by satlexmb09.amd.com (10.181.42.218) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Thu, 19 Nov 2026 15:37:26 -0600 Received: from amd.com (10.180.168.240) by satlexmb08.amd.com (10.181.42.217) with Microsoft SMTP Server id 15.2.2562.57 via Frontend Transport; Thu, 19 Nov 2026 15:37:26 -0600 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=amd.com header.i="@amd.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=WATBm+6k/H5aOOpiYP1SWldSTE4GV2weRFiZre4svoYx2fnl+0MQtwhGqz79PEW3A9r8+H3MmWhQAtP9M9p6ni6bClTNNRHmjfJ22L9WOGWFsaXN8G8F6++g89M3HVp74F+MMtzFNH/delUtQ+ehsfp6xP8jM+KjafY9IiIjSPmkSJq8BJaierLpOr1ZQ4BppRnCzizdV3sDKHCUZi7meCen6MT63DE82VC2eoNun88KJCHI1rbQxdCN4CW2GBj6tfCVLA9Hpf48EvKfXHXGtr3QwPkBNMXTLvAduxnizsg//wXS91HEGPP6cERbt8VawA4s5dCntcbszLS7cL0Mnw== 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=E3EnGaPxpd0s9M8e/84KgfRDiKt9nPjVP0H5T44Ih1Y=; b=SqdVFATTbUt+2HMN/RG1Cq0rL+q68i7l68Go0ZQYg6numW/meF5QHnJYtCbOWHxNcxydJ8RV27SLaCYUtF0+4gnwZLfQdo+RpGM7UhUHw3kcE354+r9o9H2REVg+JW3VAO8YeR1w89lZPlSTpssqtMSqHhVRVBt8rUQ0TXyA6IPqVkPu+bYhZNka2nydOeiBVJwAC4F4DSqU+dfFdP7Xzf6C+rcZZWtq2Uoy6ZmuAX5BdvLZJhoam2+7X4aprvW71WtjZ12Fg9F99exss/OoZRhbxTiVI+a8hmJU6Jpmenxu/Qj62Vb3tam1211OxQrdtvJLQBiy7PZ8Y3EZ2e9BpA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=E3EnGaPxpd0s9M8e/84KgfRDiKt9nPjVP0H5T44Ih1Y=; b=0X1n9Ra1cd9C/OdvCXgsbseNl+YC1nPlW3VeuSTW4E7Ocw5i2OsrWbyDZBvg2he3Gx85gnB2gKrvzB+sF5yTmgZ8sXIMSzpfeLFSE+QX/C+DCNuKiefF03PKVR1w+wJiTr06Z/CAB0+YimMHuCwXeoiw5dM0WkbDJhOJDj2URYQ= X-MS-Exchange-Authentication-Results: mx.microsoft.com 1; spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; 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 (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb08.amd.com; pr=C From: Stefano Stabellini To: CC: , Julien Grall , "Bertrand Marquis" , Michal Orzel , Volodymyr Babchuk Subject: [PATCH] xen/arm: vpl011: reserve the virq before setting up the backend Date: Thu, 19 Nov 2026 13:37:22 -0800 Message-ID: <20261119213722.4174845-1-stefano.stabellini@amd.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN2PEPF0000A800:EE_|SA1PR12MB999109:EE_ X-MS-Office365-Filtering-Correlation-Id: 03853496-661d-46ca-a7c9-08df46855088 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700016|82310400026|23010399003|1800799024|376014|18002099003|261009223027099003|261102123227099003|261026140227099003|261026121527099003|11063799006|56012099006|261028144727099003|261021121427099003|261022105027099003|261021123027099003|10067099003; X-Microsoft-Antispam-Message-Info: 4/nALxyKzgwEKJgMUdsO3BXuhFWXzf30wY/1xS9Wen7jY6j5YpXYqhgKCTXOaVyCCAi3irXMOBAZza2Ifky225YsFSCnGOCALpAWjYKdFLSeMtDG56qWZIC71ZtPBrZmsK+Y0FOiSvO6Gd9N6PhROruKYQ2RPjeeymhgndEVL4i6QgfBwX8Nw2/5m4xRubmywwJZlfnWvPC0njrWyUgVRx4mgjJUIr/myjzlHxDJkJTWurqXY08QR97I5KuY2SqPC9z0STpeLaUlx6nf3JN3GJWMLevODCbo2DBWW/4VWHQ1iLfYTcED99utoRH3KxrpAUvK1aUsmjrf6ZupZtTFOy37fOoYMfwBzpZLBzGRaFn+VifXi0sovkSEGjpNuNUMUNTop17PCB3R+v50CjRADHumrIj6Fp+/Wc0a7TIZhxrs0XU6dp+CQTJU781EibYii7aV1HQaWsXBeyAz3zmFuQCwFj9NdnxAI1iLg2oa7svelC6kYbehOc94yF/PwGhX8gwtf1x65Aj4EHgXea+OwMbr01LN0Y95xy0sMdx9j4IWFmd/rZtiSrnqRKzP5LFfNojSz21vGvIZL5v6IKC3O7OVUr8UbyXWKg7XQAq37DfWbYWEO0PAAqDF3yiQaGnDE6nqIy0rgWFEX0Yuh1wpO3YHUBM490KrHgf7fEGQJdHTSjMmZfD354wLB1b77BFVizr7GMzI+8AvLJqS+zDNnw== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb08.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700016)(82310400026)(23010399003)(1800799024)(376014)(18002099003)(261009223027099003)(261102123227099003)(261026140227099003)(261026121527099003)(11063799006)(56012099006)(261028144727099003)(261021121427099003)(261022105027099003)(261021123027099003)(10067099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ReLgidmOnrelHRMUzfNq3LiH9AqDqvueMROCHhHFVySPGA75DX7VCDYplRnwlrTyKHx+IJKSKiNmhTyLP488SBXVWKpOVRwYyHVk2A40VBFfOQb1XqVkLInJaYuXmZmsWOdemJC2LifSt+0Am6ajYlIudDzvWwqgbI65Ni9491K+lPKxtuCzEDKso56yBShvtHMFlFJ1XdUTrmNnjrbmZK61BKjoFI/4Vr8El97aRLgwKPphnHgP9W6v2FEDOEbx/1pZNgfKBuYvDdq9+kDyr2F1+A65p5yw6iYpSVyn/HOw3CzR9zrGFvcUlt/F59ow78v2LtkghmUYkSGb5b8iyMKgaeRShSSY+1jfn68eQ+kL2ALsx9UEgDnmGsj6ygaUAMZNJU1anGxunszljpvqWYetBHMNPq8frTQL7KO1AqNBPNu2RxFxly1vrYuJQCNp X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Nov 2026 21:37:30.5183 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 03853496-661d-46ca-a7c9-08df46855088 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb08.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN2PEPF0000A800.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB999109 X-purgate-ID: tlsNG-c1860d/1795124256-D514E87B-08573544/0/0 X-purgate-type: clean X-purgate-size: 2843 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1795124285576158501 Content-Type: text/plain; charset="utf-8" domain_vpl011_init() allocates the backend event channel before it reserves the virq and records it in vpl011->virq. A notification sent on that port in between runs vpl011_update_interrupt_status() with vpl011->virq still 0. With CONFIG_NEW_VGIC this calls vgic_inject_irq(d, NULL, 0, ...), and vgic_get_irq() dereferences the NULL vcpu to look up the private interrupt 0. The same notification also takes vpl011->lock and updates vpl011->uartfr before either is initialised, and both are then reset under it. Reserve and record the virq, set the initial flags and initialise the lock first, before any backend is set up, so that they are valid by the time the event channel exists. All the failures after the reservation now go through domain_vpl011_deinit(), which releases the virq. Fixes: ca0637a147af ("xen/arm: vpl011: Add SBSA UART emulation in Xen") Fixes: 85da01b71312 ("xen/arm: vpl011: record the virq only once it is rese= rved") Signed-off-by: Stefano Stabellini --- CC: Julien Grall , CC: Bertrand Marquis , CC: Michal Orzel , CC: Volodymyr Babchuk xen/arch/arm/vpl011.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/xen/arch/arm/vpl011.c b/xen/arch/arm/vpl011.c index a37e88a8b4..b1d286e1d1 100644 --- a/xen/arch/arm/vpl011.c +++ b/xen/arch/arm/vpl011.c @@ -689,6 +689,14 @@ int domain_vpl011_init(struct domain *d, struct vpl011= _init_info *info) virq =3D GUEST_VPL011_SPI; } =20 + if ( !vgic_reserve_virq(d, virq) ) + return -EINVAL; + vpl011->virq =3D virq; + + vpl011->uartfr =3D TXFE | RXFE; + + spin_lock_init(&vpl011->lock); + /* * info is NULL when the backend is in Xen. * info is !=3D NULL when the backend is in a domain. @@ -708,7 +716,7 @@ int domain_vpl011_init(struct domain *d, struct vpl011_= init_info *info) rc =3D alloc_unbound_xen_event_channel(d, 0, info->console_domid, vpl011_notification); if ( rc < 0 ) - goto out1; + goto out; =20 vpl011->evtchn =3D info->evtchn =3D rc; } @@ -725,26 +733,14 @@ int domain_vpl011_init(struct domain *d, struct vpl01= 1_init_info *info) } } =20 - if ( !vgic_reserve_virq(d, virq) ) - { - rc =3D -EINVAL; - goto out1; - } - vpl011->virq =3D virq; - - vpl011->uartfr =3D TXFE | RXFE; - - spin_lock_init(&vpl011->lock); - register_mmio_handler(d, &vpl011_mmio_handler, vpl011->base_addr, GUEST_PL011_SIZE, NULL); =20 return 0; =20 -out1: +out: domain_vpl011_deinit(d); =20 -out: return rc; } =20 --=20 2.47.3