xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xenproject.org>
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Wei Liu" <wl@xen.org>, "Jan Beulich" <JBeulich@suse.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>
Subject: [Xen-devel] [PATCH] x86/boot: Reposition trampoline data
Date: Mon, 19 Aug 2019 14:42:12 +0100	[thread overview]
Message-ID: <20190819134213.1628-3-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <20190819134213.1628-1-andrew.cooper3@citrix.com>

... to separate code from data.  In particular, trampoline_realmode_entry's
write to trampoline_cpu_started clobbers the I-cache line containing
trampoline_protmode_entry, which won't be great for AP startup.

Reformat the comments for trampoline_gdt to reduce their volume.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Wei Liu <wl@xen.org>
CC: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/boot/trampoline.S | 67 ++++++++++++++++++------------------------
 1 file changed, 28 insertions(+), 39 deletions(-)

diff --git a/xen/arch/x86/boot/trampoline.S b/xen/arch/x86/boot/trampoline.S
index 1761fc1213..1b11b4757a 100644
--- a/xen/arch/x86/boot/trampoline.S
+++ b/xen/arch/x86/boot/trampoline.S
@@ -59,45 +59,6 @@ GLOBAL(trampoline_realmode_entry)
         lmsw    %ax                       # CR0.PE = 1 (enter protected mode)
         ljmpl   $BOOT_CS32,$bootsym_rel(trampoline_protmode_entry,6)
 
-trampoline_gdt:
-        /* 0x0000: unused */
-        .quad   0x0000000000000000
-        /* 0x0008: ring 0 code, 32-bit mode */
-        .quad   0x00cf9b000000ffff
-        /* 0x0010: ring 0 code, 64-bit mode */
-        .quad   0x00af9b000000ffff
-        /* 0x0018: ring 0 data */
-        .quad   0x00cf93000000ffff
-        /* 0x0020: real-mode code @ BOOT_TRAMPOLINE */
-        .long   0x0000ffff
-        .long   0x00009b00
-        /* 0x0028: real-mode data @ BOOT_TRAMPOLINE */
-        .long   0x0000ffff
-        .long   0x00009300
-        /*
-         * 0x0030: ring 0 Xen data, 16 MiB size, base
-         * address is computed at runtime.
-         */
-        .quad   0x00c0930000000fff
-.Ltramopline_gdt_end:
-
-        .pushsection .trampoline_rel, "a"
-        .long   trampoline_gdt + BOOT_PSEUDORM_CS + 2 - .
-        .long   trampoline_gdt + BOOT_PSEUDORM_DS + 2 - .
-        .popsection
-
-GLOBAL(trampoline_misc_enable_off)
-        .quad   0
-
-GLOBAL(cpuid_ext_features)
-        .long   0
-
-GLOBAL(trampoline_xen_phys_start)
-        .long   0
-
-GLOBAL(trampoline_cpu_started)
-        .byte   0
-
         .code32
 trampoline_protmode_entry:
         /* Set up a few descriptors: on entry only CS is guaranteed good. */
@@ -186,6 +147,34 @@ idt_48: .word   0, 0, 0 # base = limit = 0
 gdt_48: .word   .Ltramopline_gdt_end - trampoline_gdt - 1
         .long   bootsym_rel(trampoline_gdt,4)
 
+trampoline_gdt:
+        .quad   0x0000000000000000 /* 0x0000: unused */
+        .quad   0x00cf9b000000ffff /* 0x0008: ring 0 code, 32-bit mode */
+        .quad   0x00af9b000000ffff /* 0x0010: ring 0 code, 64-bit mode */
+        .quad   0x00cf93000000ffff /* 0x0018: ring 0 data */
+        .quad   0x00009b000000ffff /* 0x0020: real-mode code @ BOOT_TRAMPOLINE */
+        .quad   0x000093000000ffff /* 0x0028: real-mode data @ BOOT_TRAMPOLINE */
+        .quad   0x00c0930000000fff /* 0x0030: ring 0 Xen data, 16M @ XEN */
+.Ltramopline_gdt_end:
+
+        /* Relocations for trampoline Real Mode segments. */
+        .pushsection .trampoline_rel, "a"
+        .long   trampoline_gdt + BOOT_PSEUDORM_CS + 2 - .
+        .long   trampoline_gdt + BOOT_PSEUDORM_DS + 2 - .
+        .popsection
+
+GLOBAL(trampoline_misc_enable_off)
+        .quad   0
+
+GLOBAL(cpuid_ext_features)
+        .long   0
+
+GLOBAL(trampoline_xen_phys_start)
+        .long   0
+
+GLOBAL(trampoline_cpu_started)
+        .byte   0
+
 /* The first page of trampoline is permanent, the rest boot-time only. */
 /* Reuse the boot trampoline on the 1st trampoline page as stack for wakeup. */
         .equ    wakeup_stack, trampoline_start + PAGE_SIZE
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  parent reply	other threads:[~2019-08-19 13:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-19 13:42 [Xen-devel] [PATCH] x86/boot: Various bits of trampoline cleanup Andrew Cooper
2019-08-19 13:42 ` [Xen-devel] [PATCH] x86/boot: Further minor GDT corrections Andrew Cooper
2019-08-27 14:49   ` Jan Beulich
2019-08-19 13:42 ` Andrew Cooper [this message]
2019-08-19 16:02   ` [Xen-devel] [PATCH] x86/boot: Reposition trampoline data David Woodhouse
2019-08-27 14:50   ` Jan Beulich
2019-08-19 13:42 ` [Xen-devel] [PATCH] x86/boot: Drop all use of lmsw Andrew Cooper
2019-08-27 14:52   ` Jan Beulich

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=20190819134213.1628-3-andrew.cooper3@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=roger.pau@citrix.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.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;
as well as URLs for NNTP newsgroup(s).