From nobody Thu Apr 2 20:20:21 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 88F3A330330 for ; Fri, 27 Mar 2026 02:17:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774577849; cv=none; b=ms1shzWLOKURr0ZS7EEas/iMd5D9L8kzsUfFjchi8cgocrmYIQzIrPg8qJ7vRoHJF0WMY/MaEl7RcVNQKwoAhEOAMfA8A1EAu8T76275FP4iUS+ipXzqVPMifN2VtEnTq7htZnDFUZWVfBuho4TPij3nC9F6gvRJZ5IWdhDEJMU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774577849; c=relaxed/simple; bh=f+/iJHeyDwYH3sBCvhNNFtLCIBZtC3JZoaVR7r/mweU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FEPQoR1/U0wAMMUffRGo2xrev73PZYzmK0Km2LQPzcR1+CQcQtr2WNUwz+PnZr5jxG7ArU9L59k+ma53CSTu4rEbDBT75vwJEoKj0BPB/1UwoFyN/2ycN9ZSE6WOu36/ARDsHgVZCOHTutU0z6cQNrECV9wqaeOjko3bjnAKh1s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=B2hs0m9t; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=ush0OZai; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="B2hs0m9t"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="ush0OZai" From: "Ahmed S. Darwish" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1774577846; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Mrl8XmJ7o7sgBcCDvX+j3CF0YEVIJIsLch2G1f2gE5o=; b=B2hs0m9tJM54bUwBQMd4fwHZemVx3mtfZnvwNQncjg/D/Emg55G+RFLzHuAwOSIj8YBJn4 6GF0q9qQ1MgkUaBfILtUgNP8gzow2IJrWHXMKCz0f1InTZ17h0ioKoxTxu5HwSaA239Vue 4Jp8Bx/UYYCRHPhwDiSNoGgMHD7XwiMzsODQMslgEiK9VHXHvX1GbxtkCK/mKsUa57YKnj X7D9Ytt9ASGHj8DSjKH88KHcN85A5yQsLdsJ5Po88II3YpU/KtBcyib9X2TwvyrCaYVa5W Mh+ABE97/DmAhlbx0dcKDIkN4MbW4edHBJ32JT0M9+QjAEk86MShO2caMkLuow== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1774577846; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Mrl8XmJ7o7sgBcCDvX+j3CF0YEVIJIsLch2G1f2gE5o=; b=ush0OZaiZ+DjWux+fuUy4iQpQPI5NCWi3f0UPck7dLzy8MwHGqEPSfbLKe8Tv6XVGW0wqS cw2R99Vb41SN9TDQ== To: Borislav Petkov , Dave Hansen , Ingo Molnar Cc: Thomas Gleixner , Andrew Cooper , "H. Peter Anvin" , Sean Christopherson , David Woodhouse , Peter Zijlstra , Christian Ludloff , Sohil Mehta , John Ogness , x86@kernel.org, x86-cpuid@lists.linux.dev, LKML , "Ahmed S. Darwish" Subject: [PATCH v6 02/90] ASoC: Intel: avs: Include CPUID header at file scope Date: Fri, 27 Mar 2026 03:15:16 +0100 Message-ID: <20260327021645.555257-3-darwi@linutronix.de> In-Reply-To: <20260327021645.555257-1-darwi@linutronix.de> References: <20260327021645.555257-1-darwi@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Commit cbe37a4d2b3c ("ASoC: Intel: avs: Configure basefw on TGL-based platform= s") includes the main CPUID header from within a C function. This works by luck and forbids valid refactorings inside that header. Include the CPUID header at file scope instead. Remove the COMPILE_TEST build flag so that the CONFIG_X86 conditionals can be removed. The driver gets enough compilation testing already on x86. For clarity, refactor the CPUID(0x15) code into its own function without changing any of the driver's logic. Suggested-by: Borislav Petkov # CONFIG_X86 removal Signed-off-by: Ahmed S. Darwish Fixes: cbe37a4d2b3c ("ASoC: Intel: avs: Configure basefw on TGL-based platf= orms") References: 47a1886a610a ("ASoC: Intel: avs: Enable AVS driver only on x86 = platforms") Link: https://lore.kernel.org/r/20251016105514.GCaPDPEu016XyDocfY@fat_crate= .local Link: https://lore.kernel.org/r/da5bf77b-5bdb-440f-92b5-db35d8687987@intel.= com Acked-by: Cezary Rojewski --- sound/soc/intel/Kconfig | 2 +- sound/soc/intel/avs/tgl.c | 37 ++++++++++++++++++++++++------------- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/sound/soc/intel/Kconfig b/sound/soc/intel/Kconfig index 412555e626b8..63367364916a 100644 --- a/sound/soc/intel/Kconfig +++ b/sound/soc/intel/Kconfig @@ -95,7 +95,7 @@ config SND_SOC_INTEL_KEEMBAY =20 config SND_SOC_INTEL_AVS tristate "Intel AVS driver" - depends on X86 || COMPILE_TEST + depends on X86 depends on PCI depends on COMMON_CLK select ACPI_NHLT if ACPI diff --git a/sound/soc/intel/avs/tgl.c b/sound/soc/intel/avs/tgl.c index 4649d749b41e..a7123639de43 100644 --- a/sound/soc/intel/avs/tgl.c +++ b/sound/soc/intel/avs/tgl.c @@ -7,6 +7,7 @@ // =20 #include +#include #include "avs.h" #include "debug.h" #include "messages.h" @@ -38,28 +39,38 @@ static int avs_tgl_dsp_core_stall(struct avs_dev *adev,= u32 core_mask, bool stal return avs_dsp_core_stall(adev, core_mask, stall); } =20 -static int avs_tgl_config_basefw(struct avs_dev *adev) +/* + * Succeed if CPUID(0x15) is not available, or if the nominal core crystal= clock + * frequency cannot be enumerated from it. There is nothing to do in both= cases. + */ +static int avs_tgl_set_xtal_freq(struct avs_dev *adev) { - struct pci_dev *pci =3D adev->base.pci; - struct avs_bus_hwid hwid; + unsigned int freq; int ret; -#ifdef CONFIG_X86 - unsigned int ecx; - -#include =20 if (boot_cpu_data.cpuid_level < CPUID_LEAF_TSC) - goto no_cpuid; + return 0; =20 - ecx =3D cpuid_ecx(CPUID_LEAF_TSC); - if (ecx) { - ret =3D avs_ipc_set_fw_config(adev, 1, AVS_FW_CFG_XTAL_FREQ_HZ, sizeof(e= cx), &ecx); + freq =3D cpuid_ecx(CPUID_LEAF_TSC); + if (freq) { + ret =3D avs_ipc_set_fw_config(adev, 1, AVS_FW_CFG_XTAL_FREQ_HZ, sizeof(f= req), &freq); if (ret) return AVS_IPC_RET(ret); } -#endif =20 -no_cpuid: + return 0; +} + +static int avs_tgl_config_basefw(struct avs_dev *adev) +{ + struct pci_dev *pci =3D adev->base.pci; + struct avs_bus_hwid hwid; + int ret; + + ret =3D avs_tgl_set_xtal_freq(adev); + if (ret) + return ret; + hwid.device =3D pci->device; hwid.subsystem =3D pci->subsystem_vendor | (pci->subsystem_device << 16); hwid.revision =3D pci->revision; --=20 2.53.0