All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Kai Huang <kai.huang@intel.com>
Cc: "kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"pbonzini@redhat.com" <pbonzini@redhat.com>,
	 "nikunj@amd.com" <nikunj@amd.com>,
	"thomas.lendacky@amd.com" <thomas.lendacky@amd.com>,
	 "vaishali.thakkar@suse.com" <vaishali.thakkar@suse.com>,
	Xiaoyao Li <xiaoyao.li@intel.com>,  "bp@alien8.de" <bp@alien8.de>,
	Isaku Yamahata <isaku.yamahata@intel.com>,
	 "santosh.shukla@amd.com" <santosh.shukla@amd.com>
Subject: Re: [PATCH v8 2/2] KVM: SVM: Enable Secure TSC for SNP guests
Date: Tue, 8 Jul 2025 07:34:44 -0700	[thread overview]
Message-ID: <aG0shOcWprrZmiH3@google.com> (raw)
In-Reply-To: <fec4e8dd2d015ec6a37a852f6d7bcf815d538fdc.camel@intel.com>

On Tue, Jul 08, 2025, Kai Huang wrote:
> > > Even some bug results in the default_tsc_khz being 0, will the
> > > SNP_LAUNCH_START command catch this and return error?
> > 
> > No, that is an invalid configuration, desired_tsc_khz is set to 0 when
> > SecureTSC is disabled. If SecureTSC is enabled, desired_tsc_khz should
> > have correct value.
> 
> So it's an invalid configuration that when Secure TSC is enabled and
> desired_tsc_khz is 0.  Assuming the SNP_LAUNCH_START will return an error
> if such configuration is used, wouldn't it be simpler if you remove the
> above check and depend on the SNP_LAUNCH_START command to catch the
> invalid configuration?

Support for secure TSC should depend on tsc_khz being non-zero.  That way it'll
be impossible for arch.default_tsc_khz to be zero at runtime.  Then KVM can WARN
on arch.default_tsc_khz being zero during SNP_LAUNCH_START.

I.e.

	if (sev_snp_enabled && tsc_khz &&
	    cpu_feature_enabled(X86_FEATURE_SNP_SECURE_TSC))
		sev_supported_vmsa_features |= SVM_SEV_FEAT_SECURE_TSC;

  reply	other threads:[~2025-07-08 14:34 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-07 10:10 [PATCH v8 0/2] Enable Secure TSC for SEV-SNP Nikunj A Dadhania
2025-07-07 10:10 ` [PATCH v8 1/2] x86/cpufeatures: Add SNP Secure TSC Nikunj A Dadhania
2025-07-07 10:10 ` [PATCH v8 2/2] KVM: SVM: Enable Secure TSC for SNP guests Nikunj A Dadhania
2025-07-07 13:34   ` Tom Lendacky
2025-07-08  2:21   ` Huang, Kai
2025-07-08  6:45     ` Nikunj A. Dadhania
2025-07-08 10:48       ` Huang, Kai
2025-07-08 14:34         ` Sean Christopherson [this message]
2025-07-08 22:42           ` Huang, Kai
2025-07-09  4:14           ` Nikunj A. Dadhania
2025-07-08  7:16     ` Xiaoyao Li
2025-07-08 10:53       ` Huang, Kai
2025-07-08 14:42         ` Sean Christopherson
2025-07-08 22:56           ` Huang, Kai
2025-07-08 23:08             ` Sean Christopherson
2025-07-09  5:54               ` Huang, Kai
2025-07-08 14:37   ` Sean Christopherson
2025-07-09  4:12     ` Nikunj A. Dadhania
2025-07-09 13:02       ` Sean Christopherson
2025-07-10 10:59         ` Nikunj A Dadhania
2025-07-10 13:20           ` Sean Christopherson
2025-07-10 15:04             ` Nikunj A. Dadhania
2025-07-10 23:30               ` Sean Christopherson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aG0shOcWprrZmiH3@google.com \
    --to=seanjc@google.com \
    --cc=bp@alien8.de \
    --cc=isaku.yamahata@intel.com \
    --cc=kai.huang@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=nikunj@amd.com \
    --cc=pbonzini@redhat.com \
    --cc=santosh.shukla@amd.com \
    --cc=thomas.lendacky@amd.com \
    --cc=vaishali.thakkar@suse.com \
    --cc=xiaoyao.li@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.