Re: [linux-next:master 7236/13217] arch/mips/include/asm/page.h:255:55: warning: cast to pointer from integer of different size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Feb 16, 2023 at 08:31:00PM +0800, kernel test robot wrote:

>    drivers/infiniband/sw/rxe/rxe_mr.c: In function 'rxe_set_page':
> >> arch/mips/include/asm/page.h:255:55: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
>      255 | #define virt_to_pfn(kaddr)
>      PFN_DOWN(virt_to_phys((void *)(kaddr)))

Er.. Something has gone really wrong along here.

1) The type of DMA mapped addresses is dma_addr_t NOT u64, so things
   like this in ib_sg_to_pages() need fixing:

		u64 dma_addr = sg_dma_address(sg) + sg_offset;
		u64 prev_addr = dma_addr;

2) When ib_uses_virt_dma() == true we should have a function:

   struct page *ib_virt_dma_to_page(dma_addr_t dma_addr)

   That is the inverse of ib_dma_map_page()

   That should be called in all these places. virt_to_phys is being
   used because ib_dma_map_page() called page_address(), but arguably
   this is all wrong and the dma_addr_t should by the phys_addr_t of
   the page and the inverse should be phys_to_page()

Jason



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux