diff options
author | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-10 13:00:00 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-10 13:00:00 -0500 |
commit | edb16bec41db68b22799a5fbad82c3891e637565 (patch) | |
tree | d019d2fa8fbf374d810f66e1a210648e53b0c593 | |
parent | bb7320d1d96dc2e479180ae8e7a112caf0726ace (diff) | |
parent | f0882589666440d573f657cb3a1d5f66f3caa157 (diff) |
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.
30 files changed, 470 insertions, 195 deletions
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c index 54d51b404603..cbbc98846b00 100644 --- a/arch/sparc/kernel/ioport.c +++ b/arch/sparc/kernel/ioport.c | |||
@@ -317,9 +317,8 @@ void *sbus_alloc_consistent(struct sbus_dev *sdev, long len, u32 *dma_addrp) | |||
317 | if ((va = __get_free_pages(GFP_KERNEL|__GFP_COMP, order)) == 0) | 317 | if ((va = __get_free_pages(GFP_KERNEL|__GFP_COMP, order)) == 0) |
318 | goto err_nopages; | 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 | goto err_nomem; | 321 | goto err_nomem; |
322 | memset((char*)res, 0, sizeof(struct resource)); | ||
323 | 322 | ||
324 | if (allocate_resource(&_sparc_dvma, res, len_total, | 323 | if (allocate_resource(&_sparc_dvma, res, len_total, |
325 | _sparc_dvma.start, _sparc_dvma.end, PAGE_SIZE, NULL, NULL) != 0) { | 324 | _sparc_dvma.start, _sparc_dvma.end, PAGE_SIZE, NULL, NULL) != 0) { |
@@ -589,12 +588,11 @@ void *pci_alloc_consistent(struct pci_dev *pdev, size_t len, dma_addr_t *pba) | |||
589 | return NULL; | 588 | return NULL; |
590 | } | 589 | } |
591 | 590 | ||
592 | if ((res = kmalloc(sizeof(struct resource), GFP_KERNEL)) == NULL) { | 591 | if ((res = kzalloc(sizeof(struct resource), GFP_KERNEL)) == NULL) { |
593 | free_pages(va, order); | 592 | free_pages(va, order); |
594 | printk("pci_alloc_consistent: no core\n"); | 593 | printk("pci_alloc_consistent: no core\n"); |
595 | return NULL; | 594 | return NULL; |
596 | } | 595 | } |
597 | memset((char*)res, 0, sizeof(struct resource)); | ||
598 | 596 | ||
599 | if (allocate_resource(&_sparc_dvma, res, len_total, | 597 | if (allocate_resource(&_sparc_dvma, res, len_total, |
600 | _sparc_dvma.start, _sparc_dvma.end, PAGE_SIZE, NULL, NULL) != 0) { | 598 | _sparc_dvma.start, _sparc_dvma.end, PAGE_SIZE, NULL, NULL) != 0) { |
diff --git a/arch/sparc/kernel/of_device.c b/arch/sparc/kernel/of_device.c index 46200c43ffb1..dab6169e31ca 100644 --- a/arch/sparc/kernel/of_device.c +++ b/arch/sparc/kernel/of_device.c | |||
@@ -793,10 +793,9 @@ struct of_device* of_platform_device_create(struct device_node *np, | |||
793 | { | 793 | { |
794 | struct of_device *dev; | 794 | struct of_device *dev; |
795 | 795 | ||
796 | dev = kmalloc(sizeof(*dev), GFP_KERNEL); | 796 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); |
797 | if (!dev) | 797 | if (!dev) |
798 | return NULL; | 798 | return NULL; |
799 | memset(dev, 0, sizeof(*dev)); | ||
800 | 799 | ||
801 | dev->dev.parent = parent; | 800 | dev->dev.parent = parent; |
802 | dev->dev.bus = bus; | 801 | dev->dev.bus = bus; |
diff --git a/arch/sparc/kernel/ptrace.c b/arch/sparc/kernel/ptrace.c index 1baf13ed5c3a..003f8eed32f4 100644 --- a/arch/sparc/kernel/ptrace.c +++ b/arch/sparc/kernel/ptrace.c | |||
@@ -289,7 +289,10 @@ asmlinkage void do_ptrace(struct pt_regs *regs) | |||
289 | 289 | ||
290 | if (request == PTRACE_TRACEME) { | 290 | if (request == PTRACE_TRACEME) { |
291 | ret = ptrace_traceme(); | 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 | goto out; | 296 | goto out; |
294 | } | 297 | } |
295 | 298 | ||
diff --git a/arch/sparc/kernel/sun4d_irq.c b/arch/sparc/kernel/sun4d_irq.c index d4f9da8170c5..cf1b8baa57ea 100644 --- a/arch/sparc/kernel/sun4d_irq.c +++ b/arch/sparc/kernel/sun4d_irq.c | |||
@@ -545,8 +545,11 @@ void __init sun4d_init_sbi_irq(void) | |||
545 | nsbi = 0; | 545 | nsbi = 0; |
546 | for_each_sbus(sbus) | 546 | for_each_sbus(sbus) |
547 | nsbi++; | 547 | nsbi++; |
548 | sbus_actions = (struct sbus_action *)kmalloc (nsbi * 8 * 4 * sizeof(struct sbus_action), GFP_ATOMIC); | 548 | sbus_actions = kzalloc (nsbi * 8 * 4 * sizeof(struct sbus_action), GFP_ATOMIC); |
549 | memset (sbus_actions, 0, (nsbi * 8 * 4 * sizeof(struct sbus_action))); | 549 | if (!sbus_actions) { |
550 | prom_printf("SUN4D: Cannot allocate sbus_actions, halting.\n"); | ||
551 | prom_halt(); | ||
552 | } | ||
550 | for_each_sbus(sbus) { | 553 | for_each_sbus(sbus) { |
551 | #ifdef CONFIG_SMP | 554 | #ifdef CONFIG_SMP |
552 | extern unsigned char boot_cpu_id; | 555 | extern unsigned char boot_cpu_id; |
diff --git a/arch/sparc/mm/io-unit.c b/arch/sparc/mm/io-unit.c index 2bb1309003dd..4ccda77d08d6 100644 --- a/arch/sparc/mm/io-unit.c +++ b/arch/sparc/mm/io-unit.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <asm/cacheflush.h> | 22 | #include <asm/cacheflush.h> |
23 | #include <asm/tlbflush.h> | 23 | #include <asm/tlbflush.h> |
24 | #include <asm/dma.h> | 24 | #include <asm/dma.h> |
25 | #include <asm/oplib.h> | ||
25 | 26 | ||
26 | /* #define IOUNIT_DEBUG */ | 27 | /* #define IOUNIT_DEBUG */ |
27 | #ifdef IOUNIT_DEBUG | 28 | #ifdef IOUNIT_DEBUG |
@@ -41,9 +42,12 @@ iounit_init(int sbi_node, int io_node, struct sbus_bus *sbus) | |||
41 | struct linux_prom_registers iommu_promregs[PROMREG_MAX]; | 42 | struct linux_prom_registers iommu_promregs[PROMREG_MAX]; |
42 | struct resource r; | 43 | struct resource r; |
43 | 44 | ||
44 | iounit = kmalloc(sizeof(struct iounit_struct), GFP_ATOMIC); | 45 | iounit = kzalloc(sizeof(struct iounit_struct), GFP_ATOMIC); |
46 | if (!iounit) { | ||
47 | prom_printf("SUN4D: Cannot alloc iounit, halting.\n"); | ||
48 | prom_halt(); | ||
49 | } | ||
45 | 50 | ||
46 | memset(iounit, 0, sizeof(*iounit)); | ||
47 | iounit->limit[0] = IOUNIT_BMAP1_START; | 51 | iounit->limit[0] = IOUNIT_BMAP1_START; |
48 | iounit->limit[1] = IOUNIT_BMAP2_START; | 52 | iounit->limit[1] = IOUNIT_BMAP2_START; |
49 | iounit->limit[2] = IOUNIT_BMAPM_START; | 53 | iounit->limit[2] = IOUNIT_BMAPM_START; |
diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig index d391d11f245a..d41f66ac7fff 100644 --- a/arch/sparc64/Kconfig +++ b/arch/sparc64/Kconfig | |||
@@ -26,6 +26,14 @@ config MMU | |||
26 | bool | 26 | bool |
27 | default y | 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 | config TIME_INTERPOLATION | 37 | config TIME_INTERPOLATION |
30 | bool | 38 | bool |
31 | default y | 39 | default y |
diff --git a/arch/sparc64/Kconfig.debug b/arch/sparc64/Kconfig.debug index afe0a7720a26..1f130f3b6c24 100644 --- a/arch/sparc64/Kconfig.debug +++ b/arch/sparc64/Kconfig.debug | |||
@@ -1,5 +1,9 @@ | |||
1 | menu "Kernel hacking" | 1 | menu "Kernel hacking" |
2 | 2 | ||
3 | config TRACE_IRQFLAGS_SUPPORT | ||
4 | bool | ||
5 | default y | ||
6 | |||
3 | source "lib/Kconfig.debug" | 7 | source "lib/Kconfig.debug" |
4 | 8 | ||
5 | config DEBUG_STACK_USAGE | 9 | config DEBUG_STACK_USAGE |
diff --git a/arch/sparc64/defconfig b/arch/sparc64/defconfig index 2f4612fa81f2..0f0d38f6197c 100644 --- a/arch/sparc64/defconfig +++ b/arch/sparc64/defconfig | |||
@@ -1,24 +1,29 @@ | |||
1 | # | 1 | # |
2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
3 | # Linux kernel version: 2.6.19-rc2 | 3 | # Linux kernel version: 2.6.19 |
4 | # Tue Oct 17 19:29:20 2006 | 4 | # Sat Dec 9 15:41:30 2006 |
5 | # | 5 | # |
6 | CONFIG_SPARC=y | 6 | CONFIG_SPARC=y |
7 | CONFIG_SPARC64=y | 7 | CONFIG_SPARC64=y |
8 | CONFIG_64BIT=y | 8 | CONFIG_64BIT=y |
9 | CONFIG_MMU=y | 9 | CONFIG_MMU=y |
10 | CONFIG_STACKTRACE_SUPPORT=y | ||
11 | CONFIG_LOCKDEP_SUPPORT=y | ||
10 | CONFIG_TIME_INTERPOLATION=y | 12 | CONFIG_TIME_INTERPOLATION=y |
11 | CONFIG_ARCH_MAY_HAVE_PC_FDC=y | 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 | CONFIG_AUDIT_ARCH=y | 16 | CONFIG_AUDIT_ARCH=y |
13 | CONFIG_SPARC64_PAGE_SIZE_8KB=y | 17 | CONFIG_SPARC64_PAGE_SIZE_8KB=y |
14 | # CONFIG_SPARC64_PAGE_SIZE_64KB is not set | 18 | # CONFIG_SPARC64_PAGE_SIZE_64KB is not set |
15 | # CONFIG_SPARC64_PAGE_SIZE_512KB is not set | 19 | # CONFIG_SPARC64_PAGE_SIZE_512KB is not set |
16 | # CONFIG_SPARC64_PAGE_SIZE_4MB is not set | 20 | # CONFIG_SPARC64_PAGE_SIZE_4MB is not set |
17 | CONFIG_SECCOMP=y | 21 | CONFIG_SECCOMP=y |
18 | # CONFIG_HZ_100 is not set | 22 | CONFIG_HZ_100=y |
19 | CONFIG_HZ_250=y | 23 | # CONFIG_HZ_250 is not set |
24 | # CONFIG_HZ_300 is not set | ||
20 | # CONFIG_HZ_1000 is not set | 25 | # CONFIG_HZ_1000 is not set |
21 | CONFIG_HZ=250 | 26 | CONFIG_HZ=100 |
22 | CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" | 27 | CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" |
23 | 28 | ||
24 | # | 29 | # |
@@ -42,13 +47,14 @@ CONFIG_POSIX_MQUEUE=y | |||
42 | # CONFIG_UTS_NS is not set | 47 | # CONFIG_UTS_NS is not set |
43 | # CONFIG_AUDIT is not set | 48 | # CONFIG_AUDIT is not set |
44 | # CONFIG_IKCONFIG is not set | 49 | # CONFIG_IKCONFIG is not set |
50 | CONFIG_SYSFS_DEPRECATED=y | ||
45 | CONFIG_RELAY=y | 51 | CONFIG_RELAY=y |
46 | CONFIG_INITRAMFS_SOURCE="" | 52 | CONFIG_INITRAMFS_SOURCE="" |
47 | CONFIG_CC_OPTIMIZE_FOR_SIZE=y | 53 | CONFIG_CC_OPTIMIZE_FOR_SIZE=y |
48 | CONFIG_SYSCTL=y | 54 | CONFIG_SYSCTL=y |
49 | # CONFIG_EMBEDDED is not set | 55 | # CONFIG_EMBEDDED is not set |
50 | CONFIG_UID16=y | 56 | CONFIG_UID16=y |
51 | # CONFIG_SYSCTL_SYSCALL is not set | 57 | CONFIG_SYSCTL_SYSCALL=y |
52 | CONFIG_KALLSYMS=y | 58 | CONFIG_KALLSYMS=y |
53 | # CONFIG_KALLSYMS_ALL is not set | 59 | # CONFIG_KALLSYMS_ALL is not set |
54 | # CONFIG_KALLSYMS_EXTRA_PASS is not set | 60 | # CONFIG_KALLSYMS_EXTRA_PASS is not set |
@@ -203,6 +209,7 @@ CONFIG_INET_TCP_DIAG=y | |||
203 | # CONFIG_TCP_CONG_ADVANCED is not set | 209 | # CONFIG_TCP_CONG_ADVANCED is not set |
204 | CONFIG_TCP_CONG_CUBIC=y | 210 | CONFIG_TCP_CONG_CUBIC=y |
205 | CONFIG_DEFAULT_TCP_CONG="cubic" | 211 | CONFIG_DEFAULT_TCP_CONG="cubic" |
212 | # CONFIG_TCP_MD5SIG is not set | ||
206 | CONFIG_IPV6=m | 213 | CONFIG_IPV6=m |
207 | CONFIG_IPV6_PRIVACY=y | 214 | CONFIG_IPV6_PRIVACY=y |
208 | CONFIG_IPV6_ROUTER_PREF=y | 215 | CONFIG_IPV6_ROUTER_PREF=y |
@@ -219,7 +226,6 @@ CONFIG_INET6_XFRM_MODE_BEET=m | |||
219 | # CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set | 226 | # CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set |
220 | CONFIG_IPV6_SIT=m | 227 | CONFIG_IPV6_SIT=m |
221 | CONFIG_IPV6_TUNNEL=m | 228 | CONFIG_IPV6_TUNNEL=m |
222 | # CONFIG_IPV6_SUBTREES is not set | ||
223 | # CONFIG_IPV6_MULTIPLE_TABLES is not set | 229 | # CONFIG_IPV6_MULTIPLE_TABLES is not set |
224 | # CONFIG_NETWORK_SECMARK is not set | 230 | # CONFIG_NETWORK_SECMARK is not set |
225 | # CONFIG_NETFILTER is not set | 231 | # CONFIG_NETFILTER is not set |
@@ -238,6 +244,8 @@ CONFIG_IP_DCCP_CCID2=m | |||
238 | # CONFIG_IP_DCCP_CCID2_DEBUG is not set | 244 | # CONFIG_IP_DCCP_CCID2_DEBUG is not set |
239 | CONFIG_IP_DCCP_CCID3=m | 245 | CONFIG_IP_DCCP_CCID3=m |
240 | CONFIG_IP_DCCP_TFRC_LIB=m | 246 | CONFIG_IP_DCCP_TFRC_LIB=m |
247 | # CONFIG_IP_DCCP_CCID3_DEBUG is not set | ||
248 | CONFIG_IP_DCCP_CCID3_RTO=100 | ||
241 | 249 | ||
242 | # | 250 | # |
243 | # DCCP Kernel Hacking | 251 | # DCCP Kernel Hacking |
@@ -405,6 +413,7 @@ CONFIG_IDEDMA_AUTO=y | |||
405 | # | 413 | # |
406 | CONFIG_RAID_ATTRS=m | 414 | CONFIG_RAID_ATTRS=m |
407 | CONFIG_SCSI=y | 415 | CONFIG_SCSI=y |
416 | # CONFIG_SCSI_TGT is not set | ||
408 | CONFIG_SCSI_NETLINK=y | 417 | CONFIG_SCSI_NETLINK=y |
409 | CONFIG_SCSI_PROC_FS=y | 418 | CONFIG_SCSI_PROC_FS=y |
410 | 419 | ||
@@ -425,6 +434,7 @@ CONFIG_CHR_DEV_SG=m | |||
425 | CONFIG_SCSI_MULTI_LUN=y | 434 | CONFIG_SCSI_MULTI_LUN=y |
426 | CONFIG_SCSI_CONSTANTS=y | 435 | CONFIG_SCSI_CONSTANTS=y |
427 | # CONFIG_SCSI_LOGGING is not set | 436 | # CONFIG_SCSI_LOGGING is not set |
437 | # CONFIG_SCSI_SCAN_ASYNC is not set | ||
428 | 438 | ||
429 | # | 439 | # |
430 | # SCSI Transports | 440 | # SCSI Transports |
@@ -468,6 +478,7 @@ CONFIG_ISCSI_TCP=m | |||
468 | # CONFIG_SCSI_DC390T is not set | 478 | # CONFIG_SCSI_DC390T is not set |
469 | # CONFIG_SCSI_DEBUG is not set | 479 | # CONFIG_SCSI_DEBUG is not set |
470 | # CONFIG_SCSI_SUNESP is not set | 480 | # CONFIG_SCSI_SUNESP is not set |
481 | # CONFIG_SCSI_SRP is not set | ||
471 | 482 | ||
472 | # | 483 | # |
473 | # Serial ATA (prod) and Parallel ATA (experimental) drivers | 484 | # Serial ATA (prod) and Parallel ATA (experimental) drivers |
@@ -598,6 +609,7 @@ CONFIG_BNX2=m | |||
598 | # CONFIG_IXGB is not set | 609 | # CONFIG_IXGB is not set |
599 | # CONFIG_S2IO is not set | 610 | # CONFIG_S2IO is not set |
600 | # CONFIG_MYRI10GE is not set | 611 | # CONFIG_MYRI10GE is not set |
612 | # CONFIG_NETXEN_NIC is not set | ||
601 | 613 | ||
602 | # | 614 | # |
603 | # Token Ring devices | 615 | # Token Ring devices |
@@ -724,10 +736,6 @@ CONFIG_RTC=y | |||
724 | # CONFIG_DTLK is not set | 736 | # CONFIG_DTLK is not set |
725 | # CONFIG_R3964 is not set | 737 | # CONFIG_R3964 is not set |
726 | # CONFIG_APPLICOM is not set | 738 | # CONFIG_APPLICOM is not set |
727 | |||
728 | # | ||
729 | # Ftape, the floppy tape device driver | ||
730 | # | ||
731 | # CONFIG_DRM is not set | 739 | # CONFIG_DRM is not set |
732 | # CONFIG_RAW_DRIVER is not set | 740 | # CONFIG_RAW_DRIVER is not set |
733 | 741 | ||
@@ -1039,6 +1047,11 @@ CONFIG_SND_SUN_CS4231=m | |||
1039 | # CONFIG_SOUND_PRIME is not set | 1047 | # CONFIG_SOUND_PRIME is not set |
1040 | 1048 | ||
1041 | # | 1049 | # |
1050 | # HID Devices | ||
1051 | # | ||
1052 | CONFIG_HID=y | ||
1053 | |||
1054 | # | ||
1042 | # USB support | 1055 | # USB support |
1043 | # | 1056 | # |
1044 | CONFIG_USB_ARCH_HAS_HCD=y | 1057 | CONFIG_USB_ARCH_HAS_HCD=y |
@@ -1053,6 +1066,7 @@ CONFIG_USB=y | |||
1053 | CONFIG_USB_DEVICEFS=y | 1066 | CONFIG_USB_DEVICEFS=y |
1054 | # CONFIG_USB_BANDWIDTH is not set | 1067 | # CONFIG_USB_BANDWIDTH is not set |
1055 | # CONFIG_USB_DYNAMIC_MINORS is not set | 1068 | # CONFIG_USB_DYNAMIC_MINORS is not set |
1069 | # CONFIG_USB_MULTITHREAD_PROBE is not set | ||
1056 | # CONFIG_USB_OTG is not set | 1070 | # CONFIG_USB_OTG is not set |
1057 | 1071 | ||
1058 | # | 1072 | # |
@@ -1089,8 +1103,7 @@ CONFIG_USB_UHCI_HCD=m | |||
1089 | # USB Input Devices | 1103 | # USB Input Devices |
1090 | # | 1104 | # |
1091 | CONFIG_USB_HID=y | 1105 | CONFIG_USB_HID=y |
1092 | CONFIG_USB_HIDINPUT=y | 1106 | # CONFIG_USB_HID_POWERBOOK is not set |
1093 | # CONFIG_USB_HIDINPUT_POWERBOOK is not set | ||
1094 | # CONFIG_HID_FF is not set | 1107 | # CONFIG_HID_FF is not set |
1095 | CONFIG_USB_HIDDEV=y | 1108 | CONFIG_USB_HIDDEV=y |
1096 | # CONFIG_USB_AIPTEK is not set | 1109 | # CONFIG_USB_AIPTEK is not set |
@@ -1119,6 +1132,7 @@ CONFIG_USB_HIDDEV=y | |||
1119 | # CONFIG_USB_KAWETH is not set | 1132 | # CONFIG_USB_KAWETH is not set |
1120 | # CONFIG_USB_PEGASUS is not set | 1133 | # CONFIG_USB_PEGASUS is not set |
1121 | # CONFIG_USB_RTL8150 is not set | 1134 | # CONFIG_USB_RTL8150 is not set |
1135 | # CONFIG_USB_USBNET_MII is not set | ||
1122 | # CONFIG_USB_USBNET is not set | 1136 | # CONFIG_USB_USBNET is not set |
1123 | # CONFIG_USB_MON is not set | 1137 | # CONFIG_USB_MON is not set |
1124 | 1138 | ||
@@ -1364,6 +1378,11 @@ CONFIG_NLS_DEFAULT="iso8859-1" | |||
1364 | # CONFIG_NLS_UTF8 is not set | 1378 | # CONFIG_NLS_UTF8 is not set |
1365 | 1379 | ||
1366 | # | 1380 | # |
1381 | # Distributed Lock Manager | ||
1382 | # | ||
1383 | # CONFIG_DLM is not set | ||
1384 | |||
1385 | # | ||
1367 | # Instrumentation Support | 1386 | # Instrumentation Support |
1368 | # | 1387 | # |
1369 | CONFIG_PROFILING=y | 1388 | CONFIG_PROFILING=y |
@@ -1373,6 +1392,7 @@ CONFIG_KPROBES=y | |||
1373 | # | 1392 | # |
1374 | # Kernel hacking | 1393 | # Kernel hacking |
1375 | # | 1394 | # |
1395 | CONFIG_TRACE_IRQFLAGS_SUPPORT=y | ||
1376 | CONFIG_PRINTK_TIME=y | 1396 | CONFIG_PRINTK_TIME=y |
1377 | CONFIG_ENABLE_MUST_CHECK=y | 1397 | CONFIG_ENABLE_MUST_CHECK=y |
1378 | CONFIG_MAGIC_SYSRQ=y | 1398 | CONFIG_MAGIC_SYSRQ=y |
@@ -1387,6 +1407,8 @@ CONFIG_SCHEDSTATS=y | |||
1387 | # CONFIG_DEBUG_SPINLOCK is not set | 1407 | # CONFIG_DEBUG_SPINLOCK is not set |
1388 | # CONFIG_DEBUG_MUTEXES is not set | 1408 | # CONFIG_DEBUG_MUTEXES is not set |
1389 | # CONFIG_DEBUG_RWSEMS is not set | 1409 | # CONFIG_DEBUG_RWSEMS is not set |
1410 | # CONFIG_DEBUG_LOCK_ALLOC is not set | ||
1411 | # CONFIG_PROVE_LOCKING is not set | ||
1390 | # CONFIG_DEBUG_SPINLOCK_SLEEP is not set | 1412 | # CONFIG_DEBUG_SPINLOCK_SLEEP is not set |
1391 | # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set | 1413 | # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set |
1392 | # CONFIG_DEBUG_KOBJECT is not set | 1414 | # CONFIG_DEBUG_KOBJECT is not set |
@@ -1420,8 +1442,9 @@ CONFIG_CRYPTO=y | |||
1420 | CONFIG_CRYPTO_ALGAPI=y | 1442 | CONFIG_CRYPTO_ALGAPI=y |
1421 | CONFIG_CRYPTO_BLKCIPHER=y | 1443 | CONFIG_CRYPTO_BLKCIPHER=y |
1422 | CONFIG_CRYPTO_HASH=y | 1444 | CONFIG_CRYPTO_HASH=y |
1423 | CONFIG_CRYPTO_MANAGER=m | 1445 | CONFIG_CRYPTO_MANAGER=y |
1424 | CONFIG_CRYPTO_HMAC=y | 1446 | CONFIG_CRYPTO_HMAC=y |
1447 | CONFIG_CRYPTO_XCBC=y | ||
1425 | CONFIG_CRYPTO_NULL=m | 1448 | CONFIG_CRYPTO_NULL=m |
1426 | CONFIG_CRYPTO_MD4=y | 1449 | CONFIG_CRYPTO_MD4=y |
1427 | CONFIG_CRYPTO_MD5=y | 1450 | CONFIG_CRYPTO_MD5=y |
@@ -1430,8 +1453,10 @@ CONFIG_CRYPTO_SHA256=m | |||
1430 | CONFIG_CRYPTO_SHA512=m | 1453 | CONFIG_CRYPTO_SHA512=m |
1431 | CONFIG_CRYPTO_WP512=m | 1454 | CONFIG_CRYPTO_WP512=m |
1432 | CONFIG_CRYPTO_TGR192=m | 1455 | CONFIG_CRYPTO_TGR192=m |
1456 | CONFIG_CRYPTO_GF128MUL=m | ||
1433 | CONFIG_CRYPTO_ECB=m | 1457 | CONFIG_CRYPTO_ECB=m |
1434 | CONFIG_CRYPTO_CBC=y | 1458 | CONFIG_CRYPTO_CBC=y |
1459 | CONFIG_CRYPTO_LRW=m | ||
1435 | CONFIG_CRYPTO_DES=y | 1460 | CONFIG_CRYPTO_DES=y |
1436 | CONFIG_CRYPTO_BLOWFISH=m | 1461 | CONFIG_CRYPTO_BLOWFISH=m |
1437 | CONFIG_CRYPTO_TWOFISH=m | 1462 | CONFIG_CRYPTO_TWOFISH=m |
@@ -1456,6 +1481,7 @@ CONFIG_CRYPTO_TEST=m | |||
1456 | # | 1481 | # |
1457 | # Library routines | 1482 | # Library routines |
1458 | # | 1483 | # |
1484 | CONFIG_BITREVERSE=y | ||
1459 | CONFIG_CRC_CCITT=m | 1485 | CONFIG_CRC_CCITT=m |
1460 | CONFIG_CRC16=m | 1486 | CONFIG_CRC16=m |
1461 | CONFIG_CRC32=y | 1487 | CONFIG_CRC32=y |
diff --git a/arch/sparc64/kernel/Makefile b/arch/sparc64/kernel/Makefile index e1eabebaed39..eff0c01d3579 100644 --- a/arch/sparc64/kernel/Makefile +++ b/arch/sparc64/kernel/Makefile | |||
@@ -14,6 +14,7 @@ obj-y := process.o setup.o cpu.o idprom.o \ | |||
14 | power.o sbus.o iommu_common.o sparc64_ksyms.o chmc.o \ | 14 | power.o sbus.o iommu_common.o sparc64_ksyms.o chmc.o \ |
15 | visemul.o prom.o of_device.o | 15 | visemul.o prom.o of_device.o |
16 | 16 | ||
17 | obj-$(CONFIG_STACKTRACE) += stacktrace.o | ||
17 | obj-$(CONFIG_PCI) += ebus.o isa.o pci_common.o pci_iommu.o \ | 18 | obj-$(CONFIG_PCI) += ebus.o isa.o pci_common.o pci_iommu.o \ |
18 | pci_psycho.o pci_sabre.o pci_schizo.o \ | 19 | pci_psycho.o pci_sabre.o pci_schizo.o \ |
19 | pci_sun4v.o pci_sun4v_asm.o | 20 | pci_sun4v.o pci_sun4v_asm.o |
diff --git a/arch/sparc64/kernel/chmc.c b/arch/sparc64/kernel/chmc.c index 259f37e516f5..9699abeb9907 100644 --- a/arch/sparc64/kernel/chmc.c +++ b/arch/sparc64/kernel/chmc.c | |||
@@ -341,7 +341,7 @@ static void fetch_decode_regs(struct mctrl_info *mp) | |||
341 | 341 | ||
342 | static int init_one_mctrl(struct device_node *dp) | 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 | int portid = of_getintprop_default(dp, "portid", -1); | 345 | int portid = of_getintprop_default(dp, "portid", -1); |
346 | struct linux_prom64_registers *regs; | 346 | struct linux_prom64_registers *regs; |
347 | void *pval; | 347 | void *pval; |
@@ -349,7 +349,6 @@ static int init_one_mctrl(struct device_node *dp) | |||
349 | 349 | ||
350 | if (!mp) | 350 | if (!mp) |
351 | return -1; | 351 | return -1; |
352 | memset(mp, 0, sizeof(*mp)); | ||
353 | if (portid == -1) | 352 | if (portid == -1) |
354 | goto fail; | 353 | goto fail; |
355 | 354 | ||
diff --git a/arch/sparc64/kernel/entry.S b/arch/sparc64/kernel/entry.S index 6f28bec0a9bf..c15a3edcb826 100644 --- a/arch/sparc64/kernel/entry.S +++ b/arch/sparc64/kernel/entry.S | |||
@@ -597,7 +597,12 @@ __spitfire_cee_trap_continue: | |||
597 | 1: ba,pt %xcc, etrap_irq | 597 | 1: ba,pt %xcc, etrap_irq |
598 | rd %pc, %g7 | 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 | mov %l5, %o2 | 606 | mov %l5, %o2 |
602 | call spitfire_access_error | 607 | call spitfire_access_error |
603 | add %sp, PTREGS_OFF, %o0 | 608 | add %sp, PTREGS_OFF, %o0 |
@@ -824,6 +829,10 @@ do_cheetah_plus_data_parity: | |||
824 | wrpr %g0, 15, %pil | 829 | wrpr %g0, 15, %pil |
825 | ba,pt %xcc, etrap_irq | 830 | ba,pt %xcc, etrap_irq |
826 | rd %pc, %g7 | 831 | rd %pc, %g7 |
832 | #ifdef CONFIG_TRACE_IRQFLAGS | ||
833 | call trace_hardirqs_off | ||
834 | nop | ||
835 | #endif | ||
827 | mov 0x0, %o0 | 836 | mov 0x0, %o0 |
828 | call cheetah_plus_parity_error | 837 | call cheetah_plus_parity_error |
829 | add %sp, PTREGS_OFF, %o1 | 838 | add %sp, PTREGS_OFF, %o1 |
@@ -855,6 +864,10 @@ do_cheetah_plus_insn_parity: | |||
855 | wrpr %g0, 15, %pil | 864 | wrpr %g0, 15, %pil |
856 | ba,pt %xcc, etrap_irq | 865 | ba,pt %xcc, etrap_irq |
857 | rd %pc, %g7 | 866 | rd %pc, %g7 |
867 | #ifdef CONFIG_TRACE_IRQFLAGS | ||
868 | call trace_hardirqs_off | ||
869 | nop | ||
870 | #endif | ||
858 | mov 0x1, %o0 | 871 | mov 0x1, %o0 |
859 | call cheetah_plus_parity_error | 872 | call cheetah_plus_parity_error |
860 | add %sp, PTREGS_OFF, %o1 | 873 | add %sp, PTREGS_OFF, %o1 |
@@ -1183,6 +1196,10 @@ c_fast_ecc: | |||
1183 | wrpr %g0, 15, %pil | 1196 | wrpr %g0, 15, %pil |
1184 | ba,pt %xcc, etrap_irq | 1197 | ba,pt %xcc, etrap_irq |
1185 | rd %pc, %g7 | 1198 | rd %pc, %g7 |
1199 | #ifdef CONFIG_TRACE_IRQFLAGS | ||
1200 | call trace_hardirqs_off | ||
1201 | nop | ||
1202 | #endif | ||
1186 | mov %l4, %o1 | 1203 | mov %l4, %o1 |
1187 | mov %l5, %o2 | 1204 | mov %l5, %o2 |
1188 | call cheetah_fecc_handler | 1205 | call cheetah_fecc_handler |
@@ -1211,6 +1228,10 @@ c_cee: | |||
1211 | wrpr %g0, 15, %pil | 1228 | wrpr %g0, 15, %pil |
1212 | ba,pt %xcc, etrap_irq | 1229 | ba,pt %xcc, etrap_irq |
1213 | rd %pc, %g7 | 1230 | rd %pc, %g7 |
1231 | #ifdef CONFIG_TRACE_IRQFLAGS | ||
1232 | call trace_hardirqs_off | ||
1233 | nop | ||
1234 | #endif | ||
1214 | mov %l4, %o1 | 1235 | mov %l4, %o1 |
1215 | mov %l5, %o2 | 1236 | mov %l5, %o2 |
1216 | call cheetah_cee_handler | 1237 | call cheetah_cee_handler |
@@ -1239,6 +1260,10 @@ c_deferred: | |||
1239 | wrpr %g0, 15, %pil | 1260 | wrpr %g0, 15, %pil |
1240 | ba,pt %xcc, etrap_irq | 1261 | ba,pt %xcc, etrap_irq |
1241 | rd %pc, %g7 | 1262 | rd %pc, %g7 |
1263 | #ifdef CONFIG_TRACE_IRQFLAGS | ||
1264 | call trace_hardirqs_off | ||
1265 | nop | ||
1266 | #endif | ||
1242 | mov %l4, %o1 | 1267 | mov %l4, %o1 |
1243 | mov %l5, %o2 | 1268 | mov %l5, %o2 |
1244 | call cheetah_deferred_handler | 1269 | call cheetah_deferred_handler |
diff --git a/arch/sparc64/kernel/head.S b/arch/sparc64/kernel/head.S index c8e9dc9d68a9..03ffaf895a22 100644 --- a/arch/sparc64/kernel/head.S +++ b/arch/sparc64/kernel/head.S | |||
@@ -489,6 +489,14 @@ tlb_fixup_done: | |||
489 | call __bzero | 489 | call __bzero |
490 | sub %o1, %o0, %o1 | 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 | mov %l6, %o1 ! OpenPROM stack | 500 | mov %l6, %o1 ! OpenPROM stack |
493 | call prom_init | 501 | call prom_init |
494 | mov %l7, %o0 ! OpenPROM cif handler | 502 | mov %l7, %o0 ! OpenPROM cif handler |
diff --git a/arch/sparc64/kernel/isa.c b/arch/sparc64/kernel/isa.c index f028e68b23f2..ad1c4f55420f 100644 --- a/arch/sparc64/kernel/isa.c +++ b/arch/sparc64/kernel/isa.c | |||
@@ -72,14 +72,12 @@ static void __init isa_fill_children(struct sparc_isa_device *parent_isa_dev) | |||
72 | struct linux_prom_registers *regs; | 72 | struct linux_prom_registers *regs; |
73 | struct sparc_isa_device *isa_dev; | 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 | if (!isa_dev) { | 76 | if (!isa_dev) { |
77 | fatal_err("cannot allocate child isa_dev"); | 77 | fatal_err("cannot allocate child isa_dev"); |
78 | prom_halt(); | 78 | prom_halt(); |
79 | } | 79 | } |
80 | 80 | ||
81 | memset(isa_dev, 0, sizeof(*isa_dev)); | ||
82 | |||
83 | /* Link it in to parent. */ | 81 | /* Link it in to parent. */ |
84 | isa_dev->next = parent_isa_dev->child; | 82 | isa_dev->next = parent_isa_dev->child; |
85 | parent_isa_dev->child = isa_dev; | 83 | parent_isa_dev->child = isa_dev; |
@@ -104,14 +102,12 @@ static void __init isa_fill_devices(struct sparc_isa_bridge *isa_br) | |||
104 | struct linux_prom_registers *regs; | 102 | struct linux_prom_registers *regs; |
105 | struct sparc_isa_device *isa_dev; | 103 | struct sparc_isa_device *isa_dev; |
106 | 104 | ||
107 | isa_dev = kmalloc(sizeof(*isa_dev), GFP_KERNEL); | 105 | isa_dev = kzalloc(sizeof(*isa_dev), GFP_KERNEL); |
108 | if (!isa_dev) { | 106 | if (!isa_dev) { |
109 | printk(KERN_DEBUG "ISA: cannot allocate isa_dev"); | 107 | printk(KERN_DEBUG "ISA: cannot allocate isa_dev"); |
110 | return; | 108 | return; |
111 | } | 109 | } |
112 | 110 | ||
113 | memset(isa_dev, 0, sizeof(*isa_dev)); | ||
114 | |||
115 | isa_dev->ofdev.node = dp; | 111 | isa_dev->ofdev.node = dp; |
116 | isa_dev->ofdev.dev.parent = &isa_br->ofdev.dev; | 112 | isa_dev->ofdev.dev.parent = &isa_br->ofdev.dev; |
117 | isa_dev->ofdev.dev.bus = &isa_bus_type; | 113 | isa_dev->ofdev.dev.bus = &isa_bus_type; |
@@ -180,14 +176,12 @@ void __init isa_init(void) | |||
180 | pbm = pdev_cookie->pbm; | 176 | pbm = pdev_cookie->pbm; |
181 | dp = pdev_cookie->prom_node; | 177 | dp = pdev_cookie->prom_node; |
182 | 178 | ||
183 | isa_br = kmalloc(sizeof(*isa_br), GFP_KERNEL); | 179 | isa_br = kzalloc(sizeof(*isa_br), GFP_KERNEL); |
184 | if (!isa_br) { | 180 | if (!isa_br) { |
185 | printk(KERN_DEBUG "isa: cannot allocate sparc_isa_bridge"); | 181 | printk(KERN_DEBUG "isa: cannot allocate sparc_isa_bridge"); |
186 | return; | 182 | return; |
187 | } | 183 | } |
188 | 184 | ||
189 | memset(isa_br, 0, sizeof(*isa_br)); | ||
190 | |||
191 | isa_br->ofdev.node = dp; | 185 | isa_br->ofdev.node = dp; |
192 | isa_br->ofdev.dev.parent = &pdev->dev; | 186 | isa_br->ofdev.dev.parent = &pdev->dev; |
193 | isa_br->ofdev.dev.bus = &isa_bus_type; | 187 | isa_br->ofdev.dev.bus = &isa_bus_type; |
diff --git a/arch/sparc64/kernel/kprobes.c b/arch/sparc64/kernel/kprobes.c index 8e75ed762fd8..ae221f0d4a6f 100644 --- a/arch/sparc64/kernel/kprobes.c +++ b/arch/sparc64/kernel/kprobes.c | |||
@@ -45,7 +45,11 @@ DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); | |||
45 | int __kprobes arch_prepare_kprobe(struct kprobe *p) | 45 | int __kprobes arch_prepare_kprobe(struct kprobe *p) |
46 | { | 46 | { |
47 | p->ainsn.insn[0] = *p->addr; | 47 | p->ainsn.insn[0] = *p->addr; |
48 | flushi(&p->ainsn.insn[0]); | ||
49 | |||
48 | p->ainsn.insn[1] = BREAKPOINT_INSTRUCTION_2; | 50 | p->ainsn.insn[1] = BREAKPOINT_INSTRUCTION_2; |
51 | flushi(&p->ainsn.insn[1]); | ||
52 | |||
49 | p->opcode = *p->addr; | 53 | p->opcode = *p->addr; |
50 | return 0; | 54 | return 0; |
51 | } | 55 | } |
@@ -185,16 +189,19 @@ no_kprobe: | |||
185 | /* If INSN is a relative control transfer instruction, | 189 | /* If INSN is a relative control transfer instruction, |
186 | * return the corrected branch destination value. | 190 | * return the corrected branch destination value. |
187 | * | 191 | * |
188 | * The original INSN location was REAL_PC, it actually | 192 | * regs->tpc and regs->tnpc still hold the values of the |
189 | * executed at PC and produced destination address NPC. | 193 | * program counters at the time of trap due to the execution |
194 | * of the BREAKPOINT_INSTRUCTION_2 at p->ainsn.insn[1] | ||
195 | * | ||
190 | */ | 196 | */ |
191 | static unsigned long __kprobes relbranch_fixup(u32 insn, unsigned long real_pc, | 197 | static unsigned long __kprobes relbranch_fixup(u32 insn, struct kprobe *p, |
192 | unsigned long pc, | 198 | struct pt_regs *regs) |
193 | unsigned long npc) | ||
194 | { | 199 | { |
200 | unsigned long real_pc = (unsigned long) p->addr; | ||
201 | |||
195 | /* Branch not taken, no mods necessary. */ | 202 | /* Branch not taken, no mods necessary. */ |
196 | if (npc == pc + 0x4UL) | 203 | if (regs->tnpc == regs->tpc + 0x4UL) |
197 | return real_pc + 0x4UL; | 204 | return real_pc + 0x8UL; |
198 | 205 | ||
199 | /* The three cases are call, branch w/prediction, | 206 | /* The three cases are call, branch w/prediction, |
200 | * and traditional branch. | 207 | * and traditional branch. |
@@ -202,14 +209,21 @@ static unsigned long __kprobes relbranch_fixup(u32 insn, unsigned long real_pc, | |||
202 | if ((insn & 0xc0000000) == 0x40000000 || | 209 | if ((insn & 0xc0000000) == 0x40000000 || |
203 | (insn & 0xc1c00000) == 0x00400000 || | 210 | (insn & 0xc1c00000) == 0x00400000 || |
204 | (insn & 0xc1c00000) == 0x00800000) { | 211 | (insn & 0xc1c00000) == 0x00800000) { |
212 | unsigned long ainsn_addr; | ||
213 | |||
214 | ainsn_addr = (unsigned long) &p->ainsn.insn[0]; | ||
215 | |||
205 | /* The instruction did all the work for us | 216 | /* The instruction did all the work for us |
206 | * already, just apply the offset to the correct | 217 | * already, just apply the offset to the correct |
207 | * instruction location. | 218 | * instruction location. |
208 | */ | 219 | */ |
209 | return (real_pc + (npc - pc)); | 220 | return (real_pc + (regs->tnpc - ainsn_addr)); |
210 | } | 221 | } |
211 | 222 | ||
212 | return real_pc + 0x4UL; | 223 | /* It is jmpl or some other absolute PC modification instruction, |
224 | * leave NPC as-is. | ||
225 | */ | ||
226 | return regs->tnpc; | ||
213 | } | 227 | } |
214 | 228 | ||
215 | /* If INSN is an instruction which writes it's PC location | 229 | /* If INSN is an instruction which writes it's PC location |
@@ -220,12 +234,12 @@ static void __kprobes retpc_fixup(struct pt_regs *regs, u32 insn, | |||
220 | { | 234 | { |
221 | unsigned long *slot = NULL; | 235 | unsigned long *slot = NULL; |
222 | 236 | ||
223 | /* Simplest cast is call, which always uses %o7 */ | 237 | /* Simplest case is 'call', which always uses %o7 */ |
224 | if ((insn & 0xc0000000) == 0x40000000) { | 238 | if ((insn & 0xc0000000) == 0x40000000) { |
225 | slot = ®s->u_regs[UREG_I7]; | 239 | slot = ®s->u_regs[UREG_I7]; |
226 | } | 240 | } |
227 | 241 | ||
228 | /* Jmpl encodes the register inside of the opcode */ | 242 | /* 'jmpl' encodes the register inside of the opcode */ |
229 | if ((insn & 0xc1f80000) == 0x81c00000) { | 243 | if ((insn & 0xc1f80000) == 0x81c00000) { |
230 | unsigned long rd = ((insn >> 25) & 0x1f); | 244 | unsigned long rd = ((insn >> 25) & 0x1f); |
231 | 245 | ||
@@ -247,11 +261,11 @@ static void __kprobes retpc_fixup(struct pt_regs *regs, u32 insn, | |||
247 | 261 | ||
248 | /* | 262 | /* |
249 | * Called after single-stepping. p->addr is the address of the | 263 | * Called after single-stepping. p->addr is the address of the |
250 | * instruction whose first byte has been replaced by the breakpoint | 264 | * instruction which has been replaced by the breakpoint |
251 | * instruction. To avoid the SMP problems that can occur when we | 265 | * instruction. To avoid the SMP problems that can occur when we |
252 | * temporarily put back the original opcode to single-step, we | 266 | * temporarily put back the original opcode to single-step, we |
253 | * single-stepped a copy of the instruction. The address of this | 267 | * single-stepped a copy of the instruction. The address of this |
254 | * copy is p->ainsn.insn. | 268 | * copy is &p->ainsn.insn[0]. |
255 | * | 269 | * |
256 | * This function prepares to return from the post-single-step | 270 | * This function prepares to return from the post-single-step |
257 | * breakpoint trap. | 271 | * breakpoint trap. |
@@ -261,11 +275,11 @@ static void __kprobes resume_execution(struct kprobe *p, | |||
261 | { | 275 | { |
262 | u32 insn = p->ainsn.insn[0]; | 276 | u32 insn = p->ainsn.insn[0]; |
263 | 277 | ||
278 | regs->tnpc = relbranch_fixup(insn, p, regs); | ||
279 | |||
280 | /* This assignment must occur after relbranch_fixup() */ | ||
264 | regs->tpc = kcb->kprobe_orig_tnpc; | 281 | regs->tpc = kcb->kprobe_orig_tnpc; |
265 | regs->tnpc = relbranch_fixup(insn, | 282 | |
266 | (unsigned long) p->addr, | ||
267 | (unsigned long) &p->ainsn.insn[0], | ||
268 | regs->tnpc); | ||
269 | retpc_fixup(regs, insn, (unsigned long) p->addr); | 283 | retpc_fixup(regs, insn, (unsigned long) p->addr); |
270 | 284 | ||
271 | regs->tstate = ((regs->tstate & ~TSTATE_PIL) | | 285 | regs->tstate = ((regs->tstate & ~TSTATE_PIL) | |
@@ -430,17 +444,8 @@ int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs) | |||
430 | struct jprobe *jp = container_of(p, struct jprobe, kp); | 444 | struct jprobe *jp = container_of(p, struct jprobe, kp); |
431 | struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); | 445 | struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); |
432 | 446 | ||
433 | kcb->jprobe_saved_regs_location = regs; | ||
434 | memcpy(&(kcb->jprobe_saved_regs), regs, sizeof(*regs)); | 447 | memcpy(&(kcb->jprobe_saved_regs), regs, sizeof(*regs)); |
435 | 448 | ||
436 | /* Save a whole stack frame, this gets arguments | ||
437 | * pushed onto the stack after using up all the | ||
438 | * arg registers. | ||
439 | */ | ||
440 | memcpy(&(kcb->jprobe_saved_stack), | ||
441 | (char *) (regs->u_regs[UREG_FP] + STACK_BIAS), | ||
442 | sizeof(kcb->jprobe_saved_stack)); | ||
443 | |||
444 | regs->tpc = (unsigned long) jp->entry; | 449 | regs->tpc = (unsigned long) jp->entry; |
445 | regs->tnpc = ((unsigned long) jp->entry) + 0x4UL; | 450 | regs->tnpc = ((unsigned long) jp->entry) + 0x4UL; |
446 | regs->tstate |= TSTATE_PIL; | 451 | regs->tstate |= TSTATE_PIL; |
@@ -450,10 +455,19 @@ int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs) | |||
450 | 455 | ||
451 | void __kprobes jprobe_return(void) | 456 | void __kprobes jprobe_return(void) |
452 | { | 457 | { |
453 | __asm__ __volatile__( | 458 | struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); |
454 | ".globl jprobe_return_trap_instruction\n" | 459 | register unsigned long orig_fp asm("g1"); |
460 | |||
461 | orig_fp = kcb->jprobe_saved_regs.u_regs[UREG_FP]; | ||
462 | __asm__ __volatile__("\n" | ||
463 | "1: cmp %%sp, %0\n\t" | ||
464 | "blu,a,pt %%xcc, 1b\n\t" | ||
465 | " restore\n\t" | ||
466 | ".globl jprobe_return_trap_instruction\n" | ||
455 | "jprobe_return_trap_instruction:\n\t" | 467 | "jprobe_return_trap_instruction:\n\t" |
456 | "ta 0x70"); | 468 | "ta 0x70" |
469 | : /* no outputs */ | ||
470 | : "r" (orig_fp)); | ||
457 | } | 471 | } |
458 | 472 | ||
459 | extern void jprobe_return_trap_instruction(void); | 473 | extern void jprobe_return_trap_instruction(void); |
@@ -466,26 +480,7 @@ int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs) | |||
466 | struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); | 480 | struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); |
467 | 481 | ||
468 | if (addr == (u32 *) jprobe_return_trap_instruction) { | 482 | if (addr == (u32 *) jprobe_return_trap_instruction) { |
469 | if (kcb->jprobe_saved_regs_location != regs) { | ||
470 | printk("JPROBE: Current regs (%p) does not match " | ||
471 | "saved regs (%p).\n", | ||
472 | regs, kcb->jprobe_saved_regs_location); | ||
473 | printk("JPROBE: Saved registers\n"); | ||
474 | __show_regs(kcb->jprobe_saved_regs_location); | ||
475 | printk("JPROBE: Current registers\n"); | ||
476 | __show_regs(regs); | ||
477 | BUG(); | ||
478 | } | ||
479 | /* Restore old register state. Do pt_regs | ||
480 | * first so that UREG_FP is the original one for | ||
481 | * the stack frame restore. | ||
482 | */ | ||
483 | memcpy(regs, &(kcb->jprobe_saved_regs), sizeof(*regs)); | 483 | memcpy(regs, &(kcb->jprobe_saved_regs), sizeof(*regs)); |
484 | |||
485 | memcpy((char *) (regs->u_regs[UREG_FP] + STACK_BIAS), | ||
486 | &(kcb->jprobe_saved_stack), | ||
487 | sizeof(kcb->jprobe_saved_stack)); | ||
488 | |||
489 | preempt_enable_no_resched(); | 484 | preempt_enable_no_resched(); |
490 | return 1; | 485 | return 1; |
491 | } | 486 | } |
diff --git a/arch/sparc64/kernel/of_device.c b/arch/sparc64/kernel/of_device.c index 8cc14fc6b6f1..cec0eceae552 100644 --- a/arch/sparc64/kernel/of_device.c +++ b/arch/sparc64/kernel/of_device.c | |||
@@ -1007,10 +1007,9 @@ struct of_device* of_platform_device_create(struct device_node *np, | |||
1007 | { | 1007 | { |
1008 | struct of_device *dev; | 1008 | struct of_device *dev; |
1009 | 1009 | ||
1010 | dev = kmalloc(sizeof(*dev), GFP_KERNEL); | 1010 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); |
1011 | if (!dev) | 1011 | if (!dev) |
1012 | return NULL; | 1012 | return NULL; |
1013 | memset(dev, 0, sizeof(*dev)); | ||
1014 | 1013 | ||
1015 | dev->dev.parent = parent; | 1014 | dev->dev.parent = parent; |
1016 | dev->dev.bus = bus; | 1015 | dev->dev.bus = bus; |
diff --git a/arch/sparc64/kernel/pci_sun4v.c b/arch/sparc64/kernel/pci_sun4v.c index 03ad4c06758e..6b04794b7a97 100644 --- a/arch/sparc64/kernel/pci_sun4v.c +++ b/arch/sparc64/kernel/pci_sun4v.c | |||
@@ -798,7 +798,7 @@ static struct pci_ops pci_sun4v_ops = { | |||
798 | static void pbm_scan_bus(struct pci_controller_info *p, | 798 | static void pbm_scan_bus(struct pci_controller_info *p, |
799 | struct pci_pbm_info *pbm) | 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 | if (!cookie) { | 803 | if (!cookie) { |
804 | prom_printf("%s: Critical allocation failure.\n", pbm->name); | 804 | prom_printf("%s: Critical allocation failure.\n", pbm->name); |
@@ -806,7 +806,6 @@ static void pbm_scan_bus(struct pci_controller_info *p, | |||
806 | } | 806 | } |
807 | 807 | ||
808 | /* All we care about is the PBM. */ | 808 | /* All we care about is the PBM. */ |
809 | memset(cookie, 0, sizeof(*cookie)); | ||
810 | cookie->pbm = pbm; | 809 | cookie->pbm = pbm; |
811 | 810 | ||
812 | pbm->pci_bus = pci_scan_bus(pbm->pci_first_busno, p->pci_ops, pbm); | 811 | pbm->pci_bus = pci_scan_bus(pbm->pci_first_busno, p->pci_ops, pbm); |
@@ -1048,12 +1047,11 @@ static void pci_sun4v_iommu_init(struct pci_pbm_info *pbm) | |||
1048 | /* Allocate and initialize the free area map. */ | 1047 | /* Allocate and initialize the free area map. */ |
1049 | sz = num_tsb_entries / 8; | 1048 | sz = num_tsb_entries / 8; |
1050 | sz = (sz + 7UL) & ~7UL; | 1049 | sz = (sz + 7UL) & ~7UL; |
1051 | iommu->arena.map = kmalloc(sz, GFP_KERNEL); | 1050 | iommu->arena.map = kzalloc(sz, GFP_KERNEL); |
1052 | if (!iommu->arena.map) { | 1051 | if (!iommu->arena.map) { |
1053 | prom_printf("PCI_IOMMU: Error, kmalloc(arena.map) failed.\n"); | 1052 | prom_printf("PCI_IOMMU: Error, kmalloc(arena.map) failed.\n"); |
1054 | prom_halt(); | 1053 | prom_halt(); |
1055 | } | 1054 | } |
1056 | memset(iommu->arena.map, 0, sz); | ||
1057 | iommu->arena.limit = num_tsb_entries; | 1055 | iommu->arena.limit = num_tsb_entries; |
1058 | 1056 | ||
1059 | sz = probe_existing_entries(pbm, iommu); | 1057 | sz = probe_existing_entries(pbm, iommu); |
@@ -1164,24 +1162,20 @@ void sun4v_pci_init(struct device_node *dp, char *model_name) | |||
1164 | per_cpu(pci_iommu_batch, i).pglist = (u64 *) page; | 1162 | per_cpu(pci_iommu_batch, i).pglist = (u64 *) page; |
1165 | } | 1163 | } |
1166 | 1164 | ||
1167 | p = kmalloc(sizeof(struct pci_controller_info), GFP_ATOMIC); | 1165 | p = kzalloc(sizeof(struct pci_controller_info), GFP_ATOMIC); |
1168 | if (!p) | 1166 | if (!p) |
1169 | goto fatal_memory_error; | 1167 | goto fatal_memory_error; |
1170 | 1168 | ||
1171 | memset(p, 0, sizeof(*p)); | 1169 | iommu = kzalloc(sizeof(struct pci_iommu), GFP_ATOMIC); |
1172 | |||
1173 | iommu = kmalloc(sizeof(struct pci_iommu), GFP_ATOMIC); | ||
1174 | if (!iommu) | 1170 | if (!iommu) |
1175 | goto fatal_memory_error; | 1171 | goto fatal_memory_error; |
1176 | 1172 | ||
1177 | memset(iommu, 0, sizeof(*iommu)); | ||
1178 | p->pbm_A.iommu = iommu; | 1173 | p->pbm_A.iommu = iommu; |
1179 | 1174 | ||
1180 | iommu = kmalloc(sizeof(struct pci_iommu), GFP_ATOMIC); | 1175 | iommu = kzalloc(sizeof(struct pci_iommu), GFP_ATOMIC); |
1181 | if (!iommu) | 1176 | if (!iommu) |
1182 | goto fatal_memory_error; | 1177 | goto fatal_memory_error; |
1183 | 1178 | ||
1184 | memset(iommu, 0, sizeof(*iommu)); | ||
1185 | p->pbm_B.iommu = iommu; | 1179 | p->pbm_B.iommu = iommu; |
1186 | 1180 | ||
1187 | p->next = pci_controller_root; | 1181 | p->next = pci_controller_root; |
diff --git a/arch/sparc64/kernel/ptrace.c b/arch/sparc64/kernel/ptrace.c index d31975e6d6f6..81111a12f0a8 100644 --- a/arch/sparc64/kernel/ptrace.c +++ b/arch/sparc64/kernel/ptrace.c | |||
@@ -202,7 +202,10 @@ asmlinkage void do_ptrace(struct pt_regs *regs) | |||
202 | #endif | 202 | #endif |
203 | if (request == PTRACE_TRACEME) { | 203 | if (request == PTRACE_TRACEME) { |
204 | ret = ptrace_traceme(); | 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 | goto out; | 209 | goto out; |
207 | } | 210 | } |
208 | 211 | ||
diff --git a/arch/sparc64/kernel/rtrap.S b/arch/sparc64/kernel/rtrap.S index 3522cd66f3bb..079d18a11d24 100644 --- a/arch/sparc64/kernel/rtrap.S +++ b/arch/sparc64/kernel/rtrap.S | |||
@@ -165,14 +165,26 @@ rtrap: | |||
165 | __handle_softirq_continue: | 165 | __handle_softirq_continue: |
166 | rtrap_xcall: | 166 | rtrap_xcall: |
167 | sethi %hi(0xf << 20), %l4 | 167 | sethi %hi(0xf << 20), %l4 |
168 | andcc %l1, TSTATE_PRIV, %l3 | ||
169 | and %l1, %l4, %l4 | 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 | bne,pn %icc, to_kernel | 180 | bne,pn %icc, to_kernel |
171 | andn %l1, %l4, %l1 | 181 | nop |
172 | 182 | ||
173 | /* We must hold IRQs off and atomically test schedule+signal | 183 | /* We must hold IRQs off and atomically test schedule+signal |
174 | * state, then hold them off all the way back to userspace. | 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 | * If we do not do this, there is a window where we would do | 189 | * If we do not do this, there is a window where we would do |
178 | * the tests, later the signal/resched event arrives but we do | 190 | * the tests, later the signal/resched event arrives but we do |
@@ -256,7 +268,6 @@ rt_continue: ldx [%sp + PTREGS_OFF + PT_V9_G1], %g1 | |||
256 | 268 | ||
257 | ld [%sp + PTREGS_OFF + PT_V9_Y], %o3 | 269 | ld [%sp + PTREGS_OFF + PT_V9_Y], %o3 |
258 | wr %o3, %g0, %y | 270 | wr %o3, %g0, %y |
259 | srl %l4, 20, %l4 | ||
260 | wrpr %l4, 0x0, %pil | 271 | wrpr %l4, 0x0, %pil |
261 | wrpr %g0, 0x1, %tl | 272 | wrpr %g0, 0x1, %tl |
262 | wrpr %l1, %g0, %tstate | 273 | wrpr %l1, %g0, %tstate |
@@ -374,8 +385,8 @@ to_kernel: | |||
374 | ldx [%g6 + TI_FLAGS], %l5 | 385 | ldx [%g6 + TI_FLAGS], %l5 |
375 | andcc %l5, _TIF_NEED_RESCHED, %g0 | 386 | andcc %l5, _TIF_NEED_RESCHED, %g0 |
376 | be,pt %xcc, kern_fpucheck | 387 | be,pt %xcc, kern_fpucheck |
377 | srl %l4, 20, %l5 | 388 | nop |
378 | cmp %l5, 0 | 389 | cmp %l4, 0 |
379 | bne,pn %xcc, kern_fpucheck | 390 | bne,pn %xcc, kern_fpucheck |
380 | sethi %hi(PREEMPT_ACTIVE), %l6 | 391 | sethi %hi(PREEMPT_ACTIVE), %l6 |
381 | stw %l6, [%g6 + TI_PRE_COUNT] | 392 | stw %l6, [%g6 + TI_PRE_COUNT] |
diff --git a/arch/sparc64/kernel/stacktrace.c b/arch/sparc64/kernel/stacktrace.c new file mode 100644 index 000000000000..c4d15f2762b9 --- /dev/null +++ b/arch/sparc64/kernel/stacktrace.c | |||
@@ -0,0 +1,41 @@ | |||
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 | } | ||
diff --git a/arch/sparc64/kernel/sun4v_ivec.S b/arch/sparc64/kernel/sun4v_ivec.S index 49703c3c5769..405855dd886b 100644 --- a/arch/sparc64/kernel/sun4v_ivec.S +++ b/arch/sparc64/kernel/sun4v_ivec.S | |||
@@ -190,7 +190,10 @@ sun4v_res_mondo: | |||
190 | mov %g1, %g4 | 190 | mov %g1, %g4 |
191 | ba,pt %xcc, etrap_irq | 191 | ba,pt %xcc, etrap_irq |
192 | rd %pc, %g7 | 192 | rd %pc, %g7 |
193 | 193 | #ifdef CONFIG_TRACE_IRQFLAGS | |
194 | call trace_hardirqs_off | ||
195 | nop | ||
196 | #endif | ||
194 | /* Log the event. */ | 197 | /* Log the event. */ |
195 | add %sp, PTREGS_OFF, %o0 | 198 | add %sp, PTREGS_OFF, %o0 |
196 | call sun4v_resum_error | 199 | call sun4v_resum_error |
@@ -216,7 +219,10 @@ sun4v_res_mondo_queue_full: | |||
216 | wrpr %g0, 15, %pil | 219 | wrpr %g0, 15, %pil |
217 | ba,pt %xcc, etrap_irq | 220 | ba,pt %xcc, etrap_irq |
218 | rd %pc, %g7 | 221 | rd %pc, %g7 |
219 | 222 | #ifdef CONFIG_TRACE_IRQFLAGS | |
223 | call trace_hardirqs_off | ||
224 | nop | ||
225 | #endif | ||
220 | call sun4v_resum_overflow | 226 | call sun4v_resum_overflow |
221 | add %sp, PTREGS_OFF, %o0 | 227 | add %sp, PTREGS_OFF, %o0 |
222 | 228 | ||
@@ -295,7 +301,10 @@ sun4v_nonres_mondo: | |||
295 | mov %g1, %g4 | 301 | mov %g1, %g4 |
296 | ba,pt %xcc, etrap_irq | 302 | ba,pt %xcc, etrap_irq |
297 | rd %pc, %g7 | 303 | rd %pc, %g7 |
298 | 304 | #ifdef CONFIG_TRACE_IRQFLAGS | |
305 | call trace_hardirqs_off | ||
306 | nop | ||
307 | #endif | ||
299 | /* Log the event. */ | 308 | /* Log the event. */ |
300 | add %sp, PTREGS_OFF, %o0 | 309 | add %sp, PTREGS_OFF, %o0 |
301 | call sun4v_nonresum_error | 310 | call sun4v_nonresum_error |
@@ -321,7 +330,10 @@ sun4v_nonres_mondo_queue_full: | |||
321 | wrpr %g0, 15, %pil | 330 | wrpr %g0, 15, %pil |
322 | ba,pt %xcc, etrap_irq | 331 | ba,pt %xcc, etrap_irq |
323 | rd %pc, %g7 | 332 | rd %pc, %g7 |
324 | 333 | #ifdef CONFIG_TRACE_IRQFLAGS | |
334 | call trace_hardirqs_off | ||
335 | nop | ||
336 | #endif | ||
325 | call sun4v_nonresum_overflow | 337 | call sun4v_nonresum_overflow |
326 | add %sp, PTREGS_OFF, %o0 | 338 | add %sp, PTREGS_OFF, %o0 |
327 | 339 | ||
diff --git a/arch/sparc64/kernel/traps.c b/arch/sparc64/kernel/traps.c index fe1796c939c3..ad67784292db 100644 --- a/arch/sparc64/kernel/traps.c +++ b/arch/sparc64/kernel/traps.c | |||
@@ -10,7 +10,7 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/module.h> | 12 | #include <linux/module.h> |
13 | #include <linux/sched.h> /* for jiffies */ | 13 | #include <linux/sched.h> |
14 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
15 | #include <linux/kallsyms.h> | 15 | #include <linux/kallsyms.h> |
16 | #include <linux/signal.h> | 16 | #include <linux/signal.h> |
@@ -1873,6 +1873,16 @@ void sun4v_resum_error(struct pt_regs *regs, unsigned long offset) | |||
1873 | 1873 | ||
1874 | put_cpu(); | 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 | sun4v_log_error(regs, &local_copy, cpu, | 1886 | sun4v_log_error(regs, &local_copy, cpu, |
1877 | KERN_ERR "RESUMABLE ERROR", | 1887 | KERN_ERR "RESUMABLE ERROR", |
1878 | &sun4v_resum_oflow_cnt); | 1888 | &sun4v_resum_oflow_cnt); |
@@ -2261,8 +2271,12 @@ void die_if_kernel(char *str, struct pt_regs *regs) | |||
2261 | do_exit(SIGSEGV); | 2271 | do_exit(SIGSEGV); |
2262 | } | 2272 | } |
2263 | 2273 | ||
2274 | #define VIS_OPCODE_MASK ((0x3 << 30) | (0x3f << 19)) | ||
2275 | #define VIS_OPCODE_VAL ((0x2 << 30) | (0x36 << 19)) | ||
2276 | |||
2264 | extern int handle_popc(u32 insn, struct pt_regs *regs); | 2277 | extern int handle_popc(u32 insn, struct pt_regs *regs); |
2265 | extern int handle_ldf_stq(u32 insn, struct pt_regs *regs); | 2278 | extern int handle_ldf_stq(u32 insn, struct pt_regs *regs); |
2279 | extern int vis_emul(struct pt_regs *, unsigned int); | ||
2266 | 2280 | ||
2267 | void do_illegal_instruction(struct pt_regs *regs) | 2281 | void do_illegal_instruction(struct pt_regs *regs) |
2268 | { | 2282 | { |
@@ -2287,10 +2301,18 @@ void do_illegal_instruction(struct pt_regs *regs) | |||
2287 | if (handle_ldf_stq(insn, regs)) | 2301 | if (handle_ldf_stq(insn, regs)) |
2288 | return; | 2302 | return; |
2289 | } else if (tlb_type == hypervisor) { | 2303 | } else if (tlb_type == hypervisor) { |
2290 | extern int vis_emul(struct pt_regs *, unsigned int); | 2304 | if ((insn & VIS_OPCODE_MASK) == VIS_OPCODE_VAL) { |
2305 | if (!vis_emul(regs, insn)) | ||
2306 | return; | ||
2307 | } else { | ||
2308 | struct fpustate *f = FPUSTATE; | ||
2291 | 2309 | ||
2292 | if (!vis_emul(regs, insn)) | 2310 | /* XXX maybe verify XFSR bits like |
2293 | return; | 2311 | * XXX do_fpother() does? |
2312 | */ | ||
2313 | if (do_mathemu(regs, f)) | ||
2314 | return; | ||
2315 | } | ||
2294 | } | 2316 | } |
2295 | } | 2317 | } |
2296 | info.si_signo = SIGILL; | 2318 | info.si_signo = SIGILL; |
diff --git a/arch/sparc64/kernel/unaligned.c b/arch/sparc64/kernel/unaligned.c index a9b765271b85..bc18d480dd1c 100644 --- a/arch/sparc64/kernel/unaligned.c +++ b/arch/sparc64/kernel/unaligned.c | |||
@@ -243,7 +243,7 @@ static inline int ok_for_kernel(unsigned int insn) | |||
243 | return !floating_point_load_or_store_p(insn); | 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 | struct pt_regs *regs = current_thread_info()->kern_una_regs; | 248 | struct pt_regs *regs = current_thread_info()->kern_una_regs; |
249 | unsigned int insn = current_thread_info()->kern_una_insn; | 249 | unsigned int insn = current_thread_info()->kern_una_insn; |
@@ -274,18 +274,15 @@ static void kernel_mna_trap_fault(void) | |||
274 | regs->tpc = entry->fixup; | 274 | regs->tpc = entry->fixup; |
275 | regs->tnpc = regs->tpc + 4; | 275 | regs->tnpc = regs->tpc + 4; |
276 | 276 | ||
277 | regs->tstate &= ~TSTATE_ASI; | 277 | if (fixup_tstate_asi) { |
278 | regs->tstate |= (ASI_AIUS << 24UL); | 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 | static unsigned long count, last_time; | 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 | if (jiffies - last_time > 5 * HZ) | 287 | if (jiffies - last_time > 5 * HZ) |
291 | count = 0; | 288 | count = 0; |
@@ -295,6 +292,28 @@ asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn) | |||
295 | printk("Kernel unaligned access at TPC[%lx] ", regs->tpc); | 292 | printk("Kernel unaligned access at TPC[%lx] ", regs->tpc); |
296 | print_symbol("%s\n", regs->tpc); | 293 | print_symbol("%s\n", regs->tpc); |
297 | } | 294 | } |
295 | } | ||
296 | |||
297 | asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn) | ||
298 | { | ||
299 | enum direction dir = decode_direction(insn); | ||
300 | int size = decode_access_size(insn); | ||
301 | int orig_asi, asi; | ||
302 | |||
303 | current_thread_info()->kern_una_regs = regs; | ||
304 | current_thread_info()->kern_una_insn = insn; | ||
305 | |||
306 | orig_asi = asi = decode_asi(insn, regs); | ||
307 | |||
308 | /* If this is a {get,put}_user() on an unaligned userspace pointer, | ||
309 | * just signal a fault and do not log the event. | ||
310 | */ | ||
311 | if (asi == ASI_AIUS) { | ||
312 | kernel_mna_trap_fault(0); | ||
313 | return; | ||
314 | } | ||
315 | |||
316 | log_unaligned(regs); | ||
298 | 317 | ||
299 | if (!ok_for_kernel(insn) || dir == both) { | 318 | if (!ok_for_kernel(insn) || dir == both) { |
300 | printk("Unsupported unaligned load/store trap for kernel " | 319 | printk("Unsupported unaligned load/store trap for kernel " |
@@ -302,10 +321,10 @@ asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn) | |||
302 | unaligned_panic("Kernel does fpu/atomic " | 321 | unaligned_panic("Kernel does fpu/atomic " |
303 | "unaligned load/store.", regs); | 322 | "unaligned load/store.", regs); |
304 | 323 | ||
305 | kernel_mna_trap_fault(); | 324 | kernel_mna_trap_fault(0); |
306 | } else { | 325 | } else { |
307 | unsigned long addr, *reg_addr; | 326 | unsigned long addr, *reg_addr; |
308 | int orig_asi, asi, err; | 327 | int err; |
309 | 328 | ||
310 | addr = compute_effective_address(regs, insn, | 329 | addr = compute_effective_address(regs, insn, |
311 | ((insn >> 25) & 0x1f)); | 330 | ((insn >> 25) & 0x1f)); |
@@ -315,7 +334,6 @@ asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn) | |||
315 | regs->tpc, dirstrings[dir], addr, size, | 334 | regs->tpc, dirstrings[dir], addr, size, |
316 | regs->u_regs[UREG_RETPC]); | 335 | regs->u_regs[UREG_RETPC]); |
317 | #endif | 336 | #endif |
318 | orig_asi = asi = decode_asi(insn, regs); | ||
319 | switch (asi) { | 337 | switch (asi) { |
320 | case ASI_NL: | 338 | case ASI_NL: |
321 | case ASI_AIUPL: | 339 | case ASI_AIUPL: |
@@ -365,7 +383,7 @@ asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn) | |||
365 | /* Not reached... */ | 383 | /* Not reached... */ |
366 | } | 384 | } |
367 | if (unlikely(err)) | 385 | if (unlikely(err)) |
368 | kernel_mna_trap_fault(); | 386 | kernel_mna_trap_fault(1); |
369 | else | 387 | else |
370 | advance(regs); | 388 | advance(regs); |
371 | } | 389 | } |
diff --git a/arch/sparc64/kernel/visemul.c b/arch/sparc64/kernel/visemul.c index 84fedaa38aae..c3fd64706b53 100644 --- a/arch/sparc64/kernel/visemul.c +++ b/arch/sparc64/kernel/visemul.c | |||
@@ -128,9 +128,6 @@ | |||
128 | /* 001001100 - Permute bytes as specified by GSR.MASK */ | 128 | /* 001001100 - Permute bytes as specified by GSR.MASK */ |
129 | #define BSHUFFLE_OPF 0x04c | 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 | #define VIS_OPF_SHIFT 5 | 131 | #define VIS_OPF_SHIFT 5 |
135 | #define VIS_OPF_MASK (0x1ff << VIS_OPF_SHIFT) | 132 | #define VIS_OPF_MASK (0x1ff << VIS_OPF_SHIFT) |
136 | 133 | ||
@@ -810,9 +807,6 @@ int vis_emul(struct pt_regs *regs, unsigned int insn) | |||
810 | if (get_user(insn, (u32 __user *) pc)) | 807 | if (get_user(insn, (u32 __user *) pc)) |
811 | return -EFAULT; | 808 | return -EFAULT; |
812 | 809 | ||
813 | if ((insn & VIS_OPCODE_MASK) != VIS_OPCODE_VAL) | ||
814 | return -EINVAL; | ||
815 | |||
816 | opf = (insn & VIS_OPF_MASK) >> VIS_OPF_SHIFT; | 810 | opf = (insn & VIS_OPF_MASK) >> VIS_OPF_SHIFT; |
817 | switch (opf) { | 811 | switch (opf) { |
818 | default: | 812 | default: |
diff --git a/arch/sparc64/mm/ultra.S b/arch/sparc64/mm/ultra.S index d70b60a3bbcc..737c26923c09 100644 --- a/arch/sparc64/mm/ultra.S +++ b/arch/sparc64/mm/ultra.S | |||
@@ -477,6 +477,10 @@ xcall_sync_tick: | |||
477 | sethi %hi(109f), %g7 | 477 | sethi %hi(109f), %g7 |
478 | b,pt %xcc, etrap_irq | 478 | b,pt %xcc, etrap_irq |
479 | 109: or %g7, %lo(109b), %g7 | 479 | 109: or %g7, %lo(109b), %g7 |
480 | #ifdef CONFIG_TRACE_IRQFLAGS | ||
481 | call trace_hardirqs_off | ||
482 | nop | ||
483 | #endif | ||
480 | call smp_synchronize_tick_client | 484 | call smp_synchronize_tick_client |
481 | nop | 485 | nop |
482 | clr %l6 | 486 | clr %l6 |
@@ -508,6 +512,10 @@ xcall_report_regs: | |||
508 | sethi %hi(109f), %g7 | 512 | sethi %hi(109f), %g7 |
509 | b,pt %xcc, etrap_irq | 513 | b,pt %xcc, etrap_irq |
510 | 109: or %g7, %lo(109b), %g7 | 514 | 109: or %g7, %lo(109b), %g7 |
515 | #ifdef CONFIG_TRACE_IRQFLAGS | ||
516 | call trace_hardirqs_off | ||
517 | nop | ||
518 | #endif | ||
511 | call __show_regs | 519 | call __show_regs |
512 | add %sp, PTREGS_OFF, %o0 | 520 | add %sp, PTREGS_OFF, %o0 |
513 | clr %l6 | 521 | clr %l6 |
diff --git a/include/asm-sparc64/dma.h b/include/asm-sparc64/dma.h index 27f65972b3bb..93e5a062df88 100644 --- a/include/asm-sparc64/dma.h +++ b/include/asm-sparc64/dma.h | |||
@@ -152,9 +152,9 @@ extern void dvma_init(struct sbus_bus *); | |||
152 | #define DMA_MAXEND(addr) (0x01000000UL-(((unsigned long)(addr))&0x00ffffffUL)) | 152 | #define DMA_MAXEND(addr) (0x01000000UL-(((unsigned long)(addr))&0x00ffffffUL)) |
153 | 153 | ||
154 | /* Yes, I hack a lot of elisp in my spare time... */ | 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)) | 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))) | 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)) | 157 | #define DMA_WRITE_P(regs) ((sbus_readl((regs) + DMA_CSR) & DMA_ST_WRITE)) |
158 | #define DMA_OFF(__regs) \ | 158 | #define DMA_OFF(__regs) \ |
159 | do { u32 tmp = sbus_readl((__regs) + DMA_CSR); \ | 159 | do { u32 tmp = sbus_readl((__regs) + DMA_CSR); \ |
160 | tmp &= ~DMA_ENABLE; \ | 160 | tmp &= ~DMA_ENABLE; \ |
diff --git a/include/asm-sparc64/irqflags.h b/include/asm-sparc64/irqflags.h new file mode 100644 index 000000000000..024fc54d0682 --- /dev/null +++ b/include/asm-sparc64/irqflags.h | |||
@@ -0,0 +1,89 @@ | |||
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) */ | ||
diff --git a/include/asm-sparc64/kprobes.h b/include/asm-sparc64/kprobes.h index c9f5c34d318c..becc38fa06c5 100644 --- a/include/asm-sparc64/kprobes.h +++ b/include/asm-sparc64/kprobes.h | |||
@@ -13,7 +13,11 @@ typedef u32 kprobe_opcode_t; | |||
13 | #define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry | 13 | #define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry |
14 | #define arch_remove_kprobe(p) do {} while (0) | 14 | #define arch_remove_kprobe(p) do {} while (0) |
15 | #define ARCH_INACTIVE_KPROBE_COUNT 0 | 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 | /* Architecture specific copy of original instruction*/ | 22 | /* Architecture specific copy of original instruction*/ |
19 | struct arch_specific_insn { | 23 | struct arch_specific_insn { |
@@ -23,7 +27,7 @@ struct arch_specific_insn { | |||
23 | 27 | ||
24 | struct prev_kprobe { | 28 | struct prev_kprobe { |
25 | struct kprobe *kp; | 29 | struct kprobe *kp; |
26 | unsigned int status; | 30 | unsigned long status; |
27 | unsigned long orig_tnpc; | 31 | unsigned long orig_tnpc; |
28 | unsigned long orig_tstate_pil; | 32 | unsigned long orig_tstate_pil; |
29 | }; | 33 | }; |
@@ -33,10 +37,7 @@ struct kprobe_ctlblk { | |||
33 | unsigned long kprobe_status; | 37 | unsigned long kprobe_status; |
34 | unsigned long kprobe_orig_tnpc; | 38 | unsigned long kprobe_orig_tnpc; |
35 | unsigned long kprobe_orig_tstate_pil; | 39 | unsigned long kprobe_orig_tstate_pil; |
36 | long *jprobe_saved_esp; | ||
37 | struct pt_regs jprobe_saved_regs; | 40 | struct pt_regs jprobe_saved_regs; |
38 | struct pt_regs *jprobe_saved_regs_location; | ||
39 | struct sparc_stackf jprobe_saved_stack; | ||
40 | struct prev_kprobe prev_kprobe; | 41 | struct prev_kprobe prev_kprobe; |
41 | }; | 42 | }; |
42 | 43 | ||
diff --git a/include/asm-sparc64/rwsem.h b/include/asm-sparc64/rwsem.h index cef5e8270421..1294b7ce5d06 100644 --- a/include/asm-sparc64/rwsem.h +++ b/include/asm-sparc64/rwsem.h | |||
@@ -23,20 +23,33 @@ struct rw_semaphore { | |||
23 | signed int count; | 23 | signed int count; |
24 | spinlock_t wait_lock; | 24 | spinlock_t wait_lock; |
25 | struct list_head wait_list; | 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 | #define __RWSEM_INITIALIZER(name) \ | 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 | #define DECLARE_RWSEM(name) \ | 41 | #define DECLARE_RWSEM(name) \ |
32 | struct rw_semaphore name = __RWSEM_INITIALIZER(name) | 42 | struct rw_semaphore name = __RWSEM_INITIALIZER(name) |
33 | 43 | ||
34 | static __inline__ void init_rwsem(struct rw_semaphore *sem) | 44 | extern void __init_rwsem(struct rw_semaphore *sem, const char *name, |
35 | { | 45 | struct lock_class_key *key); |
36 | sem->count = RWSEM_UNLOCKED_VALUE; | 46 | |
37 | spin_lock_init(&sem->wait_lock); | 47 | #define init_rwsem(sem) \ |
38 | INIT_LIST_HEAD(&sem->wait_list); | 48 | do { \ |
39 | } | 49 | static struct lock_class_key __key; \ |
50 | \ | ||
51 | __init_rwsem((sem), #sem, &__key); \ | ||
52 | } while (0) | ||
40 | 53 | ||
41 | extern void __down_read(struct rw_semaphore *sem); | 54 | extern void __down_read(struct rw_semaphore *sem); |
42 | extern int __down_read_trylock(struct rw_semaphore *sem); | 55 | extern int __down_read_trylock(struct rw_semaphore *sem); |
@@ -46,6 +59,11 @@ extern void __up_read(struct rw_semaphore *sem); | |||
46 | extern void __up_write(struct rw_semaphore *sem); | 59 | extern void __up_write(struct rw_semaphore *sem); |
47 | extern void __downgrade_write(struct rw_semaphore *sem); | 60 | extern void __downgrade_write(struct rw_semaphore *sem); |
48 | 61 | ||
62 | static inline void __down_write_nested(struct rw_semaphore *sem, int subclass) | ||
63 | { | ||
64 | __down_write(sem); | ||
65 | } | ||
66 | |||
49 | static inline int rwsem_atomic_update(int delta, struct rw_semaphore *sem) | 67 | static inline int rwsem_atomic_update(int delta, struct rw_semaphore *sem) |
50 | { | 68 | { |
51 | return atomic_add_return(delta, (atomic_t *)(&sem->count)); | 69 | return atomic_add_return(delta, (atomic_t *)(&sem->count)); |
diff --git a/include/asm-sparc64/system.h b/include/asm-sparc64/system.h index a8b7432c9a70..32281acb878b 100644 --- a/include/asm-sparc64/system.h +++ b/include/asm-sparc64/system.h | |||
@@ -7,6 +7,9 @@ | |||
7 | #include <asm/visasm.h> | 7 | #include <asm/visasm.h> |
8 | 8 | ||
9 | #ifndef __ASSEMBLY__ | 9 | #ifndef __ASSEMBLY__ |
10 | |||
11 | #include <linux/irqflags.h> | ||
12 | |||
10 | /* | 13 | /* |
11 | * Sparc (general) CPU types | 14 | * Sparc (general) CPU types |
12 | */ | 15 | */ |
@@ -72,52 +75,6 @@ do { __asm__ __volatile__("ba,pt %%xcc, 1f\n\t" \ | |||
72 | 75 | ||
73 | #endif | 76 | #endif |
74 | 77 | ||
75 | #define setipl(__new_ipl) \ | ||
76 | __asm__ __volatile__("wrpr %0, %%pil" : : "r" (__new_ipl) : "memory") | ||
77 | |||
78 | #define local_irq_disable() \ | ||
79 | __asm__ __volatile__("wrpr 15, %%pil" : : : "memory") | ||
80 | |||
81 | #define local_irq_enable() \ | ||
82 | __asm__ __volatile__("wrpr 0, %%pil" : : : "memory") | ||
83 | |||
84 | #define getipl() \ | ||
85 | ({ unsigned long retval; __asm__ __volatile__("rdpr %%pil, %0" : "=r" (retval)); retval; }) | ||
86 | |||
87 | #define swap_pil(__new_pil) \ | ||
88 | ({ unsigned long retval; \ | ||
89 | __asm__ __volatile__("rdpr %%pil, %0\n\t" \ | ||
90 | "wrpr %1, %%pil" \ | ||
91 | : "=&r" (retval) \ | ||
92 | : "r" (__new_pil) \ | ||
93 | : "memory"); \ | ||
94 | retval; \ | ||
95 | }) | ||
96 | |||
97 | #define read_pil_and_cli() \ | ||
98 | ({ unsigned long retval; \ | ||
99 | __asm__ __volatile__("rdpr %%pil, %0\n\t" \ | ||
100 | "wrpr 15, %%pil" \ | ||
101 | : "=r" (retval) \ | ||
102 | : : "memory"); \ | ||
103 | retval; \ | ||
104 | }) | ||
105 | |||
106 | #define local_save_flags(flags) ((flags) = getipl()) | ||
107 | #define local_irq_save(flags) ((flags) = read_pil_and_cli()) | ||
108 | #define local_irq_restore(flags) setipl((flags)) | ||
109 | |||
110 | /* On sparc64 IRQ flags are the PIL register. A value of zero | ||
111 | * means all interrupt levels are enabled, any other value means | ||
112 | * only IRQ levels greater than that value will be received. | ||
113 | * Consequently this means that the lowest IRQ level is one. | ||
114 | */ | ||
115 | #define irqs_disabled() \ | ||
116 | ({ unsigned long flags; \ | ||
117 | local_save_flags(flags);\ | ||
118 | (flags > 0); \ | ||
119 | }) | ||
120 | |||
121 | #define nop() __asm__ __volatile__ ("nop") | 78 | #define nop() __asm__ __volatile__ ("nop") |
122 | 79 | ||
123 | #define read_barrier_depends() do { } while(0) | 80 | #define read_barrier_depends() do { } while(0) |
diff --git a/include/asm-sparc64/ttable.h b/include/asm-sparc64/ttable.h index f2352606a79f..c2a16e188499 100644 --- a/include/asm-sparc64/ttable.h +++ b/include/asm-sparc64/ttable.h | |||
@@ -137,10 +137,49 @@ | |||
137 | #endif | 137 | #endif |
138 | #define BREAKPOINT_TRAP TRAP(breakpoint_trap) | 138 | #define BREAKPOINT_TRAP TRAP(breakpoint_trap) |
139 | 139 | ||
140 | #ifdef CONFIG_TRACE_IRQFLAGS | ||
141 | |||
142 | #define TRAP_IRQ(routine, level) \ | ||
143 | rdpr %pil, %g2; \ | ||
144 | wrpr %g0, 15, %pil; \ | ||
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 | |||
140 | #define TRAP_IRQ(routine, level) \ | 179 | #define TRAP_IRQ(routine, level) \ |
141 | rdpr %pil, %g2; \ | 180 | rdpr %pil, %g2; \ |
142 | wrpr %g0, 15, %pil; \ | 181 | wrpr %g0, 15, %pil; \ |
143 | b,pt %xcc, etrap_irq; \ | 182 | ba,pt %xcc, etrap_irq; \ |
144 | rd %pc, %g7; \ | 183 | rd %pc, %g7; \ |
145 | mov level, %o0; \ | 184 | mov level, %o0; \ |
146 | call routine; \ | 185 | call routine; \ |
@@ -151,12 +190,14 @@ | |||
151 | rdpr %pil, %g2; \ | 190 | rdpr %pil, %g2; \ |
152 | wrpr %g0, 15, %pil; \ | 191 | wrpr %g0, 15, %pil; \ |
153 | sethi %hi(109f), %g7; \ | 192 | sethi %hi(109f), %g7; \ |
154 | b,pt %xcc, etrap_irq; \ | 193 | ba,pt %xcc, etrap_irq; \ |
155 | 109: or %g7, %lo(109b), %g7; \ | 194 | 109: or %g7, %lo(109b), %g7; \ |
156 | call smp_percpu_timer_interrupt; \ | 195 | call smp_percpu_timer_interrupt; \ |
157 | add %sp, PTREGS_OFF, %o0; \ | 196 | add %sp, PTREGS_OFF, %o0; \ |
158 | ba,a,pt %xcc, rtrap_irq; | 197 | ba,a,pt %xcc, rtrap_irq; |
159 | 198 | ||
199 | #endif | ||
200 | |||
160 | #define TRAP_IVEC TRAP_NOSAVE(do_ivec) | 201 | #define TRAP_IVEC TRAP_NOSAVE(do_ivec) |
161 | 202 | ||
162 | #define BTRAP(lvl) TRAP_ARG(bad_trap, lvl) | 203 | #define BTRAP(lvl) TRAP_ARG(bad_trap, lvl) |