Commit 3e9ca022 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc

Pull powerpc fixes from Paul Mackerras:
 "Two small fixes for powerpc:
   - a fix for a regression since 3.2 that causes 4-second (or longer)
     pauses
   - a fix for a potential oops when loading kernel modules on 32-bit
     embedded systems."

* 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc:
  powerpc: Fix kernel panic during kernel module load
  powerpc/time: Sanity check of decrementer expiration is necessary
parents e7264308 3c752965
...@@ -176,8 +176,8 @@ int module_frob_arch_sections(Elf32_Ehdr *hdr, ...@@ -176,8 +176,8 @@ int module_frob_arch_sections(Elf32_Ehdr *hdr,
static inline int entry_matches(struct ppc_plt_entry *entry, Elf32_Addr val) static inline int entry_matches(struct ppc_plt_entry *entry, Elf32_Addr val)
{ {
if (entry->jump[0] == 0x3d600000 + ((val + 0x8000) >> 16) if (entry->jump[0] == 0x3d800000 + ((val + 0x8000) >> 16)
&& entry->jump[1] == 0x396b0000 + (val & 0xffff)) && entry->jump[1] == 0x398c0000 + (val & 0xffff))
return 1; return 1;
return 0; return 0;
} }
...@@ -204,10 +204,9 @@ static uint32_t do_plt_call(void *location, ...@@ -204,10 +204,9 @@ static uint32_t do_plt_call(void *location,
entry++; entry++;
} }
/* Stolen from Paul Mackerras as well... */ entry->jump[0] = 0x3d800000+((val+0x8000)>>16); /* lis r12,sym@ha */
entry->jump[0] = 0x3d600000+((val+0x8000)>>16); /* lis r11,sym@ha */ entry->jump[1] = 0x398c0000 + (val&0xffff); /* addi r12,r12,sym@l*/
entry->jump[1] = 0x396b0000 + (val&0xffff); /* addi r11,r11,sym@l*/ entry->jump[2] = 0x7d8903a6; /* mtctr r12 */
entry->jump[2] = 0x7d6903a6; /* mtctr r11 */
entry->jump[3] = 0x4e800420; /* bctr */ entry->jump[3] = 0x4e800420; /* bctr */
DEBUGP("Initialized plt for 0x%x at %p\n", val, entry); DEBUGP("Initialized plt for 0x%x at %p\n", val, entry);
......
...@@ -475,6 +475,7 @@ void timer_interrupt(struct pt_regs * regs) ...@@ -475,6 +475,7 @@ void timer_interrupt(struct pt_regs * regs)
struct pt_regs *old_regs; struct pt_regs *old_regs;
u64 *next_tb = &__get_cpu_var(decrementers_next_tb); u64 *next_tb = &__get_cpu_var(decrementers_next_tb);
struct clock_event_device *evt = &__get_cpu_var(decrementers); struct clock_event_device *evt = &__get_cpu_var(decrementers);
u64 now;
/* Ensure a positive value is written to the decrementer, or else /* Ensure a positive value is written to the decrementer, or else
* some CPUs will continue to take decrementer exceptions. * some CPUs will continue to take decrementer exceptions.
...@@ -509,9 +510,16 @@ void timer_interrupt(struct pt_regs * regs) ...@@ -509,9 +510,16 @@ void timer_interrupt(struct pt_regs * regs)
irq_work_run(); irq_work_run();
} }
*next_tb = ~(u64)0; now = get_tb_or_rtc();
if (evt->event_handler) if (now >= *next_tb) {
evt->event_handler(evt); *next_tb = ~(u64)0;
if (evt->event_handler)
evt->event_handler(evt);
} else {
now = *next_tb - now;
if (now <= DECREMENTER_MAX)
set_dec((int)now);
}
#ifdef CONFIG_PPC64 #ifdef CONFIG_PPC64
/* collect purr register values often, for accurate calculations */ /* collect purr register values often, for accurate calculations */
......
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