21 May, 2019

2 commits


28 Mar, 2019

1 commit


16 Oct, 2018

4 commits

  • Add new GSMI commands (GSMI_CMD_LOG_S0IX_SUSPEND = 0xa,
    GSMI_CMD_LOG_S0IX_RESUME = 0xb) that allow firmware to log any
    information during S0ix suspend/resume paths.

    Traditional ACPI suspend S3 involves BIOS both during the suspend and
    the resume paths. However, modern suspend type like S0ix does not
    involve firmware on either of the paths. This command gives the
    firmware an opportunity to log any required information about the
    suspend and resume operations e.g. wake sources.

    Additionally, this change adds a module parameter to allow platforms
    to specifically enable S0ix logging if required. This prevents any
    other platforms from unnecessarily making a GSMI call which could have
    any side-effects.

    Tested by verifying that wake sources are correctly logged in eventlog.

    Signed-off-by: Furquan Shaikh
    Reviewed-by: Aaron Durbin
    Reviewed-by: Rajat Jain
    Signed-off-by: Furquan Shaikh
    Tested-by: Furquan Shaikh
    Reviewed-by: Aaron Durbin
    [zwisler: update changelog for upstream]
    Signed-off-by: Ross Zwisler
    Reviewed-by: Guenter Roeck
    Signed-off-by: Greg Kroah-Hartman

    Furquan Shaikh
     
  • Instead of selecting EFI and EFI_VARS automatically when GSMI is
    enabled let that portion of the driver be conditionally compiled
    if EFI and EFI_VARS are enabled.

    This allows the rest of the driver (specifically event log) to
    be used if EFI_VARS is not enabled.

    To test:
    1) verify that EFI_VARS is not automatically selected when
    CONFIG_GOOGLE_GSMI is enabled
    2) verify that the kernel boots on Link and that GSMI event log
    is still available and functional
    3) specifically boot the kernel on Alex to ensure it does not
    try to load efivars and that gsmi also does not load because it
    is not in the supported DMI table

    Signed-off-by: Duncan Laurie
    Reviewed-by: Olof Johansson
    Signed-off-by: Benson Leung
    Signed-off-by: Ben Zhang
    Signed-off-by: Filipe Brandenburger
    Signed-off-by: Furquan Shaikh
    Tested-by: Furquan Shaikh
    Reviewed-by: Aaron Durbin
    [zwisler: update changelog for upstream]
    Signed-off-by: Ross Zwisler
    Reviewed-by: Guenter Roeck
    Signed-off-by: Greg Kroah-Hartman

    Duncan Laurie
     
  • In order to use this coreboot needs board support for:
    CONFIG_ELOG=y
    CONFIG_ELOG_GSMI=y

    And the kernel driver needs enabled:
    CONFIG_GOOGLE_GSMI=y

    To test, verify that clean shutdown event is added to the log:

    > mosys eventlog list | grep 'Clean Shutdown'
    11 | 2012-06-25 09:49:24 | Kernl Event | Clean Shutdown

    Signed-off-by: Duncan Laurie
    Reviewed-by: Vadim Bendebury
    Reviewed-by: Stefan Reinauer
    Signed-off-by: Furquan Shaikh
    Tested-by: Furquan Shaikh
    Reviewed-by: Aaron Durbin
    Reviewed-by: Justin TerAvest
    [zwisler: update changelog for upstream]
    Signed-off-by: Ross Zwisler
    Reviewed-by: Guenter Roeck
    Signed-off-by: Greg Kroah-Hartman

    Duncan Laurie
     
  • The sysfs handler should return the number of bytes consumed, which in the
    case of a successful write is the entire buffer. Also fix a bug where
    param.data_len was being set to (count - (2 * sizeof(u32))) instead of just
    (count - sizeof(u32)). The latter is correct because we skip over the
    leading u32 which is our param.type, but we were also incorrectly
    subtracting sizeof(u32) on the line where we were actually setting
    param.data_len:

    param.data_len = count - sizeof(u32);

    This meant that for our example event.kernel_software_watchdog with total
    length 10 bytes, param.data_len was just 2 prior to this change.

    To test, successfully append an event to the log with gsmi sysfs.
    This sample event is for a "Kernel Software Watchdog"

    > xxd -g 1 event.kernel_software_watchdog
    0000000: 01 00 00 00 ad de 06 00 00 00

    > cat event.kernel_software_watchdog > /sys/firmware/gsmi/append_to_eventlog

    > mosys eventlog list | tail -1
    14 | 2012-06-25 10:14:14 | Kernl Event | Software Watchdog

    Signed-off-by: Duncan Laurie
    Reviewed-by: Vadim Bendebury
    Reviewed-by: Stefan Reinauer
    Signed-off-by: Furquan Shaikh
    Tested-by: Furquan Shaikh
    Reviewed-by: Aaron Durbin
    Reviewed-by: Justin TerAvest
    [zwisler: updated changelog for 2nd bug fix and upstream]
    Signed-off-by: Ross Zwisler
    Reviewed-by: Guenter Roeck
    Signed-off-by: Greg Kroah-Hartman

    Duncan Laurie
     

26 Sep, 2018

1 commit


14 Sep, 2018

7 commits

  • This function checks the header for sanity, registers a bus, and
    populates devices for each coreboot table entry. Let's just populate
    devices here and pull the other bits up into the caller so that this
    function can be repurposed for pure device creation and registration.

    Cc: Wei-Ning Huang
    Cc: Julius Werner
    Cc: Brian Norris
    Cc: Samuel Holland
    Suggested-by: Julius Werner
    Signed-off-by: Stephen Boyd
    Reviewed-by: Julius Werner
    Signed-off-by: Greg Kroah-Hartman

    Stephen Boyd
     
  • This is all system memory, so we shouldn't be mapping this all with
    ioremap() as these aren't I/O regions. Instead, they're memory regions
    so we should use memremap(). Pick MEMREMAP_WB so we can map memory from
    RAM directly if that's possible, otherwise it falls back to
    ioremap_cache() like is being done here already. This also nicely
    silences the sparse warnings in this code and reduces the need to copy
    anything around anymore.

    Cc: Wei-Ning Huang
    Cc: Julius Werner
    Cc: Brian Norris
    Cc: Samuel Holland
    Signed-off-by: Stephen Boyd
    Reviewed-by: Julius Werner
    Signed-off-by: Greg Kroah-Hartman

    Stephen Boyd
     
  • The DT based and ACPI based platform drivers here do the same thing; map
    some memory and hand it over to the coreboot bus to populate devices.
    The only major difference is that the DT based driver doesn't map the
    coreboot table header to figure out how large of a region to map for the
    whole coreboot table and it uses of_iomap() instead of ioremap_cache().
    A cached or non-cached mapping shouldn't matter here and mapping some
    smaller region first before mapping the whole table is just more work
    but should be OK. In the end, we can remove two files and combine the
    code all in one place making it easier to reason about things.

    We leave the old Kconfigs in place for a little while longer but make
    them hidden and select the previously hidden config option. This way
    users can upgrade without having to know to reselect this config in the
    future. Later on we can remove the old hidden configs.

    Cc: Wei-Ning Huang
    Cc: Julius Werner
    Cc: Brian Norris
    Cc: Samuel Holland
    Signed-off-by: Stephen Boyd
    Reviewed-by: Julius Werner
    Signed-off-by: Greg Kroah-Hartman

    Stephen Boyd
     
  • The bus is registered in module_init() but is unregistered when the
    platform driver remove() function calls coreboot_table_exit(). That
    isn't symmetric and it causes the bus to appear on systems that compile
    this code in, even when there isn't any coreboot firmware on the device.
    Let's move the registration to the coreboot_table_init() function so
    that it matches the exit path.

    Cc: Wei-Ning Huang
    Cc: Julius Werner
    Cc: Brian Norris
    Cc: Samuel Holland
    Signed-off-by: Stephen Boyd
    Reviewed-by: Julius Werner
    Signed-off-by: Greg Kroah-Hartman

    Stephen Boyd
     
  • Both callers of coreboot_table_init() ioremap the pointer that comes in
    but they don't unmap the memory on failure. Both of them also fail probe
    immediately with the return value of coreboot_table_init(), leaking a
    mapping when it fails. The mapping isn't necessary at all after devices
    are populated either, so we can just drop the mapping here when we exit
    the function. Let's do that to simplify the code a bit and plug the leak.

    Cc: Wei-Ning Huang
    Cc: Julius Werner
    Cc: Brian Norris
    Cc: Samuel Holland
    Fixes: 570d30c2823f ("firmware: coreboot: Expose the coreboot table as a bus")
    Signed-off-by: Stephen Boyd
    Reviewed-by: Julius Werner
    Signed-off-by: Greg Kroah-Hartman

    Stephen Boyd
     
  • Now that the /firmware/coreboot node in DT is populated by the core DT
    platform code with commit 3aa0582fdb82 ("of: platform: populate
    /firmware/ node from of_platform_default_populate_init()") we should and
    can remove the platform device creation here. Otherwise, the
    of_platform_device_create() call will fail, the coreboot of driver won't
    be registered, and this driver will never bind. At the same time, we
    should move this driver to use MODULE_DEVICE_TABLE so that module
    auto-load works properly when the coreboot device is auto-populated and
    we should drop the of_node handling that was presumably placed here to
    hold a reference to the DT node created during module init that no
    longer happens.

    Cc: Wei-Ning Huang
    Cc: Julius Werner
    Reviewed-by: Brian Norris
    Cc: Samuel Holland
    Reviewed-by: Sudeep Holla
    Fixes: 3aa0582fdb82 ("of: platform: populate /firmware/ node from of_platform_default_populate_init()")
    Signed-off-by: Stephen Boyd
    Reviewed-by: Julius Werner
    Signed-off-by: Greg Kroah-Hartman

    Stephen Boyd
     
  • The structure gsmi_dev is local to the source and does not need to be
    in global scope, so make it static.

    Cleans up sparse warning:
    symbol 'gsmi_dev' was not declared. Should it be static?

    Signed-off-by: Colin Ian King
    Signed-off-by: Jean Delvare
    Signed-off-by: Greg Kroah-Hartman

    Colin Ian King
     

02 Aug, 2018

1 commit

  • static struct ro_vpd and rw_vpd are initialized by vpd_sections_init()
    in vpd_probe() based on header's ro and rw sizes.
    In vpd_remove() vpd_section_destroy() performs deinitialization based
    on enabled flag, which is set to true by vpd_sections_init().
    This leads to call of vpd_section_destroy() on already destroyed section
    for probe-release-probe-release sequence if first probe performs
    ro_vpd initialization and second probe does not initialize it.

    The patch adds changing enabled flag on vpd_section_destroy and adds
    cleanup on the error path of vpd_sections_init.

    Found by Linux Driver Verification project (linuxtesting.org).

    Signed-off-by: Anton Vasilyev
    Reviewed-by: Guenter Roeck
    Signed-off-by: Greg Kroah-Hartman

    Anton Vasilyev
     

23 Apr, 2018

5 commits


28 Nov, 2017

3 commits


02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

14 Sep, 2017

1 commit


28 Aug, 2017

1 commit


12 Jun, 2017

1 commit


27 May, 2017

1 commit


25 May, 2017

8 commits

  • There is no reason why VPD should register platform device and driver,
    given that we do not use their respective kobjects to attach attributes,
    nor do we need suspend/resume hooks, or any other features of device
    core.

    Signed-off-by: Dmitry Torokhov
    Reviewed-by: Guenter Roeck
    Signed-off-by: Greg Kroah-Hartman

    Dmitry Torokhov
     
  • ro_vpd and rw_vpd are static module-scope variables that are guaranteed
    to be initialized with zeroes, there is no need for explicit memset().

    Signed-off-by: Dmitry Torokhov
    Reviewed-by: Guenter Roeck
    Signed-off-by: Greg Kroah-Hartman

    Dmitry Torokhov
     
  • When creating name for the "raw" attribute, let's switch to using
    kaspeintf() instead of doing it by hand. Also make sure we handle
    errors.

    Signed-off-by: Dmitry Torokhov
    Reviewed-by: Guenter Roeck
    Signed-off-by: Greg Kroah-Hartman

    Dmitry Torokhov
     
  • Instead of open-coding kstrndup with kzalloc + memcpy, let's use
    the helper.

    Signed-off-by: Dmitry Torokhov
    Reviewed-by: Guenter Roeck
    Signed-off-by: Greg Kroah-Hartman

    Dmitry Torokhov
     
  • kobject_del() only unlinks kobject, we need to use kobject_put() to
    make sure kobject will go away completely.

    Fixes: 049a59db34eb ("firmware: Google VPD sysfs driver")
    Signed-off-by: Dmitry Torokhov
    Reviewed-by: Guenter Roeck
    Signed-off-by: Greg Kroah-Hartman

    Dmitry Torokhov
     
  • We should not free info->key before we remove sysfs attribute that uses
    this data as its name.

    Fixes: 049a59db34eb ("firmware: Google VPD sysfs driver")
    Signed-off-by: Dmitry Torokhov
    Reviewed-by: Guenter Roeck
    Signed-off-by: Greg Kroah-Hartman

    Dmitry Torokhov
     
  • We should only add section attribute to the list of section attributes
    if we successfully created corresponding sysfs attribute.

    Fixes: 049a59db34eb ("firmware: Google VPD sysfs driver")
    Signed-off-by: Dmitry Torokhov
    Reviewed-by: Guenter Roeck
    Signed-off-by: Greg Kroah-Hartman

    Dmitry Torokhov
     
  • The recent coreboot memory console update (firmware: google: memconsole:
    Adapt to new coreboot ring buffer format) introduced a small security
    issue in the driver: The new driver implementation parses the memory
    console structure again on every access. This is intentional so that
    additional lines added concurrently by runtime firmware can be read out.

    However, if an attacker can write to the structure, they could increase
    the size value to a point where the driver would read potentially
    sensitive memory areas from outside the original console buffer during
    the next access. This can be done through /dev/mem, since the console
    buffer usually resides in firmware-reserved memory that is not covered
    by STRICT_DEVMEM.

    This patch resolves that problem by reading the buffer's size value only
    once during boot (where we can still trust the structure). Other parts
    of the structure can still be modified at runtime, but the driver's
    bounds checks make sure that it will never read outside the buffer.

    Fixes: a5061d028 ("firmware: google: memconsole: Adapt to new coreboot ring buffer format")
    Signed-off-by: Julius Werner
    Signed-off-by: Greg Kroah-Hartman

    Julius Werner
     

22 May, 2017

1 commit


18 May, 2017

2 commits

  • This patch fixes several issues:
    - if the 1st 'kzalloc' fails, we dereference a NULL pointer
    - if the 2nd 'kzalloc' fails, there is a memory leak
    - if 'sysfs_create_bin_file' fails there is also a memory leak

    Fix it by adding a test after the first memory allocation and some error
    handling paths to correctly free memory if needed.

    Signed-off-by: Christophe JAILLET
    Signed-off-by: Greg Kroah-Hartman

    Christophe JAILLET
     
  • The upstream coreboot implementation of memconsole was enhanced from a
    single-boot console to a persistent ring buffer
    (https://review.coreboot.org/#/c/18301). This patch changes the kernel
    memconsole driver to be able to read the new format in all cases.

    Signed-off-by: Julius Werner
    Signed-off-by: Greg Kroah-Hartman

    Julius Werner