Re: [Patch v3 07/14] x86/hyperv: Change vTOM handling to use standard coco mechanisms

From: Dave Hansen
Date: Tue Nov 22 2022 - 13:30:52 EST


On 11/22/22 10:22, Michael Kelley (LINUX) wrote:
> Anyway, that's where I think this should go. Does it make sense?
> Other thoughts?

I think hard-coding the C-bit behavior and/or position to a vendor was
probably a bad idea. Even the comment:

u64 cc_mkenc(u64 val)
{
/*
* Both AMD and Intel use a bit in the page table to indicate
* encryption status of the page.
*
* - for AMD, bit *set* means the page is encrypted
* - for Intel *clear* means encrypted.
*/

doesn't make a lot of sense now. Maybe we should just have a:

CC_ATTR_ENC_SET

which gets set for the "AMD" behavior and is clear for the "Intel"
behavior. Hyper-V code running on AMD can set the attribute to get teh
"Intel" behavior.

That sure beats having a Hyper-V vendor.