Skip to content

Commit 4ba991d

Browse files
committed
sparc: Detect and handle UltraSPARC-T3 cpu types.
The cpu compatible string we look for is "SPARC-T3". As far as memset/memcpy optimizations go, we treat this chip the same as Niagara-T2/T2+. Use cache initializing stores for memset, and use perfetch, FPU block loads, cache initializing stores, and block stores for copies. We use the Niagara-T2 perf support, since T3 is a close relative in this regard. Later we'll add support for the new events T3 can report, plus enable T3's new "sample" mode. For now I haven't added any new ELF hwcap flags. We probably need to add a couple, for example: T2 and T3 both support the population count instruction in hardware. T3 supports VIS3 instructions, including support (finally) for partitioned shift. One can also now move directly between float and integer registers. T3 supports instructions meant to help with Galois Field and other HPC calculations, such as XOR multiply. Also there are "OP and negate" instructions, for example "fnmul" which is multiply-and-negate. T3 recognizes the transactional memory opcodes, however since transactional memory isn't supported: 1) 'commit' behaves as a NOP and 2) 'chkpt' always branches 3) 'rdcps' returns all zeros and 4) 'wrcps' behaves as a NOP. So we'll need about 3 new elf capability flags in the end to represent all of these things. Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 314ff52 commit 4ba991d

7 files changed

Lines changed: 50 additions & 4 deletions

File tree

‎arch/sparc/include/asm/elf_64.h‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,11 @@ static inline unsigned int sparc64_elf_hwcap(void)
177177
cap |= HWCAP_SPARC_ULTRA3;
178178
else if (tlb_type == hypervisor) {
179179
if (sun4v_chip_type == SUN4V_CHIP_NIAGARA1 ||
180-
sun4v_chip_type == SUN4V_CHIP_NIAGARA2)
180+
sun4v_chip_type == SUN4V_CHIP_NIAGARA2 ||
181+
sun4v_chip_type == SUN4V_CHIP_NIAGARA3)
181182
cap |= HWCAP_SPARC_BLKINIT;
182-
if (sun4v_chip_type == SUN4V_CHIP_NIAGARA2)
183+
if (sun4v_chip_type == SUN4V_CHIP_NIAGARA2 ||
184+
sun4v_chip_type == SUN4V_CHIP_NIAGARA3)
183185
cap |= HWCAP_SPARC_N2;
184186
}
185187

‎arch/sparc/include/asm/xor_64.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ static struct xor_block_template xor_block_niagara = {
6565
#define XOR_SELECT_TEMPLATE(FASTEST) \
6666
((tlb_type == hypervisor && \
6767
(sun4v_chip_type == SUN4V_CHIP_NIAGARA1 || \
68-
sun4v_chip_type == SUN4V_CHIP_NIAGARA2)) ? \
68+
sun4v_chip_type == SUN4V_CHIP_NIAGARA2 || \
69+
sun4v_chip_type == SUN4V_CHIP_NIAGARA3)) ? \
6970
&xor_block_niagara : \
7071
&xor_block_VIS)

‎arch/sparc/kernel/cpu.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,12 @@ static void __init sun4v_cpu_probe(void)
474474
sparc_pmu_type = "niagara2";
475475
break;
476476

477+
case SUN4V_CHIP_NIAGARA3:
478+
sparc_cpu_type = "UltraSparc T3 (Niagara3)";
479+
sparc_fpu_type = "UltraSparc T3 integrated FPU";
480+
sparc_pmu_type = "niagara3";
481+
break;
482+
477483
default:
478484
printk(KERN_WARNING "CPU: Unknown sun4v cpu type [%s]\n",
479485
prom_cpu_compatible);

‎arch/sparc/kernel/cpumap.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@ static int iterate_cpu(struct cpuinfo_tree *t, unsigned int root_index)
324324
switch (sun4v_chip_type) {
325325
case SUN4V_CHIP_NIAGARA1:
326326
case SUN4V_CHIP_NIAGARA2:
327+
case SUN4V_CHIP_NIAGARA3:
327328
rover_inc_table = niagara_iterate_method;
328329
break;
329330
default:

‎arch/sparc/kernel/head_64.S‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ prom_sun4v_name:
132132
.asciz "sun4v"
133133
prom_niagara_prefix:
134134
.asciz "SUNW,UltraSPARC-T"
135+
prom_sparc_prefix:
136+
.asciz "SPARC-T"
135137
.align 4
136138
prom_root_compatible:
137139
.skip 64
@@ -379,6 +381,22 @@ sun4v_chip_type:
379381
sethi %hi(prom_niagara_prefix), %g7
380382
or %g7, %lo(prom_niagara_prefix), %g7
381383
mov 17, %g3
384+
90: ldub [%g7], %g2
385+
ldub [%g1], %g4
386+
cmp %g2, %g4
387+
bne,pn %icc, 89f
388+
add %g7, 1, %g7
389+
subcc %g3, 1, %g3
390+
bne,pt %xcc, 90b
391+
add %g1, 1, %g1
392+
ba,pt %xcc, 91f
393+
nop
394+
395+
89: sethi %hi(prom_cpu_compatible), %g1
396+
or %g1, %lo(prom_cpu_compatible), %g1
397+
sethi %hi(prom_sparc_prefix), %g7
398+
or %g7, %lo(prom_sparc_prefix), %g7
399+
mov 7, %g3
382400
90: ldub [%g7], %g2
383401
ldub [%g1], %g4
384402
cmp %g2, %g4
@@ -389,6 +407,15 @@ sun4v_chip_type:
389407
add %g1, 1, %g1
390408

391409
sethi %hi(prom_cpu_compatible), %g1
410+
or %g1, %lo(prom_cpu_compatible), %g1
411+
ldub [%g1 + 7], %g2
412+
cmp %g2, '3'
413+
be,pt %xcc, 5f
414+
mov SUN4V_CHIP_NIAGARA3, %g4
415+
ba,pt %xcc, 4f
416+
nop
417+
418+
91: sethi %hi(prom_cpu_compatible), %g1
392419
or %g1, %lo(prom_cpu_compatible), %g1
393420
ldub [%g1 + 17], %g2
394421
cmp %g2, '1'
@@ -397,6 +424,7 @@ sun4v_chip_type:
397424
cmp %g2, '2'
398425
be,pt %xcc, 5f
399426
mov SUN4V_CHIP_NIAGARA2, %g4
427+
400428
4:
401429
mov SUN4V_CHIP_UNKNOWN, %g4
402430
5: sethi %hi(sun4v_chip_type), %g2
@@ -514,6 +542,9 @@ niagara_tlb_fixup:
514542
cmp %g1, SUN4V_CHIP_NIAGARA2
515543
be,pt %xcc, niagara2_patch
516544
nop
545+
cmp %g1, SUN4V_CHIP_NIAGARA3
546+
be,pt %xcc, niagara2_patch
547+
nop
517548

518549
call generic_patch_copyops
519550
nop

‎arch/sparc/kernel/pcr.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ static int __init register_perf_hsvc(void)
109109
perf_hsvc_group = HV_GRP_N2_CPU;
110110
break;
111111

112+
case SUN4V_CHIP_NIAGARA3:
113+
perf_hsvc_group = HV_GRP_KT_CPU;
114+
break;
115+
112116
default:
113117
return -ENODEV;
114118
}

‎arch/sparc/kernel/perf_event.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1343,7 +1343,8 @@ static bool __init supported_pmu(void)
13431343
sparc_pmu = &niagara1_pmu;
13441344
return true;
13451345
}
1346-
if (!strcmp(sparc_pmu_type, "niagara2")) {
1346+
if (!strcmp(sparc_pmu_type, "niagara2") ||
1347+
!strcmp(sparc_pmu_type, "niagara3")) {
13471348
sparc_pmu = &niagara2_pmu;
13481349
return true;
13491350
}

0 commit comments

Comments
 (0)