public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: harm-smits <harmsmitsdev@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: harmsmitsdev@gmail.com, Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	Brijesh Singh <brijesh.singh@amd.com>,
	Joerg Roedel <jroedel@suse.de>,
	Tom Lendacky <thomas.lendacky@amd.com>,
	Marco Bonelli <marco@mebeim.net>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] x86/head/64: Codestyle fixes for loading startup GDT
Date: Mon, 28 Mar 2022 20:35:24 +0200	[thread overview]
Message-ID: <20220328183526.435-1-harmsmitsdev@gmail.com> (raw)

Wrap the GDT access in `fixup_pointer` to avoid having to rely on the
compiler optimization passes to generate %rip relative access. This also
brings it in line with the rest of the code that is executed before the
virtual paging is loaded (e.g. `__startup_64` and
`startup_64_load_idt`).

Signed-off-by: harm-smits <harmsmitsdev@gmail.com>
---
 arch/x86/kernel/head64.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
index 4f5ecbbaae77..33360a1b6ffc 100644
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -613,8 +613,9 @@ void early_setup_idt(void)
 void __head startup_64_setup_env(unsigned long physbase)
 {
 	/* Load GDT */
-	startup_gdt_descr.address = (unsigned long)fixup_pointer(startup_gdt, physbase);
-	native_load_gdt(&startup_gdt_descr);
+	struct desc_ptr *desc = fixup_pointer(&startup_gdt_descr, physbase);
+	desc->address = (unsigned long)fixup_pointer(startup_gdt, physbase);
+	native_load_gdt(desc);
 
 	/* New GDT is live - reload data segment registers */
 	asm volatile("movl %%eax, %%ds\n"
-- 
2.25.1


                 reply	other threads:[~2022-03-28 18:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220328183526.435-1-harmsmitsdev@gmail.com \
    --to=harmsmitsdev@gmail.com \
    --cc=bp@alien8.de \
    --cc=brijesh.singh@amd.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jroedel@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marco@mebeim.net \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=thomas.lendacky@amd.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox