From nobody Thu Apr 2 20:28:14 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E2E72316917 for ; Thu, 12 Feb 2026 10:52:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770893544; cv=none; b=X682sd9CFuFRSj9L4mUspW1jRIfQyHaZ5tSAdbL94XT0qGzN5FoyQZKY3jp5c1mojsdKl7X0MohKXPm39oDq5Wzeo1a03vRdL7sP6uhF+ewMivmA+YiDL0QPV+sPdXu+wFBBZVBLVtn6ROSmMS8sZhXYKYdaJZQ68iWmzAfhPYM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770893544; c=relaxed/simple; bh=0VJorrCNLDmll5biT00ss8hT7qU/JEiNG1R8WhBGgbE=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uHYvWqmFcZok01wNzJh41yoBmrV2rLRV9OmkXCQOBt1H3OpgsDsCRKS3P7Xvm30wywY3VPf0g603aA9ly5uQpHEEtELsG0VT45VIlkMV7MKJaepNKAtzhjiu24O6Hk7t1NW5GVlqAVqrAo6ruFJq10xj/EDaRltTW3sobDh5AvU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=JWrxuYaG; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=jtSDozM4; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="JWrxuYaG"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="jtSDozM4" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1770893539; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Dv/cLXh264i91XUSFDhJ5W6sVIgqSnLYvLU3b6QBq40=; b=JWrxuYaGBYxVnCULmSd/D6lrh5twyvmI0vCLzGBrefDbSYZXrRLP7L6DLQGrjm5IQqh7RO g3XxURF8+eLhzpeFiMLN6yJLMn9BXXzfPRLxwXOESoTG/7bHbssc9i0P7iuqKTio4oVvw0 W/DK7aph5exuAoSIsz80ycTI7wEp8ig= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-588-i6quE7d_N7-KHkpClIupVw-1; Thu, 12 Feb 2026 05:52:18 -0500 X-MC-Unique: i6quE7d_N7-KHkpClIupVw-1 X-Mimecast-MFC-AGG-ID: i6quE7d_N7-KHkpClIupVw_1770893537 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4804157a3c9so52239055e9.1 for ; Thu, 12 Feb 2026 02:52:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1770893537; x=1771498337; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Dv/cLXh264i91XUSFDhJ5W6sVIgqSnLYvLU3b6QBq40=; b=jtSDozM4E2nfjCd13sglzSWSgP/rhrfpzQC4WYga+B7ED++ORRQt+BNKXtlI8KESFy rFhBRw+v8ssAZgui3Bvqf8P6vmdB01ZPIUg+MijMbJPaIHgWlRsXpVGE28fnKb5opvgI taQgdzWizpmeihCQjWL5shvmx2hALpyK+4t2eWuuR3gHvZzF83M1auuHtTqNkzFlQ+gW GWV62HYCc2LJAaT+r0Hbw1HwivHQXQVosR0xN4MYKkmjgC6B+pbaJ2viZUGUw3LPOziG lGTsdCOQbpr6S+hdLrwf4XO6Ma7AvM6fYIptGN4ZzJl7KUs7gIA5HQ6cxepO25ut2Gbh ERrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770893537; x=1771498337; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=Dv/cLXh264i91XUSFDhJ5W6sVIgqSnLYvLU3b6QBq40=; b=UKphu9lGjleHOlKYNVzA/Bfk1ftDDWBGaiejW0FUsWmHI6Dw3oO0ucLYu0dlndpVaF RfgyXiWgZpry9Z0sCPlesURb11impgdmtKOFqHK7Zqas/ZxEulParwHCzjq5L52iNv5H QI38VIW1Hhm462yCgzeYj+yBS3hWOUpwsVpPgZiJojHWgaPWPuhS2XG3LKDVxibt6Rl0 zancNHNNFwyA2po9E9HhYToF8gUScxIIkPZJlwSEmIw0UkqZYCAXvDuwz2esOos3YrHL Zvd8y7TC4Lgvpuu3D5cKHi4NpchLqIdoEZ6p37dk19KqKuiWbl/CQqE1AoLnwmCdOJAH pKIA== X-Gm-Message-State: AOJu0Yyt3rHXWR8jeqGpp8Esw1jA3tqRZy24u63iHP/1ojBssZ+CaZnL RPAUgr5sJ5y/pQxatyoUM76SgFzHdw65lGRXICr0vF9Ek3fOwRqcZTcm0uvuwzEgkF7mkN9oQ24 j9mEGwcN9GmRpMHul62aNw79VJ7lhUQzfzjU4jkSOuBJPrnFdSGvo6IrVoNVXjkT6iO4E3VLDId +yTVJYs6S7rdD0vxV4HNUoA1HyAiRHpRdCs+6zGzyt3VIauIlNkQ== X-Gm-Gg: AZuq6aJYrpbxsTs/azgpZVtw4a7YbFWICE9pucKHtX055mKREw9Exr3mwC/g8mfSFpZ JVz9jvCstmnVHkubiLMhV44BTQqyhEhtJ+ENHBVtZO0A0qLpVAYAVS5aeMuUvKJhFXmklEcUYER BgIwe2z4gAk04CDip7JXulWJU7XOvm6auH9Rog6O1vUFZ4zRZY5bivWl/NZVEjlhBXuHcNN5hOk XzT6A/tMuuC4Q8A7N4Ek+GC5MjRUhNE+S/V1krYe7iiMNbFej/hKBwuznP5BXPyc++VrhgH7zRK Uo0Up6lsh3+ekyF712G0xlwyjaaBrONDDI/wBDR6r2yYKfikqrLUCP/KwMto9QBgCrgh109MEoq meWOtUCVLNqGbbLZJtYA6iB5VEVincGQTQZ1ntTGJdogT3gQuuaxIf9/f34gvQs06E9NNHjy/jS SnAIZnQwUgIckZiWLE3JqFb6fgtafAbC/1ALnFqCpWaIdxJ8zdFTI= X-Received: by 2002:a05:600c:c494:b0:47e:e5c5:f3a3 with SMTP id 5b1f17b1804b1-4836570edf3mr34175545e9.24.1770893536719; Thu, 12 Feb 2026 02:52:16 -0800 (PST) X-Received: by 2002:a05:600c:c494:b0:47e:e5c5:f3a3 with SMTP id 5b1f17b1804b1-4836570edf3mr34175125e9.24.1770893536224; Thu, 12 Feb 2026 02:52:16 -0800 (PST) Received: from [192.168.122.1] (nat-pool-mxp-t.redhat.com. [149.6.153.186]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4835a619c7dsm67722695e9.2.2026.02.12.02.52.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Feb 2026 02:52:15 -0800 (PST) From: Paolo Bonzini To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Subject: [PATCH 2/2] KVM: always define KVM_CAP_SYNC_MMU Date: Thu, 12 Feb 2026 11:52:11 +0100 Message-ID: <20260212105211.1555876-3-pbonzini@redhat.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260212105211.1555876-1-pbonzini@redhat.com> References: <20260212105211.1555876-1-pbonzini@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" KVM_CAP_SYNC_MMU is provided by KVM's MMU notifiers, which are now always available. Move the definition from individual architectures to common code. Signed-off-by: Paolo Bonzini --- Documentation/virt/kvm/api.rst | 10 ++++------ arch/arm64/kvm/arm.c | 1 - arch/loongarch/kvm/vm.c | 1 - arch/mips/kvm/mips.c | 1 - arch/powerpc/kvm/powerpc.c | 5 ----- arch/riscv/kvm/vm.c | 1 - arch/s390/kvm/kvm-s390.c | 1 - arch/x86/kvm/x86.c | 1 - virt/kvm/kvm_main.c | 1 + 9 files changed, 5 insertions(+), 17 deletions(-) diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst index fc5736839edd..6f85e1b321dd 100644 --- a/Documentation/virt/kvm/api.rst +++ b/Documentation/virt/kvm/api.rst @@ -1396,7 +1396,10 @@ or its flags may be modified, but it may not be resi= zed. Memory for the region is taken starting at the address denoted by the field userspace_addr, which must point at user addressable memory for the entire memory slot size. Any object may back this memory, including -anonymous memory, ordinary files, and hugetlbfs. +anonymous memory, ordinary files, and hugetlbfs. Changes in the backing +of the memory region are automatically reflected into the guest. +For example, an mmap() that affects the region will be made visible +immediately. Another example is madvise(MADV_DROP). =20 On architectures that support a form of address tagging, userspace_addr mu= st be an untagged address. @@ -1412,11 +1415,6 @@ use it. The latter can be set, if KVM_CAP_READONLY_= MEM capability allows it, to make a new slot read-only. In this case, writes to this memory will be posted to userspace as KVM_EXIT_MMIO exits. =20 -When the KVM_CAP_SYNC_MMU capability is available, changes in the backing = of -the memory region are automatically reflected into the guest. For example= , an -mmap() that affects the region will be made visible immediately. Another -example is madvise(MADV_DROP). - For TDX guest, deleting/moving memory region loses guest memory contents. Read only region isn't supported. Only as-id 0 is supported. =20 diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c index 94d5b0b99fd1..7309f5084388 100644 --- a/arch/arm64/kvm/arm.c +++ b/arch/arm64/kvm/arm.c @@ -358,7 +358,6 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long = ext) break; case KVM_CAP_IOEVENTFD: case KVM_CAP_USER_MEMORY: - case KVM_CAP_SYNC_MMU: case KVM_CAP_DESTROY_MEMORY_REGION_WORKS: case KVM_CAP_ONE_REG: case KVM_CAP_ARM_PSCI: diff --git a/arch/loongarch/kvm/vm.c b/arch/loongarch/kvm/vm.c index 9681ade890c6..41b58ec45f41 100644 --- a/arch/loongarch/kvm/vm.c +++ b/arch/loongarch/kvm/vm.c @@ -117,7 +117,6 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long = ext) case KVM_CAP_ONE_REG: case KVM_CAP_ENABLE_CAP: case KVM_CAP_READONLY_MEM: - case KVM_CAP_SYNC_MMU: case KVM_CAP_IMMEDIATE_EXIT: case KVM_CAP_IOEVENTFD: case KVM_CAP_MP_STATE: diff --git a/arch/mips/kvm/mips.c b/arch/mips/kvm/mips.c index b0fb92fda4d4..29d9f630edfb 100644 --- a/arch/mips/kvm/mips.c +++ b/arch/mips/kvm/mips.c @@ -1035,7 +1035,6 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, lon= g ext) case KVM_CAP_ONE_REG: case KVM_CAP_ENABLE_CAP: case KVM_CAP_READONLY_MEM: - case KVM_CAP_SYNC_MMU: case KVM_CAP_IMMEDIATE_EXIT: r =3D 1; break; diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c index 3da40ea8c562..00302399fc37 100644 --- a/arch/powerpc/kvm/powerpc.c +++ b/arch/powerpc/kvm/powerpc.c @@ -623,11 +623,6 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long= ext) r =3D !!(hv_enabled && kvmppc_hv_ops->enable_nested && !kvmppc_hv_ops->enable_nested(NULL)); break; -#endif - case KVM_CAP_SYNC_MMU: - r =3D 1; - break; -#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE case KVM_CAP_PPC_HTAB_FD: r =3D hv_enabled; break; diff --git a/arch/riscv/kvm/vm.c b/arch/riscv/kvm/vm.c index 66d91ae6e9b2..b4afef7e59fc 100644 --- a/arch/riscv/kvm/vm.c +++ b/arch/riscv/kvm/vm.c @@ -181,7 +181,6 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long = ext) break; case KVM_CAP_IOEVENTFD: case KVM_CAP_USER_MEMORY: - case KVM_CAP_SYNC_MMU: case KVM_CAP_DESTROY_MEMORY_REGION_WORKS: case KVM_CAP_ONE_REG: case KVM_CAP_READONLY_MEM: diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index de645025db0f..6591ee56bf5b 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c @@ -601,7 +601,6 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long = ext) switch (ext) { case KVM_CAP_S390_PSW: case KVM_CAP_S390_GMAP: - case KVM_CAP_SYNC_MMU: #ifdef CONFIG_KVM_S390_UCONTROL case KVM_CAP_S390_UCONTROL: #endif diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 391f4a5ce6dd..ac31b098bfbd 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -4805,7 +4805,6 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, lon= g ext) #endif case KVM_CAP_NOP_IO_DELAY: case KVM_CAP_MP_STATE: - case KVM_CAP_SYNC_MMU: case KVM_CAP_USER_NMI: case KVM_CAP_IRQ_INJECT_STATUS: case KVM_CAP_IOEVENTFD: diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index bf5606d76f0c..51d1f7d4905e 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -4870,6 +4870,7 @@ static int kvm_ioctl_create_device(struct kvm *kvm, static int kvm_vm_ioctl_check_extension_generic(struct kvm *kvm, long arg) { switch (arg) { + case KVM_CAP_SYNC_MMU: case KVM_CAP_USER_MEMORY: case KVM_CAP_USER_MEMORY2: case KVM_CAP_DESTROY_MEMORY_REGION_WORKS: --=20 2.52.0