linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: Dave Gerlach <d-gerlach@ti.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Alexandre Belloni <alexandre.belloni@free-electrons.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Shawn Guo <shawnguo@kernel.org>,
	Russell King <linux@arm.linux.org.uk>
Subject: Re: [PATCH 0/3] misc: sram: Introduce protect-exec region type
Date: Fri, 20 Jan 2017 10:24:39 -0800	[thread overview]
Message-ID: <20170120182438.GD7403@atomide.com> (raw)
In-Reply-To: <20170112205220.26325-1-d-gerlach@ti.com>

* Dave Gerlach <d-gerlach@ti.com> [170112 12:54]:
> Hi,
> There are several instances when one would want to execute out of on-chip
> SRAM, such as PM code on ARM platforms, so once again revisiting this
> series to allow that in a generic manner. Seems that having a solution for
> allowing SRAM to be mapped as executable will help clean up PM code on several
> ARM platforms that are using ARM internal __arm_ioremap_exec API
> and also open the door for PM support on new platforms like TI AM335x and
> AM437x.
> 
> Previously a generic solution was attempted by introducing a memremap
> executable API and then calling this from the generic sram driver here [1].
> Russell King brought up the point that we should not just be mapping
> memory as both writable and executable for security reasons which led to
> the solution proposed in this series. 
> 
> The generic SRAM driver already has a concept of "partitions" which can be
> defined and flagged in the device tree, so this series introduces a new flag,
> protect-exec, which indicates the region of SRAM that has been blocked out in
> the DT is protected and executable. It will share the same capabilities of the
> already present sram "pool" which will allow allocation through the use of the
> genalloc framework but also be protected through the use of an "sram_exec_copy"
> helper function to handle the copying of data to the space and also the page
> attributes. In this context protected means the memory is managed such that
> it is *either* writeable and non-executable or read-only and executable through
> manipulation of the page attributes.
> 
> Unforunately, unlike the previously proposed solution, this is not a drop in
> replacement for __arm_ioremap_exec, A large side effect of allocating
> executable SRAM as this series does is that it will require rework for some
> SRAM code as a lot of the assembly code I have seen makes use of PC relative
> memory locations at the end of the code for local variables. This will no
> longer be possible if we must maintain the read-only executable status of
> the memory. If that's required then SRAM code will need to use pointers to
> a separately allocated region of sram that is just a normal writable pool.
> 
> As mentioned in previous series I still see several platforms (at-91,
> imx6, socfpga, omap3) that could make use of this although some rework may
> be required unlike with the last solution, and it will be needed for the
> forthcoming TI am335x and am437x PM code as portions of PM code are
> moving in to drivers. An example of this in use can be seen at [2] in the 
> drivers/memory/ti-emif-sram.c and drivers/soc/ti/pm33xx.c files.

Looks good to me:

Acked-by: Tony Lindgren <tony@atomide.com>

> [1] http://www.spinics.net/lists/linux-omap/msg132728.html
> [2] https://github.com/dgerlach/linux-pm/tree/upstream/v4.10/sram-exec-copy-pm
> 
> Dave Gerlach (3):
>   misc: sram: Split sram data structures into local header
>   misc: sram: Introduce support code for protect-exec sram type
>   misc: sram: Integrate protect-exec reserved sram area type
> 
>  Documentation/devicetree/bindings/sram/sram.txt |   6 ++
>  drivers/misc/Kconfig                            |   4 +
>  drivers/misc/Makefile                           |   1 +
>  drivers/misc/sram-exec.c                        | 105 ++++++++++++++++++++++++
>  drivers/misc/sram.c                             |  51 +++++-------
>  drivers/misc/sram.h                             |  58 +++++++++++++
>  include/linux/sram.h                            |  27 ++++++
>  7 files changed, 222 insertions(+), 30 deletions(-)
>  create mode 100644 drivers/misc/sram-exec.c
>  create mode 100644 drivers/misc/sram.h
>  create mode 100644 include/linux/sram.h

      parent reply	other threads:[~2017-01-20 18:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-12 20:52 [PATCH 0/3] misc: sram: Introduce protect-exec region type Dave Gerlach
2017-01-12 20:52 ` [PATCH 1/3] misc: sram: Split sram data structures into local header Dave Gerlach
2017-01-12 20:52 ` [PATCH 2/3] misc: sram: Introduce support code for protect-exec sram type Dave Gerlach
2017-01-12 20:52 ` [PATCH 3/3] misc: sram: Integrate protect-exec reserved sram area type Dave Gerlach
2017-01-20 18:24 ` Tony Lindgren [this message]

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=20170120182438.GD7403@atomide.com \
    --to=tony@atomide.com \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=arnd@arndb.de \
    --cc=d-gerlach@ti.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=shawnguo@kernel.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).