Re: [PATCH 05/16] KVM: Add member to struct kvm_gfn_range for target alias
From: Edgecombe, Rick P
Date: Fri May 17 2024 - 16:59:01 EST
On Tue, 2024-05-14 at 17:59 -0700, Rick Edgecombe wrote:
>
> diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
> index c3c922bf077f..f92c8b605b03 100644
> --- a/include/linux/kvm_host.h
> +++ b/include/linux/kvm_host.h
> @@ -260,11 +260,19 @@ union kvm_mmu_notifier_arg {
> unsigned long attributes;
> };
>
> +enum kvm_process {
> + BUGGY_KVM_INVALIDATION = 0,
> + KVM_PROCESS_SHARED = BIT(0),
> + KVM_PROCESS_PRIVATE = BIT(1),
> + KVM_PROCESS_PRIVATE_AND_SHARED = KVM_PROCESS_SHARED |
> KVM_PROCESS_PRIVATE,
> +};
> +
This enum and kvm_tdp_mmu_root_types are very similar. We could teach the
generic KVM code about invaliding roots instead of just private/shared. Then we
could have a single enum: kvm_tdp_mmu_root_types. This leaks arch details a
little more. But since kvm_process is only used by TDX anyway, the abstraction
seems a little excessive.
I think we should just justify it better in the log. Basically that the benefit
is to hide the detail that private and shared are actually on different roots.
And I guess to hide the existence of the mirrored EPT optimization since the
root is named KVM_MIRROR_ROOTS now. The latter seems more worthwhile.