[svsm-devel] [PATCH v4 05/15] x86/sev: Use kernel provided SVSM Calling Areas

Borislav Petkov bp at alien8.de
Wed May 8 21:58:42 CEST 2024


On Wed, May 08, 2024 at 02:13:17PM -0500, Tom Lendacky wrote:
> ok, maybe __perform_svsm_msr_protocol or such.

We'll bikeshed it in the coming weeks.

> There's quite a bit of interaction so I'll make sure to prefix everything.

Ack.

> The paravirt versions of local_irq_save and local_irq_restore can't be used
> as early as this routine is called.

tglx says you should do native_local_irq_save()/.._restore() helpers
just like the arch_local_irq_save()/..._restore() ones but use only
native_ functions without the paravirt gunk.

In a prepatch pls.

> > > +	struct svsm_call call = {};
> > > +	int ret;
> > > +	u64 pa;
> > > +
> > > +	/*
> > > +	 * Record the SVSM Calling Area address (CAA) if the guest is not
> > > +	 * running at VMPL0. The CA will be used to communicate with the
> > > +	 * SVSM to perform the SVSM services.
> > > +	 */
> > > +	setup_svsm_ca(cc_info);
> > > +
> > > +	/* Nothing to do if not running under an SVSM. */
> > > +	if (!vmpl)
> > > +		return;
> > 
> > You set up stuff above and now you bail out?
> 
> setup_svsm_ca() is what sets the vmpl variable. So nothing will have been
> setup if the VMPL is zero, in which case we don't continue on.

You still assign

        /*
         * The CA is identity mapped when this routine is called, both by the
         * decompressor code and the early kernel code.
         */
        boot_svsm_caa = (struct svsm_ca *)caa;
        boot_svsm_caa_pa = caa;

regardless of vmpl.

I think you should assign those only when vmpl != 0.

Otherwise the code is confusing.

> > Judging by setup_svsm_ca() you don't really need that vmpl var but you
> > can check
> > 
> > 	if (!boot_svsm_caa)
> > 		return;
> > 
> > to determine whether a SVSM was detected.
> 
> Yes, but the vmpl var will be used for attestation requests, sysfs, etc.

I guess that comes later in the patchset...

> > Huh, setup_svsm_ca() already assigned those...
> 
> setup_svsm_ca() assigned the ones from the secrets page. The kernel now
> switches to using its own CA.

Comment pls.

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette


More information about the Svsm-devel mailing list