All of lore.kernel.org
 help / color / mirror / Atom feed
From: York Sun <yorksun@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [Patch v4 2/5] ARMv8: Adjust MMU setup
Date: Fri, 6 Jun 2014 10:37:12 -0700	[thread overview]
Message-ID: <5391FC48.2060002@freescale.com> (raw)
In-Reply-To: <20140606173243.GC18918@leverpostej>

On 06/06/2014 10:32 AM, Mark Rutland wrote:
> On Fri, Jun 06, 2014 at 03:54:49PM +0100, York Sun wrote:
>> On 06/06/2014 05:33 AM, Mark Rutland wrote:
>>> [...]
>>>
>>>>>>> What you need to do to replace the active set of tables (assuming that
>>>>>>> the new mapping has the instruction stream mapped in an identical way)
>>>>>>> is:
>>>>>>>
>>>>>>> - Write the tables.
>>>>>>>
>>>>>>> - DSB to make them visible to the MMU.
>>>>>>>
>>>>>>> - Write to the appropriate TTBR_*.
>>>>>>>
>>>>>>> - ISB to complete the write to the TTBR_*.
>>>>>>>
>>>>>>> - TLBI to invalidate the old mappings the the TLBs.
>>>>>>>
>>>>>>> - DSB to complete the TLBI.
>>>>>>>
>>>>>>> - If you've changed the instruction stream or system state that will
>>>>>>>   affect the instruction stream, ISB to flush the CPU pipeline.
>>>>>>>
>>>>>>>
>>>>>> Here is the flow I have (as of v5 patch)
>>>>>>
>>>>>> Write the tables
>>>>>>
>>>>>> (I removed dsb here in v5, need to add back)
>>>>>>
>>>>>> Write TTBR
>>>>>>
>>>>>> (I missed isb here, need to add)
>>>>>>
>>>>>> Flush dcache (otherwise the table will not be in DDR. Yes, I verified)
>>>>>
>>>>> This looks odd -- why do we need the tables to be in DDR? Why would we
>>>>> flush them here, when the address is partially visible to the MMU?
>>>>
>>>> This sounds odd but it actually makes sense. Let's say we have new tables
>>>> created by u-boot. The new tables are in the address of DDR with D-cache
>>>> enabled. If we don't flush the cache, the moment TLBs are invalidated, MMU will
>>>> fetch the tables from TTBR which points to DDR. Without a valid TLB, MMU cannot
>>>> get the table from D-cache, it has to fetch from the DDR directly. I have
>>>> verified this by checking waveforms of the SoC and exercised code in both ways.
>>>
>>> How is TCR_EL2.SH0 (or TCR_EL1.SH*) configured?
>>>
>>> You'll only need to flush the cache if they're configured non shareable.
>>
>> It is configured as non shareable.
> 
> Is there any reason not to configure them as inner shareable? That way
> the MMU will look in the D-cache, and you won't have to spend time
> flushing them.
> 

You may be right. I need to test it. It will take me a little while. In the
meantime, would you comment on v6 patches please? If flushing is the only
question left, I can address it after testing.

York

  reply	other threads:[~2014-06-06 17:37 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-29 20:49 [U-Boot] [Patch v4 1/5] Added 64-bit MMIO accessors for ARMv8 York Sun
2014-05-29 20:49 ` [U-Boot] [Patch v4 2/5] ARMv8: Adjust MMU setup York Sun
2014-06-02 11:34   ` Mark Rutland
2014-06-02 16:06     ` York Sun
2014-06-02 18:01       ` Mark Rutland
2014-06-04 16:27         ` York Sun
2014-06-05 10:09           ` Mark Rutland
2014-06-05 15:07             ` York Sun
2014-06-05 17:41               ` Mark Rutland
2014-06-05 18:34                 ` York Sun
2014-06-06 12:33                   ` Mark Rutland
2014-06-06 14:54                     ` York Sun
2014-06-06 17:32                       ` Mark Rutland
2014-06-06 17:37                         ` York Sun [this message]
2014-06-06 20:17                         ` York Sun
2014-06-06 22:14                           ` York Sun
2014-06-10  9:15                             ` Mark Rutland
2014-06-10 16:04                               ` York Sun
2014-06-13 19:41                               ` York Sun
2014-06-18 14:09                                 ` fenghua at phytium.com.cn
2014-06-18 15:44                                   ` York Sun
2014-06-06 13:34                   ` Rob Herring
2014-06-06 14:52                     ` York Sun
2014-06-06 16:09                       ` Tom Rini
2014-05-29 20:49 ` [U-Boot] [Patch v4 3/5] ARMv8/FSL_LSCH3: Add FSL_LSCH3 SoC York Sun
2014-06-11 14:05   ` fenghua at phytium.com.cn
2014-06-11 14:55     ` York Sun
2014-05-29 20:49 ` [U-Boot] [Patch v4 4/5] armv8/fsl-lsch3: Add support to load and start MC Firmware York Sun
2014-05-29 20:49 ` [U-Boot] [Patch v4 5/5] ARMv8/ls2100a_emu: Add LS2100A emulator and simulator board support York Sun

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=5391FC48.2060002@freescale.com \
    --to=yorksun@freescale.com \
    --cc=u-boot@lists.denx.de \
    /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.