All of lore.kernel.org
 help / color / mirror / Atom feed
From: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
To: Ian Campbell <ian.campbell@citrix.com>
Cc: "Roy.Franz@linaro.org" <Roy.Franz@linaro.org>,
	Julien Grall <julien.grall@linaro.org>,
	"stefano.stabellini@eu.citrix.com"
	<stefano.stabellini@eu.citrix.com>,
	xen-devel <xen-devel@lists.xen.org>
Subject: Failed to enable MMU when  booting EFI on Seattle
Date: Mon, 6 Oct 2014 22:29:55 -0500	[thread overview]
Message-ID: <54335E33.6030005@amd.com> (raw)

Ian/Roy,

So, I have found that in arch/arm/arm64/head.S, after we enable MMU and 
execute "br x1" (where x1 = 0x2005F8, the VA of "paging:"), it went to 
address 0x2005F8, which has all zeros value. This is why we getting the 
"Synchronous Exception"

......
1:
         PRINT("- Turning on paging -\r\n")

         ldr   x1, =paging            /* Explicit vaddr, not RIP-relative */
         mrs   x0, SCTLR_EL2
         orr   x0, x0, #SCTLR_M       /* Enable MMU */
         orr   x0, x0, #SCTLR_C       /* Enable D-cache */
         dsb   sy                     /* Flush PTE writes and finish 
reads */
	b .
         msr   SCTLR_EL2, x0          /* now paging is enabled */
         isb                          /* Now, flush the icache */
         br    x1                     /* Get a proper vaddr into PC */
paging:
.....

Notes:
* This is not the case when booting non-EFI.

* If I do "add x1, x1, x20", which puts the PA of paging into x1, it 
seems to branch to "paging:" fine. Although, I don't this this is the 
right thing to do since it should already be using VA).

So, I inspected the page tables and compare the ones from booting with 
and without EFI. At this point, it seems that the contents of the page 
tables are set up properly. The only thing different is the phys-offset 
and the location of the page table:

BOOTING WITH EFI:

	x20 (phys-offset) = 0x83fc2d0000
	x19 (start paddr) = 0x83fc4d0000
	(.text starts at 2MB = 0x200000 offset)

	boot_pgtable (pa) = x20 + 0x2f2000 = 0x83fc5c2000
	boot_first (pa)   = x20 + 0x2f3000 = 0x83fc5c3000
	boot_second(pa)   = x20 + 0x2f5000 = 0x83fc5c5000
	boot_third (pa)   = x20 + 0x2f6000 = 0x83fc5c6000

BOOTING WITHOUT EFI:

	x20 (phys-offset) = 0x8008500000
	x19 (start paddr) = 0x8008700000
	(.text starts at 2MB = 0x200000 offset)

	boot_pgtable (pa) = x20 + 0x2f2000 = 0x80087f2000
	boot_first (pa)   = x20 + 0x2f3000 = 0x80087f3000
	boot_second(pa)   = x20 + 0x2f5000 = 0x80087f5000
	boot_third (pa)   = x20 + 0x2f6000 = 0x80087f6000

Here is the memory map available from UEFI:
	
Shell> memmap
Type      Start            End              #pages             Attributes
RT_Data   0000008000000000-0000008000FFFFFF 0000000000001000 
800000000000000F
Available 0000008001000000-0000008007FFDFFF 0000000000006FFE 
000000000000000F
BS_Code   0000008007FFE000-0000008007FFFFFF 0000000000000002 
000000000000000F
Available 0000008008000000-000000801FFFDFFF 0000000000017FFE 
000000000000000F
BS_Data   000000801FFFE000-000000801FFFFFFF 0000000000000002 
000000000000000F
Available 0000008020000000-000000802FFFFFFF 0000000000010000 
000000000000000F
RT_Code   0000008030000000-0000008030000FFF 0000000000000001 
800000000000000F
Available 0000008030001000-00000083F0FFFFFF 00000000003C0FFF 
000000000000000F
BS_Data   00000083F1000000-00000083F101FFFF 0000000000000020 
000000000000000F
Available 00000083F1020000-00000083FC5D2FFF 000000000000B5B3 
000000000000000F
LoaderCode 00000083FC5D3000-00000083FC6B1FFF 00000000000000DF 
000000000000000F

However, it seems that the location falls in the "Available", which 
should be ok to use.

Not sure at this point what I might be missing :(

Suravee

             reply	other threads:[~2014-10-07  3:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-07  3:29 Suravee Suthikulpanit [this message]
2014-10-07  9:21 ` Failed to enable MMU when booting EFI on Seattle Ian Campbell
2014-10-08  1:45   ` Suravee Suthikulanit
2014-10-08  4:02     ` Roy Franz

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=54335E33.6030005@amd.com \
    --to=suravee.suthikulpanit@amd.com \
    --cc=Roy.Franz@linaro.org \
    --cc=ian.campbell@citrix.com \
    --cc=julien.grall@linaro.org \
    --cc=stefano.stabellini@eu.citrix.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.