[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221221091302.mxnmrnqvn7oua7nf@sgarzare-redhat>
Date: Wed, 21 Dec 2022 10:13:02 +0100
From: Stefano Garzarella <sgarzare@...hat.com>
To: Shunsuke Mie <mie@...l.co.jp>
Cc: "Michael S. Tsirkin" <mst@...hat.com>,
Jason Wang <jasowang@...hat.com>,
Eugenio PĂ©rez <eperezma@...hat.com>,
linux-kernel@...r.kernel.org,
virtualization@...ts.linux-foundation.org
Subject: Re: [PATCH] tools/virtio: fix the vringh test for virtio ring changes
On Wed, Dec 21, 2022 at 04:55:06PM +0900, Shunsuke Mie wrote:
>Fix the build caused by missing kmsan_handle_dma() and is_power_of_2() that
>are used in drivers/virtio/virtio_ring.c.
>
>Signed-off-by: Shunsuke Mie <mie@...l.co.jp>
>---
> tools/virtio/linux/cpumask.h | 7 +++++++
> tools/virtio/linux/gfp.h | 7 +++++++
> tools/virtio/linux/kernel.h | 1 +
> tools/virtio/linux/kmsan.h | 12 ++++++++++++
> tools/virtio/linux/log2.h | 11 +++++++++++
> tools/virtio/linux/topology.h | 7 +++++++
> 6 files changed, 45 insertions(+)
> create mode 100644 tools/virtio/linux/cpumask.h
> create mode 100644 tools/virtio/linux/gfp.h
> create mode 100644 tools/virtio/linux/kmsan.h
> create mode 100644 tools/virtio/linux/log2.h
> create mode 100644 tools/virtio/linux/topology.h
>
>diff --git a/tools/virtio/linux/cpumask.h b/tools/virtio/linux/cpumask.h
>new file mode 100644
>index 000000000000..307da69d6b26
>--- /dev/null
>+++ b/tools/virtio/linux/cpumask.h
>@@ -0,0 +1,7 @@
>+/* SPDX-License-Identifier: GPL-2.0 */
>+#ifndef _LINUX_CPUMASK_H
>+#define _LINUX_CPUMASK_H
>+
>+#include <linux/kernel.h>
>+
>+#endif /* _LINUX_CPUMASK_H */
>diff --git a/tools/virtio/linux/gfp.h b/tools/virtio/linux/gfp.h
>new file mode 100644
>index 000000000000..43d146f236f1
>--- /dev/null
>+++ b/tools/virtio/linux/gfp.h
>@@ -0,0 +1,7 @@
>+/* SPDX-License-Identifier: GPL-2.0 */
>+#ifndef __LINUX_GFP_H
>+#define __LINUX_GFP_H
>+
>+#include <linux/topology.h>
>+
>+#endif
>diff --git a/tools/virtio/linux/kernel.h b/tools/virtio/linux/kernel.h
>index 21593bf97755..8b877167933d 100644
>--- a/tools/virtio/linux/kernel.h
>+++ b/tools/virtio/linux/kernel.h
>@@ -10,6 +10,7 @@
> #include <stdarg.h>
>
> #include <linux/compiler.h>
>+#include <linux/log2.h>
> #include <linux/types.h>
> #include <linux/overflow.h>
> #include <linux/list.h>
>diff --git a/tools/virtio/linux/kmsan.h b/tools/virtio/linux/kmsan.h
>new file mode 100644
>index 000000000000..272b5aa285d5
>--- /dev/null
>+++ b/tools/virtio/linux/kmsan.h
>@@ -0,0 +1,12 @@
>+/* SPDX-License-Identifier: GPL-2.0 */
>+#ifndef _LINUX_KMSAN_H
>+#define _LINUX_KMSAN_H
>+
>+#include <linux/gfp.h>
>+
>+inline void kmsan_handle_dma(struct page *page, size_t offset, size_t size,
>+ enum dma_data_direction dir)
>+{
>+}
>+
>+#endif /* _LINUX_KMSAN_H */
>diff --git a/tools/virtio/linux/log2.h b/tools/virtio/linux/log2.h
>new file mode 100644
>index 000000000000..aa67bb21d8e2
>--- /dev/null
>+++ b/tools/virtio/linux/log2.h
>@@ -0,0 +1,11 @@
>+/* SPDX-License-Identifier: GPL-2.0 */
>+
>+#ifndef _LINUX_LOG2_H
>+#define _LINUX_LOG2_H
>+
>+inline bool is_power_of_2(unsigned long n)
>+{
>+ return true;
>+}
is_power_of_2 seems defined in tools/include/linux/log2.h so
`#include <linux/log2.h>` in tools/virtio/linux/kernel.h should be
enough.
If that's not the case, however, I think we should return true here only
if n is really power of 2.
Thanks,
Stefano
Powered by blists - more mailing lists