Re: [PATCH v19 052/130] KVM: x86/mmu: Track shadow MMIO value on a per-VM basis

From: Edgecombe, Rick P
Date: Mon Mar 25 2024 - 23:31:45 EST


On Mon, 2024-02-26 at 00:25 -0800, isaku.yamahata@xxxxxxxxx wrote:
> From: Isaku Yamahata <isaku.yamahata@xxxxxxxxx>
>
> TDX will use a different shadow PTE entry value for MMIO from VMX.  Add
> members to kvm_arch and track value for MMIO per-VM instead of global
> variables.  By using the per-VM EPT entry value for MMIO, the existing VMX
> logic is kept working.  Introduce a separate setter function so that guest
> TD can override later.
>
> Also require mmio spte caching for TDX.


> Actually this is true case
> because TDX requires EPT and KVM EPT allows mmio spte caching.
>

I can't understand what this is trying to say.

>  
>  void kvm_mmu_init_vm(struct kvm *kvm)
>  {
> +
> +       kvm->arch.shadow_mmio_value = shadow_mmio_value;

It could use kvm_mmu_set_mmio_spte_value()?

>         INIT_LIST_HEAD(&kvm->arch.active_mmu_pages);