kvm/tdx: Ignore memory conversion to shared of unassigned region
authorIsaku Yamahata <isaku.yamahata@intel.com>
Thu, 29 Feb 2024 06:36:55 +0000 (01:36 -0500)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 23 Apr 2024 15:35:26 +0000 (17:35 +0200)
commit565f4768bb9cf840b2f8cca41483bb91aa3196a3
tree150a7ff1d2155a0e6d8a1ca213db2873ed87c404
parentc5d9425ef4da9f43fc0903905ad415456d1ab843
kvm/tdx: Ignore memory conversion to shared of unassigned region

TDX requires vMMIO region to be shared.  For KVM, MMIO region is the region
which kvm memslot isn't assigned to (except in-kernel emulation).
qemu has the memory region for vMMIO at each device level.

While OVMF issues MapGPA(to-shared) conservatively on 32bit PCI MMIO
region, qemu doesn't find corresponding vMMIO region because it's before
PCI device allocation and memory_region_find() finds the device region, not
PCI bus region.  It's safe to ignore MapGPA(to-shared) because when guest
accesses those region they use GPA with shared bit set for vMMIO.  Ignore
memory conversion request of non-assigned region to shared and return
success.  Otherwise OVMF is confused and panics there.

Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>
Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
Message-ID: <20240229063726.610065-35-xiaoyao.li@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
accel/kvm/kvm-all.c