1 .. SPDX-License-Identifier: GPL-2.0 2 3 ======================== 4 MMC Test Framework 5 ======================== 6 7 Overview 8 ======== 9 10 The `mmc_test` framework is designed to test t 11 12 The framework provides a variety of tests to e 13 14 The `mmc_test` framework is particularly usefu 15 16 - Verifying the functionality and performance 17 - Ensuring compatibility and reliability of MM 18 - Identifying and diagnosing issues in the MMC 19 20 The results of the tests are logged in the ker 21 22 Note: whatever is on your card will be overwri 23 24 Initialization 25 ============== 26 27 To use the ``mmc_test`` framework, follow thes 28 29 1. **Enable the MMC Test Framework**: 30 31 Ensure that the ``CONFIG_MMC_TEST`` kernel 32 33 .. code-block:: none 34 35 make menuconfig 36 37 Navigate to: 38 39 Device Drivers ---> 40 <*> MMC/SD/SDIO card support ---> 41 [*] MMC host test driver 42 43 Alternatively, you can enable it directly i 44 45 .. code-block:: none 46 47 echo "CONFIG_MMC_TEST=y" >> .config 48 49 Rebuild and install the kernel if necessary 50 51 2. **Load the MMC Test Module**: 52 53 If the ``mmc_test`` framework is built as a 54 55 .. code-block:: none 56 57 modprobe mmc_test 58 59 Binding the MMC Card for Testing 60 ================================ 61 62 To enable MMC testing, you need to unbind the 63 64 1. Identify the MMC card: 65 66 .. code-block:: sh 67 68 ls /sys/bus/mmc/devices/ 69 70 This will list the MMC devices, such as ``m 71 72 2. Unbind the MMC card from the ``mmcblk`` dri 73 74 .. code-block:: sh 75 76 echo 'mmc0:0001' > /sys/bus/mmc/drivers/ 77 78 3. Bind the MMC card to the ``mmc_test`` drive 79 80 .. code-block:: sh 81 82 echo 'mmc0:0001' > /sys/bus/mmc/drivers/ 83 84 After binding, you should see a line in the ke 85 86 .. code-block:: none 87 88 mmc_test mmc0:0001: Card claimed for testin 89 90 91 Usage - Debugfs Entries 92 ======================= 93 94 Once the ``mmc_test`` framework is enabled, yo 95 96 1. **test**: 97 98 This file is used to run specific tests. Wr 99 100 .. code-block:: sh 101 102 echo <test_number> > /sys/kernel/debug/m 103 104 The test result is indicated in the kernel 105 106 .. code-block:: sh 107 108 dmesg | grep mmc0 109 110 Example: 111 112 To run test number 4 (Basic read with data 113 114 .. code-block:: sh 115 116 echo 4 > /sys/kernel/debug/mmc0/mmc0:000 117 118 Check the kernel log for the result: 119 120 .. code-block:: sh 121 122 dmesg | grep mmc0 123 124 2. **testlist**: 125 126 This file lists all available tests. You ca 127 128 .. code-block:: sh 129 130 cat /sys/kernel/debug/mmc0/mmc0:0001/tes 131 132 The available tests are listed in the table 133 134 +------+--------------------------------+----- 135 | Test | Test Name | Test 136 +======+================================+===== 137 | 0 | Run all tests | Runs 138 +------+--------------------------------+----- 139 | 1 | Basic write | Perf 140 | | | sing 141 | | | with 142 +------+--------------------------------+----- 143 | 2 | Basic read | Same 144 +------+--------------------------------+----- 145 | 3 | Basic write | Perf 146 | | (with data verification) | sing 147 | | | with 148 | | | the 149 +------+--------------------------------+----- 150 | 4 | Basic read | Same 151 | | (with data verification) | 152 +------+--------------------------------+----- 153 | 5 | Multi-block write | Perf 154 | | | 8 bl 155 +------+--------------------------------+----- 156 | 6 | Multi-block read | Same 157 +------+--------------------------------+----- 158 | 7 | Power of two block writes | Perf 159 | | | that 160 | | | byte 161 +------+--------------------------------+----- 162 | 8 | Power of two block reads | Same 163 +------+--------------------------------+----- 164 | 9 | Weird sized block writes | Perf 165 | | | bloc 166 | | | incr 167 | | | to 5 168 +------+--------------------------------+----- 169 | 10 | Weird sized block reads | same 170 +------+--------------------------------+----- 171 | 11 | Badly aligned write | Perf 172 | | | star 173 | | | byte 174 | | | hand 175 +------+--------------------------------+----- 176 | 12 | Badly aligned read | same 177 +------+--------------------------------+----- 178 | 13 | Badly aligned multi-block write| same 179 +------+--------------------------------+----- 180 | 14 | Badly aligned multi-block read | same 181 +------+--------------------------------+----- 182 | 15 | Proper xfer_size at write | inte 183 | | (Start failure) | modi 184 | | | will 185 | | | MMC_ 186 +------+--------------------------------+----- 187 | 16 | Proper xfer_size at read | same 188 | | (Start failure) | 189 +------+--------------------------------+----- 190 | 17 | Proper xfer_size at write | same 191 | | (Midway failure) | 192 +------+--------------------------------+----- 193 | 18 | Proper xfer_size at read | same 194 | | (Midway failure) | 195 +------+--------------------------------+----- 196 | 19 | Highmem write | use 197 +------+--------------------------------+----- 198 | 20 | Highmem read | same 199 +------+--------------------------------+----- 200 | 21 | Multi-block highmem write | same 201 +------+--------------------------------+----- 202 | 22 | Multi-block highmem read | same 203 +------+--------------------------------+----- 204 | 23 | Best-case read performance | Perf 205 +------+--------------------------------+----- 206 | 24 | Best-case write performance | same 207 +------+--------------------------------+----- 208 | 25 | Best-case read performance | Same 209 | | (Into scattered pages) | 210 +------+--------------------------------+----- 211 | 26 | Best-case write performance | same 212 | | (From scattered pages) | 213 +------+--------------------------------+----- 214 | 27 | Single read performance | By t 215 +------+--------------------------------+----- 216 | 28 | Single write performance | By t 217 +------+--------------------------------+----- 218 | 29 | Single trim performance | By t 219 +------+--------------------------------+----- 220 | 30 | Consecutive read performance | By t 221 +------+--------------------------------+----- 222 | 31 | Consecutive write performance | By t 223 +------+--------------------------------+----- 224 | 32 | Consecutive trim performance | By t 225 +------+--------------------------------+----- 226 | 33 | Random read performance | By t 227 +------+--------------------------------+----- 228 | 34 | Random write performance | By t 229 +------+--------------------------------+----- 230 | 35 | Large sequential read | Into 231 +------+--------------------------------+----- 232 | 36 | Large sequential write | From 233 +------+--------------------------------+----- 234 | 37 | Write performance | With 235 +------+--------------------------------+----- 236 | 38 | Write performance | With 237 +------+--------------------------------+----- 238 | 39 | Read performance | With 239 +------+--------------------------------+----- 240 | 40 | Read performance | With 241 +------+--------------------------------+----- 242 | 41 | Write performance | Bloc 243 +------+--------------------------------+----- 244 | 42 | Write performance | Non- 245 +------+--------------------------------+----- 246 | 43 | Read performance | Bloc 247 +------+--------------------------------+----- 248 | 44 | Read performance | Non- 249 +------+--------------------------------+----- 250 | 45 | Reset test | 251 +------+--------------------------------+----- 252 | 46 | Commands during read | No S 253 +------+--------------------------------+----- 254 | 47 | Commands during write | No S 255 +------+--------------------------------+----- 256 | 48 | Commands during read | Use 257 +------+--------------------------------+----- 258 | 49 | Commands during write | Use 259 +------+--------------------------------+----- 260 | 50 | Commands during non-blocking | Read 261 +------+--------------------------------+----- 262 | 51 | Commands during non-blocking | Writ 263 +------+--------------------------------+----- 264 265 Test Results 266 ============ 267 268 The results of the tests are logged in the ker 269 270 - **OK**: The test completed successfully. 271 - **FAILED**: The test failed. 272 - **UNSUPPORTED (by host)**: The test is unsup 273 - **UNSUPPORTED (by card)**: The test is unsup 274 - **ERROR**: An error occurred during the test 275 276 Example Kernel Log Output 277 ========================= 278 279 When running a test, you will see log entries 280 281 .. code-block:: none 282 283 [ 1234.567890] mmc0: Starting tests of card 284 [ 1234.567891] mmc0: Test case 4. Basic rea 285 [ 1234.567892] mmc0: Result: OK 286 [ 1234.567893] mmc0: Tests completed. 287 288 In this example, test case 4 (Basic read with 289 290 291 Contributing 292 ============ 293 294 Contributions to the `mmc_test` framework are 295 296 Contact 297 ======= 298 299 For more information or to report issues, plea
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.