From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.alien8.de (mail.alien8.de [65.109.113.108]) (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 4CBAB21E0BA; Tue, 2 Jun 2026 03:50:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=65.109.113.108 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780372221; cv=none; b=myNaeHUEyHtWVivkAIPWH5jSapnNAkWha7plulu/IbJgdcVTUQctf3ycQlCKuaZYSqAc0A8+3WoiBGOspU7T2z0WmNZd/NbsurU7008bli0inGzxjUKLLSklDPp9CLfNQ8argUZ22CiuBIrwIeWeVUsXnQhPKlfAidB//L0fNh0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780372221; c=relaxed/simple; bh=9sr2irVxdUl8CzOcLwp+rJ3CtWHA2j/elSxxJH5GLqk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=hgRvSgrzDeqTF0sPAXQI8RsxYt5RG6ZTREYDDs3wTOxKDjigdGazqAazoHd15hwPnp6uScTPCG4uDQ6fu5WX89YQ8+ONUbfB7e+WY8k4Mqs4KUqoWNNDj33cxtfPiMkAn0z3OOWWvVRr2SrX41HhZvR6EWDdsmHgg1Q+hOY73+Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=alien8.de; spf=pass smtp.mailfrom=alien8.de; dkim=pass (4096-bit key) header.d=alien8.de header.i=@alien8.de header.b=BRMb1T+l; arc=none smtp.client-ip=65.109.113.108 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=alien8.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=alien8.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (4096-bit key) header.d=alien8.de header.i=@alien8.de header.b="BRMb1T+l" Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with ESMTP id BDD1140E0140; Tue, 2 Jun 2026 03:50:16 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at mail.alien8.de Authentication-Results: mail.alien8.de (amavisd-new); dkim=pass (4096-bit key) header.d=alien8.de Received: from mail.alien8.de ([127.0.0.1]) by localhost (mail.alien8.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id rZ_Ke2IbpmQx; Tue, 2 Jun 2026 03:50:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=alien8; t=1780372206; bh=HH13uV+Z55mhxzoi6FErPEsztGrj9z0uUROqU3Stz7Y=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=BRMb1T+l+1IEZY4TOjMQ4w9ReoLidSSyCALG5lXh6uQPdtJJQdXO/YpIwNlbAph4G l/Dh+tFMKmPgVvKipIF2u99KtO2EN4cAREtpsqdKPkOqerozWTYAFwi46Wybtw/fbe +vmegLk87Rbq8vbD1H6DVOK2BrOKVAvWoMdxIbDT51x5lCY8z551GuWp9FhHp5+car VfJLFeyoLUyJO6c15FDGEfyv+Rbc53q3q5OSovUcXOREzvcqEjbwoVe0Y7wIViYOYy dK617hXkXVl9eYOJXWLlMawnI/pzDgQLxVC0VmuhZxwuyaJg1r6HaVHRONeWchNvGu vuUBlnvH9mmhMammOcSRyPnYSNm/ouhxvpjBC/kkh+mImmroEj5FFwKdESFRHD587M WZc+lXnb/l4BjyEVAAGNP2cLctZRPQKFYevllLAVNJtLle0Ashf1Pb13YdcdHN1spM rkF/jhg93VsSnzNK3JT36gNuh51JJh4mRth91IoSXBMOPYx6eLMZftQjrevQIQewk4 r73TYm4D6cnm0I9ePqYDRkUs1jK14EW1+rpqzoVUj1phZqDDalP0khp5WsBql7Ff4D DlzFTsjW4cZGQdPzsWOWFWXdC25leop27h508hIBBoyX6ymrK7PIpoEE1rrc0t6G1Y cqjQSDM1OdJJ7XcJilcWD9FQ= Received: from stx.tnic (unknown [IPv6:2600:1700:38ca:c00::30]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id ADDBA40E01B5; Tue, 2 Jun 2026 03:49:27 +0000 (UTC) Date: Mon, 1 Jun 2026 20:49:16 -0700 From: Borislav Petkov To: Sean Christopherson Cc: Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Dave Hansen , x86@kernel.org, Kiryl Shutsemau , "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Long Li , Ajay Kaher , Alexey Makhalov , Jan Kiszka , Andy Lutomirski , Peter Zijlstra , Juergen Gross , Daniel Lezcano , John Stultz , "H. Peter Anvin" , Rick Edgecombe , Vitaly Kuznetsov , Broadcom internal kernel review list , Boris Ostrovsky , Stephen Boyd , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-coco@lists.linux.dev, linux-hyperv@vger.kernel.org, virtualization@lists.linux.dev, xen-devel@lists.xenproject.org, David Woodhouse , Tom Lendacky , Nikunj A Dadhania , David Woodhouse , Michael Kelley , Thomas Gleixner Subject: Re: [PATCH v4 02/47] x86/tsc: Add a standalone helpers for getting TSC info from CPUID.0x15 Message-ID: <20260602034916.GGah5SvARd77mkvxe3@fat_crate.local> References: <20260529144435.704127-1-seanjc@google.com> <20260529144435.704127-3-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-coco@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20260529144435.704127-3-seanjc@google.com> On Fri, May 29, 2026 at 07:43:49AM -0700, Sean Christopherson wrote: > +static int cpuid_get_tsc_info(struct cpuid_tsc_info *info) > +{ > + unsigned int ecx_hz, edx; > + > + memset(info, 0, sizeof(*info)); Let's not clear this unnecessarily... > + > + if (boot_cpu_data.cpuid_level < CPUID_LEAF_TSC) > + return -ENOENT; ... just to return here... > + > + /* CPUID 15H TSC/Crystal ratio, plus optionally Crystal Hz */ > + cpuid(CPUID_LEAF_TSC, &info->denominator, &info->numerator, &ecx_hz, &edx); > + > + if (!info->denominator || !info->numerator) > + return -ENOENT; ... or here. We wanna clear it here, when we'll return success. > + > + /* > + * Note, some CPUs provide the multiplier information, but not the core Note: some CPUs... > + * crystal frequency. The multiplier information is still useful for > + * such CPUs, as the crystal frequency can be gleaned from CPUID.0x16. > + */ > + info->crystal_khz = ecx_hz / 1000; > + return 0; > +} > + > +int __init cpuid_get_tsc_freq(struct cpuid_tsc_info *info) > +{ > + if (cpuid_get_tsc_info(info) || !info->crystal_khz) > + return -ENOENT; > + > + info->tsc_khz = info->crystal_khz * info->numerator / info->denominator; > + return 0; > +} Unused here. Add it with its first user pls. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette