From nobody Wed Apr 06 13:24:01 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 8C2171A8365E; Wed, 6 Apr 2022 13:24:02 +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 4KYQFt05qsz58NL; Wed, 6 Apr 2022 13:24:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649251442; 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=OfPTmiN3y7gu6BigxlFr2Tuv9c5pvF9rViNbhwdWgL8=; b=dqYnPNOS+XMJupag6xsBpxOgUB4zFYao4I+uBDSc1ILg6jRYgvt3QOZxFXdaoim15A6IRu 5YbwIrXXAElzmd5rQq/1DYjFpbqpDyduroGqlAw0wliDWycVp04no6hYB34PcHUbjAS8N0 SPLyuepSrfgRf19obqho83wCfGj9NL7PNWS6/4h+pEKo6y4u95gDXiJapVrjLjP5ERHHrj aQDh5yp7lr63nH5ByPn1GcDPUschGa19HYRjADr1PuBn16Nz3iD5hwu9C8AQh7ocE3uRva TiSiKIxpALYBLItZR7CbFvyWa7utk8JCRWW8DCzcvU/17X51pHGPPj7SapE6sA== 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 D566F1BC2E; Wed, 6 Apr 2022 13:24:01 +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 236DO1kC071429; Wed, 6 Apr 2022 13:24:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 236DO1di071428; Wed, 6 Apr 2022 13:24:01 GMT (envelope-from git) Date: Wed, 6 Apr 2022 13:24:01 GMT Message-Id: <202204061324.236DO1di071428@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 3532bcd282b3 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 3532bcd282b3ba508f0b39560626983463512813 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649251442; 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=OfPTmiN3y7gu6BigxlFr2Tuv9c5pvF9rViNbhwdWgL8=; b=S4T77tMOItWH2hahKdP5MW4Jc1Z+G9OO2ZIga1O8OKPJRbpb4M8+Hy7o0f5OfftFJByjMp beTe0vKjzMT1e0IyAoAKE6TGBniVOKJ56WznnCTpXF1t9IfQEEZDxYkYveCBIA+HRdto1j zVMkIAa0dSdRW5C5TkWnPr2SMj1NeE76iTJhaZCB1EWulhem1s8ZKbVfHyYdcL4a7t032b HZvdi0+XoEZZTDyoNz/SmoTf4lpwJYCkor+XnGWhC5t2qLrMSojOzD8RfLlFRXWbgiOZFw 5BddbsUtlwGqApqurVOAGt/Uknj+8xx3bw0gj6aV8aGiXy98mE7gTfPV8bd/Xw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1649251442; a=rsa-sha256; cv=none; b=W5252eDHQA4RkWj7u0IPRKjV08DtWq+PA5mfJnuk4CNNfovEqnFG/c/+hUfuAWelv2Xd/X lebgC2nglrUD6gfAD49JgDky6zchZU4yBy3ho0pr3UbUnhAe/T7Y8s0GQoisuN1MIuhJp3 cI+ELdYhtewnmTMhj2+WNHvToDhvA34cwt31ycPIRh0TvVLK7Cun+k6rKpS8b9I7CwT5Xl l0j+JMdFY8WSBvITVSOKUabG5VgVA17gQBmhHR/kZnFeAXFVxssaMdfuowOt3TaaIswezP Vp6H+aTj1iPs0dmxzHNGfoUnIh1K12Sqid7D8a2HoGv8TRLFqVcq1FdHLgmikA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=3532bcd282b3ba508f0b39560626983463512813 commit 3532bcd282b3ba508f0b39560626983463512813 Author: Andrew Turner AuthorDate: 2022-04-04 09:28:59 +0000 Commit: Andrew Turner CommitDate: 2022-04-06 13:11:12 +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 --- 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 0f17fdb9bffc..afaa1ef8510d 100644 --- a/sys/arm64/arm64/busdma_bounce.c +++ b/sys/arm64/arm64/busdma_bounce.c @@ -228,6 +228,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 { @@ -243,15 +255,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;