public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 06/12] virt-dt: Allow reservation of the secure region when it is in a RAM carveout.
Date: Tue, 17 Feb 2015 11:55:24 +0000	[thread overview]
Message-ID: <20150217115523.GL8994@leverpostej> (raw)
In-Reply-To: <54E326CC.6040300@siemens.com>

[...]

> >> This is getting invasive:
> >>
> >> If I add carveouts via adjusting memory banks, I need to account for the
> >> case that an existing bank is split into two halves, creating additional
> >> banks this way. But then current fdt_fixup_memory_banks will no longer
> >> work due to its limitation to the number of physical banks. I could
> >> always add one spare bank to that service, ok, but then the next use
> >> case for carveouts will hit the wall again. So I better double that
> >> limit, or so.
> > 
> > Yeah, not fun.
> > 
> > If the code is position-independent then you might be able to simply
> > carve out a sufficient proportion from the start of the first entry or
> > the end of the last one, which would avoid splitting. If either of said
> > regions are too small for the monitor code then it's questionable as to
> > whether the OS can make use of it.
> 
> The code /seems/ to be position-independent, but locations are so far
> hard-coded in those places that prepare it and move it around. Maybe we
> can decide about the location at runtime, maybe we can simply demand it
> to be at the end or the beginning of some bank.

If it's possible to do so, it would seem like the nicest option to me.

> >> Also, are there any architectural or OS-implementation related
> >> restrictions on the alignment of bank start addresses and sizes? Just to
> >> make sure we don't stumble over some side effects of punching holes into
> >> that device tree node.
> > 
> > I would guess that we need to at least pad the carevout to page-aligned
> > to prevent any particular OS from mapping a page for the sake of a few
> > bytes left unused by the monitor.
> > 
> > From a quick look at the Linux arm_add_memory and memblock code it looks
> > like Linux won't map partial pages, but I don't know what Xen and others
> > do, and given we know that we want to keep the relevant pages exclusive
> > to the monitor anyway padding to age boundaries seems like a sensible
> > thing to do.
> > 
> > My one concern would be early mappings; I believe that the initial page
> > tables use (2MiB) section/block mappings to map the kernel and some
> > initial memory (including the DTB) before the memory nodes are parsed,
> > so the carevout would need to be placed away from where the kernel and
> > DTB were loaded in order to prevent those early mappings from covering
> > it. I'm unfortunately not sure on the full details there.
> 
> That makes be wonder again if we are trying to solve real issues: What
> is the OS supposed to do with a memory reserve map, what does it have to
> avoid doing with it?

Per ePAPR, memory reservation block entries may not be explicitly
accessed by the operating system (unless told to elsewhere). The OS may
map any reserved entries with cacheable attributes (potentially leading
to the issues I described earlier)

> Is the semantic really so weak that we cannot use it here?

In general, the semantic is too weak. In fact, it's not even strictly
defined for the ARM architecture w.r.t. memory attributes, so we have
very little guarantee as to what what an OS will do beyond that it will
not perform any explicit accesses to the region.

In practice, Linux will currently map the region as cacheable, and it
may or may not map it shareable depending on SMP/UP (which could be a
problem if you want to use a UP Linux to load and kexec an SMP kernel
for some reason).

It may be that on a given CPU/system implemetation that a memreserve
entry is sufficient; but unfortunately this depends on IMPLEMENTATION
DEFINED details.

