|
|
1c0632 |
From 9eb5a31bc2d7f6af88459b89c414fe144e7491f8 Mon Sep 17 00:00:00 2001
|
|
|
1c0632 |
From: Kazuhito Hagio <k-hagio@ab.jp.nec.com>
|
|
|
1c0632 |
Date: Thu, 8 Nov 2018 14:26:43 -0500
|
|
|
1c0632 |
Subject: [PATCH] [PATCH] Prepare paddr_to_vaddr() for arch-specific p2v conversion
|
|
|
1c0632 |
|
|
|
1c0632 |
Currently, conversion from physical address to virtual address in
|
|
|
1c0632 |
--mem-usage option is "paddr + PAGE_OFFSET", which was written for
|
|
|
1c0632 |
x86_64, but it's not suitable especially for arm64.
|
|
|
1c0632 |
|
|
|
1c0632 |
This patch introduces paddr_to_vaddr() macro to get prepared for
|
|
|
1c0632 |
arch-specific physical to virtual conversion.
|
|
|
1c0632 |
|
|
|
1c0632 |
Tested-by: Bhupesh Sharma <bhsharma@redhat.com>
|
|
|
1c0632 |
Signed-off-by: Kazuhito Hagio <k-hagio@ab.jp.nec.com>
|
|
|
1c0632 |
---
|
|
|
1c0632 |
elf_info.c | 7 ++++---
|
|
|
1c0632 |
makedumpfile.h | 11 +++++++++++
|
|
|
1c0632 |
2 files changed, 15 insertions(+), 3 deletions(-)
|
|
|
1c0632 |
|
|
|
1c0632 |
diff --git a/makedumpfile-1.6.2/elf_info.c b/makedumpfile-1.6.2/elf_info.c
|
|
|
1c0632 |
index 711601a170c7..1d33e96684b6 100644
|
|
|
1c0632 |
--- a/makedumpfile-1.6.2/elf_info.c
|
|
|
1c0632 |
+++ b/makedumpfile-1.6.2/elf_info.c
|
|
|
1c0632 |
@@ -372,7 +372,7 @@ int set_kcore_vmcoreinfo(uint64_t vmcoreinfo_addr, uint64_t vmcoreinfo_len)
|
|
|
1c0632 |
off_t offset_desc;
|
|
|
1c0632 |
|
|
|
1c0632 |
offset = UNINITIALIZED;
|
|
|
1c0632 |
- kvaddr = (ulong)vmcoreinfo_addr + PAGE_OFFSET;
|
|
|
1c0632 |
+ kvaddr = paddr_to_vaddr(vmcoreinfo_addr);
|
|
|
1c0632 |
|
|
|
1c0632 |
for (i = 0; i < num_pt_loads; ++i) {
|
|
|
1c0632 |
struct pt_load_segment *p = &pt_loads[i];
|
|
|
1c0632 |
@@ -810,10 +810,11 @@ static int exclude_segment(struct pt_load_segment **pt_loads,
|
|
|
1c0632 |
int i, j, tidx = -1;
|
|
|
1c0632 |
unsigned long long vstart, vend, kvstart, kvend;
|
|
|
1c0632 |
struct pt_load_segment temp_seg = {0};
|
|
|
1c0632 |
- kvstart = (ulong)start + PAGE_OFFSET;
|
|
|
1c0632 |
- kvend = (ulong)end + PAGE_OFFSET;
|
|
|
1c0632 |
unsigned long size;
|
|
|
1c0632 |
|
|
|
1c0632 |
+ kvstart = paddr_to_vaddr(start);
|
|
|
1c0632 |
+ kvend = paddr_to_vaddr(end);
|
|
|
1c0632 |
+
|
|
|
1c0632 |
for (i = 0; i < (*num_pt_loads); i++) {
|
|
|
1c0632 |
vstart = (*pt_loads)[i].virt_start;
|
|
|
1c0632 |
vend = (*pt_loads)[i].virt_end;
|
|
|
1c0632 |
diff --git a/makedumpfile-1.6.2/makedumpfile.h b/makedumpfile-1.6.2/makedumpfile.h
|
|
|
1c0632 |
index 5f7a1dcf3b2f..010a9ce302bd 100644
|
|
|
1c0632 |
--- a/makedumpfile-1.6.2/makedumpfile.h
|
|
|
1c0632 |
+++ b/makedumpfile-1.6.2/makedumpfile.h
|
|
|
1c0632 |
@@ -929,6 +929,8 @@ typedef unsigned long pgd_t;
|
|
|
1c0632 |
static inline int stub_true() { return TRUE; }
|
|
|
1c0632 |
static inline int stub_true_ul(unsigned long x) { return TRUE; }
|
|
|
1c0632 |
static inline int stub_false() { return FALSE; }
|
|
|
1c0632 |
+#define paddr_to_vaddr_general(X) ((X) + PAGE_OFFSET)
|
|
|
1c0632 |
+
|
|
|
1c0632 |
#ifdef __aarch64__
|
|
|
1c0632 |
int get_phys_base_arm64(void);
|
|
|
1c0632 |
int get_machdep_info_arm64(void);
|
|
|
1c0632 |
@@ -938,6 +940,7 @@ int get_xen_basic_info_arm64(void);
|
|
|
1c0632 |
int get_xen_info_arm64(void);
|
|
|
1c0632 |
#define find_vmemmap() stub_false()
|
|
|
1c0632 |
#define vaddr_to_paddr(X) vaddr_to_paddr_arm64(X)
|
|
|
1c0632 |
+#define paddr_to_vaddr(X) paddr_to_vaddr_general(X)
|
|
|
1c0632 |
#define get_phys_base() get_phys_base_arm64()
|
|
|
1c0632 |
#define get_machdep_info() get_machdep_info_arm64()
|
|
|
1c0632 |
#define get_versiondep_info() get_versiondep_info_arm64()
|
|
|
1c0632 |
@@ -958,6 +961,7 @@ unsigned long long vaddr_to_paddr_arm(unsigned long vaddr);
|
|
|
1c0632 |
#define get_versiondep_info() stub_true()
|
|
|
1c0632 |
#define get_kaslr_offset(X) stub_false()
|
|
|
1c0632 |
#define vaddr_to_paddr(X) vaddr_to_paddr_arm(X)
|
|
|
1c0632 |
+#define paddr_to_vaddr(X) paddr_to_vaddr_general(X)
|
|
|
1c0632 |
#define is_phys_addr(X) stub_true_ul(X)
|
|
|
1c0632 |
#define arch_crashkernel_mem_size() stub_false()
|
|
|
1c0632 |
#endif /* arm */
|
|
|
1c0632 |
@@ -972,6 +976,7 @@ unsigned long long vaddr_to_paddr_x86(unsigned long vaddr);
|
|
|
1c0632 |
#define get_versiondep_info() get_versiondep_info_x86()
|
|
|
1c0632 |
#define get_kaslr_offset(X) stub_false()
|
|
|
1c0632 |
#define vaddr_to_paddr(X) vaddr_to_paddr_x86(X)
|
|
|
1c0632 |
+#define paddr_to_vaddr(X) paddr_to_vaddr_general(X)
|
|
|
1c0632 |
#define is_phys_addr(X) stub_true_ul(X)
|
|
|
1c0632 |
#define arch_crashkernel_mem_size() stub_false()
|
|
|
1c0632 |
#endif /* x86 */
|
|
|
1c0632 |
@@ -989,6 +994,7 @@ unsigned long long vtop4_x86_64_pagetable(unsigned long vaddr, unsigned long pag
|
|
|
1c0632 |
#define get_versiondep_info() get_versiondep_info_x86_64()
|
|
|
1c0632 |
#define get_kaslr_offset(X) get_kaslr_offset_x86_64(X)
|
|
|
1c0632 |
#define vaddr_to_paddr(X) vtop4_x86_64(X)
|
|
|
1c0632 |
+#define paddr_to_vaddr(X) paddr_to_vaddr_general(X)
|
|
|
1c0632 |
#define is_phys_addr(X) stub_true_ul(X)
|
|
|
1c0632 |
#define arch_crashkernel_mem_size() stub_false()
|
|
|
1c0632 |
#endif /* x86_64 */
|
|
|
1c0632 |
@@ -1004,6 +1010,7 @@ int arch_crashkernel_mem_size_ppc64(void);
|
|
|
1c0632 |
#define get_versiondep_info() get_versiondep_info_ppc64()
|
|
|
1c0632 |
#define get_kaslr_offset(X) stub_false()
|
|
|
1c0632 |
#define vaddr_to_paddr(X) vaddr_to_paddr_ppc64(X)
|
|
|
1c0632 |
+#define paddr_to_vaddr(X) paddr_to_vaddr_general(X)
|
|
|
1c0632 |
#define is_phys_addr(X) stub_true_ul(X)
|
|
|
1c0632 |
#define arch_crashkernel_mem_size() arch_crashkernel_mem_size_ppc64()
|
|
|
1c0632 |
#endif /* powerpc64 */
|
|
|
1c0632 |
@@ -1017,6 +1024,7 @@ unsigned long long vaddr_to_paddr_ppc(unsigned long vaddr);
|
|
|
1c0632 |
#define get_versiondep_info() stub_true()
|
|
|
1c0632 |
#define get_kaslr_offset(X) stub_false()
|
|
|
1c0632 |
#define vaddr_to_paddr(X) vaddr_to_paddr_ppc(X)
|
|
|
1c0632 |
+#define paddr_to_vaddr(X) paddr_to_vaddr_general(X)
|
|
|
1c0632 |
#define is_phys_addr(X) stub_true_ul(X)
|
|
|
1c0632 |
#define arch_crashkernel_mem_size() stub_false()
|
|
|
1c0632 |
#endif /* powerpc32 */
|
|
|
1c0632 |
@@ -1031,6 +1039,7 @@ int is_iomem_phys_addr_s390x(unsigned long addr);
|
|
|
1c0632 |
#define get_versiondep_info() stub_true()
|
|
|
1c0632 |
#define get_kaslr_offset(X) stub_false()
|
|
|
1c0632 |
#define vaddr_to_paddr(X) vaddr_to_paddr_s390x(X)
|
|
|
1c0632 |
+#define paddr_to_vaddr(X) paddr_to_vaddr_general(X)
|
|
|
1c0632 |
#define is_phys_addr(X) is_iomem_phys_addr_s390x(X)
|
|
|
1c0632 |
#define arch_crashkernel_mem_size() stub_false()
|
|
|
1c0632 |
#endif /* s390x */
|
|
|
1c0632 |
@@ -1045,6 +1054,7 @@ unsigned long long vaddr_to_paddr_ia64(unsigned long vaddr);
|
|
|
1c0632 |
#define get_versiondep_info() stub_true()
|
|
|
1c0632 |
#define get_kaslr_offset(X) stub_false()
|
|
|
1c0632 |
#define vaddr_to_paddr(X) vaddr_to_paddr_ia64(X)
|
|
|
1c0632 |
+#define paddr_to_vaddr(X) paddr_to_vaddr_general(X)
|
|
|
1c0632 |
#define VADDR_REGION(X) (((unsigned long)(X)) >> REGION_SHIFT)
|
|
|
1c0632 |
#define is_phys_addr(X) stub_true_ul(X)
|
|
|
1c0632 |
#define arch_crashkernel_mem_size() stub_false()
|
|
|
1c0632 |
@@ -1059,6 +1069,7 @@ unsigned long long vaddr_to_paddr_sparc64(unsigned long vaddr);
|
|
|
1c0632 |
#define get_phys_base() get_phys_base_sparc64()
|
|
|
1c0632 |
#define get_versiondep_info() get_versiondep_info_sparc64()
|
|
|
1c0632 |
#define vaddr_to_paddr(X) vaddr_to_paddr_sparc64(X)
|
|
|
1c0632 |
+#define paddr_to_vaddr(X) paddr_to_vaddr_general(X)
|
|
|
1c0632 |
#define is_phys_addr(X) stub_true_ul(X)
|
|
|
1c0632 |
#define arch_crashkernel_mem_size() stub_false()
|
|
|
1c0632 |
#endif /* sparc64 */
|
|
|
1c0632 |
--
|
|
|
1c0632 |
2.7.4
|