Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: muhammad.nazim.amirul.nazle.asmade@altera.com
Cc: krzk+dt@kernel.org, conor+dt@kernel.org, robh@kernel.org,
	devicetree@vger.kernel.org
Subject: Re: [PATCH v2 2/2] arm64: dts: socfpga: Add dma-coherent to XGMAC nodes
Date: Fri, 15 May 2026 08:23:46 +0000	[thread overview]
Message-ID: <20260515082347.5AE17C2BCB0@smtp.kernel.org> (raw)
In-Reply-To: <20260515080014.6260-3-muhammad.nazim.amirul.nazle.asmade@altera.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Missing dma-coherent property on other SMMU clients causes data corruption
--

commit be9ce7db4922ed7d48488efa182130301cfa9435
Author: Nazim Amirul <muhammad.nazim.amirul.nazle.asmade@altera.com>

arm64: dts: socfpga: Add dma-coherent to XGMAC nodes

The commit asserts that SMMU transactions are cache coherent and adds
dma-coherent to the XGMAC nodes. This prevents redundant cache flush and
invalidate operations and potential stale data issues.

> The SMMU is enabled and transactions going through it are cache
> coherent. Add the dma-coherent property to the XGMAC nodes to prevent
> redundant cache flush/invalidate operations and potential stale data
> issues.

This problem wasn't introduced by this patch, but the patch provides an
incomplete fix.

The commit message asserts that "transactions going through it are cache
coherent" and correctly notes that missing the dma-coherent property causes
"potential stale data issues".

On ARM64, if a hardware-coherent device is treated as non-coherent, the kernel
will execute cache invalidation (dcache_inval_poc -> dc ivac via
arch_sync_dma_for_cpu) for DMA_FROM_DEVICE transfers.

If the device wrote data directly into the CPU caches, the dc ivac instruction
will discard those dirty cache lines without writing them back to RAM. This
destroys the DMA writes and causes the CPU to read stale data from memory,
resulting in reproducible data corruption.

If the SMMU provides coherency for all transactions, do other major DMA
masters that also route through the SMMU need the dma-coherent property?

For example, usb0, dmac0, and dmac1 use the SMMU but lack the property:

arch/arm64/boot/dts/intel/socfpga_agilex5.dtsi:
    usb0: usb@10b00000 {
        ...
        iommus = <&smmu 6>;
        ...
    };

    dmac0: dma-controller@0 {
        ...
        iommus = <&smmu 8>;
        ...
    };

    dmac1: dma-controller@10000 {
        ...
        iommus = <&smmu 9>;
        ...
    };

If coherency is specific only to XGMAC, could the commit message be clarified
to avoid a blanket statement about the SMMU?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260515080014.6260-1-muhammad.nazim.amirul.nazle.asmade@altera.com?part=2

  reply	other threads:[~2026-05-15  8:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-15  8:00 [PATCH v2 0/2] arm64: dts: socfpga: Enable SMMU and add DMA coherency for XGMAC muhammad.nazim.amirul.nazle.asmade
2026-05-15  8:00 ` [PATCH v2 1/2] arm64: dts: socfpga: Enable the SMMU for SoCFPGA device trees muhammad.nazim.amirul.nazle.asmade
2026-05-15  8:16   ` sashiko-bot
2026-05-15 11:51   ` Dinh Nguyen
2026-05-15  8:00 ` [PATCH v2 2/2] arm64: dts: socfpga: Add dma-coherent to XGMAC nodes muhammad.nazim.amirul.nazle.asmade
2026-05-15  8:23   ` sashiko-bot [this message]
2026-05-15 11:52   ` Dinh Nguyen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260515082347.5AE17C2BCB0@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=muhammad.nazim.amirul.nazle.asmade@altera.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox