xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Ian Campbell <ian.campbell@citrix.com>
To: xen-devel@lists.xen.org
Cc: julien.grall@linaro.org, tim@xen.org,
	Ian Campbell <ian.campbell@citrix.com>,
	stefano.stabellini@eu.citrix.com
Subject: [PATCH 5/5] xen: arm: flush TLB after overwriting 1:1 mapping in boot page tables
Date: Mon, 14 Jul 2014 17:39:10 +0100	[thread overview]
Message-ID: <1405355950-6461-5-git-send-email-ian.campbell@citrix.com> (raw)
In-Reply-To: <1405355930.31863.5.camel@kazak.uk.xensource.com>

Otherwise a stale TLB entry can shadow the fixmap/UART or DTB mapping

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 xen/arch/arm/arm32/head.S |   13 ++++++++++++-
 xen/arch/arm/arm64/head.S |   13 ++++++++++++-
 2 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S
index 348ca7d..a36c8fc 100644
--- a/xen/arch/arm/arm32/head.S
+++ b/xen/arch/arm/arm32/head.S
@@ -398,9 +398,20 @@ paging:
         ldr   r4, =BOOT_FDT_VIRT_START
         mov   r4, r4, lsr #(SECOND_SHIFT - 3)   /* Slot for BOOT_FDT_VIRT_START */
         strd  r2, r3, [r1, r4]       /* Map it in the early fdt slot */
-        dsb
 1:
 
+        /*
+         * Flush the TLB in case the 1:1 mapping happens to clash with
+         * the virtual addresses used by the fixmap or DTB.
+         */
+        dsb                          /* Ensure any page table updates made above
+                                      * have occurred. */
+
+        isb
+        mcr   CP32(r0, TLBIALLH)     /* Flush hypervisor TLB */
+        dsb                          /* Ensure completion of TLB flush */
+        isb
+
         PRINT("- Ready -\r\n")
 
         /* The boot CPU should go straight into C now */
diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S
index 7152d9c..a50192e 100644
--- a/xen/arch/arm/arm64/head.S
+++ b/xen/arch/arm/arm64/head.S
@@ -432,9 +432,20 @@ paging:
         ldr   x1, =BOOT_FDT_VIRT_START
         lsr   x1, x1, #(SECOND_SHIFT - 3)   /* x4 := Slot for BOOT_FDT_VIRT_START */
         str   x2, [x4, x1]           /* Map it in the early fdt slot */
-        dsb   sy
 1:
 
+        /*
+         * Flush the TLB in case the 1:1 mapping happens to clash with
+         * the virtual addresses used by the fixmap or DTB.
+         */
+        dsb   sy                     /* Ensure any page table updates made above
+                                      * have occurred. */
+
+        isb
+        tlbi  alle2
+        dsb   sy                     /* Ensure completion of TLB flush */
+        isb
+
         PRINT("- Ready -\r\n")
 
         /* The boot CPU should go straight into C now */
-- 
1.7.10.4

  parent reply	other threads:[~2014-07-14 16:39 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-14 16:38 [PATCH 0/5] xen: arm: various improvements to boot time page table handling Ian Campbell
2014-07-14 16:39 ` [PATCH 1/5] xen: arm: correct whitespace/comments and use #defines in head.S Ian Campbell
2014-07-14 18:37   ` Julien Grall
2014-07-14 16:39 ` [PATCH 2/5] xen: arm: Handle 4K aligned hypervisor load address Ian Campbell
2014-07-14 22:33   ` Julien Grall
2014-07-15  9:13     ` Ian Campbell
2014-07-15 11:03       ` Julien Grall
2014-07-15 11:07         ` Julien Grall
2014-07-15 11:10           ` Ian Campbell
2014-07-15 12:03             ` Julien Grall
2014-07-15 15:18               ` Ian Campbell
2014-07-16 15:18                 ` Julien Grall
2014-07-16 16:54                   ` Ian Campbell
2014-07-16 15:41   ` Julien Grall
2014-07-16 16:53     ` Ian Campbell
2014-07-16 17:49       ` Julien Grall
2014-07-17  9:38         ` Ian Campbell
2014-07-14 16:39 ` [PATCH 3/5] xen: arm: Do not use level 0 section mappings in boot page tables Ian Campbell
2014-07-14 16:39 ` [PATCH 4/5] xen: arm: avoid unnecessary aliasing " Ian Campbell
2014-07-17 11:37   ` Ian Campbell
2014-07-14 16:39 ` Ian Campbell [this message]
2014-07-16 18:11   ` [PATCH 5/5] xen: arm: flush TLB after overwriting 1:1 mapping " Julien Grall
2014-07-17  9:30     ` Ian Campbell
2014-07-18 13:37     ` Ian Campbell

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=1405355950-6461-5-git-send-email-ian.campbell@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=julien.grall@linaro.org \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=tim@xen.org \
    --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 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).