diff options
author | Steven Rostedt <srostedt@redhat.com> | 2010-05-21 11:49:57 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2010-05-21 11:49:57 -0400 |
commit | ff5f149b6aec8edbfa3698721667acd043009a33 (patch) | |
tree | d052553eb296dfee3f01b1cb2b717cb7ccf3127a /arch | |
parent | f0218b3e9974f06014b61be8987159f4a20e011e (diff) | |
parent | 580d607cd666dfabfc1c7b0fb08c8ac690c7c87f (diff) |
Merge branch 'perf/core' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip into trace/tip/tracing/core-7
Conflicts:
include/linux/ftrace_event.h
include/trace/ftrace.h
kernel/trace/trace_event_perf.c
kernel/trace/trace_kprobe.c
kernel/trace/trace_syscalls.c
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'arch')
213 files changed, 4970 insertions, 3335 deletions
diff --git a/arch/alpha/include/asm/atomic.h b/arch/alpha/include/asm/atomic.h index 610dff44d94b..e756d04b6cd5 100644 --- a/arch/alpha/include/asm/atomic.h +++ b/arch/alpha/include/asm/atomic.h | |||
@@ -17,8 +17,8 @@ | |||
17 | #define ATOMIC_INIT(i) ( (atomic_t) { (i) } ) | 17 | #define ATOMIC_INIT(i) ( (atomic_t) { (i) } ) |
18 | #define ATOMIC64_INIT(i) ( (atomic64_t) { (i) } ) | 18 | #define ATOMIC64_INIT(i) ( (atomic64_t) { (i) } ) |
19 | 19 | ||
20 | #define atomic_read(v) ((v)->counter + 0) | 20 | #define atomic_read(v) (*(volatile int *)&(v)->counter) |
21 | #define atomic64_read(v) ((v)->counter + 0) | 21 | #define atomic64_read(v) (*(volatile long *)&(v)->counter) |
22 | 22 | ||
23 | #define atomic_set(v,i) ((v)->counter = (i)) | 23 | #define atomic_set(v,i) ((v)->counter = (i)) |
24 | #define atomic64_set(v,i) ((v)->counter = (i)) | 24 | #define atomic64_set(v,i) ((v)->counter = (i)) |
diff --git a/arch/alpha/include/asm/bitops.h b/arch/alpha/include/asm/bitops.h index 15f3ae25c511..296da1d5ed57 100644 --- a/arch/alpha/include/asm/bitops.h +++ b/arch/alpha/include/asm/bitops.h | |||
@@ -405,29 +405,31 @@ static inline int fls(int x) | |||
405 | 405 | ||
406 | #if defined(CONFIG_ALPHA_EV6) && defined(CONFIG_ALPHA_EV67) | 406 | #if defined(CONFIG_ALPHA_EV6) && defined(CONFIG_ALPHA_EV67) |
407 | /* Whee. EV67 can calculate it directly. */ | 407 | /* Whee. EV67 can calculate it directly. */ |
408 | static inline unsigned long hweight64(unsigned long w) | 408 | static inline unsigned long __arch_hweight64(unsigned long w) |
409 | { | 409 | { |
410 | return __kernel_ctpop(w); | 410 | return __kernel_ctpop(w); |
411 | } | 411 | } |
412 | 412 | ||
413 | static inline unsigned int hweight32(unsigned int w) | 413 | static inline unsigned int __arch_weight32(unsigned int w) |
414 | { | 414 | { |
415 | return hweight64(w); | 415 | return __arch_hweight64(w); |
416 | } | 416 | } |
417 | 417 | ||
418 | static inline unsigned int hweight16(unsigned int w) | 418 | static inline unsigned int __arch_hweight16(unsigned int w) |
419 | { | 419 | { |
420 | return hweight64(w & 0xffff); | 420 | return __arch_hweight64(w & 0xffff); |
421 | } | 421 | } |
422 | 422 | ||
423 | static inline unsigned int hweight8(unsigned int w) | 423 | static inline unsigned int __arch_hweight8(unsigned int w) |
424 | { | 424 | { |
425 | return hweight64(w & 0xff); | 425 | return __arch_hweight64(w & 0xff); |
426 | } | 426 | } |
427 | #else | 427 | #else |
428 | #include <asm-generic/bitops/hweight.h> | 428 | #include <asm-generic/bitops/arch_hweight.h> |
429 | #endif | 429 | #endif |
430 | 430 | ||
431 | #include <asm-generic/bitops/const_hweight.h> | ||
432 | |||
431 | #endif /* __KERNEL__ */ | 433 | #endif /* __KERNEL__ */ |
432 | 434 | ||
433 | #include <asm-generic/bitops/find.h> | 435 | #include <asm-generic/bitops/find.h> |
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S index 6ab6b337a913..c5191b1532e8 100644 --- a/arch/arm/boot/compressed/head.S +++ b/arch/arm/boot/compressed/head.S | |||
@@ -685,8 +685,8 @@ proc_types: | |||
685 | W(b) __armv4_mmu_cache_off | 685 | W(b) __armv4_mmu_cache_off |
686 | W(b) __armv4_mmu_cache_flush | 686 | W(b) __armv4_mmu_cache_flush |
687 | 687 | ||
688 | .word 0x56056930 | 688 | .word 0x56056900 |
689 | .word 0xff0ffff0 @ PXA935 | 689 | .word 0xffffff00 @ PXA9xx |
690 | W(b) __armv4_mmu_cache_on | 690 | W(b) __armv4_mmu_cache_on |
691 | W(b) __armv4_mmu_cache_off | 691 | W(b) __armv4_mmu_cache_off |
692 | W(b) __armv4_mmu_cache_flush | 692 | W(b) __armv4_mmu_cache_flush |
@@ -697,12 +697,6 @@ proc_types: | |||
697 | W(b) __armv4_mmu_cache_off | 697 | W(b) __armv4_mmu_cache_off |
698 | W(b) __armv5tej_mmu_cache_flush | 698 | W(b) __armv5tej_mmu_cache_flush |
699 | 699 | ||
700 | .word 0x56056930 | ||
701 | .word 0xff0ffff0 @ PXA935 | ||
702 | W(b) __armv4_mmu_cache_on | ||
703 | W(b) __armv4_mmu_cache_off | ||
704 | W(b) __armv4_mmu_cache_flush | ||
705 | |||
706 | .word 0x56050000 @ Feroceon | 700 | .word 0x56050000 @ Feroceon |
707 | .word 0xff0f0000 | 701 | .word 0xff0f0000 |
708 | W(b) __armv4_mmu_cache_on | 702 | W(b) __armv4_mmu_cache_on |
diff --git a/arch/arm/configs/imote2_defconfig b/arch/arm/configs/imote2_defconfig index 95d2becfc664..21f2bff8a363 100644 --- a/arch/arm/configs/imote2_defconfig +++ b/arch/arm/configs/imote2_defconfig | |||
@@ -1,13 +1,14 @@ | |||
1 | # | 1 | # |
2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
3 | # Linux kernel version: 2.6.33-rc8 | 3 | # Linux kernel version: 2.6.34-rc2 |
4 | # Sat Feb 13 21:48:53 2010 | 4 | # Thu Apr 8 14:49:08 2010 |
5 | # | 5 | # |
6 | CONFIG_ARM=y | 6 | CONFIG_ARM=y |
7 | CONFIG_SYS_SUPPORTS_APM_EMULATION=y | 7 | CONFIG_SYS_SUPPORTS_APM_EMULATION=y |
8 | CONFIG_GENERIC_GPIO=y | 8 | CONFIG_GENERIC_GPIO=y |
9 | CONFIG_GENERIC_TIME=y | 9 | CONFIG_GENERIC_TIME=y |
10 | CONFIG_GENERIC_CLOCKEVENTS=y | 10 | CONFIG_GENERIC_CLOCKEVENTS=y |
11 | CONFIG_HAVE_PROC_CPU=y | ||
11 | CONFIG_GENERIC_HARDIRQS=y | 12 | CONFIG_GENERIC_HARDIRQS=y |
12 | CONFIG_STACKTRACE_SUPPORT=y | 13 | CONFIG_STACKTRACE_SUPPORT=y |
13 | CONFIG_HAVE_LATENCYTOP_SUPPORT=y | 14 | CONFIG_HAVE_LATENCYTOP_SUPPORT=y |
@@ -19,6 +20,7 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y | |||
19 | CONFIG_ARCH_HAS_CPUFREQ=y | 20 | CONFIG_ARCH_HAS_CPUFREQ=y |
20 | CONFIG_GENERIC_HWEIGHT=y | 21 | CONFIG_GENERIC_HWEIGHT=y |
21 | CONFIG_GENERIC_CALIBRATE_DELAY=y | 22 | CONFIG_GENERIC_CALIBRATE_DELAY=y |
23 | CONFIG_NEED_DMA_MAP_STATE=y | ||
22 | CONFIG_ARCH_MTD_XIP=y | 24 | CONFIG_ARCH_MTD_XIP=y |
23 | CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y | 25 | CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y |
24 | CONFIG_VECTORS_BASE=0xffff0000 | 26 | CONFIG_VECTORS_BASE=0xffff0000 |
@@ -60,11 +62,6 @@ CONFIG_RCU_FANOUT=32 | |||
60 | # CONFIG_TREE_RCU_TRACE is not set | 62 | # CONFIG_TREE_RCU_TRACE is not set |
61 | # CONFIG_IKCONFIG is not set | 63 | # CONFIG_IKCONFIG is not set |
62 | CONFIG_LOG_BUF_SHIFT=14 | 64 | CONFIG_LOG_BUF_SHIFT=14 |
63 | CONFIG_GROUP_SCHED=y | ||
64 | CONFIG_FAIR_GROUP_SCHED=y | ||
65 | # CONFIG_RT_GROUP_SCHED is not set | ||
66 | CONFIG_USER_SCHED=y | ||
67 | # CONFIG_CGROUP_SCHED is not set | ||
68 | # CONFIG_CGROUPS is not set | 65 | # CONFIG_CGROUPS is not set |
69 | CONFIG_SYSFS_DEPRECATED=y | 66 | CONFIG_SYSFS_DEPRECATED=y |
70 | CONFIG_SYSFS_DEPRECATED_V2=y | 67 | CONFIG_SYSFS_DEPRECATED_V2=y |
@@ -97,10 +94,14 @@ CONFIG_TIMERFD=y | |||
97 | CONFIG_EVENTFD=y | 94 | CONFIG_EVENTFD=y |
98 | CONFIG_SHMEM=y | 95 | CONFIG_SHMEM=y |
99 | CONFIG_AIO=y | 96 | CONFIG_AIO=y |
97 | CONFIG_HAVE_PERF_EVENTS=y | ||
98 | CONFIG_PERF_USE_VMALLOC=y | ||
100 | 99 | ||
101 | # | 100 | # |
102 | # Kernel Performance Events And Counters | 101 | # Kernel Performance Events And Counters |
103 | # | 102 | # |
103 | # CONFIG_PERF_EVENTS is not set | ||
104 | # CONFIG_PERF_COUNTERS is not set | ||
104 | CONFIG_VM_EVENT_COUNTERS=y | 105 | CONFIG_VM_EVENT_COUNTERS=y |
105 | # CONFIG_COMPAT_BRK is not set | 106 | # CONFIG_COMPAT_BRK is not set |
106 | CONFIG_SLAB=y | 107 | CONFIG_SLAB=y |
@@ -184,6 +185,7 @@ CONFIG_MMU=y | |||
184 | # CONFIG_ARCH_REALVIEW is not set | 185 | # CONFIG_ARCH_REALVIEW is not set |
185 | # CONFIG_ARCH_VERSATILE is not set | 186 | # CONFIG_ARCH_VERSATILE is not set |
186 | # CONFIG_ARCH_AT91 is not set | 187 | # CONFIG_ARCH_AT91 is not set |
188 | # CONFIG_ARCH_BCMRING is not set | ||
187 | # CONFIG_ARCH_CLPS711X is not set | 189 | # CONFIG_ARCH_CLPS711X is not set |
188 | # CONFIG_ARCH_GEMINI is not set | 190 | # CONFIG_ARCH_GEMINI is not set |
189 | # CONFIG_ARCH_EBSA110 is not set | 191 | # CONFIG_ARCH_EBSA110 is not set |
@@ -193,7 +195,6 @@ CONFIG_MMU=y | |||
193 | # CONFIG_ARCH_STMP3XXX is not set | 195 | # CONFIG_ARCH_STMP3XXX is not set |
194 | # CONFIG_ARCH_NETX is not set | 196 | # CONFIG_ARCH_NETX is not set |
195 | # CONFIG_ARCH_H720X is not set | 197 | # CONFIG_ARCH_H720X is not set |
196 | # CONFIG_ARCH_NOMADIK is not set | ||
197 | # CONFIG_ARCH_IOP13XX is not set | 198 | # CONFIG_ARCH_IOP13XX is not set |
198 | # CONFIG_ARCH_IOP32X is not set | 199 | # CONFIG_ARCH_IOP32X is not set |
199 | # CONFIG_ARCH_IOP33X is not set | 200 | # CONFIG_ARCH_IOP33X is not set |
@@ -210,21 +211,26 @@ CONFIG_MMU=y | |||
210 | # CONFIG_ARCH_KS8695 is not set | 211 | # CONFIG_ARCH_KS8695 is not set |
211 | # CONFIG_ARCH_NS9XXX is not set | 212 | # CONFIG_ARCH_NS9XXX is not set |
212 | # CONFIG_ARCH_W90X900 is not set | 213 | # CONFIG_ARCH_W90X900 is not set |
214 | # CONFIG_ARCH_NUC93X is not set | ||
213 | # CONFIG_ARCH_PNX4008 is not set | 215 | # CONFIG_ARCH_PNX4008 is not set |
214 | CONFIG_ARCH_PXA=y | 216 | CONFIG_ARCH_PXA=y |
215 | # CONFIG_ARCH_MSM is not set | 217 | # CONFIG_ARCH_MSM is not set |
218 | # CONFIG_ARCH_SHMOBILE is not set | ||
216 | # CONFIG_ARCH_RPC is not set | 219 | # CONFIG_ARCH_RPC is not set |
217 | # CONFIG_ARCH_SA1100 is not set | 220 | # CONFIG_ARCH_SA1100 is not set |
218 | # CONFIG_ARCH_S3C2410 is not set | 221 | # CONFIG_ARCH_S3C2410 is not set |
219 | # CONFIG_ARCH_S3C64XX is not set | 222 | # CONFIG_ARCH_S3C64XX is not set |
223 | # CONFIG_ARCH_S5P6440 is not set | ||
224 | # CONFIG_ARCH_S5P6442 is not set | ||
220 | # CONFIG_ARCH_S5PC1XX is not set | 225 | # CONFIG_ARCH_S5PC1XX is not set |
226 | # CONFIG_ARCH_S5PV210 is not set | ||
221 | # CONFIG_ARCH_SHARK is not set | 227 | # CONFIG_ARCH_SHARK is not set |
222 | # CONFIG_ARCH_LH7A40X is not set | 228 | # CONFIG_ARCH_LH7A40X is not set |
223 | # CONFIG_ARCH_U300 is not set | 229 | # CONFIG_ARCH_U300 is not set |
230 | # CONFIG_ARCH_U8500 is not set | ||
231 | # CONFIG_ARCH_NOMADIK is not set | ||
224 | # CONFIG_ARCH_DAVINCI is not set | 232 | # CONFIG_ARCH_DAVINCI is not set |
225 | # CONFIG_ARCH_OMAP is not set | 233 | # CONFIG_ARCH_OMAP is not set |
226 | # CONFIG_ARCH_BCMRING is not set | ||
227 | # CONFIG_ARCH_U8500 is not set | ||
228 | 234 | ||
229 | # | 235 | # |
230 | # Intel PXA2xx/PXA3xx Implementations | 236 | # Intel PXA2xx/PXA3xx Implementations |
@@ -253,6 +259,7 @@ CONFIG_ARCH_PXA=y | |||
253 | # CONFIG_MACH_EM_X270 is not set | 259 | # CONFIG_MACH_EM_X270 is not set |
254 | # CONFIG_MACH_EXEDA is not set | 260 | # CONFIG_MACH_EXEDA is not set |
255 | # CONFIG_MACH_CM_X300 is not set | 261 | # CONFIG_MACH_CM_X300 is not set |
262 | # CONFIG_MACH_CAPC7117 is not set | ||
256 | # CONFIG_ARCH_GUMSTIX is not set | 263 | # CONFIG_ARCH_GUMSTIX is not set |
257 | CONFIG_MACH_INTELMOTE2=y | 264 | CONFIG_MACH_INTELMOTE2=y |
258 | # CONFIG_MACH_STARGATE2 is not set | 265 | # CONFIG_MACH_STARGATE2 is not set |
@@ -275,7 +282,11 @@ CONFIG_MACH_INTELMOTE2=y | |||
275 | # CONFIG_PXA_EZX is not set | 282 | # CONFIG_PXA_EZX is not set |
276 | # CONFIG_MACH_MP900C is not set | 283 | # CONFIG_MACH_MP900C is not set |
277 | # CONFIG_ARCH_PXA_PALM is not set | 284 | # CONFIG_ARCH_PXA_PALM is not set |
285 | # CONFIG_MACH_RAUMFELD_RC is not set | ||
286 | # CONFIG_MACH_RAUMFELD_CONNECTOR is not set | ||
287 | # CONFIG_MACH_RAUMFELD_SPEAKER is not set | ||
278 | # CONFIG_PXA_SHARPSL is not set | 288 | # CONFIG_PXA_SHARPSL is not set |
289 | # CONFIG_MACH_ICONTROL is not set | ||
279 | # CONFIG_ARCH_PXA_ESERIES is not set | 290 | # CONFIG_ARCH_PXA_ESERIES is not set |
280 | CONFIG_PXA27x=y | 291 | CONFIG_PXA27x=y |
281 | CONFIG_PXA_SSP=y | 292 | CONFIG_PXA_SSP=y |
@@ -302,6 +313,7 @@ CONFIG_ARM_THUMB=y | |||
302 | CONFIG_ARM_L1_CACHE_SHIFT=5 | 313 | CONFIG_ARM_L1_CACHE_SHIFT=5 |
303 | CONFIG_IWMMXT=y | 314 | CONFIG_IWMMXT=y |
304 | CONFIG_XSCALE_PMU=y | 315 | CONFIG_XSCALE_PMU=y |
316 | CONFIG_CPU_HAS_PMU=y | ||
305 | CONFIG_COMMON_CLKDEV=y | 317 | CONFIG_COMMON_CLKDEV=y |
306 | 318 | ||
307 | # | 319 | # |
@@ -352,7 +364,7 @@ CONFIG_ALIGNMENT_TRAP=y | |||
352 | # | 364 | # |
353 | CONFIG_ZBOOT_ROM_TEXT=0x0 | 365 | CONFIG_ZBOOT_ROM_TEXT=0x0 |
354 | CONFIG_ZBOOT_ROM_BSS=0x0 | 366 | CONFIG_ZBOOT_ROM_BSS=0x0 |
355 | CONFIG_CMDLINE="console=tty1 root=/dev/mmcblk0p2 rootfstype=ext2 rootdelay=3 ip=192.168.0.202:192.168.0.200:192.168.0.200:255.255.255.0 debug" | 367 | CONFIG_CMDLINE="root=/dev/mtdblock2 rootfstype=jffs2 console=ttyS2,115200 mem=32M" |
356 | # CONFIG_XIP_KERNEL is not set | 368 | # CONFIG_XIP_KERNEL is not set |
357 | CONFIG_KEXEC=y | 369 | CONFIG_KEXEC=y |
358 | CONFIG_ATAGS_PROC=y | 370 | CONFIG_ATAGS_PROC=y |
@@ -360,24 +372,8 @@ CONFIG_ATAGS_PROC=y | |||
360 | # | 372 | # |
361 | # CPU Power Management | 373 | # CPU Power Management |
362 | # | 374 | # |
363 | CONFIG_CPU_FREQ=y | 375 | # CONFIG_CPU_FREQ is not set |
364 | CONFIG_CPU_FREQ_TABLE=y | 376 | # CONFIG_CPU_IDLE is not set |
365 | CONFIG_CPU_FREQ_DEBUG=y | ||
366 | CONFIG_CPU_FREQ_STAT=y | ||
367 | # CONFIG_CPU_FREQ_STAT_DETAILS is not set | ||
368 | CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y | ||
369 | # CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set | ||
370 | # CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set | ||
371 | # CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set | ||
372 | # CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set | ||
373 | CONFIG_CPU_FREQ_GOV_PERFORMANCE=y | ||
374 | CONFIG_CPU_FREQ_GOV_POWERSAVE=m | ||
375 | CONFIG_CPU_FREQ_GOV_USERSPACE=m | ||
376 | CONFIG_CPU_FREQ_GOV_ONDEMAND=m | ||
377 | CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m | ||
378 | CONFIG_CPU_IDLE=y | ||
379 | CONFIG_CPU_IDLE_GOV_LADDER=y | ||
380 | CONFIG_CPU_IDLE_GOV_MENU=y | ||
381 | 377 | ||
382 | # | 378 | # |
383 | # Floating point emulation | 379 | # Floating point emulation |
@@ -409,6 +405,7 @@ CONFIG_SUSPEND=y | |||
409 | CONFIG_SUSPEND_FREEZER=y | 405 | CONFIG_SUSPEND_FREEZER=y |
410 | CONFIG_APM_EMULATION=y | 406 | CONFIG_APM_EMULATION=y |
411 | CONFIG_PM_RUNTIME=y | 407 | CONFIG_PM_RUNTIME=y |
408 | CONFIG_PM_OPS=y | ||
412 | CONFIG_ARCH_SUSPEND_POSSIBLE=y | 409 | CONFIG_ARCH_SUSPEND_POSSIBLE=y |
413 | CONFIG_NET=y | 410 | CONFIG_NET=y |
414 | 411 | ||
@@ -416,7 +413,6 @@ CONFIG_NET=y | |||
416 | # Networking options | 413 | # Networking options |
417 | # | 414 | # |
418 | CONFIG_PACKET=y | 415 | CONFIG_PACKET=y |
419 | CONFIG_PACKET_MMAP=y | ||
420 | CONFIG_UNIX=y | 416 | CONFIG_UNIX=y |
421 | CONFIG_XFRM=y | 417 | CONFIG_XFRM=y |
422 | # CONFIG_XFRM_USER is not set | 418 | # CONFIG_XFRM_USER is not set |
@@ -506,6 +502,7 @@ CONFIG_NF_CT_NETLINK=m | |||
506 | CONFIG_NETFILTER_XTABLES=m | 502 | CONFIG_NETFILTER_XTABLES=m |
507 | CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m | 503 | CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m |
508 | # CONFIG_NETFILTER_XT_TARGET_CONNMARK is not set | 504 | # CONFIG_NETFILTER_XT_TARGET_CONNMARK is not set |
505 | # CONFIG_NETFILTER_XT_TARGET_CT is not set | ||
509 | # CONFIG_NETFILTER_XT_TARGET_DSCP is not set | 506 | # CONFIG_NETFILTER_XT_TARGET_DSCP is not set |
510 | CONFIG_NETFILTER_XT_TARGET_HL=m | 507 | CONFIG_NETFILTER_XT_TARGET_HL=m |
511 | CONFIG_NETFILTER_XT_TARGET_LED=m | 508 | CONFIG_NETFILTER_XT_TARGET_LED=m |
@@ -622,6 +619,7 @@ CONFIG_IP6_NF_RAW=m | |||
622 | # CONFIG_ATM is not set | 619 | # CONFIG_ATM is not set |
623 | CONFIG_STP=m | 620 | CONFIG_STP=m |
624 | CONFIG_BRIDGE=m | 621 | CONFIG_BRIDGE=m |
622 | # CONFIG_BRIDGE_IGMP_SNOOPING is not set | ||
625 | # CONFIG_NET_DSA is not set | 623 | # CONFIG_NET_DSA is not set |
626 | # CONFIG_VLAN_8021Q is not set | 624 | # CONFIG_VLAN_8021Q is not set |
627 | # CONFIG_DECNET is not set | 625 | # CONFIG_DECNET is not set |
@@ -646,32 +644,7 @@ CONFIG_NET_CLS_ROUTE=y | |||
646 | # CONFIG_HAMRADIO is not set | 644 | # CONFIG_HAMRADIO is not set |
647 | # CONFIG_CAN is not set | 645 | # CONFIG_CAN is not set |
648 | # CONFIG_IRDA is not set | 646 | # CONFIG_IRDA is not set |
649 | CONFIG_BT=y | 647 | # CONFIG_BT is not set |
650 | CONFIG_BT_L2CAP=y | ||
651 | CONFIG_BT_SCO=y | ||
652 | CONFIG_BT_RFCOMM=y | ||
653 | CONFIG_BT_RFCOMM_TTY=y | ||
654 | CONFIG_BT_BNEP=y | ||
655 | CONFIG_BT_BNEP_MC_FILTER=y | ||
656 | CONFIG_BT_BNEP_PROTO_FILTER=y | ||
657 | CONFIG_BT_HIDP=y | ||
658 | |||
659 | # | ||
660 | # Bluetooth device drivers | ||
661 | # | ||
662 | CONFIG_BT_HCIBTUSB=m | ||
663 | CONFIG_BT_HCIBTSDIO=m | ||
664 | CONFIG_BT_HCIUART=y | ||
665 | CONFIG_BT_HCIUART_H4=y | ||
666 | # CONFIG_BT_HCIUART_BCSP is not set | ||
667 | # CONFIG_BT_HCIUART_LL is not set | ||
668 | CONFIG_BT_HCIBCM203X=m | ||
669 | CONFIG_BT_HCIBPA10X=m | ||
670 | CONFIG_BT_HCIBFUSB=m | ||
671 | CONFIG_BT_HCIVHCI=m | ||
672 | CONFIG_BT_MRVL=m | ||
673 | CONFIG_BT_MRVL_SDIO=m | ||
674 | # CONFIG_BT_ATH3K is not set | ||
675 | # CONFIG_AF_RXRPC is not set | 648 | # CONFIG_AF_RXRPC is not set |
676 | CONFIG_FIB_RULES=y | 649 | CONFIG_FIB_RULES=y |
677 | # CONFIG_WIRELESS is not set | 650 | # CONFIG_WIRELESS is not set |
@@ -687,7 +660,8 @@ CONFIG_FIB_RULES=y | |||
687 | # Generic Driver Options | 660 | # Generic Driver Options |
688 | # | 661 | # |
689 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | 662 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" |
690 | # CONFIG_DEVTMPFS is not set | 663 | CONFIG_DEVTMPFS=y |
664 | CONFIG_DEVTMPFS_MOUNT=y | ||
691 | CONFIG_STANDALONE=y | 665 | CONFIG_STANDALONE=y |
692 | CONFIG_PREVENT_FIRMWARE_BUILD=y | 666 | CONFIG_PREVENT_FIRMWARE_BUILD=y |
693 | CONFIG_FW_LOADER=m | 667 | CONFIG_FW_LOADER=m |
@@ -703,9 +677,9 @@ CONFIG_MTD=y | |||
703 | # CONFIG_MTD_CONCAT is not set | 677 | # CONFIG_MTD_CONCAT is not set |
704 | CONFIG_MTD_PARTITIONS=y | 678 | CONFIG_MTD_PARTITIONS=y |
705 | # CONFIG_MTD_REDBOOT_PARTS is not set | 679 | # CONFIG_MTD_REDBOOT_PARTS is not set |
706 | # CONFIG_MTD_CMDLINE_PARTS is not set | 680 | CONFIG_MTD_CMDLINE_PARTS=y |
707 | # CONFIG_MTD_AFS_PARTS is not set | 681 | CONFIG_MTD_AFS_PARTS=y |
708 | # CONFIG_MTD_AR7_PARTS is not set | 682 | CONFIG_MTD_AR7_PARTS=y |
709 | 683 | ||
710 | # | 684 | # |
711 | # User Modules And Translation Layers | 685 | # User Modules And Translation Layers |
@@ -812,6 +786,7 @@ CONFIG_HAVE_IDE=y | |||
812 | # | 786 | # |
813 | # SCSI device support | 787 | # SCSI device support |
814 | # | 788 | # |
789 | CONFIG_SCSI_MOD=y | ||
815 | # CONFIG_RAID_ATTRS is not set | 790 | # CONFIG_RAID_ATTRS is not set |
816 | # CONFIG_SCSI is not set | 791 | # CONFIG_SCSI is not set |
817 | # CONFIG_SCSI_DMA is not set | 792 | # CONFIG_SCSI_DMA is not set |
@@ -965,6 +940,7 @@ CONFIG_SERIAL_PXA=y | |||
965 | CONFIG_SERIAL_PXA_CONSOLE=y | 940 | CONFIG_SERIAL_PXA_CONSOLE=y |
966 | CONFIG_SERIAL_CORE=y | 941 | CONFIG_SERIAL_CORE=y |
967 | CONFIG_SERIAL_CORE_CONSOLE=y | 942 | CONFIG_SERIAL_CORE_CONSOLE=y |
943 | # CONFIG_SERIAL_TIMBERDALE is not set | ||
968 | CONFIG_UNIX98_PTYS=y | 944 | CONFIG_UNIX98_PTYS=y |
969 | # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set | 945 | # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set |
970 | CONFIG_LEGACY_PTYS=y | 946 | CONFIG_LEGACY_PTYS=y |
@@ -993,6 +969,7 @@ CONFIG_I2C_HELPER_AUTO=y | |||
993 | CONFIG_I2C_PXA=y | 969 | CONFIG_I2C_PXA=y |
994 | # CONFIG_I2C_PXA_SLAVE is not set | 970 | # CONFIG_I2C_PXA_SLAVE is not set |
995 | # CONFIG_I2C_SIMTEC is not set | 971 | # CONFIG_I2C_SIMTEC is not set |
972 | # CONFIG_I2C_XILINX is not set | ||
996 | 973 | ||
997 | # | 974 | # |
998 | # External I2C/SMBus adapter drivers | 975 | # External I2C/SMBus adapter drivers |
@@ -1006,15 +983,9 @@ CONFIG_I2C_PXA=y | |||
1006 | # | 983 | # |
1007 | # CONFIG_I2C_PCA_PLATFORM is not set | 984 | # CONFIG_I2C_PCA_PLATFORM is not set |
1008 | # CONFIG_I2C_STUB is not set | 985 | # CONFIG_I2C_STUB is not set |
1009 | |||
1010 | # | ||
1011 | # Miscellaneous I2C Chip support | ||
1012 | # | ||
1013 | # CONFIG_SENSORS_TSL2550 is not set | ||
1014 | # CONFIG_I2C_DEBUG_CORE is not set | 986 | # CONFIG_I2C_DEBUG_CORE is not set |
1015 | # CONFIG_I2C_DEBUG_ALGO is not set | 987 | # CONFIG_I2C_DEBUG_ALGO is not set |
1016 | # CONFIG_I2C_DEBUG_BUS is not set | 988 | # CONFIG_I2C_DEBUG_BUS is not set |
1017 | # CONFIG_I2C_DEBUG_CHIP is not set | ||
1018 | CONFIG_SPI=y | 989 | CONFIG_SPI=y |
1019 | # CONFIG_SPI_DEBUG is not set | 990 | # CONFIG_SPI_DEBUG is not set |
1020 | CONFIG_SPI_MASTER=y | 991 | CONFIG_SPI_MASTER=y |
@@ -1046,10 +1017,12 @@ CONFIG_GPIO_SYSFS=y | |||
1046 | # | 1017 | # |
1047 | # Memory mapped GPIO expanders: | 1018 | # Memory mapped GPIO expanders: |
1048 | # | 1019 | # |
1020 | # CONFIG_GPIO_IT8761E is not set | ||
1049 | 1021 | ||
1050 | # | 1022 | # |
1051 | # I2C GPIO expanders: | 1023 | # I2C GPIO expanders: |
1052 | # | 1024 | # |
1025 | # CONFIG_GPIO_MAX7300 is not set | ||
1053 | # CONFIG_GPIO_MAX732X is not set | 1026 | # CONFIG_GPIO_MAX732X is not set |
1054 | # CONFIG_GPIO_PCA953X is not set | 1027 | # CONFIG_GPIO_PCA953X is not set |
1055 | # CONFIG_GPIO_PCF857X is not set | 1028 | # CONFIG_GPIO_PCF857X is not set |
@@ -1093,10 +1066,12 @@ CONFIG_SSB_POSSIBLE=y | |||
1093 | # Multifunction device drivers | 1066 | # Multifunction device drivers |
1094 | # | 1067 | # |
1095 | # CONFIG_MFD_CORE is not set | 1068 | # CONFIG_MFD_CORE is not set |
1069 | # CONFIG_MFD_88PM860X is not set | ||
1096 | # CONFIG_MFD_SM501 is not set | 1070 | # CONFIG_MFD_SM501 is not set |
1097 | # CONFIG_MFD_ASIC3 is not set | 1071 | # CONFIG_MFD_ASIC3 is not set |
1098 | # CONFIG_HTC_EGPIO is not set | 1072 | # CONFIG_HTC_EGPIO is not set |
1099 | # CONFIG_HTC_PASIC3 is not set | 1073 | # CONFIG_HTC_PASIC3 is not set |
1074 | # CONFIG_HTC_I2CPLD is not set | ||
1100 | # CONFIG_TPS65010 is not set | 1075 | # CONFIG_TPS65010 is not set |
1101 | # CONFIG_TWL4030_CORE is not set | 1076 | # CONFIG_TWL4030_CORE is not set |
1102 | # CONFIG_MFD_TMIO is not set | 1077 | # CONFIG_MFD_TMIO is not set |
@@ -1105,22 +1080,25 @@ CONFIG_SSB_POSSIBLE=y | |||
1105 | # CONFIG_MFD_TC6393XB is not set | 1080 | # CONFIG_MFD_TC6393XB is not set |
1106 | CONFIG_PMIC_DA903X=y | 1081 | CONFIG_PMIC_DA903X=y |
1107 | # CONFIG_PMIC_ADP5520 is not set | 1082 | # CONFIG_PMIC_ADP5520 is not set |
1083 | # CONFIG_MFD_MAX8925 is not set | ||
1108 | # CONFIG_MFD_WM8400 is not set | 1084 | # CONFIG_MFD_WM8400 is not set |
1109 | # CONFIG_MFD_WM831X is not set | 1085 | # CONFIG_MFD_WM831X is not set |
1110 | # CONFIG_MFD_WM8350_I2C is not set | 1086 | # CONFIG_MFD_WM8350_I2C is not set |
1087 | # CONFIG_MFD_WM8994 is not set | ||
1111 | # CONFIG_MFD_PCF50633 is not set | 1088 | # CONFIG_MFD_PCF50633 is not set |
1112 | # CONFIG_MFD_MC13783 is not set | 1089 | # CONFIG_MFD_MC13783 is not set |
1113 | # CONFIG_AB3100_CORE is not set | 1090 | # CONFIG_AB3100_CORE is not set |
1114 | # CONFIG_EZX_PCAP is not set | 1091 | # CONFIG_EZX_PCAP is not set |
1115 | # CONFIG_MFD_88PM8607 is not set | ||
1116 | # CONFIG_AB4500_CORE is not set | 1092 | # CONFIG_AB4500_CORE is not set |
1117 | CONFIG_REGULATOR=y | 1093 | CONFIG_REGULATOR=y |
1118 | CONFIG_REGULATOR_DEBUG=y | 1094 | CONFIG_REGULATOR_DEBUG=y |
1095 | # CONFIG_REGULATOR_DUMMY is not set | ||
1119 | # CONFIG_REGULATOR_FIXED_VOLTAGE is not set | 1096 | # CONFIG_REGULATOR_FIXED_VOLTAGE is not set |
1120 | CONFIG_REGULATOR_VIRTUAL_CONSUMER=y | 1097 | CONFIG_REGULATOR_VIRTUAL_CONSUMER=y |
1121 | CONFIG_REGULATOR_USERSPACE_CONSUMER=y | 1098 | CONFIG_REGULATOR_USERSPACE_CONSUMER=y |
1122 | # CONFIG_REGULATOR_BQ24022 is not set | 1099 | # CONFIG_REGULATOR_BQ24022 is not set |
1123 | # CONFIG_REGULATOR_MAX1586 is not set | 1100 | # CONFIG_REGULATOR_MAX1586 is not set |
1101 | # CONFIG_REGULATOR_MAX8649 is not set | ||
1124 | # CONFIG_REGULATOR_MAX8660 is not set | 1102 | # CONFIG_REGULATOR_MAX8660 is not set |
1125 | CONFIG_REGULATOR_DA903X=y | 1103 | CONFIG_REGULATOR_DA903X=y |
1126 | # CONFIG_REGULATOR_LP3971 is not set | 1104 | # CONFIG_REGULATOR_LP3971 is not set |
@@ -1218,6 +1196,7 @@ CONFIG_VIDEO_IR_I2C=y | |||
1218 | # CONFIG_VIDEO_SAA7191 is not set | 1196 | # CONFIG_VIDEO_SAA7191 is not set |
1219 | # CONFIG_VIDEO_TVP514X is not set | 1197 | # CONFIG_VIDEO_TVP514X is not set |
1220 | # CONFIG_VIDEO_TVP5150 is not set | 1198 | # CONFIG_VIDEO_TVP5150 is not set |
1199 | # CONFIG_VIDEO_TVP7002 is not set | ||
1221 | # CONFIG_VIDEO_VPX3220 is not set | 1200 | # CONFIG_VIDEO_VPX3220 is not set |
1222 | 1201 | ||
1223 | # | 1202 | # |
@@ -1264,15 +1243,7 @@ CONFIG_SOC_CAMERA_MT9M111=y | |||
1264 | CONFIG_VIDEO_PXA27x=y | 1243 | CONFIG_VIDEO_PXA27x=y |
1265 | # CONFIG_VIDEO_SH_MOBILE_CEU is not set | 1244 | # CONFIG_VIDEO_SH_MOBILE_CEU is not set |
1266 | # CONFIG_V4L_USB_DRIVERS is not set | 1245 | # CONFIG_V4L_USB_DRIVERS is not set |
1267 | CONFIG_RADIO_ADAPTERS=y | 1246 | # CONFIG_RADIO_ADAPTERS is not set |
1268 | # CONFIG_I2C_SI4713 is not set | ||
1269 | # CONFIG_RADIO_SI4713 is not set | ||
1270 | # CONFIG_USB_DSBR is not set | ||
1271 | # CONFIG_RADIO_SI470X is not set | ||
1272 | # CONFIG_USB_MR800 is not set | ||
1273 | CONFIG_RADIO_TEA5764=y | ||
1274 | CONFIG_RADIO_TEA5764_XTAL=y | ||
1275 | # CONFIG_RADIO_TEF6862 is not set | ||
1276 | # CONFIG_DAB is not set | 1247 | # CONFIG_DAB is not set |
1277 | 1248 | ||
1278 | # | 1249 | # |
@@ -1398,8 +1369,6 @@ CONFIG_HID=y | |||
1398 | # | 1369 | # |
1399 | # Special HID drivers | 1370 | # Special HID drivers |
1400 | # | 1371 | # |
1401 | CONFIG_HID_APPLE=m | ||
1402 | # CONFIG_HID_WACOM is not set | ||
1403 | CONFIG_USB_SUPPORT=y | 1372 | CONFIG_USB_SUPPORT=y |
1404 | CONFIG_USB_ARCH_HAS_HCD=y | 1373 | CONFIG_USB_ARCH_HAS_HCD=y |
1405 | CONFIG_USB_ARCH_HAS_OHCI=y | 1374 | CONFIG_USB_ARCH_HAS_OHCI=y |
@@ -1477,7 +1446,6 @@ CONFIG_USB_OHCI_LITTLE_ENDIAN=y | |||
1477 | # CONFIG_USB_RIO500 is not set | 1446 | # CONFIG_USB_RIO500 is not set |
1478 | # CONFIG_USB_LEGOTOWER is not set | 1447 | # CONFIG_USB_LEGOTOWER is not set |
1479 | # CONFIG_USB_LCD is not set | 1448 | # CONFIG_USB_LCD is not set |
1480 | # CONFIG_USB_BERRY_CHARGE is not set | ||
1481 | # CONFIG_USB_LED is not set | 1449 | # CONFIG_USB_LED is not set |
1482 | # CONFIG_USB_CYPRESS_CY7C63 is not set | 1450 | # CONFIG_USB_CYPRESS_CY7C63 is not set |
1483 | # CONFIG_USB_CYTHERM is not set | 1451 | # CONFIG_USB_CYTHERM is not set |
@@ -1489,7 +1457,6 @@ CONFIG_USB_OHCI_LITTLE_ENDIAN=y | |||
1489 | # CONFIG_USB_IOWARRIOR is not set | 1457 | # CONFIG_USB_IOWARRIOR is not set |
1490 | # CONFIG_USB_TEST is not set | 1458 | # CONFIG_USB_TEST is not set |
1491 | # CONFIG_USB_ISIGHTFW is not set | 1459 | # CONFIG_USB_ISIGHTFW is not set |
1492 | # CONFIG_USB_VST is not set | ||
1493 | CONFIG_USB_GADGET=y | 1460 | CONFIG_USB_GADGET=y |
1494 | # CONFIG_USB_GADGET_DEBUG is not set | 1461 | # CONFIG_USB_GADGET_DEBUG is not set |
1495 | # CONFIG_USB_GADGET_DEBUG_FILES is not set | 1462 | # CONFIG_USB_GADGET_DEBUG_FILES is not set |
@@ -1529,6 +1496,7 @@ CONFIG_USB_ETH=y | |||
1529 | # CONFIG_USB_MIDI_GADGET is not set | 1496 | # CONFIG_USB_MIDI_GADGET is not set |
1530 | # CONFIG_USB_G_PRINTER is not set | 1497 | # CONFIG_USB_G_PRINTER is not set |
1531 | # CONFIG_USB_CDC_COMPOSITE is not set | 1498 | # CONFIG_USB_CDC_COMPOSITE is not set |
1499 | # CONFIG_USB_G_NOKIA is not set | ||
1532 | # CONFIG_USB_G_MULTI is not set | 1500 | # CONFIG_USB_G_MULTI is not set |
1533 | 1501 | ||
1534 | # | 1502 | # |
@@ -1555,8 +1523,6 @@ CONFIG_SDIO_UART=m | |||
1555 | # | 1523 | # |
1556 | CONFIG_MMC_PXA=y | 1524 | CONFIG_MMC_PXA=y |
1557 | # CONFIG_MMC_SDHCI is not set | 1525 | # CONFIG_MMC_SDHCI is not set |
1558 | # CONFIG_MMC_AT91 is not set | ||
1559 | # CONFIG_MMC_ATMELMCI is not set | ||
1560 | CONFIG_MMC_SPI=y | 1526 | CONFIG_MMC_SPI=y |
1561 | # CONFIG_MEMSTICK is not set | 1527 | # CONFIG_MEMSTICK is not set |
1562 | CONFIG_NEW_LEDS=y | 1528 | CONFIG_NEW_LEDS=y |
@@ -1574,11 +1540,11 @@ CONFIG_LEDS_LP3944=y | |||
1574 | # CONFIG_LEDS_REGULATOR is not set | 1540 | # CONFIG_LEDS_REGULATOR is not set |
1575 | # CONFIG_LEDS_BD2802 is not set | 1541 | # CONFIG_LEDS_BD2802 is not set |
1576 | # CONFIG_LEDS_LT3593 is not set | 1542 | # CONFIG_LEDS_LT3593 is not set |
1543 | CONFIG_LEDS_TRIGGERS=y | ||
1577 | 1544 | ||
1578 | # | 1545 | # |
1579 | # LED Triggers | 1546 | # LED Triggers |
1580 | # | 1547 | # |
1581 | CONFIG_LEDS_TRIGGERS=y | ||
1582 | CONFIG_LEDS_TRIGGER_TIMER=y | 1548 | CONFIG_LEDS_TRIGGER_TIMER=y |
1583 | CONFIG_LEDS_TRIGGER_HEARTBEAT=y | 1549 | CONFIG_LEDS_TRIGGER_HEARTBEAT=y |
1584 | CONFIG_LEDS_TRIGGER_BACKLIGHT=y | 1550 | CONFIG_LEDS_TRIGGER_BACKLIGHT=y |
@@ -1656,7 +1622,7 @@ CONFIG_RTC_INTF_DEV=y | |||
1656 | # on-CPU RTC drivers | 1622 | # on-CPU RTC drivers |
1657 | # | 1623 | # |
1658 | # CONFIG_RTC_DRV_SA1100 is not set | 1624 | # CONFIG_RTC_DRV_SA1100 is not set |
1659 | # CONFIG_RTC_DRV_PXA is not set | 1625 | CONFIG_RTC_DRV_PXA=y |
1660 | # CONFIG_DMADEVICES is not set | 1626 | # CONFIG_DMADEVICES is not set |
1661 | # CONFIG_AUXDISPLAY is not set | 1627 | # CONFIG_AUXDISPLAY is not set |
1662 | # CONFIG_UIO is not set | 1628 | # CONFIG_UIO is not set |
@@ -1681,19 +1647,10 @@ CONFIG_EXT3_FS_XATTR=y | |||
1681 | CONFIG_JBD=m | 1647 | CONFIG_JBD=m |
1682 | # CONFIG_JBD_DEBUG is not set | 1648 | # CONFIG_JBD_DEBUG is not set |
1683 | CONFIG_FS_MBCACHE=m | 1649 | CONFIG_FS_MBCACHE=m |
1684 | CONFIG_REISERFS_FS=m | 1650 | # CONFIG_REISERFS_FS is not set |
1685 | # CONFIG_REISERFS_CHECK is not set | ||
1686 | # CONFIG_REISERFS_PROC_INFO is not set | ||
1687 | CONFIG_REISERFS_FS_XATTR=y | ||
1688 | CONFIG_REISERFS_FS_POSIX_ACL=y | ||
1689 | CONFIG_REISERFS_FS_SECURITY=y | ||
1690 | # CONFIG_JFS_FS is not set | 1651 | # CONFIG_JFS_FS is not set |
1691 | CONFIG_FS_POSIX_ACL=y | 1652 | CONFIG_FS_POSIX_ACL=y |
1692 | CONFIG_XFS_FS=m | 1653 | # CONFIG_XFS_FS is not set |
1693 | # CONFIG_XFS_QUOTA is not set | ||
1694 | # CONFIG_XFS_POSIX_ACL is not set | ||
1695 | # CONFIG_XFS_RT is not set | ||
1696 | # CONFIG_XFS_DEBUG is not set | ||
1697 | # CONFIG_OCFS2_FS is not set | 1654 | # CONFIG_OCFS2_FS is not set |
1698 | # CONFIG_BTRFS_FS is not set | 1655 | # CONFIG_BTRFS_FS is not set |
1699 | # CONFIG_NILFS2_FS is not set | 1656 | # CONFIG_NILFS2_FS is not set |
@@ -1716,9 +1673,7 @@ CONFIG_CUSE=m | |||
1716 | # | 1673 | # |
1717 | # CD-ROM/DVD Filesystems | 1674 | # CD-ROM/DVD Filesystems |
1718 | # | 1675 | # |
1719 | CONFIG_ISO9660_FS=m | 1676 | # CONFIG_ISO9660_FS is not set |
1720 | CONFIG_JOLIET=y | ||
1721 | CONFIG_ZISOFS=y | ||
1722 | # CONFIG_UDF_FS is not set | 1677 | # CONFIG_UDF_FS is not set |
1723 | 1678 | ||
1724 | # | 1679 | # |
@@ -1750,12 +1705,14 @@ CONFIG_MISC_FILESYSTEMS=y | |||
1750 | # CONFIG_BEFS_FS is not set | 1705 | # CONFIG_BEFS_FS is not set |
1751 | # CONFIG_BFS_FS is not set | 1706 | # CONFIG_BFS_FS is not set |
1752 | # CONFIG_EFS_FS is not set | 1707 | # CONFIG_EFS_FS is not set |
1753 | CONFIG_JFFS2_FS=m | 1708 | CONFIG_JFFS2_FS=y |
1754 | CONFIG_JFFS2_FS_DEBUG=0 | 1709 | CONFIG_JFFS2_FS_DEBUG=0 |
1755 | CONFIG_JFFS2_FS_WRITEBUFFER=y | 1710 | CONFIG_JFFS2_FS_WRITEBUFFER=y |
1756 | # CONFIG_JFFS2_FS_WBUF_VERIFY is not set | 1711 | CONFIG_JFFS2_FS_WBUF_VERIFY=y |
1757 | # CONFIG_JFFS2_SUMMARY is not set | 1712 | CONFIG_JFFS2_SUMMARY=y |
1758 | # CONFIG_JFFS2_FS_XATTR is not set | 1713 | CONFIG_JFFS2_FS_XATTR=y |
1714 | CONFIG_JFFS2_FS_POSIX_ACL=y | ||
1715 | CONFIG_JFFS2_FS_SECURITY=y | ||
1759 | CONFIG_JFFS2_COMPRESSION_OPTIONS=y | 1716 | CONFIG_JFFS2_COMPRESSION_OPTIONS=y |
1760 | CONFIG_JFFS2_ZLIB=y | 1717 | CONFIG_JFFS2_ZLIB=y |
1761 | CONFIG_JFFS2_LZO=y | 1718 | CONFIG_JFFS2_LZO=y |
@@ -1765,6 +1722,7 @@ CONFIG_JFFS2_RUBIN=y | |||
1765 | CONFIG_JFFS2_CMODE_PRIORITY=y | 1722 | CONFIG_JFFS2_CMODE_PRIORITY=y |
1766 | # CONFIG_JFFS2_CMODE_SIZE is not set | 1723 | # CONFIG_JFFS2_CMODE_SIZE is not set |
1767 | # CONFIG_JFFS2_CMODE_FAVOURLZO is not set | 1724 | # CONFIG_JFFS2_CMODE_FAVOURLZO is not set |
1725 | # CONFIG_LOGFS is not set | ||
1768 | CONFIG_CRAMFS=m | 1726 | CONFIG_CRAMFS=m |
1769 | CONFIG_SQUASHFS=m | 1727 | CONFIG_SQUASHFS=m |
1770 | # CONFIG_SQUASHFS_EMBEDDED is not set | 1728 | # CONFIG_SQUASHFS_EMBEDDED is not set |
@@ -1802,6 +1760,7 @@ CONFIG_SUNRPC=y | |||
1802 | # CONFIG_RPCSEC_GSS_SPKM3 is not set | 1760 | # CONFIG_RPCSEC_GSS_SPKM3 is not set |
1803 | CONFIG_SMB_FS=m | 1761 | CONFIG_SMB_FS=m |
1804 | # CONFIG_SMB_NLS_DEFAULT is not set | 1762 | # CONFIG_SMB_NLS_DEFAULT is not set |
1763 | # CONFIG_CEPH_FS is not set | ||
1805 | CONFIG_CIFS=m | 1764 | CONFIG_CIFS=m |
1806 | CONFIG_CIFS_STATS=y | 1765 | CONFIG_CIFS_STATS=y |
1807 | # CONFIG_CIFS_STATS2 is not set | 1766 | # CONFIG_CIFS_STATS2 is not set |
@@ -1895,6 +1854,7 @@ CONFIG_DEBUG_SPINLOCK=y | |||
1895 | CONFIG_DEBUG_MUTEXES=y | 1854 | CONFIG_DEBUG_MUTEXES=y |
1896 | CONFIG_DEBUG_LOCK_ALLOC=y | 1855 | CONFIG_DEBUG_LOCK_ALLOC=y |
1897 | CONFIG_PROVE_LOCKING=y | 1856 | CONFIG_PROVE_LOCKING=y |
1857 | # CONFIG_PROVE_RCU is not set | ||
1898 | CONFIG_LOCKDEP=y | 1858 | CONFIG_LOCKDEP=y |
1899 | # CONFIG_LOCK_STAT is not set | 1859 | # CONFIG_LOCK_STAT is not set |
1900 | # CONFIG_DEBUG_LOCKDEP is not set | 1860 | # CONFIG_DEBUG_LOCKDEP is not set |
@@ -1918,6 +1878,7 @@ CONFIG_DEBUG_BUGVERBOSE=y | |||
1918 | # CONFIG_BACKTRACE_SELF_TEST is not set | 1878 | # CONFIG_BACKTRACE_SELF_TEST is not set |
1919 | # CONFIG_DEBUG_BLOCK_EXT_DEVT is not set | 1879 | # CONFIG_DEBUG_BLOCK_EXT_DEVT is not set |
1920 | # CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set | 1880 | # CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set |
1881 | # CONFIG_LKDTM is not set | ||
1921 | # CONFIG_FAULT_INJECTION is not set | 1882 | # CONFIG_FAULT_INJECTION is not set |
1922 | # CONFIG_LATENCYTOP is not set | 1883 | # CONFIG_LATENCYTOP is not set |
1923 | # CONFIG_SYSCTL_SYSCALL_CHECK is not set | 1884 | # CONFIG_SYSCTL_SYSCALL_CHECK is not set |
@@ -2061,9 +2022,9 @@ CONFIG_CRC32=y | |||
2061 | CONFIG_CRC7=y | 2022 | CONFIG_CRC7=y |
2062 | CONFIG_LIBCRC32C=m | 2023 | CONFIG_LIBCRC32C=m |
2063 | CONFIG_ZLIB_INFLATE=y | 2024 | CONFIG_ZLIB_INFLATE=y |
2064 | CONFIG_ZLIB_DEFLATE=m | 2025 | CONFIG_ZLIB_DEFLATE=y |
2065 | CONFIG_LZO_COMPRESS=m | 2026 | CONFIG_LZO_COMPRESS=y |
2066 | CONFIG_LZO_DECOMPRESS=m | 2027 | CONFIG_LZO_DECOMPRESS=y |
2067 | CONFIG_DECOMPRESS_GZIP=y | 2028 | CONFIG_DECOMPRESS_GZIP=y |
2068 | CONFIG_DECOMPRESS_BZIP2=y | 2029 | CONFIG_DECOMPRESS_BZIP2=y |
2069 | CONFIG_DECOMPRESS_LZMA=y | 2030 | CONFIG_DECOMPRESS_LZMA=y |
@@ -2075,3 +2036,4 @@ CONFIG_HAS_IOMEM=y | |||
2075 | CONFIG_HAS_IOPORT=y | 2036 | CONFIG_HAS_IOPORT=y |
2076 | CONFIG_HAS_DMA=y | 2037 | CONFIG_HAS_DMA=y |
2077 | CONFIG_NLATTR=y | 2038 | CONFIG_NLATTR=y |
2039 | CONFIG_GENERIC_ATOMIC64=y | ||
diff --git a/arch/arm/include/asm/atomic.h b/arch/arm/include/asm/atomic.h index e8ddec2cb158..a0162fa94564 100644 --- a/arch/arm/include/asm/atomic.h +++ b/arch/arm/include/asm/atomic.h | |||
@@ -24,7 +24,7 @@ | |||
24 | * strex/ldrex monitor on some implementations. The reason we can use it for | 24 | * strex/ldrex monitor on some implementations. The reason we can use it for |
25 | * atomic_set() is the clrex or dummy strex done on every exception return. | 25 | * atomic_set() is the clrex or dummy strex done on every exception return. |
26 | */ | 26 | */ |
27 | #define atomic_read(v) ((v)->counter) | 27 | #define atomic_read(v) (*(volatile int *)&(v)->counter) |
28 | #define atomic_set(v,i) (((v)->counter) = (i)) | 28 | #define atomic_set(v,i) (((v)->counter) = (i)) |
29 | 29 | ||
30 | #if __LINUX_ARM_ARCH__ >= 6 | 30 | #if __LINUX_ARM_ARCH__ >= 6 |
diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h index 0d08d4170b64..4656a24058d2 100644 --- a/arch/arm/include/asm/cacheflush.h +++ b/arch/arm/include/asm/cacheflush.h | |||
@@ -371,6 +371,10 @@ static inline void __flush_icache_all(void) | |||
371 | #ifdef CONFIG_ARM_ERRATA_411920 | 371 | #ifdef CONFIG_ARM_ERRATA_411920 |
372 | extern void v6_icache_inval_all(void); | 372 | extern void v6_icache_inval_all(void); |
373 | v6_icache_inval_all(); | 373 | v6_icache_inval_all(); |
374 | #elif defined(CONFIG_SMP) && __LINUX_ARM_ARCH__ >= 7 | ||
375 | asm("mcr p15, 0, %0, c7, c1, 0 @ invalidate I-cache inner shareable\n" | ||
376 | : | ||
377 | : "r" (0)); | ||
374 | #else | 378 | #else |
375 | asm("mcr p15, 0, %0, c7, c5, 0 @ invalidate I-cache\n" | 379 | asm("mcr p15, 0, %0, c7, c5, 0 @ invalidate I-cache\n" |
376 | : | 380 | : |
diff --git a/arch/arm/include/asm/elf.h b/arch/arm/include/asm/elf.h index bff056489cc1..51662feb9f1d 100644 --- a/arch/arm/include/asm/elf.h +++ b/arch/arm/include/asm/elf.h | |||
@@ -9,6 +9,8 @@ | |||
9 | #include <asm/ptrace.h> | 9 | #include <asm/ptrace.h> |
10 | #include <asm/user.h> | 10 | #include <asm/user.h> |
11 | 11 | ||
12 | struct task_struct; | ||
13 | |||
12 | typedef unsigned long elf_greg_t; | 14 | typedef unsigned long elf_greg_t; |
13 | typedef unsigned long elf_freg_t[3]; | 15 | typedef unsigned long elf_freg_t[3]; |
14 | 16 | ||
diff --git a/arch/arm/include/asm/smp_twd.h b/arch/arm/include/asm/smp_twd.h index 7be0978b2625..634f357be6bb 100644 --- a/arch/arm/include/asm/smp_twd.h +++ b/arch/arm/include/asm/smp_twd.h | |||
@@ -1,6 +1,23 @@ | |||
1 | #ifndef __ASMARM_SMP_TWD_H | 1 | #ifndef __ASMARM_SMP_TWD_H |
2 | #define __ASMARM_SMP_TWD_H | 2 | #define __ASMARM_SMP_TWD_H |
3 | 3 | ||
4 | #define TWD_TIMER_LOAD 0x00 | ||
5 | #define TWD_TIMER_COUNTER 0x04 | ||
6 | #define TWD_TIMER_CONTROL 0x08 | ||
7 | #define TWD_TIMER_INTSTAT 0x0C | ||
8 | |||
9 | #define TWD_WDOG_LOAD 0x20 | ||
10 | #define TWD_WDOG_COUNTER 0x24 | ||
11 | #define TWD_WDOG_CONTROL 0x28 | ||
12 | #define TWD_WDOG_INTSTAT 0x2C | ||
13 | #define TWD_WDOG_RESETSTAT 0x30 | ||
14 | #define TWD_WDOG_DISABLE 0x34 | ||
15 | |||
16 | #define TWD_TIMER_CONTROL_ENABLE (1 << 0) | ||
17 | #define TWD_TIMER_CONTROL_ONESHOT (0 << 1) | ||
18 | #define TWD_TIMER_CONTROL_PERIODIC (1 << 1) | ||
19 | #define TWD_TIMER_CONTROL_IT_ENABLE (1 << 2) | ||
20 | |||
4 | struct clock_event_device; | 21 | struct clock_event_device; |
5 | 22 | ||
6 | extern void __iomem *twd_base; | 23 | extern void __iomem *twd_base; |
diff --git a/arch/arm/include/asm/tlbflush.h b/arch/arm/include/asm/tlbflush.h index e085e2c545eb..bd863d8608cd 100644 --- a/arch/arm/include/asm/tlbflush.h +++ b/arch/arm/include/asm/tlbflush.h | |||
@@ -46,6 +46,9 @@ | |||
46 | #define TLB_V7_UIS_FULL (1 << 20) | 46 | #define TLB_V7_UIS_FULL (1 << 20) |
47 | #define TLB_V7_UIS_ASID (1 << 21) | 47 | #define TLB_V7_UIS_ASID (1 << 21) |
48 | 48 | ||
49 | /* Inner Shareable BTB operation (ARMv7 MP extensions) */ | ||
50 | #define TLB_V7_IS_BTB (1 << 22) | ||
51 | |||
49 | #define TLB_L2CLEAN_FR (1 << 29) /* Feroceon */ | 52 | #define TLB_L2CLEAN_FR (1 << 29) /* Feroceon */ |
50 | #define TLB_DCLEAN (1 << 30) | 53 | #define TLB_DCLEAN (1 << 30) |
51 | #define TLB_WB (1 << 31) | 54 | #define TLB_WB (1 << 31) |
@@ -183,7 +186,7 @@ | |||
183 | #endif | 186 | #endif |
184 | 187 | ||
185 | #ifdef CONFIG_SMP | 188 | #ifdef CONFIG_SMP |
186 | #define v7wbi_tlb_flags (TLB_WB | TLB_DCLEAN | TLB_BTB | \ | 189 | #define v7wbi_tlb_flags (TLB_WB | TLB_DCLEAN | TLB_V7_IS_BTB | \ |
187 | TLB_V7_UIS_FULL | TLB_V7_UIS_PAGE | TLB_V7_UIS_ASID) | 190 | TLB_V7_UIS_FULL | TLB_V7_UIS_PAGE | TLB_V7_UIS_ASID) |
188 | #else | 191 | #else |
189 | #define v7wbi_tlb_flags (TLB_WB | TLB_DCLEAN | TLB_BTB | \ | 192 | #define v7wbi_tlb_flags (TLB_WB | TLB_DCLEAN | TLB_BTB | \ |
@@ -339,6 +342,12 @@ static inline void local_flush_tlb_all(void) | |||
339 | dsb(); | 342 | dsb(); |
340 | isb(); | 343 | isb(); |
341 | } | 344 | } |
345 | if (tlb_flag(TLB_V7_IS_BTB)) { | ||
346 | /* flush the branch target cache */ | ||
347 | asm("mcr p15, 0, %0, c7, c1, 6" : : "r" (zero) : "cc"); | ||
348 | dsb(); | ||
349 | isb(); | ||
350 | } | ||
342 | } | 351 | } |
343 | 352 | ||
344 | static inline void local_flush_tlb_mm(struct mm_struct *mm) | 353 | static inline void local_flush_tlb_mm(struct mm_struct *mm) |
@@ -376,6 +385,12 @@ static inline void local_flush_tlb_mm(struct mm_struct *mm) | |||
376 | asm("mcr p15, 0, %0, c7, c5, 6" : : "r" (zero) : "cc"); | 385 | asm("mcr p15, 0, %0, c7, c5, 6" : : "r" (zero) : "cc"); |
377 | dsb(); | 386 | dsb(); |
378 | } | 387 | } |
388 | if (tlb_flag(TLB_V7_IS_BTB)) { | ||
389 | /* flush the branch target cache */ | ||
390 | asm("mcr p15, 0, %0, c7, c1, 6" : : "r" (zero) : "cc"); | ||
391 | dsb(); | ||
392 | isb(); | ||
393 | } | ||
379 | } | 394 | } |
380 | 395 | ||
381 | static inline void | 396 | static inline void |
@@ -416,6 +431,12 @@ local_flush_tlb_page(struct vm_area_struct *vma, unsigned long uaddr) | |||
416 | asm("mcr p15, 0, %0, c7, c5, 6" : : "r" (zero) : "cc"); | 431 | asm("mcr p15, 0, %0, c7, c5, 6" : : "r" (zero) : "cc"); |
417 | dsb(); | 432 | dsb(); |
418 | } | 433 | } |
434 | if (tlb_flag(TLB_V7_IS_BTB)) { | ||
435 | /* flush the branch target cache */ | ||
436 | asm("mcr p15, 0, %0, c7, c1, 6" : : "r" (zero) : "cc"); | ||
437 | dsb(); | ||
438 | isb(); | ||
439 | } | ||
419 | } | 440 | } |
420 | 441 | ||
421 | static inline void local_flush_tlb_kernel_page(unsigned long kaddr) | 442 | static inline void local_flush_tlb_kernel_page(unsigned long kaddr) |
@@ -454,6 +475,12 @@ static inline void local_flush_tlb_kernel_page(unsigned long kaddr) | |||
454 | dsb(); | 475 | dsb(); |
455 | isb(); | 476 | isb(); |
456 | } | 477 | } |
478 | if (tlb_flag(TLB_V7_IS_BTB)) { | ||
479 | /* flush the branch target cache */ | ||
480 | asm("mcr p15, 0, %0, c7, c1, 6" : : "r" (zero) : "cc"); | ||
481 | dsb(); | ||
482 | isb(); | ||
483 | } | ||
457 | } | 484 | } |
458 | 485 | ||
459 | /* | 486 | /* |
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S index e6a0fb0f392e..7ee48e7f8f31 100644 --- a/arch/arm/kernel/entry-armv.S +++ b/arch/arm/kernel/entry-armv.S | |||
@@ -676,10 +676,10 @@ do_fpe: | |||
676 | * lr = unrecognised FP instruction return address | 676 | * lr = unrecognised FP instruction return address |
677 | */ | 677 | */ |
678 | 678 | ||
679 | .data | 679 | .pushsection .data |
680 | ENTRY(fp_enter) | 680 | ENTRY(fp_enter) |
681 | .word no_fp | 681 | .word no_fp |
682 | .text | 682 | .popsection |
683 | 683 | ||
684 | ENTRY(no_fp) | 684 | ENTRY(no_fp) |
685 | mov pc, lr | 685 | mov pc, lr |
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index 577543f3857f..a01194e583ff 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c | |||
@@ -86,6 +86,12 @@ int __cpuinit __cpu_up(unsigned int cpu) | |||
86 | return PTR_ERR(idle); | 86 | return PTR_ERR(idle); |
87 | } | 87 | } |
88 | ci->idle = idle; | 88 | ci->idle = idle; |
89 | } else { | ||
90 | /* | ||
91 | * Since this idle thread is being re-used, call | ||
92 | * init_idle() to reinitialize the thread structure. | ||
93 | */ | ||
94 | init_idle(idle, cpu); | ||
89 | } | 95 | } |
90 | 96 | ||
91 | /* | 97 | /* |
diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c index ea02a7b1c244..7c5f0c024db7 100644 --- a/arch/arm/kernel/smp_twd.c +++ b/arch/arm/kernel/smp_twd.c | |||
@@ -21,23 +21,6 @@ | |||
21 | #include <asm/smp_twd.h> | 21 | #include <asm/smp_twd.h> |
22 | #include <asm/hardware/gic.h> | 22 | #include <asm/hardware/gic.h> |
23 | 23 | ||
24 | #define TWD_TIMER_LOAD 0x00 | ||
25 | #define TWD_TIMER_COUNTER 0x04 | ||
26 | #define TWD_TIMER_CONTROL 0x08 | ||
27 | #define TWD_TIMER_INTSTAT 0x0C | ||
28 | |||
29 | #define TWD_WDOG_LOAD 0x20 | ||
30 | #define TWD_WDOG_COUNTER 0x24 | ||
31 | #define TWD_WDOG_CONTROL 0x28 | ||
32 | #define TWD_WDOG_INTSTAT 0x2C | ||
33 | #define TWD_WDOG_RESETSTAT 0x30 | ||
34 | #define TWD_WDOG_DISABLE 0x34 | ||
35 | |||
36 | #define TWD_TIMER_CONTROL_ENABLE (1 << 0) | ||
37 | #define TWD_TIMER_CONTROL_ONESHOT (0 << 1) | ||
38 | #define TWD_TIMER_CONTROL_PERIODIC (1 << 1) | ||
39 | #define TWD_TIMER_CONTROL_IT_ENABLE (1 << 2) | ||
40 | |||
41 | /* set up by the platform code */ | 24 | /* set up by the platform code */ |
42 | void __iomem *twd_base; | 25 | void __iomem *twd_base; |
43 | 26 | ||
diff --git a/arch/arm/lib/clear_user.S b/arch/arm/lib/clear_user.S index 5e3f99620c04..14a0d988c82c 100644 --- a/arch/arm/lib/clear_user.S +++ b/arch/arm/lib/clear_user.S | |||
@@ -45,6 +45,7 @@ USER( strnebt r2, [r0]) | |||
45 | mov r0, #0 | 45 | mov r0, #0 |
46 | ldmfd sp!, {r1, pc} | 46 | ldmfd sp!, {r1, pc} |
47 | ENDPROC(__clear_user) | 47 | ENDPROC(__clear_user) |
48 | ENDPROC(__clear_user_std) | ||
48 | 49 | ||
49 | .pushsection .fixup,"ax" | 50 | .pushsection .fixup,"ax" |
50 | .align 0 | 51 | .align 0 |
diff --git a/arch/arm/lib/copy_to_user.S b/arch/arm/lib/copy_to_user.S index 027b69bdbad1..d066df686e17 100644 --- a/arch/arm/lib/copy_to_user.S +++ b/arch/arm/lib/copy_to_user.S | |||
@@ -93,6 +93,7 @@ WEAK(__copy_to_user) | |||
93 | #include "copy_template.S" | 93 | #include "copy_template.S" |
94 | 94 | ||
95 | ENDPROC(__copy_to_user) | 95 | ENDPROC(__copy_to_user) |
96 | ENDPROC(__copy_to_user_std) | ||
96 | 97 | ||
97 | .pushsection .fixup,"ax" | 98 | .pushsection .fixup,"ax" |
98 | .align 0 | 99 | .align 0 |
diff --git a/arch/arm/mach-davinci/da830.c b/arch/arm/mach-davinci/da830.c index 122e61a9f505..e8cb982f5e8e 100644 --- a/arch/arm/mach-davinci/da830.c +++ b/arch/arm/mach-davinci/da830.c | |||
@@ -410,7 +410,7 @@ static struct clk_lookup da830_clks[] = { | |||
410 | CLK("davinci-mcasp.0", NULL, &mcasp0_clk), | 410 | CLK("davinci-mcasp.0", NULL, &mcasp0_clk), |
411 | CLK("davinci-mcasp.1", NULL, &mcasp1_clk), | 411 | CLK("davinci-mcasp.1", NULL, &mcasp1_clk), |
412 | CLK("davinci-mcasp.2", NULL, &mcasp2_clk), | 412 | CLK("davinci-mcasp.2", NULL, &mcasp2_clk), |
413 | CLK("musb_hdrc", NULL, &usb20_clk), | 413 | CLK(NULL, "usb20", &usb20_clk), |
414 | CLK(NULL, "aemif", &aemif_clk), | 414 | CLK(NULL, "aemif", &aemif_clk), |
415 | CLK(NULL, "aintc", &aintc_clk), | 415 | CLK(NULL, "aintc", &aintc_clk), |
416 | CLK(NULL, "secu_mgr", &secu_mgr_clk), | 416 | CLK(NULL, "secu_mgr", &secu_mgr_clk), |
diff --git a/arch/arm/mach-mx5/clock-mx51.c b/arch/arm/mach-mx5/clock-mx51.c index 8f85f73b83a8..1ee6ce4087b8 100644 --- a/arch/arm/mach-mx5/clock-mx51.c +++ b/arch/arm/mach-mx5/clock-mx51.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/io.h> | 16 | #include <linux/io.h> |
17 | 17 | ||
18 | #include <asm/clkdev.h> | 18 | #include <asm/clkdev.h> |
19 | #include <asm/div64.h> | ||
19 | 20 | ||
20 | #include <mach/hardware.h> | 21 | #include <mach/hardware.h> |
21 | #include <mach/common.h> | 22 | #include <mach/common.h> |
diff --git a/arch/arm/mach-pxa/include/mach/colibri.h b/arch/arm/mach-pxa/include/mach/colibri.h index 811743c56147..5f2ba8d9015c 100644 --- a/arch/arm/mach-pxa/include/mach/colibri.h +++ b/arch/arm/mach-pxa/include/mach/colibri.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define _COLIBRI_H_ | 2 | #define _COLIBRI_H_ |
3 | 3 | ||
4 | #include <net/ax88796.h> | 4 | #include <net/ax88796.h> |
5 | #include <mach/mfp.h> | ||
5 | 6 | ||
6 | /* | 7 | /* |
7 | * common settings for all modules | 8 | * common settings for all modules |
diff --git a/arch/arm/mach-pxa/include/mach/hardware.h b/arch/arm/mach-pxa/include/mach/hardware.h index 7515757d6911..3d8d8cb09685 100644 --- a/arch/arm/mach-pxa/include/mach/hardware.h +++ b/arch/arm/mach-pxa/include/mach/hardware.h | |||
@@ -202,7 +202,7 @@ | |||
202 | #define __cpu_is_pxa950(id) \ | 202 | #define __cpu_is_pxa950(id) \ |
203 | ({ \ | 203 | ({ \ |
204 | unsigned int _id = (id) >> 4 & 0xfff; \ | 204 | unsigned int _id = (id) >> 4 & 0xfff; \ |
205 | id == 0x697; \ | 205 | _id == 0x697; \ |
206 | }) | 206 | }) |
207 | #else | 207 | #else |
208 | #define __cpu_is_pxa950(id) (0) | 208 | #define __cpu_is_pxa950(id) (0) |
diff --git a/arch/arm/mach-pxa/include/mach/regs-u2d.h b/arch/arm/mach-pxa/include/mach/regs-u2d.h index 44b0b20b69a4..c15c0c57de08 100644 --- a/arch/arm/mach-pxa/include/mach/regs-u2d.h +++ b/arch/arm/mach-pxa/include/mach/regs-u2d.h | |||
@@ -166,7 +166,8 @@ | |||
166 | #define U2DMACSR_BUSERRTYPE (7 << 10) /* PX Bus Error Type */ | 166 | #define U2DMACSR_BUSERRTYPE (7 << 10) /* PX Bus Error Type */ |
167 | #define U2DMACSR_EORINTR (1 << 9) /* End Of Receive */ | 167 | #define U2DMACSR_EORINTR (1 << 9) /* End Of Receive */ |
168 | #define U2DMACSR_REQPEND (1 << 8) /* Request Pending */ | 168 | #define U2DMACSR_REQPEND (1 << 8) /* Request Pending */ |
169 | #define U2DMACSR_RASINTR (1 << 4) /* Request After Channel Stopped (read / write 1 clear) */#define U2DMACSR_STOPINTR (1 << 3) /* Stop Interrupt (read only) */ | 169 | #define U2DMACSR_RASINTR (1 << 4) /* Request After Channel Stopped (read / write 1 clear) */ |
170 | #define U2DMACSR_STOPINTR (1 << 3) /* Stop Interrupt (read only) */ | ||
170 | #define U2DMACSR_ENDINTR (1 << 2) /* End Interrupt (read / write 1 clear) */ | 171 | #define U2DMACSR_ENDINTR (1 << 2) /* End Interrupt (read / write 1 clear) */ |
171 | #define U2DMACSR_STARTINTR (1 << 1) /* Start Interrupt (read / write 1 clear) */ | 172 | #define U2DMACSR_STARTINTR (1 << 1) /* Start Interrupt (read / write 1 clear) */ |
172 | #define U2DMACSR_BUSERRINTR (1 << 0) /* Bus Error Interrupt (read / write 1 clear) */ | 173 | #define U2DMACSR_BUSERRINTR (1 << 0) /* Bus Error Interrupt (read / write 1 clear) */ |
diff --git a/arch/arm/mach-pxa/raumfeld.c b/arch/arm/mach-pxa/raumfeld.c index 44bb675e47f1..d12667bd9ebe 100644 --- a/arch/arm/mach-pxa/raumfeld.c +++ b/arch/arm/mach-pxa/raumfeld.c | |||
@@ -983,7 +983,7 @@ static void __init raumfeld_common_init(void) | |||
983 | int i; | 983 | int i; |
984 | 984 | ||
985 | for (i = 0; i < ARRAY_SIZE(gpio_keys_button); i++) | 985 | for (i = 0; i < ARRAY_SIZE(gpio_keys_button); i++) |
986 | if (!strcmp(gpio_keys_button[i].desc, "on/off button")) | 986 | if (!strcmp(gpio_keys_button[i].desc, "on_off button")) |
987 | gpio_keys_button[i].active_low = 1; | 987 | gpio_keys_button[i].active_low = 1; |
988 | } | 988 | } |
989 | 989 | ||
@@ -1009,8 +1009,7 @@ static void __init raumfeld_common_init(void) | |||
1009 | gpio_direction_output(GPIO_W2W_PDN, 0); | 1009 | gpio_direction_output(GPIO_W2W_PDN, 0); |
1010 | 1010 | ||
1011 | /* this can be used to switch off the device */ | 1011 | /* this can be used to switch off the device */ |
1012 | ret = gpio_request(GPIO_SHUTDOWN_SUPPLY, | 1012 | ret = gpio_request(GPIO_SHUTDOWN_SUPPLY, "supply shutdown"); |
1013 | "supply shutdown"); | ||
1014 | if (ret < 0) | 1013 | if (ret < 0) |
1015 | pr_warning("Unable to request GPIO_SHUTDOWN_SUPPLY\n"); | 1014 | pr_warning("Unable to request GPIO_SHUTDOWN_SUPPLY\n"); |
1016 | else | 1015 | else |
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index 19b5109d9808..01bdd7500df4 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c | |||
@@ -363,7 +363,7 @@ static struct gpio_keys_button spitz_gpio_keys[] = { | |||
363 | .type = EV_PWR, | 363 | .type = EV_PWR, |
364 | .code = KEY_SUSPEND, | 364 | .code = KEY_SUSPEND, |
365 | .gpio = SPITZ_GPIO_ON_KEY, | 365 | .gpio = SPITZ_GPIO_ON_KEY, |
366 | .desc = "On/Off", | 366 | .desc = "On Off", |
367 | .wakeup = 1, | 367 | .wakeup = 1, |
368 | }, | 368 | }, |
369 | /* Two buttons detecting the lid state */ | 369 | /* Two buttons detecting the lid state */ |
diff --git a/arch/arm/mach-pxa/viper.c b/arch/arm/mach-pxa/viper.c index 9e0c5c3988a1..e90114a7e246 100644 --- a/arch/arm/mach-pxa/viper.c +++ b/arch/arm/mach-pxa/viper.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/pm.h> | 34 | #include <linux/pm.h> |
35 | #include <linux/sched.h> | 35 | #include <linux/sched.h> |
36 | #include <linux/gpio.h> | 36 | #include <linux/gpio.h> |
37 | #include <linux/jiffies.h> | ||
37 | #include <linux/i2c-gpio.h> | 38 | #include <linux/i2c-gpio.h> |
38 | #include <linux/serial_8250.h> | 39 | #include <linux/serial_8250.h> |
39 | #include <linux/smc91x.h> | 40 | #include <linux/smc91x.h> |
@@ -454,7 +455,7 @@ static struct i2c_gpio_platform_data i2c_bus_data = { | |||
454 | .sda_pin = VIPER_RTC_I2C_SDA_GPIO, | 455 | .sda_pin = VIPER_RTC_I2C_SDA_GPIO, |
455 | .scl_pin = VIPER_RTC_I2C_SCL_GPIO, | 456 | .scl_pin = VIPER_RTC_I2C_SCL_GPIO, |
456 | .udelay = 10, | 457 | .udelay = 10, |
457 | .timeout = 100, | 458 | .timeout = HZ, |
458 | }; | 459 | }; |
459 | 460 | ||
460 | static struct platform_device i2c_bus_device = { | 461 | static struct platform_device i2c_bus_device = { |
@@ -779,7 +780,7 @@ static void __init viper_tpm_init(void) | |||
779 | .sda_pin = VIPER_TPM_I2C_SDA_GPIO, | 780 | .sda_pin = VIPER_TPM_I2C_SDA_GPIO, |
780 | .scl_pin = VIPER_TPM_I2C_SCL_GPIO, | 781 | .scl_pin = VIPER_TPM_I2C_SCL_GPIO, |
781 | .udelay = 10, | 782 | .udelay = 10, |
782 | .timeout = 100, | 783 | .timeout = HZ, |
783 | }; | 784 | }; |
784 | char *errstr; | 785 | char *errstr; |
785 | 786 | ||
diff --git a/arch/arm/mach-sa1100/Kconfig b/arch/arm/mach-sa1100/Kconfig index b17d52f7cc48..fd4c52b7ccb6 100644 --- a/arch/arm/mach-sa1100/Kconfig +++ b/arch/arm/mach-sa1100/Kconfig | |||
@@ -57,7 +57,7 @@ config SA1100_COLLIE | |||
57 | config SA1100_H3100 | 57 | config SA1100_H3100 |
58 | bool "Compaq iPAQ H3100" | 58 | bool "Compaq iPAQ H3100" |
59 | select HTC_EGPIO | 59 | select HTC_EGPIO |
60 | select CPU_FREQ_SA1100 | 60 | select CPU_FREQ_SA1110 |
61 | help | 61 | help |
62 | Say Y here if you intend to run this kernel on the Compaq iPAQ | 62 | Say Y here if you intend to run this kernel on the Compaq iPAQ |
63 | H3100 handheld computer. Information about this machine and the | 63 | H3100 handheld computer. Information about this machine and the |
@@ -68,7 +68,7 @@ config SA1100_H3100 | |||
68 | config SA1100_H3600 | 68 | config SA1100_H3600 |
69 | bool "Compaq iPAQ H3600/H3700" | 69 | bool "Compaq iPAQ H3600/H3700" |
70 | select HTC_EGPIO | 70 | select HTC_EGPIO |
71 | select CPU_FREQ_SA1100 | 71 | select CPU_FREQ_SA1110 |
72 | help | 72 | help |
73 | Say Y here if you intend to run this kernel on the Compaq iPAQ | 73 | Say Y here if you intend to run this kernel on the Compaq iPAQ |
74 | H3600 handheld computer. Information about this machine and the | 74 | H3600 handheld computer. Information about this machine and the |
diff --git a/arch/arm/mach-sa1100/cpu-sa1110.c b/arch/arm/mach-sa1100/cpu-sa1110.c index 63b32b68b296..7252874d328b 100644 --- a/arch/arm/mach-sa1100/cpu-sa1110.c +++ b/arch/arm/mach-sa1100/cpu-sa1110.c | |||
@@ -363,6 +363,9 @@ static int __init sa1110_clk_init(void) | |||
363 | struct sdram_params *sdram; | 363 | struct sdram_params *sdram; |
364 | const char *name = sdram_name; | 364 | const char *name = sdram_name; |
365 | 365 | ||
366 | if (!cpu_is_sa1110()) | ||
367 | return -ENODEV; | ||
368 | |||
366 | if (!name[0]) { | 369 | if (!name[0]) { |
367 | if (machine_is_assabet()) | 370 | if (machine_is_assabet()) |
368 | name = "TC59SM716-CL3"; | 371 | name = "TC59SM716-CL3"; |
diff --git a/arch/arm/mm/cache-v6.S b/arch/arm/mm/cache-v6.S index 9d89c67a1cc3..e46ecd847138 100644 --- a/arch/arm/mm/cache-v6.S +++ b/arch/arm/mm/cache-v6.S | |||
@@ -211,6 +211,9 @@ v6_dma_inv_range: | |||
211 | mcrne p15, 0, r1, c7, c15, 1 @ clean & invalidate unified line | 211 | mcrne p15, 0, r1, c7, c15, 1 @ clean & invalidate unified line |
212 | #endif | 212 | #endif |
213 | 1: | 213 | 1: |
214 | #ifdef CONFIG_SMP | ||
215 | str r0, [r0] @ write for ownership | ||
216 | #endif | ||
214 | #ifdef HARVARD_CACHE | 217 | #ifdef HARVARD_CACHE |
215 | mcr p15, 0, r0, c7, c6, 1 @ invalidate D line | 218 | mcr p15, 0, r0, c7, c6, 1 @ invalidate D line |
216 | #else | 219 | #else |
@@ -231,6 +234,9 @@ v6_dma_inv_range: | |||
231 | v6_dma_clean_range: | 234 | v6_dma_clean_range: |
232 | bic r0, r0, #D_CACHE_LINE_SIZE - 1 | 235 | bic r0, r0, #D_CACHE_LINE_SIZE - 1 |
233 | 1: | 236 | 1: |
237 | #ifdef CONFIG_SMP | ||
238 | ldr r2, [r0] @ read for ownership | ||
239 | #endif | ||
234 | #ifdef HARVARD_CACHE | 240 | #ifdef HARVARD_CACHE |
235 | mcr p15, 0, r0, c7, c10, 1 @ clean D line | 241 | mcr p15, 0, r0, c7, c10, 1 @ clean D line |
236 | #else | 242 | #else |
@@ -251,6 +257,10 @@ v6_dma_clean_range: | |||
251 | ENTRY(v6_dma_flush_range) | 257 | ENTRY(v6_dma_flush_range) |
252 | bic r0, r0, #D_CACHE_LINE_SIZE - 1 | 258 | bic r0, r0, #D_CACHE_LINE_SIZE - 1 |
253 | 1: | 259 | 1: |
260 | #ifdef CONFIG_SMP | ||
261 | ldr r2, [r0] @ read for ownership | ||
262 | str r2, [r0] @ write for ownership | ||
263 | #endif | ||
254 | #ifdef HARVARD_CACHE | 264 | #ifdef HARVARD_CACHE |
255 | mcr p15, 0, r0, c7, c14, 1 @ clean & invalidate D line | 265 | mcr p15, 0, r0, c7, c14, 1 @ clean & invalidate D line |
256 | #else | 266 | #else |
@@ -273,7 +283,9 @@ ENTRY(v6_dma_map_area) | |||
273 | add r1, r1, r0 | 283 | add r1, r1, r0 |
274 | teq r2, #DMA_FROM_DEVICE | 284 | teq r2, #DMA_FROM_DEVICE |
275 | beq v6_dma_inv_range | 285 | beq v6_dma_inv_range |
276 | b v6_dma_clean_range | 286 | teq r2, #DMA_TO_DEVICE |
287 | beq v6_dma_clean_range | ||
288 | b v6_dma_flush_range | ||
277 | ENDPROC(v6_dma_map_area) | 289 | ENDPROC(v6_dma_map_area) |
278 | 290 | ||
279 | /* | 291 | /* |
@@ -283,9 +295,6 @@ ENDPROC(v6_dma_map_area) | |||
283 | * - dir - DMA direction | 295 | * - dir - DMA direction |
284 | */ | 296 | */ |
285 | ENTRY(v6_dma_unmap_area) | 297 | ENTRY(v6_dma_unmap_area) |
286 | add r1, r1, r0 | ||
287 | teq r2, #DMA_TO_DEVICE | ||
288 | bne v6_dma_inv_range | ||
289 | mov pc, lr | 298 | mov pc, lr |
290 | ENDPROC(v6_dma_unmap_area) | 299 | ENDPROC(v6_dma_unmap_area) |
291 | 300 | ||
diff --git a/arch/arm/mm/cache-v7.S b/arch/arm/mm/cache-v7.S index bcd64f265870..06a90dcfc60a 100644 --- a/arch/arm/mm/cache-v7.S +++ b/arch/arm/mm/cache-v7.S | |||
@@ -167,7 +167,11 @@ ENTRY(v7_coherent_user_range) | |||
167 | cmp r0, r1 | 167 | cmp r0, r1 |
168 | blo 1b | 168 | blo 1b |
169 | mov r0, #0 | 169 | mov r0, #0 |
170 | #ifdef CONFIG_SMP | ||
171 | mcr p15, 0, r0, c7, c1, 6 @ invalidate BTB Inner Shareable | ||
172 | #else | ||
170 | mcr p15, 0, r0, c7, c5, 6 @ invalidate BTB | 173 | mcr p15, 0, r0, c7, c5, 6 @ invalidate BTB |
174 | #endif | ||
171 | dsb | 175 | dsb |
172 | isb | 176 | isb |
173 | mov pc, lr | 177 | mov pc, lr |
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index 83db12a68d56..0ed29bfeba1c 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c | |||
@@ -86,9 +86,6 @@ void show_mem(void) | |||
86 | printk("Mem-info:\n"); | 86 | printk("Mem-info:\n"); |
87 | show_free_areas(); | 87 | show_free_areas(); |
88 | for_each_online_node(node) { | 88 | for_each_online_node(node) { |
89 | pg_data_t *n = NODE_DATA(node); | ||
90 | struct page *map = pgdat_page_nr(n, 0) - n->node_start_pfn; | ||
91 | |||
92 | for_each_nodebank (i,mi,node) { | 89 | for_each_nodebank (i,mi,node) { |
93 | struct membank *bank = &mi->bank[i]; | 90 | struct membank *bank = &mi->bank[i]; |
94 | unsigned int pfn1, pfn2; | 91 | unsigned int pfn1, pfn2; |
@@ -97,8 +94,8 @@ void show_mem(void) | |||
97 | pfn1 = bank_pfn_start(bank); | 94 | pfn1 = bank_pfn_start(bank); |
98 | pfn2 = bank_pfn_end(bank); | 95 | pfn2 = bank_pfn_end(bank); |
99 | 96 | ||
100 | page = map + pfn1; | 97 | page = pfn_to_page(pfn1); |
101 | end = map + pfn2; | 98 | end = pfn_to_page(pfn2 - 1) + 1; |
102 | 99 | ||
103 | do { | 100 | do { |
104 | total++; | 101 | total++; |
@@ -603,9 +600,6 @@ void __init mem_init(void) | |||
603 | reserved_pages = free_pages = 0; | 600 | reserved_pages = free_pages = 0; |
604 | 601 | ||
605 | for_each_online_node(node) { | 602 | for_each_online_node(node) { |
606 | pg_data_t *n = NODE_DATA(node); | ||
607 | struct page *map = pgdat_page_nr(n, 0) - n->node_start_pfn; | ||
608 | |||
609 | for_each_nodebank(i, &meminfo, node) { | 603 | for_each_nodebank(i, &meminfo, node) { |
610 | struct membank *bank = &meminfo.bank[i]; | 604 | struct membank *bank = &meminfo.bank[i]; |
611 | unsigned int pfn1, pfn2; | 605 | unsigned int pfn1, pfn2; |
@@ -614,8 +608,8 @@ void __init mem_init(void) | |||
614 | pfn1 = bank_pfn_start(bank); | 608 | pfn1 = bank_pfn_start(bank); |
615 | pfn2 = bank_pfn_end(bank); | 609 | pfn2 = bank_pfn_end(bank); |
616 | 610 | ||
617 | page = map + pfn1; | 611 | page = pfn_to_page(pfn1); |
618 | end = map + pfn2; | 612 | end = pfn_to_page(pfn2 - 1) + 1; |
619 | 613 | ||
620 | do { | 614 | do { |
621 | if (PageReserved(page)) | 615 | if (PageReserved(page)) |
diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c index 9bfeb6b9509a..33b327379f07 100644 --- a/arch/arm/mm/nommu.c +++ b/arch/arm/mm/nommu.c | |||
@@ -65,6 +65,15 @@ void flush_dcache_page(struct page *page) | |||
65 | } | 65 | } |
66 | EXPORT_SYMBOL(flush_dcache_page); | 66 | EXPORT_SYMBOL(flush_dcache_page); |
67 | 67 | ||
68 | void copy_to_user_page(struct vm_area_struct *vma, struct page *page, | ||
69 | unsigned long uaddr, void *dst, const void *src, | ||
70 | unsigned long len) | ||
71 | { | ||
72 | memcpy(dst, src, len); | ||
73 | if (vma->vm_flags & VM_EXEC) | ||
74 | __cpuc_coherent_user_range(uaddr, uaddr + len); | ||
75 | } | ||
76 | |||
68 | void __iomem *__arm_ioremap_pfn(unsigned long pfn, unsigned long offset, | 77 | void __iomem *__arm_ioremap_pfn(unsigned long pfn, unsigned long offset, |
69 | size_t size, unsigned int mtype) | 78 | size_t size, unsigned int mtype) |
70 | { | 79 | { |
@@ -87,8 +96,8 @@ void __iomem *__arm_ioremap(unsigned long phys_addr, size_t size, | |||
87 | } | 96 | } |
88 | EXPORT_SYMBOL(__arm_ioremap); | 97 | EXPORT_SYMBOL(__arm_ioremap); |
89 | 98 | ||
90 | void __iomem *__arm_ioremap(unsigned long phys_addr, size_t size, | 99 | void __iomem *__arm_ioremap_caller(unsigned long phys_addr, size_t size, |
91 | unsigned int mtype, void *caller) | 100 | unsigned int mtype, void *caller) |
92 | { | 101 | { |
93 | return __arm_ioremap(phys_addr, size, mtype); | 102 | return __arm_ioremap(phys_addr, size, mtype); |
94 | } | 103 | } |
diff --git a/arch/arm/mm/tlb-v7.S b/arch/arm/mm/tlb-v7.S index 0cb1848bd876..f3f288a9546d 100644 --- a/arch/arm/mm/tlb-v7.S +++ b/arch/arm/mm/tlb-v7.S | |||
@@ -50,7 +50,11 @@ ENTRY(v7wbi_flush_user_tlb_range) | |||
50 | cmp r0, r1 | 50 | cmp r0, r1 |
51 | blo 1b | 51 | blo 1b |
52 | mov ip, #0 | 52 | mov ip, #0 |
53 | #ifdef CONFIG_SMP | ||
54 | mcr p15, 0, ip, c7, c1, 6 @ flush BTAC/BTB Inner Shareable | ||
55 | #else | ||
53 | mcr p15, 0, ip, c7, c5, 6 @ flush BTAC/BTB | 56 | mcr p15, 0, ip, c7, c5, 6 @ flush BTAC/BTB |
57 | #endif | ||
54 | dsb | 58 | dsb |
55 | mov pc, lr | 59 | mov pc, lr |
56 | ENDPROC(v7wbi_flush_user_tlb_range) | 60 | ENDPROC(v7wbi_flush_user_tlb_range) |
@@ -79,7 +83,11 @@ ENTRY(v7wbi_flush_kern_tlb_range) | |||
79 | cmp r0, r1 | 83 | cmp r0, r1 |
80 | blo 1b | 84 | blo 1b |
81 | mov r2, #0 | 85 | mov r2, #0 |
86 | #ifdef CONFIG_SMP | ||
87 | mcr p15, 0, r2, c7, c1, 6 @ flush BTAC/BTB Inner Shareable | ||
88 | #else | ||
82 | mcr p15, 0, r2, c7, c5, 6 @ flush BTAC/BTB | 89 | mcr p15, 0, r2, c7, c5, 6 @ flush BTAC/BTB |
90 | #endif | ||
83 | dsb | 91 | dsb |
84 | isb | 92 | isb |
85 | mov pc, lr | 93 | mov pc, lr |
diff --git a/arch/arm/plat-mxc/include/mach/dma-mx1-mx2.h b/arch/arm/plat-mxc/include/mach/dma-mx1-mx2.h index 07be8ad7ec37..7c4870bd5a21 100644 --- a/arch/arm/plat-mxc/include/mach/dma-mx1-mx2.h +++ b/arch/arm/plat-mxc/include/mach/dma-mx1-mx2.h | |||
@@ -31,7 +31,13 @@ | |||
31 | #define DMA_MODE_WRITE 1 | 31 | #define DMA_MODE_WRITE 1 |
32 | #define DMA_MODE_MASK 1 | 32 | #define DMA_MODE_MASK 1 |
33 | 33 | ||
34 | #define DMA_BASE IO_ADDRESS(DMA_BASE_ADDR) | 34 | #define MX1_DMA_REG(offset) MX1_IO_ADDRESS(MX1_DMA_BASE_ADDR + (offset)) |
35 | |||
36 | /* DMA Interrupt Mask Register */ | ||
37 | #define MX1_DMA_DIMR MX1_DMA_REG(0x08) | ||
38 | |||
39 | /* Channel Control Register */ | ||
40 | #define MX1_DMA_CCR(x) MX1_DMA_REG(0x8c + ((x) << 6)) | ||
35 | 41 | ||
36 | #define IMX_DMA_MEMSIZE_32 (0 << 4) | 42 | #define IMX_DMA_MEMSIZE_32 (0 << 4) |
37 | #define IMX_DMA_MEMSIZE_8 (1 << 4) | 43 | #define IMX_DMA_MEMSIZE_8 (1 << 4) |
diff --git a/arch/arm/plat-pxa/dma.c b/arch/arm/plat-pxa/dma.c index 742350e0f2a7..2d3c19d7c7b1 100644 --- a/arch/arm/plat-pxa/dma.c +++ b/arch/arm/plat-pxa/dma.c | |||
@@ -245,7 +245,7 @@ static void pxa_dma_init_debugfs(void) | |||
245 | 245 | ||
246 | dbgfs_chan = kmalloc(sizeof(*dbgfs_state) * num_dma_channels, | 246 | dbgfs_chan = kmalloc(sizeof(*dbgfs_state) * num_dma_channels, |
247 | GFP_KERNEL); | 247 | GFP_KERNEL); |
248 | if (!dbgfs_state) | 248 | if (!dbgfs_chan) |
249 | goto err_alloc; | 249 | goto err_alloc; |
250 | 250 | ||
251 | chandir = debugfs_create_dir("channels", dbgfs_root); | 251 | chandir = debugfs_create_dir("channels", dbgfs_root); |
diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types index 1536f1784cac..8f10d24ae625 100644 --- a/arch/arm/tools/mach-types +++ b/arch/arm/tools/mach-types | |||
@@ -12,7 +12,7 @@ | |||
12 | # | 12 | # |
13 | # http://www.arm.linux.org.uk/developer/machines/?action=new | 13 | # http://www.arm.linux.org.uk/developer/machines/?action=new |
14 | # | 14 | # |
15 | # Last update: Sat Mar 20 15:35:41 2010 | 15 | # Last update: Sat May 1 10:36:42 2010 |
16 | # | 16 | # |
17 | # machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number | 17 | # machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number |
18 | # | 18 | # |
@@ -2749,3 +2749,58 @@ stamp9g45 MACH_STAMP9G45 STAMP9G45 2761 | |||
2749 | h6053 MACH_H6053 H6053 2762 | 2749 | h6053 MACH_H6053 H6053 2762 |
2750 | smint01 MACH_SMINT01 SMINT01 2763 | 2750 | smint01 MACH_SMINT01 SMINT01 2763 |
2751 | prtlvt2 MACH_PRTLVT2 PRTLVT2 2764 | 2751 | prtlvt2 MACH_PRTLVT2 PRTLVT2 2764 |
2752 | ap420 MACH_AP420 AP420 2765 | ||
2753 | htcshift MACH_HTCSHIFT HTCSHIFT 2766 | ||
2754 | davinci_dm365_fc MACH_DAVINCI_DM365_FC DAVINCI_DM365_FC 2767 | ||
2755 | msm8x55_surf MACH_MSM8X55_SURF MSM8X55_SURF 2768 | ||
2756 | msm8x55_ffa MACH_MSM8X55_FFA MSM8X55_FFA 2769 | ||
2757 | esl_vamana MACH_ESL_VAMANA ESL_VAMANA 2770 | ||
2758 | sbc35 MACH_SBC35 SBC35 2771 | ||
2759 | mpx6446 MACH_MPX6446 MPX6446 2772 | ||
2760 | oreo_controller MACH_OREO_CONTROLLER OREO_CONTROLLER 2773 | ||
2761 | kopin_models MACH_KOPIN_MODELS KOPIN_MODELS 2774 | ||
2762 | ttc_vision2 MACH_TTC_VISION2 TTC_VISION2 2775 | ||
2763 | cns3420vb MACH_CNS3420VB CNS3420VB 2776 | ||
2764 | lpc2 MACH_LPC2 LPC2 2777 | ||
2765 | olympus MACH_OLYMPUS OLYMPUS 2778 | ||
2766 | vortex MACH_VORTEX VORTEX 2779 | ||
2767 | s5pc200 MACH_S5PC200 S5PC200 2780 | ||
2768 | ecucore_9263 MACH_ECUCORE_9263 ECUCORE_9263 2781 | ||
2769 | smdkc200 MACH_SMDKC200 SMDKC200 2782 | ||
2770 | emsiso_sx27 MACH_EMSISO_SX27 EMSISO_SX27 2783 | ||
2771 | apx_som9g45_ek MACH_APX_SOM9G45_EK APX_SOM9G45_EK 2784 | ||
2772 | songshan MACH_SONGSHAN SONGSHAN 2785 | ||
2773 | tianshan MACH_TIANSHAN TIANSHAN 2786 | ||
2774 | vpx500 MACH_VPX500 VPX500 2787 | ||
2775 | am3517sam MACH_AM3517SAM AM3517SAM 2788 | ||
2776 | skat91_sim508 MACH_SKAT91_SIM508 SKAT91_SIM508 2789 | ||
2777 | skat91_s3e MACH_SKAT91_S3E SKAT91_S3E 2790 | ||
2778 | omap4_panda MACH_OMAP4_PANDA OMAP4_PANDA 2791 | ||
2779 | df7220 MACH_DF7220 DF7220 2792 | ||
2780 | nemini MACH_NEMINI NEMINI 2793 | ||
2781 | t8200 MACH_T8200 T8200 2794 | ||
2782 | apf51 MACH_APF51 APF51 2795 | ||
2783 | dr_rc_unit MACH_DR_RC_UNIT DR_RC_UNIT 2796 | ||
2784 | bordeaux MACH_BORDEAUX BORDEAUX 2797 | ||
2785 | catania_b MACH_CATANIA_B CATANIA_B 2798 | ||
2786 | mx51_ocean MACH_MX51_OCEAN MX51_OCEAN 2799 | ||
2787 | ti8168evm MACH_TI8168EVM TI8168EVM 2800 | ||
2788 | neocoreomap MACH_NEOCOREOMAP NEOCOREOMAP 2801 | ||
2789 | withings_wbp MACH_WITHINGS_WBP WITHINGS_WBP 2802 | ||
2790 | dbps MACH_DBPS DBPS 2803 | ||
2791 | sbc9261 MACH_SBC9261 SBC9261 2804 | ||
2792 | pcbfp0001 MACH_PCBFP0001 PCBFP0001 2805 | ||
2793 | speedy MACH_SPEEDY SPEEDY 2806 | ||
2794 | chrysaor MACH_CHRYSAOR CHRYSAOR 2807 | ||
2795 | tango MACH_TANGO TANGO 2808 | ||
2796 | synology_dsx11 MACH_SYNOLOGY_DSX11 SYNOLOGY_DSX11 2809 | ||
2797 | hanlin_v3ext MACH_HANLIN_V3EXT HANLIN_V3EXT 2810 | ||
2798 | hanlin_v5 MACH_HANLIN_V5 HANLIN_V5 2811 | ||
2799 | hanlin_v3plus MACH_HANLIN_V3PLUS HANLIN_V3PLUS 2812 | ||
2800 | iriver_story MACH_IRIVER_STORY IRIVER_STORY 2813 | ||
2801 | irex_iliad MACH_IREX_ILIAD IREX_ILIAD 2814 | ||
2802 | irex_dr1000 MACH_IREX_DR1000 IREX_DR1000 2815 | ||
2803 | teton_bga MACH_TETON_BGA TETON_BGA 2816 | ||
2804 | snapper9g45 MACH_SNAPPER9G45 SNAPPER9G45 2817 | ||
2805 | tam3517 MACH_TAM3517 TAM3517 2818 | ||
2806 | pdc100 MACH_PDC100 PDC100 2819 | ||
diff --git a/arch/avr32/include/asm/atomic.h b/arch/avr32/include/asm/atomic.h index b131c27ddf57..bbce6a1c6bb6 100644 --- a/arch/avr32/include/asm/atomic.h +++ b/arch/avr32/include/asm/atomic.h | |||
@@ -19,7 +19,7 @@ | |||
19 | 19 | ||
20 | #define ATOMIC_INIT(i) { (i) } | 20 | #define ATOMIC_INIT(i) { (i) } |
21 | 21 | ||
22 | #define atomic_read(v) ((v)->counter) | 22 | #define atomic_read(v) (*(volatile int *)&(v)->counter) |
23 | #define atomic_set(v, i) (((v)->counter) = i) | 23 | #define atomic_set(v, i) (((v)->counter) = i) |
24 | 24 | ||
25 | /* | 25 | /* |
diff --git a/arch/cris/include/asm/atomic.h b/arch/cris/include/asm/atomic.h index a6aca819e9f3..88dc9b9c4ba0 100644 --- a/arch/cris/include/asm/atomic.h +++ b/arch/cris/include/asm/atomic.h | |||
@@ -15,7 +15,7 @@ | |||
15 | 15 | ||
16 | #define ATOMIC_INIT(i) { (i) } | 16 | #define ATOMIC_INIT(i) { (i) } |
17 | 17 | ||
18 | #define atomic_read(v) ((v)->counter) | 18 | #define atomic_read(v) (*(volatile int *)&(v)->counter) |
19 | #define atomic_set(v,i) (((v)->counter) = (i)) | 19 | #define atomic_set(v,i) (((v)->counter) = (i)) |
20 | 20 | ||
21 | /* These should be written in asm but we do it in C for now. */ | 21 | /* These should be written in asm but we do it in C for now. */ |
diff --git a/arch/frv/include/asm/atomic.h b/arch/frv/include/asm/atomic.h index 00a57af79afc..fae32c7fdcb6 100644 --- a/arch/frv/include/asm/atomic.h +++ b/arch/frv/include/asm/atomic.h | |||
@@ -36,7 +36,7 @@ | |||
36 | #define smp_mb__after_atomic_inc() barrier() | 36 | #define smp_mb__after_atomic_inc() barrier() |
37 | 37 | ||
38 | #define ATOMIC_INIT(i) { (i) } | 38 | #define ATOMIC_INIT(i) { (i) } |
39 | #define atomic_read(v) ((v)->counter) | 39 | #define atomic_read(v) (*(volatile int *)&(v)->counter) |
40 | #define atomic_set(v, i) (((v)->counter) = (i)) | 40 | #define atomic_set(v, i) (((v)->counter) = (i)) |
41 | 41 | ||
42 | #ifndef CONFIG_FRV_OUTOFLINE_ATOMIC_OPS | 42 | #ifndef CONFIG_FRV_OUTOFLINE_ATOMIC_OPS |
diff --git a/arch/h8300/include/asm/atomic.h b/arch/h8300/include/asm/atomic.h index 33c8c0fa9583..e936804b7508 100644 --- a/arch/h8300/include/asm/atomic.h +++ b/arch/h8300/include/asm/atomic.h | |||
@@ -10,7 +10,7 @@ | |||
10 | 10 | ||
11 | #define ATOMIC_INIT(i) { (i) } | 11 | #define ATOMIC_INIT(i) { (i) } |
12 | 12 | ||
13 | #define atomic_read(v) ((v)->counter) | 13 | #define atomic_read(v) (*(volatile int *)&(v)->counter) |
14 | #define atomic_set(v, i) (((v)->counter) = i) | 14 | #define atomic_set(v, i) (((v)->counter) = i) |
15 | 15 | ||
16 | #include <asm/system.h> | 16 | #include <asm/system.h> |
diff --git a/arch/ia64/include/asm/atomic.h b/arch/ia64/include/asm/atomic.h index 88405cb0832a..4e1948447a00 100644 --- a/arch/ia64/include/asm/atomic.h +++ b/arch/ia64/include/asm/atomic.h | |||
@@ -21,8 +21,8 @@ | |||
21 | #define ATOMIC_INIT(i) ((atomic_t) { (i) }) | 21 | #define ATOMIC_INIT(i) ((atomic_t) { (i) }) |
22 | #define ATOMIC64_INIT(i) ((atomic64_t) { (i) }) | 22 | #define ATOMIC64_INIT(i) ((atomic64_t) { (i) }) |
23 | 23 | ||
24 | #define atomic_read(v) ((v)->counter) | 24 | #define atomic_read(v) (*(volatile int *)&(v)->counter) |
25 | #define atomic64_read(v) ((v)->counter) | 25 | #define atomic64_read(v) (*(volatile long *)&(v)->counter) |
26 | 26 | ||
27 | #define atomic_set(v,i) (((v)->counter) = (i)) | 27 | #define atomic_set(v,i) (((v)->counter) = (i)) |
28 | #define atomic64_set(v,i) (((v)->counter) = (i)) | 28 | #define atomic64_set(v,i) (((v)->counter) = (i)) |
diff --git a/arch/ia64/include/asm/bitops.h b/arch/ia64/include/asm/bitops.h index 6ebc229a1c51..9da3df6f1a52 100644 --- a/arch/ia64/include/asm/bitops.h +++ b/arch/ia64/include/asm/bitops.h | |||
@@ -437,17 +437,18 @@ __fls (unsigned long x) | |||
437 | * hweightN: returns the hamming weight (i.e. the number | 437 | * hweightN: returns the hamming weight (i.e. the number |
438 | * of bits set) of a N-bit word | 438 | * of bits set) of a N-bit word |
439 | */ | 439 | */ |
440 | static __inline__ unsigned long | 440 | static __inline__ unsigned long __arch_hweight64(unsigned long x) |
441 | hweight64 (unsigned long x) | ||
442 | { | 441 | { |
443 | unsigned long result; | 442 | unsigned long result; |
444 | result = ia64_popcnt(x); | 443 | result = ia64_popcnt(x); |
445 | return result; | 444 | return result; |
446 | } | 445 | } |
447 | 446 | ||
448 | #define hweight32(x) (unsigned int) hweight64((x) & 0xfffffffful) | 447 | #define __arch_hweight32(x) ((unsigned int) __arch_hweight64((x) & 0xfffffffful)) |
449 | #define hweight16(x) (unsigned int) hweight64((x) & 0xfffful) | 448 | #define __arch_hweight16(x) ((unsigned int) __arch_hweight64((x) & 0xfffful)) |
450 | #define hweight8(x) (unsigned int) hweight64((x) & 0xfful) | 449 | #define __arch_hweight8(x) ((unsigned int) __arch_hweight64((x) & 0xfful)) |
450 | |||
451 | #include <asm-generic/bitops/const_hweight.h> | ||
451 | 452 | ||
452 | #endif /* __KERNEL__ */ | 453 | #endif /* __KERNEL__ */ |
453 | 454 | ||
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c index 4d1a7e9314cf..c6c90f39f4d9 100644 --- a/arch/ia64/kernel/acpi.c +++ b/arch/ia64/kernel/acpi.c | |||
@@ -785,6 +785,14 @@ int acpi_gsi_to_irq(u32 gsi, unsigned int *irq) | |||
785 | return 0; | 785 | return 0; |
786 | } | 786 | } |
787 | 787 | ||
788 | int acpi_isa_irq_to_gsi(unsigned isa_irq, u32 *gsi) | ||
789 | { | ||
790 | if (isa_irq >= 16) | ||
791 | return -1; | ||
792 | *gsi = isa_irq; | ||
793 | return 0; | ||
794 | } | ||
795 | |||
788 | /* | 796 | /* |
789 | * ACPI based hotplug CPU support | 797 | * ACPI based hotplug CPU support |
790 | */ | 798 | */ |
diff --git a/arch/m32r/include/asm/atomic.h b/arch/m32r/include/asm/atomic.h index 63f0cf0f50dd..d44a51e5271b 100644 --- a/arch/m32r/include/asm/atomic.h +++ b/arch/m32r/include/asm/atomic.h | |||
@@ -26,7 +26,7 @@ | |||
26 | * | 26 | * |
27 | * Atomically reads the value of @v. | 27 | * Atomically reads the value of @v. |
28 | */ | 28 | */ |
29 | #define atomic_read(v) ((v)->counter) | 29 | #define atomic_read(v) (*(volatile int *)&(v)->counter) |
30 | 30 | ||
31 | /** | 31 | /** |
32 | * atomic_set - set atomic variable | 32 | * atomic_set - set atomic variable |
diff --git a/arch/m68k/amiga/Makefile b/arch/m68k/amiga/Makefile index 6a0d7650f980..11dd30b16b3b 100644 --- a/arch/m68k/amiga/Makefile +++ b/arch/m68k/amiga/Makefile | |||
@@ -2,6 +2,6 @@ | |||
2 | # Makefile for Linux arch/m68k/amiga source directory | 2 | # Makefile for Linux arch/m68k/amiga source directory |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y := config.o amiints.o cia.o chipram.o amisound.o | 5 | obj-y := config.o amiints.o cia.o chipram.o amisound.o platform.o |
6 | 6 | ||
7 | obj-$(CONFIG_AMIGA_PCMCIA) += pcmcia.o | 7 | obj-$(CONFIG_AMIGA_PCMCIA) += pcmcia.o |
diff --git a/arch/m68k/amiga/platform.c b/arch/m68k/amiga/platform.c new file mode 100644 index 000000000000..38f18bf14737 --- /dev/null +++ b/arch/m68k/amiga/platform.c | |||
@@ -0,0 +1,83 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2007-2009 Geert Uytterhoeven | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file COPYING in the main directory of this archive | ||
6 | * for more details. | ||
7 | */ | ||
8 | |||
9 | #include <linux/init.h> | ||
10 | #include <linux/platform_device.h> | ||
11 | #include <linux/zorro.h> | ||
12 | |||
13 | #include <asm/amigahw.h> | ||
14 | |||
15 | |||
16 | #ifdef CONFIG_ZORRO | ||
17 | |||
18 | static const struct resource zorro_resources[] __initconst = { | ||
19 | /* Zorro II regions (on Zorro II/III) */ | ||
20 | { | ||
21 | .name = "Zorro II exp", | ||
22 | .start = 0x00e80000, | ||
23 | .end = 0x00efffff, | ||
24 | .flags = IORESOURCE_MEM, | ||
25 | }, { | ||
26 | .name = "Zorro II mem", | ||
27 | .start = 0x00200000, | ||
28 | .end = 0x009fffff, | ||
29 | .flags = IORESOURCE_MEM, | ||
30 | }, | ||
31 | /* Zorro III regions (on Zorro III only) */ | ||
32 | { | ||
33 | .name = "Zorro III exp", | ||
34 | .start = 0xff000000, | ||
35 | .end = 0xffffffff, | ||
36 | .flags = IORESOURCE_MEM, | ||
37 | }, { | ||
38 | .name = "Zorro III cfg", | ||
39 | .start = 0x40000000, | ||
40 | .end = 0x7fffffff, | ||
41 | .flags = IORESOURCE_MEM, | ||
42 | } | ||
43 | }; | ||
44 | |||
45 | |||
46 | static int __init amiga_init_bus(void) | ||
47 | { | ||
48 | if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(ZORRO)) | ||
49 | return -ENODEV; | ||
50 | |||
51 | platform_device_register_simple("amiga-zorro", -1, zorro_resources, | ||
52 | AMIGAHW_PRESENT(ZORRO3) ? 4 : 2); | ||
53 | return 0; | ||
54 | } | ||
55 | |||
56 | subsys_initcall(amiga_init_bus); | ||
57 | |||
58 | #endif /* CONFIG_ZORRO */ | ||
59 | |||
60 | |||
61 | static int __init amiga_init_devices(void) | ||
62 | { | ||
63 | if (!MACH_IS_AMIGA) | ||
64 | return -ENODEV; | ||
65 | |||
66 | /* video hardware */ | ||
67 | if (AMIGAHW_PRESENT(AMI_VIDEO)) | ||
68 | platform_device_register_simple("amiga-video", -1, NULL, 0); | ||
69 | |||
70 | |||
71 | /* sound hardware */ | ||
72 | if (AMIGAHW_PRESENT(AMI_AUDIO)) | ||
73 | platform_device_register_simple("amiga-audio", -1, NULL, 0); | ||
74 | |||
75 | |||
76 | /* storage interfaces */ | ||
77 | if (AMIGAHW_PRESENT(AMI_FLOPPY)) | ||
78 | platform_device_register_simple("amiga-floppy", -1, NULL, 0); | ||
79 | |||
80 | return 0; | ||
81 | } | ||
82 | |||
83 | device_initcall(amiga_init_devices); | ||
diff --git a/arch/m68k/bvme6000/rtc.c b/arch/m68k/bvme6000/rtc.c index b46ea1714a89..cb8617bb194b 100644 --- a/arch/m68k/bvme6000/rtc.c +++ b/arch/m68k/bvme6000/rtc.c | |||
@@ -9,7 +9,6 @@ | |||
9 | #include <linux/types.h> | 9 | #include <linux/types.h> |
10 | #include <linux/errno.h> | 10 | #include <linux/errno.h> |
11 | #include <linux/miscdevice.h> | 11 | #include <linux/miscdevice.h> |
12 | #include <linux/smp_lock.h> | ||
13 | #include <linux/ioport.h> | 12 | #include <linux/ioport.h> |
14 | #include <linux/capability.h> | 13 | #include <linux/capability.h> |
15 | #include <linux/fcntl.h> | 14 | #include <linux/fcntl.h> |
@@ -35,10 +34,9 @@ | |||
35 | static unsigned char days_in_mo[] = | 34 | static unsigned char days_in_mo[] = |
36 | {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; | 35 | {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; |
37 | 36 | ||
38 | static char rtc_status; | 37 | static atomic_t rtc_status = ATOMIC_INIT(1); |
39 | 38 | ||
40 | static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | 39 | static long rtc_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
41 | unsigned long arg) | ||
42 | { | 40 | { |
43 | volatile RtcPtr_t rtc = (RtcPtr_t)BVME_RTC_BASE; | 41 | volatile RtcPtr_t rtc = (RtcPtr_t)BVME_RTC_BASE; |
44 | unsigned char msr; | 42 | unsigned char msr; |
@@ -132,29 +130,20 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | |||
132 | } | 130 | } |
133 | 131 | ||
134 | /* | 132 | /* |
135 | * We enforce only one user at a time here with the open/close. | 133 | * We enforce only one user at a time here with the open/close. |
136 | * Also clear the previous interrupt data on an open, and clean | ||
137 | * up things on a close. | ||
138 | */ | 134 | */ |
139 | |||
140 | static int rtc_open(struct inode *inode, struct file *file) | 135 | static int rtc_open(struct inode *inode, struct file *file) |
141 | { | 136 | { |
142 | lock_kernel(); | 137 | if (!atomic_dec_and_test(&rtc_status)) { |
143 | if(rtc_status) { | 138 | atomic_inc(&rtc_status); |
144 | unlock_kernel(); | ||
145 | return -EBUSY; | 139 | return -EBUSY; |
146 | } | 140 | } |
147 | |||
148 | rtc_status = 1; | ||
149 | unlock_kernel(); | ||
150 | return 0; | 141 | return 0; |
151 | } | 142 | } |
152 | 143 | ||
153 | static int rtc_release(struct inode *inode, struct file *file) | 144 | static int rtc_release(struct inode *inode, struct file *file) |
154 | { | 145 | { |
155 | lock_kernel(); | 146 | atomic_inc(&rtc_status); |
156 | rtc_status = 0; | ||
157 | unlock_kernel(); | ||
158 | return 0; | 147 | return 0; |
159 | } | 148 | } |
160 | 149 | ||
@@ -163,9 +152,9 @@ static int rtc_release(struct inode *inode, struct file *file) | |||
163 | */ | 152 | */ |
164 | 153 | ||
165 | static const struct file_operations rtc_fops = { | 154 | static const struct file_operations rtc_fops = { |
166 | .ioctl = rtc_ioctl, | 155 | .unlocked_ioctl = rtc_ioctl, |
167 | .open = rtc_open, | 156 | .open = rtc_open, |
168 | .release = rtc_release, | 157 | .release = rtc_release, |
169 | }; | 158 | }; |
170 | 159 | ||
171 | static struct miscdevice rtc_dev = { | 160 | static struct miscdevice rtc_dev = { |
diff --git a/arch/m68k/hp300/time.h b/arch/m68k/hp300/time.h index f5b3d098b0f5..7b98242960de 100644 --- a/arch/m68k/hp300/time.h +++ b/arch/m68k/hp300/time.h | |||
@@ -1,4 +1,2 @@ | |||
1 | extern void hp300_sched_init(irq_handler_t vector); | 1 | extern void hp300_sched_init(irq_handler_t vector); |
2 | extern unsigned long hp300_gettimeoffset (void); | 2 | extern unsigned long hp300_gettimeoffset(void); |
3 | |||
4 | |||
diff --git a/arch/m68k/include/asm/atomic_mm.h b/arch/m68k/include/asm/atomic_mm.h index d9d2ed647435..6a223b3f7e74 100644 --- a/arch/m68k/include/asm/atomic_mm.h +++ b/arch/m68k/include/asm/atomic_mm.h | |||
@@ -15,7 +15,7 @@ | |||
15 | 15 | ||
16 | #define ATOMIC_INIT(i) { (i) } | 16 | #define ATOMIC_INIT(i) { (i) } |
17 | 17 | ||
18 | #define atomic_read(v) ((v)->counter) | 18 | #define atomic_read(v) (*(volatile int *)&(v)->counter) |
19 | #define atomic_set(v, i) (((v)->counter) = i) | 19 | #define atomic_set(v, i) (((v)->counter) = i) |
20 | 20 | ||
21 | static inline void atomic_add(int i, atomic_t *v) | 21 | static inline void atomic_add(int i, atomic_t *v) |
diff --git a/arch/m68k/include/asm/atomic_no.h b/arch/m68k/include/asm/atomic_no.h index 5674cb9449bd..289310c63a8a 100644 --- a/arch/m68k/include/asm/atomic_no.h +++ b/arch/m68k/include/asm/atomic_no.h | |||
@@ -15,7 +15,7 @@ | |||
15 | 15 | ||
16 | #define ATOMIC_INIT(i) { (i) } | 16 | #define ATOMIC_INIT(i) { (i) } |
17 | 17 | ||
18 | #define atomic_read(v) ((v)->counter) | 18 | #define atomic_read(v) (*(volatile int *)&(v)->counter) |
19 | #define atomic_set(v, i) (((v)->counter) = i) | 19 | #define atomic_set(v, i) (((v)->counter) = i) |
20 | 20 | ||
21 | static __inline__ void atomic_add(int i, atomic_t *v) | 21 | static __inline__ void atomic_add(int i, atomic_t *v) |
diff --git a/arch/m68k/include/asm/bitops_mm.h b/arch/m68k/include/asm/bitops_mm.h index 9bde784e7bad..b4ecdaada520 100644 --- a/arch/m68k/include/asm/bitops_mm.h +++ b/arch/m68k/include/asm/bitops_mm.h | |||
@@ -365,6 +365,10 @@ static inline int minix_test_bit(int nr, const void *vaddr) | |||
365 | #define ext2_set_bit_atomic(lock, nr, addr) test_and_set_bit((nr) ^ 24, (unsigned long *)(addr)) | 365 | #define ext2_set_bit_atomic(lock, nr, addr) test_and_set_bit((nr) ^ 24, (unsigned long *)(addr)) |
366 | #define ext2_clear_bit(nr, addr) __test_and_clear_bit((nr) ^ 24, (unsigned long *)(addr)) | 366 | #define ext2_clear_bit(nr, addr) __test_and_clear_bit((nr) ^ 24, (unsigned long *)(addr)) |
367 | #define ext2_clear_bit_atomic(lock, nr, addr) test_and_clear_bit((nr) ^ 24, (unsigned long *)(addr)) | 367 | #define ext2_clear_bit_atomic(lock, nr, addr) test_and_clear_bit((nr) ^ 24, (unsigned long *)(addr)) |
368 | #define ext2_find_next_zero_bit(addr, size, offset) \ | ||
369 | generic_find_next_zero_le_bit((unsigned long *)addr, size, offset) | ||
370 | #define ext2_find_next_bit(addr, size, offset) \ | ||
371 | generic_find_next_le_bit((unsigned long *)addr, size, offset) | ||
368 | 372 | ||
369 | static inline int ext2_test_bit(int nr, const void *vaddr) | 373 | static inline int ext2_test_bit(int nr, const void *vaddr) |
370 | { | 374 | { |
@@ -394,10 +398,9 @@ static inline int ext2_find_first_zero_bit(const void *vaddr, unsigned size) | |||
394 | return (p - addr) * 32 + res; | 398 | return (p - addr) * 32 + res; |
395 | } | 399 | } |
396 | 400 | ||
397 | static inline int ext2_find_next_zero_bit(const void *vaddr, unsigned size, | 401 | static inline unsigned long generic_find_next_zero_le_bit(const unsigned long *addr, |
398 | unsigned offset) | 402 | unsigned long size, unsigned long offset) |
399 | { | 403 | { |
400 | const unsigned long *addr = vaddr; | ||
401 | const unsigned long *p = addr + (offset >> 5); | 404 | const unsigned long *p = addr + (offset >> 5); |
402 | int bit = offset & 31UL, res; | 405 | int bit = offset & 31UL, res; |
403 | 406 | ||
@@ -437,10 +440,9 @@ static inline int ext2_find_first_bit(const void *vaddr, unsigned size) | |||
437 | return (p - addr) * 32 + res; | 440 | return (p - addr) * 32 + res; |
438 | } | 441 | } |
439 | 442 | ||
440 | static inline int ext2_find_next_bit(const void *vaddr, unsigned size, | 443 | static inline unsigned long generic_find_next_le_bit(const unsigned long *addr, |
441 | unsigned offset) | 444 | unsigned long size, unsigned long offset) |
442 | { | 445 | { |
443 | const unsigned long *addr = vaddr; | ||
444 | const unsigned long *p = addr + (offset >> 5); | 446 | const unsigned long *p = addr + (offset >> 5); |
445 | int bit = offset & 31UL, res; | 447 | int bit = offset & 31UL, res; |
446 | 448 | ||
diff --git a/arch/m68k/include/asm/param.h b/arch/m68k/include/asm/param.h index 85c41b75aa78..36265ccf5c7b 100644 --- a/arch/m68k/include/asm/param.h +++ b/arch/m68k/include/asm/param.h | |||
@@ -1,26 +1,12 @@ | |||
1 | #ifndef _M68K_PARAM_H | 1 | #ifndef _M68K_PARAM_H |
2 | #define _M68K_PARAM_H | 2 | #define _M68K_PARAM_H |
3 | 3 | ||
4 | #ifdef __KERNEL__ | ||
5 | # define HZ CONFIG_HZ /* Internal kernel timer frequency */ | ||
6 | # define USER_HZ 100 /* .. some user interfaces are in "ticks" */ | ||
7 | # define CLOCKS_PER_SEC (USER_HZ) /* like times() */ | ||
8 | #endif | ||
9 | |||
10 | #ifndef HZ | ||
11 | #define HZ 100 | ||
12 | #endif | ||
13 | |||
14 | #ifdef __uClinux__ | 4 | #ifdef __uClinux__ |
15 | #define EXEC_PAGESIZE 4096 | 5 | #define EXEC_PAGESIZE 4096 |
16 | #else | 6 | #else |
17 | #define EXEC_PAGESIZE 8192 | 7 | #define EXEC_PAGESIZE 8192 |
18 | #endif | 8 | #endif |
19 | 9 | ||
20 | #ifndef NOGROUP | 10 | #include <asm-generic/param.h> |
21 | #define NOGROUP (-1) | ||
22 | #endif | ||
23 | |||
24 | #define MAXHOSTNAMELEN 64 /* max length of hostname */ | ||
25 | 11 | ||
26 | #endif /* _M68K_PARAM_H */ | 12 | #endif /* _M68K_PARAM_H */ |
diff --git a/arch/m68k/kernel/traps.c b/arch/m68k/kernel/traps.c index aacd6d17b833..ada4f4cca811 100644 --- a/arch/m68k/kernel/traps.c +++ b/arch/m68k/kernel/traps.c | |||
@@ -455,7 +455,7 @@ static inline void access_error040(struct frame *fp) | |||
455 | 455 | ||
456 | if (do_page_fault(&fp->ptregs, addr, errorcode)) { | 456 | if (do_page_fault(&fp->ptregs, addr, errorcode)) { |
457 | #ifdef DEBUG | 457 | #ifdef DEBUG |
458 | printk("do_page_fault() !=0 \n"); | 458 | printk("do_page_fault() !=0\n"); |
459 | #endif | 459 | #endif |
460 | if (user_mode(&fp->ptregs)){ | 460 | if (user_mode(&fp->ptregs)){ |
461 | /* delay writebacks after signal delivery */ | 461 | /* delay writebacks after signal delivery */ |
diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c index 0356da9bf763..1c16b1baf8db 100644 --- a/arch/m68k/mac/config.c +++ b/arch/m68k/mac/config.c | |||
@@ -148,7 +148,7 @@ static void mac_cache_card_flush(int writeback) | |||
148 | void __init config_mac(void) | 148 | void __init config_mac(void) |
149 | { | 149 | { |
150 | if (!MACH_IS_MAC) | 150 | if (!MACH_IS_MAC) |
151 | printk(KERN_ERR "ERROR: no Mac, but config_mac() called!! \n"); | 151 | printk(KERN_ERR "ERROR: no Mac, but config_mac() called!!\n"); |
152 | 152 | ||
153 | mach_sched_init = mac_sched_init; | 153 | mach_sched_init = mac_sched_init; |
154 | mach_init_IRQ = mac_init_IRQ; | 154 | mach_init_IRQ = mac_init_IRQ; |
@@ -867,7 +867,7 @@ static void __init mac_identify(void) | |||
867 | */ | 867 | */ |
868 | iop_preinit(); | 868 | iop_preinit(); |
869 | 869 | ||
870 | printk(KERN_INFO "Detected Macintosh model: %d \n", model); | 870 | printk(KERN_INFO "Detected Macintosh model: %d\n", model); |
871 | 871 | ||
872 | /* | 872 | /* |
873 | * Report booter data: | 873 | * Report booter data: |
@@ -878,12 +878,12 @@ static void __init mac_identify(void) | |||
878 | mac_bi_data.videoaddr, mac_bi_data.videorow, | 878 | mac_bi_data.videoaddr, mac_bi_data.videorow, |
879 | mac_bi_data.videodepth, mac_bi_data.dimensions & 0xFFFF, | 879 | mac_bi_data.videodepth, mac_bi_data.dimensions & 0xFFFF, |
880 | mac_bi_data.dimensions >> 16); | 880 | mac_bi_data.dimensions >> 16); |
881 | printk(KERN_DEBUG " Videological 0x%lx phys. 0x%lx, SCC at 0x%lx \n", | 881 | printk(KERN_DEBUG " Videological 0x%lx phys. 0x%lx, SCC at 0x%lx\n", |
882 | mac_bi_data.videological, mac_orig_videoaddr, | 882 | mac_bi_data.videological, mac_orig_videoaddr, |
883 | mac_bi_data.sccbase); | 883 | mac_bi_data.sccbase); |
884 | printk(KERN_DEBUG " Boottime: 0x%lx GMTBias: 0x%lx \n", | 884 | printk(KERN_DEBUG " Boottime: 0x%lx GMTBias: 0x%lx\n", |
885 | mac_bi_data.boottime, mac_bi_data.gmtbias); | 885 | mac_bi_data.boottime, mac_bi_data.gmtbias); |
886 | printk(KERN_DEBUG " Machine ID: %ld CPUid: 0x%lx memory size: 0x%lx \n", | 886 | printk(KERN_DEBUG " Machine ID: %ld CPUid: 0x%lx memory size: 0x%lx\n", |
887 | mac_bi_data.id, mac_bi_data.cpuid, mac_bi_data.memsize); | 887 | mac_bi_data.id, mac_bi_data.cpuid, mac_bi_data.memsize); |
888 | 888 | ||
889 | iop_init(); | 889 | iop_init(); |
diff --git a/arch/m68k/mm/fault.c b/arch/m68k/mm/fault.c index d0e35cf99fc6..a96394a0333d 100644 --- a/arch/m68k/mm/fault.c +++ b/arch/m68k/mm/fault.c | |||
@@ -154,7 +154,6 @@ good_area: | |||
154 | * the fault. | 154 | * the fault. |
155 | */ | 155 | */ |
156 | 156 | ||
157 | survive: | ||
158 | fault = handle_mm_fault(mm, vma, address, write ? FAULT_FLAG_WRITE : 0); | 157 | fault = handle_mm_fault(mm, vma, address, write ? FAULT_FLAG_WRITE : 0); |
159 | #ifdef DEBUG | 158 | #ifdef DEBUG |
160 | printk("handle_mm_fault returns %d\n",fault); | 159 | printk("handle_mm_fault returns %d\n",fault); |
@@ -180,15 +179,10 @@ good_area: | |||
180 | */ | 179 | */ |
181 | out_of_memory: | 180 | out_of_memory: |
182 | up_read(&mm->mmap_sem); | 181 | up_read(&mm->mmap_sem); |
183 | if (is_global_init(current)) { | 182 | if (!user_mode(regs)) |
184 | yield(); | 183 | goto no_context; |
185 | down_read(&mm->mmap_sem); | 184 | pagefault_out_of_memory(); |
186 | goto survive; | 185 | return 0; |
187 | } | ||
188 | |||
189 | printk("VM: killing process %s\n", current->comm); | ||
190 | if (user_mode(regs)) | ||
191 | do_group_exit(SIGKILL); | ||
192 | 186 | ||
193 | no_context: | 187 | no_context: |
194 | current->thread.signo = SIGBUS; | 188 | current->thread.signo = SIGBUS; |
diff --git a/arch/m68k/mvme16x/rtc.c b/arch/m68k/mvme16x/rtc.c index 8da9c250d3e1..11ac6f63967a 100644 --- a/arch/m68k/mvme16x/rtc.c +++ b/arch/m68k/mvme16x/rtc.c | |||
@@ -9,7 +9,6 @@ | |||
9 | #include <linux/types.h> | 9 | #include <linux/types.h> |
10 | #include <linux/errno.h> | 10 | #include <linux/errno.h> |
11 | #include <linux/miscdevice.h> | 11 | #include <linux/miscdevice.h> |
12 | #include <linux/smp_lock.h> | ||
13 | #include <linux/ioport.h> | 12 | #include <linux/ioport.h> |
14 | #include <linux/capability.h> | 13 | #include <linux/capability.h> |
15 | #include <linux/fcntl.h> | 14 | #include <linux/fcntl.h> |
@@ -36,8 +35,7 @@ static const unsigned char days_in_mo[] = | |||
36 | 35 | ||
37 | static atomic_t rtc_ready = ATOMIC_INIT(1); | 36 | static atomic_t rtc_ready = ATOMIC_INIT(1); |
38 | 37 | ||
39 | static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | 38 | static long rtc_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
40 | unsigned long arg) | ||
41 | { | 39 | { |
42 | volatile MK48T08ptr_t rtc = (MK48T08ptr_t)MVME_RTC_BASE; | 40 | volatile MK48T08ptr_t rtc = (MK48T08ptr_t)MVME_RTC_BASE; |
43 | unsigned long flags; | 41 | unsigned long flags; |
@@ -120,22 +118,15 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | |||
120 | } | 118 | } |
121 | 119 | ||
122 | /* | 120 | /* |
123 | * We enforce only one user at a time here with the open/close. | 121 | * We enforce only one user at a time here with the open/close. |
124 | * Also clear the previous interrupt data on an open, and clean | ||
125 | * up things on a close. | ||
126 | */ | 122 | */ |
127 | |||
128 | static int rtc_open(struct inode *inode, struct file *file) | 123 | static int rtc_open(struct inode *inode, struct file *file) |
129 | { | 124 | { |
130 | lock_kernel(); | ||
131 | if( !atomic_dec_and_test(&rtc_ready) ) | 125 | if( !atomic_dec_and_test(&rtc_ready) ) |
132 | { | 126 | { |
133 | atomic_inc( &rtc_ready ); | 127 | atomic_inc( &rtc_ready ); |
134 | unlock_kernel(); | ||
135 | return -EBUSY; | 128 | return -EBUSY; |
136 | } | 129 | } |
137 | unlock_kernel(); | ||
138 | |||
139 | return 0; | 130 | return 0; |
140 | } | 131 | } |
141 | 132 | ||
@@ -150,9 +141,9 @@ static int rtc_release(struct inode *inode, struct file *file) | |||
150 | */ | 141 | */ |
151 | 142 | ||
152 | static const struct file_operations rtc_fops = { | 143 | static const struct file_operations rtc_fops = { |
153 | .ioctl = rtc_ioctl, | 144 | .unlocked_ioctl = rtc_ioctl, |
154 | .open = rtc_open, | 145 | .open = rtc_open, |
155 | .release = rtc_release, | 146 | .release = rtc_release, |
156 | }; | 147 | }; |
157 | 148 | ||
158 | static struct miscdevice rtc_dev= | 149 | static struct miscdevice rtc_dev= |
diff --git a/arch/m68k/q40/config.c b/arch/m68k/q40/config.c index 31ab3f08bbda..ad10fecec2fe 100644 --- a/arch/m68k/q40/config.c +++ b/arch/m68k/q40/config.c | |||
@@ -126,7 +126,7 @@ static void q40_reset(void) | |||
126 | { | 126 | { |
127 | halted = 1; | 127 | halted = 1; |
128 | printk("\n\n*******************************************\n" | 128 | printk("\n\n*******************************************\n" |
129 | "Called q40_reset : press the RESET button!! \n" | 129 | "Called q40_reset : press the RESET button!!\n" |
130 | "*******************************************\n"); | 130 | "*******************************************\n"); |
131 | Q40_LED_ON(); | 131 | Q40_LED_ON(); |
132 | while (1) | 132 | while (1) |
diff --git a/arch/microblaze/configs/mmu_defconfig b/arch/microblaze/configs/mmu_defconfig index 6fced1fe3bf0..3c91cf6192c6 100644 --- a/arch/microblaze/configs/mmu_defconfig +++ b/arch/microblaze/configs/mmu_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.33-rc6 | 3 | # Linux kernel version: 2.6.34-rc6 |
4 | # Wed Feb 3 10:02:59 2010 | 4 | # Thu May 6 11:22:14 2010 |
5 | # | 5 | # |
6 | CONFIG_MICROBLAZE=y | 6 | CONFIG_MICROBLAZE=y |
7 | # CONFIG_SWAP is not set | 7 | # CONFIG_SWAP is not set |
@@ -22,8 +22,6 @@ CONFIG_GENERIC_CSUM=y | |||
22 | CONFIG_STACKTRACE_SUPPORT=y | 22 | CONFIG_STACKTRACE_SUPPORT=y |
23 | CONFIG_LOCKDEP_SUPPORT=y | 23 | CONFIG_LOCKDEP_SUPPORT=y |
24 | CONFIG_HAVE_LATENCYTOP_SUPPORT=y | 24 | CONFIG_HAVE_LATENCYTOP_SUPPORT=y |
25 | # CONFIG_PCI is not set | ||
26 | CONFIG_NO_DMA=y | ||
27 | CONFIG_DTC=y | 25 | CONFIG_DTC=y |
28 | CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" | 26 | CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" |
29 | CONFIG_CONSTRUCTORS=y | 27 | CONFIG_CONSTRUCTORS=y |
@@ -56,7 +54,6 @@ CONFIG_RCU_FANOUT=32 | |||
56 | CONFIG_IKCONFIG=y | 54 | CONFIG_IKCONFIG=y |
57 | CONFIG_IKCONFIG_PROC=y | 55 | CONFIG_IKCONFIG_PROC=y |
58 | CONFIG_LOG_BUF_SHIFT=17 | 56 | CONFIG_LOG_BUF_SHIFT=17 |
59 | # CONFIG_GROUP_SCHED is not set | ||
60 | # CONFIG_CGROUPS is not set | 57 | # CONFIG_CGROUPS is not set |
61 | CONFIG_SYSFS_DEPRECATED=y | 58 | CONFIG_SYSFS_DEPRECATED=y |
62 | CONFIG_SYSFS_DEPRECATED_V2=y | 59 | CONFIG_SYSFS_DEPRECATED_V2=y |
@@ -106,6 +103,8 @@ CONFIG_SLAB=y | |||
106 | # CONFIG_SLOB is not set | 103 | # CONFIG_SLOB is not set |
107 | # CONFIG_PROFILING is not set | 104 | # CONFIG_PROFILING is not set |
108 | CONFIG_HAVE_OPROFILE=y | 105 | CONFIG_HAVE_OPROFILE=y |
106 | CONFIG_HAVE_DMA_ATTRS=y | ||
107 | CONFIG_HAVE_DMA_API_DEBUG=y | ||
109 | 108 | ||
110 | # | 109 | # |
111 | # GCOV-based kernel profiling | 110 | # GCOV-based kernel profiling |
@@ -245,13 +244,20 @@ CONFIG_BINFMT_ELF=y | |||
245 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set | 244 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set |
246 | # CONFIG_HAVE_AOUT is not set | 245 | # CONFIG_HAVE_AOUT is not set |
247 | # CONFIG_BINFMT_MISC is not set | 246 | # CONFIG_BINFMT_MISC is not set |
247 | |||
248 | # | ||
249 | # Bus Options | ||
250 | # | ||
251 | # CONFIG_PCI is not set | ||
252 | # CONFIG_PCI_DOMAINS is not set | ||
253 | # CONFIG_PCI_SYSCALL is not set | ||
254 | # CONFIG_ARCH_SUPPORTS_MSI is not set | ||
248 | CONFIG_NET=y | 255 | CONFIG_NET=y |
249 | 256 | ||
250 | # | 257 | # |
251 | # Networking options | 258 | # Networking options |
252 | # | 259 | # |
253 | CONFIG_PACKET=y | 260 | CONFIG_PACKET=y |
254 | # CONFIG_PACKET_MMAP is not set | ||
255 | CONFIG_UNIX=y | 261 | CONFIG_UNIX=y |
256 | CONFIG_XFRM=y | 262 | CONFIG_XFRM=y |
257 | # CONFIG_XFRM_USER is not set | 263 | # CONFIG_XFRM_USER is not set |
@@ -341,7 +347,9 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y | |||
341 | # CONFIG_SYS_HYPERVISOR is not set | 347 | # CONFIG_SYS_HYPERVISOR is not set |
342 | # CONFIG_CONNECTOR is not set | 348 | # CONFIG_CONNECTOR is not set |
343 | # CONFIG_MTD is not set | 349 | # CONFIG_MTD is not set |
350 | CONFIG_OF_FLATTREE=y | ||
344 | CONFIG_OF_DEVICE=y | 351 | CONFIG_OF_DEVICE=y |
352 | CONFIG_OF_MDIO=y | ||
345 | # CONFIG_PARPORT is not set | 353 | # CONFIG_PARPORT is not set |
346 | CONFIG_BLK_DEV=y | 354 | CONFIG_BLK_DEV=y |
347 | # CONFIG_BLK_DEV_COW_COMMON is not set | 355 | # CONFIG_BLK_DEV_COW_COMMON is not set |
@@ -370,6 +378,7 @@ CONFIG_MISC_DEVICES=y | |||
370 | # | 378 | # |
371 | # SCSI device support | 379 | # SCSI device support |
372 | # | 380 | # |
381 | CONFIG_SCSI_MOD=y | ||
373 | # CONFIG_RAID_ATTRS is not set | 382 | # CONFIG_RAID_ATTRS is not set |
374 | # CONFIG_SCSI is not set | 383 | # CONFIG_SCSI is not set |
375 | # CONFIG_SCSI_DMA is not set | 384 | # CONFIG_SCSI_DMA is not set |
@@ -383,9 +392,30 @@ CONFIG_NETDEVICES=y | |||
383 | # CONFIG_EQUALIZER is not set | 392 | # CONFIG_EQUALIZER is not set |
384 | # CONFIG_TUN is not set | 393 | # CONFIG_TUN is not set |
385 | # CONFIG_VETH is not set | 394 | # CONFIG_VETH is not set |
386 | # CONFIG_PHYLIB is not set | 395 | CONFIG_PHYLIB=y |
396 | |||
397 | # | ||
398 | # MII PHY device drivers | ||
399 | # | ||
400 | # CONFIG_MARVELL_PHY is not set | ||
401 | # CONFIG_DAVICOM_PHY is not set | ||
402 | # CONFIG_QSEMI_PHY is not set | ||
403 | # CONFIG_LXT_PHY is not set | ||
404 | # CONFIG_CICADA_PHY is not set | ||
405 | # CONFIG_VITESSE_PHY is not set | ||
406 | # CONFIG_SMSC_PHY is not set | ||
407 | # CONFIG_BROADCOM_PHY is not set | ||
408 | # CONFIG_ICPLUS_PHY is not set | ||
409 | # CONFIG_REALTEK_PHY is not set | ||
410 | # CONFIG_NATIONAL_PHY is not set | ||
411 | # CONFIG_STE10XP is not set | ||
412 | # CONFIG_LSI_ET1011C_PHY is not set | ||
413 | # CONFIG_MICREL_PHY is not set | ||
414 | # CONFIG_FIXED_PHY is not set | ||
415 | # CONFIG_MDIO_BITBANG is not set | ||
387 | CONFIG_NET_ETHERNET=y | 416 | CONFIG_NET_ETHERNET=y |
388 | # CONFIG_MII is not set | 417 | # CONFIG_MII is not set |
418 | # CONFIG_ETHOC is not set | ||
389 | # CONFIG_DNET is not set | 419 | # CONFIG_DNET is not set |
390 | # CONFIG_IBM_NEW_EMAC_ZMII is not set | 420 | # CONFIG_IBM_NEW_EMAC_ZMII is not set |
391 | # CONFIG_IBM_NEW_EMAC_RGMII is not set | 421 | # CONFIG_IBM_NEW_EMAC_RGMII is not set |
@@ -394,6 +424,7 @@ CONFIG_NET_ETHERNET=y | |||
394 | # CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set | 424 | # CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set |
395 | # CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set | 425 | # CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set |
396 | # CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set | 426 | # CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set |
427 | # CONFIG_B44 is not set | ||
397 | # CONFIG_KS8842 is not set | 428 | # CONFIG_KS8842 is not set |
398 | # CONFIG_KS8851_MLL is not set | 429 | # CONFIG_KS8851_MLL is not set |
399 | CONFIG_XILINX_EMACLITE=y | 430 | CONFIG_XILINX_EMACLITE=y |
@@ -444,6 +475,7 @@ CONFIG_SERIAL_UARTLITE=y | |||
444 | CONFIG_SERIAL_UARTLITE_CONSOLE=y | 475 | CONFIG_SERIAL_UARTLITE_CONSOLE=y |
445 | CONFIG_SERIAL_CORE=y | 476 | CONFIG_SERIAL_CORE=y |
446 | CONFIG_SERIAL_CORE_CONSOLE=y | 477 | CONFIG_SERIAL_CORE_CONSOLE=y |
478 | # CONFIG_SERIAL_TIMBERDALE is not set | ||
447 | # CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set | 479 | # CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set |
448 | CONFIG_UNIX98_PTYS=y | 480 | CONFIG_UNIX98_PTYS=y |
449 | # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set | 481 | # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set |
@@ -471,6 +503,12 @@ CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y | |||
471 | # CONFIG_HWMON is not set | 503 | # CONFIG_HWMON is not set |
472 | # CONFIG_THERMAL is not set | 504 | # CONFIG_THERMAL is not set |
473 | # CONFIG_WATCHDOG is not set | 505 | # CONFIG_WATCHDOG is not set |
506 | CONFIG_SSB_POSSIBLE=y | ||
507 | |||
508 | # | ||
509 | # Sonics Silicon Backplane | ||
510 | # | ||
511 | # CONFIG_SSB is not set | ||
474 | 512 | ||
475 | # | 513 | # |
476 | # Multifunction device drivers | 514 | # Multifunction device drivers |
@@ -502,6 +540,7 @@ CONFIG_USB_ARCH_HAS_EHCI=y | |||
502 | # CONFIG_NEW_LEDS is not set | 540 | # CONFIG_NEW_LEDS is not set |
503 | # CONFIG_ACCESSIBILITY is not set | 541 | # CONFIG_ACCESSIBILITY is not set |
504 | # CONFIG_RTC_CLASS is not set | 542 | # CONFIG_RTC_CLASS is not set |
543 | # CONFIG_DMADEVICES is not set | ||
505 | # CONFIG_AUXDISPLAY is not set | 544 | # CONFIG_AUXDISPLAY is not set |
506 | # CONFIG_UIO is not set | 545 | # CONFIG_UIO is not set |
507 | 546 | ||
@@ -572,6 +611,7 @@ CONFIG_MISC_FILESYSTEMS=y | |||
572 | # CONFIG_BEFS_FS is not set | 611 | # CONFIG_BEFS_FS is not set |
573 | # CONFIG_BFS_FS is not set | 612 | # CONFIG_BFS_FS is not set |
574 | # CONFIG_EFS_FS is not set | 613 | # CONFIG_EFS_FS is not set |
614 | # CONFIG_LOGFS is not set | ||
575 | # CONFIG_CRAMFS is not set | 615 | # CONFIG_CRAMFS is not set |
576 | # CONFIG_SQUASHFS is not set | 616 | # CONFIG_SQUASHFS is not set |
577 | # CONFIG_VXFS_FS is not set | 617 | # CONFIG_VXFS_FS is not set |
@@ -595,6 +635,7 @@ CONFIG_SUNRPC=y | |||
595 | # CONFIG_RPCSEC_GSS_KRB5 is not set | 635 | # CONFIG_RPCSEC_GSS_KRB5 is not set |
596 | # CONFIG_RPCSEC_GSS_SPKM3 is not set | 636 | # CONFIG_RPCSEC_GSS_SPKM3 is not set |
597 | # CONFIG_SMB_FS is not set | 637 | # CONFIG_SMB_FS is not set |
638 | # CONFIG_CEPH_FS is not set | ||
598 | CONFIG_CIFS=y | 639 | CONFIG_CIFS=y |
599 | CONFIG_CIFS_STATS=y | 640 | CONFIG_CIFS_STATS=y |
600 | CONFIG_CIFS_STATS2=y | 641 | CONFIG_CIFS_STATS2=y |
@@ -696,6 +737,7 @@ CONFIG_SCHED_DEBUG=y | |||
696 | # CONFIG_DEBUG_OBJECTS is not set | 737 | # CONFIG_DEBUG_OBJECTS is not set |
697 | CONFIG_DEBUG_SLAB=y | 738 | CONFIG_DEBUG_SLAB=y |
698 | # CONFIG_DEBUG_SLAB_LEAK is not set | 739 | # CONFIG_DEBUG_SLAB_LEAK is not set |
740 | # CONFIG_DEBUG_KMEMLEAK is not set | ||
699 | CONFIG_DEBUG_SPINLOCK=y | 741 | CONFIG_DEBUG_SPINLOCK=y |
700 | # CONFIG_DEBUG_MUTEXES is not set | 742 | # CONFIG_DEBUG_MUTEXES is not set |
701 | # CONFIG_DEBUG_LOCK_ALLOC is not set | 743 | # CONFIG_DEBUG_LOCK_ALLOC is not set |
@@ -741,6 +783,7 @@ CONFIG_BRANCH_PROFILE_NONE=y | |||
741 | # CONFIG_KMEMTRACE is not set | 783 | # CONFIG_KMEMTRACE is not set |
742 | # CONFIG_WORKQUEUE_TRACER is not set | 784 | # CONFIG_WORKQUEUE_TRACER is not set |
743 | # CONFIG_BLK_DEV_IO_TRACE is not set | 785 | # CONFIG_BLK_DEV_IO_TRACE is not set |
786 | # CONFIG_DMA_API_DEBUG is not set | ||
744 | # CONFIG_SAMPLES is not set | 787 | # CONFIG_SAMPLES is not set |
745 | CONFIG_EARLY_PRINTK=y | 788 | CONFIG_EARLY_PRINTK=y |
746 | # CONFIG_HEART_BEAT is not set | 789 | # CONFIG_HEART_BEAT is not set |
@@ -862,5 +905,6 @@ CONFIG_ZLIB_INFLATE=y | |||
862 | CONFIG_DECOMPRESS_GZIP=y | 905 | CONFIG_DECOMPRESS_GZIP=y |
863 | CONFIG_HAS_IOMEM=y | 906 | CONFIG_HAS_IOMEM=y |
864 | CONFIG_HAS_IOPORT=y | 907 | CONFIG_HAS_IOPORT=y |
908 | CONFIG_HAS_DMA=y | ||
865 | CONFIG_HAVE_LMB=y | 909 | CONFIG_HAVE_LMB=y |
866 | CONFIG_NLATTR=y | 910 | CONFIG_NLATTR=y |
diff --git a/arch/microblaze/configs/nommu_defconfig b/arch/microblaze/configs/nommu_defconfig index ce2da535246a..dd3a494257f4 100644 --- a/arch/microblaze/configs/nommu_defconfig +++ b/arch/microblaze/configs/nommu_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.33-rc6 | 3 | # Linux kernel version: 2.6.34-rc6 |
4 | # Wed Feb 3 10:03:21 2010 | 4 | # Thu May 6 11:25:12 2010 |
5 | # | 5 | # |
6 | CONFIG_MICROBLAZE=y | 6 | CONFIG_MICROBLAZE=y |
7 | # CONFIG_SWAP is not set | 7 | # CONFIG_SWAP is not set |
@@ -22,8 +22,6 @@ CONFIG_GENERIC_CSUM=y | |||
22 | CONFIG_STACKTRACE_SUPPORT=y | 22 | CONFIG_STACKTRACE_SUPPORT=y |
23 | CONFIG_LOCKDEP_SUPPORT=y | 23 | CONFIG_LOCKDEP_SUPPORT=y |
24 | CONFIG_HAVE_LATENCYTOP_SUPPORT=y | 24 | CONFIG_HAVE_LATENCYTOP_SUPPORT=y |
25 | # CONFIG_PCI is not set | ||
26 | CONFIG_NO_DMA=y | ||
27 | CONFIG_DTC=y | 25 | CONFIG_DTC=y |
28 | CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" | 26 | CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" |
29 | CONFIG_CONSTRUCTORS=y | 27 | CONFIG_CONSTRUCTORS=y |
@@ -58,7 +56,6 @@ CONFIG_RCU_FANOUT=32 | |||
58 | CONFIG_IKCONFIG=y | 56 | CONFIG_IKCONFIG=y |
59 | CONFIG_IKCONFIG_PROC=y | 57 | CONFIG_IKCONFIG_PROC=y |
60 | CONFIG_LOG_BUF_SHIFT=17 | 58 | CONFIG_LOG_BUF_SHIFT=17 |
61 | # CONFIG_GROUP_SCHED is not set | ||
62 | # CONFIG_CGROUPS is not set | 59 | # CONFIG_CGROUPS is not set |
63 | CONFIG_SYSFS_DEPRECATED=y | 60 | CONFIG_SYSFS_DEPRECATED=y |
64 | CONFIG_SYSFS_DEPRECATED_V2=y | 61 | CONFIG_SYSFS_DEPRECATED_V2=y |
@@ -96,6 +93,8 @@ CONFIG_SLAB=y | |||
96 | # CONFIG_MMAP_ALLOW_UNINITIALIZED is not set | 93 | # CONFIG_MMAP_ALLOW_UNINITIALIZED is not set |
97 | # CONFIG_PROFILING is not set | 94 | # CONFIG_PROFILING is not set |
98 | CONFIG_HAVE_OPROFILE=y | 95 | CONFIG_HAVE_OPROFILE=y |
96 | CONFIG_HAVE_DMA_ATTRS=y | ||
97 | CONFIG_HAVE_DMA_API_DEBUG=y | ||
99 | 98 | ||
100 | # | 99 | # |
101 | # GCOV-based kernel profiling | 100 | # GCOV-based kernel profiling |
@@ -209,11 +208,14 @@ CONFIG_PROC_DEVICETREE=y | |||
209 | # | 208 | # |
210 | # Advanced setup | 209 | # Advanced setup |
211 | # | 210 | # |
211 | # CONFIG_ADVANCED_OPTIONS is not set | ||
212 | 212 | ||
213 | # | 213 | # |
214 | # Default settings for advanced configuration options are used | 214 | # Default settings for advanced configuration options are used |
215 | # | 215 | # |
216 | CONFIG_LOWMEM_SIZE=0x30000000 | ||
216 | CONFIG_KERNEL_START=0x90000000 | 217 | CONFIG_KERNEL_START=0x90000000 |
218 | CONFIG_TASK_SIZE=0x80000000 | ||
217 | CONFIG_SELECT_MEMORY_MODEL=y | 219 | CONFIG_SELECT_MEMORY_MODEL=y |
218 | CONFIG_FLATMEM_MANUAL=y | 220 | CONFIG_FLATMEM_MANUAL=y |
219 | # CONFIG_DISCONTIGMEM_MANUAL is not set | 221 | # CONFIG_DISCONTIGMEM_MANUAL is not set |
@@ -235,13 +237,20 @@ CONFIG_BINFMT_FLAT=y | |||
235 | # CONFIG_BINFMT_SHARED_FLAT is not set | 237 | # CONFIG_BINFMT_SHARED_FLAT is not set |
236 | # CONFIG_HAVE_AOUT is not set | 238 | # CONFIG_HAVE_AOUT is not set |
237 | # CONFIG_BINFMT_MISC is not set | 239 | # CONFIG_BINFMT_MISC is not set |
240 | |||
241 | # | ||
242 | # Bus Options | ||
243 | # | ||
244 | # CONFIG_PCI is not set | ||
245 | # CONFIG_PCI_DOMAINS is not set | ||
246 | # CONFIG_PCI_SYSCALL is not set | ||
247 | # CONFIG_ARCH_SUPPORTS_MSI is not set | ||
238 | CONFIG_NET=y | 248 | CONFIG_NET=y |
239 | 249 | ||
240 | # | 250 | # |
241 | # Networking options | 251 | # Networking options |
242 | # | 252 | # |
243 | CONFIG_PACKET=y | 253 | CONFIG_PACKET=y |
244 | # CONFIG_PACKET_MMAP is not set | ||
245 | CONFIG_UNIX=y | 254 | CONFIG_UNIX=y |
246 | CONFIG_XFRM=y | 255 | CONFIG_XFRM=y |
247 | # CONFIG_XFRM_USER is not set | 256 | # CONFIG_XFRM_USER is not set |
@@ -413,6 +422,7 @@ CONFIG_MTD_UCLINUX=y | |||
413 | # UBI - Unsorted block images | 422 | # UBI - Unsorted block images |
414 | # | 423 | # |
415 | # CONFIG_MTD_UBI is not set | 424 | # CONFIG_MTD_UBI is not set |
425 | CONFIG_OF_FLATTREE=y | ||
416 | CONFIG_OF_DEVICE=y | 426 | CONFIG_OF_DEVICE=y |
417 | # CONFIG_PARPORT is not set | 427 | # CONFIG_PARPORT is not set |
418 | CONFIG_BLK_DEV=y | 428 | CONFIG_BLK_DEV=y |
@@ -442,6 +452,7 @@ CONFIG_MISC_DEVICES=y | |||
442 | # | 452 | # |
443 | # SCSI device support | 453 | # SCSI device support |
444 | # | 454 | # |
455 | CONFIG_SCSI_MOD=y | ||
445 | # CONFIG_RAID_ATTRS is not set | 456 | # CONFIG_RAID_ATTRS is not set |
446 | # CONFIG_SCSI is not set | 457 | # CONFIG_SCSI is not set |
447 | # CONFIG_SCSI_DMA is not set | 458 | # CONFIG_SCSI_DMA is not set |
@@ -458,6 +469,7 @@ CONFIG_NETDEVICES=y | |||
458 | # CONFIG_PHYLIB is not set | 469 | # CONFIG_PHYLIB is not set |
459 | CONFIG_NET_ETHERNET=y | 470 | CONFIG_NET_ETHERNET=y |
460 | # CONFIG_MII is not set | 471 | # CONFIG_MII is not set |
472 | # CONFIG_ETHOC is not set | ||
461 | # CONFIG_DNET is not set | 473 | # CONFIG_DNET is not set |
462 | # CONFIG_IBM_NEW_EMAC_ZMII is not set | 474 | # CONFIG_IBM_NEW_EMAC_ZMII is not set |
463 | # CONFIG_IBM_NEW_EMAC_RGMII is not set | 475 | # CONFIG_IBM_NEW_EMAC_RGMII is not set |
@@ -466,6 +478,7 @@ CONFIG_NET_ETHERNET=y | |||
466 | # CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set | 478 | # CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set |
467 | # CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set | 479 | # CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set |
468 | # CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set | 480 | # CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set |
481 | # CONFIG_B44 is not set | ||
469 | # CONFIG_KS8842 is not set | 482 | # CONFIG_KS8842 is not set |
470 | # CONFIG_KS8851_MLL is not set | 483 | # CONFIG_KS8851_MLL is not set |
471 | # CONFIG_XILINX_EMACLITE is not set | 484 | # CONFIG_XILINX_EMACLITE is not set |
@@ -516,6 +529,7 @@ CONFIG_SERIAL_UARTLITE=y | |||
516 | CONFIG_SERIAL_UARTLITE_CONSOLE=y | 529 | CONFIG_SERIAL_UARTLITE_CONSOLE=y |
517 | CONFIG_SERIAL_CORE=y | 530 | CONFIG_SERIAL_CORE=y |
518 | CONFIG_SERIAL_CORE_CONSOLE=y | 531 | CONFIG_SERIAL_CORE_CONSOLE=y |
532 | # CONFIG_SERIAL_TIMBERDALE is not set | ||
519 | # CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set | 533 | # CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set |
520 | CONFIG_UNIX98_PTYS=y | 534 | CONFIG_UNIX98_PTYS=y |
521 | # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set | 535 | # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set |
@@ -544,6 +558,12 @@ CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y | |||
544 | # CONFIG_HWMON is not set | 558 | # CONFIG_HWMON is not set |
545 | # CONFIG_THERMAL is not set | 559 | # CONFIG_THERMAL is not set |
546 | # CONFIG_WATCHDOG is not set | 560 | # CONFIG_WATCHDOG is not set |
561 | CONFIG_SSB_POSSIBLE=y | ||
562 | |||
563 | # | ||
564 | # Sonics Silicon Backplane | ||
565 | # | ||
566 | # CONFIG_SSB is not set | ||
547 | 567 | ||
548 | # | 568 | # |
549 | # Multifunction device drivers | 569 | # Multifunction device drivers |
@@ -593,6 +613,7 @@ CONFIG_USB_ARCH_HAS_EHCI=y | |||
593 | # CONFIG_NEW_LEDS is not set | 613 | # CONFIG_NEW_LEDS is not set |
594 | # CONFIG_ACCESSIBILITY is not set | 614 | # CONFIG_ACCESSIBILITY is not set |
595 | # CONFIG_RTC_CLASS is not set | 615 | # CONFIG_RTC_CLASS is not set |
616 | # CONFIG_DMADEVICES is not set | ||
596 | # CONFIG_AUXDISPLAY is not set | 617 | # CONFIG_AUXDISPLAY is not set |
597 | # CONFIG_UIO is not set | 618 | # CONFIG_UIO is not set |
598 | 619 | ||
@@ -661,6 +682,7 @@ CONFIG_MISC_FILESYSTEMS=y | |||
661 | # CONFIG_BFS_FS is not set | 682 | # CONFIG_BFS_FS is not set |
662 | # CONFIG_EFS_FS is not set | 683 | # CONFIG_EFS_FS is not set |
663 | # CONFIG_JFFS2_FS is not set | 684 | # CONFIG_JFFS2_FS is not set |
685 | # CONFIG_LOGFS is not set | ||
664 | CONFIG_CRAMFS=y | 686 | CONFIG_CRAMFS=y |
665 | # CONFIG_SQUASHFS is not set | 687 | # CONFIG_SQUASHFS is not set |
666 | # CONFIG_VXFS_FS is not set | 688 | # CONFIG_VXFS_FS is not set |
@@ -689,6 +711,7 @@ CONFIG_SUNRPC=y | |||
689 | # CONFIG_RPCSEC_GSS_KRB5 is not set | 711 | # CONFIG_RPCSEC_GSS_KRB5 is not set |
690 | # CONFIG_RPCSEC_GSS_SPKM3 is not set | 712 | # CONFIG_RPCSEC_GSS_SPKM3 is not set |
691 | # CONFIG_SMB_FS is not set | 713 | # CONFIG_SMB_FS is not set |
714 | # CONFIG_CEPH_FS is not set | ||
692 | # CONFIG_CIFS is not set | 715 | # CONFIG_CIFS is not set |
693 | # CONFIG_NCP_FS is not set | 716 | # CONFIG_NCP_FS is not set |
694 | # CONFIG_CODA_FS is not set | 717 | # CONFIG_CODA_FS is not set |
@@ -733,6 +756,7 @@ CONFIG_DEBUG_OBJECTS_TIMERS=y | |||
733 | # CONFIG_DEBUG_OBJECTS_WORK is not set | 756 | # CONFIG_DEBUG_OBJECTS_WORK is not set |
734 | CONFIG_DEBUG_OBJECTS_ENABLE_DEFAULT=1 | 757 | CONFIG_DEBUG_OBJECTS_ENABLE_DEFAULT=1 |
735 | # CONFIG_DEBUG_SLAB is not set | 758 | # CONFIG_DEBUG_SLAB is not set |
759 | # CONFIG_DEBUG_KMEMLEAK is not set | ||
736 | # CONFIG_DEBUG_RT_MUTEXES is not set | 760 | # CONFIG_DEBUG_RT_MUTEXES is not set |
737 | # CONFIG_RT_MUTEX_TESTER is not set | 761 | # CONFIG_RT_MUTEX_TESTER is not set |
738 | # CONFIG_DEBUG_SPINLOCK is not set | 762 | # CONFIG_DEBUG_SPINLOCK is not set |
@@ -758,6 +782,7 @@ CONFIG_DEBUG_SG=y | |||
758 | # CONFIG_BACKTRACE_SELF_TEST is not set | 782 | # CONFIG_BACKTRACE_SELF_TEST is not set |
759 | # CONFIG_DEBUG_BLOCK_EXT_DEVT is not set | 783 | # CONFIG_DEBUG_BLOCK_EXT_DEVT is not set |
760 | # CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set | 784 | # CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set |
785 | # CONFIG_LKDTM is not set | ||
761 | # CONFIG_FAULT_INJECTION is not set | 786 | # CONFIG_FAULT_INJECTION is not set |
762 | # CONFIG_LATENCYTOP is not set | 787 | # CONFIG_LATENCYTOP is not set |
763 | CONFIG_SYSCTL_SYSCALL_CHECK=y | 788 | CONFIG_SYSCTL_SYSCALL_CHECK=y |
@@ -782,6 +807,7 @@ CONFIG_BRANCH_PROFILE_NONE=y | |||
782 | # CONFIG_WORKQUEUE_TRACER is not set | 807 | # CONFIG_WORKQUEUE_TRACER is not set |
783 | # CONFIG_BLK_DEV_IO_TRACE is not set | 808 | # CONFIG_BLK_DEV_IO_TRACE is not set |
784 | # CONFIG_DYNAMIC_DEBUG is not set | 809 | # CONFIG_DYNAMIC_DEBUG is not set |
810 | # CONFIG_DMA_API_DEBUG is not set | ||
785 | # CONFIG_SAMPLES is not set | 811 | # CONFIG_SAMPLES is not set |
786 | CONFIG_EARLY_PRINTK=y | 812 | CONFIG_EARLY_PRINTK=y |
787 | # CONFIG_HEART_BEAT is not set | 813 | # CONFIG_HEART_BEAT is not set |
@@ -901,5 +927,6 @@ CONFIG_GENERIC_FIND_LAST_BIT=y | |||
901 | CONFIG_ZLIB_INFLATE=y | 927 | CONFIG_ZLIB_INFLATE=y |
902 | CONFIG_HAS_IOMEM=y | 928 | CONFIG_HAS_IOMEM=y |
903 | CONFIG_HAS_IOPORT=y | 929 | CONFIG_HAS_IOPORT=y |
930 | CONFIG_HAS_DMA=y | ||
904 | CONFIG_HAVE_LMB=y | 931 | CONFIG_HAVE_LMB=y |
905 | CONFIG_NLATTR=y | 932 | CONFIG_NLATTR=y |
diff --git a/arch/microblaze/include/asm/cache.h b/arch/microblaze/include/asm/cache.h index e52210891d78..4efe96a036f7 100644 --- a/arch/microblaze/include/asm/cache.h +++ b/arch/microblaze/include/asm/cache.h | |||
@@ -15,7 +15,7 @@ | |||
15 | 15 | ||
16 | #include <asm/registers.h> | 16 | #include <asm/registers.h> |
17 | 17 | ||
18 | #define L1_CACHE_SHIFT 2 | 18 | #define L1_CACHE_SHIFT 5 |
19 | /* word-granular cache in microblaze */ | 19 | /* word-granular cache in microblaze */ |
20 | #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) | 20 | #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) |
21 | 21 | ||
diff --git a/arch/microblaze/include/asm/dma.h b/arch/microblaze/include/asm/dma.h index 08c073badf19..0d73d0c6de37 100644 --- a/arch/microblaze/include/asm/dma.h +++ b/arch/microblaze/include/asm/dma.h | |||
@@ -18,4 +18,10 @@ | |||
18 | #define MAX_DMA_ADDRESS (CONFIG_KERNEL_START + memory_size - 1) | 18 | #define MAX_DMA_ADDRESS (CONFIG_KERNEL_START + memory_size - 1) |
19 | #endif | 19 | #endif |
20 | 20 | ||
21 | #ifdef CONFIG_PCI | ||
22 | extern int isa_dma_bridge_buggy; | ||
23 | #else | ||
24 | #define isa_dma_bridge_buggy (0) | ||
25 | #endif | ||
26 | |||
21 | #endif /* _ASM_MICROBLAZE_DMA_H */ | 27 | #endif /* _ASM_MICROBLAZE_DMA_H */ |
diff --git a/arch/microblaze/include/asm/exceptions.h b/arch/microblaze/include/asm/exceptions.h index 90731df9e574..4c7b5d037c88 100644 --- a/arch/microblaze/include/asm/exceptions.h +++ b/arch/microblaze/include/asm/exceptions.h | |||
@@ -64,12 +64,6 @@ asmlinkage void full_exception(struct pt_regs *regs, unsigned int type, | |||
64 | void die(const char *str, struct pt_regs *fp, long err); | 64 | void die(const char *str, struct pt_regs *fp, long err); |
65 | void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr); | 65 | void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr); |
66 | 66 | ||
67 | #ifdef CONFIG_MMU | ||
68 | void __bug(const char *file, int line, void *data); | ||
69 | int bad_trap(int trap_num, struct pt_regs *regs); | ||
70 | int debug_trap(struct pt_regs *regs); | ||
71 | #endif /* CONFIG_MMU */ | ||
72 | |||
73 | #if defined(CONFIG_KGDB) | 67 | #if defined(CONFIG_KGDB) |
74 | void (*debugger)(struct pt_regs *regs); | 68 | void (*debugger)(struct pt_regs *regs); |
75 | int (*debugger_bpt)(struct pt_regs *regs); | 69 | int (*debugger_bpt)(struct pt_regs *regs); |
diff --git a/arch/microblaze/include/asm/io.h b/arch/microblaze/include/asm/io.h index e45a6eea92e0..00b5398d08c7 100644 --- a/arch/microblaze/include/asm/io.h +++ b/arch/microblaze/include/asm/io.h | |||
@@ -139,8 +139,6 @@ static inline void writel(unsigned int v, volatile void __iomem *addr) | |||
139 | 139 | ||
140 | #ifdef CONFIG_MMU | 140 | #ifdef CONFIG_MMU |
141 | 141 | ||
142 | #define mm_ptov(addr) ((void *)__phys_to_virt(addr)) | ||
143 | #define mm_vtop(addr) ((unsigned long)__virt_to_phys(addr)) | ||
144 | #define phys_to_virt(addr) ((void *)__phys_to_virt(addr)) | 142 | #define phys_to_virt(addr) ((void *)__phys_to_virt(addr)) |
145 | #define virt_to_phys(addr) ((unsigned long)__virt_to_phys(addr)) | 143 | #define virt_to_phys(addr) ((unsigned long)__virt_to_phys(addr)) |
146 | #define virt_to_bus(addr) ((unsigned long)__virt_to_phys(addr)) | 144 | #define virt_to_bus(addr) ((unsigned long)__virt_to_phys(addr)) |
diff --git a/arch/microblaze/include/asm/page.h b/arch/microblaze/include/asm/page.h index 2dd1d04129e0..de493f86d28f 100644 --- a/arch/microblaze/include/asm/page.h +++ b/arch/microblaze/include/asm/page.h | |||
@@ -31,6 +31,9 @@ | |||
31 | 31 | ||
32 | #ifndef __ASSEMBLY__ | 32 | #ifndef __ASSEMBLY__ |
33 | 33 | ||
34 | /* MS be sure that SLAB allocates aligned objects */ | ||
35 | #define ARCH_KMALLOC_MINALIGN L1_CACHE_BYTES | ||
36 | |||
34 | #define PAGE_UP(addr) (((addr)+((PAGE_SIZE)-1))&(~((PAGE_SIZE)-1))) | 37 | #define PAGE_UP(addr) (((addr)+((PAGE_SIZE)-1))&(~((PAGE_SIZE)-1))) |
35 | #define PAGE_DOWN(addr) ((addr)&(~((PAGE_SIZE)-1))) | 38 | #define PAGE_DOWN(addr) ((addr)&(~((PAGE_SIZE)-1))) |
36 | 39 | ||
@@ -70,14 +73,7 @@ typedef unsigned long pte_basic_t; | |||
70 | 73 | ||
71 | #endif /* CONFIG_MMU */ | 74 | #endif /* CONFIG_MMU */ |
72 | 75 | ||
73 | # ifndef CONFIG_MMU | 76 | # define copy_page(to, from) memcpy((to), (from), PAGE_SIZE) |
74 | # define copy_page(to, from) memcpy((to), (from), PAGE_SIZE) | ||
75 | # define get_user_page(vaddr) __get_free_page(GFP_KERNEL) | ||
76 | # define free_user_page(page, addr) free_page(addr) | ||
77 | # else /* CONFIG_MMU */ | ||
78 | extern void copy_page(void *to, void *from); | ||
79 | # endif /* CONFIG_MMU */ | ||
80 | |||
81 | # define clear_page(pgaddr) memset((pgaddr), 0, PAGE_SIZE) | 77 | # define clear_page(pgaddr) memset((pgaddr), 0, PAGE_SIZE) |
82 | 78 | ||
83 | # define clear_user_page(pgaddr, vaddr, page) memset((pgaddr), 0, PAGE_SIZE) | 79 | # define clear_user_page(pgaddr, vaddr, page) memset((pgaddr), 0, PAGE_SIZE) |
diff --git a/arch/microblaze/include/asm/pci.h b/arch/microblaze/include/asm/pci.h index bdd65aaee30d..5a388eeeb28f 100644 --- a/arch/microblaze/include/asm/pci.h +++ b/arch/microblaze/include/asm/pci.h | |||
@@ -94,14 +94,6 @@ extern int pci_mmap_legacy_page_range(struct pci_bus *bus, | |||
94 | 94 | ||
95 | #define HAVE_PCI_LEGACY 1 | 95 | #define HAVE_PCI_LEGACY 1 |
96 | 96 | ||
97 | /* pci_unmap_{page,single} is a nop so... */ | ||
98 | #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) | ||
99 | #define DECLARE_PCI_UNMAP_LEN(LEN_NAME) | ||
100 | #define pci_unmap_addr(PTR, ADDR_NAME) (0) | ||
101 | #define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0) | ||
102 | #define pci_unmap_len(PTR, LEN_NAME) (0) | ||
103 | #define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0) | ||
104 | |||
105 | /* The PCI address space does equal the physical memory | 97 | /* The PCI address space does equal the physical memory |
106 | * address space (no IOMMU). The IDE and SCSI device layers use | 98 | * address space (no IOMMU). The IDE and SCSI device layers use |
107 | * this boolean for bounce buffer decisions. | 99 | * this boolean for bounce buffer decisions. |
diff --git a/arch/microblaze/include/asm/pgalloc.h b/arch/microblaze/include/asm/pgalloc.h index f44b0d696fe2..c614a893f8a3 100644 --- a/arch/microblaze/include/asm/pgalloc.h +++ b/arch/microblaze/include/asm/pgalloc.h | |||
@@ -108,21 +108,7 @@ extern inline void free_pgd_slow(pgd_t *pgd) | |||
108 | #define pmd_alloc_one_fast(mm, address) ({ BUG(); ((pmd_t *)1); }) | 108 | #define pmd_alloc_one_fast(mm, address) ({ BUG(); ((pmd_t *)1); }) |
109 | #define pmd_alloc_one(mm, address) ({ BUG(); ((pmd_t *)2); }) | 109 | #define pmd_alloc_one(mm, address) ({ BUG(); ((pmd_t *)2); }) |
110 | 110 | ||
111 | static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, | 111 | extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr); |
112 | unsigned long address) | ||
113 | { | ||
114 | pte_t *pte; | ||
115 | extern void *early_get_page(void); | ||
116 | if (mem_init_done) { | ||
117 | pte = (pte_t *)__get_free_page(GFP_KERNEL | | ||
118 | __GFP_REPEAT | __GFP_ZERO); | ||
119 | } else { | ||
120 | pte = (pte_t *)early_get_page(); | ||
121 | if (pte) | ||
122 | clear_page(pte); | ||
123 | } | ||
124 | return pte; | ||
125 | } | ||
126 | 112 | ||
127 | static inline struct page *pte_alloc_one(struct mm_struct *mm, | 113 | static inline struct page *pte_alloc_one(struct mm_struct *mm, |
128 | unsigned long address) | 114 | unsigned long address) |
diff --git a/arch/microblaze/include/asm/pgtable.h b/arch/microblaze/include/asm/pgtable.h index dd2bb60651c7..ca2d92871545 100644 --- a/arch/microblaze/include/asm/pgtable.h +++ b/arch/microblaze/include/asm/pgtable.h | |||
@@ -512,15 +512,6 @@ static inline pmd_t *pmd_offset(pgd_t *dir, unsigned long address) | |||
512 | extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; | 512 | extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; |
513 | 513 | ||
514 | /* | 514 | /* |
515 | * When flushing the tlb entry for a page, we also need to flush the hash | ||
516 | * table entry. flush_hash_page is assembler (for speed) in hashtable.S. | ||
517 | */ | ||
518 | extern int flush_hash_page(unsigned context, unsigned long va, pte_t *ptep); | ||
519 | |||
520 | /* Add an HPTE to the hash table */ | ||
521 | extern void add_hash_page(unsigned context, unsigned long va, pte_t *ptep); | ||
522 | |||
523 | /* | ||
524 | * Encode and decode a swap entry. | 515 | * Encode and decode a swap entry. |
525 | * Note that the bits we use in a PTE for representing a swap entry | 516 | * Note that the bits we use in a PTE for representing a swap entry |
526 | * must not include the _PAGE_PRESENT bit, or the _PAGE_HASHPTE bit | 517 | * must not include the _PAGE_PRESENT bit, or the _PAGE_HASHPTE bit |
@@ -533,15 +524,7 @@ extern void add_hash_page(unsigned context, unsigned long va, pte_t *ptep); | |||
533 | #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) >> 2 }) | 524 | #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) >> 2 }) |
534 | #define __swp_entry_to_pte(x) ((pte_t) { (x).val << 2 }) | 525 | #define __swp_entry_to_pte(x) ((pte_t) { (x).val << 2 }) |
535 | 526 | ||
536 | |||
537 | /* CONFIG_APUS */ | ||
538 | /* For virtual address to physical address conversion */ | ||
539 | extern void cache_clear(__u32 addr, int length); | ||
540 | extern void cache_push(__u32 addr, int length); | ||
541 | extern int mm_end_of_chunk(unsigned long addr, int len); | ||
542 | extern unsigned long iopa(unsigned long addr); | 527 | extern unsigned long iopa(unsigned long addr); |
543 | /* extern unsigned long mm_ptov(unsigned long addr) \ | ||
544 | __attribute__ ((const)); TBD */ | ||
545 | 528 | ||
546 | /* Values for nocacheflag and cmode */ | 529 | /* Values for nocacheflag and cmode */ |
547 | /* These are not used by the APUS kernel_map, but prevents | 530 | /* These are not used by the APUS kernel_map, but prevents |
@@ -552,18 +535,6 @@ extern unsigned long iopa(unsigned long addr); | |||
552 | #define IOMAP_NOCACHE_NONSER 2 | 535 | #define IOMAP_NOCACHE_NONSER 2 |
553 | #define IOMAP_NO_COPYBACK 3 | 536 | #define IOMAP_NO_COPYBACK 3 |
554 | 537 | ||
555 | /* | ||
556 | * Map some physical address range into the kernel address space. | ||
557 | */ | ||
558 | extern unsigned long kernel_map(unsigned long paddr, unsigned long size, | ||
559 | int nocacheflag, unsigned long *memavailp); | ||
560 | |||
561 | /* | ||
562 | * Set cache mode of (kernel space) address range. | ||
563 | */ | ||
564 | extern void kernel_set_cachemode(unsigned long address, unsigned long size, | ||
565 | unsigned int cmode); | ||
566 | |||
567 | /* Needs to be defined here and not in linux/mm.h, as it is arch dependent */ | 538 | /* Needs to be defined here and not in linux/mm.h, as it is arch dependent */ |
568 | #define kern_addr_valid(addr) (1) | 539 | #define kern_addr_valid(addr) (1) |
569 | 540 | ||
@@ -577,10 +548,6 @@ extern void kernel_set_cachemode(unsigned long address, unsigned long size, | |||
577 | void do_page_fault(struct pt_regs *regs, unsigned long address, | 548 | void do_page_fault(struct pt_regs *regs, unsigned long address, |
578 | unsigned long error_code); | 549 | unsigned long error_code); |
579 | 550 | ||
580 | void __init io_block_mapping(unsigned long virt, phys_addr_t phys, | ||
581 | unsigned int size, int flags); | ||
582 | |||
583 | void __init adjust_total_lowmem(void); | ||
584 | void mapin_ram(void); | 551 | void mapin_ram(void); |
585 | int map_page(unsigned long va, phys_addr_t pa, int flags); | 552 | int map_page(unsigned long va, phys_addr_t pa, int flags); |
586 | 553 | ||
@@ -601,7 +568,7 @@ void __init *early_get_page(void); | |||
601 | extern unsigned long ioremap_bot, ioremap_base; | 568 | extern unsigned long ioremap_bot, ioremap_base; |
602 | 569 | ||
603 | void *consistent_alloc(int gfp, size_t size, dma_addr_t *dma_handle); | 570 | void *consistent_alloc(int gfp, size_t size, dma_addr_t *dma_handle); |
604 | void consistent_free(void *vaddr); | 571 | void consistent_free(size_t size, void *vaddr); |
605 | void consistent_sync(void *vaddr, size_t size, int direction); | 572 | void consistent_sync(void *vaddr, size_t size, int direction); |
606 | void consistent_sync_page(struct page *page, unsigned long offset, | 573 | void consistent_sync_page(struct page *page, unsigned long offset, |
607 | size_t size, int direction); | 574 | size_t size, int direction); |
diff --git a/arch/microblaze/include/asm/uaccess.h b/arch/microblaze/include/asm/uaccess.h index 446bec29b142..26460d15b338 100644 --- a/arch/microblaze/include/asm/uaccess.h +++ b/arch/microblaze/include/asm/uaccess.h | |||
@@ -182,6 +182,39 @@ extern long __user_bad(void); | |||
182 | * Returns zero on success, or -EFAULT on error. | 182 | * Returns zero on success, or -EFAULT on error. |
183 | * On error, the variable @x is set to zero. | 183 | * On error, the variable @x is set to zero. |
184 | */ | 184 | */ |
185 | #define get_user(x, ptr) \ | ||
186 | __get_user_check((x), (ptr), sizeof(*(ptr))) | ||
187 | |||
188 | #define __get_user_check(x, ptr, size) \ | ||
189 | ({ \ | ||
190 | unsigned long __gu_val = 0; \ | ||
191 | const typeof(*(ptr)) __user *__gu_addr = (ptr); \ | ||
192 | int __gu_err = 0; \ | ||
193 | \ | ||
194 | if (access_ok(VERIFY_READ, __gu_addr, size)) { \ | ||
195 | switch (size) { \ | ||
196 | case 1: \ | ||
197 | __get_user_asm("lbu", __gu_addr, __gu_val, \ | ||
198 | __gu_err); \ | ||
199 | break; \ | ||
200 | case 2: \ | ||
201 | __get_user_asm("lhu", __gu_addr, __gu_val, \ | ||
202 | __gu_err); \ | ||
203 | break; \ | ||
204 | case 4: \ | ||
205 | __get_user_asm("lw", __gu_addr, __gu_val, \ | ||
206 | __gu_err); \ | ||
207 | break; \ | ||
208 | default: \ | ||
209 | __gu_err = __user_bad(); \ | ||
210 | break; \ | ||
211 | } \ | ||
212 | } else { \ | ||
213 | __gu_err = -EFAULT; \ | ||
214 | } \ | ||
215 | x = (typeof(*(ptr)))__gu_val; \ | ||
216 | __gu_err; \ | ||
217 | }) | ||
185 | 218 | ||
186 | #define __get_user(x, ptr) \ | 219 | #define __get_user(x, ptr) \ |
187 | ({ \ | 220 | ({ \ |
@@ -206,12 +239,6 @@ extern long __user_bad(void); | |||
206 | }) | 239 | }) |
207 | 240 | ||
208 | 241 | ||
209 | #define get_user(x, ptr) \ | ||
210 | ({ \ | ||
211 | access_ok(VERIFY_READ, (ptr), sizeof(*(ptr))) \ | ||
212 | ? __get_user((x), (ptr)) : -EFAULT; \ | ||
213 | }) | ||
214 | |||
215 | #define __put_user_asm(insn, __gu_ptr, __gu_val, __gu_err) \ | 242 | #define __put_user_asm(insn, __gu_ptr, __gu_val, __gu_err) \ |
216 | ({ \ | 243 | ({ \ |
217 | __asm__ __volatile__ ( \ | 244 | __asm__ __volatile__ ( \ |
@@ -266,6 +293,42 @@ extern long __user_bad(void); | |||
266 | * | 293 | * |
267 | * Returns zero on success, or -EFAULT on error. | 294 | * Returns zero on success, or -EFAULT on error. |
268 | */ | 295 | */ |
296 | #define put_user(x, ptr) \ | ||
297 | __put_user_check((x), (ptr), sizeof(*(ptr))) | ||
298 | |||
299 | #define __put_user_check(x, ptr, size) \ | ||
300 | ({ \ | ||
301 | typeof(*(ptr)) __pu_val; \ | ||
302 | typeof(*(ptr)) __user *__pu_addr = (ptr); \ | ||
303 | int __pu_err = 0; \ | ||
304 | \ | ||
305 | __pu_val = (x); \ | ||
306 | if (access_ok(VERIFY_WRITE, __pu_addr, size)) { \ | ||
307 | switch (size) { \ | ||
308 | case 1: \ | ||
309 | __put_user_asm("sb", __pu_addr, __pu_val, \ | ||
310 | __pu_err); \ | ||
311 | break; \ | ||
312 | case 2: \ | ||
313 | __put_user_asm("sh", __pu_addr, __pu_val, \ | ||
314 | __pu_err); \ | ||
315 | break; \ | ||
316 | case 4: \ | ||
317 | __put_user_asm("sw", __pu_addr, __pu_val, \ | ||
318 | __pu_err); \ | ||
319 | break; \ | ||
320 | case 8: \ | ||
321 | __put_user_asm_8(__pu_addr, __pu_val, __pu_err);\ | ||
322 | break; \ | ||
323 | default: \ | ||
324 | __pu_err = __user_bad(); \ | ||
325 | break; \ | ||
326 | } \ | ||
327 | } else { \ | ||
328 | __pu_err = -EFAULT; \ | ||
329 | } \ | ||
330 | __pu_err; \ | ||
331 | }) | ||
269 | 332 | ||
270 | #define __put_user(x, ptr) \ | 333 | #define __put_user(x, ptr) \ |
271 | ({ \ | 334 | ({ \ |
@@ -290,18 +353,6 @@ extern long __user_bad(void); | |||
290 | __gu_err; \ | 353 | __gu_err; \ |
291 | }) | 354 | }) |
292 | 355 | ||
293 | #ifndef CONFIG_MMU | ||
294 | |||
295 | #define put_user(x, ptr) __put_user((x), (ptr)) | ||
296 | |||
297 | #else /* CONFIG_MMU */ | ||
298 | |||
299 | #define put_user(x, ptr) \ | ||
300 | ({ \ | ||
301 | access_ok(VERIFY_WRITE, (ptr), sizeof(*(ptr))) \ | ||
302 | ? __put_user((x), (ptr)) : -EFAULT; \ | ||
303 | }) | ||
304 | #endif /* CONFIG_MMU */ | ||
305 | 356 | ||
306 | /* copy_to_from_user */ | 357 | /* copy_to_from_user */ |
307 | #define __copy_from_user(to, from, n) \ | 358 | #define __copy_from_user(to, from, n) \ |
diff --git a/arch/microblaze/kernel/asm-offsets.c b/arch/microblaze/kernel/asm-offsets.c index 0071260a672c..c1b459c97571 100644 --- a/arch/microblaze/kernel/asm-offsets.c +++ b/arch/microblaze/kernel/asm-offsets.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/hardirq.h> | 16 | #include <linux/hardirq.h> |
17 | #include <linux/thread_info.h> | 17 | #include <linux/thread_info.h> |
18 | #include <linux/kbuild.h> | 18 | #include <linux/kbuild.h> |
19 | #include <asm/cpuinfo.h> | ||
19 | 20 | ||
20 | int main(int argc, char *argv[]) | 21 | int main(int argc, char *argv[]) |
21 | { | 22 | { |
diff --git a/arch/microblaze/kernel/cpu/cache.c b/arch/microblaze/kernel/cpu/cache.c index f04d8a86dead..109876e8d643 100644 --- a/arch/microblaze/kernel/cpu/cache.c +++ b/arch/microblaze/kernel/cpu/cache.c | |||
@@ -96,13 +96,16 @@ static inline void __disable_dcache_nomsr(void) | |||
96 | } | 96 | } |
97 | 97 | ||
98 | 98 | ||
99 | /* Helper macro for computing the limits of cache range loops */ | 99 | /* Helper macro for computing the limits of cache range loops |
100 | * | ||
101 | * End address can be unaligned which is OK for C implementation. | ||
102 | * ASM implementation align it in ASM macros | ||
103 | */ | ||
100 | #define CACHE_LOOP_LIMITS(start, end, cache_line_length, cache_size) \ | 104 | #define CACHE_LOOP_LIMITS(start, end, cache_line_length, cache_size) \ |
101 | do { \ | 105 | do { \ |
102 | int align = ~(cache_line_length - 1); \ | 106 | int align = ~(cache_line_length - 1); \ |
103 | end = min(start + cache_size, end); \ | 107 | end = min(start + cache_size, end); \ |
104 | start &= align; \ | 108 | start &= align; \ |
105 | end = ((end & align) + cache_line_length); \ | ||
106 | } while (0); | 109 | } while (0); |
107 | 110 | ||
108 | /* | 111 | /* |
@@ -111,9 +114,9 @@ do { \ | |||
111 | */ | 114 | */ |
112 | #define CACHE_ALL_LOOP(cache_size, line_length, op) \ | 115 | #define CACHE_ALL_LOOP(cache_size, line_length, op) \ |
113 | do { \ | 116 | do { \ |
114 | unsigned int len = cache_size; \ | 117 | unsigned int len = cache_size - line_length; \ |
115 | int step = -line_length; \ | 118 | int step = -line_length; \ |
116 | BUG_ON(step >= 0); \ | 119 | WARN_ON(step >= 0); \ |
117 | \ | 120 | \ |
118 | __asm__ __volatile__ (" 1: " #op " %0, r0; \ | 121 | __asm__ __volatile__ (" 1: " #op " %0, r0; \ |
119 | bgtid %0, 1b; \ | 122 | bgtid %0, 1b; \ |
@@ -122,26 +125,22 @@ do { \ | |||
122 | : "memory"); \ | 125 | : "memory"); \ |
123 | } while (0); | 126 | } while (0); |
124 | 127 | ||
125 | 128 | /* Used for wdc.flush/clear which can use rB for offset which is not possible | |
126 | #define CACHE_ALL_LOOP2(cache_size, line_length, op) \ | 129 | * to use for simple wdc or wic. |
127 | do { \ | 130 | * |
128 | unsigned int len = cache_size; \ | 131 | * start address is cache aligned |
129 | int step = -line_length; \ | 132 | * end address is not aligned, if end is aligned then I have to substract |
130 | BUG_ON(step >= 0); \ | 133 | * cacheline length because I can't flush/invalidate the next cacheline. |
131 | \ | 134 | * If is not, I align it because I will flush/invalidate whole line. |
132 | __asm__ __volatile__ (" 1: " #op " r0, %0; \ | 135 | */ |
133 | bgtid %0, 1b; \ | ||
134 | addk %0, %0, %1; \ | ||
135 | " : : "r" (len), "r" (step) \ | ||
136 | : "memory"); \ | ||
137 | } while (0); | ||
138 | |||
139 | /* for wdc.flush/clear */ | ||
140 | #define CACHE_RANGE_LOOP_2(start, end, line_length, op) \ | 136 | #define CACHE_RANGE_LOOP_2(start, end, line_length, op) \ |
141 | do { \ | 137 | do { \ |
142 | int step = -line_length; \ | 138 | int step = -line_length; \ |
143 | int count = end - start; \ | 139 | int align = ~(line_length - 1); \ |
144 | BUG_ON(count <= 0); \ | 140 | int count; \ |
141 | end = ((end & align) == end) ? end - line_length : end & align; \ | ||
142 | count = end - start; \ | ||
143 | WARN_ON(count < 0); \ | ||
145 | \ | 144 | \ |
146 | __asm__ __volatile__ (" 1: " #op " %0, %1; \ | 145 | __asm__ __volatile__ (" 1: " #op " %0, %1; \ |
147 | bgtid %1, 1b; \ | 146 | bgtid %1, 1b; \ |
@@ -154,7 +153,9 @@ do { \ | |||
154 | #define CACHE_RANGE_LOOP_1(start, end, line_length, op) \ | 153 | #define CACHE_RANGE_LOOP_1(start, end, line_length, op) \ |
155 | do { \ | 154 | do { \ |
156 | int volatile temp; \ | 155 | int volatile temp; \ |
157 | BUG_ON(end - start <= 0); \ | 156 | int align = ~(line_length - 1); \ |
157 | end = ((end & align) == end) ? end - line_length : end & align; \ | ||
158 | WARN_ON(end - start < 0); \ | ||
158 | \ | 159 | \ |
159 | __asm__ __volatile__ (" 1: " #op " %1, r0; \ | 160 | __asm__ __volatile__ (" 1: " #op " %1, r0; \ |
160 | cmpu %0, %1, %2; \ | 161 | cmpu %0, %1, %2; \ |
@@ -360,8 +361,12 @@ static void __invalidate_dcache_all_noirq_wt(void) | |||
360 | #endif | 361 | #endif |
361 | } | 362 | } |
362 | 363 | ||
363 | /* FIXME this is weird - should be only wdc but not work | 364 | /* FIXME It is blindly invalidation as is expected |
364 | * MS: I am getting bus errors and other weird things */ | 365 | * but can't be called on noMMU in microblaze_cache_init below |
366 | * | ||
367 | * MS: noMMU kernel won't boot if simple wdc is used | ||
368 | * The reason should be that there are discared data which kernel needs | ||
369 | */ | ||
365 | static void __invalidate_dcache_all_wb(void) | 370 | static void __invalidate_dcache_all_wb(void) |
366 | { | 371 | { |
367 | #ifndef ASM_LOOP | 372 | #ifndef ASM_LOOP |
@@ -369,12 +374,12 @@ static void __invalidate_dcache_all_wb(void) | |||
369 | #endif | 374 | #endif |
370 | pr_debug("%s\n", __func__); | 375 | pr_debug("%s\n", __func__); |
371 | #ifdef ASM_LOOP | 376 | #ifdef ASM_LOOP |
372 | CACHE_ALL_LOOP2(cpuinfo.dcache_size, cpuinfo.dcache_line_length, | 377 | CACHE_ALL_LOOP(cpuinfo.dcache_size, cpuinfo.dcache_line_length, |
373 | wdc.clear) | 378 | wdc) |
374 | #else | 379 | #else |
375 | for (i = 0; i < cpuinfo.dcache_size; | 380 | for (i = 0; i < cpuinfo.dcache_size; |
376 | i += cpuinfo.dcache_line_length) | 381 | i += cpuinfo.dcache_line_length) |
377 | __asm__ __volatile__ ("wdc.clear %0, r0;" \ | 382 | __asm__ __volatile__ ("wdc %0, r0;" \ |
378 | : : "r" (i)); | 383 | : : "r" (i)); |
379 | #endif | 384 | #endif |
380 | } | 385 | } |
@@ -393,7 +398,7 @@ static void __invalidate_dcache_range_wb(unsigned long start, | |||
393 | #ifdef ASM_LOOP | 398 | #ifdef ASM_LOOP |
394 | CACHE_RANGE_LOOP_2(start, end, cpuinfo.dcache_line_length, wdc.clear); | 399 | CACHE_RANGE_LOOP_2(start, end, cpuinfo.dcache_line_length, wdc.clear); |
395 | #else | 400 | #else |
396 | for (i = start; i < end; i += cpuinfo.icache_line_length) | 401 | for (i = start; i < end; i += cpuinfo.dcache_line_length) |
397 | __asm__ __volatile__ ("wdc.clear %0, r0;" \ | 402 | __asm__ __volatile__ ("wdc.clear %0, r0;" \ |
398 | : : "r" (i)); | 403 | : : "r" (i)); |
399 | #endif | 404 | #endif |
@@ -413,7 +418,7 @@ static void __invalidate_dcache_range_nomsr_wt(unsigned long start, | |||
413 | #ifdef ASM_LOOP | 418 | #ifdef ASM_LOOP |
414 | CACHE_RANGE_LOOP_1(start, end, cpuinfo.dcache_line_length, wdc); | 419 | CACHE_RANGE_LOOP_1(start, end, cpuinfo.dcache_line_length, wdc); |
415 | #else | 420 | #else |
416 | for (i = start; i < end; i += cpuinfo.icache_line_length) | 421 | for (i = start; i < end; i += cpuinfo.dcache_line_length) |
417 | __asm__ __volatile__ ("wdc %0, r0;" \ | 422 | __asm__ __volatile__ ("wdc %0, r0;" \ |
418 | : : "r" (i)); | 423 | : : "r" (i)); |
419 | #endif | 424 | #endif |
@@ -437,7 +442,7 @@ static void __invalidate_dcache_range_msr_irq_wt(unsigned long start, | |||
437 | #ifdef ASM_LOOP | 442 | #ifdef ASM_LOOP |
438 | CACHE_RANGE_LOOP_1(start, end, cpuinfo.dcache_line_length, wdc); | 443 | CACHE_RANGE_LOOP_1(start, end, cpuinfo.dcache_line_length, wdc); |
439 | #else | 444 | #else |
440 | for (i = start; i < end; i += cpuinfo.icache_line_length) | 445 | for (i = start; i < end; i += cpuinfo.dcache_line_length) |
441 | __asm__ __volatile__ ("wdc %0, r0;" \ | 446 | __asm__ __volatile__ ("wdc %0, r0;" \ |
442 | : : "r" (i)); | 447 | : : "r" (i)); |
443 | #endif | 448 | #endif |
@@ -465,7 +470,7 @@ static void __invalidate_dcache_range_nomsr_irq(unsigned long start, | |||
465 | #ifdef ASM_LOOP | 470 | #ifdef ASM_LOOP |
466 | CACHE_RANGE_LOOP_1(start, end, cpuinfo.dcache_line_length, wdc); | 471 | CACHE_RANGE_LOOP_1(start, end, cpuinfo.dcache_line_length, wdc); |
467 | #else | 472 | #else |
468 | for (i = start; i < end; i += cpuinfo.icache_line_length) | 473 | for (i = start; i < end; i += cpuinfo.dcache_line_length) |
469 | __asm__ __volatile__ ("wdc %0, r0;" \ | 474 | __asm__ __volatile__ ("wdc %0, r0;" \ |
470 | : : "r" (i)); | 475 | : : "r" (i)); |
471 | #endif | 476 | #endif |
@@ -504,7 +509,7 @@ static void __flush_dcache_range_wb(unsigned long start, unsigned long end) | |||
504 | #ifdef ASM_LOOP | 509 | #ifdef ASM_LOOP |
505 | CACHE_RANGE_LOOP_2(start, end, cpuinfo.dcache_line_length, wdc.flush); | 510 | CACHE_RANGE_LOOP_2(start, end, cpuinfo.dcache_line_length, wdc.flush); |
506 | #else | 511 | #else |
507 | for (i = start; i < end; i += cpuinfo.icache_line_length) | 512 | for (i = start; i < end; i += cpuinfo.dcache_line_length) |
508 | __asm__ __volatile__ ("wdc.flush %0, r0;" \ | 513 | __asm__ __volatile__ ("wdc.flush %0, r0;" \ |
509 | : : "r" (i)); | 514 | : : "r" (i)); |
510 | #endif | 515 | #endif |
@@ -650,7 +655,11 @@ void microblaze_cache_init(void) | |||
650 | } | 655 | } |
651 | } | 656 | } |
652 | } | 657 | } |
653 | invalidate_dcache(); | 658 | /* FIXME Invalidation is done in U-BOOT |
659 | * WT cache: Data is already written to main memory | ||
660 | * WB cache: Discard data on noMMU which caused that kernel doesn't boot | ||
661 | */ | ||
662 | /* invalidate_dcache(); */ | ||
654 | enable_dcache(); | 663 | enable_dcache(); |
655 | 664 | ||
656 | invalidate_icache(); | 665 | invalidate_icache(); |
diff --git a/arch/microblaze/kernel/cpu/mb.c b/arch/microblaze/kernel/cpu/mb.c index 0c912b2a8e03..4216eb1eaa32 100644 --- a/arch/microblaze/kernel/cpu/mb.c +++ b/arch/microblaze/kernel/cpu/mb.c | |||
@@ -98,15 +98,17 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
98 | 98 | ||
99 | if (cpuinfo.use_icache) | 99 | if (cpuinfo.use_icache) |
100 | count += seq_printf(m, | 100 | count += seq_printf(m, |
101 | "Icache:\t\t%ukB\n", | 101 | "Icache:\t\t%ukB\tline length:\t%dB\n", |
102 | cpuinfo.icache_size >> 10); | 102 | cpuinfo.icache_size >> 10, |
103 | cpuinfo.icache_line_length); | ||
103 | else | 104 | else |
104 | count += seq_printf(m, "Icache:\t\tno\n"); | 105 | count += seq_printf(m, "Icache:\t\tno\n"); |
105 | 106 | ||
106 | if (cpuinfo.use_dcache) { | 107 | if (cpuinfo.use_dcache) { |
107 | count += seq_printf(m, | 108 | count += seq_printf(m, |
108 | "Dcache:\t\t%ukB\n", | 109 | "Dcache:\t\t%ukB\tline length:\t%dB\n", |
109 | cpuinfo.dcache_size >> 10); | 110 | cpuinfo.dcache_size >> 10, |
111 | cpuinfo.dcache_line_length); | ||
110 | if (cpuinfo.dcache_wb) | 112 | if (cpuinfo.dcache_wb) |
111 | count += seq_printf(m, "\t\twrite-back\n"); | 113 | count += seq_printf(m, "\t\twrite-back\n"); |
112 | else | 114 | else |
diff --git a/arch/microblaze/kernel/dma.c b/arch/microblaze/kernel/dma.c index ce72dd4967cf..9dcd90b5df55 100644 --- a/arch/microblaze/kernel/dma.c +++ b/arch/microblaze/kernel/dma.c | |||
@@ -74,7 +74,7 @@ static void dma_direct_free_coherent(struct device *dev, size_t size, | |||
74 | void *vaddr, dma_addr_t dma_handle) | 74 | void *vaddr, dma_addr_t dma_handle) |
75 | { | 75 | { |
76 | #ifdef NOT_COHERENT_CACHE | 76 | #ifdef NOT_COHERENT_CACHE |
77 | consistent_free(vaddr); | 77 | consistent_free(size, vaddr); |
78 | #else | 78 | #else |
79 | free_pages((unsigned long)vaddr, get_order(size)); | 79 | free_pages((unsigned long)vaddr, get_order(size)); |
80 | #endif | 80 | #endif |
diff --git a/arch/microblaze/kernel/entry-nommu.S b/arch/microblaze/kernel/entry-nommu.S index 391d6197fc3b..8cc18cd2cce6 100644 --- a/arch/microblaze/kernel/entry-nommu.S +++ b/arch/microblaze/kernel/entry-nommu.S | |||
@@ -476,6 +476,8 @@ ENTRY(ret_from_fork) | |||
476 | nop | 476 | nop |
477 | 477 | ||
478 | work_pending: | 478 | work_pending: |
479 | enable_irq | ||
480 | |||
479 | andi r11, r19, _TIF_NEED_RESCHED | 481 | andi r11, r19, _TIF_NEED_RESCHED |
480 | beqi r11, 1f | 482 | beqi r11, 1f |
481 | bralid r15, schedule | 483 | bralid r15, schedule |
diff --git a/arch/microblaze/kernel/exceptions.c b/arch/microblaze/kernel/exceptions.c index d9f70f83097f..02cbdfe5aa8d 100644 --- a/arch/microblaze/kernel/exceptions.c +++ b/arch/microblaze/kernel/exceptions.c | |||
@@ -121,7 +121,7 @@ asmlinkage void full_exception(struct pt_regs *regs, unsigned int type, | |||
121 | } | 121 | } |
122 | printk(KERN_WARNING "Divide by zero exception " \ | 122 | printk(KERN_WARNING "Divide by zero exception " \ |
123 | "in kernel mode.\n"); | 123 | "in kernel mode.\n"); |
124 | die("Divide by exception", regs, SIGBUS); | 124 | die("Divide by zero exception", regs, SIGBUS); |
125 | break; | 125 | break; |
126 | case MICROBLAZE_FPU_EXCEPTION: | 126 | case MICROBLAZE_FPU_EXCEPTION: |
127 | pr_debug(KERN_WARNING "FPU exception\n"); | 127 | pr_debug(KERN_WARNING "FPU exception\n"); |
diff --git a/arch/microblaze/kernel/head.S b/arch/microblaze/kernel/head.S index da6a5f5dc766..1bf739888260 100644 --- a/arch/microblaze/kernel/head.S +++ b/arch/microblaze/kernel/head.S | |||
@@ -28,6 +28,7 @@ | |||
28 | * for more details. | 28 | * for more details. |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include <linux/init.h> | ||
31 | #include <linux/linkage.h> | 32 | #include <linux/linkage.h> |
32 | #include <asm/thread_info.h> | 33 | #include <asm/thread_info.h> |
33 | #include <asm/page.h> | 34 | #include <asm/page.h> |
@@ -49,7 +50,7 @@ swapper_pg_dir: | |||
49 | 50 | ||
50 | #endif /* CONFIG_MMU */ | 51 | #endif /* CONFIG_MMU */ |
51 | 52 | ||
52 | .text | 53 | __HEAD |
53 | ENTRY(_start) | 54 | ENTRY(_start) |
54 | #if CONFIG_KERNEL_BASE_ADDR == 0 | 55 | #if CONFIG_KERNEL_BASE_ADDR == 0 |
55 | brai TOPHYS(real_start) | 56 | brai TOPHYS(real_start) |
diff --git a/arch/microblaze/kernel/irq.c b/arch/microblaze/kernel/irq.c index 6f39e2c001f3..8f120aca123d 100644 --- a/arch/microblaze/kernel/irq.c +++ b/arch/microblaze/kernel/irq.c | |||
@@ -9,6 +9,7 @@ | |||
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <linux/init.h> | 11 | #include <linux/init.h> |
12 | #include <linux/ftrace.h> | ||
12 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
13 | #include <linux/hardirq.h> | 14 | #include <linux/hardirq.h> |
14 | #include <linux/interrupt.h> | 15 | #include <linux/interrupt.h> |
@@ -32,7 +33,7 @@ EXPORT_SYMBOL_GPL(irq_of_parse_and_map); | |||
32 | 33 | ||
33 | static u32 concurrent_irq; | 34 | static u32 concurrent_irq; |
34 | 35 | ||
35 | void do_IRQ(struct pt_regs *regs) | 36 | void __irq_entry do_IRQ(struct pt_regs *regs) |
36 | { | 37 | { |
37 | unsigned int irq; | 38 | unsigned int irq; |
38 | struct pt_regs *old_regs = set_irq_regs(regs); | 39 | struct pt_regs *old_regs = set_irq_regs(regs); |
diff --git a/arch/microblaze/kernel/microblaze_ksyms.c b/arch/microblaze/kernel/microblaze_ksyms.c index bc4dcb7d3861..ff85f7718035 100644 --- a/arch/microblaze/kernel/microblaze_ksyms.c +++ b/arch/microblaze/kernel/microblaze_ksyms.c | |||
@@ -52,3 +52,14 @@ EXPORT_SYMBOL_GPL(_ebss); | |||
52 | extern void _mcount(void); | 52 | extern void _mcount(void); |
53 | EXPORT_SYMBOL(_mcount); | 53 | EXPORT_SYMBOL(_mcount); |
54 | #endif | 54 | #endif |
55 | |||
56 | /* | ||
57 | * Assembly functions that may be used (directly or indirectly) by modules | ||
58 | */ | ||
59 | EXPORT_SYMBOL(__copy_tofrom_user); | ||
60 | EXPORT_SYMBOL(__strncpy_user); | ||
61 | |||
62 | #ifdef CONFIG_OPT_LIB_ASM | ||
63 | EXPORT_SYMBOL(memcpy); | ||
64 | EXPORT_SYMBOL(memmove); | ||
65 | #endif | ||
diff --git a/arch/microblaze/kernel/misc.S b/arch/microblaze/kernel/misc.S index 7cf86498326c..0fb5fc6c1fc2 100644 --- a/arch/microblaze/kernel/misc.S +++ b/arch/microblaze/kernel/misc.S | |||
@@ -93,39 +93,3 @@ early_console_reg_tlb_alloc: | |||
93 | nop | 93 | nop |
94 | 94 | ||
95 | .size early_console_reg_tlb_alloc, . - early_console_reg_tlb_alloc | 95 | .size early_console_reg_tlb_alloc, . - early_console_reg_tlb_alloc |
96 | |||
97 | /* | ||
98 | * Copy a whole page (4096 bytes). | ||
99 | */ | ||
100 | #define COPY_16_BYTES \ | ||
101 | lwi r7, r6, 0; \ | ||
102 | lwi r8, r6, 4; \ | ||
103 | lwi r9, r6, 8; \ | ||
104 | lwi r10, r6, 12; \ | ||
105 | swi r7, r5, 0; \ | ||
106 | swi r8, r5, 4; \ | ||
107 | swi r9, r5, 8; \ | ||
108 | swi r10, r5, 12 | ||
109 | |||
110 | |||
111 | /* FIXME DCACHE_LINE_BYTES (CONFIG_XILINX_MICROBLAZE0_DCACHE_LINE_LEN * 4)*/ | ||
112 | #define DCACHE_LINE_BYTES (4 * 4) | ||
113 | |||
114 | .globl copy_page; | ||
115 | .type copy_page, @function | ||
116 | .align 4; | ||
117 | copy_page: | ||
118 | ori r11, r0, (PAGE_SIZE/DCACHE_LINE_BYTES) - 1 | ||
119 | _copy_page_loop: | ||
120 | COPY_16_BYTES | ||
121 | #if DCACHE_LINE_BYTES >= 32 | ||
122 | COPY_16_BYTES | ||
123 | #endif | ||
124 | addik r6, r6, DCACHE_LINE_BYTES | ||
125 | addik r5, r5, DCACHE_LINE_BYTES | ||
126 | bneid r11, _copy_page_loop | ||
127 | addik r11, r11, -1 | ||
128 | rtsd r15, 8 | ||
129 | nop | ||
130 | |||
131 | .size copy_page, . - copy_page | ||
diff --git a/arch/microblaze/kernel/module.c b/arch/microblaze/kernel/module.c index cbecf110dc30..0e73f6606547 100644 --- a/arch/microblaze/kernel/module.c +++ b/arch/microblaze/kernel/module.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/string.h> | 16 | #include <linux/string.h> |
17 | 17 | ||
18 | #include <asm/pgtable.h> | 18 | #include <asm/pgtable.h> |
19 | #include <asm/cacheflush.h> | ||
19 | 20 | ||
20 | void *module_alloc(unsigned long size) | 21 | void *module_alloc(unsigned long size) |
21 | { | 22 | { |
@@ -151,6 +152,7 @@ int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab, | |||
151 | int module_finalize(const Elf32_Ehdr *hdr, const Elf_Shdr *sechdrs, | 152 | int module_finalize(const Elf32_Ehdr *hdr, const Elf_Shdr *sechdrs, |
152 | struct module *module) | 153 | struct module *module) |
153 | { | 154 | { |
155 | flush_dcache(); | ||
154 | return 0; | 156 | return 0; |
155 | } | 157 | } |
156 | 158 | ||
diff --git a/arch/microblaze/kernel/traps.c b/arch/microblaze/kernel/traps.c index 5e4570ef515c..75e49202a5ed 100644 --- a/arch/microblaze/kernel/traps.c +++ b/arch/microblaze/kernel/traps.c | |||
@@ -95,37 +95,3 @@ void dump_stack(void) | |||
95 | show_stack(NULL, NULL); | 95 | show_stack(NULL, NULL); |
96 | } | 96 | } |
97 | EXPORT_SYMBOL(dump_stack); | 97 | EXPORT_SYMBOL(dump_stack); |
98 | |||
99 | #ifdef CONFIG_MMU | ||
100 | void __bug(const char *file, int line, void *data) | ||
101 | { | ||
102 | if (data) | ||
103 | printk(KERN_CRIT "kernel BUG at %s:%d (data = %p)!\n", | ||
104 | file, line, data); | ||
105 | else | ||
106 | printk(KERN_CRIT "kernel BUG at %s:%d!\n", file, line); | ||
107 | |||
108 | machine_halt(); | ||
109 | } | ||
110 | |||
111 | int bad_trap(int trap_num, struct pt_regs *regs) | ||
112 | { | ||
113 | printk(KERN_CRIT | ||
114 | "unimplemented trap %d called at 0x%08lx, pid %d!\n", | ||
115 | trap_num, regs->pc, current->pid); | ||
116 | return -ENOSYS; | ||
117 | } | ||
118 | |||
119 | int debug_trap(struct pt_regs *regs) | ||
120 | { | ||
121 | int i; | ||
122 | printk(KERN_CRIT "debug trap\n"); | ||
123 | for (i = 0; i < 32; i++) { | ||
124 | /* printk("r%i:%08X\t",i,regs->gpr[i]); */ | ||
125 | if ((i % 4) == 3) | ||
126 | printk(KERN_CRIT "\n"); | ||
127 | } | ||
128 | printk(KERN_CRIT "pc:%08lX\tmsr:%08lX\n", regs->pc, regs->msr); | ||
129 | return -ENOSYS; | ||
130 | } | ||
131 | #endif | ||
diff --git a/arch/microblaze/kernel/vmlinux.lds.S b/arch/microblaze/kernel/vmlinux.lds.S index 5ef619aad634..db72d7124602 100644 --- a/arch/microblaze/kernel/vmlinux.lds.S +++ b/arch/microblaze/kernel/vmlinux.lds.S | |||
@@ -24,7 +24,8 @@ SECTIONS { | |||
24 | .text : AT(ADDR(.text) - LOAD_OFFSET) { | 24 | .text : AT(ADDR(.text) - LOAD_OFFSET) { |
25 | _text = . ; | 25 | _text = . ; |
26 | _stext = . ; | 26 | _stext = . ; |
27 | *(.text .text.*) | 27 | HEAD_TEXT |
28 | TEXT_TEXT | ||
28 | *(.fixup) | 29 | *(.fixup) |
29 | EXIT_TEXT | 30 | EXIT_TEXT |
30 | EXIT_CALL | 31 | EXIT_CALL |
diff --git a/arch/microblaze/mm/consistent.c b/arch/microblaze/mm/consistent.c index f956e24fe49c..5a59dad62bd2 100644 --- a/arch/microblaze/mm/consistent.c +++ b/arch/microblaze/mm/consistent.c | |||
@@ -42,11 +42,12 @@ | |||
42 | #include <linux/uaccess.h> | 42 | #include <linux/uaccess.h> |
43 | #include <asm/pgtable.h> | 43 | #include <asm/pgtable.h> |
44 | #include <asm/cpuinfo.h> | 44 | #include <asm/cpuinfo.h> |
45 | #include <asm/tlbflush.h> | ||
45 | 46 | ||
46 | #ifndef CONFIG_MMU | 47 | #ifndef CONFIG_MMU |
47 | |||
48 | /* I have to use dcache values because I can't relate on ram size */ | 48 | /* I have to use dcache values because I can't relate on ram size */ |
49 | #define UNCACHED_SHADOW_MASK (cpuinfo.dcache_high - cpuinfo.dcache_base + 1) | 49 | # define UNCACHED_SHADOW_MASK (cpuinfo.dcache_high - cpuinfo.dcache_base + 1) |
50 | #endif | ||
50 | 51 | ||
51 | /* | 52 | /* |
52 | * Consistent memory allocators. Used for DMA devices that want to | 53 | * Consistent memory allocators. Used for DMA devices that want to |
@@ -60,71 +61,16 @@ | |||
60 | */ | 61 | */ |
61 | void *consistent_alloc(int gfp, size_t size, dma_addr_t *dma_handle) | 62 | void *consistent_alloc(int gfp, size_t size, dma_addr_t *dma_handle) |
62 | { | 63 | { |
63 | struct page *page, *end, *free; | 64 | unsigned long order, vaddr; |
64 | unsigned long order; | 65 | void *ret; |
65 | void *ret, *virt; | 66 | unsigned int i, err = 0; |
66 | 67 | struct page *page, *end; | |
67 | if (in_interrupt()) | ||
68 | BUG(); | ||
69 | |||
70 | size = PAGE_ALIGN(size); | ||
71 | order = get_order(size); | ||
72 | |||
73 | page = alloc_pages(gfp, order); | ||
74 | if (!page) | ||
75 | goto no_page; | ||
76 | |||
77 | /* We could do with a page_to_phys and page_to_bus here. */ | ||
78 | virt = page_address(page); | ||
79 | ret = ioremap(virt_to_phys(virt), size); | ||
80 | if (!ret) | ||
81 | goto no_remap; | ||
82 | |||
83 | /* | ||
84 | * Here's the magic! Note if the uncached shadow is not implemented, | ||
85 | * it's up to the calling code to also test that condition and make | ||
86 | * other arranegments, such as manually flushing the cache and so on. | ||
87 | */ | ||
88 | #ifdef CONFIG_XILINX_UNCACHED_SHADOW | ||
89 | ret = (void *)((unsigned) ret | UNCACHED_SHADOW_MASK); | ||
90 | #endif | ||
91 | /* dma_handle is same as physical (shadowed) address */ | ||
92 | *dma_handle = (dma_addr_t)ret; | ||
93 | |||
94 | /* | ||
95 | * free wasted pages. We skip the first page since we know | ||
96 | * that it will have count = 1 and won't require freeing. | ||
97 | * We also mark the pages in use as reserved so that | ||
98 | * remap_page_range works. | ||
99 | */ | ||
100 | page = virt_to_page(virt); | ||
101 | free = page + (size >> PAGE_SHIFT); | ||
102 | end = page + (1 << order); | ||
103 | |||
104 | for (; page < end; page++) { | ||
105 | init_page_count(page); | ||
106 | if (page >= free) | ||
107 | __free_page(page); | ||
108 | else | ||
109 | SetPageReserved(page); | ||
110 | } | ||
111 | |||
112 | return ret; | ||
113 | no_remap: | ||
114 | __free_pages(page, order); | ||
115 | no_page: | ||
116 | return NULL; | ||
117 | } | ||
118 | |||
119 | #else | ||
120 | 68 | ||
121 | void *consistent_alloc(int gfp, size_t size, dma_addr_t *dma_handle) | 69 | #ifdef CONFIG_MMU |
122 | { | ||
123 | int order, err, i; | ||
124 | unsigned long page, va, flags; | ||
125 | phys_addr_t pa; | 70 | phys_addr_t pa; |
126 | struct vm_struct *area; | 71 | struct vm_struct *area; |
127 | void *ret; | 72 | unsigned long va; |
73 | #endif | ||
128 | 74 | ||
129 | if (in_interrupt()) | 75 | if (in_interrupt()) |
130 | BUG(); | 76 | BUG(); |
@@ -133,71 +79,133 @@ void *consistent_alloc(int gfp, size_t size, dma_addr_t *dma_handle) | |||
133 | size = PAGE_ALIGN(size); | 79 | size = PAGE_ALIGN(size); |
134 | order = get_order(size); | 80 | order = get_order(size); |
135 | 81 | ||
136 | page = __get_free_pages(gfp, order); | 82 | vaddr = __get_free_pages(gfp, order); |
137 | if (!page) { | 83 | if (!vaddr) |
138 | BUG(); | ||
139 | return NULL; | 84 | return NULL; |
140 | } | ||
141 | 85 | ||
142 | /* | 86 | /* |
143 | * we need to ensure that there are no cachelines in use, | 87 | * we need to ensure that there are no cachelines in use, |
144 | * or worse dirty in this area. | 88 | * or worse dirty in this area. |
145 | */ | 89 | */ |
146 | flush_dcache_range(virt_to_phys(page), virt_to_phys(page) + size); | 90 | flush_dcache_range(virt_to_phys((void *)vaddr), |
91 | virt_to_phys((void *)vaddr) + size); | ||
147 | 92 | ||
93 | #ifndef CONFIG_MMU | ||
94 | ret = (void *)vaddr; | ||
95 | /* | ||
96 | * Here's the magic! Note if the uncached shadow is not implemented, | ||
97 | * it's up to the calling code to also test that condition and make | ||
98 | * other arranegments, such as manually flushing the cache and so on. | ||
99 | */ | ||
100 | # ifdef CONFIG_XILINX_UNCACHED_SHADOW | ||
101 | ret = (void *)((unsigned) ret | UNCACHED_SHADOW_MASK); | ||
102 | # endif | ||
103 | if ((unsigned int)ret > cpuinfo.dcache_base && | ||
104 | (unsigned int)ret < cpuinfo.dcache_high) | ||
105 | printk(KERN_WARNING | ||
106 | "ERROR: Your cache coherent area is CACHED!!!\n"); | ||
107 | |||
108 | /* dma_handle is same as physical (shadowed) address */ | ||
109 | *dma_handle = (dma_addr_t)ret; | ||
110 | #else | ||
148 | /* Allocate some common virtual space to map the new pages. */ | 111 | /* Allocate some common virtual space to map the new pages. */ |
149 | area = get_vm_area(size, VM_ALLOC); | 112 | area = get_vm_area(size, VM_ALLOC); |
150 | if (area == NULL) { | 113 | if (!area) { |
151 | free_pages(page, order); | 114 | free_pages(vaddr, order); |
152 | return NULL; | 115 | return NULL; |
153 | } | 116 | } |
154 | va = (unsigned long) area->addr; | 117 | va = (unsigned long) area->addr; |
155 | ret = (void *)va; | 118 | ret = (void *)va; |
156 | 119 | ||
157 | /* This gives us the real physical address of the first page. */ | 120 | /* This gives us the real physical address of the first page. */ |
158 | *dma_handle = pa = virt_to_bus((void *)page); | 121 | *dma_handle = pa = virt_to_bus((void *)vaddr); |
159 | 122 | #endif | |
160 | /* MS: This is the whole magic - use cache inhibit pages */ | ||
161 | flags = _PAGE_KERNEL | _PAGE_NO_CACHE; | ||
162 | 123 | ||
163 | /* | 124 | /* |
164 | * Set refcount=1 on all pages in an order>0 | 125 | * free wasted pages. We skip the first page since we know |
165 | * allocation so that vfree() will actually | 126 | * that it will have count = 1 and won't require freeing. |
166 | * free all pages that were allocated. | 127 | * We also mark the pages in use as reserved so that |
128 | * remap_page_range works. | ||
167 | */ | 129 | */ |
168 | if (order > 0) { | 130 | page = virt_to_page(vaddr); |
169 | struct page *rpage = virt_to_page(page); | 131 | end = page + (1 << order); |
170 | for (i = 1; i < (1 << order); i++) | 132 | |
171 | init_page_count(rpage+i); | 133 | split_page(page, order); |
134 | |||
135 | for (i = 0; i < size && err == 0; i += PAGE_SIZE) { | ||
136 | #ifdef CONFIG_MMU | ||
137 | /* MS: This is the whole magic - use cache inhibit pages */ | ||
138 | err = map_page(va + i, pa + i, _PAGE_KERNEL | _PAGE_NO_CACHE); | ||
139 | #endif | ||
140 | |||
141 | SetPageReserved(page); | ||
142 | page++; | ||
172 | } | 143 | } |
173 | 144 | ||
174 | err = 0; | 145 | /* Free the otherwise unused pages. */ |
175 | for (i = 0; i < size && err == 0; i += PAGE_SIZE) | 146 | while (page < end) { |
176 | err = map_page(va+i, pa+i, flags); | 147 | __free_page(page); |
148 | page++; | ||
149 | } | ||
177 | 150 | ||
178 | if (err) { | 151 | if (err) { |
179 | vfree((void *)va); | 152 | free_pages(vaddr, order); |
180 | return NULL; | 153 | return NULL; |
181 | } | 154 | } |
182 | 155 | ||
183 | return ret; | 156 | return ret; |
184 | } | 157 | } |
185 | #endif /* CONFIG_MMU */ | ||
186 | EXPORT_SYMBOL(consistent_alloc); | 158 | EXPORT_SYMBOL(consistent_alloc); |
187 | 159 | ||
188 | /* | 160 | /* |
189 | * free page(s) as defined by the above mapping. | 161 | * free page(s) as defined by the above mapping. |
190 | */ | 162 | */ |
191 | void consistent_free(void *vaddr) | 163 | void consistent_free(size_t size, void *vaddr) |
192 | { | 164 | { |
165 | struct page *page; | ||
166 | |||
193 | if (in_interrupt()) | 167 | if (in_interrupt()) |
194 | BUG(); | 168 | BUG(); |
195 | 169 | ||
170 | size = PAGE_ALIGN(size); | ||
171 | |||
172 | #ifndef CONFIG_MMU | ||
196 | /* Clear SHADOW_MASK bit in address, and free as per usual */ | 173 | /* Clear SHADOW_MASK bit in address, and free as per usual */ |
197 | #ifdef CONFIG_XILINX_UNCACHED_SHADOW | 174 | # ifdef CONFIG_XILINX_UNCACHED_SHADOW |
198 | vaddr = (void *)((unsigned)vaddr & ~UNCACHED_SHADOW_MASK); | 175 | vaddr = (void *)((unsigned)vaddr & ~UNCACHED_SHADOW_MASK); |
176 | # endif | ||
177 | page = virt_to_page(vaddr); | ||
178 | |||
179 | do { | ||
180 | ClearPageReserved(page); | ||
181 | __free_page(page); | ||
182 | page++; | ||
183 | } while (size -= PAGE_SIZE); | ||
184 | #else | ||
185 | do { | ||
186 | pte_t *ptep; | ||
187 | unsigned long pfn; | ||
188 | |||
189 | ptep = pte_offset_kernel(pmd_offset(pgd_offset_k( | ||
190 | (unsigned int)vaddr), | ||
191 | (unsigned int)vaddr), | ||
192 | (unsigned int)vaddr); | ||
193 | if (!pte_none(*ptep) && pte_present(*ptep)) { | ||
194 | pfn = pte_pfn(*ptep); | ||
195 | pte_clear(&init_mm, (unsigned int)vaddr, ptep); | ||
196 | if (pfn_valid(pfn)) { | ||
197 | page = pfn_to_page(pfn); | ||
198 | |||
199 | ClearPageReserved(page); | ||
200 | __free_page(page); | ||
201 | } | ||
202 | } | ||
203 | vaddr += PAGE_SIZE; | ||
204 | } while (size -= PAGE_SIZE); | ||
205 | |||
206 | /* flush tlb */ | ||
207 | flush_tlb_all(); | ||
199 | #endif | 208 | #endif |
200 | vfree(vaddr); | ||
201 | } | 209 | } |
202 | EXPORT_SYMBOL(consistent_free); | 210 | EXPORT_SYMBOL(consistent_free); |
203 | 211 | ||
@@ -221,7 +229,7 @@ void consistent_sync(void *vaddr, size_t size, int direction) | |||
221 | case PCI_DMA_NONE: | 229 | case PCI_DMA_NONE: |
222 | BUG(); | 230 | BUG(); |
223 | case PCI_DMA_FROMDEVICE: /* invalidate only */ | 231 | case PCI_DMA_FROMDEVICE: /* invalidate only */ |
224 | flush_dcache_range(start, end); | 232 | invalidate_dcache_range(start, end); |
225 | break; | 233 | break; |
226 | case PCI_DMA_TODEVICE: /* writeback only */ | 234 | case PCI_DMA_TODEVICE: /* writeback only */ |
227 | flush_dcache_range(start, end); | 235 | flush_dcache_range(start, end); |
diff --git a/arch/microblaze/mm/fault.c b/arch/microblaze/mm/fault.c index 7af87f4b2c2c..bab922993185 100644 --- a/arch/microblaze/mm/fault.c +++ b/arch/microblaze/mm/fault.c | |||
@@ -273,16 +273,11 @@ bad_area_nosemaphore: | |||
273 | * us unable to handle the page fault gracefully. | 273 | * us unable to handle the page fault gracefully. |
274 | */ | 274 | */ |
275 | out_of_memory: | 275 | out_of_memory: |
276 | if (current->pid == 1) { | ||
277 | yield(); | ||
278 | down_read(&mm->mmap_sem); | ||
279 | goto survive; | ||
280 | } | ||
281 | up_read(&mm->mmap_sem); | 276 | up_read(&mm->mmap_sem); |
282 | printk(KERN_WARNING "VM: killing process %s\n", current->comm); | 277 | if (!user_mode(regs)) |
283 | if (user_mode(regs)) | 278 | bad_page_fault(regs, address, SIGKILL); |
284 | do_exit(SIGKILL); | 279 | else |
285 | bad_page_fault(regs, address, SIGKILL); | 280 | pagefault_out_of_memory(); |
286 | return; | 281 | return; |
287 | 282 | ||
288 | do_sigbus: | 283 | do_sigbus: |
diff --git a/arch/microblaze/mm/init.c b/arch/microblaze/mm/init.c index f42c2dde8b1c..cca3579d4268 100644 --- a/arch/microblaze/mm/init.c +++ b/arch/microblaze/mm/init.c | |||
@@ -47,6 +47,7 @@ unsigned long memory_start; | |||
47 | EXPORT_SYMBOL(memory_start); | 47 | EXPORT_SYMBOL(memory_start); |
48 | unsigned long memory_end; /* due to mm/nommu.c */ | 48 | unsigned long memory_end; /* due to mm/nommu.c */ |
49 | unsigned long memory_size; | 49 | unsigned long memory_size; |
50 | EXPORT_SYMBOL(memory_size); | ||
50 | 51 | ||
51 | /* | 52 | /* |
52 | * paging_init() sets up the page tables - in fact we've already done this. | 53 | * paging_init() sets up the page tables - in fact we've already done this. |
diff --git a/arch/microblaze/mm/pgtable.c b/arch/microblaze/mm/pgtable.c index d31312cde6ea..59bf2335a4ce 100644 --- a/arch/microblaze/mm/pgtable.c +++ b/arch/microblaze/mm/pgtable.c | |||
@@ -42,6 +42,7 @@ | |||
42 | 42 | ||
43 | unsigned long ioremap_base; | 43 | unsigned long ioremap_base; |
44 | unsigned long ioremap_bot; | 44 | unsigned long ioremap_bot; |
45 | EXPORT_SYMBOL(ioremap_bot); | ||
45 | 46 | ||
46 | /* The maximum lowmem defaults to 768Mb, but this can be configured to | 47 | /* The maximum lowmem defaults to 768Mb, but this can be configured to |
47 | * another value. | 48 | * another value. |
@@ -161,24 +162,6 @@ int map_page(unsigned long va, phys_addr_t pa, int flags) | |||
161 | return err; | 162 | return err; |
162 | } | 163 | } |
163 | 164 | ||
164 | void __init adjust_total_lowmem(void) | ||
165 | { | ||
166 | /* TBD */ | ||
167 | #if 0 | ||
168 | unsigned long max_low_mem = MAX_LOW_MEM; | ||
169 | |||
170 | if (total_lowmem > max_low_mem) { | ||
171 | total_lowmem = max_low_mem; | ||
172 | #ifndef CONFIG_HIGHMEM | ||
173 | printk(KERN_INFO "Warning, memory limited to %ld Mb, use " | ||
174 | "CONFIG_HIGHMEM to reach %ld Mb\n", | ||
175 | max_low_mem >> 20, total_memory >> 20); | ||
176 | total_memory = total_lowmem; | ||
177 | #endif /* CONFIG_HIGHMEM */ | ||
178 | } | ||
179 | #endif | ||
180 | } | ||
181 | |||
182 | /* | 165 | /* |
183 | * Map in all of physical memory starting at CONFIG_KERNEL_START. | 166 | * Map in all of physical memory starting at CONFIG_KERNEL_START. |
184 | */ | 167 | */ |
@@ -206,24 +189,6 @@ void __init mapin_ram(void) | |||
206 | /* is x a power of 2? */ | 189 | /* is x a power of 2? */ |
207 | #define is_power_of_2(x) ((x) != 0 && (((x) & ((x) - 1)) == 0)) | 190 | #define is_power_of_2(x) ((x) != 0 && (((x) & ((x) - 1)) == 0)) |
208 | 191 | ||
209 | /* | ||
210 | * Set up a mapping for a block of I/O. | ||
211 | * virt, phys, size must all be page-aligned. | ||
212 | * This should only be called before ioremap is called. | ||
213 | */ | ||
214 | void __init io_block_mapping(unsigned long virt, phys_addr_t phys, | ||
215 | unsigned int size, int flags) | ||
216 | { | ||
217 | int i; | ||
218 | |||
219 | if (virt > CONFIG_KERNEL_START && virt < ioremap_bot) | ||
220 | ioremap_bot = ioremap_base = virt; | ||
221 | |||
222 | /* Put it in the page tables. */ | ||
223 | for (i = 0; i < size; i += PAGE_SIZE) | ||
224 | map_page(virt + i, phys + i, flags); | ||
225 | } | ||
226 | |||
227 | /* Scan the real Linux page tables and return a PTE pointer for | 192 | /* Scan the real Linux page tables and return a PTE pointer for |
228 | * a virtual address in a context. | 193 | * a virtual address in a context. |
229 | * Returns true (1) if PTE was found, zero otherwise. The pointer to | 194 | * Returns true (1) if PTE was found, zero otherwise. The pointer to |
@@ -274,3 +239,18 @@ unsigned long iopa(unsigned long addr) | |||
274 | 239 | ||
275 | return pa; | 240 | return pa; |
276 | } | 241 | } |
242 | |||
243 | __init_refok pte_t *pte_alloc_one_kernel(struct mm_struct *mm, | ||
244 | unsigned long address) | ||
245 | { | ||
246 | pte_t *pte; | ||
247 | if (mem_init_done) { | ||
248 | pte = (pte_t *)__get_free_page(GFP_KERNEL | | ||
249 | __GFP_REPEAT | __GFP_ZERO); | ||
250 | } else { | ||
251 | pte = (pte_t *)early_get_page(); | ||
252 | if (pte) | ||
253 | clear_page(pte); | ||
254 | } | ||
255 | return pte; | ||
256 | } | ||
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c index 740bb32ec57e..9cb782b8e036 100644 --- a/arch/microblaze/pci/pci-common.c +++ b/arch/microblaze/pci/pci-common.c | |||
@@ -1025,7 +1025,7 @@ static void __devinit pcibios_fixup_bridge(struct pci_bus *bus) | |||
1025 | 1025 | ||
1026 | struct pci_dev *dev = bus->self; | 1026 | struct pci_dev *dev = bus->self; |
1027 | 1027 | ||
1028 | for (i = 0; i < PCI_BUS_NUM_RESOURCES; ++i) { | 1028 | pci_bus_for_each_resource(bus, res, i) { |
1029 | res = bus->resource[i]; | 1029 | res = bus->resource[i]; |
1030 | if (!res) | 1030 | if (!res) |
1031 | continue; | 1031 | continue; |
@@ -1131,21 +1131,20 @@ static int skip_isa_ioresource_align(struct pci_dev *dev) | |||
1131 | * but we want to try to avoid allocating at 0x2900-0x2bff | 1131 | * but we want to try to avoid allocating at 0x2900-0x2bff |
1132 | * which might have be mirrored at 0x0100-0x03ff.. | 1132 | * which might have be mirrored at 0x0100-0x03ff.. |
1133 | */ | 1133 | */ |
1134 | void pcibios_align_resource(void *data, struct resource *res, | 1134 | resource_size_t pcibios_align_resource(void *data, const struct resource *res, |
1135 | resource_size_t size, resource_size_t align) | 1135 | resource_size_t size, resource_size_t align) |
1136 | { | 1136 | { |
1137 | struct pci_dev *dev = data; | 1137 | struct pci_dev *dev = data; |
1138 | resource_size_t start = res->start; | ||
1138 | 1139 | ||
1139 | if (res->flags & IORESOURCE_IO) { | 1140 | if (res->flags & IORESOURCE_IO) { |
1140 | resource_size_t start = res->start; | ||
1141 | |||
1142 | if (skip_isa_ioresource_align(dev)) | 1141 | if (skip_isa_ioresource_align(dev)) |
1143 | return; | 1142 | return start; |
1144 | if (start & 0x300) { | 1143 | if (start & 0x300) |
1145 | start = (start + 0x3ff) & ~0x3ff; | 1144 | start = (start + 0x3ff) & ~0x3ff; |
1146 | res->start = start; | ||
1147 | } | ||
1148 | } | 1145 | } |
1146 | |||
1147 | return start; | ||
1149 | } | 1148 | } |
1150 | EXPORT_SYMBOL(pcibios_align_resource); | 1149 | EXPORT_SYMBOL(pcibios_align_resource); |
1151 | 1150 | ||
@@ -1228,7 +1227,7 @@ void pcibios_allocate_bus_resources(struct pci_bus *bus) | |||
1228 | pr_debug("PCI: Allocating bus resources for %04x:%02x...\n", | 1227 | pr_debug("PCI: Allocating bus resources for %04x:%02x...\n", |
1229 | pci_domain_nr(bus), bus->number); | 1228 | pci_domain_nr(bus), bus->number); |
1230 | 1229 | ||
1231 | for (i = 0; i < PCI_BUS_NUM_RESOURCES; ++i) { | 1230 | pci_bus_for_each_resource(bus, res, i) { |
1232 | res = bus->resource[i]; | 1231 | res = bus->resource[i]; |
1233 | if (!res || !res->flags | 1232 | if (!res || !res->flags |
1234 | || res->start > res->end || res->parent) | 1233 | || res->start > res->end || res->parent) |
@@ -1508,7 +1507,7 @@ void pcibios_finish_adding_to_bus(struct pci_bus *bus) | |||
1508 | pci_bus_add_devices(bus); | 1507 | pci_bus_add_devices(bus); |
1509 | 1508 | ||
1510 | /* Fixup EEH */ | 1509 | /* Fixup EEH */ |
1511 | eeh_add_device_tree_late(bus); | 1510 | /* eeh_add_device_tree_late(bus); */ |
1512 | } | 1511 | } |
1513 | EXPORT_SYMBOL_GPL(pcibios_finish_adding_to_bus); | 1512 | EXPORT_SYMBOL_GPL(pcibios_finish_adding_to_bus); |
1514 | 1513 | ||
diff --git a/arch/mips/include/asm/atomic.h b/arch/mips/include/asm/atomic.h index 519197ede089..59dc0c7ef733 100644 --- a/arch/mips/include/asm/atomic.h +++ b/arch/mips/include/asm/atomic.h | |||
@@ -29,7 +29,7 @@ | |||
29 | * | 29 | * |
30 | * Atomically reads the value of @v. | 30 | * Atomically reads the value of @v. |
31 | */ | 31 | */ |
32 | #define atomic_read(v) ((v)->counter) | 32 | #define atomic_read(v) (*(volatile int *)&(v)->counter) |
33 | 33 | ||
34 | /* | 34 | /* |
35 | * atomic_set - set atomic variable | 35 | * atomic_set - set atomic variable |
@@ -410,7 +410,7 @@ static __inline__ int atomic_add_unless(atomic_t *v, int a, int u) | |||
410 | * @v: pointer of type atomic64_t | 410 | * @v: pointer of type atomic64_t |
411 | * | 411 | * |
412 | */ | 412 | */ |
413 | #define atomic64_read(v) ((v)->counter) | 413 | #define atomic64_read(v) (*(volatile long *)&(v)->counter) |
414 | 414 | ||
415 | /* | 415 | /* |
416 | * atomic64_set - set atomic variable | 416 | * atomic64_set - set atomic variable |
diff --git a/arch/mips/include/asm/i8253.h b/arch/mips/include/asm/i8253.h index 032ca73f181b..48bb82372994 100644 --- a/arch/mips/include/asm/i8253.h +++ b/arch/mips/include/asm/i8253.h | |||
@@ -12,7 +12,7 @@ | |||
12 | #define PIT_CH0 0x40 | 12 | #define PIT_CH0 0x40 |
13 | #define PIT_CH2 0x42 | 13 | #define PIT_CH2 0x42 |
14 | 14 | ||
15 | extern spinlock_t i8253_lock; | 15 | extern raw_spinlock_t i8253_lock; |
16 | 16 | ||
17 | extern void setup_pit_timer(void); | 17 | extern void setup_pit_timer(void); |
18 | 18 | ||
diff --git a/arch/mips/include/asm/mipsregs.h b/arch/mips/include/asm/mipsregs.h index 49382d5e891a..c6e3c93ce7c7 100644 --- a/arch/mips/include/asm/mipsregs.h +++ b/arch/mips/include/asm/mipsregs.h | |||
@@ -135,6 +135,12 @@ | |||
135 | #define FPU_CSR_COND7 0x80000000 /* $fcc7 */ | 135 | #define FPU_CSR_COND7 0x80000000 /* $fcc7 */ |
136 | 136 | ||
137 | /* | 137 | /* |
138 | * Bits 18 - 20 of the FPU Status Register will be read as 0, | ||
139 | * and should be written as zero. | ||
140 | */ | ||
141 | #define FPU_CSR_RSVD 0x001c0000 | ||
142 | |||
143 | /* | ||
138 | * X the exception cause indicator | 144 | * X the exception cause indicator |
139 | * E the exception enable | 145 | * E the exception enable |
140 | * S the sticky/flag bit | 146 | * S the sticky/flag bit |
@@ -161,7 +167,8 @@ | |||
161 | #define FPU_CSR_UDF_S 0x00000008 | 167 | #define FPU_CSR_UDF_S 0x00000008 |
162 | #define FPU_CSR_INE_S 0x00000004 | 168 | #define FPU_CSR_INE_S 0x00000004 |
163 | 169 | ||
164 | /* rounding mode */ | 170 | /* Bits 0 and 1 of FPU Status Register specify the rounding mode */ |
171 | #define FPU_CSR_RM 0x00000003 | ||
165 | #define FPU_CSR_RN 0x0 /* nearest */ | 172 | #define FPU_CSR_RN 0x0 /* nearest */ |
166 | #define FPU_CSR_RZ 0x1 /* towards zero */ | 173 | #define FPU_CSR_RZ 0x1 /* towards zero */ |
167 | #define FPU_CSR_RU 0x2 /* towards +Infinity */ | 174 | #define FPU_CSR_RU 0x2 /* towards +Infinity */ |
diff --git a/arch/mips/kernel/i8253.c b/arch/mips/kernel/i8253.c index ed5c441615e4..94794062a177 100644 --- a/arch/mips/kernel/i8253.c +++ b/arch/mips/kernel/i8253.c | |||
@@ -15,7 +15,7 @@ | |||
15 | #include <asm/io.h> | 15 | #include <asm/io.h> |
16 | #include <asm/time.h> | 16 | #include <asm/time.h> |
17 | 17 | ||
18 | DEFINE_SPINLOCK(i8253_lock); | 18 | DEFINE_RAW_SPINLOCK(i8253_lock); |
19 | EXPORT_SYMBOL(i8253_lock); | 19 | EXPORT_SYMBOL(i8253_lock); |
20 | 20 | ||
21 | /* | 21 | /* |
@@ -26,7 +26,7 @@ EXPORT_SYMBOL(i8253_lock); | |||
26 | static void init_pit_timer(enum clock_event_mode mode, | 26 | static void init_pit_timer(enum clock_event_mode mode, |
27 | struct clock_event_device *evt) | 27 | struct clock_event_device *evt) |
28 | { | 28 | { |
29 | spin_lock(&i8253_lock); | 29 | raw_spin_lock(&i8253_lock); |
30 | 30 | ||
31 | switch(mode) { | 31 | switch(mode) { |
32 | case CLOCK_EVT_MODE_PERIODIC: | 32 | case CLOCK_EVT_MODE_PERIODIC: |
@@ -55,7 +55,7 @@ static void init_pit_timer(enum clock_event_mode mode, | |||
55 | /* Nothing to do here */ | 55 | /* Nothing to do here */ |
56 | break; | 56 | break; |
57 | } | 57 | } |
58 | spin_unlock(&i8253_lock); | 58 | raw_spin_unlock(&i8253_lock); |
59 | } | 59 | } |
60 | 60 | ||
61 | /* | 61 | /* |
@@ -65,10 +65,10 @@ static void init_pit_timer(enum clock_event_mode mode, | |||
65 | */ | 65 | */ |
66 | static int pit_next_event(unsigned long delta, struct clock_event_device *evt) | 66 | static int pit_next_event(unsigned long delta, struct clock_event_device *evt) |
67 | { | 67 | { |
68 | spin_lock(&i8253_lock); | 68 | raw_spin_lock(&i8253_lock); |
69 | outb_p(delta & 0xff , PIT_CH0); /* LSB */ | 69 | outb_p(delta & 0xff , PIT_CH0); /* LSB */ |
70 | outb(delta >> 8 , PIT_CH0); /* MSB */ | 70 | outb(delta >> 8 , PIT_CH0); /* MSB */ |
71 | spin_unlock(&i8253_lock); | 71 | raw_spin_unlock(&i8253_lock); |
72 | 72 | ||
73 | return 0; | 73 | return 0; |
74 | } | 74 | } |
@@ -137,7 +137,7 @@ static cycle_t pit_read(struct clocksource *cs) | |||
137 | static int old_count; | 137 | static int old_count; |
138 | static u32 old_jifs; | 138 | static u32 old_jifs; |
139 | 139 | ||
140 | spin_lock_irqsave(&i8253_lock, flags); | 140 | raw_spin_lock_irqsave(&i8253_lock, flags); |
141 | /* | 141 | /* |
142 | * Although our caller may have the read side of xtime_lock, | 142 | * Although our caller may have the read side of xtime_lock, |
143 | * this is now a seqlock, and we are cheating in this routine | 143 | * this is now a seqlock, and we are cheating in this routine |
@@ -183,7 +183,7 @@ static cycle_t pit_read(struct clocksource *cs) | |||
183 | old_count = count; | 183 | old_count = count; |
184 | old_jifs = jifs; | 184 | old_jifs = jifs; |
185 | 185 | ||
186 | spin_unlock_irqrestore(&i8253_lock, flags); | 186 | raw_spin_unlock_irqrestore(&i8253_lock, flags); |
187 | 187 | ||
188 | count = (LATCH - 1) - count; | 188 | count = (LATCH - 1) - count; |
189 | 189 | ||
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S index 44337ba03717..a5297e2a353a 100644 --- a/arch/mips/kernel/scall64-n32.S +++ b/arch/mips/kernel/scall64-n32.S | |||
@@ -385,7 +385,7 @@ EXPORT(sysn32_call_table) | |||
385 | PTR sys_fchmodat | 385 | PTR sys_fchmodat |
386 | PTR sys_faccessat | 386 | PTR sys_faccessat |
387 | PTR compat_sys_pselect6 | 387 | PTR compat_sys_pselect6 |
388 | PTR sys_ppoll /* 6265 */ | 388 | PTR compat_sys_ppoll /* 6265 */ |
389 | PTR sys_unshare | 389 | PTR sys_unshare |
390 | PTR sys_splice | 390 | PTR sys_splice |
391 | PTR sys_sync_file_range | 391 | PTR sys_sync_file_range |
diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c index 8f2f8e9d8b21..f2338d1c0b48 100644 --- a/arch/mips/math-emu/cp1emu.c +++ b/arch/mips/math-emu/cp1emu.c | |||
@@ -78,6 +78,9 @@ DEFINE_PER_CPU(struct mips_fpu_emulator_stats, fpuemustats); | |||
78 | #define FPCREG_RID 0 /* $0 = revision id */ | 78 | #define FPCREG_RID 0 /* $0 = revision id */ |
79 | #define FPCREG_CSR 31 /* $31 = csr */ | 79 | #define FPCREG_CSR 31 /* $31 = csr */ |
80 | 80 | ||
81 | /* Determine rounding mode from the RM bits of the FCSR */ | ||
82 | #define modeindex(v) ((v) & FPU_CSR_RM) | ||
83 | |||
81 | /* Convert Mips rounding mode (0..3) to IEEE library modes. */ | 84 | /* Convert Mips rounding mode (0..3) to IEEE library modes. */ |
82 | static const unsigned char ieee_rm[4] = { | 85 | static const unsigned char ieee_rm[4] = { |
83 | [FPU_CSR_RN] = IEEE754_RN, | 86 | [FPU_CSR_RN] = IEEE754_RN, |
@@ -384,10 +387,14 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_struct *ctx) | |||
384 | (void *) (xcp->cp0_epc), | 387 | (void *) (xcp->cp0_epc), |
385 | MIPSInst_RT(ir), value); | 388 | MIPSInst_RT(ir), value); |
386 | #endif | 389 | #endif |
387 | value &= (FPU_CSR_FLUSH | FPU_CSR_ALL_E | FPU_CSR_ALL_S | 0x03); | 390 | |
388 | ctx->fcr31 &= ~(FPU_CSR_FLUSH | FPU_CSR_ALL_E | FPU_CSR_ALL_S | 0x03); | 391 | /* |
389 | /* convert to ieee library modes */ | 392 | * Don't write reserved bits, |
390 | ctx->fcr31 |= (value & ~0x3) | ieee_rm[value & 0x3]; | 393 | * and convert to ieee library modes |
394 | */ | ||
395 | ctx->fcr31 = (value & | ||
396 | ~(FPU_CSR_RSVD | FPU_CSR_RM)) | | ||
397 | ieee_rm[modeindex(value)]; | ||
391 | } | 398 | } |
392 | if ((ctx->fcr31 >> 5) & ctx->fcr31 & FPU_CSR_ALL_E) { | 399 | if ((ctx->fcr31 >> 5) & ctx->fcr31 & FPU_CSR_ALL_E) { |
393 | return SIGFPE; | 400 | return SIGFPE; |
diff --git a/arch/mips/oprofile/op_model_loongson2.c b/arch/mips/oprofile/op_model_loongson2.c index 29e2326b6257..fa3bf661ae29 100644 --- a/arch/mips/oprofile/op_model_loongson2.c +++ b/arch/mips/oprofile/op_model_loongson2.c | |||
@@ -122,7 +122,7 @@ static irqreturn_t loongson2_perfcount_handler(int irq, void *dev_id) | |||
122 | */ | 122 | */ |
123 | 123 | ||
124 | /* Check whether the irq belongs to me */ | 124 | /* Check whether the irq belongs to me */ |
125 | enabled = read_c0_perfcnt() & LOONGSON2_PERFCNT_INT_EN; | 125 | enabled = read_c0_perfctrl() & LOONGSON2_PERFCNT_INT_EN; |
126 | if (!enabled) | 126 | if (!enabled) |
127 | return IRQ_NONE; | 127 | return IRQ_NONE; |
128 | enabled = reg.cnt1_enabled | reg.cnt2_enabled; | 128 | enabled = reg.cnt1_enabled | reg.cnt2_enabled; |
diff --git a/arch/mn10300/include/asm/atomic.h b/arch/mn10300/include/asm/atomic.h index 5bf5be9566de..e41222d6c2fd 100644 --- a/arch/mn10300/include/asm/atomic.h +++ b/arch/mn10300/include/asm/atomic.h | |||
@@ -31,7 +31,7 @@ | |||
31 | * Atomically reads the value of @v. Note that the guaranteed | 31 | * Atomically reads the value of @v. Note that the guaranteed |
32 | * useful range of an atomic_t is only 24 bits. | 32 | * useful range of an atomic_t is only 24 bits. |
33 | */ | 33 | */ |
34 | #define atomic_read(v) ((v)->counter) | 34 | #define atomic_read(v) (*(volatile int *)&(v)->counter) |
35 | 35 | ||
36 | /** | 36 | /** |
37 | * atomic_set - set atomic variable | 37 | * atomic_set - set atomic variable |
diff --git a/arch/parisc/include/asm/atomic.h b/arch/parisc/include/asm/atomic.h index 716634d1f546..f81955934aeb 100644 --- a/arch/parisc/include/asm/atomic.h +++ b/arch/parisc/include/asm/atomic.h | |||
@@ -189,7 +189,7 @@ static __inline__ void atomic_set(atomic_t *v, int i) | |||
189 | 189 | ||
190 | static __inline__ int atomic_read(const atomic_t *v) | 190 | static __inline__ int atomic_read(const atomic_t *v) |
191 | { | 191 | { |
192 | return v->counter; | 192 | return (*(volatile int *)&(v)->counter); |
193 | } | 193 | } |
194 | 194 | ||
195 | /* exported interface */ | 195 | /* exported interface */ |
@@ -286,7 +286,7 @@ atomic64_set(atomic64_t *v, s64 i) | |||
286 | static __inline__ s64 | 286 | static __inline__ s64 |
287 | atomic64_read(const atomic64_t *v) | 287 | atomic64_read(const atomic64_t *v) |
288 | { | 288 | { |
289 | return v->counter; | 289 | return (*(volatile long *)&(v)->counter); |
290 | } | 290 | } |
291 | 291 | ||
292 | #define atomic64_add(i,v) ((void)(__atomic64_add_return( ((s64)(i)),(v)))) | 292 | #define atomic64_add(i,v) ((void)(__atomic64_add_return( ((s64)(i)),(v)))) |
diff --git a/arch/powerpc/include/asm/hw_irq.h b/arch/powerpc/include/asm/hw_irq.h index 9f4c9d4f5803..bd100fcf40d0 100644 --- a/arch/powerpc/include/asm/hw_irq.h +++ b/arch/powerpc/include/asm/hw_irq.h | |||
@@ -130,43 +130,5 @@ static inline int irqs_disabled_flags(unsigned long flags) | |||
130 | */ | 130 | */ |
131 | struct irq_chip; | 131 | struct irq_chip; |
132 | 132 | ||
133 | #ifdef CONFIG_PERF_EVENTS | ||
134 | |||
135 | #ifdef CONFIG_PPC64 | ||
136 | static inline unsigned long test_perf_event_pending(void) | ||
137 | { | ||
138 | unsigned long x; | ||
139 | |||
140 | asm volatile("lbz %0,%1(13)" | ||
141 | : "=r" (x) | ||
142 | : "i" (offsetof(struct paca_struct, perf_event_pending))); | ||
143 | return x; | ||
144 | } | ||
145 | |||
146 | static inline void set_perf_event_pending(void) | ||
147 | { | ||
148 | asm volatile("stb %0,%1(13)" : : | ||
149 | "r" (1), | ||
150 | "i" (offsetof(struct paca_struct, perf_event_pending))); | ||
151 | } | ||
152 | |||
153 | static inline void clear_perf_event_pending(void) | ||
154 | { | ||
155 | asm volatile("stb %0,%1(13)" : : | ||
156 | "r" (0), | ||
157 | "i" (offsetof(struct paca_struct, perf_event_pending))); | ||
158 | } | ||
159 | #endif /* CONFIG_PPC64 */ | ||
160 | |||
161 | #else /* CONFIG_PERF_EVENTS */ | ||
162 | |||
163 | static inline unsigned long test_perf_event_pending(void) | ||
164 | { | ||
165 | return 0; | ||
166 | } | ||
167 | |||
168 | static inline void clear_perf_event_pending(void) {} | ||
169 | #endif /* CONFIG_PERF_EVENTS */ | ||
170 | |||
171 | #endif /* __KERNEL__ */ | 133 | #endif /* __KERNEL__ */ |
172 | #endif /* _ASM_POWERPC_HW_IRQ_H */ | 134 | #endif /* _ASM_POWERPC_HW_IRQ_H */ |
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c index 957ceb7059c5..c09138d150d4 100644 --- a/arch/powerpc/kernel/asm-offsets.c +++ b/arch/powerpc/kernel/asm-offsets.c | |||
@@ -133,7 +133,6 @@ int main(void) | |||
133 | DEFINE(PACAKMSR, offsetof(struct paca_struct, kernel_msr)); | 133 | DEFINE(PACAKMSR, offsetof(struct paca_struct, kernel_msr)); |
134 | DEFINE(PACASOFTIRQEN, offsetof(struct paca_struct, soft_enabled)); | 134 | DEFINE(PACASOFTIRQEN, offsetof(struct paca_struct, soft_enabled)); |
135 | DEFINE(PACAHARDIRQEN, offsetof(struct paca_struct, hard_enabled)); | 135 | DEFINE(PACAHARDIRQEN, offsetof(struct paca_struct, hard_enabled)); |
136 | DEFINE(PACAPERFPEND, offsetof(struct paca_struct, perf_event_pending)); | ||
137 | DEFINE(PACACONTEXTID, offsetof(struct paca_struct, context.id)); | 136 | DEFINE(PACACONTEXTID, offsetof(struct paca_struct, context.id)); |
138 | #ifdef CONFIG_PPC_MM_SLICES | 137 | #ifdef CONFIG_PPC_MM_SLICES |
139 | DEFINE(PACALOWSLICESPSIZE, offsetof(struct paca_struct, | 138 | DEFINE(PACALOWSLICESPSIZE, offsetof(struct paca_struct, |
diff --git a/arch/powerpc/kernel/dma-swiotlb.c b/arch/powerpc/kernel/dma-swiotlb.c index 59c928564a03..4ff4da2c238b 100644 --- a/arch/powerpc/kernel/dma-swiotlb.c +++ b/arch/powerpc/kernel/dma-swiotlb.c | |||
@@ -1,7 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * Contains routines needed to support swiotlb for ppc. | 2 | * Contains routines needed to support swiotlb for ppc. |
3 | * | 3 | * |
4 | * Copyright (C) 2009 Becky Bruce, Freescale Semiconductor | 4 | * Copyright (C) 2009-2010 Freescale Semiconductor, Inc. |
5 | * Author: Becky Bruce | ||
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify it | 7 | * This program is free software; you can redistribute it and/or modify it |
7 | * under the terms of the GNU General Public License as published by the | 8 | * under the terms of the GNU General Public License as published by the |
@@ -70,7 +71,7 @@ static int ppc_swiotlb_bus_notify(struct notifier_block *nb, | |||
70 | sd->max_direct_dma_addr = 0; | 71 | sd->max_direct_dma_addr = 0; |
71 | 72 | ||
72 | /* May need to bounce if the device can't address all of DRAM */ | 73 | /* May need to bounce if the device can't address all of DRAM */ |
73 | if (dma_get_mask(dev) < lmb_end_of_DRAM()) | 74 | if ((dma_get_mask(dev) + 1) < lmb_end_of_DRAM()) |
74 | set_dma_ops(dev, &swiotlb_dma_ops); | 75 | set_dma_ops(dev, &swiotlb_dma_ops); |
75 | 76 | ||
76 | return NOTIFY_DONE; | 77 | return NOTIFY_DONE; |
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S index 07109d843787..42e9d908914a 100644 --- a/arch/powerpc/kernel/entry_64.S +++ b/arch/powerpc/kernel/entry_64.S | |||
@@ -556,15 +556,6 @@ ALT_FW_FTR_SECTION_END_IFCLR(FW_FEATURE_ISERIES) | |||
556 | 2: | 556 | 2: |
557 | TRACE_AND_RESTORE_IRQ(r5); | 557 | TRACE_AND_RESTORE_IRQ(r5); |
558 | 558 | ||
559 | #ifdef CONFIG_PERF_EVENTS | ||
560 | /* check paca->perf_event_pending if we're enabling ints */ | ||
561 | lbz r3,PACAPERFPEND(r13) | ||
562 | and. r3,r3,r5 | ||
563 | beq 27f | ||
564 | bl .perf_event_do_pending | ||
565 | 27: | ||
566 | #endif /* CONFIG_PERF_EVENTS */ | ||
567 | |||
568 | /* extract EE bit and use it to restore paca->hard_enabled */ | 559 | /* extract EE bit and use it to restore paca->hard_enabled */ |
569 | ld r3,_MSR(r1) | 560 | ld r3,_MSR(r1) |
570 | rldicl r4,r3,49,63 /* r0 = (r3 >> 15) & 1 */ | 561 | rldicl r4,r3,49,63 /* r0 = (r3 >> 15) & 1 */ |
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c index 64f6f2031c22..066bd31551d5 100644 --- a/arch/powerpc/kernel/irq.c +++ b/arch/powerpc/kernel/irq.c | |||
@@ -53,7 +53,6 @@ | |||
53 | #include <linux/bootmem.h> | 53 | #include <linux/bootmem.h> |
54 | #include <linux/pci.h> | 54 | #include <linux/pci.h> |
55 | #include <linux/debugfs.h> | 55 | #include <linux/debugfs.h> |
56 | #include <linux/perf_event.h> | ||
57 | 56 | ||
58 | #include <asm/uaccess.h> | 57 | #include <asm/uaccess.h> |
59 | #include <asm/system.h> | 58 | #include <asm/system.h> |
@@ -145,11 +144,6 @@ notrace void raw_local_irq_restore(unsigned long en) | |||
145 | } | 144 | } |
146 | #endif /* CONFIG_PPC_STD_MMU_64 */ | 145 | #endif /* CONFIG_PPC_STD_MMU_64 */ |
147 | 146 | ||
148 | if (test_perf_event_pending()) { | ||
149 | clear_perf_event_pending(); | ||
150 | perf_event_do_pending(); | ||
151 | } | ||
152 | |||
153 | /* | 147 | /* |
154 | * if (get_paca()->hard_enabled) return; | 148 | * if (get_paca()->hard_enabled) return; |
155 | * But again we need to take care that gcc gets hard_enabled directly | 149 | * But again we need to take care that gcc gets hard_enabled directly |
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c index 1b16b9a3e49a..0441bbdadbd1 100644 --- a/arch/powerpc/kernel/time.c +++ b/arch/powerpc/kernel/time.c | |||
@@ -532,25 +532,60 @@ void __init iSeries_time_init_early(void) | |||
532 | } | 532 | } |
533 | #endif /* CONFIG_PPC_ISERIES */ | 533 | #endif /* CONFIG_PPC_ISERIES */ |
534 | 534 | ||
535 | #if defined(CONFIG_PERF_EVENTS) && defined(CONFIG_PPC32) | 535 | #ifdef CONFIG_PERF_EVENTS |
536 | DEFINE_PER_CPU(u8, perf_event_pending); | ||
537 | 536 | ||
538 | void set_perf_event_pending(void) | 537 | /* |
538 | * 64-bit uses a byte in the PACA, 32-bit uses a per-cpu variable... | ||
539 | */ | ||
540 | #ifdef CONFIG_PPC64 | ||
541 | static inline unsigned long test_perf_event_pending(void) | ||
539 | { | 542 | { |
540 | get_cpu_var(perf_event_pending) = 1; | 543 | unsigned long x; |
541 | set_dec(1); | 544 | |
542 | put_cpu_var(perf_event_pending); | 545 | asm volatile("lbz %0,%1(13)" |
546 | : "=r" (x) | ||
547 | : "i" (offsetof(struct paca_struct, perf_event_pending))); | ||
548 | return x; | ||
543 | } | 549 | } |
544 | 550 | ||
551 | static inline void set_perf_event_pending_flag(void) | ||
552 | { | ||
553 | asm volatile("stb %0,%1(13)" : : | ||
554 | "r" (1), | ||
555 | "i" (offsetof(struct paca_struct, perf_event_pending))); | ||
556 | } | ||
557 | |||
558 | static inline void clear_perf_event_pending(void) | ||
559 | { | ||
560 | asm volatile("stb %0,%1(13)" : : | ||
561 | "r" (0), | ||
562 | "i" (offsetof(struct paca_struct, perf_event_pending))); | ||
563 | } | ||
564 | |||
565 | #else /* 32-bit */ | ||
566 | |||
567 | DEFINE_PER_CPU(u8, perf_event_pending); | ||
568 | |||
569 | #define set_perf_event_pending_flag() __get_cpu_var(perf_event_pending) = 1 | ||
545 | #define test_perf_event_pending() __get_cpu_var(perf_event_pending) | 570 | #define test_perf_event_pending() __get_cpu_var(perf_event_pending) |
546 | #define clear_perf_event_pending() __get_cpu_var(perf_event_pending) = 0 | 571 | #define clear_perf_event_pending() __get_cpu_var(perf_event_pending) = 0 |
547 | 572 | ||
548 | #else /* CONFIG_PERF_EVENTS && CONFIG_PPC32 */ | 573 | #endif /* 32 vs 64 bit */ |
574 | |||
575 | void set_perf_event_pending(void) | ||
576 | { | ||
577 | preempt_disable(); | ||
578 | set_perf_event_pending_flag(); | ||
579 | set_dec(1); | ||
580 | preempt_enable(); | ||
581 | } | ||
582 | |||
583 | #else /* CONFIG_PERF_EVENTS */ | ||
549 | 584 | ||
550 | #define test_perf_event_pending() 0 | 585 | #define test_perf_event_pending() 0 |
551 | #define clear_perf_event_pending() | 586 | #define clear_perf_event_pending() |
552 | 587 | ||
553 | #endif /* CONFIG_PERF_EVENTS && CONFIG_PPC32 */ | 588 | #endif /* CONFIG_PERF_EVENTS */ |
554 | 589 | ||
555 | /* | 590 | /* |
556 | * For iSeries shared processors, we have to let the hypervisor | 591 | * For iSeries shared processors, we have to let the hypervisor |
@@ -582,10 +617,6 @@ void timer_interrupt(struct pt_regs * regs) | |||
582 | set_dec(DECREMENTER_MAX); | 617 | set_dec(DECREMENTER_MAX); |
583 | 618 | ||
584 | #ifdef CONFIG_PPC32 | 619 | #ifdef CONFIG_PPC32 |
585 | if (test_perf_event_pending()) { | ||
586 | clear_perf_event_pending(); | ||
587 | perf_event_do_pending(); | ||
588 | } | ||
589 | if (atomic_read(&ppc_n_lost_interrupts) != 0) | 620 | if (atomic_read(&ppc_n_lost_interrupts) != 0) |
590 | do_IRQ(regs); | 621 | do_IRQ(regs); |
591 | #endif | 622 | #endif |
@@ -604,6 +635,11 @@ void timer_interrupt(struct pt_regs * regs) | |||
604 | 635 | ||
605 | calculate_steal_time(); | 636 | calculate_steal_time(); |
606 | 637 | ||
638 | if (test_perf_event_pending()) { | ||
639 | clear_perf_event_pending(); | ||
640 | perf_event_do_pending(); | ||
641 | } | ||
642 | |||
607 | #ifdef CONFIG_PPC_ISERIES | 643 | #ifdef CONFIG_PPC_ISERIES |
608 | if (firmware_has_feature(FW_FEATURE_ISERIES)) | 644 | if (firmware_has_feature(FW_FEATURE_ISERIES)) |
609 | get_lppaca()->int_dword.fields.decr_int = 0; | 645 | get_lppaca()->int_dword.fields.decr_int = 0; |
diff --git a/arch/powerpc/kvm/44x_tlb.c b/arch/powerpc/kvm/44x_tlb.c index 2570fcc7665d..812312542e50 100644 --- a/arch/powerpc/kvm/44x_tlb.c +++ b/arch/powerpc/kvm/44x_tlb.c | |||
@@ -440,7 +440,7 @@ int kvmppc_44x_emul_tlbwe(struct kvm_vcpu *vcpu, u8 ra, u8 rs, u8 ws) | |||
440 | unsigned int gtlb_index; | 440 | unsigned int gtlb_index; |
441 | 441 | ||
442 | gtlb_index = kvmppc_get_gpr(vcpu, ra); | 442 | gtlb_index = kvmppc_get_gpr(vcpu, ra); |
443 | if (gtlb_index > KVM44x_GUEST_TLB_SIZE) { | 443 | if (gtlb_index >= KVM44x_GUEST_TLB_SIZE) { |
444 | printk("%s: index %d\n", __func__, gtlb_index); | 444 | printk("%s: index %d\n", __func__, gtlb_index); |
445 | kvmppc_dump_vcpu(vcpu); | 445 | kvmppc_dump_vcpu(vcpu); |
446 | return EMULATE_FAIL; | 446 | return EMULATE_FAIL; |
diff --git a/arch/s390/kernel/head31.S b/arch/s390/kernel/head31.S index 1bbcc499d455..b8f8dc126102 100644 --- a/arch/s390/kernel/head31.S +++ b/arch/s390/kernel/head31.S | |||
@@ -82,7 +82,7 @@ startup_continue: | |||
82 | _ehead: | 82 | _ehead: |
83 | 83 | ||
84 | #ifdef CONFIG_SHARED_KERNEL | 84 | #ifdef CONFIG_SHARED_KERNEL |
85 | .org 0x100000 | 85 | .org 0x100000 - 0x11000 # head.o ends at 0x11000 |
86 | #endif | 86 | #endif |
87 | 87 | ||
88 | # | 88 | # |
diff --git a/arch/s390/kernel/head64.S b/arch/s390/kernel/head64.S index 1f70970de0aa..cdef68717416 100644 --- a/arch/s390/kernel/head64.S +++ b/arch/s390/kernel/head64.S | |||
@@ -80,7 +80,7 @@ startup_continue: | |||
80 | _ehead: | 80 | _ehead: |
81 | 81 | ||
82 | #ifdef CONFIG_SHARED_KERNEL | 82 | #ifdef CONFIG_SHARED_KERNEL |
83 | .org 0x100000 | 83 | .org 0x100000 - 0x11000 # head.o ends at 0x11000 |
84 | #endif | 84 | #endif |
85 | 85 | ||
86 | # | 86 | # |
diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c index 33fdc5a79764..9f654da4cecc 100644 --- a/arch/s390/kernel/ptrace.c +++ b/arch/s390/kernel/ptrace.c | |||
@@ -640,7 +640,7 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request, | |||
640 | 640 | ||
641 | asmlinkage long do_syscall_trace_enter(struct pt_regs *regs) | 641 | asmlinkage long do_syscall_trace_enter(struct pt_regs *regs) |
642 | { | 642 | { |
643 | long ret; | 643 | long ret = 0; |
644 | 644 | ||
645 | /* Do the secure computing check first. */ | 645 | /* Do the secure computing check first. */ |
646 | secure_computing(regs->gprs[2]); | 646 | secure_computing(regs->gprs[2]); |
@@ -649,7 +649,6 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs) | |||
649 | * The sysc_tracesys code in entry.S stored the system | 649 | * The sysc_tracesys code in entry.S stored the system |
650 | * call number to gprs[2]. | 650 | * call number to gprs[2]. |
651 | */ | 651 | */ |
652 | ret = regs->gprs[2]; | ||
653 | if (test_thread_flag(TIF_SYSCALL_TRACE) && | 652 | if (test_thread_flag(TIF_SYSCALL_TRACE) && |
654 | (tracehook_report_syscall_entry(regs) || | 653 | (tracehook_report_syscall_entry(regs) || |
655 | regs->gprs[2] >= NR_syscalls)) { | 654 | regs->gprs[2] >= NR_syscalls)) { |
@@ -671,7 +670,7 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs) | |||
671 | regs->gprs[2], regs->orig_gpr2, | 670 | regs->gprs[2], regs->orig_gpr2, |
672 | regs->gprs[3], regs->gprs[4], | 671 | regs->gprs[3], regs->gprs[4], |
673 | regs->gprs[5]); | 672 | regs->gprs[5]); |
674 | return ret; | 673 | return ret ?: regs->gprs[2]; |
675 | } | 674 | } |
676 | 675 | ||
677 | asmlinkage void do_syscall_trace_exit(struct pt_regs *regs) | 676 | asmlinkage void do_syscall_trace_exit(struct pt_regs *regs) |
diff --git a/arch/sh/configs/rts7751r2d1_defconfig b/arch/sh/configs/rts7751r2d1_defconfig index fba1f62d56e7..dba024d72a89 100644 --- a/arch/sh/configs/rts7751r2d1_defconfig +++ b/arch/sh/configs/rts7751r2d1_defconfig | |||
@@ -877,7 +877,7 @@ CONFIG_SERIAL_8250_RUNTIME_UARTS=4 | |||
877 | # | 877 | # |
878 | # CONFIG_SERIAL_MAX3100 is not set | 878 | # CONFIG_SERIAL_MAX3100 is not set |
879 | CONFIG_SERIAL_SH_SCI=y | 879 | CONFIG_SERIAL_SH_SCI=y |
880 | CONFIG_SERIAL_SH_SCI_NR_UARTS=1 | 880 | CONFIG_SERIAL_SH_SCI_NR_UARTS=2 |
881 | CONFIG_SERIAL_SH_SCI_CONSOLE=y | 881 | CONFIG_SERIAL_SH_SCI_CONSOLE=y |
882 | CONFIG_SERIAL_CORE=y | 882 | CONFIG_SERIAL_CORE=y |
883 | CONFIG_SERIAL_CORE_CONSOLE=y | 883 | CONFIG_SERIAL_CORE_CONSOLE=y |
diff --git a/arch/sh/configs/rts7751r2dplus_defconfig b/arch/sh/configs/rts7751r2dplus_defconfig index a8d538f06e67..6d511d06cbf6 100644 --- a/arch/sh/configs/rts7751r2dplus_defconfig +++ b/arch/sh/configs/rts7751r2dplus_defconfig | |||
@@ -963,7 +963,7 @@ CONFIG_SERIAL_8250_RUNTIME_UARTS=4 | |||
963 | # | 963 | # |
964 | # CONFIG_SERIAL_MAX3100 is not set | 964 | # CONFIG_SERIAL_MAX3100 is not set |
965 | CONFIG_SERIAL_SH_SCI=y | 965 | CONFIG_SERIAL_SH_SCI=y |
966 | CONFIG_SERIAL_SH_SCI_NR_UARTS=1 | 966 | CONFIG_SERIAL_SH_SCI_NR_UARTS=2 |
967 | CONFIG_SERIAL_SH_SCI_CONSOLE=y | 967 | CONFIG_SERIAL_SH_SCI_CONSOLE=y |
968 | CONFIG_SERIAL_CORE=y | 968 | CONFIG_SERIAL_CORE=y |
969 | CONFIG_SERIAL_CORE_CONSOLE=y | 969 | CONFIG_SERIAL_CORE_CONSOLE=y |
diff --git a/arch/sh/drivers/pci/pci-sh7751.c b/arch/sh/drivers/pci/pci-sh7751.c index 17811e5d287b..f98141b3b7d7 100644 --- a/arch/sh/drivers/pci/pci-sh7751.c +++ b/arch/sh/drivers/pci/pci-sh7751.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/io.h> | 17 | #include <linux/io.h> |
18 | #include "pci-sh4.h" | 18 | #include "pci-sh4.h" |
19 | #include <asm/addrspace.h> | 19 | #include <asm/addrspace.h> |
20 | #include <asm/sizes.h> | ||
20 | 21 | ||
21 | static int __init __area_sdram_check(struct pci_channel *chan, | 22 | static int __init __area_sdram_check(struct pci_channel *chan, |
22 | unsigned int area) | 23 | unsigned int area) |
@@ -47,8 +48,8 @@ static int __init __area_sdram_check(struct pci_channel *chan, | |||
47 | static struct resource sh7751_pci_resources[] = { | 48 | static struct resource sh7751_pci_resources[] = { |
48 | { | 49 | { |
49 | .name = "SH7751_IO", | 50 | .name = "SH7751_IO", |
50 | .start = SH7751_PCI_IO_BASE, | 51 | .start = 0x1000, |
51 | .end = SH7751_PCI_IO_BASE + SH7751_PCI_IO_SIZE - 1, | 52 | .end = SZ_4M - 1, |
52 | .flags = IORESOURCE_IO | 53 | .flags = IORESOURCE_IO |
53 | }, { | 54 | }, { |
54 | .name = "SH7751_mem", | 55 | .name = "SH7751_mem", |
diff --git a/arch/sh/include/asm/atomic.h b/arch/sh/include/asm/atomic.h index 275a448ae8c2..c7983124d99d 100644 --- a/arch/sh/include/asm/atomic.h +++ b/arch/sh/include/asm/atomic.h | |||
@@ -13,7 +13,7 @@ | |||
13 | 13 | ||
14 | #define ATOMIC_INIT(i) ( (atomic_t) { (i) } ) | 14 | #define ATOMIC_INIT(i) ( (atomic_t) { (i) } ) |
15 | 15 | ||
16 | #define atomic_read(v) ((v)->counter) | 16 | #define atomic_read(v) (*(volatile int *)&(v)->counter) |
17 | #define atomic_set(v,i) ((v)->counter = (i)) | 17 | #define atomic_set(v,i) ((v)->counter = (i)) |
18 | 18 | ||
19 | #if defined(CONFIG_GUSA_RB) | 19 | #if defined(CONFIG_GUSA_RB) |
diff --git a/arch/sh/include/cpu-sh4/cpu/dma-register.h b/arch/sh/include/cpu-sh4/cpu/dma-register.h index 55f9fec082d4..de2359533994 100644 --- a/arch/sh/include/cpu-sh4/cpu/dma-register.h +++ b/arch/sh/include/cpu-sh4/cpu/dma-register.h | |||
@@ -76,7 +76,7 @@ enum { | |||
76 | } | 76 | } |
77 | 77 | ||
78 | #define TS_INDEX2VAL(i) ((((i) & 3) << CHCR_TS_LOW_SHIFT) | \ | 78 | #define TS_INDEX2VAL(i) ((((i) & 3) << CHCR_TS_LOW_SHIFT) | \ |
79 | ((((i) >> 2) & 3) << CHCR_TS_HIGH_SHIFT)) | 79 | (((i) & 0xc) << CHCR_TS_HIGH_SHIFT)) |
80 | 80 | ||
81 | #else /* CONFIG_CPU_SH4A */ | 81 | #else /* CONFIG_CPU_SH4A */ |
82 | 82 | ||
diff --git a/arch/sparc/include/asm/atomic_32.h b/arch/sparc/include/asm/atomic_32.h index f0d343c3b956..7ae128b19d3f 100644 --- a/arch/sparc/include/asm/atomic_32.h +++ b/arch/sparc/include/asm/atomic_32.h | |||
@@ -25,7 +25,7 @@ extern int atomic_cmpxchg(atomic_t *, int, int); | |||
25 | extern int atomic_add_unless(atomic_t *, int, int); | 25 | extern int atomic_add_unless(atomic_t *, int, int); |
26 | extern void atomic_set(atomic_t *, int); | 26 | extern void atomic_set(atomic_t *, int); |
27 | 27 | ||
28 | #define atomic_read(v) ((v)->counter) | 28 | #define atomic_read(v) (*(volatile int *)&(v)->counter) |
29 | 29 | ||
30 | #define atomic_add(i, v) ((void)__atomic_add_return( (int)(i), (v))) | 30 | #define atomic_add(i, v) ((void)__atomic_add_return( (int)(i), (v))) |
31 | #define atomic_sub(i, v) ((void)__atomic_add_return(-(int)(i), (v))) | 31 | #define atomic_sub(i, v) ((void)__atomic_add_return(-(int)(i), (v))) |
diff --git a/arch/sparc/include/asm/atomic_64.h b/arch/sparc/include/asm/atomic_64.h index f2e48009989e..2050ca02c423 100644 --- a/arch/sparc/include/asm/atomic_64.h +++ b/arch/sparc/include/asm/atomic_64.h | |||
@@ -13,8 +13,8 @@ | |||
13 | #define ATOMIC_INIT(i) { (i) } | 13 | #define ATOMIC_INIT(i) { (i) } |
14 | #define ATOMIC64_INIT(i) { (i) } | 14 | #define ATOMIC64_INIT(i) { (i) } |
15 | 15 | ||
16 | #define atomic_read(v) ((v)->counter) | 16 | #define atomic_read(v) (*(volatile int *)&(v)->counter) |
17 | #define atomic64_read(v) ((v)->counter) | 17 | #define atomic64_read(v) (*(volatile long *)&(v)->counter) |
18 | 18 | ||
19 | #define atomic_set(v, i) (((v)->counter) = i) | 19 | #define atomic_set(v, i) (((v)->counter) = i) |
20 | #define atomic64_set(v, i) (((v)->counter) = i) | 20 | #define atomic64_set(v, i) (((v)->counter) = i) |
diff --git a/arch/sparc/include/asm/bitops_64.h b/arch/sparc/include/asm/bitops_64.h index e72ac9cdfb98..766121a67a24 100644 --- a/arch/sparc/include/asm/bitops_64.h +++ b/arch/sparc/include/asm/bitops_64.h | |||
@@ -44,7 +44,7 @@ extern void change_bit(unsigned long nr, volatile unsigned long *addr); | |||
44 | 44 | ||
45 | #ifdef ULTRA_HAS_POPULATION_COUNT | 45 | #ifdef ULTRA_HAS_POPULATION_COUNT |
46 | 46 | ||
47 | static inline unsigned int hweight64(unsigned long w) | 47 | static inline unsigned int __arch_hweight64(unsigned long w) |
48 | { | 48 | { |
49 | unsigned int res; | 49 | unsigned int res; |
50 | 50 | ||
@@ -52,7 +52,7 @@ static inline unsigned int hweight64(unsigned long w) | |||
52 | return res; | 52 | return res; |
53 | } | 53 | } |
54 | 54 | ||
55 | static inline unsigned int hweight32(unsigned int w) | 55 | static inline unsigned int __arch_hweight32(unsigned int w) |
56 | { | 56 | { |
57 | unsigned int res; | 57 | unsigned int res; |
58 | 58 | ||
@@ -60,7 +60,7 @@ static inline unsigned int hweight32(unsigned int w) | |||
60 | return res; | 60 | return res; |
61 | } | 61 | } |
62 | 62 | ||
63 | static inline unsigned int hweight16(unsigned int w) | 63 | static inline unsigned int __arch_hweight16(unsigned int w) |
64 | { | 64 | { |
65 | unsigned int res; | 65 | unsigned int res; |
66 | 66 | ||
@@ -68,7 +68,7 @@ static inline unsigned int hweight16(unsigned int w) | |||
68 | return res; | 68 | return res; |
69 | } | 69 | } |
70 | 70 | ||
71 | static inline unsigned int hweight8(unsigned int w) | 71 | static inline unsigned int __arch_hweight8(unsigned int w) |
72 | { | 72 | { |
73 | unsigned int res; | 73 | unsigned int res; |
74 | 74 | ||
@@ -78,9 +78,10 @@ static inline unsigned int hweight8(unsigned int w) | |||
78 | 78 | ||
79 | #else | 79 | #else |
80 | 80 | ||
81 | #include <asm-generic/bitops/hweight.h> | 81 | #include <asm-generic/bitops/arch_hweight.h> |
82 | 82 | ||
83 | #endif | 83 | #endif |
84 | #include <asm-generic/bitops/const_hweight.h> | ||
84 | #include <asm-generic/bitops/lock.h> | 85 | #include <asm-generic/bitops/lock.h> |
85 | #endif /* __KERNEL__ */ | 86 | #endif /* __KERNEL__ */ |
86 | 87 | ||
diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c index e2771939341d..cf4ce263ff81 100644 --- a/arch/sparc/kernel/perf_event.c +++ b/arch/sparc/kernel/perf_event.c | |||
@@ -91,6 +91,8 @@ struct cpu_hw_events { | |||
91 | 91 | ||
92 | /* Enabled/disable state. */ | 92 | /* Enabled/disable state. */ |
93 | int enabled; | 93 | int enabled; |
94 | |||
95 | unsigned int group_flag; | ||
94 | }; | 96 | }; |
95 | DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events) = { .enabled = 1, }; | 97 | DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events) = { .enabled = 1, }; |
96 | 98 | ||
@@ -980,53 +982,6 @@ static int collect_events(struct perf_event *group, int max_count, | |||
980 | return n; | 982 | return n; |
981 | } | 983 | } |
982 | 984 | ||
983 | static void event_sched_in(struct perf_event *event) | ||
984 | { | ||
985 | event->state = PERF_EVENT_STATE_ACTIVE; | ||
986 | event->oncpu = smp_processor_id(); | ||
987 | event->tstamp_running += event->ctx->time - event->tstamp_stopped; | ||
988 | if (is_software_event(event)) | ||
989 | event->pmu->enable(event); | ||
990 | } | ||
991 | |||
992 | int hw_perf_group_sched_in(struct perf_event *group_leader, | ||
993 | struct perf_cpu_context *cpuctx, | ||
994 | struct perf_event_context *ctx) | ||
995 | { | ||
996 | struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); | ||
997 | struct perf_event *sub; | ||
998 | int n0, n; | ||
999 | |||
1000 | if (!sparc_pmu) | ||
1001 | return 0; | ||
1002 | |||
1003 | n0 = cpuc->n_events; | ||
1004 | n = collect_events(group_leader, perf_max_events - n0, | ||
1005 | &cpuc->event[n0], &cpuc->events[n0], | ||
1006 | &cpuc->current_idx[n0]); | ||
1007 | if (n < 0) | ||
1008 | return -EAGAIN; | ||
1009 | if (check_excludes(cpuc->event, n0, n)) | ||
1010 | return -EINVAL; | ||
1011 | if (sparc_check_constraints(cpuc->event, cpuc->events, n + n0)) | ||
1012 | return -EAGAIN; | ||
1013 | cpuc->n_events = n0 + n; | ||
1014 | cpuc->n_added += n; | ||
1015 | |||
1016 | cpuctx->active_oncpu += n; | ||
1017 | n = 1; | ||
1018 | event_sched_in(group_leader); | ||
1019 | list_for_each_entry(sub, &group_leader->sibling_list, group_entry) { | ||
1020 | if (sub->state != PERF_EVENT_STATE_OFF) { | ||
1021 | event_sched_in(sub); | ||
1022 | n++; | ||
1023 | } | ||
1024 | } | ||
1025 | ctx->nr_active += n; | ||
1026 | |||
1027 | return 1; | ||
1028 | } | ||
1029 | |||
1030 | static int sparc_pmu_enable(struct perf_event *event) | 985 | static int sparc_pmu_enable(struct perf_event *event) |
1031 | { | 986 | { |
1032 | struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); | 987 | struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); |
@@ -1044,11 +999,20 @@ static int sparc_pmu_enable(struct perf_event *event) | |||
1044 | cpuc->events[n0] = event->hw.event_base; | 999 | cpuc->events[n0] = event->hw.event_base; |
1045 | cpuc->current_idx[n0] = PIC_NO_INDEX; | 1000 | cpuc->current_idx[n0] = PIC_NO_INDEX; |
1046 | 1001 | ||
1002 | /* | ||
1003 | * If group events scheduling transaction was started, | ||
1004 | * skip the schedulability test here, it will be peformed | ||
1005 | * at commit time(->commit_txn) as a whole | ||
1006 | */ | ||
1007 | if (cpuc->group_flag & PERF_EVENT_TXN_STARTED) | ||
1008 | goto nocheck; | ||
1009 | |||
1047 | if (check_excludes(cpuc->event, n0, 1)) | 1010 | if (check_excludes(cpuc->event, n0, 1)) |
1048 | goto out; | 1011 | goto out; |
1049 | if (sparc_check_constraints(cpuc->event, cpuc->events, n0 + 1)) | 1012 | if (sparc_check_constraints(cpuc->event, cpuc->events, n0 + 1)) |
1050 | goto out; | 1013 | goto out; |
1051 | 1014 | ||
1015 | nocheck: | ||
1052 | cpuc->n_events++; | 1016 | cpuc->n_events++; |
1053 | cpuc->n_added++; | 1017 | cpuc->n_added++; |
1054 | 1018 | ||
@@ -1128,11 +1092,61 @@ static int __hw_perf_event_init(struct perf_event *event) | |||
1128 | return 0; | 1092 | return 0; |
1129 | } | 1093 | } |
1130 | 1094 | ||
1095 | /* | ||
1096 | * Start group events scheduling transaction | ||
1097 | * Set the flag to make pmu::enable() not perform the | ||
1098 | * schedulability test, it will be performed at commit time | ||
1099 | */ | ||
1100 | static void sparc_pmu_start_txn(const struct pmu *pmu) | ||
1101 | { | ||
1102 | struct cpu_hw_events *cpuhw = &__get_cpu_var(cpu_hw_events); | ||
1103 | |||
1104 | cpuhw->group_flag |= PERF_EVENT_TXN_STARTED; | ||
1105 | } | ||
1106 | |||
1107 | /* | ||
1108 | * Stop group events scheduling transaction | ||
1109 | * Clear the flag and pmu::enable() will perform the | ||
1110 | * schedulability test. | ||
1111 | */ | ||
1112 | static void sparc_pmu_cancel_txn(const struct pmu *pmu) | ||
1113 | { | ||
1114 | struct cpu_hw_events *cpuhw = &__get_cpu_var(cpu_hw_events); | ||
1115 | |||
1116 | cpuhw->group_flag &= ~PERF_EVENT_TXN_STARTED; | ||
1117 | } | ||
1118 | |||
1119 | /* | ||
1120 | * Commit group events scheduling transaction | ||
1121 | * Perform the group schedulability test as a whole | ||
1122 | * Return 0 if success | ||
1123 | */ | ||
1124 | static int sparc_pmu_commit_txn(const struct pmu *pmu) | ||
1125 | { | ||
1126 | struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); | ||
1127 | int n; | ||
1128 | |||
1129 | if (!sparc_pmu) | ||
1130 | return -EINVAL; | ||
1131 | |||
1132 | cpuc = &__get_cpu_var(cpu_hw_events); | ||
1133 | n = cpuc->n_events; | ||
1134 | if (check_excludes(cpuc->event, 0, n)) | ||
1135 | return -EINVAL; | ||
1136 | if (sparc_check_constraints(cpuc->event, cpuc->events, n)) | ||
1137 | return -EAGAIN; | ||
1138 | |||
1139 | return 0; | ||
1140 | } | ||
1141 | |||
1131 | static const struct pmu pmu = { | 1142 | static const struct pmu pmu = { |
1132 | .enable = sparc_pmu_enable, | 1143 | .enable = sparc_pmu_enable, |
1133 | .disable = sparc_pmu_disable, | 1144 | .disable = sparc_pmu_disable, |
1134 | .read = sparc_pmu_read, | 1145 | .read = sparc_pmu_read, |
1135 | .unthrottle = sparc_pmu_unthrottle, | 1146 | .unthrottle = sparc_pmu_unthrottle, |
1147 | .start_txn = sparc_pmu_start_txn, | ||
1148 | .cancel_txn = sparc_pmu_cancel_txn, | ||
1149 | .commit_txn = sparc_pmu_commit_txn, | ||
1136 | }; | 1150 | }; |
1137 | 1151 | ||
1138 | const struct pmu *hw_perf_event_init(struct perf_event *event) | 1152 | const struct pmu *hw_perf_event_init(struct perf_event *event) |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 01177dcbe261..a2d3a5fbeeda 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -201,20 +201,17 @@ config HAVE_INTEL_TXT | |||
201 | 201 | ||
202 | # Use the generic interrupt handling code in kernel/irq/: | 202 | # Use the generic interrupt handling code in kernel/irq/: |
203 | config GENERIC_HARDIRQS | 203 | config GENERIC_HARDIRQS |
204 | bool | 204 | def_bool y |
205 | default y | ||
206 | 205 | ||
207 | config GENERIC_HARDIRQS_NO__DO_IRQ | 206 | config GENERIC_HARDIRQS_NO__DO_IRQ |
208 | def_bool y | 207 | def_bool y |
209 | 208 | ||
210 | config GENERIC_IRQ_PROBE | 209 | config GENERIC_IRQ_PROBE |
211 | bool | 210 | def_bool y |
212 | default y | ||
213 | 211 | ||
214 | config GENERIC_PENDING_IRQ | 212 | config GENERIC_PENDING_IRQ |
215 | bool | 213 | def_bool y |
216 | depends on GENERIC_HARDIRQS && SMP | 214 | depends on GENERIC_HARDIRQS && SMP |
217 | default y | ||
218 | 215 | ||
219 | config USE_GENERIC_SMP_HELPERS | 216 | config USE_GENERIC_SMP_HELPERS |
220 | def_bool y | 217 | def_bool y |
@@ -229,19 +226,22 @@ config X86_64_SMP | |||
229 | depends on X86_64 && SMP | 226 | depends on X86_64 && SMP |
230 | 227 | ||
231 | config X86_HT | 228 | config X86_HT |
232 | bool | 229 | def_bool y |
233 | depends on SMP | 230 | depends on SMP |
234 | default y | ||
235 | 231 | ||
236 | config X86_TRAMPOLINE | 232 | config X86_TRAMPOLINE |
237 | bool | 233 | def_bool y |
238 | depends on SMP || (64BIT && ACPI_SLEEP) | 234 | depends on SMP || (64BIT && ACPI_SLEEP) |
239 | default y | ||
240 | 235 | ||
241 | config X86_32_LAZY_GS | 236 | config X86_32_LAZY_GS |
242 | def_bool y | 237 | def_bool y |
243 | depends on X86_32 && !CC_STACKPROTECTOR | 238 | depends on X86_32 && !CC_STACKPROTECTOR |
244 | 239 | ||
240 | config ARCH_HWEIGHT_CFLAGS | ||
241 | string | ||
242 | default "-fcall-saved-ecx -fcall-saved-edx" if X86_32 | ||
243 | default "-fcall-saved-rdi -fcall-saved-rsi -fcall-saved-rdx -fcall-saved-rcx -fcall-saved-r8 -fcall-saved-r9 -fcall-saved-r10 -fcall-saved-r11" if X86_64 | ||
244 | |||
245 | config KTIME_SCALAR | 245 | config KTIME_SCALAR |
246 | def_bool X86_32 | 246 | def_bool X86_32 |
247 | source "init/Kconfig" | 247 | source "init/Kconfig" |
@@ -451,7 +451,7 @@ config X86_NUMAQ | |||
451 | firmware with - send email to <Martin.Bligh@us.ibm.com>. | 451 | firmware with - send email to <Martin.Bligh@us.ibm.com>. |
452 | 452 | ||
453 | config X86_SUPPORTS_MEMORY_FAILURE | 453 | config X86_SUPPORTS_MEMORY_FAILURE |
454 | bool | 454 | def_bool y |
455 | # MCE code calls memory_failure(): | 455 | # MCE code calls memory_failure(): |
456 | depends on X86_MCE | 456 | depends on X86_MCE |
457 | # On 32-bit this adds too big of NODES_SHIFT and we run out of page flags: | 457 | # On 32-bit this adds too big of NODES_SHIFT and we run out of page flags: |
@@ -459,7 +459,6 @@ config X86_SUPPORTS_MEMORY_FAILURE | |||
459 | # On 32-bit SPARSEMEM adds too big of SECTIONS_WIDTH: | 459 | # On 32-bit SPARSEMEM adds too big of SECTIONS_WIDTH: |
460 | depends on X86_64 || !SPARSEMEM | 460 | depends on X86_64 || !SPARSEMEM |
461 | select ARCH_SUPPORTS_MEMORY_FAILURE | 461 | select ARCH_SUPPORTS_MEMORY_FAILURE |
462 | default y | ||
463 | 462 | ||
464 | config X86_VISWS | 463 | config X86_VISWS |
465 | bool "SGI 320/540 (Visual Workstation)" | 464 | bool "SGI 320/540 (Visual Workstation)" |
@@ -574,7 +573,6 @@ config PARAVIRT_SPINLOCKS | |||
574 | 573 | ||
575 | config PARAVIRT_CLOCK | 574 | config PARAVIRT_CLOCK |
576 | bool | 575 | bool |
577 | default n | ||
578 | 576 | ||
579 | endif | 577 | endif |
580 | 578 | ||
@@ -753,7 +751,6 @@ config MAXSMP | |||
753 | bool "Configure Maximum number of SMP Processors and NUMA Nodes" | 751 | bool "Configure Maximum number of SMP Processors and NUMA Nodes" |
754 | depends on X86_64 && SMP && DEBUG_KERNEL && EXPERIMENTAL | 752 | depends on X86_64 && SMP && DEBUG_KERNEL && EXPERIMENTAL |
755 | select CPUMASK_OFFSTACK | 753 | select CPUMASK_OFFSTACK |
756 | default n | ||
757 | ---help--- | 754 | ---help--- |
758 | Configure maximum number of CPUS and NUMA Nodes for this architecture. | 755 | Configure maximum number of CPUS and NUMA Nodes for this architecture. |
759 | If unsure, say N. | 756 | If unsure, say N. |
@@ -833,7 +830,6 @@ config X86_VISWS_APIC | |||
833 | 830 | ||
834 | config X86_REROUTE_FOR_BROKEN_BOOT_IRQS | 831 | config X86_REROUTE_FOR_BROKEN_BOOT_IRQS |
835 | bool "Reroute for broken boot IRQs" | 832 | bool "Reroute for broken boot IRQs" |
836 | default n | ||
837 | depends on X86_IO_APIC | 833 | depends on X86_IO_APIC |
838 | ---help--- | 834 | ---help--- |
839 | This option enables a workaround that fixes a source of | 835 | This option enables a workaround that fixes a source of |
@@ -880,9 +876,8 @@ config X86_MCE_AMD | |||
880 | the DRAM Error Threshold. | 876 | the DRAM Error Threshold. |
881 | 877 | ||
882 | config X86_ANCIENT_MCE | 878 | config X86_ANCIENT_MCE |
883 | def_bool n | 879 | bool "Support for old Pentium 5 / WinChip machine checks" |
884 | depends on X86_32 && X86_MCE | 880 | depends on X86_32 && X86_MCE |
885 | prompt "Support for old Pentium 5 / WinChip machine checks" | ||
886 | ---help--- | 881 | ---help--- |
887 | Include support for machine check handling on old Pentium 5 or WinChip | 882 | Include support for machine check handling on old Pentium 5 or WinChip |
888 | systems. These typically need to be enabled explicitely on the command | 883 | systems. These typically need to be enabled explicitely on the command |
@@ -890,8 +885,7 @@ config X86_ANCIENT_MCE | |||
890 | 885 | ||
891 | config X86_MCE_THRESHOLD | 886 | config X86_MCE_THRESHOLD |
892 | depends on X86_MCE_AMD || X86_MCE_INTEL | 887 | depends on X86_MCE_AMD || X86_MCE_INTEL |
893 | bool | 888 | def_bool y |
894 | default y | ||
895 | 889 | ||
896 | config X86_MCE_INJECT | 890 | config X86_MCE_INJECT |
897 | depends on X86_MCE | 891 | depends on X86_MCE |
@@ -1030,8 +1024,8 @@ config X86_CPUID | |||
1030 | 1024 | ||
1031 | choice | 1025 | choice |
1032 | prompt "High Memory Support" | 1026 | prompt "High Memory Support" |
1033 | default HIGHMEM4G if !X86_NUMAQ | ||
1034 | default HIGHMEM64G if X86_NUMAQ | 1027 | default HIGHMEM64G if X86_NUMAQ |
1028 | default HIGHMEM4G | ||
1035 | depends on X86_32 | 1029 | depends on X86_32 |
1036 | 1030 | ||
1037 | config NOHIGHMEM | 1031 | config NOHIGHMEM |
@@ -1289,7 +1283,7 @@ source "mm/Kconfig" | |||
1289 | 1283 | ||
1290 | config HIGHPTE | 1284 | config HIGHPTE |
1291 | bool "Allocate 3rd-level pagetables from highmem" | 1285 | bool "Allocate 3rd-level pagetables from highmem" |
1292 | depends on X86_32 && (HIGHMEM4G || HIGHMEM64G) | 1286 | depends on HIGHMEM |
1293 | ---help--- | 1287 | ---help--- |
1294 | The VM uses one page table entry for each page of physical memory. | 1288 | The VM uses one page table entry for each page of physical memory. |
1295 | For systems with a lot of RAM, this can be wasteful of precious | 1289 | For systems with a lot of RAM, this can be wasteful of precious |
@@ -1373,8 +1367,7 @@ config MATH_EMULATION | |||
1373 | kernel, it won't hurt. | 1367 | kernel, it won't hurt. |
1374 | 1368 | ||
1375 | config MTRR | 1369 | config MTRR |
1376 | bool | 1370 | def_bool y |
1377 | default y | ||
1378 | prompt "MTRR (Memory Type Range Register) support" if EMBEDDED | 1371 | prompt "MTRR (Memory Type Range Register) support" if EMBEDDED |
1379 | ---help--- | 1372 | ---help--- |
1380 | On Intel P6 family processors (Pentium Pro, Pentium II and later) | 1373 | On Intel P6 family processors (Pentium Pro, Pentium II and later) |
@@ -1440,8 +1433,7 @@ config MTRR_SANITIZER_SPARE_REG_NR_DEFAULT | |||
1440 | mtrr_spare_reg_nr=N on the kernel command line. | 1433 | mtrr_spare_reg_nr=N on the kernel command line. |
1441 | 1434 | ||
1442 | config X86_PAT | 1435 | config X86_PAT |
1443 | bool | 1436 | def_bool y |
1444 | default y | ||
1445 | prompt "x86 PAT support" if EMBEDDED | 1437 | prompt "x86 PAT support" if EMBEDDED |
1446 | depends on MTRR | 1438 | depends on MTRR |
1447 | ---help--- | 1439 | ---help--- |
@@ -1609,8 +1601,7 @@ config X86_NEED_RELOCS | |||
1609 | depends on X86_32 && RELOCATABLE | 1601 | depends on X86_32 && RELOCATABLE |
1610 | 1602 | ||
1611 | config PHYSICAL_ALIGN | 1603 | config PHYSICAL_ALIGN |
1612 | hex | 1604 | hex "Alignment value to which kernel should be aligned" if X86_32 |
1613 | prompt "Alignment value to which kernel should be aligned" if X86_32 | ||
1614 | default "0x1000000" | 1605 | default "0x1000000" |
1615 | range 0x2000 0x1000000 | 1606 | range 0x2000 0x1000000 |
1616 | ---help--- | 1607 | ---help--- |
@@ -1657,7 +1648,6 @@ config COMPAT_VDSO | |||
1657 | 1648 | ||
1658 | config CMDLINE_BOOL | 1649 | config CMDLINE_BOOL |
1659 | bool "Built-in kernel command line" | 1650 | bool "Built-in kernel command line" |
1660 | default n | ||
1661 | ---help--- | 1651 | ---help--- |
1662 | Allow for specifying boot arguments to the kernel at | 1652 | Allow for specifying boot arguments to the kernel at |
1663 | build time. On some systems (e.g. embedded ones), it is | 1653 | build time. On some systems (e.g. embedded ones), it is |
@@ -1691,7 +1681,6 @@ config CMDLINE | |||
1691 | 1681 | ||
1692 | config CMDLINE_OVERRIDE | 1682 | config CMDLINE_OVERRIDE |
1693 | bool "Built-in command line overrides boot loader arguments" | 1683 | bool "Built-in command line overrides boot loader arguments" |
1694 | default n | ||
1695 | depends on CMDLINE_BOOL | 1684 | depends on CMDLINE_BOOL |
1696 | ---help--- | 1685 | ---help--- |
1697 | Set this option to 'Y' to have the kernel ignore the boot loader | 1686 | Set this option to 'Y' to have the kernel ignore the boot loader |
@@ -1727,8 +1716,7 @@ source "drivers/acpi/Kconfig" | |||
1727 | source "drivers/sfi/Kconfig" | 1716 | source "drivers/sfi/Kconfig" |
1728 | 1717 | ||
1729 | config X86_APM_BOOT | 1718 | config X86_APM_BOOT |
1730 | bool | 1719 | def_bool y |
1731 | default y | ||
1732 | depends on APM || APM_MODULE | 1720 | depends on APM || APM_MODULE |
1733 | 1721 | ||
1734 | menuconfig APM | 1722 | menuconfig APM |
@@ -1957,8 +1945,7 @@ config DMAR_DEFAULT_ON | |||
1957 | experimental. | 1945 | experimental. |
1958 | 1946 | ||
1959 | config DMAR_BROKEN_GFX_WA | 1947 | config DMAR_BROKEN_GFX_WA |
1960 | def_bool n | 1948 | bool "Workaround broken graphics drivers (going away soon)" |
1961 | prompt "Workaround broken graphics drivers (going away soon)" | ||
1962 | depends on DMAR && BROKEN | 1949 | depends on DMAR && BROKEN |
1963 | ---help--- | 1950 | ---help--- |
1964 | Current Graphics drivers tend to use physical address | 1951 | Current Graphics drivers tend to use physical address |
@@ -2056,7 +2043,6 @@ config SCx200HR_TIMER | |||
2056 | config OLPC | 2043 | config OLPC |
2057 | bool "One Laptop Per Child support" | 2044 | bool "One Laptop Per Child support" |
2058 | select GPIOLIB | 2045 | select GPIOLIB |
2059 | default n | ||
2060 | ---help--- | 2046 | ---help--- |
2061 | Add support for detecting the unique features of the OLPC | 2047 | Add support for detecting the unique features of the OLPC |
2062 | XO hardware. | 2048 | XO hardware. |
diff --git a/arch/x86/Kconfig.cpu b/arch/x86/Kconfig.cpu index 918fbb1855cc..2ac9069890cd 100644 --- a/arch/x86/Kconfig.cpu +++ b/arch/x86/Kconfig.cpu | |||
@@ -338,6 +338,10 @@ config X86_F00F_BUG | |||
338 | def_bool y | 338 | def_bool y |
339 | depends on M586MMX || M586TSC || M586 || M486 || M386 | 339 | depends on M586MMX || M586TSC || M586 || M486 || M386 |
340 | 340 | ||
341 | config X86_INVD_BUG | ||
342 | def_bool y | ||
343 | depends on M486 || M386 | ||
344 | |||
341 | config X86_WP_WORKS_OK | 345 | config X86_WP_WORKS_OK |
342 | def_bool y | 346 | def_bool y |
343 | depends on !M386 | 347 | depends on !M386 |
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug index bd58c8abbfbd..75085080b63e 100644 --- a/arch/x86/Kconfig.debug +++ b/arch/x86/Kconfig.debug | |||
@@ -45,7 +45,6 @@ config EARLY_PRINTK | |||
45 | 45 | ||
46 | config EARLY_PRINTK_DBGP | 46 | config EARLY_PRINTK_DBGP |
47 | bool "Early printk via EHCI debug port" | 47 | bool "Early printk via EHCI debug port" |
48 | default n | ||
49 | depends on EARLY_PRINTK && PCI | 48 | depends on EARLY_PRINTK && PCI |
50 | ---help--- | 49 | ---help--- |
51 | Write kernel log output directly into the EHCI debug port. | 50 | Write kernel log output directly into the EHCI debug port. |
@@ -76,7 +75,6 @@ config DEBUG_PER_CPU_MAPS | |||
76 | bool "Debug access to per_cpu maps" | 75 | bool "Debug access to per_cpu maps" |
77 | depends on DEBUG_KERNEL | 76 | depends on DEBUG_KERNEL |
78 | depends on SMP | 77 | depends on SMP |
79 | default n | ||
80 | ---help--- | 78 | ---help--- |
81 | Say Y to verify that the per_cpu map being accessed has | 79 | Say Y to verify that the per_cpu map being accessed has |
82 | been setup. Adds a fair amount of code to kernel memory | 80 | been setup. Adds a fair amount of code to kernel memory |
diff --git a/arch/x86/Makefile b/arch/x86/Makefile index 0a43dc515e4c..8aa1b59b9074 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile | |||
@@ -95,8 +95,9 @@ sp-$(CONFIG_X86_64) := rsp | |||
95 | cfi := $(call as-instr,.cfi_startproc\n.cfi_rel_offset $(sp-y)$(comma)0\n.cfi_endproc,-DCONFIG_AS_CFI=1) | 95 | cfi := $(call as-instr,.cfi_startproc\n.cfi_rel_offset $(sp-y)$(comma)0\n.cfi_endproc,-DCONFIG_AS_CFI=1) |
96 | # is .cfi_signal_frame supported too? | 96 | # is .cfi_signal_frame supported too? |
97 | cfi-sigframe := $(call as-instr,.cfi_startproc\n.cfi_signal_frame\n.cfi_endproc,-DCONFIG_AS_CFI_SIGNAL_FRAME=1) | 97 | cfi-sigframe := $(call as-instr,.cfi_startproc\n.cfi_signal_frame\n.cfi_endproc,-DCONFIG_AS_CFI_SIGNAL_FRAME=1) |
98 | KBUILD_AFLAGS += $(cfi) $(cfi-sigframe) | 98 | cfi-sections := $(call as-instr,.cfi_sections .debug_frame,-DCONFIG_AS_CFI_SECTIONS=1) |
99 | KBUILD_CFLAGS += $(cfi) $(cfi-sigframe) | 99 | KBUILD_AFLAGS += $(cfi) $(cfi-sigframe) $(cfi-sections) |
100 | KBUILD_CFLAGS += $(cfi) $(cfi-sigframe) $(cfi-sections) | ||
100 | 101 | ||
101 | LDFLAGS := -m elf_$(UTS_MACHINE) | 102 | LDFLAGS := -m elf_$(UTS_MACHINE) |
102 | 103 | ||
diff --git a/arch/x86/include/asm/alternative-asm.h b/arch/x86/include/asm/alternative-asm.h index b97f786a48d5..a63a68be1cce 100644 --- a/arch/x86/include/asm/alternative-asm.h +++ b/arch/x86/include/asm/alternative-asm.h | |||
@@ -6,8 +6,8 @@ | |||
6 | .macro LOCK_PREFIX | 6 | .macro LOCK_PREFIX |
7 | 1: lock | 7 | 1: lock |
8 | .section .smp_locks,"a" | 8 | .section .smp_locks,"a" |
9 | _ASM_ALIGN | 9 | .balign 4 |
10 | _ASM_PTR 1b | 10 | .long 1b - . |
11 | .previous | 11 | .previous |
12 | .endm | 12 | .endm |
13 | #else | 13 | #else |
diff --git a/arch/x86/include/asm/alternative.h b/arch/x86/include/asm/alternative.h index b09ec55650b3..03b6bb5394a0 100644 --- a/arch/x86/include/asm/alternative.h +++ b/arch/x86/include/asm/alternative.h | |||
@@ -28,20 +28,20 @@ | |||
28 | */ | 28 | */ |
29 | 29 | ||
30 | #ifdef CONFIG_SMP | 30 | #ifdef CONFIG_SMP |
31 | #define LOCK_PREFIX \ | 31 | #define LOCK_PREFIX_HERE \ |
32 | ".section .smp_locks,\"a\"\n" \ | 32 | ".section .smp_locks,\"a\"\n" \ |
33 | _ASM_ALIGN "\n" \ | 33 | ".balign 4\n" \ |
34 | _ASM_PTR "661f\n" /* address */ \ | 34 | ".long 671f - .\n" /* offset */ \ |
35 | ".previous\n" \ | 35 | ".previous\n" \ |
36 | "661:\n\tlock; " | 36 | "671:" |
37 | |||
38 | #define LOCK_PREFIX LOCK_PREFIX_HERE "\n\tlock; " | ||
37 | 39 | ||
38 | #else /* ! CONFIG_SMP */ | 40 | #else /* ! CONFIG_SMP */ |
41 | #define LOCK_PREFIX_HERE "" | ||
39 | #define LOCK_PREFIX "" | 42 | #define LOCK_PREFIX "" |
40 | #endif | 43 | #endif |
41 | 44 | ||
42 | /* This must be included *after* the definition of LOCK_PREFIX */ | ||
43 | #include <asm/cpufeature.h> | ||
44 | |||
45 | struct alt_instr { | 45 | struct alt_instr { |
46 | u8 *instr; /* original instruction */ | 46 | u8 *instr; /* original instruction */ |
47 | u8 *replacement; | 47 | u8 *replacement; |
@@ -96,6 +96,12 @@ static inline int alternatives_text_reserved(void *start, void *end) | |||
96 | ".previous" | 96 | ".previous" |
97 | 97 | ||
98 | /* | 98 | /* |
99 | * This must be included *after* the definition of ALTERNATIVE due to | ||
100 | * <asm/arch_hweight.h> | ||
101 | */ | ||
102 | #include <asm/cpufeature.h> | ||
103 | |||
104 | /* | ||
99 | * Alternative instructions for different CPU types or capabilities. | 105 | * Alternative instructions for different CPU types or capabilities. |
100 | * | 106 | * |
101 | * This allows to use optimized instructions even on generic binary | 107 | * This allows to use optimized instructions even on generic binary |
diff --git a/arch/x86/include/asm/amd_iommu_types.h b/arch/x86/include/asm/amd_iommu_types.h index 86a0ff0aeac7..7014e88bc779 100644 --- a/arch/x86/include/asm/amd_iommu_types.h +++ b/arch/x86/include/asm/amd_iommu_types.h | |||
@@ -174,6 +174,40 @@ | |||
174 | (~((1ULL << (12 + ((lvl) * 9))) - 1))) | 174 | (~((1ULL << (12 + ((lvl) * 9))) - 1))) |
175 | #define PM_ALIGNED(lvl, addr) ((PM_MAP_MASK(lvl) & (addr)) == (addr)) | 175 | #define PM_ALIGNED(lvl, addr) ((PM_MAP_MASK(lvl) & (addr)) == (addr)) |
176 | 176 | ||
177 | /* | ||
178 | * Returns the page table level to use for a given page size | ||
179 | * Pagesize is expected to be a power-of-two | ||
180 | */ | ||
181 | #define PAGE_SIZE_LEVEL(pagesize) \ | ||
182 | ((__ffs(pagesize) - 12) / 9) | ||
183 | /* | ||
184 | * Returns the number of ptes to use for a given page size | ||
185 | * Pagesize is expected to be a power-of-two | ||
186 | */ | ||
187 | #define PAGE_SIZE_PTE_COUNT(pagesize) \ | ||
188 | (1ULL << ((__ffs(pagesize) - 12) % 9)) | ||
189 | |||
190 | /* | ||
191 | * Aligns a given io-virtual address to a given page size | ||
192 | * Pagesize is expected to be a power-of-two | ||
193 | */ | ||
194 | #define PAGE_SIZE_ALIGN(address, pagesize) \ | ||
195 | ((address) & ~((pagesize) - 1)) | ||
196 | /* | ||
197 | * Creates an IOMMU PTE for an address an a given pagesize | ||
198 | * The PTE has no permission bits set | ||
199 | * Pagesize is expected to be a power-of-two larger than 4096 | ||
200 | */ | ||
201 | #define PAGE_SIZE_PTE(address, pagesize) \ | ||
202 | (((address) | ((pagesize) - 1)) & \ | ||
203 | (~(pagesize >> 1)) & PM_ADDR_MASK) | ||
204 | |||
205 | /* | ||
206 | * Takes a PTE value with mode=0x07 and returns the page size it maps | ||
207 | */ | ||
208 | #define PTE_PAGE_SIZE(pte) \ | ||
209 | (1ULL << (1 + ffz(((pte) | 0xfffULL)))) | ||
210 | |||
177 | #define IOMMU_PTE_P (1ULL << 0) | 211 | #define IOMMU_PTE_P (1ULL << 0) |
178 | #define IOMMU_PTE_TV (1ULL << 1) | 212 | #define IOMMU_PTE_TV (1ULL << 1) |
179 | #define IOMMU_PTE_U (1ULL << 59) | 213 | #define IOMMU_PTE_U (1ULL << 59) |
diff --git a/arch/x86/include/asm/arch_hweight.h b/arch/x86/include/asm/arch_hweight.h new file mode 100644 index 000000000000..9686c3d9ff73 --- /dev/null +++ b/arch/x86/include/asm/arch_hweight.h | |||
@@ -0,0 +1,61 @@ | |||
1 | #ifndef _ASM_X86_HWEIGHT_H | ||
2 | #define _ASM_X86_HWEIGHT_H | ||
3 | |||
4 | #ifdef CONFIG_64BIT | ||
5 | /* popcnt %edi, %eax -- redundant REX prefix for alignment */ | ||
6 | #define POPCNT32 ".byte 0xf3,0x40,0x0f,0xb8,0xc7" | ||
7 | /* popcnt %rdi, %rax */ | ||
8 | #define POPCNT64 ".byte 0xf3,0x48,0x0f,0xb8,0xc7" | ||
9 | #define REG_IN "D" | ||
10 | #define REG_OUT "a" | ||
11 | #else | ||
12 | /* popcnt %eax, %eax */ | ||
13 | #define POPCNT32 ".byte 0xf3,0x0f,0xb8,0xc0" | ||
14 | #define REG_IN "a" | ||
15 | #define REG_OUT "a" | ||
16 | #endif | ||
17 | |||
18 | /* | ||
19 | * __sw_hweightXX are called from within the alternatives below | ||
20 | * and callee-clobbered registers need to be taken care of. See | ||
21 | * ARCH_HWEIGHT_CFLAGS in <arch/x86/Kconfig> for the respective | ||
22 | * compiler switches. | ||
23 | */ | ||
24 | static inline unsigned int __arch_hweight32(unsigned int w) | ||
25 | { | ||
26 | unsigned int res = 0; | ||
27 | |||
28 | asm (ALTERNATIVE("call __sw_hweight32", POPCNT32, X86_FEATURE_POPCNT) | ||
29 | : "="REG_OUT (res) | ||
30 | : REG_IN (w)); | ||
31 | |||
32 | return res; | ||
33 | } | ||
34 | |||
35 | static inline unsigned int __arch_hweight16(unsigned int w) | ||
36 | { | ||
37 | return __arch_hweight32(w & 0xffff); | ||
38 | } | ||
39 | |||
40 | static inline unsigned int __arch_hweight8(unsigned int w) | ||
41 | { | ||
42 | return __arch_hweight32(w & 0xff); | ||
43 | } | ||
44 | |||
45 | static inline unsigned long __arch_hweight64(__u64 w) | ||
46 | { | ||
47 | unsigned long res = 0; | ||
48 | |||
49 | #ifdef CONFIG_X86_32 | ||
50 | return __arch_hweight32((u32)w) + | ||
51 | __arch_hweight32((u32)(w >> 32)); | ||
52 | #else | ||
53 | asm (ALTERNATIVE("call __sw_hweight64", POPCNT64, X86_FEATURE_POPCNT) | ||
54 | : "="REG_OUT (res) | ||
55 | : REG_IN (w)); | ||
56 | #endif /* CONFIG_X86_32 */ | ||
57 | |||
58 | return res; | ||
59 | } | ||
60 | |||
61 | #endif | ||
diff --git a/arch/x86/include/asm/atomic.h b/arch/x86/include/asm/atomic.h index 8f8217b9bdac..952a826ac4e5 100644 --- a/arch/x86/include/asm/atomic.h +++ b/arch/x86/include/asm/atomic.h | |||
@@ -22,7 +22,7 @@ | |||
22 | */ | 22 | */ |
23 | static inline int atomic_read(const atomic_t *v) | 23 | static inline int atomic_read(const atomic_t *v) |
24 | { | 24 | { |
25 | return v->counter; | 25 | return (*(volatile int *)&(v)->counter); |
26 | } | 26 | } |
27 | 27 | ||
28 | /** | 28 | /** |
@@ -246,6 +246,29 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u) | |||
246 | 246 | ||
247 | #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) | 247 | #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) |
248 | 248 | ||
249 | /* | ||
250 | * atomic_dec_if_positive - decrement by 1 if old value positive | ||
251 | * @v: pointer of type atomic_t | ||
252 | * | ||
253 | * The function returns the old value of *v minus 1, even if | ||
254 | * the atomic variable, v, was not decremented. | ||
255 | */ | ||
256 | static inline int atomic_dec_if_positive(atomic_t *v) | ||
257 | { | ||
258 | int c, old, dec; | ||
259 | c = atomic_read(v); | ||
260 | for (;;) { | ||
261 | dec = c - 1; | ||
262 | if (unlikely(dec < 0)) | ||
263 | break; | ||
264 | old = atomic_cmpxchg((v), c, dec); | ||
265 | if (likely(old == c)) | ||
266 | break; | ||
267 | c = old; | ||
268 | } | ||
269 | return dec; | ||
270 | } | ||
271 | |||
249 | /** | 272 | /** |
250 | * atomic_inc_short - increment of a short integer | 273 | * atomic_inc_short - increment of a short integer |
251 | * @v: pointer to type int | 274 | * @v: pointer to type int |
diff --git a/arch/x86/include/asm/atomic64_32.h b/arch/x86/include/asm/atomic64_32.h index 03027bf28de5..2a934aa19a43 100644 --- a/arch/x86/include/asm/atomic64_32.h +++ b/arch/x86/include/asm/atomic64_32.h | |||
@@ -14,109 +14,193 @@ typedef struct { | |||
14 | 14 | ||
15 | #define ATOMIC64_INIT(val) { (val) } | 15 | #define ATOMIC64_INIT(val) { (val) } |
16 | 16 | ||
17 | extern u64 atomic64_cmpxchg(atomic64_t *ptr, u64 old_val, u64 new_val); | 17 | #ifdef CONFIG_X86_CMPXCHG64 |
18 | #define ATOMIC64_ALTERNATIVE_(f, g) "call atomic64_" #g "_cx8" | ||
19 | #else | ||
20 | #define ATOMIC64_ALTERNATIVE_(f, g) ALTERNATIVE("call atomic64_" #f "_386", "call atomic64_" #g "_cx8", X86_FEATURE_CX8) | ||
21 | #endif | ||
22 | |||
23 | #define ATOMIC64_ALTERNATIVE(f) ATOMIC64_ALTERNATIVE_(f, f) | ||
24 | |||
25 | /** | ||
26 | * atomic64_cmpxchg - cmpxchg atomic64 variable | ||
27 | * @p: pointer to type atomic64_t | ||
28 | * @o: expected value | ||
29 | * @n: new value | ||
30 | * | ||
31 | * Atomically sets @v to @n if it was equal to @o and returns | ||
32 | * the old value. | ||
33 | */ | ||
34 | |||
35 | static inline long long atomic64_cmpxchg(atomic64_t *v, long long o, long long n) | ||
36 | { | ||
37 | return cmpxchg64(&v->counter, o, n); | ||
38 | } | ||
18 | 39 | ||
19 | /** | 40 | /** |
20 | * atomic64_xchg - xchg atomic64 variable | 41 | * atomic64_xchg - xchg atomic64 variable |
21 | * @ptr: pointer to type atomic64_t | 42 | * @v: pointer to type atomic64_t |
22 | * @new_val: value to assign | 43 | * @n: value to assign |
23 | * | 44 | * |
24 | * Atomically xchgs the value of @ptr to @new_val and returns | 45 | * Atomically xchgs the value of @v to @n and returns |
25 | * the old value. | 46 | * the old value. |
26 | */ | 47 | */ |
27 | extern u64 atomic64_xchg(atomic64_t *ptr, u64 new_val); | 48 | static inline long long atomic64_xchg(atomic64_t *v, long long n) |
49 | { | ||
50 | long long o; | ||
51 | unsigned high = (unsigned)(n >> 32); | ||
52 | unsigned low = (unsigned)n; | ||
53 | asm volatile(ATOMIC64_ALTERNATIVE(xchg) | ||
54 | : "=A" (o), "+b" (low), "+c" (high) | ||
55 | : "S" (v) | ||
56 | : "memory" | ||
57 | ); | ||
58 | return o; | ||
59 | } | ||
28 | 60 | ||
29 | /** | 61 | /** |
30 | * atomic64_set - set atomic64 variable | 62 | * atomic64_set - set atomic64 variable |
31 | * @ptr: pointer to type atomic64_t | 63 | * @v: pointer to type atomic64_t |
32 | * @new_val: value to assign | 64 | * @n: value to assign |
33 | * | 65 | * |
34 | * Atomically sets the value of @ptr to @new_val. | 66 | * Atomically sets the value of @v to @n. |
35 | */ | 67 | */ |
36 | extern void atomic64_set(atomic64_t *ptr, u64 new_val); | 68 | static inline void atomic64_set(atomic64_t *v, long long i) |
69 | { | ||
70 | unsigned high = (unsigned)(i >> 32); | ||
71 | unsigned low = (unsigned)i; | ||
72 | asm volatile(ATOMIC64_ALTERNATIVE(set) | ||
73 | : "+b" (low), "+c" (high) | ||
74 | : "S" (v) | ||
75 | : "eax", "edx", "memory" | ||
76 | ); | ||
77 | } | ||
37 | 78 | ||
38 | /** | 79 | /** |
39 | * atomic64_read - read atomic64 variable | 80 | * atomic64_read - read atomic64 variable |
40 | * @ptr: pointer to type atomic64_t | 81 | * @v: pointer to type atomic64_t |
41 | * | 82 | * |
42 | * Atomically reads the value of @ptr and returns it. | 83 | * Atomically reads the value of @v and returns it. |
43 | */ | 84 | */ |
44 | static inline u64 atomic64_read(atomic64_t *ptr) | 85 | static inline long long atomic64_read(atomic64_t *v) |
45 | { | 86 | { |
46 | u64 res; | 87 | long long r; |
47 | 88 | asm volatile(ATOMIC64_ALTERNATIVE(read) | |
48 | /* | 89 | : "=A" (r), "+c" (v) |
49 | * Note, we inline this atomic64_t primitive because | 90 | : : "memory" |
50 | * it only clobbers EAX/EDX and leaves the others | 91 | ); |
51 | * untouched. We also (somewhat subtly) rely on the | 92 | return r; |
52 | * fact that cmpxchg8b returns the current 64-bit value | 93 | } |
53 | * of the memory location we are touching: | ||
54 | */ | ||
55 | asm volatile( | ||
56 | "mov %%ebx, %%eax\n\t" | ||
57 | "mov %%ecx, %%edx\n\t" | ||
58 | LOCK_PREFIX "cmpxchg8b %1\n" | ||
59 | : "=&A" (res) | ||
60 | : "m" (*ptr) | ||
61 | ); | ||
62 | |||
63 | return res; | ||
64 | } | ||
65 | |||
66 | extern u64 atomic64_read(atomic64_t *ptr); | ||
67 | 94 | ||
68 | /** | 95 | /** |
69 | * atomic64_add_return - add and return | 96 | * atomic64_add_return - add and return |
70 | * @delta: integer value to add | 97 | * @i: integer value to add |
71 | * @ptr: pointer to type atomic64_t | 98 | * @v: pointer to type atomic64_t |
72 | * | 99 | * |
73 | * Atomically adds @delta to @ptr and returns @delta + *@ptr | 100 | * Atomically adds @i to @v and returns @i + *@v |
74 | */ | 101 | */ |
75 | extern u64 atomic64_add_return(u64 delta, atomic64_t *ptr); | 102 | static inline long long atomic64_add_return(long long i, atomic64_t *v) |
103 | { | ||
104 | asm volatile(ATOMIC64_ALTERNATIVE(add_return) | ||
105 | : "+A" (i), "+c" (v) | ||
106 | : : "memory" | ||
107 | ); | ||
108 | return i; | ||
109 | } | ||
76 | 110 | ||
77 | /* | 111 | /* |
78 | * Other variants with different arithmetic operators: | 112 | * Other variants with different arithmetic operators: |
79 | */ | 113 | */ |
80 | extern u64 atomic64_sub_return(u64 delta, atomic64_t *ptr); | 114 | static inline long long atomic64_sub_return(long long i, atomic64_t *v) |
81 | extern u64 atomic64_inc_return(atomic64_t *ptr); | 115 | { |
82 | extern u64 atomic64_dec_return(atomic64_t *ptr); | 116 | asm volatile(ATOMIC64_ALTERNATIVE(sub_return) |
117 | : "+A" (i), "+c" (v) | ||
118 | : : "memory" | ||
119 | ); | ||
120 | return i; | ||
121 | } | ||
122 | |||
123 | static inline long long atomic64_inc_return(atomic64_t *v) | ||
124 | { | ||
125 | long long a; | ||
126 | asm volatile(ATOMIC64_ALTERNATIVE(inc_return) | ||
127 | : "=A" (a) | ||
128 | : "S" (v) | ||
129 | : "memory", "ecx" | ||
130 | ); | ||
131 | return a; | ||
132 | } | ||
133 | |||
134 | static inline long long atomic64_dec_return(atomic64_t *v) | ||
135 | { | ||
136 | long long a; | ||
137 | asm volatile(ATOMIC64_ALTERNATIVE(dec_return) | ||
138 | : "=A" (a) | ||
139 | : "S" (v) | ||
140 | : "memory", "ecx" | ||
141 | ); | ||
142 | return a; | ||
143 | } | ||
83 | 144 | ||
84 | /** | 145 | /** |
85 | * atomic64_add - add integer to atomic64 variable | 146 | * atomic64_add - add integer to atomic64 variable |
86 | * @delta: integer value to add | 147 | * @i: integer value to add |
87 | * @ptr: pointer to type atomic64_t | 148 | * @v: pointer to type atomic64_t |
88 | * | 149 | * |
89 | * Atomically adds @delta to @ptr. | 150 | * Atomically adds @i to @v. |
90 | */ | 151 | */ |
91 | extern void atomic64_add(u64 delta, atomic64_t *ptr); | 152 | static inline long long atomic64_add(long long i, atomic64_t *v) |
153 | { | ||
154 | asm volatile(ATOMIC64_ALTERNATIVE_(add, add_return) | ||
155 | : "+A" (i), "+c" (v) | ||
156 | : : "memory" | ||
157 | ); | ||
158 | return i; | ||
159 | } | ||
92 | 160 | ||
93 | /** | 161 | /** |
94 | * atomic64_sub - subtract the atomic64 variable | 162 | * atomic64_sub - subtract the atomic64 variable |
95 | * @delta: integer value to subtract | 163 | * @i: integer value to subtract |
96 | * @ptr: pointer to type atomic64_t | 164 | * @v: pointer to type atomic64_t |
97 | * | 165 | * |
98 | * Atomically subtracts @delta from @ptr. | 166 | * Atomically subtracts @i from @v. |
99 | */ | 167 | */ |
100 | extern void atomic64_sub(u64 delta, atomic64_t *ptr); | 168 | static inline long long atomic64_sub(long long i, atomic64_t *v) |
169 | { | ||
170 | asm volatile(ATOMIC64_ALTERNATIVE_(sub, sub_return) | ||
171 | : "+A" (i), "+c" (v) | ||
172 | : : "memory" | ||
173 | ); | ||
174 | return i; | ||
175 | } | ||
101 | 176 | ||
102 | /** | 177 | /** |
103 | * atomic64_sub_and_test - subtract value from variable and test result | 178 | * atomic64_sub_and_test - subtract value from variable and test result |
104 | * @delta: integer value to subtract | 179 | * @i: integer value to subtract |
105 | * @ptr: pointer to type atomic64_t | 180 | * @v: pointer to type atomic64_t |
106 | * | 181 | * |
107 | * Atomically subtracts @delta from @ptr and returns | 182 | * Atomically subtracts @i from @v and returns |
108 | * true if the result is zero, or false for all | 183 | * true if the result is zero, or false for all |
109 | * other cases. | 184 | * other cases. |
110 | */ | 185 | */ |
111 | extern int atomic64_sub_and_test(u64 delta, atomic64_t *ptr); | 186 | static inline int atomic64_sub_and_test(long long i, atomic64_t *v) |
187 | { | ||
188 | return atomic64_sub_return(i, v) == 0; | ||
189 | } | ||
112 | 190 | ||
113 | /** | 191 | /** |
114 | * atomic64_inc - increment atomic64 variable | 192 | * atomic64_inc - increment atomic64 variable |
115 | * @ptr: pointer to type atomic64_t | 193 | * @v: pointer to type atomic64_t |
116 | * | 194 | * |
117 | * Atomically increments @ptr by 1. | 195 | * Atomically increments @v by 1. |
118 | */ | 196 | */ |
119 | extern void atomic64_inc(atomic64_t *ptr); | 197 | static inline void atomic64_inc(atomic64_t *v) |
198 | { | ||
199 | asm volatile(ATOMIC64_ALTERNATIVE_(inc, inc_return) | ||
200 | : : "S" (v) | ||
201 | : "memory", "eax", "ecx", "edx" | ||
202 | ); | ||
203 | } | ||
120 | 204 | ||
121 | /** | 205 | /** |
122 | * atomic64_dec - decrement atomic64 variable | 206 | * atomic64_dec - decrement atomic64 variable |
@@ -124,37 +208,97 @@ extern void atomic64_inc(atomic64_t *ptr); | |||
124 | * | 208 | * |
125 | * Atomically decrements @ptr by 1. | 209 | * Atomically decrements @ptr by 1. |
126 | */ | 210 | */ |
127 | extern void atomic64_dec(atomic64_t *ptr); | 211 | static inline void atomic64_dec(atomic64_t *v) |
212 | { | ||
213 | asm volatile(ATOMIC64_ALTERNATIVE_(dec, dec_return) | ||
214 | : : "S" (v) | ||
215 | : "memory", "eax", "ecx", "edx" | ||
216 | ); | ||
217 | } | ||
128 | 218 | ||
129 | /** | 219 | /** |
130 | * atomic64_dec_and_test - decrement and test | 220 | * atomic64_dec_and_test - decrement and test |
131 | * @ptr: pointer to type atomic64_t | 221 | * @v: pointer to type atomic64_t |
132 | * | 222 | * |
133 | * Atomically decrements @ptr by 1 and | 223 | * Atomically decrements @v by 1 and |
134 | * returns true if the result is 0, or false for all other | 224 | * returns true if the result is 0, or false for all other |
135 | * cases. | 225 | * cases. |
136 | */ | 226 | */ |
137 | extern int atomic64_dec_and_test(atomic64_t *ptr); | 227 | static inline int atomic64_dec_and_test(atomic64_t *v) |
228 | { | ||
229 | return atomic64_dec_return(v) == 0; | ||
230 | } | ||
138 | 231 | ||
139 | /** | 232 | /** |
140 | * atomic64_inc_and_test - increment and test | 233 | * atomic64_inc_and_test - increment and test |
141 | * @ptr: pointer to type atomic64_t | 234 | * @v: pointer to type atomic64_t |
142 | * | 235 | * |
143 | * Atomically increments @ptr by 1 | 236 | * Atomically increments @v by 1 |
144 | * and returns true if the result is zero, or false for all | 237 | * and returns true if the result is zero, or false for all |
145 | * other cases. | 238 | * other cases. |
146 | */ | 239 | */ |
147 | extern int atomic64_inc_and_test(atomic64_t *ptr); | 240 | static inline int atomic64_inc_and_test(atomic64_t *v) |
241 | { | ||
242 | return atomic64_inc_return(v) == 0; | ||
243 | } | ||
148 | 244 | ||
149 | /** | 245 | /** |
150 | * atomic64_add_negative - add and test if negative | 246 | * atomic64_add_negative - add and test if negative |
151 | * @delta: integer value to add | 247 | * @i: integer value to add |
152 | * @ptr: pointer to type atomic64_t | 248 | * @v: pointer to type atomic64_t |
153 | * | 249 | * |
154 | * Atomically adds @delta to @ptr and returns true | 250 | * Atomically adds @i to @v and returns true |
155 | * if the result is negative, or false when | 251 | * if the result is negative, or false when |
156 | * result is greater than or equal to zero. | 252 | * result is greater than or equal to zero. |
157 | */ | 253 | */ |
158 | extern int atomic64_add_negative(u64 delta, atomic64_t *ptr); | 254 | static inline int atomic64_add_negative(long long i, atomic64_t *v) |
255 | { | ||
256 | return atomic64_add_return(i, v) < 0; | ||
257 | } | ||
258 | |||
259 | /** | ||
260 | * atomic64_add_unless - add unless the number is a given value | ||
261 | * @v: pointer of type atomic64_t | ||
262 | * @a: the amount to add to v... | ||
263 | * @u: ...unless v is equal to u. | ||
264 | * | ||
265 | * Atomically adds @a to @v, so long as it was not @u. | ||
266 | * Returns non-zero if @v was not @u, and zero otherwise. | ||
267 | */ | ||
268 | static inline int atomic64_add_unless(atomic64_t *v, long long a, long long u) | ||
269 | { | ||
270 | unsigned low = (unsigned)u; | ||
271 | unsigned high = (unsigned)(u >> 32); | ||
272 | asm volatile(ATOMIC64_ALTERNATIVE(add_unless) "\n\t" | ||
273 | : "+A" (a), "+c" (v), "+S" (low), "+D" (high) | ||
274 | : : "memory"); | ||
275 | return (int)a; | ||
276 | } | ||
277 | |||
278 | |||
279 | static inline int atomic64_inc_not_zero(atomic64_t *v) | ||
280 | { | ||
281 | int r; | ||
282 | asm volatile(ATOMIC64_ALTERNATIVE(inc_not_zero) | ||
283 | : "=a" (r) | ||
284 | : "S" (v) | ||
285 | : "ecx", "edx", "memory" | ||
286 | ); | ||
287 | return r; | ||
288 | } | ||
289 | |||
290 | static inline long long atomic64_dec_if_positive(atomic64_t *v) | ||
291 | { | ||
292 | long long r; | ||
293 | asm volatile(ATOMIC64_ALTERNATIVE(dec_if_positive) | ||
294 | : "=A" (r) | ||
295 | : "S" (v) | ||
296 | : "ecx", "memory" | ||
297 | ); | ||
298 | return r; | ||
299 | } | ||
300 | |||
301 | #undef ATOMIC64_ALTERNATIVE | ||
302 | #undef ATOMIC64_ALTERNATIVE_ | ||
159 | 303 | ||
160 | #endif /* _ASM_X86_ATOMIC64_32_H */ | 304 | #endif /* _ASM_X86_ATOMIC64_32_H */ |
diff --git a/arch/x86/include/asm/atomic64_64.h b/arch/x86/include/asm/atomic64_64.h index 51c5b4056929..49fd1ea22951 100644 --- a/arch/x86/include/asm/atomic64_64.h +++ b/arch/x86/include/asm/atomic64_64.h | |||
@@ -18,7 +18,7 @@ | |||
18 | */ | 18 | */ |
19 | static inline long atomic64_read(const atomic64_t *v) | 19 | static inline long atomic64_read(const atomic64_t *v) |
20 | { | 20 | { |
21 | return v->counter; | 21 | return (*(volatile long *)&(v)->counter); |
22 | } | 22 | } |
23 | 23 | ||
24 | /** | 24 | /** |
@@ -221,4 +221,27 @@ static inline int atomic64_add_unless(atomic64_t *v, long a, long u) | |||
221 | 221 | ||
222 | #define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0) | 222 | #define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0) |
223 | 223 | ||
224 | /* | ||
225 | * atomic64_dec_if_positive - decrement by 1 if old value positive | ||
226 | * @v: pointer of type atomic_t | ||
227 | * | ||
228 | * The function returns the old value of *v minus 1, even if | ||
229 | * the atomic variable, v, was not decremented. | ||
230 | */ | ||
231 | static inline long atomic64_dec_if_positive(atomic64_t *v) | ||
232 | { | ||
233 | long c, old, dec; | ||
234 | c = atomic64_read(v); | ||
235 | for (;;) { | ||
236 | dec = c - 1; | ||
237 | if (unlikely(dec < 0)) | ||
238 | break; | ||
239 | old = atomic64_cmpxchg((v), c, dec); | ||
240 | if (likely(old == c)) | ||
241 | break; | ||
242 | c = old; | ||
243 | } | ||
244 | return dec; | ||
245 | } | ||
246 | |||
224 | #endif /* _ASM_X86_ATOMIC64_64_H */ | 247 | #endif /* _ASM_X86_ATOMIC64_64_H */ |
diff --git a/arch/x86/include/asm/bitops.h b/arch/x86/include/asm/bitops.h index 02b47a603fc8..545776efeb16 100644 --- a/arch/x86/include/asm/bitops.h +++ b/arch/x86/include/asm/bitops.h | |||
@@ -444,7 +444,9 @@ static inline int fls(int x) | |||
444 | 444 | ||
445 | #define ARCH_HAS_FAST_MULTIPLIER 1 | 445 | #define ARCH_HAS_FAST_MULTIPLIER 1 |
446 | 446 | ||
447 | #include <asm-generic/bitops/hweight.h> | 447 | #include <asm/arch_hweight.h> |
448 | |||
449 | #include <asm-generic/bitops/const_hweight.h> | ||
448 | 450 | ||
449 | #endif /* __KERNEL__ */ | 451 | #endif /* __KERNEL__ */ |
450 | 452 | ||
diff --git a/arch/x86/include/asm/boot.h b/arch/x86/include/asm/boot.h index 7a1065958ba9..3b62ab56c7a0 100644 --- a/arch/x86/include/asm/boot.h +++ b/arch/x86/include/asm/boot.h | |||
@@ -24,7 +24,7 @@ | |||
24 | #define MIN_KERNEL_ALIGN (_AC(1, UL) << MIN_KERNEL_ALIGN_LG2) | 24 | #define MIN_KERNEL_ALIGN (_AC(1, UL) << MIN_KERNEL_ALIGN_LG2) |
25 | 25 | ||
26 | #if (CONFIG_PHYSICAL_ALIGN & (CONFIG_PHYSICAL_ALIGN-1)) || \ | 26 | #if (CONFIG_PHYSICAL_ALIGN & (CONFIG_PHYSICAL_ALIGN-1)) || \ |
27 | (CONFIG_PHYSICAL_ALIGN < (_AC(1, UL) << MIN_KERNEL_ALIGN_LG2)) | 27 | (CONFIG_PHYSICAL_ALIGN < MIN_KERNEL_ALIGN) |
28 | #error "Invalid value for CONFIG_PHYSICAL_ALIGN" | 28 | #error "Invalid value for CONFIG_PHYSICAL_ALIGN" |
29 | #endif | 29 | #endif |
30 | 30 | ||
diff --git a/arch/x86/include/asm/cacheflush.h b/arch/x86/include/asm/cacheflush.h index 634c40a739a6..c70068d05f70 100644 --- a/arch/x86/include/asm/cacheflush.h +++ b/arch/x86/include/asm/cacheflush.h | |||
@@ -44,9 +44,6 @@ static inline void copy_from_user_page(struct vm_area_struct *vma, | |||
44 | memcpy(dst, src, len); | 44 | memcpy(dst, src, len); |
45 | } | 45 | } |
46 | 46 | ||
47 | #define PG_WC PG_arch_1 | ||
48 | PAGEFLAG(WC, WC) | ||
49 | |||
50 | #ifdef CONFIG_X86_PAT | 47 | #ifdef CONFIG_X86_PAT |
51 | /* | 48 | /* |
52 | * X86 PAT uses page flags WC and Uncached together to keep track of | 49 | * X86 PAT uses page flags WC and Uncached together to keep track of |
@@ -55,16 +52,24 @@ PAGEFLAG(WC, WC) | |||
55 | * _PAGE_CACHE_UC_MINUS and fourth state where page's memory type has not | 52 | * _PAGE_CACHE_UC_MINUS and fourth state where page's memory type has not |
56 | * been changed from its default (value of -1 used to denote this). | 53 | * been changed from its default (value of -1 used to denote this). |
57 | * Note we do not support _PAGE_CACHE_UC here. | 54 | * Note we do not support _PAGE_CACHE_UC here. |
58 | * | ||
59 | * Caller must hold memtype_lock for atomicity. | ||
60 | */ | 55 | */ |
56 | |||
57 | #define _PGMT_DEFAULT 0 | ||
58 | #define _PGMT_WC (1UL << PG_arch_1) | ||
59 | #define _PGMT_UC_MINUS (1UL << PG_uncached) | ||
60 | #define _PGMT_WB (1UL << PG_uncached | 1UL << PG_arch_1) | ||
61 | #define _PGMT_MASK (1UL << PG_uncached | 1UL << PG_arch_1) | ||
62 | #define _PGMT_CLEAR_MASK (~_PGMT_MASK) | ||
63 | |||
61 | static inline unsigned long get_page_memtype(struct page *pg) | 64 | static inline unsigned long get_page_memtype(struct page *pg) |
62 | { | 65 | { |
63 | if (!PageUncached(pg) && !PageWC(pg)) | 66 | unsigned long pg_flags = pg->flags & _PGMT_MASK; |
67 | |||
68 | if (pg_flags == _PGMT_DEFAULT) | ||
64 | return -1; | 69 | return -1; |
65 | else if (!PageUncached(pg) && PageWC(pg)) | 70 | else if (pg_flags == _PGMT_WC) |
66 | return _PAGE_CACHE_WC; | 71 | return _PAGE_CACHE_WC; |
67 | else if (PageUncached(pg) && !PageWC(pg)) | 72 | else if (pg_flags == _PGMT_UC_MINUS) |
68 | return _PAGE_CACHE_UC_MINUS; | 73 | return _PAGE_CACHE_UC_MINUS; |
69 | else | 74 | else |
70 | return _PAGE_CACHE_WB; | 75 | return _PAGE_CACHE_WB; |
@@ -72,25 +77,26 @@ static inline unsigned long get_page_memtype(struct page *pg) | |||
72 | 77 | ||
73 | static inline void set_page_memtype(struct page *pg, unsigned long memtype) | 78 | static inline void set_page_memtype(struct page *pg, unsigned long memtype) |
74 | { | 79 | { |
80 | unsigned long memtype_flags = _PGMT_DEFAULT; | ||
81 | unsigned long old_flags; | ||
82 | unsigned long new_flags; | ||
83 | |||
75 | switch (memtype) { | 84 | switch (memtype) { |
76 | case _PAGE_CACHE_WC: | 85 | case _PAGE_CACHE_WC: |
77 | ClearPageUncached(pg); | 86 | memtype_flags = _PGMT_WC; |
78 | SetPageWC(pg); | ||
79 | break; | 87 | break; |
80 | case _PAGE_CACHE_UC_MINUS: | 88 | case _PAGE_CACHE_UC_MINUS: |
81 | SetPageUncached(pg); | 89 | memtype_flags = _PGMT_UC_MINUS; |
82 | ClearPageWC(pg); | ||
83 | break; | 90 | break; |
84 | case _PAGE_CACHE_WB: | 91 | case _PAGE_CACHE_WB: |
85 | SetPageUncached(pg); | 92 | memtype_flags = _PGMT_WB; |
86 | SetPageWC(pg); | ||
87 | break; | ||
88 | default: | ||
89 | case -1: | ||
90 | ClearPageUncached(pg); | ||
91 | ClearPageWC(pg); | ||
92 | break; | 93 | break; |
93 | } | 94 | } |
95 | |||
96 | do { | ||
97 | old_flags = pg->flags; | ||
98 | new_flags = (old_flags & _PGMT_CLEAR_MASK) | memtype_flags; | ||
99 | } while (cmpxchg(&pg->flags, old_flags, new_flags) != old_flags); | ||
94 | } | 100 | } |
95 | #else | 101 | #else |
96 | static inline unsigned long get_page_memtype(struct page *pg) { return -1; } | 102 | static inline unsigned long get_page_memtype(struct page *pg) { return -1; } |
diff --git a/arch/x86/include/asm/cmpxchg_32.h b/arch/x86/include/asm/cmpxchg_32.h index ffb9bb6b6c37..8859e12dd3cf 100644 --- a/arch/x86/include/asm/cmpxchg_32.h +++ b/arch/x86/include/asm/cmpxchg_32.h | |||
@@ -271,7 +271,8 @@ extern unsigned long long cmpxchg_486_u64(volatile void *, u64, u64); | |||
271 | __typeof__(*(ptr)) __ret; \ | 271 | __typeof__(*(ptr)) __ret; \ |
272 | __typeof__(*(ptr)) __old = (o); \ | 272 | __typeof__(*(ptr)) __old = (o); \ |
273 | __typeof__(*(ptr)) __new = (n); \ | 273 | __typeof__(*(ptr)) __new = (n); \ |
274 | alternative_io("call cmpxchg8b_emu", \ | 274 | alternative_io(LOCK_PREFIX_HERE \ |
275 | "call cmpxchg8b_emu", \ | ||
275 | "lock; cmpxchg8b (%%esi)" , \ | 276 | "lock; cmpxchg8b (%%esi)" , \ |
276 | X86_FEATURE_CX8, \ | 277 | X86_FEATURE_CX8, \ |
277 | "=A" (__ret), \ | 278 | "=A" (__ret), \ |
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h index 0cd82d068613..dca9c545f44e 100644 --- a/arch/x86/include/asm/cpufeature.h +++ b/arch/x86/include/asm/cpufeature.h | |||
@@ -161,6 +161,7 @@ | |||
161 | */ | 161 | */ |
162 | #define X86_FEATURE_IDA (7*32+ 0) /* Intel Dynamic Acceleration */ | 162 | #define X86_FEATURE_IDA (7*32+ 0) /* Intel Dynamic Acceleration */ |
163 | #define X86_FEATURE_ARAT (7*32+ 1) /* Always Running APIC Timer */ | 163 | #define X86_FEATURE_ARAT (7*32+ 1) /* Always Running APIC Timer */ |
164 | #define X86_FEATURE_CPB (7*32+ 2) /* AMD Core Performance Boost */ | ||
164 | 165 | ||
165 | /* Virtualization flags: Linux defined */ | 166 | /* Virtualization flags: Linux defined */ |
166 | #define X86_FEATURE_TPR_SHADOW (8*32+ 0) /* Intel TPR Shadow */ | 167 | #define X86_FEATURE_TPR_SHADOW (8*32+ 0) /* Intel TPR Shadow */ |
@@ -175,6 +176,7 @@ | |||
175 | 176 | ||
176 | #if defined(__KERNEL__) && !defined(__ASSEMBLY__) | 177 | #if defined(__KERNEL__) && !defined(__ASSEMBLY__) |
177 | 178 | ||
179 | #include <asm/asm.h> | ||
178 | #include <linux/bitops.h> | 180 | #include <linux/bitops.h> |
179 | 181 | ||
180 | extern const char * const x86_cap_flags[NCAPINTS*32]; | 182 | extern const char * const x86_cap_flags[NCAPINTS*32]; |
@@ -283,6 +285,62 @@ extern const char * const x86_power_flags[32]; | |||
283 | 285 | ||
284 | #endif /* CONFIG_X86_64 */ | 286 | #endif /* CONFIG_X86_64 */ |
285 | 287 | ||
288 | /* | ||
289 | * Static testing of CPU features. Used the same as boot_cpu_has(). | ||
290 | * These are only valid after alternatives have run, but will statically | ||
291 | * patch the target code for additional performance. | ||
292 | * | ||
293 | */ | ||
294 | static __always_inline __pure bool __static_cpu_has(u8 bit) | ||
295 | { | ||
296 | #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) | ||
297 | asm goto("1: jmp %l[t_no]\n" | ||
298 | "2:\n" | ||
299 | ".section .altinstructions,\"a\"\n" | ||
300 | _ASM_ALIGN "\n" | ||
301 | _ASM_PTR "1b\n" | ||
302 | _ASM_PTR "0\n" /* no replacement */ | ||
303 | " .byte %P0\n" /* feature bit */ | ||
304 | " .byte 2b - 1b\n" /* source len */ | ||
305 | " .byte 0\n" /* replacement len */ | ||
306 | " .byte 0xff + 0 - (2b-1b)\n" /* padding */ | ||
307 | ".previous\n" | ||
308 | : : "i" (bit) : : t_no); | ||
309 | return true; | ||
310 | t_no: | ||
311 | return false; | ||
312 | #else | ||
313 | u8 flag; | ||
314 | /* Open-coded due to __stringify() in ALTERNATIVE() */ | ||
315 | asm volatile("1: movb $0,%0\n" | ||
316 | "2:\n" | ||
317 | ".section .altinstructions,\"a\"\n" | ||
318 | _ASM_ALIGN "\n" | ||
319 | _ASM_PTR "1b\n" | ||
320 | _ASM_PTR "3f\n" | ||
321 | " .byte %P1\n" /* feature bit */ | ||
322 | " .byte 2b - 1b\n" /* source len */ | ||
323 | " .byte 4f - 3f\n" /* replacement len */ | ||
324 | " .byte 0xff + (4f-3f) - (2b-1b)\n" /* padding */ | ||
325 | ".previous\n" | ||
326 | ".section .altinstr_replacement,\"ax\"\n" | ||
327 | "3: movb $1,%0\n" | ||
328 | "4:\n" | ||
329 | ".previous\n" | ||
330 | : "=qm" (flag) : "i" (bit)); | ||
331 | return flag; | ||
332 | #endif | ||
333 | } | ||
334 | |||
335 | #define static_cpu_has(bit) \ | ||
336 | ( \ | ||
337 | __builtin_constant_p(boot_cpu_has(bit)) ? \ | ||
338 | boot_cpu_has(bit) : \ | ||
339 | (__builtin_constant_p(bit) && !((bit) & ~0xff)) ? \ | ||
340 | __static_cpu_has(bit) : \ | ||
341 | boot_cpu_has(bit) \ | ||
342 | ) | ||
343 | |||
286 | #endif /* defined(__KERNEL__) && !defined(__ASSEMBLY__) */ | 344 | #endif /* defined(__KERNEL__) && !defined(__ASSEMBLY__) */ |
287 | 345 | ||
288 | #endif /* _ASM_X86_CPUFEATURE_H */ | 346 | #endif /* _ASM_X86_CPUFEATURE_H */ |
diff --git a/arch/x86/include/asm/dwarf2.h b/arch/x86/include/asm/dwarf2.h index ae6253ab9029..733f7e91e7a9 100644 --- a/arch/x86/include/asm/dwarf2.h +++ b/arch/x86/include/asm/dwarf2.h | |||
@@ -34,6 +34,18 @@ | |||
34 | #define CFI_SIGNAL_FRAME | 34 | #define CFI_SIGNAL_FRAME |
35 | #endif | 35 | #endif |
36 | 36 | ||
37 | #if defined(CONFIG_AS_CFI_SECTIONS) && defined(__ASSEMBLY__) | ||
38 | /* | ||
39 | * Emit CFI data in .debug_frame sections, not .eh_frame sections. | ||
40 | * The latter we currently just discard since we don't do DWARF | ||
41 | * unwinding at runtime. So only the offline DWARF information is | ||
42 | * useful to anyone. Note we should not use this directive if this | ||
43 | * file is used in the vDSO assembly, or if vmlinux.lds.S gets | ||
44 | * changed so it doesn't discard .eh_frame. | ||
45 | */ | ||
46 | .cfi_sections .debug_frame | ||
47 | #endif | ||
48 | |||
37 | #else | 49 | #else |
38 | 50 | ||
39 | /* | 51 | /* |
diff --git a/arch/x86/include/asm/e820.h b/arch/x86/include/asm/e820.h index 0e22296790d3..ec8a52d14ab1 100644 --- a/arch/x86/include/asm/e820.h +++ b/arch/x86/include/asm/e820.h | |||
@@ -45,7 +45,12 @@ | |||
45 | #define E820_NVS 4 | 45 | #define E820_NVS 4 |
46 | #define E820_UNUSABLE 5 | 46 | #define E820_UNUSABLE 5 |
47 | 47 | ||
48 | /* reserved RAM used by kernel itself */ | 48 | /* |
49 | * reserved RAM used by kernel itself | ||
50 | * if CONFIG_INTEL_TXT is enabled, memory of this type will be | ||
51 | * included in the S3 integrity calculation and so should not include | ||
52 | * any memory that BIOS might alter over the S3 transition | ||
53 | */ | ||
49 | #define E820_RESERVED_KERN 128 | 54 | #define E820_RESERVED_KERN 128 |
50 | 55 | ||
51 | #ifndef __ASSEMBLY__ | 56 | #ifndef __ASSEMBLY__ |
diff --git a/arch/x86/include/asm/hardirq.h b/arch/x86/include/asm/hardirq.h index 0f8576427cfe..aeab29aee617 100644 --- a/arch/x86/include/asm/hardirq.h +++ b/arch/x86/include/asm/hardirq.h | |||
@@ -35,7 +35,7 @@ DECLARE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat); | |||
35 | 35 | ||
36 | #define __ARCH_IRQ_STAT | 36 | #define __ARCH_IRQ_STAT |
37 | 37 | ||
38 | #define inc_irq_stat(member) percpu_add(irq_stat.member, 1) | 38 | #define inc_irq_stat(member) percpu_inc(irq_stat.member) |
39 | 39 | ||
40 | #define local_softirq_pending() percpu_read(irq_stat.__softirq_pending) | 40 | #define local_softirq_pending() percpu_read(irq_stat.__softirq_pending) |
41 | 41 | ||
diff --git a/arch/x86/include/asm/hyperv.h b/arch/x86/include/asm/hyperv.h index e153a2b3889a..5df477ac3af7 100644 --- a/arch/x86/include/asm/hyperv.h +++ b/arch/x86/include/asm/hyperv.h | |||
@@ -1,5 +1,5 @@ | |||
1 | #ifndef _ASM_X86_KVM_HYPERV_H | 1 | #ifndef _ASM_X86_HYPERV_H |
2 | #define _ASM_X86_KVM_HYPERV_H | 2 | #define _ASM_X86_HYPERV_H |
3 | 3 | ||
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | 5 | ||
@@ -14,6 +14,10 @@ | |||
14 | #define HYPERV_CPUID_ENLIGHTMENT_INFO 0x40000004 | 14 | #define HYPERV_CPUID_ENLIGHTMENT_INFO 0x40000004 |
15 | #define HYPERV_CPUID_IMPLEMENT_LIMITS 0x40000005 | 15 | #define HYPERV_CPUID_IMPLEMENT_LIMITS 0x40000005 |
16 | 16 | ||
17 | #define HYPERV_HYPERVISOR_PRESENT_BIT 0x80000000 | ||
18 | #define HYPERV_CPUID_MIN 0x40000005 | ||
19 | #define HYPERV_CPUID_MAX 0x4000ffff | ||
20 | |||
17 | /* | 21 | /* |
18 | * Feature identification. EAX indicates which features are available | 22 | * Feature identification. EAX indicates which features are available |
19 | * to the partition based upon the current partition privileges. | 23 | * to the partition based upon the current partition privileges. |
@@ -129,6 +133,9 @@ | |||
129 | /* MSR used to provide vcpu index */ | 133 | /* MSR used to provide vcpu index */ |
130 | #define HV_X64_MSR_VP_INDEX 0x40000002 | 134 | #define HV_X64_MSR_VP_INDEX 0x40000002 |
131 | 135 | ||
136 | /* MSR used to read the per-partition time reference counter */ | ||
137 | #define HV_X64_MSR_TIME_REF_COUNT 0x40000020 | ||
138 | |||
132 | /* Define the virtual APIC registers */ | 139 | /* Define the virtual APIC registers */ |
133 | #define HV_X64_MSR_EOI 0x40000070 | 140 | #define HV_X64_MSR_EOI 0x40000070 |
134 | #define HV_X64_MSR_ICR 0x40000071 | 141 | #define HV_X64_MSR_ICR 0x40000071 |
diff --git a/arch/x86/include/asm/hypervisor.h b/arch/x86/include/asm/hypervisor.h index b78c0941e422..70abda7058c8 100644 --- a/arch/x86/include/asm/hypervisor.h +++ b/arch/x86/include/asm/hypervisor.h | |||
@@ -17,10 +17,33 @@ | |||
17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
18 | * | 18 | * |
19 | */ | 19 | */ |
20 | #ifndef ASM_X86__HYPERVISOR_H | 20 | #ifndef _ASM_X86_HYPERVISOR_H |
21 | #define ASM_X86__HYPERVISOR_H | 21 | #define _ASM_X86_HYPERVISOR_H |
22 | 22 | ||
23 | extern void init_hypervisor(struct cpuinfo_x86 *c); | 23 | extern void init_hypervisor(struct cpuinfo_x86 *c); |
24 | extern void init_hypervisor_platform(void); | 24 | extern void init_hypervisor_platform(void); |
25 | 25 | ||
26 | /* | ||
27 | * x86 hypervisor information | ||
28 | */ | ||
29 | struct hypervisor_x86 { | ||
30 | /* Hypervisor name */ | ||
31 | const char *name; | ||
32 | |||
33 | /* Detection routine */ | ||
34 | bool (*detect)(void); | ||
35 | |||
36 | /* Adjust CPU feature bits (run once per CPU) */ | ||
37 | void (*set_cpu_features)(struct cpuinfo_x86 *); | ||
38 | |||
39 | /* Platform setup (run once per boot) */ | ||
40 | void (*init_platform)(void); | ||
41 | }; | ||
42 | |||
43 | extern const struct hypervisor_x86 *x86_hyper; | ||
44 | |||
45 | /* Recognized hypervisors */ | ||
46 | extern const struct hypervisor_x86 x86_hyper_vmware; | ||
47 | extern const struct hypervisor_x86 x86_hyper_ms_hyperv; | ||
48 | |||
26 | #endif | 49 | #endif |
diff --git a/arch/x86/include/asm/i387.h b/arch/x86/include/asm/i387.h index da2930924501..c991b3a7b904 100644 --- a/arch/x86/include/asm/i387.h +++ b/arch/x86/include/asm/i387.h | |||
@@ -16,7 +16,9 @@ | |||
16 | #include <linux/kernel_stat.h> | 16 | #include <linux/kernel_stat.h> |
17 | #include <linux/regset.h> | 17 | #include <linux/regset.h> |
18 | #include <linux/hardirq.h> | 18 | #include <linux/hardirq.h> |
19 | #include <linux/slab.h> | ||
19 | #include <asm/asm.h> | 20 | #include <asm/asm.h> |
21 | #include <asm/cpufeature.h> | ||
20 | #include <asm/processor.h> | 22 | #include <asm/processor.h> |
21 | #include <asm/sigcontext.h> | 23 | #include <asm/sigcontext.h> |
22 | #include <asm/user.h> | 24 | #include <asm/user.h> |
@@ -56,6 +58,11 @@ extern int restore_i387_xstate_ia32(void __user *buf); | |||
56 | 58 | ||
57 | #define X87_FSW_ES (1 << 7) /* Exception Summary */ | 59 | #define X87_FSW_ES (1 << 7) /* Exception Summary */ |
58 | 60 | ||
61 | static __always_inline __pure bool use_xsave(void) | ||
62 | { | ||
63 | return static_cpu_has(X86_FEATURE_XSAVE); | ||
64 | } | ||
65 | |||
59 | #ifdef CONFIG_X86_64 | 66 | #ifdef CONFIG_X86_64 |
60 | 67 | ||
61 | /* Ignore delayed exceptions from user space */ | 68 | /* Ignore delayed exceptions from user space */ |
@@ -91,15 +98,15 @@ static inline int fxrstor_checking(struct i387_fxsave_struct *fx) | |||
91 | values. The kernel data segment can be sometimes 0 and sometimes | 98 | values. The kernel data segment can be sometimes 0 and sometimes |
92 | new user value. Both should be ok. | 99 | new user value. Both should be ok. |
93 | Use the PDA as safe address because it should be already in L1. */ | 100 | Use the PDA as safe address because it should be already in L1. */ |
94 | static inline void clear_fpu_state(struct task_struct *tsk) | 101 | static inline void fpu_clear(struct fpu *fpu) |
95 | { | 102 | { |
96 | struct xsave_struct *xstate = &tsk->thread.xstate->xsave; | 103 | struct xsave_struct *xstate = &fpu->state->xsave; |
97 | struct i387_fxsave_struct *fx = &tsk->thread.xstate->fxsave; | 104 | struct i387_fxsave_struct *fx = &fpu->state->fxsave; |
98 | 105 | ||
99 | /* | 106 | /* |
100 | * xsave header may indicate the init state of the FP. | 107 | * xsave header may indicate the init state of the FP. |
101 | */ | 108 | */ |
102 | if ((task_thread_info(tsk)->status & TS_XSAVE) && | 109 | if (use_xsave() && |
103 | !(xstate->xsave_hdr.xstate_bv & XSTATE_FP)) | 110 | !(xstate->xsave_hdr.xstate_bv & XSTATE_FP)) |
104 | return; | 111 | return; |
105 | 112 | ||
@@ -111,6 +118,11 @@ static inline void clear_fpu_state(struct task_struct *tsk) | |||
111 | X86_FEATURE_FXSAVE_LEAK); | 118 | X86_FEATURE_FXSAVE_LEAK); |
112 | } | 119 | } |
113 | 120 | ||
121 | static inline void clear_fpu_state(struct task_struct *tsk) | ||
122 | { | ||
123 | fpu_clear(&tsk->thread.fpu); | ||
124 | } | ||
125 | |||
114 | static inline int fxsave_user(struct i387_fxsave_struct __user *fx) | 126 | static inline int fxsave_user(struct i387_fxsave_struct __user *fx) |
115 | { | 127 | { |
116 | int err; | 128 | int err; |
@@ -135,7 +147,7 @@ static inline int fxsave_user(struct i387_fxsave_struct __user *fx) | |||
135 | return err; | 147 | return err; |
136 | } | 148 | } |
137 | 149 | ||
138 | static inline void fxsave(struct task_struct *tsk) | 150 | static inline void fpu_fxsave(struct fpu *fpu) |
139 | { | 151 | { |
140 | /* Using "rex64; fxsave %0" is broken because, if the memory operand | 152 | /* Using "rex64; fxsave %0" is broken because, if the memory operand |
141 | uses any extended registers for addressing, a second REX prefix | 153 | uses any extended registers for addressing, a second REX prefix |
@@ -145,42 +157,45 @@ static inline void fxsave(struct task_struct *tsk) | |||
145 | /* Using "fxsaveq %0" would be the ideal choice, but is only supported | 157 | /* Using "fxsaveq %0" would be the ideal choice, but is only supported |
146 | starting with gas 2.16. */ | 158 | starting with gas 2.16. */ |
147 | __asm__ __volatile__("fxsaveq %0" | 159 | __asm__ __volatile__("fxsaveq %0" |
148 | : "=m" (tsk->thread.xstate->fxsave)); | 160 | : "=m" (fpu->state->fxsave)); |
149 | #elif 0 | 161 | #elif 0 |
150 | /* Using, as a workaround, the properly prefixed form below isn't | 162 | /* Using, as a workaround, the properly prefixed form below isn't |
151 | accepted by any binutils version so far released, complaining that | 163 | accepted by any binutils version so far released, complaining that |
152 | the same type of prefix is used twice if an extended register is | 164 | the same type of prefix is used twice if an extended register is |
153 | needed for addressing (fix submitted to mainline 2005-11-21). */ | 165 | needed for addressing (fix submitted to mainline 2005-11-21). */ |
154 | __asm__ __volatile__("rex64/fxsave %0" | 166 | __asm__ __volatile__("rex64/fxsave %0" |
155 | : "=m" (tsk->thread.xstate->fxsave)); | 167 | : "=m" (fpu->state->fxsave)); |
156 | #else | 168 | #else |
157 | /* This, however, we can work around by forcing the compiler to select | 169 | /* This, however, we can work around by forcing the compiler to select |
158 | an addressing mode that doesn't require extended registers. */ | 170 | an addressing mode that doesn't require extended registers. */ |
159 | __asm__ __volatile__("rex64/fxsave (%1)" | 171 | __asm__ __volatile__("rex64/fxsave (%1)" |
160 | : "=m" (tsk->thread.xstate->fxsave) | 172 | : "=m" (fpu->state->fxsave) |
161 | : "cdaSDb" (&tsk->thread.xstate->fxsave)); | 173 | : "cdaSDb" (&fpu->state->fxsave)); |
162 | #endif | 174 | #endif |
163 | } | 175 | } |
164 | 176 | ||
165 | static inline void __save_init_fpu(struct task_struct *tsk) | 177 | static inline void fpu_save_init(struct fpu *fpu) |
166 | { | 178 | { |
167 | if (task_thread_info(tsk)->status & TS_XSAVE) | 179 | if (use_xsave()) |
168 | xsave(tsk); | 180 | fpu_xsave(fpu); |
169 | else | 181 | else |
170 | fxsave(tsk); | 182 | fpu_fxsave(fpu); |
183 | |||
184 | fpu_clear(fpu); | ||
185 | } | ||
171 | 186 | ||
172 | clear_fpu_state(tsk); | 187 | static inline void __save_init_fpu(struct task_struct *tsk) |
188 | { | ||
189 | fpu_save_init(&tsk->thread.fpu); | ||
173 | task_thread_info(tsk)->status &= ~TS_USEDFPU; | 190 | task_thread_info(tsk)->status &= ~TS_USEDFPU; |
174 | } | 191 | } |
175 | 192 | ||
176 | #else /* CONFIG_X86_32 */ | 193 | #else /* CONFIG_X86_32 */ |
177 | 194 | ||
178 | #ifdef CONFIG_MATH_EMULATION | 195 | #ifdef CONFIG_MATH_EMULATION |
179 | extern void finit_task(struct task_struct *tsk); | 196 | extern void finit_soft_fpu(struct i387_soft_struct *soft); |
180 | #else | 197 | #else |
181 | static inline void finit_task(struct task_struct *tsk) | 198 | static inline void finit_soft_fpu(struct i387_soft_struct *soft) {} |
182 | { | ||
183 | } | ||
184 | #endif | 199 | #endif |
185 | 200 | ||
186 | static inline void tolerant_fwait(void) | 201 | static inline void tolerant_fwait(void) |
@@ -216,13 +231,13 @@ static inline int fxrstor_checking(struct i387_fxsave_struct *fx) | |||
216 | /* | 231 | /* |
217 | * These must be called with preempt disabled | 232 | * These must be called with preempt disabled |
218 | */ | 233 | */ |
219 | static inline void __save_init_fpu(struct task_struct *tsk) | 234 | static inline void fpu_save_init(struct fpu *fpu) |
220 | { | 235 | { |
221 | if (task_thread_info(tsk)->status & TS_XSAVE) { | 236 | if (use_xsave()) { |
222 | struct xsave_struct *xstate = &tsk->thread.xstate->xsave; | 237 | struct xsave_struct *xstate = &fpu->state->xsave; |
223 | struct i387_fxsave_struct *fx = &tsk->thread.xstate->fxsave; | 238 | struct i387_fxsave_struct *fx = &fpu->state->fxsave; |
224 | 239 | ||
225 | xsave(tsk); | 240 | fpu_xsave(fpu); |
226 | 241 | ||
227 | /* | 242 | /* |
228 | * xsave header may indicate the init state of the FP. | 243 | * xsave header may indicate the init state of the FP. |
@@ -246,8 +261,8 @@ static inline void __save_init_fpu(struct task_struct *tsk) | |||
246 | "fxsave %[fx]\n" | 261 | "fxsave %[fx]\n" |
247 | "bt $7,%[fsw] ; jnc 1f ; fnclex\n1:", | 262 | "bt $7,%[fsw] ; jnc 1f ; fnclex\n1:", |
248 | X86_FEATURE_FXSR, | 263 | X86_FEATURE_FXSR, |
249 | [fx] "m" (tsk->thread.xstate->fxsave), | 264 | [fx] "m" (fpu->state->fxsave), |
250 | [fsw] "m" (tsk->thread.xstate->fxsave.swd) : "memory"); | 265 | [fsw] "m" (fpu->state->fxsave.swd) : "memory"); |
251 | clear_state: | 266 | clear_state: |
252 | /* AMD K7/K8 CPUs don't save/restore FDP/FIP/FOP unless an exception | 267 | /* AMD K7/K8 CPUs don't save/restore FDP/FIP/FOP unless an exception |
253 | is pending. Clear the x87 state here by setting it to fixed | 268 | is pending. Clear the x87 state here by setting it to fixed |
@@ -259,17 +274,34 @@ clear_state: | |||
259 | X86_FEATURE_FXSAVE_LEAK, | 274 | X86_FEATURE_FXSAVE_LEAK, |
260 | [addr] "m" (safe_address)); | 275 | [addr] "m" (safe_address)); |
261 | end: | 276 | end: |
277 | ; | ||
278 | } | ||
279 | |||
280 | static inline void __save_init_fpu(struct task_struct *tsk) | ||
281 | { | ||
282 | fpu_save_init(&tsk->thread.fpu); | ||
262 | task_thread_info(tsk)->status &= ~TS_USEDFPU; | 283 | task_thread_info(tsk)->status &= ~TS_USEDFPU; |
263 | } | 284 | } |
264 | 285 | ||
286 | |||
265 | #endif /* CONFIG_X86_64 */ | 287 | #endif /* CONFIG_X86_64 */ |
266 | 288 | ||
267 | static inline int restore_fpu_checking(struct task_struct *tsk) | 289 | static inline int fpu_fxrstor_checking(struct fpu *fpu) |
268 | { | 290 | { |
269 | if (task_thread_info(tsk)->status & TS_XSAVE) | 291 | return fxrstor_checking(&fpu->state->fxsave); |
270 | return xrstor_checking(&tsk->thread.xstate->xsave); | 292 | } |
293 | |||
294 | static inline int fpu_restore_checking(struct fpu *fpu) | ||
295 | { | ||
296 | if (use_xsave()) | ||
297 | return fpu_xrstor_checking(fpu); | ||
271 | else | 298 | else |
272 | return fxrstor_checking(&tsk->thread.xstate->fxsave); | 299 | return fpu_fxrstor_checking(fpu); |
300 | } | ||
301 | |||
302 | static inline int restore_fpu_checking(struct task_struct *tsk) | ||
303 | { | ||
304 | return fpu_restore_checking(&tsk->thread.fpu); | ||
273 | } | 305 | } |
274 | 306 | ||
275 | /* | 307 | /* |
@@ -397,30 +429,59 @@ static inline void clear_fpu(struct task_struct *tsk) | |||
397 | static inline unsigned short get_fpu_cwd(struct task_struct *tsk) | 429 | static inline unsigned short get_fpu_cwd(struct task_struct *tsk) |
398 | { | 430 | { |
399 | if (cpu_has_fxsr) { | 431 | if (cpu_has_fxsr) { |
400 | return tsk->thread.xstate->fxsave.cwd; | 432 | return tsk->thread.fpu.state->fxsave.cwd; |
401 | } else { | 433 | } else { |
402 | return (unsigned short)tsk->thread.xstate->fsave.cwd; | 434 | return (unsigned short)tsk->thread.fpu.state->fsave.cwd; |
403 | } | 435 | } |
404 | } | 436 | } |
405 | 437 | ||
406 | static inline unsigned short get_fpu_swd(struct task_struct *tsk) | 438 | static inline unsigned short get_fpu_swd(struct task_struct *tsk) |
407 | { | 439 | { |
408 | if (cpu_has_fxsr) { | 440 | if (cpu_has_fxsr) { |
409 | return tsk->thread.xstate->fxsave.swd; | 441 | return tsk->thread.fpu.state->fxsave.swd; |
410 | } else { | 442 | } else { |
411 | return (unsigned short)tsk->thread.xstate->fsave.swd; | 443 | return (unsigned short)tsk->thread.fpu.state->fsave.swd; |
412 | } | 444 | } |
413 | } | 445 | } |
414 | 446 | ||
415 | static inline unsigned short get_fpu_mxcsr(struct task_struct *tsk) | 447 | static inline unsigned short get_fpu_mxcsr(struct task_struct *tsk) |
416 | { | 448 | { |
417 | if (cpu_has_xmm) { | 449 | if (cpu_has_xmm) { |
418 | return tsk->thread.xstate->fxsave.mxcsr; | 450 | return tsk->thread.fpu.state->fxsave.mxcsr; |
419 | } else { | 451 | } else { |
420 | return MXCSR_DEFAULT; | 452 | return MXCSR_DEFAULT; |
421 | } | 453 | } |
422 | } | 454 | } |
423 | 455 | ||
456 | static bool fpu_allocated(struct fpu *fpu) | ||
457 | { | ||
458 | return fpu->state != NULL; | ||
459 | } | ||
460 | |||
461 | static inline int fpu_alloc(struct fpu *fpu) | ||
462 | { | ||
463 | if (fpu_allocated(fpu)) | ||
464 | return 0; | ||
465 | fpu->state = kmem_cache_alloc(task_xstate_cachep, GFP_KERNEL); | ||
466 | if (!fpu->state) | ||
467 | return -ENOMEM; | ||
468 | WARN_ON((unsigned long)fpu->state & 15); | ||
469 | return 0; | ||
470 | } | ||
471 | |||
472 | static inline void fpu_free(struct fpu *fpu) | ||
473 | { | ||
474 | if (fpu->state) { | ||
475 | kmem_cache_free(task_xstate_cachep, fpu->state); | ||
476 | fpu->state = NULL; | ||
477 | } | ||
478 | } | ||
479 | |||
480 | static inline void fpu_copy(struct fpu *dst, struct fpu *src) | ||
481 | { | ||
482 | memcpy(dst->state, src->state, xstate_size); | ||
483 | } | ||
484 | |||
424 | #endif /* __ASSEMBLY__ */ | 485 | #endif /* __ASSEMBLY__ */ |
425 | 486 | ||
426 | #define PSHUFB_XMM5_XMM0 .byte 0x66, 0x0f, 0x38, 0x00, 0xc5 | 487 | #define PSHUFB_XMM5_XMM0 .byte 0x66, 0x0f, 0x38, 0x00, 0xc5 |
diff --git a/arch/x86/include/asm/i8253.h b/arch/x86/include/asm/i8253.h index 1edbf89680fd..fc1f579fb965 100644 --- a/arch/x86/include/asm/i8253.h +++ b/arch/x86/include/asm/i8253.h | |||
@@ -6,7 +6,7 @@ | |||
6 | #define PIT_CH0 0x40 | 6 | #define PIT_CH0 0x40 |
7 | #define PIT_CH2 0x42 | 7 | #define PIT_CH2 0x42 |
8 | 8 | ||
9 | extern spinlock_t i8253_lock; | 9 | extern raw_spinlock_t i8253_lock; |
10 | 10 | ||
11 | extern struct clock_event_device *global_clock_event; | 11 | extern struct clock_event_device *global_clock_event; |
12 | 12 | ||
diff --git a/arch/x86/include/asm/io_apic.h b/arch/x86/include/asm/io_apic.h index 35832a03a515..63cb4096c3dc 100644 --- a/arch/x86/include/asm/io_apic.h +++ b/arch/x86/include/asm/io_apic.h | |||
@@ -159,7 +159,6 @@ struct io_apic_irq_attr; | |||
159 | extern int io_apic_set_pci_routing(struct device *dev, int irq, | 159 | extern int io_apic_set_pci_routing(struct device *dev, int irq, |
160 | struct io_apic_irq_attr *irq_attr); | 160 | struct io_apic_irq_attr *irq_attr); |
161 | void setup_IO_APIC_irq_extra(u32 gsi); | 161 | void setup_IO_APIC_irq_extra(u32 gsi); |
162 | extern int (*ioapic_renumber_irq)(int ioapic, int irq); | ||
163 | extern void ioapic_init_mappings(void); | 162 | extern void ioapic_init_mappings(void); |
164 | extern void ioapic_insert_resources(void); | 163 | extern void ioapic_insert_resources(void); |
165 | 164 | ||
@@ -180,12 +179,13 @@ extern void ioapic_write_entry(int apic, int pin, | |||
180 | extern void setup_ioapic_ids_from_mpc(void); | 179 | extern void setup_ioapic_ids_from_mpc(void); |
181 | 180 | ||
182 | struct mp_ioapic_gsi{ | 181 | struct mp_ioapic_gsi{ |
183 | int gsi_base; | 182 | u32 gsi_base; |
184 | int gsi_end; | 183 | u32 gsi_end; |
185 | }; | 184 | }; |
186 | extern struct mp_ioapic_gsi mp_gsi_routing[]; | 185 | extern struct mp_ioapic_gsi mp_gsi_routing[]; |
187 | int mp_find_ioapic(int gsi); | 186 | extern u32 gsi_end; |
188 | int mp_find_ioapic_pin(int ioapic, int gsi); | 187 | int mp_find_ioapic(u32 gsi); |
188 | int mp_find_ioapic_pin(int ioapic, u32 gsi); | ||
189 | void __init mp_register_ioapic(int id, u32 address, u32 gsi_base); | 189 | void __init mp_register_ioapic(int id, u32 address, u32 gsi_base); |
190 | extern void __init pre_init_apic_IRQ0(void); | 190 | extern void __init pre_init_apic_IRQ0(void); |
191 | 191 | ||
@@ -197,7 +197,8 @@ static const int timer_through_8259 = 0; | |||
197 | static inline void ioapic_init_mappings(void) { } | 197 | static inline void ioapic_init_mappings(void) { } |
198 | static inline void ioapic_insert_resources(void) { } | 198 | static inline void ioapic_insert_resources(void) { } |
199 | static inline void probe_nr_irqs_gsi(void) { } | 199 | static inline void probe_nr_irqs_gsi(void) { } |
200 | static inline int mp_find_ioapic(int gsi) { return 0; } | 200 | #define gsi_end (NR_IRQS_LEGACY - 1) |
201 | static inline int mp_find_ioapic(u32 gsi) { return 0; } | ||
201 | 202 | ||
202 | struct io_apic_irq_attr; | 203 | struct io_apic_irq_attr; |
203 | static inline int io_apic_set_pci_routing(struct device *dev, int irq, | 204 | static inline int io_apic_set_pci_routing(struct device *dev, int irq, |
diff --git a/arch/x86/include/asm/k8.h b/arch/x86/include/asm/k8.h index f70e60071fe8..af00bd1d2089 100644 --- a/arch/x86/include/asm/k8.h +++ b/arch/x86/include/asm/k8.h | |||
@@ -16,11 +16,16 @@ extern int k8_numa_init(unsigned long start_pfn, unsigned long end_pfn); | |||
16 | extern int k8_scan_nodes(void); | 16 | extern int k8_scan_nodes(void); |
17 | 17 | ||
18 | #ifdef CONFIG_K8_NB | 18 | #ifdef CONFIG_K8_NB |
19 | extern int num_k8_northbridges; | ||
20 | |||
19 | static inline struct pci_dev *node_to_k8_nb_misc(int node) | 21 | static inline struct pci_dev *node_to_k8_nb_misc(int node) |
20 | { | 22 | { |
21 | return (node < num_k8_northbridges) ? k8_northbridges[node] : NULL; | 23 | return (node < num_k8_northbridges) ? k8_northbridges[node] : NULL; |
22 | } | 24 | } |
25 | |||
23 | #else | 26 | #else |
27 | #define num_k8_northbridges 0 | ||
28 | |||
24 | static inline struct pci_dev *node_to_k8_nb_misc(int node) | 29 | static inline struct pci_dev *node_to_k8_nb_misc(int node) |
25 | { | 30 | { |
26 | return NULL; | 31 | return NULL; |
diff --git a/arch/x86/include/asm/mpspec.h b/arch/x86/include/asm/mpspec.h index d8bf23a88d05..c82868e9f905 100644 --- a/arch/x86/include/asm/mpspec.h +++ b/arch/x86/include/asm/mpspec.h | |||
@@ -105,16 +105,6 @@ extern void mp_config_acpi_legacy_irqs(void); | |||
105 | struct device; | 105 | struct device; |
106 | extern int mp_register_gsi(struct device *dev, u32 gsi, int edge_level, | 106 | extern int mp_register_gsi(struct device *dev, u32 gsi, int edge_level, |
107 | int active_high_low); | 107 | int active_high_low); |
108 | extern int acpi_probe_gsi(void); | ||
109 | #ifdef CONFIG_X86_IO_APIC | ||
110 | extern int mp_find_ioapic(int gsi); | ||
111 | extern int mp_find_ioapic_pin(int ioapic, int gsi); | ||
112 | #endif | ||
113 | #else /* !CONFIG_ACPI: */ | ||
114 | static inline int acpi_probe_gsi(void) | ||
115 | { | ||
116 | return 0; | ||
117 | } | ||
118 | #endif /* CONFIG_ACPI */ | 108 | #endif /* CONFIG_ACPI */ |
119 | 109 | ||
120 | #define PHYSID_ARRAY_SIZE BITS_TO_LONGS(MAX_APICS) | 110 | #define PHYSID_ARRAY_SIZE BITS_TO_LONGS(MAX_APICS) |
diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h new file mode 100644 index 000000000000..79ce5685ab64 --- /dev/null +++ b/arch/x86/include/asm/mshyperv.h | |||
@@ -0,0 +1,14 @@ | |||
1 | #ifndef _ASM_X86_MSHYPER_H | ||
2 | #define _ASM_X86_MSHYPER_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <asm/hyperv.h> | ||
6 | |||
7 | struct ms_hyperv_info { | ||
8 | u32 features; | ||
9 | u32 hints; | ||
10 | }; | ||
11 | |||
12 | extern struct ms_hyperv_info ms_hyperv; | ||
13 | |||
14 | #endif | ||
diff --git a/arch/x86/include/asm/percpu.h b/arch/x86/include/asm/percpu.h index 66a272dfd8b8..0ec6d12d84e6 100644 --- a/arch/x86/include/asm/percpu.h +++ b/arch/x86/include/asm/percpu.h | |||
@@ -190,6 +190,29 @@ do { \ | |||
190 | pfo_ret__; \ | 190 | pfo_ret__; \ |
191 | }) | 191 | }) |
192 | 192 | ||
193 | #define percpu_unary_op(op, var) \ | ||
194 | ({ \ | ||
195 | switch (sizeof(var)) { \ | ||
196 | case 1: \ | ||
197 | asm(op "b "__percpu_arg(0) \ | ||
198 | : "+m" (var)); \ | ||
199 | break; \ | ||
200 | case 2: \ | ||
201 | asm(op "w "__percpu_arg(0) \ | ||
202 | : "+m" (var)); \ | ||
203 | break; \ | ||
204 | case 4: \ | ||
205 | asm(op "l "__percpu_arg(0) \ | ||
206 | : "+m" (var)); \ | ||
207 | break; \ | ||
208 | case 8: \ | ||
209 | asm(op "q "__percpu_arg(0) \ | ||
210 | : "+m" (var)); \ | ||
211 | break; \ | ||
212 | default: __bad_percpu_size(); \ | ||
213 | } \ | ||
214 | }) | ||
215 | |||
193 | /* | 216 | /* |
194 | * percpu_read() makes gcc load the percpu variable every time it is | 217 | * percpu_read() makes gcc load the percpu variable every time it is |
195 | * accessed while percpu_read_stable() allows the value to be cached. | 218 | * accessed while percpu_read_stable() allows the value to be cached. |
@@ -207,6 +230,7 @@ do { \ | |||
207 | #define percpu_and(var, val) percpu_to_op("and", var, val) | 230 | #define percpu_and(var, val) percpu_to_op("and", var, val) |
208 | #define percpu_or(var, val) percpu_to_op("or", var, val) | 231 | #define percpu_or(var, val) percpu_to_op("or", var, val) |
209 | #define percpu_xor(var, val) percpu_to_op("xor", var, val) | 232 | #define percpu_xor(var, val) percpu_to_op("xor", var, val) |
233 | #define percpu_inc(var) percpu_unary_op("inc", var) | ||
210 | 234 | ||
211 | #define __this_cpu_read_1(pcp) percpu_from_op("mov", (pcp), "m"(pcp)) | 235 | #define __this_cpu_read_1(pcp) percpu_from_op("mov", (pcp), "m"(pcp)) |
212 | #define __this_cpu_read_2(pcp) percpu_from_op("mov", (pcp), "m"(pcp)) | 236 | #define __this_cpu_read_2(pcp) percpu_from_op("mov", (pcp), "m"(pcp)) |
diff --git a/arch/x86/include/asm/perf_event_p4.h b/arch/x86/include/asm/perf_event_p4.h index b05400a542ff..64a8ebff06fc 100644 --- a/arch/x86/include/asm/perf_event_p4.h +++ b/arch/x86/include/asm/perf_event_p4.h | |||
@@ -89,7 +89,8 @@ | |||
89 | P4_CCCR_ENABLE) | 89 | P4_CCCR_ENABLE) |
90 | 90 | ||
91 | /* HT mask */ | 91 | /* HT mask */ |
92 | #define P4_CCCR_MASK_HT (P4_CCCR_MASK | P4_CCCR_THREAD_ANY) | 92 | #define P4_CCCR_MASK_HT \ |
93 | (P4_CCCR_MASK | P4_CCCR_OVF_PMI_T1 | P4_CCCR_THREAD_ANY) | ||
93 | 94 | ||
94 | #define P4_GEN_ESCR_EMASK(class, name, bit) \ | 95 | #define P4_GEN_ESCR_EMASK(class, name, bit) \ |
95 | class##__##name = ((1 << bit) << P4_ESCR_EVENTMASK_SHIFT) | 96 | class##__##name = ((1 << bit) << P4_ESCR_EVENTMASK_SHIFT) |
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index 32428b410b55..5a51379dcbe4 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h | |||
@@ -113,7 +113,6 @@ struct cpuinfo_x86 { | |||
113 | /* Index into per_cpu list: */ | 113 | /* Index into per_cpu list: */ |
114 | u16 cpu_index; | 114 | u16 cpu_index; |
115 | #endif | 115 | #endif |
116 | unsigned int x86_hyper_vendor; | ||
117 | } __attribute__((__aligned__(SMP_CACHE_BYTES))); | 116 | } __attribute__((__aligned__(SMP_CACHE_BYTES))); |
118 | 117 | ||
119 | #define X86_VENDOR_INTEL 0 | 118 | #define X86_VENDOR_INTEL 0 |
@@ -127,9 +126,6 @@ struct cpuinfo_x86 { | |||
127 | 126 | ||
128 | #define X86_VENDOR_UNKNOWN 0xff | 127 | #define X86_VENDOR_UNKNOWN 0xff |
129 | 128 | ||
130 | #define X86_HYPER_VENDOR_NONE 0 | ||
131 | #define X86_HYPER_VENDOR_VMWARE 1 | ||
132 | |||
133 | /* | 129 | /* |
134 | * capabilities of CPUs | 130 | * capabilities of CPUs |
135 | */ | 131 | */ |
@@ -380,6 +376,10 @@ union thread_xstate { | |||
380 | struct xsave_struct xsave; | 376 | struct xsave_struct xsave; |
381 | }; | 377 | }; |
382 | 378 | ||
379 | struct fpu { | ||
380 | union thread_xstate *state; | ||
381 | }; | ||
382 | |||
383 | #ifdef CONFIG_X86_64 | 383 | #ifdef CONFIG_X86_64 |
384 | DECLARE_PER_CPU(struct orig_ist, orig_ist); | 384 | DECLARE_PER_CPU(struct orig_ist, orig_ist); |
385 | 385 | ||
@@ -457,7 +457,7 @@ struct thread_struct { | |||
457 | unsigned long trap_no; | 457 | unsigned long trap_no; |
458 | unsigned long error_code; | 458 | unsigned long error_code; |
459 | /* floating point and extended processor state */ | 459 | /* floating point and extended processor state */ |
460 | union thread_xstate *xstate; | 460 | struct fpu fpu; |
461 | #ifdef CONFIG_X86_32 | 461 | #ifdef CONFIG_X86_32 |
462 | /* Virtual 86 mode info */ | 462 | /* Virtual 86 mode info */ |
463 | struct vm86_struct __user *vm86_info; | 463 | struct vm86_struct __user *vm86_info; |
diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h index d017ed5502e2..d4092fac226b 100644 --- a/arch/x86/include/asm/thread_info.h +++ b/arch/x86/include/asm/thread_info.h | |||
@@ -242,7 +242,6 @@ static inline struct thread_info *current_thread_info(void) | |||
242 | #define TS_POLLING 0x0004 /* true if in idle loop | 242 | #define TS_POLLING 0x0004 /* true if in idle loop |
243 | and not sleeping */ | 243 | and not sleeping */ |
244 | #define TS_RESTORE_SIGMASK 0x0008 /* restore signal mask in do_signal() */ | 244 | #define TS_RESTORE_SIGMASK 0x0008 /* restore signal mask in do_signal() */ |
245 | #define TS_XSAVE 0x0010 /* Use xsave/xrstor */ | ||
246 | 245 | ||
247 | #define tsk_is_polling(t) (task_thread_info(t)->status & TS_POLLING) | 246 | #define tsk_is_polling(t) (task_thread_info(t)->status & TS_POLLING) |
248 | 247 | ||
diff --git a/arch/x86/include/asm/traps.h b/arch/x86/include/asm/traps.h index 4da91ad69e0d..f66cda56781d 100644 --- a/arch/x86/include/asm/traps.h +++ b/arch/x86/include/asm/traps.h | |||
@@ -79,7 +79,7 @@ static inline int get_si_code(unsigned long condition) | |||
79 | 79 | ||
80 | extern int panic_on_unrecovered_nmi; | 80 | extern int panic_on_unrecovered_nmi; |
81 | 81 | ||
82 | void math_error(void __user *); | 82 | void math_error(struct pt_regs *, int, int); |
83 | void math_emulate(struct math_emu_info *); | 83 | void math_emulate(struct math_emu_info *); |
84 | #ifndef CONFIG_X86_32 | 84 | #ifndef CONFIG_X86_32 |
85 | asmlinkage void smp_thermal_interrupt(void); | 85 | asmlinkage void smp_thermal_interrupt(void); |
diff --git a/arch/x86/include/asm/uv/uv_bau.h b/arch/x86/include/asm/uv/uv_bau.h index b414d2b401f6..aa558ac0306e 100644 --- a/arch/x86/include/asm/uv/uv_bau.h +++ b/arch/x86/include/asm/uv/uv_bau.h | |||
@@ -27,13 +27,14 @@ | |||
27 | * set 2 is at BASE + 2*512, set 3 at BASE + 3*512, and so on. | 27 | * set 2 is at BASE + 2*512, set 3 at BASE + 3*512, and so on. |
28 | * | 28 | * |
29 | * We will use 31 sets, one for sending BAU messages from each of the 32 | 29 | * We will use 31 sets, one for sending BAU messages from each of the 32 |
30 | * cpu's on the node. | 30 | * cpu's on the uvhub. |
31 | * | 31 | * |
32 | * TLB shootdown will use the first of the 8 descriptors of each set. | 32 | * TLB shootdown will use the first of the 8 descriptors of each set. |
33 | * Each of the descriptors is 64 bytes in size (8*64 = 512 bytes in a set). | 33 | * Each of the descriptors is 64 bytes in size (8*64 = 512 bytes in a set). |
34 | */ | 34 | */ |
35 | 35 | ||
36 | #define UV_ITEMS_PER_DESCRIPTOR 8 | 36 | #define UV_ITEMS_PER_DESCRIPTOR 8 |
37 | #define MAX_BAU_CONCURRENT 3 | ||
37 | #define UV_CPUS_PER_ACT_STATUS 32 | 38 | #define UV_CPUS_PER_ACT_STATUS 32 |
38 | #define UV_ACT_STATUS_MASK 0x3 | 39 | #define UV_ACT_STATUS_MASK 0x3 |
39 | #define UV_ACT_STATUS_SIZE 2 | 40 | #define UV_ACT_STATUS_SIZE 2 |
@@ -45,6 +46,9 @@ | |||
45 | #define UV_PAYLOADQ_PNODE_SHIFT 49 | 46 | #define UV_PAYLOADQ_PNODE_SHIFT 49 |
46 | #define UV_PTC_BASENAME "sgi_uv/ptc_statistics" | 47 | #define UV_PTC_BASENAME "sgi_uv/ptc_statistics" |
47 | #define uv_physnodeaddr(x) ((__pa((unsigned long)(x)) & uv_mmask)) | 48 | #define uv_physnodeaddr(x) ((__pa((unsigned long)(x)) & uv_mmask)) |
49 | #define UV_ENABLE_INTD_SOFT_ACK_MODE_SHIFT 15 | ||
50 | #define UV_INTD_SOFT_ACK_TIMEOUT_PERIOD_SHIFT 16 | ||
51 | #define UV_INTD_SOFT_ACK_TIMEOUT_PERIOD 0x000000000bUL | ||
48 | 52 | ||
49 | /* | 53 | /* |
50 | * bits in UVH_LB_BAU_SB_ACTIVATION_STATUS_0/1 | 54 | * bits in UVH_LB_BAU_SB_ACTIVATION_STATUS_0/1 |
@@ -55,15 +59,29 @@ | |||
55 | #define DESC_STATUS_SOURCE_TIMEOUT 3 | 59 | #define DESC_STATUS_SOURCE_TIMEOUT 3 |
56 | 60 | ||
57 | /* | 61 | /* |
58 | * source side thresholds at which message retries print a warning | 62 | * source side threshholds at which message retries print a warning |
59 | */ | 63 | */ |
60 | #define SOURCE_TIMEOUT_LIMIT 20 | 64 | #define SOURCE_TIMEOUT_LIMIT 20 |
61 | #define DESTINATION_TIMEOUT_LIMIT 20 | 65 | #define DESTINATION_TIMEOUT_LIMIT 20 |
62 | 66 | ||
63 | /* | 67 | /* |
68 | * misc. delays, in microseconds | ||
69 | */ | ||
70 | #define THROTTLE_DELAY 10 | ||
71 | #define TIMEOUT_DELAY 10 | ||
72 | #define BIOS_TO 1000 | ||
73 | /* BIOS is assumed to set the destination timeout to 1003520 nanoseconds */ | ||
74 | |||
75 | /* | ||
76 | * threshholds at which to use IPI to free resources | ||
77 | */ | ||
78 | #define PLUGSB4RESET 100 | ||
79 | #define TIMEOUTSB4RESET 100 | ||
80 | |||
81 | /* | ||
64 | * number of entries in the destination side payload queue | 82 | * number of entries in the destination side payload queue |
65 | */ | 83 | */ |
66 | #define DEST_Q_SIZE 17 | 84 | #define DEST_Q_SIZE 20 |
67 | /* | 85 | /* |
68 | * number of destination side software ack resources | 86 | * number of destination side software ack resources |
69 | */ | 87 | */ |
@@ -72,9 +90,10 @@ | |||
72 | /* | 90 | /* |
73 | * completion statuses for sending a TLB flush message | 91 | * completion statuses for sending a TLB flush message |
74 | */ | 92 | */ |
75 | #define FLUSH_RETRY 1 | 93 | #define FLUSH_RETRY_PLUGGED 1 |
76 | #define FLUSH_GIVEUP 2 | 94 | #define FLUSH_RETRY_TIMEOUT 2 |
77 | #define FLUSH_COMPLETE 3 | 95 | #define FLUSH_GIVEUP 3 |
96 | #define FLUSH_COMPLETE 4 | ||
78 | 97 | ||
79 | /* | 98 | /* |
80 | * Distribution: 32 bytes (256 bits) (bytes 0-0x1f of descriptor) | 99 | * Distribution: 32 bytes (256 bits) (bytes 0-0x1f of descriptor) |
@@ -86,14 +105,14 @@ | |||
86 | * 'base_dest_nodeid' field of the header corresponds to the | 105 | * 'base_dest_nodeid' field of the header corresponds to the |
87 | * destination nodeID associated with that specified bit. | 106 | * destination nodeID associated with that specified bit. |
88 | */ | 107 | */ |
89 | struct bau_target_nodemask { | 108 | struct bau_target_uvhubmask { |
90 | unsigned long bits[BITS_TO_LONGS(256)]; | 109 | unsigned long bits[BITS_TO_LONGS(UV_DISTRIBUTION_SIZE)]; |
91 | }; | 110 | }; |
92 | 111 | ||
93 | /* | 112 | /* |
94 | * mask of cpu's on a node | 113 | * mask of cpu's on a uvhub |
95 | * (during initialization we need to check that unsigned long has | 114 | * (during initialization we need to check that unsigned long has |
96 | * enough bits for max. cpu's per node) | 115 | * enough bits for max. cpu's per uvhub) |
97 | */ | 116 | */ |
98 | struct bau_local_cpumask { | 117 | struct bau_local_cpumask { |
99 | unsigned long bits; | 118 | unsigned long bits; |
@@ -135,8 +154,8 @@ struct bau_msg_payload { | |||
135 | struct bau_msg_header { | 154 | struct bau_msg_header { |
136 | unsigned int dest_subnodeid:6; /* must be 0x10, for the LB */ | 155 | unsigned int dest_subnodeid:6; /* must be 0x10, for the LB */ |
137 | /* bits 5:0 */ | 156 | /* bits 5:0 */ |
138 | unsigned int base_dest_nodeid:15; /* nasid>>1 (pnode) of */ | 157 | unsigned int base_dest_nodeid:15; /* nasid (pnode<<1) of */ |
139 | /* bits 20:6 */ /* first bit in node_map */ | 158 | /* bits 20:6 */ /* first bit in uvhub map */ |
140 | unsigned int command:8; /* message type */ | 159 | unsigned int command:8; /* message type */ |
141 | /* bits 28:21 */ | 160 | /* bits 28:21 */ |
142 | /* 0x38: SN3net EndPoint Message */ | 161 | /* 0x38: SN3net EndPoint Message */ |
@@ -146,26 +165,38 @@ struct bau_msg_header { | |||
146 | unsigned int rsvd_2:9; /* must be zero */ | 165 | unsigned int rsvd_2:9; /* must be zero */ |
147 | /* bits 40:32 */ | 166 | /* bits 40:32 */ |
148 | /* Suppl_A is 56-41 */ | 167 | /* Suppl_A is 56-41 */ |
149 | unsigned int payload_2a:8;/* becomes byte 16 of msg */ | 168 | unsigned int sequence:16;/* message sequence number */ |
150 | /* bits 48:41 */ /* not currently using */ | 169 | /* bits 56:41 */ /* becomes bytes 16-17 of msg */ |
151 | unsigned int payload_2b:8;/* becomes byte 17 of msg */ | ||
152 | /* bits 56:49 */ /* not currently using */ | ||
153 | /* Address field (96:57) is never used as an | 170 | /* Address field (96:57) is never used as an |
154 | address (these are address bits 42:3) */ | 171 | address (these are address bits 42:3) */ |
172 | |||
155 | unsigned int rsvd_3:1; /* must be zero */ | 173 | unsigned int rsvd_3:1; /* must be zero */ |
156 | /* bit 57 */ | 174 | /* bit 57 */ |
157 | /* address bits 27:4 are payload */ | 175 | /* address bits 27:4 are payload */ |
158 | /* these 24 bits become bytes 12-14 of msg */ | 176 | /* these next 24 (58-81) bits become bytes 12-14 of msg */ |
177 | |||
178 | /* bits 65:58 land in byte 12 */ | ||
159 | unsigned int replied_to:1;/* sent as 0 by the source to byte 12 */ | 179 | unsigned int replied_to:1;/* sent as 0 by the source to byte 12 */ |
160 | /* bit 58 */ | 180 | /* bit 58 */ |
161 | 181 | unsigned int msg_type:3; /* software type of the message*/ | |
162 | unsigned int payload_1a:5;/* not currently used */ | 182 | /* bits 61:59 */ |
163 | /* bits 63:59 */ | 183 | unsigned int canceled:1; /* message canceled, resource to be freed*/ |
164 | unsigned int payload_1b:8;/* not currently used */ | 184 | /* bit 62 */ |
165 | /* bits 71:64 */ | 185 | unsigned int payload_1a:1;/* not currently used */ |
166 | unsigned int payload_1c:8;/* not currently used */ | 186 | /* bit 63 */ |
167 | /* bits 79:72 */ | 187 | unsigned int payload_1b:2;/* not currently used */ |
168 | unsigned int payload_1d:2;/* not currently used */ | 188 | /* bits 65:64 */ |
189 | |||
190 | /* bits 73:66 land in byte 13 */ | ||
191 | unsigned int payload_1ca:6;/* not currently used */ | ||
192 | /* bits 71:66 */ | ||
193 | unsigned int payload_1c:2;/* not currently used */ | ||
194 | /* bits 73:72 */ | ||
195 | |||
196 | /* bits 81:74 land in byte 14 */ | ||
197 | unsigned int payload_1d:6;/* not currently used */ | ||
198 | /* bits 79:74 */ | ||
199 | unsigned int payload_1e:2;/* not currently used */ | ||
169 | /* bits 81:80 */ | 200 | /* bits 81:80 */ |
170 | 201 | ||
171 | unsigned int rsvd_4:7; /* must be zero */ | 202 | unsigned int rsvd_4:7; /* must be zero */ |
@@ -178,7 +209,7 @@ struct bau_msg_header { | |||
178 | /* bits 95:90 */ | 209 | /* bits 95:90 */ |
179 | unsigned int rsvd_6:5; /* must be zero */ | 210 | unsigned int rsvd_6:5; /* must be zero */ |
180 | /* bits 100:96 */ | 211 | /* bits 100:96 */ |
181 | unsigned int int_both:1;/* if 1, interrupt both sockets on the blade */ | 212 | unsigned int int_both:1;/* if 1, interrupt both sockets on the uvhub */ |
182 | /* bit 101*/ | 213 | /* bit 101*/ |
183 | unsigned int fairness:3;/* usually zero */ | 214 | unsigned int fairness:3;/* usually zero */ |
184 | /* bits 104:102 */ | 215 | /* bits 104:102 */ |
@@ -191,13 +222,18 @@ struct bau_msg_header { | |||
191 | /* bits 127:107 */ | 222 | /* bits 127:107 */ |
192 | }; | 223 | }; |
193 | 224 | ||
225 | /* see msg_type: */ | ||
226 | #define MSG_NOOP 0 | ||
227 | #define MSG_REGULAR 1 | ||
228 | #define MSG_RETRY 2 | ||
229 | |||
194 | /* | 230 | /* |
195 | * The activation descriptor: | 231 | * The activation descriptor: |
196 | * The format of the message to send, plus all accompanying control | 232 | * The format of the message to send, plus all accompanying control |
197 | * Should be 64 bytes | 233 | * Should be 64 bytes |
198 | */ | 234 | */ |
199 | struct bau_desc { | 235 | struct bau_desc { |
200 | struct bau_target_nodemask distribution; | 236 | struct bau_target_uvhubmask distribution; |
201 | /* | 237 | /* |
202 | * message template, consisting of header and payload: | 238 | * message template, consisting of header and payload: |
203 | */ | 239 | */ |
@@ -237,19 +273,25 @@ struct bau_payload_queue_entry { | |||
237 | unsigned short acknowledge_count; /* filled in by destination */ | 273 | unsigned short acknowledge_count; /* filled in by destination */ |
238 | /* 16 bits, bytes 10-11 */ | 274 | /* 16 bits, bytes 10-11 */ |
239 | 275 | ||
240 | unsigned short replied_to:1; /* sent as 0 by the source */ | 276 | /* these next 3 bytes come from bits 58-81 of the message header */ |
241 | /* 1 bit */ | 277 | unsigned short replied_to:1; /* sent as 0 by the source */ |
242 | unsigned short unused1:7; /* not currently using */ | 278 | unsigned short msg_type:3; /* software message type */ |
243 | /* 7 bits: byte 12) */ | 279 | unsigned short canceled:1; /* sent as 0 by the source */ |
280 | unsigned short unused1:3; /* not currently using */ | ||
281 | /* byte 12 */ | ||
244 | 282 | ||
245 | unsigned char unused2[2]; /* not currently using */ | 283 | unsigned char unused2a; /* not currently using */ |
246 | /* bytes 13-14 */ | 284 | /* byte 13 */ |
285 | unsigned char unused2; /* not currently using */ | ||
286 | /* byte 14 */ | ||
247 | 287 | ||
248 | unsigned char sw_ack_vector; /* filled in by the hardware */ | 288 | unsigned char sw_ack_vector; /* filled in by the hardware */ |
249 | /* byte 15 (bits 127:120) */ | 289 | /* byte 15 (bits 127:120) */ |
250 | 290 | ||
251 | unsigned char unused4[3]; /* not currently using bytes 17-19 */ | 291 | unsigned short sequence; /* message sequence number */ |
252 | /* bytes 17-19 */ | 292 | /* bytes 16-17 */ |
293 | unsigned char unused4[2]; /* not currently using bytes 18-19 */ | ||
294 | /* bytes 18-19 */ | ||
253 | 295 | ||
254 | int number_of_cpus; /* filled in at destination */ | 296 | int number_of_cpus; /* filled in at destination */ |
255 | /* 32 bits, bytes 20-23 (aligned) */ | 297 | /* 32 bits, bytes 20-23 (aligned) */ |
@@ -259,63 +301,93 @@ struct bau_payload_queue_entry { | |||
259 | }; | 301 | }; |
260 | 302 | ||
261 | /* | 303 | /* |
262 | * one for every slot in the destination payload queue | 304 | * one per-cpu; to locate the software tables |
263 | */ | ||
264 | struct bau_msg_status { | ||
265 | struct bau_local_cpumask seen_by; /* map of cpu's */ | ||
266 | }; | ||
267 | |||
268 | /* | ||
269 | * one for every slot in the destination software ack resources | ||
270 | */ | ||
271 | struct bau_sw_ack_status { | ||
272 | struct bau_payload_queue_entry *msg; /* associated message */ | ||
273 | int watcher; /* cpu monitoring, or -1 */ | ||
274 | }; | ||
275 | |||
276 | /* | ||
277 | * one on every node and per-cpu; to locate the software tables | ||
278 | */ | 305 | */ |
279 | struct bau_control { | 306 | struct bau_control { |
280 | struct bau_desc *descriptor_base; | 307 | struct bau_desc *descriptor_base; |
281 | struct bau_payload_queue_entry *bau_msg_head; | ||
282 | struct bau_payload_queue_entry *va_queue_first; | 308 | struct bau_payload_queue_entry *va_queue_first; |
283 | struct bau_payload_queue_entry *va_queue_last; | 309 | struct bau_payload_queue_entry *va_queue_last; |
284 | struct bau_msg_status *msg_statuses; | 310 | struct bau_payload_queue_entry *bau_msg_head; |
285 | int *watching; /* pointer to array */ | 311 | struct bau_control *uvhub_master; |
312 | struct bau_control *socket_master; | ||
313 | unsigned long timeout_interval; | ||
314 | atomic_t active_descriptor_count; | ||
315 | int max_concurrent; | ||
316 | int max_concurrent_constant; | ||
317 | int retry_message_scans; | ||
318 | int plugged_tries; | ||
319 | int timeout_tries; | ||
320 | int ipi_attempts; | ||
321 | int conseccompletes; | ||
322 | short cpu; | ||
323 | short uvhub_cpu; | ||
324 | short uvhub; | ||
325 | short cpus_in_socket; | ||
326 | short cpus_in_uvhub; | ||
327 | unsigned short message_number; | ||
328 | unsigned short uvhub_quiesce; | ||
329 | short socket_acknowledge_count[DEST_Q_SIZE]; | ||
330 | cycles_t send_message; | ||
331 | spinlock_t masks_lock; | ||
332 | spinlock_t uvhub_lock; | ||
333 | spinlock_t queue_lock; | ||
286 | }; | 334 | }; |
287 | 335 | ||
288 | /* | 336 | /* |
289 | * This structure is allocated per_cpu for UV TLB shootdown statistics. | 337 | * This structure is allocated per_cpu for UV TLB shootdown statistics. |
290 | */ | 338 | */ |
291 | struct ptc_stats { | 339 | struct ptc_stats { |
292 | unsigned long ptc_i; /* number of IPI-style flushes */ | 340 | /* sender statistics */ |
293 | unsigned long requestor; /* number of nodes this cpu sent to */ | 341 | unsigned long s_giveup; /* number of fall backs to IPI-style flushes */ |
294 | unsigned long requestee; /* times cpu was remotely requested */ | 342 | unsigned long s_requestor; /* number of shootdown requests */ |
295 | unsigned long alltlb; /* times all tlb's on this cpu were flushed */ | 343 | unsigned long s_stimeout; /* source side timeouts */ |
296 | unsigned long onetlb; /* times just one tlb on this cpu was flushed */ | 344 | unsigned long s_dtimeout; /* destination side timeouts */ |
297 | unsigned long s_retry; /* retries on source side timeouts */ | 345 | unsigned long s_time; /* time spent in sending side */ |
298 | unsigned long d_retry; /* retries on destination side timeouts */ | 346 | unsigned long s_retriesok; /* successful retries */ |
299 | unsigned long sflush; /* cycles spent in uv_flush_tlb_others */ | 347 | unsigned long s_ntargcpu; /* number of cpus targeted */ |
300 | unsigned long dflush; /* cycles spent on destination side */ | 348 | unsigned long s_ntarguvhub; /* number of uvhubs targeted */ |
301 | unsigned long retriesok; /* successes on retries */ | 349 | unsigned long s_ntarguvhub16; /* number of times >= 16 target hubs */ |
302 | unsigned long nomsg; /* interrupts with no message */ | 350 | unsigned long s_ntarguvhub8; /* number of times >= 8 target hubs */ |
303 | unsigned long multmsg; /* interrupts with multiple messages */ | 351 | unsigned long s_ntarguvhub4; /* number of times >= 4 target hubs */ |
304 | unsigned long ntargeted;/* nodes targeted */ | 352 | unsigned long s_ntarguvhub2; /* number of times >= 2 target hubs */ |
353 | unsigned long s_ntarguvhub1; /* number of times == 1 target hub */ | ||
354 | unsigned long s_resets_plug; /* ipi-style resets from plug state */ | ||
355 | unsigned long s_resets_timeout; /* ipi-style resets from timeouts */ | ||
356 | unsigned long s_busy; /* status stayed busy past s/w timer */ | ||
357 | unsigned long s_throttles; /* waits in throttle */ | ||
358 | unsigned long s_retry_messages; /* retry broadcasts */ | ||
359 | /* destination statistics */ | ||
360 | unsigned long d_alltlb; /* times all tlb's on this cpu were flushed */ | ||
361 | unsigned long d_onetlb; /* times just one tlb on this cpu was flushed */ | ||
362 | unsigned long d_multmsg; /* interrupts with multiple messages */ | ||
363 | unsigned long d_nomsg; /* interrupts with no message */ | ||
364 | unsigned long d_time; /* time spent on destination side */ | ||
365 | unsigned long d_requestee; /* number of messages processed */ | ||
366 | unsigned long d_retries; /* number of retry messages processed */ | ||
367 | unsigned long d_canceled; /* number of messages canceled by retries */ | ||
368 | unsigned long d_nocanceled; /* retries that found nothing to cancel */ | ||
369 | unsigned long d_resets; /* number of ipi-style requests processed */ | ||
370 | unsigned long d_rcanceled; /* number of messages canceled by resets */ | ||
305 | }; | 371 | }; |
306 | 372 | ||
307 | static inline int bau_node_isset(int node, struct bau_target_nodemask *dstp) | 373 | static inline int bau_uvhub_isset(int uvhub, struct bau_target_uvhubmask *dstp) |
308 | { | 374 | { |
309 | return constant_test_bit(node, &dstp->bits[0]); | 375 | return constant_test_bit(uvhub, &dstp->bits[0]); |
310 | } | 376 | } |
311 | static inline void bau_node_set(int node, struct bau_target_nodemask *dstp) | 377 | static inline void bau_uvhub_set(int uvhub, struct bau_target_uvhubmask *dstp) |
312 | { | 378 | { |
313 | __set_bit(node, &dstp->bits[0]); | 379 | __set_bit(uvhub, &dstp->bits[0]); |
314 | } | 380 | } |
315 | static inline void bau_nodes_clear(struct bau_target_nodemask *dstp, int nbits) | 381 | static inline void bau_uvhubs_clear(struct bau_target_uvhubmask *dstp, |
382 | int nbits) | ||
316 | { | 383 | { |
317 | bitmap_zero(&dstp->bits[0], nbits); | 384 | bitmap_zero(&dstp->bits[0], nbits); |
318 | } | 385 | } |
386 | static inline int bau_uvhub_weight(struct bau_target_uvhubmask *dstp) | ||
387 | { | ||
388 | return bitmap_weight((unsigned long *)&dstp->bits[0], | ||
389 | UV_DISTRIBUTION_SIZE); | ||
390 | } | ||
319 | 391 | ||
320 | static inline void bau_cpubits_clear(struct bau_local_cpumask *dstp, int nbits) | 392 | static inline void bau_cpubits_clear(struct bau_local_cpumask *dstp, int nbits) |
321 | { | 393 | { |
@@ -328,4 +400,35 @@ static inline void bau_cpubits_clear(struct bau_local_cpumask *dstp, int nbits) | |||
328 | extern void uv_bau_message_intr1(void); | 400 | extern void uv_bau_message_intr1(void); |
329 | extern void uv_bau_timeout_intr1(void); | 401 | extern void uv_bau_timeout_intr1(void); |
330 | 402 | ||
403 | struct atomic_short { | ||
404 | short counter; | ||
405 | }; | ||
406 | |||
407 | /** | ||
408 | * atomic_read_short - read a short atomic variable | ||
409 | * @v: pointer of type atomic_short | ||
410 | * | ||
411 | * Atomically reads the value of @v. | ||
412 | */ | ||
413 | static inline int atomic_read_short(const struct atomic_short *v) | ||
414 | { | ||
415 | return v->counter; | ||
416 | } | ||
417 | |||
418 | /** | ||
419 | * atomic_add_short_return - add and return a short int | ||
420 | * @i: short value to add | ||
421 | * @v: pointer of type atomic_short | ||
422 | * | ||
423 | * Atomically adds @i to @v and returns @i + @v | ||
424 | */ | ||
425 | static inline int atomic_add_short_return(short i, struct atomic_short *v) | ||
426 | { | ||
427 | short __i = i; | ||
428 | asm volatile(LOCK_PREFIX "xaddw %0, %1" | ||
429 | : "+r" (i), "+m" (v->counter) | ||
430 | : : "memory"); | ||
431 | return i + __i; | ||
432 | } | ||
433 | |||
331 | #endif /* _ASM_X86_UV_UV_BAU_H */ | 434 | #endif /* _ASM_X86_UV_UV_BAU_H */ |
diff --git a/arch/x86/include/asm/uv/uv_hub.h b/arch/x86/include/asm/uv/uv_hub.h index 14cc74ba5d23..bf6b88ef8eeb 100644 --- a/arch/x86/include/asm/uv/uv_hub.h +++ b/arch/x86/include/asm/uv/uv_hub.h | |||
@@ -307,7 +307,7 @@ static inline unsigned long uv_read_global_mmr32(int pnode, unsigned long offset | |||
307 | * Access Global MMR space using the MMR space located at the top of physical | 307 | * Access Global MMR space using the MMR space located at the top of physical |
308 | * memory. | 308 | * memory. |
309 | */ | 309 | */ |
310 | static inline unsigned long *uv_global_mmr64_address(int pnode, unsigned long offset) | 310 | static inline volatile void __iomem *uv_global_mmr64_address(int pnode, unsigned long offset) |
311 | { | 311 | { |
312 | return __va(UV_GLOBAL_MMR64_BASE | | 312 | return __va(UV_GLOBAL_MMR64_BASE | |
313 | UV_GLOBAL_MMR64_PNODE_BITS(pnode) | offset); | 313 | UV_GLOBAL_MMR64_PNODE_BITS(pnode) | offset); |
diff --git a/arch/x86/include/asm/uv/uv_mmrs.h b/arch/x86/include/asm/uv/uv_mmrs.h index 2cae46c7c8a2..b2f2d2e05cec 100644 --- a/arch/x86/include/asm/uv/uv_mmrs.h +++ b/arch/x86/include/asm/uv/uv_mmrs.h | |||
@@ -1,4 +1,3 @@ | |||
1 | |||
2 | /* | 1 | /* |
3 | * This file is subject to the terms and conditions of the GNU General Public | 2 | * This file is subject to the terms and conditions of the GNU General Public |
4 | * License. See the file "COPYING" in the main directory of this archive | 3 | * License. See the file "COPYING" in the main directory of this archive |
@@ -15,13 +14,25 @@ | |||
15 | #define UV_MMR_ENABLE (1UL << 63) | 14 | #define UV_MMR_ENABLE (1UL << 63) |
16 | 15 | ||
17 | /* ========================================================================= */ | 16 | /* ========================================================================= */ |
17 | /* UVH_BAU_DATA_BROADCAST */ | ||
18 | /* ========================================================================= */ | ||
19 | #define UVH_BAU_DATA_BROADCAST 0x61688UL | ||
20 | #define UVH_BAU_DATA_BROADCAST_32 0x0440 | ||
21 | |||
22 | #define UVH_BAU_DATA_BROADCAST_ENABLE_SHFT 0 | ||
23 | #define UVH_BAU_DATA_BROADCAST_ENABLE_MASK 0x0000000000000001UL | ||
24 | |||
25 | union uvh_bau_data_broadcast_u { | ||
26 | unsigned long v; | ||
27 | struct uvh_bau_data_broadcast_s { | ||
28 | unsigned long enable : 1; /* RW */ | ||
29 | unsigned long rsvd_1_63: 63; /* */ | ||
30 | } s; | ||
31 | }; | ||
32 | |||
33 | /* ========================================================================= */ | ||
18 | /* UVH_BAU_DATA_CONFIG */ | 34 | /* UVH_BAU_DATA_CONFIG */ |
19 | /* ========================================================================= */ | 35 | /* ========================================================================= */ |
20 | #define UVH_LB_BAU_MISC_CONTROL 0x320170UL | ||
21 | #define UV_ENABLE_INTD_SOFT_ACK_MODE_SHIFT 15 | ||
22 | #define UV_INTD_SOFT_ACK_TIMEOUT_PERIOD_SHIFT 16 | ||
23 | #define UV_INTD_SOFT_ACK_TIMEOUT_PERIOD 0x000000000bUL | ||
24 | /* 1011 timebase 7 (168millisec) * 3 ticks -> 500ms */ | ||
25 | #define UVH_BAU_DATA_CONFIG 0x61680UL | 36 | #define UVH_BAU_DATA_CONFIG 0x61680UL |
26 | #define UVH_BAU_DATA_CONFIG_32 0x0438 | 37 | #define UVH_BAU_DATA_CONFIG_32 0x0438 |
27 | 38 | ||
@@ -604,6 +615,68 @@ union uvh_lb_bau_intd_software_acknowledge_u { | |||
604 | #define UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_ALIAS_32 0x0a70 | 615 | #define UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_ALIAS_32 0x0a70 |
605 | 616 | ||
606 | /* ========================================================================= */ | 617 | /* ========================================================================= */ |
618 | /* UVH_LB_BAU_MISC_CONTROL */ | ||
619 | /* ========================================================================= */ | ||
620 | #define UVH_LB_BAU_MISC_CONTROL 0x320170UL | ||
621 | #define UVH_LB_BAU_MISC_CONTROL_32 0x00a10 | ||
622 | |||
623 | #define UVH_LB_BAU_MISC_CONTROL_REJECTION_DELAY_SHFT 0 | ||
624 | #define UVH_LB_BAU_MISC_CONTROL_REJECTION_DELAY_MASK 0x00000000000000ffUL | ||
625 | #define UVH_LB_BAU_MISC_CONTROL_APIC_MODE_SHFT 8 | ||
626 | #define UVH_LB_BAU_MISC_CONTROL_APIC_MODE_MASK 0x0000000000000100UL | ||
627 | #define UVH_LB_BAU_MISC_CONTROL_FORCE_BROADCAST_SHFT 9 | ||
628 | #define UVH_LB_BAU_MISC_CONTROL_FORCE_BROADCAST_MASK 0x0000000000000200UL | ||
629 | #define UVH_LB_BAU_MISC_CONTROL_FORCE_LOCK_NOP_SHFT 10 | ||
630 | #define UVH_LB_BAU_MISC_CONTROL_FORCE_LOCK_NOP_MASK 0x0000000000000400UL | ||
631 | #define UVH_LB_BAU_MISC_CONTROL_CSI_AGENT_PRESENCE_VECTOR_SHFT 11 | ||
632 | #define UVH_LB_BAU_MISC_CONTROL_CSI_AGENT_PRESENCE_VECTOR_MASK 0x0000000000003800UL | ||
633 | #define UVH_LB_BAU_MISC_CONTROL_DESCRIPTOR_FETCH_MODE_SHFT 14 | ||
634 | #define UVH_LB_BAU_MISC_CONTROL_DESCRIPTOR_FETCH_MODE_MASK 0x0000000000004000UL | ||
635 | #define UVH_LB_BAU_MISC_CONTROL_ENABLE_INTD_SOFT_ACK_MODE_SHFT 15 | ||
636 | #define UVH_LB_BAU_MISC_CONTROL_ENABLE_INTD_SOFT_ACK_MODE_MASK 0x0000000000008000UL | ||
637 | #define UVH_LB_BAU_MISC_CONTROL_INTD_SOFT_ACK_TIMEOUT_PERIOD_SHFT 16 | ||
638 | #define UVH_LB_BAU_MISC_CONTROL_INTD_SOFT_ACK_TIMEOUT_PERIOD_MASK 0x00000000000f0000UL | ||
639 | #define UVH_LB_BAU_MISC_CONTROL_ENABLE_DUAL_MAPPING_MODE_SHFT 20 | ||
640 | #define UVH_LB_BAU_MISC_CONTROL_ENABLE_DUAL_MAPPING_MODE_MASK 0x0000000000100000UL | ||
641 | #define UVH_LB_BAU_MISC_CONTROL_VGA_IO_PORT_DECODE_ENABLE_SHFT 21 | ||
642 | #define UVH_LB_BAU_MISC_CONTROL_VGA_IO_PORT_DECODE_ENABLE_MASK 0x0000000000200000UL | ||
643 | #define UVH_LB_BAU_MISC_CONTROL_VGA_IO_PORT_16_BIT_DECODE_SHFT 22 | ||
644 | #define UVH_LB_BAU_MISC_CONTROL_VGA_IO_PORT_16_BIT_DECODE_MASK 0x0000000000400000UL | ||
645 | #define UVH_LB_BAU_MISC_CONTROL_SUPPRESS_DEST_REGISTRATION_SHFT 23 | ||
646 | #define UVH_LB_BAU_MISC_CONTROL_SUPPRESS_DEST_REGISTRATION_MASK 0x0000000000800000UL | ||
647 | #define UVH_LB_BAU_MISC_CONTROL_PROGRAMMED_INITIAL_PRIORITY_SHFT 24 | ||
648 | #define UVH_LB_BAU_MISC_CONTROL_PROGRAMMED_INITIAL_PRIORITY_MASK 0x0000000007000000UL | ||
649 | #define UVH_LB_BAU_MISC_CONTROL_USE_INCOMING_PRIORITY_SHFT 27 | ||
650 | #define UVH_LB_BAU_MISC_CONTROL_USE_INCOMING_PRIORITY_MASK 0x0000000008000000UL | ||
651 | #define UVH_LB_BAU_MISC_CONTROL_ENABLE_PROGRAMMED_INITIAL_PRIORITY_SHFT 28 | ||
652 | #define UVH_LB_BAU_MISC_CONTROL_ENABLE_PROGRAMMED_INITIAL_PRIORITY_MASK 0x0000000010000000UL | ||
653 | #define UVH_LB_BAU_MISC_CONTROL_FUN_SHFT 48 | ||
654 | #define UVH_LB_BAU_MISC_CONTROL_FUN_MASK 0xffff000000000000UL | ||
655 | |||
656 | union uvh_lb_bau_misc_control_u { | ||
657 | unsigned long v; | ||
658 | struct uvh_lb_bau_misc_control_s { | ||
659 | unsigned long rejection_delay : 8; /* RW */ | ||
660 | unsigned long apic_mode : 1; /* RW */ | ||
661 | unsigned long force_broadcast : 1; /* RW */ | ||
662 | unsigned long force_lock_nop : 1; /* RW */ | ||
663 | unsigned long csi_agent_presence_vector : 3; /* RW */ | ||
664 | unsigned long descriptor_fetch_mode : 1; /* RW */ | ||
665 | unsigned long enable_intd_soft_ack_mode : 1; /* RW */ | ||
666 | unsigned long intd_soft_ack_timeout_period : 4; /* RW */ | ||
667 | unsigned long enable_dual_mapping_mode : 1; /* RW */ | ||
668 | unsigned long vga_io_port_decode_enable : 1; /* RW */ | ||
669 | unsigned long vga_io_port_16_bit_decode : 1; /* RW */ | ||
670 | unsigned long suppress_dest_registration : 1; /* RW */ | ||
671 | unsigned long programmed_initial_priority : 3; /* RW */ | ||
672 | unsigned long use_incoming_priority : 1; /* RW */ | ||
673 | unsigned long enable_programmed_initial_priority : 1; /* RW */ | ||
674 | unsigned long rsvd_29_47 : 19; /* */ | ||
675 | unsigned long fun : 16; /* RW */ | ||
676 | } s; | ||
677 | }; | ||
678 | |||
679 | /* ========================================================================= */ | ||
607 | /* UVH_LB_BAU_SB_ACTIVATION_CONTROL */ | 680 | /* UVH_LB_BAU_SB_ACTIVATION_CONTROL */ |
608 | /* ========================================================================= */ | 681 | /* ========================================================================= */ |
609 | #define UVH_LB_BAU_SB_ACTIVATION_CONTROL 0x320020UL | 682 | #define UVH_LB_BAU_SB_ACTIVATION_CONTROL 0x320020UL |
@@ -681,334 +754,6 @@ union uvh_lb_bau_sb_descriptor_base_u { | |||
681 | }; | 754 | }; |
682 | 755 | ||
683 | /* ========================================================================= */ | 756 | /* ========================================================================= */ |
684 | /* UVH_LB_MCAST_AOERR0_RPT_ENABLE */ | ||
685 | /* ========================================================================= */ | ||
686 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE 0x50b20UL | ||
687 | |||
688 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MCAST_OBESE_MSG_SHFT 0 | ||
689 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MCAST_OBESE_MSG_MASK 0x0000000000000001UL | ||
690 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MCAST_DATA_SB_ERR_SHFT 1 | ||
691 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MCAST_DATA_SB_ERR_MASK 0x0000000000000002UL | ||
692 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MCAST_NACK_BUFF_PARITY_SHFT 2 | ||
693 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MCAST_NACK_BUFF_PARITY_MASK 0x0000000000000004UL | ||
694 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MCAST_TIMEOUT_SHFT 3 | ||
695 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MCAST_TIMEOUT_MASK 0x0000000000000008UL | ||
696 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MCAST_INACTIVE_REPLY_SHFT 4 | ||
697 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MCAST_INACTIVE_REPLY_MASK 0x0000000000000010UL | ||
698 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MCAST_UPGRADE_ERROR_SHFT 5 | ||
699 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MCAST_UPGRADE_ERROR_MASK 0x0000000000000020UL | ||
700 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MCAST_REG_COUNT_UNDERFLOW_SHFT 6 | ||
701 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MCAST_REG_COUNT_UNDERFLOW_MASK 0x0000000000000040UL | ||
702 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MCAST_REP_OBESE_MSG_SHFT 7 | ||
703 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MCAST_REP_OBESE_MSG_MASK 0x0000000000000080UL | ||
704 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_UCACHE_REQ_RUNT_MSG_SHFT 8 | ||
705 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_UCACHE_REQ_RUNT_MSG_MASK 0x0000000000000100UL | ||
706 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_UCACHE_REQ_OBESE_MSG_SHFT 9 | ||
707 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_UCACHE_REQ_OBESE_MSG_MASK 0x0000000000000200UL | ||
708 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_UCACHE_REQ_DATA_SB_ERR_SHFT 10 | ||
709 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_UCACHE_REQ_DATA_SB_ERR_MASK 0x0000000000000400UL | ||
710 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_UCACHE_REP_RUNT_MSG_SHFT 11 | ||
711 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_UCACHE_REP_RUNT_MSG_MASK 0x0000000000000800UL | ||
712 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_UCACHE_REP_OBESE_MSG_SHFT 12 | ||
713 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_UCACHE_REP_OBESE_MSG_MASK 0x0000000000001000UL | ||
714 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_UCACHE_REP_DATA_SB_ERR_SHFT 13 | ||
715 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_UCACHE_REP_DATA_SB_ERR_MASK 0x0000000000002000UL | ||
716 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_UCACHE_REP_COMMAND_ERR_SHFT 14 | ||
717 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_UCACHE_REP_COMMAND_ERR_MASK 0x0000000000004000UL | ||
718 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_UCACHE_PEND_TIMEOUT_SHFT 15 | ||
719 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_UCACHE_PEND_TIMEOUT_MASK 0x0000000000008000UL | ||
720 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_REQ_RUNT_MSG_SHFT 16 | ||
721 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_REQ_RUNT_MSG_MASK 0x0000000000010000UL | ||
722 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_REQ_OBESE_MSG_SHFT 17 | ||
723 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_REQ_OBESE_MSG_MASK 0x0000000000020000UL | ||
724 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_REQ_DATA_SB_ERR_SHFT 18 | ||
725 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_REQ_DATA_SB_ERR_MASK 0x0000000000040000UL | ||
726 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_REP_RUNT_MSG_SHFT 19 | ||
727 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_REP_RUNT_MSG_MASK 0x0000000000080000UL | ||
728 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_REP_OBESE_MSG_SHFT 20 | ||
729 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_REP_OBESE_MSG_MASK 0x0000000000100000UL | ||
730 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_REP_DATA_SB_ERR_SHFT 21 | ||
731 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_REP_DATA_SB_ERR_MASK 0x0000000000200000UL | ||
732 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_AMO_TIMEOUT_SHFT 22 | ||
733 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_AMO_TIMEOUT_MASK 0x0000000000400000UL | ||
734 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_PUT_TIMEOUT_SHFT 23 | ||
735 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_PUT_TIMEOUT_MASK 0x0000000000800000UL | ||
736 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_SPURIOUS_EVENT_SHFT 24 | ||
737 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_SPURIOUS_EVENT_MASK 0x0000000001000000UL | ||
738 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_IOH_DESTINATION_TABLE_PARITY_SHFT 25 | ||
739 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_IOH_DESTINATION_TABLE_PARITY_MASK 0x0000000002000000UL | ||
740 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_GET_HAD_ERROR_REPLY_SHFT 26 | ||
741 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_GET_HAD_ERROR_REPLY_MASK 0x0000000004000000UL | ||
742 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_GET_TIMEOUT_SHFT 27 | ||
743 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_GET_TIMEOUT_MASK 0x0000000008000000UL | ||
744 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_LOCK_MANAGER_HAD_ERROR_REPLY_SHFT 28 | ||
745 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_LOCK_MANAGER_HAD_ERROR_REPLY_MASK 0x0000000010000000UL | ||
746 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_PUT_HAD_ERROR_REPLY_SHFT 29 | ||
747 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_PUT_HAD_ERROR_REPLY_MASK 0x0000000020000000UL | ||
748 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_PUT_TIMEOUT_SHFT 30 | ||
749 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_PUT_TIMEOUT_MASK 0x0000000040000000UL | ||
750 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_SB_ACTIVATION_OVERRUN_SHFT 31 | ||
751 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_SB_ACTIVATION_OVERRUN_MASK 0x0000000080000000UL | ||
752 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_COMPLETED_GB_ACTIVATION_HAD_ERROR_REPLY_SHFT 32 | ||
753 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_COMPLETED_GB_ACTIVATION_HAD_ERROR_REPLY_MASK 0x0000000100000000UL | ||
754 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_COMPLETED_GB_ACTIVATION_TIMEOUT_SHFT 33 | ||
755 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_COMPLETED_GB_ACTIVATION_TIMEOUT_MASK 0x0000000200000000UL | ||
756 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_DESCRIPTOR_BUFFER_0_PARITY_SHFT 34 | ||
757 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_DESCRIPTOR_BUFFER_0_PARITY_MASK 0x0000000400000000UL | ||
758 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_DESCRIPTOR_BUFFER_1_PARITY_SHFT 35 | ||
759 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_DESCRIPTOR_BUFFER_1_PARITY_MASK 0x0000000800000000UL | ||
760 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_SOCKET_DESTINATION_TABLE_PARITY_SHFT 36 | ||
761 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_SOCKET_DESTINATION_TABLE_PARITY_MASK 0x0000001000000000UL | ||
762 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_BAU_REPLY_PAYLOAD_CORRUPTION_SHFT 37 | ||
763 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_BAU_REPLY_PAYLOAD_CORRUPTION_MASK 0x0000002000000000UL | ||
764 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_IO_PORT_DESTINATION_TABLE_PARITY_SHFT 38 | ||
765 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_IO_PORT_DESTINATION_TABLE_PARITY_MASK 0x0000004000000000UL | ||
766 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_INTD_SOFT_ACK_TIMEOUT_SHFT 39 | ||
767 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_INTD_SOFT_ACK_TIMEOUT_MASK 0x0000008000000000UL | ||
768 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_INT_REP_OBESE_MSG_SHFT 40 | ||
769 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_INT_REP_OBESE_MSG_MASK 0x0000010000000000UL | ||
770 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_INT_REP_COMMAND_ERR_SHFT 41 | ||
771 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_INT_REP_COMMAND_ERR_MASK 0x0000020000000000UL | ||
772 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_INT_TIMEOUT_SHFT 42 | ||
773 | #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_INT_TIMEOUT_MASK 0x0000040000000000UL | ||
774 | |||
775 | union uvh_lb_mcast_aoerr0_rpt_enable_u { | ||
776 | unsigned long v; | ||
777 | struct uvh_lb_mcast_aoerr0_rpt_enable_s { | ||
778 | unsigned long mcast_obese_msg : 1; /* RW */ | ||
779 | unsigned long mcast_data_sb_err : 1; /* RW */ | ||
780 | unsigned long mcast_nack_buff_parity : 1; /* RW */ | ||
781 | unsigned long mcast_timeout : 1; /* RW */ | ||
782 | unsigned long mcast_inactive_reply : 1; /* RW */ | ||
783 | unsigned long mcast_upgrade_error : 1; /* RW */ | ||
784 | unsigned long mcast_reg_count_underflow : 1; /* RW */ | ||
785 | unsigned long mcast_rep_obese_msg : 1; /* RW */ | ||
786 | unsigned long ucache_req_runt_msg : 1; /* RW */ | ||
787 | unsigned long ucache_req_obese_msg : 1; /* RW */ | ||
788 | unsigned long ucache_req_data_sb_err : 1; /* RW */ | ||
789 | unsigned long ucache_rep_runt_msg : 1; /* RW */ | ||
790 | unsigned long ucache_rep_obese_msg : 1; /* RW */ | ||
791 | unsigned long ucache_rep_data_sb_err : 1; /* RW */ | ||
792 | unsigned long ucache_rep_command_err : 1; /* RW */ | ||
793 | unsigned long ucache_pend_timeout : 1; /* RW */ | ||
794 | unsigned long macc_req_runt_msg : 1; /* RW */ | ||
795 | unsigned long macc_req_obese_msg : 1; /* RW */ | ||
796 | unsigned long macc_req_data_sb_err : 1; /* RW */ | ||
797 | unsigned long macc_rep_runt_msg : 1; /* RW */ | ||
798 | unsigned long macc_rep_obese_msg : 1; /* RW */ | ||
799 | unsigned long macc_rep_data_sb_err : 1; /* RW */ | ||
800 | unsigned long macc_amo_timeout : 1; /* RW */ | ||
801 | unsigned long macc_put_timeout : 1; /* RW */ | ||
802 | unsigned long macc_spurious_event : 1; /* RW */ | ||
803 | unsigned long ioh_destination_table_parity : 1; /* RW */ | ||
804 | unsigned long get_had_error_reply : 1; /* RW */ | ||
805 | unsigned long get_timeout : 1; /* RW */ | ||
806 | unsigned long lock_manager_had_error_reply : 1; /* RW */ | ||
807 | unsigned long put_had_error_reply : 1; /* RW */ | ||
808 | unsigned long put_timeout : 1; /* RW */ | ||
809 | unsigned long sb_activation_overrun : 1; /* RW */ | ||
810 | unsigned long completed_gb_activation_had_error_reply : 1; /* RW */ | ||
811 | unsigned long completed_gb_activation_timeout : 1; /* RW */ | ||
812 | unsigned long descriptor_buffer_0_parity : 1; /* RW */ | ||
813 | unsigned long descriptor_buffer_1_parity : 1; /* RW */ | ||
814 | unsigned long socket_destination_table_parity : 1; /* RW */ | ||
815 | unsigned long bau_reply_payload_corruption : 1; /* RW */ | ||
816 | unsigned long io_port_destination_table_parity : 1; /* RW */ | ||
817 | unsigned long intd_soft_ack_timeout : 1; /* RW */ | ||
818 | unsigned long int_rep_obese_msg : 1; /* RW */ | ||
819 | unsigned long int_rep_command_err : 1; /* RW */ | ||
820 | unsigned long int_timeout : 1; /* RW */ | ||
821 | unsigned long rsvd_43_63 : 21; /* */ | ||
822 | } s; | ||
823 | }; | ||
824 | |||
825 | /* ========================================================================= */ | ||
826 | /* UVH_LOCAL_INT0_CONFIG */ | ||
827 | /* ========================================================================= */ | ||
828 | #define UVH_LOCAL_INT0_CONFIG 0x61000UL | ||
829 | |||
830 | #define UVH_LOCAL_INT0_CONFIG_VECTOR_SHFT 0 | ||
831 | #define UVH_LOCAL_INT0_CONFIG_VECTOR_MASK 0x00000000000000ffUL | ||
832 | #define UVH_LOCAL_INT0_CONFIG_DM_SHFT 8 | ||
833 | #define UVH_LOCAL_INT0_CONFIG_DM_MASK 0x0000000000000700UL | ||
834 | #define UVH_LOCAL_INT0_CONFIG_DESTMODE_SHFT 11 | ||
835 | #define UVH_LOCAL_INT0_CONFIG_DESTMODE_MASK 0x0000000000000800UL | ||
836 | #define UVH_LOCAL_INT0_CONFIG_STATUS_SHFT 12 | ||
837 | #define UVH_LOCAL_INT0_CONFIG_STATUS_MASK 0x0000000000001000UL | ||
838 | #define UVH_LOCAL_INT0_CONFIG_P_SHFT 13 | ||
839 | #define UVH_LOCAL_INT0_CONFIG_P_MASK 0x0000000000002000UL | ||
840 | #define UVH_LOCAL_INT0_CONFIG_T_SHFT 15 | ||
841 | #define UVH_LOCAL_INT0_CONFIG_T_MASK 0x0000000000008000UL | ||
842 | #define UVH_LOCAL_INT0_CONFIG_M_SHFT 16 | ||
843 | #define UVH_LOCAL_INT0_CONFIG_M_MASK 0x0000000000010000UL | ||
844 | #define UVH_LOCAL_INT0_CONFIG_APIC_ID_SHFT 32 | ||
845 | #define UVH_LOCAL_INT0_CONFIG_APIC_ID_MASK 0xffffffff00000000UL | ||
846 | |||
847 | union uvh_local_int0_config_u { | ||
848 | unsigned long v; | ||
849 | struct uvh_local_int0_config_s { | ||
850 | unsigned long vector_ : 8; /* RW */ | ||
851 | unsigned long dm : 3; /* RW */ | ||
852 | unsigned long destmode : 1; /* RW */ | ||
853 | unsigned long status : 1; /* RO */ | ||
854 | unsigned long p : 1; /* RO */ | ||
855 | unsigned long rsvd_14 : 1; /* */ | ||
856 | unsigned long t : 1; /* RO */ | ||
857 | unsigned long m : 1; /* RW */ | ||
858 | unsigned long rsvd_17_31: 15; /* */ | ||
859 | unsigned long apic_id : 32; /* RW */ | ||
860 | } s; | ||
861 | }; | ||
862 | |||
863 | /* ========================================================================= */ | ||
864 | /* UVH_LOCAL_INT0_ENABLE */ | ||
865 | /* ========================================================================= */ | ||
866 | #define UVH_LOCAL_INT0_ENABLE 0x65000UL | ||
867 | |||
868 | #define UVH_LOCAL_INT0_ENABLE_LB_HCERR_SHFT 0 | ||
869 | #define UVH_LOCAL_INT0_ENABLE_LB_HCERR_MASK 0x0000000000000001UL | ||
870 | #define UVH_LOCAL_INT0_ENABLE_GR0_HCERR_SHFT 1 | ||
871 | #define UVH_LOCAL_INT0_ENABLE_GR0_HCERR_MASK 0x0000000000000002UL | ||
872 | #define UVH_LOCAL_INT0_ENABLE_GR1_HCERR_SHFT 2 | ||
873 | #define UVH_LOCAL_INT0_ENABLE_GR1_HCERR_MASK 0x0000000000000004UL | ||
874 | #define UVH_LOCAL_INT0_ENABLE_LH_HCERR_SHFT 3 | ||
875 | #define UVH_LOCAL_INT0_ENABLE_LH_HCERR_MASK 0x0000000000000008UL | ||
876 | #define UVH_LOCAL_INT0_ENABLE_RH_HCERR_SHFT 4 | ||
877 | #define UVH_LOCAL_INT0_ENABLE_RH_HCERR_MASK 0x0000000000000010UL | ||
878 | #define UVH_LOCAL_INT0_ENABLE_XN_HCERR_SHFT 5 | ||
879 | #define UVH_LOCAL_INT0_ENABLE_XN_HCERR_MASK 0x0000000000000020UL | ||
880 | #define UVH_LOCAL_INT0_ENABLE_SI_HCERR_SHFT 6 | ||
881 | #define UVH_LOCAL_INT0_ENABLE_SI_HCERR_MASK 0x0000000000000040UL | ||
882 | #define UVH_LOCAL_INT0_ENABLE_LB_AOERR0_SHFT 7 | ||
883 | #define UVH_LOCAL_INT0_ENABLE_LB_AOERR0_MASK 0x0000000000000080UL | ||
884 | #define UVH_LOCAL_INT0_ENABLE_GR0_AOERR0_SHFT 8 | ||
885 | #define UVH_LOCAL_INT0_ENABLE_GR0_AOERR0_MASK 0x0000000000000100UL | ||
886 | #define UVH_LOCAL_INT0_ENABLE_GR1_AOERR0_SHFT 9 | ||
887 | #define UVH_LOCAL_INT0_ENABLE_GR1_AOERR0_MASK 0x0000000000000200UL | ||
888 | #define UVH_LOCAL_INT0_ENABLE_LH_AOERR0_SHFT 10 | ||
889 | #define UVH_LOCAL_INT0_ENABLE_LH_AOERR0_MASK 0x0000000000000400UL | ||
890 | #define UVH_LOCAL_INT0_ENABLE_RH_AOERR0_SHFT 11 | ||
891 | #define UVH_LOCAL_INT0_ENABLE_RH_AOERR0_MASK 0x0000000000000800UL | ||
892 | #define UVH_LOCAL_INT0_ENABLE_XN_AOERR0_SHFT 12 | ||
893 | #define UVH_LOCAL_INT0_ENABLE_XN_AOERR0_MASK 0x0000000000001000UL | ||
894 | #define UVH_LOCAL_INT0_ENABLE_SI_AOERR0_SHFT 13 | ||
895 | #define UVH_LOCAL_INT0_ENABLE_SI_AOERR0_MASK 0x0000000000002000UL | ||
896 | #define UVH_LOCAL_INT0_ENABLE_LB_AOERR1_SHFT 14 | ||
897 | #define UVH_LOCAL_INT0_ENABLE_LB_AOERR1_MASK 0x0000000000004000UL | ||
898 | #define UVH_LOCAL_INT0_ENABLE_GR0_AOERR1_SHFT 15 | ||
899 | #define UVH_LOCAL_INT0_ENABLE_GR0_AOERR1_MASK 0x0000000000008000UL | ||
900 | #define UVH_LOCAL_INT0_ENABLE_GR1_AOERR1_SHFT 16 | ||
901 | #define UVH_LOCAL_INT0_ENABLE_GR1_AOERR1_MASK 0x0000000000010000UL | ||
902 | #define UVH_LOCAL_INT0_ENABLE_LH_AOERR1_SHFT 17 | ||
903 | #define UVH_LOCAL_INT0_ENABLE_LH_AOERR1_MASK 0x0000000000020000UL | ||
904 | #define UVH_LOCAL_INT0_ENABLE_RH_AOERR1_SHFT 18 | ||
905 | #define UVH_LOCAL_INT0_ENABLE_RH_AOERR1_MASK 0x0000000000040000UL | ||
906 | #define UVH_LOCAL_INT0_ENABLE_XN_AOERR1_SHFT 19 | ||
907 | #define UVH_LOCAL_INT0_ENABLE_XN_AOERR1_MASK 0x0000000000080000UL | ||
908 | #define UVH_LOCAL_INT0_ENABLE_SI_AOERR1_SHFT 20 | ||
909 | #define UVH_LOCAL_INT0_ENABLE_SI_AOERR1_MASK 0x0000000000100000UL | ||
910 | #define UVH_LOCAL_INT0_ENABLE_RH_VPI_INT_SHFT 21 | ||
911 | #define UVH_LOCAL_INT0_ENABLE_RH_VPI_INT_MASK 0x0000000000200000UL | ||
912 | #define UVH_LOCAL_INT0_ENABLE_SYSTEM_SHUTDOWN_INT_SHFT 22 | ||
913 | #define UVH_LOCAL_INT0_ENABLE_SYSTEM_SHUTDOWN_INT_MASK 0x0000000000400000UL | ||
914 | #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_0_SHFT 23 | ||
915 | #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_0_MASK 0x0000000000800000UL | ||
916 | #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_1_SHFT 24 | ||
917 | #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_1_MASK 0x0000000001000000UL | ||
918 | #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_2_SHFT 25 | ||
919 | #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_2_MASK 0x0000000002000000UL | ||
920 | #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_3_SHFT 26 | ||
921 | #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_3_MASK 0x0000000004000000UL | ||
922 | #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_4_SHFT 27 | ||
923 | #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_4_MASK 0x0000000008000000UL | ||
924 | #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_5_SHFT 28 | ||
925 | #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_5_MASK 0x0000000010000000UL | ||
926 | #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_6_SHFT 29 | ||
927 | #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_6_MASK 0x0000000020000000UL | ||
928 | #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_7_SHFT 30 | ||
929 | #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_7_MASK 0x0000000040000000UL | ||
930 | #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_8_SHFT 31 | ||
931 | #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_8_MASK 0x0000000080000000UL | ||
932 | #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_9_SHFT 32 | ||
933 | #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_9_MASK 0x0000000100000000UL | ||
934 | #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_10_SHFT 33 | ||
935 | #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_10_MASK 0x0000000200000000UL | ||
936 | #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_11_SHFT 34 | ||
937 | #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_11_MASK 0x0000000400000000UL | ||
938 | #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_12_SHFT 35 | ||
939 | #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_12_MASK 0x0000000800000000UL | ||
940 | #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_13_SHFT 36 | ||
941 | #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_13_MASK 0x0000001000000000UL | ||
942 | #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_14_SHFT 37 | ||
943 | #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_14_MASK 0x0000002000000000UL | ||
944 | #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_15_SHFT 38 | ||
945 | #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_15_MASK 0x0000004000000000UL | ||
946 | #define UVH_LOCAL_INT0_ENABLE_L1_NMI_INT_SHFT 39 | ||
947 | #define UVH_LOCAL_INT0_ENABLE_L1_NMI_INT_MASK 0x0000008000000000UL | ||
948 | #define UVH_LOCAL_INT0_ENABLE_STOP_CLOCK_SHFT 40 | ||
949 | #define UVH_LOCAL_INT0_ENABLE_STOP_CLOCK_MASK 0x0000010000000000UL | ||
950 | #define UVH_LOCAL_INT0_ENABLE_ASIC_TO_L1_SHFT 41 | ||
951 | #define UVH_LOCAL_INT0_ENABLE_ASIC_TO_L1_MASK 0x0000020000000000UL | ||
952 | #define UVH_LOCAL_INT0_ENABLE_L1_TO_ASIC_SHFT 42 | ||
953 | #define UVH_LOCAL_INT0_ENABLE_L1_TO_ASIC_MASK 0x0000040000000000UL | ||
954 | #define UVH_LOCAL_INT0_ENABLE_LTC_INT_SHFT 43 | ||
955 | #define UVH_LOCAL_INT0_ENABLE_LTC_INT_MASK 0x0000080000000000UL | ||
956 | #define UVH_LOCAL_INT0_ENABLE_LA_SEQ_TRIGGER_SHFT 44 | ||
957 | #define UVH_LOCAL_INT0_ENABLE_LA_SEQ_TRIGGER_MASK 0x0000100000000000UL | ||
958 | |||
959 | union uvh_local_int0_enable_u { | ||
960 | unsigned long v; | ||
961 | struct uvh_local_int0_enable_s { | ||
962 | unsigned long lb_hcerr : 1; /* RW */ | ||
963 | unsigned long gr0_hcerr : 1; /* RW */ | ||
964 | unsigned long gr1_hcerr : 1; /* RW */ | ||
965 | unsigned long lh_hcerr : 1; /* RW */ | ||
966 | unsigned long rh_hcerr : 1; /* RW */ | ||
967 | unsigned long xn_hcerr : 1; /* RW */ | ||
968 | unsigned long si_hcerr : 1; /* RW */ | ||
969 | unsigned long lb_aoerr0 : 1; /* RW */ | ||
970 | unsigned long gr0_aoerr0 : 1; /* RW */ | ||
971 | unsigned long gr1_aoerr0 : 1; /* RW */ | ||
972 | unsigned long lh_aoerr0 : 1; /* RW */ | ||
973 | unsigned long rh_aoerr0 : 1; /* RW */ | ||
974 | unsigned long xn_aoerr0 : 1; /* RW */ | ||
975 | unsigned long si_aoerr0 : 1; /* RW */ | ||
976 | unsigned long lb_aoerr1 : 1; /* RW */ | ||
977 | unsigned long gr0_aoerr1 : 1; /* RW */ | ||
978 | unsigned long gr1_aoerr1 : 1; /* RW */ | ||
979 | unsigned long lh_aoerr1 : 1; /* RW */ | ||
980 | unsigned long rh_aoerr1 : 1; /* RW */ | ||
981 | unsigned long xn_aoerr1 : 1; /* RW */ | ||
982 | unsigned long si_aoerr1 : 1; /* RW */ | ||
983 | unsigned long rh_vpi_int : 1; /* RW */ | ||
984 | unsigned long system_shutdown_int : 1; /* RW */ | ||
985 | unsigned long lb_irq_int_0 : 1; /* RW */ | ||
986 | unsigned long lb_irq_int_1 : 1; /* RW */ | ||
987 | unsigned long lb_irq_int_2 : 1; /* RW */ | ||
988 | unsigned long lb_irq_int_3 : 1; /* RW */ | ||
989 | unsigned long lb_irq_int_4 : 1; /* RW */ | ||
990 | unsigned long lb_irq_int_5 : 1; /* RW */ | ||
991 | unsigned long lb_irq_int_6 : 1; /* RW */ | ||
992 | unsigned long lb_irq_int_7 : 1; /* RW */ | ||
993 | unsigned long lb_irq_int_8 : 1; /* RW */ | ||
994 | unsigned long lb_irq_int_9 : 1; /* RW */ | ||
995 | unsigned long lb_irq_int_10 : 1; /* RW */ | ||
996 | unsigned long lb_irq_int_11 : 1; /* RW */ | ||
997 | unsigned long lb_irq_int_12 : 1; /* RW */ | ||
998 | unsigned long lb_irq_int_13 : 1; /* RW */ | ||
999 | unsigned long lb_irq_int_14 : 1; /* RW */ | ||
1000 | unsigned long lb_irq_int_15 : 1; /* RW */ | ||
1001 | unsigned long l1_nmi_int : 1; /* RW */ | ||
1002 | unsigned long stop_clock : 1; /* RW */ | ||
1003 | unsigned long asic_to_l1 : 1; /* RW */ | ||
1004 | unsigned long l1_to_asic : 1; /* RW */ | ||
1005 | unsigned long ltc_int : 1; /* RW */ | ||
1006 | unsigned long la_seq_trigger : 1; /* RW */ | ||
1007 | unsigned long rsvd_45_63 : 19; /* */ | ||
1008 | } s; | ||
1009 | }; | ||
1010 | |||
1011 | /* ========================================================================= */ | ||
1012 | /* UVH_NODE_ID */ | 757 | /* UVH_NODE_ID */ |
1013 | /* ========================================================================= */ | 758 | /* ========================================================================= */ |
1014 | #define UVH_NODE_ID 0x0UL | 759 | #define UVH_NODE_ID 0x0UL |
@@ -1112,26 +857,6 @@ union uvh_rh_gam_alias210_redirect_config_2_mmr_u { | |||
1112 | }; | 857 | }; |
1113 | 858 | ||
1114 | /* ========================================================================= */ | 859 | /* ========================================================================= */ |
1115 | /* UVH_RH_GAM_CFG_OVERLAY_CONFIG_MMR */ | ||
1116 | /* ========================================================================= */ | ||
1117 | #define UVH_RH_GAM_CFG_OVERLAY_CONFIG_MMR 0x1600020UL | ||
1118 | |||
1119 | #define UVH_RH_GAM_CFG_OVERLAY_CONFIG_MMR_BASE_SHFT 26 | ||
1120 | #define UVH_RH_GAM_CFG_OVERLAY_CONFIG_MMR_BASE_MASK 0x00003ffffc000000UL | ||
1121 | #define UVH_RH_GAM_CFG_OVERLAY_CONFIG_MMR_ENABLE_SHFT 63 | ||
1122 | #define UVH_RH_GAM_CFG_OVERLAY_CONFIG_MMR_ENABLE_MASK 0x8000000000000000UL | ||
1123 | |||
1124 | union uvh_rh_gam_cfg_overlay_config_mmr_u { | ||
1125 | unsigned long v; | ||
1126 | struct uvh_rh_gam_cfg_overlay_config_mmr_s { | ||
1127 | unsigned long rsvd_0_25: 26; /* */ | ||
1128 | unsigned long base : 20; /* RW */ | ||
1129 | unsigned long rsvd_46_62: 17; /* */ | ||
1130 | unsigned long enable : 1; /* RW */ | ||
1131 | } s; | ||
1132 | }; | ||
1133 | |||
1134 | /* ========================================================================= */ | ||
1135 | /* UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR */ | 860 | /* UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR */ |
1136 | /* ========================================================================= */ | 861 | /* ========================================================================= */ |
1137 | #define UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR 0x1600010UL | 862 | #define UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR 0x1600010UL |
@@ -1263,101 +988,6 @@ union uvh_rtc1_int_config_u { | |||
1263 | }; | 988 | }; |
1264 | 989 | ||
1265 | /* ========================================================================= */ | 990 | /* ========================================================================= */ |
1266 | /* UVH_RTC2_INT_CONFIG */ | ||
1267 | /* ========================================================================= */ | ||
1268 | #define UVH_RTC2_INT_CONFIG 0x61600UL | ||
1269 | |||
1270 | #define UVH_RTC2_INT_CONFIG_VECTOR_SHFT 0 | ||
1271 | #define UVH_RTC2_INT_CONFIG_VECTOR_MASK 0x00000000000000ffUL | ||
1272 | #define UVH_RTC2_INT_CONFIG_DM_SHFT 8 | ||
1273 | #define UVH_RTC2_INT_CONFIG_DM_MASK 0x0000000000000700UL | ||
1274 | #define UVH_RTC2_INT_CONFIG_DESTMODE_SHFT 11 | ||
1275 | #define UVH_RTC2_INT_CONFIG_DESTMODE_MASK 0x0000000000000800UL | ||
1276 | #define UVH_RTC2_INT_CONFIG_STATUS_SHFT 12 | ||
1277 | #define UVH_RTC2_INT_CONFIG_STATUS_MASK 0x0000000000001000UL | ||
1278 | #define UVH_RTC2_INT_CONFIG_P_SHFT 13 | ||
1279 | #define UVH_RTC2_INT_CONFIG_P_MASK 0x0000000000002000UL | ||
1280 | #define UVH_RTC2_INT_CONFIG_T_SHFT 15 | ||
1281 | #define UVH_RTC2_INT_CONFIG_T_MASK 0x0000000000008000UL | ||
1282 | #define UVH_RTC2_INT_CONFIG_M_SHFT 16 | ||
1283 | #define UVH_RTC2_INT_CONFIG_M_MASK 0x0000000000010000UL | ||
1284 | #define UVH_RTC2_INT_CONFIG_APIC_ID_SHFT 32 | ||
1285 | #define UVH_RTC2_INT_CONFIG_APIC_ID_MASK 0xffffffff00000000UL | ||
1286 | |||
1287 | union uvh_rtc2_int_config_u { | ||
1288 | unsigned long v; | ||
1289 | struct uvh_rtc2_int_config_s { | ||
1290 | unsigned long vector_ : 8; /* RW */ | ||
1291 | unsigned long dm : 3; /* RW */ | ||
1292 | unsigned long destmode : 1; /* RW */ | ||
1293 | unsigned long status : 1; /* RO */ | ||
1294 | unsigned long p : 1; /* RO */ | ||
1295 | unsigned long rsvd_14 : 1; /* */ | ||
1296 | unsigned long t : 1; /* RO */ | ||
1297 | unsigned long m : 1; /* RW */ | ||
1298 | unsigned long rsvd_17_31: 15; /* */ | ||
1299 | unsigned long apic_id : 32; /* RW */ | ||
1300 | } s; | ||
1301 | }; | ||
1302 | |||
1303 | /* ========================================================================= */ | ||
1304 | /* UVH_RTC3_INT_CONFIG */ | ||
1305 | /* ========================================================================= */ | ||
1306 | #define UVH_RTC3_INT_CONFIG 0x61640UL | ||
1307 | |||
1308 | #define UVH_RTC3_INT_CONFIG_VECTOR_SHFT 0 | ||
1309 | #define UVH_RTC3_INT_CONFIG_VECTOR_MASK 0x00000000000000ffUL | ||
1310 | #define UVH_RTC3_INT_CONFIG_DM_SHFT 8 | ||
1311 | #define UVH_RTC3_INT_CONFIG_DM_MASK 0x0000000000000700UL | ||
1312 | #define UVH_RTC3_INT_CONFIG_DESTMODE_SHFT 11 | ||
1313 | #define UVH_RTC3_INT_CONFIG_DESTMODE_MASK 0x0000000000000800UL | ||
1314 | #define UVH_RTC3_INT_CONFIG_STATUS_SHFT 12 | ||
1315 | #define UVH_RTC3_INT_CONFIG_STATUS_MASK 0x0000000000001000UL | ||
1316 | #define UVH_RTC3_INT_CONFIG_P_SHFT 13 | ||
1317 | #define UVH_RTC3_INT_CONFIG_P_MASK 0x0000000000002000UL | ||
1318 | #define UVH_RTC3_INT_CONFIG_T_SHFT 15 | ||
1319 | #define UVH_RTC3_INT_CONFIG_T_MASK 0x0000000000008000UL | ||
1320 | #define UVH_RTC3_INT_CONFIG_M_SHFT 16 | ||
1321 | #define UVH_RTC3_INT_CONFIG_M_MASK 0x0000000000010000UL | ||
1322 | #define UVH_RTC3_INT_CONFIG_APIC_ID_SHFT 32 | ||
1323 | #define UVH_RTC3_INT_CONFIG_APIC_ID_MASK 0xffffffff00000000UL | ||
1324 | |||
1325 | union uvh_rtc3_int_config_u { | ||
1326 | unsigned long v; | ||
1327 | struct uvh_rtc3_int_config_s { | ||
1328 | unsigned long vector_ : 8; /* RW */ | ||
1329 | unsigned long dm : 3; /* RW */ | ||
1330 | unsigned long destmode : 1; /* RW */ | ||
1331 | unsigned long status : 1; /* RO */ | ||
1332 | unsigned long p : 1; /* RO */ | ||
1333 | unsigned long rsvd_14 : 1; /* */ | ||
1334 | unsigned long t : 1; /* RO */ | ||
1335 | unsigned long m : 1; /* RW */ | ||
1336 | unsigned long rsvd_17_31: 15; /* */ | ||
1337 | unsigned long apic_id : 32; /* RW */ | ||
1338 | } s; | ||
1339 | }; | ||
1340 | |||
1341 | /* ========================================================================= */ | ||
1342 | /* UVH_RTC_INC_RATIO */ | ||
1343 | /* ========================================================================= */ | ||
1344 | #define UVH_RTC_INC_RATIO 0x350000UL | ||
1345 | |||
1346 | #define UVH_RTC_INC_RATIO_FRACTION_SHFT 0 | ||
1347 | #define UVH_RTC_INC_RATIO_FRACTION_MASK 0x00000000000fffffUL | ||
1348 | #define UVH_RTC_INC_RATIO_RATIO_SHFT 20 | ||
1349 | #define UVH_RTC_INC_RATIO_RATIO_MASK 0x0000000000700000UL | ||
1350 | |||
1351 | union uvh_rtc_inc_ratio_u { | ||
1352 | unsigned long v; | ||
1353 | struct uvh_rtc_inc_ratio_s { | ||
1354 | unsigned long fraction : 20; /* RW */ | ||
1355 | unsigned long ratio : 3; /* RW */ | ||
1356 | unsigned long rsvd_23_63: 41; /* */ | ||
1357 | } s; | ||
1358 | }; | ||
1359 | |||
1360 | /* ========================================================================= */ | ||
1361 | /* UVH_SI_ADDR_MAP_CONFIG */ | 991 | /* UVH_SI_ADDR_MAP_CONFIG */ |
1362 | /* ========================================================================= */ | 992 | /* ========================================================================= */ |
1363 | #define UVH_SI_ADDR_MAP_CONFIG 0xc80000UL | 993 | #define UVH_SI_ADDR_MAP_CONFIG 0xc80000UL |
diff --git a/arch/x86/include/asm/vmware.h b/arch/x86/include/asm/vmware.h deleted file mode 100644 index e49ed6d2fd4e..000000000000 --- a/arch/x86/include/asm/vmware.h +++ /dev/null | |||
@@ -1,27 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2008, VMware, Inc. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, but | ||
10 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
12 | * NON INFRINGEMENT. See the GNU General Public License for more | ||
13 | * details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
18 | * | ||
19 | */ | ||
20 | #ifndef ASM_X86__VMWARE_H | ||
21 | #define ASM_X86__VMWARE_H | ||
22 | |||
23 | extern void vmware_platform_setup(void); | ||
24 | extern int vmware_platform(void); | ||
25 | extern void vmware_set_feature_bits(struct cpuinfo_x86 *c); | ||
26 | |||
27 | #endif | ||
diff --git a/arch/x86/include/asm/xsave.h b/arch/x86/include/asm/xsave.h index ddc04ccad03b..2c4390cae228 100644 --- a/arch/x86/include/asm/xsave.h +++ b/arch/x86/include/asm/xsave.h | |||
@@ -37,8 +37,9 @@ extern int check_for_xstate(struct i387_fxsave_struct __user *buf, | |||
37 | void __user *fpstate, | 37 | void __user *fpstate, |
38 | struct _fpx_sw_bytes *sw); | 38 | struct _fpx_sw_bytes *sw); |
39 | 39 | ||
40 | static inline int xrstor_checking(struct xsave_struct *fx) | 40 | static inline int fpu_xrstor_checking(struct fpu *fpu) |
41 | { | 41 | { |
42 | struct xsave_struct *fx = &fpu->state->xsave; | ||
42 | int err; | 43 | int err; |
43 | 44 | ||
44 | asm volatile("1: .byte " REX_PREFIX "0x0f,0xae,0x2f\n\t" | 45 | asm volatile("1: .byte " REX_PREFIX "0x0f,0xae,0x2f\n\t" |
@@ -110,12 +111,12 @@ static inline void xrstor_state(struct xsave_struct *fx, u64 mask) | |||
110 | : "memory"); | 111 | : "memory"); |
111 | } | 112 | } |
112 | 113 | ||
113 | static inline void xsave(struct task_struct *tsk) | 114 | static inline void fpu_xsave(struct fpu *fpu) |
114 | { | 115 | { |
115 | /* This, however, we can work around by forcing the compiler to select | 116 | /* This, however, we can work around by forcing the compiler to select |
116 | an addressing mode that doesn't require extended registers. */ | 117 | an addressing mode that doesn't require extended registers. */ |
117 | __asm__ __volatile__(".byte " REX_PREFIX "0x0f,0xae,0x27" | 118 | __asm__ __volatile__(".byte " REX_PREFIX "0x0f,0xae,0x27" |
118 | : : "D" (&(tsk->thread.xstate->xsave)), | 119 | : : "D" (&(fpu->state->xsave)), |
119 | "a" (-1), "d"(-1) : "memory"); | 120 | "a" (-1), "d"(-1) : "memory"); |
120 | } | 121 | } |
121 | #endif | 122 | #endif |
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index cd40aba6aa95..9a5ed58f09dc 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c | |||
@@ -94,6 +94,53 @@ enum acpi_irq_model_id acpi_irq_model = ACPI_IRQ_MODEL_PIC; | |||
94 | 94 | ||
95 | 95 | ||
96 | /* | 96 | /* |
97 | * ISA irqs by default are the first 16 gsis but can be | ||
98 | * any gsi as specified by an interrupt source override. | ||
99 | */ | ||
100 | static u32 isa_irq_to_gsi[NR_IRQS_LEGACY] __read_mostly = { | ||
101 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 | ||
102 | }; | ||
103 | |||
104 | static unsigned int gsi_to_irq(unsigned int gsi) | ||
105 | { | ||
106 | unsigned int irq = gsi + NR_IRQS_LEGACY; | ||
107 | unsigned int i; | ||
108 | |||
109 | for (i = 0; i < NR_IRQS_LEGACY; i++) { | ||
110 | if (isa_irq_to_gsi[i] == gsi) { | ||
111 | return i; | ||
112 | } | ||
113 | } | ||
114 | |||
115 | /* Provide an identity mapping of gsi == irq | ||
116 | * except on truly weird platforms that have | ||
117 | * non isa irqs in the first 16 gsis. | ||
118 | */ | ||
119 | if (gsi >= NR_IRQS_LEGACY) | ||
120 | irq = gsi; | ||
121 | else | ||
122 | irq = gsi_end + 1 + gsi; | ||
123 | |||
124 | return irq; | ||
125 | } | ||
126 | |||
127 | static u32 irq_to_gsi(int irq) | ||
128 | { | ||
129 | unsigned int gsi; | ||
130 | |||
131 | if (irq < NR_IRQS_LEGACY) | ||
132 | gsi = isa_irq_to_gsi[irq]; | ||
133 | else if (irq <= gsi_end) | ||
134 | gsi = irq; | ||
135 | else if (irq <= (gsi_end + NR_IRQS_LEGACY)) | ||
136 | gsi = irq - gsi_end; | ||
137 | else | ||
138 | gsi = 0xffffffff; | ||
139 | |||
140 | return gsi; | ||
141 | } | ||
142 | |||
143 | /* | ||
97 | * Temporarily use the virtual area starting from FIX_IO_APIC_BASE_END, | 144 | * Temporarily use the virtual area starting from FIX_IO_APIC_BASE_END, |
98 | * to map the target physical address. The problem is that set_fixmap() | 145 | * to map the target physical address. The problem is that set_fixmap() |
99 | * provides a single page, and it is possible that the page is not | 146 | * provides a single page, and it is possible that the page is not |
@@ -313,7 +360,7 @@ acpi_parse_ioapic(struct acpi_subtable_header * header, const unsigned long end) | |||
313 | /* | 360 | /* |
314 | * Parse Interrupt Source Override for the ACPI SCI | 361 | * Parse Interrupt Source Override for the ACPI SCI |
315 | */ | 362 | */ |
316 | static void __init acpi_sci_ioapic_setup(u32 gsi, u16 polarity, u16 trigger) | 363 | static void __init acpi_sci_ioapic_setup(u8 bus_irq, u16 polarity, u16 trigger, u32 gsi) |
317 | { | 364 | { |
318 | if (trigger == 0) /* compatible SCI trigger is level */ | 365 | if (trigger == 0) /* compatible SCI trigger is level */ |
319 | trigger = 3; | 366 | trigger = 3; |
@@ -333,7 +380,7 @@ static void __init acpi_sci_ioapic_setup(u32 gsi, u16 polarity, u16 trigger) | |||
333 | * If GSI is < 16, this will update its flags, | 380 | * If GSI is < 16, this will update its flags, |
334 | * else it will create a new mp_irqs[] entry. | 381 | * else it will create a new mp_irqs[] entry. |
335 | */ | 382 | */ |
336 | mp_override_legacy_irq(gsi, polarity, trigger, gsi); | 383 | mp_override_legacy_irq(bus_irq, polarity, trigger, gsi); |
337 | 384 | ||
338 | /* | 385 | /* |
339 | * stash over-ride to indicate we've been here | 386 | * stash over-ride to indicate we've been here |
@@ -357,9 +404,10 @@ acpi_parse_int_src_ovr(struct acpi_subtable_header * header, | |||
357 | acpi_table_print_madt_entry(header); | 404 | acpi_table_print_madt_entry(header); |
358 | 405 | ||
359 | if (intsrc->source_irq == acpi_gbl_FADT.sci_interrupt) { | 406 | if (intsrc->source_irq == acpi_gbl_FADT.sci_interrupt) { |
360 | acpi_sci_ioapic_setup(intsrc->global_irq, | 407 | acpi_sci_ioapic_setup(intsrc->source_irq, |
361 | intsrc->inti_flags & ACPI_MADT_POLARITY_MASK, | 408 | intsrc->inti_flags & ACPI_MADT_POLARITY_MASK, |
362 | (intsrc->inti_flags & ACPI_MADT_TRIGGER_MASK) >> 2); | 409 | (intsrc->inti_flags & ACPI_MADT_TRIGGER_MASK) >> 2, |
410 | intsrc->global_irq); | ||
363 | return 0; | 411 | return 0; |
364 | } | 412 | } |
365 | 413 | ||
@@ -448,7 +496,7 @@ void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger) | |||
448 | 496 | ||
449 | int acpi_gsi_to_irq(u32 gsi, unsigned int *irq) | 497 | int acpi_gsi_to_irq(u32 gsi, unsigned int *irq) |
450 | { | 498 | { |
451 | *irq = gsi; | 499 | *irq = gsi_to_irq(gsi); |
452 | 500 | ||
453 | #ifdef CONFIG_X86_IO_APIC | 501 | #ifdef CONFIG_X86_IO_APIC |
454 | if (acpi_irq_model == ACPI_IRQ_MODEL_IOAPIC) | 502 | if (acpi_irq_model == ACPI_IRQ_MODEL_IOAPIC) |
@@ -458,6 +506,14 @@ int acpi_gsi_to_irq(u32 gsi, unsigned int *irq) | |||
458 | return 0; | 506 | return 0; |
459 | } | 507 | } |
460 | 508 | ||
509 | int acpi_isa_irq_to_gsi(unsigned isa_irq, u32 *gsi) | ||
510 | { | ||
511 | if (isa_irq >= 16) | ||
512 | return -1; | ||
513 | *gsi = irq_to_gsi(isa_irq); | ||
514 | return 0; | ||
515 | } | ||
516 | |||
461 | /* | 517 | /* |
462 | * success: return IRQ number (>=0) | 518 | * success: return IRQ number (>=0) |
463 | * failure: return < 0 | 519 | * failure: return < 0 |
@@ -482,7 +538,7 @@ int acpi_register_gsi(struct device *dev, u32 gsi, int trigger, int polarity) | |||
482 | plat_gsi = mp_register_gsi(dev, gsi, trigger, polarity); | 538 | plat_gsi = mp_register_gsi(dev, gsi, trigger, polarity); |
483 | } | 539 | } |
484 | #endif | 540 | #endif |
485 | irq = plat_gsi; | 541 | irq = gsi_to_irq(plat_gsi); |
486 | 542 | ||
487 | return irq; | 543 | return irq; |
488 | } | 544 | } |
@@ -867,29 +923,6 @@ static int __init acpi_parse_madt_lapic_entries(void) | |||
867 | extern int es7000_plat; | 923 | extern int es7000_plat; |
868 | #endif | 924 | #endif |
869 | 925 | ||
870 | int __init acpi_probe_gsi(void) | ||
871 | { | ||
872 | int idx; | ||
873 | int gsi; | ||
874 | int max_gsi = 0; | ||
875 | |||
876 | if (acpi_disabled) | ||
877 | return 0; | ||
878 | |||
879 | if (!acpi_ioapic) | ||
880 | return 0; | ||
881 | |||
882 | max_gsi = 0; | ||
883 | for (idx = 0; idx < nr_ioapics; idx++) { | ||
884 | gsi = mp_gsi_routing[idx].gsi_end; | ||
885 | |||
886 | if (gsi > max_gsi) | ||
887 | max_gsi = gsi; | ||
888 | } | ||
889 | |||
890 | return max_gsi + 1; | ||
891 | } | ||
892 | |||
893 | static void assign_to_mp_irq(struct mpc_intsrc *m, | 926 | static void assign_to_mp_irq(struct mpc_intsrc *m, |
894 | struct mpc_intsrc *mp_irq) | 927 | struct mpc_intsrc *mp_irq) |
895 | { | 928 | { |
@@ -947,13 +980,13 @@ void __init mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger, u32 gsi) | |||
947 | mp_irq.dstirq = pin; /* INTIN# */ | 980 | mp_irq.dstirq = pin; /* INTIN# */ |
948 | 981 | ||
949 | save_mp_irq(&mp_irq); | 982 | save_mp_irq(&mp_irq); |
983 | |||
984 | isa_irq_to_gsi[bus_irq] = gsi; | ||
950 | } | 985 | } |
951 | 986 | ||
952 | void __init mp_config_acpi_legacy_irqs(void) | 987 | void __init mp_config_acpi_legacy_irqs(void) |
953 | { | 988 | { |
954 | int i; | 989 | int i; |
955 | int ioapic; | ||
956 | unsigned int dstapic; | ||
957 | struct mpc_intsrc mp_irq; | 990 | struct mpc_intsrc mp_irq; |
958 | 991 | ||
959 | #if defined (CONFIG_MCA) || defined (CONFIG_EISA) | 992 | #if defined (CONFIG_MCA) || defined (CONFIG_EISA) |
@@ -974,19 +1007,27 @@ void __init mp_config_acpi_legacy_irqs(void) | |||
974 | #endif | 1007 | #endif |
975 | 1008 | ||
976 | /* | 1009 | /* |
977 | * Locate the IOAPIC that manages the ISA IRQs (0-15). | ||
978 | */ | ||
979 | ioapic = mp_find_ioapic(0); | ||
980 | if (ioapic < 0) | ||
981 | return; | ||
982 | dstapic = mp_ioapics[ioapic].apicid; | ||
983 | |||
984 | /* | ||
985 | * Use the default configuration for the IRQs 0-15. Unless | 1010 | * Use the default configuration for the IRQs 0-15. Unless |
986 | * overridden by (MADT) interrupt source override entries. | 1011 | * overridden by (MADT) interrupt source override entries. |
987 | */ | 1012 | */ |
988 | for (i = 0; i < 16; i++) { | 1013 | for (i = 0; i < 16; i++) { |
1014 | int ioapic, pin; | ||
1015 | unsigned int dstapic; | ||
989 | int idx; | 1016 | int idx; |
1017 | u32 gsi; | ||
1018 | |||
1019 | /* Locate the gsi that irq i maps to. */ | ||
1020 | if (acpi_isa_irq_to_gsi(i, &gsi)) | ||
1021 | continue; | ||
1022 | |||
1023 | /* | ||
1024 | * Locate the IOAPIC that manages the ISA IRQ. | ||
1025 | */ | ||
1026 | ioapic = mp_find_ioapic(gsi); | ||
1027 | if (ioapic < 0) | ||
1028 | continue; | ||
1029 | pin = mp_find_ioapic_pin(ioapic, gsi); | ||
1030 | dstapic = mp_ioapics[ioapic].apicid; | ||
990 | 1031 | ||
991 | for (idx = 0; idx < mp_irq_entries; idx++) { | 1032 | for (idx = 0; idx < mp_irq_entries; idx++) { |
992 | struct mpc_intsrc *irq = mp_irqs + idx; | 1033 | struct mpc_intsrc *irq = mp_irqs + idx; |
@@ -996,7 +1037,7 @@ void __init mp_config_acpi_legacy_irqs(void) | |||
996 | break; | 1037 | break; |
997 | 1038 | ||
998 | /* Do we already have a mapping for this IOAPIC pin */ | 1039 | /* Do we already have a mapping for this IOAPIC pin */ |
999 | if (irq->dstapic == dstapic && irq->dstirq == i) | 1040 | if (irq->dstapic == dstapic && irq->dstirq == pin) |
1000 | break; | 1041 | break; |
1001 | } | 1042 | } |
1002 | 1043 | ||
@@ -1011,7 +1052,7 @@ void __init mp_config_acpi_legacy_irqs(void) | |||
1011 | mp_irq.dstapic = dstapic; | 1052 | mp_irq.dstapic = dstapic; |
1012 | mp_irq.irqtype = mp_INT; | 1053 | mp_irq.irqtype = mp_INT; |
1013 | mp_irq.srcbusirq = i; /* Identity mapped */ | 1054 | mp_irq.srcbusirq = i; /* Identity mapped */ |
1014 | mp_irq.dstirq = i; | 1055 | mp_irq.dstirq = pin; |
1015 | 1056 | ||
1016 | save_mp_irq(&mp_irq); | 1057 | save_mp_irq(&mp_irq); |
1017 | } | 1058 | } |
@@ -1076,11 +1117,6 @@ int mp_register_gsi(struct device *dev, u32 gsi, int trigger, int polarity) | |||
1076 | 1117 | ||
1077 | ioapic_pin = mp_find_ioapic_pin(ioapic, gsi); | 1118 | ioapic_pin = mp_find_ioapic_pin(ioapic, gsi); |
1078 | 1119 | ||
1079 | #ifdef CONFIG_X86_32 | ||
1080 | if (ioapic_renumber_irq) | ||
1081 | gsi = ioapic_renumber_irq(ioapic, gsi); | ||
1082 | #endif | ||
1083 | |||
1084 | if (ioapic_pin > MP_MAX_IOAPIC_PIN) { | 1120 | if (ioapic_pin > MP_MAX_IOAPIC_PIN) { |
1085 | printk(KERN_ERR "Invalid reference to IOAPIC pin " | 1121 | printk(KERN_ERR "Invalid reference to IOAPIC pin " |
1086 | "%d-%d\n", mp_ioapics[ioapic].apicid, | 1122 | "%d-%d\n", mp_ioapics[ioapic].apicid, |
@@ -1094,7 +1130,7 @@ int mp_register_gsi(struct device *dev, u32 gsi, int trigger, int polarity) | |||
1094 | set_io_apic_irq_attr(&irq_attr, ioapic, ioapic_pin, | 1130 | set_io_apic_irq_attr(&irq_attr, ioapic, ioapic_pin, |
1095 | trigger == ACPI_EDGE_SENSITIVE ? 0 : 1, | 1131 | trigger == ACPI_EDGE_SENSITIVE ? 0 : 1, |
1096 | polarity == ACPI_ACTIVE_HIGH ? 0 : 1); | 1132 | polarity == ACPI_ACTIVE_HIGH ? 0 : 1); |
1097 | io_apic_set_pci_routing(dev, gsi, &irq_attr); | 1133 | io_apic_set_pci_routing(dev, gsi_to_irq(gsi), &irq_attr); |
1098 | 1134 | ||
1099 | return gsi; | 1135 | return gsi; |
1100 | } | 1136 | } |
@@ -1154,7 +1190,8 @@ static int __init acpi_parse_madt_ioapic_entries(void) | |||
1154 | * pretend we got one so we can set the SCI flags. | 1190 | * pretend we got one so we can set the SCI flags. |
1155 | */ | 1191 | */ |
1156 | if (!acpi_sci_override_gsi) | 1192 | if (!acpi_sci_override_gsi) |
1157 | acpi_sci_ioapic_setup(acpi_gbl_FADT.sci_interrupt, 0, 0); | 1193 | acpi_sci_ioapic_setup(acpi_gbl_FADT.sci_interrupt, 0, 0, |
1194 | acpi_gbl_FADT.sci_interrupt); | ||
1158 | 1195 | ||
1159 | /* Fill in identity legacy mappings where no override */ | 1196 | /* Fill in identity legacy mappings where no override */ |
1160 | mp_config_acpi_legacy_irqs(); | 1197 | mp_config_acpi_legacy_irqs(); |
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c index 1a160d5d44d0..70237732a6c7 100644 --- a/arch/x86/kernel/alternative.c +++ b/arch/x86/kernel/alternative.c | |||
@@ -194,7 +194,7 @@ static void __init_or_module add_nops(void *insns, unsigned int len) | |||
194 | } | 194 | } |
195 | 195 | ||
196 | extern struct alt_instr __alt_instructions[], __alt_instructions_end[]; | 196 | extern struct alt_instr __alt_instructions[], __alt_instructions_end[]; |
197 | extern u8 *__smp_locks[], *__smp_locks_end[]; | 197 | extern s32 __smp_locks[], __smp_locks_end[]; |
198 | static void *text_poke_early(void *addr, const void *opcode, size_t len); | 198 | static void *text_poke_early(void *addr, const void *opcode, size_t len); |
199 | 199 | ||
200 | /* Replace instructions with better alternatives for this CPU type. | 200 | /* Replace instructions with better alternatives for this CPU type. |
@@ -235,37 +235,41 @@ void __init_or_module apply_alternatives(struct alt_instr *start, | |||
235 | 235 | ||
236 | #ifdef CONFIG_SMP | 236 | #ifdef CONFIG_SMP |
237 | 237 | ||
238 | static void alternatives_smp_lock(u8 **start, u8 **end, u8 *text, u8 *text_end) | 238 | static void alternatives_smp_lock(const s32 *start, const s32 *end, |
239 | u8 *text, u8 *text_end) | ||
239 | { | 240 | { |
240 | u8 **ptr; | 241 | const s32 *poff; |
241 | 242 | ||
242 | mutex_lock(&text_mutex); | 243 | mutex_lock(&text_mutex); |
243 | for (ptr = start; ptr < end; ptr++) { | 244 | for (poff = start; poff < end; poff++) { |
244 | if (*ptr < text) | 245 | u8 *ptr = (u8 *)poff + *poff; |
245 | continue; | 246 | |
246 | if (*ptr > text_end) | 247 | if (!*poff || ptr < text || ptr >= text_end) |
247 | continue; | 248 | continue; |
248 | /* turn DS segment override prefix into lock prefix */ | 249 | /* turn DS segment override prefix into lock prefix */ |
249 | text_poke(*ptr, ((unsigned char []){0xf0}), 1); | 250 | if (*ptr == 0x3e) |
251 | text_poke(ptr, ((unsigned char []){0xf0}), 1); | ||
250 | }; | 252 | }; |
251 | mutex_unlock(&text_mutex); | 253 | mutex_unlock(&text_mutex); |
252 | } | 254 | } |
253 | 255 | ||
254 | static void alternatives_smp_unlock(u8 **start, u8 **end, u8 *text, u8 *text_end) | 256 | static void alternatives_smp_unlock(const s32 *start, const s32 *end, |
257 | u8 *text, u8 *text_end) | ||
255 | { | 258 | { |
256 | u8 **ptr; | 259 | const s32 *poff; |
257 | 260 | ||
258 | if (noreplace_smp) | 261 | if (noreplace_smp) |
259 | return; | 262 | return; |
260 | 263 | ||
261 | mutex_lock(&text_mutex); | 264 | mutex_lock(&text_mutex); |
262 | for (ptr = start; ptr < end; ptr++) { | 265 | for (poff = start; poff < end; poff++) { |
263 | if (*ptr < text) | 266 | u8 *ptr = (u8 *)poff + *poff; |
264 | continue; | 267 | |
265 | if (*ptr > text_end) | 268 | if (!*poff || ptr < text || ptr >= text_end) |
266 | continue; | 269 | continue; |
267 | /* turn lock prefix into DS segment override prefix */ | 270 | /* turn lock prefix into DS segment override prefix */ |
268 | text_poke(*ptr, ((unsigned char []){0x3E}), 1); | 271 | if (*ptr == 0xf0) |
272 | text_poke(ptr, ((unsigned char []){0x3E}), 1); | ||
269 | }; | 273 | }; |
270 | mutex_unlock(&text_mutex); | 274 | mutex_unlock(&text_mutex); |
271 | } | 275 | } |
@@ -276,8 +280,8 @@ struct smp_alt_module { | |||
276 | char *name; | 280 | char *name; |
277 | 281 | ||
278 | /* ptrs to lock prefixes */ | 282 | /* ptrs to lock prefixes */ |
279 | u8 **locks; | 283 | const s32 *locks; |
280 | u8 **locks_end; | 284 | const s32 *locks_end; |
281 | 285 | ||
282 | /* .text segment, needed to avoid patching init code ;) */ | 286 | /* .text segment, needed to avoid patching init code ;) */ |
283 | u8 *text; | 287 | u8 *text; |
@@ -398,16 +402,19 @@ void alternatives_smp_switch(int smp) | |||
398 | int alternatives_text_reserved(void *start, void *end) | 402 | int alternatives_text_reserved(void *start, void *end) |
399 | { | 403 | { |
400 | struct smp_alt_module *mod; | 404 | struct smp_alt_module *mod; |
401 | u8 **ptr; | 405 | const s32 *poff; |
402 | u8 *text_start = start; | 406 | u8 *text_start = start; |
403 | u8 *text_end = end; | 407 | u8 *text_end = end; |
404 | 408 | ||
405 | list_for_each_entry(mod, &smp_alt_modules, next) { | 409 | list_for_each_entry(mod, &smp_alt_modules, next) { |
406 | if (mod->text > text_end || mod->text_end < text_start) | 410 | if (mod->text > text_end || mod->text_end < text_start) |
407 | continue; | 411 | continue; |
408 | for (ptr = mod->locks; ptr < mod->locks_end; ptr++) | 412 | for (poff = mod->locks; poff < mod->locks_end; poff++) { |
409 | if (text_start <= *ptr && text_end >= *ptr) | 413 | const u8 *ptr = (const u8 *)poff + *poff; |
414 | |||
415 | if (text_start <= ptr && text_end > ptr) | ||
410 | return 1; | 416 | return 1; |
417 | } | ||
411 | } | 418 | } |
412 | 419 | ||
413 | return 0; | 420 | return 0; |
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c index f854d89b7edf..fa5a1474cd18 100644 --- a/arch/x86/kernel/amd_iommu.c +++ b/arch/x86/kernel/amd_iommu.c | |||
@@ -731,18 +731,22 @@ static bool increase_address_space(struct protection_domain *domain, | |||
731 | 731 | ||
732 | static u64 *alloc_pte(struct protection_domain *domain, | 732 | static u64 *alloc_pte(struct protection_domain *domain, |
733 | unsigned long address, | 733 | unsigned long address, |
734 | int end_lvl, | 734 | unsigned long page_size, |
735 | u64 **pte_page, | 735 | u64 **pte_page, |
736 | gfp_t gfp) | 736 | gfp_t gfp) |
737 | { | 737 | { |
738 | int level, end_lvl; | ||
738 | u64 *pte, *page; | 739 | u64 *pte, *page; |
739 | int level; | 740 | |
741 | BUG_ON(!is_power_of_2(page_size)); | ||
740 | 742 | ||
741 | while (address > PM_LEVEL_SIZE(domain->mode)) | 743 | while (address > PM_LEVEL_SIZE(domain->mode)) |
742 | increase_address_space(domain, gfp); | 744 | increase_address_space(domain, gfp); |
743 | 745 | ||
744 | level = domain->mode - 1; | 746 | level = domain->mode - 1; |
745 | pte = &domain->pt_root[PM_LEVEL_INDEX(level, address)]; | 747 | pte = &domain->pt_root[PM_LEVEL_INDEX(level, address)]; |
748 | address = PAGE_SIZE_ALIGN(address, page_size); | ||
749 | end_lvl = PAGE_SIZE_LEVEL(page_size); | ||
746 | 750 | ||
747 | while (level > end_lvl) { | 751 | while (level > end_lvl) { |
748 | if (!IOMMU_PTE_PRESENT(*pte)) { | 752 | if (!IOMMU_PTE_PRESENT(*pte)) { |
@@ -752,6 +756,10 @@ static u64 *alloc_pte(struct protection_domain *domain, | |||
752 | *pte = PM_LEVEL_PDE(level, virt_to_phys(page)); | 756 | *pte = PM_LEVEL_PDE(level, virt_to_phys(page)); |
753 | } | 757 | } |
754 | 758 | ||
759 | /* No level skipping support yet */ | ||
760 | if (PM_PTE_LEVEL(*pte) != level) | ||
761 | return NULL; | ||
762 | |||
755 | level -= 1; | 763 | level -= 1; |
756 | 764 | ||
757 | pte = IOMMU_PTE_PAGE(*pte); | 765 | pte = IOMMU_PTE_PAGE(*pte); |
@@ -769,28 +777,47 @@ static u64 *alloc_pte(struct protection_domain *domain, | |||
769 | * This function checks if there is a PTE for a given dma address. If | 777 | * This function checks if there is a PTE for a given dma address. If |
770 | * there is one, it returns the pointer to it. | 778 | * there is one, it returns the pointer to it. |
771 | */ | 779 | */ |
772 | static u64 *fetch_pte(struct protection_domain *domain, | 780 | static u64 *fetch_pte(struct protection_domain *domain, unsigned long address) |
773 | unsigned long address, int map_size) | ||
774 | { | 781 | { |
775 | int level; | 782 | int level; |
776 | u64 *pte; | 783 | u64 *pte; |
777 | 784 | ||
778 | level = domain->mode - 1; | 785 | if (address > PM_LEVEL_SIZE(domain->mode)) |
779 | pte = &domain->pt_root[PM_LEVEL_INDEX(level, address)]; | 786 | return NULL; |
787 | |||
788 | level = domain->mode - 1; | ||
789 | pte = &domain->pt_root[PM_LEVEL_INDEX(level, address)]; | ||
780 | 790 | ||
781 | while (level > map_size) { | 791 | while (level > 0) { |
792 | |||
793 | /* Not Present */ | ||
782 | if (!IOMMU_PTE_PRESENT(*pte)) | 794 | if (!IOMMU_PTE_PRESENT(*pte)) |
783 | return NULL; | 795 | return NULL; |
784 | 796 | ||
797 | /* Large PTE */ | ||
798 | if (PM_PTE_LEVEL(*pte) == 0x07) { | ||
799 | unsigned long pte_mask, __pte; | ||
800 | |||
801 | /* | ||
802 | * If we have a series of large PTEs, make | ||
803 | * sure to return a pointer to the first one. | ||
804 | */ | ||
805 | pte_mask = PTE_PAGE_SIZE(*pte); | ||
806 | pte_mask = ~((PAGE_SIZE_PTE_COUNT(pte_mask) << 3) - 1); | ||
807 | __pte = ((unsigned long)pte) & pte_mask; | ||
808 | |||
809 | return (u64 *)__pte; | ||
810 | } | ||
811 | |||
812 | /* No level skipping support yet */ | ||
813 | if (PM_PTE_LEVEL(*pte) != level) | ||
814 | return NULL; | ||
815 | |||
785 | level -= 1; | 816 | level -= 1; |
786 | 817 | ||
818 | /* Walk to the next level */ | ||
787 | pte = IOMMU_PTE_PAGE(*pte); | 819 | pte = IOMMU_PTE_PAGE(*pte); |
788 | pte = &pte[PM_LEVEL_INDEX(level, address)]; | 820 | pte = &pte[PM_LEVEL_INDEX(level, address)]; |
789 | |||
790 | if ((PM_PTE_LEVEL(*pte) == 0) && level != map_size) { | ||
791 | pte = NULL; | ||
792 | break; | ||
793 | } | ||
794 | } | 821 | } |
795 | 822 | ||
796 | return pte; | 823 | return pte; |
@@ -807,44 +834,84 @@ static int iommu_map_page(struct protection_domain *dom, | |||
807 | unsigned long bus_addr, | 834 | unsigned long bus_addr, |
808 | unsigned long phys_addr, | 835 | unsigned long phys_addr, |
809 | int prot, | 836 | int prot, |
810 | int map_size) | 837 | unsigned long page_size) |
811 | { | 838 | { |
812 | u64 __pte, *pte; | 839 | u64 __pte, *pte; |
813 | 840 | int i, count; | |
814 | bus_addr = PAGE_ALIGN(bus_addr); | ||
815 | phys_addr = PAGE_ALIGN(phys_addr); | ||
816 | |||
817 | BUG_ON(!PM_ALIGNED(map_size, bus_addr)); | ||
818 | BUG_ON(!PM_ALIGNED(map_size, phys_addr)); | ||
819 | 841 | ||
820 | if (!(prot & IOMMU_PROT_MASK)) | 842 | if (!(prot & IOMMU_PROT_MASK)) |
821 | return -EINVAL; | 843 | return -EINVAL; |
822 | 844 | ||
823 | pte = alloc_pte(dom, bus_addr, map_size, NULL, GFP_KERNEL); | 845 | bus_addr = PAGE_ALIGN(bus_addr); |
846 | phys_addr = PAGE_ALIGN(phys_addr); | ||
847 | count = PAGE_SIZE_PTE_COUNT(page_size); | ||
848 | pte = alloc_pte(dom, bus_addr, page_size, NULL, GFP_KERNEL); | ||
849 | |||
850 | for (i = 0; i < count; ++i) | ||
851 | if (IOMMU_PTE_PRESENT(pte[i])) | ||
852 | return -EBUSY; | ||
824 | 853 | ||
825 | if (IOMMU_PTE_PRESENT(*pte)) | 854 | if (page_size > PAGE_SIZE) { |
826 | return -EBUSY; | 855 | __pte = PAGE_SIZE_PTE(phys_addr, page_size); |
856 | __pte |= PM_LEVEL_ENC(7) | IOMMU_PTE_P | IOMMU_PTE_FC; | ||
857 | } else | ||
858 | __pte = phys_addr | IOMMU_PTE_P | IOMMU_PTE_FC; | ||
827 | 859 | ||
828 | __pte = phys_addr | IOMMU_PTE_P; | ||
829 | if (prot & IOMMU_PROT_IR) | 860 | if (prot & IOMMU_PROT_IR) |
830 | __pte |= IOMMU_PTE_IR; | 861 | __pte |= IOMMU_PTE_IR; |
831 | if (prot & IOMMU_PROT_IW) | 862 | if (prot & IOMMU_PROT_IW) |
832 | __pte |= IOMMU_PTE_IW; | 863 | __pte |= IOMMU_PTE_IW; |
833 | 864 | ||
834 | *pte = __pte; | 865 | for (i = 0; i < count; ++i) |
866 | pte[i] = __pte; | ||
835 | 867 | ||
836 | update_domain(dom); | 868 | update_domain(dom); |
837 | 869 | ||
838 | return 0; | 870 | return 0; |
839 | } | 871 | } |
840 | 872 | ||
841 | static void iommu_unmap_page(struct protection_domain *dom, | 873 | static unsigned long iommu_unmap_page(struct protection_domain *dom, |
842 | unsigned long bus_addr, int map_size) | 874 | unsigned long bus_addr, |
875 | unsigned long page_size) | ||
843 | { | 876 | { |
844 | u64 *pte = fetch_pte(dom, bus_addr, map_size); | 877 | unsigned long long unmap_size, unmapped; |
878 | u64 *pte; | ||
879 | |||
880 | BUG_ON(!is_power_of_2(page_size)); | ||
881 | |||
882 | unmapped = 0; | ||
845 | 883 | ||
846 | if (pte) | 884 | while (unmapped < page_size) { |
847 | *pte = 0; | 885 | |
886 | pte = fetch_pte(dom, bus_addr); | ||
887 | |||
888 | if (!pte) { | ||
889 | /* | ||
890 | * No PTE for this address | ||
891 | * move forward in 4kb steps | ||
892 | */ | ||
893 | unmap_size = PAGE_SIZE; | ||
894 | } else if (PM_PTE_LEVEL(*pte) == 0) { | ||
895 | /* 4kb PTE found for this address */ | ||
896 | unmap_size = PAGE_SIZE; | ||
897 | *pte = 0ULL; | ||
898 | } else { | ||
899 | int count, i; | ||
900 | |||
901 | /* Large PTE found which maps this address */ | ||
902 | unmap_size = PTE_PAGE_SIZE(*pte); | ||
903 | count = PAGE_SIZE_PTE_COUNT(unmap_size); | ||
904 | for (i = 0; i < count; i++) | ||
905 | pte[i] = 0ULL; | ||
906 | } | ||
907 | |||
908 | bus_addr = (bus_addr & ~(unmap_size - 1)) + unmap_size; | ||
909 | unmapped += unmap_size; | ||
910 | } | ||
911 | |||
912 | BUG_ON(!is_power_of_2(unmapped)); | ||
913 | |||
914 | return unmapped; | ||
848 | } | 915 | } |
849 | 916 | ||
850 | /* | 917 | /* |
@@ -878,7 +945,7 @@ static int dma_ops_unity_map(struct dma_ops_domain *dma_dom, | |||
878 | for (addr = e->address_start; addr < e->address_end; | 945 | for (addr = e->address_start; addr < e->address_end; |
879 | addr += PAGE_SIZE) { | 946 | addr += PAGE_SIZE) { |
880 | ret = iommu_map_page(&dma_dom->domain, addr, addr, e->prot, | 947 | ret = iommu_map_page(&dma_dom->domain, addr, addr, e->prot, |
881 | PM_MAP_4k); | 948 | PAGE_SIZE); |
882 | if (ret) | 949 | if (ret) |
883 | return ret; | 950 | return ret; |
884 | /* | 951 | /* |
@@ -1006,7 +1073,7 @@ static int alloc_new_range(struct dma_ops_domain *dma_dom, | |||
1006 | u64 *pte, *pte_page; | 1073 | u64 *pte, *pte_page; |
1007 | 1074 | ||
1008 | for (i = 0; i < num_ptes; ++i) { | 1075 | for (i = 0; i < num_ptes; ++i) { |
1009 | pte = alloc_pte(&dma_dom->domain, address, PM_MAP_4k, | 1076 | pte = alloc_pte(&dma_dom->domain, address, PAGE_SIZE, |
1010 | &pte_page, gfp); | 1077 | &pte_page, gfp); |
1011 | if (!pte) | 1078 | if (!pte) |
1012 | goto out_free; | 1079 | goto out_free; |
@@ -1042,7 +1109,7 @@ static int alloc_new_range(struct dma_ops_domain *dma_dom, | |||
1042 | for (i = dma_dom->aperture[index]->offset; | 1109 | for (i = dma_dom->aperture[index]->offset; |
1043 | i < dma_dom->aperture_size; | 1110 | i < dma_dom->aperture_size; |
1044 | i += PAGE_SIZE) { | 1111 | i += PAGE_SIZE) { |
1045 | u64 *pte = fetch_pte(&dma_dom->domain, i, PM_MAP_4k); | 1112 | u64 *pte = fetch_pte(&dma_dom->domain, i); |
1046 | if (!pte || !IOMMU_PTE_PRESENT(*pte)) | 1113 | if (!pte || !IOMMU_PTE_PRESENT(*pte)) |
1047 | continue; | 1114 | continue; |
1048 | 1115 | ||
@@ -1712,7 +1779,7 @@ static u64* dma_ops_get_pte(struct dma_ops_domain *dom, | |||
1712 | 1779 | ||
1713 | pte = aperture->pte_pages[APERTURE_PAGE_INDEX(address)]; | 1780 | pte = aperture->pte_pages[APERTURE_PAGE_INDEX(address)]; |
1714 | if (!pte) { | 1781 | if (!pte) { |
1715 | pte = alloc_pte(&dom->domain, address, PM_MAP_4k, &pte_page, | 1782 | pte = alloc_pte(&dom->domain, address, PAGE_SIZE, &pte_page, |
1716 | GFP_ATOMIC); | 1783 | GFP_ATOMIC); |
1717 | aperture->pte_pages[APERTURE_PAGE_INDEX(address)] = pte_page; | 1784 | aperture->pte_pages[APERTURE_PAGE_INDEX(address)] = pte_page; |
1718 | } else | 1785 | } else |
@@ -2439,12 +2506,11 @@ static int amd_iommu_attach_device(struct iommu_domain *dom, | |||
2439 | return ret; | 2506 | return ret; |
2440 | } | 2507 | } |
2441 | 2508 | ||
2442 | static int amd_iommu_map_range(struct iommu_domain *dom, | 2509 | static int amd_iommu_map(struct iommu_domain *dom, unsigned long iova, |
2443 | unsigned long iova, phys_addr_t paddr, | 2510 | phys_addr_t paddr, int gfp_order, int iommu_prot) |
2444 | size_t size, int iommu_prot) | ||
2445 | { | 2511 | { |
2512 | unsigned long page_size = 0x1000UL << gfp_order; | ||
2446 | struct protection_domain *domain = dom->priv; | 2513 | struct protection_domain *domain = dom->priv; |
2447 | unsigned long i, npages = iommu_num_pages(paddr, size, PAGE_SIZE); | ||
2448 | int prot = 0; | 2514 | int prot = 0; |
2449 | int ret; | 2515 | int ret; |
2450 | 2516 | ||
@@ -2453,61 +2519,50 @@ static int amd_iommu_map_range(struct iommu_domain *dom, | |||
2453 | if (iommu_prot & IOMMU_WRITE) | 2519 | if (iommu_prot & IOMMU_WRITE) |
2454 | prot |= IOMMU_PROT_IW; | 2520 | prot |= IOMMU_PROT_IW; |
2455 | 2521 | ||
2456 | iova &= PAGE_MASK; | ||
2457 | paddr &= PAGE_MASK; | ||
2458 | |||
2459 | mutex_lock(&domain->api_lock); | 2522 | mutex_lock(&domain->api_lock); |
2460 | 2523 | ret = iommu_map_page(domain, iova, paddr, prot, page_size); | |
2461 | for (i = 0; i < npages; ++i) { | ||
2462 | ret = iommu_map_page(domain, iova, paddr, prot, PM_MAP_4k); | ||
2463 | if (ret) | ||
2464 | return ret; | ||
2465 | |||
2466 | iova += PAGE_SIZE; | ||
2467 | paddr += PAGE_SIZE; | ||
2468 | } | ||
2469 | |||
2470 | mutex_unlock(&domain->api_lock); | 2524 | mutex_unlock(&domain->api_lock); |
2471 | 2525 | ||
2472 | return 0; | 2526 | return ret; |
2473 | } | 2527 | } |
2474 | 2528 | ||
2475 | static void amd_iommu_unmap_range(struct iommu_domain *dom, | 2529 | static int amd_iommu_unmap(struct iommu_domain *dom, unsigned long iova, |
2476 | unsigned long iova, size_t size) | 2530 | int gfp_order) |
2477 | { | 2531 | { |
2478 | |||
2479 | struct protection_domain *domain = dom->priv; | 2532 | struct protection_domain *domain = dom->priv; |
2480 | unsigned long i, npages = iommu_num_pages(iova, size, PAGE_SIZE); | 2533 | unsigned long page_size, unmap_size; |
2481 | 2534 | ||
2482 | iova &= PAGE_MASK; | 2535 | page_size = 0x1000UL << gfp_order; |
2483 | 2536 | ||
2484 | mutex_lock(&domain->api_lock); | 2537 | mutex_lock(&domain->api_lock); |
2485 | 2538 | unmap_size = iommu_unmap_page(domain, iova, page_size); | |
2486 | for (i = 0; i < npages; ++i) { | 2539 | mutex_unlock(&domain->api_lock); |
2487 | iommu_unmap_page(domain, iova, PM_MAP_4k); | ||
2488 | iova += PAGE_SIZE; | ||
2489 | } | ||
2490 | 2540 | ||
2491 | iommu_flush_tlb_pde(domain); | 2541 | iommu_flush_tlb_pde(domain); |
2492 | 2542 | ||
2493 | mutex_unlock(&domain->api_lock); | 2543 | return get_order(unmap_size); |
2494 | } | 2544 | } |
2495 | 2545 | ||
2496 | static phys_addr_t amd_iommu_iova_to_phys(struct iommu_domain *dom, | 2546 | static phys_addr_t amd_iommu_iova_to_phys(struct iommu_domain *dom, |
2497 | unsigned long iova) | 2547 | unsigned long iova) |
2498 | { | 2548 | { |
2499 | struct protection_domain *domain = dom->priv; | 2549 | struct protection_domain *domain = dom->priv; |
2500 | unsigned long offset = iova & ~PAGE_MASK; | 2550 | unsigned long offset_mask; |
2501 | phys_addr_t paddr; | 2551 | phys_addr_t paddr; |
2502 | u64 *pte; | 2552 | u64 *pte, __pte; |
2503 | 2553 | ||
2504 | pte = fetch_pte(domain, iova, PM_MAP_4k); | 2554 | pte = fetch_pte(domain, iova); |
2505 | 2555 | ||
2506 | if (!pte || !IOMMU_PTE_PRESENT(*pte)) | 2556 | if (!pte || !IOMMU_PTE_PRESENT(*pte)) |
2507 | return 0; | 2557 | return 0; |
2508 | 2558 | ||
2509 | paddr = *pte & IOMMU_PAGE_MASK; | 2559 | if (PM_PTE_LEVEL(*pte) == 0) |
2510 | paddr |= offset; | 2560 | offset_mask = PAGE_SIZE - 1; |
2561 | else | ||
2562 | offset_mask = PTE_PAGE_SIZE(*pte) - 1; | ||
2563 | |||
2564 | __pte = *pte & PM_ADDR_MASK; | ||
2565 | paddr = (__pte & ~offset_mask) | (iova & offset_mask); | ||
2511 | 2566 | ||
2512 | return paddr; | 2567 | return paddr; |
2513 | } | 2568 | } |
@@ -2523,8 +2578,8 @@ static struct iommu_ops amd_iommu_ops = { | |||
2523 | .domain_destroy = amd_iommu_domain_destroy, | 2578 | .domain_destroy = amd_iommu_domain_destroy, |
2524 | .attach_dev = amd_iommu_attach_device, | 2579 | .attach_dev = amd_iommu_attach_device, |
2525 | .detach_dev = amd_iommu_detach_device, | 2580 | .detach_dev = amd_iommu_detach_device, |
2526 | .map = amd_iommu_map_range, | 2581 | .map = amd_iommu_map, |
2527 | .unmap = amd_iommu_unmap_range, | 2582 | .unmap = amd_iommu_unmap, |
2528 | .iova_to_phys = amd_iommu_iova_to_phys, | 2583 | .iova_to_phys = amd_iommu_iova_to_phys, |
2529 | .domain_has_cap = amd_iommu_domain_has_cap, | 2584 | .domain_has_cap = amd_iommu_domain_has_cap, |
2530 | }; | 2585 | }; |
diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c index 6360abf993d4..3bacb4d0844c 100644 --- a/arch/x86/kernel/amd_iommu_init.c +++ b/arch/x86/kernel/amd_iommu_init.c | |||
@@ -120,6 +120,7 @@ struct ivmd_header { | |||
120 | bool amd_iommu_dump; | 120 | bool amd_iommu_dump; |
121 | 121 | ||
122 | static int __initdata amd_iommu_detected; | 122 | static int __initdata amd_iommu_detected; |
123 | static bool __initdata amd_iommu_disabled; | ||
123 | 124 | ||
124 | u16 amd_iommu_last_bdf; /* largest PCI device id we have | 125 | u16 amd_iommu_last_bdf; /* largest PCI device id we have |
125 | to handle */ | 126 | to handle */ |
@@ -1372,6 +1373,9 @@ void __init amd_iommu_detect(void) | |||
1372 | if (no_iommu || (iommu_detected && !gart_iommu_aperture)) | 1373 | if (no_iommu || (iommu_detected && !gart_iommu_aperture)) |
1373 | return; | 1374 | return; |
1374 | 1375 | ||
1376 | if (amd_iommu_disabled) | ||
1377 | return; | ||
1378 | |||
1375 | if (acpi_table_parse("IVRS", early_amd_iommu_detect) == 0) { | 1379 | if (acpi_table_parse("IVRS", early_amd_iommu_detect) == 0) { |
1376 | iommu_detected = 1; | 1380 | iommu_detected = 1; |
1377 | amd_iommu_detected = 1; | 1381 | amd_iommu_detected = 1; |
@@ -1401,6 +1405,8 @@ static int __init parse_amd_iommu_options(char *str) | |||
1401 | for (; *str; ++str) { | 1405 | for (; *str; ++str) { |
1402 | if (strncmp(str, "fullflush", 9) == 0) | 1406 | if (strncmp(str, "fullflush", 9) == 0) |
1403 | amd_iommu_unmap_flush = true; | 1407 | amd_iommu_unmap_flush = true; |
1408 | if (strncmp(str, "off", 3) == 0) | ||
1409 | amd_iommu_disabled = true; | ||
1404 | } | 1410 | } |
1405 | 1411 | ||
1406 | return 1; | 1412 | return 1; |
diff --git a/arch/x86/kernel/apic/es7000_32.c b/arch/x86/kernel/apic/es7000_32.c index 03ba1b895f5e..425e53a87feb 100644 --- a/arch/x86/kernel/apic/es7000_32.c +++ b/arch/x86/kernel/apic/es7000_32.c | |||
@@ -131,24 +131,6 @@ int es7000_plat; | |||
131 | 131 | ||
132 | static unsigned int base; | 132 | static unsigned int base; |
133 | 133 | ||
134 | static int | ||
135 | es7000_rename_gsi(int ioapic, int gsi) | ||
136 | { | ||
137 | if (es7000_plat == ES7000_ZORRO) | ||
138 | return gsi; | ||
139 | |||
140 | if (!base) { | ||
141 | int i; | ||
142 | for (i = 0; i < nr_ioapics; i++) | ||
143 | base += nr_ioapic_registers[i]; | ||
144 | } | ||
145 | |||
146 | if (!ioapic && (gsi < 16)) | ||
147 | gsi += base; | ||
148 | |||
149 | return gsi; | ||
150 | } | ||
151 | |||
152 | static int __cpuinit wakeup_secondary_cpu_via_mip(int cpu, unsigned long eip) | 134 | static int __cpuinit wakeup_secondary_cpu_via_mip(int cpu, unsigned long eip) |
153 | { | 135 | { |
154 | unsigned long vect = 0, psaival = 0; | 136 | unsigned long vect = 0, psaival = 0; |
@@ -190,7 +172,6 @@ static void setup_unisys(void) | |||
190 | es7000_plat = ES7000_ZORRO; | 172 | es7000_plat = ES7000_ZORRO; |
191 | else | 173 | else |
192 | es7000_plat = ES7000_CLASSIC; | 174 | es7000_plat = ES7000_CLASSIC; |
193 | ioapic_renumber_irq = es7000_rename_gsi; | ||
194 | } | 175 | } |
195 | 176 | ||
196 | /* | 177 | /* |
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index eb2789c3f721..33f3563a2a52 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c | |||
@@ -89,6 +89,9 @@ int nr_ioapics; | |||
89 | /* IO APIC gsi routing info */ | 89 | /* IO APIC gsi routing info */ |
90 | struct mp_ioapic_gsi mp_gsi_routing[MAX_IO_APICS]; | 90 | struct mp_ioapic_gsi mp_gsi_routing[MAX_IO_APICS]; |
91 | 91 | ||
92 | /* The last gsi number used */ | ||
93 | u32 gsi_end; | ||
94 | |||
92 | /* MP IRQ source entries */ | 95 | /* MP IRQ source entries */ |
93 | struct mpc_intsrc mp_irqs[MAX_IRQ_SOURCES]; | 96 | struct mpc_intsrc mp_irqs[MAX_IRQ_SOURCES]; |
94 | 97 | ||
@@ -1013,10 +1016,9 @@ static inline int irq_trigger(int idx) | |||
1013 | return MPBIOS_trigger(idx); | 1016 | return MPBIOS_trigger(idx); |
1014 | } | 1017 | } |
1015 | 1018 | ||
1016 | int (*ioapic_renumber_irq)(int ioapic, int irq); | ||
1017 | static int pin_2_irq(int idx, int apic, int pin) | 1019 | static int pin_2_irq(int idx, int apic, int pin) |
1018 | { | 1020 | { |
1019 | int irq, i; | 1021 | int irq; |
1020 | int bus = mp_irqs[idx].srcbus; | 1022 | int bus = mp_irqs[idx].srcbus; |
1021 | 1023 | ||
1022 | /* | 1024 | /* |
@@ -1028,18 +1030,12 @@ static int pin_2_irq(int idx, int apic, int pin) | |||
1028 | if (test_bit(bus, mp_bus_not_pci)) { | 1030 | if (test_bit(bus, mp_bus_not_pci)) { |
1029 | irq = mp_irqs[idx].srcbusirq; | 1031 | irq = mp_irqs[idx].srcbusirq; |
1030 | } else { | 1032 | } else { |
1031 | /* | 1033 | u32 gsi = mp_gsi_routing[apic].gsi_base + pin; |
1032 | * PCI IRQs are mapped in order | 1034 | |
1033 | */ | 1035 | if (gsi >= NR_IRQS_LEGACY) |
1034 | i = irq = 0; | 1036 | irq = gsi; |
1035 | while (i < apic) | 1037 | else |
1036 | irq += nr_ioapic_registers[i++]; | 1038 | irq = gsi_end + 1 + gsi; |
1037 | irq += pin; | ||
1038 | /* | ||
1039 | * For MPS mode, so far only needed by ES7000 platform | ||
1040 | */ | ||
1041 | if (ioapic_renumber_irq) | ||
1042 | irq = ioapic_renumber_irq(apic, irq); | ||
1043 | } | 1039 | } |
1044 | 1040 | ||
1045 | #ifdef CONFIG_X86_32 | 1041 | #ifdef CONFIG_X86_32 |
@@ -1950,20 +1946,8 @@ static struct { int pin, apic; } ioapic_i8259 = { -1, -1 }; | |||
1950 | 1946 | ||
1951 | void __init enable_IO_APIC(void) | 1947 | void __init enable_IO_APIC(void) |
1952 | { | 1948 | { |
1953 | union IO_APIC_reg_01 reg_01; | ||
1954 | int i8259_apic, i8259_pin; | 1949 | int i8259_apic, i8259_pin; |
1955 | int apic; | 1950 | int apic; |
1956 | unsigned long flags; | ||
1957 | |||
1958 | /* | ||
1959 | * The number of IO-APIC IRQ registers (== #pins): | ||
1960 | */ | ||
1961 | for (apic = 0; apic < nr_ioapics; apic++) { | ||
1962 | raw_spin_lock_irqsave(&ioapic_lock, flags); | ||
1963 | reg_01.raw = io_apic_read(apic, 1); | ||
1964 | raw_spin_unlock_irqrestore(&ioapic_lock, flags); | ||
1965 | nr_ioapic_registers[apic] = reg_01.bits.entries+1; | ||
1966 | } | ||
1967 | 1951 | ||
1968 | if (!legacy_pic->nr_legacy_irqs) | 1952 | if (!legacy_pic->nr_legacy_irqs) |
1969 | return; | 1953 | return; |
@@ -3858,27 +3842,20 @@ int __init io_apic_get_redir_entries (int ioapic) | |||
3858 | reg_01.raw = io_apic_read(ioapic, 1); | 3842 | reg_01.raw = io_apic_read(ioapic, 1); |
3859 | raw_spin_unlock_irqrestore(&ioapic_lock, flags); | 3843 | raw_spin_unlock_irqrestore(&ioapic_lock, flags); |
3860 | 3844 | ||
3861 | return reg_01.bits.entries; | 3845 | /* The register returns the maximum index redir index |
3846 | * supported, which is one less than the total number of redir | ||
3847 | * entries. | ||
3848 | */ | ||
3849 | return reg_01.bits.entries + 1; | ||
3862 | } | 3850 | } |
3863 | 3851 | ||
3864 | void __init probe_nr_irqs_gsi(void) | 3852 | void __init probe_nr_irqs_gsi(void) |
3865 | { | 3853 | { |
3866 | int nr = 0; | 3854 | int nr; |
3867 | 3855 | ||
3868 | nr = acpi_probe_gsi(); | 3856 | nr = gsi_end + 1 + NR_IRQS_LEGACY; |
3869 | if (nr > nr_irqs_gsi) { | 3857 | if (nr > nr_irqs_gsi) |
3870 | nr_irqs_gsi = nr; | 3858 | nr_irqs_gsi = nr; |
3871 | } else { | ||
3872 | /* for acpi=off or acpi is not compiled in */ | ||
3873 | int idx; | ||
3874 | |||
3875 | nr = 0; | ||
3876 | for (idx = 0; idx < nr_ioapics; idx++) | ||
3877 | nr += io_apic_get_redir_entries(idx) + 1; | ||
3878 | |||
3879 | if (nr > nr_irqs_gsi) | ||
3880 | nr_irqs_gsi = nr; | ||
3881 | } | ||
3882 | 3859 | ||
3883 | printk(KERN_DEBUG "nr_irqs_gsi: %d\n", nr_irqs_gsi); | 3860 | printk(KERN_DEBUG "nr_irqs_gsi: %d\n", nr_irqs_gsi); |
3884 | } | 3861 | } |
@@ -4085,22 +4062,27 @@ int __init io_apic_get_version(int ioapic) | |||
4085 | return reg_01.bits.version; | 4062 | return reg_01.bits.version; |
4086 | } | 4063 | } |
4087 | 4064 | ||
4088 | int acpi_get_override_irq(int bus_irq, int *trigger, int *polarity) | 4065 | int acpi_get_override_irq(u32 gsi, int *trigger, int *polarity) |
4089 | { | 4066 | { |
4090 | int i; | 4067 | int ioapic, pin, idx; |
4091 | 4068 | ||
4092 | if (skip_ioapic_setup) | 4069 | if (skip_ioapic_setup) |
4093 | return -1; | 4070 | return -1; |
4094 | 4071 | ||
4095 | for (i = 0; i < mp_irq_entries; i++) | 4072 | ioapic = mp_find_ioapic(gsi); |
4096 | if (mp_irqs[i].irqtype == mp_INT && | 4073 | if (ioapic < 0) |
4097 | mp_irqs[i].srcbusirq == bus_irq) | ||
4098 | break; | ||
4099 | if (i >= mp_irq_entries) | ||
4100 | return -1; | 4074 | return -1; |
4101 | 4075 | ||
4102 | *trigger = irq_trigger(i); | 4076 | pin = mp_find_ioapic_pin(ioapic, gsi); |
4103 | *polarity = irq_polarity(i); | 4077 | if (pin < 0) |
4078 | return -1; | ||
4079 | |||
4080 | idx = find_irq_entry(ioapic, pin, mp_INT); | ||
4081 | if (idx < 0) | ||
4082 | return -1; | ||
4083 | |||
4084 | *trigger = irq_trigger(idx); | ||
4085 | *polarity = irq_polarity(idx); | ||
4104 | return 0; | 4086 | return 0; |
4105 | } | 4087 | } |
4106 | 4088 | ||
@@ -4241,7 +4223,7 @@ void __init ioapic_insert_resources(void) | |||
4241 | } | 4223 | } |
4242 | } | 4224 | } |
4243 | 4225 | ||
4244 | int mp_find_ioapic(int gsi) | 4226 | int mp_find_ioapic(u32 gsi) |
4245 | { | 4227 | { |
4246 | int i = 0; | 4228 | int i = 0; |
4247 | 4229 | ||
@@ -4256,7 +4238,7 @@ int mp_find_ioapic(int gsi) | |||
4256 | return -1; | 4238 | return -1; |
4257 | } | 4239 | } |
4258 | 4240 | ||
4259 | int mp_find_ioapic_pin(int ioapic, int gsi) | 4241 | int mp_find_ioapic_pin(int ioapic, u32 gsi) |
4260 | { | 4242 | { |
4261 | if (WARN_ON(ioapic == -1)) | 4243 | if (WARN_ON(ioapic == -1)) |
4262 | return -1; | 4244 | return -1; |
@@ -4284,6 +4266,7 @@ static int bad_ioapic(unsigned long address) | |||
4284 | void __init mp_register_ioapic(int id, u32 address, u32 gsi_base) | 4266 | void __init mp_register_ioapic(int id, u32 address, u32 gsi_base) |
4285 | { | 4267 | { |
4286 | int idx = 0; | 4268 | int idx = 0; |
4269 | int entries; | ||
4287 | 4270 | ||
4288 | if (bad_ioapic(address)) | 4271 | if (bad_ioapic(address)) |
4289 | return; | 4272 | return; |
@@ -4302,9 +4285,17 @@ void __init mp_register_ioapic(int id, u32 address, u32 gsi_base) | |||
4302 | * Build basic GSI lookup table to facilitate gsi->io_apic lookups | 4285 | * Build basic GSI lookup table to facilitate gsi->io_apic lookups |
4303 | * and to prevent reprogramming of IOAPIC pins (PCI GSIs). | 4286 | * and to prevent reprogramming of IOAPIC pins (PCI GSIs). |
4304 | */ | 4287 | */ |
4288 | entries = io_apic_get_redir_entries(idx); | ||
4305 | mp_gsi_routing[idx].gsi_base = gsi_base; | 4289 | mp_gsi_routing[idx].gsi_base = gsi_base; |
4306 | mp_gsi_routing[idx].gsi_end = gsi_base + | 4290 | mp_gsi_routing[idx].gsi_end = gsi_base + entries - 1; |
4307 | io_apic_get_redir_entries(idx); | 4291 | |
4292 | /* | ||
4293 | * The number of IO-APIC IRQ registers (== #pins): | ||
4294 | */ | ||
4295 | nr_ioapic_registers[idx] = entries; | ||
4296 | |||
4297 | if (mp_gsi_routing[idx].gsi_end > gsi_end) | ||
4298 | gsi_end = mp_gsi_routing[idx].gsi_end; | ||
4308 | 4299 | ||
4309 | printk(KERN_INFO "IOAPIC[%d]: apic_id %d, version %d, address 0x%x, " | 4300 | printk(KERN_INFO "IOAPIC[%d]: apic_id %d, version %d, address 0x%x, " |
4310 | "GSI %d-%d\n", idx, mp_ioapics[idx].apicid, | 4301 | "GSI %d-%d\n", idx, mp_ioapics[idx].apicid, |
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c index c085d52dbaf2..e46f98f36e31 100644 --- a/arch/x86/kernel/apic/x2apic_uv_x.c +++ b/arch/x86/kernel/apic/x2apic_uv_x.c | |||
@@ -735,9 +735,6 @@ void __init uv_system_init(void) | |||
735 | uv_node_to_blade[nid] = blade; | 735 | uv_node_to_blade[nid] = blade; |
736 | uv_cpu_to_blade[cpu] = blade; | 736 | uv_cpu_to_blade[cpu] = blade; |
737 | max_pnode = max(pnode, max_pnode); | 737 | max_pnode = max(pnode, max_pnode); |
738 | |||
739 | printk(KERN_DEBUG "UV: cpu %d, apicid 0x%x, pnode %d, nid %d, lcpu %d, blade %d\n", | ||
740 | cpu, apicid, pnode, nid, lcpu, blade); | ||
741 | } | 738 | } |
742 | 739 | ||
743 | /* Add blade/pnode info for nodes without cpus */ | 740 | /* Add blade/pnode info for nodes without cpus */ |
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c index 031aa887b0eb..c4f9182ca3ac 100644 --- a/arch/x86/kernel/apm_32.c +++ b/arch/x86/kernel/apm_32.c | |||
@@ -1224,7 +1224,7 @@ static void reinit_timer(void) | |||
1224 | #ifdef INIT_TIMER_AFTER_SUSPEND | 1224 | #ifdef INIT_TIMER_AFTER_SUSPEND |
1225 | unsigned long flags; | 1225 | unsigned long flags; |
1226 | 1226 | ||
1227 | spin_lock_irqsave(&i8253_lock, flags); | 1227 | raw_spin_lock_irqsave(&i8253_lock, flags); |
1228 | /* set the clock to HZ */ | 1228 | /* set the clock to HZ */ |
1229 | outb_pit(0x34, PIT_MODE); /* binary, mode 2, LSB/MSB, ch 0 */ | 1229 | outb_pit(0x34, PIT_MODE); /* binary, mode 2, LSB/MSB, ch 0 */ |
1230 | udelay(10); | 1230 | udelay(10); |
@@ -1232,7 +1232,7 @@ static void reinit_timer(void) | |||
1232 | udelay(10); | 1232 | udelay(10); |
1233 | outb_pit(LATCH >> 8, PIT_CH0); /* MSB */ | 1233 | outb_pit(LATCH >> 8, PIT_CH0); /* MSB */ |
1234 | udelay(10); | 1234 | udelay(10); |
1235 | spin_unlock_irqrestore(&i8253_lock, flags); | 1235 | raw_spin_unlock_irqrestore(&i8253_lock, flags); |
1236 | #endif | 1236 | #endif |
1237 | } | 1237 | } |
1238 | 1238 | ||
diff --git a/arch/x86/kernel/cpu/Makefile b/arch/x86/kernel/cpu/Makefile index c202b62f3671..3a785da34b6f 100644 --- a/arch/x86/kernel/cpu/Makefile +++ b/arch/x86/kernel/cpu/Makefile | |||
@@ -14,7 +14,7 @@ CFLAGS_common.o := $(nostackp) | |||
14 | 14 | ||
15 | obj-y := intel_cacheinfo.o addon_cpuid_features.o | 15 | obj-y := intel_cacheinfo.o addon_cpuid_features.o |
16 | obj-y += proc.o capflags.o powerflags.o common.o | 16 | obj-y += proc.o capflags.o powerflags.o common.o |
17 | obj-y += vmware.o hypervisor.o sched.o | 17 | obj-y += vmware.o hypervisor.o sched.o mshyperv.o |
18 | 18 | ||
19 | obj-$(CONFIG_X86_32) += bugs.o cmpxchg.o | 19 | obj-$(CONFIG_X86_32) += bugs.o cmpxchg.o |
20 | obj-$(CONFIG_X86_64) += bugs_64.o | 20 | obj-$(CONFIG_X86_64) += bugs_64.o |
diff --git a/arch/x86/kernel/cpu/addon_cpuid_features.c b/arch/x86/kernel/cpu/addon_cpuid_features.c index 97ad79cdf688..10fa5684a662 100644 --- a/arch/x86/kernel/cpu/addon_cpuid_features.c +++ b/arch/x86/kernel/cpu/addon_cpuid_features.c | |||
@@ -30,12 +30,14 @@ void __cpuinit init_scattered_cpuid_features(struct cpuinfo_x86 *c) | |||
30 | const struct cpuid_bit *cb; | 30 | const struct cpuid_bit *cb; |
31 | 31 | ||
32 | static const struct cpuid_bit __cpuinitconst cpuid_bits[] = { | 32 | static const struct cpuid_bit __cpuinitconst cpuid_bits[] = { |
33 | { X86_FEATURE_IDA, CR_EAX, 1, 0x00000006 }, | 33 | { X86_FEATURE_IDA, CR_EAX, 1, 0x00000006 }, |
34 | { X86_FEATURE_ARAT, CR_EAX, 2, 0x00000006 }, | 34 | { X86_FEATURE_ARAT, CR_EAX, 2, 0x00000006 }, |
35 | { X86_FEATURE_NPT, CR_EDX, 0, 0x8000000a }, | 35 | { X86_FEATURE_APERFMPERF, CR_ECX, 0, 0x00000006 }, |
36 | { X86_FEATURE_LBRV, CR_EDX, 1, 0x8000000a }, | 36 | { X86_FEATURE_CPB, CR_EDX, 9, 0x80000007 }, |
37 | { X86_FEATURE_SVML, CR_EDX, 2, 0x8000000a }, | 37 | { X86_FEATURE_NPT, CR_EDX, 0, 0x8000000a }, |
38 | { X86_FEATURE_NRIPS, CR_EDX, 3, 0x8000000a }, | 38 | { X86_FEATURE_LBRV, CR_EDX, 1, 0x8000000a }, |
39 | { X86_FEATURE_SVML, CR_EDX, 2, 0x8000000a }, | ||
40 | { X86_FEATURE_NRIPS, CR_EDX, 3, 0x8000000a }, | ||
39 | { 0, 0, 0, 0 } | 41 | { 0, 0, 0, 0 } |
40 | }; | 42 | }; |
41 | 43 | ||
diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index 01a265212395..c39576cb3018 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c | |||
@@ -86,7 +86,7 @@ static void __init check_fpu(void) | |||
86 | 86 | ||
87 | static void __init check_hlt(void) | 87 | static void __init check_hlt(void) |
88 | { | 88 | { |
89 | if (paravirt_enabled()) | 89 | if (boot_cpu_data.x86 >= 5 || paravirt_enabled()) |
90 | return; | 90 | return; |
91 | 91 | ||
92 | printk(KERN_INFO "Checking 'hlt' instruction... "); | 92 | printk(KERN_INFO "Checking 'hlt' instruction... "); |
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 4868e4a951ee..c1c00d0b1692 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c | |||
@@ -1243,10 +1243,7 @@ void __cpuinit cpu_init(void) | |||
1243 | /* | 1243 | /* |
1244 | * Force FPU initialization: | 1244 | * Force FPU initialization: |
1245 | */ | 1245 | */ |
1246 | if (cpu_has_xsave) | 1246 | current_thread_info()->status = 0; |
1247 | current_thread_info()->status = TS_XSAVE; | ||
1248 | else | ||
1249 | current_thread_info()->status = 0; | ||
1250 | clear_used_math(); | 1247 | clear_used_math(); |
1251 | mxcsr_feature_mask_init(); | 1248 | mxcsr_feature_mask_init(); |
1252 | 1249 | ||
diff --git a/arch/x86/kernel/cpu/cpufreq/Makefile b/arch/x86/kernel/cpu/cpufreq/Makefile index 1840c0a5170b..bd54bf67e6fb 100644 --- a/arch/x86/kernel/cpu/cpufreq/Makefile +++ b/arch/x86/kernel/cpu/cpufreq/Makefile | |||
@@ -2,8 +2,8 @@ | |||
2 | # K8 systems. ACPI is preferred to all other hardware-specific drivers. | 2 | # K8 systems. ACPI is preferred to all other hardware-specific drivers. |
3 | # speedstep-* is preferred over p4-clockmod. | 3 | # speedstep-* is preferred over p4-clockmod. |
4 | 4 | ||
5 | obj-$(CONFIG_X86_POWERNOW_K8) += powernow-k8.o | 5 | obj-$(CONFIG_X86_POWERNOW_K8) += powernow-k8.o mperf.o |
6 | obj-$(CONFIG_X86_ACPI_CPUFREQ) += acpi-cpufreq.o | 6 | obj-$(CONFIG_X86_ACPI_CPUFREQ) += acpi-cpufreq.o mperf.o |
7 | obj-$(CONFIG_X86_PCC_CPUFREQ) += pcc-cpufreq.o | 7 | obj-$(CONFIG_X86_PCC_CPUFREQ) += pcc-cpufreq.o |
8 | obj-$(CONFIG_X86_POWERNOW_K6) += powernow-k6.o | 8 | obj-$(CONFIG_X86_POWERNOW_K6) += powernow-k6.o |
9 | obj-$(CONFIG_X86_POWERNOW_K7) += powernow-k7.o | 9 | obj-$(CONFIG_X86_POWERNOW_K7) += powernow-k7.o |
diff --git a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c index 459168083b77..1d3cddaa40ee 100644 --- a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c +++ b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c | |||
@@ -46,6 +46,7 @@ | |||
46 | #include <asm/msr.h> | 46 | #include <asm/msr.h> |
47 | #include <asm/processor.h> | 47 | #include <asm/processor.h> |
48 | #include <asm/cpufeature.h> | 48 | #include <asm/cpufeature.h> |
49 | #include "mperf.h" | ||
49 | 50 | ||
50 | #define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, \ | 51 | #define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, \ |
51 | "acpi-cpufreq", msg) | 52 | "acpi-cpufreq", msg) |
@@ -71,8 +72,6 @@ struct acpi_cpufreq_data { | |||
71 | 72 | ||
72 | static DEFINE_PER_CPU(struct acpi_cpufreq_data *, acfreq_data); | 73 | static DEFINE_PER_CPU(struct acpi_cpufreq_data *, acfreq_data); |
73 | 74 | ||
74 | static DEFINE_PER_CPU(struct aperfmperf, acfreq_old_perf); | ||
75 | |||
76 | /* acpi_perf_data is a pointer to percpu data. */ | 75 | /* acpi_perf_data is a pointer to percpu data. */ |
77 | static struct acpi_processor_performance *acpi_perf_data; | 76 | static struct acpi_processor_performance *acpi_perf_data; |
78 | 77 | ||
@@ -240,45 +239,6 @@ static u32 get_cur_val(const struct cpumask *mask) | |||
240 | return cmd.val; | 239 | return cmd.val; |
241 | } | 240 | } |
242 | 241 | ||
243 | /* Called via smp_call_function_single(), on the target CPU */ | ||
244 | static void read_measured_perf_ctrs(void *_cur) | ||
245 | { | ||
246 | struct aperfmperf *am = _cur; | ||
247 | |||
248 | get_aperfmperf(am); | ||
249 | } | ||
250 | |||
251 | /* | ||
252 | * Return the measured active (C0) frequency on this CPU since last call | ||
253 | * to this function. | ||
254 | * Input: cpu number | ||
255 | * Return: Average CPU frequency in terms of max frequency (zero on error) | ||
256 | * | ||
257 | * We use IA32_MPERF and IA32_APERF MSRs to get the measured performance | ||
258 | * over a period of time, while CPU is in C0 state. | ||
259 | * IA32_MPERF counts at the rate of max advertised frequency | ||
260 | * IA32_APERF counts at the rate of actual CPU frequency | ||
261 | * Only IA32_APERF/IA32_MPERF ratio is architecturally defined and | ||
262 | * no meaning should be associated with absolute values of these MSRs. | ||
263 | */ | ||
264 | static unsigned int get_measured_perf(struct cpufreq_policy *policy, | ||
265 | unsigned int cpu) | ||
266 | { | ||
267 | struct aperfmperf perf; | ||
268 | unsigned long ratio; | ||
269 | unsigned int retval; | ||
270 | |||
271 | if (smp_call_function_single(cpu, read_measured_perf_ctrs, &perf, 1)) | ||
272 | return 0; | ||
273 | |||
274 | ratio = calc_aperfmperf_ratio(&per_cpu(acfreq_old_perf, cpu), &perf); | ||
275 | per_cpu(acfreq_old_perf, cpu) = perf; | ||
276 | |||
277 | retval = (policy->cpuinfo.max_freq * ratio) >> APERFMPERF_SHIFT; | ||
278 | |||
279 | return retval; | ||
280 | } | ||
281 | |||
282 | static unsigned int get_cur_freq_on_cpu(unsigned int cpu) | 242 | static unsigned int get_cur_freq_on_cpu(unsigned int cpu) |
283 | { | 243 | { |
284 | struct acpi_cpufreq_data *data = per_cpu(acfreq_data, cpu); | 244 | struct acpi_cpufreq_data *data = per_cpu(acfreq_data, cpu); |
@@ -702,7 +662,7 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
702 | 662 | ||
703 | /* Check for APERF/MPERF support in hardware */ | 663 | /* Check for APERF/MPERF support in hardware */ |
704 | if (cpu_has(c, X86_FEATURE_APERFMPERF)) | 664 | if (cpu_has(c, X86_FEATURE_APERFMPERF)) |
705 | acpi_cpufreq_driver.getavg = get_measured_perf; | 665 | acpi_cpufreq_driver.getavg = cpufreq_get_measured_perf; |
706 | 666 | ||
707 | dprintk("CPU%u - ACPI performance management activated.\n", cpu); | 667 | dprintk("CPU%u - ACPI performance management activated.\n", cpu); |
708 | for (i = 0; i < perf->state_count; i++) | 668 | for (i = 0; i < perf->state_count; i++) |
diff --git a/arch/x86/kernel/cpu/cpufreq/mperf.c b/arch/x86/kernel/cpu/cpufreq/mperf.c new file mode 100644 index 000000000000..911e193018ae --- /dev/null +++ b/arch/x86/kernel/cpu/cpufreq/mperf.c | |||
@@ -0,0 +1,51 @@ | |||
1 | #include <linux/kernel.h> | ||
2 | #include <linux/smp.h> | ||
3 | #include <linux/module.h> | ||
4 | #include <linux/init.h> | ||
5 | #include <linux/cpufreq.h> | ||
6 | #include <linux/slab.h> | ||
7 | |||
8 | #include "mperf.h" | ||
9 | |||
10 | static DEFINE_PER_CPU(struct aperfmperf, acfreq_old_perf); | ||
11 | |||
12 | /* Called via smp_call_function_single(), on the target CPU */ | ||
13 | static void read_measured_perf_ctrs(void *_cur) | ||
14 | { | ||
15 | struct aperfmperf *am = _cur; | ||
16 | |||
17 | get_aperfmperf(am); | ||
18 | } | ||
19 | |||
20 | /* | ||
21 | * Return the measured active (C0) frequency on this CPU since last call | ||
22 | * to this function. | ||
23 | * Input: cpu number | ||
24 | * Return: Average CPU frequency in terms of max frequency (zero on error) | ||
25 | * | ||
26 | * We use IA32_MPERF and IA32_APERF MSRs to get the measured performance | ||
27 | * over a period of time, while CPU is in C0 state. | ||
28 | * IA32_MPERF counts at the rate of max advertised frequency | ||
29 | * IA32_APERF counts at the rate of actual CPU frequency | ||
30 | * Only IA32_APERF/IA32_MPERF ratio is architecturally defined and | ||
31 | * no meaning should be associated with absolute values of these MSRs. | ||
32 | */ | ||
33 | unsigned int cpufreq_get_measured_perf(struct cpufreq_policy *policy, | ||
34 | unsigned int cpu) | ||
35 | { | ||
36 | struct aperfmperf perf; | ||
37 | unsigned long ratio; | ||
38 | unsigned int retval; | ||
39 | |||
40 | if (smp_call_function_single(cpu, read_measured_perf_ctrs, &perf, 1)) | ||
41 | return 0; | ||
42 | |||
43 | ratio = calc_aperfmperf_ratio(&per_cpu(acfreq_old_perf, cpu), &perf); | ||
44 | per_cpu(acfreq_old_perf, cpu) = perf; | ||
45 | |||
46 | retval = (policy->cpuinfo.max_freq * ratio) >> APERFMPERF_SHIFT; | ||
47 | |||
48 | return retval; | ||
49 | } | ||
50 | EXPORT_SYMBOL_GPL(cpufreq_get_measured_perf); | ||
51 | MODULE_LICENSE("GPL"); | ||
diff --git a/arch/x86/kernel/cpu/cpufreq/mperf.h b/arch/x86/kernel/cpu/cpufreq/mperf.h new file mode 100644 index 000000000000..5dbf2950dc22 --- /dev/null +++ b/arch/x86/kernel/cpu/cpufreq/mperf.h | |||
@@ -0,0 +1,9 @@ | |||
1 | /* | ||
2 | * (c) 2010 Advanced Micro Devices, Inc. | ||
3 | * Your use of this code is subject to the terms and conditions of the | ||
4 | * GNU general public license version 2. See "COPYING" or | ||
5 | * http://www.gnu.org/licenses/gpl.html | ||
6 | */ | ||
7 | |||
8 | unsigned int cpufreq_get_measured_perf(struct cpufreq_policy *policy, | ||
9 | unsigned int cpu); | ||
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c index b6215b9798e2..6f3dc8fbbfdc 100644 --- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c +++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c | |||
@@ -1,6 +1,5 @@ | |||
1 | |||
2 | /* | 1 | /* |
3 | * (c) 2003-2006 Advanced Micro Devices, Inc. | 2 | * (c) 2003-2010 Advanced Micro Devices, Inc. |
4 | * Your use of this code is subject to the terms and conditions of the | 3 | * Your use of this code is subject to the terms and conditions of the |
5 | * GNU general public license version 2. See "COPYING" or | 4 | * GNU general public license version 2. See "COPYING" or |
6 | * http://www.gnu.org/licenses/gpl.html | 5 | * http://www.gnu.org/licenses/gpl.html |
@@ -46,6 +45,7 @@ | |||
46 | #define PFX "powernow-k8: " | 45 | #define PFX "powernow-k8: " |
47 | #define VERSION "version 2.20.00" | 46 | #define VERSION "version 2.20.00" |
48 | #include "powernow-k8.h" | 47 | #include "powernow-k8.h" |
48 | #include "mperf.h" | ||
49 | 49 | ||
50 | /* serialize freq changes */ | 50 | /* serialize freq changes */ |
51 | static DEFINE_MUTEX(fidvid_mutex); | 51 | static DEFINE_MUTEX(fidvid_mutex); |
@@ -54,6 +54,12 @@ static DEFINE_PER_CPU(struct powernow_k8_data *, powernow_data); | |||
54 | 54 | ||
55 | static int cpu_family = CPU_OPTERON; | 55 | static int cpu_family = CPU_OPTERON; |
56 | 56 | ||
57 | /* core performance boost */ | ||
58 | static bool cpb_capable, cpb_enabled; | ||
59 | static struct msr __percpu *msrs; | ||
60 | |||
61 | static struct cpufreq_driver cpufreq_amd64_driver; | ||
62 | |||
57 | #ifndef CONFIG_SMP | 63 | #ifndef CONFIG_SMP |
58 | static inline const struct cpumask *cpu_core_mask(int cpu) | 64 | static inline const struct cpumask *cpu_core_mask(int cpu) |
59 | { | 65 | { |
@@ -1249,6 +1255,7 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol) | |||
1249 | struct powernow_k8_data *data; | 1255 | struct powernow_k8_data *data; |
1250 | struct init_on_cpu init_on_cpu; | 1256 | struct init_on_cpu init_on_cpu; |
1251 | int rc; | 1257 | int rc; |
1258 | struct cpuinfo_x86 *c = &cpu_data(pol->cpu); | ||
1252 | 1259 | ||
1253 | if (!cpu_online(pol->cpu)) | 1260 | if (!cpu_online(pol->cpu)) |
1254 | return -ENODEV; | 1261 | return -ENODEV; |
@@ -1323,6 +1330,10 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol) | |||
1323 | return -EINVAL; | 1330 | return -EINVAL; |
1324 | } | 1331 | } |
1325 | 1332 | ||
1333 | /* Check for APERF/MPERF support in hardware */ | ||
1334 | if (cpu_has(c, X86_FEATURE_APERFMPERF)) | ||
1335 | cpufreq_amd64_driver.getavg = cpufreq_get_measured_perf; | ||
1336 | |||
1326 | cpufreq_frequency_table_get_attr(data->powernow_table, pol->cpu); | 1337 | cpufreq_frequency_table_get_attr(data->powernow_table, pol->cpu); |
1327 | 1338 | ||
1328 | if (cpu_family == CPU_HW_PSTATE) | 1339 | if (cpu_family == CPU_HW_PSTATE) |
@@ -1394,8 +1405,77 @@ out: | |||
1394 | return khz; | 1405 | return khz; |
1395 | } | 1406 | } |
1396 | 1407 | ||
1408 | static void _cpb_toggle_msrs(bool t) | ||
1409 | { | ||
1410 | int cpu; | ||
1411 | |||
1412 | get_online_cpus(); | ||
1413 | |||
1414 | rdmsr_on_cpus(cpu_online_mask, MSR_K7_HWCR, msrs); | ||
1415 | |||
1416 | for_each_cpu(cpu, cpu_online_mask) { | ||
1417 | struct msr *reg = per_cpu_ptr(msrs, cpu); | ||
1418 | if (t) | ||
1419 | reg->l &= ~BIT(25); | ||
1420 | else | ||
1421 | reg->l |= BIT(25); | ||
1422 | } | ||
1423 | wrmsr_on_cpus(cpu_online_mask, MSR_K7_HWCR, msrs); | ||
1424 | |||
1425 | put_online_cpus(); | ||
1426 | } | ||
1427 | |||
1428 | /* | ||
1429 | * Switch on/off core performance boosting. | ||
1430 | * | ||
1431 | * 0=disable | ||
1432 | * 1=enable. | ||
1433 | */ | ||
1434 | static void cpb_toggle(bool t) | ||
1435 | { | ||
1436 | if (!cpb_capable) | ||
1437 | return; | ||
1438 | |||
1439 | if (t && !cpb_enabled) { | ||
1440 | cpb_enabled = true; | ||
1441 | _cpb_toggle_msrs(t); | ||
1442 | printk(KERN_INFO PFX "Core Boosting enabled.\n"); | ||
1443 | } else if (!t && cpb_enabled) { | ||
1444 | cpb_enabled = false; | ||
1445 | _cpb_toggle_msrs(t); | ||
1446 | printk(KERN_INFO PFX "Core Boosting disabled.\n"); | ||
1447 | } | ||
1448 | } | ||
1449 | |||
1450 | static ssize_t store_cpb(struct cpufreq_policy *policy, const char *buf, | ||
1451 | size_t count) | ||
1452 | { | ||
1453 | int ret = -EINVAL; | ||
1454 | unsigned long val = 0; | ||
1455 | |||
1456 | ret = strict_strtoul(buf, 10, &val); | ||
1457 | if (!ret && (val == 0 || val == 1) && cpb_capable) | ||
1458 | cpb_toggle(val); | ||
1459 | else | ||
1460 | return -EINVAL; | ||
1461 | |||
1462 | return count; | ||
1463 | } | ||
1464 | |||
1465 | static ssize_t show_cpb(struct cpufreq_policy *policy, char *buf) | ||
1466 | { | ||
1467 | return sprintf(buf, "%u\n", cpb_enabled); | ||
1468 | } | ||
1469 | |||
1470 | #define define_one_rw(_name) \ | ||
1471 | static struct freq_attr _name = \ | ||
1472 | __ATTR(_name, 0644, show_##_name, store_##_name) | ||
1473 | |||
1474 | define_one_rw(cpb); | ||
1475 | |||
1397 | static struct freq_attr *powernow_k8_attr[] = { | 1476 | static struct freq_attr *powernow_k8_attr[] = { |
1398 | &cpufreq_freq_attr_scaling_available_freqs, | 1477 | &cpufreq_freq_attr_scaling_available_freqs, |
1478 | &cpb, | ||
1399 | NULL, | 1479 | NULL, |
1400 | }; | 1480 | }; |
1401 | 1481 | ||
@@ -1411,10 +1491,51 @@ static struct cpufreq_driver cpufreq_amd64_driver = { | |||
1411 | .attr = powernow_k8_attr, | 1491 | .attr = powernow_k8_attr, |
1412 | }; | 1492 | }; |
1413 | 1493 | ||
1494 | /* | ||
1495 | * Clear the boost-disable flag on the CPU_DOWN path so that this cpu | ||
1496 | * cannot block the remaining ones from boosting. On the CPU_UP path we | ||
1497 | * simply keep the boost-disable flag in sync with the current global | ||
1498 | * state. | ||
1499 | */ | ||
1500 | static int __cpuinit cpb_notify(struct notifier_block *nb, unsigned long action, | ||
1501 | void *hcpu) | ||
1502 | { | ||
1503 | unsigned cpu = (long)hcpu; | ||
1504 | u32 lo, hi; | ||
1505 | |||
1506 | switch (action) { | ||
1507 | case CPU_UP_PREPARE: | ||
1508 | case CPU_UP_PREPARE_FROZEN: | ||
1509 | |||
1510 | if (!cpb_enabled) { | ||
1511 | rdmsr_on_cpu(cpu, MSR_K7_HWCR, &lo, &hi); | ||
1512 | lo |= BIT(25); | ||
1513 | wrmsr_on_cpu(cpu, MSR_K7_HWCR, lo, hi); | ||
1514 | } | ||
1515 | break; | ||
1516 | |||
1517 | case CPU_DOWN_PREPARE: | ||
1518 | case CPU_DOWN_PREPARE_FROZEN: | ||
1519 | rdmsr_on_cpu(cpu, MSR_K7_HWCR, &lo, &hi); | ||
1520 | lo &= ~BIT(25); | ||
1521 | wrmsr_on_cpu(cpu, MSR_K7_HWCR, lo, hi); | ||
1522 | break; | ||
1523 | |||
1524 | default: | ||
1525 | break; | ||
1526 | } | ||
1527 | |||
1528 | return NOTIFY_OK; | ||
1529 | } | ||
1530 | |||
1531 | static struct notifier_block __cpuinitdata cpb_nb = { | ||
1532 | .notifier_call = cpb_notify, | ||
1533 | }; | ||
1534 | |||
1414 | /* driver entry point for init */ | 1535 | /* driver entry point for init */ |
1415 | static int __cpuinit powernowk8_init(void) | 1536 | static int __cpuinit powernowk8_init(void) |
1416 | { | 1537 | { |
1417 | unsigned int i, supported_cpus = 0; | 1538 | unsigned int i, supported_cpus = 0, cpu; |
1418 | 1539 | ||
1419 | for_each_online_cpu(i) { | 1540 | for_each_online_cpu(i) { |
1420 | int rc; | 1541 | int rc; |
@@ -1423,15 +1544,36 @@ static int __cpuinit powernowk8_init(void) | |||
1423 | supported_cpus++; | 1544 | supported_cpus++; |
1424 | } | 1545 | } |
1425 | 1546 | ||
1426 | if (supported_cpus == num_online_cpus()) { | 1547 | if (supported_cpus != num_online_cpus()) |
1427 | printk(KERN_INFO PFX "Found %d %s " | 1548 | return -ENODEV; |
1428 | "processors (%d cpu cores) (" VERSION ")\n", | 1549 | |
1429 | num_online_nodes(), | 1550 | printk(KERN_INFO PFX "Found %d %s (%d cpu cores) (" VERSION ")\n", |
1430 | boot_cpu_data.x86_model_id, supported_cpus); | 1551 | num_online_nodes(), boot_cpu_data.x86_model_id, supported_cpus); |
1431 | return cpufreq_register_driver(&cpufreq_amd64_driver); | 1552 | |
1553 | if (boot_cpu_has(X86_FEATURE_CPB)) { | ||
1554 | |||
1555 | cpb_capable = true; | ||
1556 | |||
1557 | register_cpu_notifier(&cpb_nb); | ||
1558 | |||
1559 | msrs = msrs_alloc(); | ||
1560 | if (!msrs) { | ||
1561 | printk(KERN_ERR "%s: Error allocating msrs!\n", __func__); | ||
1562 | return -ENOMEM; | ||
1563 | } | ||
1564 | |||
1565 | rdmsr_on_cpus(cpu_online_mask, MSR_K7_HWCR, msrs); | ||
1566 | |||
1567 | for_each_cpu(cpu, cpu_online_mask) { | ||
1568 | struct msr *reg = per_cpu_ptr(msrs, cpu); | ||
1569 | cpb_enabled |= !(!!(reg->l & BIT(25))); | ||
1570 | } | ||
1571 | |||
1572 | printk(KERN_INFO PFX "Core Performance Boosting: %s.\n", | ||
1573 | (cpb_enabled ? "on" : "off")); | ||
1432 | } | 1574 | } |
1433 | 1575 | ||
1434 | return -ENODEV; | 1576 | return cpufreq_register_driver(&cpufreq_amd64_driver); |
1435 | } | 1577 | } |
1436 | 1578 | ||
1437 | /* driver entry point for term */ | 1579 | /* driver entry point for term */ |
@@ -1439,6 +1581,13 @@ static void __exit powernowk8_exit(void) | |||
1439 | { | 1581 | { |
1440 | dprintk("exit\n"); | 1582 | dprintk("exit\n"); |
1441 | 1583 | ||
1584 | if (boot_cpu_has(X86_FEATURE_CPB)) { | ||
1585 | msrs_free(msrs); | ||
1586 | msrs = NULL; | ||
1587 | |||
1588 | unregister_cpu_notifier(&cpb_nb); | ||
1589 | } | ||
1590 | |||
1442 | cpufreq_unregister_driver(&cpufreq_amd64_driver); | 1591 | cpufreq_unregister_driver(&cpufreq_amd64_driver); |
1443 | } | 1592 | } |
1444 | 1593 | ||
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.h b/arch/x86/kernel/cpu/cpufreq/powernow-k8.h index 02ce824073cb..df3529b1c02d 100644 --- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.h +++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.h | |||
@@ -5,7 +5,6 @@ | |||
5 | * http://www.gnu.org/licenses/gpl.html | 5 | * http://www.gnu.org/licenses/gpl.html |
6 | */ | 6 | */ |
7 | 7 | ||
8 | |||
9 | enum pstate { | 8 | enum pstate { |
10 | HW_PSTATE_INVALID = 0xff, | 9 | HW_PSTATE_INVALID = 0xff, |
11 | HW_PSTATE_0 = 0, | 10 | HW_PSTATE_0 = 0, |
@@ -55,7 +54,6 @@ struct powernow_k8_data { | |||
55 | struct cpumask *available_cores; | 54 | struct cpumask *available_cores; |
56 | }; | 55 | }; |
57 | 56 | ||
58 | |||
59 | /* processor's cpuid instruction support */ | 57 | /* processor's cpuid instruction support */ |
60 | #define CPUID_PROCESSOR_SIGNATURE 1 /* function 1 */ | 58 | #define CPUID_PROCESSOR_SIGNATURE 1 /* function 1 */ |
61 | #define CPUID_XFAM 0x0ff00000 /* extended family */ | 59 | #define CPUID_XFAM 0x0ff00000 /* extended family */ |
diff --git a/arch/x86/kernel/cpu/hypervisor.c b/arch/x86/kernel/cpu/hypervisor.c index 08be922de33a..dd531cc56a8f 100644 --- a/arch/x86/kernel/cpu/hypervisor.c +++ b/arch/x86/kernel/cpu/hypervisor.c | |||
@@ -21,37 +21,55 @@ | |||
21 | * | 21 | * |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <linux/module.h> | ||
24 | #include <asm/processor.h> | 25 | #include <asm/processor.h> |
25 | #include <asm/vmware.h> | ||
26 | #include <asm/hypervisor.h> | 26 | #include <asm/hypervisor.h> |
27 | 27 | ||
28 | static inline void __cpuinit | 28 | /* |
29 | detect_hypervisor_vendor(struct cpuinfo_x86 *c) | 29 | * Hypervisor detect order. This is specified explicitly here because |
30 | * some hypervisors might implement compatibility modes for other | ||
31 | * hypervisors and therefore need to be detected in specific sequence. | ||
32 | */ | ||
33 | static const __initconst struct hypervisor_x86 * const hypervisors[] = | ||
30 | { | 34 | { |
31 | if (vmware_platform()) | 35 | &x86_hyper_vmware, |
32 | c->x86_hyper_vendor = X86_HYPER_VENDOR_VMWARE; | 36 | &x86_hyper_ms_hyperv, |
33 | else | 37 | }; |
34 | c->x86_hyper_vendor = X86_HYPER_VENDOR_NONE; | ||
35 | } | ||
36 | 38 | ||
37 | static inline void __cpuinit | 39 | const struct hypervisor_x86 *x86_hyper; |
38 | hypervisor_set_feature_bits(struct cpuinfo_x86 *c) | 40 | EXPORT_SYMBOL(x86_hyper); |
41 | |||
42 | static inline void __init | ||
43 | detect_hypervisor_vendor(void) | ||
39 | { | 44 | { |
40 | if (boot_cpu_data.x86_hyper_vendor == X86_HYPER_VENDOR_VMWARE) { | 45 | const struct hypervisor_x86 *h, * const *p; |
41 | vmware_set_feature_bits(c); | 46 | |
42 | return; | 47 | for (p = hypervisors; p < hypervisors + ARRAY_SIZE(hypervisors); p++) { |
48 | h = *p; | ||
49 | if (h->detect()) { | ||
50 | x86_hyper = h; | ||
51 | printk(KERN_INFO "Hypervisor detected: %s\n", h->name); | ||
52 | break; | ||
53 | } | ||
43 | } | 54 | } |
44 | } | 55 | } |
45 | 56 | ||
46 | void __cpuinit init_hypervisor(struct cpuinfo_x86 *c) | 57 | void __cpuinit init_hypervisor(struct cpuinfo_x86 *c) |
47 | { | 58 | { |
48 | detect_hypervisor_vendor(c); | 59 | if (x86_hyper && x86_hyper->set_cpu_features) |
49 | hypervisor_set_feature_bits(c); | 60 | x86_hyper->set_cpu_features(c); |
50 | } | 61 | } |
51 | 62 | ||
52 | void __init init_hypervisor_platform(void) | 63 | void __init init_hypervisor_platform(void) |
53 | { | 64 | { |
65 | |||
66 | detect_hypervisor_vendor(); | ||
67 | |||
68 | if (!x86_hyper) | ||
69 | return; | ||
70 | |||
54 | init_hypervisor(&boot_cpu_data); | 71 | init_hypervisor(&boot_cpu_data); |
55 | if (boot_cpu_data.x86_hyper_vendor == X86_HYPER_VENDOR_VMWARE) | 72 | |
56 | vmware_platform_setup(); | 73 | if (x86_hyper->init_platform) |
74 | x86_hyper->init_platform(); | ||
57 | } | 75 | } |
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c index f5e5390d3459..85f69cdeae10 100644 --- a/arch/x86/kernel/cpu/intel.c +++ b/arch/x86/kernel/cpu/intel.c | |||
@@ -372,12 +372,6 @@ static void __cpuinit init_intel(struct cpuinfo_x86 *c) | |||
372 | set_cpu_cap(c, X86_FEATURE_ARCH_PERFMON); | 372 | set_cpu_cap(c, X86_FEATURE_ARCH_PERFMON); |
373 | } | 373 | } |
374 | 374 | ||
375 | if (c->cpuid_level > 6) { | ||
376 | unsigned ecx = cpuid_ecx(6); | ||
377 | if (ecx & 0x01) | ||
378 | set_cpu_cap(c, X86_FEATURE_APERFMPERF); | ||
379 | } | ||
380 | |||
381 | if (cpu_has_xmm2) | 375 | if (cpu_has_xmm2) |
382 | set_cpu_cap(c, X86_FEATURE_LFENCE_RDTSC); | 376 | set_cpu_cap(c, X86_FEATURE_LFENCE_RDTSC); |
383 | if (cpu_has_ds) { | 377 | if (cpu_has_ds) { |
diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c index b3eeb66c0a51..33eae2062cf5 100644 --- a/arch/x86/kernel/cpu/intel_cacheinfo.c +++ b/arch/x86/kernel/cpu/intel_cacheinfo.c | |||
@@ -148,13 +148,19 @@ union _cpuid4_leaf_ecx { | |||
148 | u32 full; | 148 | u32 full; |
149 | }; | 149 | }; |
150 | 150 | ||
151 | struct amd_l3_cache { | ||
152 | struct pci_dev *dev; | ||
153 | bool can_disable; | ||
154 | unsigned indices; | ||
155 | u8 subcaches[4]; | ||
156 | }; | ||
157 | |||
151 | struct _cpuid4_info { | 158 | struct _cpuid4_info { |
152 | union _cpuid4_leaf_eax eax; | 159 | union _cpuid4_leaf_eax eax; |
153 | union _cpuid4_leaf_ebx ebx; | 160 | union _cpuid4_leaf_ebx ebx; |
154 | union _cpuid4_leaf_ecx ecx; | 161 | union _cpuid4_leaf_ecx ecx; |
155 | unsigned long size; | 162 | unsigned long size; |
156 | bool can_disable; | 163 | struct amd_l3_cache *l3; |
157 | unsigned int l3_indices; | ||
158 | DECLARE_BITMAP(shared_cpu_map, NR_CPUS); | 164 | DECLARE_BITMAP(shared_cpu_map, NR_CPUS); |
159 | }; | 165 | }; |
160 | 166 | ||
@@ -164,8 +170,7 @@ struct _cpuid4_info_regs { | |||
164 | union _cpuid4_leaf_ebx ebx; | 170 | union _cpuid4_leaf_ebx ebx; |
165 | union _cpuid4_leaf_ecx ecx; | 171 | union _cpuid4_leaf_ecx ecx; |
166 | unsigned long size; | 172 | unsigned long size; |
167 | bool can_disable; | 173 | struct amd_l3_cache *l3; |
168 | unsigned int l3_indices; | ||
169 | }; | 174 | }; |
170 | 175 | ||
171 | unsigned short num_cache_leaves; | 176 | unsigned short num_cache_leaves; |
@@ -302,87 +307,163 @@ struct _cache_attr { | |||
302 | }; | 307 | }; |
303 | 308 | ||
304 | #ifdef CONFIG_CPU_SUP_AMD | 309 | #ifdef CONFIG_CPU_SUP_AMD |
305 | static unsigned int __cpuinit amd_calc_l3_indices(void) | 310 | |
311 | /* | ||
312 | * L3 cache descriptors | ||
313 | */ | ||
314 | static struct amd_l3_cache **__cpuinitdata l3_caches; | ||
315 | |||
316 | static void __cpuinit amd_calc_l3_indices(struct amd_l3_cache *l3) | ||
306 | { | 317 | { |
307 | /* | ||
308 | * We're called over smp_call_function_single() and therefore | ||
309 | * are on the correct cpu. | ||
310 | */ | ||
311 | int cpu = smp_processor_id(); | ||
312 | int node = cpu_to_node(cpu); | ||
313 | struct pci_dev *dev = node_to_k8_nb_misc(node); | ||
314 | unsigned int sc0, sc1, sc2, sc3; | 318 | unsigned int sc0, sc1, sc2, sc3; |
315 | u32 val = 0; | 319 | u32 val = 0; |
316 | 320 | ||
317 | pci_read_config_dword(dev, 0x1C4, &val); | 321 | pci_read_config_dword(l3->dev, 0x1C4, &val); |
318 | 322 | ||
319 | /* calculate subcache sizes */ | 323 | /* calculate subcache sizes */ |
320 | sc0 = !(val & BIT(0)); | 324 | l3->subcaches[0] = sc0 = !(val & BIT(0)); |
321 | sc1 = !(val & BIT(4)); | 325 | l3->subcaches[1] = sc1 = !(val & BIT(4)); |
322 | sc2 = !(val & BIT(8)) + !(val & BIT(9)); | 326 | l3->subcaches[2] = sc2 = !(val & BIT(8)) + !(val & BIT(9)); |
323 | sc3 = !(val & BIT(12)) + !(val & BIT(13)); | 327 | l3->subcaches[3] = sc3 = !(val & BIT(12)) + !(val & BIT(13)); |
324 | 328 | ||
325 | return (max(max(max(sc0, sc1), sc2), sc3) << 10) - 1; | 329 | l3->indices = (max(max(max(sc0, sc1), sc2), sc3) << 10) - 1; |
330 | } | ||
331 | |||
332 | static struct amd_l3_cache * __cpuinit amd_init_l3_cache(int node) | ||
333 | { | ||
334 | struct amd_l3_cache *l3; | ||
335 | struct pci_dev *dev = node_to_k8_nb_misc(node); | ||
336 | |||
337 | l3 = kzalloc(sizeof(struct amd_l3_cache), GFP_ATOMIC); | ||
338 | if (!l3) { | ||
339 | printk(KERN_WARNING "Error allocating L3 struct\n"); | ||
340 | return NULL; | ||
341 | } | ||
342 | |||
343 | l3->dev = dev; | ||
344 | |||
345 | amd_calc_l3_indices(l3); | ||
346 | |||
347 | return l3; | ||
326 | } | 348 | } |
327 | 349 | ||
328 | static void __cpuinit | 350 | static void __cpuinit |
329 | amd_check_l3_disable(int index, struct _cpuid4_info_regs *this_leaf) | 351 | amd_check_l3_disable(int index, struct _cpuid4_info_regs *this_leaf) |
330 | { | 352 | { |
331 | if (index < 3) | 353 | int node; |
354 | |||
355 | if (boot_cpu_data.x86 != 0x10) | ||
332 | return; | 356 | return; |
333 | 357 | ||
334 | if (boot_cpu_data.x86 == 0x11) | 358 | if (index < 3) |
335 | return; | 359 | return; |
336 | 360 | ||
337 | /* see errata #382 and #388 */ | 361 | /* see errata #382 and #388 */ |
338 | if ((boot_cpu_data.x86 == 0x10) && | 362 | if (boot_cpu_data.x86_model < 0x8) |
339 | ((boot_cpu_data.x86_model < 0x8) || | 363 | return; |
340 | (boot_cpu_data.x86_mask < 0x1))) | 364 | |
365 | if ((boot_cpu_data.x86_model == 0x8 || | ||
366 | boot_cpu_data.x86_model == 0x9) | ||
367 | && | ||
368 | boot_cpu_data.x86_mask < 0x1) | ||
369 | return; | ||
370 | |||
371 | /* not in virtualized environments */ | ||
372 | if (num_k8_northbridges == 0) | ||
341 | return; | 373 | return; |
342 | 374 | ||
343 | this_leaf->can_disable = true; | 375 | /* |
344 | this_leaf->l3_indices = amd_calc_l3_indices(); | 376 | * Strictly speaking, the amount in @size below is leaked since it is |
377 | * never freed but this is done only on shutdown so it doesn't matter. | ||
378 | */ | ||
379 | if (!l3_caches) { | ||
380 | int size = num_k8_northbridges * sizeof(struct amd_l3_cache *); | ||
381 | |||
382 | l3_caches = kzalloc(size, GFP_ATOMIC); | ||
383 | if (!l3_caches) | ||
384 | return; | ||
385 | } | ||
386 | |||
387 | node = amd_get_nb_id(smp_processor_id()); | ||
388 | |||
389 | if (!l3_caches[node]) { | ||
390 | l3_caches[node] = amd_init_l3_cache(node); | ||
391 | l3_caches[node]->can_disable = true; | ||
392 | } | ||
393 | |||
394 | WARN_ON(!l3_caches[node]); | ||
395 | |||
396 | this_leaf->l3 = l3_caches[node]; | ||
345 | } | 397 | } |
346 | 398 | ||
347 | static ssize_t show_cache_disable(struct _cpuid4_info *this_leaf, char *buf, | 399 | static ssize_t show_cache_disable(struct _cpuid4_info *this_leaf, char *buf, |
348 | unsigned int index) | 400 | unsigned int slot) |
349 | { | 401 | { |
350 | int cpu = cpumask_first(to_cpumask(this_leaf->shared_cpu_map)); | 402 | struct pci_dev *dev = this_leaf->l3->dev; |
351 | int node = amd_get_nb_id(cpu); | ||
352 | struct pci_dev *dev = node_to_k8_nb_misc(node); | ||
353 | unsigned int reg = 0; | 403 | unsigned int reg = 0; |
354 | 404 | ||
355 | if (!this_leaf->can_disable) | 405 | if (!this_leaf->l3 || !this_leaf->l3->can_disable) |
356 | return -EINVAL; | 406 | return -EINVAL; |
357 | 407 | ||
358 | if (!dev) | 408 | if (!dev) |
359 | return -EINVAL; | 409 | return -EINVAL; |
360 | 410 | ||
361 | pci_read_config_dword(dev, 0x1BC + index * 4, ®); | 411 | pci_read_config_dword(dev, 0x1BC + slot * 4, ®); |
362 | return sprintf(buf, "0x%08x\n", reg); | 412 | return sprintf(buf, "0x%08x\n", reg); |
363 | } | 413 | } |
364 | 414 | ||
365 | #define SHOW_CACHE_DISABLE(index) \ | 415 | #define SHOW_CACHE_DISABLE(slot) \ |
366 | static ssize_t \ | 416 | static ssize_t \ |
367 | show_cache_disable_##index(struct _cpuid4_info *this_leaf, char *buf) \ | 417 | show_cache_disable_##slot(struct _cpuid4_info *this_leaf, char *buf) \ |
368 | { \ | 418 | { \ |
369 | return show_cache_disable(this_leaf, buf, index); \ | 419 | return show_cache_disable(this_leaf, buf, slot); \ |
370 | } | 420 | } |
371 | SHOW_CACHE_DISABLE(0) | 421 | SHOW_CACHE_DISABLE(0) |
372 | SHOW_CACHE_DISABLE(1) | 422 | SHOW_CACHE_DISABLE(1) |
373 | 423 | ||
424 | static void amd_l3_disable_index(struct amd_l3_cache *l3, int cpu, | ||
425 | unsigned slot, unsigned long idx) | ||
426 | { | ||
427 | int i; | ||
428 | |||
429 | idx |= BIT(30); | ||
430 | |||
431 | /* | ||
432 | * disable index in all 4 subcaches | ||
433 | */ | ||
434 | for (i = 0; i < 4; i++) { | ||
435 | u32 reg = idx | (i << 20); | ||
436 | |||
437 | if (!l3->subcaches[i]) | ||
438 | continue; | ||
439 | |||
440 | pci_write_config_dword(l3->dev, 0x1BC + slot * 4, reg); | ||
441 | |||
442 | /* | ||
443 | * We need to WBINVD on a core on the node containing the L3 | ||
444 | * cache which indices we disable therefore a simple wbinvd() | ||
445 | * is not sufficient. | ||
446 | */ | ||
447 | wbinvd_on_cpu(cpu); | ||
448 | |||
449 | reg |= BIT(31); | ||
450 | pci_write_config_dword(l3->dev, 0x1BC + slot * 4, reg); | ||
451 | } | ||
452 | } | ||
453 | |||
454 | |||
374 | static ssize_t store_cache_disable(struct _cpuid4_info *this_leaf, | 455 | static ssize_t store_cache_disable(struct _cpuid4_info *this_leaf, |
375 | const char *buf, size_t count, unsigned int index) | 456 | const char *buf, size_t count, |
457 | unsigned int slot) | ||
376 | { | 458 | { |
459 | struct pci_dev *dev = this_leaf->l3->dev; | ||
377 | int cpu = cpumask_first(to_cpumask(this_leaf->shared_cpu_map)); | 460 | int cpu = cpumask_first(to_cpumask(this_leaf->shared_cpu_map)); |
378 | int node = amd_get_nb_id(cpu); | ||
379 | struct pci_dev *dev = node_to_k8_nb_misc(node); | ||
380 | unsigned long val = 0; | 461 | unsigned long val = 0; |
381 | 462 | ||
382 | #define SUBCACHE_MASK (3UL << 20) | 463 | #define SUBCACHE_MASK (3UL << 20) |
383 | #define SUBCACHE_INDEX 0xfff | 464 | #define SUBCACHE_INDEX 0xfff |
384 | 465 | ||
385 | if (!this_leaf->can_disable) | 466 | if (!this_leaf->l3 || !this_leaf->l3->can_disable) |
386 | return -EINVAL; | 467 | return -EINVAL; |
387 | 468 | ||
388 | if (!capable(CAP_SYS_ADMIN)) | 469 | if (!capable(CAP_SYS_ADMIN)) |
@@ -396,26 +477,20 @@ static ssize_t store_cache_disable(struct _cpuid4_info *this_leaf, | |||
396 | 477 | ||
397 | /* do not allow writes outside of allowed bits */ | 478 | /* do not allow writes outside of allowed bits */ |
398 | if ((val & ~(SUBCACHE_MASK | SUBCACHE_INDEX)) || | 479 | if ((val & ~(SUBCACHE_MASK | SUBCACHE_INDEX)) || |
399 | ((val & SUBCACHE_INDEX) > this_leaf->l3_indices)) | 480 | ((val & SUBCACHE_INDEX) > this_leaf->l3->indices)) |
400 | return -EINVAL; | 481 | return -EINVAL; |
401 | 482 | ||
402 | val |= BIT(30); | 483 | amd_l3_disable_index(this_leaf->l3, cpu, slot, val); |
403 | pci_write_config_dword(dev, 0x1BC + index * 4, val); | 484 | |
404 | /* | ||
405 | * We need to WBINVD on a core on the node containing the L3 cache which | ||
406 | * indices we disable therefore a simple wbinvd() is not sufficient. | ||
407 | */ | ||
408 | wbinvd_on_cpu(cpu); | ||
409 | pci_write_config_dword(dev, 0x1BC + index * 4, val | BIT(31)); | ||
410 | return count; | 485 | return count; |
411 | } | 486 | } |
412 | 487 | ||
413 | #define STORE_CACHE_DISABLE(index) \ | 488 | #define STORE_CACHE_DISABLE(slot) \ |
414 | static ssize_t \ | 489 | static ssize_t \ |
415 | store_cache_disable_##index(struct _cpuid4_info *this_leaf, \ | 490 | store_cache_disable_##slot(struct _cpuid4_info *this_leaf, \ |
416 | const char *buf, size_t count) \ | 491 | const char *buf, size_t count) \ |
417 | { \ | 492 | { \ |
418 | return store_cache_disable(this_leaf, buf, count, index); \ | 493 | return store_cache_disable(this_leaf, buf, count, slot); \ |
419 | } | 494 | } |
420 | STORE_CACHE_DISABLE(0) | 495 | STORE_CACHE_DISABLE(0) |
421 | STORE_CACHE_DISABLE(1) | 496 | STORE_CACHE_DISABLE(1) |
@@ -443,8 +518,7 @@ __cpuinit cpuid4_cache_lookup_regs(int index, | |||
443 | 518 | ||
444 | if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) { | 519 | if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) { |
445 | amd_cpuid4(index, &eax, &ebx, &ecx); | 520 | amd_cpuid4(index, &eax, &ebx, &ecx); |
446 | if (boot_cpu_data.x86 >= 0x10) | 521 | amd_check_l3_disable(index, this_leaf); |
447 | amd_check_l3_disable(index, this_leaf); | ||
448 | } else { | 522 | } else { |
449 | cpuid_count(4, index, &eax.full, &ebx.full, &ecx.full, &edx); | 523 | cpuid_count(4, index, &eax.full, &ebx.full, &ecx.full, &edx); |
450 | } | 524 | } |
@@ -701,6 +775,7 @@ static void __cpuinit free_cache_attributes(unsigned int cpu) | |||
701 | for (i = 0; i < num_cache_leaves; i++) | 775 | for (i = 0; i < num_cache_leaves; i++) |
702 | cache_remove_shared_cpu_map(cpu, i); | 776 | cache_remove_shared_cpu_map(cpu, i); |
703 | 777 | ||
778 | kfree(per_cpu(ici_cpuid4_info, cpu)->l3); | ||
704 | kfree(per_cpu(ici_cpuid4_info, cpu)); | 779 | kfree(per_cpu(ici_cpuid4_info, cpu)); |
705 | per_cpu(ici_cpuid4_info, cpu) = NULL; | 780 | per_cpu(ici_cpuid4_info, cpu) = NULL; |
706 | } | 781 | } |
@@ -985,7 +1060,7 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev) | |||
985 | 1060 | ||
986 | this_leaf = CPUID4_INFO_IDX(cpu, i); | 1061 | this_leaf = CPUID4_INFO_IDX(cpu, i); |
987 | 1062 | ||
988 | if (this_leaf->can_disable) | 1063 | if (this_leaf->l3 && this_leaf->l3->can_disable) |
989 | ktype_cache.default_attrs = default_l3_attrs; | 1064 | ktype_cache.default_attrs = default_l3_attrs; |
990 | else | 1065 | else |
991 | ktype_cache.default_attrs = default_attrs; | 1066 | ktype_cache.default_attrs = default_attrs; |
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c index 8a6f0afa767e..7a355ddcc64b 100644 --- a/arch/x86/kernel/cpu/mcheck/mce.c +++ b/arch/x86/kernel/cpu/mcheck/mce.c | |||
@@ -539,7 +539,7 @@ void machine_check_poll(enum mcp_flags flags, mce_banks_t *b) | |||
539 | struct mce m; | 539 | struct mce m; |
540 | int i; | 540 | int i; |
541 | 541 | ||
542 | __get_cpu_var(mce_poll_count)++; | 542 | percpu_inc(mce_poll_count); |
543 | 543 | ||
544 | mce_setup(&m); | 544 | mce_setup(&m); |
545 | 545 | ||
@@ -934,7 +934,7 @@ void do_machine_check(struct pt_regs *regs, long error_code) | |||
934 | 934 | ||
935 | atomic_inc(&mce_entry); | 935 | atomic_inc(&mce_entry); |
936 | 936 | ||
937 | __get_cpu_var(mce_exception_count)++; | 937 | percpu_inc(mce_exception_count); |
938 | 938 | ||
939 | if (notify_die(DIE_NMI, "machine check", regs, error_code, | 939 | if (notify_die(DIE_NMI, "machine check", regs, error_code, |
940 | 18, SIGKILL) == NOTIFY_STOP) | 940 | 18, SIGKILL) == NOTIFY_STOP) |
diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c new file mode 100644 index 000000000000..16f41bbe46b6 --- /dev/null +++ b/arch/x86/kernel/cpu/mshyperv.c | |||
@@ -0,0 +1,55 @@ | |||
1 | /* | ||
2 | * HyperV Detection code. | ||
3 | * | ||
4 | * Copyright (C) 2010, Novell, Inc. | ||
5 | * Author : K. Y. Srinivasan <ksrinivasan@novell.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; version 2 of the License. | ||
10 | * | ||
11 | */ | ||
12 | |||
13 | #include <linux/types.h> | ||
14 | #include <linux/module.h> | ||
15 | #include <asm/processor.h> | ||
16 | #include <asm/hypervisor.h> | ||
17 | #include <asm/hyperv.h> | ||
18 | #include <asm/mshyperv.h> | ||
19 | |||
20 | struct ms_hyperv_info ms_hyperv; | ||
21 | |||
22 | static bool __init ms_hyperv_platform(void) | ||
23 | { | ||
24 | u32 eax; | ||
25 | u32 hyp_signature[3]; | ||
26 | |||
27 | if (!boot_cpu_has(X86_FEATURE_HYPERVISOR)) | ||
28 | return false; | ||
29 | |||
30 | cpuid(HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS, | ||
31 | &eax, &hyp_signature[0], &hyp_signature[1], &hyp_signature[2]); | ||
32 | |||
33 | return eax >= HYPERV_CPUID_MIN && | ||
34 | eax <= HYPERV_CPUID_MAX && | ||
35 | !memcmp("Microsoft Hv", hyp_signature, 12); | ||
36 | } | ||
37 | |||
38 | static void __init ms_hyperv_init_platform(void) | ||
39 | { | ||
40 | /* | ||
41 | * Extract the features and hints | ||
42 | */ | ||
43 | ms_hyperv.features = cpuid_eax(HYPERV_CPUID_FEATURES); | ||
44 | ms_hyperv.hints = cpuid_eax(HYPERV_CPUID_ENLIGHTMENT_INFO); | ||
45 | |||
46 | printk(KERN_INFO "HyperV: features 0x%x, hints 0x%x\n", | ||
47 | ms_hyperv.features, ms_hyperv.hints); | ||
48 | } | ||
49 | |||
50 | const __refconst struct hypervisor_x86 x86_hyper_ms_hyperv = { | ||
51 | .name = "Microsoft HyperV", | ||
52 | .detect = ms_hyperv_platform, | ||
53 | .init_platform = ms_hyperv_init_platform, | ||
54 | }; | ||
55 | EXPORT_SYMBOL(x86_hyper_ms_hyperv); | ||
diff --git a/arch/x86/kernel/cpu/perf_event_p4.c b/arch/x86/kernel/cpu/perf_event_p4.c index 424fc8de68e4..ae85d69644d1 100644 --- a/arch/x86/kernel/cpu/perf_event_p4.c +++ b/arch/x86/kernel/cpu/perf_event_p4.c | |||
@@ -465,15 +465,21 @@ out: | |||
465 | return rc; | 465 | return rc; |
466 | } | 466 | } |
467 | 467 | ||
468 | static inline void p4_pmu_clear_cccr_ovf(struct hw_perf_event *hwc) | 468 | static inline int p4_pmu_clear_cccr_ovf(struct hw_perf_event *hwc) |
469 | { | 469 | { |
470 | unsigned long dummy; | 470 | int overflow = 0; |
471 | u32 low, high; | ||
471 | 472 | ||
472 | rdmsrl(hwc->config_base + hwc->idx, dummy); | 473 | rdmsr(hwc->config_base + hwc->idx, low, high); |
473 | if (dummy & P4_CCCR_OVF) { | 474 | |
475 | /* we need to check high bit for unflagged overflows */ | ||
476 | if ((low & P4_CCCR_OVF) || !(high & (1 << 31))) { | ||
477 | overflow = 1; | ||
474 | (void)checking_wrmsrl(hwc->config_base + hwc->idx, | 478 | (void)checking_wrmsrl(hwc->config_base + hwc->idx, |
475 | ((u64)dummy) & ~P4_CCCR_OVF); | 479 | ((u64)low) & ~P4_CCCR_OVF); |
476 | } | 480 | } |
481 | |||
482 | return overflow; | ||
477 | } | 483 | } |
478 | 484 | ||
479 | static inline void p4_pmu_disable_event(struct perf_event *event) | 485 | static inline void p4_pmu_disable_event(struct perf_event *event) |
@@ -584,21 +590,15 @@ static int p4_pmu_handle_irq(struct pt_regs *regs) | |||
584 | 590 | ||
585 | WARN_ON_ONCE(hwc->idx != idx); | 591 | WARN_ON_ONCE(hwc->idx != idx); |
586 | 592 | ||
587 | /* | 593 | /* it might be unflagged overflow */ |
588 | * FIXME: Redundant call, actually not needed | 594 | handled = p4_pmu_clear_cccr_ovf(hwc); |
589 | * but just to check if we're screwed | ||
590 | */ | ||
591 | p4_pmu_clear_cccr_ovf(hwc); | ||
592 | 595 | ||
593 | val = x86_perf_event_update(event); | 596 | val = x86_perf_event_update(event); |
594 | if (val & (1ULL << (x86_pmu.cntval_bits - 1))) | 597 | if (!handled && (val & (1ULL << (x86_pmu.cntval_bits - 1)))) |
595 | continue; | 598 | continue; |
596 | 599 | ||
597 | /* | 600 | /* event overflow for sure */ |
598 | * event overflow | 601 | data.period = event->hw.last_period; |
599 | */ | ||
600 | handled = 1; | ||
601 | data.period = event->hw.last_period; | ||
602 | 602 | ||
603 | if (!x86_perf_event_set_period(event)) | 603 | if (!x86_perf_event_set_period(event)) |
604 | continue; | 604 | continue; |
@@ -670,7 +670,7 @@ static void p4_pmu_swap_config_ts(struct hw_perf_event *hwc, int cpu) | |||
670 | 670 | ||
671 | /* | 671 | /* |
672 | * ESCR address hashing is tricky, ESCRs are not sequential | 672 | * ESCR address hashing is tricky, ESCRs are not sequential |
673 | * in memory but all starts from MSR_P4_BSU_ESCR0 (0x03e0) and | 673 | * in memory but all starts from MSR_P4_BSU_ESCR0 (0x03a0) and |
674 | * the metric between any ESCRs is laid in range [0xa0,0xe1] | 674 | * the metric between any ESCRs is laid in range [0xa0,0xe1] |
675 | * | 675 | * |
676 | * so we make ~70% filled hashtable | 676 | * so we make ~70% filled hashtable |
@@ -735,8 +735,9 @@ static int p4_get_escr_idx(unsigned int addr) | |||
735 | { | 735 | { |
736 | unsigned int idx = P4_ESCR_MSR_IDX(addr); | 736 | unsigned int idx = P4_ESCR_MSR_IDX(addr); |
737 | 737 | ||
738 | if (unlikely(idx >= P4_ESCR_MSR_TABLE_SIZE || | 738 | if (unlikely(idx >= P4_ESCR_MSR_TABLE_SIZE || |
739 | !p4_escr_table[idx])) { | 739 | !p4_escr_table[idx] || |
740 | p4_escr_table[idx] != addr)) { | ||
740 | WARN_ONCE(1, "P4 PMU: Wrong address passed: %x\n", addr); | 741 | WARN_ONCE(1, "P4 PMU: Wrong address passed: %x\n", addr); |
741 | return -1; | 742 | return -1; |
742 | } | 743 | } |
@@ -762,7 +763,7 @@ static int p4_pmu_schedule_events(struct cpu_hw_events *cpuc, int n, int *assign | |||
762 | { | 763 | { |
763 | unsigned long used_mask[BITS_TO_LONGS(X86_PMC_IDX_MAX)]; | 764 | unsigned long used_mask[BITS_TO_LONGS(X86_PMC_IDX_MAX)]; |
764 | unsigned long escr_mask[BITS_TO_LONGS(P4_ESCR_MSR_TABLE_SIZE)]; | 765 | unsigned long escr_mask[BITS_TO_LONGS(P4_ESCR_MSR_TABLE_SIZE)]; |
765 | int cpu = raw_smp_processor_id(); | 766 | int cpu = smp_processor_id(); |
766 | struct hw_perf_event *hwc; | 767 | struct hw_perf_event *hwc; |
767 | struct p4_event_bind *bind; | 768 | struct p4_event_bind *bind; |
768 | unsigned int i, thread, num; | 769 | unsigned int i, thread, num; |
diff --git a/arch/x86/kernel/cpu/vmware.c b/arch/x86/kernel/cpu/vmware.c index dfdb4dba2320..b9d1ff588445 100644 --- a/arch/x86/kernel/cpu/vmware.c +++ b/arch/x86/kernel/cpu/vmware.c | |||
@@ -24,8 +24,8 @@ | |||
24 | #include <linux/dmi.h> | 24 | #include <linux/dmi.h> |
25 | #include <linux/module.h> | 25 | #include <linux/module.h> |
26 | #include <asm/div64.h> | 26 | #include <asm/div64.h> |
27 | #include <asm/vmware.h> | ||
28 | #include <asm/x86_init.h> | 27 | #include <asm/x86_init.h> |
28 | #include <asm/hypervisor.h> | ||
29 | 29 | ||
30 | #define CPUID_VMWARE_INFO_LEAF 0x40000000 | 30 | #define CPUID_VMWARE_INFO_LEAF 0x40000000 |
31 | #define VMWARE_HYPERVISOR_MAGIC 0x564D5868 | 31 | #define VMWARE_HYPERVISOR_MAGIC 0x564D5868 |
@@ -65,7 +65,7 @@ static unsigned long vmware_get_tsc_khz(void) | |||
65 | return tsc_hz; | 65 | return tsc_hz; |
66 | } | 66 | } |
67 | 67 | ||
68 | void __init vmware_platform_setup(void) | 68 | static void __init vmware_platform_setup(void) |
69 | { | 69 | { |
70 | uint32_t eax, ebx, ecx, edx; | 70 | uint32_t eax, ebx, ecx, edx; |
71 | 71 | ||
@@ -83,26 +83,22 @@ void __init vmware_platform_setup(void) | |||
83 | * serial key should be enough, as this will always have a VMware | 83 | * serial key should be enough, as this will always have a VMware |
84 | * specific string when running under VMware hypervisor. | 84 | * specific string when running under VMware hypervisor. |
85 | */ | 85 | */ |
86 | int vmware_platform(void) | 86 | static bool __init vmware_platform(void) |
87 | { | 87 | { |
88 | if (cpu_has_hypervisor) { | 88 | if (cpu_has_hypervisor) { |
89 | unsigned int eax, ebx, ecx, edx; | 89 | unsigned int eax; |
90 | char hyper_vendor_id[13]; | 90 | unsigned int hyper_vendor_id[3]; |
91 | 91 | ||
92 | cpuid(CPUID_VMWARE_INFO_LEAF, &eax, &ebx, &ecx, &edx); | 92 | cpuid(CPUID_VMWARE_INFO_LEAF, &eax, &hyper_vendor_id[0], |
93 | memcpy(hyper_vendor_id + 0, &ebx, 4); | 93 | &hyper_vendor_id[1], &hyper_vendor_id[2]); |
94 | memcpy(hyper_vendor_id + 4, &ecx, 4); | 94 | if (!memcmp(hyper_vendor_id, "VMwareVMware", 12)) |
95 | memcpy(hyper_vendor_id + 8, &edx, 4); | 95 | return true; |
96 | hyper_vendor_id[12] = '\0'; | ||
97 | if (!strcmp(hyper_vendor_id, "VMwareVMware")) | ||
98 | return 1; | ||
99 | } else if (dmi_available && dmi_name_in_serial("VMware") && | 96 | } else if (dmi_available && dmi_name_in_serial("VMware") && |
100 | __vmware_platform()) | 97 | __vmware_platform()) |
101 | return 1; | 98 | return true; |
102 | 99 | ||
103 | return 0; | 100 | return false; |
104 | } | 101 | } |
105 | EXPORT_SYMBOL(vmware_platform); | ||
106 | 102 | ||
107 | /* | 103 | /* |
108 | * VMware hypervisor takes care of exporting a reliable TSC to the guest. | 104 | * VMware hypervisor takes care of exporting a reliable TSC to the guest. |
@@ -116,8 +112,16 @@ EXPORT_SYMBOL(vmware_platform); | |||
116 | * so that the kernel could just trust the hypervisor with providing a | 112 | * so that the kernel could just trust the hypervisor with providing a |
117 | * reliable virtual TSC that is suitable for timekeeping. | 113 | * reliable virtual TSC that is suitable for timekeeping. |
118 | */ | 114 | */ |
119 | void __cpuinit vmware_set_feature_bits(struct cpuinfo_x86 *c) | 115 | static void __cpuinit vmware_set_cpu_features(struct cpuinfo_x86 *c) |
120 | { | 116 | { |
121 | set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC); | 117 | set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC); |
122 | set_cpu_cap(c, X86_FEATURE_TSC_RELIABLE); | 118 | set_cpu_cap(c, X86_FEATURE_TSC_RELIABLE); |
123 | } | 119 | } |
120 | |||
121 | const __refconst struct hypervisor_x86 x86_hyper_vmware = { | ||
122 | .name = "VMware", | ||
123 | .detect = vmware_platform, | ||
124 | .set_cpu_features = vmware_set_cpu_features, | ||
125 | .init_platform = vmware_platform_setup, | ||
126 | }; | ||
127 | EXPORT_SYMBOL(x86_hyper_vmware); | ||
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S index 44a8e0dc6737..cd49141cf153 100644 --- a/arch/x86/kernel/entry_32.S +++ b/arch/x86/kernel/entry_32.S | |||
@@ -53,6 +53,7 @@ | |||
53 | #include <asm/processor-flags.h> | 53 | #include <asm/processor-flags.h> |
54 | #include <asm/ftrace.h> | 54 | #include <asm/ftrace.h> |
55 | #include <asm/irq_vectors.h> | 55 | #include <asm/irq_vectors.h> |
56 | #include <asm/cpufeature.h> | ||
56 | 57 | ||
57 | /* Avoid __ASSEMBLER__'ifying <linux/audit.h> just for this. */ | 58 | /* Avoid __ASSEMBLER__'ifying <linux/audit.h> just for this. */ |
58 | #include <linux/elf-em.h> | 59 | #include <linux/elf-em.h> |
@@ -905,7 +906,25 @@ ENTRY(simd_coprocessor_error) | |||
905 | RING0_INT_FRAME | 906 | RING0_INT_FRAME |
906 | pushl $0 | 907 | pushl $0 |
907 | CFI_ADJUST_CFA_OFFSET 4 | 908 | CFI_ADJUST_CFA_OFFSET 4 |
909 | #ifdef CONFIG_X86_INVD_BUG | ||
910 | /* AMD 486 bug: invd from userspace calls exception 19 instead of #GP */ | ||
911 | 661: pushl $do_general_protection | ||
912 | 662: | ||
913 | .section .altinstructions,"a" | ||
914 | .balign 4 | ||
915 | .long 661b | ||
916 | .long 663f | ||
917 | .byte X86_FEATURE_XMM | ||
918 | .byte 662b-661b | ||
919 | .byte 664f-663f | ||
920 | .previous | ||
921 | .section .altinstr_replacement,"ax" | ||
922 | 663: pushl $do_simd_coprocessor_error | ||
923 | 664: | ||
924 | .previous | ||
925 | #else | ||
908 | pushl $do_simd_coprocessor_error | 926 | pushl $do_simd_coprocessor_error |
927 | #endif | ||
909 | CFI_ADJUST_CFA_OFFSET 4 | 928 | CFI_ADJUST_CFA_OFFSET 4 |
910 | jmp error_code | 929 | jmp error_code |
911 | CFI_ENDPROC | 930 | CFI_ENDPROC |
diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c index 54c31c285488..86cef6b32253 100644 --- a/arch/x86/kernel/i387.c +++ b/arch/x86/kernel/i387.c | |||
@@ -102,65 +102,62 @@ void __cpuinit fpu_init(void) | |||
102 | 102 | ||
103 | mxcsr_feature_mask_init(); | 103 | mxcsr_feature_mask_init(); |
104 | /* clean state in init */ | 104 | /* clean state in init */ |
105 | if (cpu_has_xsave) | 105 | current_thread_info()->status = 0; |
106 | current_thread_info()->status = TS_XSAVE; | ||
107 | else | ||
108 | current_thread_info()->status = 0; | ||
109 | clear_used_math(); | 106 | clear_used_math(); |
110 | } | 107 | } |
111 | #endif /* CONFIG_X86_64 */ | 108 | #endif /* CONFIG_X86_64 */ |
112 | 109 | ||
113 | /* | 110 | static void fpu_finit(struct fpu *fpu) |
114 | * The _current_ task is using the FPU for the first time | ||
115 | * so initialize it and set the mxcsr to its default | ||
116 | * value at reset if we support XMM instructions and then | ||
117 | * remeber the current task has used the FPU. | ||
118 | */ | ||
119 | int init_fpu(struct task_struct *tsk) | ||
120 | { | 111 | { |
121 | if (tsk_used_math(tsk)) { | ||
122 | if (HAVE_HWFP && tsk == current) | ||
123 | unlazy_fpu(tsk); | ||
124 | return 0; | ||
125 | } | ||
126 | |||
127 | /* | ||
128 | * Memory allocation at the first usage of the FPU and other state. | ||
129 | */ | ||
130 | if (!tsk->thread.xstate) { | ||
131 | tsk->thread.xstate = kmem_cache_alloc(task_xstate_cachep, | ||
132 | GFP_KERNEL); | ||
133 | if (!tsk->thread.xstate) | ||
134 | return -ENOMEM; | ||
135 | } | ||
136 | |||
137 | #ifdef CONFIG_X86_32 | 112 | #ifdef CONFIG_X86_32 |
138 | if (!HAVE_HWFP) { | 113 | if (!HAVE_HWFP) { |
139 | memset(tsk->thread.xstate, 0, xstate_size); | 114 | finit_soft_fpu(&fpu->state->soft); |
140 | finit_task(tsk); | 115 | return; |
141 | set_stopped_child_used_math(tsk); | ||
142 | return 0; | ||
143 | } | 116 | } |
144 | #endif | 117 | #endif |
145 | 118 | ||
146 | if (cpu_has_fxsr) { | 119 | if (cpu_has_fxsr) { |
147 | struct i387_fxsave_struct *fx = &tsk->thread.xstate->fxsave; | 120 | struct i387_fxsave_struct *fx = &fpu->state->fxsave; |
148 | 121 | ||
149 | memset(fx, 0, xstate_size); | 122 | memset(fx, 0, xstate_size); |
150 | fx->cwd = 0x37f; | 123 | fx->cwd = 0x37f; |
151 | if (cpu_has_xmm) | 124 | if (cpu_has_xmm) |
152 | fx->mxcsr = MXCSR_DEFAULT; | 125 | fx->mxcsr = MXCSR_DEFAULT; |
153 | } else { | 126 | } else { |
154 | struct i387_fsave_struct *fp = &tsk->thread.xstate->fsave; | 127 | struct i387_fsave_struct *fp = &fpu->state->fsave; |
155 | memset(fp, 0, xstate_size); | 128 | memset(fp, 0, xstate_size); |
156 | fp->cwd = 0xffff037fu; | 129 | fp->cwd = 0xffff037fu; |
157 | fp->swd = 0xffff0000u; | 130 | fp->swd = 0xffff0000u; |
158 | fp->twd = 0xffffffffu; | 131 | fp->twd = 0xffffffffu; |
159 | fp->fos = 0xffff0000u; | 132 | fp->fos = 0xffff0000u; |
160 | } | 133 | } |
134 | } | ||
135 | |||
136 | /* | ||
137 | * The _current_ task is using the FPU for the first time | ||
138 | * so initialize it and set the mxcsr to its default | ||
139 | * value at reset if we support XMM instructions and then | ||
140 | * remeber the current task has used the FPU. | ||
141 | */ | ||
142 | int init_fpu(struct task_struct *tsk) | ||
143 | { | ||
144 | int ret; | ||
145 | |||
146 | if (tsk_used_math(tsk)) { | ||
147 | if (HAVE_HWFP && tsk == current) | ||
148 | unlazy_fpu(tsk); | ||
149 | return 0; | ||
150 | } | ||
151 | |||
161 | /* | 152 | /* |
162 | * Only the device not available exception or ptrace can call init_fpu. | 153 | * Memory allocation at the first usage of the FPU and other state. |
163 | */ | 154 | */ |
155 | ret = fpu_alloc(&tsk->thread.fpu); | ||
156 | if (ret) | ||
157 | return ret; | ||
158 | |||
159 | fpu_finit(&tsk->thread.fpu); | ||
160 | |||
164 | set_stopped_child_used_math(tsk); | 161 | set_stopped_child_used_math(tsk); |
165 | return 0; | 162 | return 0; |
166 | } | 163 | } |
@@ -194,7 +191,7 @@ int xfpregs_get(struct task_struct *target, const struct user_regset *regset, | |||
194 | return ret; | 191 | return ret; |
195 | 192 | ||
196 | return user_regset_copyout(&pos, &count, &kbuf, &ubuf, | 193 | return user_regset_copyout(&pos, &count, &kbuf, &ubuf, |
197 | &target->thread.xstate->fxsave, 0, -1); | 194 | &target->thread.fpu.state->fxsave, 0, -1); |
198 | } | 195 | } |
199 | 196 | ||
200 | int xfpregs_set(struct task_struct *target, const struct user_regset *regset, | 197 | int xfpregs_set(struct task_struct *target, const struct user_regset *regset, |
@@ -211,19 +208,19 @@ int xfpregs_set(struct task_struct *target, const struct user_regset *regset, | |||
211 | return ret; | 208 | return ret; |
212 | 209 | ||
213 | ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, | 210 | ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, |
214 | &target->thread.xstate->fxsave, 0, -1); | 211 | &target->thread.fpu.state->fxsave, 0, -1); |
215 | 212 | ||
216 | /* | 213 | /* |
217 | * mxcsr reserved bits must be masked to zero for security reasons. | 214 | * mxcsr reserved bits must be masked to zero for security reasons. |
218 | */ | 215 | */ |
219 | target->thread.xstate->fxsave.mxcsr &= mxcsr_feature_mask; | 216 | target->thread.fpu.state->fxsave.mxcsr &= mxcsr_feature_mask; |
220 | 217 | ||
221 | /* | 218 | /* |
222 | * update the header bits in the xsave header, indicating the | 219 | * update the header bits in the xsave header, indicating the |
223 | * presence of FP and SSE state. | 220 | * presence of FP and SSE state. |
224 | */ | 221 | */ |
225 | if (cpu_has_xsave) | 222 | if (cpu_has_xsave) |
226 | target->thread.xstate->xsave.xsave_hdr.xstate_bv |= XSTATE_FPSSE; | 223 | target->thread.fpu.state->xsave.xsave_hdr.xstate_bv |= XSTATE_FPSSE; |
227 | 224 | ||
228 | return ret; | 225 | return ret; |
229 | } | 226 | } |
@@ -246,14 +243,14 @@ int xstateregs_get(struct task_struct *target, const struct user_regset *regset, | |||
246 | * memory layout in the thread struct, so that we can copy the entire | 243 | * memory layout in the thread struct, so that we can copy the entire |
247 | * xstateregs to the user using one user_regset_copyout(). | 244 | * xstateregs to the user using one user_regset_copyout(). |
248 | */ | 245 | */ |
249 | memcpy(&target->thread.xstate->fxsave.sw_reserved, | 246 | memcpy(&target->thread.fpu.state->fxsave.sw_reserved, |
250 | xstate_fx_sw_bytes, sizeof(xstate_fx_sw_bytes)); | 247 | xstate_fx_sw_bytes, sizeof(xstate_fx_sw_bytes)); |
251 | 248 | ||
252 | /* | 249 | /* |
253 | * Copy the xstate memory layout. | 250 | * Copy the xstate memory layout. |
254 | */ | 251 | */ |
255 | ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, | 252 | ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, |
256 | &target->thread.xstate->xsave, 0, -1); | 253 | &target->thread.fpu.state->xsave, 0, -1); |
257 | return ret; | 254 | return ret; |
258 | } | 255 | } |
259 | 256 | ||
@@ -272,14 +269,14 @@ int xstateregs_set(struct task_struct *target, const struct user_regset *regset, | |||
272 | return ret; | 269 | return ret; |
273 | 270 | ||
274 | ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, | 271 | ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, |
275 | &target->thread.xstate->xsave, 0, -1); | 272 | &target->thread.fpu.state->xsave, 0, -1); |
276 | 273 | ||
277 | /* | 274 | /* |
278 | * mxcsr reserved bits must be masked to zero for security reasons. | 275 | * mxcsr reserved bits must be masked to zero for security reasons. |
279 | */ | 276 | */ |
280 | target->thread.xstate->fxsave.mxcsr &= mxcsr_feature_mask; | 277 | target->thread.fpu.state->fxsave.mxcsr &= mxcsr_feature_mask; |
281 | 278 | ||
282 | xsave_hdr = &target->thread.xstate->xsave.xsave_hdr; | 279 | xsave_hdr = &target->thread.fpu.state->xsave.xsave_hdr; |
283 | 280 | ||
284 | xsave_hdr->xstate_bv &= pcntxt_mask; | 281 | xsave_hdr->xstate_bv &= pcntxt_mask; |
285 | /* | 282 | /* |
@@ -365,7 +362,7 @@ static inline u32 twd_fxsr_to_i387(struct i387_fxsave_struct *fxsave) | |||
365 | static void | 362 | static void |
366 | convert_from_fxsr(struct user_i387_ia32_struct *env, struct task_struct *tsk) | 363 | convert_from_fxsr(struct user_i387_ia32_struct *env, struct task_struct *tsk) |
367 | { | 364 | { |
368 | struct i387_fxsave_struct *fxsave = &tsk->thread.xstate->fxsave; | 365 | struct i387_fxsave_struct *fxsave = &tsk->thread.fpu.state->fxsave; |
369 | struct _fpreg *to = (struct _fpreg *) &env->st_space[0]; | 366 | struct _fpreg *to = (struct _fpreg *) &env->st_space[0]; |
370 | struct _fpxreg *from = (struct _fpxreg *) &fxsave->st_space[0]; | 367 | struct _fpxreg *from = (struct _fpxreg *) &fxsave->st_space[0]; |
371 | int i; | 368 | int i; |
@@ -405,7 +402,7 @@ static void convert_to_fxsr(struct task_struct *tsk, | |||
405 | const struct user_i387_ia32_struct *env) | 402 | const struct user_i387_ia32_struct *env) |
406 | 403 | ||
407 | { | 404 | { |
408 | struct i387_fxsave_struct *fxsave = &tsk->thread.xstate->fxsave; | 405 | struct i387_fxsave_struct *fxsave = &tsk->thread.fpu.state->fxsave; |
409 | struct _fpreg *from = (struct _fpreg *) &env->st_space[0]; | 406 | struct _fpreg *from = (struct _fpreg *) &env->st_space[0]; |
410 | struct _fpxreg *to = (struct _fpxreg *) &fxsave->st_space[0]; | 407 | struct _fpxreg *to = (struct _fpxreg *) &fxsave->st_space[0]; |
411 | int i; | 408 | int i; |
@@ -445,7 +442,7 @@ int fpregs_get(struct task_struct *target, const struct user_regset *regset, | |||
445 | 442 | ||
446 | if (!cpu_has_fxsr) { | 443 | if (!cpu_has_fxsr) { |
447 | return user_regset_copyout(&pos, &count, &kbuf, &ubuf, | 444 | return user_regset_copyout(&pos, &count, &kbuf, &ubuf, |
448 | &target->thread.xstate->fsave, 0, | 445 | &target->thread.fpu.state->fsave, 0, |
449 | -1); | 446 | -1); |
450 | } | 447 | } |
451 | 448 | ||
@@ -475,7 +472,7 @@ int fpregs_set(struct task_struct *target, const struct user_regset *regset, | |||
475 | 472 | ||
476 | if (!cpu_has_fxsr) { | 473 | if (!cpu_has_fxsr) { |
477 | return user_regset_copyin(&pos, &count, &kbuf, &ubuf, | 474 | return user_regset_copyin(&pos, &count, &kbuf, &ubuf, |
478 | &target->thread.xstate->fsave, 0, -1); | 475 | &target->thread.fpu.state->fsave, 0, -1); |
479 | } | 476 | } |
480 | 477 | ||
481 | if (pos > 0 || count < sizeof(env)) | 478 | if (pos > 0 || count < sizeof(env)) |
@@ -490,7 +487,7 @@ int fpregs_set(struct task_struct *target, const struct user_regset *regset, | |||
490 | * presence of FP. | 487 | * presence of FP. |
491 | */ | 488 | */ |
492 | if (cpu_has_xsave) | 489 | if (cpu_has_xsave) |
493 | target->thread.xstate->xsave.xsave_hdr.xstate_bv |= XSTATE_FP; | 490 | target->thread.fpu.state->xsave.xsave_hdr.xstate_bv |= XSTATE_FP; |
494 | return ret; | 491 | return ret; |
495 | } | 492 | } |
496 | 493 | ||
@@ -501,7 +498,7 @@ int fpregs_set(struct task_struct *target, const struct user_regset *regset, | |||
501 | static inline int save_i387_fsave(struct _fpstate_ia32 __user *buf) | 498 | static inline int save_i387_fsave(struct _fpstate_ia32 __user *buf) |
502 | { | 499 | { |
503 | struct task_struct *tsk = current; | 500 | struct task_struct *tsk = current; |
504 | struct i387_fsave_struct *fp = &tsk->thread.xstate->fsave; | 501 | struct i387_fsave_struct *fp = &tsk->thread.fpu.state->fsave; |
505 | 502 | ||
506 | fp->status = fp->swd; | 503 | fp->status = fp->swd; |
507 | if (__copy_to_user(buf, fp, sizeof(struct i387_fsave_struct))) | 504 | if (__copy_to_user(buf, fp, sizeof(struct i387_fsave_struct))) |
@@ -512,7 +509,7 @@ static inline int save_i387_fsave(struct _fpstate_ia32 __user *buf) | |||
512 | static int save_i387_fxsave(struct _fpstate_ia32 __user *buf) | 509 | static int save_i387_fxsave(struct _fpstate_ia32 __user *buf) |
513 | { | 510 | { |
514 | struct task_struct *tsk = current; | 511 | struct task_struct *tsk = current; |
515 | struct i387_fxsave_struct *fx = &tsk->thread.xstate->fxsave; | 512 | struct i387_fxsave_struct *fx = &tsk->thread.fpu.state->fxsave; |
516 | struct user_i387_ia32_struct env; | 513 | struct user_i387_ia32_struct env; |
517 | int err = 0; | 514 | int err = 0; |
518 | 515 | ||
@@ -547,7 +544,7 @@ static int save_i387_xsave(void __user *buf) | |||
547 | * header as well as change any contents in the memory layout. | 544 | * header as well as change any contents in the memory layout. |
548 | * xrestore as part of sigreturn will capture all the changes. | 545 | * xrestore as part of sigreturn will capture all the changes. |
549 | */ | 546 | */ |
550 | tsk->thread.xstate->xsave.xsave_hdr.xstate_bv |= XSTATE_FPSSE; | 547 | tsk->thread.fpu.state->xsave.xsave_hdr.xstate_bv |= XSTATE_FPSSE; |
551 | 548 | ||
552 | if (save_i387_fxsave(fx) < 0) | 549 | if (save_i387_fxsave(fx) < 0) |
553 | return -1; | 550 | return -1; |
@@ -599,7 +596,7 @@ static inline int restore_i387_fsave(struct _fpstate_ia32 __user *buf) | |||
599 | { | 596 | { |
600 | struct task_struct *tsk = current; | 597 | struct task_struct *tsk = current; |
601 | 598 | ||
602 | return __copy_from_user(&tsk->thread.xstate->fsave, buf, | 599 | return __copy_from_user(&tsk->thread.fpu.state->fsave, buf, |
603 | sizeof(struct i387_fsave_struct)); | 600 | sizeof(struct i387_fsave_struct)); |
604 | } | 601 | } |
605 | 602 | ||
@@ -610,10 +607,10 @@ static int restore_i387_fxsave(struct _fpstate_ia32 __user *buf, | |||
610 | struct user_i387_ia32_struct env; | 607 | struct user_i387_ia32_struct env; |
611 | int err; | 608 | int err; |
612 | 609 | ||
613 | err = __copy_from_user(&tsk->thread.xstate->fxsave, &buf->_fxsr_env[0], | 610 | err = __copy_from_user(&tsk->thread.fpu.state->fxsave, &buf->_fxsr_env[0], |
614 | size); | 611 | size); |
615 | /* mxcsr reserved bits must be masked to zero for security reasons */ | 612 | /* mxcsr reserved bits must be masked to zero for security reasons */ |
616 | tsk->thread.xstate->fxsave.mxcsr &= mxcsr_feature_mask; | 613 | tsk->thread.fpu.state->fxsave.mxcsr &= mxcsr_feature_mask; |
617 | if (err || __copy_from_user(&env, buf, sizeof(env))) | 614 | if (err || __copy_from_user(&env, buf, sizeof(env))) |
618 | return 1; | 615 | return 1; |
619 | convert_to_fxsr(tsk, &env); | 616 | convert_to_fxsr(tsk, &env); |
@@ -629,7 +626,7 @@ static int restore_i387_xsave(void __user *buf) | |||
629 | struct i387_fxsave_struct __user *fx = | 626 | struct i387_fxsave_struct __user *fx = |
630 | (struct i387_fxsave_struct __user *) &fx_user->_fxsr_env[0]; | 627 | (struct i387_fxsave_struct __user *) &fx_user->_fxsr_env[0]; |
631 | struct xsave_hdr_struct *xsave_hdr = | 628 | struct xsave_hdr_struct *xsave_hdr = |
632 | ¤t->thread.xstate->xsave.xsave_hdr; | 629 | ¤t->thread.fpu.state->xsave.xsave_hdr; |
633 | u64 mask; | 630 | u64 mask; |
634 | int err; | 631 | int err; |
635 | 632 | ||
diff --git a/arch/x86/kernel/i8253.c b/arch/x86/kernel/i8253.c index 23c167925a5c..2dfd31597443 100644 --- a/arch/x86/kernel/i8253.c +++ b/arch/x86/kernel/i8253.c | |||
@@ -16,7 +16,7 @@ | |||
16 | #include <asm/hpet.h> | 16 | #include <asm/hpet.h> |
17 | #include <asm/smp.h> | 17 | #include <asm/smp.h> |
18 | 18 | ||
19 | DEFINE_SPINLOCK(i8253_lock); | 19 | DEFINE_RAW_SPINLOCK(i8253_lock); |
20 | EXPORT_SYMBOL(i8253_lock); | 20 | EXPORT_SYMBOL(i8253_lock); |
21 | 21 | ||
22 | /* | 22 | /* |
@@ -33,7 +33,7 @@ struct clock_event_device *global_clock_event; | |||
33 | static void init_pit_timer(enum clock_event_mode mode, | 33 | static void init_pit_timer(enum clock_event_mode mode, |
34 | struct clock_event_device *evt) | 34 | struct clock_event_device *evt) |
35 | { | 35 | { |
36 | spin_lock(&i8253_lock); | 36 | raw_spin_lock(&i8253_lock); |
37 | 37 | ||
38 | switch (mode) { | 38 | switch (mode) { |
39 | case CLOCK_EVT_MODE_PERIODIC: | 39 | case CLOCK_EVT_MODE_PERIODIC: |
@@ -62,7 +62,7 @@ static void init_pit_timer(enum clock_event_mode mode, | |||
62 | /* Nothing to do here */ | 62 | /* Nothing to do here */ |
63 | break; | 63 | break; |
64 | } | 64 | } |
65 | spin_unlock(&i8253_lock); | 65 | raw_spin_unlock(&i8253_lock); |
66 | } | 66 | } |
67 | 67 | ||
68 | /* | 68 | /* |
@@ -72,10 +72,10 @@ static void init_pit_timer(enum clock_event_mode mode, | |||
72 | */ | 72 | */ |
73 | static int pit_next_event(unsigned long delta, struct clock_event_device *evt) | 73 | static int pit_next_event(unsigned long delta, struct clock_event_device *evt) |
74 | { | 74 | { |
75 | spin_lock(&i8253_lock); | 75 | raw_spin_lock(&i8253_lock); |
76 | outb_pit(delta & 0xff , PIT_CH0); /* LSB */ | 76 | outb_pit(delta & 0xff , PIT_CH0); /* LSB */ |
77 | outb_pit(delta >> 8 , PIT_CH0); /* MSB */ | 77 | outb_pit(delta >> 8 , PIT_CH0); /* MSB */ |
78 | spin_unlock(&i8253_lock); | 78 | raw_spin_unlock(&i8253_lock); |
79 | 79 | ||
80 | return 0; | 80 | return 0; |
81 | } | 81 | } |
@@ -130,7 +130,7 @@ static cycle_t pit_read(struct clocksource *cs) | |||
130 | int count; | 130 | int count; |
131 | u32 jifs; | 131 | u32 jifs; |
132 | 132 | ||
133 | spin_lock_irqsave(&i8253_lock, flags); | 133 | raw_spin_lock_irqsave(&i8253_lock, flags); |
134 | /* | 134 | /* |
135 | * Although our caller may have the read side of xtime_lock, | 135 | * Although our caller may have the read side of xtime_lock, |
136 | * this is now a seqlock, and we are cheating in this routine | 136 | * this is now a seqlock, and we are cheating in this routine |
@@ -176,7 +176,7 @@ static cycle_t pit_read(struct clocksource *cs) | |||
176 | old_count = count; | 176 | old_count = count; |
177 | old_jifs = jifs; | 177 | old_jifs = jifs; |
178 | 178 | ||
179 | spin_unlock_irqrestore(&i8253_lock, flags); | 179 | raw_spin_unlock_irqrestore(&i8253_lock, flags); |
180 | 180 | ||
181 | count = (LATCH - 1) - count; | 181 | count = (LATCH - 1) - count; |
182 | 182 | ||
diff --git a/arch/x86/kernel/irqinit.c b/arch/x86/kernel/irqinit.c index 0ed2d300cd46..990ae7cfc578 100644 --- a/arch/x86/kernel/irqinit.c +++ b/arch/x86/kernel/irqinit.c | |||
@@ -60,7 +60,7 @@ static irqreturn_t math_error_irq(int cpl, void *dev_id) | |||
60 | outb(0, 0xF0); | 60 | outb(0, 0xF0); |
61 | if (ignore_fpu_irq || !boot_cpu_data.hard_math) | 61 | if (ignore_fpu_irq || !boot_cpu_data.hard_math) |
62 | return IRQ_NONE; | 62 | return IRQ_NONE; |
63 | math_error((void __user *)get_irq_regs()->ip); | 63 | math_error(get_irq_regs(), 0, 16); |
64 | return IRQ_HANDLED; | 64 | return IRQ_HANDLED; |
65 | } | 65 | } |
66 | 66 | ||
diff --git a/arch/x86/kernel/kprobes.c b/arch/x86/kernel/kprobes.c index f2f56c0967b6..345a4b1fe144 100644 --- a/arch/x86/kernel/kprobes.c +++ b/arch/x86/kernel/kprobes.c | |||
@@ -542,20 +542,6 @@ static int __kprobes kprobe_handler(struct pt_regs *regs) | |||
542 | struct kprobe_ctlblk *kcb; | 542 | struct kprobe_ctlblk *kcb; |
543 | 543 | ||
544 | addr = (kprobe_opcode_t *)(regs->ip - sizeof(kprobe_opcode_t)); | 544 | addr = (kprobe_opcode_t *)(regs->ip - sizeof(kprobe_opcode_t)); |
545 | if (*addr != BREAKPOINT_INSTRUCTION) { | ||
546 | /* | ||
547 | * The breakpoint instruction was removed right | ||
548 | * after we hit it. Another cpu has removed | ||
549 | * either a probepoint or a debugger breakpoint | ||
550 | * at this address. In either case, no further | ||
551 | * handling of this interrupt is appropriate. | ||
552 | * Back up over the (now missing) int3 and run | ||
553 | * the original instruction. | ||
554 | */ | ||
555 | regs->ip = (unsigned long)addr; | ||
556 | return 1; | ||
557 | } | ||
558 | |||
559 | /* | 545 | /* |
560 | * We don't want to be preempted for the entire | 546 | * We don't want to be preempted for the entire |
561 | * duration of kprobe processing. We conditionally | 547 | * duration of kprobe processing. We conditionally |
@@ -587,6 +573,19 @@ static int __kprobes kprobe_handler(struct pt_regs *regs) | |||
587 | setup_singlestep(p, regs, kcb, 0); | 573 | setup_singlestep(p, regs, kcb, 0); |
588 | return 1; | 574 | return 1; |
589 | } | 575 | } |
576 | } else if (*addr != BREAKPOINT_INSTRUCTION) { | ||
577 | /* | ||
578 | * The breakpoint instruction was removed right | ||
579 | * after we hit it. Another cpu has removed | ||
580 | * either a probepoint or a debugger breakpoint | ||
581 | * at this address. In either case, no further | ||
582 | * handling of this interrupt is appropriate. | ||
583 | * Back up over the (now missing) int3 and run | ||
584 | * the original instruction. | ||
585 | */ | ||
586 | regs->ip = (unsigned long)addr; | ||
587 | preempt_enable_no_resched(); | ||
588 | return 1; | ||
590 | } else if (kprobe_running()) { | 589 | } else if (kprobe_running()) { |
591 | p = __get_cpu_var(current_kprobe); | 590 | p = __get_cpu_var(current_kprobe); |
592 | if (p->break_handler && p->break_handler(p, regs)) { | 591 | if (p->break_handler && p->break_handler(p, regs)) { |
diff --git a/arch/x86/kernel/microcode_core.c b/arch/x86/kernel/microcode_core.c index cceb5bc3c3c2..2cd8c544e41a 100644 --- a/arch/x86/kernel/microcode_core.c +++ b/arch/x86/kernel/microcode_core.c | |||
@@ -201,9 +201,9 @@ static int do_microcode_update(const void __user *buf, size_t size) | |||
201 | return error; | 201 | return error; |
202 | } | 202 | } |
203 | 203 | ||
204 | static int microcode_open(struct inode *unused1, struct file *unused2) | 204 | static int microcode_open(struct inode *inode, struct file *file) |
205 | { | 205 | { |
206 | return capable(CAP_SYS_RAWIO) ? 0 : -EPERM; | 206 | return capable(CAP_SYS_RAWIO) ? nonseekable_open(inode, file) : -EPERM; |
207 | } | 207 | } |
208 | 208 | ||
209 | static ssize_t microcode_write(struct file *file, const char __user *buf, | 209 | static ssize_t microcode_write(struct file *file, const char __user *buf, |
diff --git a/arch/x86/kernel/microcode_intel.c b/arch/x86/kernel/microcode_intel.c index 85a343e28937..356170262a93 100644 --- a/arch/x86/kernel/microcode_intel.c +++ b/arch/x86/kernel/microcode_intel.c | |||
@@ -343,10 +343,11 @@ static enum ucode_state generic_load_microcode(int cpu, void *data, size_t size, | |||
343 | int (*get_ucode_data)(void *, const void *, size_t)) | 343 | int (*get_ucode_data)(void *, const void *, size_t)) |
344 | { | 344 | { |
345 | struct ucode_cpu_info *uci = ucode_cpu_info + cpu; | 345 | struct ucode_cpu_info *uci = ucode_cpu_info + cpu; |
346 | u8 *ucode_ptr = data, *new_mc = NULL, *mc; | 346 | u8 *ucode_ptr = data, *new_mc = NULL, *mc = NULL; |
347 | int new_rev = uci->cpu_sig.rev; | 347 | int new_rev = uci->cpu_sig.rev; |
348 | unsigned int leftover = size; | 348 | unsigned int leftover = size; |
349 | enum ucode_state state = UCODE_OK; | 349 | enum ucode_state state = UCODE_OK; |
350 | unsigned int curr_mc_size = 0; | ||
350 | 351 | ||
351 | while (leftover) { | 352 | while (leftover) { |
352 | struct microcode_header_intel mc_header; | 353 | struct microcode_header_intel mc_header; |
@@ -361,9 +362,15 @@ static enum ucode_state generic_load_microcode(int cpu, void *data, size_t size, | |||
361 | break; | 362 | break; |
362 | } | 363 | } |
363 | 364 | ||
364 | mc = vmalloc(mc_size); | 365 | /* For performance reasons, reuse mc area when possible */ |
365 | if (!mc) | 366 | if (!mc || mc_size > curr_mc_size) { |
366 | break; | 367 | if (mc) |
368 | vfree(mc); | ||
369 | mc = vmalloc(mc_size); | ||
370 | if (!mc) | ||
371 | break; | ||
372 | curr_mc_size = mc_size; | ||
373 | } | ||
367 | 374 | ||
368 | if (get_ucode_data(mc, ucode_ptr, mc_size) || | 375 | if (get_ucode_data(mc, ucode_ptr, mc_size) || |
369 | microcode_sanity_check(mc) < 0) { | 376 | microcode_sanity_check(mc) < 0) { |
@@ -376,13 +383,16 @@ static enum ucode_state generic_load_microcode(int cpu, void *data, size_t size, | |||
376 | vfree(new_mc); | 383 | vfree(new_mc); |
377 | new_rev = mc_header.rev; | 384 | new_rev = mc_header.rev; |
378 | new_mc = mc; | 385 | new_mc = mc; |
379 | } else | 386 | mc = NULL; /* trigger new vmalloc */ |
380 | vfree(mc); | 387 | } |
381 | 388 | ||
382 | ucode_ptr += mc_size; | 389 | ucode_ptr += mc_size; |
383 | leftover -= mc_size; | 390 | leftover -= mc_size; |
384 | } | 391 | } |
385 | 392 | ||
393 | if (mc) | ||
394 | vfree(mc); | ||
395 | |||
386 | if (leftover) { | 396 | if (leftover) { |
387 | if (new_mc) | 397 | if (new_mc) |
388 | vfree(new_mc); | 398 | vfree(new_mc); |
diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c index e81030f71a8f..5ae5d2426edf 100644 --- a/arch/x86/kernel/mpparse.c +++ b/arch/x86/kernel/mpparse.c | |||
@@ -115,21 +115,6 @@ static void __init MP_bus_info(struct mpc_bus *m) | |||
115 | printk(KERN_WARNING "Unknown bustype %s - ignoring\n", str); | 115 | printk(KERN_WARNING "Unknown bustype %s - ignoring\n", str); |
116 | } | 116 | } |
117 | 117 | ||
118 | static int bad_ioapic(unsigned long address) | ||
119 | { | ||
120 | if (nr_ioapics >= MAX_IO_APICS) { | ||
121 | printk(KERN_ERR "ERROR: Max # of I/O APICs (%d) exceeded " | ||
122 | "(found %d)\n", MAX_IO_APICS, nr_ioapics); | ||
123 | panic("Recompile kernel with bigger MAX_IO_APICS!\n"); | ||
124 | } | ||
125 | if (!address) { | ||
126 | printk(KERN_ERR "WARNING: Bogus (zero) I/O APIC address" | ||
127 | " found in table, skipping!\n"); | ||
128 | return 1; | ||
129 | } | ||
130 | return 0; | ||
131 | } | ||
132 | |||
133 | static void __init MP_ioapic_info(struct mpc_ioapic *m) | 118 | static void __init MP_ioapic_info(struct mpc_ioapic *m) |
134 | { | 119 | { |
135 | if (!(m->flags & MPC_APIC_USABLE)) | 120 | if (!(m->flags & MPC_APIC_USABLE)) |
@@ -138,15 +123,7 @@ static void __init MP_ioapic_info(struct mpc_ioapic *m) | |||
138 | printk(KERN_INFO "I/O APIC #%d Version %d at 0x%X.\n", | 123 | printk(KERN_INFO "I/O APIC #%d Version %d at 0x%X.\n", |
139 | m->apicid, m->apicver, m->apicaddr); | 124 | m->apicid, m->apicver, m->apicaddr); |
140 | 125 | ||
141 | if (bad_ioapic(m->apicaddr)) | 126 | mp_register_ioapic(m->apicid, m->apicaddr, gsi_end + 1); |
142 | return; | ||
143 | |||
144 | mp_ioapics[nr_ioapics].apicaddr = m->apicaddr; | ||
145 | mp_ioapics[nr_ioapics].apicid = m->apicid; | ||
146 | mp_ioapics[nr_ioapics].type = m->type; | ||
147 | mp_ioapics[nr_ioapics].apicver = m->apicver; | ||
148 | mp_ioapics[nr_ioapics].flags = m->flags; | ||
149 | nr_ioapics++; | ||
150 | } | 127 | } |
151 | 128 | ||
152 | static void print_MP_intsrc_info(struct mpc_intsrc *m) | 129 | static void print_MP_intsrc_info(struct mpc_intsrc *m) |
diff --git a/arch/x86/kernel/mrst.c b/arch/x86/kernel/mrst.c index 0aad8670858e..e796448f0eb5 100644 --- a/arch/x86/kernel/mrst.c +++ b/arch/x86/kernel/mrst.c | |||
@@ -237,4 +237,9 @@ void __init x86_mrst_early_setup(void) | |||
237 | x86_init.pci.fixup_irqs = x86_init_noop; | 237 | x86_init.pci.fixup_irqs = x86_init_noop; |
238 | 238 | ||
239 | legacy_pic = &null_legacy_pic; | 239 | legacy_pic = &null_legacy_pic; |
240 | |||
241 | /* Avoid searching for BIOS MP tables */ | ||
242 | x86_init.mpparse.find_smp_config = x86_init_noop; | ||
243 | x86_init.mpparse.get_smp_config = x86_init_uint_noop; | ||
244 | |||
240 | } | 245 | } |
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index eccdb57094e3..e7e35219b32f 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c | |||
@@ -31,24 +31,22 @@ struct kmem_cache *task_xstate_cachep; | |||
31 | 31 | ||
32 | int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) | 32 | int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) |
33 | { | 33 | { |
34 | int ret; | ||
35 | |||
34 | *dst = *src; | 36 | *dst = *src; |
35 | if (src->thread.xstate) { | 37 | if (fpu_allocated(&src->thread.fpu)) { |
36 | dst->thread.xstate = kmem_cache_alloc(task_xstate_cachep, | 38 | memset(&dst->thread.fpu, 0, sizeof(dst->thread.fpu)); |
37 | GFP_KERNEL); | 39 | ret = fpu_alloc(&dst->thread.fpu); |
38 | if (!dst->thread.xstate) | 40 | if (ret) |
39 | return -ENOMEM; | 41 | return ret; |
40 | WARN_ON((unsigned long)dst->thread.xstate & 15); | 42 | fpu_copy(&dst->thread.fpu, &src->thread.fpu); |
41 | memcpy(dst->thread.xstate, src->thread.xstate, xstate_size); | ||
42 | } | 43 | } |
43 | return 0; | 44 | return 0; |
44 | } | 45 | } |
45 | 46 | ||
46 | void free_thread_xstate(struct task_struct *tsk) | 47 | void free_thread_xstate(struct task_struct *tsk) |
47 | { | 48 | { |
48 | if (tsk->thread.xstate) { | 49 | fpu_free(&tsk->thread.fpu); |
49 | kmem_cache_free(task_xstate_cachep, tsk->thread.xstate); | ||
50 | tsk->thread.xstate = NULL; | ||
51 | } | ||
52 | } | 50 | } |
53 | 51 | ||
54 | void free_thread_info(struct thread_info *ti) | 52 | void free_thread_info(struct thread_info *ti) |
@@ -548,11 +546,13 @@ static int __cpuinit check_c1e_idle(const struct cpuinfo_x86 *c) | |||
548 | * check OSVW bit for CPUs that are not affected | 546 | * check OSVW bit for CPUs that are not affected |
549 | * by erratum #400 | 547 | * by erratum #400 |
550 | */ | 548 | */ |
551 | rdmsrl(MSR_AMD64_OSVW_ID_LENGTH, val); | 549 | if (cpu_has(c, X86_FEATURE_OSVW)) { |
552 | if (val >= 2) { | 550 | rdmsrl(MSR_AMD64_OSVW_ID_LENGTH, val); |
553 | rdmsrl(MSR_AMD64_OSVW_STATUS, val); | 551 | if (val >= 2) { |
554 | if (!(val & BIT(1))) | 552 | rdmsrl(MSR_AMD64_OSVW_STATUS, val); |
555 | goto no_c1e_idle; | 553 | if (!(val & BIT(1))) |
554 | goto no_c1e_idle; | ||
555 | } | ||
556 | } | 556 | } |
557 | return 1; | 557 | return 1; |
558 | } | 558 | } |
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c index 75090c589b7a..8d128783af47 100644 --- a/arch/x86/kernel/process_32.c +++ b/arch/x86/kernel/process_32.c | |||
@@ -309,7 +309,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) | |||
309 | 309 | ||
310 | /* we're going to use this soon, after a few expensive things */ | 310 | /* we're going to use this soon, after a few expensive things */ |
311 | if (preload_fpu) | 311 | if (preload_fpu) |
312 | prefetch(next->xstate); | 312 | prefetch(next->fpu.state); |
313 | 313 | ||
314 | /* | 314 | /* |
315 | * Reload esp0. | 315 | * Reload esp0. |
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c index 50cc84ac0a0d..3c2422a99f1f 100644 --- a/arch/x86/kernel/process_64.c +++ b/arch/x86/kernel/process_64.c | |||
@@ -388,7 +388,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) | |||
388 | 388 | ||
389 | /* we're going to use this soon, after a few expensive things */ | 389 | /* we're going to use this soon, after a few expensive things */ |
390 | if (preload_fpu) | 390 | if (preload_fpu) |
391 | prefetch(next->xstate); | 391 | prefetch(next->fpu.state); |
392 | 392 | ||
393 | /* | 393 | /* |
394 | * Reload esp0, LDT and the page table pointer: | 394 | * Reload esp0, LDT and the page table pointer: |
diff --git a/arch/x86/kernel/sfi.c b/arch/x86/kernel/sfi.c index 34e099382651..7ded57896c0a 100644 --- a/arch/x86/kernel/sfi.c +++ b/arch/x86/kernel/sfi.c | |||
@@ -81,7 +81,6 @@ static int __init sfi_parse_cpus(struct sfi_table_header *table) | |||
81 | #endif /* CONFIG_X86_LOCAL_APIC */ | 81 | #endif /* CONFIG_X86_LOCAL_APIC */ |
82 | 82 | ||
83 | #ifdef CONFIG_X86_IO_APIC | 83 | #ifdef CONFIG_X86_IO_APIC |
84 | static u32 gsi_base; | ||
85 | 84 | ||
86 | static int __init sfi_parse_ioapic(struct sfi_table_header *table) | 85 | static int __init sfi_parse_ioapic(struct sfi_table_header *table) |
87 | { | 86 | { |
@@ -94,8 +93,7 @@ static int __init sfi_parse_ioapic(struct sfi_table_header *table) | |||
94 | pentry = (struct sfi_apic_table_entry *)sb->pentry; | 93 | pentry = (struct sfi_apic_table_entry *)sb->pentry; |
95 | 94 | ||
96 | for (i = 0; i < num; i++) { | 95 | for (i = 0; i < num; i++) { |
97 | mp_register_ioapic(i, pentry->phys_addr, gsi_base); | 96 | mp_register_ioapic(i, pentry->phys_addr, gsi_end + 1); |
98 | gsi_base += io_apic_get_redir_entries(i); | ||
99 | pentry++; | 97 | pentry++; |
100 | } | 98 | } |
101 | 99 | ||
diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c index 86c9f91b48ae..cc2c60474fd0 100644 --- a/arch/x86/kernel/tboot.c +++ b/arch/x86/kernel/tboot.c | |||
@@ -175,6 +175,9 @@ static void add_mac_region(phys_addr_t start, unsigned long size) | |||
175 | struct tboot_mac_region *mr; | 175 | struct tboot_mac_region *mr; |
176 | phys_addr_t end = start + size; | 176 | phys_addr_t end = start + size; |
177 | 177 | ||
178 | if (tboot->num_mac_regions >= MAX_TB_MAC_REGIONS) | ||
179 | panic("tboot: Too many MAC regions\n"); | ||
180 | |||
178 | if (start && size) { | 181 | if (start && size) { |
179 | mr = &tboot->mac_regions[tboot->num_mac_regions++]; | 182 | mr = &tboot->mac_regions[tboot->num_mac_regions++]; |
180 | mr->start = round_down(start, PAGE_SIZE); | 183 | mr->start = round_down(start, PAGE_SIZE); |
@@ -184,18 +187,17 @@ static void add_mac_region(phys_addr_t start, unsigned long size) | |||
184 | 187 | ||
185 | static int tboot_setup_sleep(void) | 188 | static int tboot_setup_sleep(void) |
186 | { | 189 | { |
190 | int i; | ||
191 | |||
187 | tboot->num_mac_regions = 0; | 192 | tboot->num_mac_regions = 0; |
188 | 193 | ||
189 | /* S3 resume code */ | 194 | for (i = 0; i < e820.nr_map; i++) { |
190 | add_mac_region(acpi_wakeup_address, WAKEUP_SIZE); | 195 | if ((e820.map[i].type != E820_RAM) |
196 | && (e820.map[i].type != E820_RESERVED_KERN)) | ||
197 | continue; | ||
191 | 198 | ||
192 | #ifdef CONFIG_X86_TRAMPOLINE | 199 | add_mac_region(e820.map[i].addr, e820.map[i].size); |
193 | /* AP trampoline code */ | 200 | } |
194 | add_mac_region(virt_to_phys(trampoline_base), TRAMPOLINE_SIZE); | ||
195 | #endif | ||
196 | |||
197 | /* kernel code + data + bss */ | ||
198 | add_mac_region(virt_to_phys(_text), _end - _text); | ||
199 | 201 | ||
200 | tboot->acpi_sinfo.kernel_s3_resume_vector = acpi_wakeup_address; | 202 | tboot->acpi_sinfo.kernel_s3_resume_vector = acpi_wakeup_address; |
201 | 203 | ||
diff --git a/arch/x86/kernel/tlb_uv.c b/arch/x86/kernel/tlb_uv.c index 17b03dd3a6b5..7fea555929e2 100644 --- a/arch/x86/kernel/tlb_uv.c +++ b/arch/x86/kernel/tlb_uv.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * SGI UltraViolet TLB flush routines. | 2 | * SGI UltraViolet TLB flush routines. |
3 | * | 3 | * |
4 | * (c) 2008 Cliff Wickman <cpw@sgi.com>, SGI. | 4 | * (c) 2008-2010 Cliff Wickman <cpw@sgi.com>, SGI. |
5 | * | 5 | * |
6 | * This code is released under the GNU General Public License version 2 or | 6 | * This code is released under the GNU General Public License version 2 or |
7 | * later. | 7 | * later. |
@@ -20,42 +20,67 @@ | |||
20 | #include <asm/idle.h> | 20 | #include <asm/idle.h> |
21 | #include <asm/tsc.h> | 21 | #include <asm/tsc.h> |
22 | #include <asm/irq_vectors.h> | 22 | #include <asm/irq_vectors.h> |
23 | #include <asm/timer.h> | ||
23 | 24 | ||
24 | static struct bau_control **uv_bau_table_bases __read_mostly; | 25 | struct msg_desc { |
25 | static int uv_bau_retry_limit __read_mostly; | 26 | struct bau_payload_queue_entry *msg; |
27 | int msg_slot; | ||
28 | int sw_ack_slot; | ||
29 | struct bau_payload_queue_entry *va_queue_first; | ||
30 | struct bau_payload_queue_entry *va_queue_last; | ||
31 | }; | ||
26 | 32 | ||
27 | /* base pnode in this partition */ | 33 | #define UV_INTD_SOFT_ACK_TIMEOUT_PERIOD 0x000000000bUL |
28 | static int uv_partition_base_pnode __read_mostly; | 34 | |
35 | static int uv_bau_max_concurrent __read_mostly; | ||
36 | |||
37 | static int nobau; | ||
38 | static int __init setup_nobau(char *arg) | ||
39 | { | ||
40 | nobau = 1; | ||
41 | return 0; | ||
42 | } | ||
43 | early_param("nobau", setup_nobau); | ||
29 | 44 | ||
30 | static unsigned long uv_mmask __read_mostly; | 45 | /* base pnode in this partition */ |
46 | static int uv_partition_base_pnode __read_mostly; | ||
47 | /* position of pnode (which is nasid>>1): */ | ||
48 | static int uv_nshift __read_mostly; | ||
49 | static unsigned long uv_mmask __read_mostly; | ||
31 | 50 | ||
32 | static DEFINE_PER_CPU(struct ptc_stats, ptcstats); | 51 | static DEFINE_PER_CPU(struct ptc_stats, ptcstats); |
33 | static DEFINE_PER_CPU(struct bau_control, bau_control); | 52 | static DEFINE_PER_CPU(struct bau_control, bau_control); |
53 | static DEFINE_PER_CPU(cpumask_var_t, uv_flush_tlb_mask); | ||
54 | |||
55 | struct reset_args { | ||
56 | int sender; | ||
57 | }; | ||
34 | 58 | ||
35 | /* | 59 | /* |
36 | * Determine the first node on a blade. | 60 | * Determine the first node on a uvhub. 'Nodes' are used for kernel |
61 | * memory allocation. | ||
37 | */ | 62 | */ |
38 | static int __init blade_to_first_node(int blade) | 63 | static int __init uvhub_to_first_node(int uvhub) |
39 | { | 64 | { |
40 | int node, b; | 65 | int node, b; |
41 | 66 | ||
42 | for_each_online_node(node) { | 67 | for_each_online_node(node) { |
43 | b = uv_node_to_blade_id(node); | 68 | b = uv_node_to_blade_id(node); |
44 | if (blade == b) | 69 | if (uvhub == b) |
45 | return node; | 70 | return node; |
46 | } | 71 | } |
47 | return -1; /* shouldn't happen */ | 72 | return -1; |
48 | } | 73 | } |
49 | 74 | ||
50 | /* | 75 | /* |
51 | * Determine the apicid of the first cpu on a blade. | 76 | * Determine the apicid of the first cpu on a uvhub. |
52 | */ | 77 | */ |
53 | static int __init blade_to_first_apicid(int blade) | 78 | static int __init uvhub_to_first_apicid(int uvhub) |
54 | { | 79 | { |
55 | int cpu; | 80 | int cpu; |
56 | 81 | ||
57 | for_each_present_cpu(cpu) | 82 | for_each_present_cpu(cpu) |
58 | if (blade == uv_cpu_to_blade_id(cpu)) | 83 | if (uvhub == uv_cpu_to_blade_id(cpu)) |
59 | return per_cpu(x86_cpu_to_apicid, cpu); | 84 | return per_cpu(x86_cpu_to_apicid, cpu); |
60 | return -1; | 85 | return -1; |
61 | } | 86 | } |
@@ -68,195 +93,459 @@ static int __init blade_to_first_apicid(int blade) | |||
68 | * clear of the Timeout bit (as well) will free the resource. No reply will | 93 | * clear of the Timeout bit (as well) will free the resource. No reply will |
69 | * be sent (the hardware will only do one reply per message). | 94 | * be sent (the hardware will only do one reply per message). |
70 | */ | 95 | */ |
71 | static void uv_reply_to_message(int resource, | 96 | static inline void uv_reply_to_message(struct msg_desc *mdp, |
72 | struct bau_payload_queue_entry *msg, | 97 | struct bau_control *bcp) |
73 | struct bau_msg_status *msp) | ||
74 | { | 98 | { |
75 | unsigned long dw; | 99 | unsigned long dw; |
100 | struct bau_payload_queue_entry *msg; | ||
76 | 101 | ||
77 | dw = (1 << (resource + UV_SW_ACK_NPENDING)) | (1 << resource); | 102 | msg = mdp->msg; |
103 | if (!msg->canceled) { | ||
104 | dw = (msg->sw_ack_vector << UV_SW_ACK_NPENDING) | | ||
105 | msg->sw_ack_vector; | ||
106 | uv_write_local_mmr( | ||
107 | UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_ALIAS, dw); | ||
108 | } | ||
78 | msg->replied_to = 1; | 109 | msg->replied_to = 1; |
79 | msg->sw_ack_vector = 0; | 110 | msg->sw_ack_vector = 0; |
80 | if (msp) | ||
81 | msp->seen_by.bits = 0; | ||
82 | uv_write_local_mmr(UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_ALIAS, dw); | ||
83 | } | 111 | } |
84 | 112 | ||
85 | /* | 113 | /* |
86 | * Do all the things a cpu should do for a TLB shootdown message. | 114 | * Process the receipt of a RETRY message |
87 | * Other cpu's may come here at the same time for this message. | ||
88 | */ | 115 | */ |
89 | static void uv_bau_process_message(struct bau_payload_queue_entry *msg, | 116 | static inline void uv_bau_process_retry_msg(struct msg_desc *mdp, |
90 | int msg_slot, int sw_ack_slot) | 117 | struct bau_control *bcp) |
91 | { | 118 | { |
92 | unsigned long this_cpu_mask; | 119 | int i; |
93 | struct bau_msg_status *msp; | 120 | int cancel_count = 0; |
94 | int cpu; | 121 | int slot2; |
122 | unsigned long msg_res; | ||
123 | unsigned long mmr = 0; | ||
124 | struct bau_payload_queue_entry *msg; | ||
125 | struct bau_payload_queue_entry *msg2; | ||
126 | struct ptc_stats *stat; | ||
95 | 127 | ||
96 | msp = __get_cpu_var(bau_control).msg_statuses + msg_slot; | 128 | msg = mdp->msg; |
97 | cpu = uv_blade_processor_id(); | 129 | stat = &per_cpu(ptcstats, bcp->cpu); |
98 | msg->number_of_cpus = | 130 | stat->d_retries++; |
99 | uv_blade_nr_online_cpus(uv_node_to_blade_id(numa_node_id())); | 131 | /* |
100 | this_cpu_mask = 1UL << cpu; | 132 | * cancel any message from msg+1 to the retry itself |
101 | if (msp->seen_by.bits & this_cpu_mask) | 133 | */ |
102 | return; | 134 | for (msg2 = msg+1, i = 0; i < DEST_Q_SIZE; msg2++, i++) { |
103 | atomic_or_long(&msp->seen_by.bits, this_cpu_mask); | 135 | if (msg2 > mdp->va_queue_last) |
136 | msg2 = mdp->va_queue_first; | ||
137 | if (msg2 == msg) | ||
138 | break; | ||
139 | |||
140 | /* same conditions for cancellation as uv_do_reset */ | ||
141 | if ((msg2->replied_to == 0) && (msg2->canceled == 0) && | ||
142 | (msg2->sw_ack_vector) && ((msg2->sw_ack_vector & | ||
143 | msg->sw_ack_vector) == 0) && | ||
144 | (msg2->sending_cpu == msg->sending_cpu) && | ||
145 | (msg2->msg_type != MSG_NOOP)) { | ||
146 | slot2 = msg2 - mdp->va_queue_first; | ||
147 | mmr = uv_read_local_mmr | ||
148 | (UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE); | ||
149 | msg_res = ((msg2->sw_ack_vector << 8) | | ||
150 | msg2->sw_ack_vector); | ||
151 | /* | ||
152 | * This is a message retry; clear the resources held | ||
153 | * by the previous message only if they timed out. | ||
154 | * If it has not timed out we have an unexpected | ||
155 | * situation to report. | ||
156 | */ | ||
157 | if (mmr & (msg_res << 8)) { | ||
158 | /* | ||
159 | * is the resource timed out? | ||
160 | * make everyone ignore the cancelled message. | ||
161 | */ | ||
162 | msg2->canceled = 1; | ||
163 | stat->d_canceled++; | ||
164 | cancel_count++; | ||
165 | uv_write_local_mmr( | ||
166 | UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_ALIAS, | ||
167 | (msg_res << 8) | msg_res); | ||
168 | } else | ||
169 | printk(KERN_INFO "note bau retry: no effect\n"); | ||
170 | } | ||
171 | } | ||
172 | if (!cancel_count) | ||
173 | stat->d_nocanceled++; | ||
174 | } | ||
104 | 175 | ||
105 | if (msg->replied_to == 1) | 176 | /* |
106 | return; | 177 | * Do all the things a cpu should do for a TLB shootdown message. |
178 | * Other cpu's may come here at the same time for this message. | ||
179 | */ | ||
180 | static void uv_bau_process_message(struct msg_desc *mdp, | ||
181 | struct bau_control *bcp) | ||
182 | { | ||
183 | int msg_ack_count; | ||
184 | short socket_ack_count = 0; | ||
185 | struct ptc_stats *stat; | ||
186 | struct bau_payload_queue_entry *msg; | ||
187 | struct bau_control *smaster = bcp->socket_master; | ||
107 | 188 | ||
189 | /* | ||
190 | * This must be a normal message, or retry of a normal message | ||
191 | */ | ||
192 | msg = mdp->msg; | ||
193 | stat = &per_cpu(ptcstats, bcp->cpu); | ||
108 | if (msg->address == TLB_FLUSH_ALL) { | 194 | if (msg->address == TLB_FLUSH_ALL) { |
109 | local_flush_tlb(); | 195 | local_flush_tlb(); |
110 | __get_cpu_var(ptcstats).alltlb++; | 196 | stat->d_alltlb++; |
111 | } else { | 197 | } else { |
112 | __flush_tlb_one(msg->address); | 198 | __flush_tlb_one(msg->address); |
113 | __get_cpu_var(ptcstats).onetlb++; | 199 | stat->d_onetlb++; |
114 | } | 200 | } |
201 | stat->d_requestee++; | ||
202 | |||
203 | /* | ||
204 | * One cpu on each uvhub has the additional job on a RETRY | ||
205 | * of releasing the resource held by the message that is | ||
206 | * being retried. That message is identified by sending | ||
207 | * cpu number. | ||
208 | */ | ||
209 | if (msg->msg_type == MSG_RETRY && bcp == bcp->uvhub_master) | ||
210 | uv_bau_process_retry_msg(mdp, bcp); | ||
115 | 211 | ||
116 | __get_cpu_var(ptcstats).requestee++; | 212 | /* |
213 | * This is a sw_ack message, so we have to reply to it. | ||
214 | * Count each responding cpu on the socket. This avoids | ||
215 | * pinging the count's cache line back and forth between | ||
216 | * the sockets. | ||
217 | */ | ||
218 | socket_ack_count = atomic_add_short_return(1, (struct atomic_short *) | ||
219 | &smaster->socket_acknowledge_count[mdp->msg_slot]); | ||
220 | if (socket_ack_count == bcp->cpus_in_socket) { | ||
221 | /* | ||
222 | * Both sockets dump their completed count total into | ||
223 | * the message's count. | ||
224 | */ | ||
225 | smaster->socket_acknowledge_count[mdp->msg_slot] = 0; | ||
226 | msg_ack_count = atomic_add_short_return(socket_ack_count, | ||
227 | (struct atomic_short *)&msg->acknowledge_count); | ||
228 | |||
229 | if (msg_ack_count == bcp->cpus_in_uvhub) { | ||
230 | /* | ||
231 | * All cpus in uvhub saw it; reply | ||
232 | */ | ||
233 | uv_reply_to_message(mdp, bcp); | ||
234 | } | ||
235 | } | ||
117 | 236 | ||
118 | atomic_inc_short(&msg->acknowledge_count); | 237 | return; |
119 | if (msg->number_of_cpus == msg->acknowledge_count) | ||
120 | uv_reply_to_message(sw_ack_slot, msg, msp); | ||
121 | } | 238 | } |
122 | 239 | ||
123 | /* | 240 | /* |
124 | * Examine the payload queue on one distribution node to see | 241 | * Determine the first cpu on a uvhub. |
125 | * which messages have not been seen, and which cpu(s) have not seen them. | 242 | */ |
243 | static int uvhub_to_first_cpu(int uvhub) | ||
244 | { | ||
245 | int cpu; | ||
246 | for_each_present_cpu(cpu) | ||
247 | if (uvhub == uv_cpu_to_blade_id(cpu)) | ||
248 | return cpu; | ||
249 | return -1; | ||
250 | } | ||
251 | |||
252 | /* | ||
253 | * Last resort when we get a large number of destination timeouts is | ||
254 | * to clear resources held by a given cpu. | ||
255 | * Do this with IPI so that all messages in the BAU message queue | ||
256 | * can be identified by their nonzero sw_ack_vector field. | ||
126 | * | 257 | * |
127 | * Returns the number of cpu's that have not responded. | 258 | * This is entered for a single cpu on the uvhub. |
259 | * The sender want's this uvhub to free a specific message's | ||
260 | * sw_ack resources. | ||
128 | */ | 261 | */ |
129 | static int uv_examine_destination(struct bau_control *bau_tablesp, int sender) | 262 | static void |
263 | uv_do_reset(void *ptr) | ||
130 | { | 264 | { |
131 | struct bau_payload_queue_entry *msg; | ||
132 | struct bau_msg_status *msp; | ||
133 | int count = 0; | ||
134 | int i; | 265 | int i; |
135 | int j; | 266 | int slot; |
267 | int count = 0; | ||
268 | unsigned long mmr; | ||
269 | unsigned long msg_res; | ||
270 | struct bau_control *bcp; | ||
271 | struct reset_args *rap; | ||
272 | struct bau_payload_queue_entry *msg; | ||
273 | struct ptc_stats *stat; | ||
136 | 274 | ||
137 | for (msg = bau_tablesp->va_queue_first, i = 0; i < DEST_Q_SIZE; | 275 | bcp = &per_cpu(bau_control, smp_processor_id()); |
138 | msg++, i++) { | 276 | rap = (struct reset_args *)ptr; |
139 | if ((msg->sending_cpu == sender) && (!msg->replied_to)) { | 277 | stat = &per_cpu(ptcstats, bcp->cpu); |
140 | msp = bau_tablesp->msg_statuses + i; | 278 | stat->d_resets++; |
141 | printk(KERN_DEBUG | 279 | |
142 | "blade %d: address:%#lx %d of %d, not cpu(s): ", | 280 | /* |
143 | i, msg->address, msg->acknowledge_count, | 281 | * We're looking for the given sender, and |
144 | msg->number_of_cpus); | 282 | * will free its sw_ack resource. |
145 | for (j = 0; j < msg->number_of_cpus; j++) { | 283 | * If all cpu's finally responded after the timeout, its |
146 | if (!((1L << j) & msp->seen_by.bits)) { | 284 | * message 'replied_to' was set. |
147 | count++; | 285 | */ |
148 | printk("%d ", j); | 286 | for (msg = bcp->va_queue_first, i = 0; i < DEST_Q_SIZE; msg++, i++) { |
149 | } | 287 | /* uv_do_reset: same conditions for cancellation as |
288 | uv_bau_process_retry_msg() */ | ||
289 | if ((msg->replied_to == 0) && | ||
290 | (msg->canceled == 0) && | ||
291 | (msg->sending_cpu == rap->sender) && | ||
292 | (msg->sw_ack_vector) && | ||
293 | (msg->msg_type != MSG_NOOP)) { | ||
294 | /* | ||
295 | * make everyone else ignore this message | ||
296 | */ | ||
297 | msg->canceled = 1; | ||
298 | slot = msg - bcp->va_queue_first; | ||
299 | count++; | ||
300 | /* | ||
301 | * only reset the resource if it is still pending | ||
302 | */ | ||
303 | mmr = uv_read_local_mmr | ||
304 | (UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE); | ||
305 | msg_res = ((msg->sw_ack_vector << 8) | | ||
306 | msg->sw_ack_vector); | ||
307 | if (mmr & msg_res) { | ||
308 | stat->d_rcanceled++; | ||
309 | uv_write_local_mmr( | ||
310 | UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_ALIAS, | ||
311 | msg_res); | ||
150 | } | 312 | } |
151 | printk("\n"); | ||
152 | } | 313 | } |
153 | } | 314 | } |
154 | return count; | 315 | return; |
155 | } | 316 | } |
156 | 317 | ||
157 | /* | 318 | /* |
158 | * Examine the payload queue on all the distribution nodes to see | 319 | * Use IPI to get all target uvhubs to release resources held by |
159 | * which messages have not been seen, and which cpu(s) have not seen them. | 320 | * a given sending cpu number. |
160 | * | ||
161 | * Returns the number of cpu's that have not responded. | ||
162 | */ | 321 | */ |
163 | static int uv_examine_destinations(struct bau_target_nodemask *distribution) | 322 | static void uv_reset_with_ipi(struct bau_target_uvhubmask *distribution, |
323 | int sender) | ||
164 | { | 324 | { |
165 | int sender; | 325 | int uvhub; |
166 | int i; | 326 | int cpu; |
167 | int count = 0; | 327 | cpumask_t mask; |
328 | struct reset_args reset_args; | ||
329 | |||
330 | reset_args.sender = sender; | ||
168 | 331 | ||
169 | sender = smp_processor_id(); | 332 | cpus_clear(mask); |
170 | for (i = 0; i < sizeof(struct bau_target_nodemask) * BITSPERBYTE; i++) { | 333 | /* find a single cpu for each uvhub in this distribution mask */ |
171 | if (!bau_node_isset(i, distribution)) | 334 | for (uvhub = 0; |
335 | uvhub < sizeof(struct bau_target_uvhubmask) * BITSPERBYTE; | ||
336 | uvhub++) { | ||
337 | if (!bau_uvhub_isset(uvhub, distribution)) | ||
172 | continue; | 338 | continue; |
173 | count += uv_examine_destination(uv_bau_table_bases[i], sender); | 339 | /* find a cpu for this uvhub */ |
340 | cpu = uvhub_to_first_cpu(uvhub); | ||
341 | cpu_set(cpu, mask); | ||
174 | } | 342 | } |
175 | return count; | 343 | /* IPI all cpus; Preemption is already disabled */ |
344 | smp_call_function_many(&mask, uv_do_reset, (void *)&reset_args, 1); | ||
345 | return; | ||
346 | } | ||
347 | |||
348 | static inline unsigned long | ||
349 | cycles_2_us(unsigned long long cyc) | ||
350 | { | ||
351 | unsigned long long ns; | ||
352 | unsigned long us; | ||
353 | ns = (cyc * per_cpu(cyc2ns, smp_processor_id())) | ||
354 | >> CYC2NS_SCALE_FACTOR; | ||
355 | us = ns / 1000; | ||
356 | return us; | ||
176 | } | 357 | } |
177 | 358 | ||
178 | /* | 359 | /* |
179 | * wait for completion of a broadcast message | 360 | * wait for all cpus on this hub to finish their sends and go quiet |
180 | * | 361 | * leaves uvhub_quiesce set so that no new broadcasts are started by |
181 | * return COMPLETE, RETRY or GIVEUP | 362 | * bau_flush_send_and_wait() |
363 | */ | ||
364 | static inline void | ||
365 | quiesce_local_uvhub(struct bau_control *hmaster) | ||
366 | { | ||
367 | atomic_add_short_return(1, (struct atomic_short *) | ||
368 | &hmaster->uvhub_quiesce); | ||
369 | } | ||
370 | |||
371 | /* | ||
372 | * mark this quiet-requestor as done | ||
373 | */ | ||
374 | static inline void | ||
375 | end_uvhub_quiesce(struct bau_control *hmaster) | ||
376 | { | ||
377 | atomic_add_short_return(-1, (struct atomic_short *) | ||
378 | &hmaster->uvhub_quiesce); | ||
379 | } | ||
380 | |||
381 | /* | ||
382 | * Wait for completion of a broadcast software ack message | ||
383 | * return COMPLETE, RETRY(PLUGGED or TIMEOUT) or GIVEUP | ||
182 | */ | 384 | */ |
183 | static int uv_wait_completion(struct bau_desc *bau_desc, | 385 | static int uv_wait_completion(struct bau_desc *bau_desc, |
184 | unsigned long mmr_offset, int right_shift) | 386 | unsigned long mmr_offset, int right_shift, int this_cpu, |
387 | struct bau_control *bcp, struct bau_control *smaster, long try) | ||
185 | { | 388 | { |
186 | int exams = 0; | 389 | int relaxes = 0; |
187 | long destination_timeouts = 0; | ||
188 | long source_timeouts = 0; | ||
189 | unsigned long descriptor_status; | 390 | unsigned long descriptor_status; |
391 | unsigned long mmr; | ||
392 | unsigned long mask; | ||
393 | cycles_t ttime; | ||
394 | cycles_t timeout_time; | ||
395 | struct ptc_stats *stat = &per_cpu(ptcstats, this_cpu); | ||
396 | struct bau_control *hmaster; | ||
397 | |||
398 | hmaster = bcp->uvhub_master; | ||
399 | timeout_time = get_cycles() + bcp->timeout_interval; | ||
190 | 400 | ||
401 | /* spin on the status MMR, waiting for it to go idle */ | ||
191 | while ((descriptor_status = (((unsigned long) | 402 | while ((descriptor_status = (((unsigned long) |
192 | uv_read_local_mmr(mmr_offset) >> | 403 | uv_read_local_mmr(mmr_offset) >> |
193 | right_shift) & UV_ACT_STATUS_MASK)) != | 404 | right_shift) & UV_ACT_STATUS_MASK)) != |
194 | DESC_STATUS_IDLE) { | 405 | DESC_STATUS_IDLE) { |
195 | if (descriptor_status == DESC_STATUS_SOURCE_TIMEOUT) { | ||
196 | source_timeouts++; | ||
197 | if (source_timeouts > SOURCE_TIMEOUT_LIMIT) | ||
198 | source_timeouts = 0; | ||
199 | __get_cpu_var(ptcstats).s_retry++; | ||
200 | return FLUSH_RETRY; | ||
201 | } | ||
202 | /* | 406 | /* |
203 | * spin here looking for progress at the destinations | 407 | * Our software ack messages may be blocked because there are |
408 | * no swack resources available. As long as none of them | ||
409 | * has timed out hardware will NACK our message and its | ||
410 | * state will stay IDLE. | ||
204 | */ | 411 | */ |
205 | if (descriptor_status == DESC_STATUS_DESTINATION_TIMEOUT) { | 412 | if (descriptor_status == DESC_STATUS_SOURCE_TIMEOUT) { |
206 | destination_timeouts++; | 413 | stat->s_stimeout++; |
207 | if (destination_timeouts > DESTINATION_TIMEOUT_LIMIT) { | 414 | return FLUSH_GIVEUP; |
208 | /* | 415 | } else if (descriptor_status == |
209 | * returns number of cpus not responding | 416 | DESC_STATUS_DESTINATION_TIMEOUT) { |
210 | */ | 417 | stat->s_dtimeout++; |
211 | if (uv_examine_destinations | 418 | ttime = get_cycles(); |
212 | (&bau_desc->distribution) == 0) { | 419 | |
213 | __get_cpu_var(ptcstats).d_retry++; | 420 | /* |
214 | return FLUSH_RETRY; | 421 | * Our retries may be blocked by all destination |
215 | } | 422 | * swack resources being consumed, and a timeout |
216 | exams++; | 423 | * pending. In that case hardware returns the |
217 | if (exams >= uv_bau_retry_limit) { | 424 | * ERROR that looks like a destination timeout. |
218 | printk(KERN_DEBUG | 425 | */ |
219 | "uv_flush_tlb_others"); | 426 | if (cycles_2_us(ttime - bcp->send_message) < BIOS_TO) { |
220 | printk("giving up on cpu %d\n", | 427 | bcp->conseccompletes = 0; |
221 | smp_processor_id()); | 428 | return FLUSH_RETRY_PLUGGED; |
429 | } | ||
430 | |||
431 | bcp->conseccompletes = 0; | ||
432 | return FLUSH_RETRY_TIMEOUT; | ||
433 | } else { | ||
434 | /* | ||
435 | * descriptor_status is still BUSY | ||
436 | */ | ||
437 | cpu_relax(); | ||
438 | relaxes++; | ||
439 | if (relaxes >= 10000) { | ||
440 | relaxes = 0; | ||
441 | if (get_cycles() > timeout_time) { | ||
442 | quiesce_local_uvhub(hmaster); | ||
443 | |||
444 | /* single-thread the register change */ | ||
445 | spin_lock(&hmaster->masks_lock); | ||
446 | mmr = uv_read_local_mmr(mmr_offset); | ||
447 | mask = 0UL; | ||
448 | mask |= (3UL < right_shift); | ||
449 | mask = ~mask; | ||
450 | mmr &= mask; | ||
451 | uv_write_local_mmr(mmr_offset, mmr); | ||
452 | spin_unlock(&hmaster->masks_lock); | ||
453 | end_uvhub_quiesce(hmaster); | ||
454 | stat->s_busy++; | ||
222 | return FLUSH_GIVEUP; | 455 | return FLUSH_GIVEUP; |
223 | } | 456 | } |
224 | /* | ||
225 | * delays can hang the simulator | ||
226 | udelay(1000); | ||
227 | */ | ||
228 | destination_timeouts = 0; | ||
229 | } | 457 | } |
230 | } | 458 | } |
231 | cpu_relax(); | ||
232 | } | 459 | } |
460 | bcp->conseccompletes++; | ||
233 | return FLUSH_COMPLETE; | 461 | return FLUSH_COMPLETE; |
234 | } | 462 | } |
235 | 463 | ||
464 | static inline cycles_t | ||
465 | sec_2_cycles(unsigned long sec) | ||
466 | { | ||
467 | unsigned long ns; | ||
468 | cycles_t cyc; | ||
469 | |||
470 | ns = sec * 1000000000; | ||
471 | cyc = (ns << CYC2NS_SCALE_FACTOR)/(per_cpu(cyc2ns, smp_processor_id())); | ||
472 | return cyc; | ||
473 | } | ||
474 | |||
475 | /* | ||
476 | * conditionally add 1 to *v, unless *v is >= u | ||
477 | * return 0 if we cannot add 1 to *v because it is >= u | ||
478 | * return 1 if we can add 1 to *v because it is < u | ||
479 | * the add is atomic | ||
480 | * | ||
481 | * This is close to atomic_add_unless(), but this allows the 'u' value | ||
482 | * to be lowered below the current 'v'. atomic_add_unless can only stop | ||
483 | * on equal. | ||
484 | */ | ||
485 | static inline int atomic_inc_unless_ge(spinlock_t *lock, atomic_t *v, int u) | ||
486 | { | ||
487 | spin_lock(lock); | ||
488 | if (atomic_read(v) >= u) { | ||
489 | spin_unlock(lock); | ||
490 | return 0; | ||
491 | } | ||
492 | atomic_inc(v); | ||
493 | spin_unlock(lock); | ||
494 | return 1; | ||
495 | } | ||
496 | |||
236 | /** | 497 | /** |
237 | * uv_flush_send_and_wait | 498 | * uv_flush_send_and_wait |
238 | * | 499 | * |
239 | * Send a broadcast and wait for a broadcast message to complete. | 500 | * Send a broadcast and wait for it to complete. |
240 | * | 501 | * |
241 | * The flush_mask contains the cpus the broadcast was sent to. | 502 | * The flush_mask contains the cpus the broadcast is to be sent to, plus |
503 | * cpus that are on the local uvhub. | ||
242 | * | 504 | * |
243 | * Returns NULL if all remote flushing was done. The mask is zeroed. | 505 | * Returns NULL if all flushing represented in the mask was done. The mask |
506 | * is zeroed. | ||
244 | * Returns @flush_mask if some remote flushing remains to be done. The | 507 | * Returns @flush_mask if some remote flushing remains to be done. The |
245 | * mask will have some bits still set. | 508 | * mask will have some bits still set, representing any cpus on the local |
509 | * uvhub (not current cpu) and any on remote uvhubs if the broadcast failed. | ||
246 | */ | 510 | */ |
247 | const struct cpumask *uv_flush_send_and_wait(int cpu, int this_pnode, | 511 | const struct cpumask *uv_flush_send_and_wait(struct bau_desc *bau_desc, |
248 | struct bau_desc *bau_desc, | 512 | struct cpumask *flush_mask, |
249 | struct cpumask *flush_mask) | 513 | struct bau_control *bcp) |
250 | { | 514 | { |
251 | int completion_status = 0; | ||
252 | int right_shift; | 515 | int right_shift; |
253 | int tries = 0; | 516 | int uvhub; |
254 | int pnode; | ||
255 | int bit; | 517 | int bit; |
518 | int completion_status = 0; | ||
519 | int seq_number = 0; | ||
520 | long try = 0; | ||
521 | int cpu = bcp->uvhub_cpu; | ||
522 | int this_cpu = bcp->cpu; | ||
523 | int this_uvhub = bcp->uvhub; | ||
256 | unsigned long mmr_offset; | 524 | unsigned long mmr_offset; |
257 | unsigned long index; | 525 | unsigned long index; |
258 | cycles_t time1; | 526 | cycles_t time1; |
259 | cycles_t time2; | 527 | cycles_t time2; |
528 | struct ptc_stats *stat = &per_cpu(ptcstats, bcp->cpu); | ||
529 | struct bau_control *smaster = bcp->socket_master; | ||
530 | struct bau_control *hmaster = bcp->uvhub_master; | ||
531 | |||
532 | /* | ||
533 | * Spin here while there are hmaster->max_concurrent or more active | ||
534 | * descriptors. This is the per-uvhub 'throttle'. | ||
535 | */ | ||
536 | if (!atomic_inc_unless_ge(&hmaster->uvhub_lock, | ||
537 | &hmaster->active_descriptor_count, | ||
538 | hmaster->max_concurrent)) { | ||
539 | stat->s_throttles++; | ||
540 | do { | ||
541 | cpu_relax(); | ||
542 | } while (!atomic_inc_unless_ge(&hmaster->uvhub_lock, | ||
543 | &hmaster->active_descriptor_count, | ||
544 | hmaster->max_concurrent)); | ||
545 | } | ||
546 | |||
547 | while (hmaster->uvhub_quiesce) | ||
548 | cpu_relax(); | ||
260 | 549 | ||
261 | if (cpu < UV_CPUS_PER_ACT_STATUS) { | 550 | if (cpu < UV_CPUS_PER_ACT_STATUS) { |
262 | mmr_offset = UVH_LB_BAU_SB_ACTIVATION_STATUS_0; | 551 | mmr_offset = UVH_LB_BAU_SB_ACTIVATION_STATUS_0; |
@@ -268,24 +557,108 @@ const struct cpumask *uv_flush_send_and_wait(int cpu, int this_pnode, | |||
268 | } | 557 | } |
269 | time1 = get_cycles(); | 558 | time1 = get_cycles(); |
270 | do { | 559 | do { |
271 | tries++; | 560 | /* |
561 | * Every message from any given cpu gets a unique message | ||
562 | * sequence number. But retries use that same number. | ||
563 | * Our message may have timed out at the destination because | ||
564 | * all sw-ack resources are in use and there is a timeout | ||
565 | * pending there. In that case, our last send never got | ||
566 | * placed into the queue and we need to persist until it | ||
567 | * does. | ||
568 | * | ||
569 | * Make any retry a type MSG_RETRY so that the destination will | ||
570 | * free any resource held by a previous message from this cpu. | ||
571 | */ | ||
572 | if (try == 0) { | ||
573 | /* use message type set by the caller the first time */ | ||
574 | seq_number = bcp->message_number++; | ||
575 | } else { | ||
576 | /* use RETRY type on all the rest; same sequence */ | ||
577 | bau_desc->header.msg_type = MSG_RETRY; | ||
578 | stat->s_retry_messages++; | ||
579 | } | ||
580 | bau_desc->header.sequence = seq_number; | ||
272 | index = (1UL << UVH_LB_BAU_SB_ACTIVATION_CONTROL_PUSH_SHFT) | | 581 | index = (1UL << UVH_LB_BAU_SB_ACTIVATION_CONTROL_PUSH_SHFT) | |
273 | cpu; | 582 | bcp->uvhub_cpu; |
583 | bcp->send_message = get_cycles(); | ||
584 | |||
274 | uv_write_local_mmr(UVH_LB_BAU_SB_ACTIVATION_CONTROL, index); | 585 | uv_write_local_mmr(UVH_LB_BAU_SB_ACTIVATION_CONTROL, index); |
586 | |||
587 | try++; | ||
275 | completion_status = uv_wait_completion(bau_desc, mmr_offset, | 588 | completion_status = uv_wait_completion(bau_desc, mmr_offset, |
276 | right_shift); | 589 | right_shift, this_cpu, bcp, smaster, try); |
277 | } while (completion_status == FLUSH_RETRY); | 590 | |
591 | if (completion_status == FLUSH_RETRY_PLUGGED) { | ||
592 | /* | ||
593 | * Our retries may be blocked by all destination swack | ||
594 | * resources being consumed, and a timeout pending. In | ||
595 | * that case hardware immediately returns the ERROR | ||
596 | * that looks like a destination timeout. | ||
597 | */ | ||
598 | udelay(TIMEOUT_DELAY); | ||
599 | bcp->plugged_tries++; | ||
600 | if (bcp->plugged_tries >= PLUGSB4RESET) { | ||
601 | bcp->plugged_tries = 0; | ||
602 | quiesce_local_uvhub(hmaster); | ||
603 | spin_lock(&hmaster->queue_lock); | ||
604 | uv_reset_with_ipi(&bau_desc->distribution, | ||
605 | this_cpu); | ||
606 | spin_unlock(&hmaster->queue_lock); | ||
607 | end_uvhub_quiesce(hmaster); | ||
608 | bcp->ipi_attempts++; | ||
609 | stat->s_resets_plug++; | ||
610 | } | ||
611 | } else if (completion_status == FLUSH_RETRY_TIMEOUT) { | ||
612 | hmaster->max_concurrent = 1; | ||
613 | bcp->timeout_tries++; | ||
614 | udelay(TIMEOUT_DELAY); | ||
615 | if (bcp->timeout_tries >= TIMEOUTSB4RESET) { | ||
616 | bcp->timeout_tries = 0; | ||
617 | quiesce_local_uvhub(hmaster); | ||
618 | spin_lock(&hmaster->queue_lock); | ||
619 | uv_reset_with_ipi(&bau_desc->distribution, | ||
620 | this_cpu); | ||
621 | spin_unlock(&hmaster->queue_lock); | ||
622 | end_uvhub_quiesce(hmaster); | ||
623 | bcp->ipi_attempts++; | ||
624 | stat->s_resets_timeout++; | ||
625 | } | ||
626 | } | ||
627 | if (bcp->ipi_attempts >= 3) { | ||
628 | bcp->ipi_attempts = 0; | ||
629 | completion_status = FLUSH_GIVEUP; | ||
630 | break; | ||
631 | } | ||
632 | cpu_relax(); | ||
633 | } while ((completion_status == FLUSH_RETRY_PLUGGED) || | ||
634 | (completion_status == FLUSH_RETRY_TIMEOUT)); | ||
278 | time2 = get_cycles(); | 635 | time2 = get_cycles(); |
279 | __get_cpu_var(ptcstats).sflush += (time2 - time1); | ||
280 | if (tries > 1) | ||
281 | __get_cpu_var(ptcstats).retriesok++; | ||
282 | 636 | ||
283 | if (completion_status == FLUSH_GIVEUP) { | 637 | if ((completion_status == FLUSH_COMPLETE) && (bcp->conseccompletes > 5) |
638 | && (hmaster->max_concurrent < hmaster->max_concurrent_constant)) | ||
639 | hmaster->max_concurrent++; | ||
640 | |||
641 | /* | ||
642 | * hold any cpu not timing out here; no other cpu currently held by | ||
643 | * the 'throttle' should enter the activation code | ||
644 | */ | ||
645 | while (hmaster->uvhub_quiesce) | ||
646 | cpu_relax(); | ||
647 | atomic_dec(&hmaster->active_descriptor_count); | ||
648 | |||
649 | /* guard against cycles wrap */ | ||
650 | if (time2 > time1) | ||
651 | stat->s_time += (time2 - time1); | ||
652 | else | ||
653 | stat->s_requestor--; /* don't count this one */ | ||
654 | if (completion_status == FLUSH_COMPLETE && try > 1) | ||
655 | stat->s_retriesok++; | ||
656 | else if (completion_status == FLUSH_GIVEUP) { | ||
284 | /* | 657 | /* |
285 | * Cause the caller to do an IPI-style TLB shootdown on | 658 | * Cause the caller to do an IPI-style TLB shootdown on |
286 | * the cpu's, all of which are still in the mask. | 659 | * the target cpu's, all of which are still in the mask. |
287 | */ | 660 | */ |
288 | __get_cpu_var(ptcstats).ptc_i++; | 661 | stat->s_giveup++; |
289 | return flush_mask; | 662 | return flush_mask; |
290 | } | 663 | } |
291 | 664 | ||
@@ -294,18 +667,17 @@ const struct cpumask *uv_flush_send_and_wait(int cpu, int this_pnode, | |||
294 | * use the IPI method of shootdown on them. | 667 | * use the IPI method of shootdown on them. |
295 | */ | 668 | */ |
296 | for_each_cpu(bit, flush_mask) { | 669 | for_each_cpu(bit, flush_mask) { |
297 | pnode = uv_cpu_to_pnode(bit); | 670 | uvhub = uv_cpu_to_blade_id(bit); |
298 | if (pnode == this_pnode) | 671 | if (uvhub == this_uvhub) |
299 | continue; | 672 | continue; |
300 | cpumask_clear_cpu(bit, flush_mask); | 673 | cpumask_clear_cpu(bit, flush_mask); |
301 | } | 674 | } |
302 | if (!cpumask_empty(flush_mask)) | 675 | if (!cpumask_empty(flush_mask)) |
303 | return flush_mask; | 676 | return flush_mask; |
677 | |||
304 | return NULL; | 678 | return NULL; |
305 | } | 679 | } |
306 | 680 | ||
307 | static DEFINE_PER_CPU(cpumask_var_t, uv_flush_tlb_mask); | ||
308 | |||
309 | /** | 681 | /** |
310 | * uv_flush_tlb_others - globally purge translation cache of a virtual | 682 | * uv_flush_tlb_others - globally purge translation cache of a virtual |
311 | * address or all TLB's | 683 | * address or all TLB's |
@@ -322,8 +694,8 @@ static DEFINE_PER_CPU(cpumask_var_t, uv_flush_tlb_mask); | |||
322 | * The caller has derived the cpumask from the mm_struct. This function | 694 | * The caller has derived the cpumask from the mm_struct. This function |
323 | * is called only if there are bits set in the mask. (e.g. flush_tlb_page()) | 695 | * is called only if there are bits set in the mask. (e.g. flush_tlb_page()) |
324 | * | 696 | * |
325 | * The cpumask is converted into a nodemask of the nodes containing | 697 | * The cpumask is converted into a uvhubmask of the uvhubs containing |
326 | * the cpus. | 698 | * those cpus. |
327 | * | 699 | * |
328 | * Note that this function should be called with preemption disabled. | 700 | * Note that this function should be called with preemption disabled. |
329 | * | 701 | * |
@@ -335,52 +707,82 @@ const struct cpumask *uv_flush_tlb_others(const struct cpumask *cpumask, | |||
335 | struct mm_struct *mm, | 707 | struct mm_struct *mm, |
336 | unsigned long va, unsigned int cpu) | 708 | unsigned long va, unsigned int cpu) |
337 | { | 709 | { |
338 | struct cpumask *flush_mask = __get_cpu_var(uv_flush_tlb_mask); | 710 | int remotes; |
339 | int i; | 711 | int tcpu; |
340 | int bit; | 712 | int uvhub; |
341 | int pnode; | ||
342 | int uv_cpu; | ||
343 | int this_pnode; | ||
344 | int locals = 0; | 713 | int locals = 0; |
345 | struct bau_desc *bau_desc; | 714 | struct bau_desc *bau_desc; |
715 | struct cpumask *flush_mask; | ||
716 | struct ptc_stats *stat; | ||
717 | struct bau_control *bcp; | ||
346 | 718 | ||
347 | cpumask_andnot(flush_mask, cpumask, cpumask_of(cpu)); | 719 | if (nobau) |
720 | return cpumask; | ||
348 | 721 | ||
349 | uv_cpu = uv_blade_processor_id(); | 722 | bcp = &per_cpu(bau_control, cpu); |
350 | this_pnode = uv_hub_info->pnode; | 723 | /* |
351 | bau_desc = __get_cpu_var(bau_control).descriptor_base; | 724 | * Each sending cpu has a per-cpu mask which it fills from the caller's |
352 | bau_desc += UV_ITEMS_PER_DESCRIPTOR * uv_cpu; | 725 | * cpu mask. Only remote cpus are converted to uvhubs and copied. |
726 | */ | ||
727 | flush_mask = (struct cpumask *)per_cpu(uv_flush_tlb_mask, cpu); | ||
728 | /* | ||
729 | * copy cpumask to flush_mask, removing current cpu | ||
730 | * (current cpu should already have been flushed by the caller and | ||
731 | * should never be returned if we return flush_mask) | ||
732 | */ | ||
733 | cpumask_andnot(flush_mask, cpumask, cpumask_of(cpu)); | ||
734 | if (cpu_isset(cpu, *cpumask)) | ||
735 | locals++; /* current cpu was targeted */ | ||
353 | 736 | ||
354 | bau_nodes_clear(&bau_desc->distribution, UV_DISTRIBUTION_SIZE); | 737 | bau_desc = bcp->descriptor_base; |
738 | bau_desc += UV_ITEMS_PER_DESCRIPTOR * bcp->uvhub_cpu; | ||
355 | 739 | ||
356 | i = 0; | 740 | bau_uvhubs_clear(&bau_desc->distribution, UV_DISTRIBUTION_SIZE); |
357 | for_each_cpu(bit, flush_mask) { | 741 | remotes = 0; |
358 | pnode = uv_cpu_to_pnode(bit); | 742 | for_each_cpu(tcpu, flush_mask) { |
359 | BUG_ON(pnode > (UV_DISTRIBUTION_SIZE - 1)); | 743 | uvhub = uv_cpu_to_blade_id(tcpu); |
360 | if (pnode == this_pnode) { | 744 | if (uvhub == bcp->uvhub) { |
361 | locals++; | 745 | locals++; |
362 | continue; | 746 | continue; |
363 | } | 747 | } |
364 | bau_node_set(pnode - uv_partition_base_pnode, | 748 | bau_uvhub_set(uvhub, &bau_desc->distribution); |
365 | &bau_desc->distribution); | 749 | remotes++; |
366 | i++; | ||
367 | } | 750 | } |
368 | if (i == 0) { | 751 | if (remotes == 0) { |
369 | /* | 752 | /* |
370 | * no off_node flushing; return status for local node | 753 | * No off_hub flushing; return status for local hub. |
754 | * Return the caller's mask if all were local (the current | ||
755 | * cpu may be in that mask). | ||
371 | */ | 756 | */ |
372 | if (locals) | 757 | if (locals) |
373 | return flush_mask; | 758 | return cpumask; |
374 | else | 759 | else |
375 | return NULL; | 760 | return NULL; |
376 | } | 761 | } |
377 | __get_cpu_var(ptcstats).requestor++; | 762 | stat = &per_cpu(ptcstats, cpu); |
378 | __get_cpu_var(ptcstats).ntargeted += i; | 763 | stat->s_requestor++; |
764 | stat->s_ntargcpu += remotes; | ||
765 | remotes = bau_uvhub_weight(&bau_desc->distribution); | ||
766 | stat->s_ntarguvhub += remotes; | ||
767 | if (remotes >= 16) | ||
768 | stat->s_ntarguvhub16++; | ||
769 | else if (remotes >= 8) | ||
770 | stat->s_ntarguvhub8++; | ||
771 | else if (remotes >= 4) | ||
772 | stat->s_ntarguvhub4++; | ||
773 | else if (remotes >= 2) | ||
774 | stat->s_ntarguvhub2++; | ||
775 | else | ||
776 | stat->s_ntarguvhub1++; | ||
379 | 777 | ||
380 | bau_desc->payload.address = va; | 778 | bau_desc->payload.address = va; |
381 | bau_desc->payload.sending_cpu = cpu; | 779 | bau_desc->payload.sending_cpu = cpu; |
382 | 780 | ||
383 | return uv_flush_send_and_wait(uv_cpu, this_pnode, bau_desc, flush_mask); | 781 | /* |
782 | * uv_flush_send_and_wait returns null if all cpu's were messaged, or | ||
783 | * the adjusted flush_mask if any cpu's were not messaged. | ||
784 | */ | ||
785 | return uv_flush_send_and_wait(bau_desc, flush_mask, bcp); | ||
384 | } | 786 | } |
385 | 787 | ||
386 | /* | 788 | /* |
@@ -389,87 +791,70 @@ const struct cpumask *uv_flush_tlb_others(const struct cpumask *cpumask, | |||
389 | * | 791 | * |
390 | * We received a broadcast assist message. | 792 | * We received a broadcast assist message. |
391 | * | 793 | * |
392 | * Interrupts may have been disabled; this interrupt could represent | 794 | * Interrupts are disabled; this interrupt could represent |
393 | * the receipt of several messages. | 795 | * the receipt of several messages. |
394 | * | 796 | * |
395 | * All cores/threads on this node get this interrupt. | 797 | * All cores/threads on this hub get this interrupt. |
396 | * The last one to see it does the s/w ack. | 798 | * The last one to see it does the software ack. |
397 | * (the resource will not be freed until noninterruptable cpus see this | 799 | * (the resource will not be freed until noninterruptable cpus see this |
398 | * interrupt; hardware will timeout the s/w ack and reply ERROR) | 800 | * interrupt; hardware may timeout the s/w ack and reply ERROR) |
399 | */ | 801 | */ |
400 | void uv_bau_message_interrupt(struct pt_regs *regs) | 802 | void uv_bau_message_interrupt(struct pt_regs *regs) |
401 | { | 803 | { |
402 | struct bau_payload_queue_entry *va_queue_first; | ||
403 | struct bau_payload_queue_entry *va_queue_last; | ||
404 | struct bau_payload_queue_entry *msg; | ||
405 | struct pt_regs *old_regs = set_irq_regs(regs); | ||
406 | cycles_t time1; | ||
407 | cycles_t time2; | ||
408 | int msg_slot; | ||
409 | int sw_ack_slot; | ||
410 | int fw; | ||
411 | int count = 0; | 804 | int count = 0; |
412 | unsigned long local_pnode; | 805 | cycles_t time_start; |
413 | 806 | struct bau_payload_queue_entry *msg; | |
414 | ack_APIC_irq(); | 807 | struct bau_control *bcp; |
415 | exit_idle(); | 808 | struct ptc_stats *stat; |
416 | irq_enter(); | 809 | struct msg_desc msgdesc; |
417 | 810 | ||
418 | time1 = get_cycles(); | 811 | time_start = get_cycles(); |
419 | 812 | bcp = &per_cpu(bau_control, smp_processor_id()); | |
420 | local_pnode = uv_blade_to_pnode(uv_numa_blade_id()); | 813 | stat = &per_cpu(ptcstats, smp_processor_id()); |
421 | 814 | msgdesc.va_queue_first = bcp->va_queue_first; | |
422 | va_queue_first = __get_cpu_var(bau_control).va_queue_first; | 815 | msgdesc.va_queue_last = bcp->va_queue_last; |
423 | va_queue_last = __get_cpu_var(bau_control).va_queue_last; | 816 | msg = bcp->bau_msg_head; |
424 | |||
425 | msg = __get_cpu_var(bau_control).bau_msg_head; | ||
426 | while (msg->sw_ack_vector) { | 817 | while (msg->sw_ack_vector) { |
427 | count++; | 818 | count++; |
428 | fw = msg->sw_ack_vector; | 819 | msgdesc.msg_slot = msg - msgdesc.va_queue_first; |
429 | msg_slot = msg - va_queue_first; | 820 | msgdesc.sw_ack_slot = ffs(msg->sw_ack_vector) - 1; |
430 | sw_ack_slot = ffs(fw) - 1; | 821 | msgdesc.msg = msg; |
431 | 822 | uv_bau_process_message(&msgdesc, bcp); | |
432 | uv_bau_process_message(msg, msg_slot, sw_ack_slot); | ||
433 | |||
434 | msg++; | 823 | msg++; |
435 | if (msg > va_queue_last) | 824 | if (msg > msgdesc.va_queue_last) |
436 | msg = va_queue_first; | 825 | msg = msgdesc.va_queue_first; |
437 | __get_cpu_var(bau_control).bau_msg_head = msg; | 826 | bcp->bau_msg_head = msg; |
438 | } | 827 | } |
828 | stat->d_time += (get_cycles() - time_start); | ||
439 | if (!count) | 829 | if (!count) |
440 | __get_cpu_var(ptcstats).nomsg++; | 830 | stat->d_nomsg++; |
441 | else if (count > 1) | 831 | else if (count > 1) |
442 | __get_cpu_var(ptcstats).multmsg++; | 832 | stat->d_multmsg++; |
443 | 833 | ack_APIC_irq(); | |
444 | time2 = get_cycles(); | ||
445 | __get_cpu_var(ptcstats).dflush += (time2 - time1); | ||
446 | |||
447 | irq_exit(); | ||
448 | set_irq_regs(old_regs); | ||
449 | } | 834 | } |
450 | 835 | ||
451 | /* | 836 | /* |
452 | * uv_enable_timeouts | 837 | * uv_enable_timeouts |
453 | * | 838 | * |
454 | * Each target blade (i.e. blades that have cpu's) needs to have | 839 | * Each target uvhub (i.e. a uvhub that has no cpu's) needs to have |
455 | * shootdown message timeouts enabled. The timeout does not cause | 840 | * shootdown message timeouts enabled. The timeout does not cause |
456 | * an interrupt, but causes an error message to be returned to | 841 | * an interrupt, but causes an error message to be returned to |
457 | * the sender. | 842 | * the sender. |
458 | */ | 843 | */ |
459 | static void uv_enable_timeouts(void) | 844 | static void uv_enable_timeouts(void) |
460 | { | 845 | { |
461 | int blade; | 846 | int uvhub; |
462 | int nblades; | 847 | int nuvhubs; |
463 | int pnode; | 848 | int pnode; |
464 | unsigned long mmr_image; | 849 | unsigned long mmr_image; |
465 | 850 | ||
466 | nblades = uv_num_possible_blades(); | 851 | nuvhubs = uv_num_possible_blades(); |
467 | 852 | ||
468 | for (blade = 0; blade < nblades; blade++) { | 853 | for (uvhub = 0; uvhub < nuvhubs; uvhub++) { |
469 | if (!uv_blade_nr_possible_cpus(blade)) | 854 | if (!uv_blade_nr_possible_cpus(uvhub)) |
470 | continue; | 855 | continue; |
471 | 856 | ||
472 | pnode = uv_blade_to_pnode(blade); | 857 | pnode = uv_blade_to_pnode(uvhub); |
473 | mmr_image = | 858 | mmr_image = |
474 | uv_read_global_mmr64(pnode, UVH_LB_BAU_MISC_CONTROL); | 859 | uv_read_global_mmr64(pnode, UVH_LB_BAU_MISC_CONTROL); |
475 | /* | 860 | /* |
@@ -479,16 +864,16 @@ static void uv_enable_timeouts(void) | |||
479 | * To program the period, the SOFT_ACK_MODE must be off. | 864 | * To program the period, the SOFT_ACK_MODE must be off. |
480 | */ | 865 | */ |
481 | mmr_image &= ~((unsigned long)1 << | 866 | mmr_image &= ~((unsigned long)1 << |
482 | UV_ENABLE_INTD_SOFT_ACK_MODE_SHIFT); | 867 | UVH_LB_BAU_MISC_CONTROL_ENABLE_INTD_SOFT_ACK_MODE_SHFT); |
483 | uv_write_global_mmr64 | 868 | uv_write_global_mmr64 |
484 | (pnode, UVH_LB_BAU_MISC_CONTROL, mmr_image); | 869 | (pnode, UVH_LB_BAU_MISC_CONTROL, mmr_image); |
485 | /* | 870 | /* |
486 | * Set the 4-bit period. | 871 | * Set the 4-bit period. |
487 | */ | 872 | */ |
488 | mmr_image &= ~((unsigned long)0xf << | 873 | mmr_image &= ~((unsigned long)0xf << |
489 | UV_INTD_SOFT_ACK_TIMEOUT_PERIOD_SHIFT); | 874 | UVH_LB_BAU_MISC_CONTROL_INTD_SOFT_ACK_TIMEOUT_PERIOD_SHFT); |
490 | mmr_image |= (UV_INTD_SOFT_ACK_TIMEOUT_PERIOD << | 875 | mmr_image |= (UV_INTD_SOFT_ACK_TIMEOUT_PERIOD << |
491 | UV_INTD_SOFT_ACK_TIMEOUT_PERIOD_SHIFT); | 876 | UVH_LB_BAU_MISC_CONTROL_INTD_SOFT_ACK_TIMEOUT_PERIOD_SHFT); |
492 | uv_write_global_mmr64 | 877 | uv_write_global_mmr64 |
493 | (pnode, UVH_LB_BAU_MISC_CONTROL, mmr_image); | 878 | (pnode, UVH_LB_BAU_MISC_CONTROL, mmr_image); |
494 | /* | 879 | /* |
@@ -497,7 +882,7 @@ static void uv_enable_timeouts(void) | |||
497 | * indicated in bits 2:0 (7 causes all of them to timeout). | 882 | * indicated in bits 2:0 (7 causes all of them to timeout). |
498 | */ | 883 | */ |
499 | mmr_image |= ((unsigned long)1 << | 884 | mmr_image |= ((unsigned long)1 << |
500 | UV_ENABLE_INTD_SOFT_ACK_MODE_SHIFT); | 885 | UVH_LB_BAU_MISC_CONTROL_ENABLE_INTD_SOFT_ACK_MODE_SHFT); |
501 | uv_write_global_mmr64 | 886 | uv_write_global_mmr64 |
502 | (pnode, UVH_LB_BAU_MISC_CONTROL, mmr_image); | 887 | (pnode, UVH_LB_BAU_MISC_CONTROL, mmr_image); |
503 | } | 888 | } |
@@ -522,9 +907,20 @@ static void uv_ptc_seq_stop(struct seq_file *file, void *data) | |||
522 | { | 907 | { |
523 | } | 908 | } |
524 | 909 | ||
910 | static inline unsigned long long | ||
911 | millisec_2_cycles(unsigned long millisec) | ||
912 | { | ||
913 | unsigned long ns; | ||
914 | unsigned long long cyc; | ||
915 | |||
916 | ns = millisec * 1000; | ||
917 | cyc = (ns << CYC2NS_SCALE_FACTOR)/(per_cpu(cyc2ns, smp_processor_id())); | ||
918 | return cyc; | ||
919 | } | ||
920 | |||
525 | /* | 921 | /* |
526 | * Display the statistics thru /proc | 922 | * Display the statistics thru /proc. |
527 | * data points to the cpu number | 923 | * 'data' points to the cpu number |
528 | */ | 924 | */ |
529 | static int uv_ptc_seq_show(struct seq_file *file, void *data) | 925 | static int uv_ptc_seq_show(struct seq_file *file, void *data) |
530 | { | 926 | { |
@@ -535,78 +931,155 @@ static int uv_ptc_seq_show(struct seq_file *file, void *data) | |||
535 | 931 | ||
536 | if (!cpu) { | 932 | if (!cpu) { |
537 | seq_printf(file, | 933 | seq_printf(file, |
538 | "# cpu requestor requestee one all sretry dretry ptc_i "); | 934 | "# cpu sent stime numuvhubs numuvhubs16 numuvhubs8 "); |
539 | seq_printf(file, | 935 | seq_printf(file, |
540 | "sw_ack sflush dflush sok dnomsg dmult starget\n"); | 936 | "numuvhubs4 numuvhubs2 numuvhubs1 numcpus dto "); |
937 | seq_printf(file, | ||
938 | "retries rok resetp resett giveup sto bz throt "); | ||
939 | seq_printf(file, | ||
940 | "sw_ack recv rtime all "); | ||
941 | seq_printf(file, | ||
942 | "one mult none retry canc nocan reset rcan\n"); | ||
541 | } | 943 | } |
542 | if (cpu < num_possible_cpus() && cpu_online(cpu)) { | 944 | if (cpu < num_possible_cpus() && cpu_online(cpu)) { |
543 | stat = &per_cpu(ptcstats, cpu); | 945 | stat = &per_cpu(ptcstats, cpu); |
544 | seq_printf(file, "cpu %d %ld %ld %ld %ld %ld %ld %ld ", | 946 | /* source side statistics */ |
545 | cpu, stat->requestor, | 947 | seq_printf(file, |
546 | stat->requestee, stat->onetlb, stat->alltlb, | 948 | "cpu %d %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld ", |
547 | stat->s_retry, stat->d_retry, stat->ptc_i); | 949 | cpu, stat->s_requestor, cycles_2_us(stat->s_time), |
548 | seq_printf(file, "%lx %ld %ld %ld %ld %ld %ld\n", | 950 | stat->s_ntarguvhub, stat->s_ntarguvhub16, |
951 | stat->s_ntarguvhub8, stat->s_ntarguvhub4, | ||
952 | stat->s_ntarguvhub2, stat->s_ntarguvhub1, | ||
953 | stat->s_ntargcpu, stat->s_dtimeout); | ||
954 | seq_printf(file, "%ld %ld %ld %ld %ld %ld %ld %ld ", | ||
955 | stat->s_retry_messages, stat->s_retriesok, | ||
956 | stat->s_resets_plug, stat->s_resets_timeout, | ||
957 | stat->s_giveup, stat->s_stimeout, | ||
958 | stat->s_busy, stat->s_throttles); | ||
959 | /* destination side statistics */ | ||
960 | seq_printf(file, | ||
961 | "%lx %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld\n", | ||
549 | uv_read_global_mmr64(uv_cpu_to_pnode(cpu), | 962 | uv_read_global_mmr64(uv_cpu_to_pnode(cpu), |
550 | UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE), | 963 | UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE), |
551 | stat->sflush, stat->dflush, | 964 | stat->d_requestee, cycles_2_us(stat->d_time), |
552 | stat->retriesok, stat->nomsg, | 965 | stat->d_alltlb, stat->d_onetlb, stat->d_multmsg, |
553 | stat->multmsg, stat->ntargeted); | 966 | stat->d_nomsg, stat->d_retries, stat->d_canceled, |
967 | stat->d_nocanceled, stat->d_resets, | ||
968 | stat->d_rcanceled); | ||
554 | } | 969 | } |
555 | 970 | ||
556 | return 0; | 971 | return 0; |
557 | } | 972 | } |
558 | 973 | ||
559 | /* | 974 | /* |
975 | * -1: resetf the statistics | ||
560 | * 0: display meaning of the statistics | 976 | * 0: display meaning of the statistics |
561 | * >0: retry limit | 977 | * >0: maximum concurrent active descriptors per uvhub (throttle) |
562 | */ | 978 | */ |
563 | static ssize_t uv_ptc_proc_write(struct file *file, const char __user *user, | 979 | static ssize_t uv_ptc_proc_write(struct file *file, const char __user *user, |
564 | size_t count, loff_t *data) | 980 | size_t count, loff_t *data) |
565 | { | 981 | { |
566 | long newmode; | 982 | int cpu; |
983 | long input_arg; | ||
567 | char optstr[64]; | 984 | char optstr[64]; |
985 | struct ptc_stats *stat; | ||
986 | struct bau_control *bcp; | ||
568 | 987 | ||
569 | if (count == 0 || count > sizeof(optstr)) | 988 | if (count == 0 || count > sizeof(optstr)) |
570 | return -EINVAL; | 989 | return -EINVAL; |
571 | if (copy_from_user(optstr, user, count)) | 990 | if (copy_from_user(optstr, user, count)) |
572 | return -EFAULT; | 991 | return -EFAULT; |
573 | optstr[count - 1] = '\0'; | 992 | optstr[count - 1] = '\0'; |
574 | if (strict_strtoul(optstr, 10, &newmode) < 0) { | 993 | if (strict_strtol(optstr, 10, &input_arg) < 0) { |
575 | printk(KERN_DEBUG "%s is invalid\n", optstr); | 994 | printk(KERN_DEBUG "%s is invalid\n", optstr); |
576 | return -EINVAL; | 995 | return -EINVAL; |
577 | } | 996 | } |
578 | 997 | ||
579 | if (newmode == 0) { | 998 | if (input_arg == 0) { |
580 | printk(KERN_DEBUG "# cpu: cpu number\n"); | 999 | printk(KERN_DEBUG "# cpu: cpu number\n"); |
1000 | printk(KERN_DEBUG "Sender statistics:\n"); | ||
1001 | printk(KERN_DEBUG | ||
1002 | "sent: number of shootdown messages sent\n"); | ||
1003 | printk(KERN_DEBUG | ||
1004 | "stime: time spent sending messages\n"); | ||
1005 | printk(KERN_DEBUG | ||
1006 | "numuvhubs: number of hubs targeted with shootdown\n"); | ||
1007 | printk(KERN_DEBUG | ||
1008 | "numuvhubs16: number times 16 or more hubs targeted\n"); | ||
1009 | printk(KERN_DEBUG | ||
1010 | "numuvhubs8: number times 8 or more hubs targeted\n"); | ||
1011 | printk(KERN_DEBUG | ||
1012 | "numuvhubs4: number times 4 or more hubs targeted\n"); | ||
1013 | printk(KERN_DEBUG | ||
1014 | "numuvhubs2: number times 2 or more hubs targeted\n"); | ||
1015 | printk(KERN_DEBUG | ||
1016 | "numuvhubs1: number times 1 hub targeted\n"); | ||
1017 | printk(KERN_DEBUG | ||
1018 | "numcpus: number of cpus targeted with shootdown\n"); | ||
1019 | printk(KERN_DEBUG | ||
1020 | "dto: number of destination timeouts\n"); | ||
1021 | printk(KERN_DEBUG | ||
1022 | "retries: destination timeout retries sent\n"); | ||
1023 | printk(KERN_DEBUG | ||
1024 | "rok: : destination timeouts successfully retried\n"); | ||
1025 | printk(KERN_DEBUG | ||
1026 | "resetp: ipi-style resource resets for plugs\n"); | ||
1027 | printk(KERN_DEBUG | ||
1028 | "resett: ipi-style resource resets for timeouts\n"); | ||
1029 | printk(KERN_DEBUG | ||
1030 | "giveup: fall-backs to ipi-style shootdowns\n"); | ||
1031 | printk(KERN_DEBUG | ||
1032 | "sto: number of source timeouts\n"); | ||
1033 | printk(KERN_DEBUG | ||
1034 | "bz: number of stay-busy's\n"); | ||
1035 | printk(KERN_DEBUG | ||
1036 | "throt: number times spun in throttle\n"); | ||
1037 | printk(KERN_DEBUG "Destination side statistics:\n"); | ||
581 | printk(KERN_DEBUG | 1038 | printk(KERN_DEBUG |
582 | "requestor: times this cpu was the flush requestor\n"); | 1039 | "sw_ack: image of UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE\n"); |
583 | printk(KERN_DEBUG | 1040 | printk(KERN_DEBUG |
584 | "requestee: times this cpu was requested to flush its TLBs\n"); | 1041 | "recv: shootdown messages received\n"); |
585 | printk(KERN_DEBUG | 1042 | printk(KERN_DEBUG |
586 | "one: times requested to flush a single address\n"); | 1043 | "rtime: time spent processing messages\n"); |
587 | printk(KERN_DEBUG | 1044 | printk(KERN_DEBUG |
588 | "all: times requested to flush all TLB's\n"); | 1045 | "all: shootdown all-tlb messages\n"); |
589 | printk(KERN_DEBUG | 1046 | printk(KERN_DEBUG |
590 | "sretry: number of retries of source-side timeouts\n"); | 1047 | "one: shootdown one-tlb messages\n"); |
591 | printk(KERN_DEBUG | 1048 | printk(KERN_DEBUG |
592 | "dretry: number of retries of destination-side timeouts\n"); | 1049 | "mult: interrupts that found multiple messages\n"); |
593 | printk(KERN_DEBUG | 1050 | printk(KERN_DEBUG |
594 | "ptc_i: times UV fell through to IPI-style flushes\n"); | 1051 | "none: interrupts that found no messages\n"); |
595 | printk(KERN_DEBUG | 1052 | printk(KERN_DEBUG |
596 | "sw_ack: image of UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE\n"); | 1053 | "retry: number of retry messages processed\n"); |
597 | printk(KERN_DEBUG | 1054 | printk(KERN_DEBUG |
598 | "sflush_us: cycles spent in uv_flush_tlb_others()\n"); | 1055 | "canc: number messages canceled by retries\n"); |
599 | printk(KERN_DEBUG | 1056 | printk(KERN_DEBUG |
600 | "dflush_us: cycles spent in handling flush requests\n"); | 1057 | "nocan: number retries that found nothing to cancel\n"); |
601 | printk(KERN_DEBUG "sok: successes on retry\n"); | ||
602 | printk(KERN_DEBUG "dnomsg: interrupts with no message\n"); | ||
603 | printk(KERN_DEBUG | 1058 | printk(KERN_DEBUG |
604 | "dmult: interrupts with multiple messages\n"); | 1059 | "reset: number of ipi-style reset requests processed\n"); |
605 | printk(KERN_DEBUG "starget: nodes targeted\n"); | 1060 | printk(KERN_DEBUG |
1061 | "rcan: number messages canceled by reset requests\n"); | ||
1062 | } else if (input_arg == -1) { | ||
1063 | for_each_present_cpu(cpu) { | ||
1064 | stat = &per_cpu(ptcstats, cpu); | ||
1065 | memset(stat, 0, sizeof(struct ptc_stats)); | ||
1066 | } | ||
606 | } else { | 1067 | } else { |
607 | uv_bau_retry_limit = newmode; | 1068 | uv_bau_max_concurrent = input_arg; |
608 | printk(KERN_DEBUG "timeout retry limit:%d\n", | 1069 | bcp = &per_cpu(bau_control, smp_processor_id()); |
609 | uv_bau_retry_limit); | 1070 | if (uv_bau_max_concurrent < 1 || |
1071 | uv_bau_max_concurrent > bcp->cpus_in_uvhub) { | ||
1072 | printk(KERN_DEBUG | ||
1073 | "Error: BAU max concurrent %d; %d is invalid\n", | ||
1074 | bcp->max_concurrent, uv_bau_max_concurrent); | ||
1075 | return -EINVAL; | ||
1076 | } | ||
1077 | printk(KERN_DEBUG "Set BAU max concurrent:%d\n", | ||
1078 | uv_bau_max_concurrent); | ||
1079 | for_each_present_cpu(cpu) { | ||
1080 | bcp = &per_cpu(bau_control, cpu); | ||
1081 | bcp->max_concurrent = uv_bau_max_concurrent; | ||
1082 | } | ||
610 | } | 1083 | } |
611 | 1084 | ||
612 | return count; | 1085 | return count; |
@@ -650,79 +1123,30 @@ static int __init uv_ptc_init(void) | |||
650 | } | 1123 | } |
651 | 1124 | ||
652 | /* | 1125 | /* |
653 | * begin the initialization of the per-blade control structures | ||
654 | */ | ||
655 | static struct bau_control * __init uv_table_bases_init(int blade, int node) | ||
656 | { | ||
657 | int i; | ||
658 | struct bau_msg_status *msp; | ||
659 | struct bau_control *bau_tabp; | ||
660 | |||
661 | bau_tabp = | ||
662 | kmalloc_node(sizeof(struct bau_control), GFP_KERNEL, node); | ||
663 | BUG_ON(!bau_tabp); | ||
664 | |||
665 | bau_tabp->msg_statuses = | ||
666 | kmalloc_node(sizeof(struct bau_msg_status) * | ||
667 | DEST_Q_SIZE, GFP_KERNEL, node); | ||
668 | BUG_ON(!bau_tabp->msg_statuses); | ||
669 | |||
670 | for (i = 0, msp = bau_tabp->msg_statuses; i < DEST_Q_SIZE; i++, msp++) | ||
671 | bau_cpubits_clear(&msp->seen_by, (int) | ||
672 | uv_blade_nr_possible_cpus(blade)); | ||
673 | |||
674 | uv_bau_table_bases[blade] = bau_tabp; | ||
675 | |||
676 | return bau_tabp; | ||
677 | } | ||
678 | |||
679 | /* | ||
680 | * finish the initialization of the per-blade control structures | ||
681 | */ | ||
682 | static void __init | ||
683 | uv_table_bases_finish(int blade, | ||
684 | struct bau_control *bau_tablesp, | ||
685 | struct bau_desc *adp) | ||
686 | { | ||
687 | struct bau_control *bcp; | ||
688 | int cpu; | ||
689 | |||
690 | for_each_present_cpu(cpu) { | ||
691 | if (blade != uv_cpu_to_blade_id(cpu)) | ||
692 | continue; | ||
693 | |||
694 | bcp = (struct bau_control *)&per_cpu(bau_control, cpu); | ||
695 | bcp->bau_msg_head = bau_tablesp->va_queue_first; | ||
696 | bcp->va_queue_first = bau_tablesp->va_queue_first; | ||
697 | bcp->va_queue_last = bau_tablesp->va_queue_last; | ||
698 | bcp->msg_statuses = bau_tablesp->msg_statuses; | ||
699 | bcp->descriptor_base = adp; | ||
700 | } | ||
701 | } | ||
702 | |||
703 | /* | ||
704 | * initialize the sending side's sending buffers | 1126 | * initialize the sending side's sending buffers |
705 | */ | 1127 | */ |
706 | static struct bau_desc * __init | 1128 | static void |
707 | uv_activation_descriptor_init(int node, int pnode) | 1129 | uv_activation_descriptor_init(int node, int pnode) |
708 | { | 1130 | { |
709 | int i; | 1131 | int i; |
1132 | int cpu; | ||
710 | unsigned long pa; | 1133 | unsigned long pa; |
711 | unsigned long m; | 1134 | unsigned long m; |
712 | unsigned long n; | 1135 | unsigned long n; |
713 | struct bau_desc *adp; | 1136 | struct bau_desc *bau_desc; |
714 | struct bau_desc *ad2; | 1137 | struct bau_desc *bd2; |
1138 | struct bau_control *bcp; | ||
715 | 1139 | ||
716 | /* | 1140 | /* |
717 | * each bau_desc is 64 bytes; there are 8 (UV_ITEMS_PER_DESCRIPTOR) | 1141 | * each bau_desc is 64 bytes; there are 8 (UV_ITEMS_PER_DESCRIPTOR) |
718 | * per cpu; and up to 32 (UV_ADP_SIZE) cpu's per blade | 1142 | * per cpu; and up to 32 (UV_ADP_SIZE) cpu's per uvhub |
719 | */ | 1143 | */ |
720 | adp = (struct bau_desc *)kmalloc_node(sizeof(struct bau_desc)* | 1144 | bau_desc = (struct bau_desc *)kmalloc_node(sizeof(struct bau_desc)* |
721 | UV_ADP_SIZE*UV_ITEMS_PER_DESCRIPTOR, GFP_KERNEL, node); | 1145 | UV_ADP_SIZE*UV_ITEMS_PER_DESCRIPTOR, GFP_KERNEL, node); |
722 | BUG_ON(!adp); | 1146 | BUG_ON(!bau_desc); |
723 | 1147 | ||
724 | pa = uv_gpa(adp); /* need the real nasid*/ | 1148 | pa = uv_gpa(bau_desc); /* need the real nasid*/ |
725 | n = uv_gpa_to_pnode(pa); | 1149 | n = pa >> uv_nshift; |
726 | m = pa & uv_mmask; | 1150 | m = pa & uv_mmask; |
727 | 1151 | ||
728 | uv_write_global_mmr64(pnode, UVH_LB_BAU_SB_DESCRIPTOR_BASE, | 1152 | uv_write_global_mmr64(pnode, UVH_LB_BAU_SB_DESCRIPTOR_BASE, |
@@ -731,96 +1155,188 @@ uv_activation_descriptor_init(int node, int pnode) | |||
731 | /* | 1155 | /* |
732 | * initializing all 8 (UV_ITEMS_PER_DESCRIPTOR) descriptors for each | 1156 | * initializing all 8 (UV_ITEMS_PER_DESCRIPTOR) descriptors for each |
733 | * cpu even though we only use the first one; one descriptor can | 1157 | * cpu even though we only use the first one; one descriptor can |
734 | * describe a broadcast to 256 nodes. | 1158 | * describe a broadcast to 256 uv hubs. |
735 | */ | 1159 | */ |
736 | for (i = 0, ad2 = adp; i < (UV_ADP_SIZE*UV_ITEMS_PER_DESCRIPTOR); | 1160 | for (i = 0, bd2 = bau_desc; i < (UV_ADP_SIZE*UV_ITEMS_PER_DESCRIPTOR); |
737 | i++, ad2++) { | 1161 | i++, bd2++) { |
738 | memset(ad2, 0, sizeof(struct bau_desc)); | 1162 | memset(bd2, 0, sizeof(struct bau_desc)); |
739 | ad2->header.sw_ack_flag = 1; | 1163 | bd2->header.sw_ack_flag = 1; |
740 | /* | 1164 | /* |
741 | * base_dest_nodeid is the first node in the partition, so | 1165 | * base_dest_nodeid is the nasid (pnode<<1) of the first uvhub |
742 | * the bit map will indicate partition-relative node numbers. | 1166 | * in the partition. The bit map will indicate uvhub numbers, |
743 | * note that base_dest_nodeid is actually a nasid. | 1167 | * which are 0-N in a partition. Pnodes are unique system-wide. |
744 | */ | 1168 | */ |
745 | ad2->header.base_dest_nodeid = uv_partition_base_pnode << 1; | 1169 | bd2->header.base_dest_nodeid = uv_partition_base_pnode << 1; |
746 | ad2->header.dest_subnodeid = 0x10; /* the LB */ | 1170 | bd2->header.dest_subnodeid = 0x10; /* the LB */ |
747 | ad2->header.command = UV_NET_ENDPOINT_INTD; | 1171 | bd2->header.command = UV_NET_ENDPOINT_INTD; |
748 | ad2->header.int_both = 1; | 1172 | bd2->header.int_both = 1; |
749 | /* | 1173 | /* |
750 | * all others need to be set to zero: | 1174 | * all others need to be set to zero: |
751 | * fairness chaining multilevel count replied_to | 1175 | * fairness chaining multilevel count replied_to |
752 | */ | 1176 | */ |
753 | } | 1177 | } |
754 | return adp; | 1178 | for_each_present_cpu(cpu) { |
1179 | if (pnode != uv_blade_to_pnode(uv_cpu_to_blade_id(cpu))) | ||
1180 | continue; | ||
1181 | bcp = &per_cpu(bau_control, cpu); | ||
1182 | bcp->descriptor_base = bau_desc; | ||
1183 | } | ||
755 | } | 1184 | } |
756 | 1185 | ||
757 | /* | 1186 | /* |
758 | * initialize the destination side's receiving buffers | 1187 | * initialize the destination side's receiving buffers |
1188 | * entered for each uvhub in the partition | ||
1189 | * - node is first node (kernel memory notion) on the uvhub | ||
1190 | * - pnode is the uvhub's physical identifier | ||
759 | */ | 1191 | */ |
760 | static struct bau_payload_queue_entry * __init | 1192 | static void |
761 | uv_payload_queue_init(int node, int pnode, struct bau_control *bau_tablesp) | 1193 | uv_payload_queue_init(int node, int pnode) |
762 | { | 1194 | { |
763 | struct bau_payload_queue_entry *pqp; | ||
764 | unsigned long pa; | ||
765 | int pn; | 1195 | int pn; |
1196 | int cpu; | ||
766 | char *cp; | 1197 | char *cp; |
1198 | unsigned long pa; | ||
1199 | struct bau_payload_queue_entry *pqp; | ||
1200 | struct bau_payload_queue_entry *pqp_malloc; | ||
1201 | struct bau_control *bcp; | ||
767 | 1202 | ||
768 | pqp = (struct bau_payload_queue_entry *) kmalloc_node( | 1203 | pqp = (struct bau_payload_queue_entry *) kmalloc_node( |
769 | (DEST_Q_SIZE + 1) * sizeof(struct bau_payload_queue_entry), | 1204 | (DEST_Q_SIZE + 1) * sizeof(struct bau_payload_queue_entry), |
770 | GFP_KERNEL, node); | 1205 | GFP_KERNEL, node); |
771 | BUG_ON(!pqp); | 1206 | BUG_ON(!pqp); |
1207 | pqp_malloc = pqp; | ||
772 | 1208 | ||
773 | cp = (char *)pqp + 31; | 1209 | cp = (char *)pqp + 31; |
774 | pqp = (struct bau_payload_queue_entry *)(((unsigned long)cp >> 5) << 5); | 1210 | pqp = (struct bau_payload_queue_entry *)(((unsigned long)cp >> 5) << 5); |
775 | bau_tablesp->va_queue_first = pqp; | 1211 | |
1212 | for_each_present_cpu(cpu) { | ||
1213 | if (pnode != uv_cpu_to_pnode(cpu)) | ||
1214 | continue; | ||
1215 | /* for every cpu on this pnode: */ | ||
1216 | bcp = &per_cpu(bau_control, cpu); | ||
1217 | bcp->va_queue_first = pqp; | ||
1218 | bcp->bau_msg_head = pqp; | ||
1219 | bcp->va_queue_last = pqp + (DEST_Q_SIZE - 1); | ||
1220 | } | ||
776 | /* | 1221 | /* |
777 | * need the pnode of where the memory was really allocated | 1222 | * need the pnode of where the memory was really allocated |
778 | */ | 1223 | */ |
779 | pa = uv_gpa(pqp); | 1224 | pa = uv_gpa(pqp); |
780 | pn = uv_gpa_to_pnode(pa); | 1225 | pn = pa >> uv_nshift; |
781 | uv_write_global_mmr64(pnode, | 1226 | uv_write_global_mmr64(pnode, |
782 | UVH_LB_BAU_INTD_PAYLOAD_QUEUE_FIRST, | 1227 | UVH_LB_BAU_INTD_PAYLOAD_QUEUE_FIRST, |
783 | ((unsigned long)pn << UV_PAYLOADQ_PNODE_SHIFT) | | 1228 | ((unsigned long)pn << UV_PAYLOADQ_PNODE_SHIFT) | |
784 | uv_physnodeaddr(pqp)); | 1229 | uv_physnodeaddr(pqp)); |
785 | uv_write_global_mmr64(pnode, UVH_LB_BAU_INTD_PAYLOAD_QUEUE_TAIL, | 1230 | uv_write_global_mmr64(pnode, UVH_LB_BAU_INTD_PAYLOAD_QUEUE_TAIL, |
786 | uv_physnodeaddr(pqp)); | 1231 | uv_physnodeaddr(pqp)); |
787 | bau_tablesp->va_queue_last = pqp + (DEST_Q_SIZE - 1); | ||
788 | uv_write_global_mmr64(pnode, UVH_LB_BAU_INTD_PAYLOAD_QUEUE_LAST, | 1232 | uv_write_global_mmr64(pnode, UVH_LB_BAU_INTD_PAYLOAD_QUEUE_LAST, |
789 | (unsigned long) | 1233 | (unsigned long) |
790 | uv_physnodeaddr(bau_tablesp->va_queue_last)); | 1234 | uv_physnodeaddr(pqp + (DEST_Q_SIZE - 1))); |
1235 | /* in effect, all msg_type's are set to MSG_NOOP */ | ||
791 | memset(pqp, 0, sizeof(struct bau_payload_queue_entry) * DEST_Q_SIZE); | 1236 | memset(pqp, 0, sizeof(struct bau_payload_queue_entry) * DEST_Q_SIZE); |
792 | |||
793 | return pqp; | ||
794 | } | 1237 | } |
795 | 1238 | ||
796 | /* | 1239 | /* |
797 | * Initialization of each UV blade's structures | 1240 | * Initialization of each UV hub's structures |
798 | */ | 1241 | */ |
799 | static int __init uv_init_blade(int blade) | 1242 | static void __init uv_init_uvhub(int uvhub, int vector) |
800 | { | 1243 | { |
801 | int node; | 1244 | int node; |
802 | int pnode; | 1245 | int pnode; |
803 | unsigned long pa; | ||
804 | unsigned long apicid; | 1246 | unsigned long apicid; |
805 | struct bau_desc *adp; | 1247 | |
806 | struct bau_payload_queue_entry *pqp; | 1248 | node = uvhub_to_first_node(uvhub); |
807 | struct bau_control *bau_tablesp; | 1249 | pnode = uv_blade_to_pnode(uvhub); |
808 | 1250 | uv_activation_descriptor_init(node, pnode); | |
809 | node = blade_to_first_node(blade); | 1251 | uv_payload_queue_init(node, pnode); |
810 | bau_tablesp = uv_table_bases_init(blade, node); | ||
811 | pnode = uv_blade_to_pnode(blade); | ||
812 | adp = uv_activation_descriptor_init(node, pnode); | ||
813 | pqp = uv_payload_queue_init(node, pnode, bau_tablesp); | ||
814 | uv_table_bases_finish(blade, bau_tablesp, adp); | ||
815 | /* | 1252 | /* |
816 | * the below initialization can't be in firmware because the | 1253 | * the below initialization can't be in firmware because the |
817 | * messaging IRQ will be determined by the OS | 1254 | * messaging IRQ will be determined by the OS |
818 | */ | 1255 | */ |
819 | apicid = blade_to_first_apicid(blade); | 1256 | apicid = uvhub_to_first_apicid(uvhub); |
820 | pa = uv_read_global_mmr64(pnode, UVH_BAU_DATA_CONFIG); | ||
821 | uv_write_global_mmr64(pnode, UVH_BAU_DATA_CONFIG, | 1257 | uv_write_global_mmr64(pnode, UVH_BAU_DATA_CONFIG, |
822 | ((apicid << 32) | UV_BAU_MESSAGE)); | 1258 | ((apicid << 32) | vector)); |
823 | return 0; | 1259 | } |
1260 | |||
1261 | /* | ||
1262 | * initialize the bau_control structure for each cpu | ||
1263 | */ | ||
1264 | static void uv_init_per_cpu(int nuvhubs) | ||
1265 | { | ||
1266 | int i, j, k; | ||
1267 | int cpu; | ||
1268 | int pnode; | ||
1269 | int uvhub; | ||
1270 | short socket = 0; | ||
1271 | struct bau_control *bcp; | ||
1272 | struct uvhub_desc *bdp; | ||
1273 | struct socket_desc *sdp; | ||
1274 | struct bau_control *hmaster = NULL; | ||
1275 | struct bau_control *smaster = NULL; | ||
1276 | struct socket_desc { | ||
1277 | short num_cpus; | ||
1278 | short cpu_number[16]; | ||
1279 | }; | ||
1280 | struct uvhub_desc { | ||
1281 | short num_sockets; | ||
1282 | short num_cpus; | ||
1283 | short uvhub; | ||
1284 | short pnode; | ||
1285 | struct socket_desc socket[2]; | ||
1286 | }; | ||
1287 | struct uvhub_desc *uvhub_descs; | ||
1288 | |||
1289 | uvhub_descs = (struct uvhub_desc *) | ||
1290 | kmalloc(nuvhubs * sizeof(struct uvhub_desc), GFP_KERNEL); | ||
1291 | memset(uvhub_descs, 0, nuvhubs * sizeof(struct uvhub_desc)); | ||
1292 | for_each_present_cpu(cpu) { | ||
1293 | bcp = &per_cpu(bau_control, cpu); | ||
1294 | memset(bcp, 0, sizeof(struct bau_control)); | ||
1295 | spin_lock_init(&bcp->masks_lock); | ||
1296 | bcp->max_concurrent = uv_bau_max_concurrent; | ||
1297 | pnode = uv_cpu_hub_info(cpu)->pnode; | ||
1298 | uvhub = uv_cpu_hub_info(cpu)->numa_blade_id; | ||
1299 | bdp = &uvhub_descs[uvhub]; | ||
1300 | bdp->num_cpus++; | ||
1301 | bdp->uvhub = uvhub; | ||
1302 | bdp->pnode = pnode; | ||
1303 | /* time interval to catch a hardware stay-busy bug */ | ||
1304 | bcp->timeout_interval = millisec_2_cycles(3); | ||
1305 | /* kludge: assume uv_hub.h is constant */ | ||
1306 | socket = (cpu_physical_id(cpu)>>5)&1; | ||
1307 | if (socket >= bdp->num_sockets) | ||
1308 | bdp->num_sockets = socket+1; | ||
1309 | sdp = &bdp->socket[socket]; | ||
1310 | sdp->cpu_number[sdp->num_cpus] = cpu; | ||
1311 | sdp->num_cpus++; | ||
1312 | } | ||
1313 | socket = 0; | ||
1314 | for_each_possible_blade(uvhub) { | ||
1315 | bdp = &uvhub_descs[uvhub]; | ||
1316 | for (i = 0; i < bdp->num_sockets; i++) { | ||
1317 | sdp = &bdp->socket[i]; | ||
1318 | for (j = 0; j < sdp->num_cpus; j++) { | ||
1319 | cpu = sdp->cpu_number[j]; | ||
1320 | bcp = &per_cpu(bau_control, cpu); | ||
1321 | bcp->cpu = cpu; | ||
1322 | if (j == 0) { | ||
1323 | smaster = bcp; | ||
1324 | if (i == 0) | ||
1325 | hmaster = bcp; | ||
1326 | } | ||
1327 | bcp->cpus_in_uvhub = bdp->num_cpus; | ||
1328 | bcp->cpus_in_socket = sdp->num_cpus; | ||
1329 | bcp->socket_master = smaster; | ||
1330 | bcp->uvhub_master = hmaster; | ||
1331 | for (k = 0; k < DEST_Q_SIZE; k++) | ||
1332 | bcp->socket_acknowledge_count[k] = 0; | ||
1333 | bcp->uvhub_cpu = | ||
1334 | uv_cpu_hub_info(cpu)->blade_processor_id; | ||
1335 | } | ||
1336 | socket++; | ||
1337 | } | ||
1338 | } | ||
1339 | kfree(uvhub_descs); | ||
824 | } | 1340 | } |
825 | 1341 | ||
826 | /* | 1342 | /* |
@@ -828,38 +1344,54 @@ static int __init uv_init_blade(int blade) | |||
828 | */ | 1344 | */ |
829 | static int __init uv_bau_init(void) | 1345 | static int __init uv_bau_init(void) |
830 | { | 1346 | { |
831 | int blade; | 1347 | int uvhub; |
832 | int nblades; | 1348 | int pnode; |
1349 | int nuvhubs; | ||
833 | int cur_cpu; | 1350 | int cur_cpu; |
1351 | int vector; | ||
1352 | unsigned long mmr; | ||
834 | 1353 | ||
835 | if (!is_uv_system()) | 1354 | if (!is_uv_system()) |
836 | return 0; | 1355 | return 0; |
837 | 1356 | ||
1357 | if (nobau) | ||
1358 | return 0; | ||
1359 | |||
838 | for_each_possible_cpu(cur_cpu) | 1360 | for_each_possible_cpu(cur_cpu) |
839 | zalloc_cpumask_var_node(&per_cpu(uv_flush_tlb_mask, cur_cpu), | 1361 | zalloc_cpumask_var_node(&per_cpu(uv_flush_tlb_mask, cur_cpu), |
840 | GFP_KERNEL, cpu_to_node(cur_cpu)); | 1362 | GFP_KERNEL, cpu_to_node(cur_cpu)); |
841 | 1363 | ||
842 | uv_bau_retry_limit = 1; | 1364 | uv_bau_max_concurrent = MAX_BAU_CONCURRENT; |
1365 | uv_nshift = uv_hub_info->m_val; | ||
843 | uv_mmask = (1UL << uv_hub_info->m_val) - 1; | 1366 | uv_mmask = (1UL << uv_hub_info->m_val) - 1; |
844 | nblades = uv_num_possible_blades(); | 1367 | nuvhubs = uv_num_possible_blades(); |
845 | 1368 | ||
846 | uv_bau_table_bases = (struct bau_control **) | 1369 | uv_init_per_cpu(nuvhubs); |
847 | kmalloc(nblades * sizeof(struct bau_control *), GFP_KERNEL); | ||
848 | BUG_ON(!uv_bau_table_bases); | ||
849 | 1370 | ||
850 | uv_partition_base_pnode = 0x7fffffff; | 1371 | uv_partition_base_pnode = 0x7fffffff; |
851 | for (blade = 0; blade < nblades; blade++) | 1372 | for (uvhub = 0; uvhub < nuvhubs; uvhub++) |
852 | if (uv_blade_nr_possible_cpus(blade) && | 1373 | if (uv_blade_nr_possible_cpus(uvhub) && |
853 | (uv_blade_to_pnode(blade) < uv_partition_base_pnode)) | 1374 | (uv_blade_to_pnode(uvhub) < uv_partition_base_pnode)) |
854 | uv_partition_base_pnode = uv_blade_to_pnode(blade); | 1375 | uv_partition_base_pnode = uv_blade_to_pnode(uvhub); |
855 | for (blade = 0; blade < nblades; blade++) | 1376 | |
856 | if (uv_blade_nr_possible_cpus(blade)) | 1377 | vector = UV_BAU_MESSAGE; |
857 | uv_init_blade(blade); | 1378 | for_each_possible_blade(uvhub) |
858 | 1379 | if (uv_blade_nr_possible_cpus(uvhub)) | |
859 | alloc_intr_gate(UV_BAU_MESSAGE, uv_bau_message_intr1); | 1380 | uv_init_uvhub(uvhub, vector); |
1381 | |||
860 | uv_enable_timeouts(); | 1382 | uv_enable_timeouts(); |
1383 | alloc_intr_gate(vector, uv_bau_message_intr1); | ||
1384 | |||
1385 | for_each_possible_blade(uvhub) { | ||
1386 | pnode = uv_blade_to_pnode(uvhub); | ||
1387 | /* INIT the bau */ | ||
1388 | uv_write_global_mmr64(pnode, UVH_LB_BAU_SB_ACTIVATION_CONTROL, | ||
1389 | ((unsigned long)1 << 63)); | ||
1390 | mmr = 1; /* should be 1 to broadcast to both sockets */ | ||
1391 | uv_write_global_mmr64(pnode, UVH_BAU_DATA_BROADCAST, mmr); | ||
1392 | } | ||
861 | 1393 | ||
862 | return 0; | 1394 | return 0; |
863 | } | 1395 | } |
864 | __initcall(uv_bau_init); | 1396 | core_initcall(uv_bau_init); |
865 | __initcall(uv_ptc_init); | 1397 | core_initcall(uv_ptc_init); |
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c index 36f1bd9f8e76..02cfb9b8f5b1 100644 --- a/arch/x86/kernel/traps.c +++ b/arch/x86/kernel/traps.c | |||
@@ -108,15 +108,6 @@ static inline void preempt_conditional_cli(struct pt_regs *regs) | |||
108 | dec_preempt_count(); | 108 | dec_preempt_count(); |
109 | } | 109 | } |
110 | 110 | ||
111 | #ifdef CONFIG_X86_32 | ||
112 | static inline void | ||
113 | die_if_kernel(const char *str, struct pt_regs *regs, long err) | ||
114 | { | ||
115 | if (!user_mode_vm(regs)) | ||
116 | die(str, regs, err); | ||
117 | } | ||
118 | #endif | ||
119 | |||
120 | static void __kprobes | 111 | static void __kprobes |
121 | do_trap(int trapnr, int signr, char *str, struct pt_regs *regs, | 112 | do_trap(int trapnr, int signr, char *str, struct pt_regs *regs, |
122 | long error_code, siginfo_t *info) | 113 | long error_code, siginfo_t *info) |
@@ -585,55 +576,67 @@ dotraplinkage void __kprobes do_debug(struct pt_regs *regs, long error_code) | |||
585 | return; | 576 | return; |
586 | } | 577 | } |
587 | 578 | ||
588 | #ifdef CONFIG_X86_64 | ||
589 | static int kernel_math_error(struct pt_regs *regs, const char *str, int trapnr) | ||
590 | { | ||
591 | if (fixup_exception(regs)) | ||
592 | return 1; | ||
593 | |||
594 | notify_die(DIE_GPF, str, regs, 0, trapnr, SIGFPE); | ||
595 | /* Illegal floating point operation in the kernel */ | ||
596 | current->thread.trap_no = trapnr; | ||
597 | die(str, regs, 0); | ||
598 | return 0; | ||
599 | } | ||
600 | #endif | ||
601 | |||
602 | /* | 579 | /* |
603 | * Note that we play around with the 'TS' bit in an attempt to get | 580 | * Note that we play around with the 'TS' bit in an attempt to get |
604 | * the correct behaviour even in the presence of the asynchronous | 581 | * the correct behaviour even in the presence of the asynchronous |
605 | * IRQ13 behaviour | 582 | * IRQ13 behaviour |
606 | */ | 583 | */ |
607 | void math_error(void __user *ip) | 584 | void math_error(struct pt_regs *regs, int error_code, int trapnr) |
608 | { | 585 | { |
609 | struct task_struct *task; | 586 | struct task_struct *task = current; |
610 | siginfo_t info; | 587 | siginfo_t info; |
611 | unsigned short cwd, swd, err; | 588 | unsigned short err; |
589 | char *str = (trapnr == 16) ? "fpu exception" : "simd exception"; | ||
590 | |||
591 | if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, SIGFPE) == NOTIFY_STOP) | ||
592 | return; | ||
593 | conditional_sti(regs); | ||
594 | |||
595 | if (!user_mode_vm(regs)) | ||
596 | { | ||
597 | if (!fixup_exception(regs)) { | ||
598 | task->thread.error_code = error_code; | ||
599 | task->thread.trap_no = trapnr; | ||
600 | die(str, regs, error_code); | ||
601 | } | ||
602 | return; | ||
603 | } | ||
612 | 604 | ||
613 | /* | 605 | /* |
614 | * Save the info for the exception handler and clear the error. | 606 | * Save the info for the exception handler and clear the error. |
615 | */ | 607 | */ |
616 | task = current; | ||
617 | save_init_fpu(task); | 608 | save_init_fpu(task); |
618 | task->thread.trap_no = 16; | 609 | task->thread.trap_no = trapnr; |
619 | task->thread.error_code = 0; | 610 | task->thread.error_code = error_code; |
620 | info.si_signo = SIGFPE; | 611 | info.si_signo = SIGFPE; |
621 | info.si_errno = 0; | 612 | info.si_errno = 0; |
622 | info.si_addr = ip; | 613 | info.si_addr = (void __user *)regs->ip; |
623 | /* | 614 | if (trapnr == 16) { |
624 | * (~cwd & swd) will mask out exceptions that are not set to unmasked | 615 | unsigned short cwd, swd; |
625 | * status. 0x3f is the exception bits in these regs, 0x200 is the | 616 | /* |
626 | * C1 reg you need in case of a stack fault, 0x040 is the stack | 617 | * (~cwd & swd) will mask out exceptions that are not set to unmasked |
627 | * fault bit. We should only be taking one exception at a time, | 618 | * status. 0x3f is the exception bits in these regs, 0x200 is the |
628 | * so if this combination doesn't produce any single exception, | 619 | * C1 reg you need in case of a stack fault, 0x040 is the stack |
629 | * then we have a bad program that isn't synchronizing its FPU usage | 620 | * fault bit. We should only be taking one exception at a time, |
630 | * and it will suffer the consequences since we won't be able to | 621 | * so if this combination doesn't produce any single exception, |
631 | * fully reproduce the context of the exception | 622 | * then we have a bad program that isn't synchronizing its FPU usage |
632 | */ | 623 | * and it will suffer the consequences since we won't be able to |
633 | cwd = get_fpu_cwd(task); | 624 | * fully reproduce the context of the exception |
634 | swd = get_fpu_swd(task); | 625 | */ |
626 | cwd = get_fpu_cwd(task); | ||
627 | swd = get_fpu_swd(task); | ||
635 | 628 | ||
636 | err = swd & ~cwd; | 629 | err = swd & ~cwd; |
630 | } else { | ||
631 | /* | ||
632 | * The SIMD FPU exceptions are handled a little differently, as there | ||
633 | * is only a single status/control register. Thus, to determine which | ||
634 | * unmasked exception was caught we must mask the exception mask bits | ||
635 | * at 0x1f80, and then use these to mask the exception bits at 0x3f. | ||
636 | */ | ||
637 | unsigned short mxcsr = get_fpu_mxcsr(task); | ||
638 | err = ~(mxcsr >> 7) & mxcsr; | ||
639 | } | ||
637 | 640 | ||
638 | if (err & 0x001) { /* Invalid op */ | 641 | if (err & 0x001) { /* Invalid op */ |
639 | /* | 642 | /* |
@@ -662,97 +665,17 @@ void math_error(void __user *ip) | |||
662 | 665 | ||
663 | dotraplinkage void do_coprocessor_error(struct pt_regs *regs, long error_code) | 666 | dotraplinkage void do_coprocessor_error(struct pt_regs *regs, long error_code) |
664 | { | 667 | { |
665 | conditional_sti(regs); | ||
666 | |||
667 | #ifdef CONFIG_X86_32 | 668 | #ifdef CONFIG_X86_32 |
668 | ignore_fpu_irq = 1; | 669 | ignore_fpu_irq = 1; |
669 | #else | ||
670 | if (!user_mode(regs) && | ||
671 | kernel_math_error(regs, "kernel x87 math error", 16)) | ||
672 | return; | ||
673 | #endif | 670 | #endif |
674 | 671 | ||
675 | math_error((void __user *)regs->ip); | 672 | math_error(regs, error_code, 16); |
676 | } | ||
677 | |||
678 | static void simd_math_error(void __user *ip) | ||
679 | { | ||
680 | struct task_struct *task; | ||
681 | siginfo_t info; | ||
682 | unsigned short mxcsr; | ||
683 | |||
684 | /* | ||
685 | * Save the info for the exception handler and clear the error. | ||
686 | */ | ||
687 | task = current; | ||
688 | save_init_fpu(task); | ||
689 | task->thread.trap_no = 19; | ||
690 | task->thread.error_code = 0; | ||
691 | info.si_signo = SIGFPE; | ||
692 | info.si_errno = 0; | ||
693 | info.si_code = __SI_FAULT; | ||
694 | info.si_addr = ip; | ||
695 | /* | ||
696 | * The SIMD FPU exceptions are handled a little differently, as there | ||
697 | * is only a single status/control register. Thus, to determine which | ||
698 | * unmasked exception was caught we must mask the exception mask bits | ||
699 | * at 0x1f80, and then use these to mask the exception bits at 0x3f. | ||
700 | */ | ||
701 | mxcsr = get_fpu_mxcsr(task); | ||
702 | switch (~((mxcsr & 0x1f80) >> 7) & (mxcsr & 0x3f)) { | ||
703 | case 0x000: | ||
704 | default: | ||
705 | break; | ||
706 | case 0x001: /* Invalid Op */ | ||
707 | info.si_code = FPE_FLTINV; | ||
708 | break; | ||
709 | case 0x002: /* Denormalize */ | ||
710 | case 0x010: /* Underflow */ | ||
711 | info.si_code = FPE_FLTUND; | ||
712 | break; | ||
713 | case 0x004: /* Zero Divide */ | ||
714 | info.si_code = FPE_FLTDIV; | ||
715 | break; | ||
716 | case 0x008: /* Overflow */ | ||
717 | info.si_code = FPE_FLTOVF; | ||
718 | break; | ||
719 | case 0x020: /* Precision */ | ||
720 | info.si_code = FPE_FLTRES; | ||
721 | break; | ||
722 | } | ||
723 | force_sig_info(SIGFPE, &info, task); | ||
724 | } | 673 | } |
725 | 674 | ||
726 | dotraplinkage void | 675 | dotraplinkage void |
727 | do_simd_coprocessor_error(struct pt_regs *regs, long error_code) | 676 | do_simd_coprocessor_error(struct pt_regs *regs, long error_code) |
728 | { | 677 | { |
729 | conditional_sti(regs); | 678 | math_error(regs, error_code, 19); |
730 | |||
731 | #ifdef CONFIG_X86_32 | ||
732 | if (cpu_has_xmm) { | ||
733 | /* Handle SIMD FPU exceptions on PIII+ processors. */ | ||
734 | ignore_fpu_irq = 1; | ||
735 | simd_math_error((void __user *)regs->ip); | ||
736 | return; | ||
737 | } | ||
738 | /* | ||
739 | * Handle strange cache flush from user space exception | ||
740 | * in all other cases. This is undocumented behaviour. | ||
741 | */ | ||
742 | if (regs->flags & X86_VM_MASK) { | ||
743 | handle_vm86_fault((struct kernel_vm86_regs *)regs, error_code); | ||
744 | return; | ||
745 | } | ||
746 | current->thread.trap_no = 19; | ||
747 | current->thread.error_code = error_code; | ||
748 | die_if_kernel("cache flush denied", regs, error_code); | ||
749 | force_sig(SIGSEGV, current); | ||
750 | #else | ||
751 | if (!user_mode(regs) && | ||
752 | kernel_math_error(regs, "kernel simd math error", 19)) | ||
753 | return; | ||
754 | simd_math_error((void __user *)regs->ip); | ||
755 | #endif | ||
756 | } | 679 | } |
757 | 680 | ||
758 | dotraplinkage void | 681 | dotraplinkage void |
diff --git a/arch/x86/kernel/uv_irq.c b/arch/x86/kernel/uv_irq.c index 1d40336b030a..1132129db792 100644 --- a/arch/x86/kernel/uv_irq.c +++ b/arch/x86/kernel/uv_irq.c | |||
@@ -44,7 +44,7 @@ static void uv_ack_apic(unsigned int irq) | |||
44 | ack_APIC_irq(); | 44 | ack_APIC_irq(); |
45 | } | 45 | } |
46 | 46 | ||
47 | struct irq_chip uv_irq_chip = { | 47 | static struct irq_chip uv_irq_chip = { |
48 | .name = "UV-CORE", | 48 | .name = "UV-CORE", |
49 | .startup = uv_noop_ret, | 49 | .startup = uv_noop_ret, |
50 | .shutdown = uv_noop, | 50 | .shutdown = uv_noop, |
@@ -141,7 +141,7 @@ int uv_irq_2_mmr_info(int irq, unsigned long *offset, int *pnode) | |||
141 | */ | 141 | */ |
142 | static int | 142 | static int |
143 | arch_enable_uv_irq(char *irq_name, unsigned int irq, int cpu, int mmr_blade, | 143 | arch_enable_uv_irq(char *irq_name, unsigned int irq, int cpu, int mmr_blade, |
144 | unsigned long mmr_offset, int restrict) | 144 | unsigned long mmr_offset, int limit) |
145 | { | 145 | { |
146 | const struct cpumask *eligible_cpu = cpumask_of(cpu); | 146 | const struct cpumask *eligible_cpu = cpumask_of(cpu); |
147 | struct irq_desc *desc = irq_to_desc(irq); | 147 | struct irq_desc *desc = irq_to_desc(irq); |
@@ -160,7 +160,7 @@ arch_enable_uv_irq(char *irq_name, unsigned int irq, int cpu, int mmr_blade, | |||
160 | if (err != 0) | 160 | if (err != 0) |
161 | return err; | 161 | return err; |
162 | 162 | ||
163 | if (restrict == UV_AFFINITY_CPU) | 163 | if (limit == UV_AFFINITY_CPU) |
164 | desc->status |= IRQ_NO_BALANCING; | 164 | desc->status |= IRQ_NO_BALANCING; |
165 | else | 165 | else |
166 | desc->status |= IRQ_MOVE_PCNTXT; | 166 | desc->status |= IRQ_MOVE_PCNTXT; |
@@ -214,7 +214,7 @@ static int uv_set_irq_affinity(unsigned int irq, const struct cpumask *mask) | |||
214 | unsigned long mmr_value; | 214 | unsigned long mmr_value; |
215 | struct uv_IO_APIC_route_entry *entry; | 215 | struct uv_IO_APIC_route_entry *entry; |
216 | unsigned long mmr_offset; | 216 | unsigned long mmr_offset; |
217 | unsigned mmr_pnode; | 217 | int mmr_pnode; |
218 | 218 | ||
219 | if (set_desc_affinity(desc, mask, &dest)) | 219 | if (set_desc_affinity(desc, mask, &dest)) |
220 | return -1; | 220 | return -1; |
@@ -248,7 +248,7 @@ static int uv_set_irq_affinity(unsigned int irq, const struct cpumask *mask) | |||
248 | * interrupt is raised. | 248 | * interrupt is raised. |
249 | */ | 249 | */ |
250 | int uv_setup_irq(char *irq_name, int cpu, int mmr_blade, | 250 | int uv_setup_irq(char *irq_name, int cpu, int mmr_blade, |
251 | unsigned long mmr_offset, int restrict) | 251 | unsigned long mmr_offset, int limit) |
252 | { | 252 | { |
253 | int irq, ret; | 253 | int irq, ret; |
254 | 254 | ||
@@ -258,7 +258,7 @@ int uv_setup_irq(char *irq_name, int cpu, int mmr_blade, | |||
258 | return -EBUSY; | 258 | return -EBUSY; |
259 | 259 | ||
260 | ret = arch_enable_uv_irq(irq_name, irq, cpu, mmr_blade, mmr_offset, | 260 | ret = arch_enable_uv_irq(irq_name, irq, cpu, mmr_blade, mmr_offset, |
261 | restrict); | 261 | limit); |
262 | if (ret == irq) | 262 | if (ret == irq) |
263 | uv_set_irq_2_mmr_info(irq, mmr_offset, mmr_blade); | 263 | uv_set_irq_2_mmr_info(irq, mmr_offset, mmr_blade); |
264 | else | 264 | else |
diff --git a/arch/x86/kernel/x8664_ksyms_64.c b/arch/x86/kernel/x8664_ksyms_64.c index 693920b22496..1b950d151e58 100644 --- a/arch/x86/kernel/x8664_ksyms_64.c +++ b/arch/x86/kernel/x8664_ksyms_64.c | |||
@@ -54,7 +54,6 @@ EXPORT_SYMBOL(memcpy); | |||
54 | EXPORT_SYMBOL(__memcpy); | 54 | EXPORT_SYMBOL(__memcpy); |
55 | 55 | ||
56 | EXPORT_SYMBOL(empty_zero_page); | 56 | EXPORT_SYMBOL(empty_zero_page); |
57 | EXPORT_SYMBOL(init_level4_pgt); | ||
58 | #ifndef CONFIG_PARAVIRT | 57 | #ifndef CONFIG_PARAVIRT |
59 | EXPORT_SYMBOL(native_load_gs_index); | 58 | EXPORT_SYMBOL(native_load_gs_index); |
60 | #endif | 59 | #endif |
diff --git a/arch/x86/kernel/xsave.c b/arch/x86/kernel/xsave.c index 782c3a362ec6..37e68fc5e24a 100644 --- a/arch/x86/kernel/xsave.c +++ b/arch/x86/kernel/xsave.c | |||
@@ -99,7 +99,7 @@ int save_i387_xstate(void __user *buf) | |||
99 | if (err) | 99 | if (err) |
100 | return err; | 100 | return err; |
101 | 101 | ||
102 | if (task_thread_info(tsk)->status & TS_XSAVE) | 102 | if (use_xsave()) |
103 | err = xsave_user(buf); | 103 | err = xsave_user(buf); |
104 | else | 104 | else |
105 | err = fxsave_user(buf); | 105 | err = fxsave_user(buf); |
@@ -109,14 +109,14 @@ int save_i387_xstate(void __user *buf) | |||
109 | task_thread_info(tsk)->status &= ~TS_USEDFPU; | 109 | task_thread_info(tsk)->status &= ~TS_USEDFPU; |
110 | stts(); | 110 | stts(); |
111 | } else { | 111 | } else { |
112 | if (__copy_to_user(buf, &tsk->thread.xstate->fxsave, | 112 | if (__copy_to_user(buf, &tsk->thread.fpu.state->fxsave, |
113 | xstate_size)) | 113 | xstate_size)) |
114 | return -1; | 114 | return -1; |
115 | } | 115 | } |
116 | 116 | ||
117 | clear_used_math(); /* trigger finit */ | 117 | clear_used_math(); /* trigger finit */ |
118 | 118 | ||
119 | if (task_thread_info(tsk)->status & TS_XSAVE) { | 119 | if (use_xsave()) { |
120 | struct _fpstate __user *fx = buf; | 120 | struct _fpstate __user *fx = buf; |
121 | struct _xstate __user *x = buf; | 121 | struct _xstate __user *x = buf; |
122 | u64 xstate_bv; | 122 | u64 xstate_bv; |
@@ -225,7 +225,7 @@ int restore_i387_xstate(void __user *buf) | |||
225 | clts(); | 225 | clts(); |
226 | task_thread_info(current)->status |= TS_USEDFPU; | 226 | task_thread_info(current)->status |= TS_USEDFPU; |
227 | } | 227 | } |
228 | if (task_thread_info(tsk)->status & TS_XSAVE) | 228 | if (use_xsave()) |
229 | err = restore_user_xstate(buf); | 229 | err = restore_user_xstate(buf); |
230 | else | 230 | else |
231 | err = fxrstor_checking((__force struct i387_fxsave_struct *) | 231 | err = fxrstor_checking((__force struct i387_fxsave_struct *) |
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 2ba58206812a..737361fcd503 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
@@ -2067,7 +2067,7 @@ static int cpuid_interception(struct vcpu_svm *svm) | |||
2067 | static int iret_interception(struct vcpu_svm *svm) | 2067 | static int iret_interception(struct vcpu_svm *svm) |
2068 | { | 2068 | { |
2069 | ++svm->vcpu.stat.nmi_window_exits; | 2069 | ++svm->vcpu.stat.nmi_window_exits; |
2070 | svm->vmcb->control.intercept &= ~(1UL << INTERCEPT_IRET); | 2070 | svm->vmcb->control.intercept &= ~(1ULL << INTERCEPT_IRET); |
2071 | svm->vcpu.arch.hflags |= HF_IRET_MASK; | 2071 | svm->vcpu.arch.hflags |= HF_IRET_MASK; |
2072 | return 1; | 2072 | return 1; |
2073 | } | 2073 | } |
@@ -2479,7 +2479,7 @@ static void svm_inject_nmi(struct kvm_vcpu *vcpu) | |||
2479 | 2479 | ||
2480 | svm->vmcb->control.event_inj = SVM_EVTINJ_VALID | SVM_EVTINJ_TYPE_NMI; | 2480 | svm->vmcb->control.event_inj = SVM_EVTINJ_VALID | SVM_EVTINJ_TYPE_NMI; |
2481 | vcpu->arch.hflags |= HF_NMI_MASK; | 2481 | vcpu->arch.hflags |= HF_NMI_MASK; |
2482 | svm->vmcb->control.intercept |= (1UL << INTERCEPT_IRET); | 2482 | svm->vmcb->control.intercept |= (1ULL << INTERCEPT_IRET); |
2483 | ++vcpu->stat.nmi_injections; | 2483 | ++vcpu->stat.nmi_injections; |
2484 | } | 2484 | } |
2485 | 2485 | ||
@@ -2539,10 +2539,10 @@ static void svm_set_nmi_mask(struct kvm_vcpu *vcpu, bool masked) | |||
2539 | 2539 | ||
2540 | if (masked) { | 2540 | if (masked) { |
2541 | svm->vcpu.arch.hflags |= HF_NMI_MASK; | 2541 | svm->vcpu.arch.hflags |= HF_NMI_MASK; |
2542 | svm->vmcb->control.intercept |= (1UL << INTERCEPT_IRET); | 2542 | svm->vmcb->control.intercept |= (1ULL << INTERCEPT_IRET); |
2543 | } else { | 2543 | } else { |
2544 | svm->vcpu.arch.hflags &= ~HF_NMI_MASK; | 2544 | svm->vcpu.arch.hflags &= ~HF_NMI_MASK; |
2545 | svm->vmcb->control.intercept &= ~(1UL << INTERCEPT_IRET); | 2545 | svm->vmcb->control.intercept &= ~(1ULL << INTERCEPT_IRET); |
2546 | } | 2546 | } |
2547 | } | 2547 | } |
2548 | 2548 | ||
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 32022a8a5c3b..edca080407a5 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -2703,8 +2703,7 @@ static int vmx_nmi_allowed(struct kvm_vcpu *vcpu) | |||
2703 | return 0; | 2703 | return 0; |
2704 | 2704 | ||
2705 | return !(vmcs_read32(GUEST_INTERRUPTIBILITY_INFO) & | 2705 | return !(vmcs_read32(GUEST_INTERRUPTIBILITY_INFO) & |
2706 | (GUEST_INTR_STATE_STI | GUEST_INTR_STATE_MOV_SS | | 2706 | (GUEST_INTR_STATE_MOV_SS | GUEST_INTR_STATE_NMI)); |
2707 | GUEST_INTR_STATE_NMI)); | ||
2708 | } | 2707 | } |
2709 | 2708 | ||
2710 | static bool vmx_get_nmi_mask(struct kvm_vcpu *vcpu) | 2709 | static bool vmx_get_nmi_mask(struct kvm_vcpu *vcpu) |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 73d854c36e39..dd9bc8fb81ab 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -1713,6 +1713,7 @@ static int kvm_vcpu_ioctl_set_cpuid(struct kvm_vcpu *vcpu, | |||
1713 | if (copy_from_user(cpuid_entries, entries, | 1713 | if (copy_from_user(cpuid_entries, entries, |
1714 | cpuid->nent * sizeof(struct kvm_cpuid_entry))) | 1714 | cpuid->nent * sizeof(struct kvm_cpuid_entry))) |
1715 | goto out_free; | 1715 | goto out_free; |
1716 | vcpu_load(vcpu); | ||
1716 | for (i = 0; i < cpuid->nent; i++) { | 1717 | for (i = 0; i < cpuid->nent; i++) { |
1717 | vcpu->arch.cpuid_entries[i].function = cpuid_entries[i].function; | 1718 | vcpu->arch.cpuid_entries[i].function = cpuid_entries[i].function; |
1718 | vcpu->arch.cpuid_entries[i].eax = cpuid_entries[i].eax; | 1719 | vcpu->arch.cpuid_entries[i].eax = cpuid_entries[i].eax; |
@@ -1730,6 +1731,7 @@ static int kvm_vcpu_ioctl_set_cpuid(struct kvm_vcpu *vcpu, | |||
1730 | r = 0; | 1731 | r = 0; |
1731 | kvm_apic_set_version(vcpu); | 1732 | kvm_apic_set_version(vcpu); |
1732 | kvm_x86_ops->cpuid_update(vcpu); | 1733 | kvm_x86_ops->cpuid_update(vcpu); |
1734 | vcpu_put(vcpu); | ||
1733 | 1735 | ||
1734 | out_free: | 1736 | out_free: |
1735 | vfree(cpuid_entries); | 1737 | vfree(cpuid_entries); |
@@ -1750,9 +1752,11 @@ static int kvm_vcpu_ioctl_set_cpuid2(struct kvm_vcpu *vcpu, | |||
1750 | if (copy_from_user(&vcpu->arch.cpuid_entries, entries, | 1752 | if (copy_from_user(&vcpu->arch.cpuid_entries, entries, |
1751 | cpuid->nent * sizeof(struct kvm_cpuid_entry2))) | 1753 | cpuid->nent * sizeof(struct kvm_cpuid_entry2))) |
1752 | goto out; | 1754 | goto out; |
1755 | vcpu_load(vcpu); | ||
1753 | vcpu->arch.cpuid_nent = cpuid->nent; | 1756 | vcpu->arch.cpuid_nent = cpuid->nent; |
1754 | kvm_apic_set_version(vcpu); | 1757 | kvm_apic_set_version(vcpu); |
1755 | kvm_x86_ops->cpuid_update(vcpu); | 1758 | kvm_x86_ops->cpuid_update(vcpu); |
1759 | vcpu_put(vcpu); | ||
1756 | return 0; | 1760 | return 0; |
1757 | 1761 | ||
1758 | out: | 1762 | out: |
diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile index cbaf8f2b83df..f871e04b6965 100644 --- a/arch/x86/lib/Makefile +++ b/arch/x86/lib/Makefile | |||
@@ -26,11 +26,12 @@ obj-y += msr.o msr-reg.o msr-reg-export.o | |||
26 | 26 | ||
27 | ifeq ($(CONFIG_X86_32),y) | 27 | ifeq ($(CONFIG_X86_32),y) |
28 | obj-y += atomic64_32.o | 28 | obj-y += atomic64_32.o |
29 | lib-y += atomic64_cx8_32.o | ||
29 | lib-y += checksum_32.o | 30 | lib-y += checksum_32.o |
30 | lib-y += strstr_32.o | 31 | lib-y += strstr_32.o |
31 | lib-y += semaphore_32.o string_32.o | 32 | lib-y += semaphore_32.o string_32.o |
32 | ifneq ($(CONFIG_X86_CMPXCHG64),y) | 33 | ifneq ($(CONFIG_X86_CMPXCHG64),y) |
33 | lib-y += cmpxchg8b_emu.o | 34 | lib-y += cmpxchg8b_emu.o atomic64_386_32.o |
34 | endif | 35 | endif |
35 | lib-$(CONFIG_X86_USE_3DNOW) += mmx_32.o | 36 | lib-$(CONFIG_X86_USE_3DNOW) += mmx_32.o |
36 | else | 37 | else |
diff --git a/arch/x86/lib/atomic64_32.c b/arch/x86/lib/atomic64_32.c index 824fa0be55a3..540179e8e9fa 100644 --- a/arch/x86/lib/atomic64_32.c +++ b/arch/x86/lib/atomic64_32.c | |||
@@ -6,225 +6,54 @@ | |||
6 | #include <asm/cmpxchg.h> | 6 | #include <asm/cmpxchg.h> |
7 | #include <asm/atomic.h> | 7 | #include <asm/atomic.h> |
8 | 8 | ||
9 | static noinline u64 cmpxchg8b(u64 *ptr, u64 old, u64 new) | 9 | long long atomic64_read_cx8(long long, const atomic64_t *v); |
10 | { | 10 | EXPORT_SYMBOL(atomic64_read_cx8); |
11 | u32 low = new; | 11 | long long atomic64_set_cx8(long long, const atomic64_t *v); |
12 | u32 high = new >> 32; | 12 | EXPORT_SYMBOL(atomic64_set_cx8); |
13 | 13 | long long atomic64_xchg_cx8(long long, unsigned high); | |
14 | asm volatile( | 14 | EXPORT_SYMBOL(atomic64_xchg_cx8); |
15 | LOCK_PREFIX "cmpxchg8b %1\n" | 15 | long long atomic64_add_return_cx8(long long a, atomic64_t *v); |
16 | : "+A" (old), "+m" (*ptr) | 16 | EXPORT_SYMBOL(atomic64_add_return_cx8); |
17 | : "b" (low), "c" (high) | 17 | long long atomic64_sub_return_cx8(long long a, atomic64_t *v); |
18 | ); | 18 | EXPORT_SYMBOL(atomic64_sub_return_cx8); |
19 | return old; | 19 | long long atomic64_inc_return_cx8(long long a, atomic64_t *v); |
20 | } | 20 | EXPORT_SYMBOL(atomic64_inc_return_cx8); |
21 | 21 | long long atomic64_dec_return_cx8(long long a, atomic64_t *v); | |
22 | u64 atomic64_cmpxchg(atomic64_t *ptr, u64 old_val, u64 new_val) | 22 | EXPORT_SYMBOL(atomic64_dec_return_cx8); |
23 | { | 23 | long long atomic64_dec_if_positive_cx8(atomic64_t *v); |
24 | return cmpxchg8b(&ptr->counter, old_val, new_val); | 24 | EXPORT_SYMBOL(atomic64_dec_if_positive_cx8); |
25 | } | 25 | int atomic64_inc_not_zero_cx8(atomic64_t *v); |
26 | EXPORT_SYMBOL(atomic64_cmpxchg); | 26 | EXPORT_SYMBOL(atomic64_inc_not_zero_cx8); |
27 | 27 | int atomic64_add_unless_cx8(atomic64_t *v, long long a, long long u); | |
28 | /** | 28 | EXPORT_SYMBOL(atomic64_add_unless_cx8); |
29 | * atomic64_xchg - xchg atomic64 variable | 29 | |
30 | * @ptr: pointer to type atomic64_t | 30 | #ifndef CONFIG_X86_CMPXCHG64 |
31 | * @new_val: value to assign | 31 | long long atomic64_read_386(long long, const atomic64_t *v); |
32 | * | 32 | EXPORT_SYMBOL(atomic64_read_386); |
33 | * Atomically xchgs the value of @ptr to @new_val and returns | 33 | long long atomic64_set_386(long long, const atomic64_t *v); |
34 | * the old value. | 34 | EXPORT_SYMBOL(atomic64_set_386); |
35 | */ | 35 | long long atomic64_xchg_386(long long, unsigned high); |
36 | u64 atomic64_xchg(atomic64_t *ptr, u64 new_val) | 36 | EXPORT_SYMBOL(atomic64_xchg_386); |
37 | { | 37 | long long atomic64_add_return_386(long long a, atomic64_t *v); |
38 | /* | 38 | EXPORT_SYMBOL(atomic64_add_return_386); |
39 | * Try first with a (possibly incorrect) assumption about | 39 | long long atomic64_sub_return_386(long long a, atomic64_t *v); |
40 | * what we have there. We'll do two loops most likely, | 40 | EXPORT_SYMBOL(atomic64_sub_return_386); |
41 | * but we'll get an ownership MESI transaction straight away | 41 | long long atomic64_inc_return_386(long long a, atomic64_t *v); |
42 | * instead of a read transaction followed by a | 42 | EXPORT_SYMBOL(atomic64_inc_return_386); |
43 | * flush-for-ownership transaction: | 43 | long long atomic64_dec_return_386(long long a, atomic64_t *v); |
44 | */ | 44 | EXPORT_SYMBOL(atomic64_dec_return_386); |
45 | u64 old_val, real_val = 0; | 45 | long long atomic64_add_386(long long a, atomic64_t *v); |
46 | 46 | EXPORT_SYMBOL(atomic64_add_386); | |
47 | do { | 47 | long long atomic64_sub_386(long long a, atomic64_t *v); |
48 | old_val = real_val; | 48 | EXPORT_SYMBOL(atomic64_sub_386); |
49 | 49 | long long atomic64_inc_386(long long a, atomic64_t *v); | |
50 | real_val = atomic64_cmpxchg(ptr, old_val, new_val); | 50 | EXPORT_SYMBOL(atomic64_inc_386); |
51 | 51 | long long atomic64_dec_386(long long a, atomic64_t *v); | |
52 | } while (real_val != old_val); | 52 | EXPORT_SYMBOL(atomic64_dec_386); |
53 | 53 | long long atomic64_dec_if_positive_386(atomic64_t *v); | |
54 | return old_val; | 54 | EXPORT_SYMBOL(atomic64_dec_if_positive_386); |
55 | } | 55 | int atomic64_inc_not_zero_386(atomic64_t *v); |
56 | EXPORT_SYMBOL(atomic64_xchg); | 56 | EXPORT_SYMBOL(atomic64_inc_not_zero_386); |
57 | 57 | int atomic64_add_unless_386(atomic64_t *v, long long a, long long u); | |
58 | /** | 58 | EXPORT_SYMBOL(atomic64_add_unless_386); |
59 | * atomic64_set - set atomic64 variable | 59 | #endif |
60 | * @ptr: pointer to type atomic64_t | ||
61 | * @new_val: value to assign | ||
62 | * | ||
63 | * Atomically sets the value of @ptr to @new_val. | ||
64 | */ | ||
65 | void atomic64_set(atomic64_t *ptr, u64 new_val) | ||
66 | { | ||
67 | atomic64_xchg(ptr, new_val); | ||
68 | } | ||
69 | EXPORT_SYMBOL(atomic64_set); | ||
70 | |||
71 | /** | ||
72 | EXPORT_SYMBOL(atomic64_read); | ||
73 | * atomic64_add_return - add and return | ||
74 | * @delta: integer value to add | ||
75 | * @ptr: pointer to type atomic64_t | ||
76 | * | ||
77 | * Atomically adds @delta to @ptr and returns @delta + *@ptr | ||
78 | */ | ||
79 | noinline u64 atomic64_add_return(u64 delta, atomic64_t *ptr) | ||
80 | { | ||
81 | /* | ||
82 | * Try first with a (possibly incorrect) assumption about | ||
83 | * what we have there. We'll do two loops most likely, | ||
84 | * but we'll get an ownership MESI transaction straight away | ||
85 | * instead of a read transaction followed by a | ||
86 | * flush-for-ownership transaction: | ||
87 | */ | ||
88 | u64 old_val, new_val, real_val = 0; | ||
89 | |||
90 | do { | ||
91 | old_val = real_val; | ||
92 | new_val = old_val + delta; | ||
93 | |||
94 | real_val = atomic64_cmpxchg(ptr, old_val, new_val); | ||
95 | |||
96 | } while (real_val != old_val); | ||
97 | |||
98 | return new_val; | ||
99 | } | ||
100 | EXPORT_SYMBOL(atomic64_add_return); | ||
101 | |||
102 | u64 atomic64_sub_return(u64 delta, atomic64_t *ptr) | ||
103 | { | ||
104 | return atomic64_add_return(-delta, ptr); | ||
105 | } | ||
106 | EXPORT_SYMBOL(atomic64_sub_return); | ||
107 | |||
108 | u64 atomic64_inc_return(atomic64_t *ptr) | ||
109 | { | ||
110 | return atomic64_add_return(1, ptr); | ||
111 | } | ||
112 | EXPORT_SYMBOL(atomic64_inc_return); | ||
113 | |||
114 | u64 atomic64_dec_return(atomic64_t *ptr) | ||
115 | { | ||
116 | return atomic64_sub_return(1, ptr); | ||
117 | } | ||
118 | EXPORT_SYMBOL(atomic64_dec_return); | ||
119 | |||
120 | /** | ||
121 | * atomic64_add - add integer to atomic64 variable | ||
122 | * @delta: integer value to add | ||
123 | * @ptr: pointer to type atomic64_t | ||
124 | * | ||
125 | * Atomically adds @delta to @ptr. | ||
126 | */ | ||
127 | void atomic64_add(u64 delta, atomic64_t *ptr) | ||
128 | { | ||
129 | atomic64_add_return(delta, ptr); | ||
130 | } | ||
131 | EXPORT_SYMBOL(atomic64_add); | ||
132 | |||
133 | /** | ||
134 | * atomic64_sub - subtract the atomic64 variable | ||
135 | * @delta: integer value to subtract | ||
136 | * @ptr: pointer to type atomic64_t | ||
137 | * | ||
138 | * Atomically subtracts @delta from @ptr. | ||
139 | */ | ||
140 | void atomic64_sub(u64 delta, atomic64_t *ptr) | ||
141 | { | ||
142 | atomic64_add(-delta, ptr); | ||
143 | } | ||
144 | EXPORT_SYMBOL(atomic64_sub); | ||
145 | |||
146 | /** | ||
147 | * atomic64_sub_and_test - subtract value from variable and test result | ||
148 | * @delta: integer value to subtract | ||
149 | * @ptr: pointer to type atomic64_t | ||
150 | * | ||
151 | * Atomically subtracts @delta from @ptr and returns | ||
152 | * true if the result is zero, or false for all | ||
153 | * other cases. | ||
154 | */ | ||
155 | int atomic64_sub_and_test(u64 delta, atomic64_t *ptr) | ||
156 | { | ||
157 | u64 new_val = atomic64_sub_return(delta, ptr); | ||
158 | |||
159 | return new_val == 0; | ||
160 | } | ||
161 | EXPORT_SYMBOL(atomic64_sub_and_test); | ||
162 | |||
163 | /** | ||
164 | * atomic64_inc - increment atomic64 variable | ||
165 | * @ptr: pointer to type atomic64_t | ||
166 | * | ||
167 | * Atomically increments @ptr by 1. | ||
168 | */ | ||
169 | void atomic64_inc(atomic64_t *ptr) | ||
170 | { | ||
171 | atomic64_add(1, ptr); | ||
172 | } | ||
173 | EXPORT_SYMBOL(atomic64_inc); | ||
174 | |||
175 | /** | ||
176 | * atomic64_dec - decrement atomic64 variable | ||
177 | * @ptr: pointer to type atomic64_t | ||
178 | * | ||
179 | * Atomically decrements @ptr by 1. | ||
180 | */ | ||
181 | void atomic64_dec(atomic64_t *ptr) | ||
182 | { | ||
183 | atomic64_sub(1, ptr); | ||
184 | } | ||
185 | EXPORT_SYMBOL(atomic64_dec); | ||
186 | |||
187 | /** | ||
188 | * atomic64_dec_and_test - decrement and test | ||
189 | * @ptr: pointer to type atomic64_t | ||
190 | * | ||
191 | * Atomically decrements @ptr by 1 and | ||
192 | * returns true if the result is 0, or false for all other | ||
193 | * cases. | ||
194 | */ | ||
195 | int atomic64_dec_and_test(atomic64_t *ptr) | ||
196 | { | ||
197 | return atomic64_sub_and_test(1, ptr); | ||
198 | } | ||
199 | EXPORT_SYMBOL(atomic64_dec_and_test); | ||
200 | |||
201 | /** | ||
202 | * atomic64_inc_and_test - increment and test | ||
203 | * @ptr: pointer to type atomic64_t | ||
204 | * | ||
205 | * Atomically increments @ptr by 1 | ||
206 | * and returns true if the result is zero, or false for all | ||
207 | * other cases. | ||
208 | */ | ||
209 | int atomic64_inc_and_test(atomic64_t *ptr) | ||
210 | { | ||
211 | return atomic64_sub_and_test(-1, ptr); | ||
212 | } | ||
213 | EXPORT_SYMBOL(atomic64_inc_and_test); | ||
214 | |||
215 | /** | ||
216 | * atomic64_add_negative - add and test if negative | ||
217 | * @delta: integer value to add | ||
218 | * @ptr: pointer to type atomic64_t | ||
219 | * | ||
220 | * Atomically adds @delta to @ptr and returns true | ||
221 | * if the result is negative, or false when | ||
222 | * result is greater than or equal to zero. | ||
223 | */ | ||
224 | int atomic64_add_negative(u64 delta, atomic64_t *ptr) | ||
225 | { | ||
226 | s64 new_val = atomic64_add_return(delta, ptr); | ||
227 | |||
228 | return new_val < 0; | ||
229 | } | ||
230 | EXPORT_SYMBOL(atomic64_add_negative); | ||
diff --git a/arch/x86/lib/atomic64_386_32.S b/arch/x86/lib/atomic64_386_32.S new file mode 100644 index 000000000000..4a5979aa6883 --- /dev/null +++ b/arch/x86/lib/atomic64_386_32.S | |||
@@ -0,0 +1,174 @@ | |||
1 | /* | ||
2 | * atomic64_t for 386/486 | ||
3 | * | ||
4 | * Copyright © 2010 Luca Barbieri | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #include <linux/linkage.h> | ||
13 | #include <asm/alternative-asm.h> | ||
14 | #include <asm/dwarf2.h> | ||
15 | |||
16 | /* if you want SMP support, implement these with real spinlocks */ | ||
17 | .macro LOCK reg | ||
18 | pushfl | ||
19 | CFI_ADJUST_CFA_OFFSET 4 | ||
20 | cli | ||
21 | .endm | ||
22 | |||
23 | .macro UNLOCK reg | ||
24 | popfl | ||
25 | CFI_ADJUST_CFA_OFFSET -4 | ||
26 | .endm | ||
27 | |||
28 | .macro BEGIN func reg | ||
29 | $v = \reg | ||
30 | |||
31 | ENTRY(atomic64_\func\()_386) | ||
32 | CFI_STARTPROC | ||
33 | LOCK $v | ||
34 | |||
35 | .macro RETURN | ||
36 | UNLOCK $v | ||
37 | ret | ||
38 | .endm | ||
39 | |||
40 | .macro END_ | ||
41 | CFI_ENDPROC | ||
42 | ENDPROC(atomic64_\func\()_386) | ||
43 | .purgem RETURN | ||
44 | .purgem END_ | ||
45 | .purgem END | ||
46 | .endm | ||
47 | |||
48 | .macro END | ||
49 | RETURN | ||
50 | END_ | ||
51 | .endm | ||
52 | .endm | ||
53 | |||
54 | BEGIN read %ecx | ||
55 | movl ($v), %eax | ||
56 | movl 4($v), %edx | ||
57 | END | ||
58 | |||
59 | BEGIN set %esi | ||
60 | movl %ebx, ($v) | ||
61 | movl %ecx, 4($v) | ||
62 | END | ||
63 | |||
64 | BEGIN xchg %esi | ||
65 | movl ($v), %eax | ||
66 | movl 4($v), %edx | ||
67 | movl %ebx, ($v) | ||
68 | movl %ecx, 4($v) | ||
69 | END | ||
70 | |||
71 | BEGIN add %ecx | ||
72 | addl %eax, ($v) | ||
73 | adcl %edx, 4($v) | ||
74 | END | ||
75 | |||
76 | BEGIN add_return %ecx | ||
77 | addl ($v), %eax | ||
78 | adcl 4($v), %edx | ||
79 | movl %eax, ($v) | ||
80 | movl %edx, 4($v) | ||
81 | END | ||
82 | |||
83 | BEGIN sub %ecx | ||
84 | subl %eax, ($v) | ||
85 | sbbl %edx, 4($v) | ||
86 | END | ||
87 | |||
88 | BEGIN sub_return %ecx | ||
89 | negl %edx | ||
90 | negl %eax | ||
91 | sbbl $0, %edx | ||
92 | addl ($v), %eax | ||
93 | adcl 4($v), %edx | ||
94 | movl %eax, ($v) | ||
95 | movl %edx, 4($v) | ||
96 | END | ||
97 | |||
98 | BEGIN inc %esi | ||
99 | addl $1, ($v) | ||
100 | adcl $0, 4($v) | ||
101 | END | ||
102 | |||
103 | BEGIN inc_return %esi | ||
104 | movl ($v), %eax | ||
105 | movl 4($v), %edx | ||
106 | addl $1, %eax | ||
107 | adcl $0, %edx | ||
108 | movl %eax, ($v) | ||
109 | movl %edx, 4($v) | ||
110 | END | ||
111 | |||
112 | BEGIN dec %esi | ||
113 | subl $1, ($v) | ||
114 | sbbl $0, 4($v) | ||
115 | END | ||
116 | |||
117 | BEGIN dec_return %esi | ||
118 | movl ($v), %eax | ||
119 | movl 4($v), %edx | ||
120 | subl $1, %eax | ||
121 | sbbl $0, %edx | ||
122 | movl %eax, ($v) | ||
123 | movl %edx, 4($v) | ||
124 | END | ||
125 | |||
126 | BEGIN add_unless %ecx | ||
127 | addl %eax, %esi | ||
128 | adcl %edx, %edi | ||
129 | addl ($v), %eax | ||
130 | adcl 4($v), %edx | ||
131 | cmpl %eax, %esi | ||
132 | je 3f | ||
133 | 1: | ||
134 | movl %eax, ($v) | ||
135 | movl %edx, 4($v) | ||
136 | movl $1, %eax | ||
137 | 2: | ||
138 | RETURN | ||
139 | 3: | ||
140 | cmpl %edx, %edi | ||
141 | jne 1b | ||
142 | xorl %eax, %eax | ||
143 | jmp 2b | ||
144 | END_ | ||
145 | |||
146 | BEGIN inc_not_zero %esi | ||
147 | movl ($v), %eax | ||
148 | movl 4($v), %edx | ||
149 | testl %eax, %eax | ||
150 | je 3f | ||
151 | 1: | ||
152 | addl $1, %eax | ||
153 | adcl $0, %edx | ||
154 | movl %eax, ($v) | ||
155 | movl %edx, 4($v) | ||
156 | movl $1, %eax | ||
157 | 2: | ||
158 | RETURN | ||
159 | 3: | ||
160 | testl %edx, %edx | ||
161 | jne 1b | ||
162 | jmp 2b | ||
163 | END_ | ||
164 | |||
165 | BEGIN dec_if_positive %esi | ||
166 | movl ($v), %eax | ||
167 | movl 4($v), %edx | ||
168 | subl $1, %eax | ||
169 | sbbl $0, %edx | ||
170 | js 1f | ||
171 | movl %eax, ($v) | ||
172 | movl %edx, 4($v) | ||
173 | 1: | ||
174 | END | ||
diff --git a/arch/x86/lib/atomic64_cx8_32.S b/arch/x86/lib/atomic64_cx8_32.S new file mode 100644 index 000000000000..71e080de3352 --- /dev/null +++ b/arch/x86/lib/atomic64_cx8_32.S | |||
@@ -0,0 +1,224 @@ | |||
1 | /* | ||
2 | * atomic64_t for 586+ | ||
3 | * | ||
4 | * Copyright © 2010 Luca Barbieri | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #include <linux/linkage.h> | ||
13 | #include <asm/alternative-asm.h> | ||
14 | #include <asm/dwarf2.h> | ||
15 | |||
16 | .macro SAVE reg | ||
17 | pushl %\reg | ||
18 | CFI_ADJUST_CFA_OFFSET 4 | ||
19 | CFI_REL_OFFSET \reg, 0 | ||
20 | .endm | ||
21 | |||
22 | .macro RESTORE reg | ||
23 | popl %\reg | ||
24 | CFI_ADJUST_CFA_OFFSET -4 | ||
25 | CFI_RESTORE \reg | ||
26 | .endm | ||
27 | |||
28 | .macro read64 reg | ||
29 | movl %ebx, %eax | ||
30 | movl %ecx, %edx | ||
31 | /* we need LOCK_PREFIX since otherwise cmpxchg8b always does the write */ | ||
32 | LOCK_PREFIX | ||
33 | cmpxchg8b (\reg) | ||
34 | .endm | ||
35 | |||
36 | ENTRY(atomic64_read_cx8) | ||
37 | CFI_STARTPROC | ||
38 | |||
39 | read64 %ecx | ||
40 | ret | ||
41 | CFI_ENDPROC | ||
42 | ENDPROC(atomic64_read_cx8) | ||
43 | |||
44 | ENTRY(atomic64_set_cx8) | ||
45 | CFI_STARTPROC | ||
46 | |||
47 | 1: | ||
48 | /* we don't need LOCK_PREFIX since aligned 64-bit writes | ||
49 | * are atomic on 586 and newer */ | ||
50 | cmpxchg8b (%esi) | ||
51 | jne 1b | ||
52 | |||
53 | ret | ||
54 | CFI_ENDPROC | ||
55 | ENDPROC(atomic64_set_cx8) | ||
56 | |||
57 | ENTRY(atomic64_xchg_cx8) | ||
58 | CFI_STARTPROC | ||
59 | |||
60 | movl %ebx, %eax | ||
61 | movl %ecx, %edx | ||
62 | 1: | ||
63 | LOCK_PREFIX | ||
64 | cmpxchg8b (%esi) | ||
65 | jne 1b | ||
66 | |||
67 | ret | ||
68 | CFI_ENDPROC | ||
69 | ENDPROC(atomic64_xchg_cx8) | ||
70 | |||
71 | .macro addsub_return func ins insc | ||
72 | ENTRY(atomic64_\func\()_return_cx8) | ||
73 | CFI_STARTPROC | ||
74 | SAVE ebp | ||
75 | SAVE ebx | ||
76 | SAVE esi | ||
77 | SAVE edi | ||
78 | |||
79 | movl %eax, %esi | ||
80 | movl %edx, %edi | ||
81 | movl %ecx, %ebp | ||
82 | |||
83 | read64 %ebp | ||
84 | 1: | ||
85 | movl %eax, %ebx | ||
86 | movl %edx, %ecx | ||
87 | \ins\()l %esi, %ebx | ||
88 | \insc\()l %edi, %ecx | ||
89 | LOCK_PREFIX | ||
90 | cmpxchg8b (%ebp) | ||
91 | jne 1b | ||
92 | |||
93 | 10: | ||
94 | movl %ebx, %eax | ||
95 | movl %ecx, %edx | ||
96 | RESTORE edi | ||
97 | RESTORE esi | ||
98 | RESTORE ebx | ||
99 | RESTORE ebp | ||
100 | ret | ||
101 | CFI_ENDPROC | ||
102 | ENDPROC(atomic64_\func\()_return_cx8) | ||
103 | .endm | ||
104 | |||
105 | addsub_return add add adc | ||
106 | addsub_return sub sub sbb | ||
107 | |||
108 | .macro incdec_return func ins insc | ||
109 | ENTRY(atomic64_\func\()_return_cx8) | ||
110 | CFI_STARTPROC | ||
111 | SAVE ebx | ||
112 | |||
113 | read64 %esi | ||
114 | 1: | ||
115 | movl %eax, %ebx | ||
116 | movl %edx, %ecx | ||
117 | \ins\()l $1, %ebx | ||
118 | \insc\()l $0, %ecx | ||
119 | LOCK_PREFIX | ||
120 | cmpxchg8b (%esi) | ||
121 | jne 1b | ||
122 | |||
123 | 10: | ||
124 | movl %ebx, %eax | ||
125 | movl %ecx, %edx | ||
126 | RESTORE ebx | ||
127 | ret | ||
128 | CFI_ENDPROC | ||
129 | ENDPROC(atomic64_\func\()_return_cx8) | ||
130 | .endm | ||
131 | |||
132 | incdec_return inc add adc | ||
133 | incdec_return dec sub sbb | ||
134 | |||
135 | ENTRY(atomic64_dec_if_positive_cx8) | ||
136 | CFI_STARTPROC | ||
137 | SAVE ebx | ||
138 | |||
139 | read64 %esi | ||
140 | 1: | ||
141 | movl %eax, %ebx | ||
142 | movl %edx, %ecx | ||
143 | subl $1, %ebx | ||
144 | sbb $0, %ecx | ||
145 | js 2f | ||
146 | LOCK_PREFIX | ||
147 | cmpxchg8b (%esi) | ||
148 | jne 1b | ||
149 | |||
150 | 2: | ||
151 | movl %ebx, %eax | ||
152 | movl %ecx, %edx | ||
153 | RESTORE ebx | ||
154 | ret | ||
155 | CFI_ENDPROC | ||
156 | ENDPROC(atomic64_dec_if_positive_cx8) | ||
157 | |||
158 | ENTRY(atomic64_add_unless_cx8) | ||
159 | CFI_STARTPROC | ||
160 | SAVE ebp | ||
161 | SAVE ebx | ||
162 | /* these just push these two parameters on the stack */ | ||
163 | SAVE edi | ||
164 | SAVE esi | ||
165 | |||
166 | movl %ecx, %ebp | ||
167 | movl %eax, %esi | ||
168 | movl %edx, %edi | ||
169 | |||
170 | read64 %ebp | ||
171 | 1: | ||
172 | cmpl %eax, 0(%esp) | ||
173 | je 4f | ||
174 | 2: | ||
175 | movl %eax, %ebx | ||
176 | movl %edx, %ecx | ||
177 | addl %esi, %ebx | ||
178 | adcl %edi, %ecx | ||
179 | LOCK_PREFIX | ||
180 | cmpxchg8b (%ebp) | ||
181 | jne 1b | ||
182 | |||
183 | movl $1, %eax | ||
184 | 3: | ||
185 | addl $8, %esp | ||
186 | CFI_ADJUST_CFA_OFFSET -8 | ||
187 | RESTORE ebx | ||
188 | RESTORE ebp | ||
189 | ret | ||
190 | 4: | ||
191 | cmpl %edx, 4(%esp) | ||
192 | jne 2b | ||
193 | xorl %eax, %eax | ||
194 | jmp 3b | ||
195 | CFI_ENDPROC | ||
196 | ENDPROC(atomic64_add_unless_cx8) | ||
197 | |||
198 | ENTRY(atomic64_inc_not_zero_cx8) | ||
199 | CFI_STARTPROC | ||
200 | SAVE ebx | ||
201 | |||
202 | read64 %esi | ||
203 | 1: | ||
204 | testl %eax, %eax | ||
205 | je 4f | ||
206 | 2: | ||
207 | movl %eax, %ebx | ||
208 | movl %edx, %ecx | ||
209 | addl $1, %ebx | ||
210 | adcl $0, %ecx | ||
211 | LOCK_PREFIX | ||
212 | cmpxchg8b (%esi) | ||
213 | jne 1b | ||
214 | |||
215 | movl $1, %eax | ||
216 | 3: | ||
217 | RESTORE ebx | ||
218 | ret | ||
219 | 4: | ||
220 | testl %edx, %edx | ||
221 | jne 2b | ||
222 | jmp 3b | ||
223 | CFI_ENDPROC | ||
224 | ENDPROC(atomic64_inc_not_zero_cx8) | ||
diff --git a/arch/x86/math-emu/fpu_aux.c b/arch/x86/math-emu/fpu_aux.c index aa0987088774..dc8adad10a2f 100644 --- a/arch/x86/math-emu/fpu_aux.c +++ b/arch/x86/math-emu/fpu_aux.c | |||
@@ -30,10 +30,10 @@ static void fclex(void) | |||
30 | } | 30 | } |
31 | 31 | ||
32 | /* Needs to be externally visible */ | 32 | /* Needs to be externally visible */ |
33 | void finit_task(struct task_struct *tsk) | 33 | void finit_soft_fpu(struct i387_soft_struct *soft) |
34 | { | 34 | { |
35 | struct i387_soft_struct *soft = &tsk->thread.xstate->soft; | ||
36 | struct address *oaddr, *iaddr; | 35 | struct address *oaddr, *iaddr; |
36 | memset(soft, 0, sizeof(*soft)); | ||
37 | soft->cwd = 0x037f; | 37 | soft->cwd = 0x037f; |
38 | soft->swd = 0; | 38 | soft->swd = 0; |
39 | soft->ftop = 0; /* We don't keep top in the status word internally. */ | 39 | soft->ftop = 0; /* We don't keep top in the status word internally. */ |
@@ -52,7 +52,7 @@ void finit_task(struct task_struct *tsk) | |||
52 | 52 | ||
53 | void finit(void) | 53 | void finit(void) |
54 | { | 54 | { |
55 | finit_task(current); | 55 | finit_soft_fpu(¤t->thread.fpu.state->soft); |
56 | } | 56 | } |
57 | 57 | ||
58 | /* | 58 | /* |
diff --git a/arch/x86/math-emu/fpu_entry.c b/arch/x86/math-emu/fpu_entry.c index 5d87f586f8d7..7718541541d4 100644 --- a/arch/x86/math-emu/fpu_entry.c +++ b/arch/x86/math-emu/fpu_entry.c | |||
@@ -681,7 +681,7 @@ int fpregs_soft_set(struct task_struct *target, | |||
681 | unsigned int pos, unsigned int count, | 681 | unsigned int pos, unsigned int count, |
682 | const void *kbuf, const void __user *ubuf) | 682 | const void *kbuf, const void __user *ubuf) |
683 | { | 683 | { |
684 | struct i387_soft_struct *s387 = &target->thread.xstate->soft; | 684 | struct i387_soft_struct *s387 = &target->thread.fpu.state->soft; |
685 | void *space = s387->st_space; | 685 | void *space = s387->st_space; |
686 | int ret; | 686 | int ret; |
687 | int offset, other, i, tags, regnr, tag, newtop; | 687 | int offset, other, i, tags, regnr, tag, newtop; |
@@ -733,7 +733,7 @@ int fpregs_soft_get(struct task_struct *target, | |||
733 | unsigned int pos, unsigned int count, | 733 | unsigned int pos, unsigned int count, |
734 | void *kbuf, void __user *ubuf) | 734 | void *kbuf, void __user *ubuf) |
735 | { | 735 | { |
736 | struct i387_soft_struct *s387 = &target->thread.xstate->soft; | 736 | struct i387_soft_struct *s387 = &target->thread.fpu.state->soft; |
737 | const void *space = s387->st_space; | 737 | const void *space = s387->st_space; |
738 | int ret; | 738 | int ret; |
739 | int offset = (S387->ftop & 7) * 10, other = 80 - offset; | 739 | int offset = (S387->ftop & 7) * 10, other = 80 - offset; |
diff --git a/arch/x86/math-emu/fpu_system.h b/arch/x86/math-emu/fpu_system.h index 50fa0ec2c8a5..2c614410a5f3 100644 --- a/arch/x86/math-emu/fpu_system.h +++ b/arch/x86/math-emu/fpu_system.h | |||
@@ -31,7 +31,7 @@ | |||
31 | #define SEG_EXPAND_DOWN(s) (((s).b & ((1 << 11) | (1 << 10))) \ | 31 | #define SEG_EXPAND_DOWN(s) (((s).b & ((1 << 11) | (1 << 10))) \ |
32 | == (1 << 10)) | 32 | == (1 << 10)) |
33 | 33 | ||
34 | #define I387 (current->thread.xstate) | 34 | #define I387 (current->thread.fpu.state) |
35 | #define FPU_info (I387->soft.info) | 35 | #define FPU_info (I387->soft.info) |
36 | 36 | ||
37 | #define FPU_CS (*(unsigned short *) &(FPU_info->regs->cs)) | 37 | #define FPU_CS (*(unsigned short *) &(FPU_info->regs->cs)) |
diff --git a/arch/x86/mm/Makefile b/arch/x86/mm/Makefile index 06630d26e56d..a4c768397baa 100644 --- a/arch/x86/mm/Makefile +++ b/arch/x86/mm/Makefile | |||
@@ -6,6 +6,7 @@ nostackp := $(call cc-option, -fno-stack-protector) | |||
6 | CFLAGS_physaddr.o := $(nostackp) | 6 | CFLAGS_physaddr.o := $(nostackp) |
7 | CFLAGS_setup_nx.o := $(nostackp) | 7 | CFLAGS_setup_nx.o := $(nostackp) |
8 | 8 | ||
9 | obj-$(CONFIG_X86_PAT) += pat_rbtree.o | ||
9 | obj-$(CONFIG_SMP) += tlb.o | 10 | obj-$(CONFIG_SMP) += tlb.o |
10 | 11 | ||
11 | obj-$(CONFIG_X86_32) += pgtable_32.o iomap_32.o | 12 | obj-$(CONFIG_X86_32) += pgtable_32.o iomap_32.o |
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c index edc8b95afc1a..bbe5502ee1cb 100644 --- a/arch/x86/mm/pat.c +++ b/arch/x86/mm/pat.c | |||
@@ -30,6 +30,8 @@ | |||
30 | #include <asm/pat.h> | 30 | #include <asm/pat.h> |
31 | #include <asm/io.h> | 31 | #include <asm/io.h> |
32 | 32 | ||
33 | #include "pat_internal.h" | ||
34 | |||
33 | #ifdef CONFIG_X86_PAT | 35 | #ifdef CONFIG_X86_PAT |
34 | int __read_mostly pat_enabled = 1; | 36 | int __read_mostly pat_enabled = 1; |
35 | 37 | ||
@@ -53,19 +55,15 @@ static inline void pat_disable(const char *reason) | |||
53 | #endif | 55 | #endif |
54 | 56 | ||
55 | 57 | ||
56 | static int debug_enable; | 58 | int pat_debug_enable; |
57 | 59 | ||
58 | static int __init pat_debug_setup(char *str) | 60 | static int __init pat_debug_setup(char *str) |
59 | { | 61 | { |
60 | debug_enable = 1; | 62 | pat_debug_enable = 1; |
61 | return 0; | 63 | return 0; |
62 | } | 64 | } |
63 | __setup("debugpat", pat_debug_setup); | 65 | __setup("debugpat", pat_debug_setup); |
64 | 66 | ||
65 | #define dprintk(fmt, arg...) \ | ||
66 | do { if (debug_enable) printk(KERN_INFO fmt, ##arg); } while (0) | ||
67 | |||
68 | |||
69 | static u64 __read_mostly boot_pat_state; | 67 | static u64 __read_mostly boot_pat_state; |
70 | 68 | ||
71 | enum { | 69 | enum { |
@@ -132,84 +130,7 @@ void pat_init(void) | |||
132 | 130 | ||
133 | #undef PAT | 131 | #undef PAT |
134 | 132 | ||
135 | static char *cattr_name(unsigned long flags) | 133 | static DEFINE_SPINLOCK(memtype_lock); /* protects memtype accesses */ |
136 | { | ||
137 | switch (flags & _PAGE_CACHE_MASK) { | ||
138 | case _PAGE_CACHE_UC: return "uncached"; | ||
139 | case _PAGE_CACHE_UC_MINUS: return "uncached-minus"; | ||
140 | case _PAGE_CACHE_WB: return "write-back"; | ||
141 | case _PAGE_CACHE_WC: return "write-combining"; | ||
142 | default: return "broken"; | ||
143 | } | ||
144 | } | ||
145 | |||
146 | /* | ||
147 | * The global memtype list keeps track of memory type for specific | ||
148 | * physical memory areas. Conflicting memory types in different | ||
149 | * mappings can cause CPU cache corruption. To avoid this we keep track. | ||
150 | * | ||
151 | * The list is sorted based on starting address and can contain multiple | ||
152 | * entries for each address (this allows reference counting for overlapping | ||
153 | * areas). All the aliases have the same cache attributes of course. | ||
154 | * Zero attributes are represented as holes. | ||
155 | * | ||
156 | * The data structure is a list that is also organized as an rbtree | ||
157 | * sorted on the start address of memtype range. | ||
158 | * | ||
159 | * memtype_lock protects both the linear list and rbtree. | ||
160 | */ | ||
161 | |||
162 | struct memtype { | ||
163 | u64 start; | ||
164 | u64 end; | ||
165 | unsigned long type; | ||
166 | struct list_head nd; | ||
167 | struct rb_node rb; | ||
168 | }; | ||
169 | |||
170 | static struct rb_root memtype_rbroot = RB_ROOT; | ||
171 | static LIST_HEAD(memtype_list); | ||
172 | static DEFINE_SPINLOCK(memtype_lock); /* protects memtype list */ | ||
173 | |||
174 | static struct memtype *memtype_rb_search(struct rb_root *root, u64 start) | ||
175 | { | ||
176 | struct rb_node *node = root->rb_node; | ||
177 | struct memtype *last_lower = NULL; | ||
178 | |||
179 | while (node) { | ||
180 | struct memtype *data = container_of(node, struct memtype, rb); | ||
181 | |||
182 | if (data->start < start) { | ||
183 | last_lower = data; | ||
184 | node = node->rb_right; | ||
185 | } else if (data->start > start) { | ||
186 | node = node->rb_left; | ||
187 | } else | ||
188 | return data; | ||
189 | } | ||
190 | |||
191 | /* Will return NULL if there is no entry with its start <= start */ | ||
192 | return last_lower; | ||
193 | } | ||
194 | |||
195 | static void memtype_rb_insert(struct rb_root *root, struct memtype *data) | ||
196 | { | ||
197 | struct rb_node **new = &(root->rb_node); | ||
198 | struct rb_node *parent = NULL; | ||
199 | |||
200 | while (*new) { | ||
201 | struct memtype *this = container_of(*new, struct memtype, rb); | ||
202 | |||
203 | parent = *new; | ||
204 | if (data->start <= this->start) | ||
205 | new = &((*new)->rb_left); | ||
206 | else if (data->start > this->start) | ||
207 | new = &((*new)->rb_right); | ||
208 | } | ||
209 | |||
210 | rb_link_node(&data->rb, parent, new); | ||
211 | rb_insert_color(&data->rb, root); | ||
212 | } | ||
213 | 134 | ||
214 | /* | 135 | /* |
215 | * Does intersection of PAT memory type and MTRR memory type and returns | 136 | * Does intersection of PAT memory type and MTRR memory type and returns |
@@ -237,33 +158,6 @@ static unsigned long pat_x_mtrr_type(u64 start, u64 end, unsigned long req_type) | |||
237 | return req_type; | 158 | return req_type; |
238 | } | 159 | } |
239 | 160 | ||
240 | static int | ||
241 | chk_conflict(struct memtype *new, struct memtype *entry, unsigned long *type) | ||
242 | { | ||
243 | if (new->type != entry->type) { | ||
244 | if (type) { | ||
245 | new->type = entry->type; | ||
246 | *type = entry->type; | ||
247 | } else | ||
248 | goto conflict; | ||
249 | } | ||
250 | |||
251 | /* check overlaps with more than one entry in the list */ | ||
252 | list_for_each_entry_continue(entry, &memtype_list, nd) { | ||
253 | if (new->end <= entry->start) | ||
254 | break; | ||
255 | else if (new->type != entry->type) | ||
256 | goto conflict; | ||
257 | } | ||
258 | return 0; | ||
259 | |||
260 | conflict: | ||
261 | printk(KERN_INFO "%s:%d conflicting memory types " | ||
262 | "%Lx-%Lx %s<->%s\n", current->comm, current->pid, new->start, | ||
263 | new->end, cattr_name(new->type), cattr_name(entry->type)); | ||
264 | return -EBUSY; | ||
265 | } | ||
266 | |||
267 | static int pat_pagerange_is_ram(unsigned long start, unsigned long end) | 161 | static int pat_pagerange_is_ram(unsigned long start, unsigned long end) |
268 | { | 162 | { |
269 | int ram_page = 0, not_rampage = 0; | 163 | int ram_page = 0, not_rampage = 0; |
@@ -296,8 +190,6 @@ static int pat_pagerange_is_ram(unsigned long start, unsigned long end) | |||
296 | * Here we do two pass: | 190 | * Here we do two pass: |
297 | * - Find the memtype of all the pages in the range, look for any conflicts | 191 | * - Find the memtype of all the pages in the range, look for any conflicts |
298 | * - In case of no conflicts, set the new memtype for pages in the range | 192 | * - In case of no conflicts, set the new memtype for pages in the range |
299 | * | ||
300 | * Caller must hold memtype_lock for atomicity. | ||
301 | */ | 193 | */ |
302 | static int reserve_ram_pages_type(u64 start, u64 end, unsigned long req_type, | 194 | static int reserve_ram_pages_type(u64 start, u64 end, unsigned long req_type, |
303 | unsigned long *new_type) | 195 | unsigned long *new_type) |
@@ -364,9 +256,8 @@ static int free_ram_pages_type(u64 start, u64 end) | |||
364 | int reserve_memtype(u64 start, u64 end, unsigned long req_type, | 256 | int reserve_memtype(u64 start, u64 end, unsigned long req_type, |
365 | unsigned long *new_type) | 257 | unsigned long *new_type) |
366 | { | 258 | { |
367 | struct memtype *new, *entry; | 259 | struct memtype *new; |
368 | unsigned long actual_type; | 260 | unsigned long actual_type; |
369 | struct list_head *where; | ||
370 | int is_range_ram; | 261 | int is_range_ram; |
371 | int err = 0; | 262 | int err = 0; |
372 | 263 | ||
@@ -404,9 +295,7 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type, | |||
404 | is_range_ram = pat_pagerange_is_ram(start, end); | 295 | is_range_ram = pat_pagerange_is_ram(start, end); |
405 | if (is_range_ram == 1) { | 296 | if (is_range_ram == 1) { |
406 | 297 | ||
407 | spin_lock(&memtype_lock); | ||
408 | err = reserve_ram_pages_type(start, end, req_type, new_type); | 298 | err = reserve_ram_pages_type(start, end, req_type, new_type); |
409 | spin_unlock(&memtype_lock); | ||
410 | 299 | ||
411 | return err; | 300 | return err; |
412 | } else if (is_range_ram < 0) { | 301 | } else if (is_range_ram < 0) { |
@@ -423,42 +312,7 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type, | |||
423 | 312 | ||
424 | spin_lock(&memtype_lock); | 313 | spin_lock(&memtype_lock); |
425 | 314 | ||
426 | /* Search for existing mapping that overlaps the current range */ | 315 | err = rbt_memtype_check_insert(new, new_type); |
427 | where = NULL; | ||
428 | list_for_each_entry(entry, &memtype_list, nd) { | ||
429 | if (end <= entry->start) { | ||
430 | where = entry->nd.prev; | ||
431 | break; | ||
432 | } else if (start <= entry->start) { /* end > entry->start */ | ||
433 | err = chk_conflict(new, entry, new_type); | ||
434 | if (!err) { | ||
435 | dprintk("Overlap at 0x%Lx-0x%Lx\n", | ||
436 | entry->start, entry->end); | ||
437 | where = entry->nd.prev; | ||
438 | } | ||
439 | break; | ||
440 | } else if (start < entry->end) { /* start > entry->start */ | ||
441 | err = chk_conflict(new, entry, new_type); | ||
442 | if (!err) { | ||
443 | dprintk("Overlap at 0x%Lx-0x%Lx\n", | ||
444 | entry->start, entry->end); | ||
445 | |||
446 | /* | ||
447 | * Move to right position in the linked | ||
448 | * list to add this new entry | ||
449 | */ | ||
450 | list_for_each_entry_continue(entry, | ||
451 | &memtype_list, nd) { | ||
452 | if (start <= entry->start) { | ||
453 | where = entry->nd.prev; | ||
454 | break; | ||
455 | } | ||
456 | } | ||
457 | } | ||
458 | break; | ||
459 | } | ||
460 | } | ||
461 | |||
462 | if (err) { | 316 | if (err) { |
463 | printk(KERN_INFO "reserve_memtype failed 0x%Lx-0x%Lx, " | 317 | printk(KERN_INFO "reserve_memtype failed 0x%Lx-0x%Lx, " |
464 | "track %s, req %s\n", | 318 | "track %s, req %s\n", |
@@ -469,13 +323,6 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type, | |||
469 | return err; | 323 | return err; |
470 | } | 324 | } |
471 | 325 | ||
472 | if (where) | ||
473 | list_add(&new->nd, where); | ||
474 | else | ||
475 | list_add_tail(&new->nd, &memtype_list); | ||
476 | |||
477 | memtype_rb_insert(&memtype_rbroot, new); | ||
478 | |||
479 | spin_unlock(&memtype_lock); | 326 | spin_unlock(&memtype_lock); |
480 | 327 | ||
481 | dprintk("reserve_memtype added 0x%Lx-0x%Lx, track %s, req %s, ret %s\n", | 328 | dprintk("reserve_memtype added 0x%Lx-0x%Lx, track %s, req %s, ret %s\n", |
@@ -487,7 +334,6 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type, | |||
487 | 334 | ||
488 | int free_memtype(u64 start, u64 end) | 335 | int free_memtype(u64 start, u64 end) |
489 | { | 336 | { |
490 | struct memtype *entry, *saved_entry; | ||
491 | int err = -EINVAL; | 337 | int err = -EINVAL; |
492 | int is_range_ram; | 338 | int is_range_ram; |
493 | 339 | ||
@@ -501,9 +347,7 @@ int free_memtype(u64 start, u64 end) | |||
501 | is_range_ram = pat_pagerange_is_ram(start, end); | 347 | is_range_ram = pat_pagerange_is_ram(start, end); |
502 | if (is_range_ram == 1) { | 348 | if (is_range_ram == 1) { |
503 | 349 | ||
504 | spin_lock(&memtype_lock); | ||
505 | err = free_ram_pages_type(start, end); | 350 | err = free_ram_pages_type(start, end); |
506 | spin_unlock(&memtype_lock); | ||
507 | 351 | ||
508 | return err; | 352 | return err; |
509 | } else if (is_range_ram < 0) { | 353 | } else if (is_range_ram < 0) { |
@@ -511,46 +355,7 @@ int free_memtype(u64 start, u64 end) | |||
511 | } | 355 | } |
512 | 356 | ||
513 | spin_lock(&memtype_lock); | 357 | spin_lock(&memtype_lock); |
514 | 358 | err = rbt_memtype_erase(start, end); | |
515 | entry = memtype_rb_search(&memtype_rbroot, start); | ||
516 | if (unlikely(entry == NULL)) | ||
517 | goto unlock_ret; | ||
518 | |||
519 | /* | ||
520 | * Saved entry points to an entry with start same or less than what | ||
521 | * we searched for. Now go through the list in both directions to look | ||
522 | * for the entry that matches with both start and end, with list stored | ||
523 | * in sorted start address | ||
524 | */ | ||
525 | saved_entry = entry; | ||
526 | list_for_each_entry_from(entry, &memtype_list, nd) { | ||
527 | if (entry->start == start && entry->end == end) { | ||
528 | rb_erase(&entry->rb, &memtype_rbroot); | ||
529 | list_del(&entry->nd); | ||
530 | kfree(entry); | ||
531 | err = 0; | ||
532 | break; | ||
533 | } else if (entry->start > start) { | ||
534 | break; | ||
535 | } | ||
536 | } | ||
537 | |||
538 | if (!err) | ||
539 | goto unlock_ret; | ||
540 | |||
541 | entry = saved_entry; | ||
542 | list_for_each_entry_reverse(entry, &memtype_list, nd) { | ||
543 | if (entry->start == start && entry->end == end) { | ||
544 | rb_erase(&entry->rb, &memtype_rbroot); | ||
545 | list_del(&entry->nd); | ||
546 | kfree(entry); | ||
547 | err = 0; | ||
548 | break; | ||
549 | } else if (entry->start < start) { | ||
550 | break; | ||
551 | } | ||
552 | } | ||
553 | unlock_ret: | ||
554 | spin_unlock(&memtype_lock); | 359 | spin_unlock(&memtype_lock); |
555 | 360 | ||
556 | if (err) { | 361 | if (err) { |
@@ -583,10 +388,8 @@ static unsigned long lookup_memtype(u64 paddr) | |||
583 | 388 | ||
584 | if (pat_pagerange_is_ram(paddr, paddr + PAGE_SIZE)) { | 389 | if (pat_pagerange_is_ram(paddr, paddr + PAGE_SIZE)) { |
585 | struct page *page; | 390 | struct page *page; |
586 | spin_lock(&memtype_lock); | ||
587 | page = pfn_to_page(paddr >> PAGE_SHIFT); | 391 | page = pfn_to_page(paddr >> PAGE_SHIFT); |
588 | rettype = get_page_memtype(page); | 392 | rettype = get_page_memtype(page); |
589 | spin_unlock(&memtype_lock); | ||
590 | /* | 393 | /* |
591 | * -1 from get_page_memtype() implies RAM page is in its | 394 | * -1 from get_page_memtype() implies RAM page is in its |
592 | * default state and not reserved, and hence of type WB | 395 | * default state and not reserved, and hence of type WB |
@@ -599,7 +402,7 @@ static unsigned long lookup_memtype(u64 paddr) | |||
599 | 402 | ||
600 | spin_lock(&memtype_lock); | 403 | spin_lock(&memtype_lock); |
601 | 404 | ||
602 | entry = memtype_rb_search(&memtype_rbroot, paddr); | 405 | entry = rbt_memtype_lookup(paddr); |
603 | if (entry != NULL) | 406 | if (entry != NULL) |
604 | rettype = entry->type; | 407 | rettype = entry->type; |
605 | else | 408 | else |
@@ -936,29 +739,25 @@ EXPORT_SYMBOL_GPL(pgprot_writecombine); | |||
936 | 739 | ||
937 | #if defined(CONFIG_DEBUG_FS) && defined(CONFIG_X86_PAT) | 740 | #if defined(CONFIG_DEBUG_FS) && defined(CONFIG_X86_PAT) |
938 | 741 | ||
939 | /* get Nth element of the linked list */ | ||
940 | static struct memtype *memtype_get_idx(loff_t pos) | 742 | static struct memtype *memtype_get_idx(loff_t pos) |
941 | { | 743 | { |
942 | struct memtype *list_node, *print_entry; | 744 | struct memtype *print_entry; |
943 | int i = 1; | 745 | int ret; |
944 | 746 | ||
945 | print_entry = kmalloc(sizeof(struct memtype), GFP_KERNEL); | 747 | print_entry = kzalloc(sizeof(struct memtype), GFP_KERNEL); |
946 | if (!print_entry) | 748 | if (!print_entry) |
947 | return NULL; | 749 | return NULL; |
948 | 750 | ||
949 | spin_lock(&memtype_lock); | 751 | spin_lock(&memtype_lock); |
950 | list_for_each_entry(list_node, &memtype_list, nd) { | 752 | ret = rbt_memtype_copy_nth_element(print_entry, pos); |
951 | if (pos == i) { | ||
952 | *print_entry = *list_node; | ||
953 | spin_unlock(&memtype_lock); | ||
954 | return print_entry; | ||
955 | } | ||
956 | ++i; | ||
957 | } | ||
958 | spin_unlock(&memtype_lock); | 753 | spin_unlock(&memtype_lock); |
959 | kfree(print_entry); | ||
960 | 754 | ||
961 | return NULL; | 755 | if (!ret) { |
756 | return print_entry; | ||
757 | } else { | ||
758 | kfree(print_entry); | ||
759 | return NULL; | ||
760 | } | ||
962 | } | 761 | } |
963 | 762 | ||
964 | static void *memtype_seq_start(struct seq_file *seq, loff_t *pos) | 763 | static void *memtype_seq_start(struct seq_file *seq, loff_t *pos) |
diff --git a/arch/x86/mm/pat_internal.h b/arch/x86/mm/pat_internal.h new file mode 100644 index 000000000000..4f39eefa3e61 --- /dev/null +++ b/arch/x86/mm/pat_internal.h | |||
@@ -0,0 +1,46 @@ | |||
1 | #ifndef __PAT_INTERNAL_H_ | ||
2 | #define __PAT_INTERNAL_H_ | ||
3 | |||
4 | extern int pat_debug_enable; | ||
5 | |||
6 | #define dprintk(fmt, arg...) \ | ||
7 | do { if (pat_debug_enable) printk(KERN_INFO fmt, ##arg); } while (0) | ||
8 | |||
9 | struct memtype { | ||
10 | u64 start; | ||
11 | u64 end; | ||
12 | u64 subtree_max_end; | ||
13 | unsigned long type; | ||
14 | struct rb_node rb; | ||
15 | }; | ||
16 | |||
17 | static inline char *cattr_name(unsigned long flags) | ||
18 | { | ||
19 | switch (flags & _PAGE_CACHE_MASK) { | ||
20 | case _PAGE_CACHE_UC: return "uncached"; | ||
21 | case _PAGE_CACHE_UC_MINUS: return "uncached-minus"; | ||
22 | case _PAGE_CACHE_WB: return "write-back"; | ||
23 | case _PAGE_CACHE_WC: return "write-combining"; | ||
24 | default: return "broken"; | ||
25 | } | ||
26 | } | ||
27 | |||
28 | #ifdef CONFIG_X86_PAT | ||
29 | extern int rbt_memtype_check_insert(struct memtype *new, | ||
30 | unsigned long *new_type); | ||
31 | extern int rbt_memtype_erase(u64 start, u64 end); | ||
32 | extern struct memtype *rbt_memtype_lookup(u64 addr); | ||
33 | extern int rbt_memtype_copy_nth_element(struct memtype *out, loff_t pos); | ||
34 | #else | ||
35 | static inline int rbt_memtype_check_insert(struct memtype *new, | ||
36 | unsigned long *new_type) | ||
37 | { return 0; } | ||
38 | static inline int rbt_memtype_erase(u64 start, u64 end) | ||
39 | { return 0; } | ||
40 | static inline struct memtype *rbt_memtype_lookup(u64 addr) | ||
41 | { return NULL; } | ||
42 | static inline int rbt_memtype_copy_nth_element(struct memtype *out, loff_t pos) | ||
43 | { return 0; } | ||
44 | #endif | ||
45 | |||
46 | #endif /* __PAT_INTERNAL_H_ */ | ||
diff --git a/arch/x86/mm/pat_rbtree.c b/arch/x86/mm/pat_rbtree.c new file mode 100644 index 000000000000..07de4cb8cc30 --- /dev/null +++ b/arch/x86/mm/pat_rbtree.c | |||
@@ -0,0 +1,273 @@ | |||
1 | /* | ||
2 | * Handle caching attributes in page tables (PAT) | ||
3 | * | ||
4 | * Authors: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> | ||
5 | * Suresh B Siddha <suresh.b.siddha@intel.com> | ||
6 | * | ||
7 | * Interval tree (augmented rbtree) used to store the PAT memory type | ||
8 | * reservations. | ||
9 | */ | ||
10 | |||
11 | #include <linux/seq_file.h> | ||
12 | #include <linux/debugfs.h> | ||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/module.h> | ||
15 | #include <linux/rbtree.h> | ||
16 | #include <linux/sched.h> | ||
17 | #include <linux/gfp.h> | ||
18 | |||
19 | #include <asm/pgtable.h> | ||
20 | #include <asm/pat.h> | ||
21 | |||
22 | #include "pat_internal.h" | ||
23 | |||
24 | /* | ||
25 | * The memtype tree keeps track of memory type for specific | ||
26 | * physical memory areas. Without proper tracking, conflicting memory | ||
27 | * types in different mappings can cause CPU cache corruption. | ||
28 | * | ||
29 | * The tree is an interval tree (augmented rbtree) with tree ordered | ||
30 | * on starting address. Tree can contain multiple entries for | ||
31 | * different regions which overlap. All the aliases have the same | ||
32 | * cache attributes of course. | ||
33 | * | ||
34 | * memtype_lock protects the rbtree. | ||
35 | */ | ||
36 | |||
37 | static void memtype_rb_augment_cb(struct rb_node *node); | ||
38 | static struct rb_root memtype_rbroot = RB_AUGMENT_ROOT(&memtype_rb_augment_cb); | ||
39 | |||
40 | static int is_node_overlap(struct memtype *node, u64 start, u64 end) | ||
41 | { | ||
42 | if (node->start >= end || node->end <= start) | ||
43 | return 0; | ||
44 | |||
45 | return 1; | ||
46 | } | ||
47 | |||
48 | static u64 get_subtree_max_end(struct rb_node *node) | ||
49 | { | ||
50 | u64 ret = 0; | ||
51 | if (node) { | ||
52 | struct memtype *data = container_of(node, struct memtype, rb); | ||
53 | ret = data->subtree_max_end; | ||
54 | } | ||
55 | return ret; | ||
56 | } | ||
57 | |||
58 | /* Update 'subtree_max_end' for a node, based on node and its children */ | ||
59 | static void update_node_max_end(struct rb_node *node) | ||
60 | { | ||
61 | struct memtype *data; | ||
62 | u64 max_end, child_max_end; | ||
63 | |||
64 | if (!node) | ||
65 | return; | ||
66 | |||
67 | data = container_of(node, struct memtype, rb); | ||
68 | max_end = data->end; | ||
69 | |||
70 | child_max_end = get_subtree_max_end(node->rb_right); | ||
71 | if (child_max_end > max_end) | ||
72 | max_end = child_max_end; | ||
73 | |||
74 | child_max_end = get_subtree_max_end(node->rb_left); | ||
75 | if (child_max_end > max_end) | ||
76 | max_end = child_max_end; | ||
77 | |||
78 | data->subtree_max_end = max_end; | ||
79 | } | ||
80 | |||
81 | /* Update 'subtree_max_end' for a node and all its ancestors */ | ||
82 | static void update_path_max_end(struct rb_node *node) | ||
83 | { | ||
84 | u64 old_max_end, new_max_end; | ||
85 | |||
86 | while (node) { | ||
87 | struct memtype *data = container_of(node, struct memtype, rb); | ||
88 | |||
89 | old_max_end = data->subtree_max_end; | ||
90 | update_node_max_end(node); | ||
91 | new_max_end = data->subtree_max_end; | ||
92 | |||
93 | if (new_max_end == old_max_end) | ||
94 | break; | ||
95 | |||
96 | node = rb_parent(node); | ||
97 | } | ||
98 | } | ||
99 | |||
100 | /* Find the first (lowest start addr) overlapping range from rb tree */ | ||
101 | static struct memtype *memtype_rb_lowest_match(struct rb_root *root, | ||
102 | u64 start, u64 end) | ||
103 | { | ||
104 | struct rb_node *node = root->rb_node; | ||
105 | struct memtype *last_lower = NULL; | ||
106 | |||
107 | while (node) { | ||
108 | struct memtype *data = container_of(node, struct memtype, rb); | ||
109 | |||
110 | if (get_subtree_max_end(node->rb_left) > start) { | ||
111 | /* Lowest overlap if any must be on left side */ | ||
112 | node = node->rb_left; | ||
113 | } else if (is_node_overlap(data, start, end)) { | ||
114 | last_lower = data; | ||
115 | break; | ||
116 | } else if (start >= data->start) { | ||
117 | /* Lowest overlap if any must be on right side */ | ||
118 | node = node->rb_right; | ||
119 | } else { | ||
120 | break; | ||
121 | } | ||
122 | } | ||
123 | return last_lower; /* Returns NULL if there is no overlap */ | ||
124 | } | ||
125 | |||
126 | static struct memtype *memtype_rb_exact_match(struct rb_root *root, | ||
127 | u64 start, u64 end) | ||
128 | { | ||
129 | struct memtype *match; | ||
130 | |||
131 | match = memtype_rb_lowest_match(root, start, end); | ||
132 | while (match != NULL && match->start < end) { | ||
133 | struct rb_node *node; | ||
134 | |||
135 | if (match->start == start && match->end == end) | ||
136 | return match; | ||
137 | |||
138 | node = rb_next(&match->rb); | ||
139 | if (node) | ||
140 | match = container_of(node, struct memtype, rb); | ||
141 | else | ||
142 | match = NULL; | ||
143 | } | ||
144 | |||
145 | return NULL; /* Returns NULL if there is no exact match */ | ||
146 | } | ||
147 | |||
148 | static int memtype_rb_check_conflict(struct rb_root *root, | ||
149 | u64 start, u64 end, | ||
150 | unsigned long reqtype, unsigned long *newtype) | ||
151 | { | ||
152 | struct rb_node *node; | ||
153 | struct memtype *match; | ||
154 | int found_type = reqtype; | ||
155 | |||
156 | match = memtype_rb_lowest_match(&memtype_rbroot, start, end); | ||
157 | if (match == NULL) | ||
158 | goto success; | ||
159 | |||
160 | if (match->type != found_type && newtype == NULL) | ||
161 | goto failure; | ||
162 | |||
163 | dprintk("Overlap at 0x%Lx-0x%Lx\n", match->start, match->end); | ||
164 | found_type = match->type; | ||
165 | |||
166 | node = rb_next(&match->rb); | ||
167 | while (node) { | ||
168 | match = container_of(node, struct memtype, rb); | ||
169 | |||
170 | if (match->start >= end) /* Checked all possible matches */ | ||
171 | goto success; | ||
172 | |||
173 | if (is_node_overlap(match, start, end) && | ||
174 | match->type != found_type) { | ||
175 | goto failure; | ||
176 | } | ||
177 | |||
178 | node = rb_next(&match->rb); | ||
179 | } | ||
180 | success: | ||
181 | if (newtype) | ||
182 | *newtype = found_type; | ||
183 | |||
184 | return 0; | ||
185 | |||
186 | failure: | ||
187 | printk(KERN_INFO "%s:%d conflicting memory types " | ||
188 | "%Lx-%Lx %s<->%s\n", current->comm, current->pid, start, | ||
189 | end, cattr_name(found_type), cattr_name(match->type)); | ||
190 | return -EBUSY; | ||
191 | } | ||
192 | |||
193 | static void memtype_rb_augment_cb(struct rb_node *node) | ||
194 | { | ||
195 | if (node) | ||
196 | update_path_max_end(node); | ||
197 | } | ||
198 | |||
199 | static void memtype_rb_insert(struct rb_root *root, struct memtype *newdata) | ||
200 | { | ||
201 | struct rb_node **node = &(root->rb_node); | ||
202 | struct rb_node *parent = NULL; | ||
203 | |||
204 | while (*node) { | ||
205 | struct memtype *data = container_of(*node, struct memtype, rb); | ||
206 | |||
207 | parent = *node; | ||
208 | if (newdata->start <= data->start) | ||
209 | node = &((*node)->rb_left); | ||
210 | else if (newdata->start > data->start) | ||
211 | node = &((*node)->rb_right); | ||
212 | } | ||
213 | |||
214 | rb_link_node(&newdata->rb, parent, node); | ||
215 | rb_insert_color(&newdata->rb, root); | ||
216 | } | ||
217 | |||
218 | int rbt_memtype_check_insert(struct memtype *new, unsigned long *ret_type) | ||
219 | { | ||
220 | int err = 0; | ||
221 | |||
222 | err = memtype_rb_check_conflict(&memtype_rbroot, new->start, new->end, | ||
223 | new->type, ret_type); | ||
224 | |||
225 | if (!err) { | ||
226 | if (ret_type) | ||
227 | new->type = *ret_type; | ||
228 | |||
229 | memtype_rb_insert(&memtype_rbroot, new); | ||
230 | } | ||
231 | return err; | ||
232 | } | ||
233 | |||
234 | int rbt_memtype_erase(u64 start, u64 end) | ||
235 | { | ||
236 | struct memtype *data; | ||
237 | |||
238 | data = memtype_rb_exact_match(&memtype_rbroot, start, end); | ||
239 | if (!data) | ||
240 | return -EINVAL; | ||
241 | |||
242 | rb_erase(&data->rb, &memtype_rbroot); | ||
243 | return 0; | ||
244 | } | ||
245 | |||
246 | struct memtype *rbt_memtype_lookup(u64 addr) | ||
247 | { | ||
248 | struct memtype *data; | ||
249 | data = memtype_rb_lowest_match(&memtype_rbroot, addr, addr + PAGE_SIZE); | ||
250 | return data; | ||
251 | } | ||
252 | |||
253 | #if defined(CONFIG_DEBUG_FS) | ||
254 | int rbt_memtype_copy_nth_element(struct memtype *out, loff_t pos) | ||
255 | { | ||
256 | struct rb_node *node; | ||
257 | int i = 1; | ||
258 | |||
259 | node = rb_first(&memtype_rbroot); | ||
260 | while (node && pos != i) { | ||
261 | node = rb_next(node); | ||
262 | i++; | ||
263 | } | ||
264 | |||
265 | if (node) { /* pos == i */ | ||
266 | struct memtype *this = container_of(node, struct memtype, rb); | ||
267 | *out = *this; | ||
268 | return 0; | ||
269 | } else { | ||
270 | return 1; | ||
271 | } | ||
272 | } | ||
273 | #endif | ||
diff --git a/arch/x86/mm/srat_64.c b/arch/x86/mm/srat_64.c index 28c68762648f..f9897f7a9ef1 100644 --- a/arch/x86/mm/srat_64.c +++ b/arch/x86/mm/srat_64.c | |||
@@ -363,6 +363,54 @@ int __init acpi_scan_nodes(unsigned long start, unsigned long end) | |||
363 | for (i = 0; i < MAX_NUMNODES; i++) | 363 | for (i = 0; i < MAX_NUMNODES; i++) |
364 | cutoff_node(i, start, end); | 364 | cutoff_node(i, start, end); |
365 | 365 | ||
366 | /* | ||
367 | * Join together blocks on the same node, holes between | ||
368 | * which don't overlap with memory on other nodes. | ||
369 | */ | ||
370 | for (i = 0; i < num_node_memblks; ++i) { | ||
371 | int j, k; | ||
372 | |||
373 | for (j = i + 1; j < num_node_memblks; ++j) { | ||
374 | unsigned long start, end; | ||
375 | |||
376 | if (memblk_nodeid[i] != memblk_nodeid[j]) | ||
377 | continue; | ||
378 | start = min(node_memblk_range[i].end, | ||
379 | node_memblk_range[j].end); | ||
380 | end = max(node_memblk_range[i].start, | ||
381 | node_memblk_range[j].start); | ||
382 | for (k = 0; k < num_node_memblks; ++k) { | ||
383 | if (memblk_nodeid[i] == memblk_nodeid[k]) | ||
384 | continue; | ||
385 | if (start < node_memblk_range[k].end && | ||
386 | end > node_memblk_range[k].start) | ||
387 | break; | ||
388 | } | ||
389 | if (k < num_node_memblks) | ||
390 | continue; | ||
391 | start = min(node_memblk_range[i].start, | ||
392 | node_memblk_range[j].start); | ||
393 | end = max(node_memblk_range[i].end, | ||
394 | node_memblk_range[j].end); | ||
395 | printk(KERN_INFO "SRAT: Node %d " | ||
396 | "[%Lx,%Lx) + [%Lx,%Lx) -> [%lx,%lx)\n", | ||
397 | memblk_nodeid[i], | ||
398 | node_memblk_range[i].start, | ||
399 | node_memblk_range[i].end, | ||
400 | node_memblk_range[j].start, | ||
401 | node_memblk_range[j].end, | ||
402 | start, end); | ||
403 | node_memblk_range[i].start = start; | ||
404 | node_memblk_range[i].end = end; | ||
405 | k = --num_node_memblks - j; | ||
406 | memmove(memblk_nodeid + j, memblk_nodeid + j+1, | ||
407 | k * sizeof(*memblk_nodeid)); | ||
408 | memmove(node_memblk_range + j, node_memblk_range + j+1, | ||
409 | k * sizeof(*node_memblk_range)); | ||
410 | --j; | ||
411 | } | ||
412 | } | ||
413 | |||
366 | memnode_shift = compute_hash_shift(node_memblk_range, num_node_memblks, | 414 | memnode_shift = compute_hash_shift(node_memblk_range, num_node_memblks, |
367 | memblk_nodeid); | 415 | memblk_nodeid); |
368 | if (memnode_shift < 0) { | 416 | if (memnode_shift < 0) { |
@@ -461,7 +509,8 @@ void __init acpi_fake_nodes(const struct bootnode *fake_nodes, int num_nodes) | |||
461 | * node, it must now point to the fake node ID. | 509 | * node, it must now point to the fake node ID. |
462 | */ | 510 | */ |
463 | for (j = 0; j < MAX_LOCAL_APIC; j++) | 511 | for (j = 0; j < MAX_LOCAL_APIC; j++) |
464 | if (apicid_to_node[j] == nid) | 512 | if (apicid_to_node[j] == nid && |
513 | fake_apicid_to_node[j] == NUMA_NO_NODE) | ||
465 | fake_apicid_to_node[j] = i; | 514 | fake_apicid_to_node[j] = i; |
466 | } | 515 | } |
467 | for (i = 0; i < num_nodes; i++) | 516 | for (i = 0; i < num_nodes; i++) |
diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c index 2c505ee71014..b28d2f1253bb 100644 --- a/arch/x86/oprofile/nmi_int.c +++ b/arch/x86/oprofile/nmi_int.c | |||
@@ -31,8 +31,9 @@ static struct op_x86_model_spec *model; | |||
31 | static DEFINE_PER_CPU(struct op_msrs, cpu_msrs); | 31 | static DEFINE_PER_CPU(struct op_msrs, cpu_msrs); |
32 | static DEFINE_PER_CPU(unsigned long, saved_lvtpc); | 32 | static DEFINE_PER_CPU(unsigned long, saved_lvtpc); |
33 | 33 | ||
34 | /* 0 == registered but off, 1 == registered and on */ | 34 | /* must be protected with get_online_cpus()/put_online_cpus(): */ |
35 | static int nmi_enabled = 0; | 35 | static int nmi_enabled; |
36 | static int ctr_running; | ||
36 | 37 | ||
37 | struct op_counter_config counter_config[OP_MAX_COUNTER]; | 38 | struct op_counter_config counter_config[OP_MAX_COUNTER]; |
38 | 39 | ||
@@ -61,12 +62,16 @@ static int profile_exceptions_notify(struct notifier_block *self, | |||
61 | { | 62 | { |
62 | struct die_args *args = (struct die_args *)data; | 63 | struct die_args *args = (struct die_args *)data; |
63 | int ret = NOTIFY_DONE; | 64 | int ret = NOTIFY_DONE; |
64 | int cpu = smp_processor_id(); | ||
65 | 65 | ||
66 | switch (val) { | 66 | switch (val) { |
67 | case DIE_NMI: | 67 | case DIE_NMI: |
68 | case DIE_NMI_IPI: | 68 | case DIE_NMI_IPI: |
69 | model->check_ctrs(args->regs, &per_cpu(cpu_msrs, cpu)); | 69 | if (ctr_running) |
70 | model->check_ctrs(args->regs, &__get_cpu_var(cpu_msrs)); | ||
71 | else if (!nmi_enabled) | ||
72 | break; | ||
73 | else | ||
74 | model->stop(&__get_cpu_var(cpu_msrs)); | ||
70 | ret = NOTIFY_STOP; | 75 | ret = NOTIFY_STOP; |
71 | break; | 76 | break; |
72 | default: | 77 | default: |
@@ -95,24 +100,36 @@ static void nmi_cpu_save_registers(struct op_msrs *msrs) | |||
95 | static void nmi_cpu_start(void *dummy) | 100 | static void nmi_cpu_start(void *dummy) |
96 | { | 101 | { |
97 | struct op_msrs const *msrs = &__get_cpu_var(cpu_msrs); | 102 | struct op_msrs const *msrs = &__get_cpu_var(cpu_msrs); |
98 | model->start(msrs); | 103 | if (!msrs->controls) |
104 | WARN_ON_ONCE(1); | ||
105 | else | ||
106 | model->start(msrs); | ||
99 | } | 107 | } |
100 | 108 | ||
101 | static int nmi_start(void) | 109 | static int nmi_start(void) |
102 | { | 110 | { |
111 | get_online_cpus(); | ||
103 | on_each_cpu(nmi_cpu_start, NULL, 1); | 112 | on_each_cpu(nmi_cpu_start, NULL, 1); |
113 | ctr_running = 1; | ||
114 | put_online_cpus(); | ||
104 | return 0; | 115 | return 0; |
105 | } | 116 | } |
106 | 117 | ||
107 | static void nmi_cpu_stop(void *dummy) | 118 | static void nmi_cpu_stop(void *dummy) |
108 | { | 119 | { |
109 | struct op_msrs const *msrs = &__get_cpu_var(cpu_msrs); | 120 | struct op_msrs const *msrs = &__get_cpu_var(cpu_msrs); |
110 | model->stop(msrs); | 121 | if (!msrs->controls) |
122 | WARN_ON_ONCE(1); | ||
123 | else | ||
124 | model->stop(msrs); | ||
111 | } | 125 | } |
112 | 126 | ||
113 | static void nmi_stop(void) | 127 | static void nmi_stop(void) |
114 | { | 128 | { |
129 | get_online_cpus(); | ||
115 | on_each_cpu(nmi_cpu_stop, NULL, 1); | 130 | on_each_cpu(nmi_cpu_stop, NULL, 1); |
131 | ctr_running = 0; | ||
132 | put_online_cpus(); | ||
116 | } | 133 | } |
117 | 134 | ||
118 | #ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX | 135 | #ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX |
@@ -252,7 +269,10 @@ static int nmi_switch_event(void) | |||
252 | if (nmi_multiplex_on() < 0) | 269 | if (nmi_multiplex_on() < 0) |
253 | return -EINVAL; /* not necessary */ | 270 | return -EINVAL; /* not necessary */ |
254 | 271 | ||
255 | on_each_cpu(nmi_cpu_switch, NULL, 1); | 272 | get_online_cpus(); |
273 | if (ctr_running) | ||
274 | on_each_cpu(nmi_cpu_switch, NULL, 1); | ||
275 | put_online_cpus(); | ||
256 | 276 | ||
257 | return 0; | 277 | return 0; |
258 | } | 278 | } |
@@ -295,6 +315,7 @@ static void free_msrs(void) | |||
295 | kfree(per_cpu(cpu_msrs, i).controls); | 315 | kfree(per_cpu(cpu_msrs, i).controls); |
296 | per_cpu(cpu_msrs, i).controls = NULL; | 316 | per_cpu(cpu_msrs, i).controls = NULL; |
297 | } | 317 | } |
318 | nmi_shutdown_mux(); | ||
298 | } | 319 | } |
299 | 320 | ||
300 | static int allocate_msrs(void) | 321 | static int allocate_msrs(void) |
@@ -307,14 +328,21 @@ static int allocate_msrs(void) | |||
307 | per_cpu(cpu_msrs, i).counters = kzalloc(counters_size, | 328 | per_cpu(cpu_msrs, i).counters = kzalloc(counters_size, |
308 | GFP_KERNEL); | 329 | GFP_KERNEL); |
309 | if (!per_cpu(cpu_msrs, i).counters) | 330 | if (!per_cpu(cpu_msrs, i).counters) |
310 | return 0; | 331 | goto fail; |
311 | per_cpu(cpu_msrs, i).controls = kzalloc(controls_size, | 332 | per_cpu(cpu_msrs, i).controls = kzalloc(controls_size, |
312 | GFP_KERNEL); | 333 | GFP_KERNEL); |
313 | if (!per_cpu(cpu_msrs, i).controls) | 334 | if (!per_cpu(cpu_msrs, i).controls) |
314 | return 0; | 335 | goto fail; |
315 | } | 336 | } |
316 | 337 | ||
338 | if (!nmi_setup_mux()) | ||
339 | goto fail; | ||
340 | |||
317 | return 1; | 341 | return 1; |
342 | |||
343 | fail: | ||
344 | free_msrs(); | ||
345 | return 0; | ||
318 | } | 346 | } |
319 | 347 | ||
320 | static void nmi_cpu_setup(void *dummy) | 348 | static void nmi_cpu_setup(void *dummy) |
@@ -336,49 +364,6 @@ static struct notifier_block profile_exceptions_nb = { | |||
336 | .priority = 2 | 364 | .priority = 2 |
337 | }; | 365 | }; |
338 | 366 | ||
339 | static int nmi_setup(void) | ||
340 | { | ||
341 | int err = 0; | ||
342 | int cpu; | ||
343 | |||
344 | if (!allocate_msrs()) | ||
345 | err = -ENOMEM; | ||
346 | else if (!nmi_setup_mux()) | ||
347 | err = -ENOMEM; | ||
348 | else | ||
349 | err = register_die_notifier(&profile_exceptions_nb); | ||
350 | |||
351 | if (err) { | ||
352 | free_msrs(); | ||
353 | nmi_shutdown_mux(); | ||
354 | return err; | ||
355 | } | ||
356 | |||
357 | /* We need to serialize save and setup for HT because the subset | ||
358 | * of msrs are distinct for save and setup operations | ||
359 | */ | ||
360 | |||
361 | /* Assume saved/restored counters are the same on all CPUs */ | ||
362 | model->fill_in_addresses(&per_cpu(cpu_msrs, 0)); | ||
363 | for_each_possible_cpu(cpu) { | ||
364 | if (!cpu) | ||
365 | continue; | ||
366 | |||
367 | memcpy(per_cpu(cpu_msrs, cpu).counters, | ||
368 | per_cpu(cpu_msrs, 0).counters, | ||
369 | sizeof(struct op_msr) * model->num_counters); | ||
370 | |||
371 | memcpy(per_cpu(cpu_msrs, cpu).controls, | ||
372 | per_cpu(cpu_msrs, 0).controls, | ||
373 | sizeof(struct op_msr) * model->num_controls); | ||
374 | |||
375 | mux_clone(cpu); | ||
376 | } | ||
377 | on_each_cpu(nmi_cpu_setup, NULL, 1); | ||
378 | nmi_enabled = 1; | ||
379 | return 0; | ||
380 | } | ||
381 | |||
382 | static void nmi_cpu_restore_registers(struct op_msrs *msrs) | 367 | static void nmi_cpu_restore_registers(struct op_msrs *msrs) |
383 | { | 368 | { |
384 | struct op_msr *counters = msrs->counters; | 369 | struct op_msr *counters = msrs->counters; |
@@ -412,20 +397,24 @@ static void nmi_cpu_shutdown(void *dummy) | |||
412 | apic_write(APIC_LVTPC, per_cpu(saved_lvtpc, cpu)); | 397 | apic_write(APIC_LVTPC, per_cpu(saved_lvtpc, cpu)); |
413 | apic_write(APIC_LVTERR, v); | 398 | apic_write(APIC_LVTERR, v); |
414 | nmi_cpu_restore_registers(msrs); | 399 | nmi_cpu_restore_registers(msrs); |
400 | if (model->cpu_down) | ||
401 | model->cpu_down(); | ||
415 | } | 402 | } |
416 | 403 | ||
417 | static void nmi_shutdown(void) | 404 | static void nmi_cpu_up(void *dummy) |
418 | { | 405 | { |
419 | struct op_msrs *msrs; | 406 | if (nmi_enabled) |
407 | nmi_cpu_setup(dummy); | ||
408 | if (ctr_running) | ||
409 | nmi_cpu_start(dummy); | ||
410 | } | ||
420 | 411 | ||
421 | nmi_enabled = 0; | 412 | static void nmi_cpu_down(void *dummy) |
422 | on_each_cpu(nmi_cpu_shutdown, NULL, 1); | 413 | { |
423 | unregister_die_notifier(&profile_exceptions_nb); | 414 | if (ctr_running) |
424 | nmi_shutdown_mux(); | 415 | nmi_cpu_stop(dummy); |
425 | msrs = &get_cpu_var(cpu_msrs); | 416 | if (nmi_enabled) |
426 | model->shutdown(msrs); | 417 | nmi_cpu_shutdown(dummy); |
427 | free_msrs(); | ||
428 | put_cpu_var(cpu_msrs); | ||
429 | } | 418 | } |
430 | 419 | ||
431 | static int nmi_create_files(struct super_block *sb, struct dentry *root) | 420 | static int nmi_create_files(struct super_block *sb, struct dentry *root) |
@@ -457,7 +446,6 @@ static int nmi_create_files(struct super_block *sb, struct dentry *root) | |||
457 | return 0; | 446 | return 0; |
458 | } | 447 | } |
459 | 448 | ||
460 | #ifdef CONFIG_SMP | ||
461 | static int oprofile_cpu_notifier(struct notifier_block *b, unsigned long action, | 449 | static int oprofile_cpu_notifier(struct notifier_block *b, unsigned long action, |
462 | void *data) | 450 | void *data) |
463 | { | 451 | { |
@@ -465,10 +453,10 @@ static int oprofile_cpu_notifier(struct notifier_block *b, unsigned long action, | |||
465 | switch (action) { | 453 | switch (action) { |
466 | case CPU_DOWN_FAILED: | 454 | case CPU_DOWN_FAILED: |
467 | case CPU_ONLINE: | 455 | case CPU_ONLINE: |
468 | smp_call_function_single(cpu, nmi_cpu_start, NULL, 0); | 456 | smp_call_function_single(cpu, nmi_cpu_up, NULL, 0); |
469 | break; | 457 | break; |
470 | case CPU_DOWN_PREPARE: | 458 | case CPU_DOWN_PREPARE: |
471 | smp_call_function_single(cpu, nmi_cpu_stop, NULL, 1); | 459 | smp_call_function_single(cpu, nmi_cpu_down, NULL, 1); |
472 | break; | 460 | break; |
473 | } | 461 | } |
474 | return NOTIFY_DONE; | 462 | return NOTIFY_DONE; |
@@ -477,7 +465,75 @@ static int oprofile_cpu_notifier(struct notifier_block *b, unsigned long action, | |||
477 | static struct notifier_block oprofile_cpu_nb = { | 465 | static struct notifier_block oprofile_cpu_nb = { |
478 | .notifier_call = oprofile_cpu_notifier | 466 | .notifier_call = oprofile_cpu_notifier |
479 | }; | 467 | }; |
480 | #endif | 468 | |
469 | static int nmi_setup(void) | ||
470 | { | ||
471 | int err = 0; | ||
472 | int cpu; | ||
473 | |||
474 | if (!allocate_msrs()) | ||
475 | return -ENOMEM; | ||
476 | |||
477 | /* We need to serialize save and setup for HT because the subset | ||
478 | * of msrs are distinct for save and setup operations | ||
479 | */ | ||
480 | |||
481 | /* Assume saved/restored counters are the same on all CPUs */ | ||
482 | err = model->fill_in_addresses(&per_cpu(cpu_msrs, 0)); | ||
483 | if (err) | ||
484 | goto fail; | ||
485 | |||
486 | for_each_possible_cpu(cpu) { | ||
487 | if (!cpu) | ||
488 | continue; | ||
489 | |||
490 | memcpy(per_cpu(cpu_msrs, cpu).counters, | ||
491 | per_cpu(cpu_msrs, 0).counters, | ||
492 | sizeof(struct op_msr) * model->num_counters); | ||
493 | |||
494 | memcpy(per_cpu(cpu_msrs, cpu).controls, | ||
495 | per_cpu(cpu_msrs, 0).controls, | ||
496 | sizeof(struct op_msr) * model->num_controls); | ||
497 | |||
498 | mux_clone(cpu); | ||
499 | } | ||
500 | |||
501 | nmi_enabled = 0; | ||
502 | ctr_running = 0; | ||
503 | barrier(); | ||
504 | err = register_die_notifier(&profile_exceptions_nb); | ||
505 | if (err) | ||
506 | goto fail; | ||
507 | |||
508 | get_online_cpus(); | ||
509 | register_cpu_notifier(&oprofile_cpu_nb); | ||
510 | on_each_cpu(nmi_cpu_setup, NULL, 1); | ||
511 | nmi_enabled = 1; | ||
512 | put_online_cpus(); | ||
513 | |||
514 | return 0; | ||
515 | fail: | ||
516 | free_msrs(); | ||
517 | return err; | ||
518 | } | ||
519 | |||
520 | static void nmi_shutdown(void) | ||
521 | { | ||
522 | struct op_msrs *msrs; | ||
523 | |||
524 | get_online_cpus(); | ||
525 | unregister_cpu_notifier(&oprofile_cpu_nb); | ||
526 | on_each_cpu(nmi_cpu_shutdown, NULL, 1); | ||
527 | nmi_enabled = 0; | ||
528 | ctr_running = 0; | ||
529 | put_online_cpus(); | ||
530 | barrier(); | ||
531 | unregister_die_notifier(&profile_exceptions_nb); | ||
532 | msrs = &get_cpu_var(cpu_msrs); | ||
533 | model->shutdown(msrs); | ||
534 | free_msrs(); | ||
535 | put_cpu_var(cpu_msrs); | ||
536 | } | ||
481 | 537 | ||
482 | #ifdef CONFIG_PM | 538 | #ifdef CONFIG_PM |
483 | 539 | ||
@@ -687,9 +743,6 @@ int __init op_nmi_init(struct oprofile_operations *ops) | |||
687 | return -ENODEV; | 743 | return -ENODEV; |
688 | } | 744 | } |
689 | 745 | ||
690 | #ifdef CONFIG_SMP | ||
691 | register_cpu_notifier(&oprofile_cpu_nb); | ||
692 | #endif | ||
693 | /* default values, can be overwritten by model */ | 746 | /* default values, can be overwritten by model */ |
694 | ops->create_files = nmi_create_files; | 747 | ops->create_files = nmi_create_files; |
695 | ops->setup = nmi_setup; | 748 | ops->setup = nmi_setup; |
@@ -716,12 +769,6 @@ int __init op_nmi_init(struct oprofile_operations *ops) | |||
716 | 769 | ||
717 | void op_nmi_exit(void) | 770 | void op_nmi_exit(void) |
718 | { | 771 | { |
719 | if (using_nmi) { | 772 | if (using_nmi) |
720 | exit_sysfs(); | 773 | exit_sysfs(); |
721 | #ifdef CONFIG_SMP | ||
722 | unregister_cpu_notifier(&oprofile_cpu_nb); | ||
723 | #endif | ||
724 | } | ||
725 | if (model->exit) | ||
726 | model->exit(); | ||
727 | } | 774 | } |
diff --git a/arch/x86/oprofile/op_model_amd.c b/arch/x86/oprofile/op_model_amd.c index 090cbbec7dbd..b67a6b5aa8d4 100644 --- a/arch/x86/oprofile/op_model_amd.c +++ b/arch/x86/oprofile/op_model_amd.c | |||
@@ -30,13 +30,10 @@ | |||
30 | #include "op_counter.h" | 30 | #include "op_counter.h" |
31 | 31 | ||
32 | #define NUM_COUNTERS 4 | 32 | #define NUM_COUNTERS 4 |
33 | #define NUM_CONTROLS 4 | ||
34 | #ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX | 33 | #ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX |
35 | #define NUM_VIRT_COUNTERS 32 | 34 | #define NUM_VIRT_COUNTERS 32 |
36 | #define NUM_VIRT_CONTROLS 32 | ||
37 | #else | 35 | #else |
38 | #define NUM_VIRT_COUNTERS NUM_COUNTERS | 36 | #define NUM_VIRT_COUNTERS NUM_COUNTERS |
39 | #define NUM_VIRT_CONTROLS NUM_CONTROLS | ||
40 | #endif | 37 | #endif |
41 | 38 | ||
42 | #define OP_EVENT_MASK 0x0FFF | 39 | #define OP_EVENT_MASK 0x0FFF |
@@ -105,102 +102,6 @@ static u32 get_ibs_caps(void) | |||
105 | return ibs_caps; | 102 | return ibs_caps; |
106 | } | 103 | } |
107 | 104 | ||
108 | #ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX | ||
109 | |||
110 | static void op_mux_switch_ctrl(struct op_x86_model_spec const *model, | ||
111 | struct op_msrs const * const msrs) | ||
112 | { | ||
113 | u64 val; | ||
114 | int i; | ||
115 | |||
116 | /* enable active counters */ | ||
117 | for (i = 0; i < NUM_COUNTERS; ++i) { | ||
118 | int virt = op_x86_phys_to_virt(i); | ||
119 | if (!reset_value[virt]) | ||
120 | continue; | ||
121 | rdmsrl(msrs->controls[i].addr, val); | ||
122 | val &= model->reserved; | ||
123 | val |= op_x86_get_ctrl(model, &counter_config[virt]); | ||
124 | wrmsrl(msrs->controls[i].addr, val); | ||
125 | } | ||
126 | } | ||
127 | |||
128 | #endif | ||
129 | |||
130 | /* functions for op_amd_spec */ | ||
131 | |||
132 | static void op_amd_fill_in_addresses(struct op_msrs * const msrs) | ||
133 | { | ||
134 | int i; | ||
135 | |||
136 | for (i = 0; i < NUM_COUNTERS; i++) { | ||
137 | if (reserve_perfctr_nmi(MSR_K7_PERFCTR0 + i)) | ||
138 | msrs->counters[i].addr = MSR_K7_PERFCTR0 + i; | ||
139 | } | ||
140 | |||
141 | for (i = 0; i < NUM_CONTROLS; i++) { | ||
142 | if (reserve_evntsel_nmi(MSR_K7_EVNTSEL0 + i)) | ||
143 | msrs->controls[i].addr = MSR_K7_EVNTSEL0 + i; | ||
144 | } | ||
145 | } | ||
146 | |||
147 | static void op_amd_setup_ctrs(struct op_x86_model_spec const *model, | ||
148 | struct op_msrs const * const msrs) | ||
149 | { | ||
150 | u64 val; | ||
151 | int i; | ||
152 | |||
153 | /* setup reset_value */ | ||
154 | for (i = 0; i < NUM_VIRT_COUNTERS; ++i) { | ||
155 | if (counter_config[i].enabled | ||
156 | && msrs->counters[op_x86_virt_to_phys(i)].addr) | ||
157 | reset_value[i] = counter_config[i].count; | ||
158 | else | ||
159 | reset_value[i] = 0; | ||
160 | } | ||
161 | |||
162 | /* clear all counters */ | ||
163 | for (i = 0; i < NUM_CONTROLS; ++i) { | ||
164 | if (unlikely(!msrs->controls[i].addr)) { | ||
165 | if (counter_config[i].enabled && !smp_processor_id()) | ||
166 | /* | ||
167 | * counter is reserved, this is on all | ||
168 | * cpus, so report only for cpu #0 | ||
169 | */ | ||
170 | op_x86_warn_reserved(i); | ||
171 | continue; | ||
172 | } | ||
173 | rdmsrl(msrs->controls[i].addr, val); | ||
174 | if (val & ARCH_PERFMON_EVENTSEL_ENABLE) | ||
175 | op_x86_warn_in_use(i); | ||
176 | val &= model->reserved; | ||
177 | wrmsrl(msrs->controls[i].addr, val); | ||
178 | } | ||
179 | |||
180 | /* avoid a false detection of ctr overflows in NMI handler */ | ||
181 | for (i = 0; i < NUM_COUNTERS; ++i) { | ||
182 | if (unlikely(!msrs->counters[i].addr)) | ||
183 | continue; | ||
184 | wrmsrl(msrs->counters[i].addr, -1LL); | ||
185 | } | ||
186 | |||
187 | /* enable active counters */ | ||
188 | for (i = 0; i < NUM_COUNTERS; ++i) { | ||
189 | int virt = op_x86_phys_to_virt(i); | ||
190 | if (!reset_value[virt]) | ||
191 | continue; | ||
192 | |||
193 | /* setup counter registers */ | ||
194 | wrmsrl(msrs->counters[i].addr, -(u64)reset_value[virt]); | ||
195 | |||
196 | /* setup control registers */ | ||
197 | rdmsrl(msrs->controls[i].addr, val); | ||
198 | val &= model->reserved; | ||
199 | val |= op_x86_get_ctrl(model, &counter_config[virt]); | ||
200 | wrmsrl(msrs->controls[i].addr, val); | ||
201 | } | ||
202 | } | ||
203 | |||
204 | /* | 105 | /* |
205 | * 16-bit Linear Feedback Shift Register (LFSR) | 106 | * 16-bit Linear Feedback Shift Register (LFSR) |
206 | * | 107 | * |
@@ -365,6 +266,125 @@ static void op_amd_stop_ibs(void) | |||
365 | wrmsrl(MSR_AMD64_IBSOPCTL, 0); | 266 | wrmsrl(MSR_AMD64_IBSOPCTL, 0); |
366 | } | 267 | } |
367 | 268 | ||
269 | #ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX | ||
270 | |||
271 | static void op_mux_switch_ctrl(struct op_x86_model_spec const *model, | ||
272 | struct op_msrs const * const msrs) | ||
273 | { | ||
274 | u64 val; | ||
275 | int i; | ||
276 | |||
277 | /* enable active counters */ | ||
278 | for (i = 0; i < NUM_COUNTERS; ++i) { | ||
279 | int virt = op_x86_phys_to_virt(i); | ||
280 | if (!reset_value[virt]) | ||
281 | continue; | ||
282 | rdmsrl(msrs->controls[i].addr, val); | ||
283 | val &= model->reserved; | ||
284 | val |= op_x86_get_ctrl(model, &counter_config[virt]); | ||
285 | wrmsrl(msrs->controls[i].addr, val); | ||
286 | } | ||
287 | } | ||
288 | |||
289 | #endif | ||
290 | |||
291 | /* functions for op_amd_spec */ | ||
292 | |||
293 | static void op_amd_shutdown(struct op_msrs const * const msrs) | ||
294 | { | ||
295 | int i; | ||
296 | |||
297 | for (i = 0; i < NUM_COUNTERS; ++i) { | ||
298 | if (!msrs->counters[i].addr) | ||
299 | continue; | ||
300 | release_perfctr_nmi(MSR_K7_PERFCTR0 + i); | ||
301 | release_evntsel_nmi(MSR_K7_EVNTSEL0 + i); | ||
302 | } | ||
303 | } | ||
304 | |||
305 | static int op_amd_fill_in_addresses(struct op_msrs * const msrs) | ||
306 | { | ||
307 | int i; | ||
308 | |||
309 | for (i = 0; i < NUM_COUNTERS; i++) { | ||
310 | if (!reserve_perfctr_nmi(MSR_K7_PERFCTR0 + i)) | ||
311 | goto fail; | ||
312 | if (!reserve_evntsel_nmi(MSR_K7_EVNTSEL0 + i)) { | ||
313 | release_perfctr_nmi(MSR_K7_PERFCTR0 + i); | ||
314 | goto fail; | ||
315 | } | ||
316 | /* both registers must be reserved */ | ||
317 | msrs->counters[i].addr = MSR_K7_PERFCTR0 + i; | ||
318 | msrs->controls[i].addr = MSR_K7_EVNTSEL0 + i; | ||
319 | continue; | ||
320 | fail: | ||
321 | if (!counter_config[i].enabled) | ||
322 | continue; | ||
323 | op_x86_warn_reserved(i); | ||
324 | op_amd_shutdown(msrs); | ||
325 | return -EBUSY; | ||
326 | } | ||
327 | |||
328 | return 0; | ||
329 | } | ||
330 | |||
331 | static void op_amd_setup_ctrs(struct op_x86_model_spec const *model, | ||
332 | struct op_msrs const * const msrs) | ||
333 | { | ||
334 | u64 val; | ||
335 | int i; | ||
336 | |||
337 | /* setup reset_value */ | ||
338 | for (i = 0; i < NUM_VIRT_COUNTERS; ++i) { | ||
339 | if (counter_config[i].enabled | ||
340 | && msrs->counters[op_x86_virt_to_phys(i)].addr) | ||
341 | reset_value[i] = counter_config[i].count; | ||
342 | else | ||
343 | reset_value[i] = 0; | ||
344 | } | ||
345 | |||
346 | /* clear all counters */ | ||
347 | for (i = 0; i < NUM_COUNTERS; ++i) { | ||
348 | if (!msrs->controls[i].addr) | ||
349 | continue; | ||
350 | rdmsrl(msrs->controls[i].addr, val); | ||
351 | if (val & ARCH_PERFMON_EVENTSEL_ENABLE) | ||
352 | op_x86_warn_in_use(i); | ||
353 | val &= model->reserved; | ||
354 | wrmsrl(msrs->controls[i].addr, val); | ||
355 | /* | ||
356 | * avoid a false detection of ctr overflows in NMI | ||
357 | * handler | ||
358 | */ | ||
359 | wrmsrl(msrs->counters[i].addr, -1LL); | ||
360 | } | ||
361 | |||
362 | /* enable active counters */ | ||
363 | for (i = 0; i < NUM_COUNTERS; ++i) { | ||
364 | int virt = op_x86_phys_to_virt(i); | ||
365 | if (!reset_value[virt]) | ||
366 | continue; | ||
367 | |||
368 | /* setup counter registers */ | ||
369 | wrmsrl(msrs->counters[i].addr, -(u64)reset_value[virt]); | ||
370 | |||
371 | /* setup control registers */ | ||
372 | rdmsrl(msrs->controls[i].addr, val); | ||
373 | val &= model->reserved; | ||
374 | val |= op_x86_get_ctrl(model, &counter_config[virt]); | ||
375 | wrmsrl(msrs->controls[i].addr, val); | ||
376 | } | ||
377 | |||
378 | if (ibs_caps) | ||
379 | setup_APIC_eilvt_ibs(0, APIC_EILVT_MSG_NMI, 0); | ||
380 | } | ||
381 | |||
382 | static void op_amd_cpu_shutdown(void) | ||
383 | { | ||
384 | if (ibs_caps) | ||
385 | setup_APIC_eilvt_ibs(0, APIC_EILVT_MSG_FIX, 1); | ||
386 | } | ||
387 | |||
368 | static int op_amd_check_ctrs(struct pt_regs * const regs, | 388 | static int op_amd_check_ctrs(struct pt_regs * const regs, |
369 | struct op_msrs const * const msrs) | 389 | struct op_msrs const * const msrs) |
370 | { | 390 | { |
@@ -425,42 +445,16 @@ static void op_amd_stop(struct op_msrs const * const msrs) | |||
425 | op_amd_stop_ibs(); | 445 | op_amd_stop_ibs(); |
426 | } | 446 | } |
427 | 447 | ||
428 | static void op_amd_shutdown(struct op_msrs const * const msrs) | 448 | static int __init_ibs_nmi(void) |
429 | { | ||
430 | int i; | ||
431 | |||
432 | for (i = 0; i < NUM_COUNTERS; ++i) { | ||
433 | if (msrs->counters[i].addr) | ||
434 | release_perfctr_nmi(MSR_K7_PERFCTR0 + i); | ||
435 | } | ||
436 | for (i = 0; i < NUM_CONTROLS; ++i) { | ||
437 | if (msrs->controls[i].addr) | ||
438 | release_evntsel_nmi(MSR_K7_EVNTSEL0 + i); | ||
439 | } | ||
440 | } | ||
441 | |||
442 | static u8 ibs_eilvt_off; | ||
443 | |||
444 | static inline void apic_init_ibs_nmi_per_cpu(void *arg) | ||
445 | { | ||
446 | ibs_eilvt_off = setup_APIC_eilvt_ibs(0, APIC_EILVT_MSG_NMI, 0); | ||
447 | } | ||
448 | |||
449 | static inline void apic_clear_ibs_nmi_per_cpu(void *arg) | ||
450 | { | ||
451 | setup_APIC_eilvt_ibs(0, APIC_EILVT_MSG_FIX, 1); | ||
452 | } | ||
453 | |||
454 | static int init_ibs_nmi(void) | ||
455 | { | 449 | { |
456 | #define IBSCTL_LVTOFFSETVAL (1 << 8) | 450 | #define IBSCTL_LVTOFFSETVAL (1 << 8) |
457 | #define IBSCTL 0x1cc | 451 | #define IBSCTL 0x1cc |
458 | struct pci_dev *cpu_cfg; | 452 | struct pci_dev *cpu_cfg; |
459 | int nodes; | 453 | int nodes; |
460 | u32 value = 0; | 454 | u32 value = 0; |
455 | u8 ibs_eilvt_off; | ||
461 | 456 | ||
462 | /* per CPU setup */ | 457 | ibs_eilvt_off = setup_APIC_eilvt_ibs(0, APIC_EILVT_MSG_FIX, 1); |
463 | on_each_cpu(apic_init_ibs_nmi_per_cpu, NULL, 1); | ||
464 | 458 | ||
465 | nodes = 0; | 459 | nodes = 0; |
466 | cpu_cfg = NULL; | 460 | cpu_cfg = NULL; |
@@ -490,22 +484,15 @@ static int init_ibs_nmi(void) | |||
490 | return 0; | 484 | return 0; |
491 | } | 485 | } |
492 | 486 | ||
493 | /* uninitialize the APIC for the IBS interrupts if needed */ | ||
494 | static void clear_ibs_nmi(void) | ||
495 | { | ||
496 | if (ibs_caps) | ||
497 | on_each_cpu(apic_clear_ibs_nmi_per_cpu, NULL, 1); | ||
498 | } | ||
499 | |||
500 | /* initialize the APIC for the IBS interrupts if available */ | 487 | /* initialize the APIC for the IBS interrupts if available */ |
501 | static void ibs_init(void) | 488 | static void init_ibs(void) |
502 | { | 489 | { |
503 | ibs_caps = get_ibs_caps(); | 490 | ibs_caps = get_ibs_caps(); |
504 | 491 | ||
505 | if (!ibs_caps) | 492 | if (!ibs_caps) |
506 | return; | 493 | return; |
507 | 494 | ||
508 | if (init_ibs_nmi()) { | 495 | if (__init_ibs_nmi()) { |
509 | ibs_caps = 0; | 496 | ibs_caps = 0; |
510 | return; | 497 | return; |
511 | } | 498 | } |
@@ -514,14 +501,6 @@ static void ibs_init(void) | |||
514 | (unsigned)ibs_caps); | 501 | (unsigned)ibs_caps); |
515 | } | 502 | } |
516 | 503 | ||
517 | static void ibs_exit(void) | ||
518 | { | ||
519 | if (!ibs_caps) | ||
520 | return; | ||
521 | |||
522 | clear_ibs_nmi(); | ||
523 | } | ||
524 | |||
525 | static int (*create_arch_files)(struct super_block *sb, struct dentry *root); | 504 | static int (*create_arch_files)(struct super_block *sb, struct dentry *root); |
526 | 505 | ||
527 | static int setup_ibs_files(struct super_block *sb, struct dentry *root) | 506 | static int setup_ibs_files(struct super_block *sb, struct dentry *root) |
@@ -570,27 +549,22 @@ static int setup_ibs_files(struct super_block *sb, struct dentry *root) | |||
570 | 549 | ||
571 | static int op_amd_init(struct oprofile_operations *ops) | 550 | static int op_amd_init(struct oprofile_operations *ops) |
572 | { | 551 | { |
573 | ibs_init(); | 552 | init_ibs(); |
574 | create_arch_files = ops->create_files; | 553 | create_arch_files = ops->create_files; |
575 | ops->create_files = setup_ibs_files; | 554 | ops->create_files = setup_ibs_files; |
576 | return 0; | 555 | return 0; |
577 | } | 556 | } |
578 | 557 | ||
579 | static void op_amd_exit(void) | ||
580 | { | ||
581 | ibs_exit(); | ||
582 | } | ||
583 | |||
584 | struct op_x86_model_spec op_amd_spec = { | 558 | struct op_x86_model_spec op_amd_spec = { |
585 | .num_counters = NUM_COUNTERS, | 559 | .num_counters = NUM_COUNTERS, |
586 | .num_controls = NUM_CONTROLS, | 560 | .num_controls = NUM_COUNTERS, |
587 | .num_virt_counters = NUM_VIRT_COUNTERS, | 561 | .num_virt_counters = NUM_VIRT_COUNTERS, |
588 | .reserved = MSR_AMD_EVENTSEL_RESERVED, | 562 | .reserved = MSR_AMD_EVENTSEL_RESERVED, |
589 | .event_mask = OP_EVENT_MASK, | 563 | .event_mask = OP_EVENT_MASK, |
590 | .init = op_amd_init, | 564 | .init = op_amd_init, |
591 | .exit = op_amd_exit, | ||
592 | .fill_in_addresses = &op_amd_fill_in_addresses, | 565 | .fill_in_addresses = &op_amd_fill_in_addresses, |
593 | .setup_ctrs = &op_amd_setup_ctrs, | 566 | .setup_ctrs = &op_amd_setup_ctrs, |
567 | .cpu_down = &op_amd_cpu_shutdown, | ||
594 | .check_ctrs = &op_amd_check_ctrs, | 568 | .check_ctrs = &op_amd_check_ctrs, |
595 | .start = &op_amd_start, | 569 | .start = &op_amd_start, |
596 | .stop = &op_amd_stop, | 570 | .stop = &op_amd_stop, |
diff --git a/arch/x86/oprofile/op_model_p4.c b/arch/x86/oprofile/op_model_p4.c index e6a160a4684a..182558dd5515 100644 --- a/arch/x86/oprofile/op_model_p4.c +++ b/arch/x86/oprofile/op_model_p4.c | |||
@@ -385,8 +385,26 @@ static unsigned int get_stagger(void) | |||
385 | 385 | ||
386 | static unsigned long reset_value[NUM_COUNTERS_NON_HT]; | 386 | static unsigned long reset_value[NUM_COUNTERS_NON_HT]; |
387 | 387 | ||
388 | static void p4_shutdown(struct op_msrs const * const msrs) | ||
389 | { | ||
390 | int i; | ||
388 | 391 | ||
389 | static void p4_fill_in_addresses(struct op_msrs * const msrs) | 392 | for (i = 0; i < num_counters; ++i) { |
393 | if (msrs->counters[i].addr) | ||
394 | release_perfctr_nmi(msrs->counters[i].addr); | ||
395 | } | ||
396 | /* | ||
397 | * some of the control registers are specially reserved in | ||
398 | * conjunction with the counter registers (hence the starting offset). | ||
399 | * This saves a few bits. | ||
400 | */ | ||
401 | for (i = num_counters; i < num_controls; ++i) { | ||
402 | if (msrs->controls[i].addr) | ||
403 | release_evntsel_nmi(msrs->controls[i].addr); | ||
404 | } | ||
405 | } | ||
406 | |||
407 | static int p4_fill_in_addresses(struct op_msrs * const msrs) | ||
390 | { | 408 | { |
391 | unsigned int i; | 409 | unsigned int i; |
392 | unsigned int addr, cccraddr, stag; | 410 | unsigned int addr, cccraddr, stag; |
@@ -468,6 +486,18 @@ static void p4_fill_in_addresses(struct op_msrs * const msrs) | |||
468 | msrs->controls[i++].addr = MSR_P4_CRU_ESCR5; | 486 | msrs->controls[i++].addr = MSR_P4_CRU_ESCR5; |
469 | } | 487 | } |
470 | } | 488 | } |
489 | |||
490 | for (i = 0; i < num_counters; ++i) { | ||
491 | if (!counter_config[i].enabled) | ||
492 | continue; | ||
493 | if (msrs->controls[i].addr) | ||
494 | continue; | ||
495 | op_x86_warn_reserved(i); | ||
496 | p4_shutdown(msrs); | ||
497 | return -EBUSY; | ||
498 | } | ||
499 | |||
500 | return 0; | ||
471 | } | 501 | } |
472 | 502 | ||
473 | 503 | ||
@@ -668,26 +698,6 @@ static void p4_stop(struct op_msrs const * const msrs) | |||
668 | } | 698 | } |
669 | } | 699 | } |
670 | 700 | ||
671 | static void p4_shutdown(struct op_msrs const * const msrs) | ||
672 | { | ||
673 | int i; | ||
674 | |||
675 | for (i = 0; i < num_counters; ++i) { | ||
676 | if (msrs->counters[i].addr) | ||
677 | release_perfctr_nmi(msrs->counters[i].addr); | ||
678 | } | ||
679 | /* | ||
680 | * some of the control registers are specially reserved in | ||
681 | * conjunction with the counter registers (hence the starting offset). | ||
682 | * This saves a few bits. | ||
683 | */ | ||
684 | for (i = num_counters; i < num_controls; ++i) { | ||
685 | if (msrs->controls[i].addr) | ||
686 | release_evntsel_nmi(msrs->controls[i].addr); | ||
687 | } | ||
688 | } | ||
689 | |||
690 | |||
691 | #ifdef CONFIG_SMP | 701 | #ifdef CONFIG_SMP |
692 | struct op_x86_model_spec op_p4_ht2_spec = { | 702 | struct op_x86_model_spec op_p4_ht2_spec = { |
693 | .num_counters = NUM_COUNTERS_HT2, | 703 | .num_counters = NUM_COUNTERS_HT2, |
diff --git a/arch/x86/oprofile/op_model_ppro.c b/arch/x86/oprofile/op_model_ppro.c index c8abc4d1bf35..d769cda54082 100644 --- a/arch/x86/oprofile/op_model_ppro.c +++ b/arch/x86/oprofile/op_model_ppro.c | |||
@@ -30,19 +30,46 @@ static int counter_width = 32; | |||
30 | 30 | ||
31 | static u64 *reset_value; | 31 | static u64 *reset_value; |
32 | 32 | ||
33 | static void ppro_fill_in_addresses(struct op_msrs * const msrs) | 33 | static void ppro_shutdown(struct op_msrs const * const msrs) |
34 | { | 34 | { |
35 | int i; | 35 | int i; |
36 | 36 | ||
37 | for (i = 0; i < num_counters; i++) { | 37 | for (i = 0; i < num_counters; ++i) { |
38 | if (reserve_perfctr_nmi(MSR_P6_PERFCTR0 + i)) | 38 | if (!msrs->counters[i].addr) |
39 | msrs->counters[i].addr = MSR_P6_PERFCTR0 + i; | 39 | continue; |
40 | release_perfctr_nmi(MSR_P6_PERFCTR0 + i); | ||
41 | release_evntsel_nmi(MSR_P6_EVNTSEL0 + i); | ||
42 | } | ||
43 | if (reset_value) { | ||
44 | kfree(reset_value); | ||
45 | reset_value = NULL; | ||
40 | } | 46 | } |
47 | } | ||
48 | |||
49 | static int ppro_fill_in_addresses(struct op_msrs * const msrs) | ||
50 | { | ||
51 | int i; | ||
41 | 52 | ||
42 | for (i = 0; i < num_counters; i++) { | 53 | for (i = 0; i < num_counters; i++) { |
43 | if (reserve_evntsel_nmi(MSR_P6_EVNTSEL0 + i)) | 54 | if (!reserve_perfctr_nmi(MSR_P6_PERFCTR0 + i)) |
44 | msrs->controls[i].addr = MSR_P6_EVNTSEL0 + i; | 55 | goto fail; |
56 | if (!reserve_evntsel_nmi(MSR_P6_EVNTSEL0 + i)) { | ||
57 | release_perfctr_nmi(MSR_P6_PERFCTR0 + i); | ||
58 | goto fail; | ||
59 | } | ||
60 | /* both registers must be reserved */ | ||
61 | msrs->counters[i].addr = MSR_P6_PERFCTR0 + i; | ||
62 | msrs->controls[i].addr = MSR_P6_EVNTSEL0 + i; | ||
63 | continue; | ||
64 | fail: | ||
65 | if (!counter_config[i].enabled) | ||
66 | continue; | ||
67 | op_x86_warn_reserved(i); | ||
68 | ppro_shutdown(msrs); | ||
69 | return -EBUSY; | ||
45 | } | 70 | } |
71 | |||
72 | return 0; | ||
46 | } | 73 | } |
47 | 74 | ||
48 | 75 | ||
@@ -78,26 +105,17 @@ static void ppro_setup_ctrs(struct op_x86_model_spec const *model, | |||
78 | 105 | ||
79 | /* clear all counters */ | 106 | /* clear all counters */ |
80 | for (i = 0; i < num_counters; ++i) { | 107 | for (i = 0; i < num_counters; ++i) { |
81 | if (unlikely(!msrs->controls[i].addr)) { | 108 | if (!msrs->controls[i].addr) |
82 | if (counter_config[i].enabled && !smp_processor_id()) | ||
83 | /* | ||
84 | * counter is reserved, this is on all | ||
85 | * cpus, so report only for cpu #0 | ||
86 | */ | ||
87 | op_x86_warn_reserved(i); | ||
88 | continue; | 109 | continue; |
89 | } | ||
90 | rdmsrl(msrs->controls[i].addr, val); | 110 | rdmsrl(msrs->controls[i].addr, val); |
91 | if (val & ARCH_PERFMON_EVENTSEL_ENABLE) | 111 | if (val & ARCH_PERFMON_EVENTSEL_ENABLE) |
92 | op_x86_warn_in_use(i); | 112 | op_x86_warn_in_use(i); |
93 | val &= model->reserved; | 113 | val &= model->reserved; |
94 | wrmsrl(msrs->controls[i].addr, val); | 114 | wrmsrl(msrs->controls[i].addr, val); |
95 | } | 115 | /* |
96 | 116 | * avoid a false detection of ctr overflows in NMI * | |
97 | /* avoid a false detection of ctr overflows in NMI handler */ | 117 | * handler |
98 | for (i = 0; i < num_counters; ++i) { | 118 | */ |
99 | if (unlikely(!msrs->counters[i].addr)) | ||
100 | continue; | ||
101 | wrmsrl(msrs->counters[i].addr, -1LL); | 119 | wrmsrl(msrs->counters[i].addr, -1LL); |
102 | } | 120 | } |
103 | 121 | ||
@@ -189,25 +207,6 @@ static void ppro_stop(struct op_msrs const * const msrs) | |||
189 | } | 207 | } |
190 | } | 208 | } |
191 | 209 | ||
192 | static void ppro_shutdown(struct op_msrs const * const msrs) | ||
193 | { | ||
194 | int i; | ||
195 | |||
196 | for (i = 0; i < num_counters; ++i) { | ||
197 | if (msrs->counters[i].addr) | ||
198 | release_perfctr_nmi(MSR_P6_PERFCTR0 + i); | ||
199 | } | ||
200 | for (i = 0; i < num_counters; ++i) { | ||
201 | if (msrs->controls[i].addr) | ||
202 | release_evntsel_nmi(MSR_P6_EVNTSEL0 + i); | ||
203 | } | ||
204 | if (reset_value) { | ||
205 | kfree(reset_value); | ||
206 | reset_value = NULL; | ||
207 | } | ||
208 | } | ||
209 | |||
210 | |||
211 | struct op_x86_model_spec op_ppro_spec = { | 210 | struct op_x86_model_spec op_ppro_spec = { |
212 | .num_counters = 2, | 211 | .num_counters = 2, |
213 | .num_controls = 2, | 212 | .num_controls = 2, |
diff --git a/arch/x86/oprofile/op_x86_model.h b/arch/x86/oprofile/op_x86_model.h index ff82a755edd4..89017fa1fd63 100644 --- a/arch/x86/oprofile/op_x86_model.h +++ b/arch/x86/oprofile/op_x86_model.h | |||
@@ -40,10 +40,10 @@ struct op_x86_model_spec { | |||
40 | u64 reserved; | 40 | u64 reserved; |
41 | u16 event_mask; | 41 | u16 event_mask; |
42 | int (*init)(struct oprofile_operations *ops); | 42 | int (*init)(struct oprofile_operations *ops); |
43 | void (*exit)(void); | 43 | int (*fill_in_addresses)(struct op_msrs * const msrs); |
44 | void (*fill_in_addresses)(struct op_msrs * const msrs); | ||
45 | void (*setup_ctrs)(struct op_x86_model_spec const *model, | 44 | void (*setup_ctrs)(struct op_x86_model_spec const *model, |
46 | struct op_msrs const * const msrs); | 45 | struct op_msrs const * const msrs); |
46 | void (*cpu_down)(void); | ||
47 | int (*check_ctrs)(struct pt_regs * const regs, | 47 | int (*check_ctrs)(struct pt_regs * const regs, |
48 | struct op_msrs const * const msrs); | 48 | struct op_msrs const * const msrs); |
49 | void (*start)(struct op_msrs const * const msrs); | 49 | void (*start)(struct op_msrs const * const msrs); |
diff --git a/arch/x86/pci/mrst.c b/arch/x86/pci/mrst.c index 8bf2fcb88d04..7ef3a2735df3 100644 --- a/arch/x86/pci/mrst.c +++ b/arch/x86/pci/mrst.c | |||
@@ -109,7 +109,7 @@ static int pci_device_update_fixed(struct pci_bus *bus, unsigned int devfn, | |||
109 | decode++; | 109 | decode++; |
110 | decode = ~(decode - 1); | 110 | decode = ~(decode - 1); |
111 | } else { | 111 | } else { |
112 | decode = ~0; | 112 | decode = 0; |
113 | } | 113 | } |
114 | 114 | ||
115 | /* | 115 | /* |
@@ -247,6 +247,10 @@ static void __devinit pci_fixed_bar_fixup(struct pci_dev *dev) | |||
247 | u32 size; | 247 | u32 size; |
248 | int i; | 248 | int i; |
249 | 249 | ||
250 | /* Must have extended configuration space */ | ||
251 | if (dev->cfg_size < PCIE_CAP_OFFSET + 4) | ||
252 | return; | ||
253 | |||
250 | /* Fixup the BAR sizes for fixed BAR devices and make them unmoveable */ | 254 | /* Fixup the BAR sizes for fixed BAR devices and make them unmoveable */ |
251 | offset = fixed_bar_cap(dev->bus, dev->devfn); | 255 | offset = fixed_bar_cap(dev->bus, dev->devfn); |
252 | if (!offset || PCI_DEVFN(2, 0) == dev->devfn || | 256 | if (!offset || PCI_DEVFN(2, 0) == dev->devfn || |
diff --git a/arch/xtensa/include/asm/atomic.h b/arch/xtensa/include/asm/atomic.h index 22d6dde42619..a96a0619d0b7 100644 --- a/arch/xtensa/include/asm/atomic.h +++ b/arch/xtensa/include/asm/atomic.h | |||
@@ -46,7 +46,7 @@ | |||
46 | * | 46 | * |
47 | * Atomically reads the value of @v. | 47 | * Atomically reads the value of @v. |
48 | */ | 48 | */ |
49 | #define atomic_read(v) ((v)->counter) | 49 | #define atomic_read(v) (*(volatile int *)&(v)->counter) |
50 | 50 | ||
51 | /** | 51 | /** |
52 | * atomic_set - set atomic variable | 52 | * atomic_set - set atomic variable |