diff mbox

[kvm-unit-tests,RFC,04/10] x86: Remove virt_to_phys_cr3() interface

Message ID 1483288652-18983-5-git-send-email-agordeev@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Alexander Gordeev Jan. 1, 2017, 4:37 p.m. UTC
Public interface virt_to_phys_cr3() is only used in asyncpf
test and does not make much sense for the rest of the code.
This update turns it local to asyncpf only.

Cc: Radim Krčmář <rkrcmar@redhat.com>
Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
---
 lib/x86/vm.c  | 5 -----
 lib/x86/vm.h  | 1 -
 x86/asyncpf.c | 5 +++++
 3 files changed, 5 insertions(+), 6 deletions(-)
diff mbox

Patch

diff --git a/lib/x86/vm.c b/lib/x86/vm.c
index 72f6b380bb79..c1448d7a2766 100644
--- a/lib/x86/vm.c
+++ b/lib/x86/vm.c
@@ -178,11 +178,6 @@  void *vmalloc(unsigned long size)
     return mem;
 }
 
-uint64_t virt_to_phys_cr3(void *mem)
-{
-    return (*get_pte(phys_to_virt(read_cr3()), mem) & PT_ADDR_MASK) + ((ulong)mem & (PAGE_SIZE - 1));
-}
-
 void vfree(void *mem)
 {
     unsigned long size = ((unsigned long *)mem)[-1];
diff --git a/lib/x86/vm.h b/lib/x86/vm.h
index 2418311b25f5..427da661cf69 100644
--- a/lib/x86/vm.h
+++ b/lib/x86/vm.h
@@ -12,7 +12,6 @@  void vfree(void *mem);
 void *vmap(unsigned long long phys, unsigned long size);
 void *alloc_vpage(void);
 void *alloc_vpages(ulong nr);
-uint64_t virt_to_phys_cr3(void *mem);
 
 unsigned long *get_pte(unsigned long *cr3, void *virt);
 unsigned long *install_pte(unsigned long *cr3,
diff --git a/x86/asyncpf.c b/x86/asyncpf.c
index 3b1bcb007ded..2f857a2a07ab 100644
--- a/x86/asyncpf.c
+++ b/x86/asyncpf.c
@@ -45,6 +45,11 @@  static inline uint32_t get_apf_reason(void)
 	return r;
 }
 
+static uint64_t virt_to_phys_cr3(void *mem)
+{
+    return (*get_pte(phys_to_virt(read_cr3()), mem) & PT_ADDR_MASK) + ((ulong)mem & (PAGE_SIZE - 1));
+}
+
 static void pf_isr(struct ex_regs *r)
 {
 	void* virt = (void*)((ulong)(buf+i) & ~(PAGE_SIZE-1));