summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorXiaoyao Li <xiaoyao.li@intel.com>2025-05-08 10:59:41 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2025-05-28 19:35:54 +0200
commitda6728658bf63d6a3989f1587a33566b3e54bed8 (patch)
treec14d0443bf287777fa7c7bc4cf5eb87940ab4099
parent9002494f80b751a7655045c5f46bf90bc1d3bbd0 (diff)
downloadfocaccia-qemu-da6728658bf63d6a3989f1587a33566b3e54bed8.tar.gz
focaccia-qemu-da6728658bf63d6a3989f1587a33566b3e54bed8.zip
i386/tdx: Set kvm_readonly_mem_enabled to false for TDX VM
TDX only supports readonly for shared memory but not for private memory.

In the view of QEMU, it has no idea whether a memslot is used as shared
memory of private. Thus just mark kvm_readonly_mem_enabled to false to
TDX VM for simplicity.

Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Link: https://lore.kernel.org/r/20250508150002.689633-36-xiaoyao.li@intel.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to '')
-rw-r--r--target/i386/kvm/tdx.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/target/i386/kvm/tdx.c b/target/i386/kvm/tdx.c
index accaefb401..344e560b4b 100644
--- a/target/i386/kvm/tdx.c
+++ b/target/i386/kvm/tdx.c
@@ -384,6 +384,15 @@ static int tdx_kvm_init(ConfidentialGuestSupport *cgs, Error **errp)
         return -EOPNOTSUPP;
     }
 
+    /*
+     * Set kvm_readonly_mem_allowed to false, because TDX only supports readonly
+     * memory for shared memory but not for private memory. Besides, whether a
+     * memslot is private or shared is not determined by QEMU.
+     *
+     * Thus, just mark readonly memory not supported for simplicity.
+     */
+    kvm_readonly_mem_allowed = false;
+
     qemu_add_machine_init_done_notifier(&tdx_machine_done_notify);
 
     tdx_guest = tdx;