linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/3] Recieve boot_param from RDI Instead of RSI
@ 2025-06-23  8:15 Khalid Ali
  2025-06-23 15:24 ` H. Peter Anvin
  0 siblings, 1 reply; 4+ messages in thread
From: Khalid Ali @ 2025-06-23  8:15 UTC (permalink / raw)
  To: tglx, mingo, bp, dave.hansen, ubizjak
  Cc: x86, hpa, linux-efi, linux-kernel, Khalid Ali

From: Khalid Ali <khaliidcaliy@gmail.com>

Adjust the kernel entry point to recieve arguments from RDI instead of
RSI.

Signed-off-by: Khalid Ali <khaliidcaliy@gmail.com>
---
 arch/x86/kernel/head_64.S | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
index dfb5390e5c9a..d24fea15b6a6 100644
--- a/arch/x86/kernel/head_64.S
+++ b/arch/x86/kernel/head_64.S
@@ -43,7 +43,7 @@ SYM_CODE_START_NOALIGN(startup_64)
 	 * for us.  These identity mapped page tables map all of the
 	 * kernel pages and possibly all of memory.
 	 *
-	 * %RSI holds the physical address of the boot_params structure
+	 * %RDI holds the physical address of the boot_params structure
 	 * provided by the bootloader. Preserve it in %R15 so C function calls
 	 * will not clobber it.
 	 *
@@ -56,7 +56,7 @@ SYM_CODE_START_NOALIGN(startup_64)
 	 * compiled to run at we first fixup the physical addresses in our page
 	 * tables and then reload them.
 	 */
-	mov	%rsi, %r15
+	mov	%rdi, %r15
 
 	/* Set up the stack for verify_cpu() */
 	leaq	__top_init_kernel_stack(%rip), %rsp
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v1 1/3] Recieve boot_param from RDI Instead of RSI
  2025-06-23  8:15 [PATCH v1 1/3] Recieve boot_param from RDI Instead of RSI Khalid Ali
@ 2025-06-23 15:24 ` H. Peter Anvin
  2025-06-23 16:16   ` Khalid Ali
  0 siblings, 1 reply; 4+ messages in thread
From: H. Peter Anvin @ 2025-06-23 15:24 UTC (permalink / raw)
  To: Khalid Ali, tglx, mingo, bp, dave.hansen, ubizjak
  Cc: x86, linux-efi, linux-kernel

On June 23, 2025 1:15:23 AM PDT, Khalid Ali <khaliidcaliy@gmail.com> wrote:
>From: Khalid Ali <khaliidcaliy@gmail.com>
>
>Adjust the kernel entry point to recieve arguments from RDI instead of
>RSI.
>
>Signed-off-by: Khalid Ali <khaliidcaliy@gmail.com>
>---
> arch/x86/kernel/head_64.S | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
>index dfb5390e5c9a..d24fea15b6a6 100644
>--- a/arch/x86/kernel/head_64.S
>+++ b/arch/x86/kernel/head_64.S
>@@ -43,7 +43,7 @@ SYM_CODE_START_NOALIGN(startup_64)
> 	 * for us.  These identity mapped page tables map all of the
> 	 * kernel pages and possibly all of memory.
> 	 *
>-	 * %RSI holds the physical address of the boot_params structure
>+	 * %RDI holds the physical address of the boot_params structure
> 	 * provided by the bootloader. Preserve it in %R15 so C function calls
> 	 * will not clobber it.
> 	 *
>@@ -56,7 +56,7 @@ SYM_CODE_START_NOALIGN(startup_64)
> 	 * compiled to run at we first fixup the physical addresses in our page
> 	 * tables and then reload them.
> 	 */
>-	mov	%rsi, %r15
>+	mov	%rdi, %r15
> 
> 	/* Set up the stack for verify_cpu() */
> 	leaq	__top_init_kernel_stack(%rip), %rsp

This is an ABI.

Nacked-by: H. Peter Anvin <hpa@zytor.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re:[PATCH v1 1/3] Recieve boot_param from RDI Instead of RSI
  2025-06-23 15:24 ` H. Peter Anvin
