Introduce a new memory accessor for vringh. It is able to use vringh to
virtio rings located on io-memory region.
Signed-off-by: Shunsuke Mie <mie at igel.co.jp>
---
drivers/vhost/vringh.c | 201 +++++++++++++++++++++++++++++++++++++++++
include/linux/vringh.h | 32 +++++++
2 files changed, 233 insertions(+)
diff --git a/drivers/vhost/vringh.c b/drivers/vhost/vringh.c
index 955d938eb663..6e89dcd871b4 100644
--- a/drivers/vhost/vringh.c
+++ b/drivers/vhost/vringh.c
@@ -1604,4 +1604,205 @@ EXPORT_SYMBOL(vringh_need_notify_iotlb);
#endif
+static inline int getu16_iomem(const struct vringh *vrh, u16 *val,
+ const __virtio16 *p)
+{
+ *val = vringh16_to_cpu(vrh, ioread16(p));
+ return 0;
+}
+
+static inline int putu16_iomem(const struct vringh *vrh, __virtio16 *p, u16
val)
+{
+ iowrite16(cpu_to_vringh16(vrh, val), p);
+ return 0;
+}
+
+static inline int copydesc_iomem(const struct vringh *vrh, void *dst,
+ const void *src, size_t len)
+{
+ memcpy_fromio(dst, src, len);
+ return 0;
+}
+
+static int putused_iomem(const struct vringh *vrh, struct vring_used_elem *dst,
+ const struct vring_used_elem *src, unsigned int num)
+{
+ memcpy_toio(dst, src, num * sizeof(*dst));
+ return 0;
+}
+
+static inline int xfer_from_iomem(const struct vringh *vrh, void *src,
+ void *dst, size_t len)
+{
+ memcpy_fromio(dst, src, len);
+ return 0;
+}
+
+static inline int xfer_to_iomem(const struct vringh *vrh, void *dst, void *src,
+ size_t len)
+{
+ memcpy_toio(dst, src, len);
+ return 0;
+}
+
+/**
+ * vringh_init_iomem - initialize a vringh for a vring on io-memory.
+ * @vrh: the vringh to initialize.
+ * @features: the feature bits for this ring.
+ * @num: the number of elements.
+ * @weak_barriers: true if we only need memory barriers, not I/O.
+ * @desc: the userspace descriptor pointer.
+ * @avail: the userspace avail pointer.
+ * @used: the userspace used pointer.
+ *
+ * Returns an error if num is invalid: you should check pointers
+ * yourself!
+ */
+int vringh_init_iomem(struct vringh *vrh, u64 features, unsigned int num,
+ bool weak_barriers, struct vring_desc *desc,
+ struct vring_avail *avail, struct vring_used *used)
+{
+ return vringh_init_kern(vrh, features, num, weak_barriers, desc, avail,
+ used);
+}
+EXPORT_SYMBOL(vringh_init_iomem);
+
+/**
+ * vringh_getdesc_iomem - get next available descriptor from vring on
io-memory.
+ * @vrh: the vring on io-memory.
+ * @riov: where to put the readable descriptors (or NULL)
+ * @wiov: where to put the writable descriptors (or NULL)
+ * @head: head index we received, for passing to vringh_complete_iomem().
+ * @gfp: flags for allocating larger riov/wiov.
+ *
+ * Returns 0 if there was no descriptor, 1 if there was, or -errno.
+ *
+ * There some notes, and those are same with vringh_getdesc_kern(). Please see
+ * it.
+ */
+int vringh_getdesc_iomem(struct vringh *vrh, struct vringh_kiov *riov,
+ struct vringh_kiov *wiov, u16 *head, gfp_t gfp)
+{
+ int err;
+
+ err = __vringh_get_head(vrh, getu16_iomem, &vrh->last_avail_idx);
+ if (err < 0)
+ return err;
+
+ /* Empty... */
+ if (err == vrh->vring.num)
+ return 0;
+
+ *head = err;
+ err = __vringh_iov(vrh, *head, riov, wiov, no_range_check, NULL, gfp,
+ copydesc_iomem);
+ if (err)
+ return err;
+
+ return 1;
+}
+EXPORT_SYMBOL(vringh_getdesc_iomem);
+
+/**
+ * vringh_iov_pull_iomem - copy bytes from vring_iov.
+ * @riov: the riov as passed to vringh_getdesc_iomem() (updated as we consume)
+ * @dst: the place to copy.
+ * @len: the maximum length to copy.
+ *
+ * Returns the bytes copied <= len or a negative errno.
+ */
+ssize_t vringh_iov_pull_iomem(struct vringh *vrh, struct vringh_kiov *riov,
+ void *dst, size_t len)
+{
+ return vringh_iov_xfer(vrh, riov, dst, len, xfer_from_iomem);
+}
+EXPORT_SYMBOL(vringh_iov_pull_iomem);
+
+/**
+ * vringh_iov_push_iomem - copy bytes into vring_iov.
+ * @wiov: the wiov as passed to vringh_getdesc_iomem() (updated as we consume)
+ * @src: the place to copy from.
+ * @len: the maximum length to copy.
+ *
+ * Returns the bytes copied <= len or a negative errno.
+ */
+ssize_t vringh_iov_push_iomem(struct vringh *vrh, struct vringh_kiov *wiov,
+ const void *src, size_t len)
+{
+ return vringh_iov_xfer(vrh, wiov, (void *)src, len, xfer_to_iomem);
+}
+EXPORT_SYMBOL(vringh_iov_push_iomem);
+
+/**
+ * vringh_abandon_iomem - we've decided not to handle the descriptor(s).
+ * @vrh: the vring.
+ * @num: the number of descriptors to put back (ie. num
+ * vringh_getdesc_iomem() to undo).
+ *
+ * The next vringh_get_kern() will return the old descriptor(s) again.
+ */
+void vringh_abandon_iomem(struct vringh *vrh, unsigned int num)
+{
+ vringh_abandon_kern(vrh, num);
+}
+EXPORT_SYMBOL(vringh_abandon_iomem);
+
+/**
+ * vringh_complete_iomem - we've finished with descriptor, publish it.
+ * @vrh: the vring.
+ * @head: the head as filled in by vringh_getdesc_iomem().
+ * @len: the length of data we have written.
+ *
+ * You should check vringh_need_notify_iomem() after one or more calls
+ * to this function.
+ */
+int vringh_complete_iomem(struct vringh *vrh, u16 head, u32 len)
+{
+ struct vring_used_elem used;
+
+ used.id = cpu_to_vringh32(vrh, head);
+ used.len = cpu_to_vringh32(vrh, len);
+
+ return __vringh_complete(vrh, &used, 1, putu16_iomem, putused_iomem);
+}
+EXPORT_SYMBOL(vringh_complete_iomem);
+
+/**
+ * vringh_notify_enable_iomem - we want to know if something changes.
+ * @vrh: the vring.
+ *
+ * This always enables notifications, but returns false if there are
+ * now more buffers available in the vring.
+ */
+bool vringh_notify_enable_iomem(struct vringh *vrh)
+{
+ return __vringh_notify_enable(vrh, getu16_iomem, putu16_iomem);
+}
+EXPORT_SYMBOL(vringh_notify_enable_iomem);
+
+/**
+ * vringh_notify_disable_iomem - don't tell us if something changes.
+ * @vrh: the vring.
+ *
+ * This is our normal running state: we disable and then only enable when
+ * we're going to sleep.
+ */
+void vringh_notify_disable_iomem(struct vringh *vrh)
+{
+ __vringh_notify_disable(vrh, putu16_iomem);
+}
+EXPORT_SYMBOL(vringh_notify_disable_iomem);
+
+/**
+ * vringh_need_notify_iomem - must we tell the other side about used buffers?
+ * @vrh: the vring we've called vringh_complete_iomem() on.
+ *
+ * Returns -errno or 0 if we don't need to tell the other side, 1 if we do.
+ */
+int vringh_need_notify_iomem(struct vringh *vrh)
+{
+ return __vringh_need_notify(vrh, getu16_iomem);
+}
+EXPORT_SYMBOL(vringh_need_notify_iomem);
+
MODULE_LICENSE("GPL");
diff --git a/include/linux/vringh.h b/include/linux/vringh.h
index c3a8117dabe8..4130e5302ee6 100644
--- a/include/linux/vringh.h
+++ b/include/linux/vringh.h
@@ -330,4 +330,36 @@ int vringh_need_notify_iotlb(struct vringh *vrh);
#endif /* CONFIG_VHOST_IOTLB */
+#if IS_REACHABLE(CONFIG_VHOST_RING_IOMEM)
+
+int vringh_init_iomem(struct vringh *vrh, u64 features,
+ unsigned int num, bool weak_barriers,
+ struct vring_desc *desc,
+ struct vring_avail *avail,
+ struct vring_used *used);
+
+int vringh_getdesc_iomem(struct vringh *vrh,
+ struct vringh_kiov *riov,
+ struct vringh_kiov *wiov,
+ u16 *head,
+ gfp_t gfp);
+
+ssize_t vringh_iov_pull_iomem(struct vringh *vrh,
+ struct vringh_kiov *riov,
+ void *dst, size_t len);
+ssize_t vringh_iov_push_iomem(struct vringh *vrh,
+ struct vringh_kiov *wiov,
+ const void *src, size_t len);
+
+void vringh_abandon_iomem(struct vringh *vrh, unsigned int num);
+
+int vringh_complete_iomem(struct vringh *vrh, u16 head, u32 len);
+
+bool vringh_notify_enable_iomem(struct vringh *vrh);
+void vringh_notify_disable_iomem(struct vringh *vrh);
+
+int vringh_need_notify_iomem(struct vringh *vrh);
+
+#endif /* CONFIG_VHOST_RING_IOMEM */
+
#endif /* _LINUX_VRINGH_H */
--
2.25.1
Hi Shunsuke,
kernel test robot noticed the following build warnings:
[auto build test WARNING on mst-vhost/linux-next]
[also build test WARNING on linus/master horms-ipvs/master v6.4-rc4
next-20230602]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url:
https://github.com/intel-lab-lkp/linux/commits/Shunsuke-Mie/vringh-IOMEM-support/20230602-135351
base: https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git linux-next
patch link:
https://lore.kernel.org/r/20230602055211.309960-2-mie%40igel.co.jp
patch subject: [PATCH v4 1/1] vringh: IOMEM support
config: alpha-allyesconfig
(https://download.01.org/0day-ci/archive/20230602/202306021725.3otSfXPF-lkp at
intel.com/config)
compiler: alpha-linux-gcc (GCC) 12.3.0
reproduce (this is a W=1 build):
mkdir -p ~/bin
wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
~/bin/make.cross
chmod +x ~/bin/make.cross
#
https://github.com/intel-lab-lkp/linux/commit/de2a1f5220c32e953400f225aba6bd294a8d41b8
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review
Shunsuke-Mie/vringh-IOMEM-support/20230602-135351
git checkout de2a1f5220c32e953400f225aba6bd294a8d41b8
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.3.0 ~/bin/make.cross
W=1 O=build_dir ARCH=alpha olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.3.0 ~/bin/make.cross
W=1 O=build_dir ARCH=alpha SHELL=/bin/bash drivers/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp at intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202306021725.3otSfXPF-lkp at
intel.com/
All warnings (new ones prefixed by >>):
>> drivers/vhost/vringh.c:1661:5: warning: no previous prototype for
'vringh_init_iomem' [-Wmissing-prototypes]
1661 | int vringh_init_iomem(struct vringh *vrh, u64 features, unsigned int
num,
| ^~~~~~~~~~~~~~~~~>> drivers/vhost/vringh.c:1683:5: warning: no previous prototype for
'vringh_getdesc_iomem' [-Wmissing-prototypes]
1683 | int vringh_getdesc_iomem(struct vringh *vrh, struct vringh_kiov
*riov,
| ^~~~~~~~~~~~~~~~~~~~>> drivers/vhost/vringh.c:1714:9: warning: no previous prototype for
'vringh_iov_pull_iomem' [-Wmissing-prototypes]
1714 | ssize_t vringh_iov_pull_iomem(struct vringh *vrh, struct vringh_kiov
*riov,
| ^~~~~~~~~~~~~~~~~~~~~>> drivers/vhost/vringh.c:1729:9: warning: no previous prototype for
'vringh_iov_push_iomem' [-Wmissing-prototypes]
1729 | ssize_t vringh_iov_push_iomem(struct vringh *vrh, struct vringh_kiov
*wiov,
| ^~~~~~~~~~~~~~~~~~~~~>> drivers/vhost/vringh.c:1744:6: warning: no previous prototype for
'vringh_abandon_iomem' [-Wmissing-prototypes]
1744 | void vringh_abandon_iomem(struct vringh *vrh, unsigned int num)
| ^~~~~~~~~~~~~~~~~~~~>> drivers/vhost/vringh.c:1759:5: warning: no previous prototype for
'vringh_complete_iomem' [-Wmissing-prototypes]
1759 | int vringh_complete_iomem(struct vringh *vrh, u16 head, u32 len)
| ^~~~~~~~~~~~~~~~~~~~~>> drivers/vhost/vringh.c:1777:6: warning: no previous prototype for
'vringh_notify_enable_iomem' [-Wmissing-prototypes]
1777 | bool vringh_notify_enable_iomem(struct vringh *vrh)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~>> drivers/vhost/vringh.c:1790:6: warning: no previous prototype for
'vringh_notify_disable_iomem' [-Wmissing-prototypes]
1790 | void vringh_notify_disable_iomem(struct vringh *vrh)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~>> drivers/vhost/vringh.c:1802:5: warning: no previous prototype for
'vringh_need_notify_iomem' [-Wmissing-prototypes]
1802 | int vringh_need_notify_iomem(struct vringh *vrh)
| ^~~~~~~~~~~~~~~~~~~~~~~~
vim +/vringh_init_iomem +1661 drivers/vhost/vringh.c
1647
1648 /**
1649 * vringh_init_iomem - initialize a vringh for a vring on io-memory.
1650 * @vrh: the vringh to initialize.
1651 * @features: the feature bits for this ring.
1652 * @num: the number of elements.
1653 * @weak_barriers: true if we only need memory barriers, not I/O.
1654 * @desc: the userspace descriptor pointer.
1655 * @avail: the userspace avail pointer.
1656 * @used: the userspace used pointer.
1657 *
1658 * Returns an error if num is invalid: you should check pointers
1659 * yourself!
1660 */> 1661 int vringh_init_iomem(struct vringh *vrh, u64 features, unsigned int
num,
1662 bool weak_barriers, struct vring_desc *desc,
1663 struct vring_avail *avail, struct vring_used *used)
1664 {
1665 return vringh_init_kern(vrh, features, num, weak_barriers, desc, avail,
1666 used);
1667 }
1668 EXPORT_SYMBOL(vringh_init_iomem);
1669
1670 /**
1671 * vringh_getdesc_iomem - get next available descriptor from vring on
io-memory.
1672 * @vrh: the vring on io-memory.
1673 * @riov: where to put the readable descriptors (or NULL)
1674 * @wiov: where to put the writable descriptors (or NULL)
1675 * @head: head index we received, for passing to vringh_complete_iomem().
1676 * @gfp: flags for allocating larger riov/wiov.
1677 *
1678 * Returns 0 if there was no descriptor, 1 if there was, or -errno.
1679 *
1680 * There some notes, and those are same with vringh_getdesc_kern().
Please see
1681 * it.
1682 */> 1683 int vringh_getdesc_iomem(struct vringh *vrh, struct vringh_kiov *riov,
1684 struct vringh_kiov *wiov, u16 *head, gfp_t gfp)
1685 {
1686 int err;
1687
1688 err = __vringh_get_head(vrh, getu16_iomem, &vrh->last_avail_idx);
1689 if (err < 0)
1690 return err;
1691
1692 /* Empty... */
1693 if (err == vrh->vring.num)
1694 return 0;
1695
1696 *head = err;
1697 err = __vringh_iov(vrh, *head, riov, wiov, no_range_check, NULL, gfp,
1698 copydesc_iomem);
1699 if (err)
1700 return err;
1701
1702 return 1;
1703 }
1704 EXPORT_SYMBOL(vringh_getdesc_iomem);
1705
1706 /**
1707 * vringh_iov_pull_iomem - copy bytes from vring_iov.
1708 * @riov: the riov as passed to vringh_getdesc_iomem() (updated as we
consume)
1709 * @dst: the place to copy.
1710 * @len: the maximum length to copy.
1711 *
1712 * Returns the bytes copied <= len or a negative errno.
1713 */> 1714 ssize_t vringh_iov_pull_iomem(struct vringh *vrh, struct vringh_kiov
*riov,
1715 void *dst, size_t len)
1716 {
1717 return vringh_iov_xfer(vrh, riov, dst, len, xfer_from_iomem);
1718 }
1719 EXPORT_SYMBOL(vringh_iov_pull_iomem);
1720
1721 /**
1722 * vringh_iov_push_iomem - copy bytes into vring_iov.
1723 * @wiov: the wiov as passed to vringh_getdesc_iomem() (updated as we
consume)
1724 * @src: the place to copy from.
1725 * @len: the maximum length to copy.
1726 *
1727 * Returns the bytes copied <= len or a negative errno.
1728 */> 1729 ssize_t vringh_iov_push_iomem(struct vringh *vrh, struct vringh_kiov
*wiov,
1730 const void *src, size_t len)
1731 {
1732 return vringh_iov_xfer(vrh, wiov, (void *)src, len, xfer_to_iomem);
1733 }
1734 EXPORT_SYMBOL(vringh_iov_push_iomem);
1735
1736 /**
1737 * vringh_abandon_iomem - we've decided not to handle the
descriptor(s).
1738 * @vrh: the vring.
1739 * @num: the number of descriptors to put back (ie. num
1740 * vringh_getdesc_iomem() to undo).
1741 *
1742 * The next vringh_get_kern() will return the old descriptor(s) again.
1743 */> 1744 void vringh_abandon_iomem(struct vringh *vrh, unsigned int num)
1745 {
1746 vringh_abandon_kern(vrh, num);
1747 }
1748 EXPORT_SYMBOL(vringh_abandon_iomem);
1749
1750 /**
1751 * vringh_complete_iomem - we've finished with descriptor, publish
it.
1752 * @vrh: the vring.
1753 * @head: the head as filled in by vringh_getdesc_iomem().
1754 * @len: the length of data we have written.
1755 *
1756 * You should check vringh_need_notify_iomem() after one or more calls
1757 * to this function.
1758 */> 1759 int vringh_complete_iomem(struct vringh *vrh, u16 head, u32 len)
1760 {
1761 struct vring_used_elem used;
1762
1763 used.id = cpu_to_vringh32(vrh, head);
1764 used.len = cpu_to_vringh32(vrh, len);
1765
1766 return __vringh_complete(vrh, &used, 1, putu16_iomem,
putused_iomem);
1767 }
1768 EXPORT_SYMBOL(vringh_complete_iomem);
1769
1770 /**
1771 * vringh_notify_enable_iomem - we want to know if something changes.
1772 * @vrh: the vring.
1773 *
1774 * This always enables notifications, but returns false if there are
1775 * now more buffers available in the vring.
1776 */> 1777 bool vringh_notify_enable_iomem(struct vringh *vrh)
1778 {
1779 return __vringh_notify_enable(vrh, getu16_iomem, putu16_iomem);
1780 }
1781 EXPORT_SYMBOL(vringh_notify_enable_iomem);
1782
1783 /**
1784 * vringh_notify_disable_iomem - don't tell us if something changes.
1785 * @vrh: the vring.
1786 *
1787 * This is our normal running state: we disable and then only enable when
1788 * we're going to sleep.
1789 */> 1790 void vringh_notify_disable_iomem(struct vringh *vrh)
1791 {
1792 __vringh_notify_disable(vrh, putu16_iomem);
1793 }
1794 EXPORT_SYMBOL(vringh_notify_disable_iomem);
1795
1796 /**
1797 * vringh_need_notify_iomem - must we tell the other side about used
buffers?
1798 * @vrh: the vring we've called vringh_complete_iomem() on.
1799 *
1800 * Returns -errno or 0 if we don't need to tell the other side, 1 if
we do.
1801 */> 1802 int vringh_need_notify_iomem(struct vringh *vrh)
1803 {
1804 return __vringh_need_notify(vrh, getu16_iomem);
1805 }
1806 EXPORT_SYMBOL(vringh_need_notify_iomem);
1807
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Hi Shunsuke,
kernel test robot noticed the following build warnings:
[auto build test WARNING on mst-vhost/linux-next]
[also build test WARNING on linus/master horms-ipvs/master v6.4-rc4
next-20230602]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url:
https://github.com/intel-lab-lkp/linux/commits/Shunsuke-Mie/vringh-IOMEM-support/20230602-135351
base: https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git linux-next
patch link:
https://lore.kernel.org/r/20230602055211.309960-2-mie%40igel.co.jp
patch subject: [PATCH v4 1/1] vringh: IOMEM support
config: hexagon-randconfig-r034-20230531
(https://download.01.org/0day-ci/archive/20230603/202306030119.NG7CQmJ8-lkp at
intel.com/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project
4faf3aaf28226a4e950c103a14f6fc1d1fdabb1b)
reproduce (this is a W=1 build):
mkdir -p ~/bin
wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
~/bin/make.cross
chmod +x ~/bin/make.cross
#
https://github.com/intel-lab-lkp/linux/commit/de2a1f5220c32e953400f225aba6bd294a8d41b8
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review
Shunsuke-Mie/vringh-IOMEM-support/20230602-135351
git checkout de2a1f5220c32e953400f225aba6bd294a8d41b8
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang ~/bin/make.cross W=1
O=build_dir ARCH=hexagon olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang ~/bin/make.cross W=1
O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/vhost/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp at intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202306030119.NG7CQmJ8-lkp at
intel.com/
All warnings (new ones prefixed by >>):
In file included from drivers/vhost/vringh.c:17:
In file included from include/linux/bvec.h:10:
In file included from include/linux/highmem.h:12:
In file included from include/linux/hardirq.h:11:
In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/hexagon/include/asm/io.h:334:
include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a
null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __raw_readb(PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a
null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro
'__le16_to_cpu'
#define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
^
In file included from drivers/vhost/vringh.c:17:
In file included from include/linux/bvec.h:10:
In file included from include/linux/highmem.h:12:
In file included from include/linux/hardirq.h:11:
In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/hexagon/include/asm/io.h:334:
include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a
null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro
'__le32_to_cpu'
#define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
^
In file included from drivers/vhost/vringh.c:17:
In file included from include/linux/bvec.h:10:
In file included from include/linux/highmem.h:12:
In file included from include/linux/hardirq.h:11:
In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/hexagon/include/asm/io.h:334:
include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a
null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writeb(value, PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a
null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a
null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
~~~~~~~~~~
^>> drivers/vhost/vringh.c:1661:5: warning: no previous prototype for
function 'vringh_init_iomem' [-Wmissing-prototypes]
int vringh_init_iomem(struct vringh *vrh, u64 features, unsigned int num,
^
drivers/vhost/vringh.c:1661:1: note: declare 'static' if the function
is not intended to be used outside of this translation unit
int vringh_init_iomem(struct vringh *vrh, u64 features, unsigned int num,
^
static >> drivers/vhost/vringh.c:1683:5: warning: no previous prototype for
function 'vringh_getdesc_iomem' [-Wmissing-prototypes]
int vringh_getdesc_iomem(struct vringh *vrh, struct vringh_kiov *riov,
^
drivers/vhost/vringh.c:1683:1: note: declare 'static' if the function
is not intended to be used outside of this translation unit
int vringh_getdesc_iomem(struct vringh *vrh, struct vringh_kiov *riov,
^
static >> drivers/vhost/vringh.c:1714:9: warning: no previous prototype for
function 'vringh_iov_pull_iomem' [-Wmissing-prototypes]
ssize_t vringh_iov_pull_iomem(struct vringh *vrh, struct vringh_kiov *riov,
^
drivers/vhost/vringh.c:1714:1: note: declare 'static' if the function
is not intended to be used outside of this translation unit
ssize_t vringh_iov_pull_iomem(struct vringh *vrh, struct vringh_kiov *riov,
^
static >> drivers/vhost/vringh.c:1729:9: warning: no previous prototype for
function 'vringh_iov_push_iomem' [-Wmissing-prototypes]
ssize_t vringh_iov_push_iomem(struct vringh *vrh, struct vringh_kiov *wiov,
^
drivers/vhost/vringh.c:1729:1: note: declare 'static' if the function
is not intended to be used outside of this translation unit
ssize_t vringh_iov_push_iomem(struct vringh *vrh, struct vringh_kiov *wiov,
^
static >> drivers/vhost/vringh.c:1744:6: warning: no previous prototype for
function 'vringh_abandon_iomem' [-Wmissing-prototypes]
void vringh_abandon_iomem(struct vringh *vrh, unsigned int num)
^
drivers/vhost/vringh.c:1744:1: note: declare 'static' if the function
is not intended to be used outside of this translation unit
void vringh_abandon_iomem(struct vringh *vrh, unsigned int num)
^
static >> drivers/vhost/vringh.c:1759:5: warning: no previous prototype for
function 'vringh_complete_iomem' [-Wmissing-prototypes]
int vringh_complete_iomem(struct vringh *vrh, u16 head, u32 len)
^
drivers/vhost/vringh.c:1759:1: note: declare 'static' if the function
is not intended to be used outside of this translation unit
int vringh_complete_iomem(struct vringh *vrh, u16 head, u32 len)
^
static >> drivers/vhost/vringh.c:1777:6: warning: no previous prototype for
function 'vringh_notify_enable_iomem' [-Wmissing-prototypes]
bool vringh_notify_enable_iomem(struct vringh *vrh)
^
drivers/vhost/vringh.c:1777:1: note: declare 'static' if the function
is not intended to be used outside of this translation unit
bool vringh_notify_enable_iomem(struct vringh *vrh)
^
static >> drivers/vhost/vringh.c:1790:6: warning: no previous prototype for
function 'vringh_notify_disable_iomem' [-Wmissing-prototypes]
void vringh_notify_disable_iomem(struct vringh *vrh)
^
drivers/vhost/vringh.c:1790:1: note: declare 'static' if the function
is not intended to be used outside of this translation unit
void vringh_notify_disable_iomem(struct vringh *vrh)
^
static >> drivers/vhost/vringh.c:1802:5: warning: no previous prototype for
function 'vringh_need_notify_iomem' [-Wmissing-prototypes]
int vringh_need_notify_iomem(struct vringh *vrh)
^
drivers/vhost/vringh.c:1802:1: note: declare 'static' if the function
is not intended to be used outside of this translation unit
int vringh_need_notify_iomem(struct vringh *vrh)
^
static
15 warnings generated.
vim +/vringh_init_iomem +1661 drivers/vhost/vringh.c
1647
1648 /**
1649 * vringh_init_iomem - initialize a vringh for a vring on io-memory.
1650 * @vrh: the vringh to initialize.
1651 * @features: the feature bits for this ring.
1652 * @num: the number of elements.
1653 * @weak_barriers: true if we only need memory barriers, not I/O.
1654 * @desc: the userspace descriptor pointer.
1655 * @avail: the userspace avail pointer.
1656 * @used: the userspace used pointer.
1657 *
1658 * Returns an error if num is invalid: you should check pointers
1659 * yourself!
1660 */> 1661 int vringh_init_iomem(struct vringh *vrh, u64 features, unsigned int
num,
1662 bool weak_barriers, struct vring_desc *desc,
1663 struct vring_avail *avail, struct vring_used *used)
1664 {
1665 return vringh_init_kern(vrh, features, num, weak_barriers, desc, avail,
1666 used);
1667 }
1668 EXPORT_SYMBOL(vringh_init_iomem);
1669
1670 /**
1671 * vringh_getdesc_iomem - get next available descriptor from vring on
io-memory.
1672 * @vrh: the vring on io-memory.
1673 * @riov: where to put the readable descriptors (or NULL)
1674 * @wiov: where to put the writable descriptors (or NULL)
1675 * @head: head index we received, for passing to vringh_complete_iomem().
1676 * @gfp: flags for allocating larger riov/wiov.
1677 *
1678 * Returns 0 if there was no descriptor, 1 if there was, or -errno.
1679 *
1680 * There some notes, and those are same with vringh_getdesc_kern().
Please see
1681 * it.
1682 */> 1683 int vringh_getdesc_iomem(struct vringh *vrh, struct vringh_kiov *riov,
1684 struct vringh_kiov *wiov, u16 *head, gfp_t gfp)
1685 {
1686 int err;
1687
1688 err = __vringh_get_head(vrh, getu16_iomem, &vrh->last_avail_idx);
1689 if (err < 0)
1690 return err;
1691
1692 /* Empty... */
1693 if (err == vrh->vring.num)
1694 return 0;
1695
1696 *head = err;
1697 err = __vringh_iov(vrh, *head, riov, wiov, no_range_check, NULL, gfp,
1698 copydesc_iomem);
1699 if (err)
1700 return err;
1701
1702 return 1;
1703 }
1704 EXPORT_SYMBOL(vringh_getdesc_iomem);
1705
1706 /**
1707 * vringh_iov_pull_iomem - copy bytes from vring_iov.
1708 * @riov: the riov as passed to vringh_getdesc_iomem() (updated as we
consume)
1709 * @dst: the place to copy.
1710 * @len: the maximum length to copy.
1711 *
1712 * Returns the bytes copied <= len or a negative errno.
1713 */> 1714 ssize_t vringh_iov_pull_iomem(struct vringh *vrh, struct vringh_kiov
*riov,
1715 void *dst, size_t len)
1716 {
1717 return vringh_iov_xfer(vrh, riov, dst, len, xfer_from_iomem);
1718 }
1719 EXPORT_SYMBOL(vringh_iov_pull_iomem);
1720
1721 /**
1722 * vringh_iov_push_iomem - copy bytes into vring_iov.
1723 * @wiov: the wiov as passed to vringh_getdesc_iomem() (updated as we
consume)
1724 * @src: the place to copy from.
1725 * @len: the maximum length to copy.
1726 *
1727 * Returns the bytes copied <= len or a negative errno.
1728 */> 1729 ssize_t vringh_iov_push_iomem(struct vringh *vrh, struct vringh_kiov
*wiov,
1730 const void *src, size_t len)
1731 {
1732 return vringh_iov_xfer(vrh, wiov, (void *)src, len, xfer_to_iomem);
1733 }
1734 EXPORT_SYMBOL(vringh_iov_push_iomem);
1735
1736 /**
1737 * vringh_abandon_iomem - we've decided not to handle the
descriptor(s).
1738 * @vrh: the vring.
1739 * @num: the number of descriptors to put back (ie. num
1740 * vringh_getdesc_iomem() to undo).
1741 *
1742 * The next vringh_get_kern() will return the old descriptor(s) again.
1743 */> 1744 void vringh_abandon_iomem(struct vringh *vrh, unsigned int num)
1745 {
1746 vringh_abandon_kern(vrh, num);
1747 }
1748 EXPORT_SYMBOL(vringh_abandon_iomem);
1749
1750 /**
1751 * vringh_complete_iomem - we've finished with descriptor, publish
it.
1752 * @vrh: the vring.
1753 * @head: the head as filled in by vringh_getdesc_iomem().
1754 * @len: the length of data we have written.
1755 *
1756 * You should check vringh_need_notify_iomem() after one or more calls
1757 * to this function.
1758 */> 1759 int vringh_complete_iomem(struct vringh *vrh, u16 head, u32 len)
1760 {
1761 struct vring_used_elem used;
1762
1763 used.id = cpu_to_vringh32(vrh, head);
1764 used.len = cpu_to_vringh32(vrh, len);
1765
1766 return __vringh_complete(vrh, &used, 1, putu16_iomem,
putused_iomem);
1767 }
1768 EXPORT_SYMBOL(vringh_complete_iomem);
1769
1770 /**
1771 * vringh_notify_enable_iomem - we want to know if something changes.
1772 * @vrh: the vring.
1773 *
1774 * This always enables notifications, but returns false if there are
1775 * now more buffers available in the vring.
1776 */> 1777 bool vringh_notify_enable_iomem(struct vringh *vrh)
1778 {
1779 return __vringh_notify_enable(vrh, getu16_iomem, putu16_iomem);
1780 }
1781 EXPORT_SYMBOL(vringh_notify_enable_iomem);
1782
1783 /**
1784 * vringh_notify_disable_iomem - don't tell us if something changes.
1785 * @vrh: the vring.
1786 *
1787 * This is our normal running state: we disable and then only enable when
1788 * we're going to sleep.
1789 */> 1790 void vringh_notify_disable_iomem(struct vringh *vrh)
1791 {
1792 __vringh_notify_disable(vrh, putu16_iomem);
1793 }
1794 EXPORT_SYMBOL(vringh_notify_disable_iomem);
1795
1796 /**
1797 * vringh_need_notify_iomem - must we tell the other side about used
buffers?
1798 * @vrh: the vring we've called vringh_complete_iomem() on.
1799 *
1800 * Returns -errno or 0 if we don't need to tell the other side, 1 if
we do.
1801 */> 1802 int vringh_need_notify_iomem(struct vringh *vrh)
1803 {
1804 return __vringh_need_notify(vrh, getu16_iomem);
1805 }
1806 EXPORT_SYMBOL(vringh_need_notify_iomem);
1807
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Hi Shunsuke,
kernel test robot noticed the following build errors:
[auto build test ERROR on mst-vhost/linux-next]
[also build test ERROR on linus/master horms-ipvs/master v6.4-rc4 next-20230602]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url:
https://github.com/intel-lab-lkp/linux/commits/Shunsuke-Mie/vringh-IOMEM-support/20230602-135351
base: https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git linux-next
patch link:
https://lore.kernel.org/r/20230602055211.309960-2-mie%40igel.co.jp
patch subject: [PATCH v4 1/1] vringh: IOMEM support
config: i386-randconfig-i003-20230531
(https://download.01.org/0day-ci/archive/20230603/202306030216.bpWr6XV0-lkp at
intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build):
#
https://github.com/intel-lab-lkp/linux/commit/de2a1f5220c32e953400f225aba6bd294a8d41b8
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review
Shunsuke-Mie/vringh-IOMEM-support/20230602-135351
git checkout de2a1f5220c32e953400f225aba6bd294a8d41b8
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=i386 olddefconfig
make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp at intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202306030216.bpWr6XV0-lkp at
intel.com/
All errors (new ones prefixed by >>):
drivers/vhost/vringh.c: In function
'getu16_iomem':>> drivers/vhost/vringh.c:1610:37: error: implicit declaration of function
'ioread16' [-Werror=implicit-function-declaration]
1610 | *val = vringh16_to_cpu(vrh, ioread16(p));
| ^~~~~~~~
drivers/vhost/vringh.c: In function
'putu16_iomem':>> drivers/vhost/vringh.c:1616:9: error: implicit declaration of function
'iowrite16' [-Werror=implicit-function-declaration]
1616 | iowrite16(cpu_to_vringh16(vrh, val), p);
| ^~~~~~~~~
drivers/vhost/vringh.c: In function
'copydesc_iomem':>> drivers/vhost/vringh.c:1623:9: error: implicit declaration of function
'memcpy_fromio'; did you mean 'memcpy_from_bvec'?
[-Werror=implicit-function-declaration]
1623 | memcpy_fromio(dst, src, len);
| ^~~~~~~~~~~~~
| memcpy_from_bvec
drivers/vhost/vringh.c: In function
'putused_iomem':>> drivers/vhost/vringh.c:1630:9: error: implicit declaration of function
'memcpy_toio' [-Werror=implicit-function-declaration]
1630 | memcpy_toio(dst, src, num * sizeof(*dst));
| ^~~~~~~~~~~
drivers/vhost/vringh.c: At top level:
drivers/vhost/vringh.c:1661:5: warning: no previous prototype for
'vringh_init_iomem' [-Wmissing-prototypes]
1661 | int vringh_init_iomem(struct vringh *vrh, u64 features, unsigned int
num,
| ^~~~~~~~~~~~~~~~~
drivers/vhost/vringh.c:1683:5: warning: no previous prototype for
'vringh_getdesc_iomem' [-Wmissing-prototypes]
1683 | int vringh_getdesc_iomem(struct vringh *vrh, struct vringh_kiov
*riov,
| ^~~~~~~~~~~~~~~~~~~~
drivers/vhost/vringh.c:1714:9: warning: no previous prototype for
'vringh_iov_pull_iomem' [-Wmissing-prototypes]
1714 | ssize_t vringh_iov_pull_iomem(struct vringh *vrh, struct vringh_kiov
*riov,
| ^~~~~~~~~~~~~~~~~~~~~
drivers/vhost/vringh.c:1729:9: warning: no previous prototype for
'vringh_iov_push_iomem' [-Wmissing-prototypes]
1729 | ssize_t vringh_iov_push_iomem(struct vringh *vrh, struct vringh_kiov
*wiov,
| ^~~~~~~~~~~~~~~~~~~~~
drivers/vhost/vringh.c:1744:6: warning: no previous prototype for
'vringh_abandon_iomem' [-Wmissing-prototypes]
1744 | void vringh_abandon_iomem(struct vringh *vrh, unsigned int num)
| ^~~~~~~~~~~~~~~~~~~~
drivers/vhost/vringh.c:1759:5: warning: no previous prototype for
'vringh_complete_iomem' [-Wmissing-prototypes]
1759 | int vringh_complete_iomem(struct vringh *vrh, u16 head, u32 len)
| ^~~~~~~~~~~~~~~~~~~~~
drivers/vhost/vringh.c:1777:6: warning: no previous prototype for
'vringh_notify_enable_iomem' [-Wmissing-prototypes]
1777 | bool vringh_notify_enable_iomem(struct vringh *vrh)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/vhost/vringh.c:1790:6: warning: no previous prototype for
'vringh_notify_disable_iomem' [-Wmissing-prototypes]
1790 | void vringh_notify_disable_iomem(struct vringh *vrh)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/vhost/vringh.c:1802:5: warning: no previous prototype for
'vringh_need_notify_iomem' [-Wmissing-prototypes]
1802 | int vringh_need_notify_iomem(struct vringh *vrh)
| ^~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
vim +/ioread16 +1610 drivers/vhost/vringh.c
1606
1607 static inline int getu16_iomem(const struct vringh *vrh, u16 *val,
1608 const __virtio16 *p)
1609 {> 1610 *val = vringh16_to_cpu(vrh, ioread16(p));
1611 return 0;
1612 }
1613
1614 static inline int putu16_iomem(const struct vringh *vrh, __virtio16 *p,
u16 val)
1615 {> 1616 iowrite16(cpu_to_vringh16(vrh, val), p);
1617 return 0;
1618 }
1619
1620 static inline int copydesc_iomem(const struct vringh *vrh, void *dst,
1621 const void *src, size_t len)
1622 {> 1623 memcpy_fromio(dst, src, len);
1624 return 0;
1625 }
1626
1627 static int putused_iomem(const struct vringh *vrh, struct vring_used_elem
*dst,
1628 const struct vring_used_elem *src, unsigned int num)
1629 {> 1630 memcpy_toio(dst, src, num * sizeof(*dst));
1631 return 0;
1632 }
1633
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Hi Shunsuke,
kernel test robot noticed the following build warnings:
[auto build test WARNING on mst-vhost/linux-next]
[also build test WARNING on linus/master horms-ipvs/master v6.4-rc4
next-20230602]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url:
https://github.com/intel-lab-lkp/linux/commits/Shunsuke-Mie/vringh-IOMEM-support/20230602-135351
base: https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git linux-next
patch link:
https://lore.kernel.org/r/20230602055211.309960-2-mie%40igel.co.jp
patch subject: [PATCH v4 1/1] vringh: IOMEM support
config: nios2-randconfig-s053-20230531
(https://download.01.org/0day-ci/archive/20230603/202306031019.wWKekRGz-lkp at
intel.com/config)
compiler: nios2-linux-gcc (GCC) 12.3.0
reproduce:
mkdir -p ~/bin
wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-39-gce1a6720-dirty
#
https://github.com/intel-lab-lkp/linux/commit/de2a1f5220c32e953400f225aba6bd294a8d41b8
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review
Shunsuke-Mie/vringh-IOMEM-support/20230602-135351
git checkout de2a1f5220c32e953400f225aba6bd294a8d41b8
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.3.0 ~/bin/make.cross
C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=nios2
olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.3.0 ~/bin/make.cross
C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=nios2
SHELL=/bin/bash drivers/vhost/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp at intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202306031019.wWKekRGz-lkp at
intel.com/
sparse warnings: (new ones prefixed by >>)>> drivers/vhost/vringh.c:1630:21: sparse: sparse: incorrect type in
argument 1 (different address spaces) @@ expected void volatile [noderef]
__iomem *addr @@ got struct vring_used_elem *dst @@
drivers/vhost/vringh.c:1630:21: sparse: expected void volatile [noderef]
__iomem *addr
drivers/vhost/vringh.c:1630:21: sparse: got struct vring_used_elem *dst
drivers/vhost/vringh.c:592:18: sparse: sparse: restricted __virtio16 degrades
to integer
drivers/vhost/vringh.c:592:18: sparse: sparse: restricted __virtio16 degrades
to integer
drivers/vhost/vringh.c:592:18: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vringh.c:1280:23: sparse: sparse: restricted __virtio16
degrades to integer
drivers/vhost/vringh.c:1280:23: sparse: sparse: restricted __virtio16
degrades to integer
drivers/vhost/vringh.c:1280:23: sparse: sparse: cast to restricted
__virtio16>> drivers/vhost/vringh.c:1610:46: sparse: sparse: incorrect type in
argument 1 (different address spaces) @@ expected void const volatile
[noderef] __iomem *addr @@ got restricted __virtio16 const [usertype] *p @@
drivers/vhost/vringh.c:1610:46: sparse: expected void const volatile
[noderef] __iomem *addr
drivers/vhost/vringh.c:1610:46: sparse: got restricted __virtio16 const
[usertype] *p>> drivers/vhost/vringh.c:1610:45: sparse: sparse: incorrect type in
argument 2 (different base types) @@ expected restricted __virtio16
[usertype] val @@ got unsigned short @@
drivers/vhost/vringh.c:1610:45: sparse: expected restricted __virtio16
[usertype] val
drivers/vhost/vringh.c:1610:45: sparse: got unsigned
short>> drivers/vhost/vringh.c:1623:28: sparse: sparse: incorrect type in
argument 2 (different address spaces) @@ expected void const volatile
[noderef] __iomem *addr @@ got void const *src @@
drivers/vhost/vringh.c:1623:28: sparse: expected void const volatile
[noderef] __iomem *addr
drivers/vhost/vringh.c:1623:28: sparse: got void const
*src>> drivers/vhost/vringh.c:1637:28: sparse: sparse: incorrect type in
argument 2 (different address spaces) @@ expected void const volatile
[noderef] __iomem *addr @@ got void *src @@
drivers/vhost/vringh.c:1637:28: sparse: expected void const volatile
[noderef] __iomem *addr
drivers/vhost/vringh.c:1637:28: sparse: got void
*src>> drivers/vhost/vringh.c:1644:21: sparse: sparse: incorrect type in
argument 1 (different address spaces) @@ expected void volatile [noderef]
__iomem *addr @@ got void *dst @@
drivers/vhost/vringh.c:1644:21: sparse: expected void volatile [noderef]
__iomem *addr
drivers/vhost/vringh.c:1644:21: sparse: got void
*dst>> drivers/vhost/vringh.c:1616:34: sparse: sparse: incorrect type in
argument 1 (different base types) @@ expected unsigned short [usertype]
value @@ got restricted __virtio16 @@
drivers/vhost/vringh.c:1616:34: sparse: expected unsigned short
[usertype] value
drivers/vhost/vringh.c:1616:34: sparse: got restricted
__virtio16>> drivers/vhost/vringh.c:1616:46: sparse: sparse: incorrect type in
argument 2 (different address spaces) @@ expected void volatile [noderef]
__iomem *addr @@ got restricted __virtio16 [usertype] *p @@
drivers/vhost/vringh.c:1616:46: sparse: expected void volatile [noderef]
__iomem *addr
drivers/vhost/vringh.c:1616:46: sparse: got restricted __virtio16
[usertype] *p
drivers/vhost/vringh.c: note: in included file (through
include/uapi/linux/swab.h, include/linux/swab.h,
include/uapi/linux/byteorder/little_endian.h, ...):
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:25:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:25:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:25:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:25:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:25:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:31:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:25:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:25:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:25:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:25:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:25:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:25:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:25:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
arch/nios2/include/uapi/asm/swab.h:25:24: sparse: sparse: too many arguments
for function __builtin_custom_ini
vim +1630 drivers/vhost/vringh.c
1606
1607 static inline int getu16_iomem(const struct vringh *vrh, u16 *val,
1608 const __virtio16 *p)
1609 {> 1610 *val = vringh16_to_cpu(vrh, ioread16(p));
1611 return 0;
1612 }
1613
1614 static inline int putu16_iomem(const struct vringh *vrh, __virtio16 *p,
u16 val)
1615 {> 1616 iowrite16(cpu_to_vringh16(vrh, val), p);
1617 return 0;
1618 }
1619
1620 static inline int copydesc_iomem(const struct vringh *vrh, void *dst,
1621 const void *src, size_t len)
1622 {> 1623 memcpy_fromio(dst, src, len);
1624 return 0;
1625 }
1626
1627 static int putused_iomem(const struct vringh *vrh, struct vring_used_elem
*dst,
1628 const struct vring_used_elem *src, unsigned int num)
1629 {> 1630 memcpy_toio(dst, src, num * sizeof(*dst));
1631 return 0;
1632 }
1633
1634 static inline int xfer_from_iomem(const struct vringh *vrh, void *src,
1635 void *dst, size_t len)
1636 {> 1637 memcpy_fromio(dst, src, len);
1638 return 0;
1639 }
1640
1641 static inline int xfer_to_iomem(const struct vringh *vrh, void *dst, void
*src,
1642 size_t len)
1643 {> 1644 memcpy_toio(dst, src, len);
1645 return 0;
1646 }
1647
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki