Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tools: update test_hmm script to support SP config

Add two more parameters to set spm_addr_dev0 & spm_addr_dev1 addresses.
These two parameters configure the start SP addresses for each device in
test_hmm driver. Consequently, this configures zone device type as
coherent.

Link: https://lkml.kernel.org/r/20220715150521.18165-13-alex.sierra@amd.com
Signed-off-by: Alex Sierra <alex.sierra@amd.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Alistair Popple <apopple@nvidia.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Jason Gunthorpe <jgg@nvidia.com>
Cc: Jerome Glisse <jglisse@redhat.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Ralph Campbell <rcampbell@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Alex Sierra and committed by
akpm
e6474b1a f70dab3c

+21 -3
+21 -3
tools/testing/selftests/vm/test_hmm.sh
··· 40 40 41 41 load_driver() 42 42 { 43 - modprobe $DRIVER > /dev/null 2>&1 43 + if [ $# -eq 0 ]; then 44 + modprobe $DRIVER > /dev/null 2>&1 45 + else 46 + if [ $# -eq 2 ]; then 47 + modprobe $DRIVER spm_addr_dev0=$1 spm_addr_dev1=$2 48 + > /dev/null 2>&1 49 + else 50 + echo "Missing module parameters. Make sure pass"\ 51 + "spm_addr_dev0 and spm_addr_dev1" 52 + usage 53 + fi 54 + fi 44 55 if [ $? == 0 ]; then 45 56 major=$(awk "\$2==\"HMM_DMIRROR\" {print \$1}" /proc/devices) 46 57 mknod /dev/hmm_dmirror0 c $major 0 47 58 mknod /dev/hmm_dmirror1 c $major 1 59 + if [ $# -eq 2 ]; then 60 + mknod /dev/hmm_dmirror2 c $major 2 61 + mknod /dev/hmm_dmirror3 c $major 3 62 + fi 48 63 fi 49 64 } 50 65 ··· 73 58 { 74 59 echo "Running smoke test. Note, this test provides basic coverage." 75 60 76 - load_driver 61 + load_driver $1 $2 77 62 $(dirname "${BASH_SOURCE[0]}")/hmm-tests 78 63 unload_driver 79 64 } ··· 90 75 echo "# Smoke testing" 91 76 echo "./${TEST_NAME}.sh smoke" 92 77 echo 78 + echo "# Smoke testing with SPM enabled" 79 + echo "./${TEST_NAME}.sh smoke <spm_addr_dev0> <spm_addr_dev1>" 80 + echo 93 81 exit 0 94 82 } 95 83 ··· 102 84 usage 103 85 else 104 86 if [ "$1" = "smoke" ]; then 105 - run_smoke 87 + run_smoke $2 $3 106 88 else 107 89 usage 108 90 fi