]> Gentwo Git Trees - linux/.git/commit
ALSA: compress_offload: Add 64-bit safe timestamp infrastructure
authorJoris Verhaegen <verhaegen@google.com>
Fri, 5 Sep 2025 09:12:54 +0000 (10:12 +0100)
committerTakashi Iwai <tiwai@suse.de>
Mon, 8 Sep 2025 07:33:24 +0000 (09:33 +0200)
commit2c92e2fbe9e22cefdae87d8a0d654691ee4c1957
tree0032145739c373c5599212dfadb29eca5b69671e
parentcbd676874e64a2122edd03ba6a2406b24779df05
ALSA: compress_offload: Add 64-bit safe timestamp infrastructure

The copied_total field in struct snd_compr_tstamp is a 32-bit
value that can overflow on long-running high-bitrate streams,
leading to incorrect calculations for buffer availablility.

This patch adds a 64-bit safe timestamping mechanism.
A new UAPI struct, snd_compr_tstamp64, is added which uses 64-bit
types for byte counters. The relevant ops structures across the
ASoC and core compress code are updated to use this new struct.
ASoC drivers are updated to use u64 counters.

Internal timestamps being u64 now, a compatibility function is added
to convert the 64-bit timestamp back to the 32-bit format for legacy
ioctl callers.

Reviewed-by: Miller Liang <millerliang@google.com>
Tested-by: Joris Verhaegen <verhaegen@google.com>
Signed-off-by: Joris Verhaegen <verhaegen@google.com>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Acked-by: Mark Brown <broonie@kernel.org>
Acked-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20250905091301.2711705-2-verhaegen@google.com
24 files changed:
include/sound/compress_driver.h
include/sound/soc-component.h
include/sound/soc-dai.h
include/uapi/sound/compress_offload.h
sound/core/compress_offload.c
sound/soc/codecs/wm_adsp.c
sound/soc/codecs/wm_adsp.h
sound/soc/intel/atom/sst-mfld-platform-compress.c
sound/soc/intel/atom/sst-mfld-platform.h
sound/soc/intel/atom/sst/sst_drv_interface.c
sound/soc/intel/avs/probes.c
sound/soc/qcom/qdsp6/q6apm-dai.c
sound/soc/qcom/qdsp6/q6asm-dai.c
sound/soc/soc-component.c
sound/soc/soc-compress.c
sound/soc/soc-dai.c
sound/soc/sof/amd/acp-probes.c
sound/soc/sof/compress.c
sound/soc/sof/intel/hda-probes.c
sound/soc/sof/sof-client-probes.c
sound/soc/sof/sof-client-probes.h
sound/soc/sprd/sprd-pcm-compress.c
sound/soc/sprd/sprd-pcm-dma.h
sound/soc/uniphier/aio-compress.c