Re: [RFC PATCH V3 10/16] x86/hyperv: Add smp support for sev-snp guest

From: Tianyu Lan
Date: Tue Feb 07 2023 - 08:50:04 EST


On 2/7/2023 4:11 AM, Borislav Petkov wrote:
On Fri, Feb 03, 2023 at 03:00:44PM +0800, Tianyu Lan wrote:
For the bits definition, use:

            u64 sev_feature_snp            : 1,
                sev_feature_vtom            : 1,
                sev_feature_reflectvc        : 1,
                ...


Good suggestion. Thanks.

Actually, I'd prefer if you used a named union and drop all this
"sev_feature_" prefixes everywhere:

union {
struct {
u64 snp : 1;
u64 vtom : 1;
u64 reflectvc : 1;
u64 restrict_injection : 1;
u64 alternate_injection : 1;
u64 full_debug : 1;
u64 reserved1 : 1;
u64 snpbtb_isolation : 1;
u64 resrved2 : 56;
};
u64 val;
} sev_features;



so that you can do in code:

struct sev_es_save_area *sev;

...

sev->sev_features.snp = ...

and so on.

Hi Boris:
Thanks a lot for your suggestion. Will update.