Re: [PATCH v2 3/3] x86/PVH: Support relocatable dom0 kernels

2024-03-19 Thread Jason Andryuk
On 2024-03-19 04:15, Jan Beulich wrote: On 18.03.2024 22:21, Jason Andryuk wrote: On 2024-03-15 05:48, Jan Beulich wrote: On 14.03.2024 20:19, Jason Andryuk wrote: On 2024-03-14 09:31, Jan Beulich wrote: On 13.03.2024 20:30, Jason Andryuk wrote: --- a/xen/arch/x86/hvm/dom0_build.c +++ b/xen/

Re: [PATCH v2 3/3] x86/PVH: Support relocatable dom0 kernels

2024-03-19 Thread Jan Beulich
On 18.03.2024 22:21, Jason Andryuk wrote: > On 2024-03-15 05:48, Jan Beulich wrote: >> On 14.03.2024 20:19, Jason Andryuk wrote: >>> On 2024-03-14 09:31, Jan Beulich wrote: On 13.03.2024 20:30, Jason Andryuk wrote: > --- a/xen/arch/x86/hvm/dom0_build.c > +++ b/xen/arch/x86/hvm/dom0_bui

Re: [PATCH v2 3/3] x86/PVH: Support relocatable dom0 kernels

2024-03-19 Thread Jan Beulich
On 18.03.2024 22:19, Jason Andryuk wrote: > On 2024-03-14 10:19, Jan Beulich wrote: >> On 14.03.2024 15:13, Jason Andryuk wrote: >>> On 2024-03-14 09:21, Jan Beulich wrote: On 13.03.2024 20:30, Jason Andryuk wrote: > --- a/xen/include/public/elfnote.h > +++ b/xen/include/public/elfnote

Re: [PATCH v2 3/3] x86/PVH: Support relocatable dom0 kernels

