1. 31 Oct, 2023 3 commits
  2. 28 Oct, 2023 23 commits
  3. 27 Oct, 2023 5 commits
    • Vishal Verma's avatar
      tools/testing/cxl: Slow down the mock firmware transfer · 8f61d48c
      Vishal Verma authored
      The cxl-cli unit test for firmware update does operations like starting
      an asynchronous firmware update, making sure it is in progress, and
      attempting to cancel it. In some cases, such as with no or minimal
      dynamic debugging turned on, the firmware update completes too quickly,
      not allowing the test to have a chance to verify it was in progress.
      This caused a failure of the signature:
      
        expected fw_update_in_progress:true
        test/cxl-update-firmware.sh: failed at line 88
      
      Fix this by adding a delay (~1.5 - 2 ms) to each firmware transfer
      request handled by the mocked interface.
      Reported-by: default avatarDan Williams <dan.j.williams@intel.com>
      Tested-by: default avatarDan Williams <dan.j.williams@intel.com>
      Signed-off-by: default avatarVishal Verma <vishal.l.verma@intel.com>
      Link: https://lore.kernel.org/r/20231026-vv-fw_upd_test_fix-v2-1-5282fd193883@intel.comSigned-off-by: default avatarDan Williams <dan.j.williams@intel.com>
      8f61d48c
    • Jim Harris's avatar
      cxl/region: Fix x1 root-decoder granularity calculations · 98a04c7a
      Jim Harris authored
      Root decoder granularity must match value from CFWMS, which may not
      be the region's granularity for non-interleaved root decoders.
      
      So when calculating granularities for host bridge decoders, use the
      region's granularity instead of the root decoder's granularity to ensure
      the correct granularities are set for the host bridge decoders and any
      downstream switch decoders.
      
      Test configuration is 1 host bridge * 2 switches * 2 endpoints per switch.
      
      Region created with 2048 granularity using following command line:
      
      cxl create-region -m -d decoder0.0 -w 4 mem0 mem2 mem1 mem3 \
      		  -g 2048 -s 2048M
      
      Use "cxl list -PDE | grep granularity" to get a view of the granularity
      set at each level of the topology.
      
      Before this patch:
              "interleave_granularity":2048,
              "interleave_granularity":2048,
          "interleave_granularity":512,
              "interleave_granularity":2048,
              "interleave_granularity":2048,
          "interleave_granularity":512,
      "interleave_granularity":256,
      
      After:
              "interleave_granularity":2048,
              "interleave_granularity":2048,
          "interleave_granularity":4096,
              "interleave_granularity":2048,
              "interleave_granularity":2048,
          "interleave_granularity":4096,
      "interleave_granularity":2048,
      
      Fixes: 27b3f8d1 ("cxl/region: Program target lists")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarJim Harris <jim.harris@samsung.com>
      Link: https://lore.kernel.org/r/169824893473.1403938.16110924262989774582.stgit@bgt-140510-bm03.eng.stellus.in
      [djbw: fixup the prebuilt cxl_test region]
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
      98a04c7a
    • Li Zhijian's avatar
      cxl/region: Fix cxl_region_rwsem lock held when returning to user space · 3531b27f
      Li Zhijian authored
      Fix a missed "goto out" to unlock on error to cleanup this splat:
      
          WARNING: lock held when returning to user space!
          6.6.0-rc3-lizhijian+ #213 Not tainted
          ------------------------------------------------
          cxl/673 is leaving the kernel with locks still held!
          1 lock held by cxl/673:
           #0: ffffffffa013b9d0 (cxl_region_rwsem){++++}-{3:3}, at: commit_store+0x7d/0x3e0 [cxl_core]
      
      In terms of user visible impact of this bug for backports:
      
      cxl_region_invalidate_memregion() on x86 invokes wbinvd which is a
      problematic instruction for virtualized environments. So, on virtualized
      x86, cxl_region_invalidate_memregion() returns an error. This failure
      case got missed because CXL memory-expander device passthrough is not a
      production use case, and emulation of CXL devices is typically limited
      to kernel development builds with CONFIG_CXL_REGION_INVALIDATION_TEST=y,
      that makes cxl_region_invalidate_memregion() succeed.
      
      In other words, the expected exposure of this bug is limited to CXL
      subsystem development environments using QEMU that neglected
      CONFIG_CXL_REGION_INVALIDATION_TEST=y.
      
      Fixes: d1257d09 ("cxl/region: Move cache invalidation before region teardown, and before setup")
      Signed-off-by: default avatarLi Zhijian <lizhijian@fujitsu.com>
      Reviewed-by: default avatarIra Weiny <ira.weiny@intel.com>
      Link: https://lore.kernel.org/r/20231025085450.2514906-1-lizhijian@fujitsu.comSigned-off-by: default avatarDan Williams <dan.j.williams@intel.com>
      3531b27f
    • Alison Schofield's avatar
      cxl/region: Use cxl_calc_interleave_pos() for auto-discovery · 0cf36a85
      Alison Schofield authored
      For auto-discovered regions the driver must assign each target to
      a valid position in the region interleave set based on the decoder
      topology.
      
      The current implementation fails to parse valid decode topologies,
      as it does not consider the child offset into a parent port. The sort
      put all targets of one port ahead of another port when an interleave
      was expected, causing the region assembly to fail.
      
      Replace the existing relative sort with cxl_calc_interleave_pos() that
      finds the exact position in a region interleave for an endpoint based
      on a walk up the ancestral tree from endpoint to root decoder.
      
      cxl_calc_interleave_pos() was introduced in a prior patch, so the work
      here is to use it in cxl_region_sort_targets().
      
      Remove the obsoleted helper functions from the prior sort.
      
      Testing passes on pre-production hardware with BIOS defined regions
      that natively trigger this autodiscovery path of the region driver.
      Testing passes a CXL unit test using the dev_dbg() calculation test
      (see cxl_region_attach()) across an expanded set of region configs:
      1, 1, 1+1, 1+1+1, 2, 2+2, 2+2+2, 2+2+2+2, 4, 4+4, where each number
      represents the count of endpoints per host bridge.
      
      Fixes: a32320b7 ("cxl/region: Add region autodiscovery")
      Reported-by: default avatarDmytro Adamenko <dmytro.adamenko@intel.com>
      Signed-off-by: default avatarAlison Schofield <alison.schofield@intel.com>
      Reviewed-by: default avatarDave Jiang <dave.jiang@intel.com>
      Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
      Link: https://lore.kernel.org/r/3946cc55ddc19678733eddc9de2c317749f43f3b.1698263080.git.alison.schofield@intel.comSigned-off-by: default avatarDan Williams <dan.j.williams@intel.com>
      0cf36a85
    • Alison Schofield's avatar
      cxl/region: Calculate a target position in a region interleave · a3e00c96
      Alison Schofield authored
      Introduce a calculation to find a target's position in a region
      interleave. Perform a self-test of the calculation on user-defined
      regions.
      
      The region driver uses the kernel sort() function to put region
      targets in relative order. Positions are assigned based on each
      target's index in that sorted list. That relative sort doesn't
      consider the offset of a port into its parent port which causes
      some auto-discovered regions to fail creation. In one failure case,
      a 2 + 2 config (2 host bridges each with 2 endpoints), the sort
      puts all the targets of one port ahead of another port when they
      were expected to be interleaved.
      
      In preparation for repairing the autodiscovery region assembly,
      introduce a new method for discovering a target position in the
      region interleave.
      
      cxl_calc_interleave_pos() adds a method to find the target position by
      ascending from an endpoint to a root decoder. The calculation starts
      with the endpoint's local position and position in the parent port. It
      traverses towards the root decoder and examines both position and ways
      in order to allow the position to be refined all the way to the root
      decoder.
      
      This calculation: position = position * parent_ways + parent_pos;
      applied iteratively yields the correct position.
      
      Include a self-test that exercises this new position calculation against
      every successfully configured user-defined region.
      Signed-off-by: default avatarAlison Schofield <alison.schofield@intel.com>
      Link: https://lore.kernel.org/r/0ac32c75cf81dd8b86bf07d70ff139d33c2300bc.1698263080.git.alison.schofield@intel.comSigned-off-by: default avatarDan Williams <dan.j.williams@intel.com>
      a3e00c96
  4. 26 Oct, 2023 2 commits
  5. 24 Oct, 2023 2 commits
  6. 09 Oct, 2023 3 commits
  7. 06 Oct, 2023 2 commits