From nobody Tue May 03 14:04:39 2022 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 6437F1AB9D5A; Tue, 3 May 2022 14:04:39 +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 4Kt1tH2DN3z3Qyd; Tue, 3 May 2022 14:04:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651586679; 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=I/tDUCeRdjOePsmxIFY+3eRv0YLRvBDGGg406QkvalE=; b=d6P6eFfdSN/lsaTGvjEm840d379+GvI+5Qp2EmbuVhqtGeTC8rwzTS4hMCsjY6k1yBo16z PcJFdoBIWRl1ttkTIg5i5IziXJWVZRnOBbFMnfC7oFKunI8DKR8XNgKyF+mGVXx4RPtVWw qnFLxjBcGD4MbU63MSlx52FVCSTOyHQo1zcuOvzQZ+jeJp6bsQ4421QDz+zasol91m2+5U UXguruHgum8nAZwhyI7AeoAu2VKZeG2gPLNS7vdAKkjupogma5Xun1TFYVRH9WgX2EaNRV +yUyxWdlNR7Iqry+3+HYw2C8d8XFjB7dZPp9drR4mXJXPQgaqur6FNh0S7GZCw== 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 2E1731F8E9; Tue, 3 May 2022 14:04:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 243E4dcn077802; Tue, 3 May 2022 14:04:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 243E4d25077801; Tue, 3 May 2022 14:04:39 GMT (envelope-from git) Date: Tue, 3 May 2022 14:04:39 GMT Message-Id: <202205031404.243E4d25077801@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: 6f86f758d251 - stable/13 - Fix a coherent bus check in the arm64 busdma 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: andrew X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6f86f758d251a34281c12f0195cfe662d684b4d2 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651586679; 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=I/tDUCeRdjOePsmxIFY+3eRv0YLRvBDGGg406QkvalE=; b=i5TAmEc21YOX5RK9sRzxuqLdiqB2ZfZ86wgmjP6A3wpSREjQj4N8C1O+tGbS0RtqMH9lFm nywQYqc6rLmpqZr1PuMR4H4AhEEiCIfVStga+NEJ20+godoPJe4Ei0/y+G4ON4yXxux7EP 1emJb/aFmCq73U5CTK/iq9e21peQMdYMmpqzrX+lp0y/rN5kiVxwgbA/UO/Onq2qV/2pDb JPFjT1VZEuitKxRBWVn6g/fGtNlOQSbopOiILhtIs5IKh1/WGJ9DJ2zFLsS8bI/hrxHqhS 9d+Y7ETMQpDS/FBk4feReVHuEomBTazWapVNbqUCakJAMy8cAlS2nS3xYoBSnw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1651586679; a=rsa-sha256; cv=none; b=ssGDvPjO+GLKSehQ2AM6oIbEv4f6SxiZBWPae4IGQEIpsXtu57waBM3lFIZhJuWX8lS6y1 C0rdMiUpH2Hhzk4xB6BY2yeq/JL2PhXKS3kv4B8cnZYpnvqrRITgLNkwBGvpHdo+e6BKlC kr9L9KTeNJ7Sw3KuSZXa1z1Wi61Q49gIJttYG2FJujrWkiRlkZk1lQUb6+3tOHWNsbM6sW 6EMPTIdvaO1VL6vKeTERAErcp1qgeXMzFCeyZCg2d83khEC1xDcw6NftgbazRq/frOP9M4 UUj8ycwHj4nBFpG1lZs0YJLCmfWd3u1Wkm+XrajXdgPajeEHZdW8NpgZuZAnwA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=6f86f758d251a34281c12f0195cfe662d684b4d2 commit 6f86f758d251a34281c12f0195cfe662d684b4d2 Author: Andrew Turner AuthorDate: 2022-04-04 09:28:59 +0000 Commit: Andrew Turner CommitDate: 2022-05-03 14:04:04 +0000 Fix a coherent bus check in the arm64 busdma In the arm64 busdma we have an internal flag to signal when a tag is for a cache-coherent device. In this case we don't need to adjust the size and alignment of allocated buffers to be within a cache line. The cache line adjustment was incorrectly using the coherent flag passed in to bus_dma_tag_create and not the internal flag. Fix it to use the latter to reduce the memory usage slightly. Reviewed by: bz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D34763 (cherry picked from commit 3532bcd282b3ba508f0b39560626983463512813) --- sys/arm64/arm64/busdma_bounce.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/sys/arm64/arm64/busdma_bounce.c b/sys/arm64/arm64/busdma_bounce.c index 2173273bf496..9e36dda3a90a 100644 --- a/sys/arm64/arm64/busdma_bounce.c +++ b/sys/arm64/arm64/busdma_bounce.c @@ -266,6 +266,18 @@ bounce_bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, if ((flags & BUS_DMA_COHERENT) != 0) { newtag->bounce_flags |= BF_COHERENT; + } + + if (parent != NULL) { + if ((newtag->common.filter != NULL || + (parent->bounce_flags & BF_COULD_BOUNCE) != 0)) + newtag->bounce_flags |= BF_COULD_BOUNCE; + + /* Copy some flags from the parent */ + newtag->bounce_flags |= parent->bounce_flags & BF_COHERENT; + } + + if ((newtag->bounce_flags & BF_COHERENT) != 0) { newtag->alloc_alignment = newtag->common.alignment; newtag->alloc_size = newtag->common.maxsize; } else { @@ -281,15 +293,6 @@ bounce_bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, dcache_line_size); } - if (parent != NULL) { - if ((newtag->common.filter != NULL || - (parent->bounce_flags & BF_COULD_BOUNCE) != 0)) - newtag->bounce_flags |= BF_COULD_BOUNCE; - - /* Copy some flags from the parent */ - newtag->bounce_flags |= parent->bounce_flags & BF_COHERENT; - } - if (newtag->common.lowaddr < ptoa((vm_paddr_t)Maxmem) || newtag->common.alignment > 1) newtag->bounce_flags |= BF_COULD_BOUNCE;