[PATCH v2 2/2] kvm: x86: move architecture specific code into kvm_arch_vcpu_fault

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The function kvm_arch_vcpu_fault can handle architecture specific
case, so move x86's pio_data hanlding into it.

Suggested-by: Sean Christopherson <seanjc@xxxxxxxxxx>
Signed-off-by: Hou Wenlong <houwenlong93@xxxxxxxxxxxxxxxxx>
---
 arch/x86/kvm/x86.c  | 2 ++
 virt/kvm/kvm_main.c | 4 ----
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 1e3bbe5cd33a..25c0752d6cd9 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -5349,6 +5349,8 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
 
 struct page *kvm_arch_vcpu_fault(struct kvm_vcpu *vcpu, struct vm_fault *vmf)
 {
+	if (vmf->pgoff == KVM_PIO_PAGE_OFFSET)
+		return virt_to_page(vcpu->arch.pio_data);
 	return NULL;
 }
 
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index f7d21418971b..43064df5ad87 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -3435,10 +3435,6 @@ static vm_fault_t kvm_vcpu_fault(struct vm_fault *vmf)
 
 	if (vmf->pgoff == 0)
 		page = virt_to_page(vcpu->run);
-#ifdef CONFIG_X86
-	else if (vmf->pgoff == KVM_PIO_PAGE_OFFSET)
-		page = virt_to_page(vcpu->arch.pio_data);
-#endif
 #ifdef CONFIG_KVM_MMIO
 	else if (vmf->pgoff == KVM_COALESCED_MMIO_PAGE_OFFSET)
 		page = virt_to_page(vcpu->kvm->coalesced_mmio_ring);
-- 
2.31.1




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux