aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-06-07 12:35:54 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-06-07 12:35:54 -0400
commit7244d545c123ff33a3a5bff7fcb96a07778c32d1 (patch)
treec4d2893faa844e4cd6e2b47bbd2663dc28d9af83
parent143a275984b37058d2d3ab1ec0e5be9026fda24d (diff)
parente7e8cc5ae63c39dbbbb5f14c5120bdf2d931fac9 (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6
* 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6: [VIDEO] sunxvr500fb: Fix pseudo_palette array size [VIDEO] sunxvr2500fb: Fix pseudo_palette array size [VIDEO] ffb: The pseudo_palette is only 16 elements long [VIDEO]: Fix section mismatch warning in promcon. [ATA]: Back out bogus (SPARC64 && !PCI) Kconfig depends. [SPARC64]: Fill in gaps in non-PCI dma_*() NOP implementation. [SPARC64]: Fix {mc,smt}_capable(). [SPARC64]: Make core and sibling groups equal on UltraSPARC-IV. [SPARC64]: Proper multi-core scheduling support. [SPARC64]: Provide mmu statistics via sysfs. [SPARC64]: Fix service channel hypervisor function names. [SPARC64]: Export basic cpu properties via sysfs. [SPARC64]: Move topology init code into new file, sysfs.c
-rw-r--r--arch/sparc64/Kconfig9
-rw-r--r--arch/sparc64/kernel/Makefile4
-rw-r--r--arch/sparc64/kernel/entry.S62
-rw-r--r--arch/sparc64/kernel/mdesc.c53
-rw-r--r--arch/sparc64/kernel/prom.c5
-rw-r--r--arch/sparc64/kernel/setup.c19
-rw-r--r--arch/sparc64/kernel/smp.c21
-rw-r--r--arch/sparc64/kernel/sysfs.c297
-rw-r--r--drivers/ata/Kconfig1
-rw-r--r--drivers/video/console/Makefile2
-rw-r--r--drivers/video/ffb.c4
-rw-r--r--drivers/video/sunxvr2500.c17
-rw-r--r--drivers/video/sunxvr500.c6
-rw-r--r--include/asm-sparc64/cpudata.h2
-rw-r--r--include/asm-sparc64/dma-mapping.h83
-rw-r--r--include/asm-sparc64/hypervisor.h5
-rw-r--r--include/asm-sparc64/smp.h2
-rw-r--r--include/asm-sparc64/topology.h13
18 files changed, 543 insertions, 62 deletions
diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig
index bd00f89eed1e..89a1b469b93d 100644
--- a/arch/sparc64/Kconfig
+++ b/arch/sparc64/Kconfig
@@ -396,6 +396,15 @@ config SCHED_SMT
396 when dealing with UltraSPARC cpus at a cost of slightly increased 396 when dealing with UltraSPARC cpus at a cost of slightly increased
397 overhead in some places. If unsure say N here. 397 overhead in some places. If unsure say N here.
398 398
399config SCHED_MC
400 bool "Multi-core scheduler support"
401 depends on SMP
402 default y
403 help
404 Multi-core scheduler support improves the CPU scheduler's decision
405 making when dealing with multi-core CPU chips at a cost of slightly
406 increased overhead in some places. If unsure say N here.
407
399source "kernel/Kconfig.preempt" 408source "kernel/Kconfig.preempt"
400 409
401config CMDLINE_BOOL 410config CMDLINE_BOOL
diff --git a/arch/sparc64/kernel/Makefile b/arch/sparc64/kernel/Makefile
index d8d19093d12f..f964bf28d21a 100644
--- a/arch/sparc64/kernel/Makefile
+++ b/arch/sparc64/kernel/Makefile
@@ -1,4 +1,4 @@
1# $Id: Makefile,v 1.70 2002/02/09 19:49:30 davem Exp $ 1#
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4 4
@@ -8,7 +8,7 @@ EXTRA_CFLAGS := -Werror
8extra-y := head.o init_task.o vmlinux.lds 8extra-y := head.o init_task.o vmlinux.lds
9 9
10obj-y := process.o setup.o cpu.o idprom.o \ 10obj-y := process.o setup.o cpu.o idprom.o \
11 traps.o auxio.o una_asm.o \ 11 traps.o auxio.o una_asm.o sysfs.o \
12 irq.o ptrace.o time.o sys_sparc.o signal.o \ 12 irq.o ptrace.o time.o sys_sparc.o signal.o \
13 unaligned.o central.o pci.o starfire.o semaphore.o \ 13 unaligned.o central.o pci.o starfire.o semaphore.o \
14 power.o sbus.o iommu_common.o sparc64_ksyms.o chmc.o \ 14 power.o sbus.o iommu_common.o sparc64_ksyms.o chmc.o \
diff --git a/arch/sparc64/kernel/entry.S b/arch/sparc64/kernel/entry.S
index ed712e0b3372..7d1a11822a1e 100644
--- a/arch/sparc64/kernel/entry.S
+++ b/arch/sparc64/kernel/entry.S
@@ -2514,9 +2514,9 @@ sun4v_ncs_request:
2514 nop 2514 nop
2515 .size sun4v_ncs_request, .-sun4v_ncs_request 2515 .size sun4v_ncs_request, .-sun4v_ncs_request
2516 2516
2517 .globl sun4v_scv_send 2517 .globl sun4v_svc_send
2518 .type sun4v_scv_send,#function 2518 .type sun4v_svc_send,#function
2519sun4v_scv_send: 2519sun4v_svc_send:
2520 save %sp, -192, %sp 2520 save %sp, -192, %sp
2521 mov %i0, %o0 2521 mov %i0, %o0
2522 mov %i1, %o1 2522 mov %i1, %o1
@@ -2526,11 +2526,11 @@ sun4v_scv_send:
2526 stx %o1, [%i3] 2526 stx %o1, [%i3]
2527 ret 2527 ret
2528 restore 2528 restore
2529 .size sun4v_scv_send, .-sun4v_scv_send 2529 .size sun4v_svc_send, .-sun4v_svc_send
2530 2530
2531 .globl sun4v_scv_recv 2531 .globl sun4v_svc_recv
2532 .type sun4v_scv_recv,#function 2532 .type sun4v_svc_recv,#function
2533sun4v_scv_recv: 2533sun4v_svc_recv:
2534 save %sp, -192, %sp 2534 save %sp, -192, %sp
2535 mov %i0, %o0 2535 mov %i0, %o0
2536 mov %i1, %o1 2536 mov %i1, %o1
@@ -2540,33 +2540,55 @@ sun4v_scv_recv:
2540 stx %o1, [%i3] 2540 stx %o1, [%i3]
2541 ret 2541 ret
2542 restore 2542 restore
2543 .size sun4v_scv_recv, .-sun4v_scv_recv 2543 .size sun4v_svc_recv, .-sun4v_svc_recv
2544 2544
2545 .globl sun4v_scv_getstatus 2545 .globl sun4v_svc_getstatus
2546 .type sun4v_scv_getstatus,#function 2546 .type sun4v_svc_getstatus,#function
2547sun4v_scv_getstatus: 2547sun4v_svc_getstatus:
2548 mov HV_FAST_SVC_GETSTATUS, %o5 2548 mov HV_FAST_SVC_GETSTATUS, %o5
2549 mov %o1, %o4 2549 mov %o1, %o4
2550 ta HV_FAST_TRAP 2550 ta HV_FAST_TRAP
2551 stx %o1, [%o4] 2551 stx %o1, [%o4]
2552 retl 2552 retl
2553 nop 2553 nop
2554 .size sun4v_scv_getstatus, .-sun4v_scv_getstatus 2554 .size sun4v_svc_getstatus, .-sun4v_svc_getstatus
2555 2555
2556 .globl sun4v_scv_setstatus 2556 .globl sun4v_svc_setstatus
2557 .type sun4v_scv_setstatus,#function 2557 .type sun4v_svc_setstatus,#function
2558sun4v_scv_setstatus: 2558sun4v_svc_setstatus:
2559 mov HV_FAST_SVC_SETSTATUS, %o5 2559 mov HV_FAST_SVC_SETSTATUS, %o5
2560 ta HV_FAST_TRAP 2560 ta HV_FAST_TRAP
2561 retl 2561 retl
2562 nop 2562 nop
2563 .size sun4v_scv_setstatus, .-sun4v_scv_setstatus 2563 .size sun4v_svc_setstatus, .-sun4v_svc_setstatus
2564 2564
2565 .globl sun4v_scv_clrstatus 2565 .globl sun4v_svc_clrstatus
2566 .type sun4v_scv_clrstatus,#function 2566 .type sun4v_svc_clrstatus,#function
2567sun4v_scv_clrstatus: 2567sun4v_svc_clrstatus:
2568 mov HV_FAST_SVC_CLRSTATUS, %o5 2568 mov HV_FAST_SVC_CLRSTATUS, %o5
2569 ta HV_FAST_TRAP 2569 ta HV_FAST_TRAP
2570 retl 2570 retl
2571 nop 2571 nop
2572 .size sun4v_scv_clrstatus, .-sun4v_scv_clrstatus 2572 .size sun4v_svc_clrstatus, .-sun4v_svc_clrstatus
2573
2574 .globl sun4v_mmustat_conf
2575 .type sun4v_mmustat_conf,#function
2576sun4v_mmustat_conf:
2577 mov %o1, %o4
2578 mov HV_FAST_MMUSTAT_CONF, %o5
2579 ta HV_FAST_TRAP
2580 stx %o1, [%o4]
2581 retl
2582 nop
2583 .size sun4v_mmustat_conf, .-sun4v_mmustat_conf
2584
2585 .globl sun4v_mmustat_info
2586 .type sun4v_mmustat_info,#function
2587sun4v_mmustat_info:
2588 mov %o0, %o4
2589 mov HV_FAST_MMUSTAT_INFO, %o5
2590 ta HV_FAST_TRAP
2591 stx %o1, [%o4]
2592 retl
2593 nop
2594 .size sun4v_mmustat_info, .-sun4v_mmustat_info
diff --git a/arch/sparc64/kernel/mdesc.c b/arch/sparc64/kernel/mdesc.c
index 9246c2cf9574..f0e16045fb16 100644
--- a/arch/sparc64/kernel/mdesc.c
+++ b/arch/sparc64/kernel/mdesc.c
@@ -473,6 +473,53 @@ static void __init set_core_ids(void)
473 } 473 }
474} 474}
475 475
476static void __init mark_proc_ids(struct mdesc_node *mp, int proc_id)
477{
478 int i;
479
480 for (i = 0; i < mp->num_arcs; i++) {
481 struct mdesc_node *t = mp->arcs[i].arc;
482 const u64 *id;
483
484 if (strcmp(mp->arcs[i].name, "back"))
485 continue;
486
487 if (strcmp(t->name, "cpu"))
488 continue;
489
490 id = md_get_property(t, "id", NULL);
491 if (*id < NR_CPUS)
492 cpu_data(*id).proc_id = proc_id;
493 }
494}
495
496static void __init __set_proc_ids(const char *exec_unit_name)
497{
498 struct mdesc_node *mp;
499 int idx;
500
501 idx = 0;
502 md_for_each_node_by_name(mp, exec_unit_name) {
503 const char *type;
504 int len;
505
506 type = md_get_property(mp, "type", &len);
507 if (!find_in_proplist(type, "int", len) &&
508 !find_in_proplist(type, "integer", len))
509 continue;
510
511 mark_proc_ids(mp, idx);
512
513 idx++;
514 }
515}
516
517static void __init set_proc_ids(void)
518{
519 __set_proc_ids("exec_unit");
520 __set_proc_ids("exec-unit");
521}
522
476static void __init get_one_mondo_bits(const u64 *p, unsigned int *mask, unsigned char def) 523static void __init get_one_mondo_bits(const u64 *p, unsigned int *mask, unsigned char def)
477{ 524{
478 u64 val; 525 u64 val;
@@ -574,9 +621,15 @@ static void __init mdesc_fill_in_cpu_data(void)
574#endif 621#endif
575 622
576 c->core_id = 0; 623 c->core_id = 0;
624 c->proc_id = -1;
577 } 625 }
578 626
627#ifdef CONFIG_SMP
628 sparc64_multi_core = 1;
629#endif
630
579 set_core_ids(); 631 set_core_ids();
632 set_proc_ids();
580 633
581 smp_fill_in_sib_core_maps(); 634 smp_fill_in_sib_core_maps();
582} 635}
diff --git a/arch/sparc64/kernel/prom.c b/arch/sparc64/kernel/prom.c
index dad4b3ba705f..6f4a5284b0ea 100644
--- a/arch/sparc64/kernel/prom.c
+++ b/arch/sparc64/kernel/prom.c
@@ -1781,6 +1781,10 @@ static void __init of_fill_in_cpu_data(void)
1781 } 1781 }
1782 1782
1783 cpu_data(cpuid).core_id = portid + 1; 1783 cpu_data(cpuid).core_id = portid + 1;
1784 cpu_data(cpuid).proc_id = portid;
1785#ifdef CONFIG_SMP
1786 sparc64_multi_core = 1;
1787#endif
1784 } else { 1788 } else {
1785 cpu_data(cpuid).dcache_size = 1789 cpu_data(cpuid).dcache_size =
1786 of_getintprop_default(dp, "dcache-size", 16 * 1024); 1790 of_getintprop_default(dp, "dcache-size", 16 * 1024);
@@ -1799,6 +1803,7 @@ static void __init of_fill_in_cpu_data(void)
1799 of_getintprop_default(dp, "ecache-line-size", 64); 1803 of_getintprop_default(dp, "ecache-line-size", 64);
1800 1804
1801 cpu_data(cpuid).core_id = 0; 1805 cpu_data(cpuid).core_id = 0;
1806 cpu_data(cpuid).proc_id = -1;
1802 } 1807 }
1803 1808
1804#ifdef CONFIG_SMP 1809#ifdef CONFIG_SMP
diff --git a/arch/sparc64/kernel/setup.c b/arch/sparc64/kernel/setup.c
index de9b4c13f1c7..7490cc670a53 100644
--- a/arch/sparc64/kernel/setup.c
+++ b/arch/sparc64/kernel/setup.c
@@ -513,22 +513,3 @@ void sun_do_break(void)
513 513
514int serial_console = -1; 514int serial_console = -1;
515int stop_a_enabled = 1; 515int stop_a_enabled = 1;
516
517static int __init topology_init(void)
518{
519 int i, err;
520
521 err = -ENOMEM;
522
523 for_each_possible_cpu(i) {
524 struct cpu *p = kzalloc(sizeof(*p), GFP_KERNEL);
525 if (p) {
526 register_cpu(p, i);
527 err = 0;
528 }
529 }
530
531 return err;
532}
533
534subsys_initcall(topology_init);
diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c
index c550bba3490a..4dcd7d0b60f2 100644
--- a/arch/sparc64/kernel/smp.c
+++ b/arch/sparc64/kernel/smp.c
@@ -44,6 +44,8 @@
44 44
45extern void calibrate_delay(void); 45extern void calibrate_delay(void);
46 46
47int sparc64_multi_core __read_mostly;
48
47/* Please don't make this stuff initdata!!! --DaveM */ 49/* Please don't make this stuff initdata!!! --DaveM */
48unsigned char boot_cpu_id; 50unsigned char boot_cpu_id;
49 51
@@ -51,6 +53,8 @@ cpumask_t cpu_online_map __read_mostly = CPU_MASK_NONE;
51cpumask_t phys_cpu_present_map __read_mostly = CPU_MASK_NONE; 53cpumask_t phys_cpu_present_map __read_mostly = CPU_MASK_NONE;
52cpumask_t cpu_sibling_map[NR_CPUS] __read_mostly = 54cpumask_t cpu_sibling_map[NR_CPUS] __read_mostly =
53 { [0 ... NR_CPUS-1] = CPU_MASK_NONE }; 55 { [0 ... NR_CPUS-1] = CPU_MASK_NONE };
56cpumask_t cpu_core_map[NR_CPUS] __read_mostly =
57 { [0 ... NR_CPUS-1] = CPU_MASK_NONE };
54static cpumask_t smp_commenced_mask; 58static cpumask_t smp_commenced_mask;
55static cpumask_t cpu_callout_map; 59static cpumask_t cpu_callout_map;
56 60
@@ -1217,13 +1221,28 @@ void __devinit smp_fill_in_sib_core_maps(void)
1217 unsigned int j; 1221 unsigned int j;
1218 1222
1219 if (cpu_data(i).core_id == 0) { 1223 if (cpu_data(i).core_id == 0) {
1220 cpu_set(i, cpu_sibling_map[i]); 1224 cpu_set(i, cpu_core_map[i]);
1221 continue; 1225 continue;
1222 } 1226 }
1223 1227
1224 for_each_possible_cpu(j) { 1228 for_each_possible_cpu(j) {
1225 if (cpu_data(i).core_id == 1229 if (cpu_data(i).core_id ==
1226 cpu_data(j).core_id) 1230 cpu_data(j).core_id)
1231 cpu_set(j, cpu_core_map[i]);
1232 }
1233 }
1234
1235 for_each_possible_cpu(i) {
1236 unsigned int j;
1237
1238 if (cpu_data(i).proc_id == -1) {
1239 cpu_set(i, cpu_sibling_map[i]);
1240 continue;
1241 }
1242
1243 for_each_possible_cpu(j) {
1244 if (cpu_data(i).proc_id ==
1245 cpu_data(j).proc_id)
1227 cpu_set(j, cpu_sibling_map[i]); 1246 cpu_set(j, cpu_sibling_map[i]);
1228 } 1247 }
1229 } 1248 }
diff --git a/arch/sparc64/kernel/sysfs.c b/arch/sparc64/kernel/sysfs.c
new file mode 100644
index 000000000000..cdb1477af89f
--- /dev/null
+++ b/arch/sparc64/kernel/sysfs.c
@@ -0,0 +1,297 @@
1/* sysfs.c: Toplogy sysfs support code for sparc64.
2 *
3 * Copyright (C) 2007 David S. Miller <davem@davemloft.net>
4 */
5#include <linux/sysdev.h>
6#include <linux/cpu.h>
7#include <linux/smp.h>
8#include <linux/percpu.h>
9#include <linux/init.h>
10
11#include <asm/hypervisor.h>
12#include <asm/spitfire.h>
13
14static DEFINE_PER_CPU(struct hv_mmu_statistics, mmu_stats) __attribute__((aligned(64)));
15
16#define SHOW_MMUSTAT_ULONG(NAME) \
17static ssize_t show_##NAME(struct sys_device *dev, char *buf) \
18{ \
19 struct hv_mmu_statistics *p = &per_cpu(mmu_stats, dev->id); \
20 return sprintf(buf, "%lu\n", p->NAME); \
21} \
22static SYSDEV_ATTR(NAME, 0444, show_##NAME, NULL)
23
24SHOW_MMUSTAT_ULONG(immu_tsb_hits_ctx0_8k_tte);
25SHOW_MMUSTAT_ULONG(immu_tsb_ticks_ctx0_8k_tte);
26SHOW_MMUSTAT_ULONG(immu_tsb_hits_ctx0_64k_tte);
27SHOW_MMUSTAT_ULONG(immu_tsb_ticks_ctx0_64k_tte);
28SHOW_MMUSTAT_ULONG(immu_tsb_hits_ctx0_4mb_tte);
29SHOW_MMUSTAT_ULONG(immu_tsb_ticks_ctx0_4mb_tte);
30SHOW_MMUSTAT_ULONG(immu_tsb_hits_ctx0_256mb_tte);
31SHOW_MMUSTAT_ULONG(immu_tsb_ticks_ctx0_256mb_tte);
32SHOW_MMUSTAT_ULONG(immu_tsb_hits_ctxnon0_8k_tte);
33SHOW_MMUSTAT_ULONG(immu_tsb_ticks_ctxnon0_8k_tte);
34SHOW_MMUSTAT_ULONG(immu_tsb_hits_ctxnon0_64k_tte);
35SHOW_MMUSTAT_ULONG(immu_tsb_ticks_ctxnon0_64k_tte);
36SHOW_MMUSTAT_ULONG(immu_tsb_hits_ctxnon0_4mb_tte);
37SHOW_MMUSTAT_ULONG(immu_tsb_ticks_ctxnon0_4mb_tte);
38SHOW_MMUSTAT_ULONG(immu_tsb_hits_ctxnon0_256mb_tte);
39SHOW_MMUSTAT_ULONG(immu_tsb_ticks_ctxnon0_256mb_tte);
40SHOW_MMUSTAT_ULONG(dmmu_tsb_hits_ctx0_8k_tte);
41SHOW_MMUSTAT_ULONG(dmmu_tsb_ticks_ctx0_8k_tte);
42SHOW_MMUSTAT_ULONG(dmmu_tsb_hits_ctx0_64k_tte);
43SHOW_MMUSTAT_ULONG(dmmu_tsb_ticks_ctx0_64k_tte);
44SHOW_MMUSTAT_ULONG(dmmu_tsb_hits_ctx0_4mb_tte);
45SHOW_MMUSTAT_ULONG(dmmu_tsb_ticks_ctx0_4mb_tte);
46SHOW_MMUSTAT_ULONG(dmmu_tsb_hits_ctx0_256mb_tte);
47SHOW_MMUSTAT_ULONG(dmmu_tsb_ticks_ctx0_256mb_tte);
48SHOW_MMUSTAT_ULONG(dmmu_tsb_hits_ctxnon0_8k_tte);
49SHOW_MMUSTAT_ULONG(dmmu_tsb_ticks_ctxnon0_8k_tte);
50SHOW_MMUSTAT_ULONG(dmmu_tsb_hits_ctxnon0_64k_tte);
51SHOW_MMUSTAT_ULONG(dmmu_tsb_ticks_ctxnon0_64k_tte);
52SHOW_MMUSTAT_ULONG(dmmu_tsb_hits_ctxnon0_4mb_tte);
53SHOW_MMUSTAT_ULONG(dmmu_tsb_ticks_ctxnon0_4mb_tte);
54SHOW_MMUSTAT_ULONG(dmmu_tsb_hits_ctxnon0_256mb_tte);
55SHOW_MMUSTAT_ULONG(dmmu_tsb_ticks_ctxnon0_256mb_tte);
56
57static struct attribute *mmu_stat_attrs[] = {
58 &attr_immu_tsb_hits_ctx0_8k_tte.attr,
59 &attr_immu_tsb_ticks_ctx0_8k_tte.attr,
60 &attr_immu_tsb_hits_ctx0_64k_tte.attr,
61 &attr_immu_tsb_ticks_ctx0_64k_tte.attr,
62 &attr_immu_tsb_hits_ctx0_4mb_tte.attr,
63 &attr_immu_tsb_ticks_ctx0_4mb_tte.attr,
64 &attr_immu_tsb_hits_ctx0_256mb_tte.attr,
65 &attr_immu_tsb_ticks_ctx0_256mb_tte.attr,
66 &attr_immu_tsb_hits_ctxnon0_8k_tte.attr,
67 &attr_immu_tsb_ticks_ctxnon0_8k_tte.attr,
68 &attr_immu_tsb_hits_ctxnon0_64k_tte.attr,
69 &attr_immu_tsb_ticks_ctxnon0_64k_tte.attr,
70 &attr_immu_tsb_hits_ctxnon0_4mb_tte.attr,
71 &attr_immu_tsb_ticks_ctxnon0_4mb_tte.attr,
72 &attr_immu_tsb_hits_ctxnon0_256mb_tte.attr,
73 &attr_immu_tsb_ticks_ctxnon0_256mb_tte.attr,
74 &attr_dmmu_tsb_hits_ctx0_8k_tte.attr,
75 &attr_dmmu_tsb_ticks_ctx0_8k_tte.attr,
76 &attr_dmmu_tsb_hits_ctx0_64k_tte.attr,
77 &attr_dmmu_tsb_ticks_ctx0_64k_tte.attr,
78 &attr_dmmu_tsb_hits_ctx0_4mb_tte.attr,
79 &attr_dmmu_tsb_ticks_ctx0_4mb_tte.attr,
80 &attr_dmmu_tsb_hits_ctx0_256mb_tte.attr,
81 &attr_dmmu_tsb_ticks_ctx0_256mb_tte.attr,
82 &attr_dmmu_tsb_hits_ctxnon0_8k_tte.attr,
83 &attr_dmmu_tsb_ticks_ctxnon0_8k_tte.attr,
84 &attr_dmmu_tsb_hits_ctxnon0_64k_tte.attr,
85 &attr_dmmu_tsb_ticks_ctxnon0_64k_tte.attr,
86 &attr_dmmu_tsb_hits_ctxnon0_4mb_tte.attr,
87 &attr_dmmu_tsb_ticks_ctxnon0_4mb_tte.attr,
88 &attr_dmmu_tsb_hits_ctxnon0_256mb_tte.attr,
89 &attr_dmmu_tsb_ticks_ctxnon0_256mb_tte.attr,
90 NULL,
91};
92
93static struct attribute_group mmu_stat_group = {
94 .attrs = mmu_stat_attrs,
95 .name = "mmu_stats",
96};
97
98/* XXX convert to rusty's on_one_cpu */
99static unsigned long run_on_cpu(unsigned long cpu,
100 unsigned long (*func)(unsigned long),
101 unsigned long arg)
102{
103 cpumask_t old_affinity = current->cpus_allowed;
104 unsigned long ret;
105
106 /* should return -EINVAL to userspace */
107 if (set_cpus_allowed(current, cpumask_of_cpu(cpu)))
108 return 0;
109
110 ret = func(arg);
111
112 set_cpus_allowed(current, old_affinity);
113
114 return ret;
115}
116
117static unsigned long read_mmustat_enable(unsigned long junk)
118{
119 unsigned long ra = 0;
120
121 sun4v_mmustat_info(&ra);
122
123 return ra != 0;
124}
125
126static unsigned long write_mmustat_enable(unsigned long val)
127{
128 unsigned long ra, orig_ra;
129
130 if (val)
131 ra = __pa(&per_cpu(mmu_stats, smp_processor_id()));
132 else
133 ra = 0UL;
134
135 return sun4v_mmustat_conf(ra, &orig_ra);
136}
137
138static ssize_t show_mmustat_enable(struct sys_device *s, char *buf)
139{
140 unsigned long val = run_on_cpu(s->id, read_mmustat_enable, 0);
141 return sprintf(buf, "%lx\n", val);
142}
143
144static ssize_t store_mmustat_enable(struct sys_device *s, const char *buf, size_t count)
145{
146 unsigned long val, err;
147 int ret = sscanf(buf, "%ld", &val);
148
149 if (ret != 1)
150 return -EINVAL;
151
152 err = run_on_cpu(s->id, write_mmustat_enable, val);
153 if (err)
154 return -EIO;
155
156 return count;
157}
158
159static SYSDEV_ATTR(mmustat_enable, 0644, show_mmustat_enable, store_mmustat_enable);
160
161static int mmu_stats_supported;
162
163static int register_mmu_stats(struct sys_device *s)
164{
165 if (!mmu_stats_supported)
166 return 0;
167 sysdev_create_file(s, &attr_mmustat_enable);
168 return sysfs_create_group(&s->kobj, &mmu_stat_group);
169}
170
171#ifdef CONFIG_HOTPLUG_CPU
172static void unregister_mmu_stats(struct sys_device *s)
173{
174 if (!mmu_stats_supported)
175 return;
176 sysfs_remove_group(&s->kobj, &mmu_stat_group);
177 sysdev_remove_file(s, &attr_mmustat_enable);
178}
179#endif
180
181#define SHOW_CPUDATA_ULONG_NAME(NAME, MEMBER) \
182static ssize_t show_##NAME(struct sys_device *dev, char *buf) \
183{ \
184 cpuinfo_sparc *c = &cpu_data(dev->id); \
185 return sprintf(buf, "%lu\n", c->MEMBER); \
186}
187
188#define SHOW_CPUDATA_UINT_NAME(NAME, MEMBER) \
189static ssize_t show_##NAME(struct sys_device *dev, char *buf) \
190{ \
191 cpuinfo_sparc *c = &cpu_data(dev->id); \
192 return sprintf(buf, "%u\n", c->MEMBER); \
193}
194
195SHOW_CPUDATA_ULONG_NAME(clock_tick, clock_tick);
196SHOW_CPUDATA_ULONG_NAME(udelay_val, udelay_val);
197SHOW_CPUDATA_UINT_NAME(l1_dcache_size, dcache_size);
198SHOW_CPUDATA_UINT_NAME(l1_dcache_line_size, dcache_line_size);
199SHOW_CPUDATA_UINT_NAME(l1_icache_size, icache_size);
200SHOW_CPUDATA_UINT_NAME(l1_icache_line_size, icache_line_size);
201SHOW_CPUDATA_UINT_NAME(l2_cache_size, ecache_size);
202SHOW_CPUDATA_UINT_NAME(l2_cache_line_size, ecache_line_size);
203
204static struct sysdev_attribute cpu_core_attrs[] = {
205 _SYSDEV_ATTR(clock_tick, 0444, show_clock_tick, NULL),
206 _SYSDEV_ATTR(udelay_val, 0444, show_udelay_val, NULL),
207 _SYSDEV_ATTR(l1_dcache_size, 0444, show_l1_dcache_size, NULL),
208 _SYSDEV_ATTR(l1_dcache_line_size, 0444, show_l1_dcache_line_size, NULL),
209 _SYSDEV_ATTR(l1_icache_size, 0444, show_l1_icache_size, NULL),
210 _SYSDEV_ATTR(l1_icache_line_size, 0444, show_l1_icache_line_size, NULL),
211 _SYSDEV_ATTR(l2_cache_size, 0444, show_l2_cache_size, NULL),
212 _SYSDEV_ATTR(l2_cache_line_size, 0444, show_l2_cache_line_size, NULL),
213};
214
215static DEFINE_PER_CPU(struct cpu, cpu_devices);
216
217static void register_cpu_online(unsigned int cpu)
218{
219 struct cpu *c = &per_cpu(cpu_devices, cpu);
220 struct sys_device *s = &c->sysdev;
221 int i;
222
223 for (i = 0; i < ARRAY_SIZE(cpu_core_attrs); i++)
224 sysdev_create_file(s, &cpu_core_attrs[i]);
225
226 register_mmu_stats(s);
227}
228
229#ifdef CONFIG_HOTPLUG_CPU
230static void unregister_cpu_online(unsigned int cpu)
231{
232 struct cpu *c = &per_cpu(cpu_devices, cpu);
233 struct sys_device *s = &c->sysdev;
234 int i;
235
236 unregister_mmu_stats(s);
237 for (i = 0; i < ARRAY_SIZE(cpu_core_attrs); i++)
238 sysdev_remove_file(s, &cpu_core_attrs[i]);
239}
240#endif
241
242static int __cpuinit sysfs_cpu_notify(struct notifier_block *self,
243 unsigned long action, void *hcpu)
244{
245 unsigned int cpu = (unsigned int)(long)hcpu;
246
247 switch (action) {
248 case CPU_ONLINE:
249 case CPU_ONLINE_FROZEN:
250 register_cpu_online(cpu);
251 break;
252#ifdef CONFIG_HOTPLUG_CPU
253 case CPU_DEAD:
254 case CPU_DEAD_FROZEN:
255 unregister_cpu_online(cpu);
256 break;
257#endif
258 }
259 return NOTIFY_OK;
260}
261
262static struct notifier_block __cpuinitdata sysfs_cpu_nb = {
263 .notifier_call = sysfs_cpu_notify,
264};
265
266static void __init check_mmu_stats(void)
267{
268 unsigned long dummy1, err;
269
270 if (tlb_type != hypervisor)
271 return;
272
273 err = sun4v_mmustat_info(&dummy1);
274 if (!err)
275 mmu_stats_supported = 1;
276}
277
278static int __init topology_init(void)
279{
280 int cpu;
281
282 check_mmu_stats();
283
284 register_cpu_notifier(&sysfs_cpu_nb);
285
286 for_each_possible_cpu(cpu) {
287 struct cpu *c = &per_cpu(cpu_devices, cpu);
288
289 register_cpu(c, cpu);
290 if (cpu_online(cpu))
291 register_cpu_online(cpu);
292 }
293
294 return 0;
295}
296
297subsys_initcall(topology_init);
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index 7d893a60f994..b4a8d6030e48 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -8,7 +8,6 @@ menuconfig ATA
8 depends on BLOCK 8 depends on BLOCK
9 depends on !(M32R || M68K) || BROKEN 9 depends on !(M32R || M68K) || BROKEN
10 depends on !SUN4 || BROKEN 10 depends on !SUN4 || BROKEN
11 depends on !(SPARC64 && !PCI)
12 select SCSI 11 select SCSI
13 ---help--- 12 ---help---
14 If you want to use a ATA hard disk, ATA tape drive, ATA CD-ROM or 13 If you want to use a ATA hard disk, ATA tape drive, ATA CD-ROM or
diff --git a/drivers/video/console/Makefile b/drivers/video/console/Makefile
index 9b26dda18a38..ac46cc3f6a2a 100644
--- a/drivers/video/console/Makefile
+++ b/drivers/video/console/Makefile
@@ -47,7 +47,7 @@ targets := promcon_tbl.c
47quiet_cmd_conmakehash = CNMKHSH $@ 47quiet_cmd_conmakehash = CNMKHSH $@
48 cmd_conmakehash = scripts/conmakehash $< | \ 48 cmd_conmakehash = scripts/conmakehash $< | \
49 sed -e '/\#include <[^>]*>/p' -e 's/types/init/' \ 49 sed -e '/\#include <[^>]*>/p' -e 's/types/init/' \
50 -e 's/dfont\(_uni.*\]\)/promfont\1 __initdata/' > $@ 50 -e 's/dfont\(_uni.*\]\)/promfont\1 /' > $@
51 51
52$(obj)/promcon_tbl.c: $(src)/prom.uni 52$(obj)/promcon_tbl.c: $(src)/prom.uni
53 $(call cmd,conmakehash) 53 $(call cmd,conmakehash)
diff --git a/drivers/video/ffb.c b/drivers/video/ffb.c
index 1d4e8354b561..3f6c98fad437 100644
--- a/drivers/video/ffb.c
+++ b/drivers/video/ffb.c
@@ -656,7 +656,7 @@ static int ffb_setcolreg(unsigned regno,
656{ 656{
657 u32 value; 657 u32 value;
658 658
659 if (regno >= 256) 659 if (regno >= 16)
660 return 1; 660 return 1;
661 661
662 red >>= 8; 662 red >>= 8;
@@ -903,7 +903,7 @@ ffb_init_fix(struct fb_info *info)
903struct all_info { 903struct all_info {
904 struct fb_info info; 904 struct fb_info info;
905 struct ffb_par par; 905 struct ffb_par par;
906 u32 pseudo_palette[256]; 906 u32 pseudo_palette[16];
907}; 907};
908 908
909static int ffb_init_one(struct of_device *op) 909static int ffb_init_one(struct of_device *op)
diff --git a/drivers/video/sunxvr2500.c b/drivers/video/sunxvr2500.c
index 4316c7fe8e21..c3869a96ab58 100644
--- a/drivers/video/sunxvr2500.c
+++ b/drivers/video/sunxvr2500.c
@@ -28,7 +28,7 @@ struct s3d_info {
28 unsigned int depth; 28 unsigned int depth;
29 unsigned int fb_size; 29 unsigned int fb_size;
30 30
31 u32 pseudo_palette[256]; 31 u32 pseudo_palette[16];
32}; 32};
33 33
34static int __devinit s3d_get_props(struct s3d_info *sp) 34static int __devinit s3d_get_props(struct s3d_info *sp)
@@ -52,15 +52,14 @@ static int s3d_setcolreg(unsigned regno,
52{ 52{
53 u32 value; 53 u32 value;
54 54
55 if (regno >= 256) 55 if (regno < 16) {
56 return 1; 56 red >>= 8;
57 green >>= 8;
58 blue >>= 8;
57 59
58 red >>= 8; 60 value = (blue << 24) | (green << 16) | (red << 8);
59 green >>= 8; 61 ((u32 *)info->pseudo_palette)[regno] = value;
60 blue >>= 8; 62 }
61
62 value = (blue << 24) | (green << 16) | (red << 8);
63 ((u32 *)info->pseudo_palette)[regno] = value;
64 63
65 return 0; 64 return 0;
66} 65}
diff --git a/drivers/video/sunxvr500.c b/drivers/video/sunxvr500.c
index 08880a62bfa3..71bf3f1f00bc 100644
--- a/drivers/video/sunxvr500.c
+++ b/drivers/video/sunxvr500.c
@@ -50,7 +50,7 @@ struct e3d_info {
50 u32 fb8_0_off; 50 u32 fb8_0_off;
51 u32 fb8_1_off; 51 u32 fb8_1_off;
52 52
53 u32 pseudo_palette[256]; 53 u32 pseudo_palette[16];
54}; 54};
55 55
56static int __devinit e3d_get_props(struct e3d_info *ep) 56static int __devinit e3d_get_props(struct e3d_info *ep)
@@ -126,7 +126,9 @@ static int e3d_setcolreg(unsigned regno,
126 blue_8 = blue >> 8; 126 blue_8 = blue >> 8;
127 127
128 value = (blue_8 << 24) | (green_8 << 16) | (red_8 << 8); 128 value = (blue_8 << 24) | (green_8 << 16) | (red_8 << 8);
129 ((u32 *)info->pseudo_palette)[regno] = value; 129
130 if (info->fix.visual == FB_VISUAL_TRUECOLOR && regno < 16)
131 ((u32 *)info->pseudo_palette)[regno] = value;
130 132
131 133
132 red_10 = red >> 6; 134 red_10 = red >> 6;
diff --git a/include/asm-sparc64/cpudata.h b/include/asm-sparc64/cpudata.h
index 03c385de7619..445026fbec35 100644
--- a/include/asm-sparc64/cpudata.h
+++ b/include/asm-sparc64/cpudata.h
@@ -31,7 +31,7 @@ typedef struct {
31 unsigned int ecache_size; 31 unsigned int ecache_size;
32 unsigned int ecache_line_size; 32 unsigned int ecache_line_size;
33 int core_id; 33 int core_id;
34 unsigned int __pad3; 34 int proc_id;
35} cpuinfo_sparc; 35} cpuinfo_sparc;
36 36
37DECLARE_PER_CPU(cpuinfo_sparc, __cpu_data); 37DECLARE_PER_CPU(cpuinfo_sparc, __cpu_data);
diff --git a/include/asm-sparc64/dma-mapping.h b/include/asm-sparc64/dma-mapping.h
index 9329429fb7f6..4e21c2f3065c 100644
--- a/include/asm-sparc64/dma-mapping.h
+++ b/include/asm-sparc64/dma-mapping.h
@@ -162,6 +162,22 @@ dma_mapping_error(dma_addr_t dma_addr)
162#else 162#else
163 163
164struct device; 164struct device;
165struct page;
166struct scatterlist;
167
168static inline int
169dma_supported(struct device *dev, u64 mask)
170{
171 BUG();
172 return 0;
173}
174
175static inline int
176dma_set_mask(struct device *dev, u64 dma_mask)
177{
178 BUG();
179 return 0;
180}
165 181
166static inline void *dma_alloc_coherent(struct device *dev, size_t size, 182static inline void *dma_alloc_coherent(struct device *dev, size_t size,
167 dma_addr_t *dma_handle, gfp_t flag) 183 dma_addr_t *dma_handle, gfp_t flag)
@@ -176,6 +192,52 @@ static inline void dma_free_coherent(struct device *dev, size_t size,
176 BUG(); 192 BUG();
177} 193}
178 194
195static inline dma_addr_t
196dma_map_single(struct device *dev, void *cpu_addr, size_t size,
197 enum dma_data_direction direction)
198{
199 BUG();
200 return 0;
201}
202
203static inline void
204dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
205 enum dma_data_direction direction)
206{
207 BUG();
208}
209
210static inline dma_addr_t
211dma_map_page(struct device *dev, struct page *page,
212 unsigned long offset, size_t size,
213 enum dma_data_direction direction)
214{
215 BUG();
216 return 0;
217}
218
219static inline void
220dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
221 enum dma_data_direction direction)
222{
223 BUG();
224}
225
226static inline int
227dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
228 enum dma_data_direction direction)
229{
230 BUG();
231 return 0;
232}
233
234static inline void
235dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
236 enum dma_data_direction direction)
237{
238 BUG();
239}
240
179static inline void 241static inline void
180dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size, 242dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size,
181 enum dma_data_direction direction) 243 enum dma_data_direction direction)
@@ -190,6 +252,27 @@ dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t siz
190 BUG(); 252 BUG();
191} 253}
192 254
255static inline void
256dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
257 enum dma_data_direction direction)
258{
259 BUG();
260}
261
262static inline void
263dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems,
264 enum dma_data_direction direction)
265{
266 BUG();
267}
268
269static inline int
270dma_mapping_error(dma_addr_t dma_addr)
271{
272 BUG();
273 return 0;
274}
275
193#endif /* PCI */ 276#endif /* PCI */
194 277
195 278
diff --git a/include/asm-sparc64/hypervisor.h b/include/asm-sparc64/hypervisor.h
index 4a43075a0619..5c2f9d4b9f06 100644
--- a/include/asm-sparc64/hypervisor.h
+++ b/include/asm-sparc64/hypervisor.h
@@ -2798,6 +2798,11 @@ struct hv_mmu_statistics {
2798 */ 2798 */
2799#define HV_FAST_MMUSTAT_INFO 0x103 2799#define HV_FAST_MMUSTAT_INFO 0x103
2800 2800
2801#ifndef __ASSEMBLY__
2802extern unsigned long sun4v_mmustat_conf(unsigned long ra, unsigned long *orig_ra);
2803extern unsigned long sun4v_mmustat_info(unsigned long *ra);
2804#endif
2805
2801/* NCS crypto services */ 2806/* NCS crypto services */
2802 2807
2803/* ncs_request() sub-function numbers */ 2808/* ncs_request() sub-function numbers */
diff --git a/include/asm-sparc64/smp.h b/include/asm-sparc64/smp.h
index f76e1492add5..4fb8c4bfb848 100644
--- a/include/asm-sparc64/smp.h
+++ b/include/asm-sparc64/smp.h
@@ -33,6 +33,8 @@ extern cpumask_t phys_cpu_present_map;
33#define cpu_possible_map phys_cpu_present_map 33#define cpu_possible_map phys_cpu_present_map
34 34
35extern cpumask_t cpu_sibling_map[NR_CPUS]; 35extern cpumask_t cpu_sibling_map[NR_CPUS];
36extern cpumask_t cpu_core_map[NR_CPUS];
37extern int sparc64_multi_core;
36 38
37/* 39/*
38 * General functions that each host system must provide. 40 * General functions that each host system must provide.
diff --git a/include/asm-sparc64/topology.h b/include/asm-sparc64/topology.h
index e0d450d600ec..290ac75f385b 100644
--- a/include/asm-sparc64/topology.h
+++ b/include/asm-sparc64/topology.h
@@ -1,12 +1,17 @@
1#ifndef _ASM_SPARC64_TOPOLOGY_H 1#ifndef _ASM_SPARC64_TOPOLOGY_H
2#define _ASM_SPARC64_TOPOLOGY_H 2#define _ASM_SPARC64_TOPOLOGY_H
3 3
4#include <asm/spitfire.h> 4#ifdef CONFIG_SMP
5#define smt_capable() (tlb_type == hypervisor) 5#define topology_physical_package_id(cpu) (cpu_data(cpu).proc_id)
6#define topology_core_id(cpu) (cpu_data(cpu).core_id)
7#define topology_core_siblings(cpu) (cpu_core_map[cpu])
8#define topology_thread_siblings(cpu) (cpu_sibling_map[cpu])
9#define mc_capable() (sparc64_multi_core)
10#define smt_capable() (sparc64_multi_core)
11#endif /* CONFIG_SMP */
6 12
7#include <asm-generic/topology.h> 13#include <asm-generic/topology.h>
8 14
9#define topology_core_id(cpu) (cpu_data(cpu).core_id) 15#define cpu_coregroup_map(cpu) (cpu_core_map[cpu])
10#define topology_thread_siblings(cpu) (cpu_sibling_map[cpu])
11 16
12#endif /* _ASM_SPARC64_TOPOLOGY_H */ 17#endif /* _ASM_SPARC64_TOPOLOGY_H */