Index | Thread | Search

From:
Avon Robertson <avon.r@xtra.co.nz>
Subject:
Re: smmu(4): don't always set DMA coherent tag
To:
tech@openbsd.org
Cc:
Patrick Wildt <patrick@blueri.se>
Date:
Thu, 25 Sep 2025 16:13:06 +1200

Download raw body.

Thread
On Wed, Aug 27, 2025 at 02:03:39PM +0200, Patrick Wildt wrote:
> Hi,
> 
> SMMUs don't necessarily influence device DMA coherency attributes.
> I assume we have been lucky so far that our machines that have an
> SMMUv2 usually have devices with DMA coherency.  On the RK3588
> this is not the case, and us always adding the COHERENT flag makes
> devices fail to work when used with smmu(4) enabled.
> 
> Please give this a run on machines where "dmesg | grep ^smmu" shows
> some output.
> 
> Cheers,
> Patrick
> 
> diff --git a/sys/arch/arm64/dev/smmu.c b/sys/arch/arm64/dev/smmu.c
> index f57796fdb97..fafbe3189b5 100644
> --- a/sys/arch/arm64/dev/smmu.c
> +++ b/sys/arch/arm64/dev/smmu.c
> @@ -575,7 +575,6 @@ smmu_device_map(void *cookie, uint32_t sid, bus_dma_tag_t dmat)
>  		dom->sd_dmat->_dmamap_load_uio = smmu_dmamap_load_uio;
>  		dom->sd_dmat->_dmamap_load_raw = smmu_dmamap_load_raw;
>  		dom->sd_dmat->_dmamap_unload = smmu_dmamap_unload;
> -		dom->sd_dmat->_flags |= BUS_DMA_COHERENT;
>  	}
>  
>  	return dom->sd_dmat;
> 

Hello Patrick,

I am so sorry to be so late doing this. I hope it is still useful info
for you. The info below was created on an ASUS Vivobook S 15 laptop.

Using the diffs in your emails dated:
  Wed, 27 Aug 2025 14:02:15 and
  Wed, 27 Aug 2025 14:03:39
  
I patched the then current- kernel code with the first of the diffs
above and built a new kernel. After a cold boot copies of the new /bsd and
it's dmesg were saved. Then this was repeated with the second diff
without reverting the first diff.

$ dmesg | grep ^smmu

for all kernels output

smmu0 at simplebus0: disabled
smmu1 at simplebus0: disabled

Let me know if you want the 3 dmesg's, or if you want me to do
something more specific for you.

-- 
aer