Commit 2ac52ab8 authored by Sean Christopherson's avatar Sean Christopherson Committed by Paolo Bonzini

KVM: x86: move setting of ept_identity_map_addr to vmx.c

Add kvm_x86_ops->set_identity_map_addr and set ept_identity_map_addr
in VMX specific code so that ept_identity_map_addr can be moved out
of 'struct kvm_arch' in a future patch.
Signed-off-by: default avatarSean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 434a1e94
...@@ -1021,6 +1021,7 @@ struct kvm_x86_ops { ...@@ -1021,6 +1021,7 @@ struct kvm_x86_ops {
void (*deliver_posted_interrupt)(struct kvm_vcpu *vcpu, int vector); void (*deliver_posted_interrupt)(struct kvm_vcpu *vcpu, int vector);
int (*sync_pir_to_irr)(struct kvm_vcpu *vcpu); int (*sync_pir_to_irr)(struct kvm_vcpu *vcpu);
int (*set_tss_addr)(struct kvm *kvm, unsigned int addr); int (*set_tss_addr)(struct kvm *kvm, unsigned int addr);
int (*set_identity_map_addr)(struct kvm *kvm, u64 ident_addr);
int (*get_tdp_level)(struct kvm_vcpu *vcpu); int (*get_tdp_level)(struct kvm_vcpu *vcpu);
u64 (*get_mt_mask)(struct kvm_vcpu *vcpu, gfn_t gfn, bool is_mmio); u64 (*get_mt_mask)(struct kvm_vcpu *vcpu, gfn_t gfn, bool is_mmio);
int (*get_lpage_level)(void); int (*get_lpage_level)(void);
......
...@@ -5269,6 +5269,11 @@ static int svm_set_tss_addr(struct kvm *kvm, unsigned int addr) ...@@ -5269,6 +5269,11 @@ static int svm_set_tss_addr(struct kvm *kvm, unsigned int addr)
return 0; return 0;
} }
static int svm_set_identity_map_addr(struct kvm *kvm, u64 ident_addr)
{
return 0;
}
static void svm_flush_tlb(struct kvm_vcpu *vcpu, bool invalidate_gpa) static void svm_flush_tlb(struct kvm_vcpu *vcpu, bool invalidate_gpa)
{ {
struct vcpu_svm *svm = to_svm(vcpu); struct vcpu_svm *svm = to_svm(vcpu);
...@@ -6959,6 +6964,7 @@ static struct kvm_x86_ops svm_x86_ops __ro_after_init = { ...@@ -6959,6 +6964,7 @@ static struct kvm_x86_ops svm_x86_ops __ro_after_init = {
.apicv_post_state_restore = avic_post_state_restore, .apicv_post_state_restore = avic_post_state_restore,
.set_tss_addr = svm_set_tss_addr, .set_tss_addr = svm_set_tss_addr,
.set_identity_map_addr = svm_set_identity_map_addr,
.get_tdp_level = get_npt_level, .get_tdp_level = get_npt_level,
.get_mt_mask = svm_get_mt_mask, .get_mt_mask = svm_get_mt_mask,
......
...@@ -6110,6 +6110,12 @@ static int vmx_set_tss_addr(struct kvm *kvm, unsigned int addr) ...@@ -6110,6 +6110,12 @@ static int vmx_set_tss_addr(struct kvm *kvm, unsigned int addr)
return init_rmode_tss(kvm); return init_rmode_tss(kvm);
} }
static int vmx_set_identity_map_addr(struct kvm *kvm, u64 ident_addr)
{
kvm->arch.ept_identity_map_addr = ident_addr;
return 0;
}
static bool rmode_exception(struct kvm_vcpu *vcpu, int vec) static bool rmode_exception(struct kvm_vcpu *vcpu, int vec)
{ {
switch (vec) { switch (vec) {
...@@ -12510,6 +12516,7 @@ static struct kvm_x86_ops vmx_x86_ops __ro_after_init = { ...@@ -12510,6 +12516,7 @@ static struct kvm_x86_ops vmx_x86_ops __ro_after_init = {
.deliver_posted_interrupt = vmx_deliver_posted_interrupt, .deliver_posted_interrupt = vmx_deliver_posted_interrupt,
.set_tss_addr = vmx_set_tss_addr, .set_tss_addr = vmx_set_tss_addr,
.set_identity_map_addr = vmx_set_identity_map_addr,
.get_tdp_level = get_ept_level, .get_tdp_level = get_ept_level,
.get_mt_mask = vmx_get_mt_mask, .get_mt_mask = vmx_get_mt_mask,
......
...@@ -3964,8 +3964,7 @@ static int kvm_vm_ioctl_set_tss_addr(struct kvm *kvm, unsigned long addr) ...@@ -3964,8 +3964,7 @@ static int kvm_vm_ioctl_set_tss_addr(struct kvm *kvm, unsigned long addr)
static int kvm_vm_ioctl_set_identity_map_addr(struct kvm *kvm, static int kvm_vm_ioctl_set_identity_map_addr(struct kvm *kvm,
u64 ident_addr) u64 ident_addr)
{ {
kvm->arch.ept_identity_map_addr = ident_addr; return kvm_x86_ops->set_identity_map_addr(kvm, ident_addr);
return 0;
} }
static int kvm_vm_ioctl_set_nr_mmu_pages(struct kvm *kvm, static int kvm_vm_ioctl_set_nr_mmu_pages(struct kvm *kvm,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment