On Fri, Sep 03, 2021 at 10:13:16AM -0500, Michael Roth wrote: > On Wed, Sep 01, 2021 at 04:14:10PM +0200, Markus Armbruster wrote: > > Michael Roth <michael.roth@xxxxxxx> writes: > > > > > Most of the current 'query-sev' command is relevant to both legacy > > > SEV/SEV-ES guests and SEV-SNP guests, with 2 exceptions: > > > > > > - 'policy' is a 64-bit field for SEV-SNP, not 32-bit, and > > > the meaning of the bit positions has changed > > > - 'handle' is not relevant to SEV-SNP > > > > > > To address this, this patch adds a new 'sev-type' field that can be > > > used as a discriminator to select between SEV and SEV-SNP-specific > > > fields/formats without breaking compatibility for existing management > > > tools (so long as management tools that add support for launching > > > SEV-SNP guest update their handling of query-sev appropriately). > > > > Technically a compatibility break: query-sev can now return an object > > that whose member @policy has different meaning, and also lacks @handle. > > > > Matrix: > > > > Old mgmt app New mgmt app > > Old QEMU, SEV/SEV-ES good good(1) > > New QEMU, SEV/SEV-ES good(2) good > > New QEMU, SEV-SNP bad(3) good > > > > Notes: > > > > (1) As long as the management application can cope with absent member > > @sev-type. > > > > (2) As long as the management application ignores unknown member > > @sev-type. > > > > (3) Management application may choke on missing member @handle, or > > worse, misinterpret member @policy. Can only happen when something > > other than the management application created the SEV-SNP guest (or the > > user somehow made the management application create one even though it > > doesn't know how, say with CLI option passthrough, but that's always > > fragile, and I wouldn't worry about it here). > > > > I think (1) and (2) are reasonable. (3) is an issue for management > > applications that support attaching to existing guests. Thoughts? > > Hmm... yah I hadn't considering 'old mgmt' trying to interact with a SNP > guest started through some other means. > > Don't really see an alternative other than introducing a new > 'query-sev-snp', but that would still leave 'old mgmt' broken, since > it might still call do weird stuff like try to interpret the SNP policy > as an SEV/SEV-ES and end up with some very unexpected results. So if I > did go this route, I would need to have QMP begin returning an error if > query-sev is run against an SNP guest. But currently for non-SEV guests > it already does: > > error_setg(errp, "SEV feature is not available") > > so 'old mgmt' should be able to handle the error just fine. > > Would that approach be reasonable? This ties into the question I've just sent in my other mail. If the hardware strictly requires that guest are created in SEV-SNP mode only, and will not support SEV/SEV-ES mode, then we need to ensure "query-sev" reports the feature as not-available, so that existing mgmt apps don't try to use SEV/SEV-ES. If the SEV-SNP hardware is functionally back-compatible with a gues configured in SEV/SEV-ES mode, then we souldn't need a new command, just augment th eexisting command with additional field(s), to indicate existance of SEV-SNP features. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|