From nobody Thu Oct 30 22:58:55 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=1752675536; cv=pass; d=zohomail.com; s=zohoarc; b=de4WVjCV/e21YMz1Co36JMvte3u6eXPYGAcR3TxGwAnssplGOCaUuG1q37eW6SiaSKGP7iG2s90WR2GVztX/ke07txCzFLA/F9CoKUDzWLX0eDbHc/nCFYlSeAVJi5ERoU0zkWVipU8hUskxRpfg/Xzm1wf4BKKjWPXz9bCXpbQ= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1752675536; 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=x+dS+gGFYh+0y0l5HzA5QO+FaghGWW+JGVVzEqQoMVE=; b=jYpZJUQgwInTMDL1afSHVazG+porfU9p2xMlXv3K8/qCt9uk+5jpaM0jLDI7CdbPpI3sujQEfUJPYNdzXZRfJCTRkyAjWRoBTLO+Ftoau8Y/IiCLmzyowg+lc46rgDdPqUW+whzf/Aka4n+MxubpG2viZCsadpFpKmyqAL68/I4= 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 175267553633815.89817793343866; Wed, 16 Jul 2025 07:18:56 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1045277.1415362 (Exim 4.92) (envelope-from ) id 1uc2xr-0002cN-IF; Wed, 16 Jul 2025 14:18:31 +0000 Received: by outflank-mailman (output) from mailman id 1045277.1415362; Wed, 16 Jul 2025 14:18:31 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uc2xr-0002cG-FS; Wed, 16 Jul 2025 14:18:31 +0000 Received: by outflank-mailman (input) for mailman id 1045277; Wed, 16 Jul 2025 14:18:30 +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 1uc2xq-0002cA-Ai for xen-devel@lists.xenproject.org; Wed, 16 Jul 2025 14:18:30 +0000 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2061c.outbound.protection.outlook.com [2a01:111:f403:2413::61c]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id bc7c3d4b-624f-11f0-b894-0df219b8e170; Wed, 16 Jul 2025 16:18:27 +0200 (CEST) Received: from PH7P221CA0060.NAMP221.PROD.OUTLOOK.COM (2603:10b6:510:33c::16) by PH8PR12MB6746.namprd12.prod.outlook.com (2603:10b6:510:1c1::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8922.25; Wed, 16 Jul 2025 14:18:21 +0000 Received: from CO1PEPF000044FC.namprd21.prod.outlook.com (2603:10b6:510:33c:cafe::3b) by PH7P221CA0060.outlook.office365.com (2603:10b6:510:33c::16) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8943.19 via Frontend Transport; Wed, 16 Jul 2025 14:18:21 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1PEPF000044FC.mail.protection.outlook.com (10.167.241.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8964.1 via Frontend Transport; Wed, 16 Jul 2025 14:18:20 +0000 Received: from xcbagarciav01.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 16 Jul 2025 09:18:18 -0500 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: bc7c3d4b-624f-11f0-b894-0df219b8e170 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kKDiZ+WRHQqnuPVhVXelNqnTcaZKQPChi2HDTBQ0XZkD/NGsNlupHNjrxvxPouZFV0q0D3N4+GxnXIabLOXeMx3MoqxWunlGI10QBTykus9FMdtLOX5oSpzIG8eoIAjX+2NTw0ZP8q4yjtCLtNCaUEtaZOqtFJaSjHqATea7yCfwzbnLimG7ljQo1fFbv+oSRDcjVQXcFRFeIIpx3Nbp4/BGFvDFZeFGcJlYMbOJA10o5kuRxfkRiQp0HmObdB7wKGNJE31CqFsl/fBzLWIPJPgSal0aQ8Cscz4hGAFsuHGpt+BZPegD6FEohwBhkXB8zxghImXQHSmGicw3Bgfxtg== 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=x+dS+gGFYh+0y0l5HzA5QO+FaghGWW+JGVVzEqQoMVE=; b=hPTlSadmNiu/RjgcgeSgRyUTnlivdPwKn+aPoBn2jl7/SUhXt6qJseIakOTihaeNaWthyInYct8OM3Ae4g0yTTnP4WauSPA7Oa19QXXdF7PYfdhWxfe8htUQG3tW+kOlhytUFH62I4qToctLjCzvg4dA33VFLDej7bTXFZWRkCZGn+/pKTeMG5O71+C8r7x/FOWpKPCAhQ7H97TSPaJT/iJcuoOxpqriF04wB6JKDJ1+oaTCh/5EvRGammOxiOq0jnLCE/cZWNgBP8sVUIIUphOfZGgvdq+B6xUgy2MHGKCxe0Cs+c1TFpwRP50kNXRyx3uEWqIagwjYFQ/nSIpiNw== 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=x+dS+gGFYh+0y0l5HzA5QO+FaghGWW+JGVVzEqQoMVE=; b=AA6KOIBzxWwtV4GziNpgQQ4lVv5Zohn738cbNmUCnYjQ/cfIcHC/QwBYJ9eS6op6N4zJjPdH1p5lmVzUfCEpnxTLwpUGAaEfNGF53Ex9kcxenMlEKNRCazqc/3qfunoLMD92MSysk2pB56vULo8sMug5XX7gTDtjvgh78XTQGQo= 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=SATLEXMB04.amd.com; pr=C From: Alejandro Vallejo To: CC: Alejandro Vallejo , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH] x86: Prefer d->max_vcpus to dom0_max_vcpus() Date: Wed, 16 Jul 2025 16:18:03 +0200 Message-ID: <20250716141807.52585-1-alejandro.garciavallejo@amd.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044FC:EE_|PH8PR12MB6746:EE_ X-MS-Office365-Filtering-Correlation-Id: c3f4af9a-97ce-47a5-f2a5-08ddc4739dd4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|82310400026|1800799024|376014|13003099007; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?SioekIWVqt4mz2suwB+/IY47RPLPQJVtO+iGWt3Ahs6xJNNmFFkq6kuID5ku?= =?us-ascii?Q?w3Ef0ygfZ0dPVr5i0yol3qnE6hej9iSOwie3WpIkIyy8/GICqJF8y4xOqH1V?= =?us-ascii?Q?BWEpYLMMpr5k84w3gVhA4wIyPXnZPQNr29wzwgJD74Rzy5aKROD16fgfLgqS?= =?us-ascii?Q?9NFRjQR4W06eS5kCVoEg1FVCOe0nI9UBcMuDHHbWkYd6CkU7GvfEp7FIgPgd?= =?us-ascii?Q?j53XcCx7fIWSzBPomwzlaG3kQO/hb9/UaE5rYjppgiuQ7QVpDIB2Jf4XOkA1?= =?us-ascii?Q?n8E3sO+lD87hxs2Lajs8Hr3neET4NsUUWLcCGO/G6tqbg2UU+qR4rjiP/vNZ?= =?us-ascii?Q?QJ0uFBLkQg/TCRJvbXNuX/9w9bdJSK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LpdzaDO+QkhkD2569PLDHWLn3YTuL9v0P2MRRWuw1NFFWxnR1W1G?= =?us-ascii?Q?StD05gyJXeSNpOWzQfki7MTF3N5PV07hUSXE3h1u7poXB+llkL8xwwTCUCpf?= =?us-ascii?Q?mEHnVIohJl2WaSZJ9JcCoacMAFCF7OQGBad4UiDQStuFlwxQORn+dWYSoURF?= =?us-ascii?Q?zns45N2IFjf6B6dnG3350dZ9IwIUDJH2mxDQFjLFCBKs7w22CBrXiCEwx+Tg?= =?us-ascii?Q?j5yKflNwVOMsyCSrFgaztUp/wV84MX7BC23m?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(82310400026)(1800799024)(376014)(13003099007);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jul 2025 14:18:20.3389 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c3f4af9a-97ce-47a5-f2a5-08ddc4739dd4 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=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000044FC.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB6746 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1752675538197116600 Content-Type: text/plain; charset="utf-8" These days d->max_vcpus is populated on domain_create(), so use that instea= d and avoid a function call. Signed-off-by: Alejandro Vallejo Reviewed-by: Jan Beulich Reviewed-by: Jason Andryuk --- pipeline: https://gitlab.com/xen-project/people/agvallejo/xen/-/pipelines/1= 930259234 --- xen/arch/x86/hvm/dom0_build.c | 7 +++---- xen/arch/x86/io_apic.c | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c index a038e58c11..9964068387 100644 --- a/xen/arch/x86/hvm/dom0_build.c +++ b/xen/arch/x86/hvm/dom0_build.c @@ -890,19 +890,18 @@ static int __init pvh_setup_acpi_madt(struct domain *= d, paddr_t *addr) struct acpi_madt_local_x2apic *x2apic; acpi_status status; unsigned long size; - unsigned int i, max_vcpus; + unsigned int i; int rc; =20 /* Count number of interrupt overrides in the MADT. */ acpi_table_parse_madt(ACPI_MADT_TYPE_INTERRUPT_OVERRIDE, acpi_count_intr_ovr, UINT_MAX); =20 - max_vcpus =3D dom0_max_vcpus(); /* Calculate the size of the crafted MADT. */ size =3D sizeof(*madt); size +=3D sizeof(*io_apic) * nr_ioapics; size +=3D sizeof(*intsrcovr) * acpi_intr_overrides; - size +=3D sizeof(*x2apic) * max_vcpus; + size +=3D sizeof(*x2apic) * d->max_vcpus; =20 madt =3D xzalloc_bytes(size); if ( !madt ) @@ -942,7 +941,7 @@ static int __init pvh_setup_acpi_madt(struct domain *d,= paddr_t *addr) } =20 x2apic =3D (void *)io_apic; - for ( i =3D 0; i < max_vcpus; i++ ) + for ( i =3D 0; i < d->max_vcpus; i++ ) { x2apic->header.type =3D ACPI_MADT_TYPE_LOCAL_X2APIC; x2apic->header.length =3D sizeof(*x2apic); diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c index 84bd87a5e4..1816e1c0b9 100644 --- a/xen/arch/x86/io_apic.c +++ b/xen/arch/x86/io_apic.c @@ -2758,7 +2758,7 @@ unsigned int __hwdom_init arch_hwdom_irqs(const struc= t domain *d) else { if ( !d->domain_id ) - n =3D min(n, dom0_max_vcpus()); + n =3D min(n, d->max_vcpus); n =3D min(nr_irqs_gsi + n * NR_DYNAMIC_VECTORS, max_irqs); } =20 base-commit: dff462313fe0bfa273c54ffc9bff71f054c365af --=20 2.43.0