qed: Fix reading stale configuration information
Configuration information read at driver load can become stale after it is updated. Mark information as not valid and re-populate when this happens. Signed-off-by: Denis Bolotin <denis.bolotin@cavium.com> Signed-off-by: Ariel Elior <ariel.elior@cavium.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
df8ed346d4
commit
5e7ba042fd
@ -502,6 +502,7 @@ enum BAR_ID {
|
|||||||
struct qed_nvm_image_info {
|
struct qed_nvm_image_info {
|
||||||
u32 num_images;
|
u32 num_images;
|
||||||
struct bist_nvm_image_att *image_att;
|
struct bist_nvm_image_att *image_att;
|
||||||
|
bool valid;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define DRV_MODULE_VERSION \
|
#define DRV_MODULE_VERSION \
|
||||||
|
@ -592,6 +592,9 @@ int qed_mcp_nvm_wr_cmd(struct qed_hwfn *p_hwfn,
|
|||||||
*o_mcp_resp = mb_params.mcp_resp;
|
*o_mcp_resp = mb_params.mcp_resp;
|
||||||
*o_mcp_param = mb_params.mcp_param;
|
*o_mcp_param = mb_params.mcp_param;
|
||||||
|
|
||||||
|
/* nvm_info needs to be updated */
|
||||||
|
p_hwfn->nvm_info.valid = false;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2555,11 +2558,14 @@ int qed_mcp_bist_nvm_get_image_att(struct qed_hwfn *p_hwfn,
|
|||||||
|
|
||||||
int qed_mcp_nvm_info_populate(struct qed_hwfn *p_hwfn)
|
int qed_mcp_nvm_info_populate(struct qed_hwfn *p_hwfn)
|
||||||
{
|
{
|
||||||
struct qed_nvm_image_info *nvm_info = &p_hwfn->nvm_info;
|
struct qed_nvm_image_info nvm_info;
|
||||||
struct qed_ptt *p_ptt;
|
struct qed_ptt *p_ptt;
|
||||||
int rc;
|
int rc;
|
||||||
u32 i;
|
u32 i;
|
||||||
|
|
||||||
|
if (p_hwfn->nvm_info.valid)
|
||||||
|
return 0;
|
||||||
|
|
||||||
p_ptt = qed_ptt_acquire(p_hwfn);
|
p_ptt = qed_ptt_acquire(p_hwfn);
|
||||||
if (!p_ptt) {
|
if (!p_ptt) {
|
||||||
DP_ERR(p_hwfn, "failed to acquire ptt\n");
|
DP_ERR(p_hwfn, "failed to acquire ptt\n");
|
||||||
@ -2567,29 +2573,29 @@ int qed_mcp_nvm_info_populate(struct qed_hwfn *p_hwfn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Acquire from MFW the amount of available images */
|
/* Acquire from MFW the amount of available images */
|
||||||
nvm_info->num_images = 0;
|
nvm_info.num_images = 0;
|
||||||
rc = qed_mcp_bist_nvm_get_num_images(p_hwfn,
|
rc = qed_mcp_bist_nvm_get_num_images(p_hwfn,
|
||||||
p_ptt, &nvm_info->num_images);
|
p_ptt, &nvm_info.num_images);
|
||||||
if (rc == -EOPNOTSUPP) {
|
if (rc == -EOPNOTSUPP) {
|
||||||
DP_INFO(p_hwfn, "DRV_MSG_CODE_BIST_TEST is not supported\n");
|
DP_INFO(p_hwfn, "DRV_MSG_CODE_BIST_TEST is not supported\n");
|
||||||
goto out;
|
goto out;
|
||||||
} else if (rc || !nvm_info->num_images) {
|
} else if (rc || !nvm_info.num_images) {
|
||||||
DP_ERR(p_hwfn, "Failed getting number of images\n");
|
DP_ERR(p_hwfn, "Failed getting number of images\n");
|
||||||
goto err0;
|
goto err0;
|
||||||
}
|
}
|
||||||
|
|
||||||
nvm_info->image_att = kmalloc_array(nvm_info->num_images,
|
nvm_info.image_att = kmalloc_array(nvm_info.num_images,
|
||||||
sizeof(struct bist_nvm_image_att),
|
sizeof(struct bist_nvm_image_att),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (!nvm_info->image_att) {
|
if (!nvm_info.image_att) {
|
||||||
rc = -ENOMEM;
|
rc = -ENOMEM;
|
||||||
goto err0;
|
goto err0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Iterate over images and get their attributes */
|
/* Iterate over images and get their attributes */
|
||||||
for (i = 0; i < nvm_info->num_images; i++) {
|
for (i = 0; i < nvm_info.num_images; i++) {
|
||||||
rc = qed_mcp_bist_nvm_get_image_att(p_hwfn, p_ptt,
|
rc = qed_mcp_bist_nvm_get_image_att(p_hwfn, p_ptt,
|
||||||
&nvm_info->image_att[i], i);
|
&nvm_info.image_att[i], i);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
DP_ERR(p_hwfn,
|
DP_ERR(p_hwfn,
|
||||||
"Failed getting image index %d attributes\n", i);
|
"Failed getting image index %d attributes\n", i);
|
||||||
@ -2597,14 +2603,22 @@ int qed_mcp_nvm_info_populate(struct qed_hwfn *p_hwfn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
DP_VERBOSE(p_hwfn, QED_MSG_SP, "image index %d, size %x\n", i,
|
DP_VERBOSE(p_hwfn, QED_MSG_SP, "image index %d, size %x\n", i,
|
||||||
nvm_info->image_att[i].len);
|
nvm_info.image_att[i].len);
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
|
/* Update hwfn's nvm_info */
|
||||||
|
if (nvm_info.num_images) {
|
||||||
|
p_hwfn->nvm_info.num_images = nvm_info.num_images;
|
||||||
|
kfree(p_hwfn->nvm_info.image_att);
|
||||||
|
p_hwfn->nvm_info.image_att = nvm_info.image_att;
|
||||||
|
p_hwfn->nvm_info.valid = true;
|
||||||
|
}
|
||||||
|
|
||||||
qed_ptt_release(p_hwfn, p_ptt);
|
qed_ptt_release(p_hwfn, p_ptt);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err1:
|
err1:
|
||||||
kfree(nvm_info->image_att);
|
kfree(nvm_info.image_att);
|
||||||
err0:
|
err0:
|
||||||
qed_ptt_release(p_hwfn, p_ptt);
|
qed_ptt_release(p_hwfn, p_ptt);
|
||||||
return rc;
|
return rc;
|
||||||
@ -2641,6 +2655,7 @@ qed_mcp_get_nvm_image_att(struct qed_hwfn *p_hwfn,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qed_mcp_nvm_info_populate(p_hwfn);
|
||||||
for (i = 0; i < p_hwfn->nvm_info.num_images; i++)
|
for (i = 0; i < p_hwfn->nvm_info.num_images; i++)
|
||||||
if (type == p_hwfn->nvm_info.image_att[i].image_type)
|
if (type == p_hwfn->nvm_info.image_att[i].image_type)
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user