Skip to content

SRAM patcher: patch register addresses in SRAM code at runtime

Paul Walmsley linux-omap 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5SRAM patcher: add SRAM virtual address patcherarch/arm/plat-omap/Kconfig arch/arm/plat-omap/sram.c include/asm-arm/arch-omap/sram.h +1 more+80 -00 replies
2/5SRAM patcher: convert omap24xx_sram_suspend to use runtime SRAM patcherarch/arm/mach-omap2/pm.c arch/arm/mach-omap2/sleep.S+24 -100 replies
3/5SRAM patcher: convert sram_ddr_init to use runtime SRAM patcherarch/arm/mach-omap2/sram-fn.S arch/arm/plat-omap/sram.c+44 -120 replies
4/5SRAM patcher: convert sram_reprogram_sdrc to use runtime SRAM patcherarch/arm/mach-omap2/sdrc.h arch/arm/mach-omap2/sram-fn.S arch/arm/plat-omap/sram.c+44 -200 replies
5/5SRAM patcher: convert omap2_set_prcm to use runtime SRAM patcherarch/arm/mach-omap2/sram-fn.S arch/arm/plat-omap/sram.c+53 -280 replies

Reviews trailers per patch

None of the 5 patches has a Reviewed-by or Acked-by.

PatchRichard Woodruff
SeriesSignedoff-by
1/5
2/5
3/5
4/5
5/5

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/5] SRAM patcher: patch register addresses in SRAM code at runtime

Several SRAM-based assembly-language routines in the Linux OMAP kernel use hardcoded virtual addresses to access system registers. These addresses were defined at compile-time by the preprocessor, since the same registers often appeared at different virtual addresses depending upon the target OMAP architecture. Hardcoding the addresses is efficient and convenient to implement; but precludes a single kernel binary image from supporting multiple OMAP architectures.

This patches implement a different approach. They patch in the correct register addresses at runtime into the SRAM, just after the code is copied there. While the current code simply writes in the preprocessor-defined address bases, a forthcoming patch series uses this code to write runtime-computed address bases.

The code that does the patching is quite paranoid by default, and will refuse to overwrite any address that does not contain a magic number, SRAM_VA_MAGIC. It also contains debugging printks which can be activated by defining the DEBUG symbol in sram.c and compiling with CONFIG_DEBUG_LL enabled.

Boot-tested on N800 and 3430SDP. If someone out there with a 2430SDP can give these a whirl, that would be appreciated. Comments welcome,

- Paul

---

diffstat:

 arch/arm/mach-omap2/pm.c         |   13 +++
 arch/arm/mach-omap2/sdrc.h       |    2
 arch/arm/mach-omap2/sleep.S      |   21 +++---
 arch/arm/mach-omap2/sram-fn.S    |  125 +++++++++++++++++++-----------------
 arch/arm/plat-omap/Kconfig       |   10 ++
 arch/arm/plat-omap/sram.c        |  135 +++++++++++++++++++++++++++++++++++++++
 include/asm-arm/arch-omap/sram.h |    3
 include/linux/poison.h           |    6 +
 8 files changed, 245 insertions(+), 70 deletions(-)

size:

text data bss dec hex filename

2924328  152944   85112 3162384  304110 vmlinux.orig.n800
2924504  152944   85112 3162560  3041c0 vmlinux.patched.nodebug.n800
2924928  152944   85112 3162984  304368 vmlinux.patched.debug.n800