mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-23 14:13:58 +08:00
Two fixes for omap variants for v4.16-rc cycle
Fix insecure W+X mapping warning for SRAM for omaps that don't yet use drivers/misc/*sram*.c code. An earlier attempt at fixing this turned out to cause problems with PM on omap3, this version works with PM on omap3. Also fix dmtimer probe for omap16xx devices that was noticed with the pending dmtimer move to drivers. It seems this has been broken for a while and is a non-critical for booting. It is needed for PM on omap16xx though. -----BEGIN PGP SIGNATURE----- iQJFBAABCAAvFiEEkgNvrZJU/QSQYIcQG9Q+yVyrpXMFAlqz2WgRHHRvbnlAYXRv bWlkZS5jb20ACgkQG9Q+yVyrpXPisRAAla6az5TwwdJB5JC3BkU7pZLfmqR7jsyh 65Zj0KOp+b3kI/9jwaOql+WDf5hktEMEK6JjqDkz4Gs8WUE8tBxRYh95DlIb1sza 0UloFeVy8wgZ0XJk9/6ysXWQ6cFETjR3DW5dKSyHivtFX1MYZETD8wMUhfZ6YTuJ 1lSGpz9RhhI/PSMz9nOA7PQXSF1K+k2h9BzMaEarhDk3ni+gvoY1OahKk6kmXdFG Op41Vfkc3/BqWxhZV79CtPPyoD1G1/pRtEFfxAUuaU6kGbA8XrHpmccyuBv2UXpo pL4NJkI0HPR83W4iSvJgiARcTX7qzpUwCK3NmphhNKQ7tUwwF3mWwMMT+2TsZ4tD kSViqkWqeDxcgC/JMdsff1oksjDQK+uPC8FsReZkK9MyUT3eK4gw+cRTA7fy/3jr UZgf4PjkxouBjzrrR+aQj+R79xTX6pRSEkMjpR9hgY+eQUP9Ls+zk7JnHnJRiGqw GaL4Lg0jh9p7DSLn9xRaPmb6qrs//XPrPoAN70PLdSi5bBqWeknMNSzorz8Xc3eR 7UBaIo445QoSRsG1eBAqxmz8F8R7p/fgQ+lKfxszyxDZ1qyCrORvdZZapdTy9nUA adnqukn2T6QLrt3g/kckAugY8/Piek1JtbPGgFsDMRa4jcOGiZP/kEnKm6c8Hmya LZueeqxuPac= =/ZXy -----END PGP SIGNATURE----- Merge tag 'omap-for-v4.16/sram-fix-signed' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap into fixes Pull "Two fixes for omap variants for v4.16-rc cycle" from Tony Lindgren: Fix insecure W+X mapping warning for SRAM for omaps that don't yet use drivers/misc/*sram*.c code. An earlier attempt at fixing this turned out to cause problems with PM on omap3, this version works with PM on omap3. Also fix dmtimer probe for omap16xx devices that was noticed with the pending dmtimer move to drivers. It seems this has been broken for a while and is a non-critical for booting. It is needed for PM on omap16xx though. * tag 'omap-for-v4.16/sram-fix-signed' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap: ARM: OMAP: Fix SRAM W+X mapping ARM: OMAP: Fix dmtimer init for omap1
This commit is contained in:
commit
66f3731f39
@ -888,11 +888,8 @@ static int omap_dm_timer_probe(struct platform_device *pdev)
|
||||
timer->irq = irq->start;
|
||||
timer->pdev = pdev;
|
||||
|
||||
/* Skip pm_runtime_enable for OMAP1 */
|
||||
if (!(timer->capability & OMAP_TIMER_NEEDS_RESET)) {
|
||||
pm_runtime_enable(dev);
|
||||
pm_runtime_irq_safe(dev);
|
||||
}
|
||||
pm_runtime_enable(dev);
|
||||
pm_runtime_irq_safe(dev);
|
||||
|
||||
if (!timer->reserved) {
|
||||
ret = pm_runtime_get_sync(dev);
|
||||
|
@ -5,13 +5,4 @@ void omap_map_sram(unsigned long start, unsigned long size,
|
||||
unsigned long skip, int cached);
|
||||
void omap_sram_reset(void);
|
||||
|
||||
extern void *omap_sram_push_address(unsigned long size);
|
||||
|
||||
/* Macro to push a function to the internal SRAM, using the fncpy API */
|
||||
#define omap_sram_push(funcp, size) ({ \
|
||||
typeof(&(funcp)) _res = NULL; \
|
||||
void *_sram_address = omap_sram_push_address(size); \
|
||||
if (_sram_address) \
|
||||
_res = fncpy(_sram_address, &(funcp), size); \
|
||||
_res; \
|
||||
})
|
||||
extern void *omap_sram_push(void *funcp, unsigned long size);
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <asm/fncpy.h>
|
||||
#include <asm/tlb.h>
|
||||
#include <asm/cacheflush.h>
|
||||
#include <asm/set_memory.h>
|
||||
|
||||
#include <asm/mach/map.h>
|
||||
|
||||
@ -42,7 +43,7 @@ static void __iomem *omap_sram_ceil;
|
||||
* Note that fncpy requires the returned address to be aligned
|
||||
* to an 8-byte boundary.
|
||||
*/
|
||||
void *omap_sram_push_address(unsigned long size)
|
||||
static void *omap_sram_push_address(unsigned long size)
|
||||
{
|
||||
unsigned long available, new_ceil = (unsigned long)omap_sram_ceil;
|
||||
|
||||
@ -60,6 +61,30 @@ void *omap_sram_push_address(unsigned long size)
|
||||
return (void *)omap_sram_ceil;
|
||||
}
|
||||
|
||||
void *omap_sram_push(void *funcp, unsigned long size)
|
||||
{
|
||||
void *sram;
|
||||
unsigned long base;
|
||||
int pages;
|
||||
void *dst = NULL;
|
||||
|
||||
sram = omap_sram_push_address(size);
|
||||
if (!sram)
|
||||
return NULL;
|
||||
|
||||
base = (unsigned long)sram & PAGE_MASK;
|
||||
pages = PAGE_ALIGN(size) / PAGE_SIZE;
|
||||
|
||||
set_memory_rw(base, pages);
|
||||
|
||||
dst = fncpy(sram, funcp, size);
|
||||
|
||||
set_memory_ro(base, pages);
|
||||
set_memory_x(base, pages);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
/*
|
||||
* The SRAM context is lost during off-idle and stack
|
||||
* needs to be reset.
|
||||
@ -75,6 +100,9 @@ void omap_sram_reset(void)
|
||||
void __init omap_map_sram(unsigned long start, unsigned long size,
|
||||
unsigned long skip, int cached)
|
||||
{
|
||||
unsigned long base;
|
||||
int pages;
|
||||
|
||||
if (size == 0)
|
||||
return;
|
||||
|
||||
@ -95,4 +123,10 @@ void __init omap_map_sram(unsigned long start, unsigned long size,
|
||||
*/
|
||||
memset_io(omap_sram_base + omap_sram_skip, 0,
|
||||
omap_sram_size - omap_sram_skip);
|
||||
|
||||
base = (unsigned long)omap_sram_base;
|
||||
pages = PAGE_ALIGN(omap_sram_size) / PAGE_SIZE;
|
||||
|
||||
set_memory_ro(base, pages);
|
||||
set_memory_x(base, pages);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user