Thanks,
Mark.

  reply	other threads:[~2015-02-17 11:55 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-16 12:54 [U-Boot] [PATCH v2 00/12] Add PSCI support for Jetson TK1/Tegra124 + CNTFRQ fix Jan Kiszka
2015-02-16 12:54 ` [U-Boot] [PATCH v2 01/12] ARM: Factor out reusable psci_cpu_off_common Jan Kiszka
2015-02-16 12:54 ` [U-Boot] [PATCH v2 02/12] ARM: Factor out reusable psci_cpu_entry Jan Kiszka
2015-02-16 12:54 ` [U-Boot] [PATCH v2 03/12] ARM: Factor out reusable psci_get_cpu_stack_top Jan Kiszka
2015-02-16 12:54 ` [U-Boot] [PATCH v2 04/12] ARM: Put target PC for PSCI CPU_ON on per-CPU stack Jan Kiszka
2015-02-16 12:54 ` [U-Boot] [PATCH v2 05/12] tegra124: Add more registers to struct mc_ctlr Jan Kiszka
2015-02-16 12:54 ` [U-Boot] [PATCH v2 06/12] virt-dt: Allow reservation of the secure region when it is in a RAM carveout Jan Kiszka
2015-02-16 13:42   ` Mark Rutland
2015-02-16 13:51     ` Jan Kiszka
2015-02-16 14:25       ` Mark Rutland
2015-02-16 14:31         ` Jan Kiszka
2015-02-16 14:56           ` Mark Rutland
2015-02-16 15:38             ` Jan Kiszka
2015-02-17  8:09               ` Jan Kiszka
2015-02-17 10:46                 ` Mark Rutland
2015-02-17 11:32                   ` Jan Kiszka
2015-02-17 11:55                     ` Mark Rutland [this message]
2015-02-19  8:28                       ` Thierry Reding
2015-02-19  9:19                         ` Ian Campbell
2015-02-19  9:25                           ` Jan Kiszka
2015-02-19 10:13                             ` Ian Campbell
2015-02-19 13:49                               ` Mark Rutland
2015-02-19 10:22                             ` Thierry Reding
2015-02-19 13:42                             ` Mark Rutland
2015-02-19 10:34                 ` Thierry Reding
2015-02-19 11:17                   ` Jan Kiszka
2015-02-16 12:54 ` [U-Boot] [PATCH v2 07/12] tegra: Make tegra_powergate_power_on public Jan Kiszka
2015-02-16 12:54 ` [U-Boot] [PATCH v2 08/12] tegra: Add ap_pm_init hook Jan Kiszka
2015-02-16 12:54 ` [U-Boot] [PATCH v2 09/12] tegra124: Add PSCI support for Tegra124 Jan Kiszka
2015-02-17 21:03   ` Stephen Warren
2015-02-18  6:13     ` Jan Kiszka
2015-02-18 16:34       ` Stephen Warren
2015-02-19  9:14         ` Thierry Reding
2015-02-20  9:36           ` Jan Kiszka
2015-02-24  7:23             ` Jan Kiszka
2015-02-24  8:18               ` Thierry Reding
2015-02-24  8:23                 ` Jan Kiszka
2015-02-19  8:57   ` Thierry Reding
2015-02-19  9:04   ` Thierry Reding
2015-02-16 12:54 ` [U-Boot] [PATCH v2 10/12] jetson-tk1: Add PSCI configuration options and reserve secure code Jan Kiszka
2015-02-17 21:05   ` Stephen Warren
2015-02-18  7:39     ` Jan Kiszka
2015-02-16 12:54 ` [U-Boot] [PATCH v2 11/12] tegra124: Reserve secure RAM using MC_SECURITY_CFG{0, 1}_0 Jan Kiszka
2015-02-16 13:49   ` Mark Rutland
2015-02-16 13:55     ` Jan Kiszka
2015-02-17 21:06   ` Stephen Warren
2015-02-18  7:24     ` Jan Kiszka
2015-02-16 12:54 ` [U-Boot] [PATCH v2 12/12] tegra: Set CNTFRQ for secondary CPUs Jan Kiszka
2015-02-16 13:37   ` Mark Rutland
2015-02-16 13:44     ` Jan Kiszka
2015-02-16 13:51       ` Mark Rutland
2015-02-16 14:02         ` Jan Kiszka
2015-02-17  7:01           ` Jan Kiszka
2015-02-17 10:21             ` Mark Rutland
2015-02-17 10:27               ` Jan Kiszka

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=20150217115523.GL8994@leverpostej \
    --to=mark.rutland@arm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox