From: Mark Rutland <mark.rutland@arm.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 6/8] ARMv8: PSCI: Fixup the device tree for PSCI v0.2
Date: Mon, 1 Sep 2014 19:43:18 +0100 [thread overview]
Message-ID: <20140901184318.GB6427@leverpostej> (raw)
In-Reply-To: <5400884D.2060509@freescale.com>
Hi,
> >> diff --git a/arch/arm/cpu/armv8/cpu-dt.c b/arch/arm/cpu/armv8/cpu-dt.c
> >> index 9792bc0..c2c8fe7 100644
> >> --- a/arch/arm/cpu/armv8/cpu-dt.c
> >> +++ b/arch/arm/cpu/armv8/cpu-dt.c
> >> @@ -9,7 +9,69 @@
> >> #include <fdt_support.h>
> >>
> >> #ifdef CONFIG_MP
> >> +#ifdef CONFIG_ARMV8_PSCI
> >>
> >> +static void psci_reserve_mem(void *fdt)
> >> +{
> >> +#ifndef CONFIG_ARMV8_SECURE_BASE
> >> + /* secure code lives in RAM, keep it alive */
> >> + fdt_add_mem_rsv(fdt, (unsigned long)__secure_start,
> >> + __secure_end - __secure_start);
> >> +#endif
> >> +}
> >
> > With PSCI I'd be worried about telling the OS about this memory at all.
> >
> > If the OS maps the memory we could encounter issues with mismatched
> > aliases and/or unexpected hits in the D-cache, which can result in a
> > loss of ordering and/or visbility guarantees, which could break the PSCI
> > implementation.
> >
> > With the KVM or trusted firmware PSCI implementations the (guest) OS
> > cannot map the implementation's memory, preventing such problems. The
> > arm64 Linux boot-wrapper is dodgy in this regard currently.
> >
>
> The idea here is that if there is no PSCI specific (most likely secure)
> memory allocated in the system, the macro "CONFIG_ARMV8_SECURE_BASE"
> will not be defined. In this case the PSCI vector table and its support
> code will be in DDR and will be protected from Linux using memreserve.
Sure, this will prevent the OS from explicitly modifying this memory.
However, the OS will still map the memory. This renders the protection
incomplete due to the possibility of mismatched attributes and/or
unexpected cache hits resulting in nasty coherency problems. We are
likely to get away with this most of the time (if the kernel and U-Boot
use the same attributes), but it would be very easy to blow things up
accidentally.
The only way to prevent that is to completely remove a portion of the
memory from the view of the OS, such that it doesn't map the memory at
all.
> If this macro is defined the assumption is that it points to some
> non-ddr location, say secure OCRAM. In this case U-Boot will copy the
> PSCI vector table and its support code to that region and we are hoping
> that this address space is not visible to the OS in the first place.
This makes sense, but was not the issue I was referring to.
> This is my understanding of the code, maybe Marc would like to comment
> on if this was the thinking in ARMv7.
If we're doing this on ARMv7 then it is dodgy there too.
Marc, thoughts?
[...]
> >> + }
> >> +
> >> + nodeoff = fdt_path_offset(fdt, "/psci");
> >
> > We might need to search by compatible string. All psci nodes so far have
> > been called /psci, but that's not guaranteed. Linux looks for nodes
> > compatible with "arm,psci" and/or "arm,psci-0.2".
> >
>
> I see that it is called "Main node" in the kernel documentation. Any
> reason it's name has not been fixed to "psci"? Is it too late to do that
> and save myself some work here? :)
Unfortunately the canonical way to find the PSCI node is by compatible
string, and that's what Linux does. While we might be able to ensure all
in-tree dts follow this convention, it's not something that should be
relied upon.
Sorry :(
Cheers,
Mark.
next prev parent reply other threads:[~2014-09-01 18:43 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-27 20:29 [U-Boot] [PATCH 0/8] PSCI v0.2 framework for ARMv8 Arnab Basu
2014-08-27 20:29 ` [U-Boot] [PATCH 1/8] ARM: PSCI: Update psci.h for psci v0.2 Arnab Basu
2014-11-08 7:43 ` Albert ARIBAUD
2014-11-08 8:11 ` [U-Boot] [PATCH 1/8] ARM: PSCI: Update psci.h for psci v0.2 -- CORRECTION Albert ARIBAUD
2014-08-27 20:29 ` [U-Boot] [PATCH 2/8] ARM: PSCI: Alow arch specific DT patching Arnab Basu
2014-08-28 10:10 ` Mark Rutland
2014-08-28 10:51 ` Arnab Basu
2014-08-28 12:47 ` Mark Rutland
2014-08-27 20:29 ` [U-Boot] [PATCH 3/8] ARMv8/fsl-lsch3: Refactor spin-table code Arnab Basu
2014-10-26 21:06 ` Albert ARIBAUD
2014-10-27 4:51 ` arnab.basu at freescale.com
2014-08-27 20:29 ` [U-Boot] [PATCH 4/8] ARMv8: PSCI: Add linker section to hold PSCI code Arnab Basu
2014-09-18 9:12 ` Albert ARIBAUD
2014-09-18 15:28 ` Marc Zyngier
2014-09-19 16:04 ` Albert ARIBAUD
2014-10-11 11:27 ` Albert ARIBAUD
2014-10-11 16:04 ` Marc Zyngier
2014-08-27 20:29 ` [U-Boot] [PATCH 5/8] ARMv8: PCSI: Add generic ARMv8 " Arnab Basu
2014-08-28 11:37 ` Mark Rutland
2014-08-27 20:29 ` [U-Boot] [PATCH 6/8] ARMv8: PSCI: Fixup the device tree for PSCI v0.2 Arnab Basu
2014-08-28 12:44 ` Mark Rutland
2014-08-29 14:03 ` Arnab Basu
2014-09-01 18:43 ` Mark Rutland [this message]
2014-09-02 11:17 ` Mark Rutland
2014-09-02 15:21 ` Stuart Yoder
2014-09-03 15:25 ` Mark Rutland
2014-08-27 20:30 ` [U-Boot] [PATCH 7/8] ARMv8: PSCI: Setup ARMv8 PSCI Arnab Basu
2014-08-27 20:30 ` [U-Boot] [PATCH 8/8] ARMv8: PSCI: Enable SMC Arnab Basu
2014-09-18 9:18 ` Albert ARIBAUD
2014-09-18 15:50 ` arnab.basu at freescale.com
2014-08-27 20:43 ` [U-Boot] [PATCH 0/8] PSCI v0.2 framework for ARMv8 Arnab Basu
2014-11-26 12:52 ` Jan Kiszka
2014-12-03 17:25 ` Mark Rutland
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=20140901184318.GB6427@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