15 Sep, 2018

1 commit

  • [ Upstream commit 5971b0c1594d6c34e257101ed5fdffec65205c50 ]

    Since commit 63347db0affa "ACPI / scan: Use acpi_bus_get_status() to
    initialize ACPI_TYPE_DEVICE devs" the status field of normal acpi_devices
    gets set to 0 by acpi_bus_type_and_status() and filled with its actual
    value later when acpi_add_single_object() calls acpi_bus_get_status().

    This means that any acpi_match_device_ids() calls in between will always
    fail with -ENOENT.

    We already have a workaround for this, which temporary forces status to
    ACPI_STA_DEFAULT in drivers/acpi/x86/utils.c: acpi_device_always_present()
    and the next commit in this series adds another acpi_match_device_ids()
    call between status being initialized as 0 and the acpi_bus_get_status()
    call.

    Rather then adding another workaround, this commit makes
    acpi_bus_type_and_status() initialize status to ACPI_STA_DEFAULT, this is
    safe to do as the only code looking at status between the initialization
    and the acpi_bus_get_status() call is those acpi_match_device_ids() calls.

    Note this does mean that we need to (re)set status to 0 in case the
    acpi_bus_get_status() call fails.

    Signed-off-by: Hans de Goede
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Hans de Goede
     

24 Aug, 2018

4 commits

  • [ Upstream commit 2c4d6baf1bc4f7729773ffcee9ba2a9781578633 ]

    The ec_no_wakeup matcher added for Thinkpad X1 Carbon 6th gen systems
    beyond matched only a single DMI model (20KGS3JF01), that didn't cover
    my laptop (20KH002JUS). Change to match based on DMI product family to
    cover all X1 6th gen systems.

    Signed-off-by: Robin H. Johnson
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Robin H. Johnson
     
  • [ Upstream commit ee6581ceba7f8314b81b2f2a81f1cf3f67c679e2 ]

    Incremental patch to fix the unchecked dereference in acpi_nfit_ctl.
    Reported by Dan Carpenter:

    "acpi/nfit: fix cmd_rc for acpi_nfit_ctl to
    always return a value" from Jun 28, 2018, leads to the following
    Smatch complaint:

    drivers/acpi/nfit/core.c:578 acpi_nfit_ctl()
    warn: variable dereferenced before check 'cmd_rc' (see line 411)

    drivers/acpi/nfit/core.c
    410
    411 *cmd_rc = -EINVAL;
    ^^^^^^^^^^^^^^^^^^
    Patch adds unchecked dereference.

    Fixes: c1985cefd844 ("acpi/nfit: fix cmd_rc for acpi_nfit_ctl to always return a value")

    Signed-off-by: Dave Jiang
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Dave Jiang
     
  • [ Upstream commit c1985cefd844e26bd19673a6df8d8f0b1918c2db ]

    cmd_rc is passed in by reference to the acpi_nfit_ctl() function and the
    caller expects a value returned. However, when the package is pass through
    via the ND_CMD_CALL command, cmd_rc is not touched. Make sure cmd_rc is
    always set.

    Fixes: aef253382266 ("libnvdimm, nfit: centralize command status translation")

    Signed-off-by: Dave Jiang
    Signed-off-by: Dan Williams
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Dave Jiang
     
  • [ Upstream commit 8195a655e5ce09550aff81b2573d9b015d520cb9 ]

    On this system EC interrupt triggers constantly kicking devices out of
    low power states and thus blocking power management. The system also has
    a PCIe root port hosting Alpine Ridge Thunderbolt controller and it
    never gets a chance to go to D3cold because of this.

    Since the power button works the same regardless if EC interrupt is
    enabled or not during s2idle, add a quirk for this machine that sets
    ec_no_wakeup=true preventing spurious wakeups.

    Signed-off-by: Mika Westerberg
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Mika Westerberg
     

22 Aug, 2018

1 commit

  • commit 231f9415001138a000cd0f881c46654b7ea3f8c5 upstream.

    Every time I tried to upgrade my laptop from 3.10.x to 4.x I faced an
    issue by which the fan would run at full speed upon resume. Bisecting
    it showed me the issue was introduced in 3.17 by commit 821d6f0359b0
    (ACPI / sleep: Do not save NVS for new machines to accelerate S3). This
    code only affects machines built starting as of 2012, but this Asus
    1025C laptop was made in 2012 and apparently needs the NVS data to be
    saved, otherwise the CPU's thermal state is not properly reported on
    resume and the fan runs at full speed upon resume.

    Here's a very simple way to check if such a machine is affected :

    # cat /sys/class/thermal/thermal_zone0/temp
    55000

    ( now suspend, wait one second and resume )

    # cat /sys/class/thermal/thermal_zone0/temp
    0

    (and after ~15 seconds the fan starts to spin)

    Let's apply the same quirk as commit cbc00c13 (ACPI: save NVS memory
    for Lenovo G50-45) and reuse the function it provides. Note that this
    commit was already backported to 4.9.x but not 4.4.x.

    Cc: 3.17+ # 3.17+: requires cbc00c13
    Signed-off-by: Willy Tarreau
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Greg Kroah-Hartman

    Willy Tarreau
     

18 Aug, 2018

1 commit

  • commit 520e18a5080d2c444a03280d99c8a35cb667d321 upstream.

    Now that nothing is using the ghes_ioremap_area pages, rip them out.

    Signed-off-by: James Morse
    Reviewed-by: Borislav Petkov
    Tested-by: Tyler Baicar
    Signed-off-by: Rafael J. Wysocki
    Cc: All applicable
    Signed-off-by: Sudip Mukherjee
    Signed-off-by: Greg Kroah-Hartman

    James Morse
     

03 Aug, 2018

2 commits

  • [ Upstream commit c975e472ec12392a0c34de1350e634310f8a1dea ]

    The Point of View mobii wintab p800w Bay Trail tablet comes with a Crystal
    Cove PMIC, yet uses the LPSS PWM for backlight control, rather then the
    Crystal Cove's PWM, so we need to call pwm_add_table() to add a
    pwm_backlight mapping for the LPSS pwm despite there being an INT33FD
    ACPI device present.

    On all Bay Trail devices the _HRV object of the INT33FD ACPI device
    will normally return 2, to indicate the Bay Trail variant of the CRC
    PMIC is present, except on this tablet where _HRV is 0xffff. I guess this
    is a hack to make the windows Crystal Cove PWM driver not bind.

    Out of the 44 DSTDs with an INT33FD device in there which I have (from
    different model devices) only the pov mobii wintab p800w uses 0xffff for
    the HRV.

    The byt_pwm_setup code calls acpi_dev_present to check for the presence
    of a INT33FD ACPI device which indicates that a CRC PMIC is present and
    if the INT33FD ACPI device is present then byt_pwm_setup will not add
    a pwm_backlight mapping for the LPSS pwm, so that the CRC PWM will get
    used instead.

    acpi_dev_present has a hrv parameter, this commit make us pass 2 instead
    of -1, so that things still match on normal tablets, but on this special
    case with its _HRV of 0xffff, the check will now fail so that the
    pwm_backlight mapping for the LPSS pwm gets added fixing backlight
    brightness control on this device.

    Signed-off-by: Hans de Goede
    Reviewed-by: Andy Shevchenko
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Hans de Goede
     
  • [ Upstream commit 408fec36a1ab3d14273c2116b449ef1e9be3cb8b ]

    Currently we request control of native PCIe hotplug unconditionally.
    Native PCIe hotplug events are handled by the pciehp driver, and if it is
    not enabled those events will be lost.

    Request control of native PCIe hotplug only if the pciehp driver is
    enabled, so we will actually handle native PCIe hotplug events.

    Suggested-by: Bjorn Helgaas
    Signed-off-by: Mika Westerberg
    Signed-off-by: Bjorn Helgaas
    Reviewed-by: Rafael J. Wysocki
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Mika Westerberg
     

08 Jul, 2018

1 commit

  • commit d2d2e3c46be5d6dd8001d0eebdf7cafb9bc7006b upstream.

    Sometimes memory resource may be overlapping with
    SystemMemory Operation Region by design, for example if the
    memory region is used as a mailbox for communication with a
    firmware in the system. One occasion of such mailboxes is
    USB Type-C Connector System Software Interface (UCSI).

    With regions like that, it is important that the driver is
    able to map the memory with the requirements it has. For
    example, the driver should be allowed to map the memory as
    non-cached memory. However, if the operation region has been
    accessed before the driver has mapped the memory, the memory
    has been marked as write-back by the time the driver is
    loaded. That means the driver will fail to map the memory
    if it expects non-cached memory.

    To work around the problem, introducing helper that the
    drivers can use to temporarily deactivate (unmap)
    SystemMemory Operation Regions that overlap with their
    IO memory.

    Fixes: 8243edf44152 ("usb: typec: ucsi: Add ACPI driver")
    Cc: stable@vger.kernel.org
    Reviewed-by: Rafael J. Wysocki
    Signed-off-by: Heikki Krogerus
    Signed-off-by: Greg Kroah-Hartman

    Heikki Krogerus
     

03 Jul, 2018

1 commit

  • commit fdcb613d49321b5bf5d5a1bd0fba8e7c241dcc70 upstream.

    The LPSS PWM device on on Bay Trail and Cherry Trail devices has a set
    of private registers at offset 0x800, the current lpss_device_desc for
    them already sets the LPSS_SAVE_CTX flag to have these saved/restored
    over device-suspend, but the current lpss_device_desc was not setting
    the prv_offset field, leading to the regular device registers getting
    saved/restored instead.

    This is causing the PWM controller to no longer work, resulting in a black
    screen, after a suspend/resume on systems where the firmware clears the
    APB clock and reset bits at offset 0x804.

    This commit fixes this by properly setting prv_offset to 0x800 for
    the PWM devices.

    Cc: stable@vger.kernel.org
    Fixes: e1c748179754 ("ACPI / LPSS: Add Intel BayTrail ACPI mode PWM")
    Fixes: 1bfbd8eb8a7f ("ACPI / LPSS: Add ACPI IDs for Intel Braswell")
    Signed-off-by: Hans de Goede
    Acked-by: Rafael J . Wysocki
    Signed-off-by: Thierry Reding
    Signed-off-by: Greg Kroah-Hartman

    Hans de Goede
     

21 Jun, 2018

2 commits

  • [ Upstream commit a0a37862a4e1844793d39aca9ccb8fecbdcb8659 ]

    WDAT table on Lenovo Z50-70 is using RTC SRAM (ports 0x70 and 0x71) to
    store state of the timer. This conflicts with Linux RTC driver
    (rtc-cmos.c) who fails to reserve those ports for itself preventing RTC
    from functioning. In addition the WDAT table seems not to be fully
    functional because it does not reset the system when the watchdog times
    out.

    On this system iTCO_wdt works just fine so we simply prefer to use it
    instead of WDAT. This makes RTC working again and also results working
    watchdog via iTCO_wdt.

    Reported-by: Peter Milley
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=199033
    Signed-off-by: Mika Westerberg
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Mika Westerberg
     
  • [ Upstream commit 855c1c2fce8bdbd796cba1d1456ca8f0e876c2f1 ]

    ThinkPad X1 Tablet(2016) is reported to have issues with
    the Low Power S0 Idle _DSM interface and since this machine
    model generally can do ACPI S3 just fine, and user would
    like to use S3 as default sleep model, add a blacklist
    entry to disable that interface for ThinkPad X1 Tablet(2016).

    Link: https://bugzilla.kernel.org/show_bug.cgi?id=199057
    Reported-and-tested-by: Robin Lee
    Signed-off-by: Chen Yu
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Chen Yu
     

30 May, 2018

