kexec: add phys_offset field
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): 610318244.20851272563381903.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com
Quoted 6 lines · ----- "Mika Westerberg
So how about following? This allows ARM (and maybe some future archs as well) to redefine
phys_to_virt()but default implementation should work with others.Thanks,
MW
Looks like a reasonable approach to me.
BTW, your phys_to_virt() function comments read: "virt_to_phys".
Thanks,
Dave
Quoted 85 lines
Quoted 2 lines
From
dcfda0e78ae9bfe3c9ff5d186c660e5ce1892fbbMon Sep 17 00:00:00 2001From: Mika Westerberg <[email protected]>
Date: Thu, 29 Apr 2010 11:07:14 +0300
Subject: [PATCH] kexec: introducephys_to_virt()functionThis function is used by ELF crashdump code which prepares crash memory headers for the dump capture kernel. Most architecture can use default version which just adds
PAGE_OFFSETto the virtual address but some architectures might need some special handling.Signed-off-by Mika Westerberg <[email protected]>--- kexec/Makefile | 2 ++ kexec/crashdump-elf.c | 2 +- kexec/crashdump.h | 3 +++ kexec/phys_to_virt.c | 16 ++++++++++++++++ 4 files changed, 22 insertions(+), 1 deletions(-) create mode 100644 kexec/phys_to_virt.ckexec/Makefile +2
-0@@ -39,6 +39,8 @@ $(ARCH)_PROC_IOMEM = kexec/proc_iomem.c KEXEC_SRCS += $($(ARCH)_PROC_IOMEM) $(ARCH)_VIRT_TO_PHYS = kexec/virt_to_phys.c KEXEC_SRCS += $($(ARCH)_VIRT_TO_PHYS) +$(ARCH)_PHYS_TO_VIRT = kexec/phys_to_virt.c +KEXEC_SRCS += $($(ARCH)_PHYS_TO_VIRT) $(ARCH)_ADD_SEGMENT = kexec/add_segment.c KEXEC_SRCS += $($(ARCH)_ADD_SEGMENT) $(ARCH)_ADD_BUFFER = kexec/add_buffer.ckexec/crashdump-elf.c +1
-1@@ -236,7 +236,7 @@ int FUNC(struct kexec_info *info,* memory region. */ phdr->p_paddr = mstart; - phdr->p_vaddr = mstart + elf_info->page_offset; + phdr->p_vaddr =phys_to_virt (elf_info, mstart); phdr->p_filesz = phdr->p_memsz = mend - mstart +1 ;/* Do we need any alignment of segments? */ phdr->p_align =0 ;kexec/crashdump.h +3
-0@@ -46,6 +46,9 @@ int crash_create_elf64_headers(struct kexec_info *info, unsigned long crash_architecture(struct crash_elf_info *elf_info); +unsigned long phys_to_virt (struct crash_elf_info *elf_info, +unsigned long paddr); +int xen_present (void );unsigned long xen_architecture (struct crash_elf_info *elf_info);int
xen_get_nr_phys_cpus(void);kexec/phys_to_virt.c new file +16
-0@@ -0,0 +1,16 @@ +#include "kexec.h" +#include "crashdump.h" + +/** +* virt_to_phys() - translate physical address to virtual address +* @paddr: physical address to translate +* +* For most architectures physical address is simply virtual address minus +* PAGE_OFFSET. Architectures that don't follow this convention should provide +* their own implementation. +*/ +unsigned long +phys_to_virt (struct crash_elf_info *elf_info,unsigned long paddr) +{ +return paddr + elf_info->page_offset; +}Signature · 1 line
1.5.6.5
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec