From nobody Sun Sep 14 05:14:48 2025 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=1757696512; cv=pass; d=zohomail.com; s=zohoarc; b=OfH9B0B5jpPMLnJvq2OimiJ2qEQerRhwbbXnxPljinCJ2JZMGVULsG8P0/p8gjYr2ApepivDKsUxWgc4ESXgePtHgoIc13W+aJgi5MYoxY8pI/yaoDdtDA6Jc78YPiI5aVKoh5bny5lmbINpqu9VvhtWk23/5oHfPUt5dGsn0nM= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1757696512; 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=27DHt0J20Pg2g97L+tvBsc3Z3ZrT3sGO/+bEzgDSuu0=; b=DlUEeaUuJopxLpe2czGCD2pS32gHFKEkaQyQTJTJBQJUR6VZaIyoUwFEaeAKIiS47iQq/uVRgVxxSNsuJVCTX9y4PFz9SgsRTiAbSwmyDpaUi3ja2fHsy+rV6fHfn1iOn+KID0+dHs1DNgOTtuhX9EAS+X2tutDDJfrbxZBFQRI= 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 1757696511880872.8596946947974; Fri, 12 Sep 2025 10:01:51 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1122363.1466108 (Exim 4.92) (envelope-from ) id 1ux79I-0004kM-13; Fri, 12 Sep 2025 17:01:24 +0000 Received: by outflank-mailman (output) from mailman id 1122363.1466108; Fri, 12 Sep 2025 17:01:24 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ux79H-0004kF-Ua; Fri, 12 Sep 2025 17:01:23 +0000 Received: by outflank-mailman (input) for mailman id 1122363; Fri, 12 Sep 2025 17:01:23 +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 1ux79G-0004k9-V9 for xen-devel@lists.xenproject.org; Fri, 12 Sep 2025 17:01:23 +0000 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2060c.outbound.protection.outlook.com [2a01:111:f403:2417::60c]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 18682c2d-8ffa-11f0-9809-7dc792cee155; Fri, 12 Sep 2025 19:01:17 +0200 (CEST) Received: from BYAPR07CA0072.namprd07.prod.outlook.com (2603:10b6:a03:60::49) by SJ5PPFABE38415D.namprd12.prod.outlook.com (2603:10b6:a0f:fc02::99e) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9094.22; Fri, 12 Sep 2025 17:01:13 +0000 Received: from SJ1PEPF00001CE0.namprd05.prod.outlook.com (2603:10b6:a03:60:cafe::fc) by BYAPR07CA0072.outlook.office365.com (2603:10b6:a03:60::49) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9115.17 via Frontend Transport; Fri, 12 Sep 2025 17:01:13 +0000 Received: from satlexmb07.amd.com (165.204.84.17) by SJ1PEPF00001CE0.mail.protection.outlook.com (10.167.242.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9115.13 via Frontend Transport; Fri, 12 Sep 2025 17:01:12 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.17; Fri, 12 Sep 2025 10:01:12 -0700 Received: from satlexmb07.amd.com (10.181.42.216) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 12 Sep 2025 12:01:08 -0500 Received: from xcbayankuma40.xilinx.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server id 15.2.2562.17 via Frontend Transport; Fri, 12 Sep 2025 10:01:08 -0700 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" X-Inumbo-ID: 18682c2d-8ffa-11f0-9809-7dc792cee155 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=czQP1mDVyw//DwTw0gsdKPcX/M8VueT06XAsl58hWm/ccwnNczArLR9fIhE+AI/HoZ4hls/q5Rzz2TfGfXR+8NZ6G/mRAhu8HElatXMQORPw7emA5USN7pmeJNsYU1KtkNjI/4ye4nBwFkso/fljeRYo3t/8usuSEsZiWbbEKh8FqZ94N9d2LUwqRtClU6RvL4HXTra4Mnh9KO+I4G+VDysIhDYLSlsVgHVIp2jKOEmfdA6c4poomALbfjqCqvS1sJHlwhglchXvnKeeC0h06VvvyDFCtuwjwTa/YoFmK03ePoctIO9q2KVyrcdVS2o9Skwtb5vo/TKrEhQocxiBow== 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=27DHt0J20Pg2g97L+tvBsc3Z3ZrT3sGO/+bEzgDSuu0=; b=BXCMxPegprTnkbJbnijbQuUQLElrFdI+7vyzjCqgbq4AjDu5cv0H6duG0tGDs9x+F3sg8sJwwpAVHTPw7Kz/cjJ8p7R3QTQuD95LhHF2wT59quT7PJk8QZirc2zPjuTL4DbmVY+9bL6TJ9wcfHhEr7AyKYYxWCnpfR2x5emHrKwqNjrJxzSM4trL2uhUs41Vfz2VPREHGjMDpyAY7AyZTjYoFkcbw0ishHpqkqDtQOhaE6YoNMObxjl2l6gDKuiYM9LydDJv0rW5WspoDAJ+4rQ61utP++6xcohXT3gmzbs0Mp6QuhOPAxp7+J4FySU03/m4xMlflx8Md31zBZQHJg== 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=27DHt0J20Pg2g97L+tvBsc3Z3ZrT3sGO/+bEzgDSuu0=; b=OgpIuw9CThUbwvkOmQg3Qjki6FErwFqL1FhOP1V1TTV9yfdjnRJHPZOmNQcRK1jOhyHxZ7ckii8gH13b5a31qMBkpI19BO1S5NnaXCqsAQLsAzOjhfYJ0GLLLD4RIkwVHetXSlSikMMd6Ds2vWNe68jegM83tLOfSYrWDK1bzrY= X-MS-Exchange-Authentication-Results: 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=satlexmb07.amd.com; pr=C From: Ayan Kumar Halder To: CC: Ayan Kumar Halder , Stefano Stabellini , Julien Grall , Michal Orzel , Bertrand Marquis , Volodymyr Babchuk Subject: [RFC PATCH] xen/arm: Introduce GICV3 Self Tests Date: Fri, 12 Sep 2025 18:00:55 +0100 Message-ID: <20250912170055.3077923-1-ayan.kumar.halder@amd.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: None (SATLEXMB05.amd.com: ayan.kumar.halder@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00001CE0:EE_|SJ5PPFABE38415D:EE_ X-MS-Office365-Filtering-Correlation-Id: f37914e5-8547-4824-6da1-08ddf21dfab3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?jXbOJodezbuQVtmM8LOgO3tveVoqKNwpK5pZJqc5V/rCH8vqCh6++7Feym70?= =?us-ascii?Q?lcxMaNW9X1xUaiXGmC5P/5GRCbhH834Cj+HdSeN3vkxuKgs+Xs6lDcm7kGpM?= =?us-ascii?Q?8m4wggzGUgX9i355rncAZDiO2aCEiT1ZmYjPZMXKvsr3Cr8auoT9sfg8tDX1?= =?us-ascii?Q?gAiJVH9Nbiel68xuw85trIjgB2IgShFT947653p/fniNWR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vYZpd39uFPtCUY6k5Qy7pjXJEufeYmdYpicrb/1oQkhu+jiQZz?= =?us-ascii?Q?KgcKiQTRyo6mah5O91t9+ElHKkC3aRcOYByalknCYsouJMsewo+daSOrITND?= =?us-ascii?Q?/nqlwx3V/75uDsqbdKLkT6fvyZa+AH2XIiZqATV++2EnTAnW9Vz+z0AUnAHk?= =?us-ascii?Q?oZ7e36bXYbNxvXCoXmbCE2up/SN9XRJQ5/6l/4DMf91AoV5HjqVYdeCDKScA?= =?us-ascii?Q?oqR6Q6OMNWRxMBdefJvpXDMkxnnIu5K1grxFXDmr5RjTJpAbcjsL0K2U0XRb?= =?us-ascii?Q?e0AFg+bnR6Tu/ggd9jTOv4BldVWFs+DarOD/Y+xDG5Q0r7EI8zA8si+OcbiO?= =?us-ascii?Q?VqPBYVGCSyxma0KK8My2V1NIFvjCmhpYFi0o8CfGFOr3YbNlg+YT7u98KKLN?= =?us-ascii?Q?5tFsY10Y8bmMSi3fIP45WZ7nWyXiz1r/jqRi?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(36860700013)(376014)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Sep 2025 17:01:12.9171 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f37914e5-8547-4824-6da1-08ddf21dfab3 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=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ1PEPF00001CE0.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ5PPFABE38415D X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1757696514750116600 Content-Type: text/plain; charset="utf-8" Introduce CONFIG_GICV3_SELFTEST to enclose tests for GICv3 driver. Test that Xen is able to generate SGIs. Signed-off-by: Ayan Kumar Halder --- One of the aim of functional safety is to test hw/sw interface. This means = that Xen is able to configure the hardware correctly for the desired functionali= ties. Normally this is tested from the VMs. For eg if a VM is able to receive irq= , this implies that Xen has configured the GICv3 interface 'correctly'. However th= is is a high level (or integration) test which uses not only the GICv3 interface between Xen and VM, but the interrupt injection code for Xen to VMs. We want to have some kind of unit tests to check that Xen is able to receive various interrupts, set priorities, etc. Here, we have written unit tests f= or software generated interrupts (SGIs) as example. These tests are expected to be triggered as Xen boots (right after Xen has initialised the GICv3 interface ie gicv3_init(). The aim of this test is to check whether Xen can trigger SGIs after gicv3_init() is invoked. If so, we= can claim that gicv3_init() was done properly to be able to trigger SGIs. Likew= ise we will have tests to check for priorities, SPIs, etc. A script will parse the logs and claim that Xen is able to trigger SGIs. xen/arch/arm/Kconfig | 8 ++++++++ xen/arch/arm/gic-v3.c | 7 +++++++ xen/arch/arm/gic.c | 21 +++++++++++++++++++++ 3 files changed, 36 insertions(+) diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig index 950e4452c1..739f99eaa9 100644 --- a/xen/arch/arm/Kconfig +++ b/xen/arch/arm/Kconfig @@ -73,6 +73,14 @@ config GICV3 Driver for the ARM Generic Interrupt Controller v3. If unsure, use the default setting. =20 +config GICV3_SELFTEST + bool "GICv3 driver self test" + default n + depends on GICV3 + ---help--- + + Self tests to validate GICV3 driver. + config HAS_ITS bool "GICv3 ITS MSI controller support (UNSUPPORTED)" if UNSUPPORT= ED depends on GICV3 && !NEW_VGIC && !ARM_32 diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c index 4e6c98bada..eb0c05231c 100644 --- a/xen/arch/arm/gic-v3.c +++ b/xen/arch/arm/gic-v3.c @@ -1818,6 +1818,13 @@ static int __init gicv3_init(void) =20 gicv3_hyp_init(); =20 +#ifdef CONFIG_GICV3_SELFTEST + send_SGI_self(GIC_SGI_EVENT_CHECK); + send_SGI_self(GIC_SGI_DUMP_STATE); + send_SGI_self(GIC_SGI_CALL_FUNCTION); + send_SGI_self(GIC_SGI_MAX); +#endif + out: spin_unlock(&gicv3.lock); =20 diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c index d922ea67aa..5cb58cdb92 100644 --- a/xen/arch/arm/gic.c +++ b/xen/arch/arm/gic.c @@ -346,6 +346,26 @@ static void do_sgi(struct cpu_user_regs *regs, enum gi= c_sgi sgi) */ smp_rmb(); =20 +#ifdef CONFIG_GICV3_SELFTEST + switch (sgi) + { + case GIC_SGI_EVENT_CHECK: + printk("GIC_SGI_EVENT_CHECK received\n"); + break; + case GIC_SGI_DUMP_STATE: + printk("GIC_SGI_DUMP_STATE received\n"); + break; + case GIC_SGI_CALL_FUNCTION: + printk("GIC_SGI_CALL_FUNCTION received\n"); + break; + case GIC_SGI_MAX: + printk("GIC_SGI_MAX received\n"); + break; + default: + panic("Unknown SGI triggered\n"); + break; + } +#else switch (sgi) { case GIC_SGI_EVENT_CHECK: @@ -361,6 +381,7 @@ static void do_sgi(struct cpu_user_regs *regs, enum gic= _sgi sgi) panic("Unhandled SGI %d on CPU%d\n", sgi, smp_processor_id()); break; } +#endif =20 /* Deactivate */ gic_hw_ops->deactivate_irq(desc); --=20 2.25.1