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

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

 



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@xxxxxxxxxx>
Signed-off-by: Alexander Gordeev <agordeev@xxxxxxxxxx>
---
 lib/x86/vm.c  | 5 -----
 lib/x86/vm.h  | 1 -
 x86/asyncpf.c | 5 +++++
 3 files changed, 5 insertions(+), 6 deletions(-)

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));
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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