anitazha / rpms / ndctl

Forked from rpms/ndctl 2 years ago
Clone

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

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