Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Jude Gyimah <jude.gyimah87@gmail.com>
Cc: perex@perex.cz, tiwai@suse.com, lgirdwood@gmail.com,
	peter.ujfalusi@linux.intel.com, yung-chuan.liao@linux.intel.com,
	daniel.baluta@nxp.com, broonie@kernel.org,
	kai.vehmanen@linux.intel.com, pierre-louis.bossart@linux.dev,
	Vijendar.Mukunda@amd.com, jaska.uimonen@linux.intel.com,
	arnd@arndb.de, sound-open-firmware@alsa-project.org,
	linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ALSA: hda: give the NHLT parser a module of its own
Date: Thu, 03 Dec 2026 12:39:35 +0100	[thread overview]
Message-ID: <87bj72vbig.wl-tiwai@suse.de> (raw)
In-Reply-To: <20261202140733.116024-1-jude.gyimah87@gmail.com>

On Wed, 02 Dec 2026 15:07:33 +0100,
Jude Gyimah wrote:
> 
> snd-sof calls the NHLT parser from generic code, and with a non-Intel SOF
> platform built in and the Intel option modular the link fails:
> 
>   ipc4-topology.c:(.text+0x22bc): undefined reference to
>     `intel_nhlt_get_endpoint_blob'
>   ipc4-topology.c:(.text+0x2424): undefined reference to
>     `intel_nhlt_ssp_device_type'
> 
> SND_SOC_SOF_IMX_COMMON=y selects SND_SOC_SOF, while
> SND_SOC_SOF_INTEL_COMMON=m leaves SND_INTEL_DSP_CONFIG=m.
> 
> There is no symbol to depend on to prevent that.  intel-nhlt.o is built
> into snd-intel-dspcfg, and SND_INTEL_NHLT is a bool that only decides
> whether the object joins that module, so the parser's level is really
> decided by SND_INTEL_DSP_CONFIG, which is about Intel DSP driver
> detection and gets selected by SND_HDA_INTEL for unrelated reasons.
> 
> Moving the calls into Intel code, as commit 194fe0fc3422 ("ASoC: SOF:
> pci: move DSP_CONFIG use to platform-specific drivers") did for
> snd_intel_dsp_driver_probe, would not be enough: ipc4-topology.c fills
> ipc4_data->nhlt from the topology manifest when the BIOS has none, so
> generic SOF can hold a table with no Intel code involved and has to be
> able to parse it.
> 
> Make the parser selectable instead.  SND_INTEL_NHLT becomes a tristate
> with its own module, and whoever parses an NHLT table selects it; a
> select from a built-in symbol forces the target built in, so the
> mismatch stops being expressible.  SND_INTEL_SOUNDWIRE_ACPI beside it is
> already arranged this way.
> 
> Kconfig and Makefile change together because neither is right alone:
> either order leaves SND_INTEL_NHLT=y with SND_INTEL_DSP_CONFIG=n, where
> the object is not built but the header still declares the functions.
> 
> IS_REACHABLE() would be worse than the link error.  With the guard false
> the #else stub of snd_sof_get_nhlt_endpoint_data() returns 0 without
> setting *dst or *len, and the caller reads 0 as success, so SSP and DMIC
> copiers would be prepared with no NHLT payload at all.  Selecting the
> parser keeps the real implementation: ipc4-topology.o still references
> intel_nhlt_get_endpoint_blob in the configuration above.
> 
> Tested on arm64 at v7.3.  That configuration links with no undefined
> references and no Kconfig warning, SND_INTEL_NHLT following SND_SOC_SOF
> to y while SND_INTEL_DSP_CONFIG stays m.  allnoconfig, defconfig,
> allmodconfig and allyesconfig are warning-free and snd-intel-nhlt builds
> as a module.
> 
> Found with kreach, a static check that compares what Kconfig allows
> against the symbols the compiled objects actually reference.
> 
> Fixes: aa84ffb72158 ("ASoC: SOF: ipc4-topology: Add support for SSP/DMIC DAI's")
> Link: https://lore.kernel.org/r/20261107114944.561731-1-jude.gyimah87@gmail.com
> Signed-off-by: Jude Gyimah <jude.gyimah87@gmail.com>

Applied to for-next branch.  Thanks.


Takashi

      reply	other threads:[~2026-12-03 11:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 14:07 [PATCH] ALSA: hda: give the NHLT parser a module of its own Jude Gyimah
2026-12-03 11:39 ` Takashi Iwai [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bj72vbig.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=Vijendar.Mukunda@amd.com \
    --cc=arnd@arndb.de \
    --cc=broonie@kernel.org \
    --cc=daniel.baluta@nxp.com \
    --cc=jaska.uimonen@linux.intel.com \
    --cc=jude.gyimah87@gmail.com \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=peter.ujfalusi@linux.intel.com \
    --cc=pierre-louis.bossart@linux.dev \
    --cc=sound-open-firmware@alsa-project.org \
    --cc=tiwai@suse.com \
    --cc=yung-chuan.liao@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox