From: Xiaoyao Li Date: Thu, 8 May 2025 14:59:41 +0000 (-0400) Subject: i386/tdx: Set kvm_readonly_mem_enabled to false for TDX VM X-Git-Tag: v10.1.0-rc0~69^2~30 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=da6728658bf63d6a3989f1587a33566b3e54bed8;p=thirdparty%2Fqemu.git 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 Acked-by: Gerd Hoffmann Reviewed-by: Zhao Liu Link: https://lore.kernel.org/r/20250508150002.689633-36-xiaoyao.li@intel.com Signed-off-by: Paolo Bonzini --- diff --git a/target/i386/kvm/tdx.c b/target/i386/kvm/tdx.c index accaefb4011..344e560b4b8 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;