diff mbox series

[for-next] RDMA/hns: Modify the mapping attribute of doorbell to device

Message ID 20211206133652.27476-1-liangwenpeng@huawei.com (mailing list archive)
State Accepted
Delegated to: Jason Gunthorpe
Headers show
Series [for-next] RDMA/hns: Modify the mapping attribute of doorbell to device | expand

Commit Message

Wenpeng Liang Dec. 6, 2021, 1:36 p.m. UTC
From: Yixing Liu <liuyixing1@huawei.com>

It is more general for ARM device drivers to use the device attribute to
map pci bar spaces.

Fixes: 9a4435375cd1 ("IB/hns: Add driver files for hns RoCE driver")
Signed-off-by: Yixing Liu <liuyixing1@huawei.com>
Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
---
 drivers/infiniband/hw/hns/hns_roce_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jason Gunthorpe Dec. 6, 2021, 3:37 p.m. UTC | #1
On Mon, Dec 06, 2021 at 09:36:52PM +0800, Wenpeng Liang wrote:
> From: Yixing Liu <liuyixing1@huawei.com>
> 
> It is more general for ARM device drivers to use the device attribute to
> map pci bar spaces.
> 
> Fixes: 9a4435375cd1 ("IB/hns: Add driver files for hns RoCE driver")
> Signed-off-by: Yixing Liu <liuyixing1@huawei.com>
> Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
> ---
>  drivers/infiniband/hw/hns/hns_roce_main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

It seems like the right thing todo, thanks

I see other drivers are doing it wrong as well:

drivers/infiniband/hw/bnxt_re/ib_verbs.c:               vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
drivers/infiniband/hw/cxgb4/provider.c:         vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
drivers/infiniband/hw/cxgb4/provider.c:                                 pgprot_noncached(vma->vm_page_prot);
drivers/infiniband/hw/cxgb4/t4.h:       return pgprot_noncached(prot);
drivers/infiniband/hw/efa/efa_verbs.c:                                  pgprot_noncached(vma->vm_page_prot),
drivers/infiniband/hw/hfi1/file_ops.c:          /* vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); */
drivers/infiniband/hw/hfi1/file_ops.c:          vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
drivers/infiniband/hw/hns/hns_roce_main.c:              prot = pgprot_noncached(prot);
drivers/infiniband/hw/irdma/verbs.c:                             pgprot_noncached(vma->vm_page_prot), NULL);
drivers/infiniband/hw/irdma/verbs.c:                                    pgprot_noncached(vma->vm_page_prot),
drivers/infiniband/hw/mlx4/main.c:                                       pgprot_noncached(vma->vm_page_prot),
drivers/infiniband/hw/mlx4/main.c:                      PAGE_SIZE, pgprot_noncached(vma->vm_page_prot),
drivers/infiniband/hw/mlx5/main.c:              prot = pgprot_noncached(vma->vm_page_prot);
drivers/infiniband/hw/mlx5/main.c:              prot = pgprot_noncached(vma->vm_page_prot);
drivers/infiniband/hw/mlx5/main.c:                                       pgprot_noncached(vma->vm_page_prot),
drivers/infiniband/hw/mthca/mthca_provider.c:   vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c:            vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
drivers/infiniband/hw/qib/qib_file_ops.c:               vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
drivers/infiniband/hw/qib/qib_file_ops.c:       vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
drivers/infiniband/hw/usnic/usnic_ib_verbs.c:   vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c:        vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);

They should all use pgprot_device I think?

It is the same except on ARM where pgprot_device() is a bit faster

Jason
Jason Gunthorpe Dec. 6, 2021, 11:52 p.m. UTC | #2
On Mon, Dec 06, 2021 at 09:36:52PM +0800, Wenpeng Liang wrote:
> From: Yixing Liu <liuyixing1@huawei.com>
> 
> It is more general for ARM device drivers to use the device attribute to
> map pci bar spaces.
> 
> Fixes: 9a4435375cd1 ("IB/hns: Add driver files for hns RoCE driver")
> Signed-off-by: Yixing Liu <liuyixing1@huawei.com>
> Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
> ---
>  drivers/infiniband/hw/hns/hns_roce_main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied to for-next, thanks

Jason
Wenpeng Liang Dec. 7, 2021, 12:51 p.m. UTC | #3
On 2021/12/6 23:37, Jason Gunthorpe wrote:
> On Mon, Dec 06, 2021 at 09:36:52PM +0800, Wenpeng Liang wrote:
>> From: Yixing Liu <liuyixing1@huawei.com>
>>
>> It is more general for ARM device drivers to use the device attribute to
>> map pci bar spaces.
>>
>> Fixes: 9a4435375cd1 ("IB/hns: Add driver files for hns RoCE driver")
>> Signed-off-by: Yixing Liu <liuyixing1@huawei.com>
>> Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
>> ---
>>  drivers/infiniband/hw/hns/hns_roce_main.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> It seems like the right thing todo, thanks
> 
> I see other drivers are doing it wrong as well:
> 
> drivers/infiniband/hw/bnxt_re/ib_verbs.c:               vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
> drivers/infiniband/hw/cxgb4/provider.c:         vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
> drivers/infiniband/hw/cxgb4/provider.c:                                 pgprot_noncached(vma->vm_page_prot);
> drivers/infiniband/hw/cxgb4/t4.h:       return pgprot_noncached(prot);
> drivers/infiniband/hw/efa/efa_verbs.c:                                  pgprot_noncached(vma->vm_page_prot),
> drivers/infiniband/hw/hfi1/file_ops.c:          /* vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); */
> drivers/infiniband/hw/hfi1/file_ops.c:          vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
> drivers/infiniband/hw/hns/hns_roce_main.c:              prot = pgprot_noncached(prot);
> drivers/infiniband/hw/irdma/verbs.c:                             pgprot_noncached(vma->vm_page_prot), NULL);
> drivers/infiniband/hw/irdma/verbs.c:                                    pgprot_noncached(vma->vm_page_prot),
> drivers/infiniband/hw/mlx4/main.c:                                       pgprot_noncached(vma->vm_page_prot),
> drivers/infiniband/hw/mlx4/main.c:                      PAGE_SIZE, pgprot_noncached(vma->vm_page_prot),
> drivers/infiniband/hw/mlx5/main.c:              prot = pgprot_noncached(vma->vm_page_prot);
> drivers/infiniband/hw/mlx5/main.c:              prot = pgprot_noncached(vma->vm_page_prot);
> drivers/infiniband/hw/mlx5/main.c:                                       pgprot_noncached(vma->vm_page_prot),
> drivers/infiniband/hw/mthca/mthca_provider.c:   vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
> drivers/infiniband/hw/ocrdma/ocrdma_verbs.c:            vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
> drivers/infiniband/hw/qib/qib_file_ops.c:               vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
> drivers/infiniband/hw/qib/qib_file_ops.c:       vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
> drivers/infiniband/hw/usnic/usnic_ib_verbs.c:   vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
> drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c:        vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
> 
> They should all use pgprot_device I think?
> 
> It is the same except on ARM where pgprot_device() is a bit faster
> 
> Jason
> .
> 

I will submit a patch to fix these problems later.

Thanks
Wenpeng
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c
index 8233bec053ee..a906c6078b72 100644
--- a/drivers/infiniband/hw/hns/hns_roce_main.c
+++ b/drivers/infiniband/hw/hns/hns_roce_main.c
@@ -442,7 +442,7 @@  static int hns_roce_mmap(struct ib_ucontext *uctx, struct vm_area_struct *vma)
 	prot = vma->vm_page_prot;
 
 	if (entry->mmap_type != HNS_ROCE_MMAP_TYPE_TPTR)
-		prot = pgprot_noncached(prot);
+		prot = pgprot_device(prot);
 
 	ret = rdma_user_mmap_io(uctx, vma, pfn, rdma_entry->npages * PAGE_SIZE,
 				prot, rdma_entry);