From nobody Thu Feb 8 16:36:29 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TW2gK6zcgz5B0jn; Thu, 8 Feb 2024 16:36:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TW2gK5pGVz4Mm6; Thu, 8 Feb 2024 16:36:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1707410189; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=udWwrfGRrX2bZt2vLHOOfGxzcQA8b8kh6cjrrXdUKS0=; b=BeSR/0AHMxhwUiyDZJ0BPQwpkhhNVrDVMXKr4EEodMMOofxxYJHh6maJPNAlADRdT56YXS F26B+lf+QxOqWFD8iRL9d/+ejEFczppWpM+vCNO/yTq4ECTfz8FMrhME/cmsVqCALfDt3s D8XFlgrIgy/dSlH5oHKZY3pr/9W8Bj8KRcK6LFAdo0Ba7fC78FpZJ761kDeQQxufe4hq3x 3+0P1GN/hnM5AahsiY2ePV5wsBYX4XaPHEBIp/nyCy/FhM7YZ7juCjUzHYH5nyG4wJKJx5 BXdniEDqXhJ2Oj2QQYgxvcEhTvcUcDYfk7pAAwcGERBxvnwRxfxYOaQnVmPZlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1707410189; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=udWwrfGRrX2bZt2vLHOOfGxzcQA8b8kh6cjrrXdUKS0=; b=TLbvOrTPPaDkP9lJ3uBQxEduj46iYFEmxOBStnPOctBeVgiQWhJ190Wt8RALXj/v+5FgBf ozjDmiimk0s/x/gepMddo+Be3kDjEUBibWaQmG7AO+ivd9oKSBTz5zCFKS7wI4e0NN1tVU ygV0ZPlBmTjX1LRg5mOEGrIMJGsi3UwI/6aC5KFLVRvPv4ERzf0rSRYGYNnnNkTIqz04GK BVrMgubcWKZVQ9//mAzFyDpOKYooFnw9n0KBtjubylfOMOwcNncTt6KGHFFRie8rbONBzJ CsrOamy28HEbGVBTJaL403hBqfA1J7wYxTlSANDiWWanR0EmQY4vDr37xitkXA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1707410189; a=rsa-sha256; cv=none; b=J49sddHkAJ6tnQ/nxVl+GuBEdZ0TCQi3iWspnq0qpLix6bu+PQy4MLe/03txaWGML5WO16 eBZlCvQ3Mmt9uLX5GenJ5Fzhh4GozUGN+Bq9vu0+ygkMrv6dISZvQT+S4Dk7XvsQKmf1j2 m41/ku6EhpoCtx3euw4vgs6taZsLaUEak9Csc2104NOs9Ruzx12AquwZjXhUAaMgqRZlxa p4HqBjLu6pHe0x+3J9zU+KXQwLf/ebNDw8amc+X4yCvrNEW6IXki9SyOUWGBDJ/tP6d17E Pe/SNq/eGMSDZaCvhX/yr9AAPTyYJmyOimOLSCToNG2Wxp3UXVjzxpsUvDMUDQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4TW2gK4ZRTzxFB; Thu, 8 Feb 2024 16:36:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 418GaTdp020585; Thu, 8 Feb 2024 16:36:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 418GaTNH020582; Thu, 8 Feb 2024 16:36:29 GMT (envelope-from git) Date: Thu, 8 Feb 2024 16:36:29 GMT Message-Id: <202402081636.418GaTNH020582@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 92eb673b2b0d - main - kmsan: Add some additional bus_space accessors List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 92eb673b2b0d229ba046d386f19df7c01c09b26f Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=92eb673b2b0d229ba046d386f19df7c01c09b26f commit 92eb673b2b0d229ba046d386f19df7c01c09b26f Author: Mark Johnston AuthorDate: 2024-02-08 15:40:11 +0000 Commit: Mark Johnston 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 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