Commit 1abe3af2 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'fixes' of master.kernel.org:/home/rmk/linux-2.6-arm

* 'fixes' of master.kernel.org:/home/rmk/linux-2.6-arm:
  ARM: 6657/1: hw_breakpoint: fix ptrace breakpoint advertising on unsupported arch
  ARM: 6656/1: hw_breakpoint: avoid UNPREDICTABLE behaviour when reading DBGDSCR
  ARM: 6658/1: collie: do actually pass locomo_info to locomo driver
  ARM: 6659/1: Thumb-2: Make CONFIG_OABI_COMPAT depend on !CONFIG_THUMB2_KERNEL
  ARM: 6654/1: perf/oprofile: fix off-by-one in stack check
  ARM: fixup SMP alternatives in modules
  ARM: make SWP emulation explicit on !CPU_USE_DOMAINS
  ARM: Avoid building unsafe kernels on OMAP2 and MX3
  ARM: pxa: Properly configure PWM period for palm27x
  ARM: pxa: only save/restore registers when pm functions are defined
  ARM: pxa/colibri: use correct SD detect pin
  ARM: pxa: fix mfpr_sync to read from valid offset
parents 15a831f2 e3329cba
...@@ -1391,7 +1391,7 @@ config AEABI ...@@ -1391,7 +1391,7 @@ config AEABI
config OABI_COMPAT config OABI_COMPAT
bool "Allow old ABI binaries to run with this kernel (EXPERIMENTAL)" bool "Allow old ABI binaries to run with this kernel (EXPERIMENTAL)"
depends on AEABI && EXPERIMENTAL depends on AEABI && EXPERIMENTAL && !THUMB2_KERNEL
default y default y
help help
This option preserves the old syscall interface along with the This option preserves the old syscall interface along with the
......
...@@ -391,6 +391,7 @@ ENDPROC(__turn_mmu_on) ...@@ -391,6 +391,7 @@ ENDPROC(__turn_mmu_on)
#ifdef CONFIG_SMP_ON_UP #ifdef CONFIG_SMP_ON_UP
__INIT
__fixup_smp: __fixup_smp:
and r3, r9, #0x000f0000 @ architecture version and r3, r9, #0x000f0000 @ architecture version
teq r3, #0x000f0000 @ CPU ID supported? teq r3, #0x000f0000 @ CPU ID supported?
...@@ -415,18 +416,7 @@ __fixup_smp_on_up: ...@@ -415,18 +416,7 @@ __fixup_smp_on_up:
sub r3, r0, r3 sub r3, r0, r3
add r4, r4, r3 add r4, r4, r3
add r5, r5, r3 add r5, r5, r3
2: cmp r4, r5 b __do_fixup_smp_on_up
movhs pc, lr
ldmia r4!, {r0, r6}
ARM( str r6, [r0, r3] )
THUMB( add r0, r0, r3 )
#ifdef __ARMEB__
THUMB( mov r6, r6, ror #16 ) @ Convert word order for big-endian.
#endif
THUMB( strh r6, [r0], #2 ) @ For Thumb-2, store as two halfwords
THUMB( mov r6, r6, lsr #16 ) @ to be robust against misaligned r3.
THUMB( strh r6, [r0] )
b 2b
ENDPROC(__fixup_smp) ENDPROC(__fixup_smp)
.align .align
...@@ -440,7 +430,31 @@ smp_on_up: ...@@ -440,7 +430,31 @@ smp_on_up:
ALT_SMP(.long 1) ALT_SMP(.long 1)
ALT_UP(.long 0) ALT_UP(.long 0)
.popsection .popsection
#endif
.text
__do_fixup_smp_on_up:
cmp r4, r5
movhs pc, lr
ldmia r4!, {r0, r6}
ARM( str r6, [r0, r3] )
THUMB( add r0, r0, r3 )
#ifdef __ARMEB__
THUMB( mov r6, r6, ror #16 ) @ Convert word order for big-endian.
#endif #endif
THUMB( strh r6, [r0], #2 ) @ For Thumb-2, store as two halfwords
THUMB( mov r6, r6, lsr #16 ) @ to be robust against misaligned r3.
THUMB( strh r6, [r0] )
b __do_fixup_smp_on_up
ENDPROC(__do_fixup_smp_on_up)
ENTRY(fixup_smp)
stmfd sp!, {r4 - r6, lr}
mov r4, r0
add r5, r0, r1
mov r3, #0
bl __do_fixup_smp_on_up
ldmfd sp!, {r4 - r6, pc}
ENDPROC(fixup_smp)
#include "head-common.S" #include "head-common.S"
...@@ -137,11 +137,10 @@ static u8 get_debug_arch(void) ...@@ -137,11 +137,10 @@ static u8 get_debug_arch(void)
u32 didr; u32 didr;
/* Do we implement the extended CPUID interface? */ /* Do we implement the extended CPUID interface? */
if (((read_cpuid_id() >> 16) & 0xf) != 0xf) { if (WARN_ONCE((((read_cpuid_id() >> 16) & 0xf) != 0xf),
pr_warning("CPUID feature registers not supported. " "CPUID feature registers not supported. "
"Assuming v6 debug is present.\n"); "Assuming v6 debug is present.\n"))
return ARM_DEBUG_ARCH_V6; return ARM_DEBUG_ARCH_V6;
}
ARM_DBG_READ(c0, 0, didr); ARM_DBG_READ(c0, 0, didr);
return (didr >> 16) & 0xf; return (didr >> 16) & 0xf;
...@@ -152,6 +151,12 @@ u8 arch_get_debug_arch(void) ...@@ -152,6 +151,12 @@ u8 arch_get_debug_arch(void)
return debug_arch; return debug_arch;
} }
static int debug_arch_supported(void)
{
u8 arch = get_debug_arch();
return arch >= ARM_DEBUG_ARCH_V6 && arch <= ARM_DEBUG_ARCH_V7_ECP14;
}
/* Determine number of BRP register available. */ /* Determine number of BRP register available. */
static int get_num_brp_resources(void) static int get_num_brp_resources(void)
{ {
...@@ -268,6 +273,9 @@ static int enable_monitor_mode(void) ...@@ -268,6 +273,9 @@ static int enable_monitor_mode(void)
int hw_breakpoint_slots(int type) int hw_breakpoint_slots(int type)
{ {
if (!debug_arch_supported())
return 0;
/* /*
* We can be called early, so don't rely on * We can be called early, so don't rely on
* our static variables being initialised. * our static variables being initialised.
...@@ -834,11 +842,11 @@ static void reset_ctrl_regs(void *unused) ...@@ -834,11 +842,11 @@ static void reset_ctrl_regs(void *unused)
/* /*
* v7 debug contains save and restore registers so that debug state * v7 debug contains save and restore registers so that debug state
* can be maintained across low-power modes without leaving * can be maintained across low-power modes without leaving the debug
* the debug logic powered up. It is IMPLEMENTATION DEFINED whether * logic powered up. It is IMPLEMENTATION DEFINED whether we can access
* we can write to the debug registers out of reset, so we must * the debug registers out of reset, so we must unlock the OS Lock
* unlock the OS Lock Access Register to avoid taking undefined * Access Register to avoid taking undefined instruction exceptions
* instruction exceptions later on. * later on.
*/ */
if (debug_arch >= ARM_DEBUG_ARCH_V7_ECP14) { if (debug_arch >= ARM_DEBUG_ARCH_V7_ECP14) {
/* /*
...@@ -882,7 +890,7 @@ static int __init arch_hw_breakpoint_init(void) ...@@ -882,7 +890,7 @@ static int __init arch_hw_breakpoint_init(void)
debug_arch = get_debug_arch(); debug_arch = get_debug_arch();
if (debug_arch > ARM_DEBUG_ARCH_V7_ECP14) { if (!debug_arch_supported()) {
pr_info("debug architecture 0x%x unsupported.\n", debug_arch); pr_info("debug architecture 0x%x unsupported.\n", debug_arch);
return 0; return 0;
} }
...@@ -899,18 +907,18 @@ static int __init arch_hw_breakpoint_init(void) ...@@ -899,18 +907,18 @@ static int __init arch_hw_breakpoint_init(void)
pr_info("%d breakpoint(s) reserved for watchpoint " pr_info("%d breakpoint(s) reserved for watchpoint "
"single-step.\n", core_num_reserved_brps); "single-step.\n", core_num_reserved_brps);
/*
* Reset the breakpoint resources. We assume that a halting
* debugger will leave the world in a nice state for us.
*/
on_each_cpu(reset_ctrl_regs, NULL, 1);
ARM_DBG_READ(c1, 0, dscr); ARM_DBG_READ(c1, 0, dscr);
if (dscr & ARM_DSCR_HDBGEN) { if (dscr & ARM_DSCR_HDBGEN) {
max_watchpoint_len = 4;
pr_warning("halting debug mode enabled. Assuming maximum " pr_warning("halting debug mode enabled. Assuming maximum "
"watchpoint size of 4 bytes."); "watchpoint size of %u bytes.", max_watchpoint_len);
} else { } else {
/*
* Reset the breakpoint resources. We assume that a halting
* debugger will leave the world in a nice state for us.
*/
smp_call_function(reset_ctrl_regs, NULL, 1);
reset_ctrl_regs(NULL);
/* Work out the maximum supported watchpoint length. */ /* Work out the maximum supported watchpoint length. */
max_watchpoint_len = get_max_wp_len(); max_watchpoint_len = get_max_wp_len();
pr_info("maximum watchpoint size is %u bytes.\n", pr_info("maximum watchpoint size is %u bytes.\n",
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <asm/pgtable.h> #include <asm/pgtable.h>
#include <asm/sections.h> #include <asm/sections.h>
#include <asm/smp_plat.h>
#include <asm/unwind.h> #include <asm/unwind.h>
#ifdef CONFIG_XIP_KERNEL #ifdef CONFIG_XIP_KERNEL
...@@ -268,12 +269,28 @@ struct mod_unwind_map { ...@@ -268,12 +269,28 @@ struct mod_unwind_map {
const Elf_Shdr *txt_sec; const Elf_Shdr *txt_sec;
}; };
static const Elf_Shdr *find_mod_section(const Elf32_Ehdr *hdr,
const Elf_Shdr *sechdrs, const char *name)
{
const Elf_Shdr *s, *se;
const char *secstrs = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset;
for (s = sechdrs, se = sechdrs + hdr->e_shnum; s < se; s++)
if (strcmp(name, secstrs + s->sh_name) == 0)
return s;
return NULL;
}
extern void fixup_smp(const void *, unsigned long);
int module_finalize(const Elf32_Ehdr *hdr, const Elf_Shdr *sechdrs, int module_finalize(const Elf32_Ehdr *hdr, const Elf_Shdr *sechdrs,
struct module *mod) struct module *mod)
{ {
const Elf_Shdr * __maybe_unused s = NULL;
#ifdef CONFIG_ARM_UNWIND #ifdef CONFIG_ARM_UNWIND
const char *secstrs = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset; const char *secstrs = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset;
const Elf_Shdr *s, *sechdrs_end = sechdrs + hdr->e_shnum; const Elf_Shdr *sechdrs_end = sechdrs + hdr->e_shnum;
struct mod_unwind_map maps[ARM_SEC_MAX]; struct mod_unwind_map maps[ARM_SEC_MAX];
int i; int i;
...@@ -315,6 +332,9 @@ int module_finalize(const Elf32_Ehdr *hdr, const Elf_Shdr *sechdrs, ...@@ -315,6 +332,9 @@ int module_finalize(const Elf32_Ehdr *hdr, const Elf_Shdr *sechdrs,
maps[i].txt_sec->sh_addr, maps[i].txt_sec->sh_addr,
maps[i].txt_sec->sh_size); maps[i].txt_sec->sh_size);
#endif #endif
s = find_mod_section(hdr, sechdrs, ".alt.smp.init");
if (s && !is_smp())
fixup_smp((void *)s->sh_addr, s->sh_size);
return 0; return 0;
} }
......
...@@ -700,7 +700,7 @@ user_backtrace(struct frame_tail __user *tail, ...@@ -700,7 +700,7 @@ user_backtrace(struct frame_tail __user *tail,
* Frame pointers should strictly progress back up the stack * Frame pointers should strictly progress back up the stack
* (towards higher addresses). * (towards higher addresses).
*/ */
if (tail >= buftail.fp) if (tail + 1 >= buftail.fp)
return NULL; return NULL;
return buftail.fp - 1; return buftail.fp - 1;
......
...@@ -50,7 +50,7 @@ static void __init colibri_mmc_init(void) ...@@ -50,7 +50,7 @@ static void __init colibri_mmc_init(void)
GPIO0_COLIBRI_PXA270_SD_DETECT; GPIO0_COLIBRI_PXA270_SD_DETECT;
if (machine_is_colibri300()) /* PXA300 Colibri */ if (machine_is_colibri300()) /* PXA300 Colibri */
colibri_mci_platform_data.gpio_card_detect = colibri_mci_platform_data.gpio_card_detect =
GPIO39_COLIBRI_PXA300_SD_DETECT; GPIO13_COLIBRI_PXA300_SD_DETECT;
else /* PXA320 Colibri */ else /* PXA320 Colibri */
colibri_mci_platform_data.gpio_card_detect = colibri_mci_platform_data.gpio_card_detect =
GPIO28_COLIBRI_PXA320_SD_DETECT; GPIO28_COLIBRI_PXA320_SD_DETECT;
......
...@@ -41,7 +41,7 @@ static mfp_cfg_t colibri_pxa300_evalboard_pin_config[] __initdata = { ...@@ -41,7 +41,7 @@ static mfp_cfg_t colibri_pxa300_evalboard_pin_config[] __initdata = {
GPIO4_MMC1_DAT1, GPIO4_MMC1_DAT1,
GPIO5_MMC1_DAT2, GPIO5_MMC1_DAT2,
GPIO6_MMC1_DAT3, GPIO6_MMC1_DAT3,
GPIO39_GPIO, /* SD detect */ GPIO13_GPIO, /* GPIO13_COLIBRI_PXA300_SD_DETECT */
/* UHC */ /* UHC */
GPIO0_2_USBH_PEN, GPIO0_2_USBH_PEN,
......
...@@ -60,7 +60,7 @@ static inline void colibri_pxa3xx_init_nand(void) {} ...@@ -60,7 +60,7 @@ static inline void colibri_pxa3xx_init_nand(void) {}
#define GPIO113_COLIBRI_PXA270_TS_IRQ 113 #define GPIO113_COLIBRI_PXA270_TS_IRQ 113
/* GPIO definitions for Colibri PXA300/310 */ /* GPIO definitions for Colibri PXA300/310 */
#define GPIO39_COLIBRI_PXA300_SD_DETECT 39 #define GPIO13_COLIBRI_PXA300_SD_DETECT 13
/* GPIO definitions for Colibri PXA320 */ /* GPIO definitions for Colibri PXA320 */
#define GPIO28_COLIBRI_PXA320_SD_DETECT 28 #define GPIO28_COLIBRI_PXA320_SD_DETECT 28
......
...@@ -323,7 +323,7 @@ static struct platform_pwm_backlight_data palm27x_backlight_data = { ...@@ -323,7 +323,7 @@ static struct platform_pwm_backlight_data palm27x_backlight_data = {
.pwm_id = 0, .pwm_id = 0,
.max_brightness = 0xfe, .max_brightness = 0xfe,
.dft_brightness = 0x7e, .dft_brightness = 0x7e,
.pwm_period_ns = 3500, .pwm_period_ns = 3500 * 1024,
.init = palm27x_backlight_init, .init = palm27x_backlight_init,
.notify = palm27x_backlight_notify, .notify = palm27x_backlight_notify,
.exit = palm27x_backlight_exit, .exit = palm27x_backlight_exit,
......
...@@ -33,7 +33,7 @@ int pxa_pm_enter(suspend_state_t state) ...@@ -33,7 +33,7 @@ int pxa_pm_enter(suspend_state_t state)
#endif #endif
/* skip registers saving for standby */ /* skip registers saving for standby */
if (state != PM_SUSPEND_STANDBY) { if (state != PM_SUSPEND_STANDBY && pxa_cpu_pm_fns->save) {
pxa_cpu_pm_fns->save(sleep_save); pxa_cpu_pm_fns->save(sleep_save);
/* before sleeping, calculate and save a checksum */ /* before sleeping, calculate and save a checksum */
for (i = 0; i < pxa_cpu_pm_fns->save_count - 1; i++) for (i = 0; i < pxa_cpu_pm_fns->save_count - 1; i++)
...@@ -44,7 +44,7 @@ int pxa_pm_enter(suspend_state_t state) ...@@ -44,7 +44,7 @@ int pxa_pm_enter(suspend_state_t state)
pxa_cpu_pm_fns->enter(state); pxa_cpu_pm_fns->enter(state);
cpu_init(); cpu_init();
if (state != PM_SUSPEND_STANDBY) { if (state != PM_SUSPEND_STANDBY && pxa_cpu_pm_fns->restore) {
/* after sleeping, validate the checksum */ /* after sleeping, validate the checksum */
for (i = 0; i < pxa_cpu_pm_fns->save_count - 1; i++) for (i = 0; i < pxa_cpu_pm_fns->save_count - 1; i++)
checksum += sleep_save[i]; checksum += sleep_save[i];
......
...@@ -241,6 +241,9 @@ static struct locomo_platform_data locomo_info = { ...@@ -241,6 +241,9 @@ static struct locomo_platform_data locomo_info = {
struct platform_device collie_locomo_device = { struct platform_device collie_locomo_device = {
.name = "locomo", .name = "locomo",
.id = 0, .id = 0,
.dev = {
.platform_data = &locomo_info,
},
.num_resources = ARRAY_SIZE(locomo_resources), .num_resources = ARRAY_SIZE(locomo_resources),
.resource = locomo_resources, .resource = locomo_resources,
}; };
......
...@@ -405,7 +405,7 @@ config CPU_V6 ...@@ -405,7 +405,7 @@ config CPU_V6
config CPU_32v6K config CPU_32v6K
bool "Support ARM V6K processor extensions" if !SMP bool "Support ARM V6K processor extensions" if !SMP
depends on CPU_V6 || CPU_V7 depends on CPU_V6 || CPU_V7
default y if SMP && !(ARCH_MX3 || ARCH_OMAP2) default y if SMP
help help
Say Y here if your ARMv6 processor supports the 'K' extension. Say Y here if your ARMv6 processor supports the 'K' extension.
This enables the kernel to use some instructions not present This enables the kernel to use some instructions not present
...@@ -416,7 +416,7 @@ config CPU_32v6K ...@@ -416,7 +416,7 @@ config CPU_32v6K
# ARMv7 # ARMv7
config CPU_V7 config CPU_V7
bool "Support ARM V7 processor" if ARCH_INTEGRATOR || MACH_REALVIEW_EB || MACH_REALVIEW_PBX bool "Support ARM V7 processor" if ARCH_INTEGRATOR || MACH_REALVIEW_EB || MACH_REALVIEW_PBX
select CPU_32v6K if !ARCH_OMAP2 select CPU_32v6K
select CPU_32v7 select CPU_32v7
select CPU_ABRT_EV7 select CPU_ABRT_EV7
select CPU_PABRT_V7 select CPU_PABRT_V7
...@@ -644,7 +644,7 @@ config ARM_THUMBEE ...@@ -644,7 +644,7 @@ config ARM_THUMBEE
config SWP_EMULATE config SWP_EMULATE
bool "Emulate SWP/SWPB instructions" bool "Emulate SWP/SWPB instructions"
depends on CPU_V7 && !CPU_V6 depends on !CPU_USE_DOMAINS && CPU_V7 && !CPU_V6
select HAVE_PROC_CPU if PROC_FS select HAVE_PROC_CPU if PROC_FS
default y if SMP default y if SMP
help help
......
...@@ -85,7 +85,7 @@ static struct frame_tail* user_backtrace(struct frame_tail *tail) ...@@ -85,7 +85,7 @@ static struct frame_tail* user_backtrace(struct frame_tail *tail)
/* frame pointers should strictly progress back up the stack /* frame pointers should strictly progress back up the stack
* (towards higher addresses) */ * (towards higher addresses) */
if (tail >= buftail[0].fp) if (tail + 1 >= buftail[0].fp)
return NULL; return NULL;
return buftail[0].fp-1; return buftail[0].fp-1;
......
...@@ -139,10 +139,11 @@ static const unsigned long mfpr_edge[] = { ...@@ -139,10 +139,11 @@ static const unsigned long mfpr_edge[] = {
#define mfp_configured(p) ((p)->config != -1) #define mfp_configured(p) ((p)->config != -1)
/* /*
* perform a read-back of any MFPR register to make sure the * perform a read-back of any valid MFPR register to make sure the
* previous writings are finished * previous writings are finished
*/ */
#define mfpr_sync() (void)__raw_readl(mfpr_mmio_base + 0) static unsigned long mfpr_off_readback;
#define mfpr_sync() (void)__raw_readl(mfpr_mmio_base + mfpr_off_readback)
static inline void __mfp_config_run(struct mfp_pin *p) static inline void __mfp_config_run(struct mfp_pin *p)
{ {
...@@ -248,6 +249,9 @@ void __init mfp_init_addr(struct mfp_addr_map *map) ...@@ -248,6 +249,9 @@ void __init mfp_init_addr(struct mfp_addr_map *map)
spin_lock_irqsave(&mfp_spin_lock, flags); spin_lock_irqsave(&mfp_spin_lock, flags);
/* mfp offset for readback */
mfpr_off_readback = map[0].offset;
for (p = map; p->start != MFP_PIN_INVALID; p++) { for (p = map; p->start != MFP_PIN_INVALID; p++) {
offset = p->offset; offset = p->offset;
i = p->start; i = p->start;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment