Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Feb 2024 16:36:29 GMT
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 92eb673b2b0d - main - kmsan: Add some additional bus_space accessors
Message-ID:  <202402081636.418GaTNH020582@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=92eb673b2b0d229ba046d386f19df7c01c09b26f

commit 92eb673b2b0d229ba046d386f19df7c01c09b26f
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-02-08 15:40:11 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-02-08 16:22:58 +0000

    kmsan: Add some additional bus_space accessors
    
    These are needed for arm64 support.
    
    Co-authored-by: Alexander Stetsenko <alex.stetsenko@klarasystems.com>
    Sponsored by:   Klara, Inc.
    Sponsored by:   Juniper Networks, Inc.
---
 sys/kern/subr_msan.c | 38 ++++++++++++++++++++++++++++++++++++--
 1 file changed, 36 insertions(+), 2 deletions(-)

diff --git a/sys/kern/subr_msan.c b/sys/kern/subr_msan.c
index ef3c6c10b0ba..ee60d6baf3fa 100644
--- a/sys/kern/subr_msan.c
+++ b/sys/kern/subr_msan.c
@@ -1391,13 +1391,18 @@ kmsan_bus_space_barrier(bus_space_tag_t tag, bus_space_handle_t hnd,
 	bus_space_barrier(tag, hnd, offset, size, flags);
 }
 
-/* XXXMJ x86-specific */
+#if defined(__amd64__)
+#define	BUS_SPACE_IO(tag)	((tag) == X86_BUS_SPACE_IO)
+#else
+#define	BUS_SPACE_IO(tag)	(false)
+#endif
+
 #define MSAN_BUS_READ_FUNC(func, width, type)				\
 	type kmsan_bus_space_read##func##_##width(bus_space_tag_t tag,	\
 	    bus_space_handle_t hnd, bus_size_t offset)			\
 	{								\
 		type ret;						\
-		if ((tag) != X86_BUS_SPACE_IO)				\
+		if (!BUS_SPACE_IO(tag))					\
 			kmsan_shadow_fill((uintptr_t)(hnd + offset),	\
 			    KMSAN_STATE_INITED, (width));		\
 		ret = bus_space_read##func##_##width(tag, hnd, offset);	\
@@ -1438,6 +1443,13 @@ MSAN_BUS_READ_PTR_FUNC(region, 4, uint32_t)
 MSAN_BUS_READ_PTR_FUNC(region_stream, 4, uint32_t)
 
 MSAN_BUS_READ_FUNC(, 8, uint64_t)
+#ifndef __amd64__
+MSAN_BUS_READ_FUNC(_stream, 8, uint64_t)
+MSAN_BUS_READ_PTR_FUNC(multi, 8, uint64_t)
+MSAN_BUS_READ_PTR_FUNC(multi_stream, 8, uint64_t)
+MSAN_BUS_READ_PTR_FUNC(region, 8, uint64_t)
+MSAN_BUS_READ_PTR_FUNC(region_stream, 8, uint64_t)
+#endif
 
 #define	MSAN_BUS_WRITE_FUNC(func, width, type)				\
 	void kmsan_bus_space_write##func##_##width(bus_space_tag_t tag,	\
@@ -1504,6 +1516,28 @@ MSAN_BUS_SET_FUNC(region, 4, uint32_t)
 MSAN_BUS_SET_FUNC(multi_stream, 4, uint32_t)
 MSAN_BUS_SET_FUNC(region_stream, 4, uint32_t)
 
+#define	MSAN_BUS_PEEK_FUNC(width, type)					\
+	int kmsan_bus_space_peek_##width(bus_space_tag_t tag,		\
+	    bus_space_handle_t hnd, bus_size_t offset, type *value)	\
+	{								\
+		return (bus_space_peek_##width(tag, hnd, offset, value)); \
+	}
+
+MSAN_BUS_PEEK_FUNC(1, uint8_t)
+MSAN_BUS_PEEK_FUNC(2, uint16_t)
+MSAN_BUS_PEEK_FUNC(4, uint32_t)
+
+#define	MSAN_BUS_POKE_FUNC(width, type)					\
+	int kmsan_bus_space_poke_##width(bus_space_tag_t tag,		\
+	    bus_space_handle_t hnd, bus_size_t offset, type value)	\
+	{								\
+		return (bus_space_poke_##width(tag, hnd, offset, value)); \
+	}
+
+MSAN_BUS_POKE_FUNC(1, uint8_t)
+MSAN_BUS_POKE_FUNC(2, uint16_t)
+MSAN_BUS_POKE_FUNC(4, uint32_t)
+
 /* -------------------------------------------------------------------------- */
 
 void



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202402081636.418GaTNH020582>