From nobody Fri Oct 31 03:46:11 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=1752595919; cv=pass; d=zohomail.com; s=zohoarc; b=d1fn2VVCymwlnuvGkFq6QDEA6jkAT6csqNZxW4MXvklD0uhv9Jj/e4lP3ctDLIOod67qcdQVp8VlNPdDfNBzZoXlWlpnfrwTu1NZ8VLj5eDmwM3RYoj2e6FMZM79/3zmBZQoFvQw5+N42dI/gs26X8C0XV723tyz8cCtOZmrN3o= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1752595919; 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=Cj9ecfRi3wea8GYLDn4MfPfXO+gyvn4szkN32kHXyzE=; b=jm8b8ybwEOI7pojj/Hy2xHP25BsDs6AACfAb6OllOjYhZP2A/5K8PD5kM+/cU1bmyObv3MqXLwRPXUqa9LaRNFoqW4le2gfCwR8+UMKk8MwB4/2dH+a4cwTDJTSoTBm7N6ved5R0THe6P1GKU17UqZ5iLNv5sUMN/jDzmrU2viU= 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 1752595919965323.6849762126973; Tue, 15 Jul 2025 09:11:59 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1044526.1414627 (Exim 4.92) (envelope-from ) id 1ubiFr-0006M0-E5; Tue, 15 Jul 2025 16:11:43 +0000 Received: by outflank-mailman (output) from mailman id 1044526.1414627; Tue, 15 Jul 2025 16:11:43 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ubiFr-0006Lr-A6; Tue, 15 Jul 2025 16:11:43 +0000 Received: by outflank-mailman (input) for mailman id 1044526; Tue, 15 Jul 2025 16:11:41 +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 1ubiFp-0005t5-Nv for xen-devel@lists.xenproject.org; Tue, 15 Jul 2025 16:11:41 +0000 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2062b.outbound.protection.outlook.com [2a01:111:f403:2418::62b]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 634235fb-6196-11f0-b894-0df219b8e170; Tue, 15 Jul 2025 18:11:39 +0200 (CEST) Received: from SJ0P220CA0014.NAMP220.PROD.OUTLOOK.COM (2603:10b6:a03:41b::22) by BN3PR12MB9570.namprd12.prod.outlook.com (2603:10b6:408:2ca::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8922.32; Tue, 15 Jul 2025 16:11:36 +0000 Received: from CO1PEPF000075F1.namprd03.prod.outlook.com (2603:10b6:a03:41b:cafe::d2) by SJ0P220CA0014.outlook.office365.com (2603:10b6:a03:41b::22) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8943.17 via Frontend Transport; Tue, 15 Jul 2025 16:11:35 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1PEPF000075F1.mail.protection.outlook.com (10.167.249.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8922.22 via Frontend Transport; Tue, 15 Jul 2025 16:11:34 +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; Tue, 15 Jul 2025 11:11:32 -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: 634235fb-6196-11f0-b894-0df219b8e170 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=EyFBYbcvr+IaY2UZUG9TdXvXOJrNUTVCUpz3J/wWtJyU0z525MlutNKFLv4tu3UJUIi2oCWRR3TNg1ATvHRuy5zkgAZ8qU1xQB0En0GlbqdhhfaLtxbD8Uoa7mclsyCVXHe87d1Wt7Vaws99LVWwQVQsxYOYjeDvXLuyWhx7n+NJbo259IIJDpd6EDAl8HWtH+74fUQyl4nOLQpAQGE9tSDr0G9U3g4+Qn2pUjSmxWsbpX8dS2R+0dfdspwVTcLp0soQe/6vJpqHrqdFY0gh31qmMsNhxSqmYsZVulZngpseDxB+D3ibRR6lExonTiU/Oh74UlqLHpzyd+S0eys4iQ== 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=Cj9ecfRi3wea8GYLDn4MfPfXO+gyvn4szkN32kHXyzE=; b=gtgyGbARM4wWULgEqgXZziF4VIww8aoNc4JlpNQiT0ejnJD6befjkPhPnIQf6KwHnA3OyRuJbsZ1UJJVuaxal66g5V6sBb1Ycg9ZfPa4X8FGGC1R8bWYiilY4ReL/O1uQ4VMlK6eiD7sxlvAtkFeSRKNlFfQ6HslTB2I0e88tHYf5k/6qoq+SUcjL3MI3Olt5G44IDxNj+ywyDhpOXeTa9eOxQWSJ+kzt/uX6RBUYkPF9KGMUreB/EMZwZud3pwfKwht1etXHs50FyM3J2KyDwfoHuX5YLqKduX0rDTcmDZnSN+oeioPGDz4j3X0CPLC3kLDTcVbA9RYqDAH4cNutw== 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=Cj9ecfRi3wea8GYLDn4MfPfXO+gyvn4szkN32kHXyzE=; b=QDDk5lDvod32jewDF0SxQxWnmz2+6YaPcnEHIr+2Svzas2wPDBOuoHkX9P1WT0xppMMHdmo6nES6HI/3e7WM9Vxt6N/MaHj0ZxLenN/fj7zWpU6vDlSEtUFLzVAo+ZF/6motSyGphhkLcMcwZoRNDPlICWzxeeed2l2m0cHeZ0Q= 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 , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , "Volodymyr Babchuk" , Andrew Cooper , Anthony PERARD , "Jan Beulich" , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , "Daniel P. Smith" Subject: [PATCH v7 02/11] xen: Refactor kernel_info to have a header like boot_domain Date: Tue, 15 Jul 2025 18:10:57 +0200 Message-ID: <20250715161108.141126-3-alejandro.garciavallejo@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250715161108.141126-1-alejandro.garciavallejo@amd.com> References: <20250715161108.141126-1-alejandro.garciavallejo@amd.com> 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: CO1PEPF000075F1:EE_|BN3PR12MB9570:EE_ X-MS-Office365-Filtering-Correlation-Id: 9793de5e-bc43-4241-2c83-08ddc3ba4556 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|36860700013|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?bVTdgv/R8jzoYI1/FWSX5zjBQnZi3QJl2cr3ep2cBB6+19ZD4/XOdUz2jONs?= =?us-ascii?Q?TB9Kdhrzg9c3WdnSrUKacxP5S3DghRb0ALKuQFsI50X7dn/EWnV3bUJ8sxLz?= =?us-ascii?Q?6OIk8+LYc2Wp4Qiw3K1yNh+1CeEmLBvGZ9oAXfEwfkinQUWPjwZBmDhdNzxv?= =?us-ascii?Q?uFYPRHhVtOvJFKKvvMFhXP20FukVguSxL6pHphxXFaOBSa7qTNgZEK3n481y?= =?us-ascii?Q?M66ffax4jrgIAqvh31NZoFnv0Fghos2iB10SorASA6QpayyS3gio4/9KO6gR?= =?us-ascii?Q?Nmks7c5YmxFZGPNSTC1act9vD6ZPYR4nwVkPQjtt2lCePJVNJ1RE4rexj6fu?= =?us-ascii?Q?p8JU0nmgg6EXU5gxexlcKSYTzWeG/B0gduep6I9P40jEhGl3UhzAmTYB/vnO?= =?us-ascii?Q?lBsMR9pEKMEEzqccqRBF6vMznPbfPDqw9U8CS1oreg+oS7JUEWBNnB7nSTBq?= =?us-ascii?Q?73oUDH7CKqevQdskHc+PQmBQlNow9K9xjJjQm/Jv3zjpTG75dF+5JqF0UFGF?= =?us-ascii?Q?hgmIexziEaxUZs08rQIbM0lSL3gJwOTQMSiCPKKTzny1MBDRMAXarxgADRBM?= =?us-ascii?Q?hwhFAazUIBH1v2EhEhgpzQ2zbMZ8oWovq7BAwRVWiU+aWoCr8d0+GBk5ZgJl?= =?us-ascii?Q?fsTpzxqvG1MZNJMWZU8wiM6ZpnB6aeHIab66F6FlD4gbaR+lXtwMXT4IcG6U?= =?us-ascii?Q?W6BW4LEzTemATnfJzFG3Z12r0tUhvh6pJMLBWSyKD7xKCikLU7CJuOClGW8W?= =?us-ascii?Q?L7QiKP+std2P7KUd0T/FXGK7wUfyZdH3T2pt2pSatvvIbvkDppUuLgfRqKf3?= =?us-ascii?Q?THafZLR5SQf9KEH0hptilVQdzUwtjCziXTmYVFcavGQemd7gOP8eUlniinMi?= =?us-ascii?Q?BTxzIKIWn/ZFSf2Z6Tve0CVD9fbZ0NNQq6TiNMlGJIGqpbtkLCQeEFTE4UTg?= =?us-ascii?Q?RoKaQIHlJPt2WoGQDQW9C+0KBI4J+wwFkIJnJjk9A3Nrt5KC70cBi2YiVGHi?= =?us-ascii?Q?m/9kY67cmiPzuzXhjtF244fwTure/V1yoRKmaeA55HWv45OqRb/+AGJYX5X8?= =?us-ascii?Q?CLq4Nk2u6z9glWgotRF0bvoDGQiYZVfaOFlYQI9CxoPjTsrnPR69pQhR6OgK?= =?us-ascii?Q?Y/wOhzwoNFH9kZR6GlQI0K70RExdVq6U/qmJDradQ9f9LyL0bj0s8HS0HwPA?= =?us-ascii?Q?uNB247tpn1GMsv8TS5zzfeJgqRnbrblzzXmihB6Fn7OxK2+kedjVBL9rGacW?= =?us-ascii?Q?cTvbNcNbR6Ma+ch7s3cnoQcNnzCZsKZAGZr0C0hamCM8vWoddQvKAYfrWrlR?= =?us-ascii?Q?jMgznMGGeei9NdsFBwtZwJArYQb21KVYlDnLJpYbyY/UhcbiM/uDC+IIgEmM?= =?us-ascii?Q?xfK7CAUs/Vmahy35PYI880OQYtlpvRzFSXOkAGvUYtYlNINOeWn+pQ4jGE4/?= =?us-ascii?Q?bE1hL0glUL/xQd9yu23onHPBV8563Ts15z5afnAJmmho/jxqK0DJrwK9+Pc7?= =?us-ascii?Q?xbovBF6W64g6wD3Rku6RY3CSBmWliX4YBlMe?= 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)(376014)(7416014)(36860700013)(1800799024)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2025 16:11:34.9625 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9793de5e-bc43-4241-2c83-08ddc3ba4556 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: CO1PEPF000075F1.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR12MB9570 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1752595921194116600 Content-Type: text/plain; charset="utf-8" Create a struct field within kernel_info with the contents common to kernel_info and boot_domain, and define that field in common code. This enables x86 to use that field as-is and drop x86's boot_domain. Note that x86 mutates the module when releasing it, calculating headroom, etc. So they must be made non-const on move. Not a functional change. Signed-off-by: Alejandro Vallejo Reviewed-by: Stefano Stabellini Acked-by: Jan Beulich --- xen/arch/arm/dom0less-build.c | 8 ++++---- xen/arch/arm/domain_build.c | 20 ++++++++++---------- xen/arch/arm/kernel.c | 8 ++++---- xen/common/device-tree/dom0less-build.c | 18 +++++++++--------- xen/common/device-tree/domain-build.c | 20 ++++++++++---------- xen/common/device-tree/kernel.c | 20 ++++++++++---------- xen/include/xen/bootfdt.h | 9 +++++++++ xen/include/xen/fdt-kernel.h | 5 ++--- 8 files changed, 58 insertions(+), 50 deletions(-) diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c index 4b285cff5e..69b9ea22ce 100644 --- a/xen/arch/arm/dom0less-build.c +++ b/xen/arch/arm/dom0less-build.c @@ -32,7 +32,7 @@ static int __init make_gicv2_domU_node(struct kernel_info= *kinfo) int res =3D 0; __be32 reg[(GUEST_ROOT_ADDRESS_CELLS + GUEST_ROOT_SIZE_CELLS) * 2]; __be32 *cells; - const struct domain *d =3D kinfo->d; + const struct domain *d =3D kinfo->bd.d; =20 res =3D domain_fdt_begin_node(fdt, "interrupt-controller", vgic_dist_base(&d->arch.vgic)); @@ -85,7 +85,7 @@ static int __init make_gicv3_domU_node(struct kernel_info= *kinfo) void *fdt =3D kinfo->fdt; int res =3D 0; __be32 *reg, *cells; - const struct domain *d =3D kinfo->d; + const struct domain *d =3D kinfo->bd.d; unsigned int i, len =3D 0; =20 res =3D domain_fdt_begin_node(fdt, "interrupt-controller", @@ -152,7 +152,7 @@ static int __init make_gicv3_domU_node(struct kernel_in= fo *kinfo) =20 int __init make_intc_domU_node(struct kernel_info *kinfo) { - switch ( kinfo->d->arch.vgic.version ) + switch ( kinfo->bd.d->arch.vgic.version ) { #ifdef CONFIG_GICV3 case GIC_V3: @@ -175,7 +175,7 @@ static int __init make_vpl011_uart_node(struct kernel_i= nfo *kinfo) gic_interrupt_t intr; __be32 reg[GUEST_ROOT_ADDRESS_CELLS + GUEST_ROOT_SIZE_CELLS]; __be32 *cells; - struct domain *d =3D kinfo->d; + struct domain *d =3D kinfo->bd.d; =20 res =3D domain_fdt_begin_node(fdt, "sbsa-uart", d->arch.vpl011.base_ad= dr); if ( res ) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 04d3dca38a..edc9a82c15 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -464,8 +464,8 @@ static int __init write_properties(struct domain *d, st= ruct kernel_info *kinfo, int had_dom0_bootargs =3D 0; struct dt_device_node *iommu_node; =20 - if ( kinfo->cmdline && kinfo->cmdline[0] ) - bootargs =3D &kinfo->cmdline[0]; + if ( kinfo->bd.cmdline && kinfo->bd.cmdline[0] ) + bootargs =3D &kinfo->bd.cmdline[0]; =20 /* * We always skip the IOMMU device when creating DT for hwdom if there= is @@ -579,7 +579,7 @@ static int __init write_properties(struct domain *d, st= ruct kernel_info *kinfo, =20 if ( dt_node_path_is_equal(node, "/chosen") ) { - const struct boot_module *initrd =3D kinfo->initrd; + const struct boot_module *initrd =3D kinfo->bd.initrd; =20 if ( bootargs ) { @@ -1461,7 +1461,7 @@ int __init make_timer_node(const struct kernel_info *= kinfo) if ( res ) return res; =20 - if ( !is_64bit_domain(kinfo->d) ) + if ( !is_64bit_domain(kinfo->bd.d) ) res =3D fdt_property_string(fdt, "compatible", "arm,armv7-timer"); else res =3D fdt_property_string(fdt, "compatible", "arm,armv8-timer"); @@ -1473,7 +1473,7 @@ int __init make_timer_node(const struct kernel_info *= kinfo) * It always exposes an active-low level-sensitive interrupt. */ =20 - if ( is_hardware_domain(kinfo->d) ) + if ( is_hardware_domain(kinfo->bd.d) ) { irq[TIMER_PHYS_SECURE_PPI] =3D timer_get_irq(TIMER_PHYS_SECURE_PPI= ); irq[TIMER_PHYS_NONSECURE_PPI] =3D @@ -1522,7 +1522,7 @@ int __init make_chosen_node(const struct kernel_info = *kinfo) { int res; const char *bootargs =3D NULL; - const struct boot_module *initrd =3D kinfo->initrd; + const struct boot_module *initrd =3D kinfo->bd.initrd; void *fdt =3D kinfo->fdt; =20 dt_dprintk("Create chosen node\n"); @@ -1530,9 +1530,9 @@ int __init make_chosen_node(const struct kernel_info = *kinfo) if ( res ) return res; =20 - if ( kinfo->cmdline && kinfo->cmdline[0] ) + if ( kinfo->bd.cmdline && kinfo->bd.cmdline[0] ) { - bootargs =3D &kinfo->cmdline[0]; + bootargs =3D &kinfo->bd.cmdline[0]; res =3D fdt_property(fdt, "bootargs", bootargs, strlen(bootargs) += 1); if ( res ) return res; @@ -1981,7 +1981,7 @@ static int __init construct_dom0(struct domain *d) d->max_pages =3D dom0_mem >> PAGE_SHIFT; =20 kinfo.unassigned_mem =3D dom0_mem; - kinfo.d =3D d; + kinfo.bd.d =3D d; =20 rc =3D kernel_probe(&kinfo, NULL); if ( rc < 0 ) @@ -1993,7 +1993,7 @@ static int __init construct_dom0(struct domain *d) int __init construct_hwdom(struct kernel_info *kinfo, const struct dt_device_node *node) { - struct domain *d =3D kinfo->d; + struct domain *d =3D kinfo->bd.d; int rc; =20 iommu_hwdom_init(d); diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c index e734ec5c1e..48f4b56d0c 100644 --- a/xen/arch/arm/kernel.c +++ b/xen/arch/arm/kernel.c @@ -46,7 +46,7 @@ static void __init place_modules(struct kernel_info *info, paddr_t kernbase, paddr_t kernend) { /* Align DTB and initrd size to 2Mb. Linux only requires 4 byte alignm= ent */ - const struct boot_module *mod =3D info->initrd; + const struct boot_module *mod =3D info->bd.initrd; const struct membanks *mem =3D kernel_info_get_mem(info); const paddr_t initrd_len =3D ROUNDUP(mod ? mod->size : 0, MB(2)); const paddr_t dtb_len =3D ROUNDUP(fdt_totalsize(info->fdt), MB(2)); @@ -152,12 +152,12 @@ static void __init kernel_zimage_load(struct kernel_i= nfo *info) =20 kernel =3D ioremap_wc(paddr, len); if ( !kernel ) - panic("Unable to map the %pd kernel\n", info->d); + panic("Unable to map the %pd kernel\n", info->bd.d); =20 - rc =3D copy_to_guest_phys_flush_dcache(info->d, load_addr, + rc =3D copy_to_guest_phys_flush_dcache(info->bd.d, load_addr, kernel, len); if ( rc !=3D 0 ) - panic("Unable to copy the kernel in the %pd memory\n", info->d); + panic("Unable to copy the kernel in the %pd memory\n", info->bd.d); =20 iounmap(kernel); } diff --git a/xen/common/device-tree/dom0less-build.c b/xen/common/device-tr= ee/dom0less-build.c index 221b875a2f..e950691d1e 100644 --- a/xen/common/device-tree/dom0less-build.c +++ b/xen/common/device-tree/dom0less-build.c @@ -167,18 +167,18 @@ static int __init handle_passthrough_prop(struct kern= el_info *kinfo, return -EINVAL; } =20 - res =3D iomem_permit_access(kinfo->d, paddr_to_pfn(mstart), + res =3D iomem_permit_access(kinfo->bd.d, paddr_to_pfn(mstart), paddr_to_pfn(PAGE_ALIGN(mstart + size - = 1))); if ( res ) { printk(XENLOG_ERR "Unable to permit to dom%d access to" " 0x%"PRIpaddr" - 0x%"PRIpaddr"\n", - kinfo->d->domain_id, + kinfo->bd.d->domain_id, mstart & PAGE_MASK, PAGE_ALIGN(mstart + size) - 1); return res; } =20 - res =3D map_regions_p2mt(kinfo->d, + res =3D map_regions_p2mt(kinfo->bd.d, gaddr_to_gfn(gstart), PFN_DOWN(size), maddr_to_mfn(mstart), @@ -217,7 +217,7 @@ static int __init handle_passthrough_prop(struct kernel= _info *kinfo, return -EINVAL; } =20 - res =3D map_device_irqs_to_domain(kinfo->d, node, true, NULL); + res =3D map_device_irqs_to_domain(kinfo->bd.d, node, true, NULL); if ( res < 0 ) return res; =20 @@ -229,7 +229,7 @@ static int __init handle_passthrough_prop(struct kernel= _info *kinfo, if ( xen_force && !dt_device_is_protected(node) ) return 0; =20 - return iommu_assign_dt_device(kinfo->d, node); + return iommu_assign_dt_device(kinfo->bd.d, node); } =20 static int __init handle_prop_pfdt(struct kernel_info *kinfo, @@ -296,14 +296,14 @@ static int __init handle_prop_pfdt(struct kernel_info= *kinfo, address_cells, size_cells); if ( res < 0 ) { - printk(XENLOG_ERR "Failed to assign device to %pd\n", kinfo->d= ); + printk(XENLOG_ERR "Failed to assign device to %pd\n", kinfo->b= d.d); return res; } } else if ( (xen_path && !xen_reg) || (xen_reg && !xen_path && !xen_forc= e) ) { printk(XENLOG_ERR "xen,reg or xen,path missing for %pd\n", - kinfo->d); + kinfo->bd.d); return -EINVAL; } =20 @@ -605,7 +605,7 @@ static int __init alloc_xenstore_page(struct domain *d) =20 static int __init alloc_xenstore_params(struct kernel_info *kinfo) { - struct domain *d =3D kinfo->d; + struct domain *d =3D kinfo->bd.d; int rc =3D 0; =20 #ifdef CONFIG_HVM @@ -773,7 +773,7 @@ static int __init construct_domU(struct domain *d, =20 d->max_pages =3D ((paddr_t)mem * SZ_1K) >> PAGE_SHIFT; =20 - kinfo.d =3D d; + kinfo.bd.d =3D d; =20 rc =3D kernel_probe(&kinfo, node); if ( rc < 0 ) diff --git a/xen/common/device-tree/domain-build.c b/xen/common/device-tree= /domain-build.c index 4eea095e49..2fdea6624a 100644 --- a/xen/common/device-tree/domain-build.c +++ b/xen/common/device-tree/domain-build.c @@ -76,7 +76,7 @@ bool __init allocate_bank_memory(struct kernel_info *kinf= o, gfn_t sgfn, paddr_t tot_size) { struct membanks *mem =3D kernel_info_get_mem(kinfo); - struct domain *d =3D kinfo->d; + struct domain *d =3D kinfo->bd.d; struct membank *bank; =20 /* @@ -170,7 +170,7 @@ int __init find_unallocated_memory(const struct kernel_= info *kinfo, unsigned int i, j; int res; =20 - ASSERT(domain_use_host_layout(kinfo->d)); + ASSERT(domain_use_host_layout(kinfo->bd.d)); =20 unalloc_mem =3D rangeset_new(NULL, NULL, 0); if ( !unalloc_mem ) @@ -341,23 +341,23 @@ void __init dtb_load(struct kernel_info *kinfo, unsigned long left; =20 printk("Loading %pd DTB to 0x%"PRIpaddr"-0x%"PRIpaddr"\n", - kinfo->d, kinfo->dtb_paddr, + kinfo->bd.d, kinfo->dtb_paddr, kinfo->dtb_paddr + fdt_totalsize(kinfo->fdt)); =20 - left =3D cb(kinfo->d, kinfo->dtb_paddr, + left =3D cb(kinfo->bd.d, kinfo->dtb_paddr, kinfo->fdt, fdt_totalsize(kinfo->fdt)); =20 if ( left !=3D 0 ) panic("Unable to copy the DTB to %pd memory (left =3D %lu bytes)\n= ", - kinfo->d, left); + kinfo->bd.d, left); xfree(kinfo->fdt); } =20 void __init initrd_load(struct kernel_info *kinfo, copy_to_guest_phys_cb cb) { - const struct boot_module *mod =3D kinfo->initrd; + const struct boot_module *mod =3D kinfo->bd.initrd; paddr_t load_addr =3D kinfo->initrd_paddr; paddr_t paddr, len; int node; @@ -373,7 +373,7 @@ void __init initrd_load(struct kernel_info *kinfo, len =3D mod->size; =20 printk("Loading %pd initrd from %"PRIpaddr" to 0x%"PRIpaddr"-0x%"PRIpa= ddr"\n", - kinfo->d, paddr, load_addr, load_addr + len); + kinfo->bd.d, paddr, load_addr, load_addr + len); =20 /* Fix up linux,initrd-start and linux,initrd-end in /chosen */ node =3D fdt_path_offset(kinfo->fdt, "/chosen"); @@ -396,11 +396,11 @@ void __init initrd_load(struct kernel_info *kinfo, =20 initrd =3D ioremap_wc(paddr, len); if ( !initrd ) - panic("Unable to map the %pd initrd\n", kinfo->d); + panic("Unable to map the %pd initrd\n", kinfo->bd.d); =20 - res =3D cb(kinfo->d, load_addr, initrd, len); + res =3D cb(kinfo->bd.d, load_addr, initrd, len); if ( res !=3D 0 ) - panic("Unable to copy the initrd in the %pd memory\n", kinfo->d); + panic("Unable to copy the initrd in the %pd memory\n", kinfo->bd.d= ); =20 iounmap(initrd); } diff --git a/xen/common/device-tree/kernel.c b/xen/common/device-tree/kerne= l.c index e1b22dc1c7..6de2334dbe 100644 --- a/xen/common/device-tree/kernel.c +++ b/xen/common/device-tree/kernel.c @@ -136,16 +136,16 @@ int __init kernel_probe(struct kernel_info *info, /* domain is NULL only for the hardware domain */ if ( domain =3D=3D NULL ) { - ASSERT(is_hardware_domain(info->d)); + ASSERT(is_hardware_domain(info->bd.d)); =20 mod =3D boot_module_find_by_kind(BOOTMOD_KERNEL); =20 - info->kernel =3D mod; - info->initrd =3D boot_module_find_by_kind(BOOTMOD_RAMDISK); + info->bd.kernel =3D mod; + info->bd.initrd =3D boot_module_find_by_kind(BOOTMOD_RAMDISK); =20 cmd =3D boot_cmdline_find_by_kind(BOOTMOD_KERNEL); if ( cmd ) - info->cmdline =3D &cmd->cmdline[0]; + info->bd.cmdline =3D &cmd->cmdline[0]; } else { @@ -162,7 +162,7 @@ int __init kernel_probe(struct kernel_info *info, dt_get_range(&val, node, &kernel_addr, &size); mod =3D boot_module_find_by_addr_and_kind( BOOTMOD_KERNEL, kernel_addr); - info->kernel =3D mod; + info->bd.kernel =3D mod; } else if ( dt_device_is_compatible(node, "multiboot,ramdisk") ) { @@ -171,7 +171,7 @@ int __init kernel_probe(struct kernel_info *info, =20 val =3D dt_get_property(node, "reg", &len); dt_get_range(&val, node, &initrd_addr, &size); - info->initrd =3D boot_module_find_by_addr_and_kind( + info->bd.initrd =3D boot_module_find_by_addr_and_kind( BOOTMOD_RAMDISK, initrd_addr); } else if ( dt_device_is_compatible(node, "multiboot,device-tree= ") ) @@ -192,7 +192,7 @@ int __init kernel_probe(struct kernel_info *info, name =3D dt_node_name(domain); cmd =3D boot_cmdline_find_by_name(name); if ( cmd ) - info->cmdline =3D &cmd->cmdline[0]; + info->bd.cmdline =3D &cmd->cmdline[0]; } if ( !mod || !mod->size ) { @@ -201,10 +201,10 @@ int __init kernel_probe(struct kernel_info *info, } =20 printk("Loading %pd kernel from boot module @ %"PRIpaddr"\n", - info->d, info->kernel->start); - if ( info->initrd ) + info->bd.d, info->bd.kernel->start); + if ( info->bd.initrd ) printk("Loading ramdisk from boot module @ %"PRIpaddr"\n", - info->initrd->start); + info->bd.initrd->start); =20 /* * uImage isn't really used nowadays thereby leave kernel_uimage_probe= () diff --git a/xen/include/xen/bootfdt.h b/xen/include/xen/bootfdt.h index 1b19069833..28f7d18262 100644 --- a/xen/include/xen/bootfdt.h +++ b/xen/include/xen/bootfdt.h @@ -100,6 +100,15 @@ struct shared_meminfo { struct shmem_membank_extra extra[NR_SHMEM_BANKS]; }; =20 +struct boot_domain { + struct domain *d; + + struct boot_module *kernel; + struct boot_module *initrd; + + const char *cmdline; +}; + #define BOOTMOD_MAX_CMDLINE 1024 struct boot_module { boot_module_kind kind; diff --git a/xen/include/xen/fdt-kernel.h b/xen/include/xen/fdt-kernel.h index 12a0b42d17..8363865282 100644 --- a/xen/include/xen/fdt-kernel.h +++ b/xen/include/xen/fdt-kernel.h @@ -16,7 +16,7 @@ #endif =20 struct kernel_info { - struct domain *d; + struct boot_domain bd; =20 void *fdt; /* flat device tree */ paddr_t unassigned_mem; /* RAM not (yet) assigned to a bank */ @@ -34,8 +34,7 @@ struct kernel_info { paddr_t gnttab_size; =20 /* boot blob load addresses */ - const struct boot_module *kernel, *initrd, *dtb; - const char* cmdline; + const struct boot_module *dtb; paddr_t dtb_paddr; paddr_t initrd_paddr; =20 --=20 2.43.0