aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/sparc/kernel/systbls.S6
-rw-r--r--arch/sparc64/defconfig83
-rw-r--r--arch/sparc64/kernel/Makefile2
-rw-r--r--arch/sparc64/kernel/iommu.c142
-rw-r--r--arch/sparc64/kernel/iommu_common.c248
-rw-r--r--arch/sparc64/kernel/iommu_common.h26
-rw-r--r--arch/sparc64/kernel/pci_sun4v.c170
-rw-r--r--arch/sparc64/kernel/systbls.S9
-rw-r--r--include/asm-sparc/unistd.h6
-rw-r--r--include/asm-sparc64/io.h2
-rw-r--r--include/asm-sparc64/unistd.h6
11 files changed, 164 insertions, 536 deletions
diff --git a/arch/sparc/kernel/systbls.S b/arch/sparc/kernel/systbls.S
index ee010f4532a0..9064485dc40b 100644
--- a/arch/sparc/kernel/systbls.S
+++ b/arch/sparc/kernel/systbls.S
@@ -79,7 +79,8 @@ sys_call_table:
79/*295*/ .long sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll, sys_unshare 79/*295*/ .long sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll, sys_unshare
80/*300*/ .long sys_set_robust_list, sys_get_robust_list, sys_migrate_pages, sys_mbind, sys_get_mempolicy 80/*300*/ .long sys_set_robust_list, sys_get_robust_list, sys_migrate_pages, sys_mbind, sys_get_mempolicy
81/*305*/ .long sys_set_mempolicy, sys_kexec_load, sys_move_pages, sys_getcpu, sys_epoll_pwait 81/*305*/ .long sys_set_mempolicy, sys_kexec_load, sys_move_pages, sys_getcpu, sys_epoll_pwait
82/*310*/ .long sys_utimensat, sys_signalfd, sys_ni_syscall, sys_eventfd, sys_fallocate 82/*310*/ .long sys_utimensat, sys_signalfd, sys_timerfd_create, sys_eventfd, sys_fallocate
83/*315*/ .long sys_timerfd_settime, sys_timerfd_gettime
83 84
84#ifdef CONFIG_SUNOS_EMUL 85#ifdef CONFIG_SUNOS_EMUL
85 /* Now the SunOS syscall table. */ 86 /* Now the SunOS syscall table. */
@@ -197,6 +198,7 @@ sunos_sys_table:
197 .long sunos_nosys, sunos_nosys, sunos_nosys 198 .long sunos_nosys, sunos_nosys, sunos_nosys
198 .long sunos_nosys 199 .long sunos_nosys
199/*310*/ .long sunos_nosys, sunos_nosys, sunos_nosys 200/*310*/ .long sunos_nosys, sunos_nosys, sunos_nosys
200 .long sunos_nosys, sunos_nosys 201 .long sunos_nosys, sunos_nosys, sunos_nosys
202 .long sunos_nosys
201 203
202#endif 204#endif
diff --git a/arch/sparc64/defconfig b/arch/sparc64/defconfig
index f62d9f6c5e2a..833d74b2b192 100644
--- a/arch/sparc64/defconfig
+++ b/arch/sparc64/defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.24-rc4 3# Linux kernel version: 2.6.24
4# Tue Dec 4 00:37:59 2007 4# Tue Feb 5 17:28:19 2008
5# 5#
6CONFIG_SPARC=y 6CONFIG_SPARC=y
7CONFIG_SPARC64=y 7CONFIG_SPARC64=y
@@ -17,6 +17,7 @@ CONFIG_ARCH_MAY_HAVE_PC_FDC=y
17# CONFIG_ARCH_HAS_ILOG2_U32 is not set 17# CONFIG_ARCH_HAS_ILOG2_U32 is not set
18# CONFIG_ARCH_HAS_ILOG2_U64 is not set 18# CONFIG_ARCH_HAS_ILOG2_U64 is not set
19CONFIG_AUDIT_ARCH=y 19CONFIG_AUDIT_ARCH=y
20CONFIG_HAVE_SETUP_PER_CPU_AREA=y
20CONFIG_ARCH_NO_VIRT_TO_BUS=y 21CONFIG_ARCH_NO_VIRT_TO_BUS=y
21CONFIG_OF=y 22CONFIG_OF=y
22CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y 23CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
@@ -30,13 +31,15 @@ CONFIG_HZ_100=y
30# CONFIG_HZ_300 is not set 31# CONFIG_HZ_300 is not set
31# CONFIG_HZ_1000 is not set 32# CONFIG_HZ_1000 is not set
32CONFIG_HZ=100 33CONFIG_HZ=100
34# CONFIG_SCHED_HRTICK is not set
35CONFIG_HOTPLUG_CPU=y
33CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 36CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
34 37
35# 38#
36# General setup 39# General setup
37# 40#
38CONFIG_EXPERIMENTAL=y 41CONFIG_EXPERIMENTAL=y
39CONFIG_BROKEN_ON_SMP=y 42CONFIG_LOCK_KERNEL=y
40CONFIG_INIT_ENV_ARG_LIMIT=32 43CONFIG_INIT_ENV_ARG_LIMIT=32
41CONFIG_LOCALVERSION="" 44CONFIG_LOCALVERSION=""
42# CONFIG_LOCALVERSION_AUTO is not set 45# CONFIG_LOCALVERSION_AUTO is not set
@@ -76,6 +79,7 @@ CONFIG_FUTEX=y
76CONFIG_ANON_INODES=y 79CONFIG_ANON_INODES=y
77CONFIG_EPOLL=y 80CONFIG_EPOLL=y
78CONFIG_SIGNALFD=y 81CONFIG_SIGNALFD=y
82CONFIG_TIMERFD=y
79CONFIG_EVENTFD=y 83CONFIG_EVENTFD=y
80CONFIG_SHMEM=y 84CONFIG_SHMEM=y
81CONFIG_VM_EVENT_COUNTERS=y 85CONFIG_VM_EVENT_COUNTERS=y
@@ -83,6 +87,14 @@ CONFIG_SLUB_DEBUG=y
83# CONFIG_SLAB is not set 87# CONFIG_SLAB is not set
84CONFIG_SLUB=y 88CONFIG_SLUB=y
85# CONFIG_SLOB is not set 89# CONFIG_SLOB is not set
90CONFIG_PROFILING=y
91# CONFIG_MARKERS is not set
92CONFIG_OPROFILE=m
93CONFIG_HAVE_OPROFILE=y
94CONFIG_KPROBES=y
95CONFIG_HAVE_KPROBES=y
96CONFIG_PROC_PAGE_MONITOR=y
97CONFIG_SLABINFO=y
86CONFIG_RT_MUTEXES=y 98CONFIG_RT_MUTEXES=y
87# CONFIG_TINY_SHMEM is not set 99# CONFIG_TINY_SHMEM is not set
88CONFIG_BASE_SMALL=0 100CONFIG_BASE_SMALL=0
@@ -92,6 +104,7 @@ CONFIG_MODULE_FORCE_UNLOAD=y
92CONFIG_MODVERSIONS=y 104CONFIG_MODVERSIONS=y
93CONFIG_MODULE_SRCVERSION_ALL=y 105CONFIG_MODULE_SRCVERSION_ALL=y
94CONFIG_KMOD=y 106CONFIG_KMOD=y
107CONFIG_STOP_MACHINE=y
95CONFIG_BLOCK=y 108CONFIG_BLOCK=y
96CONFIG_BLK_DEV_IO_TRACE=y 109CONFIG_BLK_DEV_IO_TRACE=y
97CONFIG_BLK_DEV_BSG=y 110CONFIG_BLK_DEV_BSG=y
@@ -109,6 +122,8 @@ CONFIG_DEFAULT_AS=y
109# CONFIG_DEFAULT_CFQ is not set 122# CONFIG_DEFAULT_CFQ is not set
110# CONFIG_DEFAULT_NOOP is not set 123# CONFIG_DEFAULT_NOOP is not set
111CONFIG_DEFAULT_IOSCHED="anticipatory" 124CONFIG_DEFAULT_IOSCHED="anticipatory"
125CONFIG_CLASSIC_RCU=y
126# CONFIG_PREEMPT_RCU is not set
112CONFIG_SYSVIPC_COMPAT=y 127CONFIG_SYSVIPC_COMPAT=y
113CONFIG_GENERIC_HARDIRQS=y 128CONFIG_GENERIC_HARDIRQS=y
114 129
@@ -119,7 +134,8 @@ CONFIG_TICK_ONESHOT=y
119CONFIG_NO_HZ=y 134CONFIG_NO_HZ=y
120CONFIG_HIGH_RES_TIMERS=y 135CONFIG_HIGH_RES_TIMERS=y
121CONFIG_GENERIC_CLOCKEVENTS_BUILD=y 136CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
122# CONFIG_SMP is not set 137CONFIG_SMP=y
138CONFIG_NR_CPUS=64
123# CONFIG_CPU_FREQ is not set 139# CONFIG_CPU_FREQ is not set
124CONFIG_RWSEM_XCHGADD_ALGORITHM=y 140CONFIG_RWSEM_XCHGADD_ALGORITHM=y
125CONFIG_GENERIC_FIND_NEXT_BIT=y 141CONFIG_GENERIC_FIND_NEXT_BIT=y
@@ -169,9 +185,12 @@ CONFIG_BINFMT_ELF32=y
169CONFIG_BINFMT_ELF=y 185CONFIG_BINFMT_ELF=y
170CONFIG_BINFMT_MISC=m 186CONFIG_BINFMT_MISC=m
171CONFIG_SOLARIS_EMUL=y 187CONFIG_SOLARIS_EMUL=y
188CONFIG_SCHED_SMT=y
189CONFIG_SCHED_MC=y
172# CONFIG_PREEMPT_NONE is not set 190# CONFIG_PREEMPT_NONE is not set
173CONFIG_PREEMPT_VOLUNTARY=y 191CONFIG_PREEMPT_VOLUNTARY=y
174# CONFIG_PREEMPT is not set 192# CONFIG_PREEMPT is not set
193# CONFIG_RCU_TRACE is not set
175# CONFIG_CMDLINE_BOOL is not set 194# CONFIG_CMDLINE_BOOL is not set
176 195
177# 196#
@@ -189,6 +208,7 @@ CONFIG_XFRM=y
189CONFIG_XFRM_USER=m 208CONFIG_XFRM_USER=m
190# CONFIG_XFRM_SUB_POLICY is not set 209# CONFIG_XFRM_SUB_POLICY is not set
191CONFIG_XFRM_MIGRATE=y 210CONFIG_XFRM_MIGRATE=y
211# CONFIG_XFRM_STATISTICS is not set
192CONFIG_NET_KEY=m 212CONFIG_NET_KEY=m
193CONFIG_NET_KEY_MIGRATE=y 213CONFIG_NET_KEY_MIGRATE=y
194CONFIG_INET=y 214CONFIG_INET=y
@@ -249,9 +269,9 @@ CONFIG_IP_DCCP_ACKVEC=y
249CONFIG_IP_DCCP_CCID2=m 269CONFIG_IP_DCCP_CCID2=m
250# CONFIG_IP_DCCP_CCID2_DEBUG is not set 270# CONFIG_IP_DCCP_CCID2_DEBUG is not set
251CONFIG_IP_DCCP_CCID3=m 271CONFIG_IP_DCCP_CCID3=m
252CONFIG_IP_DCCP_TFRC_LIB=m
253# CONFIG_IP_DCCP_CCID3_DEBUG is not set 272# CONFIG_IP_DCCP_CCID3_DEBUG is not set
254CONFIG_IP_DCCP_CCID3_RTO=100 273CONFIG_IP_DCCP_CCID3_RTO=100
274CONFIG_IP_DCCP_TFRC_LIB=m
255 275
256# 276#
257# DCCP Kernel Hacking 277# DCCP Kernel Hacking
@@ -279,6 +299,7 @@ CONFIG_VLAN_8021Q=m
279CONFIG_NET_PKTGEN=m 299CONFIG_NET_PKTGEN=m
280CONFIG_NET_TCPPROBE=m 300CONFIG_NET_TCPPROBE=m
281# CONFIG_HAMRADIO is not set 301# CONFIG_HAMRADIO is not set
302# CONFIG_CAN is not set
282# CONFIG_IRDA is not set 303# CONFIG_IRDA is not set
283# CONFIG_BT is not set 304# CONFIG_BT is not set
284# CONFIG_AF_RXRPC is not set 305# CONFIG_AF_RXRPC is not set
@@ -343,6 +364,7 @@ CONFIG_BLK_DEV_IDE=y
343CONFIG_BLK_DEV_IDEDISK=y 364CONFIG_BLK_DEV_IDEDISK=y
344# CONFIG_IDEDISK_MULTI_MODE is not set 365# CONFIG_IDEDISK_MULTI_MODE is not set
345CONFIG_BLK_DEV_IDECD=y 366CONFIG_BLK_DEV_IDECD=y
367CONFIG_BLK_DEV_IDECD_VERBOSE_ERRORS=y
346# CONFIG_BLK_DEV_IDETAPE is not set 368# CONFIG_BLK_DEV_IDETAPE is not set
347# CONFIG_BLK_DEV_IDEFLOPPY is not set 369# CONFIG_BLK_DEV_IDEFLOPPY is not set
348# CONFIG_BLK_DEV_IDESCSI is not set 370# CONFIG_BLK_DEV_IDESCSI is not set
@@ -359,7 +381,6 @@ CONFIG_IDE_GENERIC=y
359# PCI IDE chipsets support 381# PCI IDE chipsets support
360# 382#
361CONFIG_BLK_DEV_IDEPCI=y 383CONFIG_BLK_DEV_IDEPCI=y
362# CONFIG_IDEPCI_SHARE_IRQ is not set
363CONFIG_IDEPCI_PCIBUS_ORDER=y 384CONFIG_IDEPCI_PCIBUS_ORDER=y
364# CONFIG_BLK_DEV_GENERIC is not set 385# CONFIG_BLK_DEV_GENERIC is not set
365# CONFIG_BLK_DEV_OPTI621 is not set 386# CONFIG_BLK_DEV_OPTI621 is not set
@@ -389,7 +410,6 @@ CONFIG_BLK_DEV_ALI15X3=y
389# CONFIG_BLK_DEV_TRM290 is not set 410# CONFIG_BLK_DEV_TRM290 is not set
390# CONFIG_BLK_DEV_VIA82CXXX is not set 411# CONFIG_BLK_DEV_VIA82CXXX is not set
391# CONFIG_BLK_DEV_TC86C001 is not set 412# CONFIG_BLK_DEV_TC86C001 is not set
392# CONFIG_IDE_ARM is not set
393CONFIG_BLK_DEV_IDEDMA=y 413CONFIG_BLK_DEV_IDEDMA=y
394CONFIG_IDE_ARCH_OBSOLETE_INIT=y 414CONFIG_IDE_ARCH_OBSOLETE_INIT=y
395# CONFIG_BLK_DEV_HD is not set 415# CONFIG_BLK_DEV_HD is not set
@@ -501,7 +521,6 @@ CONFIG_NETDEVICES=y
501# CONFIG_EQUALIZER is not set 521# CONFIG_EQUALIZER is not set
502# CONFIG_TUN is not set 522# CONFIG_TUN is not set
503# CONFIG_VETH is not set 523# CONFIG_VETH is not set
504# CONFIG_IP1000 is not set
505# CONFIG_ARCNET is not set 524# CONFIG_ARCNET is not set
506# CONFIG_PHYLIB is not set 525# CONFIG_PHYLIB is not set
507CONFIG_NET_ETHERNET=y 526CONFIG_NET_ETHERNET=y
@@ -533,6 +552,7 @@ CONFIG_NET_PCI=y
533# CONFIG_NE2K_PCI is not set 552# CONFIG_NE2K_PCI is not set
534# CONFIG_8139CP is not set 553# CONFIG_8139CP is not set
535# CONFIG_8139TOO is not set 554# CONFIG_8139TOO is not set
555# CONFIG_R6040 is not set
536# CONFIG_SIS900 is not set 556# CONFIG_SIS900 is not set
537# CONFIG_EPIC100 is not set 557# CONFIG_EPIC100 is not set
538# CONFIG_SUNDANCE is not set 558# CONFIG_SUNDANCE is not set
@@ -545,6 +565,9 @@ CONFIG_E1000=m
545CONFIG_E1000_NAPI=y 565CONFIG_E1000_NAPI=y
546# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set 566# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
547# CONFIG_E1000E is not set 567# CONFIG_E1000E is not set
568# CONFIG_E1000E_ENABLED is not set
569# CONFIG_IP1000 is not set
570# CONFIG_IGB is not set
548# CONFIG_MYRI_SBUS is not set 571# CONFIG_MYRI_SBUS is not set
549# CONFIG_NS83820 is not set 572# CONFIG_NS83820 is not set
550# CONFIG_HAMACHI is not set 573# CONFIG_HAMACHI is not set
@@ -570,6 +593,7 @@ CONFIG_NETDEV_10000=y
570CONFIG_NIU=m 593CONFIG_NIU=m
571# CONFIG_MLX4_CORE is not set 594# CONFIG_MLX4_CORE is not set
572# CONFIG_TEHUTI is not set 595# CONFIG_TEHUTI is not set
596# CONFIG_BNX2X is not set
573# CONFIG_TR is not set 597# CONFIG_TR is not set
574 598
575# 599#
@@ -602,7 +626,6 @@ CONFIG_PPPOE=m
602# CONFIG_SLIP is not set 626# CONFIG_SLIP is not set
603CONFIG_SLHC=m 627CONFIG_SLHC=m
604# CONFIG_NET_FC is not set 628# CONFIG_NET_FC is not set
605# CONFIG_SHAPER is not set
606# CONFIG_NETCONSOLE is not set 629# CONFIG_NETCONSOLE is not set
607# CONFIG_NETPOLL is not set 630# CONFIG_NETPOLL is not set
608# CONFIG_NET_POLL_CONTROLLER is not set 631# CONFIG_NET_POLL_CONTROLLER is not set
@@ -679,6 +702,7 @@ CONFIG_VT_CONSOLE=y
679CONFIG_HW_CONSOLE=y 702CONFIG_HW_CONSOLE=y
680# CONFIG_VT_HW_CONSOLE_BINDING is not set 703# CONFIG_VT_HW_CONSOLE_BINDING is not set
681# CONFIG_SERIAL_NONSTANDARD is not set 704# CONFIG_SERIAL_NONSTANDARD is not set
705# CONFIG_NOZOMI is not set
682 706
683# 707#
684# Serial drivers 708# Serial drivers
@@ -747,13 +771,13 @@ CONFIG_I2C_ALGOBIT=y
747# 771#
748# Miscellaneous I2C Chip support 772# Miscellaneous I2C Chip support
749# 773#
750# CONFIG_SENSORS_DS1337 is not set
751# CONFIG_SENSORS_DS1374 is not set
752# CONFIG_DS1682 is not set 774# CONFIG_DS1682 is not set
753# CONFIG_SENSORS_EEPROM is not set 775# CONFIG_SENSORS_EEPROM is not set
754# CONFIG_SENSORS_PCF8574 is not set 776# CONFIG_SENSORS_PCF8574 is not set
777# CONFIG_PCF8575 is not set
755# CONFIG_SENSORS_PCA9539 is not set 778# CONFIG_SENSORS_PCA9539 is not set
756# CONFIG_SENSORS_PCF8591 is not set 779# CONFIG_SENSORS_PCF8591 is not set
780# CONFIG_TPS65010 is not set
757# CONFIG_SENSORS_MAX6875 is not set 781# CONFIG_SENSORS_MAX6875 is not set
758# CONFIG_SENSORS_TSL2550 is not set 782# CONFIG_SENSORS_TSL2550 is not set
759# CONFIG_I2C_DEBUG_CORE is not set 783# CONFIG_I2C_DEBUG_CORE is not set
@@ -990,6 +1014,7 @@ CONFIG_SND_ALI5451=m
990# CONFIG_SND_BT87X is not set 1014# CONFIG_SND_BT87X is not set
991# CONFIG_SND_CA0106 is not set 1015# CONFIG_SND_CA0106 is not set
992# CONFIG_SND_CMIPCI is not set 1016# CONFIG_SND_CMIPCI is not set
1017# CONFIG_SND_OXYGEN is not set
993# CONFIG_SND_CS4281 is not set 1018# CONFIG_SND_CS4281 is not set
994# CONFIG_SND_CS46XX is not set 1019# CONFIG_SND_CS46XX is not set
995# CONFIG_SND_DARLA20 is not set 1020# CONFIG_SND_DARLA20 is not set
@@ -1014,6 +1039,7 @@ CONFIG_SND_ALI5451=m
1014# CONFIG_SND_HDA_INTEL is not set 1039# CONFIG_SND_HDA_INTEL is not set
1015# CONFIG_SND_HDSP is not set 1040# CONFIG_SND_HDSP is not set
1016# CONFIG_SND_HDSPM is not set 1041# CONFIG_SND_HDSPM is not set
1042# CONFIG_SND_HIFIER is not set
1017# CONFIG_SND_ICE1712 is not set 1043# CONFIG_SND_ICE1712 is not set
1018# CONFIG_SND_ICE1724 is not set 1044# CONFIG_SND_ICE1724 is not set
1019# CONFIG_SND_INTEL8X0 is not set 1045# CONFIG_SND_INTEL8X0 is not set
@@ -1031,6 +1057,7 @@ CONFIG_SND_ALI5451=m
1031# CONFIG_SND_TRIDENT is not set 1057# CONFIG_SND_TRIDENT is not set
1032# CONFIG_SND_VIA82XX is not set 1058# CONFIG_SND_VIA82XX is not set
1033# CONFIG_SND_VIA82XX_MODEM is not set 1059# CONFIG_SND_VIA82XX_MODEM is not set
1060# CONFIG_SND_VIRTUOSO is not set
1034# CONFIG_SND_VX222 is not set 1061# CONFIG_SND_VX222 is not set
1035# CONFIG_SND_YMFPCI is not set 1062# CONFIG_SND_YMFPCI is not set
1036# CONFIG_SND_AC97_POWER_SAVE is not set 1063# CONFIG_SND_AC97_POWER_SAVE is not set
@@ -1058,6 +1085,10 @@ CONFIG_SND_SUN_CS4231=m
1058# 1085#
1059 1086
1060# 1087#
1088# ALSA SoC audio for Freescale SOCs
1089#
1090
1091#
1061# Open Sound System 1092# Open Sound System
1062# 1093#
1063# CONFIG_SOUND_PRIME is not set 1094# CONFIG_SOUND_PRIME is not set
@@ -1080,6 +1111,7 @@ CONFIG_USB_ARCH_HAS_OHCI=y
1080CONFIG_USB_ARCH_HAS_EHCI=y 1111CONFIG_USB_ARCH_HAS_EHCI=y
1081CONFIG_USB=y 1112CONFIG_USB=y
1082# CONFIG_USB_DEBUG is not set 1113# CONFIG_USB_DEBUG is not set
1114# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
1083 1115
1084# 1116#
1085# Miscellaneous USB options 1117# Miscellaneous USB options
@@ -1093,7 +1125,6 @@ CONFIG_USB_DEVICEFS=y
1093# USB Host Controller Drivers 1125# USB Host Controller Drivers
1094# 1126#
1095CONFIG_USB_EHCI_HCD=m 1127CONFIG_USB_EHCI_HCD=m
1096# CONFIG_USB_EHCI_SPLIT_ISO is not set
1097# CONFIG_USB_EHCI_ROOT_HUB_TT is not set 1128# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
1098# CONFIG_USB_EHCI_TT_NEWSCHED is not set 1129# CONFIG_USB_EHCI_TT_NEWSCHED is not set
1099# CONFIG_USB_ISP116X_HCD is not set 1130# CONFIG_USB_ISP116X_HCD is not set
@@ -1143,10 +1174,6 @@ CONFIG_USB_STORAGE=m
1143# 1174#
1144# USB port drivers 1175# USB port drivers
1145# 1176#
1146
1147#
1148# USB Serial Converter support
1149#
1150# CONFIG_USB_SERIAL is not set 1177# CONFIG_USB_SERIAL is not set
1151 1178
1152# 1179#
@@ -1172,14 +1199,6 @@ CONFIG_USB_STORAGE=m
1172# CONFIG_USB_TRANCEVIBRATOR is not set 1199# CONFIG_USB_TRANCEVIBRATOR is not set
1173# CONFIG_USB_IOWARRIOR is not set 1200# CONFIG_USB_IOWARRIOR is not set
1174# CONFIG_USB_TEST is not set 1201# CONFIG_USB_TEST is not set
1175
1176#
1177# USB DSL modem support
1178#
1179
1180#
1181# USB Gadget Support
1182#
1183# CONFIG_USB_GADGET is not set 1202# CONFIG_USB_GADGET is not set
1184# CONFIG_MMC is not set 1203# CONFIG_MMC is not set
1185# CONFIG_NEW_LEDS is not set 1204# CONFIG_NEW_LEDS is not set
@@ -1332,11 +1351,6 @@ CONFIG_NLS_DEFAULT="iso8859-1"
1332# CONFIG_NLS_KOI8_U is not set 1351# CONFIG_NLS_KOI8_U is not set
1333# CONFIG_NLS_UTF8 is not set 1352# CONFIG_NLS_UTF8 is not set
1334# CONFIG_DLM is not set 1353# CONFIG_DLM is not set
1335CONFIG_INSTRUMENTATION=y
1336CONFIG_PROFILING=y
1337CONFIG_OPROFILE=m
1338CONFIG_KPROBES=y
1339# CONFIG_MARKERS is not set
1340 1354
1341# 1355#
1342# Kernel hacking 1356# Kernel hacking
@@ -1374,6 +1388,8 @@ CONFIG_DEBUG_BUGVERBOSE=y
1374CONFIG_FORCED_INLINING=y 1388CONFIG_FORCED_INLINING=y
1375# CONFIG_BOOT_PRINTK_DELAY is not set 1389# CONFIG_BOOT_PRINTK_DELAY is not set
1376# CONFIG_RCU_TORTURE_TEST is not set 1390# CONFIG_RCU_TORTURE_TEST is not set
1391# CONFIG_KPROBES_SANITY_TEST is not set
1392# CONFIG_BACKTRACE_SELF_TEST is not set
1377# CONFIG_LKDTM is not set 1393# CONFIG_LKDTM is not set
1378# CONFIG_FAULT_INJECTION is not set 1394# CONFIG_FAULT_INJECTION is not set
1379# CONFIG_SAMPLES is not set 1395# CONFIG_SAMPLES is not set
@@ -1396,8 +1412,9 @@ CONFIG_ASYNC_MEMCPY=m
1396CONFIG_ASYNC_XOR=m 1412CONFIG_ASYNC_XOR=m
1397CONFIG_CRYPTO=y 1413CONFIG_CRYPTO=y
1398CONFIG_CRYPTO_ALGAPI=y 1414CONFIG_CRYPTO_ALGAPI=y
1399CONFIG_CRYPTO_AEAD=m 1415CONFIG_CRYPTO_AEAD=y
1400CONFIG_CRYPTO_BLKCIPHER=y 1416CONFIG_CRYPTO_BLKCIPHER=y
1417# CONFIG_CRYPTO_SEQIV is not set
1401CONFIG_CRYPTO_HASH=y 1418CONFIG_CRYPTO_HASH=y
1402CONFIG_CRYPTO_MANAGER=y 1419CONFIG_CRYPTO_MANAGER=y
1403CONFIG_CRYPTO_HMAC=y 1420CONFIG_CRYPTO_HMAC=y
@@ -1416,6 +1433,9 @@ CONFIG_CRYPTO_CBC=y
1416CONFIG_CRYPTO_PCBC=m 1433CONFIG_CRYPTO_PCBC=m
1417CONFIG_CRYPTO_LRW=m 1434CONFIG_CRYPTO_LRW=m
1418CONFIG_CRYPTO_XTS=m 1435CONFIG_CRYPTO_XTS=m
1436# CONFIG_CRYPTO_CTR is not set
1437# CONFIG_CRYPTO_GCM is not set
1438# CONFIG_CRYPTO_CCM is not set
1419# CONFIG_CRYPTO_CRYPTD is not set 1439# CONFIG_CRYPTO_CRYPTD is not set
1420CONFIG_CRYPTO_DES=y 1440CONFIG_CRYPTO_DES=y
1421CONFIG_CRYPTO_FCRYPT=m 1441CONFIG_CRYPTO_FCRYPT=m
@@ -1431,13 +1451,16 @@ CONFIG_CRYPTO_ARC4=m
1431CONFIG_CRYPTO_KHAZAD=m 1451CONFIG_CRYPTO_KHAZAD=m
1432CONFIG_CRYPTO_ANUBIS=m 1452CONFIG_CRYPTO_ANUBIS=m
1433CONFIG_CRYPTO_SEED=m 1453CONFIG_CRYPTO_SEED=m
1454# CONFIG_CRYPTO_SALSA20 is not set
1434CONFIG_CRYPTO_DEFLATE=y 1455CONFIG_CRYPTO_DEFLATE=y
1435CONFIG_CRYPTO_MICHAEL_MIC=m 1456CONFIG_CRYPTO_MICHAEL_MIC=m
1436CONFIG_CRYPTO_CRC32C=m 1457CONFIG_CRYPTO_CRC32C=m
1437CONFIG_CRYPTO_CAMELLIA=m 1458CONFIG_CRYPTO_CAMELLIA=m
1438CONFIG_CRYPTO_TEST=m 1459CONFIG_CRYPTO_TEST=m
1439CONFIG_CRYPTO_AUTHENC=m 1460CONFIG_CRYPTO_AUTHENC=m
1461# CONFIG_CRYPTO_LZO is not set
1440CONFIG_CRYPTO_HW=y 1462CONFIG_CRYPTO_HW=y
1463# CONFIG_CRYPTO_DEV_HIFN_795X is not set
1441 1464
1442# 1465#
1443# Library routines 1466# Library routines
diff --git a/arch/sparc64/kernel/Makefile b/arch/sparc64/kernel/Makefile
index ef50d217432f..4b78b24ef413 100644
--- a/arch/sparc64/kernel/Makefile
+++ b/arch/sparc64/kernel/Makefile
@@ -11,7 +11,7 @@ obj-y := process.o setup.o cpu.o idprom.o \
11 traps.o auxio.o una_asm.o sysfs.o iommu.o \ 11 traps.o auxio.o una_asm.o sysfs.o iommu.o \
12 irq.o ptrace.o time.o sys_sparc.o signal.o \ 12 irq.o ptrace.o time.o sys_sparc.o signal.o \
13 unaligned.o central.o pci.o starfire.o semaphore.o \ 13 unaligned.o central.o pci.o starfire.o semaphore.o \
14 power.o sbus.o iommu_common.o sparc64_ksyms.o chmc.o \ 14 power.o sbus.o sparc64_ksyms.o chmc.o \
15 visemul.o prom.o of_device.o hvapi.o sstate.o mdesc.o 15 visemul.o prom.o of_device.o hvapi.o sstate.o mdesc.o
16 16
17obj-$(CONFIG_STACKTRACE) += stacktrace.o 17obj-$(CONFIG_STACKTRACE) += stacktrace.o
diff --git a/arch/sparc64/kernel/iommu.c b/arch/sparc64/kernel/iommu.c
index 4b9115a4d92e..5623a4d59dff 100644
--- a/arch/sparc64/kernel/iommu.c
+++ b/arch/sparc64/kernel/iommu.c
@@ -472,94 +472,15 @@ static void dma_4u_unmap_single(struct device *dev, dma_addr_t bus_addr,
472 spin_unlock_irqrestore(&iommu->lock, flags); 472 spin_unlock_irqrestore(&iommu->lock, flags);
473} 473}
474 474
475#define SG_ENT_PHYS_ADDRESS(SG) (__pa(sg_virt((SG))))
476
477static void fill_sg(iopte_t *iopte, struct scatterlist *sg,
478 int nused, int nelems,
479 unsigned long iopte_protection)
480{
481 struct scatterlist *dma_sg = sg;
482 int i;
483
484 for (i = 0; i < nused; i++) {
485 unsigned long pteval = ~0UL;
486 u32 dma_npages;
487
488 dma_npages = ((dma_sg->dma_address & (IO_PAGE_SIZE - 1UL)) +
489 dma_sg->dma_length +
490 ((IO_PAGE_SIZE - 1UL))) >> IO_PAGE_SHIFT;
491 do {
492 unsigned long offset;
493 signed int len;
494
495 /* If we are here, we know we have at least one
496 * more page to map. So walk forward until we
497 * hit a page crossing, and begin creating new
498 * mappings from that spot.
499 */
500 for (;;) {
501 unsigned long tmp;
502
503 tmp = SG_ENT_PHYS_ADDRESS(sg);
504 len = sg->length;
505 if (((tmp ^ pteval) >> IO_PAGE_SHIFT) != 0UL) {
506 pteval = tmp & IO_PAGE_MASK;
507 offset = tmp & (IO_PAGE_SIZE - 1UL);
508 break;
509 }
510 if (((tmp ^ (tmp + len - 1UL)) >> IO_PAGE_SHIFT) != 0UL) {
511 pteval = (tmp + IO_PAGE_SIZE) & IO_PAGE_MASK;
512 offset = 0UL;
513 len -= (IO_PAGE_SIZE - (tmp & (IO_PAGE_SIZE - 1UL)));
514 break;
515 }
516 sg = sg_next(sg);
517 nelems--;
518 }
519
520 pteval = iopte_protection | (pteval & IOPTE_PAGE);
521 while (len > 0) {
522 *iopte++ = __iopte(pteval);
523 pteval += IO_PAGE_SIZE;
524 len -= (IO_PAGE_SIZE - offset);
525 offset = 0;
526 dma_npages--;
527 }
528
529 pteval = (pteval & IOPTE_PAGE) + len;
530 sg = sg_next(sg);
531 nelems--;
532
533 /* Skip over any tail mappings we've fully mapped,
534 * adjusting pteval along the way. Stop when we
535 * detect a page crossing event.
536 */
537 while (nelems &&
538 (pteval << (64 - IO_PAGE_SHIFT)) != 0UL &&
539 (pteval == SG_ENT_PHYS_ADDRESS(sg)) &&
540 ((pteval ^
541 (SG_ENT_PHYS_ADDRESS(sg) + sg->length - 1UL)) >> IO_PAGE_SHIFT) == 0UL) {
542 pteval += sg->length;
543 sg = sg_next(sg);
544 nelems--;
545 }
546 if ((pteval << (64 - IO_PAGE_SHIFT)) == 0UL)
547 pteval = ~0UL;
548 } while (dma_npages != 0);
549 dma_sg = sg_next(dma_sg);
550 }
551}
552
553static int dma_4u_map_sg(struct device *dev, struct scatterlist *sglist, 475static int dma_4u_map_sg(struct device *dev, struct scatterlist *sglist,
554 int nelems, enum dma_data_direction direction) 476 int nelems, enum dma_data_direction direction)
555{ 477{
556 struct iommu *iommu; 478 unsigned long flags, ctx, i, npages, iopte_protection;
479 struct scatterlist *sg;
557 struct strbuf *strbuf; 480 struct strbuf *strbuf;
558 unsigned long flags, ctx, npages, iopte_protection; 481 struct iommu *iommu;
559 iopte_t *base; 482 iopte_t *base;
560 u32 dma_base; 483 u32 dma_base;
561 struct scatterlist *sgtmp;
562 int used;
563 484
564 /* Fast path single entry scatterlists. */ 485 /* Fast path single entry scatterlists. */
565 if (nelems == 1) { 486 if (nelems == 1) {
@@ -578,11 +499,7 @@ static int dma_4u_map_sg(struct device *dev, struct scatterlist *sglist,
578 if (unlikely(direction == DMA_NONE)) 499 if (unlikely(direction == DMA_NONE))
579 goto bad_no_ctx; 500 goto bad_no_ctx;
580 501
581 /* Step 1: Prepare scatter list. */ 502 npages = calc_npages(sglist, nelems);
582
583 npages = prepare_sg(dev, sglist, nelems);
584
585 /* Step 2: Allocate a cluster and context, if necessary. */
586 503
587 spin_lock_irqsave(&iommu->lock, flags); 504 spin_lock_irqsave(&iommu->lock, flags);
588 505
@@ -599,18 +516,6 @@ static int dma_4u_map_sg(struct device *dev, struct scatterlist *sglist,
599 dma_base = iommu->page_table_map_base + 516 dma_base = iommu->page_table_map_base +
600 ((base - iommu->page_table) << IO_PAGE_SHIFT); 517 ((base - iommu->page_table) << IO_PAGE_SHIFT);
601 518
602 /* Step 3: Normalize DMA addresses. */
603 used = nelems;
604
605 sgtmp = sglist;
606 while (used && sgtmp->dma_length) {
607 sgtmp->dma_address += dma_base;
608 sgtmp = sg_next(sgtmp);
609 used--;
610 }
611 used = nelems - used;
612
613 /* Step 4: Create the mappings. */
614 if (strbuf->strbuf_enabled) 519 if (strbuf->strbuf_enabled)
615 iopte_protection = IOPTE_STREAMING(ctx); 520 iopte_protection = IOPTE_STREAMING(ctx);
616 else 521 else
@@ -618,13 +523,27 @@ static int dma_4u_map_sg(struct device *dev, struct scatterlist *sglist,
618 if (direction != DMA_TO_DEVICE) 523 if (direction != DMA_TO_DEVICE)
619 iopte_protection |= IOPTE_WRITE; 524 iopte_protection |= IOPTE_WRITE;
620 525
621 fill_sg(base, sglist, used, nelems, iopte_protection); 526 for_each_sg(sglist, sg, nelems, i) {
527 unsigned long paddr = SG_ENT_PHYS_ADDRESS(sg);
528 unsigned long slen = sg->length;
529 unsigned long this_npages;
622 530
623#ifdef VERIFY_SG 531 this_npages = iommu_num_pages(paddr, slen);
624 verify_sglist(sglist, nelems, base, npages);
625#endif
626 532
627 return used; 533 sg->dma_address = dma_base | (paddr & ~IO_PAGE_MASK);
534 sg->dma_length = slen;
535
536 paddr &= IO_PAGE_MASK;
537 while (this_npages--) {
538 iopte_val(*base) = iopte_protection | paddr;
539
540 base++;
541 paddr += IO_PAGE_SIZE;
542 dma_base += IO_PAGE_SIZE;
543 }
544 }
545
546 return nelems;
628 547
629bad: 548bad:
630 iommu_free_ctx(iommu, ctx); 549 iommu_free_ctx(iommu, ctx);
@@ -637,11 +556,10 @@ bad_no_ctx:
637static void dma_4u_unmap_sg(struct device *dev, struct scatterlist *sglist, 556static void dma_4u_unmap_sg(struct device *dev, struct scatterlist *sglist,
638 int nelems, enum dma_data_direction direction) 557 int nelems, enum dma_data_direction direction)
639{ 558{
640 struct iommu *iommu; 559 unsigned long flags, ctx, i, npages;
641 struct strbuf *strbuf; 560 struct strbuf *strbuf;
561 struct iommu *iommu;
642 iopte_t *base; 562 iopte_t *base;
643 unsigned long flags, ctx, i, npages;
644 struct scatterlist *sg, *sgprv;
645 u32 bus_addr; 563 u32 bus_addr;
646 564
647 if (unlikely(direction == DMA_NONE)) { 565 if (unlikely(direction == DMA_NONE)) {
@@ -654,15 +572,7 @@ static void dma_4u_unmap_sg(struct device *dev, struct scatterlist *sglist,
654 572
655 bus_addr = sglist->dma_address & IO_PAGE_MASK; 573 bus_addr = sglist->dma_address & IO_PAGE_MASK;
656 574
657 sgprv = NULL; 575 npages = calc_npages(sglist, nelems);
658 for_each_sg(sglist, sg, nelems, i) {
659 if (sg->dma_length == 0)
660 break;
661 sgprv = sg;
662 }
663
664 npages = (IO_PAGE_ALIGN(sgprv->dma_address + sgprv->dma_length) -
665 bus_addr) >> IO_PAGE_SHIFT;
666 576
667 base = iommu->page_table + 577 base = iommu->page_table +
668 ((bus_addr - iommu->page_table_map_base) >> IO_PAGE_SHIFT); 578 ((bus_addr - iommu->page_table_map_base) >> IO_PAGE_SHIFT);
diff --git a/arch/sparc64/kernel/iommu_common.c b/arch/sparc64/kernel/iommu_common.c
deleted file mode 100644
index 72a4acfe8c7b..000000000000
--- a/arch/sparc64/kernel/iommu_common.c
+++ /dev/null
@@ -1,248 +0,0 @@
1/* $Id: iommu_common.c,v 1.9 2001/12/17 07:05:09 davem Exp $
2 * iommu_common.c: UltraSparc SBUS/PCI common iommu code.
3 *
4 * Copyright (C) 1999 David S. Miller (davem@redhat.com)
5 */
6
7#include <linux/dma-mapping.h>
8#include "iommu_common.h"
9
10/* You are _strongly_ advised to enable the following debugging code
11 * any time you make changes to the sg code below, run it for a while
12 * with filesystems mounted read-only before buying the farm... -DaveM
13 */
14
15#ifdef VERIFY_SG
16static int verify_lengths(struct scatterlist *sglist, int nents, int npages)
17{
18 int sg_len, dma_len;
19 int i, pgcount;
20 struct scatterlist *sg;
21
22 sg_len = 0;
23 for_each_sg(sglist, sg, nents, i)
24 sg_len += sg->length;
25
26 dma_len = 0;
27 for_each_sg(sglist, sg, nents, i) {
28 if (!sg->dma_length)
29 break;
30 dma_len += sg->dma_length;
31 }
32
33 if (sg_len != dma_len) {
34 printk("verify_lengths: Error, different, sg[%d] dma[%d]\n",
35 sg_len, dma_len);
36 return -1;
37 }
38
39 pgcount = 0;
40 for_each_sg(sglist, sg, nents, i) {
41 unsigned long start, end;
42
43 if (!sg->dma_length)
44 break;
45
46 start = sg->dma_address;
47 start = start & IO_PAGE_MASK;
48
49 end = sg->dma_address + sg->dma_length;
50 end = (end + (IO_PAGE_SIZE - 1)) & IO_PAGE_MASK;
51
52 pgcount += ((end - start) >> IO_PAGE_SHIFT);
53 }
54
55 if (pgcount != npages) {
56 printk("verify_lengths: Error, page count wrong, "
57 "npages[%d] pgcount[%d]\n",
58 npages, pgcount);
59 return -1;
60 }
61
62 /* This test passes... */
63 return 0;
64}
65
66static int verify_one_map(struct scatterlist *dma_sg, struct scatterlist **__sg, int nents, iopte_t **__iopte)
67{
68 struct scatterlist *sg = *__sg;
69 iopte_t *iopte = *__iopte;
70 u32 dlen = dma_sg->dma_length;
71 u32 daddr;
72 unsigned int sglen;
73 unsigned long sgaddr;
74
75 daddr = dma_sg->dma_address;
76 sglen = sg->length;
77 sgaddr = (unsigned long) sg_virt(sg);
78 while (dlen > 0) {
79 unsigned long paddr;
80
81 /* SG and DMA_SG must begin at the same sub-page boundary. */
82 if ((sgaddr & ~IO_PAGE_MASK) != (daddr & ~IO_PAGE_MASK)) {
83 printk("verify_one_map: Wrong start offset "
84 "sg[%08lx] dma[%08x]\n",
85 sgaddr, daddr);
86 nents = -1;
87 goto out;
88 }
89
90 /* Verify the IOPTE points to the right page. */
91 paddr = iopte_val(*iopte) & IOPTE_PAGE;
92 if ((paddr + PAGE_OFFSET) != (sgaddr & IO_PAGE_MASK)) {
93 printk("verify_one_map: IOPTE[%08lx] maps the "
94 "wrong page, should be [%08lx]\n",
95 iopte_val(*iopte), (sgaddr & IO_PAGE_MASK) - PAGE_OFFSET);
96 nents = -1;
97 goto out;
98 }
99
100 /* If this SG crosses a page, adjust to that next page
101 * boundary and loop.
102 */
103 if ((sgaddr & IO_PAGE_MASK) ^ ((sgaddr + sglen - 1) & IO_PAGE_MASK)) {
104 unsigned long next_page, diff;
105
106 next_page = (sgaddr + IO_PAGE_SIZE) & IO_PAGE_MASK;
107 diff = next_page - sgaddr;
108 sgaddr += diff;
109 daddr += diff;
110 sglen -= diff;
111 dlen -= diff;
112 if (dlen > 0)
113 iopte++;
114 continue;
115 }
116
117 /* SG wholly consumed within this page. */
118 daddr += sglen;
119 dlen -= sglen;
120
121 if (dlen > 0 && ((daddr & ~IO_PAGE_MASK) == 0))
122 iopte++;
123
124 sg = sg_next(sg);
125 if (--nents <= 0)
126 break;
127 sgaddr = (unsigned long) sg_virt(sg);
128 sglen = sg->length;
129 }
130 if (dlen < 0) {
131 /* Transfer overrun, big problems. */
132 printk("verify_one_map: Transfer overrun by %d bytes.\n",
133 -dlen);
134 nents = -1;
135 } else {
136 /* Advance to next dma_sg implies that the next iopte will
137 * begin it.
138 */
139 iopte++;
140 }
141
142out:
143 *__sg = sg;
144 *__iopte = iopte;
145 return nents;
146}
147
148static int verify_maps(struct scatterlist *sg, int nents, iopte_t *iopte)
149{
150 struct scatterlist *dma_sg = sg;
151 struct scatterlist *orig_dma_sg = dma_sg;
152 int orig_nents = nents;
153
154 for (;;) {
155 nents = verify_one_map(dma_sg, &sg, nents, &iopte);
156 if (nents <= 0)
157 break;
158 dma_sg = sg_next(dma_sg);
159 if (dma_sg->dma_length == 0)
160 break;
161 }
162
163 if (nents > 0) {
164 printk("verify_maps: dma maps consumed by some sgs remain (%d)\n",
165 nents);
166 return -1;
167 }
168
169 if (nents < 0) {
170 printk("verify_maps: Error, messed up mappings, "
171 "at sg %d dma_sg %d\n",
172 (int) (orig_nents + nents), (int) (dma_sg - orig_dma_sg));
173 return -1;
174 }
175
176 /* This test passes... */
177 return 0;
178}
179
180void verify_sglist(struct scatterlist *sglist, int nents, iopte_t *iopte, int npages)
181{
182 struct scatterlist *sg;
183
184 if (verify_lengths(sglist, nents, npages) < 0 ||
185 verify_maps(sglist, nents, iopte) < 0) {
186 int i;
187
188 printk("verify_sglist: Crap, messed up mappings, dumping, iodma at ");
189 printk("%016lx.\n", sglist->dma_address & IO_PAGE_MASK);
190
191 for_each_sg(sglist, sg, nents, i) {
192 printk("sg(%d): page_addr(%p) off(%x) length(%x) "
193 "dma_address[%016x] dma_length[%016x]\n",
194 i,
195 page_address(sg_page(sg)), sg->offset,
196 sg->length,
197 sg->dma_address, sg->dma_length);
198 }
199 }
200
201 /* Seems to be ok */
202}
203#endif
204
205unsigned long prepare_sg(struct device *dev, struct scatterlist *sg, int nents)
206{
207 struct scatterlist *dma_sg = sg;
208 unsigned long prev;
209 u32 dent_addr, dent_len;
210 unsigned int max_seg_size;
211
212 prev = (unsigned long) sg_virt(sg);
213 prev += (unsigned long) (dent_len = sg->length);
214 dent_addr = (u32) ((unsigned long)(sg_virt(sg)) & (IO_PAGE_SIZE - 1UL));
215 max_seg_size = dma_get_max_seg_size(dev);
216 while (--nents) {
217 unsigned long addr;
218
219 sg = sg_next(sg);
220 addr = (unsigned long) sg_virt(sg);
221 if (! VCONTIG(prev, addr) ||
222 dent_len + sg->length > max_seg_size) {
223 dma_sg->dma_address = dent_addr;
224 dma_sg->dma_length = dent_len;
225 dma_sg = sg_next(dma_sg);
226
227 dent_addr = ((dent_addr +
228 dent_len +
229 (IO_PAGE_SIZE - 1UL)) >> IO_PAGE_SHIFT);
230 dent_addr <<= IO_PAGE_SHIFT;
231 dent_addr += addr & (IO_PAGE_SIZE - 1UL);
232 dent_len = 0;
233 }
234 dent_len += sg->length;
235 prev = addr + sg->length;
236 }
237 dma_sg->dma_address = dent_addr;
238 dma_sg->dma_length = dent_len;
239
240 if (dma_sg != sg) {
241 dma_sg = sg_next(dma_sg);
242 dma_sg->dma_length = 0;
243 }
244
245 return ((unsigned long) dent_addr +
246 (unsigned long) dent_len +
247 (IO_PAGE_SIZE - 1UL)) >> IO_PAGE_SHIFT;
248}
diff --git a/arch/sparc64/kernel/iommu_common.h b/arch/sparc64/kernel/iommu_common.h
index a90d046e8024..4b5cafa2877a 100644
--- a/arch/sparc64/kernel/iommu_common.h
+++ b/arch/sparc64/kernel/iommu_common.h
@@ -30,6 +30,32 @@
30 */ 30 */
31#define IOMMU_PAGE_SHIFT 13 31#define IOMMU_PAGE_SHIFT 13
32 32
33#define SG_ENT_PHYS_ADDRESS(SG) (__pa(sg_virt((SG))))
34
35static inline unsigned long iommu_num_pages(unsigned long vaddr,
36 unsigned long slen)
37{
38 unsigned long npages;
39
40 npages = IO_PAGE_ALIGN(vaddr + slen) - (vaddr & IO_PAGE_MASK);
41 npages >>= IO_PAGE_SHIFT;
42
43 return npages;
44}
45
46static inline unsigned long calc_npages(struct scatterlist *sglist, int nelems)
47{
48 unsigned long i, npages = 0;
49 struct scatterlist *sg;
50
51 for_each_sg(sglist, sg, nelems, i) {
52 unsigned long paddr = SG_ENT_PHYS_ADDRESS(sg);
53 npages += iommu_num_pages(paddr, sg->length);
54 }
55
56 return npages;
57}
58
33/* You are _strongly_ advised to enable the following debugging code 59/* You are _strongly_ advised to enable the following debugging code
34 * any time you make changes to the sg code below, run it for a while 60 * any time you make changes to the sg code below, run it for a while
35 * with filesystems mounted read-only before buying the farm... -DaveM 61 * with filesystems mounted read-only before buying the farm... -DaveM
diff --git a/arch/sparc64/kernel/pci_sun4v.c b/arch/sparc64/kernel/pci_sun4v.c
index 5ea2eab1ccda..61baf8dc095e 100644
--- a/arch/sparc64/kernel/pci_sun4v.c
+++ b/arch/sparc64/kernel/pci_sun4v.c
@@ -365,113 +365,14 @@ static void dma_4v_unmap_single(struct device *dev, dma_addr_t bus_addr,
365 spin_unlock_irqrestore(&iommu->lock, flags); 365 spin_unlock_irqrestore(&iommu->lock, flags);
366} 366}
367 367
368#define SG_ENT_PHYS_ADDRESS(SG) (__pa(sg_virt((SG))))
369
370static long fill_sg(long entry, struct device *dev,
371 struct scatterlist *sg,
372 int nused, int nelems, unsigned long prot)
373{
374 struct scatterlist *dma_sg = sg;
375 unsigned long flags;
376 int i;
377
378 local_irq_save(flags);
379
380 iommu_batch_start(dev, prot, entry);
381
382 for (i = 0; i < nused; i++) {
383 unsigned long pteval = ~0UL;
384 u32 dma_npages;
385
386 dma_npages = ((dma_sg->dma_address & (IO_PAGE_SIZE - 1UL)) +
387 dma_sg->dma_length +
388 ((IO_PAGE_SIZE - 1UL))) >> IO_PAGE_SHIFT;
389 do {
390 unsigned long offset;
391 signed int len;
392
393 /* If we are here, we know we have at least one
394 * more page to map. So walk forward until we
395 * hit a page crossing, and begin creating new
396 * mappings from that spot.
397 */
398 for (;;) {
399 unsigned long tmp;
400
401 tmp = SG_ENT_PHYS_ADDRESS(sg);
402 len = sg->length;
403 if (((tmp ^ pteval) >> IO_PAGE_SHIFT) != 0UL) {
404 pteval = tmp & IO_PAGE_MASK;
405 offset = tmp & (IO_PAGE_SIZE - 1UL);
406 break;
407 }
408 if (((tmp ^ (tmp + len - 1UL)) >> IO_PAGE_SHIFT) != 0UL) {
409 pteval = (tmp + IO_PAGE_SIZE) & IO_PAGE_MASK;
410 offset = 0UL;
411 len -= (IO_PAGE_SIZE - (tmp & (IO_PAGE_SIZE - 1UL)));
412 break;
413 }
414 sg = sg_next(sg);
415 nelems--;
416 }
417
418 pteval = (pteval & IOPTE_PAGE);
419 while (len > 0) {
420 long err;
421
422 err = iommu_batch_add(pteval);
423 if (unlikely(err < 0L))
424 goto iommu_map_failed;
425
426 pteval += IO_PAGE_SIZE;
427 len -= (IO_PAGE_SIZE - offset);
428 offset = 0;
429 dma_npages--;
430 }
431
432 pteval = (pteval & IOPTE_PAGE) + len;
433 sg = sg_next(sg);
434 nelems--;
435
436 /* Skip over any tail mappings we've fully mapped,
437 * adjusting pteval along the way. Stop when we
438 * detect a page crossing event.
439 */
440 while (nelems &&
441 (pteval << (64 - IO_PAGE_SHIFT)) != 0UL &&
442 (pteval == SG_ENT_PHYS_ADDRESS(sg)) &&
443 ((pteval ^
444 (SG_ENT_PHYS_ADDRESS(sg) + sg->length - 1UL)) >> IO_PAGE_SHIFT) == 0UL) {
445 pteval += sg->length;
446 sg = sg_next(sg);
447 nelems--;
448 }
449 if ((pteval << (64 - IO_PAGE_SHIFT)) == 0UL)
450 pteval = ~0UL;
451 } while (dma_npages != 0);
452 dma_sg = sg_next(dma_sg);
453 }
454
455 if (unlikely(iommu_batch_end() < 0L))
456 goto iommu_map_failed;
457
458 local_irq_restore(flags);
459 return 0;
460
461iommu_map_failed:
462 local_irq_restore(flags);
463 return -1L;
464}
465
466static int dma_4v_map_sg(struct device *dev, struct scatterlist *sglist, 368static int dma_4v_map_sg(struct device *dev, struct scatterlist *sglist,
467 int nelems, enum dma_data_direction direction) 369 int nelems, enum dma_data_direction direction)
468{ 370{
371 unsigned long flags, npages, i, prot;
372 struct scatterlist *sg;
469 struct iommu *iommu; 373 struct iommu *iommu;
470 unsigned long flags, npages, prot;
471 u32 dma_base;
472 struct scatterlist *sgtmp;
473 long entry, err; 374 long entry, err;
474 int used; 375 u32 dma_base;
475 376
476 /* Fast path single entry scatterlists. */ 377 /* Fast path single entry scatterlists. */
477 if (nelems == 1) { 378 if (nelems == 1) {
@@ -489,10 +390,8 @@ static int dma_4v_map_sg(struct device *dev, struct scatterlist *sglist,
489 if (unlikely(direction == DMA_NONE)) 390 if (unlikely(direction == DMA_NONE))
490 goto bad; 391 goto bad;
491 392
492 /* Step 1: Prepare scatter list. */ 393 npages = calc_npages(sglist, nelems);
493 npages = prepare_sg(dev, sglist, nelems);
494 394
495 /* Step 2: Allocate a cluster and context, if necessary. */
496 spin_lock_irqsave(&iommu->lock, flags); 395 spin_lock_irqsave(&iommu->lock, flags);
497 entry = arena_alloc(&iommu->arena, npages); 396 entry = arena_alloc(&iommu->arena, npages);
498 spin_unlock_irqrestore(&iommu->lock, flags); 397 spin_unlock_irqrestore(&iommu->lock, flags);
@@ -503,27 +402,45 @@ static int dma_4v_map_sg(struct device *dev, struct scatterlist *sglist,
503 dma_base = iommu->page_table_map_base + 402 dma_base = iommu->page_table_map_base +
504 (entry << IO_PAGE_SHIFT); 403 (entry << IO_PAGE_SHIFT);
505 404
506 /* Step 3: Normalize DMA addresses. */
507 used = nelems;
508
509 sgtmp = sglist;
510 while (used && sgtmp->dma_length) {
511 sgtmp->dma_address += dma_base;
512 sgtmp = sg_next(sgtmp);
513 used--;
514 }
515 used = nelems - used;
516
517 /* Step 4: Create the mappings. */
518 prot = HV_PCI_MAP_ATTR_READ; 405 prot = HV_PCI_MAP_ATTR_READ;
519 if (direction != DMA_TO_DEVICE) 406 if (direction != DMA_TO_DEVICE)
520 prot |= HV_PCI_MAP_ATTR_WRITE; 407 prot |= HV_PCI_MAP_ATTR_WRITE;
521 408
522 err = fill_sg(entry, dev, sglist, used, nelems, prot); 409 local_irq_save(flags);
410
411 iommu_batch_start(dev, prot, entry);
412
413 for_each_sg(sglist, sg, nelems, i) {
414 unsigned long paddr = SG_ENT_PHYS_ADDRESS(sg);
415 unsigned long slen = sg->length;
416 unsigned long this_npages;
417
418 this_npages = iommu_num_pages(paddr, slen);
419
420 sg->dma_address = dma_base | (paddr & ~IO_PAGE_MASK);
421 sg->dma_length = slen;
422
423 paddr &= IO_PAGE_MASK;
424 while (this_npages--) {
425 err = iommu_batch_add(paddr);
426 if (unlikely(err < 0L)) {
427 local_irq_restore(flags);
428 goto iommu_map_failed;
429 }
430
431 paddr += IO_PAGE_SIZE;
432 dma_base += IO_PAGE_SIZE;
433 }
434 }
435
436 err = iommu_batch_end();
437
438 local_irq_restore(flags);
439
523 if (unlikely(err < 0L)) 440 if (unlikely(err < 0L))
524 goto iommu_map_failed; 441 goto iommu_map_failed;
525 442
526 return used; 443 return nelems;
527 444
528bad: 445bad:
529 if (printk_ratelimit()) 446 if (printk_ratelimit())
@@ -541,12 +458,11 @@ iommu_map_failed:
541static void dma_4v_unmap_sg(struct device *dev, struct scatterlist *sglist, 458static void dma_4v_unmap_sg(struct device *dev, struct scatterlist *sglist,
542 int nelems, enum dma_data_direction direction) 459 int nelems, enum dma_data_direction direction)
543{ 460{
461 unsigned long flags, npages;
544 struct pci_pbm_info *pbm; 462 struct pci_pbm_info *pbm;
463 u32 devhandle, bus_addr;
545 struct iommu *iommu; 464 struct iommu *iommu;
546 unsigned long flags, i, npages;
547 struct scatterlist *sg, *sgprv;
548 long entry; 465 long entry;
549 u32 devhandle, bus_addr;
550 466
551 if (unlikely(direction == DMA_NONE)) { 467 if (unlikely(direction == DMA_NONE)) {
552 if (printk_ratelimit()) 468 if (printk_ratelimit())
@@ -558,16 +474,8 @@ static void dma_4v_unmap_sg(struct device *dev, struct scatterlist *sglist,
558 devhandle = pbm->devhandle; 474 devhandle = pbm->devhandle;
559 475
560 bus_addr = sglist->dma_address & IO_PAGE_MASK; 476 bus_addr = sglist->dma_address & IO_PAGE_MASK;
561 sgprv = NULL;
562 for_each_sg(sglist, sg, nelems, i) {
563 if (sg->dma_length == 0)
564 break;
565
566 sgprv = sg;
567 }
568 477
569 npages = (IO_PAGE_ALIGN(sgprv->dma_address + sgprv->dma_length) - 478 npages = calc_npages(sglist, nelems);
570 bus_addr) >> IO_PAGE_SHIFT;
571 479
572 entry = ((bus_addr - iommu->page_table_map_base) >> IO_PAGE_SHIFT); 480 entry = ((bus_addr - iommu->page_table_map_base) >> IO_PAGE_SHIFT);
573 481
diff --git a/arch/sparc64/kernel/systbls.S b/arch/sparc64/kernel/systbls.S
index b8058906e727..adc62f490f36 100644
--- a/arch/sparc64/kernel/systbls.S
+++ b/arch/sparc64/kernel/systbls.S
@@ -80,7 +80,8 @@ sys_call_table32:
80 .word sys_fchmodat, sys_faccessat, compat_sys_pselect6, compat_sys_ppoll, sys_unshare 80 .word sys_fchmodat, sys_faccessat, compat_sys_pselect6, compat_sys_ppoll, sys_unshare
81/*300*/ .word compat_sys_set_robust_list, compat_sys_get_robust_list, compat_sys_migrate_pages, compat_sys_mbind, compat_sys_get_mempolicy 81/*300*/ .word compat_sys_set_robust_list, compat_sys_get_robust_list, compat_sys_migrate_pages, compat_sys_mbind, compat_sys_get_mempolicy
82 .word compat_sys_set_mempolicy, compat_sys_kexec_load, compat_sys_move_pages, sys_getcpu, compat_sys_epoll_pwait 82 .word compat_sys_set_mempolicy, compat_sys_kexec_load, compat_sys_move_pages, sys_getcpu, compat_sys_epoll_pwait
83/*310*/ .word compat_sys_utimensat, compat_sys_signalfd, sys_ni_syscall, sys_eventfd, compat_sys_fallocate 83/*310*/ .word compat_sys_utimensat, compat_sys_signalfd, sys_timerfd_create, sys_eventfd, compat_sys_fallocate
84 .word compat_sys_timerfd_settime, compat_sys_timerfd_gettime
84 85
85#endif /* CONFIG_COMPAT */ 86#endif /* CONFIG_COMPAT */
86 87
@@ -152,7 +153,8 @@ sys_call_table:
152 .word sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll, sys_unshare 153 .word sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll, sys_unshare
153/*300*/ .word sys_set_robust_list, sys_get_robust_list, sys_migrate_pages, sys_mbind, sys_get_mempolicy 154/*300*/ .word sys_set_robust_list, sys_get_robust_list, sys_migrate_pages, sys_mbind, sys_get_mempolicy
154 .word sys_set_mempolicy, sys_kexec_load, sys_move_pages, sys_getcpu, sys_epoll_pwait 155 .word sys_set_mempolicy, sys_kexec_load, sys_move_pages, sys_getcpu, sys_epoll_pwait
155/*310*/ .word sys_utimensat, sys_signalfd, sys_ni_syscall, sys_eventfd, sys_fallocate 156/*310*/ .word sys_utimensat, sys_signalfd, sys_timerfd_create, sys_eventfd, sys_fallocate
157 .word sys_timerfd_settime, sys_timerfd_gettime
156 158
157#if defined(CONFIG_SUNOS_EMUL) || defined(CONFIG_SOLARIS_EMUL) || \ 159#if defined(CONFIG_SUNOS_EMUL) || defined(CONFIG_SOLARIS_EMUL) || \
158 defined(CONFIG_SOLARIS_EMUL_MODULE) 160 defined(CONFIG_SOLARIS_EMUL_MODULE)
@@ -271,6 +273,7 @@ sunos_sys_table:
271 .word sunos_nosys, sunos_nosys, sunos_nosys 273 .word sunos_nosys, sunos_nosys, sunos_nosys
272 .word sunos_nosys 274 .word sunos_nosys
273/*310*/ .word sunos_nosys, sunos_nosys, sunos_nosys 275/*310*/ .word sunos_nosys, sunos_nosys, sunos_nosys
274 .word sunos_nosys, sunos_nosys 276 .word sunos_nosys, sunos_nosys, sunos_nosys
277 .word sunos_nosys
275 278
276#endif 279#endif
diff --git a/include/asm-sparc/unistd.h b/include/asm-sparc/unistd.h
index 0decdf763716..2338a0276377 100644
--- a/include/asm-sparc/unistd.h
+++ b/include/asm-sparc/unistd.h
@@ -327,11 +327,13 @@
327#define __NR_epoll_pwait 309 327#define __NR_epoll_pwait 309
328#define __NR_utimensat 310 328#define __NR_utimensat 310
329#define __NR_signalfd 311 329#define __NR_signalfd 311
330#define __NR_timerfd 312 330#define __NR_timerfd_create 312
331#define __NR_eventfd 313 331#define __NR_eventfd 313
332#define __NR_fallocate 314 332#define __NR_fallocate 314
333#define __NR_timerfd_settime 315
334#define __NR_timerfd_gettime 316
333 335
334#define NR_SYSCALLS 315 336#define NR_SYSCALLS 317
335 337
336/* Sparc 32-bit only has the "setresuid32", "getresuid32" variants, 338/* Sparc 32-bit only has the "setresuid32", "getresuid32" variants,
337 * it never had the plain ones and there is no value to adding those 339 * it never had the plain ones and there is no value to adding those
diff --git a/include/asm-sparc64/io.h b/include/asm-sparc64/io.h
index c299b853b5ba..b6ece223562d 100644
--- a/include/asm-sparc64/io.h
+++ b/include/asm-sparc64/io.h
@@ -16,7 +16,7 @@
16/* BIO layer definitions. */ 16/* BIO layer definitions. */
17extern unsigned long kern_base, kern_size; 17extern unsigned long kern_base, kern_size;
18#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) 18#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
19#define BIO_VMERGE_BOUNDARY 8192 19#define BIO_VMERGE_BOUNDARY 0
20 20
21static inline u8 _inb(unsigned long addr) 21static inline u8 _inb(unsigned long addr)
22{ 22{
diff --git a/include/asm-sparc64/unistd.h b/include/asm-sparc64/unistd.h
index cb751b4d0f56..77559da0ea3f 100644
--- a/include/asm-sparc64/unistd.h
+++ b/include/asm-sparc64/unistd.h
@@ -329,11 +329,13 @@
329#define __NR_epoll_pwait 309 329#define __NR_epoll_pwait 309
330#define __NR_utimensat 310 330#define __NR_utimensat 310
331#define __NR_signalfd 311 331#define __NR_signalfd 311
332#define __NR_timerfd 312 332#define __NR_timerfd_create 312
333#define __NR_eventfd 313 333#define __NR_eventfd 313
334#define __NR_fallocate 314 334#define __NR_fallocate 314
335#define __NR_timerfd_settime 315
336#define __NR_timerfd_gettime 316
335 337
336#define NR_SYSCALLS 315 338#define NR_SYSCALLS 317
337 339
338#ifdef __KERNEL__ 340#ifdef __KERNEL__
339/* sysconf options, for SunOS compatibility */ 341/* sysconf options, for SunOS compatibility */