Re: sound/soc/sof/intel/byt.c:1057: undefined reference to `sof_acpi_probe'

From: Arnd Bergmann
Date: Tue Apr 27 2021 - 14:42:40 EST


On Tue, Apr 27, 2021 at 6:07 PM Pierre-Louis Bossart
<pierre-louis.bossart@xxxxxxxxxxxxxxx> wrote:
> On 4/27/21 6:10 AM, kernel test robot wrote:
> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> > head: 4a0225c3d208cfa6e4550f2210ffd9114a952a81
> > commit: 8d4ba1be3d2257606e04aff412829d8972670750 ASoC: SOF: pci: split PCI into different drivers
> > date: 8 weeks ago
> > config: i386-randconfig-r024-20210426 (attached as .config)
> > compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
> > reproduce (this is a W=1 build):
> > # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8d4ba1be3d2257606e04aff412829d8972670750
> > git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> > git fetch --no-tags linus master
> > git checkout 8d4ba1be3d2257606e04aff412829d8972670750
> > # save the attached .config to linux build tree
> > make W=1 W=1 ARCH=i386
> >
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <lkp@xxxxxxxxx>
> >
> > All errors (new ones prefixed by >>):
> >
> > ld: sound/soc/sof/intel/byt.o: in function `sof_baytrail_probe':
> >>> sound/soc/sof/intel/byt.c:1057: undefined reference to `sof_acpi_probe'
> >>> ld: sound/soc/sof/intel/byt.o:(.data+0x44): undefined reference to `sof_acpi_remove'
> >>> ld: sound/soc/sof/intel/byt.o:(.data+0x94): undefined reference to `sof_acpi_pm'
>
> Ack, this is again the partition between Baytrail and Merrifield that's
> problematic in the corner case where ACPI is compiled as module and PCI
> as built-in. It's a bit academic since the PCI probe wouldn't work, but
> still it's not well partitioned.
>
> I've been wanting to change this for a while, and split the common atom
> parts from the ACPI/PCI parts. I guess it's time to fix this for good.

I wonder why I never see these in randconfig builds here. I can reproduce it
with the .config from the link above though, and I see these relevant config
lines:

CONFIG_SND_SOC_SOF_INTEL_TOPLEVEL=y
CONFIG_SND_SOC_SOF_INTEL_ATOM_HIFI_EP=y
CONFIG_SND_SOC_SOF_MERRIFIELD=y
CONFIG_SND_SOC_SOF_ACPI=m
CONFIG_SND_SOC_SOF_ACPI_DEV=m
CONFIG_SND_SOC_SOF_BAYTRAIL=m

An easy workaround would be to move the first 500 or so lines of
sound/soc/sof/intel/byt.c into a separate file and #include that from
distinct baytrail and merrifield modules, at the cost of a bit of
object code duplication and a somewhat dirty hack.

Another option would be a Kconfig hack to prevent the broken
configuration, such as

diff --git a/sound/soc/sof/intel/Kconfig b/sound/soc/sof/intel/Kconfig
index eebe784ff652..b2039b4af9cf 100644
--- a/sound/soc/sof/intel/Kconfig
+++ b/sound/soc/sof/intel/Kconfig
@@ -85,6 +85,8 @@ config SND_SOC_SOF_MERRIFIELD
tristate "SOF support for Tangier/Merrifield"
default SND_SOC_SOF_PCI
select SND_SOC_SOF_INTEL_ATOM_HIFI_EP
+ # Merrifield can't be built-in if snd-sof-acpi-intel-byt.ko is a module
+ depends on SND_SOC_SOF_BAYTRAIL || !SND_SOC_SOF_BAYTRAIL
help
This adds support for Sound Open Firmware for Intel(R) platforms
using the Tangier/Merrifield processors.

Arnd