Skip to content

ASoC: SOF: Intel: hda: follow strict BDLE address alignment for ACE4#5684

Open
kv2019i wants to merge 2 commits intothesofproject:topic/sof-devfrom
kv2019i:202603-ace4-strict-bdle-alignment
Open

ASoC: SOF: Intel: hda: follow strict BDLE address alignment for ACE4#5684
kv2019i wants to merge 2 commits intothesofproject:topic/sof-devfrom
kv2019i:202603-ace4-strict-bdle-alignment

Conversation

@kv2019i
Copy link
Collaborator

@kv2019i kv2019i commented Mar 5, 2026

Intel ACE4 based products require host to strictly follow HDA spec guidance on BDLE address alignment. Each BDLE address must be aligned to 128 bytes, and given ALSA periods are directly mapped to BDLEs, period size must be 128 aligned as well.

Reported-by: Peter Ujfalusi peter.ujfalusi@linux.intel.com

@kv2019i kv2019i requested a review from ujfalusi March 5, 2026 17:58
snd_pcm_hw_constraint_step(substream->runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 4);
if (chip_info->hw_ip_version >= SOF_INTEL_ACE_4_0)
snd_pcm_hw_constraint_step(substream->runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
SOF_HDA_BDLE_ADDRESS_ALIGNMENT);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you also need to fix legacy HDA in sound/hda/controllers/intel.c and add AZX_DCAPS_NO_ALIGN_BUFSIZE to both NVL and NVL_S, probably by:

#define AZX_DCAPS_INTEL_NVL (AZX_DCAPS_INTEL_LNL | AZX_DCAPS_NO_ALIGN_BUFSIZE)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack, added a separate commit for this. Note the logic needs to be to clear the bit as default behaviour is to align.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we use '4' on the else branch, we might be better to use 128 here as well? With a small comment.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, ok, that is cleaner. The "small comment" took a bit of thinking, but an attempt is in V3 version of the patch,

snd_pcm_hw_constraint_step(substream->runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
SOF_HDA_BDLE_ADDRESS_ALIGNMENT);
else
/* minimum as per HDA spec */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would remove this sentence and/or replace it with something which is correct (also for the legacy comment block, that is wrong in the same way)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack, I ended up removing the comment and explaining why in the commit message.

@kv2019i kv2019i force-pushed the 202603-ace4-strict-bdle-alignment branch from a7bdf49 to 32aa914 Compare March 9, 2026 12:10
Copy link
Collaborator Author

@kv2019i kv2019i left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

V2 uploaded:

  • addressed feedback for @ujfalusi
  • added a separate commit for snd_hda_intel driver
  • marking as ready for review now

snd_pcm_hw_constraint_step(substream->runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 4);
if (chip_info->hw_ip_version >= SOF_INTEL_ACE_4_0)
snd_pcm_hw_constraint_step(substream->runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
SOF_HDA_BDLE_ADDRESS_ALIGNMENT);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack, added a separate commit for this. Note the logic needs to be to clear the bit as default behaviour is to align.

snd_pcm_hw_constraint_step(substream->runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
SOF_HDA_BDLE_ADDRESS_ALIGNMENT);
else
/* minimum as per HDA spec */
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack, I ended up removing the comment and explaining why in the commit message.

@kv2019i kv2019i marked this pull request as ready for review March 9, 2026 12:13
{ PCI_DEVICE_DATA(INTEL, HDA_NVL, AZX_DRIVER_SKL | AZX_DCAPS_INTEL_LNL) },
{ PCI_DEVICE_DATA(INTEL, HDA_NVL_S, AZX_DRIVER_SKL | AZX_DCAPS_INTEL_LNL) },
{ PCI_DEVICE_DATA(INTEL, HDA_NVL, AZX_DRIVER_SKL | AZX_DCAPS_INTEL_NVL) },
{ PCI_DEVICE_DATA(INTEL, HDA_NVL_S, AZX_DRIVER_SKL | AZX_DCAPS_INTEL_NVL) },
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will not apply at 9c3af1b (v6.19) because NVL is added later: 7f42828 (v7.0-rc1)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack fixed in V3

snd_pcm_hw_constraint_step(substream->runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 4);
if (chip_info->hw_ip_version >= SOF_INTEL_ACE_4_0)
snd_pcm_hw_constraint_step(substream->runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
SOF_HDA_BDLE_ADDRESS_ALIGNMENT);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we use '4' on the else branch, we might be better to use 128 here as well? With a small comment.

kv2019i added 2 commits March 9, 2026 18:36
Intel ACE4 based products require host to strictly follow HDA spec
guidance on BDLE address alignment. Each BDLE buffer address must be
aligned to 128 bytes, and given ALSA periods are directly mapped to
BDLEs, period size must be 128 aligned as well.

The commit removes the "minimum as per HDA spec" comment. This comment
was misleading as spec actually does allow a 2 byte BDLE length, and
more importantly, period size also directly impacts how the BDLE start
addresses are aligned, so it is not sufficient just to consider allowed
buffer length.

Reported-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Intel ACE4 based products require host to strictly follow HDA spec
guidance on BDLE address alignment. Each BDLE buffer address must be
aligned to 128 bytes, and given ALSA periods are directly mapped to
BDLEs, period size must be 128 aligned as well. Modify capability flags
to drop AZX_DCAPS_NO_ALIGN_BUFSIZE for Intel Nova Lake platforms.

Fixes: 7f42828 ("ALSA: hda: controllers: intel: add support for Nova Lake")
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
@kv2019i kv2019i force-pushed the 202603-ace4-strict-bdle-alignment branch from 32aa914 to 4f36889 Compare March 9, 2026 16:38
@kv2019i
Copy link
Collaborator Author

kv2019i commented Mar 9, 2026

V3 uploaded:

  • fix the "fixes" tag
  • remove the define in hda.h and just use 128 and 4 (with an inline comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants