Re: [PATCH] x86/kvm: Override default caching mode for SEV-SNP and TDX

From: Dave Hansen
Date: Tue Oct 15 2024 - 09:17:26 EST


On 10/15/24 03:12, Jürgen Groß wrote:
>>
>> +    /* Set WB as the default cache mode for SEV-SNP and TDX */
>> +    mtrr_overwrite_state(NULL, 0, MTRR_TYPE_WRBACK);
>
> Do you really want to do this for _all_ KVM guests?
>
> I'd expect this call to be conditional on TDX or SEV-SNP.

I was confused by this as well.

Shouldn't mtrr_overwrite_state() be named something more like:

guest_force_mtrr_state()

or something?

The mtrr_overwrite_state() comment is pretty good, but it looks quite
confusing from the caller.