the following patch was just integrated into master:
commit 546f29dbf1613d40b6b816a87aa3c144b1cd0b90
Author: Patrick Georgi <pgeorgi(a)chromium.org>
Date: Fri Jan 22 12:43:43 2016 +0100
arch/x86: move SetCodeSelector to .text segment
It ended up in .data, and that doesn't seem to be actually necessary.
Change-Id: Ib17d6f9870379d1b7ad7bbd3f16a0839b28f72c8
Signed-off-by: Patrick Georgi <pgeorgi(a)chromium.org>
Reviewed-on: https://review.coreboot.org/13134
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Tested-by: Raptor Engineering Automated Test Stand <noreply(a)raptorengineeringinc.com>
See https://review.coreboot.org/13134 for details.
-gerrit
Martin Roth (martinroth(a)google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13464
-gerrit
commit 9039750eb8a49d7f153d14499c23a107317d7b99
Author: Martin Roth <martinroth(a)google.com>
Date: Mon Jan 25 20:10:14 2016 -0700
kconfig_lint: Add readme document
The readme describes the operation and usage of kconfig_lint.
It also lists all the notes, warnings, and errors that kconfig_lint
looks for.
Change-Id: I873f394ff93fce42cd9638cbbad6134f1aef3a6a
Signed-off-by: Martin Roth <martinroth(a)google.com>
---
util/lint/kconfig_lint_README | 97 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 97 insertions(+)
diff --git a/util/lint/kconfig_lint_README b/util/lint/kconfig_lint_README
new file mode 100644
index 0000000..9076f4c
--- /dev/null
+++ b/util/lint/kconfig_lint_README
@@ -0,0 +1,97 @@
+kconfig_lint is a tool to help identify issues within coreboot's Kconfig
+files. It is very specific to coreboot, and is not intended to be used as a
+generic Kconfig lint tool for other projects.
+
+Operation:
+kconfig_lint parses the entire kconfig tree, building up a hash table of all
+of the statements. It then searches the coreboot tree looking for all usage of
+any Kconfig symbols. By combining these two, it is able to find many issues
+that would be difficult to locate otherwise.
+
+Usage:
+kconfig_lint <options>
+ -o|--output=file Set output filename
+ -p|--print Print full output
+ -e|--errors_off Don't print warnings or errors
+ -w|--warnings_off Don't print warnings
+ -n|--notes Show minor notes
+ -G|--no_git_grep Use standard grep tools instead of git grep
+
+
+Options:
+ -o|--output=file Send the output to a file instead of printing to stdout.
+
+ -p|--print Shows the entire Kconfig tree as parsed by kconfig_lint,
+ including the filename and line number of each statement.
+ This can be very helpful for debugging Kconfig issues.
+
+ -e|--errors_off Suppress both error and warning output. Useful along with
+ the --print command
+
+-w|--warnings_off Suppress warning output
+
+-n|--notes Enable the display of minor notes that kconfig_lint has
+ found. These might be issues, but probably are not.
+
+ -G|--no_git_grep Instead of using the 'git grep' command, use regular grep.
+ This is useful for checking coreboot trees that are not
+ contained in a git repo.
+
+Issues that kconfig_lint checks for:
+
+Notes:
+- Show when the range set for a hex or int does not match a previous range
+
+Warnings in Kconfig files:
+- Any 'default' expressions that can never be reached.
+- Symbols that are defined but never used.
+- Help text starting with no whitespace.
+- Directories specified in a 'source' keyword do not exist.
+- A 'source' keyword loading a Kconfig file that has already been loaded.
+- A 'source' keyword loading a Kconfig file that doesn't exist. Note that
+ globs are excluded from this check.
+
+Warnings in coreboot source files:
+- #define of Kconfig symbol - Symbols should only be defined in Kconfig.
+- #define starting with 'CONFIG_' - these should be reserved for Kconfig
+ symbols.
+- 'IS_ENABLED()' block that could not be interpreted.
+- Kconfig files that are not loaded by a 'source' keyword.
+
+Errors in Kconfig files:
+- Selects do not work on symbols created in a choice block.
+- All symbols used in selects or expressions must be defined in a config
+ statement.
+- 'endchoice' keyword not used in a choice block
+- Choice block defined with no symbols.
+- The 'tristate' type is not used in coreboot.
+- A 'select' keyword used outside of a config block.
+- Symbols created both inside and outside of a choice block.
+- A 'range' keyword has higher minimum than maximum value.
+- A config block with a prompt at the top level (the top level is currently
+ just for menus).
+- Indentation using spaces instead of tabs. We indent using tabs, although
+ the tab may be followed by spaces, particularly for help blocks.
+- Lines not ending with a linefeed. These can cause some keywords to not
+ function properly ('source' keywords in particular). It's also just
+ generally good to end the file with a linefeed.
+
+Errors in Kconfig that are also caught by Kconfig itself:
+- Invalid expressions.
+- Unrecognized keywords.
+- An 'optional' keyword used outside of a choice block
+- The 'select' keyword only works on bool symbols.
+- A 'range' keyword used outside of a config block.
+- A 'default' keyword used outside of a config or choice block.
+- Symbol types must be consistent - they cannot be bool in one location and
+ int in another location.
+- Type keywords (bool, int, hex, string) used outside of a config block.
+- Using a 'prompt' keyword not inside a config or choice block.
+
+Errors in coreboot source files:
+- '#ifdef' or '#if defined' used on bool, int, or hex - these are always
+ defined in coreboot's version of Kconfig.
+- The IS_ENABLED macro is only valid for bool symbols.
+- The IS_ENABLED used on unknown CONFIG_ value, like an obsolete symbol.
+
+TODO: check for choice entries at the top level
Martin Roth (martinroth(a)google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13463
-gerrit
commit 15c7b88a2e1a071692b104b76fd79a6b4a8c6e47
Author: Martin Roth <martinroth(a)google.com>
Date: Mon Jan 25 19:54:16 2016 -0700
kconfig_lint: add comments and whitespace fixes.
No functional changes.
Change-Id: I40284b68ddda7e19741c5306a8c74761c00e4b35
Signed-off-by: Martin Roth <martinroth(a)google.com>
---
util/lint/kconfig_lint | 27 +++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)
diff --git a/util/lint/kconfig_lint b/util/lint/kconfig_lint
index bec86e4..adb42c8 100755
--- a/util/lint/kconfig_lint
+++ b/util/lint/kconfig_lint
@@ -42,14 +42,14 @@ my $exclude_dirs_and_files =
'^build/\|^coreboot-builds/\|^payloads/libpayload\|^payloads/coreinfo\|^configs/\|^util/\|^\.git/'
. '\|' . # directories to exclude when searching for used symbols
'\.txt$\|\.tex$\|\.tags'; #files to exclude when looking for symbols
-my $config_file = ""; # name of config file to load symbol values from.
-my @wholeconfig; # document the entire kconfig structure
-my %loaded_files; # list of each Kconfig file loaded
-my %symbols; # main structure of all symbols declared
-my %referenced_symbols; # list of symbols referenced by expressions or select statements
-my %used_symbols; # structure of symbols used in the tree, and where they're found
-my @collected_symbols; #
-my %selected_symbols; # list of symbols that are enabled by a select statement
+my $config_file = ""; # name of config file to load symbol values from.
+my @wholeconfig; # document the entire kconfig structure
+my %loaded_files; # list of each Kconfig file loaded
+my %symbols; # main structure of all symbols declared
+my %referenced_symbols; # list of symbols referenced by expressions or select statements
+my %used_symbols; # structure of symbols used in the tree, and where they're found
+my @collected_symbols; #
+my %selected_symbols; # list of symbols that are enabled by a select statement
my $exclude_unused = '_SPECIFIC_OPTIONS|SOUTH_BRIDGE_OPTIONS';
@@ -419,7 +419,6 @@ sub build_and_parse_kconfig_tree {
#start the tree off by loading the top level kconfig
@config_to_parse = load_kconfig_file( $top_level_kconfig, "", 0, 0, "", 0 );
-
while ( ( @parseline = shift(@config_to_parse) ) && ( exists $parseline[0]{text} ) ) {
my $line = $parseline[0]{text};
my $filename = $parseline[0]{filename};
@@ -504,6 +503,8 @@ sub build_and_parse_kconfig_tree {
$inside_config = "";
$inside_choice = "$filename $line_no";
$configs_inside_choice = 0;
+
+ # Kconfig verifies that choice blocks have a prompt
}
# endchoice
@@ -535,6 +536,10 @@ sub build_and_parse_kconfig_tree {
# mainmenu <prompt>
elsif ( $line =~ /^\s*mainmenu/ ) {
$inside_config = "";
+
+ # Kconfig alread checks for multiple 'mainmenu' entries and mainmenu entries with no prompt
+ # Possible check: look for 'mainmenu ""'
+ # Possible check: verify that a mainmenu has been specified
}
# menu <prompt>
@@ -564,7 +569,6 @@ sub build_and_parse_kconfig_tree {
my $expr = $1;
push( @inside_if, $expr );
handle_expressions( $expr, $inside_config, $filename, $line_no );
-
}
# endif
@@ -679,7 +683,6 @@ sub add_symbol {
}
}
-
# add the location of this instance
my $symcount = $symbols{$symbol}{count};
$symbols{$symbol}{$symcount}{file} = $filename;
@@ -987,6 +990,7 @@ sub handle_prompt {
$prompt = $1;
}
+ #display an error if there's a prompt at the top menu level
if ( !defined @$menu_array_ref[0] ) {
show_error( "Symbol '$inside_config' with prompt '$prompt' appears outside of a menu"
. " at $filename:$line_no." );
@@ -1145,7 +1149,6 @@ sub load_kconfig_file {
return @dir_file_data;
}
-
#-------------------------------------------------------------------------------
# print_wholeconfig - prints out the parsed Kconfig file
#-------------------------------------------------------------------------------
Martin Roth (martinroth(a)google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13462
-gerrit
commit 9a9679515997e915a23f98caf903cf956a2112af
Author: Martin Roth <martinroth(a)google.com>
Date: Mon Jan 25 16:45:14 2016 -0700
kconfig_lint: Skip temp files when looking for unused Kconfig files.
Don't warn on Kconfig.orig and Kconfig~ files when trying to verify
that all the Kconfig files in the coreboot source tree are being loaded.
Change-Id: Ie7babe60b29735e5ccc5f93f4e42ad82dfb47044
Signed-off-by: Martin Roth <martinroth(a)google.com>
---
util/lint/kconfig_lint | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/util/lint/kconfig_lint b/util/lint/kconfig_lint
index 2fbaf97..bec86e4 100755
--- a/util/lint/kconfig_lint
+++ b/util/lint/kconfig_lint
@@ -1168,7 +1168,11 @@ sub print_wholeconfig {
#-------------------------------------------------------------------------------
sub check_if_file_referenced {
my $filename = $File::Find::name;
- if ( ( $filename =~ /Kconfig/ ) && ( !exists $loaded_files{$filename} ) ) {
+ if ( ( $filename =~ /Kconfig/ )
+ && ( !$filename =~ /\.orig$/ )
+ && ( !$filename =~ /~$/ )
+ && ( !exists $loaded_files{$filename} ) )
+ {
show_warning("'$filename' is never referenced");
}
}
Martin Roth (martinroth(a)google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13461
-gerrit
commit b778d64b2a8ffb768c907b5d986b8a6b26384453
Author: Martin Roth <martinroth(a)google.com>
Date: Mon Jan 25 16:42:13 2016 -0700
kconfig_lint: Update prompt structure
- The prompts were not getting incremented, so each prompt for a symbol
would overwrite the previous.
- Record the menu each prompt is in.
Change-Id: Ia282a30344d5e135f4f2027be9aff0e49a4e5edb
Signed-off-by: Martin Roth <martinroth(a)google.com>
---
util/lint/kconfig_lint | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/util/lint/kconfig_lint b/util/lint/kconfig_lint
index 8bdca8d..2fbaf97 100755
--- a/util/lint/kconfig_lint
+++ b/util/lint/kconfig_lint
@@ -993,12 +993,17 @@ sub handle_prompt {
}
my $sym_num = $symbols{$inside_config}{count};
- unless ( exists $symbols{$inside_config}{$sym_num}{prompt_max} ) {
+ if ( !exists $symbols{$inside_config}{$sym_num}{prompt_max} ) {
$symbols{$inside_config}{$sym_num}{prompt_max} = 0;
}
+ else {
+ $symbols{$inside_config}{$sym_num}{prompt_max}++;
+ }
my $prompt_max = $symbols{$inside_config}{$sym_num}{prompt_max};
$symbols{$inside_config}{$sym_num}{prompt}{$prompt_max}{prompt} = $prompt;
$symbols{$inside_config}{$sym_num}{prompt}{$prompt_max}{prompt_line_no} = $line_no;
+
+ $symbols{$inside_config}{$sym_num}{prompt}{$prompt_max}{prompt_menu} = @$menu_array_ref;
if ($expression) {
$symbols{$inside_config}{$sym_num}{prompt}{$prompt_max}{prompt_depends_on} = $expression;
}
Martin Roth (martinroth(a)google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13460
-gerrit
commit e320cd2b73cc29cb792405a89e168e2baf49ddba
Author: Martin Roth <martinroth(a)google.com>
Date: Mon Jan 25 16:39:32 2016 -0700
kconfig_ling: Add warning if tristate type is used in coreboot
Although there's no reason we COULDN"T use tristate types, we haven't
up to this point. If there's a good reason to use them in the future,
this check can be removed.
Change-Id: I5f1903341f522bc957e394bc0fd288ba1adab431
Signed-off-by: Martin Roth <martinroth(a)google.com>
---
util/lint/kconfig_lint | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/util/lint/kconfig_lint b/util/lint/kconfig_lint
index 9384336..8bdca8d 100755
--- a/util/lint/kconfig_lint
+++ b/util/lint/kconfig_lint
@@ -949,6 +949,10 @@ sub handle_type {
my $expression;
( $type, $expression ) = handle_if_line( $type, $inside_config, $filename, $line_no );
+ if ( $type =~ /tristate/ ) {
+ show_warning("$filename:$line_no - tristate types are not used.");
+ }
+
if ($inside_config) {
if ( exists( $symbols{$inside_config}{type} ) ) {
if ( $symbols{$inside_config}{type} !~ /$type/ ) {
Martin Roth (martinroth(a)google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13459
-gerrit
commit 067e885fda87ed78d825f8884e8cf26da5b518bb
Author: Martin Roth <martinroth(a)google.com>
Date: Mon Jan 25 16:38:05 2016 -0700
kconfig_lint: merge 'git grep' and 'grep' exclude dir and files
The code had originally been using standard grep to look through the
coreboot tree for Kconfig symbols. When this was switched to git grep,
the --exclude-dir options didn't work, and nothing was added to exclude
the directories that shouldn't be searched for symbols. This resulted
in invalid warnings as it searched directories that had Kconfig symbols
for other projects.
This merges the exclusion list for both the regular and git versions
of grep for consistent behavior.
Change-Id: I7fed8b9fa827cb14f7373e7b774acc56e43cb6ff
Signed-off-by: Martin Roth <martinroth(a)google.com>
---
util/lint/kconfig_lint | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/util/lint/kconfig_lint b/util/lint/kconfig_lint
index 2cb125e..9384336 100755
--- a/util/lint/kconfig_lint
+++ b/util/lint/kconfig_lint
@@ -612,6 +612,21 @@ sub build_and_parse_kconfig_tree {
show_error("$line ($filename:$line_no unrecognized)");
}
+ if ( defined $inside_menu[0] ) {
+ $parseline[0]{menus} = "";
+ }
+ else {
+ $parseline[0]{menus} = "top";
+ }
+
+ my $i = 0;
+ while ( defined $inside_menu[$i] ) {
+ $parseline[0]{menus} .= "$inside_menu[$i]";
+ $i++;
+ if ( defined $inside_menu[$i] ) {
+ $parseline[0]{menus} .= "->";
+ }
+ }
push @wholeconfig, @parseline;
}
}
@@ -1135,7 +1150,7 @@ sub print_wholeconfig {
#replace tabs with spaces for consistency
$line->{text} =~ s/\t/ /g;
- printf "%-120s # $line->{filename} line $line->{file_line_no}\n", $line->{text};
+ printf "%-120s # $line->{filename} line $line->{file_line_no} ($line->{menus})\n", $line->{text};
}
}
Martin Roth (martinroth(a)google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13458
-gerrit
commit fac977babdc0ae4dff102c010f0cea16fbd9b0bc
Author: Martin Roth <martinroth(a)google.com>
Date: Mon Jan 25 16:14:09 2016 -0700
kconfig_lint: Don't look at IS_ENABLED() text in comments.
This fixes at least one kconfig_lint warning.
Change-Id: I35edf57e90315a8372aaf3b41e923cd8dad7386a
Signed-off-by: Martin Roth <martinroth(a)google.com>
---
util/lint/kconfig_lint | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/util/lint/kconfig_lint b/util/lint/kconfig_lint
index 44e898f..2cb125e 100755
--- a/util/lint/kconfig_lint
+++ b/util/lint/kconfig_lint
@@ -253,7 +253,7 @@ sub check_is_enabled {
my $file = $1;
my $lineno = $2;
$line = $3;
- if ( $line !~ /(.*)IS_ENABLED\s*\(\s*CONFIG_(\w+)(.*)/ ) {
+ if ( ( $line !~ /(.*)IS_ENABLED\s*\(\s*CONFIG_(\w+)(.*)/ ) && ( $line !~ /(\/[\*\/])(.*)IS_ENABLED/ ) ) {
show_warning("# uninterpreted IS_ENABLED at $file:$lineno: $line");
next;
}
Martin Roth (martinroth(a)google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13457
-gerrit
commit a70eaa603365ee9b36eec53af96a1f87ccf6ef07
Author: Martin Roth <martinroth(a)google.com>
Date: Mon Jan 25 16:12:49 2016 -0700
kconfig_lint: Exclude some Kconfig symbols from unused symbol checks
The configuration that coreboot uses for setting selected symbols
typically involves a structure like this:
config BLEH_SPECIFIC_OPTIONS
def_bool y
select SYMBOL
This leads to an an extra kconfig symbol BLEH_SPECIFIC_OPTIONS
that is never referenced by anything else, generating a warning.
Since this is currently the construct that coreboot uses, filter it
out of the warnings for now.
Change-Id: I85a95e4c4e8469870c7f219f2a92955819845573
Signed-off-by: Martin Roth <martinroth(a)google.com>
---
util/lint/kconfig_lint | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/util/lint/kconfig_lint b/util/lint/kconfig_lint
index 4315768..44e898f 100755
--- a/util/lint/kconfig_lint
+++ b/util/lint/kconfig_lint
@@ -51,6 +51,8 @@ my %used_symbols; # structure of symbols used in the tree, and where th
my @collected_symbols; #
my %selected_symbols; # list of symbols that are enabled by a select statement
+my $exclude_unused = '_SPECIFIC_OPTIONS|SOUTH_BRIDGE_OPTIONS';
+
Main();
#-------------------------------------------------------------------------------
@@ -380,6 +382,10 @@ sub check_used_symbols {
# loop through all defined symbols and see if they're used anywhere
foreach my $key ( sort ( keys %symbols ) ) {
+ if ( $key =~ /$exclude_unused/ ) {
+ next;
+ }
+
#see if they're used internal to Kconfig
next if ( exists $referenced_symbols{$key} );