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

Merge branch '6.13/scsi-fixes' into 6.14/scsi-staging

Pull in fixes branch to resolve merge conflict in ufs-qcom.c.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

+343 -775
+1 -1
drivers/message/fusion/mptfc.c
··· 137 137 * Supported hardware 138 138 */ 139 139 140 - static struct pci_device_id mptfc_pci_table[] = { 140 + static const struct pci_device_id mptfc_pci_table[] = { 141 141 { PCI_VENDOR_ID_LSI_LOGIC, MPI_MANUFACTPAGE_DEVICEID_FC909, 142 142 PCI_ANY_ID, PCI_ANY_ID }, 143 143 { PCI_VENDOR_ID_LSI_LOGIC, MPI_MANUFACTPAGE_DEVICEID_FC919,
+1 -1
drivers/message/fusion/mptsas.c
··· 5377 5377 mptscsih_remove(pdev); 5378 5378 } 5379 5379 5380 - static struct pci_device_id mptsas_pci_table[] = { 5380 + static const struct pci_device_id mptsas_pci_table[] = { 5381 5381 { PCI_VENDOR_ID_LSI_LOGIC, MPI_MANUFACTPAGE_DEVID_SAS1064, 5382 5382 PCI_ANY_ID, PCI_ANY_ID }, 5383 5383 { PCI_VENDOR_ID_LSI_LOGIC, MPI_MANUFACTPAGE_DEVID_SAS1068,
+1 -1
drivers/message/fusion/mptspi.c
··· 1239 1239 * Supported hardware 1240 1240 */ 1241 1241 1242 - static struct pci_device_id mptspi_pci_table[] = { 1242 + static const struct pci_device_id mptspi_pci_table[] = { 1243 1243 { PCI_VENDOR_ID_LSI_LOGIC, MPI_MANUFACTPAGE_DEVID_53C1030, 1244 1244 PCI_ANY_ID, PCI_ANY_ID }, 1245 1245 { PCI_VENDOR_ID_ATTO, MPI_MANUFACTPAGE_DEVID_53C1030,
-482
drivers/scsi/bfa/bfa_fcbuild.c
··· 220 220 } 221 221 222 222 u16 223 - fc_flogi_build(struct fchs_s *fchs, struct fc_logi_s *flogi, u32 s_id, 224 - u16 ox_id, wwn_t port_name, wwn_t node_name, u16 pdu_size, 225 - u8 set_npiv, u8 set_auth, u16 local_bb_credits) 226 - { 227 - u32 d_id = bfa_hton3b(FC_FABRIC_PORT); 228 - __be32 *vvl_info; 229 - 230 - memcpy(flogi, &plogi_tmpl, sizeof(struct fc_logi_s)); 231 - 232 - flogi->els_cmd.els_code = FC_ELS_FLOGI; 233 - fc_els_req_build(fchs, d_id, s_id, ox_id); 234 - 235 - flogi->csp.rxsz = flogi->class3.rxsz = cpu_to_be16(pdu_size); 236 - flogi->port_name = port_name; 237 - flogi->node_name = node_name; 238 - 239 - /* 240 - * Set the NPIV Capability Bit ( word 1, bit 31) of Common 241 - * Service Parameters. 242 - */ 243 - flogi->csp.ciro = set_npiv; 244 - 245 - /* set AUTH capability */ 246 - flogi->csp.security = set_auth; 247 - 248 - flogi->csp.bbcred = cpu_to_be16(local_bb_credits); 249 - 250 - /* Set brcd token in VVL */ 251 - vvl_info = (u32 *)&flogi->vvl[0]; 252 - 253 - /* set the flag to indicate the presence of VVL */ 254 - flogi->csp.npiv_supp = 1; /* @todo. field name is not correct */ 255 - vvl_info[0] = cpu_to_be32(FLOGI_VVL_BRCD); 256 - 257 - return sizeof(struct fc_logi_s); 258 - } 259 - 260 - u16 261 223 fc_flogi_acc_build(struct fchs_s *fchs, struct fc_logi_s *flogi, u32 s_id, 262 224 __be16 ox_id, wwn_t port_name, wwn_t node_name, 263 225 u16 pdu_size, u16 local_bb_credits, u8 bb_scn) ··· 242 280 } 243 281 244 282 u16 245 - fc_fdisc_build(struct fchs_s *fchs, struct fc_logi_s *flogi, u32 s_id, 246 - u16 ox_id, wwn_t port_name, wwn_t node_name, u16 pdu_size) 247 - { 248 - u32 d_id = bfa_hton3b(FC_FABRIC_PORT); 249 - 250 - memcpy(flogi, &plogi_tmpl, sizeof(struct fc_logi_s)); 251 - 252 - flogi->els_cmd.els_code = FC_ELS_FDISC; 253 - fc_els_req_build(fchs, d_id, s_id, ox_id); 254 - 255 - flogi->csp.rxsz = flogi->class3.rxsz = cpu_to_be16(pdu_size); 256 - flogi->port_name = port_name; 257 - flogi->node_name = node_name; 258 - 259 - return sizeof(struct fc_logi_s); 260 - } 261 - 262 - u16 263 283 fc_plogi_build(struct fchs_s *fchs, void *pld, u32 d_id, u32 s_id, 264 284 u16 ox_id, wwn_t port_name, wwn_t node_name, 265 285 u16 pdu_size, u16 bb_cr) ··· 257 313 { 258 314 return fc_plogi_x_build(fchs, pld, d_id, s_id, ox_id, port_name, 259 315 node_name, pdu_size, bb_cr, FC_ELS_ACC); 260 - } 261 - 262 - enum fc_parse_status 263 - fc_plogi_rsp_parse(struct fchs_s *fchs, int len, wwn_t port_name) 264 - { 265 - struct fc_els_cmd_s *els_cmd = (struct fc_els_cmd_s *) (fchs + 1); 266 - struct fc_logi_s *plogi; 267 - struct fc_ls_rjt_s *ls_rjt; 268 - 269 - switch (els_cmd->els_code) { 270 - case FC_ELS_LS_RJT: 271 - ls_rjt = (struct fc_ls_rjt_s *) (fchs + 1); 272 - if (ls_rjt->reason_code == FC_LS_RJT_RSN_LOGICAL_BUSY) 273 - return FC_PARSE_BUSY; 274 - else 275 - return FC_PARSE_FAILURE; 276 - case FC_ELS_ACC: 277 - plogi = (struct fc_logi_s *) (fchs + 1); 278 - if (len < sizeof(struct fc_logi_s)) 279 - return FC_PARSE_FAILURE; 280 - 281 - if (!wwn_is_equal(plogi->port_name, port_name)) 282 - return FC_PARSE_FAILURE; 283 - 284 - if (!plogi->class3.class_valid) 285 - return FC_PARSE_FAILURE; 286 - 287 - if (be16_to_cpu(plogi->class3.rxsz) < (FC_MIN_PDUSZ)) 288 - return FC_PARSE_FAILURE; 289 - 290 - return FC_PARSE_OK; 291 - default: 292 - return FC_PARSE_FAILURE; 293 - } 294 316 } 295 317 296 318 enum fc_parse_status ··· 331 421 return FC_PARSE_OK; 332 422 } 333 423 334 - enum fc_parse_status 335 - fc_prli_parse(struct fc_prli_s *prli) 336 - { 337 - if (prli->parampage.type != FC_TYPE_FCP) 338 - return FC_PARSE_FAILURE; 339 - 340 - if (!prli->parampage.imagepair) 341 - return FC_PARSE_FAILURE; 342 - 343 - if (!prli->parampage.servparams.initiator) 344 - return FC_PARSE_FAILURE; 345 - 346 - return FC_PARSE_OK; 347 - } 348 - 349 424 u16 350 425 fc_logo_build(struct fchs_s *fchs, struct fc_logo_s *logo, u32 d_id, u32 s_id, 351 426 u16 ox_id, wwn_t port_name) ··· 399 504 return FC_PARSE_FAILURE; 400 505 401 506 return FC_PARSE_OK; 402 - } 403 - 404 - enum fc_parse_status 405 - fc_adisc_parse(struct fchs_s *fchs, void *pld, u32 host_dap, wwn_t node_name, 406 - wwn_t port_name) 407 - { 408 - struct fc_adisc_s *adisc = (struct fc_adisc_s *) pld; 409 - 410 - if (adisc->els_cmd.els_code != FC_ELS_ACC) 411 - return FC_PARSE_FAILURE; 412 - 413 - if ((adisc->nport_id == (host_dap)) 414 - && wwn_is_equal(adisc->orig_port_name, port_name) 415 - && wwn_is_equal(adisc->orig_node_name, node_name)) 416 - return FC_PARSE_OK; 417 - 418 - return FC_PARSE_FAILURE; 419 - } 420 - 421 - enum fc_parse_status 422 - fc_pdisc_parse(struct fchs_s *fchs, wwn_t node_name, wwn_t port_name) 423 - { 424 - struct fc_logi_s *pdisc = (struct fc_logi_s *) (fchs + 1); 425 - 426 - if (pdisc->class3.class_valid != 1) 427 - return FC_PARSE_FAILURE; 428 - 429 - if ((be16_to_cpu(pdisc->class3.rxsz) < 430 - (FC_MIN_PDUSZ - sizeof(struct fchs_s))) 431 - || (pdisc->class3.rxsz == 0)) 432 - return FC_PARSE_FAILURE; 433 - 434 - if (!wwn_is_equal(pdisc->port_name, port_name)) 435 - return FC_PARSE_FAILURE; 436 - 437 - if (!wwn_is_equal(pdisc->node_name, node_name)) 438 - return FC_PARSE_FAILURE; 439 - 440 - return FC_PARSE_OK; 441 - } 442 - 443 - u16 444 - fc_abts_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u16 ox_id) 445 - { 446 - memcpy(fchs, &fc_bls_req_tmpl, sizeof(struct fchs_s)); 447 - fchs->cat_info = FC_CAT_ABTS; 448 - fchs->d_id = (d_id); 449 - fchs->s_id = (s_id); 450 - fchs->ox_id = cpu_to_be16(ox_id); 451 - 452 - return sizeof(struct fchs_s); 453 - } 454 - 455 - enum fc_parse_status 456 - fc_abts_rsp_parse(struct fchs_s *fchs, int len) 457 - { 458 - if ((fchs->cat_info == FC_CAT_BA_ACC) 459 - || (fchs->cat_info == FC_CAT_BA_RJT)) 460 - return FC_PARSE_OK; 461 - 462 - return FC_PARSE_FAILURE; 463 - } 464 - 465 - u16 466 - fc_rrq_build(struct fchs_s *fchs, struct fc_rrq_s *rrq, u32 d_id, u32 s_id, 467 - u16 ox_id, u16 rrq_oxid) 468 - { 469 - fc_els_req_build(fchs, d_id, s_id, ox_id); 470 - 471 - /* 472 - * build rrq payload 473 - */ 474 - memcpy(rrq, &rrq_tmpl, sizeof(struct fc_rrq_s)); 475 - rrq->s_id = (s_id); 476 - rrq->ox_id = cpu_to_be16(rrq_oxid); 477 - rrq->rx_id = FC_RXID_ANY; 478 - 479 - return sizeof(struct fc_rrq_s); 480 507 } 481 508 482 509 u16 ··· 476 659 } 477 660 478 661 u16 479 - fc_tprlo_acc_build(struct fchs_s *fchs, struct fc_tprlo_acc_s *tprlo_acc, 480 - u32 d_id, u32 s_id, __be16 ox_id, int num_pages) 481 - { 482 - int page; 483 - 484 - fc_els_rsp_build(fchs, d_id, s_id, ox_id); 485 - 486 - memset(tprlo_acc, 0, (num_pages * 16) + 4); 487 - tprlo_acc->command = FC_ELS_ACC; 488 - 489 - tprlo_acc->page_len = 0x10; 490 - tprlo_acc->payload_len = cpu_to_be16((num_pages * 16) + 4); 491 - 492 - for (page = 0; page < num_pages; page++) { 493 - tprlo_acc->tprlo_acc_params[page].opa_valid = 0; 494 - tprlo_acc->tprlo_acc_params[page].rpa_valid = 0; 495 - tprlo_acc->tprlo_acc_params[page].fc4type_csp = FC_TYPE_FCP; 496 - tprlo_acc->tprlo_acc_params[page].orig_process_assc = 0; 497 - tprlo_acc->tprlo_acc_params[page].resp_process_assc = 0; 498 - } 499 - return be16_to_cpu(tprlo_acc->payload_len); 500 - } 501 - 502 - u16 503 662 fc_prlo_acc_build(struct fchs_s *fchs, struct fc_prlo_acc_s *prlo_acc, u32 d_id, 504 663 u32 s_id, __be16 ox_id, int num_pages) 505 664 { ··· 497 704 } 498 705 499 706 return be16_to_cpu(prlo_acc->payload_len); 500 - } 501 - 502 - u16 503 - fc_rnid_build(struct fchs_s *fchs, struct fc_rnid_cmd_s *rnid, u32 d_id, 504 - u32 s_id, u16 ox_id, u32 data_format) 505 - { 506 - fc_els_req_build(fchs, d_id, s_id, ox_id); 507 - 508 - memset(rnid, 0, sizeof(struct fc_rnid_cmd_s)); 509 - 510 - rnid->els_cmd.els_code = FC_ELS_RNID; 511 - rnid->node_id_data_format = data_format; 512 - 513 - return sizeof(struct fc_rnid_cmd_s); 514 707 } 515 708 516 709 u16 ··· 525 746 sizeof(struct fc_rnid_general_topology_data_s); 526 747 } 527 748 528 - } 529 - 530 - u16 531 - fc_rpsc_build(struct fchs_s *fchs, struct fc_rpsc_cmd_s *rpsc, u32 d_id, 532 - u32 s_id, u16 ox_id) 533 - { 534 - fc_els_req_build(fchs, d_id, s_id, ox_id); 535 - 536 - memset(rpsc, 0, sizeof(struct fc_rpsc_cmd_s)); 537 - 538 - rpsc->els_cmd.els_code = FC_ELS_RPSC; 539 - return sizeof(struct fc_rpsc_cmd_s); 540 749 } 541 750 542 751 u16 ··· 566 799 cpu_to_be16(oper_speed->port_op_speed); 567 800 568 801 return sizeof(struct fc_rpsc_acc_s); 569 - } 570 - 571 - u16 572 - fc_pdisc_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u16 ox_id, 573 - wwn_t port_name, wwn_t node_name, u16 pdu_size) 574 - { 575 - struct fc_logi_s *pdisc = (struct fc_logi_s *) (fchs + 1); 576 - 577 - memcpy(pdisc, &plogi_tmpl, sizeof(struct fc_logi_s)); 578 - 579 - pdisc->els_cmd.els_code = FC_ELS_PDISC; 580 - fc_els_req_build(fchs, d_id, s_id, ox_id); 581 - 582 - pdisc->csp.rxsz = pdisc->class3.rxsz = cpu_to_be16(pdu_size); 583 - pdisc->port_name = port_name; 584 - pdisc->node_name = node_name; 585 - 586 - return sizeof(struct fc_logi_s); 587 - } 588 - 589 - u16 590 - fc_pdisc_rsp_parse(struct fchs_s *fchs, int len, wwn_t port_name) 591 - { 592 - struct fc_logi_s *pdisc = (struct fc_logi_s *) (fchs + 1); 593 - 594 - if (len < sizeof(struct fc_logi_s)) 595 - return FC_PARSE_LEN_INVAL; 596 - 597 - if (pdisc->els_cmd.els_code != FC_ELS_ACC) 598 - return FC_PARSE_ACC_INVAL; 599 - 600 - if (!wwn_is_equal(pdisc->port_name, port_name)) 601 - return FC_PARSE_PWWN_NOT_EQUAL; 602 - 603 - if (!pdisc->class3.class_valid) 604 - return FC_PARSE_NWWN_NOT_EQUAL; 605 - 606 - if (be16_to_cpu(pdisc->class3.rxsz) < (FC_MIN_PDUSZ)) 607 - return FC_PARSE_RXSZ_INVAL; 608 - 609 - return FC_PARSE_OK; 610 - } 611 - 612 - u16 613 - fc_prlo_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u16 ox_id, 614 - int num_pages) 615 - { 616 - struct fc_prlo_s *prlo = (struct fc_prlo_s *) (fchs + 1); 617 - int page; 618 - 619 - fc_els_req_build(fchs, d_id, s_id, ox_id); 620 - memset(prlo, 0, (num_pages * 16) + 4); 621 - prlo->command = FC_ELS_PRLO; 622 - prlo->page_len = 0x10; 623 - prlo->payload_len = cpu_to_be16((num_pages * 16) + 4); 624 - 625 - for (page = 0; page < num_pages; page++) { 626 - prlo->prlo_params[page].type = FC_TYPE_FCP; 627 - prlo->prlo_params[page].opa_valid = 0; 628 - prlo->prlo_params[page].rpa_valid = 0; 629 - prlo->prlo_params[page].orig_process_assc = 0; 630 - prlo->prlo_params[page].resp_process_assc = 0; 631 - } 632 - 633 - return be16_to_cpu(prlo->payload_len); 634 - } 635 - 636 - u16 637 - fc_tprlo_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u16 ox_id, 638 - int num_pages, enum fc_tprlo_type tprlo_type, u32 tpr_id) 639 - { 640 - struct fc_tprlo_s *tprlo = (struct fc_tprlo_s *) (fchs + 1); 641 - int page; 642 - 643 - fc_els_req_build(fchs, d_id, s_id, ox_id); 644 - memset(tprlo, 0, (num_pages * 16) + 4); 645 - tprlo->command = FC_ELS_TPRLO; 646 - tprlo->page_len = 0x10; 647 - tprlo->payload_len = cpu_to_be16((num_pages * 16) + 4); 648 - 649 - for (page = 0; page < num_pages; page++) { 650 - tprlo->tprlo_params[page].type = FC_TYPE_FCP; 651 - tprlo->tprlo_params[page].opa_valid = 0; 652 - tprlo->tprlo_params[page].rpa_valid = 0; 653 - tprlo->tprlo_params[page].orig_process_assc = 0; 654 - tprlo->tprlo_params[page].resp_process_assc = 0; 655 - if (tprlo_type == FC_GLOBAL_LOGO) { 656 - tprlo->tprlo_params[page].global_process_logout = 1; 657 - } else if (tprlo_type == FC_TPR_LOGO) { 658 - tprlo->tprlo_params[page].tpo_nport_valid = 1; 659 - tprlo->tprlo_params[page].tpo_nport_id = (tpr_id); 660 - } 661 - } 662 - 663 - return be16_to_cpu(tprlo->payload_len); 664 - } 665 - 666 - u16 667 - fc_ba_rjt_build(struct fchs_s *fchs, u32 d_id, u32 s_id, __be16 ox_id, 668 - u32 reason_code, u32 reason_expl) 669 - { 670 - struct fc_ba_rjt_s *ba_rjt = (struct fc_ba_rjt_s *) (fchs + 1); 671 - 672 - fc_bls_rsp_build(fchs, d_id, s_id, ox_id); 673 - 674 - fchs->cat_info = FC_CAT_BA_RJT; 675 - ba_rjt->reason_code = reason_code; 676 - ba_rjt->reason_expl = reason_expl; 677 - return sizeof(struct fc_ba_rjt_s); 678 802 } 679 803 680 804 static void ··· 632 974 } 633 975 634 976 u16 635 - fc_gnnid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id, 636 - u32 port_id) 637 - { 638 - struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; 639 - fcgs_gnnid_req_t *gnnid = (fcgs_gnnid_req_t *) (cthdr + 1); 640 - u32 d_id = bfa_hton3b(FC_NAME_SERVER); 641 - 642 - fc_gs_fchdr_build(fchs, d_id, s_id, ox_id); 643 - fc_gs_cthdr_build(cthdr, s_id, GS_GNN_ID); 644 - 645 - memset(gnnid, 0, sizeof(fcgs_gnnid_req_t)); 646 - gnnid->dap = port_id; 647 - return sizeof(fcgs_gnnid_req_t) + sizeof(struct ct_hdr_s); 648 - } 649 - 650 - u16 651 - fc_ct_rsp_parse(struct ct_hdr_s *cthdr) 652 - { 653 - if (be16_to_cpu(cthdr->cmd_rsp_code) != CT_RSP_ACCEPT) { 654 - if (cthdr->reason_code == CT_RSN_LOGICAL_BUSY) 655 - return FC_PARSE_BUSY; 656 - else 657 - return FC_PARSE_FAILURE; 658 - } 659 - 660 - return FC_PARSE_OK; 661 - } 662 - 663 - u16 664 977 fc_gs_rjt_build(struct fchs_s *fchs, struct ct_hdr_s *cthdr, 665 978 u32 d_id, u32 s_id, u16 ox_id, u8 reason_code, 666 979 u8 reason_code_expl) ··· 664 1035 } 665 1036 666 1037 u16 667 - fc_rscn_build(struct fchs_s *fchs, struct fc_rscn_pl_s *rscn, 668 - u32 s_id, u16 ox_id) 669 - { 670 - u32 d_id = bfa_hton3b(FC_FABRIC_CONTROLLER); 671 - u16 payldlen; 672 - 673 - fc_els_req_build(fchs, d_id, s_id, ox_id); 674 - rscn->command = FC_ELS_RSCN; 675 - rscn->pagelen = sizeof(rscn->event[0]); 676 - 677 - payldlen = sizeof(u32) + rscn->pagelen; 678 - rscn->payldlen = cpu_to_be16(payldlen); 679 - 680 - rscn->event[0].format = FC_RSCN_FORMAT_PORTID; 681 - rscn->event[0].portid = s_id; 682 - 683 - return struct_size(rscn, event, 1); 684 - } 685 - 686 - u16 687 1038 fc_rftid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id, 688 1039 enum bfa_lport_role roles) 689 1040 { ··· 683 1074 index = FC_TYPE_FCP >> 5; 684 1075 type_value = 1 << (FC_TYPE_FCP % 32); 685 1076 rftid->fc4_type[index] = cpu_to_be32(type_value); 686 - 687 - return sizeof(struct fcgs_rftid_req_s) + sizeof(struct ct_hdr_s); 688 - } 689 - 690 - u16 691 - fc_rftid_build_sol(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id, 692 - u8 *fc4_bitmap, u32 bitmap_size) 693 - { 694 - struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; 695 - struct fcgs_rftid_req_s *rftid = (struct fcgs_rftid_req_s *)(cthdr + 1); 696 - u32 d_id = bfa_hton3b(FC_NAME_SERVER); 697 - 698 - fc_gs_fchdr_build(fchs, d_id, s_id, ox_id); 699 - fc_gs_cthdr_build(cthdr, s_id, GS_RFT_ID); 700 - 701 - memset(rftid, 0, sizeof(struct fcgs_rftid_req_s)); 702 - 703 - rftid->dap = s_id; 704 - memcpy((void *)rftid->fc4_type, (void *)fc4_bitmap, 705 - (bitmap_size < 32 ? bitmap_size : 32)); 706 1077 707 1078 return sizeof(struct fcgs_rftid_req_s) + sizeof(struct ct_hdr_s); 708 1079 } ··· 771 1182 } 772 1183 773 1184 u16 774 - fc_rpnid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u32 port_id, 775 - wwn_t port_name) 776 - { 777 - struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; 778 - struct fcgs_rpnid_req_s *rpnid = (struct fcgs_rpnid_req_s *)(cthdr + 1); 779 - u32 d_id = bfa_hton3b(FC_NAME_SERVER); 780 - 781 - fc_gs_fchdr_build(fchs, d_id, s_id, 0); 782 - fc_gs_cthdr_build(cthdr, s_id, GS_RPN_ID); 783 - 784 - memset(rpnid, 0, sizeof(struct fcgs_rpnid_req_s)); 785 - rpnid->port_id = port_id; 786 - rpnid->port_name = port_name; 787 - 788 - return sizeof(struct fcgs_rpnid_req_s) + sizeof(struct ct_hdr_s); 789 - } 790 - 791 - u16 792 1185 fc_rnnid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u32 port_id, 793 1186 wwn_t node_name) 794 1187 { ··· 786 1215 rnnid->node_name = node_name; 787 1216 788 1217 return sizeof(struct fcgs_rnnid_req_s) + sizeof(struct ct_hdr_s); 789 - } 790 - 791 - u16 792 - fc_rcsid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u32 port_id, 793 - u32 cos) 794 - { 795 - struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; 796 - struct fcgs_rcsid_req_s *rcsid = 797 - (struct fcgs_rcsid_req_s *) (cthdr + 1); 798 - u32 d_id = bfa_hton3b(FC_NAME_SERVER); 799 - 800 - fc_gs_fchdr_build(fchs, d_id, s_id, 0); 801 - fc_gs_cthdr_build(cthdr, s_id, GS_RCS_ID); 802 - 803 - memset(rcsid, 0, sizeof(struct fcgs_rcsid_req_s)); 804 - rcsid->port_id = port_id; 805 - rcsid->cos = cos; 806 - 807 - return sizeof(struct fcgs_rcsid_req_s) + sizeof(struct ct_hdr_s); 808 - } 809 - 810 - u16 811 - fc_rptid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u32 port_id, 812 - u8 port_type) 813 - { 814 - struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; 815 - struct fcgs_rptid_req_s *rptid = (struct fcgs_rptid_req_s *)(cthdr + 1); 816 - u32 d_id = bfa_hton3b(FC_NAME_SERVER); 817 - 818 - fc_gs_fchdr_build(fchs, d_id, s_id, 0); 819 - fc_gs_cthdr_build(cthdr, s_id, GS_RPT_ID); 820 - 821 - memset(rptid, 0, sizeof(struct fcgs_rptid_req_s)); 822 - rptid->port_id = port_id; 823 - rptid->port_type = port_type; 824 - 825 - return sizeof(struct fcgs_rptid_req_s) + sizeof(struct ct_hdr_s); 826 - } 827 - 828 - u16 829 - fc_ganxt_build(struct fchs_s *fchs, void *pyld, u32 s_id, u32 port_id) 830 - { 831 - struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; 832 - struct fcgs_ganxt_req_s *ganxt = (struct fcgs_ganxt_req_s *)(cthdr + 1); 833 - u32 d_id = bfa_hton3b(FC_NAME_SERVER); 834 - 835 - fc_gs_fchdr_build(fchs, d_id, s_id, 0); 836 - fc_gs_cthdr_build(cthdr, s_id, GS_GA_NXT); 837 - 838 - memset(ganxt, 0, sizeof(struct fcgs_ganxt_req_s)); 839 - ganxt->port_id = port_id; 840 - 841 - return sizeof(struct ct_hdr_s) + sizeof(struct fcgs_ganxt_req_s); 842 1218 } 843 1219 844 1220 /*
-72
drivers/scsi/bfa/bfa_fcbuild.h
··· 127 127 128 128 void fcbuild_init(void); 129 129 130 - u16 fc_flogi_build(struct fchs_s *fchs, struct fc_logi_s *flogi, 131 - u32 s_id, u16 ox_id, wwn_t port_name, wwn_t node_name, 132 - u16 pdu_size, u8 set_npiv, u8 set_auth, 133 - u16 local_bb_credits); 134 - 135 - u16 fc_fdisc_build(struct fchs_s *buf, struct fc_logi_s *flogi, u32 s_id, 136 - u16 ox_id, wwn_t port_name, wwn_t node_name, 137 - u16 pdu_size); 138 - 139 130 u16 fc_flogi_acc_build(struct fchs_s *fchs, struct fc_logi_s *flogi, 140 131 u32 s_id, __be16 ox_id, 141 132 wwn_t port_name, wwn_t node_name, ··· 139 148 140 149 enum fc_parse_status fc_plogi_parse(struct fchs_s *fchs); 141 150 142 - u16 fc_abts_build(struct fchs_s *buf, u32 d_id, u32 s_id, 143 - u16 ox_id); 144 - 145 - enum fc_parse_status fc_abts_rsp_parse(struct fchs_s *buf, int len); 146 - 147 - u16 fc_rrq_build(struct fchs_s *buf, struct fc_rrq_s *rrq, u32 d_id, 148 - u32 s_id, u16 ox_id, u16 rrq_oxid); 149 - 150 151 u16 fc_rspnid_build(struct fchs_s *fchs, void *pld, u32 s_id, 151 152 u16 ox_id, u8 *name); 152 153 u16 fc_rsnn_nn_build(struct fchs_s *fchs, void *pld, u32 s_id, ··· 146 163 147 164 u16 fc_rftid_build(struct fchs_s *fchs, void *pld, u32 s_id, 148 165 u16 ox_id, enum bfa_lport_role role); 149 - 150 - u16 fc_rftid_build_sol(struct fchs_s *fchs, void *pyld, u32 s_id, 151 - u16 ox_id, u8 *fc4_bitmap, 152 - u32 bitmap_size); 153 166 154 167 u16 fc_rffid_build(struct fchs_s *fchs, void *pyld, u32 s_id, 155 168 u16 ox_id, u8 fc4_type, u8 fc4_ftrs); ··· 172 193 u32 d_id, u32 s_id, __be16 ox_id, wwn_t port_name, 173 194 wwn_t node_name); 174 195 175 - enum fc_parse_status fc_adisc_parse(struct fchs_s *fchs, void *pld, 176 - u32 host_dap, wwn_t node_name, wwn_t port_name); 177 - 178 196 enum fc_parse_status fc_adisc_rsp_parse(struct fc_adisc_s *adisc, int len, 179 197 wwn_t port_name, wwn_t node_name); 180 198 ··· 192 216 u32 s_id, __be16 ox_id, 193 217 enum bfa_lport_role role); 194 218 195 - u16 fc_rnid_build(struct fchs_s *fchs, struct fc_rnid_cmd_s *rnid, 196 - u32 d_id, u32 s_id, u16 ox_id, 197 - u32 data_format); 198 - 199 219 u16 fc_rnid_acc_build(struct fchs_s *fchs, 200 220 struct fc_rnid_acc_s *rnid_acc, u32 d_id, u32 s_id, 201 221 __be16 ox_id, u32 data_format, ··· 200 228 201 229 u16 fc_rpsc2_build(struct fchs_s *fchs, struct fc_rpsc2_cmd_s *rps2c, 202 230 u32 d_id, u32 s_id, u32 *pid_list, u16 npids); 203 - u16 fc_rpsc_build(struct fchs_s *fchs, struct fc_rpsc_cmd_s *rpsc, 204 - u32 d_id, u32 s_id, u16 ox_id); 205 231 u16 fc_rpsc_acc_build(struct fchs_s *fchs, 206 232 struct fc_rpsc_acc_s *rpsc_acc, u32 d_id, u32 s_id, 207 233 __be16 ox_id, struct fc_rpsc_speed_info_s *oper_speed); 208 234 u16 fc_gid_ft_build(struct fchs_s *fchs, void *pld, u32 s_id, 209 235 u8 fc4_type); 210 236 211 - u16 fc_rpnid_build(struct fchs_s *fchs, void *pyld, u32 s_id, 212 - u32 port_id, wwn_t port_name); 213 - 214 237 u16 fc_rnnid_build(struct fchs_s *fchs, void *pyld, u32 s_id, 215 238 u32 port_id, wwn_t node_name); 216 - 217 - u16 fc_rcsid_build(struct fchs_s *fchs, void *pyld, u32 s_id, 218 - u32 port_id, u32 cos); 219 - 220 - u16 fc_rptid_build(struct fchs_s *fchs, void *pyld, u32 s_id, 221 - u32 port_id, u8 port_type); 222 - 223 - u16 fc_ganxt_build(struct fchs_s *fchs, void *pyld, u32 s_id, 224 - u32 port_id); 225 239 226 240 u16 fc_logo_build(struct fchs_s *fchs, struct fc_logo_s *logo, u32 d_id, 227 241 u32 s_id, u16 ox_id, wwn_t port_name); ··· 225 267 void fc_els_req_build(struct fchs_s *fchs, u32 d_id, u32 s_id, 226 268 __be16 ox_id); 227 269 228 - enum fc_parse_status fc_plogi_rsp_parse(struct fchs_s *fchs, int len, 229 - wwn_t port_name); 230 - 231 - enum fc_parse_status fc_prli_parse(struct fc_prli_s *prli); 232 - 233 - enum fc_parse_status fc_pdisc_parse(struct fchs_s *fchs, wwn_t node_name, 234 - wwn_t port_name); 235 - 236 270 u16 fc_ba_acc_build(struct fchs_s *fchs, struct fc_ba_acc_s *ba_acc, u32 d_id, 237 271 u32 s_id, __be16 ox_id, u16 rx_id); 238 272 239 273 int fc_logout_params_pages(struct fchs_s *fc_frame, u8 els_code); 240 274 241 - u16 fc_tprlo_acc_build(struct fchs_s *fchs, struct fc_tprlo_acc_s *tprlo_acc, 242 - u32 d_id, u32 s_id, __be16 ox_id, int num_pages); 243 - 244 275 u16 fc_prlo_acc_build(struct fchs_s *fchs, struct fc_prlo_acc_s *prlo_acc, 245 276 u32 d_id, u32 s_id, __be16 ox_id, int num_pages); 246 - 247 - u16 fc_pdisc_build(struct fchs_s *fchs, u32 d_id, u32 s_id, 248 - u16 ox_id, wwn_t port_name, wwn_t node_name, 249 - u16 pdu_size); 250 - 251 - u16 fc_pdisc_rsp_parse(struct fchs_s *fchs, int len, wwn_t port_name); 252 - 253 - u16 fc_prlo_build(struct fchs_s *fchs, u32 d_id, u32 s_id, 254 - u16 ox_id, int num_pages); 255 277 256 278 u16 fc_tprlo_build(struct fchs_s *fchs, u32 d_id, u32 s_id, 257 279 u16 ox_id, int num_pages, enum fc_tprlo_type tprlo_type, 258 280 u32 tpr_id); 259 281 260 - u16 fc_ba_rjt_build(struct fchs_s *fchs, u32 d_id, u32 s_id, 261 - __be16 ox_id, u32 reason_code, u32 reason_expl); 262 - 263 - u16 fc_gnnid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id, 264 - u32 port_id); 265 - 266 - u16 fc_ct_rsp_parse(struct ct_hdr_s *cthdr); 267 - 268 - u16 fc_rscn_build(struct fchs_s *fchs, struct fc_rscn_pl_s *rscn, u32 s_id, 269 - u16 ox_id); 270 282 #endif
+1 -1
drivers/scsi/lpfc/lpfc_nvme.c
··· 242 242 * @phba: pointer to lpfc hba data structure. 243 243 * @axchg: pointer to exchange context for the NVME LS request 244 244 * 245 - * This routine is used for processing an asychronously received NVME LS 245 + * This routine is used for processing an asynchronously received NVME LS 246 246 * request. Any remaining validation is done and the LS is then forwarded 247 247 * to the nvme-fc transport via nvme_fc_rcv_ls_req(). 248 248 *
+1 -1
drivers/scsi/lpfc/lpfc_nvmet.c
··· 2142 2142 * @phba: pointer to lpfc hba data structure. 2143 2143 * @axchg: pointer to exchange context for the NVME LS request 2144 2144 * 2145 - * This routine is used for processing an asychronously received NVME LS 2145 + * This routine is used for processing an asynchronously received NVME LS 2146 2146 * request. Any remaining validation is done and the LS is then forwarded 2147 2147 * to the nvmet-fc transport via nvmet_fc_rcv_ls_req(). 2148 2148 *
+4 -1
drivers/scsi/megaraid/megaraid_sas_base.c
··· 8907 8907 (ld_target_id / MEGASAS_MAX_DEV_PER_CHANNEL), 8908 8908 (ld_target_id % MEGASAS_MAX_DEV_PER_CHANNEL), 8909 8909 0); 8910 - if (sdev1) 8910 + if (sdev1) { 8911 + mutex_unlock(&instance->reset_mutex); 8911 8912 megasas_remove_scsi_device(sdev1); 8913 + mutex_lock(&instance->reset_mutex); 8914 + } 8912 8915 8913 8916 event_type = SCAN_VD_CHANNEL; 8914 8917 break;
+2 -11
drivers/scsi/mpi3mr/mpi3mr.h
··· 57 57 extern int prot_mask; 58 58 extern atomic64_t event_counter; 59 59 60 - #define MPI3MR_DRIVER_VERSION "8.12.0.0.50" 61 - #define MPI3MR_DRIVER_RELDATE "05-Sept-2024" 60 + #define MPI3MR_DRIVER_VERSION "8.12.0.3.50" 61 + #define MPI3MR_DRIVER_RELDATE "11-November-2024" 62 62 63 63 #define MPI3MR_DRIVER_NAME "mpi3mr" 64 64 #define MPI3MR_DRIVER_LICENSE "GPL" ··· 133 133 #define MPI3MR_RESET_TIMEOUT 510 134 134 135 135 #define MPI3MR_WATCHDOG_INTERVAL 1000 /* in milli seconds */ 136 - 137 - #define MPI3MR_DEFAULT_CFG_PAGE_SZ 1024 /* in bytes */ 138 136 139 137 #define MPI3MR_RESET_TOPOLOGY_SETTLE_TIME 10 140 138 ··· 1131 1133 * @io_throttle_low: I/O size to stop throttle in 512b blocks 1132 1134 * @num_io_throttle_group: Maximum number of throttle groups 1133 1135 * @throttle_groups: Pointer to throttle group info structures 1134 - * @cfg_page: Default memory for configuration pages 1135 - * @cfg_page_dma: Configuration page DMA address 1136 - * @cfg_page_sz: Default configuration page memory size 1137 1136 * @sas_transport_enabled: SAS transport enabled or not 1138 1137 * @scsi_device_channel: Channel ID for SCSI devices 1139 1138 * @transport_cmds: Command tracker for SAS transport commands ··· 1326 1331 u32 io_throttle_low; 1327 1332 u16 num_io_throttle_group; 1328 1333 struct mpi3mr_throttle_group_info *throttle_groups; 1329 - 1330 - void *cfg_page; 1331 - dma_addr_t cfg_page_dma; 1332 - u16 cfg_page_sz; 1333 1334 1334 1335 u8 sas_transport_enabled; 1335 1336 u8 scsi_device_channel;
+25 -11
drivers/scsi/mpi3mr/mpi3mr_app.c
··· 2329 2329 if (!mrioc) 2330 2330 return -ENODEV; 2331 2331 2332 + if (mutex_lock_interruptible(&mrioc->bsg_cmds.mutex)) 2333 + return -ERESTARTSYS; 2334 + 2335 + if (mrioc->bsg_cmds.state & MPI3MR_CMD_PENDING) { 2336 + dprint_bsg_err(mrioc, "%s: command is in use\n", __func__); 2337 + mutex_unlock(&mrioc->bsg_cmds.mutex); 2338 + return -EAGAIN; 2339 + } 2340 + 2332 2341 if (!mrioc->ioctl_sges_allocated) { 2333 2342 dprint_bsg_err(mrioc, "%s: DMA memory was not allocated\n", 2334 2343 __func__); ··· 2348 2339 karg->timeout = MPI3MR_APP_DEFAULT_TIMEOUT; 2349 2340 2350 2341 mpi_req = kzalloc(MPI3MR_ADMIN_REQ_FRAME_SZ, GFP_KERNEL); 2351 - if (!mpi_req) 2342 + if (!mpi_req) { 2343 + mutex_unlock(&mrioc->bsg_cmds.mutex); 2352 2344 return -ENOMEM; 2345 + } 2353 2346 mpi_header = (struct mpi3_request_header *)mpi_req; 2354 2347 2355 2348 bufcnt = karg->buf_entry_list.num_of_entries; 2356 2349 drv_bufs = kzalloc((sizeof(*drv_bufs) * bufcnt), GFP_KERNEL); 2357 2350 if (!drv_bufs) { 2351 + mutex_unlock(&mrioc->bsg_cmds.mutex); 2358 2352 rval = -ENOMEM; 2359 2353 goto out; 2360 2354 } ··· 2365 2353 dout_buf = kzalloc(job->request_payload.payload_len, 2366 2354 GFP_KERNEL); 2367 2355 if (!dout_buf) { 2356 + mutex_unlock(&mrioc->bsg_cmds.mutex); 2368 2357 rval = -ENOMEM; 2369 2358 goto out; 2370 2359 } ··· 2373 2360 din_buf = kzalloc(job->reply_payload.payload_len, 2374 2361 GFP_KERNEL); 2375 2362 if (!din_buf) { 2363 + mutex_unlock(&mrioc->bsg_cmds.mutex); 2376 2364 rval = -ENOMEM; 2377 2365 goto out; 2378 2366 } ··· 2449 2435 (mpi_msg_size > MPI3MR_ADMIN_REQ_FRAME_SZ)) { 2450 2436 dprint_bsg_err(mrioc, "%s: invalid MPI message size\n", 2451 2437 __func__); 2438 + mutex_unlock(&mrioc->bsg_cmds.mutex); 2452 2439 rval = -EINVAL; 2453 2440 goto out; 2454 2441 } ··· 2462 2447 if (invalid_be) { 2463 2448 dprint_bsg_err(mrioc, "%s: invalid buffer entries passed\n", 2464 2449 __func__); 2450 + mutex_unlock(&mrioc->bsg_cmds.mutex); 2465 2451 rval = -EINVAL; 2466 2452 goto out; 2467 2453 } ··· 2470 2454 if (sgl_dout_iter > (dout_buf + job->request_payload.payload_len)) { 2471 2455 dprint_bsg_err(mrioc, "%s: data_out buffer length mismatch\n", 2472 2456 __func__); 2457 + mutex_unlock(&mrioc->bsg_cmds.mutex); 2473 2458 rval = -EINVAL; 2474 2459 goto out; 2475 2460 } 2476 2461 if (sgl_din_iter > (din_buf + job->reply_payload.payload_len)) { 2477 2462 dprint_bsg_err(mrioc, "%s: data_in buffer length mismatch\n", 2478 2463 __func__); 2464 + mutex_unlock(&mrioc->bsg_cmds.mutex); 2479 2465 rval = -EINVAL; 2480 2466 goto out; 2481 2467 } ··· 2490 2472 dprint_bsg_err(mrioc, "%s:%d: invalid data transfer size passed for function 0x%x din_size = %d, dout_size = %d\n", 2491 2473 __func__, __LINE__, mpi_header->function, din_size, 2492 2474 dout_size); 2475 + mutex_unlock(&mrioc->bsg_cmds.mutex); 2493 2476 rval = -EINVAL; 2494 2477 goto out; 2495 2478 } ··· 2499 2480 dprint_bsg_err(mrioc, 2500 2481 "%s:%d: invalid data transfer size passed for function 0x%x din_size=%d\n", 2501 2482 __func__, __LINE__, mpi_header->function, din_size); 2483 + mutex_unlock(&mrioc->bsg_cmds.mutex); 2502 2484 rval = -EINVAL; 2503 2485 goto out; 2504 2486 } ··· 2507 2487 dprint_bsg_err(mrioc, 2508 2488 "%s:%d: invalid data transfer size passed for function 0x%x dout_size = %d\n", 2509 2489 __func__, __LINE__, mpi_header->function, dout_size); 2490 + mutex_unlock(&mrioc->bsg_cmds.mutex); 2510 2491 rval = -EINVAL; 2511 2492 goto out; 2512 2493 } ··· 2518 2497 dprint_bsg_err(mrioc, "%s:%d: invalid message size passed:%d:%d:%d:%d\n", 2519 2498 __func__, __LINE__, din_cnt, dout_cnt, din_size, 2520 2499 dout_size); 2500 + mutex_unlock(&mrioc->bsg_cmds.mutex); 2521 2501 rval = -EINVAL; 2522 2502 goto out; 2523 2503 } ··· 2566 2544 continue; 2567 2545 if (mpi3mr_map_data_buffer_dma(mrioc, drv_buf_iter, desc_count)) { 2568 2546 rval = -ENOMEM; 2547 + mutex_unlock(&mrioc->bsg_cmds.mutex); 2569 2548 dprint_bsg_err(mrioc, "%s:%d: mapping data buffers failed\n", 2570 2549 __func__, __LINE__); 2571 2550 goto out; ··· 2579 2556 sense_buff_k = kzalloc(erbsz, GFP_KERNEL); 2580 2557 if (!sense_buff_k) { 2581 2558 rval = -ENOMEM; 2559 + mutex_unlock(&mrioc->bsg_cmds.mutex); 2582 2560 goto out; 2583 2561 } 2584 2562 } 2585 2563 2586 - if (mutex_lock_interruptible(&mrioc->bsg_cmds.mutex)) { 2587 - rval = -ERESTARTSYS; 2588 - goto out; 2589 - } 2590 - if (mrioc->bsg_cmds.state & MPI3MR_CMD_PENDING) { 2591 - rval = -EAGAIN; 2592 - dprint_bsg_err(mrioc, "%s: command is in use\n", __func__); 2593 - mutex_unlock(&mrioc->bsg_cmds.mutex); 2594 - goto out; 2595 - } 2596 2564 if (mrioc->unrecoverable) { 2597 2565 dprint_bsg_err(mrioc, "%s: unrecoverable controller\n", 2598 2566 __func__);
+53 -68
drivers/scsi/mpi3mr/mpi3mr_fw.c
··· 1036 1036 } 1037 1037 1038 1038 /** 1039 + * mpi3mr_is_fault_recoverable - Read fault code and decide 1040 + * whether the controller can be recoverable 1041 + * @mrioc: Adapter instance reference 1042 + * Return: true if fault is recoverable, false otherwise. 1043 + */ 1044 + static inline bool mpi3mr_is_fault_recoverable(struct mpi3mr_ioc *mrioc) 1045 + { 1046 + u32 fault; 1047 + 1048 + fault = (readl(&mrioc->sysif_regs->fault) & 1049 + MPI3_SYSIF_FAULT_CODE_MASK); 1050 + 1051 + switch (fault) { 1052 + case MPI3_SYSIF_FAULT_CODE_COMPLETE_RESET_NEEDED: 1053 + case MPI3_SYSIF_FAULT_CODE_POWER_CYCLE_REQUIRED: 1054 + ioc_warn(mrioc, 1055 + "controller requires system power cycle, marking controller as unrecoverable\n"); 1056 + return false; 1057 + case MPI3_SYSIF_FAULT_CODE_INSUFFICIENT_PCI_SLOT_POWER: 1058 + ioc_warn(mrioc, 1059 + "controller faulted due to insufficient power,\n" 1060 + " try by connecting it to a different slot\n"); 1061 + return false; 1062 + default: 1063 + break; 1064 + } 1065 + return true; 1066 + } 1067 + 1068 + /** 1039 1069 * mpi3mr_print_fault_info - Display fault information 1040 1070 * @mrioc: Adapter instance reference 1041 1071 * ··· 1402 1372 base_info = lo_hi_readq(&mrioc->sysif_regs->ioc_information); 1403 1373 ioc_info(mrioc, "ioc_status(0x%08x), ioc_config(0x%08x), ioc_info(0x%016llx) at the bringup\n", 1404 1374 ioc_status, ioc_config, base_info); 1375 + 1376 + if (!mpi3mr_is_fault_recoverable(mrioc)) { 1377 + mrioc->unrecoverable = 1; 1378 + goto out_device_not_present; 1379 + } 1405 1380 1406 1381 /*The timeout value is in 2sec unit, changing it to seconds*/ 1407 1382 mrioc->ready_timeout = ··· 2768 2733 2769 2734 mpi3mr_print_fault_info(mrioc); 2770 2735 mrioc->diagsave_timeout = 0; 2736 + 2737 + if (!mpi3mr_is_fault_recoverable(mrioc)) { 2738 + mrioc->unrecoverable = 1; 2739 + goto schedule_work; 2740 + } 2771 2741 2772 2742 switch (trigger_data.fault) { 2773 2743 case MPI3_SYSIF_FAULT_CODE_COMPLETE_RESET_NEEDED: ··· 4226 4186 mpi3mr_read_tsu_interval(mrioc); 4227 4187 mpi3mr_print_ioc_info(mrioc); 4228 4188 4229 - if (!mrioc->cfg_page) { 4230 - dprint_init(mrioc, "allocating config page buffers\n"); 4231 - mrioc->cfg_page_sz = MPI3MR_DEFAULT_CFG_PAGE_SZ; 4232 - mrioc->cfg_page = dma_alloc_coherent(&mrioc->pdev->dev, 4233 - mrioc->cfg_page_sz, &mrioc->cfg_page_dma, GFP_KERNEL); 4234 - if (!mrioc->cfg_page) { 4235 - retval = -1; 4236 - goto out_failed_noretry; 4237 - } 4238 - } 4239 - 4240 4189 dprint_init(mrioc, "allocating host diag buffers\n"); 4241 4190 mpi3mr_alloc_diag_bufs(mrioc); 4242 4191 ··· 4797 4768 mrioc->admin_req_base, mrioc->admin_req_dma); 4798 4769 mrioc->admin_req_base = NULL; 4799 4770 } 4800 - if (mrioc->cfg_page) { 4801 - dma_free_coherent(&mrioc->pdev->dev, mrioc->cfg_page_sz, 4802 - mrioc->cfg_page, mrioc->cfg_page_dma); 4803 - mrioc->cfg_page = NULL; 4804 - } 4771 + 4805 4772 if (mrioc->pel_seqnum_virt) { 4806 4773 dma_free_coherent(&mrioc->pdev->dev, mrioc->pel_seqnum_sz, 4807 4774 mrioc->pel_seqnum_virt, mrioc->pel_seqnum_dma); ··· 5417 5392 return retval; 5418 5393 } 5419 5394 5420 - 5421 - /** 5422 - * mpi3mr_free_config_dma_memory - free memory for config page 5423 - * @mrioc: Adapter instance reference 5424 - * @mem_desc: memory descriptor structure 5425 - * 5426 - * Check whether the size of the buffer specified by the memory 5427 - * descriptor is greater than the default page size if so then 5428 - * free the memory pointed by the descriptor. 5429 - * 5430 - * Return: Nothing. 5431 - */ 5432 - static void mpi3mr_free_config_dma_memory(struct mpi3mr_ioc *mrioc, 5433 - struct dma_memory_desc *mem_desc) 5434 - { 5435 - if ((mem_desc->size > mrioc->cfg_page_sz) && mem_desc->addr) { 5436 - dma_free_coherent(&mrioc->pdev->dev, mem_desc->size, 5437 - mem_desc->addr, mem_desc->dma_addr); 5438 - mem_desc->addr = NULL; 5439 - } 5440 - } 5441 - 5442 - /** 5443 - * mpi3mr_alloc_config_dma_memory - Alloc memory for config page 5444 - * @mrioc: Adapter instance reference 5445 - * @mem_desc: Memory descriptor to hold dma memory info 5446 - * 5447 - * This function allocates new dmaable memory or provides the 5448 - * default config page dmaable memory based on the memory size 5449 - * described by the descriptor. 5450 - * 5451 - * Return: 0 on success, non-zero on failure. 5452 - */ 5453 - static int mpi3mr_alloc_config_dma_memory(struct mpi3mr_ioc *mrioc, 5454 - struct dma_memory_desc *mem_desc) 5455 - { 5456 - if (mem_desc->size > mrioc->cfg_page_sz) { 5457 - mem_desc->addr = dma_alloc_coherent(&mrioc->pdev->dev, 5458 - mem_desc->size, &mem_desc->dma_addr, GFP_KERNEL); 5459 - if (!mem_desc->addr) 5460 - return -ENOMEM; 5461 - } else { 5462 - mem_desc->addr = mrioc->cfg_page; 5463 - mem_desc->dma_addr = mrioc->cfg_page_dma; 5464 - memset(mem_desc->addr, 0, mrioc->cfg_page_sz); 5465 - } 5466 - return 0; 5467 - } 5468 - 5469 5395 /** 5470 5396 * mpi3mr_post_cfg_req - Issue config requests and wait 5471 5397 * @mrioc: Adapter instance reference ··· 5572 5596 cfg_req->page_length = cfg_hdr->page_length; 5573 5597 cfg_req->page_version = cfg_hdr->page_version; 5574 5598 } 5575 - if (mpi3mr_alloc_config_dma_memory(mrioc, &mem_desc)) 5576 - goto out; 5599 + 5600 + mem_desc.addr = dma_alloc_coherent(&mrioc->pdev->dev, 5601 + mem_desc.size, &mem_desc.dma_addr, GFP_KERNEL); 5602 + 5603 + if (!mem_desc.addr) 5604 + return retval; 5577 5605 5578 5606 mpi3mr_add_sg_single(&cfg_req->sgl, sgl_flags, mem_desc.size, 5579 5607 mem_desc.dma_addr); ··· 5606 5626 } 5607 5627 5608 5628 out: 5609 - mpi3mr_free_config_dma_memory(mrioc, &mem_desc); 5629 + if (mem_desc.addr) { 5630 + dma_free_coherent(&mrioc->pdev->dev, mem_desc.size, 5631 + mem_desc.addr, mem_desc.dma_addr); 5632 + mem_desc.addr = NULL; 5633 + } 5634 + 5610 5635 return retval; 5611 5636 } 5612 5637
+1 -1
drivers/scsi/mpi3mr/mpi3mr_os.c
··· 5215 5215 } 5216 5216 5217 5217 mrioc = shost_priv(shost); 5218 - retval = ida_alloc_range(&mrioc_ida, 1, U8_MAX, GFP_KERNEL); 5218 + retval = ida_alloc_range(&mrioc_ida, 0, U8_MAX, GFP_KERNEL); 5219 5219 if (retval < 0) 5220 5220 goto id_alloc_failed; 5221 5221 mrioc->id = (u8)retval;
+6 -1
drivers/scsi/mpt3sas/mpt3sas_base.c
··· 7040 7040 int i; 7041 7041 u8 failed; 7042 7042 __le32 *mfp; 7043 + int ret_val; 7043 7044 7044 7045 /* make sure doorbell is not in use */ 7045 7046 if ((ioc->base_readl_ext_retry(&ioc->chip->Doorbell) & MPI2_DOORBELL_USED)) { 7046 7047 ioc_err(ioc, "doorbell is in use (line=%d)\n", __LINE__); 7047 - return -EFAULT; 7048 + goto doorbell_diag_reset; 7048 7049 } 7049 7050 7050 7051 /* clear pending doorbell interrupts from previous state changes */ ··· 7135 7134 le32_to_cpu(mfp[i])); 7136 7135 } 7137 7136 return 0; 7137 + 7138 + doorbell_diag_reset: 7139 + ret_val = _base_diag_reset(ioc); 7140 + return ret_val; 7138 7141 } 7139 7142 7140 7143 /**
+4 -4
drivers/scsi/mpt3sas/mpt3sas_base.h
··· 77 77 #define MPT3SAS_DRIVER_NAME "mpt3sas" 78 78 #define MPT3SAS_AUTHOR "Avago Technologies <MPT-FusionLinux.pdl@avagotech.com>" 79 79 #define MPT3SAS_DESCRIPTION "LSI MPT Fusion SAS 3.0 Device Driver" 80 - #define MPT3SAS_DRIVER_VERSION "48.100.00.00" 81 - #define MPT3SAS_MAJOR_VERSION 48 80 + #define MPT3SAS_DRIVER_VERSION "51.100.00.00" 81 + #define MPT3SAS_MAJOR_VERSION 51 82 82 #define MPT3SAS_MINOR_VERSION 100 83 - #define MPT3SAS_BUILD_VERSION 0 84 - #define MPT3SAS_RELEASE_VERSION 00 83 + #define MPT3SAS_BUILD_VERSION 00 84 + #define MPT3SAS_RELEASE_VERSION 00 85 85 86 86 #define MPT2SAS_DRIVER_NAME "mpt2sas" 87 87 #define MPT2SAS_DESCRIPTION "LSI MPT Fusion SAS 2.0 Device Driver"
+6 -6
drivers/scsi/qla1280.h
··· 116 116 uint16_t id_h; /* ID high */ 117 117 uint16_t cfg_0; /* Configuration 0 */ 118 118 #define ISP_CFG0_HWMSK 0x000f /* Hardware revision mask */ 119 - #define ISP_CFG0_1020 BIT_0 /* ISP1020 */ 120 - #define ISP_CFG0_1020A BIT_1 /* ISP1020A */ 121 - #define ISP_CFG0_1040 BIT_2 /* ISP1040 */ 122 - #define ISP_CFG0_1040A BIT_3 /* ISP1040A */ 123 - #define ISP_CFG0_1040B BIT_4 /* ISP1040B */ 124 - #define ISP_CFG0_1040C BIT_5 /* ISP1040C */ 119 + #define ISP_CFG0_1020 1 /* ISP1020 */ 120 + #define ISP_CFG0_1020A 2 /* ISP1020A */ 121 + #define ISP_CFG0_1040 3 /* ISP1040 */ 122 + #define ISP_CFG0_1040A 4 /* ISP1040A */ 123 + #define ISP_CFG0_1040B 5 /* ISP1040B */ 124 + #define ISP_CFG0_1040C 6 /* ISP1040C */ 125 125 uint16_t cfg_1; /* Configuration 1 */ 126 126 #define ISP_CFG1_F128 BIT_6 /* 128-byte FIFO threshold */ 127 127 #define ISP_CFG1_F64 BIT_4|BIT_5 /* 128-byte FIFO threshold */
+1
drivers/scsi/qla2xxx/qla_attr.c
··· 3304 3304 .show_host_node_name = 1, 3305 3305 .show_host_port_name = 1, 3306 3306 .show_host_supported_classes = 1, 3307 + .show_host_supported_speeds = 1, 3307 3308 3308 3309 .get_host_port_id = qla2x00_get_host_port_id, 3309 3310 .show_host_port_id = 1,
+92 -32
drivers/scsi/qla2xxx/qla_bsg.c
··· 24 24 { 25 25 struct bsg_job *bsg_job = sp->u.bsg_job; 26 26 struct fc_bsg_reply *bsg_reply = bsg_job->reply; 27 + struct completion *comp = sp->comp; 27 28 28 29 ql_dbg(ql_dbg_user, sp->vha, 0x7009, 29 30 "%s: sp hdl %x, result=%x bsg ptr %p\n", ··· 36 35 bsg_reply->result = res; 37 36 bsg_job_done(bsg_job, bsg_reply->result, 38 37 bsg_reply->reply_payload_rcv_len); 38 + 39 + if (comp) 40 + complete(comp); 39 41 } 40 42 41 43 void qla2x00_bsg_sp_free(srb_t *sp) ··· 492 488 "dma_map_sg return %d for reply\n", rsp_sg_cnt); 493 489 rval = -ENOMEM; 494 490 goto done; 495 - } 496 - 497 - if ((req_sg_cnt != bsg_job->request_payload.sg_cnt) || 498 - (rsp_sg_cnt != bsg_job->reply_payload.sg_cnt)) { 499 - ql_log(ql_log_warn, vha, 0x7011, 500 - "request_sg_cnt: %x dma_request_sg_cnt: %x reply_sg_cnt:%x " 501 - "dma_reply_sg_cnt: %x\n", bsg_job->request_payload.sg_cnt, 502 - req_sg_cnt, bsg_job->reply_payload.sg_cnt, rsp_sg_cnt); 503 - rval = -EAGAIN; 504 - goto done_unmap_sg; 505 491 } 506 492 507 493 if (!vha->flags.online) { ··· 3055 3061 3056 3062 static bool qla_bsg_found(struct qla_qpair *qpair, struct bsg_job *bsg_job) 3057 3063 { 3058 - bool found = false; 3064 + bool found, do_bsg_done; 3059 3065 struct fc_bsg_reply *bsg_reply = bsg_job->reply; 3060 3066 scsi_qla_host_t *vha = shost_priv(fc_bsg_to_shost(bsg_job)); 3061 3067 struct qla_hw_data *ha = vha->hw; ··· 3063 3069 int cnt; 3064 3070 unsigned long flags; 3065 3071 struct req_que *req; 3072 + int rval; 3073 + DECLARE_COMPLETION_ONSTACK(comp); 3074 + uint32_t ratov_j; 3075 + 3076 + found = do_bsg_done = false; 3066 3077 3067 3078 spin_lock_irqsave(qpair->qp_lock_ptr, flags); 3068 3079 req = qpair->req; ··· 3079 3080 sp->type == SRB_ELS_CMD_HST || 3080 3081 sp->type == SRB_ELS_CMD_HST_NOLOGIN) && 3081 3082 sp->u.bsg_job == bsg_job) { 3082 - req->outstanding_cmds[cnt] = NULL; 3083 - spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); 3084 - 3085 - if (!ha->flags.eeh_busy && ha->isp_ops->abort_command(sp)) { 3086 - ql_log(ql_log_warn, vha, 0x7089, 3087 - "mbx abort_command failed.\n"); 3088 - bsg_reply->result = -EIO; 3089 - } else { 3090 - ql_dbg(ql_dbg_user, vha, 0x708a, 3091 - "mbx abort_command success.\n"); 3092 - bsg_reply->result = 0; 3093 - } 3094 - /* ref: INIT */ 3095 - kref_put(&sp->cmd_kref, qla2x00_sp_release); 3096 3083 3097 3084 found = true; 3098 - goto done; 3085 + sp->comp = &comp; 3086 + break; 3099 3087 } 3100 3088 } 3101 3089 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); 3102 3090 3103 - done: 3104 - return found; 3091 + if (!found) 3092 + return false; 3093 + 3094 + if (ha->flags.eeh_busy) { 3095 + /* skip over abort. EEH handling will return the bsg. Wait for it */ 3096 + rval = QLA_SUCCESS; 3097 + ql_dbg(ql_dbg_user, vha, 0x802c, 3098 + "eeh encounter. bsg %p sp=%p handle=%x \n", 3099 + bsg_job, sp, sp->handle); 3100 + } else { 3101 + rval = ha->isp_ops->abort_command(sp); 3102 + ql_dbg(ql_dbg_user, vha, 0x802c, 3103 + "Aborting bsg %p sp=%p handle=%x rval=%x\n", 3104 + bsg_job, sp, sp->handle, rval); 3105 + } 3106 + 3107 + switch (rval) { 3108 + case QLA_SUCCESS: 3109 + /* Wait for the command completion. */ 3110 + ratov_j = ha->r_a_tov / 10 * 4 * 1000; 3111 + ratov_j = msecs_to_jiffies(ratov_j); 3112 + 3113 + if (!wait_for_completion_timeout(&comp, ratov_j)) { 3114 + ql_log(ql_log_info, vha, 0x7089, 3115 + "bsg abort timeout. bsg=%p sp=%p handle %#x .\n", 3116 + bsg_job, sp, sp->handle); 3117 + 3118 + do_bsg_done = true; 3119 + } else { 3120 + /* fw had returned the bsg */ 3121 + ql_dbg(ql_dbg_user, vha, 0x708a, 3122 + "bsg abort success. bsg %p sp=%p handle=%#x\n", 3123 + bsg_job, sp, sp->handle); 3124 + do_bsg_done = false; 3125 + } 3126 + break; 3127 + default: 3128 + ql_log(ql_log_info, vha, 0x704f, 3129 + "bsg abort fail. bsg=%p sp=%p rval=%x.\n", 3130 + bsg_job, sp, rval); 3131 + 3132 + do_bsg_done = true; 3133 + break; 3134 + } 3135 + 3136 + if (!do_bsg_done) 3137 + return true; 3138 + 3139 + spin_lock_irqsave(qpair->qp_lock_ptr, flags); 3140 + /* 3141 + * recheck to make sure it's still the same bsg_job due to 3142 + * qp_lock_ptr was released earlier. 3143 + */ 3144 + if (req->outstanding_cmds[cnt] && 3145 + req->outstanding_cmds[cnt]->u.bsg_job != bsg_job) { 3146 + /* fw had returned the bsg */ 3147 + spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); 3148 + return true; 3149 + } 3150 + req->outstanding_cmds[cnt] = NULL; 3151 + spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); 3152 + 3153 + /* ref: INIT */ 3154 + sp->comp = NULL; 3155 + kref_put(&sp->cmd_kref, qla2x00_sp_release); 3156 + bsg_reply->result = -ENXIO; 3157 + bsg_reply->reply_payload_rcv_len = 0; 3158 + 3159 + ql_dbg(ql_dbg_user, vha, 0x7051, 3160 + "%s bsg_job_done : bsg %p result %#x sp %p.\n", 3161 + __func__, bsg_job, bsg_reply->result, sp); 3162 + 3163 + bsg_job_done(bsg_job, bsg_reply->result, bsg_reply->reply_payload_rcv_len); 3164 + 3165 + return true; 3105 3166 } 3106 3167 3107 3168 int 3108 3169 qla24xx_bsg_timeout(struct bsg_job *bsg_job) 3109 3170 { 3110 - struct fc_bsg_reply *bsg_reply = bsg_job->reply; 3171 + struct fc_bsg_request *bsg_request = bsg_job->request; 3111 3172 scsi_qla_host_t *vha = shost_priv(fc_bsg_to_shost(bsg_job)); 3112 3173 struct qla_hw_data *ha = vha->hw; 3113 3174 int i; 3114 3175 struct qla_qpair *qpair; 3115 3176 3116 - ql_log(ql_log_info, vha, 0x708b, "%s CMD timeout. bsg ptr %p.\n", 3117 - __func__, bsg_job); 3177 + ql_log(ql_log_info, vha, 0x708b, 3178 + "%s CMD timeout. bsg ptr %p msgcode %x vendor cmd %x\n", 3179 + __func__, bsg_job, bsg_request->msgcode, 3180 + bsg_request->rqst_data.h_vendor.vendor_cmd[0]); 3118 3181 3119 3182 if (qla2x00_isp_reg_stat(ha)) { 3120 3183 ql_log(ql_log_info, vha, 0x9007, ··· 3197 3136 } 3198 3137 3199 3138 ql_log(ql_log_info, vha, 0x708b, "SRB not found to abort.\n"); 3200 - bsg_reply->result = -ENXIO; 3201 3139 3202 3140 done: 3203 3141 return 0;
+1
drivers/scsi/qla2xxx/qla_mid.c
··· 506 506 return(NULL); 507 507 } 508 508 509 + vha->irq_offset = QLA_BASE_VECTORS; 509 510 host = vha->host; 510 511 fc_vport->dd_data = vha; 511 512 /* New host info */
+8 -7
drivers/scsi/qla2xxx/qla_os.c
··· 6902 6902 set_user_nice(current, MIN_NICE); 6903 6903 6904 6904 set_current_state(TASK_INTERRUPTIBLE); 6905 - while (!kthread_should_stop()) { 6905 + while (1) { 6906 6906 ql_dbg(ql_dbg_dpc, base_vha, 0x4000, 6907 6907 "DPC handler sleeping.\n"); 6908 6908 6909 6909 schedule(); 6910 + 6911 + if (kthread_should_stop()) 6912 + break; 6910 6913 6911 6914 if (test_and_clear_bit(DO_EEH_RECOVERY, &base_vha->dpc_flags)) 6912 6915 qla_pci_set_eeh_busy(base_vha); ··· 6923 6920 goto end_loop; 6924 6921 } 6925 6922 6923 + if (test_bit(UNLOADING, &base_vha->dpc_flags)) 6924 + /* don't do any work. Wait to be terminated by kthread_stop */ 6925 + goto end_loop; 6926 + 6926 6927 ha->dpc_active = 1; 6927 6928 6928 6929 ql_dbg(ql_dbg_dpc + ql_dbg_verbose, base_vha, 0x4001, 6929 6930 "DPC handler waking up, dpc_flags=0x%lx.\n", 6930 6931 base_vha->dpc_flags); 6931 - 6932 - if (test_bit(UNLOADING, &base_vha->dpc_flags)) 6933 - break; 6934 6932 6935 6933 if (IS_P3P_TYPE(ha)) { 6936 6934 if (IS_QLA8044(ha)) { ··· 7244 7240 * Make sure that nobody tries to wake us up again. 7245 7241 */ 7246 7242 ha->dpc_active = 0; 7247 - 7248 - /* Cleanup any residual CTX SRBs. */ 7249 - qla2x00_abort_all_cmds(base_vha, DID_NO_CONNECT << 16); 7250 7243 7251 7244 return 0; 7252 7245 }
+2 -2
drivers/scsi/qla2xxx/qla_version.h
··· 6 6 /* 7 7 * Driver version 8 8 */ 9 - #define QLA2XXX_VERSION "10.02.09.300-k" 9 + #define QLA2XXX_VERSION "10.02.09.400-k" 10 10 11 11 #define QLA_DRIVER_MAJOR_VER 10 12 12 #define QLA_DRIVER_MINOR_VER 2 13 13 #define QLA_DRIVER_PATCH_VER 9 14 - #define QLA_DRIVER_BETA_VER 300 14 + #define QLA_DRIVER_BETA_VER 400
+1 -1
drivers/scsi/scsi_debug.c
··· 6448 6448 } 6449 6449 sd_dp = &sqcp->sd_dp; 6450 6450 6451 - if (polled) 6451 + if (polled || (ndelay > 0 && ndelay < INCLUSIVE_TIMING_MAX_NS)) 6452 6452 ns_from_boot = ktime_get_boottime_ns(); 6453 6453 6454 6454 /* one of the resp_*() response functions is called here */
+1 -1
drivers/scsi/sg.c
··· 386 386 SCSI_LOG_TIMEOUT(3, sg_printk(KERN_INFO, sdp, "sg_release\n")); 387 387 388 388 mutex_lock(&sdp->open_rel_lock); 389 - kref_put(&sfp->f_ref, sg_remove_sfp); 390 389 sdp->open_cnt--; 391 390 392 391 /* possibly many open()s waiting on exlude clearing, start many; ··· 397 398 wake_up_interruptible(&sdp->open_wait); 398 399 } 399 400 mutex_unlock(&sdp->open_rel_lock); 401 + kref_put(&sfp->f_ref, sg_remove_sfp); 400 402 return 0; 401 403 } 402 404
+6 -1
drivers/scsi/storvsc_drv.c
··· 149 149 */ 150 150 static int vmstor_proto_version; 151 151 152 + static bool hv_dev_is_fc(struct hv_device *hv_dev); 153 + 152 154 #define STORVSC_LOGGING_NONE 0 153 155 #define STORVSC_LOGGING_ERROR 1 154 156 #define STORVSC_LOGGING_WARN 2 ··· 1139 1137 * not correctly handle: 1140 1138 * INQUIRY command with page code parameter set to 0x80 1141 1139 * MODE_SENSE command with cmd[2] == 0x1c 1140 + * MAINTENANCE_IN is not supported by HyperV FC passthrough 1142 1141 * 1143 1142 * Setup srb and scsi status so this won't be fatal. 1144 1143 * We do this so we can distinguish truly fatal failues ··· 1147 1144 */ 1148 1145 1149 1146 if ((stor_pkt->vm_srb.cdb[0] == INQUIRY) || 1150 - (stor_pkt->vm_srb.cdb[0] == MODE_SENSE)) { 1147 + (stor_pkt->vm_srb.cdb[0] == MODE_SENSE) || 1148 + (stor_pkt->vm_srb.cdb[0] == MAINTENANCE_IN && 1149 + hv_dev_is_fc(device))) { 1151 1150 vstor_packet->vm_srb.scsi_status = 0; 1152 1151 vstor_packet->vm_srb.srb_status = SRB_STATUS_SUCCESS; 1153 1152 }
+2 -2
drivers/target/target_core_user.c
··· 361 361 [TCMU_MCGRP_CONFIG] = { .name = "config", }, 362 362 }; 363 363 364 - static struct nla_policy tcmu_attr_policy[TCMU_ATTR_MAX+1] = { 364 + static const struct nla_policy tcmu_attr_policy[TCMU_ATTR_MAX + 1] = { 365 365 [TCMU_ATTR_DEVICE] = { .type = NLA_STRING }, 366 366 [TCMU_ATTR_MINOR] = { .type = NLA_U32 }, 367 367 [TCMU_ATTR_CMD_STATUS] = { .type = NLA_S32 }, ··· 2430 2430 Opt_cmd_ring_size_mb, Opt_err, 2431 2431 }; 2432 2432 2433 - static match_table_t tokens = { 2433 + static const match_table_t tokens = { 2434 2434 {Opt_dev_config, "dev_config=%s"}, 2435 2435 {Opt_dev_size, "dev_size=%s"}, 2436 2436 {Opt_hw_block_size, "hw_block_size=%d"},
+6
drivers/ufs/core/ufs-sysfs.c
··· 670 670 struct ufs_hba *hba = dev_get_drvdata(dev); 671 671 struct ufs_hba_monitor *m = &hba->monitor; 672 672 673 + if (!m->nr_req[READ]) 674 + return sysfs_emit(buf, "0\n"); 675 + 673 676 return sysfs_emit(buf, "%llu\n", div_u64(ktime_to_us(m->lat_sum[READ]), 674 677 m->nr_req[READ])); 675 678 } ··· 739 736 { 740 737 struct ufs_hba *hba = dev_get_drvdata(dev); 741 738 struct ufs_hba_monitor *m = &hba->monitor; 739 + 740 + if (!m->nr_req[WRITE]) 741 + return sysfs_emit(buf, "0\n"); 742 742 743 743 return sysfs_emit(buf, "%llu\n", div_u64(ktime_to_us(m->lat_sum[WRITE]), 744 744 m->nr_req[WRITE]));
+1 -1
drivers/ufs/core/ufs_bsg.c
··· 170 170 break; 171 171 case UPIU_TRANSACTION_UIC_CMD: 172 172 memcpy(&uc, &bsg_request->upiu_req.uc, UIC_CMD_SIZE); 173 - ret = ufshcd_send_uic_cmd(hba, &uc); 173 + ret = ufshcd_send_bsg_uic_cmd(hba, &uc); 174 174 if (ret) 175 175 dev_err(hba->dev, "send uic cmd: error code %d\n", ret); 176 176
+1 -6
drivers/ufs/core/ufshcd-priv.h
··· 84 84 u8 **buf, bool ascii); 85 85 86 86 int ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd); 87 + int ufshcd_send_bsg_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd); 87 88 88 89 int ufshcd_exec_raw_upiu_cmd(struct ufs_hba *hba, 89 90 struct utp_upiu_req *req_upiu, ··· 235 234 { 236 235 if (hba->vops && hba->vops->config_scaling_param) 237 236 hba->vops->config_scaling_param(hba, p, data); 238 - } 239 - 240 - static inline void ufshcd_vops_reinit_notify(struct ufs_hba *hba) 241 - { 242 - if (hba->vops && hba->vops->reinit_notify) 243 - hba->vops->reinit_notify(hba); 244 237 } 245 238 246 239 static inline int ufshcd_vops_mcq_config_resource(struct ufs_hba *hba)
+48 -7
drivers/ufs/core/ufshcd.c
··· 4313 4313 } 4314 4314 4315 4315 /** 4316 + * ufshcd_send_bsg_uic_cmd - Send UIC commands requested via BSG layer and retrieve the result 4317 + * @hba: per adapter instance 4318 + * @uic_cmd: UIC command 4319 + * 4320 + * Return: 0 only if success. 4321 + */ 4322 + int ufshcd_send_bsg_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd) 4323 + { 4324 + int ret; 4325 + 4326 + if (hba->quirks & UFSHCD_QUIRK_BROKEN_UIC_CMD) 4327 + return 0; 4328 + 4329 + ufshcd_hold(hba); 4330 + 4331 + if (uic_cmd->argument1 == UIC_ARG_MIB(PA_PWRMODE) && 4332 + uic_cmd->command == UIC_CMD_DME_SET) { 4333 + ret = ufshcd_uic_pwr_ctrl(hba, uic_cmd); 4334 + goto out; 4335 + } 4336 + 4337 + mutex_lock(&hba->uic_cmd_mutex); 4338 + ufshcd_add_delay_before_dme_cmd(hba); 4339 + 4340 + ret = __ufshcd_send_uic_cmd(hba, uic_cmd); 4341 + if (!ret) 4342 + ret = ufshcd_wait_for_uic_cmd(hba, uic_cmd); 4343 + 4344 + mutex_unlock(&hba->uic_cmd_mutex); 4345 + 4346 + out: 4347 + ufshcd_release(hba); 4348 + return ret; 4349 + } 4350 + 4351 + /** 4316 4352 * ufshcd_uic_change_pwr_mode - Perform the UIC power mode chage 4317 4353 * using DME_SET primitives. 4318 4354 * @hba: per adapter instance ··· 4664 4628 dev_err(hba->dev, 4665 4629 "%s: power mode change failed %d\n", __func__, ret); 4666 4630 } else { 4667 - ufshcd_vops_pwr_change_notify(hba, POST_CHANGE, NULL, 4668 - pwr_mode); 4669 - 4670 4631 memcpy(&hba->pwr_info, pwr_mode, 4671 4632 sizeof(struct ufs_pa_layer_attr)); 4672 4633 } ··· 4691 4658 memcpy(&final_params, desired_pwr_mode, sizeof(final_params)); 4692 4659 4693 4660 ret = ufshcd_change_power_mode(hba, &final_params); 4661 + 4662 + if (!ret) 4663 + ufshcd_vops_pwr_change_notify(hba, POST_CHANGE, NULL, 4664 + &final_params); 4694 4665 4695 4666 return ret; 4696 4667 } ··· 5543 5506 5544 5507 lrbp = &hba->lrb[task_tag]; 5545 5508 lrbp->compl_time_stamp = ktime_get(); 5509 + lrbp->compl_time_stamp_local_clock = local_clock(); 5546 5510 cmd = lrbp->cmd; 5547 5511 if (cmd) { 5548 5512 if (unlikely(ufshcd_should_inform_monitor(hba, lrbp))) ··· 8847 8809 ufshcd_device_reset(hba); 8848 8810 ufs_put_device_desc(hba); 8849 8811 ufshcd_hba_stop(hba); 8850 - ufshcd_vops_reinit_notify(hba); 8851 8812 ret = ufshcd_hba_enable(hba); 8852 8813 if (ret) { 8853 8814 dev_err(hba->dev, "Host controller enable failed\n"); ··· 10219 10182 ufs_hwmon_remove(hba); 10220 10183 ufs_bsg_remove(hba); 10221 10184 ufs_sysfs_remove_nodes(hba->dev); 10185 + cancel_delayed_work_sync(&hba->ufs_rtc_update_work); 10222 10186 blk_mq_destroy_queue(hba->tmf_queue); 10223 10187 blk_put_queue(hba->tmf_queue); 10224 10188 blk_mq_free_tag_set(&hba->tmf_tag_set); ··· 10577 10539 } 10578 10540 10579 10541 /* 10580 - * Set the default power management level for runtime and system PM. 10542 + * Set the default power management level for runtime and system PM if 10543 + * not set by the host controller drivers. 10581 10544 * Default power saving mode is to keep UFS link in Hibern8 state 10582 10545 * and UFS device in sleep state. 10583 10546 */ 10584 - hba->rpm_lvl = ufs_get_desired_pm_lvl_for_dev_link_state( 10547 + if (!hba->rpm_lvl) 10548 + hba->rpm_lvl = ufs_get_desired_pm_lvl_for_dev_link_state( 10585 10549 UFS_SLEEP_PWR_MODE, 10586 10550 UIC_LINK_HIBERN8_STATE); 10587 - hba->spm_lvl = ufs_get_desired_pm_lvl_for_dev_link_state( 10551 + if (!hba->spm_lvl) 10552 + hba->spm_lvl = ufs_get_desired_pm_lvl_for_dev_link_state( 10588 10553 UFS_SLEEP_PWR_MODE, 10589 10554 UIC_LINK_HIBERN8_STATE); 10590 10555
+2 -4
drivers/ufs/host/cdns-pltfrm.c
··· 307 307 */ 308 308 static void cdns_ufs_pltfrm_remove(struct platform_device *pdev) 309 309 { 310 - struct ufs_hba *hba = platform_get_drvdata(pdev); 311 - 312 - ufshcd_remove(hba); 310 + ufshcd_pltfrm_remove(pdev); 313 311 } 314 312 315 313 static const struct dev_pm_ops cdns_ufs_dev_pm_ops = { ··· 319 321 320 322 static struct platform_driver cdns_ufs_pltfrm_driver = { 321 323 .probe = cdns_ufs_pltfrm_probe, 322 - .remove_new = cdns_ufs_pltfrm_remove, 324 + .remove = cdns_ufs_pltfrm_remove, 323 325 .driver = { 324 326 .name = "cdns-ufshcd", 325 327 .pm = &cdns_ufs_dev_pm_ops,
+2 -5
drivers/ufs/host/tc-dwc-g210-pltfrm.c
··· 76 76 */ 77 77 static void tc_dwc_g210_pltfm_remove(struct platform_device *pdev) 78 78 { 79 - struct ufs_hba *hba = platform_get_drvdata(pdev); 80 - 81 - pm_runtime_get_sync(&(pdev)->dev); 82 - ufshcd_remove(hba); 79 + ufshcd_pltfrm_remove(pdev); 83 80 } 84 81 85 82 static const struct dev_pm_ops tc_dwc_g210_pltfm_pm_ops = { ··· 86 89 87 90 static struct platform_driver tc_dwc_g210_pltfm_driver = { 88 91 .probe = tc_dwc_g210_pltfm_probe, 89 - .remove_new = tc_dwc_g210_pltfm_remove, 92 + .remove = tc_dwc_g210_pltfm_remove, 90 93 .driver = { 91 94 .name = "tc-dwc-g210-pltfm", 92 95 .pm = &tc_dwc_g210_pltfm_pm_ops,
+1 -1
drivers/ufs/host/ti-j721e-ufs.c
··· 83 83 84 84 static struct platform_driver ti_j721e_ufs_driver = { 85 85 .probe = ti_j721e_ufs_probe, 86 - .remove_new = ti_j721e_ufs_remove, 86 + .remove = ti_j721e_ufs_remove, 87 87 .driver = { 88 88 .name = "ti-j721e-ufs", 89 89 .of_match_table = ti_j721e_ufs_of_match,
+2 -3
drivers/ufs/host/ufs-exynos.c
··· 1992 1992 struct ufs_hba *hba = platform_get_drvdata(pdev); 1993 1993 struct exynos_ufs *ufs = ufshcd_get_variant(hba); 1994 1994 1995 - pm_runtime_get_sync(&(pdev)->dev); 1996 - ufshcd_remove(hba); 1995 + ufshcd_pltfrm_remove(pdev); 1997 1996 1998 1997 phy_power_off(ufs->phy); 1999 1998 phy_exit(ufs->phy); ··· 2165 2166 2166 2167 static struct platform_driver exynos_ufs_pltform = { 2167 2168 .probe = exynos_ufs_probe, 2168 - .remove_new = exynos_ufs_remove, 2169 + .remove = exynos_ufs_remove, 2169 2170 .driver = { 2170 2171 .name = "exynos-ufshc", 2171 2172 .pm = &exynos_ufs_pm_ops,
+2 -4
drivers/ufs/host/ufs-hisi.c
··· 576 576 577 577 static void ufs_hisi_remove(struct platform_device *pdev) 578 578 { 579 - struct ufs_hba *hba = platform_get_drvdata(pdev); 580 - 581 - ufshcd_remove(hba); 579 + ufshcd_pltfrm_remove(pdev); 582 580 } 583 581 584 582 static const struct dev_pm_ops ufs_hisi_pm_ops = { ··· 588 590 589 591 static struct platform_driver ufs_hisi_pltform = { 590 592 .probe = ufs_hisi_probe, 591 - .remove_new = ufs_hisi_remove, 593 + .remove = ufs_hisi_remove, 592 594 .driver = { 593 595 .name = "ufshcd-hisi", 594 596 .pm = &ufs_hisi_pm_ops,
+2 -5
drivers/ufs/host/ufs-mediatek.c
··· 1879 1879 */ 1880 1880 static void ufs_mtk_remove(struct platform_device *pdev) 1881 1881 { 1882 - struct ufs_hba *hba = platform_get_drvdata(pdev); 1883 - 1884 - pm_runtime_get_sync(&(pdev)->dev); 1885 - ufshcd_remove(hba); 1882 + ufshcd_pltfrm_remove(pdev); 1886 1883 } 1887 1884 1888 1885 #ifdef CONFIG_PM_SLEEP ··· 1959 1962 1960 1963 static struct platform_driver ufs_mtk_pltform = { 1961 1964 .probe = ufs_mtk_probe, 1962 - .remove_new = ufs_mtk_remove, 1965 + .remove = ufs_mtk_remove, 1963 1966 .driver = { 1964 1967 .name = "ufshcd-mtk", 1965 1968 .pm = &ufs_mtk_pm_ops,
+24 -16
drivers/ufs/host/ufs-qcom.c
··· 420 420 if (ret) 421 421 return ret; 422 422 423 + if (phy->power_count) { 424 + phy_power_off(phy); 425 + phy_exit(phy); 426 + } 427 + 423 428 /* phy initialization - calibrate the phy */ 424 429 ret = phy_init(phy); 425 430 if (ret) { ··· 923 918 */ 924 919 static void ufs_qcom_advertise_quirks(struct ufs_hba *hba) 925 920 { 921 + const struct ufs_qcom_drvdata *drvdata = of_device_get_match_data(hba->dev); 926 922 struct ufs_qcom_host *host = ufshcd_get_variant(hba); 927 923 928 924 if (host->hw_ver.major == 0x2) ··· 932 926 if (host->hw_ver.major > 0x3) 933 927 hba->quirks |= UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH; 934 928 935 - if (of_device_is_compatible(hba->dev->of_node, "qcom,sm8550-ufshc") || 936 - of_device_is_compatible(hba->dev->of_node, "qcom,sm8650-ufshc")) 937 - hba->quirks |= UFSHCD_QUIRK_BROKEN_LSDBS_CAP; 929 + if (drvdata && drvdata->quirks) 930 + hba->quirks |= drvdata->quirks; 938 931 } 939 932 940 933 static void ufs_qcom_set_phy_gear(struct ufs_qcom_host *host) ··· 1121 1116 struct device *dev = hba->dev; 1122 1117 struct ufs_qcom_host *host; 1123 1118 struct ufs_clk_info *clki; 1119 + const struct ufs_qcom_drvdata *drvdata = of_device_get_match_data(hba->dev); 1124 1120 1125 1121 host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL); 1126 1122 if (!host) ··· 1200 1194 /* Failure is non-fatal */ 1201 1195 dev_warn(dev, "%s: failed to configure the testbus %d\n", 1202 1196 __func__, err); 1197 + 1198 + if (drvdata && drvdata->no_phy_retention) 1199 + hba->spm_lvl = UFS_PM_LVL_5; 1203 1200 1204 1201 return 0; 1205 1202 ··· 1640 1631 } 1641 1632 #endif 1642 1633 1643 - static void ufs_qcom_reinit_notify(struct ufs_hba *hba) 1644 - { 1645 - struct ufs_qcom_host *host = ufshcd_get_variant(hba); 1646 - 1647 - phy_power_off(host->generic_phy); 1648 - } 1649 - 1650 1634 /* Resources */ 1651 1635 static const struct ufshcd_res_info ufs_res_info[RES_MAX] = { 1652 1636 {.name = "ufs_mem",}, ··· 1878 1876 .dbg_register_dump = ufs_qcom_dump_dbg_regs, 1879 1877 .device_reset = ufs_qcom_device_reset, 1880 1878 .config_scaling_param = ufs_qcom_config_scaling_param, 1881 - .reinit_notify = ufs_qcom_reinit_notify, 1882 1879 .mcq_config_resource = ufs_qcom_mcq_config_resource, 1883 1880 .get_hba_mac = ufs_qcom_get_hba_mac, 1884 1881 .op_runtime_config = ufs_qcom_op_runtime_config, ··· 1913 1912 static void ufs_qcom_remove(struct platform_device *pdev) 1914 1913 { 1915 1914 struct ufs_hba *hba = platform_get_drvdata(pdev); 1915 + struct ufs_qcom_host *host = ufshcd_get_variant(hba); 1916 1916 1917 - pm_runtime_get_sync(&(pdev)->dev); 1918 - ufshcd_remove(hba); 1919 - platform_device_msi_free_irqs_all(hba->dev); 1917 + ufshcd_pltfrm_remove(pdev); 1918 + if (host->esi_enabled) 1919 + platform_device_msi_free_irqs_all(hba->dev); 1920 1920 } 1921 + 1922 + static const struct ufs_qcom_drvdata ufs_qcom_sm8550_drvdata = { 1923 + .quirks = UFSHCD_QUIRK_BROKEN_LSDBS_CAP, 1924 + .no_phy_retention = true, 1925 + }; 1921 1926 1922 1927 static const struct of_device_id ufs_qcom_of_match[] __maybe_unused = { 1923 1928 { .compatible = "qcom,ufshc" }, 1924 - { .compatible = "qcom,sm8550-ufshc" }, 1929 + { .compatible = "qcom,sm8550-ufshc", .data = &ufs_qcom_sm8550_drvdata }, 1930 + { .compatible = "qcom,sm8650-ufshc", .data = &ufs_qcom_sm8550_drvdata }, 1925 1931 {}, 1926 1932 }; 1927 1933 MODULE_DEVICE_TABLE(of, ufs_qcom_of_match); ··· 1956 1948 1957 1949 static struct platform_driver ufs_qcom_pltform = { 1958 1950 .probe = ufs_qcom_probe, 1959 - .remove_new = ufs_qcom_remove, 1951 + .remove = ufs_qcom_remove, 1960 1952 .driver = { 1961 1953 .name = "ufshcd-qcom", 1962 1954 .pm = &ufs_qcom_pm_ops,
+5
drivers/ufs/host/ufs-qcom.h
··· 217 217 bool esi_enabled; 218 218 }; 219 219 220 + struct ufs_qcom_drvdata { 221 + enum ufshcd_quirks quirks; 222 + bool no_phy_retention; 223 + }; 224 + 220 225 static inline u32 221 226 ufs_qcom_get_debug_reg_offset(struct ufs_qcom_host *host, u32 reg) 222 227 {
+2 -4
drivers/ufs/host/ufs-renesas.c
··· 397 397 398 398 static void ufs_renesas_remove(struct platform_device *pdev) 399 399 { 400 - struct ufs_hba *hba = platform_get_drvdata(pdev); 401 - 402 - ufshcd_remove(hba); 400 + ufshcd_pltfrm_remove(pdev); 403 401 } 404 402 405 403 static struct platform_driver ufs_renesas_platform = { 406 404 .probe = ufs_renesas_probe, 407 - .remove_new = ufs_renesas_remove, 405 + .remove = ufs_renesas_remove, 408 406 .driver = { 409 407 .name = "ufshcd-renesas", 410 408 .of_match_table = of_match_ptr(ufs_renesas_of_match),
+2 -5
drivers/ufs/host/ufs-sprd.c
··· 427 427 428 428 static void ufs_sprd_remove(struct platform_device *pdev) 429 429 { 430 - struct ufs_hba *hba = platform_get_drvdata(pdev); 431 - 432 - pm_runtime_get_sync(&(pdev)->dev); 433 - ufshcd_remove(hba); 430 + ufshcd_pltfrm_remove(pdev); 434 431 } 435 432 436 433 static const struct dev_pm_ops ufs_sprd_pm_ops = { ··· 439 442 440 443 static struct platform_driver ufs_sprd_pltform = { 441 444 .probe = ufs_sprd_probe, 442 - .remove_new = ufs_sprd_remove, 445 + .remove = ufs_sprd_remove, 443 446 .driver = { 444 447 .name = "ufshcd-sprd", 445 448 .pm = &ufs_sprd_pm_ops,
+16
drivers/ufs/host/ufshcd-pltfrm.c
··· 524 524 } 525 525 EXPORT_SYMBOL_GPL(ufshcd_pltfrm_init); 526 526 527 + /** 528 + * ufshcd_pltfrm_remove - Remove ufshcd platform 529 + * @pdev: pointer to Platform device handle 530 + */ 531 + void ufshcd_pltfrm_remove(struct platform_device *pdev) 532 + { 533 + struct ufs_hba *hba = platform_get_drvdata(pdev); 534 + 535 + pm_runtime_get_sync(&pdev->dev); 536 + ufshcd_remove(hba); 537 + ufshcd_dealloc_host(hba); 538 + pm_runtime_disable(&pdev->dev); 539 + pm_runtime_put_noidle(&pdev->dev); 540 + } 541 + EXPORT_SYMBOL_GPL(ufshcd_pltfrm_remove); 542 + 527 543 MODULE_AUTHOR("Santosh Yaragnavi <santosh.sy@samsung.com>"); 528 544 MODULE_AUTHOR("Vinayak Holikatti <h.vinayak@samsung.com>"); 529 545 MODULE_DESCRIPTION("UFS host controller Platform bus based glue driver");
+1
drivers/ufs/host/ufshcd-pltfrm.h
··· 31 31 void ufshcd_init_host_params(struct ufs_host_params *host_params); 32 32 int ufshcd_pltfrm_init(struct platform_device *pdev, 33 33 const struct ufs_hba_variant_ops *vops); 34 + void ufshcd_pltfrm_remove(struct platform_device *pdev); 34 35 int ufshcd_populate_vreg(struct device *dev, const char *name, 35 36 struct ufs_vreg **out_vreg, bool skip_current); 36 37
+6 -6
include/ufs/ufshcd.h
··· 310 310 * to allow variant specific Uni-Pro initialization. 311 311 * @pwr_change_notify: called before and after a power mode change 312 312 * is carried out to allow vendor spesific capabilities 313 - * to be set. 313 + * to be set. PRE_CHANGE can modify final_params based 314 + * on desired_pwr_mode, but POST_CHANGE must not alter 315 + * the final_params parameter 314 316 * @setup_xfer_req: called before any transfer request is issued 315 317 * to set some things 316 318 * @setup_task_mgmt: called before any task management request is issued ··· 328 326 * @config_scaling_param: called to configure clock scaling parameters 329 327 * @fill_crypto_prdt: initialize crypto-related fields in the PRDT 330 328 * @event_notify: called to notify important events 331 - * @reinit_notify: called to notify reinit of UFSHCD during max gear switch 332 329 * @mcq_config_resource: called to configure MCQ platform resources 333 330 * @get_hba_mac: reports maximum number of outstanding commands supported by 334 331 * the controller. Should be implemented for UFSHCI 4.0 or later ··· 353 352 int (*link_startup_notify)(struct ufs_hba *, 354 353 enum ufs_notify_change_status); 355 354 int (*pwr_change_notify)(struct ufs_hba *, 356 - enum ufs_notify_change_status status, 357 - struct ufs_pa_layer_attr *, 358 - struct ufs_pa_layer_attr *); 355 + enum ufs_notify_change_status status, 356 + struct ufs_pa_layer_attr *desired_pwr_mode, 357 + struct ufs_pa_layer_attr *final_params); 359 358 void (*setup_xfer_req)(struct ufs_hba *hba, int tag, 360 359 bool is_scsi_cmd); 361 360 void (*setup_task_mgmt)(struct ufs_hba *, int, u8); ··· 377 376 void *prdt, unsigned int num_segments); 378 377 void (*event_notify)(struct ufs_hba *hba, 379 378 enum ufs_event_type evt, void *data); 380 - void (*reinit_notify)(struct ufs_hba *); 381 379 int (*mcq_config_resource)(struct ufs_hba *hba); 382 380 int (*get_hba_mac)(struct ufs_hba *hba); 383 381 int (*op_runtime_config)(struct ufs_hba *hba);