From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.47 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796220474; b=1g4NjUUkMqrJD1CPuWbcvTmSVQ9oOpcALUlIpPa1XJmLadFoe2Pk+r4HO3WRDYqP/IIS Ub9DF8zOlfS11lNODtxjuTPVv7pm6VwzOuQQv+QaWi8Z211Skyo/Y+U7RJaPyodnmosYv MmMEn+f1ODIlUtt6gYT5VmGU1fQXfSoIlG8IQXmBXYHGkojEtLCSrjZqPqNrcOGeKSDjm D8X8bgOez4JUAbGarcTRvAD0l7xZ3erSjpxn4Rog+nmAhzZrFPgi8p85K1us7nyhWIEOM pkPdB5tr1UPZNY33XitgvP60UBnfLF6G1WhjTMvRNUaAeJj16JAV+ddbHkuxEwHYyHA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796220474; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:MIME-Version: Content-Transfer-Encoding; bh=UbwbC7AS3pxJjSvRmK8aOd7RbvbeEjGsA0kI20oDpp0=; b=MqQQ5NMyHSBb0KWJJVCBjURddlwan8s5XExFGjhnqEoDovYba1uxOSIdSw7hLmiU0fbt ymo+xcotdXSPBaV2f9ZbaOBDoxejLIbrs6shkRXa7XZXgHmYhZnqwlSnCkThQ62xED28X 6vcOvAWhVW2EtQ+PcKfluIx7M5D9RTt/X68J5+7zObI2MwfjNe9yaECbQgb/gF8Hx6cew saiD095f5Z+X3jTLaaO1wBxfxwYfzAE/5ctyMAcPL4MOxceT2x7iG3ZLJBfrLUdKmGuC6 W5BovFCTtZ6U1TAllBq+SlIoL+0J4Z4B/rjPoRMYp3Sxx5pzQIMoIe0pfjhCBoI6Y/Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=WGTz3+FO; arc=none smtp.remote-ip=209.85.128.47 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 39AE4606A31A for ; Wed, 2 Dec 2026 14:07:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 39AE4606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=WGTz3+FO Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-4bb72b44a97so113818955e9.0 for ; Wed, 02 Dec 2026 06:07:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796220472; x=1796825272; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=UbwbC7AS3pxJjSvRmK8aOd7RbvbeEjGsA0kI20oDpp0=; b=WGTz3+FO2c0UodPn9hmn2FFnj49kd3/D2jsMNAfIQAaUuiYYC3pNqzSn0HJZ5y4thq QV3Mtu1rJ/TMjwyd9uqXHZUeIxTkKbuzQmZWDfviRfFkNM9olumt/PqRH5Aw/C7/TNlI JqCG3mkHknCb4YRX+n2bnf8mqhCgfZom7298HOUPcI10YXjdJiJKgDChDBADTqgfkjyl LVWFnfDnzNatHWSvAMDX7th3WfidH71NiZAYJ5eaWatFOg50UKiI+XFV8rhrZO8r9i+y 9DXZYqkl6gfRC4iM4D2y5ZCoUSHldo9hDRVNSOkGFSCpzAmszlxPBz1FyaThHbHZA9kU 3YpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796220472; x=1796825272; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=UbwbC7AS3pxJjSvRmK8aOd7RbvbeEjGsA0kI20oDpp0=; b=LVnUllImXKXidQCKMtPPuW5mn46PiR7jGywG6kJ/MUNPMU2duJs2XRBxt9Vd6gU/4+ wF08x7F/HmgSUrLOVKBRM2ikmoy7GY17Ni7zUqKSJtjPKDC4UWsYJj322ea9zo2qBSWg ibNEwJhTxvGdEJp76otEikQQiO2Nr5qj2m7/AtwVmZkAkBINZVO1dh1yW2k7pm7gwAA7 LpESf1mVTSdo7lRQQDqvFRWDceUxwAY+7Poch8eUieR9DPg/fYCzzWF9F13Dcyq9035l dgFL+xaBpYbVvCloLVle26/gBGHtd/zH6cGTAm6fZs+jiearjWwqmuj5TKmYfPw27gnJ qm+A== X-Forwarded-Encrypted: i=1; AL+hErFw+/cRaU69rTSl35pDveg8QjuxXhc0eapsSbAZPHp14yfzyOrPzh6r5KSPt2N2EEmZrRvKdM6NULYWKyU=@vger.kernel.org X-Gm-Message-State: APuU4Z9GpMOX/GIq4mye0JtelS0QADYBLkXRf3+FPhOBpyEG3h0DB8fH ihjDT1yoH9RKC7KHh7qBaSqcJysZwmwP/bSQpSAAmNN+xZJH/ccXhdk7 X-Gm-Gg: AZFdTZfY8n7oU+51PUYq0kb43NvRZ2huorDxvxEcIBFdSEguk26hEY+osRn9hbOaOFZ pfQoGO3e9alCYGfbOIGlll72erOiCoeCwXl/cuBujlu/rOto6HQSCyod6F9TUgL5ZaT8FNPI2Bi C2mPZIvIdFgKpuQZWkRiw3uz/3HxMihvEz5T8mlnBHJs+GFaT8bmZKDHowRCPwAkzO0V4FUNuCq YmHTGNUkNe7kG30it9KaNYCxJ0+BF0qjdWm4tdKY7QalKVxv4XEfZyax5YkfT+CF8HXym7oyfgW A7zzaILbo6cKOnwCyRMZII1T3ZiFV0XAb7UfK8xLUsnNCiM6k/cVVx0rkIGazJS5S/GdUsISq0F 25ln5jIrHVXkqEaK3ECnLsri9vVFfFxwRUrTqV7j5IWCmdBIrQDpb4yRabU8ZUgzLeE7qgQJ2nt 3Vi0skzuhaeD7qgoA26ExrgWlIhd5VG2iutoU5ZowDU9FZ7STItZrUgt9rGOkNCbpK7qxwO9k2J KzwL2Ja7DHt9U92jEPrk+WMvJiSK4Y95TEaEl1jWYbW5ev9dyLXDLnycEilpLh0sw3xm++N19/A BzNFmh9ihyKRbiClH1PPkFmWFYNZi+VP5tPTvKARp1edik83azUgYPY6mYJQ4LV68B+dBWqN4sl B5Q== X-Received: by 2002:a05:600c:1389:b0:4bb:6519:477e with SMTP id 5b1f17b1804b1-4bb88813b35mr821729035e9.17.1796220472410; Wed, 02 Dec 2026 06:07:52 -0800 (PST) Received: from kreach.multipass (nat44-21-238.net.ruhr-uni-bochum.de. [134.147.21.238]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bbc184d8dcsm227398815e9.1.2026.12.02.06.07.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2026 06:07:51 -0800 (PST) From: Jude Gyimah To: 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 Cc: 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, Jude Gyimah Subject: [PATCH] ALSA: hda: give the NHLT parser a module of its own Date: Wed, 2 Dec 2026 15:07:33 +0100 Message-ID: <20261202140733.116024-1-jude.gyimah87@gmail.com> X-Mailer: git-send-email 2.43.0 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- sound/hda/core/Kconfig | 6 +++--- sound/hda/core/Makefile | 4 +++- sound/hda/core/intel-nhlt.c | 4 ++++ sound/soc/sof/Kconfig | 1 + 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/sound/hda/core/Kconfig b/sound/hda/core/Kconfig index bfdcf6384c52..4ecc02c1c90d 100644 --- a/sound/hda/core/Kconfig +++ b/sound/hda/core/Kconfig @@ -21,9 +21,9 @@ config SND_HDA_EXT_CORE select SND_HDA_CORE config SND_INTEL_NHLT - bool - # this config should be selected only for Intel ACPI platforms. - # A fallback is provided so that the code compiles in all cases. + tristate + # Selected by whoever parses an NHLT table. A fallback is provided so + # that the code compiles in all cases. config SND_INTEL_DSP_CONFIG tristate diff --git a/sound/hda/core/Makefile b/sound/hda/core/Makefile index 89cb46143050..d0eb2cf1fa78 100644 --- a/sound/hda/core/Makefile +++ b/sound/hda/core/Makefile @@ -15,8 +15,10 @@ obj-$(CONFIG_SND_HDA_CORE) += snd-hda-core.o obj-$(CONFIG_SND_HDA_EXT_CORE) += ext/ snd-intel-dspcfg-y := intel-dsp-config.o -snd-intel-dspcfg-$(CONFIG_SND_INTEL_NHLT) += intel-nhlt.o obj-$(CONFIG_SND_INTEL_DSP_CONFIG) += snd-intel-dspcfg.o +snd-intel-nhlt-y := intel-nhlt.o +obj-$(CONFIG_SND_INTEL_NHLT) += snd-intel-nhlt.o + snd-intel-sdw-acpi-y := intel-sdw-acpi.o obj-$(CONFIG_SND_INTEL_SOUNDWIRE_ACPI) += snd-intel-sdw-acpi.o diff --git a/sound/hda/core/intel-nhlt.c b/sound/hda/core/intel-nhlt.c index 6d72a871bda0..41565d74bd4d 100644 --- a/sound/hda/core/intel-nhlt.c +++ b/sound/hda/core/intel-nhlt.c @@ -2,6 +2,7 @@ // Copyright (c) 2015-2019 Intel Corporation #include +#include #include struct nhlt_acpi_table *intel_nhlt_init(struct device *dev) @@ -386,3 +387,6 @@ int intel_nhlt_ssp_device_type(struct device *dev, struct nhlt_acpi_table *nhlt, return -EINVAL; } EXPORT_SYMBOL(intel_nhlt_ssp_device_type); + +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("Intel NHLT table parsing helpers"); diff --git a/sound/soc/sof/Kconfig b/sound/soc/sof/Kconfig index a487ab0b51c7..c5a1065b845a 100644 --- a/sound/soc/sof/Kconfig +++ b/sound/soc/sof/Kconfig @@ -272,6 +272,7 @@ endif ## SND_SOC_SOF_DEVELOPER_SUPPORT config SND_SOC_SOF tristate + select SND_INTEL_NHLT if ACPI select SND_SOC_TOPOLOGY select SND_SOC_SOF_NOCODEC if SND_SOC_SOF_NOCODEC_SUPPORT select SND_SOC_SOF_NOCODEC if SND_SOC_SOF_NOCODEC_DEBUG_SUPPORT -- 2.43.0