Commit de6d7547 authored by Ahmed S. Darwish's avatar Ahmed S. Darwish Committed by Martin K. Petersen
Browse files

scsi: pm80xx: Switch back to original libsas event notifiers

libsas event notifiers required an extension where gfp_t flags must be
explicitly passed. For bisectability, a temporary _gfp() variant of such
functions were added. All call sites then got converted use the _gfp()
variants and explicitly pass GFP context. Having no callers left, the
original libsas notifiers were then modified to accept gfp_t flags by
default.

Switch back to the original libas API, while still passing GFP context.
The libsas _gfp() variants will be removed afterwards.

Link: https://lore.kernel.org/r/20210118100955.1761652-16-a.darwish@linutronix.de


Cc: Jack Wang <jinpu.wang@cloud.ionos.com>
Reviewed-by: default avatarJohn Garry <john.garry@huawei.com>
Reviewed-by: default avatarJack Wang <jinpu.wang@cloud.ionos.com>
Signed-off-by: default avatarAhmed S. Darwish <a.darwish@linutronix.de>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 093289e4
Loading
Loading
Loading
Loading
+19 −21
Original line number Diff line number Diff line
@@ -3185,7 +3185,7 @@ void pm8001_bytes_dmaed(struct pm8001_hba_info *pm8001_ha, int i)
	pm8001_dbg(pm8001_ha, MSG, "phy %d byte dmaded.\n", i);

	sas_phy->frame_rcvd_size = phy->frame_rcvd_size;
	sas_notify_port_event_gfp(sas_phy, PORTE_BYTES_DMAED, GFP_ATOMIC);
	sas_notify_port_event(sas_phy, PORTE_BYTES_DMAED, GFP_ATOMIC);
}

/* Get the link rate speed  */
@@ -3342,7 +3342,7 @@ hw_event_sas_phy_up(struct pm8001_hba_info *pm8001_ha, void *piomb)
	else if (phy->identify.device_type != SAS_PHY_UNUSED)
		phy->identify.target_port_protocols = SAS_PROTOCOL_SMP;
	phy->sas_phy.oob_mode = SAS_OOB_MODE;
	sas_notify_phy_event_gfp(&phy->sas_phy, PHYE_OOB_DONE, GFP_ATOMIC);
	sas_notify_phy_event(&phy->sas_phy, PHYE_OOB_DONE, GFP_ATOMIC);
	spin_lock_irqsave(&phy->sas_phy.frame_rcvd_lock, flags);
	memcpy(phy->frame_rcvd, &pPayload->sas_identify,
		sizeof(struct sas_identify_frame)-4);
@@ -3385,7 +3385,7 @@ hw_event_sata_phy_up(struct pm8001_hba_info *pm8001_ha, void *piomb)
	phy->phy_type |= PORT_TYPE_SATA;
	phy->phy_attached = 1;
	phy->sas_phy.oob_mode = SATA_OOB_MODE;
	sas_notify_phy_event_gfp(&phy->sas_phy, PHYE_OOB_DONE, GFP_ATOMIC);
	sas_notify_phy_event(&phy->sas_phy, PHYE_OOB_DONE, GFP_ATOMIC);
	spin_lock_irqsave(&phy->sas_phy.frame_rcvd_lock, flags);
	memcpy(phy->frame_rcvd, ((u8 *)&pPayload->sata_fis - 4),
		sizeof(struct dev_to_host_fis));
