Blame SOURCES/0201-cxl-test-Validate-endpoint-interleave-geometry.patch

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