mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-04 04:04:19 +00:00
RDMA/hns: Disassociate mmap pages for all uctx when HW is being reset
When HW is being reset, userspace should not ring doorbell otherwise
it may lead to abnormal consequence such as RAS.
Disassociate mmap pages for all uctx to prevent userspace from ringing
doorbell to HW. Since all resources will be destroyed during HW reset,
no new mmap is allowed after HW reset is completed.
Fixes: 9a4435375c
("IB/hns: Add driver files for hns RoCE driver")
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
Link: https://patch.msgid.link/20240927103323.1897094-3-huangjunxian6@hisilicon.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
This commit is contained in:
parent
51976c6cd7
commit
615b94746a
@ -7017,6 +7017,7 @@ static void hns_roce_hw_v2_uninit_instance(struct hnae3_handle *handle,
|
||||
|
||||
handle->rinfo.instance_state = HNS_ROCE_STATE_NON_INIT;
|
||||
}
|
||||
|
||||
static int hns_roce_hw_v2_reset_notify_down(struct hnae3_handle *handle)
|
||||
{
|
||||
struct hns_roce_dev *hr_dev;
|
||||
@ -7035,6 +7036,9 @@ static int hns_roce_hw_v2_reset_notify_down(struct hnae3_handle *handle)
|
||||
|
||||
hr_dev->active = false;
|
||||
hr_dev->dis_db = true;
|
||||
|
||||
rdma_user_mmap_disassociate(&hr_dev->ib_dev);
|
||||
|
||||
hr_dev->state = HNS_ROCE_DEVICE_STATE_RST_DOWN;
|
||||
|
||||
return 0;
|
||||
|
@ -466,6 +466,11 @@ static int hns_roce_mmap(struct ib_ucontext *uctx, struct vm_area_struct *vma)
|
||||
pgprot_t prot;
|
||||
int ret;
|
||||
|
||||
if (hr_dev->dis_db) {
|
||||
atomic64_inc(&hr_dev->dfx_cnt[HNS_ROCE_DFX_MMAP_ERR_CNT]);
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
rdma_entry = rdma_user_mmap_entry_get_pgoff(uctx, vma->vm_pgoff);
|
||||
if (!rdma_entry) {
|
||||
atomic64_inc(&hr_dev->dfx_cnt[HNS_ROCE_DFX_MMAP_ERR_CNT]);
|
||||
|
Loading…
Reference in New Issue
Block a user