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-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi

Pull more SCSI updates from James Bottomley:
"Mostly small bug fixes plus other trivial updates.

The major change of note is moving ufs out of scsi and a minor update
to lpfc vmid handling"

* tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (24 commits)
scsi: qla2xxx: Remove unused 'ql_dm_tgt_ex_pct' parameter
scsi: qla2xxx: Remove setting of 'req' and 'rsp' parameters
scsi: mpi3mr: Fix kernel-doc
scsi: lpfc: Add support for ATTO Fibre Channel devices
scsi: core: Return BLK_STS_TRANSPORT for ALUA transitioning
scsi: sd_zbc: Prevent zone information memory leak
scsi: sd: Fix potential NULL pointer dereference
scsi: mpi3mr: Rework mrioc->bsg_device model to fix warnings
scsi: myrb: Fix up null pointer access on myrb_cleanup()
scsi: core: Unexport scsi_bus_type
scsi: sd: Don't call blk_cleanup_disk() in sd_probe()
scsi: ufs: ufshcd: Delete unnecessary NULL check
scsi: isci: Fix typo in comment
scsi: pmcraid: Fix typo in comment
scsi: smartpqi: Fix typo in comment
scsi: qedf: Fix typo in comment
scsi: esas2r: Fix typo in comment
scsi: storvsc: Fix typo in comment
scsi: ufs: Split the drivers/scsi/ufs directory
scsi: qla1280: Remove redundant variable
...

+730 -467
+6 -4
MAINTAINERS
··· 2565 2565 F: drivers/phy/qualcomm/ 2566 2566 F: drivers/power/*/msm* 2567 2567 F: drivers/reset/reset-qcom-* 2568 - F: drivers/scsi/ufs/ufs-qcom* 2568 + F: drivers/ufs/host/ufs-qcom* 2569 2569 F: drivers/spi/spi-geni-qcom.c 2570 2570 F: drivers/spi/spi-qcom-qspi.c 2571 2571 F: drivers/spi/spi-qup.c ··· 17755 17755 T: git git://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git 17756 17756 F: Documentation/devicetree/bindings/scsi/ 17757 17757 F: drivers/scsi/ 17758 + F: drivers/ufs/ 17758 17759 F: include/scsi/ 17759 17760 17760 17761 SCSI TAPE DRIVER ··· 20415 20414 UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER 20416 20415 R: Alim Akhtar <alim.akhtar@samsung.com> 20417 20416 R: Avri Altman <avri.altman@wdc.com> 20417 + R: Bart Van Assche <bvanassche@acm.org> 20418 20418 L: linux-scsi@vger.kernel.org 20419 20419 S: Supported 20420 20420 F: Documentation/devicetree/bindings/ufs/ 20421 20421 F: Documentation/scsi/ufs.rst 20422 - F: drivers/scsi/ufs/ 20422 + F: drivers/ufs/core/ 20423 20423 20424 20424 UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER DWC HOOKS 20425 20425 M: Pedro Sousa <pedrom.sousa@synopsys.com> 20426 20426 L: linux-scsi@vger.kernel.org 20427 20427 S: Supported 20428 - F: drivers/scsi/ufs/*dwc* 20428 + F: drivers/ufs/host/*dwc* 20429 20429 20430 20430 UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER MEDIATEK HOOKS 20431 20431 M: Stanley Chu <stanley.chu@mediatek.com> 20432 20432 L: linux-scsi@vger.kernel.org 20433 20433 L: linux-mediatek@lists.infradead.org (moderated for non-subscribers) 20434 20434 S: Maintained 20435 - F: drivers/scsi/ufs/ufs-mediatek* 20435 + F: drivers/ufs/host/ufs-mediatek* 20436 20436 20437 20437 UNSORTED BLOCK IMAGES (UBI) 20438 20438 M: Richard Weinberger <richard@nod.at>
+2
drivers/Kconfig
··· 107 107 108 108 source "drivers/mmc/Kconfig" 109 109 110 + source "drivers/ufs/Kconfig" 111 + 110 112 source "drivers/memstick/Kconfig" 111 113 112 114 source "drivers/leds/Kconfig"
+1
drivers/Makefile
··· 128 128 obj-$(CONFIG_CPU_FREQ) += cpufreq/ 129 129 obj-$(CONFIG_CPU_IDLE) += cpuidle/ 130 130 obj-y += mmc/ 131 + obj-y += ufs/ 131 132 obj-$(CONFIG_MEMSTICK) += memstick/ 132 133 obj-$(CONFIG_NEW_LEDS) += leds/ 133 134 obj-$(CONFIG_INFINIBAND) += infiniband/
+18
drivers/nvme/host/fc.c
··· 1899 1899 nvme_fc_error_recovery(ctrl, "transport detected io error"); 1900 1900 } 1901 1901 1902 + /* 1903 + * nvme_fc_io_getuuid - Routine called to get the appid field 1904 + * associated with request by the lldd 1905 + * @req:IO request from nvme fc to driver 1906 + * Returns: UUID if there is an appid associated with VM or 1907 + * NULL if the user/libvirt has not set the appid to VM 1908 + */ 1909 + char *nvme_fc_io_getuuid(struct nvmefc_fcp_req *req) 1910 + { 1911 + struct nvme_fc_fcp_op *op = fcp_req_to_fcp_op(req); 1912 + struct request *rq = op->rq; 1913 + 1914 + if (!IS_ENABLED(CONFIG_BLK_CGROUP_FC_APPID) || !rq->bio) 1915 + return NULL; 1916 + return blkcg_get_fc_appid(rq->bio); 1917 + } 1918 + EXPORT_SYMBOL_GPL(nvme_fc_io_getuuid); 1919 + 1902 1920 static void 1903 1921 nvme_fc_fcpio_done(struct nvmefc_fcp_req *req) 1904 1922 {
-1
drivers/scsi/Kconfig
··· 500 500 source "drivers/scsi/mpt3sas/Kconfig" 501 501 source "drivers/scsi/mpi3mr/Kconfig" 502 502 source "drivers/scsi/smartpqi/Kconfig" 503 - source "drivers/scsi/ufs/Kconfig" 504 503 505 504 config SCSI_HPTIOP 506 505 tristate "HighPoint RocketRAID 3xxx/4xxx Controller support"
-1
drivers/scsi/Makefile
··· 101 101 obj-$(CONFIG_MEGARAID_SAS) += megaraid/ 102 102 obj-$(CONFIG_SCSI_MPT3SAS) += mpt3sas/ 103 103 obj-$(CONFIG_SCSI_MPI3MR) += mpi3mr/ 104 - obj-$(CONFIG_SCSI_UFSHCD) += ufs/ 105 104 obj-$(CONFIG_SCSI_ACARD) += atp870u.o 106 105 obj-$(CONFIG_SCSI_SUNESP) += esp_scsi.o sun_esp.o 107 106 obj-$(CONFIG_SCSI_INITIO) += initio.o
+1 -1
drivers/scsi/esas2r/esas2r_flash.c
··· 232 232 */ 233 233 rq->req_stat = RS_PENDING; 234 234 if (test_bit(AF_DEGRADED_MODE, &a->flags)) 235 - /* not suppported for now */; 235 + /* not supported for now */; 236 236 else 237 237 build_flash_msg(a, rq); 238 238
+1 -1
drivers/scsi/isci/request.c
··· 2182 2182 case (SCU_TASK_DONE_UNEXP_FIS << SCU_COMPLETION_TL_STATUS_SHIFT): { 2183 2183 u16 len = sci_req_tx_bytes(ireq); 2184 2184 2185 - /* likely non-error data underrrun, workaround missing 2185 + /* likely non-error data underrun, workaround missing 2186 2186 * d2h frame from the controller 2187 2187 */ 2188 2188 if (d2h->fis_type != FIS_REGD2H) {
+1 -1
drivers/scsi/lpfc/Makefile
··· 33 33 lpfc-objs := lpfc_mem.o lpfc_sli.o lpfc_ct.o lpfc_els.o \ 34 34 lpfc_hbadisc.o lpfc_init.o lpfc_mbox.o lpfc_nportdisc.o \ 35 35 lpfc_scsi.o lpfc_attr.o lpfc_vport.o lpfc_debugfs.o lpfc_bsg.o \ 36 - lpfc_nvme.o lpfc_nvmet.o 36 + lpfc_nvme.o lpfc_nvmet.o lpfc_vmid.o
+3
drivers/scsi/lpfc/lpfc_crtn.h
··· 671 671 int lpfc_vmid_hash_fn(const char *vmid, int len); 672 672 struct lpfc_vmid *lpfc_get_vmid_from_hashtable(struct lpfc_vport *vport, 673 673 uint32_t hash, uint8_t *buf); 674 + int lpfc_vmid_get_appid(struct lpfc_vport *vport, char *uuid, 675 + enum dma_data_direction iodir, 676 + union lpfc_vmid_io_tag *tag); 674 677 void lpfc_vmid_vport_cleanup(struct lpfc_vport *vport); 675 678 int lpfc_issue_els_qfpa(struct lpfc_vport *vport); 676 679
+22
drivers/scsi/lpfc/lpfc_hw.h
··· 1736 1736 #define PCI_DEVICE_ID_TOMCAT 0x0714 1737 1737 #define PCI_DEVICE_ID_SKYHAWK 0x0724 1738 1738 #define PCI_DEVICE_ID_SKYHAWK_VF 0x072c 1739 + #define PCI_VENDOR_ID_ATTO 0x117c 1740 + #define PCI_DEVICE_ID_CLRY_16XE 0x0064 1741 + #define PCI_DEVICE_ID_CLRY_161E 0x0063 1742 + #define PCI_DEVICE_ID_CLRY_162E 0x0064 1743 + #define PCI_DEVICE_ID_CLRY_164E 0x0065 1744 + #define PCI_DEVICE_ID_CLRY_16XP 0x0094 1745 + #define PCI_DEVICE_ID_CLRY_161P 0x00a0 1746 + #define PCI_DEVICE_ID_CLRY_162P 0x0094 1747 + #define PCI_DEVICE_ID_CLRY_164P 0x00a1 1748 + #define PCI_DEVICE_ID_CLRY_32XE 0x0094 1749 + #define PCI_DEVICE_ID_CLRY_321E 0x00a2 1750 + #define PCI_DEVICE_ID_CLRY_322E 0x00a3 1751 + #define PCI_DEVICE_ID_CLRY_324E 0x00ac 1752 + #define PCI_DEVICE_ID_CLRY_32XP 0x00bb 1753 + #define PCI_DEVICE_ID_CLRY_321P 0x00bc 1754 + #define PCI_DEVICE_ID_CLRY_322P 0x00bd 1755 + #define PCI_DEVICE_ID_CLRY_324P 0x00be 1756 + #define PCI_DEVICE_ID_TLFC_2 0x0064 1757 + #define PCI_DEVICE_ID_TLFC_2XX2 0x4064 1758 + #define PCI_DEVICE_ID_TLFC_3 0x0094 1759 + #define PCI_DEVICE_ID_TLFC_3162 0x40a6 1760 + #define PCI_DEVICE_ID_TLFC_3322 0x40a7 1739 1761 1740 1762 #define JEDEC_ID_ADDRESS 0x0080001c 1741 1763 #define FIREFLY_JEDEC_ID 0x1ACC
+30
drivers/scsi/lpfc/lpfc_ids.h
··· 124 124 PCI_ANY_ID, PCI_ANY_ID, }, 125 125 {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_SKYHAWK_VF, 126 126 PCI_ANY_ID, PCI_ANY_ID, }, 127 + {PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_16XE, 128 + PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_161E, }, 129 + {PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_16XE, 130 + PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_162E, }, 131 + {PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_16XE, 132 + PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_164E, }, 133 + {PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_16XP, 134 + PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_161P, }, 135 + {PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_16XP, 136 + PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_162P, }, 137 + {PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_16XP, 138 + PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_164P, }, 139 + {PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_32XE, 140 + PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_321E, }, 141 + {PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_32XE, 142 + PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_322E, }, 143 + {PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_32XE, 144 + PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_324E, }, 145 + {PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_32XP, 146 + PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_321P, }, 147 + {PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_32XP, 148 + PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_322P, }, 149 + {PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_32XP, 150 + PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_324P, }, 151 + {PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_TLFC_2, 152 + PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_TLFC_2XX2, }, 153 + {PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_TLFC_3, 154 + PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_TLFC_3162, }, 155 + {PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_TLFC_3, 156 + PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_TLFC_3322, }, 127 157 { 0 } 128 158 };
+89
drivers/scsi/lpfc/lpfc_init.c
··· 2415 2415 } 2416 2416 2417 2417 /** 2418 + * lpfc_get_atto_model_desc - Retrieve ATTO HBA device model name and description 2419 + * @phba: pointer to lpfc hba data structure. 2420 + * @mdp: pointer to the data structure to hold the derived model name. 2421 + * @descp: pointer to the data structure to hold the derived description. 2422 + * 2423 + * This routine retrieves HBA's description based on its registered PCI device 2424 + * ID. The @descp passed into this function points to an array of 256 chars. It 2425 + * shall be returned with the model name, maximum speed, and the host bus type. 2426 + * The @mdp passed into this function points to an array of 80 chars. When the 2427 + * function returns, the @mdp will be filled with the model name. 2428 + **/ 2429 + static void 2430 + lpfc_get_atto_model_desc(struct lpfc_hba *phba, uint8_t *mdp, uint8_t *descp) 2431 + { 2432 + uint16_t sub_dev_id = phba->pcidev->subsystem_device; 2433 + char *model = "<Unknown>"; 2434 + int tbolt = 0; 2435 + 2436 + switch (sub_dev_id) { 2437 + case PCI_DEVICE_ID_CLRY_161E: 2438 + model = "161E"; 2439 + break; 2440 + case PCI_DEVICE_ID_CLRY_162E: 2441 + model = "162E"; 2442 + break; 2443 + case PCI_DEVICE_ID_CLRY_164E: 2444 + model = "164E"; 2445 + break; 2446 + case PCI_DEVICE_ID_CLRY_161P: 2447 + model = "161P"; 2448 + break; 2449 + case PCI_DEVICE_ID_CLRY_162P: 2450 + model = "162P"; 2451 + break; 2452 + case PCI_DEVICE_ID_CLRY_164P: 2453 + model = "164P"; 2454 + break; 2455 + case PCI_DEVICE_ID_CLRY_321E: 2456 + model = "321E"; 2457 + break; 2458 + case PCI_DEVICE_ID_CLRY_322E: 2459 + model = "322E"; 2460 + break; 2461 + case PCI_DEVICE_ID_CLRY_324E: 2462 + model = "324E"; 2463 + break; 2464 + case PCI_DEVICE_ID_CLRY_321P: 2465 + model = "321P"; 2466 + break; 2467 + case PCI_DEVICE_ID_CLRY_322P: 2468 + model = "322P"; 2469 + break; 2470 + case PCI_DEVICE_ID_CLRY_324P: 2471 + model = "324P"; 2472 + break; 2473 + case PCI_DEVICE_ID_TLFC_2XX2: 2474 + model = "2XX2"; 2475 + tbolt = 1; 2476 + break; 2477 + case PCI_DEVICE_ID_TLFC_3162: 2478 + model = "3162"; 2479 + tbolt = 1; 2480 + break; 2481 + case PCI_DEVICE_ID_TLFC_3322: 2482 + model = "3322"; 2483 + tbolt = 1; 2484 + break; 2485 + default: 2486 + model = "Unknown"; 2487 + break; 2488 + } 2489 + 2490 + if (mdp && mdp[0] == '\0') 2491 + snprintf(mdp, 79, "%s", model); 2492 + 2493 + if (descp && descp[0] == '\0') 2494 + snprintf(descp, 255, 2495 + "ATTO %s%s, Fibre Channel Adapter Initiator, Port %s", 2496 + (tbolt) ? "ThunderLink FC " : "Celerity FC-", 2497 + model, 2498 + phba->Port); 2499 + } 2500 + 2501 + /** 2418 2502 * lpfc_get_hba_model_desc - Retrieve HBA device model name and description 2419 2503 * @phba: pointer to lpfc hba data structure. 2420 2504 * @mdp: pointer to the data structure to hold the derived model name. ··· 2527 2443 if (mdp && mdp[0] != '\0' 2528 2444 && descp && descp[0] != '\0') 2529 2445 return; 2446 + 2447 + if (phba->pcidev->vendor == PCI_VENDOR_ID_ATTO) { 2448 + lpfc_get_atto_model_desc(phba, mdp, descp); 2449 + return; 2450 + } 2530 2451 2531 2452 if (phba->lmt & LMT_64Gb) 2532 2453 max_speed = 64;
+45
drivers/scsi/lpfc/lpfc_nvme.c
··· 1279 1279 1280 1280 /* Words 13 14 15 are for PBDE support */ 1281 1281 1282 + /* add the VMID tags as per switch response */ 1283 + if (unlikely(lpfc_ncmd->cur_iocbq.cmd_flag & LPFC_IO_VMID)) { 1284 + if (phba->pport->vmid_priority_tagging) { 1285 + bf_set(wqe_ccpe, &wqe->fcp_iwrite.wqe_com, 1); 1286 + bf_set(wqe_ccp, &wqe->fcp_iwrite.wqe_com, 1287 + lpfc_ncmd->cur_iocbq.vmid_tag.cs_ctl_vmid); 1288 + } else { 1289 + bf_set(wqe_appid, &wqe->fcp_iwrite.wqe_com, 1); 1290 + bf_set(wqe_wqes, &wqe->fcp_iwrite.wqe_com, 1); 1291 + wqe->words[31] = lpfc_ncmd->cur_iocbq.vmid_tag.app_id; 1292 + } 1293 + } 1294 + 1282 1295 pwqeq->vport = vport; 1283 1296 return 0; 1284 1297 } ··· 1517 1504 struct lpfc_nvme_fcpreq_priv *freqpriv; 1518 1505 struct nvme_common_command *sqe; 1519 1506 uint64_t start = 0; 1507 + #if (IS_ENABLED(CONFIG_NVME_FC)) 1508 + u8 *uuid = NULL; 1509 + int err; 1510 + enum dma_data_direction iodir; 1511 + #endif 1520 1512 1521 1513 /* Validate pointers. LLDD fault handling with transport does 1522 1514 * have timing races. ··· 1679 1661 lpfc_ncmd->nvmeCmd = pnvme_fcreq; 1680 1662 lpfc_ncmd->ndlp = ndlp; 1681 1663 lpfc_ncmd->qidx = lpfc_queue_info->qidx; 1664 + 1665 + #if (IS_ENABLED(CONFIG_NVME_FC)) 1666 + /* check the necessary and sufficient condition to support VMID */ 1667 + if (lpfc_is_vmid_enabled(phba) && 1668 + (ndlp->vmid_support || 1669 + phba->pport->vmid_priority_tagging == 1670 + LPFC_VMID_PRIO_TAG_ALL_TARGETS)) { 1671 + /* is the I/O generated by a VM, get the associated virtual */ 1672 + /* entity id */ 1673 + uuid = nvme_fc_io_getuuid(pnvme_fcreq); 1674 + 1675 + if (uuid) { 1676 + if (pnvme_fcreq->io_dir == NVMEFC_FCP_WRITE) 1677 + iodir = DMA_TO_DEVICE; 1678 + else if (pnvme_fcreq->io_dir == NVMEFC_FCP_READ) 1679 + iodir = DMA_FROM_DEVICE; 1680 + else 1681 + iodir = DMA_NONE; 1682 + 1683 + err = lpfc_vmid_get_appid(vport, uuid, iodir, 1684 + (union lpfc_vmid_io_tag *) 1685 + &lpfc_ncmd->cur_iocbq.vmid_tag); 1686 + if (!err) 1687 + lpfc_ncmd->cur_iocbq.cmd_flag |= LPFC_IO_VMID; 1688 + } 1689 + } 1690 + #endif 1682 1691 1683 1692 /* 1684 1693 * Issue the IO on the WQ indicated by index in the hw_queue_handle.
+4 -259
drivers/scsi/lpfc/lpfc_scsi.c
··· 87 87 lpfc_release_scsi_buf_s3(struct lpfc_hba *phba, struct lpfc_io_buf *psb); 88 88 static int 89 89 lpfc_prot_group_type(struct lpfc_hba *phba, struct scsi_cmnd *sc); 90 - static void 91 - lpfc_put_vmid_in_hashtable(struct lpfc_vport *vport, u32 hash, 92 - struct lpfc_vmid *vmp); 93 - static void lpfc_vmid_update_entry(struct lpfc_vport *vport, struct scsi_cmnd 94 - *cmd, struct lpfc_vmid *vmp, 95 - union lpfc_vmid_io_tag *tag); 96 - static void lpfc_vmid_assign_cs_ctl(struct lpfc_vport *vport, 97 - struct lpfc_vmid *vmid); 98 90 99 91 /** 100 92 * lpfc_sli4_set_rsp_sgl_last - Set the last bit in the response sge. ··· 5263 5271 } 5264 5272 5265 5273 /* 5266 - * lpfc_get_vmid_from_hashtable - search the UUID in the hash table 5267 - * @vport: The virtual port for which this call is being executed. 5268 - * @hash: calculated hash value 5269 - * @buf: uuid associated with the VE 5270 - * Return the VMID entry associated with the UUID 5271 - * Make sure to acquire the appropriate lock before invoking this routine. 5272 - */ 5273 - struct lpfc_vmid *lpfc_get_vmid_from_hashtable(struct lpfc_vport *vport, 5274 - u32 hash, u8 *buf) 5275 - { 5276 - struct lpfc_vmid *vmp; 5277 - 5278 - hash_for_each_possible(vport->hash_table, vmp, hnode, hash) { 5279 - if (memcmp(&vmp->host_vmid[0], buf, 16) == 0) 5280 - return vmp; 5281 - } 5282 - return NULL; 5283 - } 5284 - 5285 - /* 5286 - * lpfc_put_vmid_in_hashtable - put the VMID in the hash table 5287 - * @vport: The virtual port for which this call is being executed. 5288 - * @hash - calculated hash value 5289 - * @vmp: Pointer to a VMID entry representing a VM sending I/O 5290 - * 5291 - * This routine will insert the newly acquired VMID entity in the hash table. 5292 - * Make sure to acquire the appropriate lock before invoking this routine. 5293 - */ 5294 - static void 5295 - lpfc_put_vmid_in_hashtable(struct lpfc_vport *vport, u32 hash, 5296 - struct lpfc_vmid *vmp) 5297 - { 5298 - hash_add(vport->hash_table, &vmp->hnode, hash); 5299 - } 5300 - 5301 - /* 5302 - * lpfc_vmid_hash_fn - create a hash value of the UUID 5303 - * @vmid: uuid associated with the VE 5304 - * @len: length of the VMID string 5305 - * Returns the calculated hash value 5306 - */ 5307 - int lpfc_vmid_hash_fn(const char *vmid, int len) 5308 - { 5309 - int c; 5310 - int hash = 0; 5311 - 5312 - if (len == 0) 5313 - return 0; 5314 - while (len--) { 5315 - c = *vmid++; 5316 - if (c >= 'A' && c <= 'Z') 5317 - c += 'a' - 'A'; 5318 - 5319 - hash = (hash + (c << LPFC_VMID_HASH_SHIFT) + 5320 - (c >> LPFC_VMID_HASH_SHIFT)) * 19; 5321 - } 5322 - 5323 - return hash & LPFC_VMID_HASH_MASK; 5324 - } 5325 - 5326 - /* 5327 - * lpfc_vmid_update_entry - update the vmid entry in the hash table 5328 - * @vport: The virtual port for which this call is being executed. 5329 - * @cmd: address of scsi cmd descriptor 5330 - * @vmp: Pointer to a VMID entry representing a VM sending I/O 5331 - * @tag: VMID tag 5332 - */ 5333 - static void lpfc_vmid_update_entry(struct lpfc_vport *vport, struct scsi_cmnd 5334 - *cmd, struct lpfc_vmid *vmp, 5335 - union lpfc_vmid_io_tag *tag) 5336 - { 5337 - u64 *lta; 5338 - 5339 - if (vport->phba->pport->vmid_flag & LPFC_VMID_TYPE_PRIO) 5340 - tag->cs_ctl_vmid = vmp->un.cs_ctl_vmid; 5341 - else if (vport->phba->cfg_vmid_app_header) 5342 - tag->app_id = vmp->un.app_id; 5343 - 5344 - if (cmd->sc_data_direction == DMA_TO_DEVICE) 5345 - vmp->io_wr_cnt++; 5346 - else 5347 - vmp->io_rd_cnt++; 5348 - 5349 - /* update the last access timestamp in the table */ 5350 - lta = per_cpu_ptr(vmp->last_io_time, raw_smp_processor_id()); 5351 - *lta = jiffies; 5352 - } 5353 - 5354 - static void lpfc_vmid_assign_cs_ctl(struct lpfc_vport *vport, 5355 - struct lpfc_vmid *vmid) 5356 - { 5357 - u32 hash; 5358 - struct lpfc_vmid *pvmid; 5359 - 5360 - if (vport->port_type == LPFC_PHYSICAL_PORT) { 5361 - vmid->un.cs_ctl_vmid = lpfc_vmid_get_cs_ctl(vport); 5362 - } else { 5363 - hash = lpfc_vmid_hash_fn(vmid->host_vmid, vmid->vmid_len); 5364 - pvmid = 5365 - lpfc_get_vmid_from_hashtable(vport->phba->pport, hash, 5366 - vmid->host_vmid); 5367 - if (pvmid) 5368 - vmid->un.cs_ctl_vmid = pvmid->un.cs_ctl_vmid; 5369 - else 5370 - vmid->un.cs_ctl_vmid = lpfc_vmid_get_cs_ctl(vport); 5371 - } 5372 - } 5373 - 5374 - /* 5375 - * lpfc_vmid_get_appid - get the VMID associated with the UUID 5376 - * @vport: The virtual port for which this call is being executed. 5377 - * @uuid: UUID associated with the VE 5378 - * @cmd: address of scsi_cmd descriptor 5379 - * @tag: VMID tag 5380 - * Returns status of the function 5381 - */ 5382 - static int lpfc_vmid_get_appid(struct lpfc_vport *vport, char *uuid, struct 5383 - scsi_cmnd * cmd, union lpfc_vmid_io_tag *tag) 5384 - { 5385 - struct lpfc_vmid *vmp = NULL; 5386 - int hash, len, rc = -EPERM, i; 5387 - 5388 - /* check if QFPA is complete */ 5389 - if (lpfc_vmid_is_type_priority_tag(vport) && 5390 - !(vport->vmid_flag & LPFC_VMID_QFPA_CMPL) && 5391 - (vport->vmid_flag & LPFC_VMID_ISSUE_QFPA)) { 5392 - vport->work_port_events |= WORKER_CHECK_VMID_ISSUE_QFPA; 5393 - return -EAGAIN; 5394 - } 5395 - 5396 - /* search if the UUID has already been mapped to the VMID */ 5397 - len = strlen(uuid); 5398 - hash = lpfc_vmid_hash_fn(uuid, len); 5399 - 5400 - /* search for the VMID in the table */ 5401 - read_lock(&vport->vmid_lock); 5402 - vmp = lpfc_get_vmid_from_hashtable(vport, hash, uuid); 5403 - 5404 - /* if found, check if its already registered */ 5405 - if (vmp && vmp->flag & LPFC_VMID_REGISTERED) { 5406 - read_unlock(&vport->vmid_lock); 5407 - lpfc_vmid_update_entry(vport, cmd, vmp, tag); 5408 - rc = 0; 5409 - } else if (vmp && (vmp->flag & LPFC_VMID_REQ_REGISTER || 5410 - vmp->flag & LPFC_VMID_DE_REGISTER)) { 5411 - /* else if register or dereg request has already been sent */ 5412 - /* Hence VMID tag will not be added for this I/O */ 5413 - read_unlock(&vport->vmid_lock); 5414 - rc = -EBUSY; 5415 - } else { 5416 - /* The VMID was not found in the hashtable. At this point, */ 5417 - /* drop the read lock first before proceeding further */ 5418 - read_unlock(&vport->vmid_lock); 5419 - /* start the process to obtain one as per the */ 5420 - /* type of the VMID indicated */ 5421 - write_lock(&vport->vmid_lock); 5422 - vmp = lpfc_get_vmid_from_hashtable(vport, hash, uuid); 5423 - 5424 - /* while the read lock was released, in case the entry was */ 5425 - /* added by other context or is in process of being added */ 5426 - if (vmp && vmp->flag & LPFC_VMID_REGISTERED) { 5427 - lpfc_vmid_update_entry(vport, cmd, vmp, tag); 5428 - write_unlock(&vport->vmid_lock); 5429 - return 0; 5430 - } else if (vmp && vmp->flag & LPFC_VMID_REQ_REGISTER) { 5431 - write_unlock(&vport->vmid_lock); 5432 - return -EBUSY; 5433 - } 5434 - 5435 - /* else search and allocate a free slot in the hash table */ 5436 - if (vport->cur_vmid_cnt < vport->max_vmid) { 5437 - for (i = 0; i < vport->max_vmid; i++) { 5438 - vmp = vport->vmid + i; 5439 - if (vmp->flag == LPFC_VMID_SLOT_FREE) 5440 - break; 5441 - } 5442 - if (i == vport->max_vmid) 5443 - vmp = NULL; 5444 - } else { 5445 - vmp = NULL; 5446 - } 5447 - 5448 - if (!vmp) { 5449 - write_unlock(&vport->vmid_lock); 5450 - return -ENOMEM; 5451 - } 5452 - 5453 - /* Add the vmid and register */ 5454 - lpfc_put_vmid_in_hashtable(vport, hash, vmp); 5455 - vmp->vmid_len = len; 5456 - memcpy(vmp->host_vmid, uuid, vmp->vmid_len); 5457 - vmp->io_rd_cnt = 0; 5458 - vmp->io_wr_cnt = 0; 5459 - vmp->flag = LPFC_VMID_SLOT_USED; 5460 - 5461 - vmp->delete_inactive = 5462 - vport->vmid_inactivity_timeout ? 1 : 0; 5463 - 5464 - /* if type priority tag, get next available VMID */ 5465 - if (vport->phba->pport->vmid_flag & LPFC_VMID_TYPE_PRIO) 5466 - lpfc_vmid_assign_cs_ctl(vport, vmp); 5467 - 5468 - /* allocate the per cpu variable for holding */ 5469 - /* the last access time stamp only if VMID is enabled */ 5470 - if (!vmp->last_io_time) 5471 - vmp->last_io_time = __alloc_percpu(sizeof(u64), 5472 - __alignof__(struct 5473 - lpfc_vmid)); 5474 - if (!vmp->last_io_time) { 5475 - hash_del(&vmp->hnode); 5476 - vmp->flag = LPFC_VMID_SLOT_FREE; 5477 - write_unlock(&vport->vmid_lock); 5478 - return -EIO; 5479 - } 5480 - 5481 - write_unlock(&vport->vmid_lock); 5482 - 5483 - /* complete transaction with switch */ 5484 - if (vport->phba->pport->vmid_flag & LPFC_VMID_TYPE_PRIO) 5485 - rc = lpfc_vmid_uvem(vport, vmp, true); 5486 - else if (vport->phba->cfg_vmid_app_header) 5487 - rc = lpfc_vmid_cmd(vport, SLI_CTAS_RAPP_IDENT, vmp); 5488 - if (!rc) { 5489 - write_lock(&vport->vmid_lock); 5490 - vport->cur_vmid_cnt++; 5491 - vmp->flag |= LPFC_VMID_REQ_REGISTER; 5492 - write_unlock(&vport->vmid_lock); 5493 - } else { 5494 - write_lock(&vport->vmid_lock); 5495 - hash_del(&vmp->hnode); 5496 - vmp->flag = LPFC_VMID_SLOT_FREE; 5497 - free_percpu(vmp->last_io_time); 5498 - write_unlock(&vport->vmid_lock); 5499 - return -EIO; 5500 - } 5501 - 5502 - /* finally, enable the idle timer once */ 5503 - if (!(vport->phba->pport->vmid_flag & LPFC_VMID_TIMER_ENBLD)) { 5504 - mod_timer(&vport->phba->inactive_vmid_poll, 5505 - jiffies + 5506 - msecs_to_jiffies(1000 * LPFC_VMID_TIMER)); 5507 - vport->phba->pport->vmid_flag |= LPFC_VMID_TIMER_ENBLD; 5508 - } 5509 - } 5510 - return rc; 5511 - } 5512 - 5513 - /* 5514 5274 * lpfc_is_command_vm_io - get the UUID from blk cgroup 5515 5275 * @cmd: Pointer to scsi_cmnd data structure 5516 5276 * Returns UUID if present, otherwise NULL ··· 5448 5704 uuid = lpfc_is_command_vm_io(cmnd); 5449 5705 5450 5706 if (uuid) { 5451 - err = lpfc_vmid_get_appid(vport, uuid, cmnd, 5452 - (union lpfc_vmid_io_tag *) 5453 - &cur_iocbq->vmid_tag); 5707 + err = lpfc_vmid_get_appid(vport, uuid, 5708 + cmnd->sc_data_direction, 5709 + (union lpfc_vmid_io_tag *) 5710 + &cur_iocbq->vmid_tag); 5454 5711 if (!err) 5455 5712 cur_iocbq->cmd_flag |= LPFC_IO_VMID; 5456 5713 }
+288
drivers/scsi/lpfc/lpfc_vmid.c
··· 1 + /******************************************************************* 2 + * This file is part of the Emulex Linux Device Driver for * 3 + * Fibre Channel Host Bus Adapters. * 4 + * Copyright (C) 2017-2022 Broadcom. All Rights Reserved. The term * 5 + * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. * 6 + * Copyright (C) 2004-2016 Emulex. All rights reserved. * 7 + * EMULEX and SLI are trademarks of Emulex. * 8 + * www.broadcom.com * 9 + * Portions Copyright (C) 2004-2005 Christoph Hellwig * 10 + * * 11 + * This program is free software; you can redistribute it and/or * 12 + * modify it under the terms of version 2 of the GNU General * 13 + * Public License as published by the Free Software Foundation. * 14 + * This program is distributed in the hope that it will be useful. * 15 + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND * 16 + * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, * 17 + * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE * 18 + * DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD * 19 + * TO BE LEGALLY INVALID. See the GNU General Public License for * 20 + * more details, a copy of which can be found in the file COPYING * 21 + * included with this package. * 22 + *******************************************************************/ 23 + 24 + #include <linux/interrupt.h> 25 + #include <linux/dma-direction.h> 26 + 27 + #include <scsi/scsi_transport_fc.h> 28 + 29 + #include "lpfc_hw4.h" 30 + #include "lpfc_hw.h" 31 + #include "lpfc_sli.h" 32 + #include "lpfc_sli4.h" 33 + #include "lpfc_nl.h" 34 + #include "lpfc_disc.h" 35 + #include "lpfc.h" 36 + #include "lpfc_crtn.h" 37 + 38 + 39 + /* 40 + * lpfc_get_vmid_from_hashtable - search the UUID in the hash table 41 + * @vport: The virtual port for which this call is being executed. 42 + * @hash: calculated hash value 43 + * @buf: uuid associated with the VE 44 + * Return the VMID entry associated with the UUID 45 + * Make sure to acquire the appropriate lock before invoking this routine. 46 + */ 47 + struct lpfc_vmid *lpfc_get_vmid_from_hashtable(struct lpfc_vport *vport, 48 + u32 hash, u8 *buf) 49 + { 50 + struct lpfc_vmid *vmp; 51 + 52 + hash_for_each_possible(vport->hash_table, vmp, hnode, hash) { 53 + if (memcmp(&vmp->host_vmid[0], buf, 16) == 0) 54 + return vmp; 55 + } 56 + return NULL; 57 + } 58 + 59 + /* 60 + * lpfc_put_vmid_in_hashtable - put the VMID in the hash table 61 + * @vport: The virtual port for which this call is being executed. 62 + * @hash - calculated hash value 63 + * @vmp: Pointer to a VMID entry representing a VM sending I/O 64 + * 65 + * This routine will insert the newly acquired VMID entity in the hash table. 66 + * Make sure to acquire the appropriate lock before invoking this routine. 67 + */ 68 + static void 69 + lpfc_put_vmid_in_hashtable(struct lpfc_vport *vport, u32 hash, 70 + struct lpfc_vmid *vmp) 71 + { 72 + hash_add(vport->hash_table, &vmp->hnode, hash); 73 + } 74 + 75 + /* 76 + * lpfc_vmid_hash_fn - create a hash value of the UUID 77 + * @vmid: uuid associated with the VE 78 + * @len: length of the VMID string 79 + * Returns the calculated hash value 80 + */ 81 + int lpfc_vmid_hash_fn(const char *vmid, int len) 82 + { 83 + int c; 84 + int hash = 0; 85 + 86 + if (len == 0) 87 + return 0; 88 + while (len--) { 89 + c = *vmid++; 90 + if (c >= 'A' && c <= 'Z') 91 + c += 'a' - 'A'; 92 + 93 + hash = (hash + (c << LPFC_VMID_HASH_SHIFT) + 94 + (c >> LPFC_VMID_HASH_SHIFT)) * 19; 95 + } 96 + 97 + return hash & LPFC_VMID_HASH_MASK; 98 + } 99 + 100 + /* 101 + * lpfc_vmid_update_entry - update the vmid entry in the hash table 102 + * @vport: The virtual port for which this call is being executed. 103 + * @iodir: io direction 104 + * @vmp: Pointer to a VMID entry representing a VM sending I/O 105 + * @tag: VMID tag 106 + */ 107 + static void lpfc_vmid_update_entry(struct lpfc_vport *vport, 108 + enum dma_data_direction iodir, 109 + struct lpfc_vmid *vmp, 110 + union lpfc_vmid_io_tag *tag) 111 + { 112 + u64 *lta; 113 + 114 + if (vport->phba->pport->vmid_flag & LPFC_VMID_TYPE_PRIO) 115 + tag->cs_ctl_vmid = vmp->un.cs_ctl_vmid; 116 + else if (vport->phba->cfg_vmid_app_header) 117 + tag->app_id = vmp->un.app_id; 118 + 119 + if (iodir == DMA_TO_DEVICE) 120 + vmp->io_wr_cnt++; 121 + else if (iodir == DMA_FROM_DEVICE) 122 + vmp->io_rd_cnt++; 123 + 124 + /* update the last access timestamp in the table */ 125 + lta = per_cpu_ptr(vmp->last_io_time, raw_smp_processor_id()); 126 + *lta = jiffies; 127 + } 128 + 129 + static void lpfc_vmid_assign_cs_ctl(struct lpfc_vport *vport, 130 + struct lpfc_vmid *vmid) 131 + { 132 + u32 hash; 133 + struct lpfc_vmid *pvmid; 134 + 135 + if (vport->port_type == LPFC_PHYSICAL_PORT) { 136 + vmid->un.cs_ctl_vmid = lpfc_vmid_get_cs_ctl(vport); 137 + } else { 138 + hash = lpfc_vmid_hash_fn(vmid->host_vmid, vmid->vmid_len); 139 + pvmid = 140 + lpfc_get_vmid_from_hashtable(vport->phba->pport, hash, 141 + vmid->host_vmid); 142 + if (pvmid) 143 + vmid->un.cs_ctl_vmid = pvmid->un.cs_ctl_vmid; 144 + else 145 + vmid->un.cs_ctl_vmid = lpfc_vmid_get_cs_ctl(vport); 146 + } 147 + } 148 + 149 + /* 150 + * lpfc_vmid_get_appid - get the VMID associated with the UUID 151 + * @vport: The virtual port for which this call is being executed. 152 + * @uuid: UUID associated with the VE 153 + * @cmd: address of scsi_cmd descriptor 154 + * @iodir: io direction 155 + * @tag: VMID tag 156 + * Returns status of the function 157 + */ 158 + int lpfc_vmid_get_appid(struct lpfc_vport *vport, char *uuid, 159 + enum dma_data_direction iodir, 160 + union lpfc_vmid_io_tag *tag) 161 + { 162 + struct lpfc_vmid *vmp = NULL; 163 + int hash, len, rc = -EPERM, i; 164 + 165 + /* check if QFPA is complete */ 166 + if (lpfc_vmid_is_type_priority_tag(vport) && 167 + !(vport->vmid_flag & LPFC_VMID_QFPA_CMPL) && 168 + (vport->vmid_flag & LPFC_VMID_ISSUE_QFPA)) { 169 + vport->work_port_events |= WORKER_CHECK_VMID_ISSUE_QFPA; 170 + return -EAGAIN; 171 + } 172 + 173 + /* search if the UUID has already been mapped to the VMID */ 174 + len = strlen(uuid); 175 + hash = lpfc_vmid_hash_fn(uuid, len); 176 + 177 + /* search for the VMID in the table */ 178 + read_lock(&vport->vmid_lock); 179 + vmp = lpfc_get_vmid_from_hashtable(vport, hash, uuid); 180 + 181 + /* if found, check if its already registered */ 182 + if (vmp && vmp->flag & LPFC_VMID_REGISTERED) { 183 + read_unlock(&vport->vmid_lock); 184 + lpfc_vmid_update_entry(vport, iodir, vmp, tag); 185 + rc = 0; 186 + } else if (vmp && (vmp->flag & LPFC_VMID_REQ_REGISTER || 187 + vmp->flag & LPFC_VMID_DE_REGISTER)) { 188 + /* else if register or dereg request has already been sent */ 189 + /* Hence VMID tag will not be added for this I/O */ 190 + read_unlock(&vport->vmid_lock); 191 + rc = -EBUSY; 192 + } else { 193 + /* The VMID was not found in the hashtable. At this point, */ 194 + /* drop the read lock first before proceeding further */ 195 + read_unlock(&vport->vmid_lock); 196 + /* start the process to obtain one as per the */ 197 + /* type of the VMID indicated */ 198 + write_lock(&vport->vmid_lock); 199 + vmp = lpfc_get_vmid_from_hashtable(vport, hash, uuid); 200 + 201 + /* while the read lock was released, in case the entry was */ 202 + /* added by other context or is in process of being added */ 203 + if (vmp && vmp->flag & LPFC_VMID_REGISTERED) { 204 + lpfc_vmid_update_entry(vport, iodir, vmp, tag); 205 + write_unlock(&vport->vmid_lock); 206 + return 0; 207 + } else if (vmp && vmp->flag & LPFC_VMID_REQ_REGISTER) { 208 + write_unlock(&vport->vmid_lock); 209 + return -EBUSY; 210 + } 211 + 212 + /* else search and allocate a free slot in the hash table */ 213 + if (vport->cur_vmid_cnt < vport->max_vmid) { 214 + for (i = 0; i < vport->max_vmid; i++) { 215 + vmp = vport->vmid + i; 216 + if (vmp->flag == LPFC_VMID_SLOT_FREE) 217 + break; 218 + } 219 + if (i == vport->max_vmid) 220 + vmp = NULL; 221 + } else { 222 + vmp = NULL; 223 + } 224 + 225 + if (!vmp) { 226 + write_unlock(&vport->vmid_lock); 227 + return -ENOMEM; 228 + } 229 + 230 + /* Add the vmid and register */ 231 + lpfc_put_vmid_in_hashtable(vport, hash, vmp); 232 + vmp->vmid_len = len; 233 + memcpy(vmp->host_vmid, uuid, vmp->vmid_len); 234 + vmp->io_rd_cnt = 0; 235 + vmp->io_wr_cnt = 0; 236 + vmp->flag = LPFC_VMID_SLOT_USED; 237 + 238 + vmp->delete_inactive = 239 + vport->vmid_inactivity_timeout ? 1 : 0; 240 + 241 + /* if type priority tag, get next available VMID */ 242 + if (vport->phba->pport->vmid_flag & LPFC_VMID_TYPE_PRIO) 243 + lpfc_vmid_assign_cs_ctl(vport, vmp); 244 + 245 + /* allocate the per cpu variable for holding */ 246 + /* the last access time stamp only if VMID is enabled */ 247 + if (!vmp->last_io_time) 248 + vmp->last_io_time = __alloc_percpu(sizeof(u64), 249 + __alignof__(struct 250 + lpfc_vmid)); 251 + if (!vmp->last_io_time) { 252 + hash_del(&vmp->hnode); 253 + vmp->flag = LPFC_VMID_SLOT_FREE; 254 + write_unlock(&vport->vmid_lock); 255 + return -EIO; 256 + } 257 + 258 + write_unlock(&vport->vmid_lock); 259 + 260 + /* complete transaction with switch */ 261 + if (vport->phba->pport->vmid_flag & LPFC_VMID_TYPE_PRIO) 262 + rc = lpfc_vmid_uvem(vport, vmp, true); 263 + else if (vport->phba->cfg_vmid_app_header) 264 + rc = lpfc_vmid_cmd(vport, SLI_CTAS_RAPP_IDENT, vmp); 265 + if (!rc) { 266 + write_lock(&vport->vmid_lock); 267 + vport->cur_vmid_cnt++; 268 + vmp->flag |= LPFC_VMID_REQ_REGISTER; 269 + write_unlock(&vport->vmid_lock); 270 + } else { 271 + write_lock(&vport->vmid_lock); 272 + hash_del(&vmp->hnode); 273 + vmp->flag = LPFC_VMID_SLOT_FREE; 274 + free_percpu(vmp->last_io_time); 275 + write_unlock(&vport->vmid_lock); 276 + return -EIO; 277 + } 278 + 279 + /* finally, enable the idle timer once */ 280 + if (!(vport->phba->pport->vmid_flag & LPFC_VMID_TIMER_ENBLD)) { 281 + mod_timer(&vport->phba->inactive_vmid_poll, 282 + jiffies + 283 + msecs_to_jiffies(1000 * LPFC_VMID_TIMER)); 284 + vport->phba->pport->vmid_flag |= LPFC_VMID_TIMER_ENBLD; 285 + } 286 + } 287 + return rc; 288 + }
+1 -1
drivers/scsi/mpi3mr/mpi3mr.h
··· 954 954 u16 active_poll_qcount; 955 955 u16 requested_poll_qcount; 956 956 957 - struct device *bsg_dev; 957 + struct device bsg_dev; 958 958 struct request_queue *bsg_queue; 959 959 u8 stop_bsgs; 960 960 u8 *logdata_buf;
+25 -29
drivers/scsi/mpi3mr/mpi3mr_app.c
··· 1487 1487 */ 1488 1488 void mpi3mr_bsg_exit(struct mpi3mr_ioc *mrioc) 1489 1489 { 1490 + struct device *bsg_dev = &mrioc->bsg_dev; 1490 1491 if (!mrioc->bsg_queue) 1491 1492 return; 1492 1493 1493 1494 bsg_remove_queue(mrioc->bsg_queue); 1494 1495 mrioc->bsg_queue = NULL; 1495 1496 1496 - device_del(mrioc->bsg_dev); 1497 - put_device(mrioc->bsg_dev); 1498 - kfree(mrioc->bsg_dev); 1497 + device_del(bsg_dev); 1498 + put_device(bsg_dev); 1499 1499 } 1500 1500 1501 1501 /** 1502 1502 * mpi3mr_bsg_node_release -release bsg device node 1503 1503 * @dev: bsg device node 1504 1504 * 1505 - * decrements bsg dev reference count 1505 + * decrements bsg dev parent reference count 1506 1506 * 1507 1507 * Return:Nothing 1508 1508 */ 1509 1509 static void mpi3mr_bsg_node_release(struct device *dev) 1510 1510 { 1511 - put_device(dev); 1511 + put_device(dev->parent); 1512 1512 } 1513 1513 1514 1514 /** ··· 1521 1521 */ 1522 1522 void mpi3mr_bsg_init(struct mpi3mr_ioc *mrioc) 1523 1523 { 1524 - mrioc->bsg_dev = kzalloc(sizeof(struct device), GFP_KERNEL); 1525 - if (!mrioc->bsg_dev) { 1526 - ioc_err(mrioc, "bsg device mem allocation failed\n"); 1524 + struct device *bsg_dev = &mrioc->bsg_dev; 1525 + struct device *parent = &mrioc->shost->shost_gendev; 1526 + 1527 + device_initialize(bsg_dev); 1528 + 1529 + bsg_dev->parent = get_device(parent); 1530 + bsg_dev->release = mpi3mr_bsg_node_release; 1531 + 1532 + dev_set_name(bsg_dev, "mpi3mrctl%u", mrioc->id); 1533 + 1534 + if (device_add(bsg_dev)) { 1535 + ioc_err(mrioc, "%s: bsg device add failed\n", 1536 + dev_name(bsg_dev)); 1537 + put_device(bsg_dev); 1527 1538 return; 1528 1539 } 1529 1540 1530 - device_initialize(mrioc->bsg_dev); 1531 - dev_set_name(mrioc->bsg_dev, "mpi3mrctl%u", mrioc->id); 1532 - 1533 - if (device_add(mrioc->bsg_dev)) { 1534 - ioc_err(mrioc, "%s: bsg device add failed\n", 1535 - dev_name(mrioc->bsg_dev)); 1536 - goto err_device_add; 1537 - } 1538 - 1539 - mrioc->bsg_dev->release = mpi3mr_bsg_node_release; 1540 - 1541 - mrioc->bsg_queue = bsg_setup_queue(mrioc->bsg_dev, dev_name(mrioc->bsg_dev), 1541 + mrioc->bsg_queue = bsg_setup_queue(bsg_dev, dev_name(bsg_dev), 1542 1542 mpi3mr_bsg_request, NULL, 0); 1543 1543 if (IS_ERR(mrioc->bsg_queue)) { 1544 1544 ioc_err(mrioc, "%s: bsg registration failed\n", 1545 - dev_name(mrioc->bsg_dev)); 1546 - goto err_setup_queue; 1545 + dev_name(bsg_dev)); 1546 + device_del(bsg_dev); 1547 + put_device(bsg_dev); 1548 + return; 1547 1549 } 1548 1550 1549 1551 blk_queue_max_segments(mrioc->bsg_queue, MPI3MR_MAX_APP_XFER_SEGMENTS); 1550 1552 blk_queue_max_hw_sectors(mrioc->bsg_queue, MPI3MR_MAX_APP_XFER_SECTORS); 1551 1553 1552 1554 return; 1553 - 1554 - err_setup_queue: 1555 - device_del(mrioc->bsg_dev); 1556 - put_device(mrioc->bsg_dev); 1557 - err_device_add: 1558 - kfree(mrioc->bsg_dev); 1559 1555 } 1560 1556 1561 1557 /** ··· 1689 1693 static DEVICE_ATTR_RW(logging_level); 1690 1694 1691 1695 /** 1692 - * adapter_state_show - SysFS callback for adapter state show 1696 + * adp_state_show() - SysFS callback for adapter state show 1693 1697 * @dev: class device 1694 1698 * @attr: Device attributes 1695 1699 * @buf: Buffer to copy
+8 -3
drivers/scsi/myrb.c
··· 1239 1239 myrb_unmap(cb); 1240 1240 1241 1241 if (cb->mmio_base) { 1242 - cb->disable_intr(cb->io_base); 1242 + if (cb->disable_intr) 1243 + cb->disable_intr(cb->io_base); 1243 1244 iounmap(cb->mmio_base); 1244 1245 } 1245 1246 if (cb->irq) ··· 3414 3413 mutex_init(&cb->dcmd_mutex); 3415 3414 mutex_init(&cb->dma_mutex); 3416 3415 cb->pdev = pdev; 3416 + cb->host = shost; 3417 3417 3418 - if (pci_enable_device(pdev)) 3419 - goto failure; 3418 + if (pci_enable_device(pdev)) { 3419 + dev_err(&pdev->dev, "Failed to enable PCI device\n"); 3420 + scsi_host_put(shost); 3421 + return NULL; 3422 + } 3420 3423 3421 3424 if (privdata->hw_init == DAC960_PD_hw_init || 3422 3425 privdata->hw_init == DAC960_P_hw_init) {
+1 -1
drivers/scsi/pmcraid.c
··· 1434 1434 return -EINVAL; 1435 1435 } 1436 1436 1437 - /* send genetlink multicast message to notify appplications */ 1437 + /* send genetlink multicast message to notify applications */ 1438 1438 genlmsg_end(skb, msg_header); 1439 1439 1440 1440 result = genlmsg_multicast(&pmcraid_event_family, skb,
+1 -1
drivers/scsi/qedf/qedf_io.c
··· 893 893 return -EINVAL; 894 894 } 895 895 896 - /* Record LUN number for later use if we neeed them */ 896 + /* Record LUN number for later use if we need them */ 897 897 io_req->lun = (int)sc_cmd->device->lun; 898 898 899 899 /* Obtain free SQE */
+1 -2
drivers/scsi/qla1280.c
··· 4037 4037 { 4038 4038 char *cp, *ptr; 4039 4039 unsigned long val; 4040 - int toke; 4041 4040 4042 4041 cp = s; 4043 4042 ··· 4051 4052 } else 4052 4053 val = simple_strtoul(ptr, &ptr, 0); 4053 4054 4054 - switch ((toke = qla1280_get_token(cp))) { 4055 + switch (qla1280_get_token(cp)) { 4055 4056 case TOKEN_NVRAM: 4056 4057 if (!val) 4057 4058 driver_setup.no_nvram = 1;
-2
drivers/scsi/qla2xxx/qla_mid.c
··· 591 591 } 592 592 kfree(req->outstanding_cmds); 593 593 kfree(req); 594 - req = NULL; 595 594 } 596 595 597 596 static void ··· 616 617 mutex_unlock(&ha->vport_lock); 617 618 } 618 619 kfree(rsp); 619 - rsp = NULL; 620 620 } 621 621 622 622 int
-7
drivers/scsi/qla2xxx/qla_target.c
··· 48 48 "when ready " 49 49 "\"enabled\" (default) - initiator mode will always stay enabled."); 50 50 51 - static int ql_dm_tgt_ex_pct = 0; 52 - module_param(ql_dm_tgt_ex_pct, int, S_IRUGO|S_IWUSR); 53 - MODULE_PARM_DESC(ql_dm_tgt_ex_pct, 54 - "For Dual Mode (qlini_mode=dual), this parameter determines " 55 - "the percentage of exchanges/cmds FW will allocate resources " 56 - "for Target mode."); 57 - 58 51 int ql2xuctrlirq = 1; 59 52 module_param(ql2xuctrlirq, int, 0644); 60 53 MODULE_PARM_DESC(ql2xuctrlirq,
+1 -1
drivers/scsi/scsi_lib.c
··· 779 779 action = ACTION_DELAYED_RETRY; 780 780 break; 781 781 case 0x0a: /* ALUA state transition */ 782 - blk_stat = BLK_STS_AGAIN; 782 + blk_stat = BLK_STS_TRANSPORT; 783 783 fallthrough; 784 784 default: 785 785 action = ACTION_FAIL;
-1
drivers/scsi/scsi_sysfs.c
··· 573 573 .pm = &scsi_bus_pm_ops, 574 574 #endif 575 575 }; 576 - EXPORT_SYMBOL_GPL(scsi_bus_type); 577 576 578 577 int scsi_sysfs_register(void) 579 578 {
+2 -3
drivers/scsi/sd.c
··· 3521 3521 error = device_add_disk(dev, gd, NULL); 3522 3522 if (error) { 3523 3523 put_device(&sdkp->disk_dev); 3524 - blk_cleanup_disk(gd); 3524 + put_disk(gd); 3525 3525 goto out; 3526 3526 } 3527 3527 ··· 3542 3542 out_put: 3543 3543 put_disk(gd); 3544 3544 out_free: 3545 - sd_zbc_release_disk(sdkp); 3546 3545 kfree(sdkp); 3547 3546 out: 3548 3547 scsi_autopm_put_device(sdp); ··· 3578 3579 struct scsi_disk *sdkp = to_scsi_disk(dev); 3579 3580 3580 3581 ida_free(&sd_index_ida, sdkp->index); 3581 - sd_zbc_release_disk(sdkp); 3582 + sd_zbc_free_zone_info(sdkp); 3582 3583 put_device(&sdkp->device->sdev_gendev); 3583 3584 free_opal_dev(sdkp->opal_dev); 3584 3585
+2 -2
drivers/scsi/sd.h
··· 241 241 242 242 #ifdef CONFIG_BLK_DEV_ZONED 243 243 244 - void sd_zbc_release_disk(struct scsi_disk *sdkp); 244 + void sd_zbc_free_zone_info(struct scsi_disk *sdkp); 245 245 int sd_zbc_read_zones(struct scsi_disk *sdkp, u8 buf[SD_BUF_SIZE]); 246 246 int sd_zbc_revalidate_zones(struct scsi_disk *sdkp); 247 247 blk_status_t sd_zbc_setup_zone_mgmt_cmnd(struct scsi_cmnd *cmd, ··· 256 256 257 257 #else /* CONFIG_BLK_DEV_ZONED */ 258 258 259 - static inline void sd_zbc_release_disk(struct scsi_disk *sdkp) {} 259 + static inline void sd_zbc_free_zone_info(struct scsi_disk *sdkp) {} 260 260 261 261 static inline int sd_zbc_read_zones(struct scsi_disk *sdkp, u8 buf[SD_BUF_SIZE]) 262 262 {
+13 -13
drivers/scsi/sd_zbc.c
··· 786 786 return 0; 787 787 } 788 788 789 - static void sd_zbc_clear_zone_info(struct scsi_disk *sdkp) 789 + void sd_zbc_free_zone_info(struct scsi_disk *sdkp) 790 790 { 791 + if (!sdkp->zone_wp_update_buf) 792 + return; 793 + 791 794 /* Serialize against revalidate zones */ 792 795 mutex_lock(&sdkp->rev_mutex); 793 796 ··· 803 800 sdkp->zone_info = (struct zoned_disk_info){ }; 804 801 805 802 mutex_unlock(&sdkp->rev_mutex); 806 - } 807 - 808 - void sd_zbc_release_disk(struct scsi_disk *sdkp) 809 - { 810 - if (sd_is_zoned(sdkp)) 811 - sd_zbc_clear_zone_info(sdkp); 812 803 } 813 804 814 805 static void sd_zbc_revalidate_zones_cb(struct gendisk *disk) ··· 911 914 u32 zone_blocks = 0; 912 915 int ret; 913 916 914 - if (!sd_is_zoned(sdkp)) 917 + if (!sd_is_zoned(sdkp)) { 915 918 /* 916 - * Device managed or normal SCSI disk, 917 - * no special handling required 919 + * Device managed or normal SCSI disk, no special handling 920 + * required. Nevertheless, free the disk zone information in 921 + * case the device type changed. 918 922 */ 923 + sd_zbc_free_zone_info(sdkp); 919 924 return 0; 925 + } 920 926 921 927 /* READ16/WRITE16 is mandatory for ZBC disks */ 922 928 sdkp->device->use_16_for_rw = 1; ··· 928 928 if (!blk_queue_is_zoned(q)) { 929 929 /* 930 930 * This can happen for a host aware disk with partitions. 931 - * The block device zone information was already cleared 932 - * by blk_queue_set_zoned(). Only clear the scsi disk zone 931 + * The block device zone model was already cleared by 932 + * blk_queue_set_zoned(). Only free the scsi disk zone 933 933 * information and exit early. 934 934 */ 935 - sd_zbc_clear_zone_info(sdkp); 935 + sd_zbc_free_zone_info(sdkp); 936 936 return 0; 937 937 } 938 938
+1 -1
drivers/scsi/smartpqi/smartpqi.h
··· 1082 1082 }; 1083 1083 1084 1084 struct pqi_scsi_dev { 1085 - int devtype; /* as reported by INQUIRY commmand */ 1085 + int devtype; /* as reported by INQUIRY command */ 1086 1086 u8 device_type; /* as reported by */ 1087 1087 /* BMIC_IDENTIFY_PHYSICAL_DEVICE */ 1088 1088 /* only valid for devtype = TYPE_DISK */
+1 -1
drivers/scsi/storvsc_drv.c
··· 479 479 host = host_device->host; 480 480 /* 481 481 * Before scanning the host, first check to see if any of the 482 - * currrently known devices have been hot removed. We issue a 482 + * currently known devices have been hot removed. We issue a 483 483 * "unit ready" command against all currently known devices. 484 484 * This I/O will result in an error for devices that have been 485 485 * removed. As part of handling the I/O error, we remove the device.
+1 -74
drivers/scsi/ufs/Kconfig drivers/ufs/host/Kconfig
··· 1 1 # SPDX-License-Identifier: GPL-2.0+ 2 2 # 3 - # Kernel configuration file for the UFS Host Controller 3 + # Kernel configuration file for the UFS host controller drivers. 4 4 # 5 5 # Copyright (C) 2011-2013 Samsung India Software Operations 6 6 # 7 7 # Authors: 8 8 # Santosh Yaraganavi <santosh.sy@samsung.com> 9 9 # Vinayak Holikatti <h.vinayak@samsung.com> 10 - 11 - config SCSI_UFSHCD 12 - tristate "Universal Flash Storage Controller Driver Core" 13 - depends on SCSI && SCSI_DMA 14 - select PM_DEVFREQ 15 - select DEVFREQ_GOV_SIMPLE_ONDEMAND 16 - select NLS 17 - help 18 - This selects the support for UFS devices in Linux, say Y and make 19 - sure that you know the name of your UFS host adapter (the card 20 - inside your computer that "speaks" the UFS protocol, also 21 - called UFS Host Controller), because you will be asked for it. 22 - The module will be called ufshcd. 23 - 24 - To compile this driver as a module, choose M here and read 25 - <file:Documentation/scsi/ufs.rst>. 26 - However, do not compile this as a module if your root file system 27 - (the one containing the directory /) is located on a UFS device. 28 - 29 - if SCSI_UFSHCD 30 10 31 11 config SCSI_UFSHCD_PCI 32 12 tristate "PCI bus based UFS Controller support" ··· 102 122 Selects this if you have TI platform with UFS controller. 103 123 If unsure, say N. 104 124 105 - config SCSI_UFS_BSG 106 - bool "Universal Flash Storage BSG device node" 107 - select BLK_DEV_BSGLIB 108 - help 109 - Universal Flash Storage (UFS) is SCSI transport specification for 110 - accessing flash storage on digital cameras, mobile phones and 111 - consumer electronic devices. 112 - A UFS controller communicates with a UFS device by exchanging 113 - UFS Protocol Information Units (UPIUs). 114 - UPIUs can not only be used as a transport layer for the SCSI protocol 115 - but are also used by the UFS native command set. 116 - This transport driver supports exchanging UFS protocol information units 117 - with a UFS device. See also the ufshcd driver, which is a SCSI driver 118 - that supports UFS devices. 119 - 120 - Select this if you need a bsg device node for your UFS controller. 121 - If unsure, say N. 122 - 123 125 config SCSI_UFS_EXYNOS 124 126 tristate "Exynos specific hooks to UFS controller platform driver" 125 127 depends on SCSI_UFSHCD_PLATFORM && (ARCH_EXYNOS || COMPILE_TEST) ··· 112 150 113 151 Select this if you have UFS host controller on Samsung Exynos SoC. 114 152 If unsure, say N. 115 - 116 - config SCSI_UFS_CRYPTO 117 - bool "UFS Crypto Engine Support" 118 - depends on BLK_INLINE_ENCRYPTION 119 - help 120 - Enable Crypto Engine Support in UFS. 121 - Enabling this makes it possible for the kernel to use the crypto 122 - capabilities of the UFS device (if present) to perform crypto 123 - operations on data being transferred to/from the device. 124 - 125 - config SCSI_UFS_HPB 126 - bool "Support UFS Host Performance Booster" 127 - help 128 - The UFS HPB feature improves random read performance. It caches 129 - L2P (logical to physical) map of UFS to host DRAM. The driver uses HPB 130 - read command by piggybacking physical page number for bypassing FTL (flash 131 - translation layer)'s L2P address translation. 132 - 133 - config SCSI_UFS_FAULT_INJECTION 134 - bool "UFS Fault Injection Support" 135 - depends on FAULT_INJECTION 136 - help 137 - Enable fault injection support in the UFS driver. This makes it easier 138 - to test the UFS error handler and abort handler. 139 - 140 - config SCSI_UFS_HWMON 141 - bool "UFS Temperature Notification" 142 - depends on SCSI_UFSHCD=HWMON || HWMON=y 143 - help 144 - This provides support for UFS hardware monitoring. If enabled, 145 - a hardware monitoring device will be created for the UFS device. 146 - 147 - If unsure, say N. 148 - 149 - endif
-12
drivers/scsi/ufs/Makefile drivers/ufs/host/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 - # UFSHCD makefile 3 - 4 - # The link order is important here. ufshcd-core must initialize 5 - # before vendor drivers. 6 - obj-$(CONFIG_SCSI_UFSHCD) += ufshcd-core.o 7 - ufshcd-core-y += ufshcd.o ufs-sysfs.o 8 - ufshcd-core-$(CONFIG_DEBUG_FS) += ufs-debugfs.o 9 - ufshcd-core-$(CONFIG_SCSI_UFS_BSG) += ufs_bsg.o 10 - ufshcd-core-$(CONFIG_SCSI_UFS_CRYPTO) += ufshcd-crypto.o 11 - ufshcd-core-$(CONFIG_SCSI_UFS_HPB) += ufshpb.o 12 - ufshcd-core-$(CONFIG_SCSI_UFS_FAULT_INJECTION) += ufs-fault-injection.o 13 - ufshcd-core-$(CONFIG_SCSI_UFS_HWMON) += ufs-hwmon.o 14 2 15 3 obj-$(CONFIG_SCSI_UFS_DWC_TC_PCI) += tc-dwc-g210-pci.o ufshcd-dwc.o tc-dwc-g210.o 16 4 obj-$(CONFIG_SCSI_UFS_DWC_TC_PLATFORM) += tc-dwc-g210-pltfrm.o ufshcd-dwc.o tc-dwc-g210.o
drivers/scsi/ufs/cdns-pltfrm.c drivers/ufs/host/cdns-pltfrm.c
+1 -1
drivers/scsi/ufs/tc-dwc-g210-pci.c drivers/ufs/host/tc-dwc-g210-pci.c
··· 7 7 * Authors: Joao Pinto <jpinto@synopsys.com> 8 8 */ 9 9 10 - #include "ufshcd.h" 10 + #include <ufs/ufshcd.h> 11 11 #include "ufshcd-dwc.h" 12 12 #include "tc-dwc-g210.h" 13 13
drivers/scsi/ufs/tc-dwc-g210-pltfrm.c drivers/ufs/host/tc-dwc-g210-pltfrm.c
+2 -2
drivers/scsi/ufs/tc-dwc-g210.c drivers/ufs/host/tc-dwc-g210.c
··· 9 9 10 10 #include <linux/module.h> 11 11 12 - #include "ufshcd.h" 13 - #include "unipro.h" 12 + #include <ufs/ufshcd.h> 13 + #include <ufs/unipro.h> 14 14 15 15 #include "ufshcd-dwc.h" 16 16 #include "ufshci-dwc.h"
drivers/scsi/ufs/tc-dwc-g210.h drivers/ufs/host/tc-dwc-g210.h
drivers/scsi/ufs/ti-j721e-ufs.c drivers/ufs/host/ti-j721e-ufs.c
+1 -1
drivers/scsi/ufs/ufs-debugfs.c drivers/ufs/core/ufs-debugfs.c
··· 4 4 #include <linux/debugfs.h> 5 5 6 6 #include "ufs-debugfs.h" 7 - #include "ufshcd.h" 7 + #include <ufs/ufshcd.h> 8 8 #include "ufshcd-priv.h" 9 9 10 10 static struct dentry *ufs_debugfs_root;
drivers/scsi/ufs/ufs-debugfs.h drivers/ufs/core/ufs-debugfs.h
+3 -3
drivers/scsi/ufs/ufs-exynos.c drivers/ufs/host/ufs-exynos.c
··· 18 18 #include <linux/platform_device.h> 19 19 #include <linux/regmap.h> 20 20 21 - #include "ufshcd.h" 21 + #include <ufs/ufshcd.h> 22 22 #include "ufshcd-pltfrm.h" 23 - #include "ufshci.h" 24 - #include "unipro.h" 23 + #include <ufs/ufshci.h> 24 + #include <ufs/unipro.h> 25 25 26 26 #include "ufs-exynos.h" 27 27
drivers/scsi/ufs/ufs-exynos.h drivers/ufs/host/ufs-exynos.h
drivers/scsi/ufs/ufs-fault-injection.c drivers/ufs/core/ufs-fault-injection.c
drivers/scsi/ufs/ufs-fault-injection.h drivers/ufs/core/ufs-fault-injection.h
+4 -4
drivers/scsi/ufs/ufs-hisi.c drivers/ufs/host/ufs-hisi.c
··· 15 15 #include <linux/platform_device.h> 16 16 #include <linux/reset.h> 17 17 18 - #include "ufshcd.h" 18 + #include <ufs/ufshcd.h> 19 19 #include "ufshcd-pltfrm.h" 20 - #include "unipro.h" 20 + #include <ufs/unipro.h> 21 21 #include "ufs-hisi.h" 22 - #include "ufshci.h" 23 - #include "ufs_quirks.h" 22 + #include <ufs/ufshci.h> 23 + #include <ufs/ufs_quirks.h> 24 24 25 25 static int ufs_hisi_check_hibern8(struct ufs_hba *hba) 26 26 {
drivers/scsi/ufs/ufs-hisi.h drivers/ufs/host/ufs-hisi.h
+1 -1
drivers/scsi/ufs/ufs-hwmon.c drivers/ufs/core/ufs-hwmon.c
··· 7 7 #include <linux/hwmon.h> 8 8 #include <linux/units.h> 9 9 10 - #include "ufshcd.h" 10 + #include <ufs/ufshcd.h> 11 11 #include "ufshcd-priv.h" 12 12 13 13 struct ufs_hwmon_data {
+1 -1
drivers/scsi/ufs/ufs-mediatek-trace.h drivers/ufs/host/ufs-mediatek-trace.h
··· 31 31 32 32 #undef TRACE_INCLUDE_PATH 33 33 #undef TRACE_INCLUDE_FILE 34 - #define TRACE_INCLUDE_PATH ../../drivers/scsi/ufs/ 34 + #define TRACE_INCLUDE_PATH ../../drivers/ufs/host 35 35 #define TRACE_INCLUDE_FILE ufs-mediatek-trace 36 36 #include <trace/define_trace.h>
+3 -3
drivers/scsi/ufs/ufs-mediatek.c drivers/ufs/host/ufs-mediatek.c
··· 21 21 #include <linux/sched/clock.h> 22 22 #include <linux/soc/mediatek/mtk_sip_svc.h> 23 23 24 - #include "ufshcd.h" 24 + #include <ufs/ufshcd.h> 25 25 #include "ufshcd-pltfrm.h" 26 - #include "ufs_quirks.h" 27 - #include "unipro.h" 26 + #include <ufs/ufs_quirks.h> 27 + #include <ufs/unipro.h> 28 28 #include "ufs-mediatek.h" 29 29 30 30 #define CREATE_TRACE_POINTS
drivers/scsi/ufs/ufs-mediatek.h drivers/ufs/host/ufs-mediatek.h
drivers/scsi/ufs/ufs-qcom-ice.c drivers/ufs/host/ufs-qcom-ice.c
+4 -4
drivers/scsi/ufs/ufs-qcom.c drivers/ufs/host/ufs-qcom.c
··· 15 15 #include <linux/reset-controller.h> 16 16 #include <linux/devfreq.h> 17 17 18 - #include "ufshcd.h" 18 + #include <ufs/ufshcd.h> 19 19 #include "ufshcd-pltfrm.h" 20 - #include "unipro.h" 20 + #include <ufs/unipro.h> 21 21 #include "ufs-qcom.h" 22 - #include "ufshci.h" 23 - #include "ufs_quirks.h" 22 + #include <ufs/ufshci.h> 23 + #include <ufs/ufs_quirks.h> 24 24 25 25 #define UFS_QCOM_DEFAULT_DBG_PRINT_EN \ 26 26 (UFS_QCOM_DBG_PRINT_REGS_EN | UFS_QCOM_DBG_PRINT_TEST_BUS_EN)
+1 -1
drivers/scsi/ufs/ufs-qcom.h drivers/ufs/host/ufs-qcom.h
··· 7 7 8 8 #include <linux/reset-controller.h> 9 9 #include <linux/reset.h> 10 - #include "ufshcd.h" 10 + #include <ufs/ufshcd.h> 11 11 12 12 #define MAX_UFS_QCOM_HOSTS 1 13 13 #define MAX_U32 (~(u32)0)
+1 -1
drivers/scsi/ufs/ufs-sysfs.c drivers/ufs/core/ufs-sysfs.c
··· 6 6 #include <linux/bitfield.h> 7 7 #include <asm/unaligned.h> 8 8 9 - #include "ufs.h" 9 + #include <ufs/ufs.h> 10 10 #include "ufs-sysfs.h" 11 11 #include "ufshcd-priv.h" 12 12
drivers/scsi/ufs/ufs-sysfs.h drivers/ufs/core/ufs-sysfs.h
drivers/scsi/ufs/ufs.h include/ufs/ufs.h
+1 -1
drivers/scsi/ufs/ufs_bsg.c drivers/ufs/core/ufs_bsg.c
··· 9 9 #include <scsi/scsi.h> 10 10 #include <scsi/scsi_host.h> 11 11 #include "ufs_bsg.h" 12 - #include "ufshcd.h" 12 + #include <ufs/ufshcd.h> 13 13 #include "ufshcd-priv.h" 14 14 15 15 static int ufs_bsg_get_query_desc_size(struct ufs_hba *hba, int *desc_len,
drivers/scsi/ufs/ufs_bsg.h drivers/ufs/core/ufs_bsg.h
drivers/scsi/ufs/ufs_quirks.h include/ufs/ufs_quirks.h
+1 -1
drivers/scsi/ufs/ufshcd-crypto.c drivers/ufs/core/ufshcd-crypto.c
··· 3 3 * Copyright 2019 Google LLC 4 4 */ 5 5 6 - #include "ufshcd.h" 6 + #include <ufs/ufshcd.h> 7 7 #include "ufshcd-crypto.h" 8 8 9 9 /* Blk-crypto modes supported by UFS crypto */
+2 -2
drivers/scsi/ufs/ufshcd-crypto.h drivers/ufs/core/ufshcd-crypto.h
··· 7 7 #define _UFSHCD_CRYPTO_H 8 8 9 9 #include <scsi/scsi_cmnd.h> 10 - #include "ufshcd.h" 10 + #include <ufs/ufshcd.h> 11 11 #include "ufshcd-priv.h" 12 - #include "ufshci.h" 12 + #include <ufs/ufshci.h> 13 13 14 14 #ifdef CONFIG_SCSI_UFS_CRYPTO 15 15
+2 -2
drivers/scsi/ufs/ufshcd-dwc.c drivers/ufs/host/ufshcd-dwc.c
··· 9 9 10 10 #include <linux/module.h> 11 11 12 - #include "ufshcd.h" 13 - #include "unipro.h" 12 + #include <ufs/ufshcd.h> 13 + #include <ufs/unipro.h> 14 14 15 15 #include "ufshcd-dwc.h" 16 16 #include "ufshci-dwc.h"
+1 -1
drivers/scsi/ufs/ufshcd-dwc.h drivers/ufs/host/ufshcd-dwc.h
··· 10 10 #ifndef _UFSHCD_DWC_H 11 11 #define _UFSHCD_DWC_H 12 12 13 - #include "ufshcd.h" 13 + #include <ufs/ufshcd.h> 14 14 15 15 struct ufshcd_dme_attr_val { 16 16 u32 attr_sel;
+1 -1
drivers/scsi/ufs/ufshcd-pci.c drivers/ufs/host/ufshcd-pci.c
··· 9 9 * Vinayak Holikatti <h.vinayak@samsung.com> 10 10 */ 11 11 12 - #include "ufshcd.h" 12 + #include <ufs/ufshcd.h> 13 13 #include <linux/delay.h> 14 14 #include <linux/module.h> 15 15 #include <linux/pci.h>
+2 -2
drivers/scsi/ufs/ufshcd-pltfrm.c drivers/ufs/host/ufshcd-pltfrm.c
··· 13 13 #include <linux/pm_runtime.h> 14 14 #include <linux/of.h> 15 15 16 - #include "ufshcd.h" 16 + #include <ufs/ufshcd.h> 17 17 #include "ufshcd-pltfrm.h" 18 - #include "unipro.h" 18 + #include <ufs/unipro.h> 19 19 20 20 #define UFSHCD_DEFAULT_LANES_PER_DIRECTION 2 21 21
+1 -1
drivers/scsi/ufs/ufshcd-pltfrm.h drivers/ufs/host/ufshcd-pltfrm.h
··· 5 5 #ifndef UFSHCD_PLTFRM_H_ 6 6 #define UFSHCD_PLTFRM_H_ 7 7 8 - #include "ufshcd.h" 8 + #include <ufs/ufshcd.h> 9 9 10 10 #define UFS_PWM_MODE 1 11 11 #define UFS_HS_MODE 2
+1 -1
drivers/scsi/ufs/ufshcd-priv.h drivers/ufs/core/ufshcd-priv.h
··· 4 4 #define _UFSHCD_PRIV_H_ 5 5 6 6 #include <linux/pm_runtime.h> 7 - #include "ufshcd.h" 7 + #include <ufs/ufshcd.h> 8 8 9 9 static inline bool ufshcd_is_user_access_allowed(struct ufs_hba *hba) 10 10 {
+3 -6
drivers/scsi/ufs/ufshcd.c drivers/ufs/core/ufshcd.c
··· 26 26 #include <scsi/scsi_driver.h> 27 27 #include <scsi/scsi_eh.h> 28 28 #include "ufshcd-priv.h" 29 - #include "ufs_quirks.h" 30 - #include "unipro.h" 29 + #include <ufs/ufs_quirks.h> 30 + #include <ufs/unipro.h> 31 31 #include "ufs-sysfs.h" 32 32 #include "ufs-debugfs.h" 33 33 #include "ufs-fault-injection.h" ··· 8445 8445 { 8446 8446 struct ufs_vreg_info *info = &hba->vreg_info; 8447 8447 8448 - if (info) 8449 - return ufshcd_get_vreg(hba->dev, info->vdd_hba); 8450 - 8451 - return 0; 8448 + return ufshcd_get_vreg(hba->dev, info->vdd_hba); 8452 8449 } 8453 8450 8454 8451 static int ufshcd_setup_clocks(struct ufs_hba *hba, bool on)
+4 -4
drivers/scsi/ufs/ufshcd.h include/ufs/ufshcd.h
··· 18 18 #include <linux/devfreq.h> 19 19 #include <linux/pm_runtime.h> 20 20 #include <scsi/scsi_device.h> 21 - #include "unipro.h" 22 - #include "ufs.h" 23 - #include "ufs_quirks.h" 24 - #include "ufshci.h" 21 + #include <ufs/unipro.h> 22 + #include <ufs/ufs.h> 23 + #include <ufs/ufs_quirks.h> 24 + #include <ufs/ufshci.h> 25 25 26 26 #define UFSHCD "ufshcd" 27 27
drivers/scsi/ufs/ufshci-dwc.h drivers/ufs/host/ufshci-dwc.h
drivers/scsi/ufs/ufshci.h include/ufs/ufshci.h
+1 -1
drivers/scsi/ufs/ufshpb.c drivers/ufs/core/ufshpb.c
··· 17 17 18 18 #include "ufshcd-priv.h" 19 19 #include "ufshpb.h" 20 - #include "../sd.h" 20 + #include "../../scsi/sd.h" 21 21 22 22 #define ACTIVATION_THRESHOLD 8 /* 8 IOs */ 23 23 #define READ_TO_MS 1000
drivers/scsi/ufs/ufshpb.h drivers/ufs/core/ufshpb.h
drivers/scsi/ufs/unipro.h include/ufs/unipro.h
+30
drivers/ufs/Kconfig
··· 1 + # SPDX-License-Identifier: GPL-2.0-only 2 + # 3 + # UFS subsystem configuration 4 + # 5 + 6 + menuconfig SCSI_UFSHCD 7 + tristate "Universal Flash Storage Controller" 8 + depends on SCSI && SCSI_DMA 9 + select PM_DEVFREQ 10 + select DEVFREQ_GOV_SIMPLE_ONDEMAND 11 + select NLS 12 + help 13 + Enables support for UFS (Universal Flash Storage) host controllers. 14 + A UFS host controller is an electronic component that is able to 15 + communicate with a UFS card. UFS host controllers occur in 16 + smartphones, laptops, digital cameras and also in cars. 17 + The kernel module will be called ufshcd. 18 + 19 + To compile this driver as a module, choose M here and read 20 + <file:Documentation/scsi/ufs.rst>. 21 + However, do not compile this as a module if your root file system 22 + (the one containing the directory /) is located on a UFS device. 23 + 24 + if SCSI_UFSHCD 25 + 26 + source "drivers/ufs/core/Kconfig" 27 + 28 + source "drivers/ufs/host/Kconfig" 29 + 30 + endif
+5
drivers/ufs/Makefile
··· 1 + # SPDX-License-Identifier: GPL-2.0 2 + 3 + # The link order is important here. ufshcd-core must initialize 4 + # before vendor drivers. 5 + obj-$(CONFIG_SCSI_UFSHCD) += core/ host/
+60
drivers/ufs/core/Kconfig
··· 1 + # SPDX-License-Identifier: GPL-2.0+ 2 + # 3 + # Kernel configuration file for the UFS Host Controller core. 4 + # 5 + # Copyright (C) 2011-2013 Samsung India Software Operations 6 + # 7 + # Authors: 8 + # Santosh Yaraganavi <santosh.sy@samsung.com> 9 + # Vinayak Holikatti <h.vinayak@samsung.com> 10 + 11 + config SCSI_UFS_BSG 12 + bool "Universal Flash Storage BSG device node" 13 + select BLK_DEV_BSGLIB 14 + help 15 + Universal Flash Storage (UFS) is SCSI transport specification for 16 + accessing flash storage on digital cameras, mobile phones and 17 + consumer electronic devices. 18 + A UFS controller communicates with a UFS device by exchanging 19 + UFS Protocol Information Units (UPIUs). 20 + UPIUs can not only be used as a transport layer for the SCSI protocol 21 + but are also used by the UFS native command set. 22 + This transport driver supports exchanging UFS protocol information units 23 + with a UFS device. See also the ufshcd driver, which is a SCSI driver 24 + that supports UFS devices. 25 + 26 + Select this if you need a bsg device node for your UFS controller. 27 + If unsure, say N. 28 + 29 + config SCSI_UFS_CRYPTO 30 + bool "UFS Crypto Engine Support" 31 + depends on BLK_INLINE_ENCRYPTION 32 + help 33 + Enable Crypto Engine Support in UFS. 34 + Enabling this makes it possible for the kernel to use the crypto 35 + capabilities of the UFS device (if present) to perform crypto 36 + operations on data being transferred to/from the device. 37 + 38 + config SCSI_UFS_HPB 39 + bool "Support UFS Host Performance Booster" 40 + help 41 + The UFS HPB feature improves random read performance. It caches 42 + L2P (logical to physical) map of UFS to host DRAM. The driver uses HPB 43 + read command by piggybacking physical page number for bypassing FTL (flash 44 + translation layer)'s L2P address translation. 45 + 46 + config SCSI_UFS_FAULT_INJECTION 47 + bool "UFS Fault Injection Support" 48 + depends on FAULT_INJECTION 49 + help 50 + Enable fault injection support in the UFS driver. This makes it easier 51 + to test the UFS error handler and abort handler. 52 + 53 + config SCSI_UFS_HWMON 54 + bool "UFS Temperature Notification" 55 + depends on SCSI_UFSHCD=HWMON || HWMON=y 56 + help 57 + This provides support for UFS hardware monitoring. If enabled, 58 + a hardware monitoring device will be created for the UFS device. 59 + 60 + If unsure, say N.
+10
drivers/ufs/core/Makefile
··· 1 + # SPDX-License-Identifier: GPL-2.0 2 + 3 + obj-$(CONFIG_SCSI_UFSHCD) += ufshcd-core.o 4 + ufshcd-core-y += ufshcd.o ufs-sysfs.o 5 + ufshcd-core-$(CONFIG_DEBUG_FS) += ufs-debugfs.o 6 + ufshcd-core-$(CONFIG_SCSI_UFS_BSG) += ufs_bsg.o 7 + ufshcd-core-$(CONFIG_SCSI_UFS_CRYPTO) += ufshcd-crypto.o 8 + ufshcd-core-$(CONFIG_SCSI_UFS_HPB) += ufshpb.o 9 + ufshcd-core-$(CONFIG_SCSI_UFS_FAULT_INJECTION) += ufs-fault-injection.o 10 + ufshcd-core-$(CONFIG_SCSI_UFS_HWMON) += ufs-hwmon.o
+14
include/linux/nvme-fc-driver.h
··· 564 564 void *lsreqbuf, u32 lsreqbuf_len); 565 565 566 566 567 + /* 568 + * Routine called to get the appid field associated with request by the lldd 569 + * 570 + * If the return value is NULL : the user/libvirt has not set the appid to VM 571 + * If the return value is non-zero: Returns the appid associated with VM 572 + * 573 + * @req: IO request from nvme fc to driver 574 + */ 575 + char *nvme_fc_io_getuuid(struct nvmefc_fcp_req *req); 567 576 568 577 /* 569 578 * *************** LLDD FC-NVME Target/Subsystem API *************** ··· 1057 1048 1058 1049 void nvmet_fc_rcv_fcp_abort(struct nvmet_fc_target_port *tgtport, 1059 1050 struct nvmefc_tgt_fcp_req *fcpreq); 1051 + /* 1052 + * add a define, visible to the compiler, that indicates support 1053 + * for feature. Allows for conditional compilation in LLDDs. 1054 + */ 1055 + #define NVME_FC_FEAT_UUID 0x0001 1060 1056 1061 1057 #endif /* _NVME_FC_DRIVER_H */