Re: [RFC PATCH v2 2/3] ASoC: tegra: Initialise PCM hardware limits at boot for page size
From: Mark Brown
Date: Wed Dec 02 2026 - 12:40:30 EST
> tegra_pcm_hardware and tegra_dmaengine_pcm_config use PAGE_SIZE in their
> initialisers, which is not a constant expression with arm64 boot-time
> page size selection.
>
> Define both with DEFINE_GLOBAL_PAGE_SIZE_VAR_CONST(), which keeps a
> normal const initialiser for a fixed page size and otherwise fills them
> in once the page size is known at boot.
It would be easier to submit stuff like this once that macro is
available...
> -static const struct snd_pcm_hardware tegra_pcm_hardware = {
> +static DEFINE_GLOBAL_PAGE_SIZE_VAR_CONST(struct snd_pcm_hardware,
> + tegra_pcm_hardware, {
> .info = SNDRV_PCM_INFO_MMAP |
> SNDRV_PCM_INFO_MMAP_VALID |
> SNDRV_PCM_INFO_INTERLEAVED,
> @@ -34,13 +35,14 @@ static const struct snd_pcm_hardware tegra_pcm_hardware = {
> .periods_max = 8,
> .buffer_bytes_max = PAGE_SIZE * 8,
> .fifo_size = 4,
> -};
> +});
> -static const struct snd_dmaengine_pcm_config tegra_dmaengine_pcm_config = {
> +static DEFINE_GLOBAL_PAGE_SIZE_VAR_CONST(struct snd_dmaengine_pcm_config,
> + tegra_dmaengine_pcm_config, {
> .pcm_hardware = &tegra_pcm_hardware,
> .prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config,
> .prealloc_buffer_size = PAGE_SIZE * 8,
> -};
> +});
Especially for the preallocted buffer why doees it make sense to scale
this with page size, is a system with 64k pages really more likely to
play 8 times more audio? It'd be good to check if the hardware is
influenced by the MMU configuration here.
--
Mark Brown <broonie@xxxxxxxxxx>