summaryrefslogtreecommitdiffstats
path: root/virt/kvm/dirty_ring.c
diff options
context:
space:
mode:
authorSean Christopherson <seanjc@google.com>2023-10-27 11:22:04 -0700
committerPaolo Bonzini <pbonzini@redhat.com>2023-11-14 08:01:05 -0500
commiteed52e434bc33603ddb0af62b6c4ef818948489d (patch)
tree0bf93687335ea9b38814f16182ca9a6f55a919a3 /virt/kvm/dirty_ring.c
parent2333afa17af0f4b6651214ee17cfd5ae5f47787a (diff)
downloadlinux-stable-eed52e434bc33603ddb0af62b6c4ef818948489d.tar.gz
linux-stable-eed52e434bc33603ddb0af62b6c4ef818948489d.tar.bz2
linux-stable-eed52e434bc33603ddb0af62b6c4ef818948489d.zip
KVM: Allow arch code to track number of memslot address spaces per VM
Let x86 track the number of address spaces on a per-VM basis so that KVM can disallow SMM memslots for confidential VMs. Confidentials VMs are fundamentally incompatible with emulating SMM, which as the name suggests requires being able to read and write guest memory and register state. Disallowing SMM will simplify support for guest private memory, as KVM will not need to worry about tracking memory attributes for multiple address spaces (SMM is the only "non-default" address space across all architectures). Signed-off-by: Sean Christopherson <seanjc@google.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Fuad Tabba <tabba@google.com> Tested-by: Fuad Tabba <tabba@google.com> Message-Id: <20231027182217.3615211-23-seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'virt/kvm/dirty_ring.c')
-rw-r--r--virt/kvm/dirty_ring.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/virt/kvm/dirty_ring.c b/virt/kvm/dirty_ring.c
index c1cd7dfe4a90..86d267db87bb 100644
--- a/virt/kvm/dirty_ring.c
+++ b/virt/kvm/dirty_ring.c
@@ -58,7 +58,7 @@ static void kvm_reset_dirty_gfn(struct kvm *kvm, u32 slot, u64 offset, u64 mask)
as_id = slot >> 16;
id = (u16)slot;
- if (as_id >= KVM_ADDRESS_SPACE_NUM || id >= KVM_USER_MEM_SLOTS)
+ if (as_id >= kvm_arch_nr_memslot_as_ids(kvm) || id >= KVM_USER_MEM_SLOTS)
return;
memslot = id_to_memslot(__kvm_memslots(kvm, as_id), id);