Merge branch 'for-linus' of git://git390.marist.edu/pub/scm/linux-2.6

* 'for-linus' of git://git390.marist.edu/pub/scm/linux-2.6:
[S390] zcrypt: fix scheduling of hrtimer ap_poll_timer
[S390] vdso: clock_gettime of CLOCK_THREAD_CPUTIME_ID with noexec=on
[S390] vdso: fix per cpu area allocation
[S390] hibernation: fix register corruption on machine checks
[S390] hibernation: fix lowcore handling

+55 -47
+2 -2
arch/s390/kernel/early.c
··· 210 machine_flags |= MACHINE_FLAG_VM; 211 } 212 213 - static void early_pgm_check_handler(void) 214 { 215 unsigned long addr; 216 const struct exception_table_entry *fixup; ··· 222 S390_lowcore.program_old_psw.addr = fixup->fixup | PSW_ADDR_AMODE; 223 } 224 225 - void setup_lowcore_early(void) 226 { 227 psw_t psw; 228
··· 210 machine_flags |= MACHINE_FLAG_VM; 211 } 212 213 + static __init void early_pgm_check_handler(void) 214 { 215 unsigned long addr; 216 const struct exception_table_entry *fixup; ··· 222 S390_lowcore.program_old_psw.addr = fixup->fixup | PSW_ADDR_AMODE; 223 } 224 225 + static noinline __init void setup_lowcore_early(void) 226 { 227 psw_t psw; 228
+4 -3
arch/s390/kernel/smp.c
··· 687 #ifndef CONFIG_64BIT 688 if (MACHINE_HAS_IEEE) 689 lowcore->extended_save_area_addr = (u32) save_area; 690 - #else 691 - if (vdso_alloc_per_cpu(smp_processor_id(), lowcore)) 692 - BUG(); 693 #endif 694 set_prefix((u32)(unsigned long) lowcore); 695 local_mcck_enable(); 696 local_irq_enable(); 697 for_each_possible_cpu(cpu) 698 if (cpu != smp_processor_id()) 699 smp_create_idle(cpu);
··· 687 #ifndef CONFIG_64BIT 688 if (MACHINE_HAS_IEEE) 689 lowcore->extended_save_area_addr = (u32) save_area; 690 #endif 691 set_prefix((u32)(unsigned long) lowcore); 692 local_mcck_enable(); 693 local_irq_enable(); 694 + #ifdef CONFIG_64BIT 695 + if (vdso_alloc_per_cpu(smp_processor_id(), &S390_lowcore)) 696 + BUG(); 697 + #endif 698 for_each_possible_cpu(cpu) 699 if (cpu != smp_processor_id()) 700 smp_create_idle(cpu);
+9 -2
arch/s390/kernel/vdso64/clock_gettime.S
··· 88 llilh %r4,0x0100 89 sar %a4,%r4 90 lghi %r4,0 91 sacf 512 /* Magic ectg instruction */ 92 .insn ssf,0xc80100000000,__VDSO_ECTG_BASE(4),__VDSO_ECTG_USER(4),4 93 - sacf 0 94 - sar %a4,%r2 95 algr %r1,%r0 /* r1 = cputime as TOD value */ 96 mghi %r1,1000 /* convert to nanoseconds */ 97 srlg %r1,%r1,12 /* r1 = cputime in nanosec */
··· 88 llilh %r4,0x0100 89 sar %a4,%r4 90 lghi %r4,0 91 + epsw %r5,0 92 sacf 512 /* Magic ectg instruction */ 93 .insn ssf,0xc80100000000,__VDSO_ECTG_BASE(4),__VDSO_ECTG_USER(4),4 94 + tml %r5,0x4000 95 + jo 11f 96 + tml %r5,0x8000 97 + jno 10f 98 + sacf 256 99 + j 11f 100 + 10: sacf 0 101 + 11: sar %a4,%r2 102 algr %r1,%r0 /* r1 = cputime as TOD value */ 103 mghi %r1,1000 /* convert to nanoseconds */ 104 srlg %r1,%r1,12 /* r1 = cputime in nanosec */
+24 -12
arch/s390/power/swsusp.c
··· 7 * 8 */ 9 10 11 - /* 12 - * save CPU registers before creating a hibernation image and before 13 - * restoring the memory state from it 14 - */ 15 void save_processor_state(void) 16 { 17 - /* implentation contained in the 18 - * swsusp_arch_suspend function 19 */ 20 } 21 22 - /* 23 - * restore the contents of CPU registers 24 - */ 25 void restore_processor_state(void) 26 { 27 - /* implentation contained in the 28 - * swsusp_arch_resume function 29 - */ 30 }
··· 7 * 8 */ 9 10 + #include <asm/system.h> 11 12 void save_processor_state(void) 13 { 14 + /* swsusp_arch_suspend() actually saves all cpu register contents. 15 + * Machine checks must be disabled since swsusp_arch_suspend() stores 16 + * register contents to their lowcore save areas. That's the same 17 + * place where register contents on machine checks would be saved. 18 + * To avoid register corruption disable machine checks. 19 + * We must also disable machine checks in the new psw mask for 20 + * program checks, since swsusp_arch_suspend() may generate program 21 + * checks. Disabling machine checks for all other new psw masks is 22 + * just paranoia. 23 */ 24 + local_mcck_disable(); 25 + /* Disable lowcore protection */ 26 + __ctl_clear_bit(0,28); 27 + S390_lowcore.external_new_psw.mask &= ~PSW_MASK_MCHECK; 28 + S390_lowcore.svc_new_psw.mask &= ~PSW_MASK_MCHECK; 29 + S390_lowcore.io_new_psw.mask &= ~PSW_MASK_MCHECK; 30 + S390_lowcore.program_new_psw.mask &= ~PSW_MASK_MCHECK; 31 } 32 33 void restore_processor_state(void) 34 { 35 + S390_lowcore.external_new_psw.mask |= PSW_MASK_MCHECK; 36 + S390_lowcore.svc_new_psw.mask |= PSW_MASK_MCHECK; 37 + S390_lowcore.io_new_psw.mask |= PSW_MASK_MCHECK; 38 + S390_lowcore.program_new_psw.mask |= PSW_MASK_MCHECK; 39 + /* Enable lowcore protection */ 40 + __ctl_set_bit(0,28); 41 + local_mcck_enable(); 42 }
+9 -26
arch/s390/power/swsusp_asm64.S
··· 32 /* Deactivate DAT */ 33 stnsm __SF_EMPTY(%r15),0xfb 34 35 - /* Switch off lowcore protection */ 36 - stctg %c0,%c0,__SF_EMPTY(%r15) 37 - ni __SF_EMPTY+4(%r15),0xef 38 - lctlg %c0,%c0,__SF_EMPTY(%r15) 39 - 40 /* Store prefix register on stack */ 41 stpx __SF_EMPTY(%r15) 42 43 - /* Setup base register for lowcore (absolute 0) */ 44 - llgf %r1,__SF_EMPTY(%r15) 45 46 /* Get pointer to save area */ 47 - aghi %r1,0x1000 48 49 /* Store registers */ 50 mvc 0x318(4,%r1),__SF_EMPTY(%r15) /* move prefix to lowcore */ ··· 74 xc __SF_EMPTY(4,%r15),__SF_EMPTY(%r15) 75 spx __SF_EMPTY(%r15) 76 77 - /* Setup lowcore */ 78 - brasl %r14,setup_lowcore_early 79 80 /* Save image */ 81 brasl %r14,swsusp_save 82 - 83 - /* Switch on lowcore protection */ 84 - stctg %c0,%c0,__SF_EMPTY(%r15) 85 - oi __SF_EMPTY+4(%r15),0x10 86 - lctlg %c0,%c0,__SF_EMPTY(%r15) 87 88 /* Restore prefix register and return */ 89 lghi %r1,0x1000 ··· 109 #endif 110 /* Deactivate DAT */ 111 stnsm __SF_EMPTY(%r15),0xfb 112 - 113 - /* Switch off lowcore protection */ 114 - stctg %c0,%c0,__SF_EMPTY(%r15) 115 - ni __SF_EMPTY+4(%r15),0xef 116 - lctlg %c0,%c0,__SF_EMPTY(%r15) 117 118 /* Set prefix page to zero */ 119 xc __SF_EMPTY(4,%r15),__SF_EMPTY(%r15) ··· 163 /* Load old stack */ 164 lg %r15,0x2f8(%r13) 165 166 - /* Pointer to save arae */ 167 lghi %r13,0x1000 168 169 #ifdef CONFIG_SMP ··· 174 #endif 175 /* Restore prefix register */ 176 spx 0x318(%r13) 177 - 178 - /* Switch on lowcore protection */ 179 - stctg %c0,%c0,__SF_EMPTY(%r15) 180 - oi __SF_EMPTY+4(%r15),0x10 181 - lctlg %c0,%c0,__SF_EMPTY(%r15) 182 183 /* Activate DAT */ 184 stosm __SF_EMPTY(%r15),0x04
··· 32 /* Deactivate DAT */ 33 stnsm __SF_EMPTY(%r15),0xfb 34 35 /* Store prefix register on stack */ 36 stpx __SF_EMPTY(%r15) 37 38 + /* Save prefix register contents for lowcore */ 39 + llgf %r4,__SF_EMPTY(%r15) 40 41 /* Get pointer to save area */ 42 + lghi %r1,0x1000 43 44 /* Store registers */ 45 mvc 0x318(4,%r1),__SF_EMPTY(%r15) /* move prefix to lowcore */ ··· 79 xc __SF_EMPTY(4,%r15),__SF_EMPTY(%r15) 80 spx __SF_EMPTY(%r15) 81 82 + lghi %r2,0 83 + lghi %r3,2*PAGE_SIZE 84 + lghi %r5,2*PAGE_SIZE 85 + 1: mvcle %r2,%r4,0 86 + jo 1b 87 88 /* Save image */ 89 brasl %r14,swsusp_save 90 91 /* Restore prefix register and return */ 92 lghi %r1,0x1000 ··· 116 #endif 117 /* Deactivate DAT */ 118 stnsm __SF_EMPTY(%r15),0xfb 119 120 /* Set prefix page to zero */ 121 xc __SF_EMPTY(4,%r15),__SF_EMPTY(%r15) ··· 175 /* Load old stack */ 176 lg %r15,0x2f8(%r13) 177 178 + /* Pointer to save area */ 179 lghi %r13,0x1000 180 181 #ifdef CONFIG_SMP ··· 186 #endif 187 /* Restore prefix register */ 188 spx 0x318(%r13) 189 190 /* Activate DAT */ 191 stosm __SF_EMPTY(%r15),0x04
+7 -2
drivers/s390/crypto/ap_bus.c
··· 1145 */ 1146 static inline void ap_schedule_poll_timer(void) 1147 { 1148 if (ap_using_interrupts() || ap_suspend_flag) 1149 return; 1150 if (hrtimer_is_queued(&ap_poll_timer)) 1151 return; 1152 - hrtimer_start(&ap_poll_timer, ktime_set(0, poll_timeout), 1153 - HRTIMER_MODE_ABS); 1154 } 1155 1156 /**
··· 1145 */ 1146 static inline void ap_schedule_poll_timer(void) 1147 { 1148 + ktime_t hr_time; 1149 if (ap_using_interrupts() || ap_suspend_flag) 1150 return; 1151 if (hrtimer_is_queued(&ap_poll_timer)) 1152 return; 1153 + if (ktime_to_ns(hrtimer_expires_remaining(&ap_poll_timer)) <= 0) { 1154 + hr_time = ktime_set(0, poll_timeout); 1155 + hrtimer_forward_now(&ap_poll_timer, hr_time); 1156 + hrtimer_restart(&ap_poll_timer); 1157 + } 1158 + return; 1159 } 1160 1161 /**