RDMA/hns: Move spin_lock_irqsave to the correct place
When hip08 set gid, it will call spin_unlock_bh when send cmq. if main.ko
call spin_lock_irqsave firstly, and the kernel is before commit
f71b74bca6
("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.
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.
Signed-off-by: Lang Cheng <chenglang@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
This commit is contained in:
parent
0502849d0b
commit
780f33962e
|
@ -1741,11 +1741,14 @@ static int hns_roce_v1_set_gid(struct hns_roce_dev *hr_dev, u8 port,
|
||||||
int gid_index, const union ib_gid *gid,
|
int gid_index, const union ib_gid *gid,
|
||||||
const struct ib_gid_attr *attr)
|
const struct ib_gid_attr *attr)
|
||||||
{
|
{
|
||||||
|
unsigned long flags;
|
||||||
u32 *p = NULL;
|
u32 *p = NULL;
|
||||||
u8 gid_idx = 0;
|
u8 gid_idx = 0;
|
||||||
|
|
||||||
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));
|
||||||
|
@ -1762,6 +1765,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,18 +78,13 @@ static int hns_roce_add_gid(const struct ib_gid_attr *attr, void **context)
|
||||||
{
|
{
|
||||||
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)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
spin_lock_irqsave(&hr_dev->iboe.lock, flags);
|
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
spin_unlock_irqrestore(&hr_dev->iboe.lock, flags);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,18 +93,13 @@ static int hns_roce_del_gid(const struct ib_gid_attr *attr, void **context)
|
||||||
struct hns_roce_dev *hr_dev = to_hr_dev(attr->device);
|
struct hns_roce_dev *hr_dev = to_hr_dev(attr->device);
|
||||||
struct ib_gid_attr zattr = { };
|
struct ib_gid_attr zattr = { };
|
||||||
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)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
spin_lock_irqsave(&hr_dev->iboe.lock, flags);
|
|
||||||
|
|
||||||
ret = hr_dev->hw->set_gid(hr_dev, port, attr->index, &zgid, &zattr);
|
ret = hr_dev->hw->set_gid(hr_dev, port, attr->index, &zgid, &zattr);
|
||||||
|
|
||||||
spin_unlock_irqrestore(&hr_dev->iboe.lock, flags);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue