Commit 4cabf094 authored by Michal Kalderon's avatar Michal Kalderon Committed by Greg Kroah-Hartman

qed: Set the doorbell address correctly

[ Upstream commit 8366d520 ]

In 100g mode the doorbell bar is united for both engines. Set
the correct offset in the hwfn so that the doorbell returned
for RoCE is in the affined hwfn.
Signed-off-by: default avatarAriel Elior <ariel.elior@marvell.com>
Signed-off-by: default avatarDenis Bolotin <denis.bolotin@marvell.com>
Signed-off-by: default avatarMichal Kalderon <michal.kalderon@marvell.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 4c5213f8
...@@ -3441,6 +3441,7 @@ static void qed_nvm_info_free(struct qed_hwfn *p_hwfn) ...@@ -3441,6 +3441,7 @@ static void qed_nvm_info_free(struct qed_hwfn *p_hwfn)
static int qed_hw_prepare_single(struct qed_hwfn *p_hwfn, static int qed_hw_prepare_single(struct qed_hwfn *p_hwfn,
void __iomem *p_regview, void __iomem *p_regview,
void __iomem *p_doorbells, void __iomem *p_doorbells,
u64 db_phys_addr,
enum qed_pci_personality personality) enum qed_pci_personality personality)
{ {
struct qed_dev *cdev = p_hwfn->cdev; struct qed_dev *cdev = p_hwfn->cdev;
...@@ -3449,6 +3450,7 @@ static int qed_hw_prepare_single(struct qed_hwfn *p_hwfn, ...@@ -3449,6 +3450,7 @@ static int qed_hw_prepare_single(struct qed_hwfn *p_hwfn,
/* Split PCI bars evenly between hwfns */ /* Split PCI bars evenly between hwfns */
p_hwfn->regview = p_regview; p_hwfn->regview = p_regview;
p_hwfn->doorbells = p_doorbells; p_hwfn->doorbells = p_doorbells;
p_hwfn->db_phys_addr = db_phys_addr;
if (IS_VF(p_hwfn->cdev)) if (IS_VF(p_hwfn->cdev))
return qed_vf_hw_prepare(p_hwfn); return qed_vf_hw_prepare(p_hwfn);
...@@ -3544,7 +3546,9 @@ int qed_hw_prepare(struct qed_dev *cdev, ...@@ -3544,7 +3546,9 @@ int qed_hw_prepare(struct qed_dev *cdev,
/* Initialize the first hwfn - will learn number of hwfns */ /* Initialize the first hwfn - will learn number of hwfns */
rc = qed_hw_prepare_single(p_hwfn, rc = qed_hw_prepare_single(p_hwfn,
cdev->regview, cdev->regview,
cdev->doorbells, personality); cdev->doorbells,
cdev->db_phys_addr,
personality);
if (rc) if (rc)
return rc; return rc;
...@@ -3553,22 +3557,25 @@ int qed_hw_prepare(struct qed_dev *cdev, ...@@ -3553,22 +3557,25 @@ int qed_hw_prepare(struct qed_dev *cdev,
/* Initialize the rest of the hwfns */ /* Initialize the rest of the hwfns */
if (cdev->num_hwfns > 1) { if (cdev->num_hwfns > 1) {
void __iomem *p_regview, *p_doorbell; void __iomem *p_regview, *p_doorbell;
u8 __iomem *addr; u64 db_phys_addr;
u32 offset;
/* adjust bar offset for second engine */ /* adjust bar offset for second engine */
addr = cdev->regview + offset = qed_hw_bar_size(p_hwfn, p_hwfn->p_main_ptt,
qed_hw_bar_size(p_hwfn, p_hwfn->p_main_ptt,
BAR_ID_0) / 2; BAR_ID_0) / 2;
p_regview = addr; p_regview = cdev->regview + offset;
addr = cdev->doorbells + offset = qed_hw_bar_size(p_hwfn, p_hwfn->p_main_ptt,
qed_hw_bar_size(p_hwfn, p_hwfn->p_main_ptt,
BAR_ID_1) / 2; BAR_ID_1) / 2;
p_doorbell = addr;
p_doorbell = cdev->doorbells + offset;
db_phys_addr = cdev->db_phys_addr + offset;
/* prepare second hw function */ /* prepare second hw function */
rc = qed_hw_prepare_single(&cdev->hwfns[1], p_regview, rc = qed_hw_prepare_single(&cdev->hwfns[1], p_regview,
p_doorbell, personality); p_doorbell, db_phys_addr,
personality);
/* in case of error, need to free the previously /* in case of error, need to free the previously
* initiliazed hwfn 0. * initiliazed hwfn 0.
......
...@@ -803,7 +803,7 @@ static int qed_rdma_add_user(void *rdma_cxt, ...@@ -803,7 +803,7 @@ static int qed_rdma_add_user(void *rdma_cxt,
dpi_start_offset + dpi_start_offset +
((out_params->dpi) * p_hwfn->dpi_size)); ((out_params->dpi) * p_hwfn->dpi_size));
out_params->dpi_phys_addr = p_hwfn->cdev->db_phys_addr + out_params->dpi_phys_addr = p_hwfn->db_phys_addr +
dpi_start_offset + dpi_start_offset +
((out_params->dpi) * p_hwfn->dpi_size); ((out_params->dpi) * p_hwfn->dpi_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