1. 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
  2. 07 6月, 2017 1 次提交
  3. 06 6月, 2017 1 次提交
  4. 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
  5. 22 5月, 2017 1 次提交
  6. 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
  7. 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
  8. 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
  9. 05 5月, 2017 2 次提交
  10. 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
  11. 29 4月, 2017 5 次提交
  12. 27 4月, 2017 16 次提交
  13. 26 4月, 2017 1 次提交
    • D
      x86, dax, pmem: remove indirection around memcpy_from_pmem() · 6abccd1b
      Dan Williams 提交于
      memcpy_from_pmem() maps directly to memcpy_mcsafe(). The wrapper
      serves no real benefit aside from affording a more generic function name
      than the x86-specific 'mcsafe'. However this would not be the first time
      that x86 terminology leaked into the global namespace. For lack of
      better name, just use memcpy_mcsafe() directly.
      
      This conversion also catches a place where we should have been using
      plain memcpy, acpi_nfit_blk_single_io().
      
      Cc: <x86@kernel.org>
      Cc: Jan Kara <jack@suse.cz>
      Cc: Jeff Moyer <jmoyer@redhat.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Matthew Wilcox <mawilcox@microsoft.com>
      Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
      Acked-by: NTony Luck <tony.luck@intel.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      6abccd1b
  14. 25 4月, 2017 1 次提交
  15. 22 4月, 2017 1 次提交
  16. 20 4月, 2017 1 次提交
    • L
      ACPI/IORT: Remove linker section for IORT entries probing · 316ca880
      Lorenzo Pieralisi 提交于
      The IORT linker section introduced by commit 34ceea27
      ("ACPI/IORT: Introduce linker section for IORT entries probing")
      was needed to make sure SMMU drivers are registered (and therefore
      probed) in the kernel before devices using the SMMU have a chance
      to probe in turn.
      
      Through the introduction of deferred IOMMU configuration the linker
      section based IORT probing infrastructure is not needed any longer, in
      that device/SMMU probe dependencies are managed through the probe
      deferral mechanism, making the IORT linker section infrastructure
      unused, so that it can be removed.
      
      Remove the unused IORT linker section probing infrastructure
      from the kernel to complete the ACPI IORT IOMMU configure probe
      deferral mechanism implementation.
      Tested-by: NHanjun Guo <hanjun.guo@linaro.org>
      Reviewed-by: NRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Cc: Sricharan R <sricharan@codeaurora.org>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      316ca880