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

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