tapper-autoreport: fix upload handling for Debian

To prevent message: "/bin/netcat -w7 -q7 tapper 7358" file not found,
execute netcat in a "new" shell.

Signed-off-by: cseidel <conny.seidel@amd.com>
tapper-autoreport: revert yesterdays change

- found the issue why it failed in the first place in my script and
  fixed it there.

Signed-off-by: cseidel <conny.seidel@amd.com>
autoreport: Use getconf to determine number of CPUs

Use glibc's getconf to determine the number of available
CPUs through _NPROCESSORS_ONLN system variable.

Signed-off-by: Frank Arnold <frank.arnold@amd.com>
autoreport: Add functions to check for specific NB devices

Add functions to check for for presence of AMD northbridge functions
with specific PCI device ids.

Examples:
has_amd_nb_function_id 0x1204
- Checks vendor id of northbridge function 4 on all nodes
- Checks northbridge function 4 on all nodes for id 0x1204

require_amd_nb_function_id 0x1205 0x1405 0x1605
- Checks vendor id of northbridge function 5 on all nodes
- Checks northbridge function 5 on all nodes for one of the ids
- Skips test on issues

Needed for PCI device driver testing, e.g. fam15_power and k10temp.

Signed-off-by: Frank Arnold <frank.arnold@amd.com>
tapper-autoreport: added "loop-detection" to skip so we can report skipped tests

Signed-off-by: cseidel <conny.seidel@amd.com>
autoreport: Fix get_number_cpus in case of missing getconf

Add the grep "^bogomips" /proc/cpuinfo again in case we
don't have getconf on the system. Also, echo -1 as a default
value when both methods are failing.

Signed-off-by: Frank Arnold <frank.arnold@amd.com>
autoreport: Add get_cpuid_reg function

In addition to the existing get_cpuid_bit function, provide a new
function to read an entire cpuid register. Sometimes we have to
look at bit ranges, and the single bit function doesn't come in
handy for those cases.

Signed-off-by: Frank Arnold <frank.arnold@amd.com>
autoreport: Add get_cpu_stepping function

Add a function to determine the CPU stepping.

Signed-off-by: Frank Arnold <frank.arnold@amd.com>
autoreport: introduce criticality_level()

...to declare how dangerous the script
behaves. There must then be an environment
variable set to run the script of that level
or below.

  $ CRITICALITY=3 prove ./example-05-criticality.t
    All tests successful.

  $ prove ./example-05-criticality.t
    1..0 # skip Too high criticality level 3 (CRITICALITY=0)
    Result: NOTESTS
autoreport: factor out is_amd_family_range()

...to be used separately of require_amd_family_range().
autoreport: rework criticality handling

We now have

  has_crit_level()
  require_crit_level()

as usual.
autoreport: rename LOOP -> EXIT_ON_SKIPALL

...to better describe what it effects
instead of when it is used.
autoreport: Add helper to parse sysfs cpumap and cpulist files

Add two helper functions to parse the content of sysfs cpumap
and cpulist files.

The cpulist format is something like "0-1,5", the cpumap format
looks like "00000000,0000000f".

Both functions result in an expanded, space-separated list of
CPUs, like "0 1 5".

The list may be empty, or "-1" in case of parsing errors.

Signed-off-by: Frank Arnold <frank.arnold@amd.com>
autoreport: Add helpers to enable frequency scaling and set boost state

Add helpers to enable the CPU frequency scaling and initialize it
with sane settings.

The main function enable_cpufreq makes sure the appropriate cpufreq
driver (powernow-k8 or acpi_cpufreq) and the cpufreq-ondemand module
are loaded, sets the ondemand governor on all cores, and sets the core
boosting state to a given value.

Four additional helper functions provide the primary interface:

require_cpb_disabled
  Enables cpufreq and disables boosting.
  In case of errors the calling test is skipped.

require_cpufreq_enabled
  Enables cpufreq and also core boosting.
  In case of errors the calling test is skipped.

request_cpb_disabled
  Enables cpufreq and disables boosting.
  The result will be reported and returned.
  Errors are marked as TODO.

request_cpufreq_enabled
  Enables cpufreq and also core boosting.
  The result will be reported and returned.
  Errors are marked as TODO.

Signed-off-by: Frank Arnold <frank.arnold@amd.com>
autoreport: Fix has_amd_nb_function_id

The lower four bits of the northbridge function device id don't
necessarily indicate the function id. Use a different approach
to determine the overall number of northbridges and check all
available northbridge functions for the specified device id.

Signed-off-by: Frank Arnold <frank.arnold@amd.com>
bugs'n'docs fixes