From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mx.groups.io with SMTP id smtpd.web10.5141.1685435401386082179 for ; Tue, 30 May 2023 01:30:01 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bYibyMjv; spf=pass (domain: kernel.org, ip: 139.178.84.217, mailfrom: ardb@kernel.org) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DB22E623E5 for ; Tue, 30 May 2023 08:30:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F3C6C433D2 for ; Tue, 30 May 2023 08:30:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1685435400; bh=yrkyD4/93lEVFJLc2f6d24lc6ZX0oIpAQ9OMsvnoupQ=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=bYibyMjvdFvqF/7l82dmlVrSVzmk+ueu5/+TDEqCf4mfWgQ4Cd7/Kuizh/Bi9iNu8 pmKv9/IbgYawGOr0aFFyjFqTra3L2b3cyh4IEVETOoVKQqezC/lVjV4lHHxAILmsZC v2nvgo+XO2AmP51wwW7mwTI5b6Ml/w3C3wVN9i5OTT9he6rkw7El9tIHs/j6bXGW9i W0vCf4bP1RjOMQjKQw9jVZIxh7oTkPJMwuNCmy4ttaVEv6g181jmUJB3CaPGJk/4jA qcqUCM3Z67dsYK2Sen9KK3ZezzQvcBfnHkMv/jYydeEpaIma/suwv97CCBoCShWPoO A5xelrvvscP3g== Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-4f4db9987f8so5605626e87.1 for ; Tue, 30 May 2023 01:30:00 -0700 (PDT) X-Gm-Message-State: AC+VfDySjvUEgFnSSxIPXZGGITsD1/VYE4j3BizlBPYLYELrInDlc57b gB3nYEx7fbFR+OvitEmqskSGhd6tlGCWDETXC6o= X-Google-Smtp-Source: ACHHUZ5ok95t732UbfQt2RL7PPNVbMML7zlnYS4RilNnefPuNw0RycOOHActpOToXkVwQ5Jrs0VDYBXOP+BmtjaGG9I= X-Received: by 2002:a2e:8e94:0:b0:293:4b60:419c with SMTP id z20-20020a2e8e94000000b002934b60419cmr504552ljk.18.1685435398334; Tue, 30 May 2023 01:29:58 -0700 (PDT) MIME-Version: 1.0 References: <20230529101705.2476949-1-ardb@kernel.org> <20230529101705.2476949-9-ardb@kernel.org> In-Reply-To: From: "Ard Biesheuvel" Date: Tue, 30 May 2023 10:29:46 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [edk2-devel] [RFC PATCH 08/11] MdeModulePkg/DxeIpl: Relocate and remap XIP capable DXE drivers To: devel@edk2.groups.io, ray.ni@intel.com Cc: "Yao, Jiewen" , Gerd Hoffmann , Taylor Beebe , Oliver Smith-Denny , "Bi, Dandan" , "Gao, Liming" , "Kinney, Michael D" , Leif Lindholm , Michael Kubacki Content-Type: text/plain; charset="UTF-8" On Tue, 30 May 2023 at 10:02, Ni, Ray wrote: > > > > > -----Original Message----- > > From: devel@edk2.groups.io On Behalf Of Ard > > Biesheuvel > > Sent: Tuesday, May 30, 2023 3:58 PM > > To: devel@edk2.groups.io; Ni, Ray > > Cc: Yao, Jiewen ; Gerd Hoffmann ; > > Taylor Beebe ; Oliver Smith-Denny > denny.com>; Bi, Dandan ; Gao, Liming > > ; Kinney, Michael D ; > > Leif Lindholm ; Michael Kubacki > > > > Subject: Re: [edk2-devel] [RFC PATCH 08/11] MdeModulePkg/DxeIpl: Relocate > > and remap XIP capable DXE drivers > > > > On Tue, 30 May 2023 at 08:45, Ni, Ray wrote: > > > > > > 1. is it possible that a PE image sits in the right location but the > > SectionAlignment is larger than FileAlignment so each section still needs to be > > copied to the aligned memory location? > > > > > > > That is a good question. Currently, the ELF toolchains rely on GenFw > > to construct the PE images in a way that permits execution in place, > > but I have no idea how this works with native PE/COFF toolchains. > > > > > 2. PeCoffLoaderRelocateImage() might not be called for XIP > > > > > > > Are you saying it is not permitted? Or that it may not happen? > > > > In any case, relocating the image in place is exactly what the > > BaseTools do for XIP PEIMs, so I think applying the same logic here is > > reasonable. > > But when the image is in SPI flash (MMIO device, rather in physical memory), relocating the image in place should not be performed. > Or you require platform build strips the relocation section for drivers XIP in SPI flash? > This code only operates on EFI_FV_FILETYPE_DRIVER, which does not cover the PEI core or PEIMs. But we should probably only operate on FVs that are covered by PEI permanent memory anyway.