linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] Add memremap executable mapping and extend drivers/misc/sram.c
@ 2016-10-27 18:56 Dave Gerlach
  2016-10-27 18:56 ` [PATCH 1/3] ARM: memremap: implement arch_memremap_exec/exec_nocache Dave Gerlach
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Dave Gerlach @ 2016-10-27 18:56 UTC (permalink / raw)
  To: Arnd Bergmann, Russell King, Dan Williams
  Cc: linux-arm-kernel, linux-kernel, linux-omap, Greg Kroah-Hartman,
	Shawn Guo, Tony Lindgren, Alexandre Belloni, Nishanth Menon,
	Dave Gerlach

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. This was last sent as RFC here [1] and based on comments from Russell
King and Arnd Bergmann has been rewritten to use memremap API rather than
ioremap API, as executable iomem does not really make sense.

I still see several platforms (at-91, imx6, socfpga) that could make use
of this and use the generic sram driver to allocate the SRAM needed for PM.
This series allows direct allocation of SRAM using the generic SRAM driver
that will be already mapped as executable. Otherwise platform SRAM allocation
code must be used or if the generic sram driver is used as-is the memory
must be remapped as executable after it has been mapped normally by the
SRAM driver.

I had sent omap3 series to convert from using old omap sram platform
mapping code to using the generic sram driver instead here [2] which was
based on previous RFC but can easily be rebased on this updated series.
Finally, forthcoming TI am335x and am437x PM code must make use of
it as well, as portions of PM code are moving in to drivers.

Changes from the RFC include:

- Rather than introduce ioremap_exec API, use memremap API, as the concept
  of executable iomem does not make sense; any memory that can used to
  run code should not have io side effects like iomem.
- Rather than having a fallback mapping if a platform does not support
  exec mappings under the memremap API, have the mapping fail, as if you
  are mapping memory as exec, presumably you will then try to run code
  from it which will fail anyway, so it makes more sense to prevent the
  mapping in the first place.
- Update sram driver to use memremap rather than ioremap for exec flags.

Regards,
Dave

[1] http://www.spinics.net/lists/arm-kernel/msg503071.html
[2] http://www.spinics.net/lists/linux-omap/msg128753.html

Dave Gerlach (3):
  ARM: memremap: implement arch_memremap_exec/exec_nocache
  memremap: add MEMREMAP_EXEC and MEMREMAP_EXEC_NOCACHE flags
  misc: SRAM: Add option to map SRAM to allow code execution

 Documentation/devicetree/bindings/sram/sram.txt |  2 ++
 arch/arm/include/asm/io.h                       |  5 ++++
 arch/arm/mm/ioremap.c                           | 16 ++++++++++++
 arch/arm/mm/nommu.c                             | 12 +++++++++
 drivers/misc/sram.c                             |  7 +++++
 include/linux/io.h                              |  2 ++
 kernel/memremap.c                               | 34 ++++++++++++++++++++++++-
 7 files changed, 77 insertions(+), 1 deletion(-)

-- 
2.9.3

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-11-07 21:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-27 18:56 [PATCH 0/3] Add memremap executable mapping and extend drivers/misc/sram.c Dave Gerlach
2016-10-27 18:56 ` [PATCH 1/3] ARM: memremap: implement arch_memremap_exec/exec_nocache Dave Gerlach
2016-10-27 18:56 ` [PATCH 2/3] memremap: add MEMREMAP_EXEC and MEMREMAP_EXEC_NOCACHE flags Dave Gerlach
2016-10-27 18:56 ` [PATCH 3/3] misc: SRAM: Add option to map SRAM to allow code execution Dave Gerlach
2016-11-05  2:47 ` [PATCH 0/3] Add memremap executable mapping and extend drivers/misc/sram.c Alexandre Belloni
2016-11-07 11:04 ` Russell King - ARM Linux
2016-11-07 17:43   ` Tony Lindgren
2016-11-07 21:34     ` Dave Gerlach

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).