Page MenuHomeFreeBSD

LinuxKPI: Add dma_length field to struct scatterlist
ClosedPublic

Authored by wulf on Sun, Sep 13, 9:01 AM.
Tags
None
Referenced Files
F174741224: D59630.diff
Mon, Oct 5, 3:57 PM
F174698414: D59630.id186613.diff
Mon, Oct 5, 7:33 AM
Unknown Object (File)
Sun, Oct 4, 4:05 AM
Unknown Object (File)
Sat, Oct 3, 10:43 AM
Unknown Object (File)
Sat, Oct 3, 10:43 AM
Unknown Object (File)
Fri, Oct 2, 2:34 AM
Unknown Object (File)
Fri, Oct 2, 1:20 AM
Unknown Object (File)
Thu, Oct 1, 10:28 PM

Details

Summary

On Linux dma_length field of struct scatterlist is present on the
arches where DMA mapping code is able to coalesce adjacent segments
of physical address space. It contains total length of coalesced
segments while length field contains non-coalesced length of each
segment. On other arches dma_length is aliased to length field with
sg_dma_len macro. As FreeBSD does not merge scatterlist segments it
do not have dma_length field. It is appered that at least i915kms
driver depends on existence of dma_length field.

Add the field and disable it by default. To enable add to Makefile

.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" || \\

${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "powerpc"

CFLAGS+= -DCONFIG_NEED_SG_DMA_LENGTH
.endif

Reported by: Ryan Fahy
GHI: https://github.com/freebsd/drm-kmod/issues/315

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

wulf requested review of this revision.Sun, Sep 13, 9:01 AM

Otherwise I think I am fine with this.

sys/compat/linuxkpi/common/include/linux/scatterlist.h
524

Am I reading it right that this is the single change of the function compared to the previous? Can we keep one copy of the rest of the logic factoring it out with a bool argument to pick one or the other length?

bool argument for dma added

Thanks for the update!

This revision is now accepted and ready to land.Sun, Sep 13, 4:34 PM