From: Hou Wenlong <houwenlong93@linux.alibaba.com>
To: kvm@vger.kernel.org
Cc: Sean Christopherson <seanjc@google.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Vitaly Kuznetsov <vkuznets@redhat.com>,
Wanpeng Li <wanpengli@tencent.com>,
Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH v2 2/2] kvm: x86: move architecture specific code into kvm_arch_vcpu_fault
Date: Thu, 12 Aug 2021 12:02:20 +0800 [thread overview]
Message-ID: <146fab9b48eb8554202f91785d0e009757439baf.1628739116.git.houwenlong93@linux.alibaba.com> (raw)
In-Reply-To: <1c510b24fc1d7cbae8aa4b69c0799ebd32e65b82.1628739116.git.houwenlong93@linux.alibaba.com>
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@google.com>
Signed-off-by: Hou Wenlong <houwenlong93@linux.alibaba.com>
---
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
next prev parent reply other threads:[~2021-08-12 4:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-11 3:17 [PATCH] kvm: x86: move architecture-specific " Hou Wenlong
2021-08-11 18:52 ` Sean Christopherson
2021-08-12 4:02 ` [PATCH v2 1/2] KVM: Refactor kvm_arch_vcpu_fault() to return a struct page pointer Hou Wenlong
2021-08-12 4:02 ` Hou Wenlong [this message]
2021-08-12 9:04 ` David Hildenbrand
2021-08-12 15:41 ` Paolo Bonzini
2021-08-23 14:12 ` Christian Borntraeger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=146fab9b48eb8554202f91785d0e009757439baf.1628739116.git.houwenlong93@linux.alibaba.com \
--to=houwenlong93@linux.alibaba.com \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=tglx@linutronix.de \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®