From nobody Sun Nov 24 01:15:41 2024 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 header.i=dpsmith@apertussolutions.com; 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=apertussolutions.com) ARC-Seal: i=2; a=rsa-sha256; t=1730568415; cv=pass; d=zohomail.com; s=zohoarc; b=RjXx3M+640itcTWydc2WYT24FWW3Aw1NicyuDApONsH4eYVNLFQ1seBxrJ/QX2pWc+XHtcTkoCmZNEXQYFTKi6jf3bo0GqqfZefdhe5NfNJjpDuV/Xe9k7jnEvB87n0HsmDT3aYTz51w+ClehIiIJ4Lbg+ekAkTHq74IH7m0Wgc= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1730568415; h=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=cldlTjNG2X0IEi+ADcYbrRHkM0Zd7pCxKFfx6gZwAx4=; b=nbsUH403hLIh+Dv+sBTmoqSYpVQiOg359ORNrrOgG8o6IE4poUHIouMqVfnk3JcmUAPNtn+I/ZnGf/B4KJbWRdiPSgNr5BCRYDMCfvEnPJNfbAr6AeTQNulxCROh4GYV7W8AAJcsZ/RSgF+a4Tf2zXHY3WHQ+Zmwee5KY5lDYTg= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass header.i=dpsmith@apertussolutions.com; 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=apertussolutions.com) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1730568415089634.337296417857; Sat, 2 Nov 2024 10:26:55 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.829570.1244574 (Exim 4.92) (envelope-from ) id 1t7Hta-0006Ck-O5; Sat, 02 Nov 2024 17:26:42 +0000 Received: by outflank-mailman (output) from mailman id 829570.1244574; Sat, 02 Nov 2024 17:26:42 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t7Hta-0006CY-Ki; Sat, 02 Nov 2024 17:26:42 +0000 Received: by outflank-mailman (input) for mailman id 829570; Sat, 02 Nov 2024 17:26:41 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t7HtZ-0005zO-H2 for xen-devel@lists.xenproject.org; Sat, 02 Nov 2024 17:26:41 +0000 Received: from sender4-of-o51.zoho.com (sender4-of-o51.zoho.com [136.143.188.51]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 9d21230b-993f-11ef-a0c5-8be0dac302b0; Sat, 02 Nov 2024 18:26:38 +0100 (CET) Received: by mx.zohomail.com with SMTPS id 1730568363326833.7879973254649; Sat, 2 Nov 2024 10:26:03 -0700 (PDT) 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: 9d21230b-993f-11ef-a0c5-8be0dac302b0 X-Custom-Connection: eyJyZW1vdGVpcCI6IjEzNi4xNDMuMTg4LjUxIiwiaGVsbyI6InNlbmRlcjQtb2YtbzUxLnpvaG8uY29tIn0= X-Custom-Transaction: eyJpZCI6IjlkMjEyMzBiLTk5M2YtMTFlZi1hMGM1LThiZTBkYWMzMDJiMCIsInRzIjoxNzMwNTY4Mzk5LjA2MDI4Mywic2VuZGVyIjoiZHBzbWl0aEBhcGVydHVzc29sdXRpb25zLmNvbSIsInJlY2lwaWVudCI6Inhlbi1kZXZlbEBsaXN0cy54ZW5wcm9qZWN0Lm9yZyJ9 ARC-Seal: i=1; a=rsa-sha256; t=1730568371; cv=none; d=zohomail.com; s=zohoarc; b=HFi/r/GDxbDE0VePkjwtbYsGJYlfYuTWJfm4B/wZotDKLu0nJs12lIsd+8QHmpHE/QogUi0ekV54vPIoyL9tkYPRHXuTtvxEZP3749r7uu4uk5mTbBMnZ07J6uALm/GkbKgxMRuR+OFV/XbbTvGqPAhKRJ0Tlk3YHQa3ntZa170= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1730568371; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=cldlTjNG2X0IEi+ADcYbrRHkM0Zd7pCxKFfx6gZwAx4=; b=iNk/IFq2UuGeGuMTxhzenE6No3ZT50h/u5jJwhMSESw3bzVnApGuoQhHS9HKu3jNwTt0pAfRFqEmLc3gT82Qs3xlLdoWqOSqgXFwUEC7O4Q2zQA9hmmIT1o/qd92HULNqWOOIrD1N9AaL0HTXlOh9jY/F9OZgWEWGPztLJ0OYJ4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=apertussolutions.com; spf=pass smtp.mailfrom=dpsmith@apertussolutions.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1730568371; s=zoho; d=apertussolutions.com; i=dpsmith@apertussolutions.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-Id:Message-Id:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Reply-To; bh=cldlTjNG2X0IEi+ADcYbrRHkM0Zd7pCxKFfx6gZwAx4=; b=IqvHUs8veLwEkrbCuInEwuyCIKtdaL/waH4FGQWUz0NYvmSGXPfnK1v/hhvFREn6 0xk0qiMfTGKFUhBT3052KdVw7tWOtC/rqeqfJ+gZtRfMZ3yRODYMx+xr/3Gmh4ectZ8 G/hxksDmuROJNr7jnTP/LPw3B/G0pISSVSwyeAFI= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, stefano.stabellini@amd.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH 03/12] x86/boot: introduce boot module flags Date: Sat, 2 Nov 2024 13:25:42 -0400 Message-Id: <20241102172551.17233-4-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241102172551.17233-1-dpsmith@apertussolutions.com> References: <20241102172551.17233-1-dpsmith@apertussolutions.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External X-ZohoMail-DKIM: pass (identity dpsmith@apertussolutions.com) X-ZM-MESSAGEID: 1730568416577116600 Content-Type: text/plain; charset="utf-8" The existing startup code employs various ad-hoc state tracking about certa= in boot module types by each area of the code. A boot module flags bitfield is added to enable tracking these different states. The first state to be transition by this commit is module relocation. Signed-off-by: Daniel P. Smith Reviewed-by: Andrew Cooper --- Changes since v6: - replaced bitmask flags field with the bitfield, relocated - slight update to commit message to mention bitfield - dropped Rb and Ab due to approach change Changes since v5: - removed trailing blank line. --- xen/arch/x86/include/asm/bootinfo.h | 6 ++++++ xen/arch/x86/setup.c | 7 +++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm= /bootinfo.h index 37dfcc14fa7d..0fbf36739782 100644 --- a/xen/arch/x86/include/asm/bootinfo.h +++ b/xen/arch/x86/include/asm/bootinfo.h @@ -29,6 +29,12 @@ struct boot_module { module_t *mod; =20 enum bootmod_type type; + + /* + * Module State Flags: + * relocated: indicates module has been relocated in memory. + */ + bool relocated:1; }; =20 /* diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 92dbdfe12a3d..d061ece0541f 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1392,7 +1392,6 @@ void asmlinkage __init noreturn __start_xen(void) panic("Bootloader didn't honor module alignment request\n"); bi->mods[i].mod->mod_end -=3D bi->mods[i].mod->mod_start; bi->mods[i].mod->mod_start >>=3D PAGE_SHIFT; - bi->mods[i].mod->reserved =3D 0; } =20 /* @@ -1508,7 +1507,7 @@ void asmlinkage __init noreturn __start_xen(void) unsigned long headroom =3D j ? 0 : modules_headroom; unsigned long size =3D PAGE_ALIGN(headroom + bm->mod->mod_end); =20 - if ( bm->mod->reserved ) + if ( bm->relocated ) continue; =20 /* Don't overlap with other modules (or Xen itself). */ @@ -1526,7 +1525,7 @@ void asmlinkage __init noreturn __start_xen(void) pfn_to_paddr(bm->mod->mod_start), bm->mod->mod= _end); bm->mod->mod_start =3D (end - size) >> PAGE_SHIFT; bm->mod->mod_end +=3D headroom; - bm->mod->reserved =3D 1; + bm->relocated =3D true; } } =20 @@ -1552,7 +1551,7 @@ void asmlinkage __init noreturn __start_xen(void) #endif } =20 - if ( modules_headroom && !bi->mods[0].mod->reserved ) + if ( modules_headroom && !bi->mods[0].relocated ) panic("Not enough memory to relocate the dom0 kernel image\n"); for ( i =3D 0; i < bi->nr_modules; ++i ) { --=20 2.30.2