@ 2025-06-23 16:16   ` Khalid Ali
  2025-06-23 17:58     ` [PATCH " Brian Gerst
  0 siblings, 1 reply; 4+ messages in thread
From: Khalid Ali @ 2025-06-23 16:16 UTC (permalink / raw)
  To: hpa, tglx, mingo, bp, dave.hansen, ubizjak; +Cc: x86, linux-efi, linux-kernel

> On June 23, 2025 1:15:23 AM PDT, Khalid Ali <khaliidcaliy@gmail.com> wrote:
> >From: Khalid Ali <khaliidcaliy@gmail.com>
> >
> >Adjust the kernel entry point to recieve arguments from RDI instead of
> >RSI.
> >
> >Signed-off-by: Khalid Ali <khaliidcaliy@gmail.com>
> >---
> > arch/x86/kernel/head_64.S | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> >diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
> >index dfb5390e5c9a..d24fea15b6a6 100644
> >--- a/arch/x86/kernel/head_64.S
> >+++ b/arch/x86/kernel/head_64.S
> >@@ -43,7 +43,7 @@ SYM_CODE_START_NOALIGN(startup_64)
> >        * for us.  These identity mapped page tables map all of the
> >        * kernel pages and possibly all of memory.
> >        *
> >-       * %RSI holds the physical address of the boot_params structure
> >+       * %RDI holds the physical address of the boot_params structure
> >        * provided by the bootloader. Preserve it in %R15 so C function calls
> >        * will not clobber it.
> >        *
> >@@ -56,7 +56,7 @@ SYM_CODE_START_NOALIGN(startup_64)
> >        * compiled to run at we first fixup the physical addresses in our page
> >        * tables and then reload them.
> >        */
> >-      mov     %rsi, %r15
> >+      mov     %rdi, %r15
> >
> >       /* Set up the stack for verify_cpu() */
> >       leaq    __top_init_kernel_stack(%rip), %rsp

> This is an ABI.
>
> Nacked-by: H. Peter Anvin <hpa@zytor.com>

Peter, thanks for the response but if i ask you:
What is specific reason that this patch is wrong?
Why used RSI instead of RDI at the first place?

I broke my patch reference and it became stand alone each one, however this is one of three series. 
This makes the entry more ABI complaint, if there is no specific reason of objection.

Thanks

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1 1/3] Recieve boot_param from RDI Instead of RSI
  2025-06-23 16:16   ` Khalid Ali
@ 2025-06-23 17:58     ` Brian Gerst
  0 siblings, 0 replies; 4+ messages in thread
From: Brian Gerst @ 2025-06-23 17:58 UTC (permalink / raw)
  To: Khalid Ali
  Cc: hpa, tglx, mingo, bp, dave.hansen, ubizjak, x86, linux-efi,
	linux-kernel

On Mon, Jun 23, 2025 at 12:27 PM Khalid Ali <khaliidcaliy@gmail.com> wrote:
>
> > On June 23, 2025 1:15:23 AM PDT, Khalid Ali <khaliidcaliy@gmail.com> wrote:
> > >From: Khalid Ali <khaliidcaliy@gmail.com>
> > >
> > >Adjust the kernel entry point to recieve arguments from RDI instead of
> > >RSI.
> > >
> > >Signed-off-by: Khalid Ali <khaliidcaliy@gmail.com>
> > >---
> > > arch/x86/kernel/head_64.S | 4 ++--
> > > 1 file changed, 2 insertions(+), 2 deletions(-)
> > >
> > >diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
> > >index dfb5390e5c9a..d24fea15b6a6 100644
> > >--- a/arch/x86/kernel/head_64.S
> > >+++ b/arch/x86/kernel/head_64.S
> > >@@ -43,7 +43,7 @@ SYM_CODE_START_NOALIGN(startup_64)
> > >        * for us.  These identity mapped page tables map all of the
> > >        * kernel pages and possibly all of memory.
> > >        *
> > >-       * %RSI holds the physical address of the boot_params structure
> > >+       * %RDI holds the physical address of the boot_params structure
> > >        * provided by the bootloader. Preserve it in %R15 so C function calls
> > >        * will not clobber it.
> > >        *
> > >@@ -56,7 +56,7 @@ SYM_CODE_START_NOALIGN(startup_64)
> > >        * compiled to run at we first fixup the physical addresses in our page
> > >        * tables and then reload them.
> > >        */
> > >-      mov     %rsi, %r15
> > >+      mov     %rdi, %r15
> > >
> > >       /* Set up the stack for verify_cpu() */
> > >       leaq    __top_init_kernel_stack(%rip), %rsp
>
> > This is an ABI.
> >
> > Nacked-by: H. Peter Anvin <hpa@zytor.com>
>
> Peter, thanks for the response but if i ask you:
> What is specific reason that this patch is wrong?
> Why used RSI instead of RDI at the first place?

It is defined in Documentation/arch/x86/boot.rst

IIRC some hypervisors can boot the uncompressed image directly.


Brian Gerst

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-06-23 17:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-23  8:15 [PATCH v1 1/3] Recieve boot_param from RDI Instead of RSI Khalid Ali
2025-06-23 15:24 ` H. Peter Anvin
2025-06-23 16:16   ` Khalid Ali
2025-06-23 17:58     ` [PATCH " Brian Gerst

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).