On Sun, Nov 06, 2022 at 03:48:13PM -0800, Dan Williams wrote:
> The original port decoder programming algorithm in the kernel failed to
> acommodate the corner case of a passthrough port connected to a fan-out
> port. Use the 5th cxl_test decoder to regression test this scenario.
> 
> Reported-by: Bobo WL <[email protected]>
> Reported-by: Jonathan Cameron <[email protected]>
> Link: http://lore.kernel.org/r/[email protected]
> Signed-off-by: Dan Williams <[email protected]>

Tested-by: Alison Schofield <[email protected]>

> ---
>  test/cxl-create-region.sh |   28 ++++++++++++++++++++++++++++
>  1 file changed, 28 insertions(+)
> 
> diff --git a/test/cxl-create-region.sh b/test/cxl-create-region.sh
> index 82aad3a7285a..47aed44848ab 100644
> --- a/test/cxl-create-region.sh
> +++ b/test/cxl-create-region.sh
> @@ -110,6 +110,34 @@ create_subregions()
>       done
>  }
>  
> +create_single()
> +{
> +     # the 5th cxl_test decoder is expected to target a single-port
> +     # host-bridge. Older cxl_test implementations may not define it,
> +     # so skip the test in that case.
> +     decoder=$($CXL list -b cxl_test -D -d root |
> +               jq -r ".[4] |
> +               select(.pmem_capable == true) |
> +               select(.nr_targets == 1) |
> +               .decoder")
> +
> +        if [[ ! $decoder ]]; then
> +                echo "no single-port host-bridge decoder found, skipping"
> +                return
> +        fi
> +
> +     region=$($CXL create-region -d "$decoder" | jq -r ".region")
> +     if [[ ! $region ]]; then
> +             echo "failed to create single-port host-bridge region"
> +             err "$LINENO"
> +     fi
> +
> +     destroy_regions "$region"
> +}
> +
> +# test region creation on devices behind a single-port host-bridge
> +create_single
> +
>  # test reading labels directly through cxl-cli
>  readarray -t mems < <("$CXL" list -b cxl_test -M | jq -r '.[].memdev')
>  
> 

Reply via email to