[bug report] video: hyperv: hyperv_fb: Use physical memory for fb on HyperV Gen 1 VMs.

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

 



Hello Wei Hu,

The patch 3a6fb6c4255c: "video: hyperv: hyperv_fb: Use physical
memory for fb on HyperV Gen 1 VMs." from Dec 9, 2019, leads to the
following static checker warning:

	drivers/video/fbdev/hyperv_fb.c:991 hvfb_get_phymem()
	error: 'vmem' came from dma_alloc_coherent() so we can't do virt_to_phys()

drivers/video/fbdev/hyperv_fb.c
   960  static phys_addr_t hvfb_get_phymem(struct hv_device *hdev,
   961                                     unsigned int request_size)
   962  {
   963          struct page *page = NULL;
   964          dma_addr_t dma_handle;
   965          void *vmem;
   966          phys_addr_t paddr = 0;
   967          unsigned int order = get_order(request_size);
   968  
   969          if (request_size == 0)
   970                  return -1;
   971  
   972          if (order < MAX_ORDER) {
   973                  /* Call alloc_pages if the size is less than 2^MAX_ORDER */
   974                  page = alloc_pages(GFP_KERNEL | __GFP_ZERO, order);
   975                  if (!page)
   976                          return -1;
   977  
   978                  paddr = (page_to_pfn(page) << PAGE_SHIFT);
   979          } else {
   980                  /* Allocate from CMA */
   981                  hdev->device.coherent_dma_mask = DMA_BIT_MASK(64);
   982  
   983                  vmem = dma_alloc_coherent(&hdev->device,
   984                                            round_up(request_size, PAGE_SIZE),
   985                                            &dma_handle,
   986                                            GFP_KERNEL | __GFP_NOWARN);
   987  
   988                  if (!vmem)
   989                          return -1;
   990  
   991                  paddr = virt_to_phys(vmem);

Pretty straight forward that the static checker is right but I can't
give you any hints how to fix it.

   992          }
   993  
   994          return paddr;
   995  }

regards,
dan carpenter



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux