[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v5 14/44] x86/boot: transition relocation calculations to struct boot_module
- To: "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Jason Andryuk <jason.andryuk@xxxxxxx>
- Date: Mon, 7 Oct 2024 16:44:03 -0400
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=apertussolutions.com 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)
- 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=7aFKNN8zeTmL9p0hh2u5Ql5ouGkss6IbcxyAIunV52o=; b=NotYfhBlz5yM23RIwsQCRGNcvGPdqaakgb5wWuEWIowaUmFgVlJQfBm2BtqC09jFbnTAi0pGw46dBHwceERYqhShNCmUETV5R7TvawyKf3unu7mgRrq9oRg9EuJbViFk2pHBUv1D1dpcpkscxamlOrxhnSuiLdDsyONpD8hAu8Ln89gc8hNjeObtqtjLc4xLia0ZNK+BVS7pEp3mCNNVn38FUrZgoyaWJbWSJnt7zU5e9vVOsOasIG0DjFaYLMxMRcC7A6yNayrtI3AIl3lg44EFnHUk7/V1HeUDagSCVXfIdnYjkSAY6++6lfEV0ofNYIbSyMkpa9fiq5QVc4zJBg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=l3Cg+g5KZ0dziZTabN8I5EY/7PJqW884FSFwP/cAAJlVJMyUT8IEIekxNpd0QOd4AVOtYtuAhK55+kUnErcPbLZgHCOGv/kF9mi/KNAlCDB3DXInMUoqA9SFMPRQ+h7MmqVv/EgzAeJYgkSehsBq+hRLvsGJjvxdqd/JKCtNqShcxrybBw0o6kE6k6obGZebCFTERp42nShypVJhhuVi8aVapduroRcpLzGI0NPvqcyOpC93gVRS0j94iKUYYFLk2YUfED5bhlX+pSo+KfOdEnD3WSKWxYWc3nxHe+lTAM8T3phD4IFLbPDkAloPvxUqVM9VwQpSGs5pydETJNITQQ==
- Cc: <christopher.w.clark@xxxxxxxxx>, <stefano.stabellini@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
- Delivery-date: Mon, 07 Oct 2024 20:44:36 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 2024-10-06 17:49, Daniel P. Smith wrote:
Use struct boot_module fields, start and size, when calculating the relocation
address and size. It also ensures that early_mod references are kept in sync.
Signed-off-by: Daniel P. Smith <dpsmith@xxxxxxxxxxxxxxxxxxxx>
---
xen/arch/x86/setup.c | 36 +++++++++++++++++-------------------
1 file changed, 17 insertions(+), 19 deletions(-)
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index f968758048ed..4f540c461b26 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1490,7 +1490,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long
mbi_p)
struct boot_module *bm = &bi->mods[j];
unsigned long size;
- size = PAGE_ALIGN(bm->headroom + bm->mod->mod_end);
+ size = PAGE_ALIGN(bm->headroom + bm->size);
Is there a mismatch from mod_end in PFNs to bm->size in bytes? Or is
mod_start in pfns and mod_end in bytes?
if ( bi->mods[j].flags & BOOTMOD_FLAG_X86_RELOCATED )
continue;
@@ -1504,13 +1504,13 @@ void asmlinkage __init noreturn __start_xen(unsigned
long mbi_p)
if ( s < end &&
(bm->headroom ||
- ((end - size) >> PAGE_SHIFT) > bm->mod->mod_start) )
+ paddr_to_pfn(end - size) > paddr_to_pfn(bm->start)) )
Drop the paddr_to_pfn if both sides are now in bytes?
{
- move_memory(end - size + bm->headroom,
- (uint64_t)bm->mod->mod_start << PAGE_SHIFT,
- bm->mod->mod_end);
- bm->mod->mod_start = (end - size) >> PAGE_SHIFT;
- bm->mod->mod_end += bm->headroom;
+ move_memory(end - size + bm->headroom, bm->start, bm->size);
+ bm->start = (end - size);
+ bm->mod->mod_start = paddr_to_pfn(bm->start);
+ bm->size += bm->headroom;
+ bm->mod->mod_end = bm->size;
bm->flags |= BOOTMOD_FLAG_X86_RELOCATED;
}
}
@@ -1700,13 +1698,13 @@ void asmlinkage __init noreturn __start_xen(unsigned
long mbi_p)
for ( i = 0; i < bi->nr_modules; ++i )
{
- set_pdx_range(bi->mods[i].mod->mod_start,
- bi->mods[i].mod->mod_start +
- PFN_UP(bi->mods[i].mod->mod_end));
+ set_pdx_range(paddr_to_pfn(bi->mods[i].mod->mod_start),
+ paddr_to_pfn(bi->mods[i].mod->mod_start) +
Shouldn't these be
paddr_to_pfn(bi->mods[i].start)
?
+ PFN_UP(bi->mods[i].size));
map_pages_to_xen(
- (unsigned long)mfn_to_virt(bi->mods[i].mod->mod_start),
- _mfn(bi->mods[i].mod->mod_start),
- PFN_UP(bi->mods[i].mod->mod_end), PAGE_HYPERVISOR);
+ (unsigned long)maddr_to_virt(bi->mods[i].start),
+ maddr_to_mfn(bi->mods[i].start),
+ PFN_UP(bi->mods[i].size), PAGE_HYPERVISOR);
First argument should fit on same line as map_pages_to_xen().
}
#ifdef CONFIG_KEXEC
Regards,
Jason
|