All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Jan Beulich <JBeulich@suse.com>
Subject: [PATCH] xen/x86: Improvements to build-time pagetable generation
Date: Wed, 24 Feb 2016 19:07:30 +0000	[thread overview]
Message-ID: <1456340856-3065-3-git-send-email-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <1456340856-3065-1-git-send-email-andrew.cooper3@citrix.com>

 * Additional comments, including size and runtime use.
 * Consistent use of .quad, rather than a mix including .long.

No change in runtime behaviour.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>

v2:
 * New
v3:
 * Drop the use of _PAGE_GLOBAL for intermediate levels.  While it is safe
   (i.e. ignored) on Intel, it is reserved for non-leaf entries on AMD.
---
 xen/arch/x86/boot/x86_64.S | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/boot/x86_64.S b/xen/arch/x86/boot/x86_64.S
index 94cf089..9df3902 100644
--- a/xen/arch/x86/boot/x86_64.S
+++ b/xen/arch/x86/boot/x86_64.S
@@ -86,32 +86,40 @@ GLOBAL(__page_tables_start)
  * Mapping of first 2 megabytes of memory. This is mapped with 4kB mappings
  * to avoid type conflicts with fixed-range MTRRs covering the lowest megabyte
  * of physical memory. In any case the VGA hole should be mapped with type UC.
+ * Uses 1x 4k page.
  */
 GLOBAL(l1_identmap)
         pfn = 0
         .rept L1_PAGETABLE_ENTRIES
         /* VGA hole (0xa0000-0xc0000) should be mapped UC. */
         .if pfn >= 0xa0 && pfn < 0xc0
-        .long (pfn << PAGE_SHIFT) | PAGE_HYPERVISOR_NOCACHE | MAP_SMALL_PAGES
+        .quad (pfn << PAGE_SHIFT) | PAGE_HYPERVISOR_NOCACHE | MAP_SMALL_PAGES
         .else
-        .long (pfn << PAGE_SHIFT) | PAGE_HYPERVISOR | MAP_SMALL_PAGES
+        .quad (pfn << PAGE_SHIFT) | PAGE_HYPERVISOR | MAP_SMALL_PAGES
         .endif
-        .long 0
         pfn = pfn + 1
         .endr
         .size l1_identmap, . - l1_identmap
 
-/* Mapping of first 16 megabytes of memory. */
+/*
+ * Space for mapping the first 4GB of memory, with the first 16 megabytes
+ * actualy mapped (mostly using superpages).  Uses 4x 4k pages.
+ */
 GLOBAL(l2_identmap)
         .quad sym_phys(l1_identmap) + __PAGE_HYPERVISOR
-        pfn = 0
+        idx = 1
         .rept 7
-        pfn = pfn + (1 << PAGETABLE_ORDER)
-        .quad (pfn << PAGE_SHIFT) | PAGE_HYPERVISOR | _PAGE_PSE
+        .quad (idx << L2_PAGETABLE_SHIFT) | PAGE_HYPERVISOR | _PAGE_PSE
+        idx = idx + 1
         .endr
         .fill 4 * L2_PAGETABLE_ENTRIES - 8, 8, 0
         .size l2_identmap, . - l2_identmap
 
+/*
+ * L2 mapping the 1GB Xen text/data/bss region.  At boot it maps 16MB from
+ * __image_base__, and is modified when Xen relocates itself.  Uses 1x 4k
+ * page.
+ */
 GLOBAL(l2_xenmap)
         idx = 0
         .rept 8
@@ -121,6 +129,7 @@ GLOBAL(l2_xenmap)
         .fill L2_PAGETABLE_ENTRIES - 8, 8, 0
         .size l2_xenmap, . - l2_xenmap
 
+/* L2 mapping the fixmap.  Uses 1x 4k page. */
 l2_fixmap:
         idx = 0
         .rept L2_PAGETABLE_ENTRIES
@@ -133,6 +142,7 @@ l2_fixmap:
         .endr
         .size l2_fixmap, . - l2_fixmap
 
+/* Identity map, covering the 4 l2_identmap tables.  Uses 1x 4k page. */
 GLOBAL(l3_identmap)
         idx = 0
         .rept 4
@@ -142,6 +152,7 @@ GLOBAL(l3_identmap)
         .fill L3_PAGETABLE_ENTRIES - 4, 8, 0
         .size l3_identmap, . - l3_identmap
 
+/* L3 mapping the fixmap.  Uses 1x 4k page. */
 l3_xenmap:
         idx = 0
         .rept L3_PAGETABLE_ENTRIES
-- 
2.1.4

  parent reply	other threads:[~2016-02-24 19:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-24 19:07 [PATCH] Map Xen code/data/bss with superpages Andrew Cooper
2016-02-24 19:07 ` [PATCH] xen/lockprof: Move .lockprofile.data into .rodata Andrew Cooper
2016-02-25 11:02   ` Stefano Stabellini
2016-02-25 11:12     ` Stefano Stabellini
2016-02-24 19:07 ` Andrew Cooper [this message]
2016-02-24 19:07 ` [PATCH] xen/x86: Construct the {l2, l3}_bootmap at compile time Andrew Cooper
2016-02-24 19:07 ` [PATCH] xen/memguard: Drop memguard_init() entirely Andrew Cooper
2016-02-24 19:07 ` [PATCH] xen/x86: Disable CR0.WP while applying alternatives Andrew Cooper
2016-02-24 19:07 ` [PATCH] xen/x86: Reorder .data and .init when linking Andrew Cooper
2016-02-24 19:07 ` [PATCH] xen/x86: Use 2M superpages for text/data/bss mappings Andrew Cooper
2016-02-24 19:07 ` [PATCH] xen/x86: Unilaterally remove .init mappings Andrew Cooper

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=1456340856-3065-3-git-send-email-andrew.cooper3@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=xen-devel@lists.xen.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.