From nobody Thu Feb 08 16:36:35 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 4TW2gR5dsyz5B0DD; Thu, 8 Feb 2024 16:36:35 +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 4TW2gR2dNjz4NFD; Thu, 8 Feb 2024 16:36:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1707410195; 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=TarB+XTze7Rui7qaJjUlOqdEs4+dK1XdKrksP5sgJT0=; b=T3OjugGMKgpj9yb8Ui9KWz4a0GgCJnKEy+Zemfq03lH0pkJr+D1y5E6vqkqlC5wyp5yLlO lAJVsOFH3BweD18qNlEHHcyoxUmGOszwc/A28ySBQUiHZggvYeBeBgLXfBJNdiesVlw7eA FNL9UKddmUtRODgOw3YOsHux2xUKeye7ZUuftl/i5o/d5TcymuuW3T27w0Opu69NE6SOjp FfSzedvsejTVArivbqaozzF4wJgsxUQyS9Ap3IRwXMTNO0slNSvGSvEu3/yiqSiLY0g4Jc ygRmrjQfFn0hXEcr/ZcCjbPbZdZkvAsqH1+3PqLSehAvbzv7gIhJlj2NLO1XVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1707410195; 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=TarB+XTze7Rui7qaJjUlOqdEs4+dK1XdKrksP5sgJT0=; b=kP+evZ62qLUUoUr04X3q/b4xcN8zDoOlAMfcyXXGnIiKPJ8sJfBG22Ez++ke+jQRK2QpVw OJgYEMgnHY0g9tdSq3AcAJSUl/iOGw6TVTCeMkQ4Ct6k4WFprPDkVM+gsuhxi8Cdyz54gt 01KoH26rkYNxRBJPGUGrBBnlwfitNwF4LoNsf4bpErphLLPW3a2qSlDvFsBHrV6Mp8XB6k T9z1rOyr7kfnxgHdFHemztGrk1BVXP0+yQblZPxurAniU+CckKcDtW/SQUFDkcKkIEWMLZ +G0gut/QpjBvg85803tPlVYf196IbyfdsAhuzBZvxvlK0VFzam4eXsNBHKikWQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1707410195; a=rsa-sha256; cv=none; b=O9ZImMiu09pMstKnc6uTrjU1oNdruAL7N1nhnioiEnO7KBKfqjR9U0nzmF4576jEfo1FZG 7yJKCmtW0+ZuRi1rSRkY7pR7Vojb4OXeMyjCFrXQVBTSPbQgHQwiZWo7njMylgVKwEDe4v aXAyA15UX+pxaUOIJOcmwDk92sOWc+q2TWuG4LYaFumvuL40QckrfKwOEwee/xzKafz1TZ +yH8YrdiKkd4nQiYSQisdKeqryzizIdtCUWAN0YepgYuXNkjyOrWHpJ2x7EX2aaSuwzsRu vP8FYxAnr7RR6GRr+0tsPZlrKT+rjY7eSMbam/2CAjHpGRD8gFmtlFf4c4n4qw== 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 4TW2gR1f2hzxFD; Thu, 8 Feb 2024 16:36:35 +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 418GaZ7c020819; Thu, 8 Feb 2024 16:36:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 418GaZp8020816; Thu, 8 Feb 2024 16:36:35 GMT (envelope-from git) Date: Thu, 8 Feb 2024 16:36:35 GMT Message-Id: <202402081636.418GaZp8020816@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: 5fa4151e925c - main - arm64: Implement busdma bits for KMSAN 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: 5fa4151e925c39c4d788918badec2ec7b4cc8938 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=5fa4151e925c39c4d788918badec2ec7b4cc8938 commit 5fa4151e925c39c4d788918badec2ec7b4cc8938 Author: Mark Johnston AuthorDate: 2024-02-08 16:01:55 +0000 Commit: Mark Johnston CommitDate: 2024-02-08 16:35:11 +0000 arm64: Implement busdma bits for KMSAN This works identically to amd64. In particular, only the bus_dma_bounce_impl busdma implementation handles KMSAN at the moment. MFC after: 2 weeks Sponsored by: Klara, Inc. Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D43157 --- sys/arm64/arm64/busdma_bounce.c | 23 +++++++++++++++++++++-- sys/arm64/include/bus_dma.h | 12 ++++++++++++ sys/arm64/include/bus_dma_impl.h | 3 +++ 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/sys/arm64/arm64/busdma_bounce.c b/sys/arm64/arm64/busdma_bounce.c index a117e1041658..57551a2edb47 100644 --- a/sys/arm64/arm64/busdma_bounce.c +++ b/sys/arm64/arm64/busdma_bounce.c @@ -40,9 +40,10 @@ #include #include #include -#include #include +#include #include +#include #include #include @@ -104,6 +105,9 @@ struct bus_dmamap { #define DMAMAP_FROM_DMAMEM (1 << 1) #define DMAMAP_MBUF (1 << 2) int sync_count; +#ifdef KMSAN + struct memdesc kmsan_mem; +#endif struct sync_list slist[]; }; @@ -1149,7 +1153,19 @@ bounce_bus_dmamap_sync(bus_dma_tag_t dmat, bus_dmamap_t map, */ dsb(sy); } + + kmsan_bus_dmamap_sync(&map->kmsan_mem, op); +} + +#ifdef KMSAN +static void +bounce_bus_dmamap_load_kmsan(bus_dmamap_t map, struct memdesc *mem) +{ + if (map == NULL) + return; + memcpy(&map->kmsan_mem, mem, sizeof(map->kmsan_mem)); } +#endif struct bus_dma_impl bus_dma_bounce_impl = { .tag_create = bounce_bus_dma_tag_create, @@ -1166,5 +1182,8 @@ struct bus_dma_impl bus_dma_bounce_impl = { .map_waitok = bounce_bus_dmamap_waitok, .map_complete = bounce_bus_dmamap_complete, .map_unload = bounce_bus_dmamap_unload, - .map_sync = bounce_bus_dmamap_sync + .map_sync = bounce_bus_dmamap_sync, +#ifdef KMSAN + .load_kmsan = bounce_bus_dmamap_load_kmsan, +#endif }; diff --git a/sys/arm64/include/bus_dma.h b/sys/arm64/include/bus_dma.h index 9e5a7124dcf5..fb494be0bdc4 100644 --- a/sys/arm64/include/bus_dma.h +++ b/sys/arm64/include/bus_dma.h @@ -149,4 +149,16 @@ _bus_dmamap_complete(bus_dma_tag_t dmat, bus_dmamap_t map, return (tc->impl->map_complete(dmat, map, segs, nsegs, error)); } +#ifdef KMSAN +static inline void +_bus_dmamap_load_kmsan(bus_dma_tag_t dmat, bus_dmamap_t map, + struct memdesc *mem) +{ + struct bus_dma_tag_common *tc; + + tc = (struct bus_dma_tag_common *)dmat; + return (tc->impl->load_kmsan(map, mem)); +} +#endif + #endif /* !_MACHINE_BUS_DMA_H_ */ diff --git a/sys/arm64/include/bus_dma_impl.h b/sys/arm64/include/bus_dma_impl.h index 9e5741758ef5..1fb5e10c92b0 100644 --- a/sys/arm64/include/bus_dma_impl.h +++ b/sys/arm64/include/bus_dma_impl.h @@ -75,6 +75,9 @@ struct bus_dma_impl { void (*map_unload)(bus_dma_tag_t dmat, bus_dmamap_t map); void (*map_sync)(bus_dma_tag_t dmat, bus_dmamap_t map, bus_dmasync_op_t op); +#ifdef KMSAN + void (*load_kmsan)(bus_dmamap_t map, struct memdesc *mem); +#endif }; int common_bus_dma_tag_create(struct bus_dma_tag_common *parent,