1. 12 7月, 2017 2 次提交
  2. 29 6月, 2017 4 次提交
  3. 28 6月, 2017 2 次提交
    • L
      ACPI: EC: Fix EC command visibility for dynamic debug · 4625d752
      Lv Zheng 提交于
      acpi_ec_cmd_string() currently is only enabled for "DEBUG" macro, but users
      trend to use CONFIG_DYNAMIC_DEBUG and enable ec.c pr_debug() print-outs by
      "dyndbg='file ec.c +p'". In this use case, all command names are turned
      into UNDEF and the log is confusing. This affects bugzilla triage work.
      
      This patch fixes this issue by enabling acpi_ec_cmd_string() for
      CONFIG_DYNAMIC_DEBUG.
      Tested-by: NWang Wendy <wendy.wang@intel.com>
      Tested-by: NFeng Chenzhou <chenzhoux.feng@intel.com>
      Signed-off-by: NLv Zheng <lv.zheng@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      4625d752
    • L
      ACPI: EC: Fix an EC event IRQ storming issue · 1ab69f27
      Lv Zheng 提交于
      The EC event IRQ (SCI_EVT) can only be handled by submitting QR_EC. As the
      EC driver handles SCI_EVT in a workqueue, after SCI_EVT is flagged and
      before QR_EC is submitted, there is a period risking IRQ storming. EC IRQ
      must be masked for this period but linux EC driver never does so.
      
      No end user notices the IRQ storming and no developer fixes this known
      issue because:
      
       1. The EC IRQ is always edge triggered GPE, and
       2. The kernel can execute no-op EC IRQ handler very fast.
      
      For edge-triggered EC GPE platforms, it is only reported of post-resume EC
      event lost issues, there won't be an IRQ storming. For level triggered EC
      GPE platforms, fortunately the kernel is always fast enough to execute such
      a no-op EC IRQ handler so that the IRQ handler won't be accumulated to
      starve the task contexts, causing a real IRQ storming.
      
      But the IRQ storming actually can still happen when:
      
       1. The EC IRQ performs like level triggered GPE, and
       2. The kernel EC debugging log is turned on but the console is slow enough.
      
      There are more and more platforms using EC GPE as wake GPE where the EC GPE
      is likely designed as level triggered. Then when EC debugging log is
      enabled, the EC IRQ handler is no longer a no-op but dumps IRQ status to
      the consoles. If the consoles are slow enough, the EC IRQs can arrive much
      faster than executing the handler. Finally the accumulated EC event IRQ
      handlers starve the task contexts, causing the IRQ storming to occur, and
      the kernel hangs can be observed during boot/resume.
      
      This patch fixes this issue by masking EC IRQ for this period:
      
       1. Begins when there is an SCI_EVT IRQ pending, and
       2. Ends when there is a QR_EC completed (SCI_EVT acknowledged).
      Tested-by: NWang Wendy <wendy.wang@intel.com>
      Tested-by: NFeng Chenzhou <chenzhoux.feng@intel.com>
      Signed-off-by: NLv Zheng <lv.zheng@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      1ab69f27
  4. 22 6月, 2017 1 次提交
    • J
      ACPI / scan: Fix enumeration for special SPI and I2C devices · e4330d8b
      Jarkko Nikula 提交于
      Commit f406270b ("ACPI / scan: Set the visited flag for all
      enumerated devices") caused that two group of special SPI or I2C
      devices do not enumerate. SPI and I2C devices are expected to be
      enumerated by the SPI and I2C subsystems but change caused that
      acpi_bus_attach() marks those devices with acpi_device_set_enumerated().
      
      First group of devices are matched using Device Tree compatible property
      with special _HID "PRP0001". Those devices have matched scan handler,
      acpi_scan_attach_handler() retuns 1 and acpi_bus_attach() marks them
      with acpi_device_set_enumerated().
      
      Second group of devices without valid _HID such as "LNXVIDEO" have
      device->pnp.type.platform_id set to zero and change again marks them
      with acpi_device_set_enumerated().
      
      Fix this by flagging the SPI and I2C devices during struct acpi_device
      object initialization time and let the code in acpi_bus_attach() to go
      through the device_attach() and acpi_default_enumeration() path for all
      SPI and I2C devices.
      
      Fixes: f406270b (ACPI / scan: Set the visited flag for all enumerated devices)
      Signed-off-by: NJarkko Nikula <jarkko.nikula@linux.intel.com>
      Acked-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Cc: 4.11+ <stable@vger.kernel.org> # 4.11+
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      e4330d8b
  5. 12 6月, 2017 1 次提交
    • L
      ACPICA: Tables: Mechanism to handle late stage acpi_get_table() imbalance · 83848fbe
      Lv Zheng 提交于
      Considering this case:
      
       1. A program opens a sysfs table file 65535 times, it can increase
          validation_count and first increment cause the table to be mapped:
      
           validation_count = 65535
      
       2. AML execution causes "Load" to be executed on the same
          table, this time it cannot increase validation_count, so
          validation_count remains:
      
            validation_count = 65535
      
       3. The program closes sysfs table file 65535 times, it can decrease
          validation_count and the last decrement cause the table to be
          unmapped:
      
           validation_count = 0
      
       4. AML code still accessing the loaded table, kernel crash can be
          observed.
      
      To prevent that from happening, add a validation_count threashold.
      When it is reached, the validation_count can no longer be
      incremented/decremented to invalidate the table descriptor (means
      preventing table unmappings)
      
      Note that code added in acpi_tb_put_table() is actually a no-op but
      changes the warning message into a "warn once" one. Lv Zheng.
      Signed-off-by: NLv Zheng <lv.zheng@intel.com>
      [ rjw: Changelog, comments ]
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      83848fbe
  6. 07 6月, 2017 1 次提交
  7. 06 6月, 2017 1 次提交
  8. 30 5月, 2017 4 次提交
    • L
      ACPI/IORT: Move the check to get iommu_ops from translated fwspec · 4dac3210
      Lorenzo Pieralisi 提交于
      With IOMMU probe deferral, iort_iommu_configure can be called
      multiple times for the same device. Hence we have a check
      to see if the device's fwspec is already translated and return
      the iommu_ops from that directly. But the check is wrongly
      placed in iort_iommu_xlate, which breaks devices with multiple
      sids. Move the check to iort_iommu_configure.
      
      Fixes: 5a1bb638 ("drivers: acpi: Handle IOMMU lookup failure with deferred probing or error")
      Tested-by: NNate Watterson <nwatters@codeaurora.org>
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      4dac3210
    • S
      ACPI/IORT: Ignore all errors except EPROBE_DEFER · 058f8c3f
      Sricharan R 提交于
      While deferring the probe of IOMMU masters, xlate and
      add_device callbacks called from iort_iommu_configure
      can pass back error values like -ENODEV, which means
      the IOMMU cannot be connected with that master for real
      reasons. Before the IOMMU probe deferral, all such errors
      were ignored. Now all those errors are propagated back,
      killing the master's probe for such errors. Instead ignore
      all the errors except EPROBE_DEFER, which is the only one
      of concern and let the master work without IOMMU, thus
      restoring the old behavior. Also make explicit that
      acpi_dma_configure handles only -EPROBE_DEFER from
      iort_iommu_configure.
      
      Fixes: 5a1bb638 ("drivers: acpi: Handle IOMMU lookup failure with deferred probing or error")
      Signed-off-by: NSricharan R <sricharan@codeaurora.org>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      058f8c3f
    • L
      ACPICA: Tables: Fix regression introduced by a too early mechanism enabling · 2ea65321
      Lv Zheng 提交于
      In the Linux kernel, acpi_get_table() "clones" haven't been fully
      balanced by acpi_put_table() invocations.  In upstream ACPICA, due to
      the design change, there are also unbalanced acpi_get_table_by_index()
      invocations requiring special care.
      
      acpi_get_table() reference counting mismatches may occor due to that
      and printing error messages related to them is not useful at this
      point.  The strict balanced validation count check should only be
      enabled after confirming that all invocations are safe and aligned
      with their designed purposes.
      
      Thus this patch removes the error value returned by acpi_tb_get_table()
      in that case along with the accompanying error message to fix the
      issue.
      
      Fixes: 174cc718 (ACPICA: Tables: Back port acpi_get_table_with_size() and early_acpi_os_unmap_memory() from Linux kernel)
      Cc: 4.10+ <stable@vger.kernel.org> # 4.10+
      Reported-by: NAnush Seetharaman <anush.seetharaman@intel.com>
      Reported-by: NDan Williams <dan.j.williams@intel.com>
      Signed-off-by: NLv Zheng <lv.zheng@intel.com>
      [ rjw: Changelog ]
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      2ea65321
    • B
      Revert "ACPI / button: Change default behavior to lid_init_state=open" · 878d8db0
      Benjamin Tissoires 提交于
      Revert commit 77e9a4aa (ACPI / button: Change default behavior to
      lid_init_state=open) which changed the kernel's behavior on laptops
      that boot with closed lids and expect the lid switch state to be
      reported accurately by the kernel.
      
      If you boot or resume your laptop with the lid closed on a docking
      station while using an external monitor connected to it, both internal
      and external displays will light on, while only the external should.
      
      There is a design choice in gdm to only provide the greeter on the
      internal display when lit on, so users only see a gray area on the
      external monitor. Also, the cursor will not show up as it's by
      default on the internal display too.
      
      To "fix" that, users have to open the laptop once and close it once
      again to sync the state of the switch with the hardware state.
      
      Even if the "method" operation mode implementation can be buggy on
      some platforms, the "open" choice is worse.  It breaks docking
      stations basically and there is no way to have a user-space hwdb to
      fix that.
      
      On the contrary, it's rather easy in user-space to have a hwdb
      with the problematic platforms. Then,  libinput (1.7.0+) can fix
      the state of the lid switch for us: you need to set the udev
      property LIBINPUT_ATTR_LID_SWITCH_RELIABILITY to 'write_open'.
      
      When libinput detects internal keyboard events, it will overwrite the
      state of the switch to open, making it reliable again.  Given that
      logind only checks the lid switch value after a timeout, we can
      assume the user will use the internal keyboard before this timeout
      expires.
      
      For example, such a hwdb entry is:
      
      libinput:name:*Lid Switch*:dmi:*svnMicrosoftCorporation:pnSurface3:*
       LIBINPUT_ATTR_LID_SWITCH_RELIABILITY=write_open
      
      Link: https://bugzilla.gnome.org/show_bug.cgi?id=782380
      Cc: 4.11+ <stable@vger.kernel.org> # 4.11+
      Signed-off-by: NBenjamin Tissoires <benjamin.tissoires@redhat.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      878d8db0
  9. 22 5月, 2017 1 次提交
  10. 13 5月, 2017 1 次提交
    • L
      Revert "ACPI / button: Remove lid_init_state=method mode" · f369fdf4
      Lv Zheng 提交于
      This reverts commit ecb10b69.
      
      The only expected ACPI control method lid device's usage model is
      
       1. Listen to the lid notification,
       2. Evaluate _LID after being notified by BIOS,
       3. Suspend the system (if users configure to do so) after seeing "close".
      
      It's not ensured that BIOS will notify OS after boot/resume, and
      it's not ensured that BIOS will always generate "open" event upon
      opening the lid.
      
      But there are 2 wrong usage models:
      
       1. When the lid device is responsible for suspend/resume the system,
          userspace requires to see "open" event to be paired with "close" after
          the system is resumed, or it will suspend the system again.
      
       2. When an external monitor connects to the laptop attached docks,
          userspace requires to see "close" event after the system is resumed so
          that it can determine whether the internal display should remain dark
          and the external display should be lit on.
      
      After we made default kernel behavior to be suitable for usage model 1,
      users of usage model 2 start to report regressions for such behavior
      change.
      
      Reversion of button.lid_init_state=method doesn't actually reverts to old
      default behavior as doing so can enter a regression loop, but facilitates
      users to work the reported regressions around with
      button.lid_init_state=method.
      
      Fixes: ecb10b69 (ACPI / button: Remove lid_init_state=method mode)
      Cc: 4.11+ <stable@vger.kernel.org> # 4.11+
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=195455
      Link: https://bugzilla.redhat.com/show_bug.cgi?id=1430259Tested-by: NSteffen Weber <steffen.weber@gmail.com>
      Tested-by: NJulian Wiedmann <julian.wiedmann@jwi.name>
      Reported-by: NJoachim Frieben <jfrieben@hotmail.com>
      Signed-off-by: NLv Zheng <lv.zheng@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      f369fdf4
  11. 09 5月, 2017 2 次提交
    • S
      scripts/spelling.txt: add regsiter -> register spelling mistake · ad61dd30
      Stephen Boyd 提交于
      This typo is quite common.  Fix it and add it to the spelling file so
      that checkpatch catches it earlier.
      
      Link: http://lkml.kernel.org/r/20170317011131.6881-2-sboyd@codeaurora.orgSigned-off-by: NStephen Boyd <sboyd@codeaurora.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      ad61dd30
    • M
      treewide: use kv[mz]alloc* rather than opencoded variants · 752ade68
      Michal Hocko 提交于
      There are many code paths opencoding kvmalloc.  Let's use the helper
      instead.  The main difference to kvmalloc is that those users are
      usually not considering all the aspects of the memory allocator.  E.g.
      allocation requests <= 32kB (with 4kB pages) are basically never failing
      and invoke OOM killer to satisfy the allocation.  This sounds too
      disruptive for something that has a reasonable fallback - the vmalloc.
      On the other hand those requests might fallback to vmalloc even when the
      memory allocator would succeed after several more reclaim/compaction
      attempts previously.  There is no guarantee something like that happens
      though.
      
      This patch converts many of those places to kv[mz]alloc* helpers because
      they are more conservative.
      
      Link: http://lkml.kernel.org/r/20170306103327.2766-2-mhocko@kernel.orgSigned-off-by: NMichal Hocko <mhocko@suse.com>
      Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> # Xen bits
      Acked-by: NKees Cook <keescook@chromium.org>
      Acked-by: NVlastimil Babka <vbabka@suse.cz>
      Acked-by: Andreas Dilger <andreas.dilger@intel.com> # Lustre
      Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> # KVM/s390
      Acked-by: Dan Williams <dan.j.williams@intel.com> # nvdim
      Acked-by: David Sterba <dsterba@suse.com> # btrfs
      Acked-by: Ilya Dryomov <idryomov@gmail.com> # Ceph
      Acked-by: Tariq Toukan <tariqt@mellanox.com> # mlx4
      Acked-by: Leon Romanovsky <leonro@mellanox.com> # mlx5
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Cc: Anton Vorontsov <anton@enomsg.org>
      Cc: Colin Cross <ccross@android.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Cc: Ben Skeggs <bskeggs@redhat.com>
      Cc: Kent Overstreet <kent.overstreet@gmail.com>
      Cc: Santosh Raspatur <santosh@chelsio.com>
      Cc: Hariprasad S <hariprasad@chelsio.com>
      Cc: Yishai Hadas <yishaih@mellanox.com>
      Cc: Oleg Drokin <oleg.drokin@intel.com>
      Cc: "Yan, Zheng" <zyan@redhat.com>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Cc: David Miller <davem@davemloft.net>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      752ade68
  12. 06 5月, 2017 1 次提交
    • R
      ACPI / sleep: Ignore spurious SCI wakeups from suspend-to-idle · eed4d47e
      Rafael J. Wysocki 提交于
      The ACPI SCI (System Control Interrupt) is set up as a wakeup IRQ
      during suspend-to-idle transitions and, consequently, any events
      signaled through it wake up the system from that state.  However,
      on some systems some of the events signaled via the ACPI SCI while
      suspended to idle should not cause the system to wake up.  In fact,
      quite often they should just be discarded.
      
      Arguably, systems should not resume entirely on such events, but in
      order to decide which events really should cause the system to resume
      and which are spurious, it is necessary to resume up to the point
      when ACPI SCIs are actually handled and processed, which is after
      executing dpm_resume_noirq() in the system resume path.
      
      For this reasons, add a loop around freeze_enter() in which the
      platforms can process events signaled via multiplexed IRQ lines
      like the ACPI SCI and add suspend-to-idle hooks that can be
      used for this purpose to struct platform_freeze_ops.
      
      In the ACPI case, the ->wake hook is used for checking if the SCI
      has triggered while suspended and deferring the interrupt-induced
      system wakeup until the events signaled through it are actually
      processed sufficiently to decide whether or not the system should
      resume.  In turn, the ->sync hook allows all of the relevant event
      queues to be flushed so as to prevent events from being missed due
      to race conditions.
      
      In addition to that, some ACPI code processing wakeup events needs
      to be modified to use the "hard" version of wakeup triggers, so that
      it will cause a system resume to happen on device-induced wakeup
      events even if the "soft" mechanism to prevent the system from
      suspending is not enabled (that also helps to catch device-induced
      wakeup events occurring during suspend transitions in progress).
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      eed4d47e
  13. 05 5月, 2017 2 次提交
  14. 02 5月, 2017 1 次提交
    • H
      ACPI / power: Delay turning off unused power resources after suspend · 8ece1d83
      Hans de Goede 提交于
      Commit 660b1113 (ACPI / PM: Fix consistency check for power resources
      during resume) introduced a check for ACPI power resources which have
      been turned on by the BIOS during suspend and turns these back off again.
      
      This is causing problems on a Dell Venue Pro 11 7130 (i5-4300Y) it causes
      the following messages to show up in dmesg:
      
      [  131.014605] ACPI: Waking up from system sleep state S3
      [  131.150271] acpi LNXPOWER:07: Turning OFF
      [  131.150323] acpi LNXPOWER:06: Turning OFF
      [  131.150911] acpi LNXPOWER:00: Turning OFF
      [  131.169014] ACPI : EC: interrupt unblocked
      [  131.181811] xhci_hcd 0000:00:14.0: System wakeup disabled by ACPI
      [  133.535728] pci_raw_set_power_state: 76 callbacks suppressed
      [  133.535735] iwlwifi 0000:01:00.0: Refused to change power state,
                     currently in D3
      [  133.597672] PM: noirq resume of devices complete after 2428.891 msecs
      
      Followed by a bunch of iwlwifi errors later on and the pcie device
      dropping from the bus (acpiphp thinks it has been unplugged).
      
      Disabling the turning off of unused power resources fixes this. Instead
      of adding a quirk for this system, this commit fixes this by moving the
      disabling of unused power resources to later in the resume sequence
      when the iwlwifi card has been moved out of D3 so the ref_count for
      its power resource no longer is 0.
      
      This new behavior seems to match the intend of the original commit which
      commit-msg says: "(... which means that no devices are going to need them
      any time soon) and we should turn them off".
      
      This also avoids power resources which we need when bringing devices out
      of D3 from getting bounced off and then back on again.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      8ece1d83
  15. 29 4月, 2017 5 次提交
  16. 27 4月, 2017 11 次提交