ndctl/0201-cxl-test-Validate-endpoint-interleave-geometry.patch

58 lines
2.4 KiB
Diff
Raw Normal View History

From 05a60dc4992bc4698ceff8e6737192ed818e7e34 Mon Sep 17 00:00:00 2001
From: Dan Williams <dan.j.williams@intel.com>
Date: Fri, 5 Aug 2022 13:37:56 -0700
Subject: [PATCH 201/217] cxl/test: Validate endpoint interleave geometry
Check that endpoint interleave geometry settings are updated once the
endpoint decoders are associated with a region.
Link: https://lore.kernel.org/r/165973187660.1528532.13832323649814892720.stgit@dwillia2-xfh.jf.intel.com
Reported-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
---
test/cxl-region-sysfs.sh | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/test/cxl-region-sysfs.sh b/test/cxl-region-sysfs.sh
index 2582edb..110e037 100644
--- a/test/cxl-region-sysfs.sh
+++ b/test/cxl-region-sysfs.sh
@@ -44,8 +44,8 @@ uuidgen > /sys/bus/cxl/devices/$region/uuid
# setup interleave geometry
nr_targets=${#endpoint[@]}
echo $nr_targets > /sys/bus/cxl/devices/$region/interleave_ways
-g=$(cat /sys/bus/cxl/devices/$decoder/interleave_granularity)
-echo $g > /sys/bus/cxl/devices/$region/interleave_granularity
+r_ig=$(cat /sys/bus/cxl/devices/$decoder/interleave_granularity)
+echo $r_ig > /sys/bus/cxl/devices/$region/interleave_granularity
echo $((nr_targets * (256<<20))) > /sys/bus/cxl/devices/$region/size
# grab the list of memdevs grouped by host-bridge interleave position
@@ -96,6 +96,22 @@ do
done
echo "$region added ${#endpoint[@]} targets: ${endpoint[@]}"
+# validate all endpoint decoders have the correct setting
+region_size=$(cat /sys/bus/cxl/devices/$region/size)
+region_base=$(cat /sys/bus/cxl/devices/$region/resource)
+for i in ${endpoint[@]}
+do
+ iw=$(cat /sys/bus/cxl/devices/$i/interleave_ways)
+ ig=$(cat /sys/bus/cxl/devices/$i/interleave_granularity)
+ [ $iw -ne $nr_targets ] && err "$LINENO: decoder: $i iw: $iw targets: $nr_targets"
+ [ $ig -ne $r_ig] && err "$LINENO: decoder: $i ig: $ig root ig: $r_ig"
+
+ sz=$(cat /sys/bus/cxl/devices/$i/size)
+ res=$(cat /sys/bus/cxl/devices/$i/start)
+ [ $sz -ne $region_size ] && err "$LINENO: decoder: $i sz: $sz region_size: $region_size"
+ [ $res -ne $region_base ] && err "$LINENO: decoder: $i base: $res region_base: $region_base"
+done
+
# walk up the topology and commit all decoders
echo 1 > /sys/bus/cxl/devices/$region/commit
--
2.27.0