Blame SOURCES/0185-cxl-test-Update-CXL-memory-parameters.patch

26ccd9
From 74a8134ef2dfa3c22c7e22b0bfd30b6a5cdf678b Mon Sep 17 00:00:00 2001
26ccd9
From: Dan Williams <dan.j.williams@intel.com>
26ccd9
Date: Thu, 14 Jul 2022 10:02:49 -0700
26ccd9
Subject: [PATCH 185/217] cxl/test: Update CXL memory parameters
26ccd9
26ccd9
In support of testing CXL region configurations cxl_test changed the size
26ccd9
of its root decoders and endpoints. Use the size of the first root decoder
26ccd9
to determine if this is an updated kernel.
26ccd9
26ccd9
Link: https://lore.kernel.org/r/165781816971.1555691.18362747345754213762.stgit@dwillia2-xfh.jf.intel.com
26ccd9
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
26ccd9
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
26ccd9
---
26ccd9
 test/cxl-topology.sh | 32 +++++++++++++++++++++-----------
26ccd9
 1 file changed, 21 insertions(+), 11 deletions(-)
26ccd9
26ccd9
diff --git a/test/cxl-topology.sh b/test/cxl-topology.sh
26ccd9
index ff11614..2583005 100644
26ccd9
--- a/test/cxl-topology.sh
26ccd9
+++ b/test/cxl-topology.sh
26ccd9
@@ -64,14 +64,9 @@ switch[2]=$(jq -r ".[] | .[\"ports:${bridge[1]}\"] | $port_sort | .[0].host" <<<
26ccd9
 switch[3]=$(jq -r ".[] | .[\"ports:${bridge[1]}\"] | $port_sort | .[1].host" <<< $json)
26ccd9
 
26ccd9
 
26ccd9
-# check that all 8 cxl_test memdevs are enabled by default and have a
26ccd9
-# pmem size of 256M
26ccd9
-json=$($CXL list -b cxl_test -M)
26ccd9
-count=$(jq "map(select(.pmem_size == $((256 << 20)))) | length" <<< $json)
26ccd9
-((count == 8)) || err "$LINENO"
26ccd9
-
26ccd9
-
26ccd9
 # validate the expected properties of the 4 root decoders
26ccd9
+# use the size of the first decoder to determine the cxl_test version /
26ccd9
+# properties
26ccd9
 json=$($CXL list -b cxl_test -D -d root)
26ccd9
 port_id=${root:4}
26ccd9
 port_id_len=${#port_id}
26ccd9
@@ -80,26 +75,41 @@ count=$(jq "[ $decoder_sort | .[0] |
26ccd9
 	select(.volatile_capable == true) |
26ccd9
 	select(.size == $((256 << 20))) |
26ccd9
 	select(.nr_targets == 1) ] | length" <<< $json)
26ccd9
-((count == 1)) || err "$LINENO"
26ccd9
+
26ccd9
+if [ $count -eq 1 ]; then
26ccd9
+	decoder_base_size=$((256 << 20))
26ccd9
+	pmem_size=$((256 << 20))
26ccd9
+else
26ccd9
+	decoder_base_size=$((1 << 30))
26ccd9
+	pmem_size=$((1 << 30))
26ccd9
+fi
26ccd9
 
26ccd9
 count=$(jq "[ $decoder_sort | .[1] |
26ccd9
 	select(.volatile_capable == true) |
26ccd9
-	select(.size == $((512 << 20))) |
26ccd9
+	select(.size == $((decoder_base_size * 2))) |
26ccd9
 	select(.nr_targets == 2) ] | length" <<< $json)
26ccd9
 ((count == 1)) || err "$LINENO"
26ccd9
 
26ccd9
 count=$(jq "[ $decoder_sort | .[2] |
26ccd9
 	select(.pmem_capable == true) |
26ccd9
-	select(.size == $((256 << 20))) |
26ccd9
+	select(.size == $decoder_base_size) |
26ccd9
 	select(.nr_targets == 1) ] | length" <<< $json)
26ccd9
 ((count == 1)) || err "$LINENO"
26ccd9
 
26ccd9
 count=$(jq "[ $decoder_sort | .[3] |
26ccd9
 	select(.pmem_capable == true) |
26ccd9
-	select(.size == $((512 << 20))) |
26ccd9
+	select(.size == $((decoder_base_size * 2))) |
26ccd9
 	select(.nr_targets == 2) ] | length" <<< $json)
26ccd9
 ((count == 1)) || err "$LINENO"
26ccd9
 
26ccd9
+
26ccd9
+# check that all 8 cxl_test memdevs are enabled by default and have a
26ccd9
+# pmem size of 256M, or 1G
26ccd9
+json=$($CXL list -b cxl_test -M)
26ccd9
+count=$(jq "map(select(.pmem_size == $pmem_size)) | length" <<< $json)
26ccd9
+((count == 8)) || err "$LINENO"
26ccd9
+
26ccd9
+
26ccd9
 # check that switch ports disappear after all of their memdevs have been
26ccd9
 # disabled, and return when the memdevs are enabled.
26ccd9
 for s in ${switch[@]}
26ccd9
-- 
26ccd9
2.27.0
26ccd9