On Tue, Oct 28, 2025 at 10:11:13AM -0500, Tom Lendacky wrote:
> On 10/24/25 12:16, Naveen N Rao wrote:
> > On Fri, Oct 24, 2025 at 10:00:08AM -0500, Tom Lendacky wrote:
> >> On 10/8/25 04:52, Naveen N Rao wrote:
> >>> On Tue, Oct 07, 2025 at 08:31:47AM -0500, Tom Lendacky wrote:
> >>>> On 9/25/25 05:17, Naveen N Rao (AMD) wrote:
> >>>
> >>> ...
> >>>
> >>>>> +
> >>>>> +static void
> >>>>> +sev_snp_guest_set_tsc_frequency(Object *obj, Visitor *v, const char 
> >>>>> *name,
> >>>>> +                                void *opaque, Error **errp)
> >>>>> +{
> >>>>> +    uint32_t value;
> >>>>> +
> >>>>> +    if (!visit_type_uint32(v, name, &value, errp)) {
> >>>>> +        return;
> >>>>> +    }
> >>>>> +
> >>>>> +    SEV_SNP_GUEST(obj)->tsc_khz = value / 1000;
> >>>>
> >>>> This will cause a value that isn't evenly divisible by 1000 to be
> >>>> rounded down, e.g.: tsc-frequency=2500000999. Should this name instead
> >>>> just be tsc-khz or secure-tsc-khz (to show it is truly associated with
> >>>> Secure TSC)?
> >>>
> >>> I modeled this after the existing tsc-frequency parameter on the cpu 
> >>> object to keep it simple (parameter is the same, just where it is 
> >>> specified differs). This also aligns with TDX which re-uses the 
> >>> tsc-frequency parameter on the cpu object.
> >>
> >> So why aren't we using the one on the cpu object instead of creating a
> >> duplicate parameter? There should be some way to get that value, no?
> > 
> > I had spent some time on this, but I couldn't figure out a simple way to 
> > make that work.
> > 
> > TDX uses a vcpu pre-create hook (similar to KVM) to get access to and 
> > set the TSC value from the cpu object. For SEV-SNP, we need the TSC 
> > frequency during SNP_LAUNCH_START which is quite early and we don't have 
> > access to the cpu object there.
> > 
> > Admittedly, my qemu understanding is limited. If there is a way to 
> > re-use the cpu tsc-frequency field, then that would be ideal.
> > 
> > Any ideas/suggestions?
> 
> Any Qemu experts know how the SEV support would be able to access the
> TSC value from the -cpu command line option at LAUNCH time?

Bump. Any feedback on this, please?

Otherwise, kindly review v3 posted here:
http://lore.kernel.org/r/[email protected]


Thanks,
Naveen


Reply via email to