Skip to content

Commit 57dfa61

Browse files
committed
KVM: VMX: Move nested_mark_vmcs12_pages_dirty() to vmx.c, and rename
Move nested_mark_vmcs12_pages_dirty() to vmx.c now that it's only used in the VM-Exit path, and add "all" to its name to document that its purpose is to mark all (mapped-out-of-band) vmcs12 pages as dirty. No functional change intended. Link: https://patch.msgid.link/20251121223444.355422-5-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent f74bb1d commit 57dfa61

2 files changed

Lines changed: 13 additions & 14 deletions

File tree

arch/x86/kvm/vmx/nested.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3981,19 +3981,6 @@ static void vmcs12_save_pending_event(struct kvm_vcpu *vcpu,
39813981
}
39823982
}
39833983

3984-
3985-
void nested_mark_vmcs12_pages_dirty(struct kvm_vcpu *vcpu)
3986-
{
3987-
struct vcpu_vmx *vmx = to_vmx(vcpu);
3988-
3989-
/*
3990-
* Don't need to mark the APIC access page dirty; it is never
3991-
* written to by the CPU during APIC virtualization.
3992-
*/
3993-
kvm_vcpu_map_mark_dirty(vcpu, &vmx->nested.virtual_apic_map);
3994-
kvm_vcpu_map_mark_dirty(vcpu, &vmx->nested.pi_desc_map);
3995-
}
3996-
39973984
static int vmx_complete_nested_posted_interrupt(struct kvm_vcpu *vcpu)
39983985
{
39993986
struct vcpu_vmx *vmx = to_vmx(vcpu);

arch/x86/kvm/vmx/vmx.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6378,6 +6378,18 @@ static void vmx_flush_pml_buffer(struct kvm_vcpu *vcpu)
63786378
vmcs_write16(GUEST_PML_INDEX, PML_HEAD_INDEX);
63796379
}
63806380

6381+
static void nested_vmx_mark_all_vmcs12_pages_dirty(struct kvm_vcpu *vcpu)
6382+
{
6383+
struct vcpu_vmx *vmx = to_vmx(vcpu);
6384+
6385+
/*
6386+
* Don't need to mark the APIC access page dirty; it is never
6387+
* written to by the CPU during APIC virtualization.
6388+
*/
6389+
kvm_vcpu_map_mark_dirty(vcpu, &vmx->nested.virtual_apic_map);
6390+
kvm_vcpu_map_mark_dirty(vcpu, &vmx->nested.pi_desc_map);
6391+
}
6392+
63816393
static void vmx_dump_sel(char *name, uint32_t sel)
63826394
{
63836395
pr_err("%s sel=0x%04x, attr=0x%05x, limit=0x%08x, base=0x%016lx\n",
@@ -6655,7 +6667,7 @@ static int __vmx_handle_exit(struct kvm_vcpu *vcpu, fastpath_t exit_fastpath)
66556667
* Mark them dirty on every exit from L2 to prevent them from
66566668
* getting out of sync with dirty tracking.
66576669
*/
6658-
nested_mark_vmcs12_pages_dirty(vcpu);
6670+
nested_vmx_mark_all_vmcs12_pages_dirty(vcpu);
66596671

66606672
/*
66616673
* Synthesize a triple fault if L2 state is invalid. In normal

0 commit comments

Comments
 (0)