@@ -3732,12 +3732,12 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void* piomb)
		break;
	case HW_EVENT_SATA_SPINUP_HOLD:
		pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_SATA_SPINUP_HOLD\n");
		sas_notify_phy_event_gfp(&phy->sas_phy, PHYE_SPINUP_HOLD,
		sas_notify_phy_event(&phy->sas_phy, PHYE_SPINUP_HOLD,
			GFP_ATOMIC);
		break;
	case HW_EVENT_PHY_DOWN:
		pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_PHY_DOWN\n");
		sas_notify_phy_event_gfp(&phy->sas_phy, PHYE_LOSS_OF_SIGNAL,
		sas_notify_phy_event(&phy->sas_phy, PHYE_LOSS_OF_SIGNAL,
			GFP_ATOMIC);
		phy->phy_attached = 0;
		phy->phy_state = 0;
@@ -3747,7 +3747,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void* piomb)
		pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_PORT_INVALID\n");
		sas_phy_disconnected(sas_phy);
		phy->phy_attached = 0;
		sas_notify_port_event_gfp(sas_phy, PORTE_LINK_RESET_ERR,
		sas_notify_port_event(sas_phy, PORTE_LINK_RESET_ERR,
			GFP_ATOMIC);
		break;
	/* the broadcast change primitive received, tell the LIBSAS this event
@@ -3759,22 +3759,21 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void* piomb)
		spin_lock_irqsave(&sas_phy->sas_prim_lock, flags);
		sas_phy->sas_prim = HW_EVENT_BROADCAST_CHANGE;
		spin_unlock_irqrestore(&sas_phy->sas_prim_lock, flags);
		sas_notify_port_event_gfp(sas_phy, PORTE_BROADCAST_RCVD,
		sas_notify_port_event(sas_phy, PORTE_BROADCAST_RCVD,
			GFP_ATOMIC);
		break;
	case HW_EVENT_PHY_ERROR:
		pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_PHY_ERROR\n");
		sas_phy_disconnected(&phy->sas_phy);
		phy->phy_attached = 0;
		sas_notify_phy_event_gfp(&phy->sas_phy, PHYE_OOB_ERROR,
			GFP_ATOMIC);
		sas_notify_phy_event(&phy->sas_phy, PHYE_OOB_ERROR, GFP_ATOMIC);
		break;
	case HW_EVENT_BROADCAST_EXP:
		pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_BROADCAST_EXP\n");
		spin_lock_irqsave(&sas_phy->sas_prim_lock, flags);
		sas_phy->sas_prim = HW_EVENT_BROADCAST_EXP;
		spin_unlock_irqrestore(&sas_phy->sas_prim_lock, flags);
		sas_notify_port_event_gfp(sas_phy, PORTE_BROADCAST_RCVD,
		sas_notify_port_event(sas_phy, PORTE_BROADCAST_RCVD,
			GFP_ATOMIC);
		break;
	case HW_EVENT_LINK_ERR_INVALID_DWORD:
@@ -3784,7 +3783,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void* piomb)
			HW_EVENT_LINK_ERR_INVALID_DWORD, port_id, phy_id, 0, 0);
		sas_phy_disconnected(sas_phy);
		phy->phy_attached = 0;
		sas_notify_port_event_gfp(sas_phy, PORTE_LINK_RESET_ERR,
		sas_notify_port_event(sas_phy, PORTE_LINK_RESET_ERR,
			GFP_ATOMIC);
		break;
	case HW_EVENT_LINK_ERR_DISPARITY_ERROR:
@@ -3795,7 +3794,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void* piomb)
			port_id, phy_id, 0, 0);
		sas_phy_disconnected(sas_phy);
		phy->phy_attached = 0;
		sas_notify_port_event_gfp(sas_phy, PORTE_LINK_RESET_ERR,
		sas_notify_port_event(sas_phy, PORTE_LINK_RESET_ERR,
			GFP_ATOMIC);
		break;
	case HW_EVENT_LINK_ERR_CODE_VIOLATION:
@@ -3806,7 +3805,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void* piomb)
			port_id, phy_id, 0, 0);
		sas_phy_disconnected(sas_phy);
		phy->phy_attached = 0;
		sas_notify_port_event_gfp(sas_phy, PORTE_LINK_RESET_ERR,
		sas_notify_port_event(sas_phy, PORTE_LINK_RESET_ERR,
			GFP_ATOMIC);
		break;
	case HW_EVENT_LINK_ERR_LOSS_OF_DWORD_SYNCH:
@@ -3817,7 +3816,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void* piomb)
			port_id, phy_id, 0, 0);
		sas_phy_disconnected(sas_phy);
		phy->phy_attached = 0;
		sas_notify_port_event_gfp(sas_phy, PORTE_LINK_RESET_ERR,
		sas_notify_port_event(sas_phy, PORTE_LINK_RESET_ERR,
			GFP_ATOMIC);
		break;
	case HW_EVENT_MALFUNCTION:
@@ -3828,7 +3827,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void* piomb)
		spin_lock_irqsave(&sas_phy->sas_prim_lock, flags);
		sas_phy->sas_prim = HW_EVENT_BROADCAST_SES;
		spin_unlock_irqrestore(&sas_phy->sas_prim_lock, flags);
		sas_notify_port_event_gfp(sas_phy, PORTE_BROADCAST_RCVD,
		sas_notify_port_event(sas_phy, PORTE_BROADCAST_RCVD,
			GFP_ATOMIC);
		break;
	case HW_EVENT_INBOUND_CRC_ERROR:
@@ -3839,14 +3838,13 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void* piomb)
		break;
	case HW_EVENT_HARD_RESET_RECEIVED:
		pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_HARD_RESET_RECEIVED\n");
		sas_notify_port_event_gfp(sas_phy, PORTE_HARD_RESET,
			GFP_ATOMIC);
		sas_notify_port_event(sas_phy, PORTE_HARD_RESET, GFP_ATOMIC);
		break;
	case HW_EVENT_ID_FRAME_TIMEOUT:
		pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_ID_FRAME_TIMEOUT\n");
		sas_phy_disconnected(sas_phy);
		phy->phy_attached = 0;
		sas_notify_port_event_gfp(sas_phy, PORTE_LINK_RESET_ERR,
		sas_notify_port_event(sas_phy, PORTE_LINK_RESET_ERR,
			GFP_ATOMIC);
		break;
	case HW_EVENT_LINK_ERR_PHY_RESET_FAILED:
@@ -3857,14 +3855,14 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void* piomb)
			port_id, phy_id, 0, 0);
		sas_phy_disconnected(sas_phy);
		phy->phy_attached = 0;
		sas_notify_port_event_gfp(sas_phy, PORTE_LINK_RESET_ERR,
		sas_notify_port_event(sas_phy, PORTE_LINK_RESET_ERR,
			GFP_ATOMIC);
		break;
	case HW_EVENT_PORT_RESET_TIMER_TMO:
		pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_PORT_RESET_TIMER_TMO\n");
		sas_phy_disconnected(sas_phy);
		phy->phy_attached = 0;
		sas_notify_port_event_gfp(sas_phy, PORTE_LINK_RESET_ERR,
		sas_notify_port_event(sas_phy, PORTE_LINK_RESET_ERR,
			GFP_ATOMIC);
		break;
	case HW_EVENT_PORT_RECOVERY_TIMER_TMO:
@@ -3872,7 +3870,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void* piomb)
			   "HW_EVENT_PORT_RECOVERY_TIMER_TMO\n");
		sas_phy_disconnected(sas_phy);
		phy->phy_attached = 0;
		sas_notify_port_event_gfp(sas_phy, PORTE_LINK_RESET_ERR,
		sas_notify_port_event(sas_phy, PORTE_LINK_RESET_ERR,
			GFP_ATOMIC);
		break;
	case HW_EVENT_PORT_RECOVER:
+2 −3
Original line number Diff line number Diff line
@@ -207,7 +207,7 @@ int pm8001_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func,
			if (pm8001_ha->phy[phy_id].phy_state ==
				PHY_STATE_LINK_UP_SPCV) {
				sas_phy_disconnected(&phy->sas_phy);
				sas_notify_phy_event_gfp(&phy->sas_phy,
				sas_notify_phy_event(&phy->sas_phy,
					PHYE_LOSS_OF_SIGNAL, GFP_KERNEL);
				phy->phy_attached = 0;
			}
@@ -215,7 +215,7 @@ int pm8001_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func,
			if (pm8001_ha->phy[phy_id].phy_state ==
				PHY_STATE_LINK_UP_SPC) {
				sas_phy_disconnected(&phy->sas_phy);
				sas_notify_phy_event_gfp(&phy->sas_phy,
				sas_notify_phy_event(&phy->sas_phy,
					PHYE_LOSS_OF_SIGNAL, GFP_KERNEL);
				phy->phy_attached = 0;
			}
@@ -1350,4 +1350,3 @@ int pm8001_clear_task_set(struct domain_device *dev, u8 *lun)
	tmf_task.tmf = TMF_CLEAR_TASK_SET;
	return pm8001_issue_ssp_tmf(dev, lun, &tmf_task);
}
+15 −17
Original line number Diff line number Diff line
@@ -3338,7 +3338,7 @@ hw_event_sas_phy_up(struct pm8001_hba_info *pm8001_ha, void *piomb)
	else if (phy->identify.device_type != SAS_PHY_UNUSED)
		phy->identify.target_port_protocols = SAS_PROTOCOL_SMP;
	phy->sas_phy.oob_mode = SAS_OOB_MODE;
	sas_notify_phy_event_gfp(&phy->sas_phy, PHYE_OOB_DONE, GFP_ATOMIC);
	sas_notify_phy_event(&phy->sas_phy, PHYE_OOB_DONE, GFP_ATOMIC);
	spin_lock_irqsave(&phy->sas_phy.frame_rcvd_lock, flags);
	memcpy(phy->frame_rcvd, &pPayload->sas_identify,
		sizeof(struct sas_identify_frame)-4);
@@ -3385,7 +3385,7 @@ hw_event_sata_phy_up(struct pm8001_hba_info *pm8001_ha, void *piomb)
	phy->phy_type |= PORT_TYPE_SATA;
	phy->phy_attached = 1;
	phy->sas_phy.oob_mode = SATA_OOB_MODE;
	sas_notify_phy_event_gfp(&phy->sas_phy, PHYE_OOB_DONE, GFP_ATOMIC);
	sas_notify_phy_event(&phy->sas_phy, PHYE_OOB_DONE, GFP_ATOMIC);
	spin_lock_irqsave(&phy->sas_phy.frame_rcvd_lock, flags);
	memcpy(phy->frame_rcvd, ((u8 *)&pPayload->sata_fis - 4),
		sizeof(struct dev_to_host_fis));
@@ -3468,7 +3468,7 @@ hw_event_phy_down(struct pm8001_hba_info *pm8001_ha, void *piomb)

	}
	if (port_sata && (portstate != PORT_IN_RESET))
		sas_notify_phy_event_gfp(&phy->sas_phy, PHYE_LOSS_OF_SIGNAL,
		sas_notify_phy_event(&phy->sas_phy, PHYE_LOSS_OF_SIGNAL,
				GFP_ATOMIC);
}

@@ -3567,7 +3567,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb)
		break;
	case HW_EVENT_SATA_SPINUP_HOLD:
		pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_SATA_SPINUP_HOLD\n");
		sas_notify_phy_event_gfp(&phy->sas_phy, PHYE_SPINUP_HOLD,
		sas_notify_phy_event(&phy->sas_phy, PHYE_SPINUP_HOLD,
			GFP_ATOMIC);
		break;
	case HW_EVENT_PHY_DOWN:
@@ -3584,7 +3584,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb)
		pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_PORT_INVALID\n");
		sas_phy_disconnected(sas_phy);
		phy->phy_attached = 0;
		sas_notify_port_event_gfp(sas_phy, PORTE_LINK_RESET_ERR,
		sas_notify_port_event(sas_phy, PORTE_LINK_RESET_ERR,
			GFP_ATOMIC);
		break;
	/* the broadcast change primitive received, tell the LIBSAS this event
@@ -3596,22 +3596,21 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb)
		spin_lock_irqsave(&sas_phy->sas_prim_lock, flags);
		sas_phy->sas_prim = HW_EVENT_BROADCAST_CHANGE;
		spin_unlock_irqrestore(&sas_phy->sas_prim_lock, flags);
		sas_notify_port_event_gfp(sas_phy, PORTE_BROADCAST_RCVD,
		sas_notify_port_event(sas_phy, PORTE_BROADCAST_RCVD,
			GFP_ATOMIC);
		break;
	case HW_EVENT_PHY_ERROR:
		pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_PHY_ERROR\n");
		sas_phy_disconnected(&phy->sas_phy);
		phy->phy_attached = 0;
		sas_notify_phy_event_gfp(&phy->sas_phy, PHYE_OOB_ERROR,
			GFP_ATOMIC);
		sas_notify_phy_event(&phy->sas_phy, PHYE_OOB_ERROR, GFP_ATOMIC);
		break;
	case HW_EVENT_BROADCAST_EXP:
		pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_BROADCAST_EXP\n");
		spin_lock_irqsave(&sas_phy->sas_prim_lock, flags);
		sas_phy->sas_prim = HW_EVENT_BROADCAST_EXP;
		spin_unlock_irqrestore(&sas_phy->sas_prim_lock, flags);
		sas_notify_port_event_gfp(sas_phy, PORTE_BROADCAST_RCVD,
		sas_notify_port_event(sas_phy, PORTE_BROADCAST_RCVD,
			GFP_ATOMIC);
		break;
	case HW_EVENT_LINK_ERR_INVALID_DWORD:
@@ -3649,7 +3648,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb)
		spin_lock_irqsave(&sas_phy->sas_prim_lock, flags);
		sas_phy->sas_prim = HW_EVENT_BROADCAST_SES;
		spin_unlock_irqrestore(&sas_phy->sas_prim_lock, flags);
		sas_notify_port_event_gfp(sas_phy, PORTE_BROADCAST_RCVD,
		sas_notify_port_event(sas_phy, PORTE_BROADCAST_RCVD,
			GFP_ATOMIC);
		break;
	case HW_EVENT_INBOUND_CRC_ERROR:
@@ -3660,14 +3659,13 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb)
		break;
	case HW_EVENT_HARD_RESET_RECEIVED:
		pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_HARD_RESET_RECEIVED\n");
		sas_notify_port_event_gfp(sas_phy, PORTE_HARD_RESET,
			GFP_ATOMIC);
		sas_notify_port_event(sas_phy, PORTE_HARD_RESET, GFP_ATOMIC);
		break;
	case HW_EVENT_ID_FRAME_TIMEOUT:
		pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_ID_FRAME_TIMEOUT\n");
		sas_phy_disconnected(sas_phy);
		phy->phy_attached = 0;
		sas_notify_port_event_gfp(sas_phy, PORTE_LINK_RESET_ERR,
		sas_notify_port_event(sas_phy, PORTE_LINK_RESET_ERR,
			GFP_ATOMIC);
		break;
	case HW_EVENT_LINK_ERR_PHY_RESET_FAILED:
@@ -3678,7 +3676,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb)
			port_id, phy_id, 0, 0);
		sas_phy_disconnected(sas_phy);
		phy->phy_attached = 0;
		sas_notify_port_event_gfp(sas_phy, PORTE_LINK_RESET_ERR,
		sas_notify_port_event(sas_phy, PORTE_LINK_RESET_ERR,
			GFP_ATOMIC);
		break;
	case HW_EVENT_PORT_RESET_TIMER_TMO:
@@ -3687,7 +3685,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb)
			port_id, phy_id, 0, 0);
		sas_phy_disconnected(sas_phy);
		phy->phy_attached = 0;
		sas_notify_port_event_gfp(sas_phy, PORTE_LINK_RESET_ERR,
		sas_notify_port_event(sas_phy, PORTE_LINK_RESET_ERR,
			GFP_ATOMIC);
		if (pm8001_ha->phy[phy_id].reset_completion) {
			pm8001_ha->phy[phy_id].port_reset_status =
@@ -3705,7 +3703,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb)
		for (i = 0; i < pm8001_ha->chip->n_phy; i++) {
			if (port->wide_port_phymap & (1 << i)) {
				phy = &pm8001_ha->phy[i];
				sas_notify_phy_event_gfp(&phy->sas_phy,
				sas_notify_phy_event(&phy->sas_phy,
					PHYE_LOSS_OF_SIGNAL, GFP_ATOMIC);
				port->wide_port_phymap &= ~(1 << i);
			}