anitazha / rpms / ndctl

Forked from rpms/ndctl 2 years ago
Clone

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

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