Commit 913cc671 authored by Sebastian Sanchez's avatar Sebastian Sanchez Committed by Doug Ledford

IB/hfi1: Always perform offline transition

Always initiate an offline transition request
when a link down occurs. The firmware will
use this request to confirm that the driver
has seen the link down message. A host version
is set to indicate this driver behavior to the
firmware.
Reviewed-by: default avatarDean Luick <dean.luick@intel.com>
Signed-off-by: default avatarSebastian Sanchez <sebastian.sanchez@intel.com>
Signed-off-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 626c077c
...@@ -8832,6 +8832,20 @@ static void read_remote_device_id(struct hfi1_devdata *dd, u16 *device_id, ...@@ -8832,6 +8832,20 @@ static void read_remote_device_id(struct hfi1_devdata *dd, u16 *device_id,
& REMOTE_DEVICE_REV_MASK; & REMOTE_DEVICE_REV_MASK;
} }
int write_host_interface_version(struct hfi1_devdata *dd, u8 version)
{
u32 frame;
u32 mask;
mask = (HOST_INTERFACE_VERSION_MASK << HOST_INTERFACE_VERSION_SHIFT);
read_8051_config(dd, RESERVED_REGISTERS, GENERAL_CONFIG, &frame);
/* Clear, then set field */
frame &= ~mask;
frame |= ((u32)version << HOST_INTERFACE_VERSION_SHIFT);
return load_8051_config(dd, RESERVED_REGISTERS, GENERAL_CONFIG,
frame);
}
void read_misc_status(struct hfi1_devdata *dd, u8 *ver_major, u8 *ver_minor, void read_misc_status(struct hfi1_devdata *dd, u8 *ver_major, u8 *ver_minor,
u8 *ver_patch) u8 *ver_patch)
{ {
...@@ -10262,30 +10276,16 @@ static void force_logical_link_state_down(struct hfi1_pportdata *ppd) ...@@ -10262,30 +10276,16 @@ static void force_logical_link_state_down(struct hfi1_pportdata *ppd)
static int goto_offline(struct hfi1_pportdata *ppd, u8 rem_reason) static int goto_offline(struct hfi1_pportdata *ppd, u8 rem_reason)
{ {
struct hfi1_devdata *dd = ppd->dd; struct hfi1_devdata *dd = ppd->dd;
u32 pstate, previous_state; u32 previous_state;
int ret; int ret;
int do_transition;
int do_wait;
update_lcb_cache(dd); update_lcb_cache(dd);
previous_state = ppd->host_link_state; previous_state = ppd->host_link_state;
ppd->host_link_state = HLS_GOING_OFFLINE; ppd->host_link_state = HLS_GOING_OFFLINE;
pstate = read_physical_state(dd);
if (pstate == PLS_OFFLINE) {
do_transition = 0; /* in right state */
do_wait = 0; /* ...no need to wait */
} else if ((pstate & 0xf0) == PLS_OFFLINE) {
do_transition = 0; /* in an offline transient state */
do_wait = 1; /* ...wait for it to settle */
} else {
do_transition = 1; /* need to move to offline */
do_wait = 1; /* ...will need to wait */
}
if (do_transition) { /* start offline transition */
ret = set_physical_link_state(dd, ret = set_physical_link_state(dd, (rem_reason << 8) | PLS_OFFLINE);
(rem_reason << 8) | PLS_OFFLINE);
if (ret != HCMD_SUCCESS) { if (ret != HCMD_SUCCESS) {
dd_dev_err(dd, dd_dev_err(dd,
...@@ -10297,14 +10297,14 @@ static int goto_offline(struct hfi1_pportdata *ppd, u8 rem_reason) ...@@ -10297,14 +10297,14 @@ static int goto_offline(struct hfi1_pportdata *ppd, u8 rem_reason)
HFI1_ODR_MASK(OPA_LINKDOWN_REASON_NONE)) HFI1_ODR_MASK(OPA_LINKDOWN_REASON_NONE))
ppd->offline_disabled_reason = ppd->offline_disabled_reason =
HFI1_ODR_MASK(OPA_LINKDOWN_REASON_TRANSIENT); HFI1_ODR_MASK(OPA_LINKDOWN_REASON_TRANSIENT);
}
if (do_wait) { /*
/* it can take a while for the link to go down */ * Wait for offline transition. It can take a while for
* the link to go down.
*/
ret = wait_physical_linkstate(ppd, PLS_OFFLINE, 10000); ret = wait_physical_linkstate(ppd, PLS_OFFLINE, 10000);
if (ret < 0) if (ret < 0)
return ret; return ret;
}
/* /*
* Now in charge of LCB - must be after the physical state is * Now in charge of LCB - must be after the physical state is
......
...@@ -384,6 +384,7 @@ ...@@ -384,6 +384,7 @@
#define VERIFY_CAP_LOCAL_FABRIC 0x08 #define VERIFY_CAP_LOCAL_FABRIC 0x08
#define VERIFY_CAP_LOCAL_LINK_WIDTH 0x09 #define VERIFY_CAP_LOCAL_LINK_WIDTH 0x09
#define LOCAL_DEVICE_ID 0x0a #define LOCAL_DEVICE_ID 0x0a
#define RESERVED_REGISTERS 0x0b
#define LOCAL_LNI_INFO 0x0c #define LOCAL_LNI_INFO 0x0c
#define REMOTE_LNI_INFO 0x0d #define REMOTE_LNI_INFO 0x0d
#define MISC_STATUS 0x0e #define MISC_STATUS 0x0e
...@@ -506,6 +507,9 @@ ...@@ -506,6 +507,9 @@
#define DOWN_REMOTE_REASON_SHIFT 16 #define DOWN_REMOTE_REASON_SHIFT 16
#define DOWN_REMOTE_REASON_MASK 0xff #define DOWN_REMOTE_REASON_MASK 0xff
#define HOST_INTERFACE_VERSION_SHIFT 16
#define HOST_INTERFACE_VERSION_MASK 0xff
/* verify capability PHY power management bits */ /* verify capability PHY power management bits */
#define PWRM_BER_CONTROL 0x1 #define PWRM_BER_CONTROL 0x1
#define PWRM_BANDWIDTH_CONTROL 0x2 #define PWRM_BANDWIDTH_CONTROL 0x2
...@@ -704,6 +708,7 @@ int read_8051_data(struct hfi1_devdata *dd, u32 addr, u32 len, u64 *result); ...@@ -704,6 +708,7 @@ int read_8051_data(struct hfi1_devdata *dd, u32 addr, u32 len, u64 *result);
/* chip.c */ /* chip.c */
void read_misc_status(struct hfi1_devdata *dd, u8 *ver_major, u8 *ver_minor, void read_misc_status(struct hfi1_devdata *dd, u8 *ver_major, u8 *ver_minor,
u8 *ver_patch); u8 *ver_patch);
int write_host_interface_version(struct hfi1_devdata *dd, u8 version);
void read_guid(struct hfi1_devdata *dd); void read_guid(struct hfi1_devdata *dd);
int wait_fm_ready(struct hfi1_devdata *dd, u32 mstimeout); int wait_fm_ready(struct hfi1_devdata *dd, u32 mstimeout);
void set_link_down_reason(struct hfi1_pportdata *ppd, u8 lcl_reason, void set_link_down_reason(struct hfi1_pportdata *ppd, u8 lcl_reason,
......
...@@ -69,6 +69,7 @@ ...@@ -69,6 +69,7 @@
#define ALT_FW_FABRIC_NAME "hfi1_fabric_d.fw" #define ALT_FW_FABRIC_NAME "hfi1_fabric_d.fw"
#define ALT_FW_SBUS_NAME "hfi1_sbus_d.fw" #define ALT_FW_SBUS_NAME "hfi1_sbus_d.fw"
#define ALT_FW_PCIE_NAME "hfi1_pcie_d.fw" #define ALT_FW_PCIE_NAME "hfi1_pcie_d.fw"
#define HOST_INTERFACE_VERSION 1
static uint fw_8051_load = 1; static uint fw_8051_load = 1;
static uint fw_fabric_serdes_load = 1; static uint fw_fabric_serdes_load = 1;
...@@ -1087,6 +1088,13 @@ static int load_8051_firmware(struct hfi1_devdata *dd, ...@@ -1087,6 +1088,13 @@ static int load_8051_firmware(struct hfi1_devdata *dd,
dd_dev_info(dd, "8051 firmware version %d.%d.%d\n", dd_dev_info(dd, "8051 firmware version %d.%d.%d\n",
(int)ver_major, (int)ver_minor, (int)ver_patch); (int)ver_major, (int)ver_minor, (int)ver_patch);
dd->dc8051_ver = dc8051_ver(ver_major, ver_minor, ver_patch); dd->dc8051_ver = dc8051_ver(ver_major, ver_minor, ver_patch);
ret = write_host_interface_version(dd, HOST_INTERFACE_VERSION);
if (ret != HCMD_SUCCESS) {
dd_dev_err(dd,
"Failed to set host interface version, return 0x%x\n",
ret);
return -EIO;
}
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment