From nobody Sat Oct 4 16:09:10 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 F12A12E889D for ; Fri, 15 Aug 2025 07:06:07 +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=1755241569; cv=none; b=CGzq0qlXU9x42F6KLp9lI1kHQIGje7SRABfeyOmG3Ywjq8CfKzU3Zsu9+W6CS1zhtJPGQEbzEKgm8PcVYpr/o+m8f0n0KzaPsHUTONypSxHDASu5c37OEyYCUL1CpEHCRxa21sOD97G+qYd12sb+zXC6c5Iao5gMHtU9WnY4zrA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755241569; c=relaxed/simple; bh=3JgGac+wLi2t8hgJ5cs7uHeU+da7Ttsi4FfXEQS7jEY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NCOEonZKYfWPnIGJ8OTLnoPouiHCi7bIEgYbEYWkflmaY69CAueVgJNtBDIICZ3yPXRZ++YIWX/Bz8uCfujZEGafkOJTgVBnIzmLTiLN9ViJWadL081N41g/vIzObmO/oIz6pig8NVM8nqfauQr9qbfp7R6nop9Spc035ZYnW9Q= 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=wYD+Hi3/; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=cg4GvD4D; 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="wYD+Hi3/"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="cg4GvD4D" From: "Ahmed S. Darwish" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1755241565; 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=MRQM0gtExWMEhiBSKGLu87ejkMzs1S3UQSqE31gfaWw=; b=wYD+Hi3/DjUEie8GboVIY0w45CtbfO2Ff/Zw4/Pq9M46fNjMOHReqha6nKJbE7M1ZLL8oG +PiZFNNPJRuEgdrwaUthQq6vty1jTZjThkNdqVdVCWjw+S7tgGC212dh/3GxD1uhQEKj9O J4w/AQnoAzYyIdn6Xu4fxOM3lTzB0TQpdGE4O/4vWny1VeM4Dej5oJTdX3YbNQjdAd33nP 7/29NjuDXOS/1oYsofYhe4ySYheWHNUTveBLXMlbPR0HgDdS4JwHSK+qs/f/oQp0NceeWy dH20rDU3QBfq6qOv2FRx3QayVcF6i8x3NbnogOntdFo6vchbOtk0ds72RsIzNw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1755241565; 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=MRQM0gtExWMEhiBSKGLu87ejkMzs1S3UQSqE31gfaWw=; b=cg4GvD4Doqt7AYXnLzbVK/KdQfyDD8GfwdlmNOopfdiG8JMfjxerF3c5d7edCmQsz8+FfD ujzIFddsHRgHRLDA== To: Borislav Petkov , Ingo Molnar , Dave Hansen Cc: Thomas Gleixner , Andrew Cooper , "H. Peter Anvin" , David Woodhouse , Sean Christopherson , Peter Zijlstra , Sohil Mehta , John Ogness , x86@kernel.org, x86-cpuid@lists.linux.dev, LKML , "Ahmed S. Darwish" Subject: [PATCH v4 20/34] x86/cacheinfo: Use parsed CPUID(0x2) Date: Fri, 15 Aug 2025 09:02:13 +0200 Message-ID: <20250815070227.19981-21-darwi@linutronix.de> In-Reply-To: <20250815070227.19981-1-darwi@linutronix.de> References: <20250815070227.19981-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" Use parsed CPUID(0x2) access instead of direct CPUID queries. Remove the max standard CPUID level check since the NULL check of cpuid_leaf_regs()'s result is equivalent. Signed-off-by: Ahmed S. Darwish --- arch/x86/kernel/cpu/cacheinfo.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/kernel/cpu/cacheinfo.c b/arch/x86/kernel/cpu/cacheinf= o.c index adfa7e8bb865..39cd6db4f702 100644 --- a/arch/x86/kernel/cpu/cacheinfo.c +++ b/arch/x86/kernel/cpu/cacheinfo.c @@ -382,14 +382,14 @@ static void intel_cacheinfo_0x2(struct cpuinfo_x86 *c) { unsigned int l1i =3D 0, l1d =3D 0, l2 =3D 0, l3 =3D 0; const struct leaf_0x2_table *desc; - union leaf_0x2_regs regs; + struct cpuid_regs *regs; u8 *ptr; =20 - if (c->cpuid_level < 2) + regs =3D cpuid_leaf_regs(c, 0x2); + if (!regs) return; =20 - cpuid_leaf_0x2(®s); - for_each_cpuid_0x2_desc(regs, ptr, desc) { + for_each_parsed_cpuid_0x2_desc(regs, ptr, desc) { switch (desc->c_type) { case CACHE_L1_INST: l1i +=3D desc->c_size; break; case CACHE_L1_DATA: l1d +=3D desc->c_size; break; --=20 2.50.1