Commit b280db52 authored by Lijun Ou's avatar Lijun Ou Committed by Doug Ledford
Browse files

IB/hns: Change the logic for allocating uar registers



This patch mainly modifies the logic for allocating uar registers.
In HiP06 SoC, HW has 8 group of uar registers for kernel and
user space application. The uar index is assigned as follows:
    0   ------ for kernel
    1~7 ------ for user space application

Signed-off-by: default avatarLijun Ou <oulijun@huawei.com>
Reviewed-by: default avatarWei Hu <xavier.huwei@huawei.com>
Signed-off-by: default avatarSalil Mehta <salil.mehta@huawei.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 7716809e
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -117,7 +117,9 @@ int hns_roce_uar_alloc(struct hns_roce_dev *hr_dev, struct hns_roce_uar *uar)
	if (ret == -1)
		return -ENOMEM;

	uar->index = (uar->index - 1) % hr_dev->caps.phy_num_uars + 1;
	if (uar->index > 0)
		uar->index = (uar->index - 1) %
			     (hr_dev->caps.phy_num_uars - 1) + 1;

	res = platform_get_resource(hr_dev->pdev, IORESOURCE_MEM, 0);
	uar->pfn = ((res->start) >> PAGE_SHIFT) + uar->index;