On Sat, 2022-10-29 at 23:22 -0700, 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. To untangle the logic to initialize > shadow_mmio_access_mask, introduce a separate setter function. > It's weird to mention "shadow_mmio_access_mask" here (and this doesn't stand anymore anyway as we have changed to only make mmio_value per-vm). Just say something like "introduce a setter function to set mmio_value for the given guest so that TDX guest can override later". Also, seems it's worth to mention the same mmio_mask is used for both TDX guest and VMX guest so we can still use global shadow_mmio_mask. [...] > void kvm_mmu_set_mmio_spte_mask(u64 mmio_value, u64 mmio_mask, u64 access_mask) > { > BUG_ON((u64)(unsigned)access_mask != access_mask); > + > WARN_ON(mmio_value & shadow_nonpresent_or_rsvd_lower_gfn_mask); Looks unnecessary change.