1. 24 9月, 2020 1 次提交
    • J
      ACPI: Remove side effect of partly creating a node in acpi_map_pxm_to_online_node() · fe205d98
      Jonathan Cameron 提交于
      While this function will only return an online node, it can have the side
      effect of partially creating a new node.  The existing comments suggest this
      is intentional, but the usecases of this function are related to NFIT and
      HMAT parsing, neither of which should be able to define new nodes.
      
      One route by which the existing behaviour would cause a crash is to have a
      _PXM entry in ACPI DSDT attempt to place a device within this partly
      created proximity domain. A subsequent call to devm_kzalloc() or similar
      would result in an attempt to allocate memory on a node for which zone
      lists have not been set up and a NULL pointer dereference.
      
      Prevent such cases by switching to pxm_to_node() within
      acpi_map_pxm_to_online_node() which cannot cause a new node to be
      partly created. If one would previously have been created we now
      return NO_NUMA_NODE.  Documentation updated to reflect this change.
      Signed-off-by: NJonathan Cameron <Jonathan.Cameron@huawei.com>
      Reviewed-by: NHanjun Guo <guohanjun@huawei.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      fe205d98
  2. 28 7月, 2020 1 次提交
    • L
      ACPI/IORT: Add an input ID to acpi_dma_configure() · b8e069a2
      Lorenzo Pieralisi 提交于
      Some HW devices are created as child devices of proprietary busses,
      that have a bus specific policy defining how the child devices
      wires representing the devices ID are translated into IOMMU and
      IRQ controllers device IDs.
      
      Current IORT code provides translations for:
      
      - PCI devices, where the device ID is well identified at bus level
        as the requester ID (RID)
      - Platform devices that are endpoint devices where the device ID is
        retrieved from the ACPI object IORT mappings (Named components single
        mappings). A platform device is represented in IORT as a named
        component node
      
      For devices that are child devices of proprietary busses the IORT
      firmware represents the bus node as a named component node in IORT
      and it is up to that named component node to define in/out bus
      specific ID translations for the bus child devices that are
      allocated and created in a bus specific manner.
      
      In order to make IORT ID translations available for proprietary
      bus child devices, the current ACPI (and IORT) code must be
      augmented to provide an additional ID parameter to acpi_dma_configure()
      representing the child devices input ID. This ID is bus specific
      and it is retrieved in bus specific code.
      
      By adding an ID parameter to acpi_dma_configure(), the IORT
      code can map the child device ID to an IOMMU stream ID through
      the IORT named component representing the bus in/out ID mappings.
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Hanjun Guo <guohanjun@huawei.com>
      Cc: Sudeep Holla <sudeep.holla@arm.com>
      Cc: Robin Murphy <robin.murphy@arm.com>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Link: https://lore.kernel.org/r/20200619082013.13661-6-lorenzo.pieralisi@arm.comSigned-off-by: NCatalin Marinas <catalin.marinas@arm.com>
      b8e069a2
  3. 27 6月, 2020 2 次提交
  4. 05 4月, 2020 1 次提交
    • H
      ACPI: PM: Add acpi_[un]register_wakeup_handler() · ddfd9dcf
      Hans de Goede 提交于
      Since commit fdde0ff8 ("ACPI: PM: s2idle: Prevent spurious SCIs from
      waking up the system") the SCI triggering without there being a wakeup
      cause recognized by the ACPI sleep code will no longer wakeup the system.
      
      This works as intended, but this is a problem for devices where the SCI
      is shared with another device which is also a wakeup source.
      
      In the past these, from the pov of the ACPI sleep code, spurious SCIs
      would still cause a wakeup so the wakeup from the device sharing the
      interrupt would actually wakeup the system. This now no longer works.
      
      This is a problem on e.g. Bay Trail-T and Cherry Trail devices where
      some peripherals (typically the XHCI controller) can signal a
      Power Management Event (PME) to the Power Management Controller (PMC)
      to wakeup the system, this uses the same interrupt as the SCI.
      These wakeups are handled through a special INT0002 ACPI device which
      checks for events in the GPE0a_STS for this and takes care of acking
      the PME so that the shared interrupt stops triggering.
      
      The change to the ACPI sleep code to ignore the spurious SCI, causes
      the system to no longer wakeup on these PME events. To make things
      worse this means that the INT0002 device driver interrupt handler will
      no longer run, causing the PME to not get cleared and resulting in the
      system hanging. Trying to wakeup the system after such a PME through e.g.
      the power button no longer works.
      
      Add an acpi_register_wakeup_handler() function which registers
      a handler to be called from acpi_s2idle_wake() and when the handler
      returns true, return true from acpi_s2idle_wake().
      
      The INT0002 driver will use this mechanism to check the GPE0a_STS
      register from acpi_s2idle_wake() and to tell the system to wakeup
      if a PME is signaled in the register.
      
      Fixes: fdde0ff8 ("ACPI: PM: s2idle: Prevent spurious SCIs from waking up the system")
      Cc: 5.4+ <stable@vger.kernel.org> # 5.4+
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      ddfd9dcf
  5. 29 3月, 2020 1 次提交
    • K
      PCI/DPC: Add Error Disconnect Recover (EDR) support · ac1c8e35
      Kuppuswamy Sathyanarayanan 提交于
      Error Disconnect Recover (EDR) is a feature that allows ACPI firmware to
      notify OSPM that a device has been disconnected due to an error condition
      (ACPI v6.3, sec 5.6.6).  OSPM advertises its support for EDR on PCI devices
      via _OSC (see [1], sec 4.5.1, table 4-4).  The OSPM EDR notify handler
      should invalidate software state associated with disconnected devices and
      may attempt to recover them.  OSPM communicates the status of recovery to
      the firmware via _OST (sec 6.3.5.2).
      
      For PCIe, firmware may use Downstream Port Containment (DPC) to support
      EDR.  Per [1], sec 4.5.1, table 4-6, even if firmware has retained control
      of DPC, OSPM may read/write DPC control and status registers during the EDR
      notification processing window, i.e., from the time it receives an EDR
      notification until it clears the DPC Trigger Status.
      
      Note that per [1], sec 4.5.1 and 4.5.2.4,
      
        1. If the OS supports EDR, it should advertise that to firmware by
           setting OSC_PCI_EDR_SUPPORT in _OSC Support.
      
        2. If the OS sets OSC_PCI_EXPRESS_DPC_CONTROL in _OSC Control to request
           control of the DPC capability, it must also set OSC_PCI_EDR_SUPPORT in
           _OSC Support.
      
      Add an EDR notify handler to attempt recovery.
      
      [1] Downstream Port Containment Related Enhancements ECN, Jan 28, 2019,
          affecting PCI Firmware Specification, Rev. 3.2
          https://members.pcisig.com/wg/PCI-SIG/document/12888
      
      [bhelgaas: squash add/enable patches into one]
      Link: https://lore.kernel.org/r/90f91fe6d25c13f9d2255d2ce97ca15be307e1bb.1585000084.git.sathyanarayanan.kuppuswamy@linux.intel.comSigned-off-by: NKuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Cc: Len Brown <lenb@kernel.org>
      ac1c8e35
  6. 18 2月, 2020 1 次提交
  7. 27 12月, 2019 1 次提交
  8. 16 12月, 2019 1 次提交
    • R
      ACPI: processor: Export function to claim _CST control · bc946388
      Rafael J. Wysocki 提交于
      The intel_idle driver will be modified to use ACPI _CST subsequently
      and it will need to notify the platform firmware of that if
      acpi_gbl_FADT.cst_control is set, so add a routine for this purpose,
      acpi_processor_claim_cst_control(), to acpi_processor.c (so that it
      is always present which is required by intel_idle) and export it
      to allow the ACPI processor driver (which is modular) to call it.
      
      No intentional functional impact.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      bc946388
  9. 15 10月, 2019 1 次提交
  10. 20 8月, 2019 1 次提交
    • J
      acpi: Ignore acpi_rsdp kernel param when the kernel has been locked down · 41fa1ee9
      Josh Boyer 提交于
      This option allows userspace to pass the RSDP address to the kernel, which
      makes it possible for a user to modify the workings of hardware. Reject
      the option when the kernel is locked down. This requires some reworking
      of the existing RSDP command line logic, since the early boot code also
      makes use of a command-line passed RSDP when locating the SRAT table
      before the lockdown code has been initialised. This is achieved by
      separating the command line RSDP path in the early boot code from the
      generic RSDP path, and then copying the command line RSDP into boot
      params in the kernel proper if lockdown is not enabled. If lockdown is
      enabled and an RSDP is provided on the command line, this will only be
      used when parsing SRAT (which shouldn't permit kernel code execution)
      and will be ignored in the rest of the kernel.
      
      (Modified by Matthew Garrett in order to handle the early boot RSDP
      environment)
      Signed-off-by: NJosh Boyer <jwboyer@redhat.com>
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NMatthew Garrett <mjg59@google.com>
      Reviewed-by: NKees Cook <keescook@chromium.org>
      cc: Dave Young <dyoung@redhat.com>
      cc: linux-acpi@vger.kernel.org
      Signed-off-by: NJames Morris <jmorris@namei.org>
      41fa1ee9
  11. 12 8月, 2019 1 次提交
  12. 31 7月, 2019 1 次提交
  13. 30 7月, 2019 1 次提交
    • R
      ACPI: PM: Set up EC GPE for system wakeup from drivers that need it · 10a08fd6
      Rafael J. Wysocki 提交于
      The EC GPE needs to be set up for system wakeup only if there is a
      driver depending on it, either intel-hid or intel-vbtn, bound to a
      button device that is expected to wake up the system from sleep (such
      as the power button on some Dell systems, like the XPS13 9360).  It
      doesn't need to be set up for waking up the system from sleep in any
      other cases and whether or not it is expected to wake up the system
      from sleep doesn't depend on whether or not the LPS0 device is
      present in the ACPI namespace.
      
      For this reason, rearrange the ACPI suspend-to-idle code to make the
      drivers depending on the EC GPE wakeup take care of setting it up and
      decouple that from the LPS0 device handling.
      
      While at it, make intel-hid and intel-vbtn prepare for system wakeup
      only if they are allowed to wake up the system from sleep by user
      space (via sysfs).
      
      [Note that acpi_ec_mark_gpe_for_wake() and acpi_ec_set_gpe_wake_mask()
       are there to prevent the EC GPE from being disabled by the
       acpi_enable_all_wakeup_gpes() call in acpi_s2idle_prepare(), so on
       systems with either intel-hid or intel-vbtn this change doesn't
       affect any interactions with the hardware or platform firmware.]
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: NAndy Shevchenko <andy.shevchenko@gmail.com>
      10a08fd6
  14. 15 7月, 2019 1 次提交
    • A
      ACPI: fix false-positive -Wuninitialized warning · dfd6f9ad
      Arnd Bergmann 提交于
      clang gets confused by an uninitialized variable in what looks
      to it like a never executed code path:
      
      arch/x86/kernel/acpi/boot.c:618:13: error: variable 'polarity' is uninitialized when used here [-Werror,-Wuninitialized]
              polarity = polarity ? ACPI_ACTIVE_LOW : ACPI_ACTIVE_HIGH;
                         ^~~~~~~~
      arch/x86/kernel/acpi/boot.c:606:32: note: initialize the variable 'polarity' to silence this warning
              int rc, irq, trigger, polarity;
                                            ^
                                             = 0
      arch/x86/kernel/acpi/boot.c:617:12: error: variable 'trigger' is uninitialized when used here [-Werror,-Wuninitialized]
              trigger = trigger ? ACPI_LEVEL_SENSITIVE : ACPI_EDGE_SENSITIVE;
                        ^~~~~~~
      arch/x86/kernel/acpi/boot.c:606:22: note: initialize the variable 'trigger' to silence this warning
              int rc, irq, trigger, polarity;
                                  ^
                                   = 0
      
      This is unfortunately a design decision in clang and won't be fixed.
      
      Changing the acpi_get_override_irq() macro to an inline function
      reliably avoids the issue.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Reviewed-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Reviewed-by: NNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      dfd6f9ad
  15. 03 7月, 2019 3 次提交
  16. 27 6月, 2019 1 次提交
  17. 17 6月, 2019 1 次提交
    • Y
      platform/x86: wmi: Add function to get _UID of WMI device · e7488e58
      Yurii Pavlovskyi 提交于
      Add a new function to acpi.h / wmi.c that returns _UID of the ACPI WMI
      device. For example, it returns "ATK" for the following declaration in
      DSDT:
      Device (ATKD)
      {
          Name (_HID, "PNP0C14" /* Windows Management Instrumentation Device */)
            // _HID: Hardware ID
          Name (_UID, "ATK")  // _UID: Unique ID
          ..
      
      Generally, it is possible that multiple PNP0C14 ACPI devices are present in
      the system as mentioned in the commit message of commit bff431e4
      ("ACPI: WMI: Add ACPI-WMI mapping driver").
      
      Therefore the _UID is returned for a specific ACPI device that declares the
      given GUID, to which it is also mapped by other methods of wmi module.
      Signed-off-by: NYurii Pavlovskyi <yurii.pavlovskyi@gmail.com>
      Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      e7488e58
  18. 31 5月, 2019 1 次提交
    • T
      treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 · c942fddf
      Thomas Gleixner 提交于
      Based on 3 normalized pattern(s):
      
        this program is free software you can redistribute it and or modify
        it under the terms of the gnu general public license as published by
        the free software foundation either version 2 of the license or at
        your option any later version this program is distributed in the
        hope that it will be useful but without any warranty without even
        the implied warranty of merchantability or fitness for a particular
        purpose see the gnu general public license for more details
      
        this program is free software you can redistribute it and or modify
        it under the terms of the gnu general public license as published by
        the free software foundation either version 2 of the license or at
        your option any later version [author] [kishon] [vijay] [abraham]
        [i] [kishon]@[ti] [com] this program is distributed in the hope that
        it will be useful but without any warranty without even the implied
        warranty of merchantability or fitness for a particular purpose see
        the gnu general public license for more details
      
        this program is free software you can redistribute it and or modify
        it under the terms of the gnu general public license as published by
        the free software foundation either version 2 of the license or at
        your option any later version [author] [graeme] [gregory]
        [gg]@[slimlogic] [co] [uk] [author] [kishon] [vijay] [abraham] [i]
        [kishon]@[ti] [com] [based] [on] [twl6030]_[usb] [c] [author] [hema]
        [hk] [hemahk]@[ti] [com] this program is distributed in the hope
        that it will be useful but without any warranty without even the
        implied warranty of merchantability or fitness for a particular
        purpose see the gnu general public license for more details
      
      extracted by the scancode license scanner the SPDX license identifier
      
        GPL-2.0-or-later
      
      has been chosen to replace the boilerplate/reference in 1105 file(s).
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Reviewed-by: NAllison Randal <allison@lohutok.net>
      Reviewed-by: NRichard Fontana <rfontana@redhat.com>
      Reviewed-by: NKate Stewart <kstewart@linuxfoundation.org>
      Cc: linux-spdx@vger.kernel.org
      Link: https://lkml.kernel.org/r/20190527070033.202006027@linutronix.deSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c942fddf
  19. 28 5月, 2019 1 次提交
    • A
      acpi/irq: Implement helper to create hierachical domains · 621dc2fd
      Ard Biesheuvel 提交于
      ACPI permits arbitrary producer->consumer interrupt links to be
      described in AML, which means a topology such as the following
      is perfectly legal:
      
        Device (EXIU) {
          Name (_HID, "SCX0008")
          Name (_UID, Zero)
          Name (_CRS, ResourceTemplate () {
            ...
          })
        }
      
        Device (GPIO) {
          Name (_HID, "SCX0007")
          Name (_UID, Zero)
          Name (_CRS, ResourceTemplate () {
            Memory32Fixed (ReadWrite, SYNQUACER_GPIO_BASE, SYNQUACER_GPIO_SIZE)
            Interrupt (ResourceConsumer, Edge, ActiveHigh, ExclusiveAndWake, 0, "\\_SB.EXIU") {
              7,
            }
          })
          ...
        }
      
      The EXIU in this example is the external interrupt unit as can be found
      on Socionext SynQuacer based platforms, which converts a block of 32 SPIs
      from arbitrary polarity/trigger into level-high, with a separate set
      of config/mask/unmask/clear controls.
      
      The existing DT based driver in drivers/irqchip/irq-sni-exiu.c models
      this as a hierarchical domain stacked on top of the GIC's irqdomain.
      Since the GIC is modeled as a DT node as well, obtaining a reference
      to this irqdomain is easily done by going through the parent link.
      
      On ACPI systems, however, the GIC is not modeled as an object in the
      namespace, and so device objects cannot refer to it directly. So in
      order to obtain the irqdomain reference when driving the EXIU in ACPI
      mode, we need a helper that implicitly grabs the default domain as the
      parent of the hierarchy for interrupts allocated out of the global GSI
      pool.
      Reviewed-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Reviewed-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      621dc2fd
  20. 24 4月, 2019 1 次提交
  21. 23 4月, 2019 1 次提交
  22. 05 4月, 2019 2 次提交
  23. 01 4月, 2019 2 次提交
  24. 08 3月, 2019 3 次提交
  25. 09 2月, 2019 1 次提交
  26. 16 1月, 2019 1 次提交
  27. 07 1月, 2019 1 次提交
    • D
      acpi/nfit, device-dax: Identify differentiated memory with a unique numa-node · 8fc5c735
      Dan Williams 提交于
      Persistent memory, as described by the ACPI NFIT (NVDIMM Firmware
      Interface Table), is the first known instance of a memory range
      described by a unique "target" proximity domain. Where "initiator" and
      "target" proximity domains is an approach that the ACPI HMAT
      (Heterogeneous Memory Attributes Table) uses to described the unique
      performance properties of a memory range relative to a given initiator
      (e.g. CPU or DMA device).
      
      Currently the numa-node for a /dev/pmemX block-device or /dev/daxX.Y
      char-device follows the traditional notion of 'numa-node' where the
      attribute conveys the closest online numa-node. That numa-node attribute
      is useful for cpu-binding and memory-binding processes *near* the
      device. However, when the memory range backing a 'pmem', or 'dax' device
      is onlined (memory hot-add) the memory-only-numa-node representing that
      address needs to be differentiated from the set of online nodes. In
      other words, the numa-node association of the device depends on whether
      you can bind processes *near* the cpu-numa-node in the offline
      device-case, or bind process *on* the memory-range directly after the
      backing address range is onlined.
      
      Allow for the case that platform firmware describes persistent memory
      with a unique proximity domain, i.e. when it is distinct from the
      proximity of DRAM and CPUs that are on the same socket. Plumb the Linux
      numa-node translation of that proximity through the libnvdimm region
      device to namespaces that are in device-dax mode. With this in place the
      proposed kmem driver [1] can optionally discover a unique numa-node
      number for the address range as it transitions the memory from an
      offline state managed by a device-driver to an online memory range
      managed by the core-mm.
      
      [1]: https://lore.kernel.org/lkml/20181022201317.8558C1D8@viggo.jf.intel.comReported-by: NFan Du <fan.du@intel.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: "Oliver O'Halloran" <oohall@gmail.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: Jérôme Glisse <jglisse@redhat.com>
      Reviewed-by: NYang Shi <yang.shi@linux.alibaba.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      8fc5c735
  28. 20 12月, 2018 1 次提交
  29. 04 12月, 2018 1 次提交
  30. 27 11月, 2018 2 次提交
  31. 03 10月, 2018 1 次提交
  32. 08 9月, 2018 1 次提交