1. 16 8月, 2019 1 次提交
  2. 31 5月, 2019 1 次提交
    • K
      ACPI/IORT: Reject platform device creation on NUMA node mapping failure · 9082058b
      Kefeng Wang 提交于
      [ Upstream commit 36a2ba07757df790b4a874efb1a105b9330a9ae7 ]
      
      In a system where, through IORT firmware mappings, the SMMU device is
      mapped to a NUMA node that is not online, the kernel bootstrap results
      in the following crash:
      
        Unable to handle kernel paging request at virtual address 0000000000001388
        Mem abort info:
          ESR = 0x96000004
          Exception class = DABT (current EL), IL = 32 bits
          SET = 0, FnV = 0
          EA = 0, S1PTW = 0
        Data abort info:
          ISV = 0, ISS = 0x00000004
          CM = 0, WnR = 0
        [0000000000001388] user address but active_mm is swapper
        Internal error: Oops: 96000004 [#1] SMP
        Modules linked in:
        CPU: 5 PID: 1 Comm: swapper/0 Not tainted 5.0.0 #15
        pstate: 80c00009 (Nzcv daif +PAN +UAO)
        pc : __alloc_pages_nodemask+0x13c/0x1068
        lr : __alloc_pages_nodemask+0xdc/0x1068
        ...
        Process swapper/0 (pid: 1, stack limit = 0x(____ptrval____))
        Call trace:
         __alloc_pages_nodemask+0x13c/0x1068
         new_slab+0xec/0x570
         ___slab_alloc+0x3e0/0x4f8
         __slab_alloc+0x60/0x80
         __kmalloc_node_track_caller+0x10c/0x478
         devm_kmalloc+0x44/0xb0
         pinctrl_bind_pins+0x4c/0x188
         really_probe+0x78/0x2b8
         driver_probe_device+0x64/0x110
         device_driver_attach+0x74/0x98
         __driver_attach+0x9c/0xe8
         bus_for_each_dev+0x84/0xd8
         driver_attach+0x30/0x40
         bus_add_driver+0x170/0x218
         driver_register+0x64/0x118
         __platform_driver_register+0x54/0x60
         arm_smmu_driver_init+0x24/0x2c
         do_one_initcall+0xbc/0x328
         kernel_init_freeable+0x304/0x3ac
         kernel_init+0x18/0x110
         ret_from_fork+0x10/0x1c
        Code: f90013b5 b9410fa1 1a9f0694 b50014c2 (b9400804)
        ---[ end trace dfeaed4c373a32da ]--
      
      Change the dev_set_proximity() hook prototype so that it returns a
      value and make it return failure if the PXM->NUMA-node mapping
      corresponds to an offline node, fixing the crash.
      Acked-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Signed-off-by: NKefeng Wang <wangkefeng.wang@huawei.com>
      Link: https://lore.kernel.org/linux-arm-kernel/20190315021940.86905-1-wangkefeng.wang@huawei.com/Signed-off-by: NWill Deacon <will.deacon@arm.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      9082058b
  3. 17 1月, 2019 1 次提交
  4. 17 12月, 2018 1 次提交
  5. 28 7月, 2018 3 次提交
  6. 08 3月, 2018 2 次提交
    • L
      ACPI/IORT: Remove obsolete ACPI_IORT_SMMU_V3_CAVIUM_CN99XX define · 8dc12538
      Lorenzo Pieralisi 提交于
      To defeat ACPICA<->kernel merge order dependencies a preprocessor define
      value was introduced in the IORT compilation unit according to IORT
      revision C, IORT_SMMU_V3_CAVIUM_CN99XX, so that even if the value was
      not defined in ACPICA headers the IORT kernel layer would still be able
      to function and use it.
      
      Since commit 0c2021c0 ("ACPICA: IORT: Update SMMU models for
      revision C") finally added the define in ACPICA headers, as required by
      ACPICA IORT support, the preprocessor definition in the IORT kernel
      compilation unit has become obsolete and can be removed.
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Acked-by: NRobin Murphy <robin.murphy@arm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Hanjun Guo <hanjun.guo@linaro.org>
      Cc: Sudeep Holla <sudeep.holla@arm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Robin Murphy <robin.murphy@arm.com>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      8dc12538
    • L
      ACPI/IORT: Remove temporary iort_get_id_mapping_index() ACPICA guard · 6c475063
      Lorenzo Pieralisi 提交于
      In IORT issue C SMMUv3 IORT nodes gained an additional field (DeviceID
      mapping index) so that the SMMUv3 can describe its MSI interrupts.
      
      Referring to it in the kernel requires ACPICA changes and in order
      to prevent kernel<->ACPICA dependencies kernel code depending on the
      SMMUv3 DeviceID mapping index field was guarded with an ACPICA version
      conditional.
      
      ACPICA changes introducing DeviceID mapping index in the IORT structs
      were integrated in the kernel with:
      
      commit 4c106aa4 ("ACPICA: iasl: Add SMMUv3 device ID mapping index
      support")
      
      so the temporary ACPICA guard has become stale and can be removed.
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Acked-by: NHanjun Guo <hanjun.guo@linaro.org>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Hanjun Guo <hanjun.guo@linaro.org>
      Cc: Sudeep Holla <sudeep.holla@arm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      6c475063
  7. 14 2月, 2018 1 次提交
  8. 16 10月, 2017 7 次提交
    • L
      ACPI/IORT: Enable SMMUv3/PMCG IORT MSI domain set-up · 65637901
      Lorenzo Pieralisi 提交于
      ITS specific mappings for SMMUv3/PMCG components can be retrieved
      through special index mapping entries introduced in IORT revision C.
      
      Introduce a new API iort_set_device_domain() to set the MSI domain for
      SMMUv3/PMCG nodes (extendable to any future IORT node requiring special
      index ITS mapping entries) that represent MSI through special index
      mappings in order to enable MSI support for the devices their nodes
      represent.
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Signed-off-by: NHanjun Guo <hanjun.guo@linaro.org>
      65637901
    • 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
  9. 05 10月, 2017 1 次提交
    • L
      ACPI/IORT: Fix PCI ACS enablement · 37f6b42e
      Lorenzo Pieralisi 提交于
      commit f6810c15 ("iommu/arm-smmu: Clean up early-probing
      workarounds") removed kernel code that was allowing to initialize
      and probe the SMMU devices early (ie earlier than PCI devices, through
      linker script callback entries) in the boot process because it was not
      needed any longer in that the SMMU devices/drivers now support deferred
      probing.
      
      Since the SMMUs probe routines are also in charge of requesting global
      PCI ACS kernel enablement, commit f6810c15 ("iommu/arm-smmu: Clean
      up early-probing workarounds") also postponed PCI ACS enablement to
      SMMUs devices probe time, which is too late given that PCI devices needs
      to detect if PCI ACS is enabled to init the respective capability
      through the following call path:
      
      pci_device_add()
       -> pci_init_capabilities()
        -> pci_enable_acs()
      
      Add code in the ACPI IORT SMMU platform devices initialization path
      (that is called before ACPI PCI enumeration) to detect if there
      exists firmware mappings to map root complexes ids to SMMU ids
      and if so enable ACS for the system.
      
      Fixes: f6810c15 ("iommu/arm-smmu: Clean up early-probing workarounds")
      Reviewed-by: NRobin Murphy <robin.murphy@arm.com>
      Tested-by: NNate Watterson <nwatters@codeaurora.org>
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Hanjun Guo <hanjun.guo@linaro.org>
      Cc: Sudeep Holla <sudeep.holla@arm.com>
      Cc: Zhou Wang <wangzhou1@hisilicon.com>
      Cc: Alex Williamson <alex.williamson@redhat.com>
      Signed-off-by: NCatalin Marinas <catalin.marinas@arm.com>
      37f6b42e
  10. 11 8月, 2017 1 次提交
  11. 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
  12. 07 8月, 2017 2 次提交
  13. 24 6月, 2017 3 次提交
  14. 15 6月, 2017 1 次提交
  15. 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
  16. 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
  17. 20 4月, 2017 3 次提交
  18. 30 3月, 2017 2 次提交
  19. 29 3月, 2017 2 次提交
  20. 22 3月, 2017 3 次提交