All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Fang <peter.fang@intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
	Sean Christopherson <seanjc@google.com>,
	Madhavan Srinivasan <maddy@linux.ibm.com>,
	"Nicholas Piggin" <npiggin@gmail.com>
Cc: Yosry Ahmed <yosry@kernel.org>,
	Ritesh Harjani <ritesh.list@gmail.com>,
	Michael Ellerman <mpe@ellerman.id.au>,
	"Christophe Leroy (CS GROUP)" <chleroy@kernel.org>,
	Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>, <x86@kernel.org>,
	"H. Peter Anvin" <hpa@zytor.com>, <kvm@vger.kernel.org>,
	<linuxppc-dev@lists.ozlabs.org>, <linux-kernel@vger.kernel.org>,
	Peter Fang <peter.fang@intel.com>
Subject: [PATCH v2 2/3] KVM: Move page mapping/unmapping APIs in kvm_host.h
Date: Tue, 7 Apr 2026 17:11:29 -0700	[thread overview]
Message-ID: <20260408001137.3290444-3-peter.fang@intel.com> (raw)
In-Reply-To: <20260408001137.3290444-1-peter.fang@intel.com>

Move kvm_vcpu_map*() and kvm_vcpu_unmap() so that a subsequent refactor
can use gpa_to_gfn() without a forward declaration.

No functional change intended.

Signed-off-by: Peter Fang <peter.fang@intel.com>
---
 include/linux/kvm_host.h | 46 ++++++++++++++++++++--------------------
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 4e3bea92a06b..484378cfdcc0 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -1382,29 +1382,6 @@ void mark_page_dirty_in_slot(struct kvm *kvm, const struct kvm_memory_slot *mems
 void mark_page_dirty(struct kvm *kvm, gfn_t gfn);
 void kvm_vcpu_mark_page_dirty(struct kvm_vcpu *vcpu, gfn_t gfn);
 
-int __kvm_vcpu_map(struct kvm_vcpu *vcpu, gfn_t gfn, struct kvm_host_map *map,
-		   bool writable);
-void kvm_vcpu_unmap(struct kvm_vcpu *vcpu, struct kvm_host_map *map);
-
-static inline int kvm_vcpu_map(struct kvm_vcpu *vcpu, gfn_t gfn,
-			       struct kvm_host_map *map)
-{
-	return __kvm_vcpu_map(vcpu, gfn, map, true);
-}
-
-static inline int kvm_vcpu_map_readonly(struct kvm_vcpu *vcpu, gfn_t gfn,
-					struct kvm_host_map *map)
-{
-	return __kvm_vcpu_map(vcpu, gfn, map, false);
-}
-
-static inline void kvm_vcpu_map_mark_dirty(struct kvm_vcpu *vcpu,
-					   struct kvm_host_map *map)
-{
-	if (kvm_vcpu_mapped(map))
-		kvm_vcpu_mark_page_dirty(vcpu, map->gfn);
-}
-
 unsigned long kvm_vcpu_gfn_to_hva(struct kvm_vcpu *vcpu, gfn_t gfn);
 unsigned long kvm_vcpu_gfn_to_hva_prot(struct kvm_vcpu *vcpu, gfn_t gfn, bool *writable);
 int kvm_vcpu_read_guest_page(struct kvm_vcpu *vcpu, gfn_t gfn, void *data, int offset,
@@ -1916,6 +1893,29 @@ static inline hpa_t pfn_to_hpa(kvm_pfn_t pfn)
 	return (hpa_t)pfn << PAGE_SHIFT;
 }
 
+int __kvm_vcpu_map(struct kvm_vcpu *vcpu, gfn_t gfn, struct kvm_host_map *map,
+		   bool writable);
+void kvm_vcpu_unmap(struct kvm_vcpu *vcpu, struct kvm_host_map *map);
+
+static inline int kvm_vcpu_map(struct kvm_vcpu *vcpu, gfn_t gfn,
+			       struct kvm_host_map *map)
+{
+	return __kvm_vcpu_map(vcpu, gfn, map, true);
+}
+
+static inline int kvm_vcpu_map_readonly(struct kvm_vcpu *vcpu, gfn_t gfn,
+					struct kvm_host_map *map)
+{
+	return __kvm_vcpu_map(vcpu, gfn, map, false);
+}
+
+static inline void kvm_vcpu_map_mark_dirty(struct kvm_vcpu *vcpu,
+					   struct kvm_host_map *map)
+{
+	if (kvm_vcpu_mapped(map))
+		kvm_vcpu_mark_page_dirty(vcpu, map->gfn);
+}
+
 static inline bool kvm_is_gpa_in_memslot(struct kvm *kvm, gpa_t gpa)
 {
 	unsigned long hva = gfn_to_hva(kvm, gpa_to_gfn(gpa));
-- 
2.53.0


  parent reply	other threads:[~2026-04-08  0:12 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-08  0:11 [PATCH v2 0/3] KVM: Fix and clean up kvm_vcpu_map[_readonly]() usages Peter Fang
2026-04-08  0:11 ` [PATCH v2 1/3] KVM: Fix kvm_vcpu_map[_readonly]() function prototypes Peter Fang
2026-04-21 23:05   ` Yosry Ahmed
2026-04-08  0:11 ` Peter Fang [this message]
2026-04-21 23:06   ` [PATCH v2 2/3] KVM: Move page mapping/unmapping APIs in kvm_host.h Yosry Ahmed
2026-04-08  0:11 ` [PATCH v2 3/3] KVM: Take gpa_t in kvm_vcpu_map[_readonly]() Peter Fang
2026-04-21 23:08   ` Yosry Ahmed
2026-04-21 23:19     ` Sean Christopherson
2026-04-21 23:25       ` Yosry Ahmed
2026-04-21 23:29       ` Sean Christopherson
2026-04-21 23:41         ` Yosry Ahmed
2026-04-22  0:27           ` Sean Christopherson
2026-04-22 20:19             ` Yosry Ahmed
2026-04-22 20:34               ` Sean Christopherson
2026-04-22 21:44                 ` Yosry Ahmed
2026-04-22 22:17                   ` Sean Christopherson
2026-04-22 22:19                     ` Yosry Ahmed
2026-04-23  7:49               ` Peter Fang
2026-04-24  8:25   ` Gautam Menghani
2026-04-25  4:25     ` Peter Fang
2026-04-24 10:27 ` [PATCH v2 0/3] KVM: Fix and clean up kvm_vcpu_map[_readonly]() usages David Woodhouse
2026-04-27  8:05   ` Peter Fang
2026-05-04 17:59     ` Sean Christopherson
2026-05-07  8:18       ` Peter Fang
2026-05-13 17:33         ` Sean Christopherson

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=20260408001137.3290444-3-peter.fang@intel.com \
    --to=peter.fang@intel.com \
    --cc=bp@alien8.de \
    --cc=chleroy@kernel.org \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.ibm.com \
    --cc=mingo@redhat.com \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=ritesh.list@gmail.com \
    --cc=seanjc@google.com \
    --cc=tglx@kernel.org \
    --cc=x86@kernel.org \
    --cc=yosry@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.