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

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi

Pull SCSI fixes from James Bottomley:
"This is a bunch of small driver fixes and a larger rework of zone disk
handling (which reaches into blk and nvme).

The aacraid array-bounds fix is now critical since the security people
turned on -Werror for some build tests, which now fail without it"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
scsi: storvsc: Handle SRB status value 0x30
scsi: block: Improve checks in blk_revalidate_disk_zones()
scsi: block: virtio_blk: Set zone limits before revalidating zones
scsi: block: nullblk: Set zone limits before revalidating zones
scsi: nvme: zns: Set zone limits before revalidating zones
scsi: sd_zbc: Set zone limits before revalidating zones
scsi: ufs: core: Add support for qTimestamp attribute
scsi: aacraid: Avoid -Warray-bounds warning
scsi: ufs: ufs-mediatek: Add dependency for RESET_CONTROLLER
scsi: ufs: core: Update contact email for monitor sysfs nodes
scsi: scsi_debug: Remove dead code
scsi: qla2xxx: Use vmalloc_array() and vcalloc()
scsi: fnic: Use vmalloc_array() and vcalloc()
scsi: qla2xxx: Fix error code in qla2x00_start_sp()
scsi: qla2xxx: Silence a static checker warning
scsi: lpfc: Fix a possible data race in lpfc_unregister_fcf_rescan()

+193 -131
+38 -38
Documentation/ABI/testing/sysfs-driver-ufs
··· 994 994 What: /sys/bus/platform/drivers/ufshcd/*/rpm_lvl 995 995 What: /sys/bus/platform/devices/*.ufs/rpm_lvl 996 996 Date: September 2014 997 - Contact: Subhash Jadavani <subhashj@codeaurora.org> 997 + Contact: Can Guo <quic_cang@quicinc.com> 998 998 Description: This entry could be used to set or show the UFS device 999 999 runtime power management level. The current driver 1000 1000 implementation supports 7 levels with next target states: ··· 1021 1021 What: /sys/bus/platform/drivers/ufshcd/*/rpm_target_dev_state 1022 1022 What: /sys/bus/platform/devices/*.ufs/rpm_target_dev_state 1023 1023 Date: February 2018 1024 - Contact: Subhash Jadavani <subhashj@codeaurora.org> 1024 + Contact: Can Guo <quic_cang@quicinc.com> 1025 1025 Description: This entry shows the target power mode of an UFS device 1026 1026 for the chosen runtime power management level. 1027 1027 ··· 1030 1030 What: /sys/bus/platform/drivers/ufshcd/*/rpm_target_link_state 1031 1031 What: /sys/bus/platform/devices/*.ufs/rpm_target_link_state 1032 1032 Date: February 2018 1033 - Contact: Subhash Jadavani <subhashj@codeaurora.org> 1033 + Contact: Can Guo <quic_cang@quicinc.com> 1034 1034 Description: This entry shows the target state of an UFS UIC link 1035 1035 for the chosen runtime power management level. 1036 1036 ··· 1039 1039 What: /sys/bus/platform/drivers/ufshcd/*/spm_lvl 1040 1040 What: /sys/bus/platform/devices/*.ufs/spm_lvl 1041 1041 Date: September 2014 1042 - Contact: Subhash Jadavani <subhashj@codeaurora.org> 1042 + Contact: Can Guo <quic_cang@quicinc.com> 1043 1043 Description: This entry could be used to set or show the UFS device 1044 1044 system power management level. The current driver 1045 1045 implementation supports 7 levels with next target states: ··· 1066 1066 What: /sys/bus/platform/drivers/ufshcd/*/spm_target_dev_state 1067 1067 What: /sys/bus/platform/devices/*.ufs/spm_target_dev_state 1068 1068 Date: February 2018 1069 - Contact: Subhash Jadavani <subhashj@codeaurora.org> 1069 + Contact: Can Guo <quic_cang@quicinc.com> 1070 1070 Description: This entry shows the target power mode of an UFS device 1071 1071 for the chosen system power management level. 1072 1072 ··· 1075 1075 What: /sys/bus/platform/drivers/ufshcd/*/spm_target_link_state 1076 1076 What: /sys/bus/platform/devices/*.ufs/spm_target_link_state 1077 1077 Date: February 2018 1078 - Contact: Subhash Jadavani <subhashj@codeaurora.org> 1078 + Contact: Can Guo <quic_cang@quicinc.com> 1079 1079 Description: This entry shows the target state of an UFS UIC link 1080 1080 for the chosen system power management level. 1081 1081 ··· 1084 1084 What: /sys/bus/platform/drivers/ufshcd/*/monitor/monitor_enable 1085 1085 What: /sys/bus/platform/devices/*.ufs/monitor/monitor_enable 1086 1086 Date: January 2021 1087 - Contact: Can Guo <cang@codeaurora.org> 1087 + Contact: Can Guo <quic_cang@quicinc.com> 1088 1088 Description: This file shows the status of performance monitor enablement 1089 1089 and it can be used to start/stop the monitor. When the monitor 1090 1090 is stopped, the performance data collected is also cleared. ··· 1092 1092 What: /sys/bus/platform/drivers/ufshcd/*/monitor/monitor_chunk_size 1093 1093 What: /sys/bus/platform/devices/*.ufs/monitor/monitor_chunk_size 1094 1094 Date: January 2021 1095 - Contact: Can Guo <cang@codeaurora.org> 1095 + Contact: Can Guo <quic_cang@quicinc.com> 1096 1096 Description: This file tells the monitor to focus on requests transferring 1097 1097 data of specific chunk size (in Bytes). 0 means any chunk size. 1098 1098 It can only be changed when monitor is disabled. ··· 1100 1100 What: /sys/bus/platform/drivers/ufshcd/*/monitor/read_total_sectors 1101 1101 What: /sys/bus/platform/devices/*.ufs/monitor/read_total_sectors 1102 1102 Date: January 2021 1103 - Contact: Can Guo <cang@codeaurora.org> 1103 + Contact: Can Guo <quic_cang@quicinc.com> 1104 1104 Description: This file shows how many sectors (in 512 Bytes) have been 1105 1105 sent from device to host after monitor gets started. 1106 1106 ··· 1109 1109 What: /sys/bus/platform/drivers/ufshcd/*/monitor/read_total_busy 1110 1110 What: /sys/bus/platform/devices/*.ufs/monitor/read_total_busy 1111 1111 Date: January 2021 1112 - Contact: Can Guo <cang@codeaurora.org> 1112 + Contact: Can Guo <quic_cang@quicinc.com> 1113 1113 Description: This file shows how long (in micro seconds) has been spent 1114 1114 sending data from device to host after monitor gets started. 1115 1115 ··· 1118 1118 What: /sys/bus/platform/drivers/ufshcd/*/monitor/read_nr_requests 1119 1119 What: /sys/bus/platform/devices/*.ufs/monitor/read_nr_requests 1120 1120 Date: January 2021 1121 - Contact: Can Guo <cang@codeaurora.org> 1121 + Contact: Can Guo <quic_cang@quicinc.com> 1122 1122 Description: This file shows how many read requests have been sent after 1123 1123 monitor gets started. 1124 1124 ··· 1127 1127 What: /sys/bus/platform/drivers/ufshcd/*/monitor/read_req_latency_max 1128 1128 What: /sys/bus/platform/devices/*.ufs/monitor/read_req_latency_max 1129 1129 Date: January 2021 1130 - Contact: Can Guo <cang@codeaurora.org> 1130 + Contact: Can Guo <quic_cang@quicinc.com> 1131 1131 Description: This file shows the maximum latency (in micro seconds) of 1132 1132 read requests after monitor gets started. 1133 1133 ··· 1136 1136 What: /sys/bus/platform/drivers/ufshcd/*/monitor/read_req_latency_min 1137 1137 What: /sys/bus/platform/devices/*.ufs/monitor/read_req_latency_min 1138 1138 Date: January 2021 1139 - Contact: Can Guo <cang@codeaurora.org> 1139 + Contact: Can Guo <quic_cang@quicinc.com> 1140 1140 Description: This file shows the minimum latency (in micro seconds) of 1141 1141 read requests after monitor gets started. 1142 1142 ··· 1145 1145 What: /sys/bus/platform/drivers/ufshcd/*/monitor/read_req_latency_avg 1146 1146 What: /sys/bus/platform/devices/*.ufs/monitor/read_req_latency_avg 1147 1147 Date: January 2021 1148 - Contact: Can Guo <cang@codeaurora.org> 1148 + Contact: Can Guo <quic_cang@quicinc.com> 1149 1149 Description: This file shows the average latency (in micro seconds) of 1150 1150 read requests after monitor gets started. 1151 1151 ··· 1154 1154 What: /sys/bus/platform/drivers/ufshcd/*/monitor/read_req_latency_sum 1155 1155 What: /sys/bus/platform/devices/*.ufs/monitor/read_req_latency_sum 1156 1156 Date: January 2021 1157 - Contact: Can Guo <cang@codeaurora.org> 1157 + Contact: Can Guo <quic_cang@quicinc.com> 1158 1158 Description: This file shows the total latency (in micro seconds) of 1159 1159 read requests sent after monitor gets started. 1160 1160 ··· 1163 1163 What: /sys/bus/platform/drivers/ufshcd/*/monitor/write_total_sectors 1164 1164 What: /sys/bus/platform/devices/*.ufs/monitor/write_total_sectors 1165 1165 Date: January 2021 1166 - Contact: Can Guo <cang@codeaurora.org> 1166 + Contact: Can Guo <quic_cang@quicinc.com> 1167 1167 Description: This file shows how many sectors (in 512 Bytes) have been sent 1168 1168 from host to device after monitor gets started. 1169 1169 ··· 1172 1172 What: /sys/bus/platform/drivers/ufshcd/*/monitor/write_total_busy 1173 1173 What: /sys/bus/platform/devices/*.ufs/monitor/write_total_busy 1174 1174 Date: January 2021 1175 - Contact: Can Guo <cang@codeaurora.org> 1175 + Contact: Can Guo <quic_cang@quicinc.com> 1176 1176 Description: This file shows how long (in micro seconds) has been spent 1177 1177 sending data from host to device after monitor gets started. 1178 1178 ··· 1181 1181 What: /sys/bus/platform/drivers/ufshcd/*/monitor/write_nr_requests 1182 1182 What: /sys/bus/platform/devices/*.ufs/monitor/write_nr_requests 1183 1183 Date: January 2021 1184 - Contact: Can Guo <cang@codeaurora.org> 1184 + Contact: Can Guo <quic_cang@quicinc.com> 1185 1185 Description: This file shows how many write requests have been sent after 1186 1186 monitor gets started. 1187 1187 ··· 1190 1190 What: /sys/bus/platform/drivers/ufshcd/*/monitor/write_req_latency_max 1191 1191 What: /sys/bus/platform/devices/*.ufs/monitor/write_req_latency_max 1192 1192 Date: January 2021 1193 - Contact: Can Guo <cang@codeaurora.org> 1193 + Contact: Can Guo <quic_cang@quicinc.com> 1194 1194 Description: This file shows the maximum latency (in micro seconds) of write 1195 1195 requests after monitor gets started. 1196 1196 ··· 1199 1199 What: /sys/bus/platform/drivers/ufshcd/*/monitor/write_req_latency_min 1200 1200 What: /sys/bus/platform/devices/*.ufs/monitor/write_req_latency_min 1201 1201 Date: January 2021 1202 - Contact: Can Guo <cang@codeaurora.org> 1202 + Contact: Can Guo <quic_cang@quicinc.com> 1203 1203 Description: This file shows the minimum latency (in micro seconds) of write 1204 1204 requests after monitor gets started. 1205 1205 ··· 1208 1208 What: /sys/bus/platform/drivers/ufshcd/*/monitor/write_req_latency_avg 1209 1209 What: /sys/bus/platform/devices/*.ufs/monitor/write_req_latency_avg 1210 1210 Date: January 2021 1211 - Contact: Can Guo <cang@codeaurora.org> 1211 + Contact: Can Guo <quic_cang@quicinc.com> 1212 1212 Description: This file shows the average latency (in micro seconds) of write 1213 1213 requests after monitor gets started. 1214 1214 ··· 1217 1217 What: /sys/bus/platform/drivers/ufshcd/*/monitor/write_req_latency_sum 1218 1218 What: /sys/bus/platform/devices/*.ufs/monitor/write_req_latency_sum 1219 1219 Date: January 2021 1220 - Contact: Can Guo <cang@codeaurora.org> 1220 + Contact: Can Guo <quic_cang@quicinc.com> 1221 1221 Description: This file shows the total latency (in micro seconds) of write 1222 1222 requests after monitor gets started. 1223 1223 ··· 1226 1226 What: /sys/bus/platform/drivers/ufshcd/*/device_descriptor/wb_presv_us_en 1227 1227 What: /sys/bus/platform/devices/*.ufs/device_descriptor/wb_presv_us_en 1228 1228 Date: June 2020 1229 - Contact: Asutosh Das <asutoshd@codeaurora.org> 1229 + Contact: Asutosh Das <quic_asutoshd@quicinc.com> 1230 1230 Description: This entry shows if preserve user-space was configured 1231 1231 1232 1232 The file is read only. ··· 1234 1234 What: /sys/bus/platform/drivers/ufshcd/*/device_descriptor/wb_shared_alloc_units 1235 1235 What: /sys/bus/platform/devices/*.ufs/device_descriptor/wb_shared_alloc_units 1236 1236 Date: June 2020 1237 - Contact: Asutosh Das <asutoshd@codeaurora.org> 1237 + Contact: Asutosh Das <quic_asutoshd@quicinc.com> 1238 1238 Description: This entry shows the shared allocated units of WB buffer 1239 1239 1240 1240 The file is read only. ··· 1242 1242 What: /sys/bus/platform/drivers/ufshcd/*/device_descriptor/wb_type 1243 1243 What: /sys/bus/platform/devices/*.ufs/device_descriptor/wb_type 1244 1244 Date: June 2020 1245 - Contact: Asutosh Das <asutoshd@codeaurora.org> 1245 + Contact: Asutosh Das <quic_asutoshd@quicinc.com> 1246 1246 Description: This entry shows the configured WB type. 1247 1247 0x1 for shared buffer mode. 0x0 for dedicated buffer mode. 1248 1248 ··· 1251 1251 What: /sys/bus/platform/drivers/ufshcd/*/geometry_descriptor/wb_buff_cap_adj 1252 1252 What: /sys/bus/platform/devices/*.ufs/geometry_descriptor/wb_buff_cap_adj 1253 1253 Date: June 2020 1254 - Contact: Asutosh Das <asutoshd@codeaurora.org> 1254 + Contact: Asutosh Das <quic_asutoshd@quicinc.com> 1255 1255 Description: This entry shows the total user-space decrease in shared 1256 1256 buffer mode. 1257 1257 The value of this parameter is 3 for TLC NAND when SLC mode ··· 1262 1262 What: /sys/bus/platform/drivers/ufshcd/*/geometry_descriptor/wb_max_alloc_units 1263 1263 What: /sys/bus/platform/devices/*.ufs/geometry_descriptor/wb_max_alloc_units 1264 1264 Date: June 2020 1265 - Contact: Asutosh Das <asutoshd@codeaurora.org> 1265 + Contact: Asutosh Das <quic_asutoshd@quicinc.com> 1266 1266 Description: This entry shows the Maximum total WriteBooster Buffer size 1267 1267 which is supported by the entire device. 1268 1268 ··· 1271 1271 What: /sys/bus/platform/drivers/ufshcd/*/geometry_descriptor/wb_max_wb_luns 1272 1272 What: /sys/bus/platform/devices/*.ufs/geometry_descriptor/wb_max_wb_luns 1273 1273 Date: June 2020 1274 - Contact: Asutosh Das <asutoshd@codeaurora.org> 1274 + Contact: Asutosh Das <quic_asutoshd@quicinc.com> 1275 1275 Description: This entry shows the maximum number of luns that can support 1276 1276 WriteBooster. 1277 1277 ··· 1280 1280 What: /sys/bus/platform/drivers/ufshcd/*/geometry_descriptor/wb_sup_red_type 1281 1281 What: /sys/bus/platform/devices/*.ufs/geometry_descriptor/wb_sup_red_type 1282 1282 Date: June 2020 1283 - Contact: Asutosh Das <asutoshd@codeaurora.org> 1283 + Contact: Asutosh Das <quic_asutoshd@quicinc.com> 1284 1284 Description: The supportability of user space reduction mode 1285 1285 and preserve user space mode. 1286 1286 00h: WriteBooster Buffer can be configured only in ··· 1295 1295 What: /sys/bus/platform/drivers/ufshcd/*/geometry_descriptor/wb_sup_wb_type 1296 1296 What: /sys/bus/platform/devices/*.ufs/geometry_descriptor/wb_sup_wb_type 1297 1297 Date: June 2020 1298 - Contact: Asutosh Das <asutoshd@codeaurora.org> 1298 + Contact: Asutosh Das <quic_asutoshd@quicinc.com> 1299 1299 Description: The supportability of WriteBooster Buffer type. 1300 1300 1301 1301 === ========================================================== ··· 1310 1310 What: /sys/bus/platform/drivers/ufshcd/*/flags/wb_enable 1311 1311 What: /sys/bus/platform/devices/*.ufs/flags/wb_enable 1312 1312 Date: June 2020 1313 - Contact: Asutosh Das <asutoshd@codeaurora.org> 1313 + Contact: Asutosh Das <quic_asutoshd@quicinc.com> 1314 1314 Description: This entry shows the status of WriteBooster. 1315 1315 1316 1316 == ============================ ··· 1323 1323 What: /sys/bus/platform/drivers/ufshcd/*/flags/wb_flush_en 1324 1324 What: /sys/bus/platform/devices/*.ufs/flags/wb_flush_en 1325 1325 Date: June 2020 1326 - Contact: Asutosh Das <asutoshd@codeaurora.org> 1326 + Contact: Asutosh Das <quic_asutoshd@quicinc.com> 1327 1327 Description: This entry shows if flush is enabled. 1328 1328 1329 1329 == ================================= ··· 1336 1336 What: /sys/bus/platform/drivers/ufshcd/*/flags/wb_flush_during_h8 1337 1337 What: /sys/bus/platform/devices/*.ufs/flags/wb_flush_during_h8 1338 1338 Date: June 2020 1339 - Contact: Asutosh Das <asutoshd@codeaurora.org> 1339 + Contact: Asutosh Das <quic_asutoshd@quicinc.com> 1340 1340 Description: Flush WriteBooster Buffer during hibernate state. 1341 1341 1342 1342 == ================================================= ··· 1351 1351 What: /sys/bus/platform/drivers/ufshcd/*/attributes/wb_avail_buf 1352 1352 What: /sys/bus/platform/devices/*.ufs/attributes/wb_avail_buf 1353 1353 Date: June 2020 1354 - Contact: Asutosh Das <asutoshd@codeaurora.org> 1354 + Contact: Asutosh Das <quic_asutoshd@quicinc.com> 1355 1355 Description: This entry shows the amount of unused WriteBooster buffer 1356 1356 available. 1357 1357 ··· 1360 1360 What: /sys/bus/platform/drivers/ufshcd/*/attributes/wb_cur_buf 1361 1361 What: /sys/bus/platform/devices/*.ufs/attributes/wb_cur_buf 1362 1362 Date: June 2020 1363 - Contact: Asutosh Das <asutoshd@codeaurora.org> 1363 + Contact: Asutosh Das <quic_asutoshd@quicinc.com> 1364 1364 Description: This entry shows the amount of unused current buffer. 1365 1365 1366 1366 The file is read only. ··· 1368 1368 What: /sys/bus/platform/drivers/ufshcd/*/attributes/wb_flush_status 1369 1369 What: /sys/bus/platform/devices/*.ufs/attributes/wb_flush_status 1370 1370 Date: June 2020 1371 - Contact: Asutosh Das <asutoshd@codeaurora.org> 1371 + Contact: Asutosh Das <quic_asutoshd@quicinc.com> 1372 1372 Description: This entry shows the flush operation status. 1373 1373 1374 1374 ··· 1385 1385 What: /sys/bus/platform/drivers/ufshcd/*/attributes/wb_life_time_est 1386 1386 What: /sys/bus/platform/devices/*.ufs/attributes/wb_life_time_est 1387 1387 Date: June 2020 1388 - Contact: Asutosh Das <asutoshd@codeaurora.org> 1388 + Contact: Asutosh Das <quic_asutoshd@quicinc.com> 1389 1389 Description: This entry shows an indication of the WriteBooster Buffer 1390 1390 lifetime based on the amount of performed program/erase cycles 1391 1391 ··· 1399 1399 1400 1400 What: /sys/class/scsi_device/*/device/unit_descriptor/wb_buf_alloc_units 1401 1401 Date: June 2020 1402 - Contact: Asutosh Das <asutoshd@codeaurora.org> 1402 + Contact: Asutosh Das <quic_asutoshd@quicinc.com> 1403 1403 Description: This entry shows the configured size of WriteBooster buffer. 1404 1404 0400h corresponds to 4GB. 1405 1405
+50 -36
block/blk-zoned.c
··· 442 442 unsigned long *conv_zones_bitmap; 443 443 unsigned long *seq_zones_wlock; 444 444 unsigned int nr_zones; 445 - sector_t zone_sectors; 446 445 sector_t sector; 447 446 }; 448 447 ··· 455 456 struct gendisk *disk = args->disk; 456 457 struct request_queue *q = disk->queue; 457 458 sector_t capacity = get_capacity(disk); 459 + sector_t zone_sectors = q->limits.chunk_sectors; 460 + 461 + /* Check for bad zones and holes in the zone report */ 462 + if (zone->start != args->sector) { 463 + pr_warn("%s: Zone gap at sectors %llu..%llu\n", 464 + disk->disk_name, args->sector, zone->start); 465 + return -ENODEV; 466 + } 467 + 468 + if (zone->start >= capacity || !zone->len) { 469 + pr_warn("%s: Invalid zone start %llu, length %llu\n", 470 + disk->disk_name, zone->start, zone->len); 471 + return -ENODEV; 472 + } 458 473 459 474 /* 460 475 * All zones must have the same size, with the exception on an eventual 461 476 * smaller last zone. 462 477 */ 463 - if (zone->start == 0) { 464 - if (zone->len == 0 || !is_power_of_2(zone->len)) { 465 - pr_warn("%s: Invalid zoned device with non power of two zone size (%llu)\n", 466 - disk->disk_name, zone->len); 467 - return -ENODEV; 468 - } 469 - 470 - args->zone_sectors = zone->len; 471 - args->nr_zones = (capacity + zone->len - 1) >> ilog2(zone->len); 472 - } else if (zone->start + args->zone_sectors < capacity) { 473 - if (zone->len != args->zone_sectors) { 478 + if (zone->start + zone->len < capacity) { 479 + if (zone->len != zone_sectors) { 474 480 pr_warn("%s: Invalid zoned device with non constant zone size\n", 475 481 disk->disk_name); 476 482 return -ENODEV; 477 483 } 478 - } else { 479 - if (zone->len > args->zone_sectors) { 480 - pr_warn("%s: Invalid zoned device with larger last zone size\n", 481 - disk->disk_name); 482 - return -ENODEV; 483 - } 484 - } 485 - 486 - /* Check for holes in the zone report */ 487 - if (zone->start != args->sector) { 488 - pr_warn("%s: Zone gap at sectors %llu..%llu\n", 489 - disk->disk_name, args->sector, zone->start); 484 + } else if (zone->len > zone_sectors) { 485 + pr_warn("%s: Invalid zoned device with larger last zone size\n", 486 + disk->disk_name); 490 487 return -ENODEV; 491 488 } 492 489 ··· 521 526 * @disk: Target disk 522 527 * @update_driver_data: Callback to update driver data on the frozen disk 523 528 * 524 - * Helper function for low-level device drivers to (re) allocate and initialize 525 - * a disk request queue zone bitmaps. This functions should normally be called 526 - * within the disk ->revalidate method for blk-mq based drivers. For BIO based 527 - * drivers only q->nr_zones needs to be updated so that the sysfs exposed value 528 - * is correct. 529 + * Helper function for low-level device drivers to check and (re) allocate and 530 + * initialize a disk request queue zone bitmaps. This functions should normally 531 + * be called within the disk ->revalidate method for blk-mq based drivers. 532 + * Before calling this function, the device driver must already have set the 533 + * device zone size (chunk_sector limit) and the max zone append limit. 534 + * For BIO based drivers, this function cannot be used. BIO based device drivers 535 + * only need to set disk->nr_zones so that the sysfs exposed value is correct. 529 536 * If the @update_driver_data callback function is not NULL, the callback is 530 537 * executed with the device request queue frozen after all zones have been 531 538 * checked. ··· 536 539 void (*update_driver_data)(struct gendisk *disk)) 537 540 { 538 541 struct request_queue *q = disk->queue; 539 - struct blk_revalidate_zone_args args = { 540 - .disk = disk, 541 - }; 542 + sector_t zone_sectors = q->limits.chunk_sectors; 543 + sector_t capacity = get_capacity(disk); 544 + struct blk_revalidate_zone_args args = { }; 542 545 unsigned int noio_flag; 543 546 int ret; 544 547 ··· 547 550 if (WARN_ON_ONCE(!queue_is_mq(q))) 548 551 return -EIO; 549 552 550 - if (!get_capacity(disk)) 551 - return -EIO; 553 + if (!capacity) 554 + return -ENODEV; 555 + 556 + /* 557 + * Checks that the device driver indicated a valid zone size and that 558 + * the max zone append limit is set. 559 + */ 560 + if (!zone_sectors || !is_power_of_2(zone_sectors)) { 561 + pr_warn("%s: Invalid non power of two zone size (%llu)\n", 562 + disk->disk_name, zone_sectors); 563 + return -ENODEV; 564 + } 565 + 566 + if (!q->limits.max_zone_append_sectors) { 567 + pr_warn("%s: Invalid 0 maximum zone append limit\n", 568 + disk->disk_name); 569 + return -ENODEV; 570 + } 552 571 553 572 /* 554 573 * Ensure that all memory allocations in this context are done as if 555 574 * GFP_NOIO was specified. 556 575 */ 576 + args.disk = disk; 577 + args.nr_zones = (capacity + zone_sectors - 1) >> ilog2(zone_sectors); 557 578 noio_flag = memalloc_noio_save(); 558 579 ret = disk->fops->report_zones(disk, 0, UINT_MAX, 559 580 blk_revalidate_zone_cb, &args); ··· 585 570 * If zones where reported, make sure that the entire disk capacity 586 571 * has been checked. 587 572 */ 588 - if (ret > 0 && args.sector != get_capacity(disk)) { 573 + if (ret > 0 && args.sector != capacity) { 589 574 pr_warn("%s: Missing zones from sector %llu\n", 590 575 disk->disk_name, args.sector); 591 576 ret = -ENODEV; ··· 598 583 */ 599 584 blk_mq_freeze_queue(q); 600 585 if (ret > 0) { 601 - blk_queue_chunk_sectors(q, args.zone_sectors); 602 586 disk->nr_zones = args.nr_zones; 603 587 swap(disk->seq_zones_wlock, args.seq_zones_wlock); 604 588 swap(disk->conv_zones_bitmap, args.conv_zones_bitmap);
+5 -11
drivers/block/null_blk/zoned.c
··· 162 162 disk_set_zoned(nullb->disk, BLK_ZONED_HM); 163 163 blk_queue_flag_set(QUEUE_FLAG_ZONE_RESETALL, q); 164 164 blk_queue_required_elevator_features(q, ELEVATOR_F_ZBD_SEQ_WRITE); 165 - 166 - if (queue_is_mq(q)) { 167 - int ret = blk_revalidate_disk_zones(nullb->disk, NULL); 168 - 169 - if (ret) 170 - return ret; 171 - } else { 172 - blk_queue_chunk_sectors(q, dev->zone_size_sects); 173 - nullb->disk->nr_zones = bdev_nr_zones(nullb->disk->part0); 174 - } 175 - 165 + blk_queue_chunk_sectors(q, dev->zone_size_sects); 166 + nullb->disk->nr_zones = bdev_nr_zones(nullb->disk->part0); 176 167 blk_queue_max_zone_append_sectors(q, dev->zone_size_sects); 177 168 disk_set_max_open_zones(nullb->disk, dev->zone_max_open); 178 169 disk_set_max_active_zones(nullb->disk, dev->zone_max_active); 170 + 171 + if (queue_is_mq(q)) 172 + return blk_revalidate_disk_zones(nullb->disk, NULL); 179 173 180 174 return 0; 181 175 }
+15 -19
drivers/block/virtio_blk.c
··· 751 751 { 752 752 u32 v, wg; 753 753 u8 model; 754 - int ret; 755 754 756 755 virtio_cread(vdev, struct virtio_blk_config, 757 756 zoned.model, &model); ··· 805 806 vblk->zone_sectors); 806 807 return -ENODEV; 807 808 } 809 + blk_queue_chunk_sectors(q, vblk->zone_sectors); 808 810 dev_dbg(&vdev->dev, "zone sectors = %u\n", vblk->zone_sectors); 809 811 810 812 if (virtio_has_feature(vdev, VIRTIO_BLK_F_DISCARD)) { ··· 814 814 blk_queue_max_discard_sectors(q, 0); 815 815 } 816 816 817 - ret = blk_revalidate_disk_zones(vblk->disk, NULL); 818 - if (!ret) { 819 - virtio_cread(vdev, struct virtio_blk_config, 820 - zoned.max_append_sectors, &v); 821 - if (!v) { 822 - dev_warn(&vdev->dev, "zero max_append_sectors reported\n"); 823 - return -ENODEV; 824 - } 825 - if ((v << SECTOR_SHIFT) < wg) { 826 - dev_err(&vdev->dev, 827 - "write granularity %u exceeds max_append_sectors %u limit\n", 828 - wg, v); 829 - return -ENODEV; 830 - } 831 - 832 - blk_queue_max_zone_append_sectors(q, v); 833 - dev_dbg(&vdev->dev, "max append sectors = %u\n", v); 817 + virtio_cread(vdev, struct virtio_blk_config, 818 + zoned.max_append_sectors, &v); 819 + if (!v) { 820 + dev_warn(&vdev->dev, "zero max_append_sectors reported\n"); 821 + return -ENODEV; 834 822 } 823 + if ((v << SECTOR_SHIFT) < wg) { 824 + dev_err(&vdev->dev, 825 + "write granularity %u exceeds max_append_sectors %u limit\n", 826 + wg, v); 827 + return -ENODEV; 828 + } 829 + blk_queue_max_zone_append_sectors(q, v); 830 + dev_dbg(&vdev->dev, "max append sectors = %u\n", v); 835 831 836 - return ret; 832 + return blk_revalidate_disk_zones(vblk->disk, NULL); 837 833 } 838 834 839 835 #else
+4 -5
drivers/nvme/host/zns.c
··· 10 10 int nvme_revalidate_zones(struct nvme_ns *ns) 11 11 { 12 12 struct request_queue *q = ns->queue; 13 - int ret; 14 13 15 - ret = blk_revalidate_disk_zones(ns->disk, NULL); 16 - if (!ret) 17 - blk_queue_max_zone_append_sectors(q, ns->ctrl->max_zone_append); 18 - return ret; 14 + blk_queue_chunk_sectors(q, ns->zsze); 15 + blk_queue_max_zone_append_sectors(q, ns->ctrl->max_zone_append); 16 + 17 + return blk_revalidate_disk_zones(ns->disk, NULL); 19 18 } 20 19 21 20 static int nvme_set_max_append(struct nvme_ctrl *ctrl)
+1 -1
drivers/scsi/aacraid/aacraid.h
··· 2618 2618 struct aac_aifcmd { 2619 2619 __le32 command; /* Tell host what type of notify this is */ 2620 2620 __le32 seqnum; /* To allow ordering of reports (if necessary) */ 2621 - u8 data[1]; /* Undefined length (from kernel viewpoint) */ 2621 + u8 data[]; /* Undefined length (from kernel viewpoint) */ 2622 2622 }; 2623 2623 2624 2624 /**
+1 -1
drivers/scsi/fnic/fnic_trace.c
··· 465 465 fnic_max_trace_entries = (trace_max_pages * PAGE_SIZE)/ 466 466 FNIC_ENTRY_SIZE_BYTES; 467 467 468 - fnic_trace_buf_p = (unsigned long)vzalloc(trace_max_pages * PAGE_SIZE); 468 + fnic_trace_buf_p = (unsigned long)vcalloc(trace_max_pages, PAGE_SIZE); 469 469 if (!fnic_trace_buf_p) { 470 470 printk(KERN_ERR PFX "Failed to allocate memory " 471 471 "for fnic_trace_buf_p\n");
+2
drivers/scsi/lpfc/lpfc_hbadisc.c
··· 6944 6944 if (rc) 6945 6945 return; 6946 6946 /* Reset HBA FCF states after successful unregister FCF */ 6947 + spin_lock_irq(&phba->hbalock); 6947 6948 phba->fcf.fcf_flag = 0; 6949 + spin_unlock_irq(&phba->hbalock); 6948 6950 phba->fcf.current_rec.flag = 0; 6949 6951 6950 6952 /*
-1
drivers/scsi/qla2xxx/qla_def.h
··· 4462 4462 4463 4463 /* n2n */ 4464 4464 struct fc_els_flogi plogi_els_payld; 4465 - #define LOGIN_TEMPLATE_SIZE (sizeof(struct fc_els_flogi) - 4) 4466 4465 4467 4466 void *swl; 4468 4467
+2 -2
drivers/scsi/qla2xxx/qla_init.c
··· 8434 8434 ql_dbg(ql_dbg_init, vha, 0x0163, 8435 8435 "-> fwdt%u template allocate template %#x words...\n", 8436 8436 j, risc_size); 8437 - fwdt->template = vmalloc(risc_size * sizeof(*dcode)); 8437 + fwdt->template = vmalloc_array(risc_size, sizeof(*dcode)); 8438 8438 if (!fwdt->template) { 8439 8439 ql_log(ql_log_warn, vha, 0x0164, 8440 8440 "-> fwdt%u failed allocate template.\n", j); ··· 8689 8689 ql_dbg(ql_dbg_init, vha, 0x0173, 8690 8690 "-> fwdt%u template allocate template %#x words...\n", 8691 8691 j, risc_size); 8692 - fwdt->template = vmalloc(risc_size * sizeof(*dcode)); 8692 + fwdt->template = vmalloc_array(risc_size, sizeof(*dcode)); 8693 8693 if (!fwdt->template) { 8694 8694 ql_log(ql_log_warn, vha, 0x0174, 8695 8695 "-> fwdt%u failed allocate template.\n", j);
+3 -2
drivers/scsi/qla2xxx/qla_iocb.c
··· 3073 3073 memset(ptr, 0, sizeof(struct els_plogi_payload)); 3074 3074 memset(resp_ptr, 0, sizeof(struct els_plogi_payload)); 3075 3075 memcpy(elsio->u.els_plogi.els_plogi_pyld->data, 3076 - &ha->plogi_els_payld.fl_csp, LOGIN_TEMPLATE_SIZE); 3076 + (void *)&ha->plogi_els_payld + offsetof(struct fc_els_flogi, fl_csp), 3077 + sizeof(ha->plogi_els_payld) - offsetof(struct fc_els_flogi, fl_csp)); 3077 3078 3078 3079 elsio->u.els_plogi.els_cmd = els_opcode; 3079 3080 elsio->u.els_plogi.els_plogi_pyld->opcode = els_opcode; ··· 3912 3911 3913 3912 pkt = __qla2x00_alloc_iocbs(sp->qpair, sp); 3914 3913 if (!pkt) { 3915 - rval = EAGAIN; 3914 + rval = -EAGAIN; 3916 3915 ql_log(ql_log_warn, vha, 0x700c, 3917 3916 "qla2x00_alloc_iocbs failed.\n"); 3918 3917 goto done;
-8
drivers/scsi/scsi_debug.c
··· 841 841 static int submit_queues = DEF_SUBMIT_QUEUES; /* > 1 for multi-queue (mq) */ 842 842 static int poll_queues; /* iouring iopoll interface.*/ 843 843 844 - static DEFINE_RWLOCK(atomic_rw); 845 - static DEFINE_RWLOCK(atomic_rw2); 846 - 847 - static rwlock_t *ramdisk_lck_a[2]; 848 - 849 844 static char sdebug_proc_name[] = MY_NAME; 850 845 static const char *my_name = MY_NAME; 851 846 ··· 6812 6817 unsigned long sz; 6813 6818 int k, ret, hosts_to_add; 6814 6819 int idx = -1; 6815 - 6816 - ramdisk_lck_a[0] = &atomic_rw; 6817 - ramdisk_lck_a[1] = &atomic_rw2; 6818 6820 6819 6821 if (sdebug_ndelay >= 1000 * 1000 * 1000) { 6820 6822 pr_warn("ndelay must be less than 1 second, ignored\n");
+5 -7
drivers/scsi/sd_zbc.c
··· 831 831 struct request_queue *q = disk->queue; 832 832 u32 zone_blocks = sdkp->early_zone_info.zone_blocks; 833 833 unsigned int nr_zones = sdkp->early_zone_info.nr_zones; 834 - u32 max_append; 835 834 int ret = 0; 836 835 unsigned int flags; 837 836 ··· 875 876 goto unlock; 876 877 } 877 878 879 + blk_queue_chunk_sectors(q, 880 + logical_to_sectors(sdkp->device, zone_blocks)); 881 + blk_queue_max_zone_append_sectors(q, 882 + q->limits.max_segments << PAGE_SECTORS_SHIFT); 883 + 878 884 ret = blk_revalidate_disk_zones(disk, sd_zbc_revalidate_zones_cb); 879 885 880 886 memalloc_noio_restore(flags); ··· 891 887 sdkp->capacity = 0; 892 888 goto unlock; 893 889 } 894 - 895 - max_append = min_t(u32, logical_to_sectors(sdkp->device, zone_blocks), 896 - q->limits.max_segments << PAGE_SECTORS_SHIFT); 897 - max_append = min_t(u32, max_append, queue_max_hw_sectors(q)); 898 - 899 - blk_queue_max_zone_append_sectors(q, max_append); 900 890 901 891 sd_zbc_print_zones(sdkp); 902 892
+2
drivers/scsi/storvsc_drv.c
··· 318 318 #define SRB_STATUS_INVALID_REQUEST 0x06 319 319 #define SRB_STATUS_DATA_OVERRUN 0x12 320 320 #define SRB_STATUS_INVALID_LUN 0x20 321 + #define SRB_STATUS_INTERNAL_ERROR 0x30 321 322 322 323 #define SRB_STATUS(status) \ 323 324 (status & ~(SRB_STATUS_AUTOSENSE_VALID | SRB_STATUS_QUEUE_FROZEN)) ··· 979 978 case SRB_STATUS_ERROR: 980 979 case SRB_STATUS_ABORTED: 981 980 case SRB_STATUS_INVALID_REQUEST: 981 + case SRB_STATUS_INTERNAL_ERROR: 982 982 if (vm_srb->srb_status & SRB_STATUS_AUTOSENSE_VALID) { 983 983 /* Check for capacity change */ 984 984 if ((asc == 0x2a) && (ascq == 0x9)) {
+38
drivers/ufs/core/ufshcd.c
··· 8520 8520 return ret; 8521 8521 } 8522 8522 8523 + static void ufshcd_set_timestamp_attr(struct ufs_hba *hba) 8524 + { 8525 + int err; 8526 + struct ufs_query_req *request = NULL; 8527 + struct ufs_query_res *response = NULL; 8528 + struct ufs_dev_info *dev_info = &hba->dev_info; 8529 + struct utp_upiu_query_v4_0 *upiu_data; 8530 + 8531 + if (dev_info->wspecversion < 0x400) 8532 + return; 8533 + 8534 + ufshcd_hold(hba); 8535 + 8536 + mutex_lock(&hba->dev_cmd.lock); 8537 + 8538 + ufshcd_init_query(hba, &request, &response, 8539 + UPIU_QUERY_OPCODE_WRITE_ATTR, 8540 + QUERY_ATTR_IDN_TIMESTAMP, 0, 0); 8541 + 8542 + request->query_func = UPIU_QUERY_FUNC_STANDARD_WRITE_REQUEST; 8543 + 8544 + upiu_data = (struct utp_upiu_query_v4_0 *)&request->upiu_req; 8545 + 8546 + put_unaligned_be64(ktime_get_real_ns(), &upiu_data->osf3); 8547 + 8548 + err = ufshcd_exec_dev_cmd(hba, DEV_CMD_TYPE_QUERY, QUERY_REQ_TIMEOUT); 8549 + 8550 + if (err) 8551 + dev_err(hba->dev, "%s: failed to set timestamp %d\n", 8552 + __func__, err); 8553 + 8554 + mutex_unlock(&hba->dev_cmd.lock); 8555 + ufshcd_release(hba); 8556 + } 8557 + 8523 8558 /** 8524 8559 * ufshcd_add_lus - probe and add UFS logical units 8525 8560 * @hba: per-adapter instance ··· 8742 8707 /* UFS device is also active now */ 8743 8708 ufshcd_set_ufs_dev_active(hba); 8744 8709 ufshcd_force_reset_auto_bkops(hba); 8710 + 8711 + ufshcd_set_timestamp_attr(hba); 8745 8712 8746 8713 /* Gear up to HS gear if supported */ 8747 8714 if (hba->max_pwr_info.is_valid) { ··· 9786 9749 ret = ufshcd_set_dev_pwr_mode(hba, UFS_ACTIVE_PWR_MODE); 9787 9750 if (ret) 9788 9751 goto set_old_link_state; 9752 + ufshcd_set_timestamp_attr(hba); 9789 9753 } 9790 9754 9791 9755 if (ufshcd_keep_autobkops_enabled_except_suspend(hba))
+1
drivers/ufs/host/Kconfig
··· 72 72 config SCSI_UFS_MEDIATEK 73 73 tristate "Mediatek specific hooks to UFS controller platform driver" 74 74 depends on SCSI_UFSHCD_PLATFORM && ARCH_MEDIATEK 75 + depends on RESET_CONTROLLER 75 76 select PHY_MTK_UFS 76 77 select RESET_TI_SYSCON 77 78 help
+25
include/uapi/scsi/scsi_bsg_ufs.h
··· 71 71 }; 72 72 73 73 /** 74 + * struct utp_upiu_query_v4_0 - upiu request buffer structure for 75 + * query request >= UFS 4.0 spec. 76 + * @opcode: command to perform B-0 77 + * @idn: a value that indicates the particular type of data B-1 78 + * @index: Index to further identify data B-2 79 + * @selector: Index to further identify data B-3 80 + * @osf4: spec field B-5 81 + * @osf5: spec field B 6,7 82 + * @osf6: spec field DW 8,9 83 + * @osf7: spec field DW 10,11 84 + */ 85 + struct utp_upiu_query_v4_0 { 86 + __u8 opcode; 87 + __u8 idn; 88 + __u8 index; 89 + __u8 selector; 90 + __u8 osf3; 91 + __u8 osf4; 92 + __be16 osf5; 93 + __be32 osf6; 94 + __be32 osf7; 95 + __be32 reserved; 96 + }; 97 + 98 + /** 74 99 * struct utp_upiu_cmd - Command UPIU structure 75 100 * @data_transfer_len: Data Transfer Length DW-3 76 101 * @cdb: Command Descriptor Block CDB DW-4 to DW-7
+1
include/ufs/ufs.h
··· 170 170 QUERY_ATTR_IDN_WB_BUFF_LIFE_TIME_EST = 0x1E, 171 171 QUERY_ATTR_IDN_CURR_WB_BUFF_SIZE = 0x1F, 172 172 QUERY_ATTR_IDN_EXT_IID_EN = 0x2A, 173 + QUERY_ATTR_IDN_TIMESTAMP = 0x30 173 174 }; 174 175 175 176 /* Descriptor idn for Query requests */