Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6

* master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6:
[SPARC64]: Fix several kprobes bugs.
[SPARC64]: Update defconfig.
[SPARC64]: dma remove extra brackets
[SPARC{32,64}]: Propagate ptrace_traceme() return value.
[SPARC64]: Replace kmalloc+memset with kzalloc
[SPARC]: Check kzalloc() return value in SUN4D irq/iommu init.
[SPARC]: Replace kmalloc+memset with kzalloc
[SPARC64]: Run ctrl-alt-del action for sun4v powerdown request.
[SPARC64]: Unaligned accesses to userspace are hard errors.
[SPARC64]: Call do_mathemu on illegal instruction traps too.
[SPARC64]: Update defconfig.
[SPARC64]: Add irqtrace/stacktrace/lockdep support.

+470 -195
+2 -4
arch/sparc/kernel/ioport.c
··· 317 317 if ((va = __get_free_pages(GFP_KERNEL|__GFP_COMP, order)) == 0) 318 318 goto err_nopages; 319 319 320 - if ((res = kmalloc(sizeof(struct resource), GFP_KERNEL)) == NULL) 320 + if ((res = kzalloc(sizeof(struct resource), GFP_KERNEL)) == NULL) 321 321 goto err_nomem; 322 - memset((char*)res, 0, sizeof(struct resource)); 323 322 324 323 if (allocate_resource(&_sparc_dvma, res, len_total, 325 324 _sparc_dvma.start, _sparc_dvma.end, PAGE_SIZE, NULL, NULL) != 0) { ··· 588 589 return NULL; 589 590 } 590 591 591 - if ((res = kmalloc(sizeof(struct resource), GFP_KERNEL)) == NULL) { 592 + if ((res = kzalloc(sizeof(struct resource), GFP_KERNEL)) == NULL) { 592 593 free_pages(va, order); 593 594 printk("pci_alloc_consistent: no core\n"); 594 595 return NULL; 595 596 } 596 - memset((char*)res, 0, sizeof(struct resource)); 597 597 598 598 if (allocate_resource(&_sparc_dvma, res, len_total, 599 599 _sparc_dvma.start, _sparc_dvma.end, PAGE_SIZE, NULL, NULL) != 0) {
+1 -2
arch/sparc/kernel/of_device.c
··· 793 793 { 794 794 struct of_device *dev; 795 795 796 - dev = kmalloc(sizeof(*dev), GFP_KERNEL); 796 + dev = kzalloc(sizeof(*dev), GFP_KERNEL); 797 797 if (!dev) 798 798 return NULL; 799 - memset(dev, 0, sizeof(*dev)); 800 799 801 800 dev->dev.parent = parent; 802 801 dev->dev.bus = bus;
+4 -1
arch/sparc/kernel/ptrace.c
··· 289 289 290 290 if (request == PTRACE_TRACEME) { 291 291 ret = ptrace_traceme(); 292 - pt_succ_return(regs, 0); 292 + if (ret < 0) 293 + pt_error_return(regs, -ret); 294 + else 295 + pt_succ_return(regs, 0); 293 296 goto out; 294 297 } 295 298
+5 -2
arch/sparc/kernel/sun4d_irq.c
··· 545 545 nsbi = 0; 546 546 for_each_sbus(sbus) 547 547 nsbi++; 548 - sbus_actions = (struct sbus_action *)kmalloc (nsbi * 8 * 4 * sizeof(struct sbus_action), GFP_ATOMIC); 549 - memset (sbus_actions, 0, (nsbi * 8 * 4 * sizeof(struct sbus_action))); 548 + sbus_actions = kzalloc (nsbi * 8 * 4 * sizeof(struct sbus_action), GFP_ATOMIC); 549 + if (!sbus_actions) { 550 + prom_printf("SUN4D: Cannot allocate sbus_actions, halting.\n"); 551 + prom_halt(); 552 + } 550 553 for_each_sbus(sbus) { 551 554 #ifdef CONFIG_SMP 552 555 extern unsigned char boot_cpu_id;
+6 -2
arch/sparc/mm/io-unit.c
··· 22 22 #include <asm/cacheflush.h> 23 23 #include <asm/tlbflush.h> 24 24 #include <asm/dma.h> 25 + #include <asm/oplib.h> 25 26 26 27 /* #define IOUNIT_DEBUG */ 27 28 #ifdef IOUNIT_DEBUG ··· 42 41 struct linux_prom_registers iommu_promregs[PROMREG_MAX]; 43 42 struct resource r; 44 43 45 - iounit = kmalloc(sizeof(struct iounit_struct), GFP_ATOMIC); 44 + iounit = kzalloc(sizeof(struct iounit_struct), GFP_ATOMIC); 45 + if (!iounit) { 46 + prom_printf("SUN4D: Cannot alloc iounit, halting.\n"); 47 + prom_halt(); 48 + } 46 49 47 - memset(iounit, 0, sizeof(*iounit)); 48 50 iounit->limit[0] = IOUNIT_BMAP1_START; 49 51 iounit->limit[1] = IOUNIT_BMAP2_START; 50 52 iounit->limit[2] = IOUNIT_BMAPM_START;
+8
arch/sparc64/Kconfig
··· 26 26 bool 27 27 default y 28 28 29 + config STACKTRACE_SUPPORT 30 + bool 31 + default y 32 + 33 + config LOCKDEP_SUPPORT 34 + bool 35 + default y 36 + 29 37 config TIME_INTERPOLATION 30 38 bool 31 39 default y
+4
arch/sparc64/Kconfig.debug
··· 1 1 menu "Kernel hacking" 2 2 3 + config TRACE_IRQFLAGS_SUPPORT 4 + bool 5 + default y 6 + 3 7 source "lib/Kconfig.debug" 4 8 5 9 config DEBUG_STACK_USAGE
+40 -14
arch/sparc64/defconfig
··· 1 1 # 2 2 # Automatically generated make config: don't edit 3 - # Linux kernel version: 2.6.19-rc2 4 - # Tue Oct 17 19:29:20 2006 3 + # Linux kernel version: 2.6.19 4 + # Sat Dec 9 15:41:30 2006 5 5 # 6 6 CONFIG_SPARC=y 7 7 CONFIG_SPARC64=y 8 8 CONFIG_64BIT=y 9 9 CONFIG_MMU=y 10 + CONFIG_STACKTRACE_SUPPORT=y 11 + CONFIG_LOCKDEP_SUPPORT=y 10 12 CONFIG_TIME_INTERPOLATION=y 11 13 CONFIG_ARCH_MAY_HAVE_PC_FDC=y 14 + # CONFIG_ARCH_HAS_ILOG2_U32 is not set 15 + # CONFIG_ARCH_HAS_ILOG2_U64 is not set 12 16 CONFIG_AUDIT_ARCH=y 13 17 CONFIG_SPARC64_PAGE_SIZE_8KB=y 14 18 # CONFIG_SPARC64_PAGE_SIZE_64KB is not set 15 19 # CONFIG_SPARC64_PAGE_SIZE_512KB is not set 16 20 # CONFIG_SPARC64_PAGE_SIZE_4MB is not set 17 21 CONFIG_SECCOMP=y 18 - # CONFIG_HZ_100 is not set 19 - CONFIG_HZ_250=y 22 + CONFIG_HZ_100=y 23 + # CONFIG_HZ_250 is not set 24 + # CONFIG_HZ_300 is not set 20 25 # CONFIG_HZ_1000 is not set 21 - CONFIG_HZ=250 26 + CONFIG_HZ=100 22 27 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 23 28 24 29 # ··· 47 42 # CONFIG_UTS_NS is not set 48 43 # CONFIG_AUDIT is not set 49 44 # CONFIG_IKCONFIG is not set 45 + CONFIG_SYSFS_DEPRECATED=y 50 46 CONFIG_RELAY=y 51 47 CONFIG_INITRAMFS_SOURCE="" 52 48 CONFIG_CC_OPTIMIZE_FOR_SIZE=y 53 49 CONFIG_SYSCTL=y 54 50 # CONFIG_EMBEDDED is not set 55 51 CONFIG_UID16=y 56 - # CONFIG_SYSCTL_SYSCALL is not set 52 + CONFIG_SYSCTL_SYSCALL=y 57 53 CONFIG_KALLSYMS=y 58 54 # CONFIG_KALLSYMS_ALL is not set 59 55 # CONFIG_KALLSYMS_EXTRA_PASS is not set ··· 209 203 # CONFIG_TCP_CONG_ADVANCED is not set 210 204 CONFIG_TCP_CONG_CUBIC=y 211 205 CONFIG_DEFAULT_TCP_CONG="cubic" 206 + # CONFIG_TCP_MD5SIG is not set 212 207 CONFIG_IPV6=m 213 208 CONFIG_IPV6_PRIVACY=y 214 209 CONFIG_IPV6_ROUTER_PREF=y ··· 226 219 # CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set 227 220 CONFIG_IPV6_SIT=m 228 221 CONFIG_IPV6_TUNNEL=m 229 - # CONFIG_IPV6_SUBTREES is not set 230 222 # CONFIG_IPV6_MULTIPLE_TABLES is not set 231 223 # CONFIG_NETWORK_SECMARK is not set 232 224 # CONFIG_NETFILTER is not set ··· 244 238 # CONFIG_IP_DCCP_CCID2_DEBUG is not set 245 239 CONFIG_IP_DCCP_CCID3=m 246 240 CONFIG_IP_DCCP_TFRC_LIB=m 241 + # CONFIG_IP_DCCP_CCID3_DEBUG is not set 242 + CONFIG_IP_DCCP_CCID3_RTO=100 247 243 248 244 # 249 245 # DCCP Kernel Hacking ··· 413 405 # 414 406 CONFIG_RAID_ATTRS=m 415 407 CONFIG_SCSI=y 408 + # CONFIG_SCSI_TGT is not set 416 409 CONFIG_SCSI_NETLINK=y 417 410 CONFIG_SCSI_PROC_FS=y 418 411 ··· 434 425 CONFIG_SCSI_MULTI_LUN=y 435 426 CONFIG_SCSI_CONSTANTS=y 436 427 # CONFIG_SCSI_LOGGING is not set 428 + # CONFIG_SCSI_SCAN_ASYNC is not set 437 429 438 430 # 439 431 # SCSI Transports ··· 478 468 # CONFIG_SCSI_DC390T is not set 479 469 # CONFIG_SCSI_DEBUG is not set 480 470 # CONFIG_SCSI_SUNESP is not set 471 + # CONFIG_SCSI_SRP is not set 481 472 482 473 # 483 474 # Serial ATA (prod) and Parallel ATA (experimental) drivers ··· 609 598 # CONFIG_IXGB is not set 610 599 # CONFIG_S2IO is not set 611 600 # CONFIG_MYRI10GE is not set 601 + # CONFIG_NETXEN_NIC is not set 612 602 613 603 # 614 604 # Token Ring devices ··· 736 724 # CONFIG_DTLK is not set 737 725 # CONFIG_R3964 is not set 738 726 # CONFIG_APPLICOM is not set 739 - 740 - # 741 - # Ftape, the floppy tape device driver 742 - # 743 727 # CONFIG_DRM is not set 744 728 # CONFIG_RAW_DRIVER is not set 745 729 ··· 1047 1039 # CONFIG_SOUND_PRIME is not set 1048 1040 1049 1041 # 1042 + # HID Devices 1043 + # 1044 + CONFIG_HID=y 1045 + 1046 + # 1050 1047 # USB support 1051 1048 # 1052 1049 CONFIG_USB_ARCH_HAS_HCD=y ··· 1066 1053 CONFIG_USB_DEVICEFS=y 1067 1054 # CONFIG_USB_BANDWIDTH is not set 1068 1055 # CONFIG_USB_DYNAMIC_MINORS is not set 1056 + # CONFIG_USB_MULTITHREAD_PROBE is not set 1069 1057 # CONFIG_USB_OTG is not set 1070 1058 1071 1059 # ··· 1103 1089 # USB Input Devices 1104 1090 # 1105 1091 CONFIG_USB_HID=y 1106 - CONFIG_USB_HIDINPUT=y 1107 - # CONFIG_USB_HIDINPUT_POWERBOOK is not set 1092 + # CONFIG_USB_HID_POWERBOOK is not set 1108 1093 # CONFIG_HID_FF is not set 1109 1094 CONFIG_USB_HIDDEV=y 1110 1095 # CONFIG_USB_AIPTEK is not set ··· 1132 1119 # CONFIG_USB_KAWETH is not set 1133 1120 # CONFIG_USB_PEGASUS is not set 1134 1121 # CONFIG_USB_RTL8150 is not set 1122 + # CONFIG_USB_USBNET_MII is not set 1135 1123 # CONFIG_USB_USBNET is not set 1136 1124 # CONFIG_USB_MON is not set 1137 1125 ··· 1378 1364 # CONFIG_NLS_UTF8 is not set 1379 1365 1380 1366 # 1367 + # Distributed Lock Manager 1368 + # 1369 + # CONFIG_DLM is not set 1370 + 1371 + # 1381 1372 # Instrumentation Support 1382 1373 # 1383 1374 CONFIG_PROFILING=y ··· 1392 1373 # 1393 1374 # Kernel hacking 1394 1375 # 1376 + CONFIG_TRACE_IRQFLAGS_SUPPORT=y 1395 1377 CONFIG_PRINTK_TIME=y 1396 1378 CONFIG_ENABLE_MUST_CHECK=y 1397 1379 CONFIG_MAGIC_SYSRQ=y ··· 1407 1387 # CONFIG_DEBUG_SPINLOCK is not set 1408 1388 # CONFIG_DEBUG_MUTEXES is not set 1409 1389 # CONFIG_DEBUG_RWSEMS is not set 1390 + # CONFIG_DEBUG_LOCK_ALLOC is not set 1391 + # CONFIG_PROVE_LOCKING is not set 1410 1392 # CONFIG_DEBUG_SPINLOCK_SLEEP is not set 1411 1393 # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set 1412 1394 # CONFIG_DEBUG_KOBJECT is not set ··· 1442 1420 CONFIG_CRYPTO_ALGAPI=y 1443 1421 CONFIG_CRYPTO_BLKCIPHER=y 1444 1422 CONFIG_CRYPTO_HASH=y 1445 - CONFIG_CRYPTO_MANAGER=m 1423 + CONFIG_CRYPTO_MANAGER=y 1446 1424 CONFIG_CRYPTO_HMAC=y 1425 + CONFIG_CRYPTO_XCBC=y 1447 1426 CONFIG_CRYPTO_NULL=m 1448 1427 CONFIG_CRYPTO_MD4=y 1449 1428 CONFIG_CRYPTO_MD5=y ··· 1453 1430 CONFIG_CRYPTO_SHA512=m 1454 1431 CONFIG_CRYPTO_WP512=m 1455 1432 CONFIG_CRYPTO_TGR192=m 1433 + CONFIG_CRYPTO_GF128MUL=m 1456 1434 CONFIG_CRYPTO_ECB=m 1457 1435 CONFIG_CRYPTO_CBC=y 1436 + CONFIG_CRYPTO_LRW=m 1458 1437 CONFIG_CRYPTO_DES=y 1459 1438 CONFIG_CRYPTO_BLOWFISH=m 1460 1439 CONFIG_CRYPTO_TWOFISH=m ··· 1481 1456 # 1482 1457 # Library routines 1483 1458 # 1459 + CONFIG_BITREVERSE=y 1484 1460 CONFIG_CRC_CCITT=m 1485 1461 CONFIG_CRC16=m 1486 1462 CONFIG_CRC32=y
+1
arch/sparc64/kernel/Makefile
··· 14 14 power.o sbus.o iommu_common.o sparc64_ksyms.o chmc.o \ 15 15 visemul.o prom.o of_device.o 16 16 17 + obj-$(CONFIG_STACKTRACE) += stacktrace.o 17 18 obj-$(CONFIG_PCI) += ebus.o isa.o pci_common.o pci_iommu.o \ 18 19 pci_psycho.o pci_sabre.o pci_schizo.o \ 19 20 pci_sun4v.o pci_sun4v_asm.o
+1 -2
arch/sparc64/kernel/chmc.c
··· 341 341 342 342 static int init_one_mctrl(struct device_node *dp) 343 343 { 344 - struct mctrl_info *mp = kmalloc(sizeof(*mp), GFP_KERNEL); 344 + struct mctrl_info *mp = kzalloc(sizeof(*mp), GFP_KERNEL); 345 345 int portid = of_getintprop_default(dp, "portid", -1); 346 346 struct linux_prom64_registers *regs; 347 347 void *pval; ··· 349 349 350 350 if (!mp) 351 351 return -1; 352 - memset(mp, 0, sizeof(*mp)); 353 352 if (portid == -1) 354 353 goto fail; 355 354
+26 -1
arch/sparc64/kernel/entry.S
··· 597 597 1: ba,pt %xcc, etrap_irq 598 598 rd %pc, %g7 599 599 600 - 2: mov %l4, %o1 600 + 2: 601 + #ifdef CONFIG_TRACE_IRQFLAGS 602 + call trace_hardirqs_off 603 + nop 604 + #endif 605 + mov %l4, %o1 601 606 mov %l5, %o2 602 607 call spitfire_access_error 603 608 add %sp, PTREGS_OFF, %o0 ··· 829 824 wrpr %g0, 15, %pil 830 825 ba,pt %xcc, etrap_irq 831 826 rd %pc, %g7 827 + #ifdef CONFIG_TRACE_IRQFLAGS 828 + call trace_hardirqs_off 829 + nop 830 + #endif 832 831 mov 0x0, %o0 833 832 call cheetah_plus_parity_error 834 833 add %sp, PTREGS_OFF, %o1 ··· 864 855 wrpr %g0, 15, %pil 865 856 ba,pt %xcc, etrap_irq 866 857 rd %pc, %g7 858 + #ifdef CONFIG_TRACE_IRQFLAGS 859 + call trace_hardirqs_off 860 + nop 861 + #endif 867 862 mov 0x1, %o0 868 863 call cheetah_plus_parity_error 869 864 add %sp, PTREGS_OFF, %o1 ··· 1196 1183 wrpr %g0, 15, %pil 1197 1184 ba,pt %xcc, etrap_irq 1198 1185 rd %pc, %g7 1186 + #ifdef CONFIG_TRACE_IRQFLAGS 1187 + call trace_hardirqs_off 1188 + nop 1189 + #endif 1199 1190 mov %l4, %o1 1200 1191 mov %l5, %o2 1201 1192 call cheetah_fecc_handler ··· 1228 1211 wrpr %g0, 15, %pil 1229 1212 ba,pt %xcc, etrap_irq 1230 1213 rd %pc, %g7 1214 + #ifdef CONFIG_TRACE_IRQFLAGS 1215 + call trace_hardirqs_off 1216 + nop 1217 + #endif 1231 1218 mov %l4, %o1 1232 1219 mov %l5, %o2 1233 1220 call cheetah_cee_handler ··· 1260 1239 wrpr %g0, 15, %pil 1261 1240 ba,pt %xcc, etrap_irq 1262 1241 rd %pc, %g7 1242 + #ifdef CONFIG_TRACE_IRQFLAGS 1243 + call trace_hardirqs_off 1244 + nop 1245 + #endif 1263 1246 mov %l4, %o1 1264 1247 mov %l5, %o2 1265 1248 call cheetah_deferred_handler
+8
arch/sparc64/kernel/head.S
··· 489 489 call __bzero 490 490 sub %o1, %o0, %o1 491 491 492 + #ifdef CONFIG_LOCKDEP 493 + /* We have this call this super early, as even prom_init can grab 494 + * spinlocks and thus call into the lockdep code. 495 + */ 496 + call lockdep_init 497 + nop 498 + #endif 499 + 492 500 mov %l6, %o1 ! OpenPROM stack 493 501 call prom_init 494 502 mov %l7, %o0 ! OpenPROM cif handler
+3 -9
arch/sparc64/kernel/isa.c
··· 72 72 struct linux_prom_registers *regs; 73 73 struct sparc_isa_device *isa_dev; 74 74 75 - isa_dev = kmalloc(sizeof(*isa_dev), GFP_KERNEL); 75 + isa_dev = kzalloc(sizeof(*isa_dev), GFP_KERNEL); 76 76 if (!isa_dev) { 77 77 fatal_err("cannot allocate child isa_dev"); 78 78 prom_halt(); 79 79 } 80 - 81 - memset(isa_dev, 0, sizeof(*isa_dev)); 82 80 83 81 /* Link it in to parent. */ 84 82 isa_dev->next = parent_isa_dev->child; ··· 102 104 struct linux_prom_registers *regs; 103 105 struct sparc_isa_device *isa_dev; 104 106 105 - isa_dev = kmalloc(sizeof(*isa_dev), GFP_KERNEL); 107 + isa_dev = kzalloc(sizeof(*isa_dev), GFP_KERNEL); 106 108 if (!isa_dev) { 107 109 printk(KERN_DEBUG "ISA: cannot allocate isa_dev"); 108 110 return; 109 111 } 110 - 111 - memset(isa_dev, 0, sizeof(*isa_dev)); 112 112 113 113 isa_dev->ofdev.node = dp; 114 114 isa_dev->ofdev.dev.parent = &isa_br->ofdev.dev; ··· 176 180 pbm = pdev_cookie->pbm; 177 181 dp = pdev_cookie->prom_node; 178 182 179 - isa_br = kmalloc(sizeof(*isa_br), GFP_KERNEL); 183 + isa_br = kzalloc(sizeof(*isa_br), GFP_KERNEL); 180 184 if (!isa_br) { 181 185 printk(KERN_DEBUG "isa: cannot allocate sparc_isa_bridge"); 182 186 return; 183 187 } 184 - 185 - memset(isa_br, 0, sizeof(*isa_br)); 186 188 187 189 isa_br->ofdev.node = dp; 188 190 isa_br->ofdev.dev.parent = &pdev->dev;
+43 -48
arch/sparc64/kernel/kprobes.c
··· 45 45 int __kprobes arch_prepare_kprobe(struct kprobe *p) 46 46 { 47 47 p->ainsn.insn[0] = *p->addr; 48 + flushi(&p->ainsn.insn[0]); 49 + 48 50 p->ainsn.insn[1] = BREAKPOINT_INSTRUCTION_2; 51 + flushi(&p->ainsn.insn[1]); 52 + 49 53 p->opcode = *p->addr; 50 54 return 0; 51 55 } ··· 189 185 /* If INSN is a relative control transfer instruction, 190 186 * return the corrected branch destination value. 191 187 * 192 - * The original INSN location was REAL_PC, it actually 193 - * executed at PC and produced destination address NPC. 188 + * regs->tpc and regs->tnpc still hold the values of the 189 + * program counters at the time of trap due to the execution 190 + * of the BREAKPOINT_INSTRUCTION_2 at p->ainsn.insn[1] 191 + * 194 192 */ 195 - static unsigned long __kprobes relbranch_fixup(u32 insn, unsigned long real_pc, 196 - unsigned long pc, 197 - unsigned long npc) 193 + static unsigned long __kprobes relbranch_fixup(u32 insn, struct kprobe *p, 194 + struct pt_regs *regs) 198 195 { 196 + unsigned long real_pc = (unsigned long) p->addr; 197 + 199 198 /* Branch not taken, no mods necessary. */ 200 - if (npc == pc + 0x4UL) 201 - return real_pc + 0x4UL; 199 + if (regs->tnpc == regs->tpc + 0x4UL) 200 + return real_pc + 0x8UL; 202 201 203 202 /* The three cases are call, branch w/prediction, 204 203 * and traditional branch. ··· 209 202 if ((insn & 0xc0000000) == 0x40000000 || 210 203 (insn & 0xc1c00000) == 0x00400000 || 211 204 (insn & 0xc1c00000) == 0x00800000) { 205 + unsigned long ainsn_addr; 206 + 207 + ainsn_addr = (unsigned long) &p->ainsn.insn[0]; 208 + 212 209 /* The instruction did all the work for us 213 210 * already, just apply the offset to the correct 214 211 * instruction location. 215 212 */ 216 - return (real_pc + (npc - pc)); 213 + return (real_pc + (regs->tnpc - ainsn_addr)); 217 214 } 218 215 219 - return real_pc + 0x4UL; 216 + /* It is jmpl or some other absolute PC modification instruction, 217 + * leave NPC as-is. 218 + */ 219 + return regs->tnpc; 220 220 } 221 221 222 222 /* If INSN is an instruction which writes it's PC location ··· 234 220 { 235 221 unsigned long *slot = NULL; 236 222 237 - /* Simplest cast is call, which always uses %o7 */ 223 + /* Simplest case is 'call', which always uses %o7 */ 238 224 if ((insn & 0xc0000000) == 0x40000000) { 239 225 slot = &regs->u_regs[UREG_I7]; 240 226 } 241 227 242 - /* Jmpl encodes the register inside of the opcode */ 228 + /* 'jmpl' encodes the register inside of the opcode */ 243 229 if ((insn & 0xc1f80000) == 0x81c00000) { 244 230 unsigned long rd = ((insn >> 25) & 0x1f); 245 231 ··· 261 247 262 248 /* 263 249 * Called after single-stepping. p->addr is the address of the 264 - * instruction whose first byte has been replaced by the breakpoint 250 + * instruction which has been replaced by the breakpoint 265 251 * instruction. To avoid the SMP problems that can occur when we 266 252 * temporarily put back the original opcode to single-step, we 267 253 * single-stepped a copy of the instruction. The address of this 268 - * copy is p->ainsn.insn. 254 + * copy is &p->ainsn.insn[0]. 269 255 * 270 256 * This function prepares to return from the post-single-step 271 257 * breakpoint trap. ··· 275 261 { 276 262 u32 insn = p->ainsn.insn[0]; 277 263 264 + regs->tnpc = relbranch_fixup(insn, p, regs); 265 + 266 + /* This assignment must occur after relbranch_fixup() */ 278 267 regs->tpc = kcb->kprobe_orig_tnpc; 279 - regs->tnpc = relbranch_fixup(insn, 280 - (unsigned long) p->addr, 281 - (unsigned long) &p->ainsn.insn[0], 282 - regs->tnpc); 268 + 283 269 retpc_fixup(regs, insn, (unsigned long) p->addr); 284 270 285 271 regs->tstate = ((regs->tstate & ~TSTATE_PIL) | ··· 444 430 struct jprobe *jp = container_of(p, struct jprobe, kp); 445 431 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); 446 432 447 - kcb->jprobe_saved_regs_location = regs; 448 433 memcpy(&(kcb->jprobe_saved_regs), regs, sizeof(*regs)); 449 - 450 - /* Save a whole stack frame, this gets arguments 451 - * pushed onto the stack after using up all the 452 - * arg registers. 453 - */ 454 - memcpy(&(kcb->jprobe_saved_stack), 455 - (char *) (regs->u_regs[UREG_FP] + STACK_BIAS), 456 - sizeof(kcb->jprobe_saved_stack)); 457 434 458 435 regs->tpc = (unsigned long) jp->entry; 459 436 regs->tnpc = ((unsigned long) jp->entry) + 0x4UL; ··· 455 450 456 451 void __kprobes jprobe_return(void) 457 452 { 458 - __asm__ __volatile__( 459 - ".globl jprobe_return_trap_instruction\n" 453 + struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); 454 + register unsigned long orig_fp asm("g1"); 455 + 456 + orig_fp = kcb->jprobe_saved_regs.u_regs[UREG_FP]; 457 + __asm__ __volatile__("\n" 458 + "1: cmp %%sp, %0\n\t" 459 + "blu,a,pt %%xcc, 1b\n\t" 460 + " restore\n\t" 461 + ".globl jprobe_return_trap_instruction\n" 460 462 "jprobe_return_trap_instruction:\n\t" 461 - "ta 0x70"); 463 + "ta 0x70" 464 + : /* no outputs */ 465 + : "r" (orig_fp)); 462 466 } 463 467 464 468 extern void jprobe_return_trap_instruction(void); ··· 480 466 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); 481 467 482 468 if (addr == (u32 *) jprobe_return_trap_instruction) { 483 - if (kcb->jprobe_saved_regs_location != regs) { 484 - printk("JPROBE: Current regs (%p) does not match " 485 - "saved regs (%p).\n", 486 - regs, kcb->jprobe_saved_regs_location); 487 - printk("JPROBE: Saved registers\n"); 488 - __show_regs(kcb->jprobe_saved_regs_location); 489 - printk("JPROBE: Current registers\n"); 490 - __show_regs(regs); 491 - BUG(); 492 - } 493 - /* Restore old register state. Do pt_regs 494 - * first so that UREG_FP is the original one for 495 - * the stack frame restore. 496 - */ 497 469 memcpy(regs, &(kcb->jprobe_saved_regs), sizeof(*regs)); 498 - 499 - memcpy((char *) (regs->u_regs[UREG_FP] + STACK_BIAS), 500 - &(kcb->jprobe_saved_stack), 501 - sizeof(kcb->jprobe_saved_stack)); 502 - 503 470 preempt_enable_no_resched(); 504 471 return 1; 505 472 }
+1 -2
arch/sparc64/kernel/of_device.c
··· 1007 1007 { 1008 1008 struct of_device *dev; 1009 1009 1010 - dev = kmalloc(sizeof(*dev), GFP_KERNEL); 1010 + dev = kzalloc(sizeof(*dev), GFP_KERNEL); 1011 1011 if (!dev) 1012 1012 return NULL; 1013 - memset(dev, 0, sizeof(*dev)); 1014 1013 1015 1014 dev->dev.parent = parent; 1016 1015 dev->dev.bus = bus;
+5 -11
arch/sparc64/kernel/pci_sun4v.c
··· 798 798 static void pbm_scan_bus(struct pci_controller_info *p, 799 799 struct pci_pbm_info *pbm) 800 800 { 801 - struct pcidev_cookie *cookie = kmalloc(sizeof(*cookie), GFP_KERNEL); 801 + struct pcidev_cookie *cookie = kzalloc(sizeof(*cookie), GFP_KERNEL); 802 802 803 803 if (!cookie) { 804 804 prom_printf("%s: Critical allocation failure.\n", pbm->name); ··· 806 806 } 807 807 808 808 /* All we care about is the PBM. */ 809 - memset(cookie, 0, sizeof(*cookie)); 810 809 cookie->pbm = pbm; 811 810 812 811 pbm->pci_bus = pci_scan_bus(pbm->pci_first_busno, p->pci_ops, pbm); ··· 1047 1048 /* Allocate and initialize the free area map. */ 1048 1049 sz = num_tsb_entries / 8; 1049 1050 sz = (sz + 7UL) & ~7UL; 1050 - iommu->arena.map = kmalloc(sz, GFP_KERNEL); 1051 + iommu->arena.map = kzalloc(sz, GFP_KERNEL); 1051 1052 if (!iommu->arena.map) { 1052 1053 prom_printf("PCI_IOMMU: Error, kmalloc(arena.map) failed.\n"); 1053 1054 prom_halt(); 1054 1055 } 1055 - memset(iommu->arena.map, 0, sz); 1056 1056 iommu->arena.limit = num_tsb_entries; 1057 1057 1058 1058 sz = probe_existing_entries(pbm, iommu); ··· 1162 1164 per_cpu(pci_iommu_batch, i).pglist = (u64 *) page; 1163 1165 } 1164 1166 1165 - p = kmalloc(sizeof(struct pci_controller_info), GFP_ATOMIC); 1167 + p = kzalloc(sizeof(struct pci_controller_info), GFP_ATOMIC); 1166 1168 if (!p) 1167 1169 goto fatal_memory_error; 1168 1170 1169 - memset(p, 0, sizeof(*p)); 1170 - 1171 - iommu = kmalloc(sizeof(struct pci_iommu), GFP_ATOMIC); 1171 + iommu = kzalloc(sizeof(struct pci_iommu), GFP_ATOMIC); 1172 1172 if (!iommu) 1173 1173 goto fatal_memory_error; 1174 1174 1175 - memset(iommu, 0, sizeof(*iommu)); 1176 1175 p->pbm_A.iommu = iommu; 1177 1176 1178 - iommu = kmalloc(sizeof(struct pci_iommu), GFP_ATOMIC); 1177 + iommu = kzalloc(sizeof(struct pci_iommu), GFP_ATOMIC); 1179 1178 if (!iommu) 1180 1179 goto fatal_memory_error; 1181 1180 1182 - memset(iommu, 0, sizeof(*iommu)); 1183 1181 p->pbm_B.iommu = iommu; 1184 1182 1185 1183 p->next = pci_controller_root;
+4 -1
arch/sparc64/kernel/ptrace.c
··· 202 202 #endif 203 203 if (request == PTRACE_TRACEME) { 204 204 ret = ptrace_traceme(); 205 - pt_succ_return(regs, 0); 205 + if (ret < 0) 206 + pt_error_return(regs, -ret); 207 + else 208 + pt_succ_return(regs, 0); 206 209 goto out; 207 210 } 208 211
+17 -6
arch/sparc64/kernel/rtrap.S
··· 165 165 __handle_softirq_continue: 166 166 rtrap_xcall: 167 167 sethi %hi(0xf << 20), %l4 168 - andcc %l1, TSTATE_PRIV, %l3 169 168 and %l1, %l4, %l4 169 + andn %l1, %l4, %l1 170 + srl %l4, 20, %l4 171 + #ifdef CONFIG_TRACE_IRQFLAGS 172 + brnz,pn %l4, rtrap_no_irq_enable 173 + nop 174 + call trace_hardirqs_on 175 + nop 176 + wrpr %l4, %pil 177 + rtrap_no_irq_enable: 178 + #endif 179 + andcc %l1, TSTATE_PRIV, %l3 170 180 bne,pn %icc, to_kernel 171 - andn %l1, %l4, %l1 181 + nop 172 182 173 183 /* We must hold IRQs off and atomically test schedule+signal 174 184 * state, then hold them off all the way back to userspace. 175 - * If we are returning to kernel, none of this matters. 185 + * If we are returning to kernel, none of this matters. Note 186 + * that we are disabling interrupts via PSTATE_IE, not using 187 + * %pil. 176 188 * 177 189 * If we do not do this, there is a window where we would do 178 190 * the tests, later the signal/resched event arrives but we do ··· 268 256 269 257 ld [%sp + PTREGS_OFF + PT_V9_Y], %o3 270 258 wr %o3, %g0, %y 271 - srl %l4, 20, %l4 272 259 wrpr %l4, 0x0, %pil 273 260 wrpr %g0, 0x1, %tl 274 261 wrpr %l1, %g0, %tstate ··· 385 374 ldx [%g6 + TI_FLAGS], %l5 386 375 andcc %l5, _TIF_NEED_RESCHED, %g0 387 376 be,pt %xcc, kern_fpucheck 388 - srl %l4, 20, %l5 389 - cmp %l5, 0 377 + nop 378 + cmp %l4, 0 390 379 bne,pn %xcc, kern_fpucheck 391 380 sethi %hi(PREEMPT_ACTIVE), %l6 392 381 stw %l6, [%g6 + TI_PRE_COUNT]
+41
arch/sparc64/kernel/stacktrace.c
··· 1 + #include <linux/sched.h> 2 + #include <linux/stacktrace.h> 3 + #include <linux/thread_info.h> 4 + #include <asm/ptrace.h> 5 + 6 + void save_stack_trace(struct stack_trace *trace, struct task_struct *task) 7 + { 8 + unsigned long ksp, fp, thread_base; 9 + struct thread_info *tp; 10 + 11 + if (!task) 12 + task = current; 13 + tp = task_thread_info(task); 14 + if (task == current) { 15 + flushw_all(); 16 + __asm__ __volatile__( 17 + "mov %%fp, %0" 18 + : "=r" (ksp) 19 + ); 20 + } else 21 + ksp = tp->ksp; 22 + 23 + fp = ksp + STACK_BIAS; 24 + thread_base = (unsigned long) tp; 25 + do { 26 + struct reg_window *rw; 27 + 28 + /* Bogus frame pointer? */ 29 + if (fp < (thread_base + sizeof(struct thread_info)) || 30 + fp >= (thread_base + THREAD_SIZE)) 31 + break; 32 + 33 + rw = (struct reg_window *) fp; 34 + if (trace->skip > 0) 35 + trace->skip--; 36 + else 37 + trace->entries[trace->nr_entries++] = rw->ins[7]; 38 + 39 + fp = rw->ins[6] + STACK_BIAS; 40 + } while (trace->nr_entries < trace->max_entries); 41 + }
+16 -4
arch/sparc64/kernel/sun4v_ivec.S
··· 190 190 mov %g1, %g4 191 191 ba,pt %xcc, etrap_irq 192 192 rd %pc, %g7 193 - 193 + #ifdef CONFIG_TRACE_IRQFLAGS 194 + call trace_hardirqs_off 195 + nop 196 + #endif 194 197 /* Log the event. */ 195 198 add %sp, PTREGS_OFF, %o0 196 199 call sun4v_resum_error ··· 219 216 wrpr %g0, 15, %pil 220 217 ba,pt %xcc, etrap_irq 221 218 rd %pc, %g7 222 - 219 + #ifdef CONFIG_TRACE_IRQFLAGS 220 + call trace_hardirqs_off 221 + nop 222 + #endif 223 223 call sun4v_resum_overflow 224 224 add %sp, PTREGS_OFF, %o0 225 225 ··· 301 295 mov %g1, %g4 302 296 ba,pt %xcc, etrap_irq 303 297 rd %pc, %g7 304 - 298 + #ifdef CONFIG_TRACE_IRQFLAGS 299 + call trace_hardirqs_off 300 + nop 301 + #endif 305 302 /* Log the event. */ 306 303 add %sp, PTREGS_OFF, %o0 307 304 call sun4v_nonresum_error ··· 330 321 wrpr %g0, 15, %pil 331 322 ba,pt %xcc, etrap_irq 332 323 rd %pc, %g7 333 - 324 + #ifdef CONFIG_TRACE_IRQFLAGS 325 + call trace_hardirqs_off 326 + nop 327 + #endif 334 328 call sun4v_nonresum_overflow 335 329 add %sp, PTREGS_OFF, %o0 336 330
+26 -4
arch/sparc64/kernel/traps.c
··· 10 10 */ 11 11 12 12 #include <linux/module.h> 13 - #include <linux/sched.h> /* for jiffies */ 13 + #include <linux/sched.h> 14 14 #include <linux/kernel.h> 15 15 #include <linux/kallsyms.h> 16 16 #include <linux/signal.h> ··· 1873 1873 1874 1874 put_cpu(); 1875 1875 1876 + if (ent->err_type == SUN4V_ERR_TYPE_WARNING_RES) { 1877 + /* If err_type is 0x4, it's a powerdown request. Do 1878 + * not do the usual resumable error log because that 1879 + * makes it look like some abnormal error. 1880 + */ 1881 + printk(KERN_INFO "Power down request...\n"); 1882 + kill_cad_pid(SIGINT, 1); 1883 + return; 1884 + } 1885 + 1876 1886 sun4v_log_error(regs, &local_copy, cpu, 1877 1887 KERN_ERR "RESUMABLE ERROR", 1878 1888 &sun4v_resum_oflow_cnt); ··· 2271 2261 do_exit(SIGSEGV); 2272 2262 } 2273 2263 2264 + #define VIS_OPCODE_MASK ((0x3 << 30) | (0x3f << 19)) 2265 + #define VIS_OPCODE_VAL ((0x2 << 30) | (0x36 << 19)) 2266 + 2274 2267 extern int handle_popc(u32 insn, struct pt_regs *regs); 2275 2268 extern int handle_ldf_stq(u32 insn, struct pt_regs *regs); 2269 + extern int vis_emul(struct pt_regs *, unsigned int); 2276 2270 2277 2271 void do_illegal_instruction(struct pt_regs *regs) 2278 2272 { ··· 2301 2287 if (handle_ldf_stq(insn, regs)) 2302 2288 return; 2303 2289 } else if (tlb_type == hypervisor) { 2304 - extern int vis_emul(struct pt_regs *, unsigned int); 2290 + if ((insn & VIS_OPCODE_MASK) == VIS_OPCODE_VAL) { 2291 + if (!vis_emul(regs, insn)) 2292 + return; 2293 + } else { 2294 + struct fpustate *f = FPUSTATE; 2305 2295 2306 - if (!vis_emul(regs, insn)) 2307 - return; 2296 + /* XXX maybe verify XFSR bits like 2297 + * XXX do_fpother() does? 2298 + */ 2299 + if (do_mathemu(regs, f)) 2300 + return; 2301 + } 2308 2302 } 2309 2303 } 2310 2304 info.si_signo = SIGILL;
+31 -13
arch/sparc64/kernel/unaligned.c
··· 243 243 return !floating_point_load_or_store_p(insn); 244 244 } 245 245 246 - static void kernel_mna_trap_fault(void) 246 + static void kernel_mna_trap_fault(int fixup_tstate_asi) 247 247 { 248 248 struct pt_regs *regs = current_thread_info()->kern_una_regs; 249 249 unsigned int insn = current_thread_info()->kern_una_insn; ··· 274 274 regs->tpc = entry->fixup; 275 275 regs->tnpc = regs->tpc + 4; 276 276 277 - regs->tstate &= ~TSTATE_ASI; 278 - regs->tstate |= (ASI_AIUS << 24UL); 277 + if (fixup_tstate_asi) { 278 + regs->tstate &= ~TSTATE_ASI; 279 + regs->tstate |= (ASI_AIUS << 24UL); 280 + } 279 281 } 280 282 281 - asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn) 283 + static void log_unaligned(struct pt_regs *regs) 282 284 { 283 285 static unsigned long count, last_time; 284 - enum direction dir = decode_direction(insn); 285 - int size = decode_access_size(insn); 286 - 287 - current_thread_info()->kern_una_regs = regs; 288 - current_thread_info()->kern_una_insn = insn; 289 286 290 287 if (jiffies - last_time > 5 * HZ) 291 288 count = 0; ··· 292 295 printk("Kernel unaligned access at TPC[%lx] ", regs->tpc); 293 296 print_symbol("%s\n", regs->tpc); 294 297 } 298 + } 299 + 300 + asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn) 301 + { 302 + enum direction dir = decode_direction(insn); 303 + int size = decode_access_size(insn); 304 + int orig_asi, asi; 305 + 306 + current_thread_info()->kern_una_regs = regs; 307 + current_thread_info()->kern_una_insn = insn; 308 + 309 + orig_asi = asi = decode_asi(insn, regs); 310 + 311 + /* If this is a {get,put}_user() on an unaligned userspace pointer, 312 + * just signal a fault and do not log the event. 313 + */ 314 + if (asi == ASI_AIUS) { 315 + kernel_mna_trap_fault(0); 316 + return; 317 + } 318 + 319 + log_unaligned(regs); 295 320 296 321 if (!ok_for_kernel(insn) || dir == both) { 297 322 printk("Unsupported unaligned load/store trap for kernel " ··· 321 302 unaligned_panic("Kernel does fpu/atomic " 322 303 "unaligned load/store.", regs); 323 304 324 - kernel_mna_trap_fault(); 305 + kernel_mna_trap_fault(0); 325 306 } else { 326 307 unsigned long addr, *reg_addr; 327 - int orig_asi, asi, err; 308 + int err; 328 309 329 310 addr = compute_effective_address(regs, insn, 330 311 ((insn >> 25) & 0x1f)); ··· 334 315 regs->tpc, dirstrings[dir], addr, size, 335 316 regs->u_regs[UREG_RETPC]); 336 317 #endif 337 - orig_asi = asi = decode_asi(insn, regs); 338 318 switch (asi) { 339 319 case ASI_NL: 340 320 case ASI_AIUPL: ··· 383 365 /* Not reached... */ 384 366 } 385 367 if (unlikely(err)) 386 - kernel_mna_trap_fault(); 368 + kernel_mna_trap_fault(1); 387 369 else 388 370 advance(regs); 389 371 }
-6
arch/sparc64/kernel/visemul.c
··· 128 128 /* 001001100 - Permute bytes as specified by GSR.MASK */ 129 129 #define BSHUFFLE_OPF 0x04c 130 130 131 - #define VIS_OPCODE_MASK ((0x3 << 30) | (0x3f << 19)) 132 - #define VIS_OPCODE_VAL ((0x2 << 30) | (0x36 << 19)) 133 - 134 131 #define VIS_OPF_SHIFT 5 135 132 #define VIS_OPF_MASK (0x1ff << VIS_OPF_SHIFT) 136 133 ··· 806 809 807 810 if (get_user(insn, (u32 __user *) pc)) 808 811 return -EFAULT; 809 - 810 - if ((insn & VIS_OPCODE_MASK) != VIS_OPCODE_VAL) 811 - return -EINVAL; 812 812 813 813 opf = (insn & VIS_OPF_MASK) >> VIS_OPF_SHIFT; 814 814 switch (opf) {
+8
arch/sparc64/mm/ultra.S
··· 477 477 sethi %hi(109f), %g7 478 478 b,pt %xcc, etrap_irq 479 479 109: or %g7, %lo(109b), %g7 480 + #ifdef CONFIG_TRACE_IRQFLAGS 481 + call trace_hardirqs_off 482 + nop 483 + #endif 480 484 call smp_synchronize_tick_client 481 485 nop 482 486 clr %l6 ··· 512 508 sethi %hi(109f), %g7 513 509 b,pt %xcc, etrap_irq 514 510 109: or %g7, %lo(109b), %g7 511 + #ifdef CONFIG_TRACE_IRQFLAGS 512 + call trace_hardirqs_off 513 + nop 514 + #endif 515 515 call __show_regs 516 516 add %sp, PTREGS_OFF, %o0 517 517 clr %l6
+3 -3
include/asm-sparc64/dma.h
··· 152 152 #define DMA_MAXEND(addr) (0x01000000UL-(((unsigned long)(addr))&0x00ffffffUL)) 153 153 154 154 /* Yes, I hack a lot of elisp in my spare time... */ 155 - #define DMA_ERROR_P(regs) (((sbus_readl((regs) + DMA_CSR) & DMA_HNDL_ERROR)) 156 - #define DMA_IRQ_P(regs) (((sbus_readl((regs) + DMA_CSR)) & (DMA_HNDL_INTR | DMA_HNDL_ERROR))) 157 - #define DMA_WRITE_P(regs) (((sbus_readl((regs) + DMA_CSR) & DMA_ST_WRITE)) 155 + #define DMA_ERROR_P(regs) ((sbus_readl((regs) + DMA_CSR) & DMA_HNDL_ERROR)) 156 + #define DMA_IRQ_P(regs) ((sbus_readl((regs) + DMA_CSR)) & (DMA_HNDL_INTR | DMA_HNDL_ERROR)) 157 + #define DMA_WRITE_P(regs) ((sbus_readl((regs) + DMA_CSR) & DMA_ST_WRITE)) 158 158 #define DMA_OFF(__regs) \ 159 159 do { u32 tmp = sbus_readl((__regs) + DMA_CSR); \ 160 160 tmp &= ~DMA_ENABLE; \
+89
include/asm-sparc64/irqflags.h
··· 1 + /* 2 + * include/asm-sparc64/irqflags.h 3 + * 4 + * IRQ flags handling 5 + * 6 + * This file gets included from lowlevel asm headers too, to provide 7 + * wrapped versions of the local_irq_*() APIs, based on the 8 + * raw_local_irq_*() functions from the lowlevel headers. 9 + */ 10 + #ifndef _ASM_IRQFLAGS_H 11 + #define _ASM_IRQFLAGS_H 12 + 13 + #ifndef __ASSEMBLY__ 14 + 15 + static inline unsigned long __raw_local_save_flags(void) 16 + { 17 + unsigned long flags; 18 + 19 + __asm__ __volatile__( 20 + "rdpr %%pil, %0" 21 + : "=r" (flags) 22 + ); 23 + 24 + return flags; 25 + } 26 + 27 + #define raw_local_save_flags(flags) \ 28 + do { (flags) = __raw_local_save_flags(); } while (0) 29 + 30 + static inline void raw_local_irq_restore(unsigned long flags) 31 + { 32 + __asm__ __volatile__( 33 + "wrpr %0, %%pil" 34 + : /* no output */ 35 + : "r" (flags) 36 + : "memory" 37 + ); 38 + } 39 + 40 + static inline void raw_local_irq_disable(void) 41 + { 42 + __asm__ __volatile__( 43 + "wrpr 15, %%pil" 44 + : /* no outputs */ 45 + : /* no inputs */ 46 + : "memory" 47 + ); 48 + } 49 + 50 + static inline void raw_local_irq_enable(void) 51 + { 52 + __asm__ __volatile__( 53 + "wrpr 0, %%pil" 54 + : /* no outputs */ 55 + : /* no inputs */ 56 + : "memory" 57 + ); 58 + } 59 + 60 + static inline int raw_irqs_disabled_flags(unsigned long flags) 61 + { 62 + return (flags > 0); 63 + } 64 + 65 + static inline int raw_irqs_disabled(void) 66 + { 67 + unsigned long flags = __raw_local_save_flags(); 68 + 69 + return raw_irqs_disabled_flags(flags); 70 + } 71 + 72 + /* 73 + * For spinlocks, etc: 74 + */ 75 + static inline unsigned long __raw_local_irq_save(void) 76 + { 77 + unsigned long flags = __raw_local_save_flags(); 78 + 79 + raw_local_irq_disable(); 80 + 81 + return flags; 82 + } 83 + 84 + #define raw_local_irq_save(flags) \ 85 + do { (flags) = __raw_local_irq_save(); } while (0) 86 + 87 + #endif /* (__ASSEMBLY__) */ 88 + 89 + #endif /* !(_ASM_IRQFLAGS_H) */
+6 -5
include/asm-sparc64/kprobes.h
··· 13 13 #define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry 14 14 #define arch_remove_kprobe(p) do {} while (0) 15 15 #define ARCH_INACTIVE_KPROBE_COUNT 0 16 - #define flush_insn_slot(p) do { } while (0) 16 + 17 + #define flush_insn_slot(p) \ 18 + do { flushi(&(p)->ainsn.insn[0]); \ 19 + flushi(&(p)->ainsn.insn[1]); \ 20 + } while (0) 17 21 18 22 /* Architecture specific copy of original instruction*/ 19 23 struct arch_specific_insn { ··· 27 23 28 24 struct prev_kprobe { 29 25 struct kprobe *kp; 30 - unsigned int status; 26 + unsigned long status; 31 27 unsigned long orig_tnpc; 32 28 unsigned long orig_tstate_pil; 33 29 }; ··· 37 33 unsigned long kprobe_status; 38 34 unsigned long kprobe_orig_tnpc; 39 35 unsigned long kprobe_orig_tstate_pil; 40 - long *jprobe_saved_esp; 41 36 struct pt_regs jprobe_saved_regs; 42 - struct pt_regs *jprobe_saved_regs_location; 43 - struct sparc_stackf jprobe_saved_stack; 44 37 struct prev_kprobe prev_kprobe; 45 38 }; 46 39
+25 -7
include/asm-sparc64/rwsem.h
··· 23 23 signed int count; 24 24 spinlock_t wait_lock; 25 25 struct list_head wait_list; 26 + #ifdef CONFIG_DEBUG_LOCK_ALLOC 27 + struct lockdep_map dep_map; 28 + #endif 26 29 }; 27 30 31 + #ifdef CONFIG_DEBUG_LOCK_ALLOC 32 + # define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname } 33 + #else 34 + # define __RWSEM_DEP_MAP_INIT(lockname) 35 + #endif 36 + 28 37 #define __RWSEM_INITIALIZER(name) \ 29 - { RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, LIST_HEAD_INIT((name).wait_list) } 38 + { RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, LIST_HEAD_INIT((name).wait_list) \ 39 + __RWSEM_DEP_MAP_INIT(name) } 30 40 31 41 #define DECLARE_RWSEM(name) \ 32 42 struct rw_semaphore name = __RWSEM_INITIALIZER(name) 33 43 34 - static __inline__ void init_rwsem(struct rw_semaphore *sem) 35 - { 36 - sem->count = RWSEM_UNLOCKED_VALUE; 37 - spin_lock_init(&sem->wait_lock); 38 - INIT_LIST_HEAD(&sem->wait_list); 39 - } 44 + extern void __init_rwsem(struct rw_semaphore *sem, const char *name, 45 + struct lock_class_key *key); 46 + 47 + #define init_rwsem(sem) \ 48 + do { \ 49 + static struct lock_class_key __key; \ 50 + \ 51 + __init_rwsem((sem), #sem, &__key); \ 52 + } while (0) 40 53 41 54 extern void __down_read(struct rw_semaphore *sem); 42 55 extern int __down_read_trylock(struct rw_semaphore *sem); ··· 58 45 extern void __up_read(struct rw_semaphore *sem); 59 46 extern void __up_write(struct rw_semaphore *sem); 60 47 extern void __downgrade_write(struct rw_semaphore *sem); 48 + 49 + static inline void __down_write_nested(struct rw_semaphore *sem, int subclass) 50 + { 51 + __down_write(sem); 52 + } 61 53 62 54 static inline int rwsem_atomic_update(int delta, struct rw_semaphore *sem) 63 55 {
+3 -46
include/asm-sparc64/system.h
··· 7 7 #include <asm/visasm.h> 8 8 9 9 #ifndef __ASSEMBLY__ 10 + 11 + #include <linux/irqflags.h> 12 + 10 13 /* 11 14 * Sparc (general) CPU types 12 15 */ ··· 74 71 membar_safe("#StoreStore | #LoadStore") 75 72 76 73 #endif 77 - 78 - #define setipl(__new_ipl) \ 79 - __asm__ __volatile__("wrpr %0, %%pil" : : "r" (__new_ipl) : "memory") 80 - 81 - #define local_irq_disable() \ 82 - __asm__ __volatile__("wrpr 15, %%pil" : : : "memory") 83 - 84 - #define local_irq_enable() \ 85 - __asm__ __volatile__("wrpr 0, %%pil" : : : "memory") 86 - 87 - #define getipl() \ 88 - ({ unsigned long retval; __asm__ __volatile__("rdpr %%pil, %0" : "=r" (retval)); retval; }) 89 - 90 - #define swap_pil(__new_pil) \ 91 - ({ unsigned long retval; \ 92 - __asm__ __volatile__("rdpr %%pil, %0\n\t" \ 93 - "wrpr %1, %%pil" \ 94 - : "=&r" (retval) \ 95 - : "r" (__new_pil) \ 96 - : "memory"); \ 97 - retval; \ 98 - }) 99 - 100 - #define read_pil_and_cli() \ 101 - ({ unsigned long retval; \ 102 - __asm__ __volatile__("rdpr %%pil, %0\n\t" \ 103 - "wrpr 15, %%pil" \ 104 - : "=r" (retval) \ 105 - : : "memory"); \ 106 - retval; \ 107 - }) 108 - 109 - #define local_save_flags(flags) ((flags) = getipl()) 110 - #define local_irq_save(flags) ((flags) = read_pil_and_cli()) 111 - #define local_irq_restore(flags) setipl((flags)) 112 - 113 - /* On sparc64 IRQ flags are the PIL register. A value of zero 114 - * means all interrupt levels are enabled, any other value means 115 - * only IRQ levels greater than that value will be received. 116 - * Consequently this means that the lowest IRQ level is one. 117 - */ 118 - #define irqs_disabled() \ 119 - ({ unsigned long flags; \ 120 - local_save_flags(flags);\ 121 - (flags > 0); \ 122 - }) 123 74 124 75 #define nop() __asm__ __volatile__ ("nop") 125 76
+43 -2
include/asm-sparc64/ttable.h
··· 137 137 #endif 138 138 #define BREAKPOINT_TRAP TRAP(breakpoint_trap) 139 139 140 + #ifdef CONFIG_TRACE_IRQFLAGS 141 + 140 142 #define TRAP_IRQ(routine, level) \ 141 143 rdpr %pil, %g2; \ 142 144 wrpr %g0, 15, %pil; \ 143 - b,pt %xcc, etrap_irq; \ 145 + sethi %hi(1f-4), %g7; \ 146 + ba,pt %xcc, etrap_irq; \ 147 + or %g7, %lo(1f-4), %g7; \ 148 + nop; \ 149 + nop; \ 150 + nop; \ 151 + .subsection 2; \ 152 + 1: call trace_hardirqs_off; \ 153 + nop; \ 154 + mov level, %o0; \ 155 + call routine; \ 156 + add %sp, PTREGS_OFF, %o1; \ 157 + ba,a,pt %xcc, rtrap_irq; \ 158 + .previous; 159 + 160 + #define TICK_SMP_IRQ \ 161 + rdpr %pil, %g2; \ 162 + wrpr %g0, 15, %pil; \ 163 + sethi %hi(1f-4), %g7; \ 164 + ba,pt %xcc, etrap_irq; \ 165 + or %g7, %lo(1f-4), %g7; \ 166 + nop; \ 167 + nop; \ 168 + nop; \ 169 + .subsection 2; \ 170 + 1: call trace_hardirqs_off; \ 171 + nop; \ 172 + call smp_percpu_timer_interrupt; \ 173 + add %sp, PTREGS_OFF, %o0; \ 174 + ba,a,pt %xcc, rtrap_irq; \ 175 + .previous; 176 + 177 + #else 178 + 179 + #define TRAP_IRQ(routine, level) \ 180 + rdpr %pil, %g2; \ 181 + wrpr %g0, 15, %pil; \ 182 + ba,pt %xcc, etrap_irq; \ 144 183 rd %pc, %g7; \ 145 184 mov level, %o0; \ 146 185 call routine; \ ··· 190 151 rdpr %pil, %g2; \ 191 152 wrpr %g0, 15, %pil; \ 192 153 sethi %hi(109f), %g7; \ 193 - b,pt %xcc, etrap_irq; \ 154 + ba,pt %xcc, etrap_irq; \ 194 155 109: or %g7, %lo(109b), %g7; \ 195 156 call smp_percpu_timer_interrupt; \ 196 157 add %sp, PTREGS_OFF, %o0; \ 197 158 ba,a,pt %xcc, rtrap_irq; 159 + 160 + #endif 198 161 199 162 #define TRAP_IVEC TRAP_NOSAVE(do_ivec) 200 163