aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-08-10 12:36:06 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-08-10 12:36:06 -0400
commitf213ad386bc5727a354e7098e34351e1b0a049a3 (patch)
treedad3f61ce018cc7837173bd8d850ca09fac73736
parent8d31f80eb38819e4f2905ad21c0e8998382a08f7 (diff)
parent3ee70591d6c47ef4c4699b3395ba96ce287db937 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc
Pull sparc updates from David Miller: 1) Recognize M8 cpus, just basic chip ID matching, from Allen Pais. 2) Prevent crashes when bringing up sunvdc virtual block devices in some environments. From Jim Quigley. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc: sunvdc: prevent sunvdc panic when mpgroup disk added to guest domain sparc64: Increase max_phys_bits to 51 and VA bits to 53 for M8. sparc64: recognize and support sparc M8 cpu type sparc64: properly name the cpu constants
-rw-r--r--arch/sparc/include/asm/spitfire.h16
-rw-r--r--arch/sparc/kernel/cpu.c6
-rw-r--r--arch/sparc/kernel/cpumap.c1
-rw-r--r--arch/sparc/kernel/head_64.S22
-rw-r--r--arch/sparc/kernel/setup_64.c15
-rw-r--r--arch/sparc/mm/init_64.c14
-rw-r--r--drivers/block/sunvdc.c61
7 files changed, 124 insertions, 11 deletions
diff --git a/arch/sparc/include/asm/spitfire.h b/arch/sparc/include/asm/spitfire.h
index 1d8321c827a8..1b1286d05069 100644
--- a/arch/sparc/include/asm/spitfire.h
+++ b/arch/sparc/include/asm/spitfire.h
@@ -47,10 +47,26 @@
47#define SUN4V_CHIP_NIAGARA5 0x05 47#define SUN4V_CHIP_NIAGARA5 0x05
48#define SUN4V_CHIP_SPARC_M6 0x06 48#define SUN4V_CHIP_SPARC_M6 0x06
49#define SUN4V_CHIP_SPARC_M7 0x07 49#define SUN4V_CHIP_SPARC_M7 0x07
50#define SUN4V_CHIP_SPARC_M8 0x08
50#define SUN4V_CHIP_SPARC64X 0x8a 51#define SUN4V_CHIP_SPARC64X 0x8a
51#define SUN4V_CHIP_SPARC_SN 0x8b 52#define SUN4V_CHIP_SPARC_SN 0x8b
52#define SUN4V_CHIP_UNKNOWN 0xff 53#define SUN4V_CHIP_UNKNOWN 0xff
53 54
55/*
56 * The following CPU_ID_xxx constants are used
57 * to identify the CPU type in the setup phase
58 * (see head_64.S)
59 */
60#define CPU_ID_NIAGARA1 ('1')
61#define CPU_ID_NIAGARA2 ('2')
62#define CPU_ID_NIAGARA3 ('3')
63#define CPU_ID_NIAGARA4 ('4')
64#define CPU_ID_NIAGARA5 ('5')
65#define CPU_ID_M6 ('6')
66#define CPU_ID_M7 ('7')
67#define CPU_ID_M8 ('8')
68#define CPU_ID_SONOMA1 ('N')
69
54#ifndef __ASSEMBLY__ 70#ifndef __ASSEMBLY__
55 71
56enum ultra_tlb_layout { 72enum ultra_tlb_layout {
diff --git a/arch/sparc/kernel/cpu.c b/arch/sparc/kernel/cpu.c
index 493e023a468a..ef4f18f7a674 100644
--- a/arch/sparc/kernel/cpu.c
+++ b/arch/sparc/kernel/cpu.c
@@ -506,6 +506,12 @@ static void __init sun4v_cpu_probe(void)
506 sparc_pmu_type = "sparc-m7"; 506 sparc_pmu_type = "sparc-m7";
507 break; 507 break;
508 508
509 case SUN4V_CHIP_SPARC_M8:
510 sparc_cpu_type = "SPARC-M8";
511 sparc_fpu_type = "SPARC-M8 integrated FPU";
512 sparc_pmu_type = "sparc-m8";
513 break;
514
509 case SUN4V_CHIP_SPARC_SN: 515 case SUN4V_CHIP_SPARC_SN:
510 sparc_cpu_type = "SPARC-SN"; 516 sparc_cpu_type = "SPARC-SN";
511 sparc_fpu_type = "SPARC-SN integrated FPU"; 517 sparc_fpu_type = "SPARC-SN integrated FPU";
diff --git a/arch/sparc/kernel/cpumap.c b/arch/sparc/kernel/cpumap.c
index 45c820e1cba5..90d550bbfeef 100644
--- a/arch/sparc/kernel/cpumap.c
+++ b/arch/sparc/kernel/cpumap.c
@@ -328,6 +328,7 @@ static int iterate_cpu(struct cpuinfo_tree *t, unsigned int root_index)
328 case SUN4V_CHIP_NIAGARA5: 328 case SUN4V_CHIP_NIAGARA5:
329 case SUN4V_CHIP_SPARC_M6: 329 case SUN4V_CHIP_SPARC_M6:
330 case SUN4V_CHIP_SPARC_M7: 330 case SUN4V_CHIP_SPARC_M7:
331 case SUN4V_CHIP_SPARC_M8:
331 case SUN4V_CHIP_SPARC_SN: 332 case SUN4V_CHIP_SPARC_SN:
332 case SUN4V_CHIP_SPARC64X: 333 case SUN4V_CHIP_SPARC64X:
333 rover_inc_table = niagara_iterate_method; 334 rover_inc_table = niagara_iterate_method;
diff --git a/arch/sparc/kernel/head_64.S b/arch/sparc/kernel/head_64.S
index 41a407328667..78e0211753d2 100644
--- a/arch/sparc/kernel/head_64.S
+++ b/arch/sparc/kernel/head_64.S
@@ -424,22 +424,25 @@ EXPORT_SYMBOL(sun4v_chip_type)
424 nop 424 nop
425 425
42670: ldub [%g1 + 7], %g2 42670: ldub [%g1 + 7], %g2
427 cmp %g2, '3' 427 cmp %g2, CPU_ID_NIAGARA3
428 be,pt %xcc, 5f 428 be,pt %xcc, 5f
429 mov SUN4V_CHIP_NIAGARA3, %g4 429 mov SUN4V_CHIP_NIAGARA3, %g4
430 cmp %g2, '4' 430 cmp %g2, CPU_ID_NIAGARA4
431 be,pt %xcc, 5f 431 be,pt %xcc, 5f
432 mov SUN4V_CHIP_NIAGARA4, %g4 432 mov SUN4V_CHIP_NIAGARA4, %g4
433 cmp %g2, '5' 433 cmp %g2, CPU_ID_NIAGARA5
434 be,pt %xcc, 5f 434 be,pt %xcc, 5f
435 mov SUN4V_CHIP_NIAGARA5, %g4 435 mov SUN4V_CHIP_NIAGARA5, %g4
436 cmp %g2, '6' 436 cmp %g2, CPU_ID_M6
437 be,pt %xcc, 5f 437 be,pt %xcc, 5f
438 mov SUN4V_CHIP_SPARC_M6, %g4 438 mov SUN4V_CHIP_SPARC_M6, %g4
439 cmp %g2, '7' 439 cmp %g2, CPU_ID_M7
440 be,pt %xcc, 5f 440 be,pt %xcc, 5f
441 mov SUN4V_CHIP_SPARC_M7, %g4 441 mov SUN4V_CHIP_SPARC_M7, %g4
442 cmp %g2, 'N' 442 cmp %g2, CPU_ID_M8
443 be,pt %xcc, 5f
444 mov SUN4V_CHIP_SPARC_M8, %g4
445 cmp %g2, CPU_ID_SONOMA1
443 be,pt %xcc, 5f 446 be,pt %xcc, 5f
444 mov SUN4V_CHIP_SPARC_SN, %g4 447 mov SUN4V_CHIP_SPARC_SN, %g4
445 ba,pt %xcc, 49f 448 ba,pt %xcc, 49f
@@ -448,10 +451,10 @@ EXPORT_SYMBOL(sun4v_chip_type)
44891: sethi %hi(prom_cpu_compatible), %g1 45191: sethi %hi(prom_cpu_compatible), %g1
449 or %g1, %lo(prom_cpu_compatible), %g1 452 or %g1, %lo(prom_cpu_compatible), %g1
450 ldub [%g1 + 17], %g2 453 ldub [%g1 + 17], %g2
451 cmp %g2, '1' 454 cmp %g2, CPU_ID_NIAGARA1
452 be,pt %xcc, 5f 455 be,pt %xcc, 5f
453 mov SUN4V_CHIP_NIAGARA1, %g4 456 mov SUN4V_CHIP_NIAGARA1, %g4
454 cmp %g2, '2' 457 cmp %g2, CPU_ID_NIAGARA2
455 be,pt %xcc, 5f 458 be,pt %xcc, 5f
456 mov SUN4V_CHIP_NIAGARA2, %g4 459 mov SUN4V_CHIP_NIAGARA2, %g4
457 460
@@ -602,6 +605,9 @@ niagara_tlb_fixup:
602 cmp %g1, SUN4V_CHIP_SPARC_M7 605 cmp %g1, SUN4V_CHIP_SPARC_M7
603 be,pt %xcc, niagara4_patch 606 be,pt %xcc, niagara4_patch
604 nop 607 nop
608 cmp %g1, SUN4V_CHIP_SPARC_M8
609 be,pt %xcc, niagara4_patch
610 nop
605 cmp %g1, SUN4V_CHIP_SPARC_SN 611 cmp %g1, SUN4V_CHIP_SPARC_SN
606 be,pt %xcc, niagara4_patch 612 be,pt %xcc, niagara4_patch
607 nop 613 nop
diff --git a/arch/sparc/kernel/setup_64.c b/arch/sparc/kernel/setup_64.c
index 4d9c3e13c150..150ee7d4b059 100644
--- a/arch/sparc/kernel/setup_64.c
+++ b/arch/sparc/kernel/setup_64.c
@@ -288,10 +288,17 @@ static void __init sun4v_patch(void)
288 288
289 sun4v_patch_2insn_range(&__sun4v_2insn_patch, 289 sun4v_patch_2insn_range(&__sun4v_2insn_patch,
290 &__sun4v_2insn_patch_end); 290 &__sun4v_2insn_patch_end);
291 if (sun4v_chip_type == SUN4V_CHIP_SPARC_M7 || 291
292 sun4v_chip_type == SUN4V_CHIP_SPARC_SN) 292 switch (sun4v_chip_type) {
293 case SUN4V_CHIP_SPARC_M7:
294 case SUN4V_CHIP_SPARC_M8:
295 case SUN4V_CHIP_SPARC_SN:
293 sun_m7_patch_2insn_range(&__sun_m7_2insn_patch, 296 sun_m7_patch_2insn_range(&__sun_m7_2insn_patch,
294 &__sun_m7_2insn_patch_end); 297 &__sun_m7_2insn_patch_end);
298 break;
299 default:
300 break;
301 }
295 302
296 sun4v_hvapi_init(); 303 sun4v_hvapi_init();
297} 304}
@@ -529,6 +536,7 @@ static void __init init_sparc64_elf_hwcap(void)
529 sun4v_chip_type == SUN4V_CHIP_NIAGARA5 || 536 sun4v_chip_type == SUN4V_CHIP_NIAGARA5 ||
530 sun4v_chip_type == SUN4V_CHIP_SPARC_M6 || 537 sun4v_chip_type == SUN4V_CHIP_SPARC_M6 ||
531 sun4v_chip_type == SUN4V_CHIP_SPARC_M7 || 538 sun4v_chip_type == SUN4V_CHIP_SPARC_M7 ||
539 sun4v_chip_type == SUN4V_CHIP_SPARC_M8 ||
532 sun4v_chip_type == SUN4V_CHIP_SPARC_SN || 540 sun4v_chip_type == SUN4V_CHIP_SPARC_SN ||
533 sun4v_chip_type == SUN4V_CHIP_SPARC64X) 541 sun4v_chip_type == SUN4V_CHIP_SPARC64X)
534 cap |= HWCAP_SPARC_BLKINIT; 542 cap |= HWCAP_SPARC_BLKINIT;
@@ -538,6 +546,7 @@ static void __init init_sparc64_elf_hwcap(void)
538 sun4v_chip_type == SUN4V_CHIP_NIAGARA5 || 546 sun4v_chip_type == SUN4V_CHIP_NIAGARA5 ||
539 sun4v_chip_type == SUN4V_CHIP_SPARC_M6 || 547 sun4v_chip_type == SUN4V_CHIP_SPARC_M6 ||
540 sun4v_chip_type == SUN4V_CHIP_SPARC_M7 || 548 sun4v_chip_type == SUN4V_CHIP_SPARC_M7 ||
549 sun4v_chip_type == SUN4V_CHIP_SPARC_M8 ||
541 sun4v_chip_type == SUN4V_CHIP_SPARC_SN || 550 sun4v_chip_type == SUN4V_CHIP_SPARC_SN ||
542 sun4v_chip_type == SUN4V_CHIP_SPARC64X) 551 sun4v_chip_type == SUN4V_CHIP_SPARC64X)
543 cap |= HWCAP_SPARC_N2; 552 cap |= HWCAP_SPARC_N2;
@@ -568,6 +577,7 @@ static void __init init_sparc64_elf_hwcap(void)
568 sun4v_chip_type == SUN4V_CHIP_NIAGARA5 || 577 sun4v_chip_type == SUN4V_CHIP_NIAGARA5 ||
569 sun4v_chip_type == SUN4V_CHIP_SPARC_M6 || 578 sun4v_chip_type == SUN4V_CHIP_SPARC_M6 ||
570 sun4v_chip_type == SUN4V_CHIP_SPARC_M7 || 579 sun4v_chip_type == SUN4V_CHIP_SPARC_M7 ||
580 sun4v_chip_type == SUN4V_CHIP_SPARC_M8 ||
571 sun4v_chip_type == SUN4V_CHIP_SPARC_SN || 581 sun4v_chip_type == SUN4V_CHIP_SPARC_SN ||
572 sun4v_chip_type == SUN4V_CHIP_SPARC64X) 582 sun4v_chip_type == SUN4V_CHIP_SPARC64X)
573 cap |= (AV_SPARC_VIS | AV_SPARC_VIS2 | 583 cap |= (AV_SPARC_VIS | AV_SPARC_VIS2 |
@@ -578,6 +588,7 @@ static void __init init_sparc64_elf_hwcap(void)
578 sun4v_chip_type == SUN4V_CHIP_NIAGARA5 || 588 sun4v_chip_type == SUN4V_CHIP_NIAGARA5 ||
579 sun4v_chip_type == SUN4V_CHIP_SPARC_M6 || 589 sun4v_chip_type == SUN4V_CHIP_SPARC_M6 ||
580 sun4v_chip_type == SUN4V_CHIP_SPARC_M7 || 590 sun4v_chip_type == SUN4V_CHIP_SPARC_M7 ||
591 sun4v_chip_type == SUN4V_CHIP_SPARC_M8 ||
581 sun4v_chip_type == SUN4V_CHIP_SPARC_SN || 592 sun4v_chip_type == SUN4V_CHIP_SPARC_SN ||
582 sun4v_chip_type == SUN4V_CHIP_SPARC64X) 593 sun4v_chip_type == SUN4V_CHIP_SPARC64X)
583 cap |= (AV_SPARC_VIS3 | AV_SPARC_HPC | 594 cap |= (AV_SPARC_VIS3 | AV_SPARC_HPC |
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
index fed73f14aa49..afa0099f3748 100644
--- a/arch/sparc/mm/init_64.c
+++ b/arch/sparc/mm/init_64.c
@@ -1944,12 +1944,22 @@ static void __init setup_page_offset(void)
1944 break; 1944 break;
1945 case SUN4V_CHIP_SPARC_M7: 1945 case SUN4V_CHIP_SPARC_M7:
1946 case SUN4V_CHIP_SPARC_SN: 1946 case SUN4V_CHIP_SPARC_SN:
1947 default:
1948 /* M7 and later support 52-bit virtual addresses. */ 1947 /* M7 and later support 52-bit virtual addresses. */
1949 sparc64_va_hole_top = 0xfff8000000000000UL; 1948 sparc64_va_hole_top = 0xfff8000000000000UL;
1950 sparc64_va_hole_bottom = 0x0008000000000000UL; 1949 sparc64_va_hole_bottom = 0x0008000000000000UL;
1951 max_phys_bits = 49; 1950 max_phys_bits = 49;
1952 break; 1951 break;
1952 case SUN4V_CHIP_SPARC_M8:
1953 default:
1954 /* M8 and later support 54-bit virtual addresses.
1955 * However, restricting M8 and above VA bits to 53
1956 * as 4-level page table cannot support more than
1957 * 53 VA bits.
1958 */
1959 sparc64_va_hole_top = 0xfff0000000000000UL;
1960 sparc64_va_hole_bottom = 0x0010000000000000UL;
1961 max_phys_bits = 51;
1962 break;
1953 } 1963 }
1954 } 1964 }
1955 1965
@@ -2161,6 +2171,7 @@ static void __init sun4v_linear_pte_xor_finalize(void)
2161 */ 2171 */
2162 switch (sun4v_chip_type) { 2172 switch (sun4v_chip_type) {
2163 case SUN4V_CHIP_SPARC_M7: 2173 case SUN4V_CHIP_SPARC_M7:
2174 case SUN4V_CHIP_SPARC_M8:
2164 case SUN4V_CHIP_SPARC_SN: 2175 case SUN4V_CHIP_SPARC_SN:
2165 pagecv_flag = 0x00; 2176 pagecv_flag = 0x00;
2166 break; 2177 break;
@@ -2313,6 +2324,7 @@ void __init paging_init(void)
2313 */ 2324 */
2314 switch (sun4v_chip_type) { 2325 switch (sun4v_chip_type) {
2315 case SUN4V_CHIP_SPARC_M7: 2326 case SUN4V_CHIP_SPARC_M7:
2327 case SUN4V_CHIP_SPARC_M8:
2316 case SUN4V_CHIP_SPARC_SN: 2328 case SUN4V_CHIP_SPARC_SN:
2317 page_cache4v_flag = _PAGE_CP_4V; 2329 page_cache4v_flag = _PAGE_CP_4V;
2318 break; 2330 break;
diff --git a/drivers/block/sunvdc.c b/drivers/block/sunvdc.c
index 6b16ead1da58..ad9749463d4f 100644
--- a/drivers/block/sunvdc.c
+++ b/drivers/block/sunvdc.c
@@ -875,6 +875,56 @@ static void print_version(void)
875 printk(KERN_INFO "%s", version); 875 printk(KERN_INFO "%s", version);
876} 876}
877 877
878struct vdc_check_port_data {
879 int dev_no;
880 char *type;
881};
882
883static int vdc_device_probed(struct device *dev, void *arg)
884{
885 struct vio_dev *vdev = to_vio_dev(dev);
886 struct vdc_check_port_data *port_data;
887
888 port_data = (struct vdc_check_port_data *)arg;
889
890 if ((vdev->dev_no == port_data->dev_no) &&
891 (!(strcmp((char *)&vdev->type, port_data->type))) &&
892 dev_get_drvdata(dev)) {
893 /* This device has already been configured
894 * by vdc_port_probe()
895 */
896 return 1;
897 } else {
898 return 0;
899 }
900}
901
902/* Determine whether the VIO device is part of an mpgroup
903 * by locating all the virtual-device-port nodes associated
904 * with the parent virtual-device node for the VIO device
905 * and checking whether any of these nodes are vdc-ports
906 * which have already been configured.
907 *
908 * Returns true if this device is part of an mpgroup and has
909 * already been probed.
910 */
911static bool vdc_port_mpgroup_check(struct vio_dev *vdev)
912{
913 struct vdc_check_port_data port_data;
914 struct device *dev;
915
916 port_data.dev_no = vdev->dev_no;
917 port_data.type = (char *)&vdev->type;
918
919 dev = device_find_child(vdev->dev.parent, &port_data,
920 vdc_device_probed);
921
922 if (dev)
923 return true;
924
925 return false;
926}
927
878static int vdc_port_probe(struct vio_dev *vdev, const struct vio_device_id *id) 928static int vdc_port_probe(struct vio_dev *vdev, const struct vio_device_id *id)
879{ 929{
880 struct mdesc_handle *hp; 930 struct mdesc_handle *hp;
@@ -893,6 +943,14 @@ static int vdc_port_probe(struct vio_dev *vdev, const struct vio_device_id *id)
893 goto err_out_release_mdesc; 943 goto err_out_release_mdesc;
894 } 944 }
895 945
946 /* Check if this device is part of an mpgroup */
947 if (vdc_port_mpgroup_check(vdev)) {
948 printk(KERN_WARNING
949 "VIO: Ignoring extra vdisk port %s",
950 dev_name(&vdev->dev));
951 goto err_out_release_mdesc;
952 }
953
896 port = kzalloc(sizeof(*port), GFP_KERNEL); 954 port = kzalloc(sizeof(*port), GFP_KERNEL);
897 err = -ENOMEM; 955 err = -ENOMEM;
898 if (!port) { 956 if (!port) {
@@ -943,6 +1001,9 @@ static int vdc_port_probe(struct vio_dev *vdev, const struct vio_device_id *id)
943 if (err) 1001 if (err)
944 goto err_out_free_tx_ring; 1002 goto err_out_free_tx_ring;
945 1003
1004 /* Note that the device driver_data is used to determine
1005 * whether the port has been probed.
1006 */
946 dev_set_drvdata(&vdev->dev, port); 1007 dev_set_drvdata(&vdev->dev, port);
947 1008
948 mdesc_release(hp); 1009 mdesc_release(hp);