From: kbuild test robot <lkp@intel.com>
To: "Christian König" <ckoenig.leichtzumerken@gmail.com>
Cc: maxime.ripard@bootlin.com, dri-devel@lists.freedesktop.org,
digetx@gmail.com, sumit.semwal@linaro.org,
m.szyprowski@samsung.com, devel@driverdev.osuosl.org,
sstabellini@kernel.org, arnd@arndb.de, linux@armlinux.org.uk,
jonathanh@nvidia.com, tomi.valkeinen@ti.com,
xen-devel@lists.xenproject.org, linux-media@vger.kernel.org,
pawel@osciak.com, intel-gfx@lists.freedesktop.org,
linux-tegra@vger.kernel.org, boris.ostrovsky@oracle.com,
mchehab@kernel.org, jgross@suse.com, gregkh@linuxfoundation.org,
linux-kernel@vger.kernel.org, kyungmin.park@samsung.com,
kbuild-all@01.org
Subject: Re: [PATCH] dma-buf: add struct dma_buf_attach_info v2
Date: Wed, 1 May 2019 07:06:51 +0800 [thread overview]
Message-ID: <201905010708.6RCJMVAw%lkp@intel.com> (raw)
In-Reply-To: <20190430111002.106168-1-christian.koenig@amd.com>
Hi "Christian,
I love your patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v5.1-rc7 next-20190430]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Christian-K-nig/dma-buf-add-struct-dma_buf_attach_info-v2/20190430-221017
reproduce:
# apt-get install sparse
make ARCH=x86_64 allmodconfig
make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
sparse warnings: (new ones prefixed by >>)
>> drivers/xen/gntdev-dmabuf.c:634:33: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected struct dma_buf_attach_info const *info @@ got dma_buf_attach_info const *info @@
>> drivers/xen/gntdev-dmabuf.c:634:33: sparse: expected struct dma_buf_attach_info const *info
>> drivers/xen/gntdev-dmabuf.c:634:33: sparse: got struct dma_buf *[assigned] dma_buf
>> drivers/xen/gntdev-dmabuf.c:634:32: sparse: sparse: too many arguments for function dma_buf_attach
vim +634 drivers/xen/gntdev-dmabuf.c
bf8dc55b Oleksandr Andrushchenko 2018-07-20 605
932d6562 Oleksandr Andrushchenko 2018-07-20 606 static struct gntdev_dmabuf *
932d6562 Oleksandr Andrushchenko 2018-07-20 607 dmabuf_imp_to_refs(struct gntdev_dmabuf_priv *priv, struct device *dev,
932d6562 Oleksandr Andrushchenko 2018-07-20 608 int fd, int count, int domid)
932d6562 Oleksandr Andrushchenko 2018-07-20 609 {
bf8dc55b Oleksandr Andrushchenko 2018-07-20 610 struct gntdev_dmabuf *gntdev_dmabuf, *ret;
e648feab Christian König 2019-04-30 611 struct dma_buf_attach_info attach_info;
bf8dc55b Oleksandr Andrushchenko 2018-07-20 612 struct dma_buf *dma_buf;
bf8dc55b Oleksandr Andrushchenko 2018-07-20 613 struct dma_buf_attachment *attach;
bf8dc55b Oleksandr Andrushchenko 2018-07-20 614 struct sg_table *sgt;
bf8dc55b Oleksandr Andrushchenko 2018-07-20 615 struct sg_page_iter sg_iter;
bf8dc55b Oleksandr Andrushchenko 2018-07-20 616 int i;
bf8dc55b Oleksandr Andrushchenko 2018-07-20 617
bf8dc55b Oleksandr Andrushchenko 2018-07-20 618 dma_buf = dma_buf_get(fd);
bf8dc55b Oleksandr Andrushchenko 2018-07-20 619 if (IS_ERR(dma_buf))
bf8dc55b Oleksandr Andrushchenko 2018-07-20 620 return ERR_CAST(dma_buf);
bf8dc55b Oleksandr Andrushchenko 2018-07-20 621
bf8dc55b Oleksandr Andrushchenko 2018-07-20 622 gntdev_dmabuf = dmabuf_imp_alloc_storage(count);
bf8dc55b Oleksandr Andrushchenko 2018-07-20 623 if (IS_ERR(gntdev_dmabuf)) {
bf8dc55b Oleksandr Andrushchenko 2018-07-20 624 ret = gntdev_dmabuf;
bf8dc55b Oleksandr Andrushchenko 2018-07-20 625 goto fail_put;
bf8dc55b Oleksandr Andrushchenko 2018-07-20 626 }
bf8dc55b Oleksandr Andrushchenko 2018-07-20 627
bf8dc55b Oleksandr Andrushchenko 2018-07-20 628 gntdev_dmabuf->priv = priv;
bf8dc55b Oleksandr Andrushchenko 2018-07-20 629 gntdev_dmabuf->fd = fd;
bf8dc55b Oleksandr Andrushchenko 2018-07-20 630
e648feab Christian König 2019-04-30 631 memset(&attach_info, 0, sizeof(attach_info));
e648feab Christian König 2019-04-30 632 attach_info.dev = dev;
e648feab Christian König 2019-04-30 633 attach_info.dmabuf = dma_buf;
bf8dc55b Oleksandr Andrushchenko 2018-07-20 @634 attach = dma_buf_attach(dma_buf, dev);
bf8dc55b Oleksandr Andrushchenko 2018-07-20 635 if (IS_ERR(attach)) {
bf8dc55b Oleksandr Andrushchenko 2018-07-20 636 ret = ERR_CAST(attach);
bf8dc55b Oleksandr Andrushchenko 2018-07-20 637 goto fail_free_obj;
bf8dc55b Oleksandr Andrushchenko 2018-07-20 638 }
bf8dc55b Oleksandr Andrushchenko 2018-07-20 639
bf8dc55b Oleksandr Andrushchenko 2018-07-20 640 gntdev_dmabuf->u.imp.attach = attach;
bf8dc55b Oleksandr Andrushchenko 2018-07-20 641
bf8dc55b Oleksandr Andrushchenko 2018-07-20 642 sgt = dma_buf_map_attachment(attach, DMA_BIDIRECTIONAL);
bf8dc55b Oleksandr Andrushchenko 2018-07-20 643 if (IS_ERR(sgt)) {
bf8dc55b Oleksandr Andrushchenko 2018-07-20 644 ret = ERR_CAST(sgt);
bf8dc55b Oleksandr Andrushchenko 2018-07-20 645 goto fail_detach;
bf8dc55b Oleksandr Andrushchenko 2018-07-20 646 }
bf8dc55b Oleksandr Andrushchenko 2018-07-20 647
bf8dc55b Oleksandr Andrushchenko 2018-07-20 648 /* Check number of pages that imported buffer has. */
bf8dc55b Oleksandr Andrushchenko 2018-07-20 649 if (attach->dmabuf->size != gntdev_dmabuf->nr_pages << PAGE_SHIFT) {
bf8dc55b Oleksandr Andrushchenko 2018-07-20 650 ret = ERR_PTR(-EINVAL);
bf8dc55b Oleksandr Andrushchenko 2018-07-20 651 pr_debug("DMA buffer has %zu pages, user-space expects %d\n",
bf8dc55b Oleksandr Andrushchenko 2018-07-20 652 attach->dmabuf->size, gntdev_dmabuf->nr_pages);
bf8dc55b Oleksandr Andrushchenko 2018-07-20 653 goto fail_unmap;
bf8dc55b Oleksandr Andrushchenko 2018-07-20 654 }
bf8dc55b Oleksandr Andrushchenko 2018-07-20 655
bf8dc55b Oleksandr Andrushchenko 2018-07-20 656 gntdev_dmabuf->u.imp.sgt = sgt;
bf8dc55b Oleksandr Andrushchenko 2018-07-20 657
bf8dc55b Oleksandr Andrushchenko 2018-07-20 658 /* Now convert sgt to array of pages and check for page validity. */
bf8dc55b Oleksandr Andrushchenko 2018-07-20 659 i = 0;
bf8dc55b Oleksandr Andrushchenko 2018-07-20 660 for_each_sg_page(sgt->sgl, &sg_iter, sgt->nents, 0) {
bf8dc55b Oleksandr Andrushchenko 2018-07-20 661 struct page *page = sg_page_iter_page(&sg_iter);
bf8dc55b Oleksandr Andrushchenko 2018-07-20 662 /*
bf8dc55b Oleksandr Andrushchenko 2018-07-20 663 * Check if page is valid: this can happen if we are given
bf8dc55b Oleksandr Andrushchenko 2018-07-20 664 * a page from VRAM or other resources which are not backed
bf8dc55b Oleksandr Andrushchenko 2018-07-20 665 * by a struct page.
bf8dc55b Oleksandr Andrushchenko 2018-07-20 666 */
bf8dc55b Oleksandr Andrushchenko 2018-07-20 667 if (!pfn_valid(page_to_pfn(page))) {
bf8dc55b Oleksandr Andrushchenko 2018-07-20 668 ret = ERR_PTR(-EINVAL);
bf8dc55b Oleksandr Andrushchenko 2018-07-20 669 goto fail_unmap;
bf8dc55b Oleksandr Andrushchenko 2018-07-20 670 }
bf8dc55b Oleksandr Andrushchenko 2018-07-20 671
bf8dc55b Oleksandr Andrushchenko 2018-07-20 672 gntdev_dmabuf->pages[i++] = page;
bf8dc55b Oleksandr Andrushchenko 2018-07-20 673 }
bf8dc55b Oleksandr Andrushchenko 2018-07-20 674
bf8dc55b Oleksandr Andrushchenko 2018-07-20 675 ret = ERR_PTR(dmabuf_imp_grant_foreign_access(gntdev_dmabuf->pages,
bf8dc55b Oleksandr Andrushchenko 2018-07-20 676 gntdev_dmabuf->u.imp.refs,
bf8dc55b Oleksandr Andrushchenko 2018-07-20 677 count, domid));
bf8dc55b Oleksandr Andrushchenko 2018-07-20 678 if (IS_ERR(ret))
bf8dc55b Oleksandr Andrushchenko 2018-07-20 679 goto fail_end_access;
bf8dc55b Oleksandr Andrushchenko 2018-07-20 680
bf8dc55b Oleksandr Andrushchenko 2018-07-20 681 pr_debug("Imported DMA buffer with fd %d\n", fd);
bf8dc55b Oleksandr Andrushchenko 2018-07-20 682
bf8dc55b Oleksandr Andrushchenko 2018-07-20 683 mutex_lock(&priv->lock);
bf8dc55b Oleksandr Andrushchenko 2018-07-20 684 list_add(&gntdev_dmabuf->next, &priv->imp_list);
bf8dc55b Oleksandr Andrushchenko 2018-07-20 685 mutex_unlock(&priv->lock);
bf8dc55b Oleksandr Andrushchenko 2018-07-20 686
bf8dc55b Oleksandr Andrushchenko 2018-07-20 687 return gntdev_dmabuf;
bf8dc55b Oleksandr Andrushchenko 2018-07-20 688
bf8dc55b Oleksandr Andrushchenko 2018-07-20 689 fail_end_access:
bf8dc55b Oleksandr Andrushchenko 2018-07-20 690 dmabuf_imp_end_foreign_access(gntdev_dmabuf->u.imp.refs, count);
bf8dc55b Oleksandr Andrushchenko 2018-07-20 691 fail_unmap:
bf8dc55b Oleksandr Andrushchenko 2018-07-20 692 dma_buf_unmap_attachment(attach, sgt, DMA_BIDIRECTIONAL);
bf8dc55b Oleksandr Andrushchenko 2018-07-20 693 fail_detach:
bf8dc55b Oleksandr Andrushchenko 2018-07-20 694 dma_buf_detach(dma_buf, attach);
bf8dc55b Oleksandr Andrushchenko 2018-07-20 695 fail_free_obj:
bf8dc55b Oleksandr Andrushchenko 2018-07-20 696 dmabuf_imp_free_storage(gntdev_dmabuf);
bf8dc55b Oleksandr Andrushchenko 2018-07-20 697 fail_put:
bf8dc55b Oleksandr Andrushchenko 2018-07-20 698 dma_buf_put(dma_buf);
bf8dc55b Oleksandr Andrushchenko 2018-07-20 699 return ret;
932d6562 Oleksandr Andrushchenko 2018-07-20 700 }
932d6562 Oleksandr Andrushchenko 2018-07-20 701
:::::: The code at line 634 was first introduced by commit
:::::: bf8dc55b135873d8bc58bb8fbc91c52f3a902eea xen/gntdev: Implement dma-buf import functionality
:::::: TO: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
:::::: CC: Boris Ostrovsky <boris.ostrovsky@oracle.com>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
prev parent reply other threads:[~2019-04-30 23:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-30 11:10 [PATCH] dma-buf: add struct dma_buf_attach_info v2 Christian König
2019-04-30 15:23 ` kbuild test robot
2019-04-30 16:59 ` Boris Ostrovsky
2019-04-30 17:31 ` Russell King - ARM Linux admin
2019-05-03 12:05 ` Christian König
2019-05-03 12:09 ` [Intel-gfx] " Daniel Vetter
2019-05-03 12:15 ` Koenig, Christian
2019-04-30 23:06 ` kbuild test robot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201905010708.6RCJMVAw%lkp@intel.com \
--to=lkp@intel.com \
--cc=arnd@arndb.de \
--cc=boris.ostrovsky@oracle.com \
--cc=ckoenig.leichtzumerken@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=digetx@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=gregkh@linuxfoundation.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jgross@suse.com \
--cc=jonathanh@nvidia.com \
--cc=kbuild-all@01.org \
--cc=kyungmin.park@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=m.szyprowski@samsung.com \
--cc=maxime.ripard@bootlin.com \
--cc=mchehab@kernel.org \
--cc=pawel@osciak.com \
--cc=sstabellini@kernel.org \
--cc=sumit.semwal@linaro.org \
--cc=tomi.valkeinen@ti.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox