diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2017-09-04 12:22:54 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2017-09-04 12:22:54 -0400 |
commit | a6cbfa1e6d38c4b3ab0ce7e3aea4bb4e744f24b8 (patch) | |
tree | 8960e571a398b5d32e72bdb9c89ce965daa870ab /arch/powerpc/kernel/dt_cpu_ftrs.c | |
parent | f5308d1b83eba20e69df5e0926ba7257c8dd9074 (diff) | |
parent | 08d6ac9ee5fedd82040bc878705981b67a116a3f (diff) |
Merge branch 'next' into for-linus
Prepare input updates for 4.14 merge window.
Diffstat (limited to 'arch/powerpc/kernel/dt_cpu_ftrs.c')
-rw-r--r-- | arch/powerpc/kernel/dt_cpu_ftrs.c | 58 |
1 files changed, 48 insertions, 10 deletions
diff --git a/arch/powerpc/kernel/dt_cpu_ftrs.c b/arch/powerpc/kernel/dt_cpu_ftrs.c index fcc7588a96d6..4c7656dc4e04 100644 --- a/arch/powerpc/kernel/dt_cpu_ftrs.c +++ b/arch/powerpc/kernel/dt_cpu_ftrs.c | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <linux/export.h> | 8 | #include <linux/export.h> |
9 | #include <linux/init.h> | 9 | #include <linux/init.h> |
10 | #include <linux/jump_label.h> | 10 | #include <linux/jump_label.h> |
11 | #include <linux/libfdt.h> | ||
11 | #include <linux/memblock.h> | 12 | #include <linux/memblock.h> |
12 | #include <linux/printk.h> | 13 | #include <linux/printk.h> |
13 | #include <linux/sched.h> | 14 | #include <linux/sched.h> |
@@ -642,7 +643,6 @@ static struct dt_cpu_feature_match __initdata | |||
642 | {"processor-control-facility", feat_enable_dbell, CPU_FTR_DBELL}, | 643 | {"processor-control-facility", feat_enable_dbell, CPU_FTR_DBELL}, |
643 | {"processor-control-facility-v3", feat_enable_dbell, CPU_FTR_DBELL}, | 644 | {"processor-control-facility-v3", feat_enable_dbell, CPU_FTR_DBELL}, |
644 | {"processor-utilization-of-resources-register", feat_enable_purr, 0}, | 645 | {"processor-utilization-of-resources-register", feat_enable_purr, 0}, |
645 | {"subcore", feat_enable, CPU_FTR_SUBCORE}, | ||
646 | {"no-execute", feat_enable, 0}, | 646 | {"no-execute", feat_enable, 0}, |
647 | {"strong-access-ordering", feat_enable, CPU_FTR_SAO}, | 647 | {"strong-access-ordering", feat_enable, CPU_FTR_SAO}, |
648 | {"cache-inhibited-large-page", feat_enable_large_ci, 0}, | 648 | {"cache-inhibited-large-page", feat_enable_large_ci, 0}, |
@@ -671,12 +671,24 @@ static struct dt_cpu_feature_match __initdata | |||
671 | {"wait-v3", feat_enable, 0}, | 671 | {"wait-v3", feat_enable, 0}, |
672 | }; | 672 | }; |
673 | 673 | ||
674 | /* XXX: how to configure this? Default + boot time? */ | 674 | static bool __initdata using_dt_cpu_ftrs; |
675 | #ifdef CONFIG_PPC_CPUFEATURES_ENABLE_UNKNOWN | 675 | static bool __initdata enable_unknown = true; |
676 | #define CPU_FEATURE_ENABLE_UNKNOWN 1 | 676 | |
677 | #else | 677 | static int __init dt_cpu_ftrs_parse(char *str) |
678 | #define CPU_FEATURE_ENABLE_UNKNOWN 0 | 678 | { |
679 | #endif | 679 | if (!str) |
680 | return 0; | ||
681 | |||
682 | if (!strcmp(str, "off")) | ||
683 | using_dt_cpu_ftrs = false; | ||
684 | else if (!strcmp(str, "known")) | ||
685 | enable_unknown = false; | ||
686 | else | ||
687 | return 1; | ||
688 | |||
689 | return 0; | ||
690 | } | ||
691 | early_param("dt_cpu_ftrs", dt_cpu_ftrs_parse); | ||
680 | 692 | ||
681 | static void __init cpufeatures_setup_start(u32 isa) | 693 | static void __init cpufeatures_setup_start(u32 isa) |
682 | { | 694 | { |
@@ -707,7 +719,7 @@ static bool __init cpufeatures_process_feature(struct dt_cpu_feature *f) | |||
707 | } | 719 | } |
708 | } | 720 | } |
709 | 721 | ||
710 | if (!known && CPU_FEATURE_ENABLE_UNKNOWN) { | 722 | if (!known && enable_unknown) { |
711 | if (!feat_try_enable_unknown(f)) { | 723 | if (!feat_try_enable_unknown(f)) { |
712 | pr_info("not enabling: %s (unknown and unsupported by kernel)\n", | 724 | pr_info("not enabling: %s (unknown and unsupported by kernel)\n", |
713 | f->name); | 725 | f->name); |
@@ -756,6 +768,26 @@ static void __init cpufeatures_setup_finished(void) | |||
756 | cur_cpu_spec->cpu_features, cur_cpu_spec->mmu_features); | 768 | cur_cpu_spec->cpu_features, cur_cpu_spec->mmu_features); |
757 | } | 769 | } |
758 | 770 | ||
771 | static int __init disabled_on_cmdline(void) | ||
772 | { | ||
773 | unsigned long root, chosen; | ||
774 | const char *p; | ||
775 | |||
776 | root = of_get_flat_dt_root(); | ||
777 | chosen = of_get_flat_dt_subnode_by_name(root, "chosen"); | ||
778 | if (chosen == -FDT_ERR_NOTFOUND) | ||
779 | return false; | ||
780 | |||
781 | p = of_get_flat_dt_prop(chosen, "bootargs", NULL); | ||
782 | if (!p) | ||
783 | return false; | ||
784 | |||
785 | if (strstr(p, "dt_cpu_ftrs=off")) | ||
786 | return true; | ||
787 | |||
788 | return false; | ||
789 | } | ||
790 | |||
759 | static int __init fdt_find_cpu_features(unsigned long node, const char *uname, | 791 | static int __init fdt_find_cpu_features(unsigned long node, const char *uname, |
760 | int depth, void *data) | 792 | int depth, void *data) |
761 | { | 793 | { |
@@ -766,8 +798,6 @@ static int __init fdt_find_cpu_features(unsigned long node, const char *uname, | |||
766 | return 0; | 798 | return 0; |
767 | } | 799 | } |
768 | 800 | ||
769 | static bool __initdata using_dt_cpu_ftrs = false; | ||
770 | |||
771 | bool __init dt_cpu_ftrs_in_use(void) | 801 | bool __init dt_cpu_ftrs_in_use(void) |
772 | { | 802 | { |
773 | return using_dt_cpu_ftrs; | 803 | return using_dt_cpu_ftrs; |
@@ -775,6 +805,8 @@ bool __init dt_cpu_ftrs_in_use(void) | |||
775 | 805 | ||
776 | bool __init dt_cpu_ftrs_init(void *fdt) | 806 | bool __init dt_cpu_ftrs_init(void *fdt) |
777 | { | 807 | { |
808 | using_dt_cpu_ftrs = false; | ||
809 | |||
778 | /* Setup and verify the FDT, if it fails we just bail */ | 810 | /* Setup and verify the FDT, if it fails we just bail */ |
779 | if (!early_init_dt_verify(fdt)) | 811 | if (!early_init_dt_verify(fdt)) |
780 | return false; | 812 | return false; |
@@ -782,6 +814,9 @@ bool __init dt_cpu_ftrs_init(void *fdt) | |||
782 | if (!of_scan_flat_dt(fdt_find_cpu_features, NULL)) | 814 | if (!of_scan_flat_dt(fdt_find_cpu_features, NULL)) |
783 | return false; | 815 | return false; |
784 | 816 | ||
817 | if (disabled_on_cmdline()) | ||
818 | return false; | ||
819 | |||
785 | cpufeatures_setup_cpu(); | 820 | cpufeatures_setup_cpu(); |
786 | 821 | ||
787 | using_dt_cpu_ftrs = true; | 822 | using_dt_cpu_ftrs = true; |
@@ -1027,5 +1062,8 @@ static int __init dt_cpu_ftrs_scan_callback(unsigned long node, const char | |||
1027 | 1062 | ||
1028 | void __init dt_cpu_ftrs_scan(void) | 1063 | void __init dt_cpu_ftrs_scan(void) |
1029 | { | 1064 | { |
1065 | if (!using_dt_cpu_ftrs) | ||
1066 | return; | ||
1067 | |||
1030 | of_scan_flat_dt(dt_cpu_ftrs_scan_callback, NULL); | 1068 | of_scan_flat_dt(dt_cpu_ftrs_scan_callback, NULL); |
1031 | } | 1069 | } |