From nobody Mon Oct 6 13:42:11 2025 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 3CFD22C15A6; Tue, 22 Jul 2025 06:55:06 +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=1753167307; cv=none; b=WmqzO0ZxymNvCMt/LsYadaakwCKcO855R0vDGpwwY+Wzth63A79l+pCuievuJhxvlE2w3ItL9COEj76Z47APm7CO21GlD3BmPKLcAzP+932p8WXWCnsNrzKt60D72Y3SmEpvrPkjI8bnww1XXS/2byXbToXRkD7daX+HXX1IqSM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753167307; c=relaxed/simple; bh=l8ElQRAT1Hszveqk+X21k8IIcIZzDZmj+WUDZsTY2C0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MbLJLjruNk2HLd/YcUUG6KH8oV1O7C+VE37P3bOwzISGHNMblqKvdJahJBy49u373l7JKpUsIt5SLUVa8Y50iqCNfiJialKez06OxFvTmpOp+0VrNjBJHtvLI4PT9rZg2mN0Wr5zVpD9yusM12q9nsk57W5vnO5bPqQ+5HDy87I= 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=OG19vllZ; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=dNw/FxhJ; 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="OG19vllZ"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="dNw/FxhJ" From: "Ahmed S. Darwish" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1753167304; 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=ILIDCHvFGsvZiwtpyNNKEdOsJOlcSIX04cXR7l0HOA4=; b=OG19vllZs4UMcY4cnu/AVu1BgRj0SPpqQm3S0/Q2w03HX1Ahsb5t5hD5eZmXxf9P2Q9pbE N8D3TBKMzI2Pz5QzGEdaNONpAXTZ0QCGLF9fFY7xqkbUPM3aZS2+ojE9HLqhfmEiAJz/iA 7Yymi1J2rpnr0LecWS27/sCmlknbCRDC5tMh2yG7xRabUTEouCPK6vGeIsBVgFNr9p/v9U m5A+wq5eqk1NrgIhURBIETINXJXYih9t77HcIybWjqr5v6/vQbsmzq0XtXew63RmLgF99f UuKoVixB8IFjVZolkK/uBeRLcf0R2kglqINpYruYxJhO8PrXFtyWmfzOg9D5dg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1753167304; 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=ILIDCHvFGsvZiwtpyNNKEdOsJOlcSIX04cXR7l0HOA4=; b=dNw/FxhJUcL6PJCsOv2mAlgc5LiKPrccT4pu5JjTfHuWN5Ql1KwwsgfbqU14oZx9exWAgS /WV2znulzlPCdIDw== To: Borislav Petkov , Ingo Molnar , Dave Hansen Cc: Thomas Gleixner , Andrew Cooper , Paolo Bonzini , Vitaly Kuznetsov , Sean Christopherson , Juergen Gross , Boris Ostrovsky , Greg Kroah-Hartman , John Ogness , x86@kernel.org, kvm@vger.kernel.org, x86-cpuid@lists.linux.dev, LKML , "Ahmed S. Darwish" Subject: [PATCH v3 2/6] ASoC: Intel: avs: Include CPUID header at file scope Date: Tue, 22 Jul 2025 08:54:27 +0200 Message-ID: <20250722065448.413503-3-darwi@linutronix.de> In-Reply-To: <20250722065448.413503-1-darwi@linutronix.de> References: <20250722065448.413503-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 the CPUID header. Include the CPUID header at file scope instead. Note, for the CPUID(0x15) leaf number, use CPUID_LEAF_TSC instead of defining a custom local macro for it. Signed-off-by: Ahmed S. Darwish Acked-by: Cezary Rojewski --- sound/soc/intel/avs/tgl.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/sound/soc/intel/avs/tgl.c b/sound/soc/intel/avs/tgl.c index 9dbb3ad0954a..cf19d3a7ced2 100644 --- a/sound/soc/intel/avs/tgl.c +++ b/sound/soc/intel/avs/tgl.c @@ -10,8 +10,6 @@ #include "avs.h" #include "messages.h" =20 -#define CPUID_TSC_LEAF 0x15 - static int avs_tgl_dsp_core_power(struct avs_dev *adev, u32 core_mask, boo= l power) { core_mask &=3D AVS_MAIN_CORE_MASK; @@ -39,22 +37,31 @@ 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 +#ifdef CONFIG_X86 +#include +static unsigned int intel_crystal_freq_hz(void) +{ + return cpuid_ecx(CPUID_LEAF_TSC); +} +#else +static unsigned int intel_crystal_freq_hz(void) +{ + return 0; +} +#endif /* !CONFIG_X86 */ + static int avs_tgl_config_basefw(struct avs_dev *adev) { + unsigned int freq =3D intel_crystal_freq_hz(); struct pci_dev *pci =3D adev->base.pci; struct avs_bus_hwid hwid; int ret; -#ifdef CONFIG_X86 - unsigned int ecx; =20 -#include - ecx =3D cpuid_ecx(CPUID_TSC_LEAF); - if (ecx) { - ret =3D avs_ipc_set_fw_config(adev, 1, AVS_FW_CFG_XTAL_FREQ_HZ, sizeof(e= cx), &ecx); + 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 hwid.device =3D pci->device; hwid.subsystem =3D pci->subsystem_vendor | (pci->subsystem_device << 16); --=20 2.50.1