git: 603bbd771f0c - stable/13 - busdma: Fix powerpc DMA alignment check

From: Alfredo Dal'Ava Junior <alfredo_at_FreeBSD.org>
Date: Mon, 03 Oct 2022 22:47:15 UTC
The branch stable/13 has been updated by alfredo:

URL: https://cgit.FreeBSD.org/src/commit/?id=603bbd771f0cbebaf8d94ab474643112448763eb

commit 603bbd771f0cbebaf8d94ab474643112448763eb
Author:     Justin Hibbits <jhibbits@FreeBSD.org>
AuthorDate: 2022-01-04 15:22:04 +0000
Commit:     Alfredo Dal'Ava Junior <alfredo@FreeBSD.org>
CommitDate: 2022-10-04 01:46:24 +0000

    busdma: Fix powerpc DMA alignment check
    
    The original logic was to check if there's no filter and the address is
    misaligned relative to the requirements.  The refactoring in
    c606ab59e7f9423f7027320e9a4514c7db39658d missed this, and instead caused
    it to return failure if the address *is* properly aligned.
    
    (cherry picked from commit 3a9688f8bc488b16bf5676057fa86263554312b0)
---
 sys/powerpc/powerpc/busdma_machdep.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/powerpc/powerpc/busdma_machdep.c b/sys/powerpc/powerpc/busdma_machdep.c
index f75d3e1efcf9..95eb98a5cbab 100644
--- a/sys/powerpc/powerpc/busdma_machdep.c
+++ b/sys/powerpc/powerpc/busdma_machdep.c
@@ -172,7 +172,7 @@ run_filter(bus_dma_tag_t dmat, bus_addr_t paddr)
 		    paddr > dmat->lowaddr && paddr <= dmat->highaddr)
 			retval = 1;
 		if (dmat->filter == NULL &&
-		    vm_addr_align_ok(paddr, dmat->alignment))
+		    !vm_addr_align_ok(paddr, dmat->alignment))
 			retval = 1;
 		if (dmat->filter != NULL &&
 		    (*dmat->filter)(dmat->filterarg, paddr) != 0)