linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [hyperv:hyperv-next 5/5] drivers/net/hyperv/netvsc.c:1026:5: warning: no previous prototype for 'netvsc_dma_map'
@ 2021-12-18  4:23 kernel test robot
  2021-12-19 12:31 ` Wei Liu
  0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2021-12-18  4:23 UTC (permalink / raw)
  To: Tianyu Lan
  Cc: kbuild-all, linux-kernel, Wei Liu, Haiyang Zhang, Michael Kelley

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux.git hyperv-next
head:   19fd7ca00201c0525452dcf5a490e4b01674ef4c
commit: 19fd7ca00201c0525452dcf5a490e4b01674ef4c [5/5] net: netvsc: Add Isolation VM support for netvsc driver
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20211218/202112181204.uRIUsFfa-lkp@intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
        # https://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux.git/commit/?id=19fd7ca00201c0525452dcf5a490e4b01674ef4c
        git remote add hyperv https://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux.git
        git fetch --no-tags hyperv hyperv-next
        git checkout 19fd7ca00201c0525452dcf5a490e4b01674ef4c
        # save the config file to linux build tree
        mkdir build_dir
        make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/net/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/net/hyperv/netvsc.c:1026:5: warning: no previous prototype for 'netvsc_dma_map' [-Wmissing-prototypes]
    1026 | int netvsc_dma_map(struct hv_device *hv_dev,
         |     ^~~~~~~~~~~~~~


vim +/netvsc_dma_map +1026 drivers/net/hyperv/netvsc.c

  1007	
  1008	/* netvsc_dma_map - Map swiotlb bounce buffer with data page of
  1009	 * packet sent by vmbus_sendpacket_pagebuffer() in the Isolation
  1010	 * VM.
  1011	 *
  1012	 * In isolation VM, netvsc send buffer has been marked visible to
  1013	 * host and so the data copied to send buffer doesn't need to use
  1014	 * bounce buffer. The data pages handled by vmbus_sendpacket_pagebuffer()
  1015	 * may not be copied to send buffer and so these pages need to be
  1016	 * mapped with swiotlb bounce buffer. netvsc_dma_map() is to do
  1017	 * that. The pfns in the struct hv_page_buffer need to be converted
  1018	 * to bounce buffer's pfn. The loop here is necessary because the
  1019	 * entries in the page buffer array are not necessarily full
  1020	 * pages of data.  Each entry in the array has a separate offset and
  1021	 * len that may be non-zero, even for entries in the middle of the
  1022	 * array.  And the entries are not physically contiguous.  So each
  1023	 * entry must be individually mapped rather than as a contiguous unit.
  1024	 * So not use dma_map_sg() here.
  1025	 */
> 1026	int netvsc_dma_map(struct hv_device *hv_dev,
  1027			   struct hv_netvsc_packet *packet,
  1028			   struct hv_page_buffer *pb)
  1029	{
  1030		u32 page_count =  packet->cp_partial ?
  1031			packet->page_buf_cnt - packet->rmsg_pgcnt :
  1032			packet->page_buf_cnt;
  1033		dma_addr_t dma;
  1034		int i;
  1035	
  1036		if (!hv_is_isolation_supported())
  1037			return 0;
  1038	
  1039		packet->dma_range = kcalloc(page_count,
  1040					    sizeof(*packet->dma_range),
  1041					    GFP_KERNEL);
  1042		if (!packet->dma_range)
  1043			return -ENOMEM;
  1044	
  1045		for (i = 0; i < page_count; i++) {
  1046			char *src = phys_to_virt((pb[i].pfn << HV_HYP_PAGE_SHIFT)
  1047						 + pb[i].offset);
  1048			u32 len = pb[i].len;
  1049	
  1050			dma = dma_map_single(&hv_dev->device, src, len,
  1051					     DMA_TO_DEVICE);
  1052			if (dma_mapping_error(&hv_dev->device, dma)) {
  1053				kfree(packet->dma_range);
  1054				return -ENOMEM;
  1055			}
  1056	
  1057			/* pb[].offset and pb[].len are not changed during dma mapping
  1058			 * and so not reassign.
  1059			 */
  1060			packet->dma_range[i].dma = dma;
  1061			packet->dma_range[i].mapping_size = len;
  1062			pb[i].pfn = dma >> HV_HYP_PAGE_SHIFT;
  1063		}
  1064	
  1065		return 0;
  1066	}
  1067	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [hyperv:hyperv-next 5/5] drivers/net/hyperv/netvsc.c:1026:5: warning: no previous prototype for 'netvsc_dma_map'
  2021-12-18  4:23 [hyperv:hyperv-next 5/5] drivers/net/hyperv/netvsc.c:1026:5: warning: no previous prototype for 'netvsc_dma_map' kernel test robot
@ 2021-12-19 12:31 ` Wei Liu
  0 siblings, 0 replies; 2+ messages in thread
From: Wei Liu @ 2021-12-19 12:31 UTC (permalink / raw)
  To: kernel test robot
  Cc: Tianyu Lan, kbuild-all, linux-kernel, Wei Liu, Haiyang Zhang,
	Michael Kelley

On Sat, Dec 18, 2021 at 12:23:30PM +0800, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux.git hyperv-next
> head:   19fd7ca00201c0525452dcf5a490e4b01674ef4c
> commit: 19fd7ca00201c0525452dcf5a490e4b01674ef4c [5/5] net: netvsc: Add Isolation VM support for netvsc driver
> config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20211218/202112181204.uRIUsFfa-lkp@intel.com/config)
> compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
> reproduce (this is a W=1 build):
>         # https://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux.git/commit/?id=19fd7ca00201c0525452dcf5a490e4b01674ef4c
>         git remote add hyperv https://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux.git
>         git fetch --no-tags hyperv hyperv-next
>         git checkout 19fd7ca00201c0525452dcf5a490e4b01674ef4c
>         # save the config file to linux build tree
>         mkdir build_dir
>         make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/net/
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All warnings (new ones prefixed by >>):
> 
> >> drivers/net/hyperv/netvsc.c:1026:5: warning: no previous prototype for 'netvsc_dma_map' [-Wmissing-prototypes]
>     1026 | int netvsc_dma_map(struct hv_device *hv_dev,
>          |     ^~~~~~~~~~~~~~

Adding static should fix this issue.

I've fixed this and the other one in hyperv-next. No need for sending new
patches.

Wei.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-12-19 12:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-18  4:23 [hyperv:hyperv-next 5/5] drivers/net/hyperv/netvsc.c:1026:5: warning: no previous prototype for 'netvsc_dma_map' kernel test robot
2021-12-19 12:31 ` Wei Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).