Xen-Devel Archive on lore.kernel.org
 help / color / 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 3/2] x86/desc: Drop __HYPERVISOR_CS32
Date: Fri, 9 Aug 2019 13:39:27 +0100
Message-ID: <20190809123927.29751-1-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <a9651ce7-bdd2-ac6d-6670-0abbe4442b14@suse.com>

Xen, being 64bit only these days, has no use for a 32bit Ring 0 code segment.

Delete __HYPERVISOR_CS32 and remove it from the GDTs.  Also delete
__HYPERVISOR_CS64 and use __HYPERVISOR_CS uniformly.

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/acpi/wakeup_prot.S |  2 +-
 xen/arch/x86/boot/x86_64.S      |  2 +-
 xen/arch/x86/desc.c             | 12 ++++--------
 xen/include/asm-x86/config.h    |  4 +---
 xen/include/asm-x86/desc.h      |  4 ++--
 5 files changed, 9 insertions(+), 15 deletions(-)

diff --git a/xen/arch/x86/acpi/wakeup_prot.S b/xen/arch/x86/acpi/wakeup_prot.S
index 4a92627436..9e9fcc1ab6 100644
--- a/xen/arch/x86/acpi/wakeup_prot.S
+++ b/xen/arch/x86/acpi/wakeup_prot.S
@@ -74,7 +74,7 @@ ENTRY(__ret_point)
         LOAD_GREG(sp)
 
         /* Reload code selector */
-        pushq   $(__HYPERVISOR_CS64)
+        pushq   $__HYPERVISOR_CS
         leaq    1f(%rip),%rax
         pushq   %rax
         lretq
diff --git a/xen/arch/x86/boot/x86_64.S b/xen/arch/x86/boot/x86_64.S
index f762dfea11..5ab24d73fc 100644
--- a/xen/arch/x86/boot/x86_64.S
+++ b/xen/arch/x86/boot/x86_64.S
@@ -23,7 +23,7 @@ ENTRY(__high_start)
         popf
 
         /* Reload code selector. */
-        pushq   $(__HYPERVISOR_CS64)
+        pushq   $__HYPERVISOR_CS
         leaq    1f(%rip),%rax
         pushq   %rax
         lretq
diff --git a/xen/arch/x86/desc.c b/xen/arch/x86/desc.c
index b5c9208164..7d9940d08a 100644
--- a/xen/arch/x86/desc.c
+++ b/xen/arch/x86/desc.c
@@ -31,7 +31,7 @@ __section(".data.page_aligned") __aligned(PAGE_SIZE)
 seg_desc_t boot_gdt[PAGE_SIZE / sizeof(seg_desc_t)] =
 {
     /* 0xe008 - Ring 0 code, 64bit mode */
-    [SEL2GDT(__HYPERVISOR_CS64)] = { 0x00af9b000000ffff },
+    [SEL2GDT(__HYPERVISOR_CS)] = { 0x00af9b000000ffff },
 
     /* 0xe010 - Ring 0 data */
     [SEL2GDT(__HYPERVISOR_DS32)] = { 0x00cf93000000ffff },
@@ -47,9 +47,7 @@ seg_desc_t boot_gdt[PAGE_SIZE / sizeof(seg_desc_t)] =
     /* 0xe033 - Ring 3 code, 64-bit mode */
     [SEL2GDT(FLAT_RING3_CS64)] = { 0x00affb000000ffff },
 
-    /* 0xe038 - Ring 0 code, compatibility */
-    [SEL2GDT(__HYPERVISOR_CS32)] = { 0x00cf9b000000ffff },
-
+    /* 0xe038 - reserved */
     /* 0xe040 - TSS */
     /* 0xe050 - LDT */
 
@@ -61,7 +59,7 @@ __section(".data.page_aligned") __aligned(PAGE_SIZE)
 seg_desc_t boot_compat_gdt[PAGE_SIZE / sizeof(seg_desc_t)] =
 {
     /* 0xe008 - Ring 0 code, 64bit mode */
-    [SEL2GDT(__HYPERVISOR_CS64)] = { 0x00af9b000000ffff },
+    [SEL2GDT(__HYPERVISOR_CS)] = { 0x00af9b000000ffff },
 
     /* 0xe010 - Ring 0 data */
     [SEL2GDT(__HYPERVISOR_DS32)] = { 0x00cf93000000ffff },
@@ -78,9 +76,7 @@ seg_desc_t boot_compat_gdt[PAGE_SIZE / sizeof(seg_desc_t)] =
     /* 0xe033 - Ring 3 data */
     [SEL2GDT(FLAT_COMPAT_RING3_DS)] = { 0x00cff3000000ffff },
 
-    /* 0xe038 - Ring 0 code, compatibility */
-    [SEL2GDT(__HYPERVISOR_CS32)] = { 0x00cf9b000000ffff },
-
+    /* 0xe038 - reserved */
     /* 0xe040 - TSS */
     /* 0xe050 - LDT */
 
diff --git a/xen/include/asm-x86/config.h b/xen/include/asm-x86/config.h
index 6e4f28d934..22dc795eea 100644
--- a/xen/include/asm-x86/config.h
+++ b/xen/include/asm-x86/config.h
@@ -264,9 +264,7 @@ extern unsigned char boot_edid_info[128];
 
 #endif
 
-#define __HYPERVISOR_CS64 0xe008
-#define __HYPERVISOR_CS32 0xe038
-#define __HYPERVISOR_CS   __HYPERVISOR_CS64
+#define __HYPERVISOR_CS   0xe008
 #define __HYPERVISOR_DS64 0x0000
 #define __HYPERVISOR_DS32 0xe010
 #define __HYPERVISOR_DS   __HYPERVISOR_DS64
diff --git a/xen/include/asm-x86/desc.h b/xen/include/asm-x86/desc.h
index 80aa254206..4b29dac259 100644
--- a/xen/include/asm-x86/desc.h
+++ b/xen/include/asm-x86/desc.h
@@ -155,7 +155,7 @@ do {                                                     \
         ((unsigned long)(dpl) << 45) |                   \
         ((unsigned long)(type) << 40) |                  \
         ((unsigned long)(addr) & 0xFFFFUL) |             \
-        ((unsigned long)__HYPERVISOR_CS64 << 16) |       \
+        ((unsigned long)__HYPERVISOR_CS << 16) |         \
         (1UL << 47);                                     \
 } while (0)
 
@@ -169,7 +169,7 @@ static inline void _set_gate_lower(idt_entry_t *gate, unsigned long type,
         ((unsigned long)(dpl) << 45) |
         ((unsigned long)(type) << 40) |
         ((unsigned long)(addr) & 0xFFFFUL) |
-        ((unsigned long)__HYPERVISOR_CS64 << 16) |
+        ((unsigned long)__HYPERVISOR_CS << 16) |
         (1UL << 47);
     _write_gate_lower(gate, &idte);
 }
-- 
2.11.0


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

  parent reply index

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-09 10:34 [Xen-devel] [PATCH v2 0/2] x86/boot: cleanup Jan Beulich
2019-08-09 10:38 ` [Xen-devel] [PATCH v2 1/2] x86: define a few selector values Jan Beulich
2019-08-09 11:50   ` Andrew Cooper
2019-08-09 12:35     ` Jan Beulich
2019-08-23  2:38   ` Tian, Kevin
2019-08-09 10:40 ` [Xen-devel] [PATCH v2 2/2] x86/desc: Build boot_{, compat_}gdt[] in C Jan Beulich
2019-08-09 12:19   ` Andrew Cooper
2019-08-09 12:43     ` Jan Beulich
2019-08-09 13:07       ` Andrew Cooper
2019-08-09 13:18         ` Jan Beulich
2019-08-09 15:25           ` Andrew Cooper
2019-08-12  7:32   ` Jan Beulich
2019-08-12 10:36     ` Andrew Cooper
2019-08-09 10:41 ` [Xen-devel] [PATCH v2 0/2] x86/boot: cleanup Jan Beulich
2019-08-09 12:39 ` Andrew Cooper [this message]
2019-08-09 12:50   ` [Xen-devel] [PATCH 3/2] x86/desc: Drop __HYPERVISOR_CS32 Jan Beulich
2019-08-09 15:36     ` Andrew Cooper
2019-08-09 15:52       ` Jan Beulich

Reply instructions:

You may reply publically 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=20190809123927.29751-1-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

Xen-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/xen-devel/0 xen-devel/git/0.git
	git clone --mirror https://lore.kernel.org/xen-devel/1 xen-devel/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 xen-devel xen-devel/ https://lore.kernel.org/xen-devel \
		xen-devel@lists.xenproject.org xen-devel@lists.xen.org
	public-inbox-index xen-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.xenproject.lists.xen-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git