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

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