2024-03-18 Thread Jason Andryuk
On 2024-03-15 05:48, Jan Beulich wrote: On 14.03.2024 20:19, Jason Andryuk wrote: On 2024-03-14 09:31, Jan Beulich wrote: On 13.03.2024 20:30, Jason Andryuk wrote: --- a/xen/arch/x86/hvm/dom0_build.c +++ b/xen/arch/x86/hvm/dom0_build.c @@ -537,6 +537,108 @@ static paddr_t __init find_memory(

Re: [PATCH v2 3/3] x86/PVH: Support relocatable dom0 kernels

2024-03-18 Thread Jason Andryuk
On 2024-03-14 10:19, Jan Beulich wrote: On 14.03.2024 15:13, Jason Andryuk wrote: On 2024-03-14 09:21, Jan Beulich wrote: On 13.03.2024 20:30, Jason Andryuk wrote: --- a/xen/include/public/elfnote.h +++ b/xen/include/public/elfnote.h @@ -194,6 +194,17 @@ */ #define XEN_ELFNOTE_PHYS32_EN

Re: [PATCH v2 3/3] x86/PVH: Support relocatable dom0 kernels

2024-03-15 Thread Jan Beulich
On 14.03.2024 20:19, Jason Andryuk wrote: > On 2024-03-14 09:31, Jan Beulich wrote: >> On 13.03.2024 20:30, Jason Andryuk wrote: >>> --- a/xen/arch/x86/hvm/dom0_build.c >>> +++ b/xen/arch/x86/hvm/dom0_build.c >>> @@ -537,6 +537,108 @@ static paddr_t __init find_memory( >>> return INVALID_PADD

Re: [PATCH v2 3/3] x86/PVH: Support relocatable dom0 kernels

2024-03-15 Thread Roger Pau Monné
On Thu, Mar 14, 2024 at 12:59:19PM -0400, Jason Andryuk wrote: > On 2024-03-14 11:30, Jan Beulich wrote: > > On 14.03.2024 15:33, Roger Pau Monné wrote: > > > On Thu, Mar 14, 2024 at 09:51:22AM -0400, Jason Andryuk wrote: > > > > On 2024-03-14 05:48, Roger Pau Monné wrote: > > > > > On Wed, Mar 13,

Re: [PATCH v2 3/3] x86/PVH: Support relocatable dom0 kernels

2024-03-14 Thread Jason Andryuk
On 2024-03-14 09:31, Jan Beulich wrote: On 13.03.2024 20:30, Jason Andryuk wrote: --- a/xen/arch/x86/hvm/dom0_build.c +++ b/xen/arch/x86/hvm/dom0_build.c @@ -537,6 +537,108 @@ static paddr_t __init find_memory( return INVALID_PADDR; } +static bool __init check_load_address( +cons

Re: [PATCH v2 3/3] x86/PVH: Support relocatable dom0 kernels

2024-03-14 Thread Jan Beulich
On 14.03.2024 17:59, Jason Andryuk wrote: > On 2024-03-14 11:30, Jan Beulich wrote: >> On 14.03.2024 15:33, Roger Pau Monné wrote: >>> On Thu, Mar 14, 2024 at 09:51:22AM -0400, Jason Andryuk wrote: On 2024-03-14 05:48, Roger Pau Monné wrote: > On Wed, Mar 13, 2024 at 03:30:21PM -0400, Jaso

Re: [PATCH v2 3/3] x86/PVH: Support relocatable dom0 kernels

2024-03-14 Thread Jason Andryuk
On 2024-03-14 11:30, Jan Beulich wrote: On 14.03.2024 15:33, Roger Pau Monné wrote: On Thu, Mar 14, 2024 at 09:51:22AM -0400, Jason Andryuk wrote: On 2024-03-14 05:48, Roger Pau Monné wrote: On Wed, Mar 13, 2024 at 03:30:21PM -0400, Jason Andryuk wrote: @@ -234,6 +235,17 @@ elf_errorstatus el

Re: [PATCH v2 3/3] x86/PVH: Support relocatable dom0 kernels

2024-03-14 Thread Roger Pau Monné
On Thu, Mar 14, 2024 at 04:30:05PM +0100, Jan Beulich wrote: > On 14.03.2024 15:33, Roger Pau Monné wrote: > > On Thu, Mar 14, 2024 at 09:51:22AM -0400, Jason Andryuk wrote: > >> On 2024-03-14 05:48, Roger Pau Monné wrote: > >>> On Wed, Mar 13, 2024 at 03:30:21PM -0400, Jason Andryuk wrote: >

Re: [PATCH v2 3/3] x86/PVH: Support relocatable dom0 kernels

2024-03-14 Thread Jan Beulich
On 14.03.2024 15:33, Roger Pau Monné wrote: > On Thu, Mar 14, 2024 at 09:51:22AM -0400, Jason Andryuk wrote: >> On 2024-03-14 05:48, Roger Pau Monné wrote: >>> On Wed, Mar 13, 2024 at 03:30:21PM -0400, Jason Andryuk wrote: @@ -234,6 +235,17 @@ elf_errorstatus elf_xen_parse_note(struct elf_bina

Re: [PATCH v2 3/3] x86/PVH: Support relocatable dom0 kernels

2024-03-14 Thread Roger Pau Monné
On Thu, Mar 14, 2024 at 09:51:22AM -0400, Jason Andryuk wrote: > On 2024-03-14 05:48, Roger Pau Monné wrote: > > On Wed, Mar 13, 2024 at 03:30:21PM -0400, Jason Andryuk wrote: > > > Xen tries to load a PVH dom0 kernel at the fixed guest physical address > > > from the elf headers. For Linux, this

Re: [PATCH v2 3/3] x86/PVH: Support relocatable dom0 kernels

2024-03-14 Thread Jan Beulich
On 14.03.2024 15:13, Jason Andryuk wrote: > On 2024-03-14 09:21, Jan Beulich wrote: >> On 13.03.2024 20:30, Jason Andryuk wrote: >>> --- a/xen/include/public/elfnote.h >>> +++ b/xen/include/public/elfnote.h >>> @@ -194,6 +194,17 @@ >>>*/ >>> #define XEN_ELFNOTE_PHYS32_ENTRY 18 >>> >>> +/*

Re: [PATCH v2 3/3] x86/PVH: Support relocatable dom0 kernels

2024-03-14 Thread Jason Andryuk
On 2024-03-14 09:21, Jan Beulich wrote: On 13.03.2024 20:30, Jason Andryuk wrote: --- a/xen/include/public/elfnote.h +++ b/xen/include/public/elfnote.h @@ -194,6 +194,17 @@ */ #define XEN_ELFNOTE_PHYS32_ENTRY 18 +/* + * Physical loading constraints for PVH kernels + * + * Used to place

Re: [PATCH v2 3/3] x86/PVH: Support relocatable dom0 kernels

2024-03-14 Thread Jason Andryuk
On 2024-03-14 05:48, Roger Pau Monné wrote: On Wed, Mar 13, 2024 at 03:30:21PM -0400, Jason Andryuk wrote: Xen tries to load a PVH dom0 kernel at the fixed guest physical address from the elf headers. For Linux, this defaults to 0x100 (16MB), but it can be configured. Unfortunately there e

Re: [PATCH v2 3/3] x86/PVH: Support relocatable dom0 kernels

2024-03-14 Thread Jan Beulich
On 13.03.2024 20:30, Jason Andryuk wrote: > --- a/xen/arch/x86/hvm/dom0_build.c > +++ b/xen/arch/x86/hvm/dom0_build.c > @@ -537,6 +537,108 @@ static paddr_t __init find_memory( > return INVALID_PADDR; > } > > +static bool __init check_load_address( > +const struct domain *d, const struc

Re: [PATCH v2 3/3] x86/PVH: Support relocatable dom0 kernels

2024-03-14 Thread Jan Beulich
On 13.03.2024 20:30, Jason Andryuk wrote: > --- a/xen/include/public/elfnote.h > +++ b/xen/include/public/elfnote.h > @@ -194,6 +194,17 @@ > */ > #define XEN_ELFNOTE_PHYS32_ENTRY 18 > > +/* > + * Physical loading constraints for PVH kernels > + * > + * Used to place constraints on the guest ph

Re: [PATCH v2 3/3] x86/PVH: Support relocatable dom0 kernels

2024-03-14 Thread Jason Andryuk
On 2024-03-14 03:12, Jan Beulich wrote: On 13.03.2024 22:02, Jason Andryuk wrote: On 2024-03-13 15:30, Jason Andryuk wrote: +/* Find an e820 RAM region that fits the kernel at a suitable alignment. */ +static paddr_t __init find_kernel_memory( +const struct domain *d, struct elf_binary *elf

Re: [PATCH v2 3/3] x86/PVH: Support relocatable dom0 kernels

2024-03-14 Thread Roger Pau Monné
On Wed, Mar 13, 2024 at 03:30:21PM -0400, Jason Andryuk wrote: > Xen tries to load a PVH dom0 kernel at the fixed guest physical address > from the elf headers. For Linux, this defaults to 0x100 (16MB), but > it can be configured. > > Unfortunately there exist firmwares that have reserved reg

Re: [PATCH v2 3/3] x86/PVH: Support relocatable dom0 kernels

2024-03-14 Thread Jan Beulich
On 13.03.2024 22:02, Jason Andryuk wrote: > On 2024-03-13 15:30, Jason Andryuk wrote: >> +/* Find an e820 RAM region that fits the kernel at a suitable alignment. */ >> +static paddr_t __init find_kernel_memory( >> +const struct domain *d, struct elf_binary *elf, >> +const struct elf_dom_pa

Re: [PATCH v2 3/3] x86/PVH: Support relocatable dom0 kernels

2024-03-13 Thread Jason Andryuk
On 2024-03-13 15:30, Jason Andryuk wrote: +/* Find an e820 RAM region that fits the kernel at a suitable alignment. */ +static paddr_t __init find_kernel_memory( +const struct domain *d, struct elf_binary *elf, +const struct elf_dom_parms *parms) +{ +paddr_t kernel_start = (paddr_t)el