提交 84d2487d 编写于 作者: L Lang Cheng 提交者: Xie XiuQi

RDMA/hns: move spin_lock_irqsave to hw_v1.ko when hip06 set gid

driver inclusion
category: bugfix
bugzilla: NA
CVE: NA

1.When hip08 set gid, hw_v2.ko will call spin_unlock_bh when send cmq.
if main.ko call spin_lock_irqsave firstly, and the kernel is before
commit f71b74bc ("irq/softirqs: Use lockdep to assert IRQs are
disabled/enabled"), it will cause WARN_ON_ONCE because of calling
spin_unlock_bh in disable context.

2. In fact, the spin_lock_irqsave in main.ko is only used for hip06,
and should be placed in hns_roce_hw_v1.c. hns_roce_hw_v2.c uses its own
spin_unlock_bh and does not need main.ko manage spin_lock.

Fixes: 29b3d4fe7fc3 ("RDMA/hns:Remove redundant spin_lock operations")

Feature or Bugfix:Bugfix
Signed-off-by: NLang Cheng <chenglang@huawei.com>
Reviewed-by: Noulijun <oulijun@huawei.com>
Reviewed-by: Nliuyixian <liuyixian@huawei.com>
Reviewed-by: NYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 2a510d49
...@@ -1812,9 +1812,12 @@ static int hns_roce_v1_set_gid(struct hns_roce_dev *hr_dev, u8 port, ...@@ -1812,9 +1812,12 @@ static int hns_roce_v1_set_gid(struct hns_roce_dev *hr_dev, u8 port,
{ {
u32 *p = NULL; u32 *p = NULL;
u8 gid_idx = 0; u8 gid_idx = 0;
unsigned long flags;
gid_idx = hns_get_gid_index(hr_dev, port, gid_index); gid_idx = hns_get_gid_index(hr_dev, port, gid_index);
spin_lock_irqsave(&hr_dev->iboe.lock, flags);
p = (u32 *)&gid->raw[0]; p = (u32 *)&gid->raw[0];
roce_raw_write(*p, hr_dev->reg_base + ROCEE_PORT_GID_L_0_REG + roce_raw_write(*p, hr_dev->reg_base + ROCEE_PORT_GID_L_0_REG +
(HNS_ROCE_V1_GID_NUM * gid_idx)); (HNS_ROCE_V1_GID_NUM * gid_idx));
...@@ -1831,6 +1834,8 @@ static int hns_roce_v1_set_gid(struct hns_roce_dev *hr_dev, u8 port, ...@@ -1831,6 +1834,8 @@ static int hns_roce_v1_set_gid(struct hns_roce_dev *hr_dev, u8 port,
roce_raw_write(*p, hr_dev->reg_base + ROCEE_PORT_GID_H_0_REG + roce_raw_write(*p, hr_dev->reg_base + ROCEE_PORT_GID_H_0_REG +
(HNS_ROCE_V1_GID_NUM * gid_idx)); (HNS_ROCE_V1_GID_NUM * gid_idx));
spin_unlock_irqrestore(&hr_dev->iboe.lock, flags);
return 0; return 0;
} }
......
...@@ -99,7 +99,6 @@ static int hns_roce_add_gid(const union ib_gid *gid, ...@@ -99,7 +99,6 @@ static int hns_roce_add_gid(const union ib_gid *gid,
{ {
struct hns_roce_dev *hr_dev = to_hr_dev(attr->device); struct hns_roce_dev *hr_dev = to_hr_dev(attr->device);
u8 port = attr->port_num - 1; u8 port = attr->port_num - 1;
unsigned long flags;
int ret; int ret;
if (port >= hr_dev->caps.num_ports || if (port >= hr_dev->caps.num_ports ||
...@@ -109,7 +108,6 @@ static int hns_roce_add_gid(const union ib_gid *gid, ...@@ -109,7 +108,6 @@ static int hns_roce_add_gid(const union ib_gid *gid,
return -EINVAL; return -EINVAL;
} }
spin_lock_irqsave(&hr_dev->iboe.lock, flags);
#ifdef CONFIG_KERNEL_419 #ifdef CONFIG_KERNEL_419
ret = hr_dev->hw->set_gid(hr_dev, port, attr->index, &attr->gid, attr); ret = hr_dev->hw->set_gid(hr_dev, port, attr->index, &attr->gid, attr);
#else #else
...@@ -121,8 +119,6 @@ static int hns_roce_add_gid(const union ib_gid *gid, ...@@ -121,8 +119,6 @@ static int hns_roce_add_gid(const union ib_gid *gid,
dev_err(hr_dev->dev, "set gid failed(%d), index = %d", ret, dev_err(hr_dev->dev, "set gid failed(%d), index = %d", ret,
attr->index); attr->index);
spin_unlock_irqrestore(&hr_dev->iboe.lock, flags);
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册