4 commits

  • [ Upstream commit 97f3c0a4b0579b646b6b10ae5a3d59f0441cc12c ]

    I found an ACPI cache leak in ACPI early termination and boot continuing case.

    When early termination occurs due to malicious ACPI table, Linux kernel
    terminates ACPI function and continues to boot process. While kernel terminates
    ACPI function, kmem_cache_destroy() reports Acpi-Operand cache leak.

    Boot log of ACPI operand cache leak is as follows:
    >[ 0.464168] ACPI: Added _OSI(Module Device)
    >[ 0.467022] ACPI: Added _OSI(Processor Device)
    >[ 0.469376] ACPI: Added _OSI(3.0 _SCP Extensions)
    >[ 0.471647] ACPI: Added _OSI(Processor Aggregator Device)
    >[ 0.477997] ACPI Error: Null stack entry at ffff880215c0aad8 (20170303/exresop-174)
    >[ 0.482706] ACPI Exception: AE_AML_INTERNAL, While resolving operands for [opcode_name unavailable] (20170303/dswexec-461)
    >[ 0.487503] ACPI Error: Method parse/execution failed [\DBG] (Node ffff88021710ab40), AE_AML_INTERNAL (20170303/psparse-543)
    >[ 0.492136] ACPI Error: Method parse/execution failed [\_SB._INI] (Node ffff88021710a618), AE_AML_INTERNAL (20170303/psparse-543)
    >[ 0.497683] ACPI: Interpreter enabled
    >[ 0.499385] ACPI: (supports S0)
    >[ 0.501151] ACPI: Using IOAPIC for interrupt routing
    >[ 0.503342] ACPI Error: Null stack entry at ffff880215c0aad8 (20170303/exresop-174)
    >[ 0.506522] ACPI Exception: AE_AML_INTERNAL, While resolving operands for [opcode_name unavailable] (20170303/dswexec-461)
    >[ 0.510463] ACPI Error: Method parse/execution failed [\DBG] (Node ffff88021710ab40), AE_AML_INTERNAL (20170303/psparse-543)
    >[ 0.514477] ACPI Error: Method parse/execution failed [\_PIC] (Node ffff88021710ab18), AE_AML_INTERNAL (20170303/psparse-543)
    >[ 0.518867] ACPI Exception: AE_AML_INTERNAL, Evaluating _PIC (20170303/bus-991)
    >[ 0.522384] kmem_cache_destroy Acpi-Operand: Slab cache still has objects
    >[ 0.524597] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.12.0-rc5 #26
    >[ 0.526795] Hardware name: innotek gmb_h virtual_box/virtual_box, BIOS virtual_box 12/01/2006
    >[ 0.529668] Call Trace:
    >[ 0.530811] ? dump_stack+0x5c/0x81
    >[ 0.532240] ? kmem_cache_destroy+0x1aa/0x1c0
    >[ 0.533905] ? acpi_os_delete_cache+0xa/0x10
    >[ 0.535497] ? acpi_ut_delete_caches+0x3f/0x7b
    >[ 0.537237] ? acpi_terminate+0xa/0x14
    >[ 0.538701] ? acpi_init+0x2af/0x34f
    >[ 0.540008] ? acpi_sleep_proc_init+0x27/0x27
    >[ 0.541593] ? do_one_initcall+0x4e/0x1a0
    >[ 0.543008] ? kernel_init_freeable+0x19e/0x21f
    >[ 0.546202] ? rest_init+0x80/0x80
    >[ 0.547513] ? kernel_init+0xa/0x100
    >[ 0.548817] ? ret_from_fork+0x25/0x30
    >[ 0.550587] vgaarb: loaded
    >[ 0.551716] EDAC MC: Ver: 3.0.0
    >[ 0.553744] PCI: Probing PCI hardware
    >[ 0.555038] PCI host bridge to bus 0000:00
    > ... Continue to boot and log is omitted ...

    I analyzed this memory leak in detail and found acpi_ns_evaluate() function
    only removes Info->return_object in AE_CTRL_RETURN_VALUE case. But, when errors
    occur, the status value is not AE_CTRL_RETURN_VALUE, and Info->return_object is
    also not null. Therefore, this causes acpi operand memory leak.

    This cache leak causes a security threat because an old kernel (
    Signed-off-by: Erik Schmauss
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Seunghun Han
     
  • [ Upstream commit 1c29c372b2d1d2415601041532745ce859f24126 ]

    Fixes a single-object memory leak on a store-to-reference method
    invocation. ACPICA BZ 1439.

    Signed-off-by: Bob Moore
    Signed-off-by: Erik Schmauss
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Bob Moore
     
  • [ Upstream commit b4c0de312613ca676db5bd7e696a44b56795612a ]

    This ensures that acpi_ev_fixed_event_detect() does not use fixed_status
    and and fixed_enable as uninitialized variables.

    Signed-off-by: Erik Schmauss
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Erik Schmauss
     
  • [ Upstream commit 8b29d29abc484d638213dd79a18a95ae7e5bb402 ]

    Fix once per second (round_robin_time) memory leak of about 1 KB in
    each acpi_pad kernel idling thread that is activated.

    Found by testing with kmemleak.

    Signed-off-by: Lenny Szubowicz
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Lenny Szubowicz
     

09 May, 2018

1 commit

  • commit ac1e55b1fdb27c1b07a0a6fe519f1291ff1e7d40 upstream.

    Modules such as nouveau.ko and i915.ko have a link time dependency on
    acpi_lid_open(), and due to its use of acpi_bus_register_driver(),
    the button.ko module that provides it is only loadable when booted in
    ACPI mode. However, the ACPI button driver can be built into the core
    kernel as well, in which case the dependency can always be satisfied,
    and the dependent modules can be loaded regardless of whether the
    system was booted in ACPI mode or not.

    So let's fix this asymmetry by making the ACPI button driver loadable
    as a module even if not booted in ACPI mode, so it can provide the
    acpi_lid_open() symbol in the same way as when built into the kernel.

    Signed-off-by: Ard Biesheuvel
    [ rjw: Minor adjustments of comments, whitespace and names. ]
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Greg Kroah-Hartman

    Ard Biesheuvel
     

29 Apr, 2018

1 commit

  • commit 53fa1f6e8a5958da698a31edf366ffe90596b490 upstream.

    Commit 5928c281524f (ACPI / video: Default lcd_only to true on Win8-ready
    and newer machines) made only_lcd default to true on all machines where
    acpi_osi_is_win8() returns true, including laptops.

    The purpose of this is to avoid the bogus / non-working acpi backlight
    interface which many newer BIOS-es define on desktop machines.

    But this is causing a regression on some laptops, specifically on the
    Dell XPS 13 2013 model, which does not have the LCD flag set for its
    fully functional ACPI backlight interface.

    Rather then DMI quirking our way out of this, this commits changes the
    logic for setting only_lcd to true, to only do this on machines with
    a desktop (or server) dmi chassis-type.

    Note that we cannot simply only check the chassis-type and not register
    the backlight interface based on that as there are some laptops and
    tablets which have their chassis-type set to "3" aka desktop. Hopefully
    the combination of checking the LCD flag, but only on devices with
    a desktop(ish) chassis-type will avoid the needs for DMI quirks for this,
    or at least limit the amount of DMI quirks which we need to a minimum.

    Fixes: 5928c281524f (ACPI / video: Default lcd_only to true on Win8-ready and newer machines)
    Reported-and-tested-by: James Hogan
    Signed-off-by: Hans de Goede
    Cc: 4.15+ # 4.15+
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Greg Kroah-Hartman

    Hans de Goede
     

26 Apr, 2018

5 commits

  • [ Upstream commit 3cd091a773936c54344a519f7ee1379ccb620bee ]

    Commit 662591461c4b (ACPI / EC: Drop EC noirq hooks to fix a
    regression) modified the ACPI EC driver so that it doesn't switch
    over to busy polling mode during noirq stages of system suspend and
    resume in an attempt to fix an issue resulting from that behavior.

    However, that modification introduced a system resume regression on
    Thinkpad X240, so make the EC driver switch over to the polling mode
    during noirq stages of system suspend and resume again, which
    effectively reverts the problematic commit.

    Fixes: 662591461c4b (ACPI / EC: Drop EC noirq hooks to fix a regression)
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=197863
    Reported-by: Markus Demleitner
    Tested-by: Markus Demleitner
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Rafael J. Wysocki
     
  • [ Upstream commit 63347db0affadcbccd5613116ea8431c70139b3e ]

    The acpi_get_bus_status wrapper for acpi_bus_get_status_handle has some
    code to handle certain device quirks, in some cases we also need this
    quirk handling for the initial _STA call.

    Specifically on some devices calling _STA before all _DEP dependencies
    are met results in errors like these:

    [ 0.123579] ACPI Error: No handler for Region [ECRM] (00000000ba9edc4c)
    [GenericSerialBus] (20170831/evregion-166)
    [ 0.123601] ACPI Error: Region GenericSerialBus (ID=9) has no handler
    (20170831/exfldio-299)
    [ 0.123618] ACPI Error: Method parse/execution failed
    \_SB.I2C1.BAT1._STA, AE_NOT_EXIST (20170831/psparse-550)

    acpi_get_bus_status already has code to avoid this, so by using it we
    also silence these errors from the initial _STA call.

    Note that in order for the acpi_get_bus_status handling for this to work,
    we initialize dep_unmet to 1 until acpi_device_dep_initialize gets called,
    this means that battery devices will be instantiated with an initial
    status of 0. This is not a problem, acpi_bus_attach will get called soon
    after the instantiation anyways and it will update the status as first
    point of order.

    Signed-off-by: Hans de Goede
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Hans de Goede
     
  • [ Upstream commit 54ddce7062242036402242242c07c60c0b505f84 ]

    The battery code uses acpi_device->dep_unmet to check for unmet deps and
    if there are unmet deps it does not bind to the device to avoid errors
    about missing OpRegions when calling ACPI methods on the device.

    The missing OpRegions when there are unmet deps problem also applies to
    the _STA method of some battery devices and calling it too early results
    in errors like these:

    [ 0.123579] ACPI Error: No handler for Region [ECRM] (00000000ba9edc4c)
    [GenericSerialBus] (20170831/evregion-166)
    [ 0.123601] ACPI Error: Region GenericSerialBus (ID=9) has no handler
    (20170831/exfldio-299)
    [ 0.123618] ACPI Error: Method parse/execution failed
    \_SB.I2C1.BAT1._STA, AE_NOT_EXIST (20170831/psparse-550)

    This commit fixes these errors happening when acpi_get_bus_status gets
    called by checking dep_unmet for battery devices and reporting a status
    of 0 until all dependencies are met.

    Signed-off-by: Hans de Goede
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Hans de Goede
     
  • [ Upstream commit ba1edb9a5125a617d612f98eead14b9b84e75c3a ]

    The following warning was triggered after resumed from S3 -
    if all the nonboot CPUs were put offline before suspend:

    [ 1840.329515] unchecked MSR access error: RDMSR from 0x771 at rIP: 0xffffffff86061e3a (native_read_msr+0xa/0x30)
    [ 1840.329516] Call Trace:
    [ 1840.329521] __rdmsr_on_cpu+0x33/0x50
    [ 1840.329525] generic_exec_single+0x81/0xb0
    [ 1840.329527] smp_call_function_single+0xd2/0x100
    [ 1840.329530] ? acpi_ds_result_pop+0xdd/0xf2
    [ 1840.329532] ? acpi_ds_create_operand+0x215/0x23c
    [ 1840.329534] rdmsrl_on_cpu+0x57/0x80
    [ 1840.329536] ? cpumask_next+0x1b/0x20
    [ 1840.329538] ? rdmsrl_on_cpu+0x57/0x80
    [ 1840.329541] intel_pstate_update_perf_limits+0xf3/0x220
    [ 1840.329544] ? notifier_call_chain+0x4a/0x70
    [ 1840.329546] intel_pstate_set_policy+0x4e/0x150
    [ 1840.329548] cpufreq_set_policy+0xcd/0x2f0
    [ 1840.329550] cpufreq_update_policy+0xb2/0x130
    [ 1840.329552] ? cpufreq_update_policy+0x130/0x130
    [ 1840.329556] acpi_processor_ppc_has_changed+0x65/0x80
    [ 1840.329558] acpi_processor_notify+0x80/0x100
    [ 1840.329561] acpi_ev_notify_dispatch+0x44/0x5c
    [ 1840.329563] acpi_os_execute_deferred+0x14/0x20
    [ 1840.329565] process_one_work+0x193/0x3c0
    [ 1840.329567] worker_thread+0x35/0x3b0
    [ 1840.329569] kthread+0x125/0x140
    [ 1840.329571] ? process_one_work+0x3c0/0x3c0
    [ 1840.329572] ? kthread_park+0x60/0x60
    [ 1840.329575] ? do_syscall_64+0x67/0x180
    [ 1840.329577] ret_from_fork+0x25/0x30
    [ 1840.329585] unchecked MSR access error: WRMSR to 0x774 (tried to write 0x0000000000000000) at rIP: 0xffffffff86061f78 (native_write_msr+0x8/0x30)
    [ 1840.329586] Call Trace:
    [ 1840.329587] __wrmsr_on_cpu+0x37/0x40
    [ 1840.329589] generic_exec_single+0x81/0xb0
    [ 1840.329592] smp_call_function_single+0xd2/0x100
    [ 1840.329594] ? acpi_ds_create_operand+0x215/0x23c
    [ 1840.329595] ? cpumask_next+0x1b/0x20
    [ 1840.329597] wrmsrl_on_cpu+0x57/0x70
    [ 1840.329598] ? rdmsrl_on_cpu+0x57/0x80
    [ 1840.329599] ? wrmsrl_on_cpu+0x57/0x70
    [ 1840.329602] intel_pstate_hwp_set+0xd3/0x150
    [ 1840.329604] intel_pstate_set_policy+0x119/0x150
    [ 1840.329606] cpufreq_set_policy+0xcd/0x2f0
    [ 1840.329607] cpufreq_update_policy+0xb2/0x130
    [ 1840.329610] ? cpufreq_update_policy+0x130/0x130
    [ 1840.329613] acpi_processor_ppc_has_changed+0x65/0x80
    [ 1840.329615] acpi_processor_notify+0x80/0x100
    [ 1840.329617] acpi_ev_notify_dispatch+0x44/0x5c
    [ 1840.329619] acpi_os_execute_deferred+0x14/0x20
    [ 1840.329620] process_one_work+0x193/0x3c0
    [ 1840.329622] worker_thread+0x35/0x3b0
    [ 1840.329624] kthread+0x125/0x140
    [ 1840.329625] ? process_one_work+0x3c0/0x3c0
    [ 1840.329626] ? kthread_park+0x60/0x60
    [ 1840.329628] ? do_syscall_64+0x67/0x180
    [ 1840.329631] ret_from_fork+0x25/0x30

    This is because if there's only one online CPU, the MSR_PM_ENABLE
    (package wide)can not be enabled after resumed, due to
    intel_pstate_hwp_enable() will only be invoked on AP's online
    process after resumed - if there's no AP online, the HWP remains
    disabled after resumed (BIOS has disabled it in S3). Then if
    there comes a _PPC change notification which touches HWP register
    during this stage, the warning is triggered.

    Since we don't call acpi_processor_register_performance() when
    HWP is enabled, the pr->performance will be NULL. When this is
    NULL we don't need to do _PPC change notification.

    Reported-by: Doug Smythies
    Suggested-by: Srinivas Pandruvada
    Signed-off-by: Yu Chen
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Chen Yu
     
  • [ Upstream commit e1681599345b8466786b6e54a2db2a00a068a3f3 ]

    acpi_lpss_create_device() skips handling LPSS devices which do not have
    a mmio resources in their resource list (typically these devices are
    disabled by the firmware). But since the LPSS code does not bind to the
    device, acpi_bus_attach() ends up still creating a platform device for
    it and the regular platform_driver for the ACPI HID still tries to bind
    to it.

    This happens e.g. on some boards which do not use the pwm-controller
    and have an empty or invalid resource-table for it. Currently this causes
    these error messages to get logged:

    [ 3.281966] pwm-lpss 80862288:00: invalid resource
    [ 3.287098] pwm-lpss: probe of 80862288:00 failed with error -22

    This commit stops the undesirable creation of a platform_device for
    disabled LPSS devices by setting pnp.type.platform_id to 0. Note that
    acpi_scan_attach_handler() also sets pnp.type.platform_id to 0 when there
    is a matching handler for the device and that handler has no attach
    callback, so we simply behave as a handler without an attach function
    in this case.

    Signed-off-by: Hans de Goede
    Acked-by: Mika Westerberg
    Reviewed-by: Andy Shevchenko
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Hans de Goede
     

24 Apr, 2018

3 commits

  • commit 0731de476a37c33485af82d64041c9d193208df8 upstream.

    Per the ACPI specification the only functional purpose for a DIMM
    Control Region to be mapped into the system physical address space, from
    an OSPM perspective, is to support block-apertures. However, there are
    some BIOSen that publish DIMM Control Region SPA entries for pre-boot
    environment consumption. Undo the kernel policy of generating disabled
    'ndblk' regions when this configuration is detected.

    Cc:
    Fixes: 1f7df6f88b92 ("libnvdimm, nfit: regions (block-data-window...)")
    Reviewed-by: Toshi Kani
    Signed-off-by: Dan Williams
    Signed-off-by: Greg Kroah-Hartman

    Dan Williams
     
  • commit 78727137fdf49edf9f731bde79d7189067b4047a upstream.

    There is a small window whereby ARS scan requests can schedule work that
    userspace will miss when polling scrub_show. Hold the init_mutex lock
    over calls to report the status to close this potential escape. Also,
    make sure that requests to cancel the ARS workqueue are treated as an
    idle event.

    Cc:
    Cc: Vishal Verma
    Fixes: 37b137ff8c83 ("nfit, libnvdimm: allow an ARS scrub...")
    Reviewed-by: Dave Jiang
    Signed-off-by: Dan Williams
    Signed-off-by: Greg Kroah-Hartman

    Dan Williams
     
  • commit bbf038618a24d72e2efc19146ef421bb1e1eda1a upstream.

    Just like many other Samsung models, the 670Z5E needs to use the acpi-video
    backlight interface rather then the native one for backlight control to
    work, add a quirk for this.

    Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1557060
    Cc: All applicable
    Signed-off-by: Hans de Goede
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Greg Kroah-Hartman

    Hans de Goede
     

19 Apr, 2018

1 commit

  • commit 8d0d8ed3356aa9ed43b819aaedd39b08ca453007 upstream.

    Commit 1cf03c00e7c1 "nfit: scrub and register regions in a workqueue"
    mistakenly attempts to register a region per BLK aperture. There is
    nothing to register for individual apertures as they belong as a set to
    a BLK aperture group that are registered with a corresponding
    DIMM-control-region. Filter them for registration to prevent some
    needless devm_kzalloc() allocations.

    Cc:
    Fixes: 1cf03c00e7c1 ("nfit: scrub and register regions in a workqueue")
    Reviewed-by: Dave Jiang
    Signed-off-by: Dan Williams
    Signed-off-by: Greg Kroah-Hartman

    Dan Williams
     

12 Apr, 2018

2 commits

  • [ Upstream commit 3522f867c13b63cf62acdf1b8ca5664c549a716a ]

    acpi_ec.gpe is "unsigned long", hence treating it as "u32" would expose
    the wrong half on big-endian 64-bit systems. Fix this by changing its
    type to "u32" and removing the cast, as all other code already uses u32
    or sometimes even only u8.

    Fixes: 1195a098168fcacf (ACPI: Provide /sys/kernel/debug/ec/...)
    Signed-off-by: Geert Uytterhoeven
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Geert Uytterhoeven
     
  • [ Upstream commit 5928c281524fe451114e04f1dfa11246a37e859f ]

    We're seeing a lot of bogus backlight interfaces on newer machines without
    a LCD such as desktops, servers and HDMI sticks. This causes userspace to
    show a non-functional brightness slider in e.g. the GNOME3 system menu,
    which is undesirable. And, in general, we should simply just not register
    a non functional backlight interface.

    Checking the LCD flag causes the bogus acpi_video backlight interfaces to
    go away (on the machines this was tested on).

    This change sets the lcd_only option by default on any machines which
    are Win8-ready, to fix this.

    This is not entirely without a risk of regressions, but video_detect.c
    already prefers native-backlight interfaces over the acpi_video one
    on Win8-ready machines, calling acpi_video_unregister_backlight() as soon
    as a native interface shows up. This is done because the ACPI backlight
    interface often is broken on Win8-ready machines, because win8 does not
    seem to actually use it.

    So in practice we already end up not registering the ACPI backlight
    interface on (most) Win8-ready machines with a LCD panel, thus this
    change does not change anything for (most) machines with a LCD panel
    and on machines without a LCD panel we actually don't want to register
    any backlight interfaces.

    This has been tested on the following machines and fixes a bogus backlight
    interface showing up there:
    - Desktop with an Asrock B150M Pro4S/D3 m.b. using i5-6500 builtin gfx
    - Intel Compute Stick STK1AW32SC
    - Meegopad T08 HDMI stick

    Bogus backlight interfaces have also been reported on:
    - Desktop with Asus H87I-Plus m.b.
    - Desktop with ASRock B75M-ITX m.b.
    - Desktop with Gigabyte Z87-D3HP m.b.
    - Dell PowerEdge T20 desktop

    Link: https://bugzilla.redhat.com/show_bug.cgi?id=1097436
    Link: https://bugzilla.redhat.com/show_bug.cgi?id=1133327
    Link: https://bugzilla.redhat.com/show_bug.cgi?id=1133329
    Link: https://bugzilla.redhat.com/show_bug.cgi?id=1133646
    Signed-off-by: Hans de Goede
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Hans de Goede
     

29 Mar, 2018

2 commits

  • commit b1abf6fc49829d89660c961fafe3f90f3d843c55 upstream.

    The resource allocation in WDAT watchdog has off-one-by error, it sets
    one byte more than the actual end address. This may eventually lead
    to unexpected resource conflicts.

    Fixes: 058dfc767008 (ACPI / watchdog: Add support for WDAT hardware watchdog)
    Cc: 4.9+ # 4.9+
    Signed-off-by: Takashi Iwai
    Acked-by: Mika Westerberg
    Acked-by: Guenter Roeck
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     
  • commit dc9e0a9347e932e3fd3cd03e7ff241022ed6ea8a upstream.

    Commit 99759869faf1 "acpi: Add acpi_map_pxm_to_online_node()" added
    support for mapping a given proximity to its nearest, by SLIT distance,
    online node. However, it sometimes returns unexpected results due to the
    fact that it switches from comparing the PXM node to the last node that
    was closer than the current max.

    for_each_online_node(n) {
    dist = node_distance(node, n);
    if (dist < min_dist) {
    min_dist = dist;
    node = n;
    Reviewed-by: Toshi Kani
    Acked-by: Rafael J. Wysocki >
    Signed-off-by: Dan Williams
    Signed-off-by: Greg Kroah-Hartman

    Dan Williams
     

09 Mar, 2018

1 commit

  • commit 36904703aeeeb6cd31993f1353c8325006229f9a upstream.

    The i2c touchpad on Dell XPS 9570 and Precision M5530 doesn't work out
    of box.

    The touchpad relies on its _INI method to update its _HID value from
    XXXX0000 to SYNA2393.

    Also, the _STA relies on value of I2CN to report correct status.

    Set acpi_gbl_parse_table_as_term_list so the value of I2CN can be
    correctly set up, and _INI can get run. The ACPI table in this machine
    is designed to get parsed this way.

    Also, change the quirk table to a more generic name.

    Link: https://bugzilla.kernel.org/show_bug.cgi?id=198515
    Signed-off-by: Kai-Heng Feng
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Greg Kroah-Hartman

    Kai Heng Feng
     

17 Feb, 2018

2 commits

  • commit 23fbd7c70aec7600e3227eb24259fc55bf6e4881 upstream.

    A NULL pointer reference kernel bug was observed when
    acpi_nfit_add_dimm() called in acpi_nfit_register_dimms() failed. This
    error path does not set nfit_mem->nvdimm, but the 2nd
    list_for_each_entry() loop in the function assumes it's always set. Add
    a check to nfit_mem->nvdimm.

    Fixes: ba9c8dd3c222 ("acpi, nfit: add dimm device notification support")
    Signed-off-by: Toshi Kani
    Cc: "Rafael J. Wysocki"
    Signed-off-by: Dan Williams
    Signed-off-by: Greg Kroah-Hartman

    Toshi Kani
     
  • commit 43cdd1b716b26f6af16da4e145b6578f98798bf6 upstream.

    There's no need to be printing a raw kernel pointer to the kernel log at
    every boot. So just remove it, and change the whole message to use the
    correct dev_info() call at the same time.

    Reported-by: Wang Qize
    Signed-off-by: Greg Kroah-Hartman
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

04 Feb, 2018

1 commit

  • [ Upstream commit 10809bb976648ac58194a629e3d7af99e7400297 ]

    Most Bay and Cherry Trail devices use a generic DSDT with all possible
    peripheral devices present in the DSDT, with their _STA returning 0x00 or
    0x0f based on AML variables which describe what is actually present on
    the board.

    Since ACPI device objects with a 0x00 status (not present) still get an
    entry under /sys/bus/acpi/devices, and those entry had an acpi:PNPID
    modalias, userspace would end up loading modules for non present hardware.

    This commit fixes this by leaving the modalias empty for non present
    devices. This results in 10 modules less being loaded with a generic
    distro kernel config on my Cherry Trail test-device (a GPD pocket).

    Signed-off-by: Hans de Goede
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Hans de Goede
     

30 Dec, 2017

2 commits

  • commit adf6895754e2503d994a765535fd1813f8834674 upstream.

    Integration testing with a BIOS that generates injected health event
    notifications fails to communicate those events to userspace. The nfit
    driver neglects to link the ACPI DIMM device with the necessary driver
    data so acpi_nvdimm_notify() fails this lookup:

    nfit_mem = dev_get_drvdata(dev);
    if (nfit_mem && nfit_mem->flags_attr)
    sysfs_notify_dirent(nfit_mem->flags_attr);

    Add the necessary linkage when installing the notification handler and
    clean it up when the nfit driver instance is torn down.

    Cc: Toshi Kani
    Cc: Vishal Verma
    Fixes: ba9c8dd3c222 ("acpi, nfit: add dimm device notification support")
    Reported-by: Daniel Osawa
    Tested-by: Daniel Osawa
    Signed-off-by: Dan Williams
    Signed-off-by: Greg Kroah-Hartman

    Dan Williams
     
  • commit bb82e0b4a7e96494f0c1004ce50cec3d7b5fb3d1 upstream.

    The commit f6f828513290 ("pstore: pass allocated memory region back to
    caller") changed the check of the return value from erst_read() in
    erst_reader() in the following way:

    if (len == -ENOENT)
    goto skip;
    - else if (len < 0) {
    - rc = -1;
    + else if (len < sizeof(*rcd)) {
    + rc = -EIO;
    goto out;

    This introduced another bug: since the comparison with sizeof() is
    cast to unsigned, a negative len value doesn't hit any longer.
    As a result, when an error is returned from erst_read(), the code
    falls through, and it may eventually lead to some weird thing like
    memory corruption.

    This patch adds the negative error value check more explicitly for
    addressing the issue.

    Fixes: f6f828513290 (pstore: pass allocated memory region back to caller)
    Tested-by: Jerry Tang
    Signed-off-by: Takashi Iwai
    Acked-by: Kees Cook
    Reviewed-by: Borislav Petkov
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     

25 Dec, 2017

2 commits

  • commit 4f89fa286f6729312e227e7c2d764e8e7b9d340e upstream.

    Replace ghes_io{re,un}map_pfn_{nmi,irq}()s use of ioremap_page_range()
    with __set_fixmap() as ioremap_page_range() may sleep to allocate a new
    level of page-table, even if its passed an existing final-address to
    use in the mapping.

    The GHES driver can only be enabled for architectures that select
    HAVE_ACPI_APEI: Add fixmap entries to both x86 and arm64.

    clear_fixmap() does the TLB invalidation in __set_fixmap() for arm64
    and __set_pte_vaddr() for x86. In each case its the same as the
    respective arch_apei_flush_tlb_one().

    Reported-by: Fengguang Wu
    Suggested-by: Linus Torvalds
    Signed-off-by: James Morse
    Reviewed-by: Borislav Petkov
    Tested-by: Tyler Baicar
    Tested-by: Toshi Kani
    [ For the arm64 bits: ]
    Acked-by: Will Deacon
    [ For the x86 bits: ]
    Acked-by: Ingo Molnar
    Signed-off-by: Rafael J. Wysocki
    Cc: All applicable
    Signed-off-by: Greg Kroah-Hartman

    James Morse
     
  • commit c49870e89f4d2c21c76ebe90568246bb0f3572b7 upstream.

    For the SEA notification, the two functions ghes_sea_add() and
    ghes_sea_remove() are only called when CONFIG_ACPI_APEI_SEA
    is defined. If not, it will return errors in the ghes_probe()
    and not continue. If the probe is failed, the ghes_sea_remove()
    also has no chance to be called. Hence, remove the unnecessary
    handling when CONFIG_ACPI_APEI_SEA is not defined.

    For the NMI notification, it has the same issue as SEA notification,
    so also remove the unused dead-code for it.

    Signed-off-by: Dongjiu Geng
    Tested-by: Tyler Baicar
    Reviewed-by: Borislav Petkov
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Greg Kroah-Hartman

    Dongjiu Geng