diff options
author | Dan Williams <dan.j.williams@intel.com> | 2011-06-24 02:44:52 -0400 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2011-07-03 07:04:51 -0400 |
commit | 4cffe13e0dfd00f90c86b0153c751dab61a1bf1d (patch) | |
tree | c9d04a30f845dcaa0eb750405e63bb43ca5657f1 | |
parent | 7cafbf1bd56be44038148bb8f733ea6e6a6a2d53 (diff) |
isci: fix frame received locking
Updates to the frame_rcvd before need to be atomic with respect to when
they are evaluated by libsas.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
-rw-r--r-- | drivers/scsi/isci/phy.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/scsi/isci/phy.c b/drivers/scsi/isci/phy.c index 93a401dfbd30..c01d76210aa2 100644 --- a/drivers/scsi/isci/phy.c +++ b/drivers/scsi/isci/phy.c | |||
@@ -893,6 +893,7 @@ enum sci_status scic_sds_phy_frame_handler(struct scic_sds_phy *sci_phy, | |||
893 | enum scic_sds_phy_states state = sci_phy->sm.current_state_id; | 893 | enum scic_sds_phy_states state = sci_phy->sm.current_state_id; |
894 | struct scic_sds_controller *scic = sci_phy->owning_port->owning_controller; | 894 | struct scic_sds_controller *scic = sci_phy->owning_port->owning_controller; |
895 | enum sci_status result; | 895 | enum sci_status result; |
896 | unsigned long flags; | ||
896 | 897 | ||
897 | switch (state) { | 898 | switch (state) { |
898 | case SCI_PHY_SUB_AWAIT_IAF_UF: { | 899 | case SCI_PHY_SUB_AWAIT_IAF_UF: { |
@@ -911,7 +912,9 @@ enum sci_status scic_sds_phy_frame_handler(struct scic_sds_phy *sci_phy, | |||
911 | if (iaf.frame_type == 0) { | 912 | if (iaf.frame_type == 0) { |
912 | u32 state; | 913 | u32 state; |
913 | 914 | ||
915 | spin_lock_irqsave(&iphy->sas_phy.frame_rcvd_lock, flags); | ||
914 | memcpy(&iphy->frame_rcvd.iaf, &iaf, sizeof(iaf)); | 916 | memcpy(&iphy->frame_rcvd.iaf, &iaf, sizeof(iaf)); |
917 | spin_unlock_irqrestore(&iphy->sas_phy.frame_rcvd_lock, flags); | ||
915 | if (iaf.smp_tport) { | 918 | if (iaf.smp_tport) { |
916 | /* We got the IAF for an expander PHY go to the final | 919 | /* We got the IAF for an expander PHY go to the final |
917 | * state since there are no power requirements for | 920 | * state since there are no power requirements for |
@@ -954,9 +957,11 @@ enum sci_status scic_sds_phy_frame_handler(struct scic_sds_phy *sci_phy, | |||
954 | frame_index, | 957 | frame_index, |
955 | (void **)&fis_frame_data); | 958 | (void **)&fis_frame_data); |
956 | 959 | ||
960 | spin_lock_irqsave(&iphy->sas_phy.frame_rcvd_lock, flags); | ||
957 | scic_sds_controller_copy_sata_response(&iphy->frame_rcvd.fis, | 961 | scic_sds_controller_copy_sata_response(&iphy->frame_rcvd.fis, |
958 | frame_header, | 962 | frame_header, |
959 | fis_frame_data); | 963 | fis_frame_data); |
964 | spin_unlock_irqrestore(&iphy->sas_phy.frame_rcvd_lock, flags); | ||
960 | 965 | ||
961 | /* got IAF we can now go to the await spinup semaphore state */ | 966 | /* got IAF we can now go to the await spinup semaphore state */ |
962 | sci_change_state(&sci_phy->sm, SCI_PHY_SUB_FINAL); | 967 | sci_change_state(&sci_phy->sm, SCI_PHY_SUB_FINAL); |