1. 25 9月, 2022 2 次提交
    • J
      LoongArch: Use acpi_arch_dma_setup() and remove ARCH_HAS_PHYS_TO_DMA · c78c43fe
      Jianmin Lv 提交于
      Use _DMA defined in ACPI spec for translation between
      DMA address and CPU address, and implement acpi_arch_dma_setup
      for initializing dev->dma_range_map, where acpi_dma_get_range
      is called for parsing _DMA.
      
      e.g.
      If we have two dma ranges:
      cpu address      dma address    size         offset
      0x200080000000   0x2080000000   0x400000000  0x1fe000000000
      0x400080000000   0x4080000000   0x400000000  0x3fc000000000
      
      _DMA for pci devices should be declared in host bridge as
      flowing:
      
      Name (_DMA, ResourceTemplate() {
              QWordMemory (ResourceProducer,
                  PosDecode,
                  MinFixed,
                  MaxFixed,
                  NonCacheable,
                  ReadWrite,
                  0x0,
                  0x4080000000,
                  0x447fffffff,
                  0x3fc000000000,
                  0x400000000,
                  ,
                  ,
                  )
      
              QWordMemory (ResourceProducer,
                  PosDecode,
                  MinFixed,
                  MaxFixed,
                  NonCacheable,
                  ReadWrite,
                  0x0,
                  0x2080000000,
                  0x247fffffff,
                  0x1fe000000000,
                  0x400000000,
                  ,
                  ,
                  )
          })
      Acked-by: NHuacai Chen <chenhuacai@loongson.cn>
      Signed-off-by: NJianmin Lv <lvjianmin@loongson.cn>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      c78c43fe
    • J
      ACPI: scan: Support multiple DMA windows with different offsets · bf2ee8d0
      Jianmin Lv 提交于
      In DT systems configurations, of_dma_get_range() returns struct
      bus_dma_region DMA regions; they are used to set-up devices
      DMA windows with different offset available for translation between DMA
      address and CPU address.
      
      In ACPI systems configuration, acpi_dma_get_range() does not return
      DMA regions yet and that precludes setting up the dev->dma_range_map
      pointer and therefore DMA regions with multiple offsets.
      
      Update acpi_dma_get_range() to return struct bus_dma_region
      DMA regions like of_dma_get_range() does.
      
      After updating acpi_dma_get_range(), acpi_arch_dma_setup() is changed for
      ARM64, where the original dma_addr and size are removed as these
      arguments are now redundant, and pass 0 and U64_MAX for dma_base
      and size of arch_setup_dma_ops; this is a simplification consistent
      with what other ACPI architectures also pass to iommu_setup_dma_ops().
      Reviewed-by: NRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: NJianmin Lv <lvjianmin@loongson.cn>
      Reviewed-by: NLorenzo Pieralisi <lpieralisi@kernel.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      bf2ee8d0
  2. 28 7月, 2022 1 次提交
  3. 20 7月, 2022 3 次提交
  4. 15 7月, 2022 1 次提交
  5. 06 7月, 2022 1 次提交
  6. 04 7月, 2022 1 次提交
  7. 20 5月, 2022 1 次提交
  8. 29 4月, 2022 3 次提交
  9. 28 4月, 2022 1 次提交
  10. 18 3月, 2022 1 次提交
  11. 17 3月, 2022 2 次提交
  12. 02 3月, 2022 1 次提交
  13. 05 1月, 2022 1 次提交
    • S
      ACPI: PCC: Implement OperationRegion handler for the PCC Type 3 subtype · 77e2a047
      Sudeep Holla 提交于
      PCC OpRegion provides a mechanism to communicate with the platform
      directly from the AML. PCCT provides the list of PCC channel available
      in the platform, a subset or all of them can be used in PCC Opregion.
      
      This patch registers the PCC OpRegion handler before ACPI tables are
      loaded. This relies on the special context data passed to identify and
      set up the PCC channel before the OpRegion handler is executed for the
      first time.
      
      Typical PCC Opregion declaration looks like this:
      
      OperationRegion (PFRM, PCC, 2, 0x74)
      Field (PFRM, ByteAcc, NoLock, Preserve)
      {
          SIGN,   32,
          FLGS,   32,
          LEN,    32,
          CMD,    32,
          DATA,   800
      }
      
      It contains four named double words followed by 100 bytes of buffer
      names DATA.
      
      ASL can fill out the buffer something like:
      
          /* Create global or local buffer */
          Name (BUFF, Buffer (0x0C){})
          /* Create double word fields over the buffer */
          CreateDWordField (BUFF, 0x0, WD0)
          CreateDWordField (BUFF, 0x04, WD1)
          CreateDWordField (BUFF, 0x08, WD2)
      
          /* Fill the named fields */
          WD0 = 0x50434300
          SIGN = BUFF
          WD0 = 1
          FLGS = BUFF
          WD0 = 0x10
          LEN = BUFF
      
          /* Fill the payload in the DATA buffer */
          WD0 = 0
          WD1 = 0x08
          WD2 = 0
          DATA = BUFF
      
          /* Write to CMD field to trigger handler */
          WD0 = 0x4404
          CMD = BUFF
      
      This buffer is received by acpi_pcc_opregion_space_handler. This
      handler will fetch the complete buffer via internal_pcc_buffer.
      
      The setup handler will receive the special PCC context data which will
      contain the PCC channel index which used to set up the channel. The
      buffer pointer and length is saved in region context which is then used
      in the handler.
      
      (kernel test robot: Build failure with CONFIG_ACPI_DEBUGGER)
      Link: https://lore.kernel.org/r/202201041539.feAV0l27-lkp@intel.comReported-by: Nkernel test robot <lkp@intel.com>
      Signed-off-by: NSudeep Holla <sudeep.holla@arm.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      77e2a047
  14. 08 12月, 2021 1 次提交
    • D
      PM: hibernate: Allow ACPI hardware signature to be honoured · 74d95555
      David Woodhouse 提交于
      Theoretically, when the hardware signature in FACS changes, the OS
      is supposed to gracefully decline to attempt to resume from S4:
      
       "If the signature has changed, OSPM will not restore the system
        context and can boot from scratch"
      
      In practice, Windows doesn't do this and many laptop vendors do allow
      the signature to change especially when docking/undocking, so it would
      be a bad idea to simply comply with the specification by default in the
      general case.
      
      However, there are use cases where we do want the compliant behaviour
      and we know it's safe. Specifically, when resuming virtual machines where
      we know the hypervisor has changed sufficiently that resume will fail.
      We really want to be able to *tell* the guest kernel not to try, so it
      boots cleanly and doesn't just crash. This patch provides a way to opt
      in to the spec-compliant behaviour on the command line.
      
      A follow-up patch may do this automatically for certain "known good"
      machines based on a DMI match, or perhaps just for all hypervisor
      guests since there's no good reason a hypervisor would change the
      hardware_signature that it exposes to guests *unless* it wants them
      to obey the ACPI specification.
      Signed-off-by: NDavid Woodhouse <dwmw@amazon.co.uk>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      74d95555
  15. 24 11月, 2021 1 次提交
  16. 16 11月, 2021 4 次提交
  17. 04 11月, 2021 1 次提交
  18. 15 10月, 2021 1 次提交
    • J
      topology: Represent clusters of CPUs within a die · c5e22fef
      Jonathan Cameron 提交于
      Both ACPI and DT provide the ability to describe additional layers of
      topology between that of individual cores and higher level constructs
      such as the level at which the last level cache is shared.
      In ACPI this can be represented in PPTT as a Processor Hierarchy
      Node Structure [1] that is the parent of the CPU cores and in turn
      has a parent Processor Hierarchy Nodes Structure representing
      a higher level of topology.
      
      For example Kunpeng 920 has 6 or 8 clusters in each NUMA node, and each
      cluster has 4 cpus. All clusters share L3 cache data, but each cluster
      has local L3 tag. On the other hand, each clusters will share some
      internal system bus.
      
      +-----------------------------------+                          +---------+
      |  +------+    +------+             +--------------------------+         |
      |  | CPU0 |    | cpu1 |             |    +-----------+         |         |
      |  +------+    +------+             |    |           |         |         |
      |                                   +----+    L3     |         |         |
      |  +------+    +------+   cluster   |    |    tag    |         |         |
      |  | CPU2 |    | CPU3 |             |    |           |         |         |
      |  +------+    +------+             |    +-----------+         |         |
      |                                   |                          |         |
      +-----------------------------------+                          |         |
      +-----------------------------------+                          |         |
      |  +------+    +------+             +--------------------------+         |
      |  |      |    |      |             |    +-----------+         |         |
      |  +------+    +------+             |    |           |         |         |
      |                                   |    |    L3     |         |         |
      |  +------+    +------+             +----+    tag    |         |         |
      |  |      |    |      |             |    |           |         |         |
      |  +------+    +------+             |    +-----------+         |         |
      |                                   |                          |         |
      +-----------------------------------+                          |   L3    |
                                                                     |   data  |
      +-----------------------------------+                          |         |
      |  +------+    +------+             |    +-----------+         |         |
      |  |      |    |      |             |    |           |         |         |
      |  +------+    +------+             +----+    L3     |         |         |
      |                                   |    |    tag    |         |         |
      |  +------+    +------+             |    |           |         |         |
      |  |      |    |      |             |    +-----------+         |         |
      |  +------+    +------+             +--------------------------+         |
      +-----------------------------------|                          |         |
      +-----------------------------------|                          |         |
      |  +------+    +------+             +--------------------------+         |
      |  |      |    |      |             |    +-----------+         |         |
      |  +------+    +------+             |    |           |         |         |
      |                                   +----+    L3     |         |         |
      |  +------+    +------+             |    |    tag    |         |         |
      |  |      |    |      |             |    |           |         |         |
      |  +------+    +------+             |    +-----------+         |         |
      |                                   |                          |         |
      +-----------------------------------+                          |         |
      +-----------------------------------+                          |         |
      |  +------+    +------+             +--------------------------+         |
      |  |      |    |      |             |   +-----------+          |         |
      |  +------+    +------+             |   |           |          |         |
      |                                   |   |    L3     |          |         |
      |  +------+    +------+             +---+    tag    |          |         |
      |  |      |    |      |             |   |           |          |         |
      |  +------+    +------+             |   +-----------+          |         |
      |                                   |                          |         |
      +-----------------------------------+                          |         |
      +-----------------------------------+                          |         |
      |  +------+    +------+             +--------------------------+         |
      |  |      |    |      |             |  +-----------+           |         |
      |  +------+    +------+             |  |           |           |         |
      |                                   |  |    L3     |           |         |
      |  +------+    +------+             +--+    tag    |           |         |
      |  |      |    |      |             |  |           |           |         |
      |  +------+    +------+             |  +-----------+           |         |
      |                                   |                          +---------+
      +-----------------------------------+
      
      That means spreading tasks among clusters will bring more bandwidth
      while packing tasks within one cluster will lead to smaller cache
      synchronization latency. So both kernel and userspace will have
      a chance to leverage this topology to deploy tasks accordingly to
      achieve either smaller cache latency within one cluster or an even
      distribution of load among clusters for higher throughput.
      
      This patch exposes cluster topology to both kernel and userspace.
      Libraried like hwloc will know cluster by cluster_cpus and related
      sysfs attributes. PoC of HWLOC support at [2].
      
      Note this patch only handle the ACPI case.
      
      Special consideration is needed for SMT processors, where it is
      necessary to move 2 levels up the hierarchy from the leaf nodes
      (thus skipping the processor core level).
      
      Note that arm64 / ACPI does not provide any means of identifying
      a die level in the topology but that may be unrelate to the cluster
      level.
      
      [1] ACPI Specification 6.3 - section 5.2.29.1 processor hierarchy node
          structure (Type 0)
      [2] https://github.com/hisilicon/hwloc/tree/linux-clusterSigned-off-by: NJonathan Cameron <Jonathan.Cameron@huawei.com>
      Signed-off-by: NTian Tao <tiantao6@hisilicon.com>
      Signed-off-by: NBarry Song <song.bao.hua@hisilicon.com>
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20210924085104.44806-2-21cnbao@gmail.com
      c5e22fef
  19. 29 9月, 2021 1 次提交
  20. 17 7月, 2021 2 次提交
  21. 02 7月, 2021 1 次提交
  22. 25 6月, 2021 1 次提交
  23. 17 6月, 2021 1 次提交
  24. 16 6月, 2021 1 次提交
  25. 12 6月, 2021 1 次提交
  26. 10 6月, 2021 2 次提交
    • E
      ACPI: Add \_SB._OSC bit for PRM · 60faa8f1
      Erik Kaneda 提交于
      Signed-off-by: NErik Kaneda <erik.kaneda@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      60faa8f1
    • E
      ACPI: PRM: implement OperationRegion handler for the PlatformRtMechanism subtype · cefc7ca4
      Erik Kaneda 提交于
      Platform Runtime Mechanism (PRM) is a firmware interface that exposes
      a set of binary executables that can either be called from the AML
      interpreter or device drivers by bypassing the AML interpreter.
      This change implements the AML interpreter path.
      
      According to the specification [1], PRM services are listed in an
      ACPI table called the PRMT. This patch parses module and handler
      information listed in the PRMT and registers the PlatformRtMechanism
      OpRegion handler before ACPI tables are loaded.
      
      Each service is defined by a 16-byte GUID and called from writing a
      26-byte ASL buffer containing the identifier to a FieldUnit object
      defined inside a PlatformRtMechanism OperationRegion.
      
          OperationRegion (PRMR, PlatformRtMechanism, 0, 26)
          Field (PRMR, BufferAcc, NoLock, Preserve)
          {
              PRMF, 208 // Write to this field to invoke the OperationRegion Handler
          }
      
      The 26-byte ASL buffer is defined as the following:
      
      Byte Offset   Byte Length    Description
      =============================================================
           0             1         PRM OperationRegion handler status
           1             8         PRM service status
           9             1         PRM command
          10            16         PRM handler GUID
      
      The ASL caller fills out a 26-byte buffer containing the PRM command
      and the PRM handler GUID like so:
      
          /* Local0 is the PRM data buffer */
          Local0 = buffer (26){}
      
          /* Create byte fields over the buffer */
          CreateByteField (Local0, 0x9, CMD)
          CreateField (Local0, 0x50, 0x80, GUID)
      
          /* Fill in the command and data fields of the data buffer */
          CMD = 0 // run command
          GUID = ToUUID("xxxx-xx-xxx-xxxx")
      
          /*
           * Invoke PRM service with an ID that matches GUID and save the
           * result.
           */
          Local0 = (\_SB.PRMT.PRMF = Local0)
      
      Byte offset 0 - 8 are written by the handler as a status passed back to AML
      and used by ASL like so:
      
          /* Create byte fields over the buffer */
          CreateByteField (Local0, 0x0, PSTA)
          CreateQWordField (Local0, 0x1, USTA)
      
      In this ASL code, PSTA contains a status from the OperationRegion and
      USTA contains a status from the PRM service.
      
      The 26-byte buffer is recieved by acpi_platformrt_space_handler. This
      handler will look at the command value and the handler guid and take
      the approperiate actions.
      
      Command value    Action
      =====================================================================
          0            Run the PRM service indicated by the PRM handler
                       GUID (bytes 10-26)
      
          1            Prevent PRM runtime updates from happening to the
                       service's parent module
      
          2            Allow PRM updates from happening to the service's parent module
      
      This patch enables command value 0.
      
      Link: https://uefi.org/sites/default/files/resources/Platform%20Runtime%20Mechanism%20-%20with%20legal%20notice.pdf # [1]
      Signed-off-by: NErik Kaneda <erik.kaneda@intel.com>
      [ rjw: Subject and changelog edits ]
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      cefc7ca4
  27. 07 6月, 2021 3 次提交