[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v6 4/4] x86/PVH: Support relocatable dom0 kernels
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: Jason Andryuk <jason.andryuk@xxxxxxx>
- Date: Thu, 4 Apr 2024 10:01:43 -0400
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=suse.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=arcselector9901; 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=uqLJfNF3hEqM/OGyHc7d56iagiJuTCvVHIYNPuwQfL0=; b=esrl5J8SLNvPcfFH3wk9xNwzPThsaAfbBd3zX4X0PCcB5TlL1cOtj7it6bC67wFQ4GRHPFRUnJ3Y1DeDAg+/pWPecQLJ3t6tV3TL69RypHRkGutjKkB0KB4Q/AsYZj4amS6YWDCmE5/RrBNHtmuJ01zV4aga/k7E+MxIr5E1SoGy7riJ4pfH78zVPjXsRtE5rqUbD+mCfVZax7UBGIqzDPzUxNJUNOi6iqXGo7mnpdWiqxSXzknZqbMPlucR4TMsCqhaazS5CrBnNgL9pafUXyUlfCHB60DX/fvNgIb/UY7L4gg8PSEhVF3z3KxleGEORD//y1jWeQ08b6oKdVVuZQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Je9qRnshnFEYkIoCyjbREvt1/1/n/VM5Z3uxroP1HVMJko6j85SH3MhdsKMseSCJ/ix2JoGd9kXqxt+Z7cCGQPHe1DJkZ2MBYnNHOI8zy7JpFAF19xDIXvY7oQX/ZnNIy/zb54hK7xBMIKCDuZc7U8GhhKtIdE919fSr3Tbt7lBs6Ub0uuG6vhZ+ppw7+Oqk6fppQa60FAkkaW5k1eH2xmVqOzbU+tlP4quKF+TH4DjmQkhzdUgqoysCj4gloxd4+WZhyQuTs5zZsVFyBorsJ1xVicTZMWZ1rMS7k+qHZyWrBboaZgi8WdmryjDwhU2fk4Q4e6jWoomAwvljHxQjOw==
- Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- Delivery-date: Thu, 04 Apr 2024 14:02:08 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 2024-04-02 10:34, Jan Beulich wrote:
On 27.03.2024 22:51, Jason Andryuk wrote:
v6:
Select alignment from, in order, Note, PHDRs, then default
The comment in the public header also needs to reflect this change.
Yes. I'll update.
I'm going to tweak the code from elf->palign > PAGE_SIZE to >=, since
PAGE_SIZE is a reasonable value to use.
+static bool __init check_and_adjust_load_address(
+ const struct domain *d, struct elf_binary *elf, struct elf_dom_parms
*parms)
+{
+ paddr_t reloc_base;
+
+ if ( check_load_address(d, elf) )
+ return true;
+
+ if ( !parms->phys_reloc )
+ {
+ printk("%pd kernel: Address conflict and not relocatable\n", d);
+ return false;
+ }
+
+ reloc_base = find_kernel_memory(d, elf, parms);
+ if ( !reloc_base )
+ {
+ printk("%pd kernel: Failed find a load address\n", d);
+ return false;
+ }
+
+ if ( opt_dom0_verbose )
+ printk("%pd kernel: Moving [%p, %p] -> [%"PRIpaddr", %"PRIpaddr"]\n",
d,
+ elf->dest_base, elf->dest_base + elf->dest_size - 1,
+ reloc_base, reloc_base + elf->dest_size - 1);
+
+ parms->phys_entry = reloc_base +
+ (parms->phys_entry - (uintptr_t)elf->dest_base);
I think this would be easier to read as
parms->phys_entry =
reloc_base + (parms->phys_entry - (uintptr_t)elf->dest_base);
Everything else looks good to me now.
Sounds good to me.
Thanks,
Jason
|