Commit 3a50d351 authored by Mintz, Yuval's avatar Mintz, Yuval Committed by David S. Miller

qed: Warn PTT usage by wrong hw-function

PTT entries are per-hwfn; If some errneous flow is trying
to use a PTT belonging to a differnet hwfn warn user, as this
can break every register accessing flow later and is very hard
to root-cause.
Signed-off-by: default avatarYuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ec1af27e
...@@ -58,6 +58,7 @@ struct qed_ptt { ...@@ -58,6 +58,7 @@ struct qed_ptt {
struct list_head list_entry; struct list_head list_entry;
unsigned int idx; unsigned int idx;
struct pxp_ptt_entry pxp; struct pxp_ptt_entry pxp;
u8 hwfn_id;
}; };
struct qed_ptt_pool { struct qed_ptt_pool {
...@@ -79,6 +80,7 @@ int qed_ptt_pool_alloc(struct qed_hwfn *p_hwfn) ...@@ -79,6 +80,7 @@ int qed_ptt_pool_alloc(struct qed_hwfn *p_hwfn)
p_pool->ptts[i].idx = i; p_pool->ptts[i].idx = i;
p_pool->ptts[i].pxp.offset = QED_BAR_INVALID_OFFSET; p_pool->ptts[i].pxp.offset = QED_BAR_INVALID_OFFSET;
p_pool->ptts[i].pxp.pretend.control = 0; p_pool->ptts[i].pxp.pretend.control = 0;
p_pool->ptts[i].hwfn_id = p_hwfn->my_id;
if (i >= RESERVED_PTT_MAX) if (i >= RESERVED_PTT_MAX)
list_add(&p_pool->ptts[i].list_entry, list_add(&p_pool->ptts[i].list_entry,
&p_pool->free_list); &p_pool->free_list);
...@@ -193,6 +195,11 @@ static u32 qed_set_ptt(struct qed_hwfn *p_hwfn, ...@@ -193,6 +195,11 @@ static u32 qed_set_ptt(struct qed_hwfn *p_hwfn,
offset = hw_addr - win_hw_addr; offset = hw_addr - win_hw_addr;
if (p_ptt->hwfn_id != p_hwfn->my_id)
DP_NOTICE(p_hwfn,
"ptt[%d] of hwfn[%02x] is used by hwfn[%02x]!\n",
p_ptt->idx, p_ptt->hwfn_id, p_hwfn->my_id);
/* Verify the address is within the window */ /* Verify the address is within the window */
if (hw_addr < win_hw_addr || if (hw_addr < win_hw_addr ||
offset >= PXP_EXTERNAL_BAR_PF_WINDOW_SINGLE_SIZE) { offset >= PXP_EXTERNAL_BAR_PF_WINDOW_SINGLE_SIZE) {
......
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