1. 16 10月, 2017 6 次提交
    • H
      ACPI/IORT: Add SMMUv3 specific special index mapping handling · 86456a3f
      Hanjun Guo 提交于
      IORT revision C introduced a mapping entry binding to describe ITS
      device ID mapping for SMMUv3 MSI interrupts.
      
      Enable the single mapping flag (ie that is used by SMMUv3 component for
      its special index mappings) for the SMMUv3 node in the IORT mapping API
      and add IORT code to handle special index mapping entry for the SMMUv3
      IORT nodes to enable their MSI interrupts. In case the ACPICA for
      SMMUv3 device ID mapping is not ready, use the ACPICA version as a guard
      for function iort_get_id_mapping_index().
      Signed-off-by: NHanjun Guo <hanjun.guo@linaro.org>
      [lorenzo.pieralisi@arm.com: patch split, typos fixing, rewrote the log]
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      86456a3f
    • H
      ACPI/IORT: Enable special index ITS group mappings for IORT nodes · 8c8df8dc
      Hanjun Guo 提交于
      IORT revision C introduced SMMUv3 and PMCG MSI support by adding
      specific mapping entries in the SMMUv3/PMCG subtables to retrieve
      the device ID and the ITS group it maps to for a given SMMUv3/PMCG
      IORT node.
      
      Introduce a mapping function (ie iort_get_id_mapping_index()), that
      for a given IORT node looks up if an ITS specific ID mapping entry
      exists and if so retrieve the corresponding mapping index in the IORT
      node mapping array.
      
      Since an ITS specific index mapping can be present for an IORT
      node that is not a leaf node (eg SMMUv3 - to describe its own
      ITS device ID) special handling is required for two steps mapping
      cases such as PCI/NamedComponent--->SMMUv3--->ITS because the SMMUv3
      ITS specific index mapping entry should be skipped to prevent the
      IORT API from considering the mapping entry as a regular mapping one.
      
      If we take the following IORT topology example:
      
      |----------------------|
      |  Root Complex Node   |
      |----------------------|
      |    map entry[x]      |
      |----------------------|
      |       id value       |
      | output_reference     |
      |---|------------------|
          |
          |   |----------------------|
          |-->|        SMMUv3        |
              |----------------------|
              |     SMMUv3 dev ID    |
              |     mapping index 0  |
              |----------------------|
              |      map entry[0]    |
              |----------------------|
              |       id value       |
              | output_reference-----------> ITS 1 (SMMU MSI domain)
              |----------------------|
              |      map entry[1]    |
              |----------------------|
              |       id value       |
              | output_reference-----------> ITS 2 (PCI MSI domain)
              |----------------------|
      
      where the SMMUv3 ITS specific mapping entry is index 0 and it
      represents the SMMUv3 ITS specific index mapping entry (describing its
      own ITS device ID), we need to skip that mapping entry while carrying
      out the Root Complex Node regular mappings to prevent erroneous
      translations.
      
      Reuse the iort_get_id_mapping_index() function to detect the ITS
      specific mapping index for a specific IORT node and skip it in the IORT
      mapping API (ie iort_node_map_id()) loop to prevent considering it a
      normal PCI/Named Component ID mapping entry.
      Signed-off-by: NHanjun Guo <hanjun.guo@linaro.org>
      [lorenzo.pieralisi@arm.com: split patch/rewrote commit log]
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      8c8df8dc
    • H
      ACPI/IORT: Look up IORT node through struct fwnode_handle pointer · 0a71d8b9
      Hanjun Guo 提交于
      Current IORT code provides a function (ie iort_get_fwnode())
      which looks up a struct fwnode_handle pointer through a
      struct acpi_iort_node pointer for SMMU components but it
      lacks a function that implements the reverse look-up, namely
      struct fwnode_handle* -> struct acpi_iort_node*.
      
      Devices that are not IORT named components cannot be retrieved through
      their associated IORT named component scan interface because they just
      are not represented in the ACPI namespace; the reverse look-up is
      therefore required for all platform devices that represent IORT nodes
      (eg SMMUs) so that the struct acpi_iort_node* can be retrieved from the
      struct device->fwnode pointer.
      Signed-off-by: NHanjun Guo <hanjun.guo@linaro.org>
      [lorenzo.pieralisi@arm.com: re-indented/rewrote the commit log]
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      0a71d8b9
    • L
      ACPI/IORT: Make platform devices initialization code SMMU agnostic · 896dd2c3
      Lorenzo Pieralisi 提交于
      The way current IORT code initializes platform devices for SMMU nodes
      is somewhat tied (mostly for naming convention) to the SMMU nodes
      themselves but it need not be in that it is completely generic and
      can easily be made so by structures renaming and code reshuffling.
      
      Rework IORT platform devices initialization code to make the functions
      and data structures SMMU agnostic.
      
      No functional changes intended.
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Acked-by: NHanjun Guo <hanjun.guo@linaro.org>
      Cc: Hanjun Guo <hanjun.guo@linaro.org>
      Cc: Sudeep Holla <sudeep.holla@arm.com>
      896dd2c3
    • L
      ACPI/IORT: Improve functions return type/storage class specifier indentation · e3d49392
      Lorenzo Pieralisi 提交于
      Some functions definition indentations are using a style that is frowned
      upon with return value type/storage class specifier in a separate line.
      
      Reindent the function definitions to fix them.
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Acked-by: NHanjun Guo <hanjun.guo@linaro.org>
      Cc: Hanjun Guo <hanjun.guo@linaro.org>
      Cc: Sudeep Holla <sudeep.holla@arm.com>
      e3d49392
    • L
      ACPI/IORT: Remove leftover ACPI_IORT_SMMU_V3_PXM_VALID guard · 75808131
      Lorenzo Pieralisi 提交于
      The conditional ACPI_IORT_SMMU_V3_PXM_VALID guard around
      arm_smmu_v3_set_proximity() was added to manage a cross tree
      ACPICA merge dependency; with ACPICA changes merged in:
      
      commit c9442300 ("ACPICA: iasl: Update to IORT SMMUv3
      disassembling")
      
      the guard has become useless. Remove it.
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Acked-by: NHanjun Guo <hanjun.guo@linaro.org>
      Cc: Hanjun Guo <hanjun.guo@linaro.org>
      Cc: Sudeep Holla <sudeep.holla@arm.com>
      Cc: Ganapatrao Kulkarni <ganapatrao.kulkarni@cavium.com>
      75808131
  2. 11 8月, 2017 1 次提交
  3. 08 8月, 2017 2 次提交
    • G
      ACPI/IORT: numa: Add numa node mapping for smmuv3 devices · 5fe0ce3b
      Ganapatrao Kulkarni 提交于
      ARM IORT specification(rev. C) has added  provision to define proximity
      domain in SMMUv3 IORT table. Adding required code to parse Proximity
      domain and set numa_node of smmv3 platform devices.
      Signed-off-by: NGanapatrao Kulkarni <ganapatrao.kulkarni@cavium.com>
      [lorenzo.pieralisi@arm.com: update pr_info()/commit log]
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      5fe0ce3b
    • R
      ACPI/IORT: Handle PCI aliases properly for IOMMUs · bc8648d4
      Robin Murphy 提交于
      When a PCI device has DMA quirks, we need to ensure that an upstream
      IOMMU knows about all possible aliases, since the presence of a DMA
      quirk does not preclude the device still also emitting transactions
      (e.g. MSIs) on its 'real' RID. Similarly, the rules for bridge aliasing
      are relatively complex, and some bridges may only take ownership of
      transactions under particular transient circumstances, leading again to
      multiple RIDs potentially being seen at the IOMMU for the given device.
      
      Take all this into account in iort_iommu_configure() by mapping every
      RID produced by the alias walk, not just whichever one comes out last.
      Since adding any more internal PTR_ERR() juggling would have confused me
      no end, a bit of refactoring happens in the process - we know where to
      find the ops if everything succeeded, so we're free to just pass regular
      error codes around up until then.
      
      CC: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      CC: Hanjun Guo <hanjun.guo@linaro.org>
      CC: Sudeep Holla <sudeep.holla@arm.com>
      Signed-off-by: NRobin Murphy <robin.murphy@arm.com>
      [lorenzo.pieralisi@arm.com: tagged __get_pci_rid __maybe_unused]
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      bc8648d4
  4. 07 8月, 2017 2 次提交
  5. 24 6月, 2017 3 次提交
  6. 15 6月, 2017 1 次提交
  7. 30 5月, 2017 2 次提交
    • 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
  8. 29 4月, 2017 1 次提交
    • L
      ACPI/IORT: Fix CONFIG_IOMMU_API dependency · d49f2ded
      Lorenzo Pieralisi 提交于
      The IOMMU probe deferral IORT rework had to add code in
      iort_iommu_configure() and iort_iommu_xlate() that requires
      the IOMMU_API to be selected in order to compile and work.
      
      Stub out the pieces of code that depend on CONFIG_IOMMU_API
      to be selected to prevent compilation failures such as:
      
      drivers/acpi/arm64/iort.c: In function 'iort_iommu_xlate':
      drivers/acpi/arm64/iort.c:647:22: error: 'struct iommu_fwspec' has no
      member named 'ops'
      
      by wrapping the code in static inline functions that provide a NOP
      implementation when CONFIG_IOMMU_API is not selected.
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Reported-by: NArnd Bergmann <arnd@arndb.de>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Robin Murphy <robin.murphy@arm.com>
      Cc: Joerg Roedel <joro@8bytes.org>
      Cc: Sricharan R <sricharan@codeaurora.org>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      d49f2ded
  9. 20 4月, 2017 3 次提交
  10. 30 3月, 2017 2 次提交
  11. 29 3月, 2017 2 次提交
  12. 22 3月, 2017 3 次提交
  13. 10 2月, 2017 1 次提交
  14. 07 2月, 2017 2 次提交
    • D
      ACPI/IORT: Fix the error return code in iort_add_smmu_platform_device() · 5e5afa6c
      Dan Carpenter 提交于
      The function iort_add_smmu_platform_device() accidentally returns 0
      (ie PTR_ERR(pdev) where pdev == NULL) if platform_device_alloc() fails;
      fix the bug by returning a proper error value.
      
      Fixes: 846f0e9e ("ACPI/IORT: Add support for ARM SMMU platform devices creation")
      Acked-by: NHanjun Guo <hanjun.guo@linaro.org>
      Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
      [lorenzo.pieralisi@arm.com: improved commit log]
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      5e5afa6c
    • L
      ACPI/IORT: Fix iort_node_get_id() mapping entries indexing · 030abd8a
      Lorenzo Pieralisi 提交于
      Commit 618f535a ("ACPI/IORT: Add single mapping function")
      introduced a function (iort_node_get_id()) to retrieve ids for IORT
      named components.
      
      The iort_node_get_id() takes an index as input to refer to a specific
      mapping entry in the named component IORT node mapping array.
      
      For a mapping entry at a given index, iort_node_get_id() should return
      the id value (through the id_out function parameter) and the IORT node
      output_reference (through function return value) the given mapping entry
      refers to.
      
      Technically output_reference values may differ for different map
      entries, (see diagram below - mapped id values may refer to different eg
      IORT SMMU nodes; the kernel may not be able to handle different
      output_reference values for a given named component but the IORT kernel
      layer should still report the IORT mappings as reported by firmware) but
      current code in iort_node_get_id() fails to use the index function
      parameter to return the correct output_reference value (ie it always
      returns the output_reference value of the first entry in the mapping
      array whilst using the index correctly to retrieve the id value from the
      respective entry).
      
      	|----------------------|
      	|     named component  |
      	|----------------------|
      	|      map entry[0]    |
      	|----------------------|
      	|       id value       |
      	| output_reference----------------> eg SMMU 1
      	|----------------------|
      	|      map entry[1]    |
      	|----------------------|
      	|       id value       |
      	| output_reference----------------> eg SMMU 2
      	|----------------------|
      		    .
      		    .
      		    .
      	|----------------------|
      	|      map entry[N]    |
      	|----------------------|
      	|       id value       |
      	| output_reference----------------> eg SMMU 1
      	|----------------------|
      
      Consequently the iort_node_get_id() function always returns the IORT
      node pointed at by the output_reference value of the first named
      component mapping array entry, irrespective of the index parameter,
      which is a bug.
      
      Update the map array entry pointer computation in iort_node_get_id() to
      take into account the index value, fixing the issue.
      
      Fixes: 618f535a ("ACPI/IORT: Add single mapping function")
      Reported-by: NHanjun Guo <hanjun.guo@linaro.org>
      Reviewed-by: NHanjun Guo <hanjun.guo@linaro.org>
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Cc: Hanjun Guo <hanjun.guo@linaro.org>
      Cc: Sinan Kaya <okaya@codeaurora.org>
      Cc: Tomasz Nowicki <tn@semihalf.com>
      Cc: Nate Watterson <nwatters@codeaurora.org>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      030abd8a
  15. 06 12月, 2016 1 次提交
    • L
      ACPI/IORT: Make dma masks set-up IORT specific · 18b709be
      Lorenzo Pieralisi 提交于
      The introduction of acpi_dma_configure() allows to configure DMA
      and related IOMMU for any device that is DMA capable. To achieve
      that goal it ensures DMA masks are set-up to sane default values
      before proceeding with IOMMU and DMA ops configuration.
      
      On x86/ia64 systems, through acpi_bind_one(), acpi_dma_configure() is
      called for every device that has an ACPI companion, in that every device
      is considered DMA capable on x86/ia64 systems (ie acpi_get_dma_attr() API),
      which has the side effect of initializing dma masks also for
      pseudo-devices (eg CPUs and memory nodes) and potentially for devices
      whose dma masks were not set-up before the acpi_dma_configure() API was
      introduced, which may have noxious side effects.
      
      Therefore, in preparation for IORT firmware specific DMA masks set-up,
      wrap the default DMA masks set-up in acpi_dma_configure() inside an IORT
      specific wrapper that reverts to a NOP on x86/ia64 systems, restoring the
      default expected behaviour on x86/ia64 systems and keeping DMA default
      masks set-up on IORT based (ie ARM) arch configurations.
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Acked-by: NWill Deacon <will.deacon@arm.com>
      Acked-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: NHanjun Guo <hanjun.guo@linaro.org>
      Tested-by: NHanjun Guo <hanjun.guo@linaro.org>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Hanjun Guo <hanjun.guo@linaro.org>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: Robin Murphy <robin.murphy@arm.com>
      Cc: Tomasz Nowicki <tn@semihalf.com>
      Cc: Joerg Roedel <joro@8bytes.org>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Cc: Sricharan R <sricharan@codeaurora.org>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      18b709be
  16. 29 11月, 2016 8 次提交