* RE: 82xx performance
From: Rune Torgersen @ 2008-07-17 19:54 UTC (permalink / raw)
To: Arnd Bergmann, linuxppc-dev; +Cc: Milton Miller
In-Reply-To: <200807172143.57576.arnd@arndb.de>
Arnd Bergmann wrote:
> So again, nothing conclusive. I'm running out of ideas.
Is the syscall path different or the same on ppc and powerpc?
Any differences in the task switching, irq handling or page fault
handling?
^ permalink raw reply
* Re: 82xx performance
From: Arnd Bergmann @ 2008-07-17 19:43 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Milton Miller
In-Reply-To: <DCEAAC0833DD314AB0B58112AD99B93B04B34D32@ismail.innsys.innovsys.com>
On Thursday 17 July 2008, Rune Torgersen wrote:
> Arnd Bergmann wrote:
> > Seeing more hits in handle_mm_fault suggests that you have
> > a higher page fault rate. A trivial reason for this might
> > be that the amount of memory was misdetected in the new
> > code (maybe broken device tree). What is the content of
> > /proc/meminfo after a fresh boot?
> Powerpc
> VmallocTotal: 474756 kB
> Ppc
> VmallocTotal: 245696 kB
This seems to be the only significant difference here, but
I don't see how it can make an impact on performance.
> User time (seconds): 4339.11
> User time (seconds): 4177.11
3.8% slowdown
> System time (seconds): 319.41
> System time (seconds): 295.00
8.2% slowdown
> Elapsed (wall clock) time (h:mm:ss or m:ss): 1:17:42
> Elapsed (wall clock) time (h:mm:ss or m:ss): 1:14:35
4% slowdown
> Minor (reclaiming a frame) page faults: 4213347
> Minor (reclaiming a frame) page faults: 4203103
slightly more faults
> Voluntary context switches: 53543
> Voluntary context switches: 53812
This actually went down by 0.5%, both of these are well within
the expected
> Involuntary context switches: 90165
> Involuntary context switches: 85856
4.8% more context switches, probably a side-effect of the longer
run-time.
So again, nothing conclusive. I'm running out of ideas.
Arnd <><
^ permalink raw reply
* Re: mpc5200b PSC interrupt load on high baud rates
From: Grant Likely @ 2008-07-17 19:43 UTC (permalink / raw)
To: Oliver Rutsch; +Cc: Linuxppc-dev
In-Reply-To: <487F0A97.9050102@sympatec.com>
On Thu, Jul 17, 2008 at 11:02:15AM +0200, Oliver Rutsch wrote:
> Hi,
>
> We're using the latest 2.4.25-Kernel from DENX on a custom mpc5200b board.
> We have a RS485 device which sends continuously its data at a rate of
> 1.25 MBit/s. The problem here is that it takes nearly 90% of system time
> just to read these data. I had a look into the driver
> (arch/ppc/5xxx_io/psc.c) and the problem seems to be the RxRDY interrupt
> of the PSCs. This interrupt is inserted every time when there's any data
> in the FIFO. I found out, that most of the time the isr is reading only
> 1 or 2 bytes out of the FIFO, so the system is very busy to serve
> thousands of interrupts.
> Then I set the FFULL flag as the interrupt source in the mr1 register of
> the PSC. I set an rx alarm level of 112 bytes (means that an interrupt
> will be generated when FIFO>=400 bytes!) and rx granularity of 7.
> With this the system load drops down under 1 percent!
> But this approach has one big drawback: There will be no interrupt if I
> receive less than 400 bytes. So this is not usable for "normal" SIO
> operation.
> Although not tested it looks like the same problem is in the driver for
> the 2.6.25-Kernel (correct me when I'm wrong here).
> So I have two ideas for better performance of this driver:
>
> 1. The interrupt will be generated by the FFULL flag. An endless kernel
> timer will have every jiffy a look at the PSC FIFO status and pull out
> any data if necessary. A look on the PSC FIFO status is a very short
> operation so this timer shouldn't affect the system performance too
> much. But maybe this adds some more latency when receiving only a few
> bytes.
This is the approach I would take.
BTW, if you want to fix this in mainline, then you'll need to migrate to
arch/powerpc. arch/ppc is now removed from mainline.
g.
^ permalink raw reply
* Re: [PATCH] elf loader support for auxvec base platform string
From: Nathan Lynch @ 2008-07-17 19:35 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Andrew Morton, linux-kernel, roland, linuxppc-dev
In-Reply-To: <alpine.LFD.1.10.0807170908060.2959@woody.linux-foundation.org>
Linus Torvalds wrote:
>
>
> On Thu, 17 Jul 2008, Benjamin Herrenschmidt wrote:
> >
> > Should I seek somebody's ack before merging a patch like the one below ?
> >
> > I'm a bit reluctant to merge via the powerpc.git tree some changes to
> > generic files without at least an ack from somebody else :-)
>
> Gaah. Generally we don't, but you're right to ask. The ELF loading keeps
> on accumulating these things, and I'm not sure we have the right process
> for things like this. They're all individually small and insignificant,
> and they are all individually never going away and making the ELF loader
> messier and messier.
FWIW, I was initially reluctant to do it this way, but the ELF aux
vector seems to be the only reasonable mechanism for getting this
information to all interested users. And the only reason the patch
touches the generic code is because we have to copy a string to
userspace (just like AT_PLATFORM). Otherwise it could be done in
powerpc's ARCH_DLINFO.
^ permalink raw reply
* [RFC v3 PATCH 4/4] Relocation support
From: Mohan Kumar M @ 2008-07-17 18:48 UTC (permalink / raw)
To: ppcdev; +Cc: paulus, miltonm
In-Reply-To: <20080717183339.GA25070@in.ibm.com>
Relocation support
This patch changes all LOAD_REG_ADDR macro calls to LOAD_REG_IMMEDIATE
to make sure that we load the correct address. It also takes care of
when accessing absolute symbols in the code by adding the relocation
kernel base address.
Signed-off-by: Mohan Kumar M <mohan@in.ibm.com>
---
arch/powerpc/kernel/crash_dump.c | 19 +++++++++
arch/powerpc/kernel/entry_64.S | 4 +-
arch/powerpc/kernel/head_64.S | 63 ++++++++++++++++++++++++++++----
arch/powerpc/kernel/iommu.c | 7 ++-
arch/powerpc/kernel/machine_kexec.c | 5 ++
arch/powerpc/kernel/machine_kexec_64.c | 4 +-
arch/powerpc/kernel/misc.S | 40 ++++++++++++++++----
arch/powerpc/kernel/prom.c | 13 ++++++
arch/powerpc/kernel/prom_init.c | 27 +++++++++++--
arch/powerpc/kernel/prom_init_check.sh | 2 -
arch/powerpc/kernel/setup_64.c | 5 +-
arch/powerpc/mm/hash_low_64.S | 8 ++--
arch/powerpc/mm/hash_utils_64.c | 5 +-
arch/powerpc/mm/init_64.c | 7 ++-
arch/powerpc/mm/mem.c | 3 +
arch/powerpc/mm/slb_low.S | 2 -
arch/powerpc/platforms/pseries/hvCall.S | 2 -
arch/powerpc/platforms/pseries/iommu.c | 5 ++
include/asm-powerpc/exception.h | 6 ---
include/asm-powerpc/prom.h | 2 +
include/asm-powerpc/sections.h | 4 +-
include/asm-powerpc/system.h | 5 ++
22 files changed, 189 insertions(+), 49 deletions(-)
Index: linux-2.6.26/arch/powerpc/kernel/crash_dump.c
===================================================================
--- linux-2.6.26.orig/arch/powerpc/kernel/crash_dump.c
+++ linux-2.6.26/arch/powerpc/kernel/crash_dump.c
@@ -28,7 +28,12 @@
void __init reserve_kdump_trampoline(void)
{
+#ifdef CONFIG_RELOCATABLE_PPC64
+ if (RELOC(reloc_delta))
+ lmb_reserve(0, KDUMP_RESERVE_LIMIT);
+#else
lmb_reserve(0, KDUMP_RESERVE_LIMIT);
+#endif
}
static void __init create_trampoline(unsigned long addr)
@@ -42,7 +47,11 @@ static void __init create_trampoline(uns
* two instructions it doesn't require any registers.
*/
create_instruction(addr, 0x60000000); /* nop */
+#ifndef CONFIG_RELOCATABLE_PPC64
create_branch(addr + 4, addr + PHYSICAL_START, 0);
+#else
+ create_branch(addr + 4, addr + RELOC(reloc_delta), 0);
+#endif
}
void __init setup_kdump_trampoline(void)
@@ -51,13 +60,23 @@ void __init setup_kdump_trampoline(void)
DBG(" -> setup_kdump_trampoline()\n");
+#ifdef CONFIG_RELOCATABLE_PPC64
+ if (!RELOC(reloc_delta))
+ return;
+#endif
+
for (i = KDUMP_TRAMPOLINE_START; i < KDUMP_TRAMPOLINE_END; i += 8) {
create_trampoline(i);
}
#ifdef CONFIG_PPC_PSERIES
+#ifndef CONFIG_RELOCATABLE_PPC64
create_trampoline(__pa(system_reset_fwnmi) - PHYSICAL_START);
create_trampoline(__pa(machine_check_fwnmi) - PHYSICAL_START);
+#else
+ create_trampoline(__pa(system_reset_fwnmi) - RELOC(reloc_delta));
+ create_trampoline(__pa(machine_check_fwnmi) - RELOC(reloc_delta));
+#endif
#endif /* CONFIG_PPC_PSERIES */
DBG(" <- setup_kdump_trampoline()\n");
Index: linux-2.6.26/arch/powerpc/kernel/entry_64.S
===================================================================
--- linux-2.6.26.orig/arch/powerpc/kernel/entry_64.S
+++ linux-2.6.26/arch/powerpc/kernel/entry_64.S
@@ -709,7 +709,7 @@ _GLOBAL(enter_rtas)
std r6,PACASAVEDMSR(r13)
/* Setup our real return addr */
- LOAD_REG_ADDR(r4,.rtas_return_loc)
+ LOAD_REG_IMMEDIATE(r4,.rtas_return_loc)
clrldi r4,r4,2 /* convert to realmode address */
mtlr r4
@@ -725,7 +725,7 @@ _GLOBAL(enter_rtas)
sync /* disable interrupts so SRR0/1 */
mtmsrd r0 /* don't get trashed */
- LOAD_REG_ADDR(r4, rtas)
+ LOAD_REG_IMMEDIATE(r4, rtas)
ld r5,RTASENTRY(r4) /* get the rtas->entry value */
ld r4,RTASBASE(r4) /* get the rtas->base value */
Index: linux-2.6.26/arch/powerpc/kernel/head_64.S
===================================================================
--- linux-2.6.26.orig/arch/powerpc/kernel/head_64.S
+++ linux-2.6.26/arch/powerpc/kernel/head_64.S
@@ -102,6 +102,12 @@ __secondary_hold_acknowledge:
.llong hvReleaseData-KERNELBASE
#endif /* CONFIG_PPC_ISERIES */
+#ifdef CONFIG_RELOCATABLE_PPC64
+ /* Used as static variable to initialize the reloc_delta */
+__initialized:
+ .long 0x0
+#endif
+
. = 0x60
/*
* The following code is used to hold secondary processors
@@ -121,11 +127,13 @@ _GLOBAL(__secondary_hold)
/* Tell the master cpu we're here */
/* Relocation is off & we are located at an address less */
/* than 0x100, so only need to grab low order offset. */
- std r24,__secondary_hold_acknowledge@l(0)
+ LOAD_REG_IMMEDIATE(r25, __secondary_hold_acknowledge)
+ std r24,0(r25)
sync
/* All secondary cpus wait here until told to start. */
-100: ld r4,__secondary_hold_spinloop@l(0)
+ LOAD_REG_IMMEDIATE(r25, __secondary_hold_spinloop)
+100: ld r4,0(r25)
cmpdi 0,r4,1
bne 100b
@@ -1176,6 +1184,38 @@ _STATIC(__mmu_off)
*
*/
_GLOBAL(__start_initialization_multiplatform)
+#ifdef CONFIG_RELOCATABLE_PPC64
+ mr r21,r3
+ mr r22,r4
+ mr r23,r5
+ bl .reloc_offset
+ mr r26,r3
+ mr r3,r21
+ mr r4,r22
+ mr r5,r23
+
+ LOAD_REG_IMMEDIATE(r27, __initialized)
+ add r27,r26,r27
+ ld r7,0(r27)
+ cmpdi r7,0
+ bne 4f
+
+ li r7,1
+ stw r7,0(r27)
+
+ cmpdi r6,0
+ beq 4f
+ LOAD_REG_IMMEDIATE(r27, reloc_delta)
+ add r27,r27,r26
+ std r6,0(r27)
+
+ LOAD_REG_IMMEDIATE(r27, KERNELBASE)
+ add r7,r6,r27
+ LOAD_REG_IMMEDIATE(r27, kernel_base)
+ add r27,r27,r26
+ std r7,0(r27)
+4:
+#endif
/*
* Are we booted from a PROM Of-type client-interface ?
*/
@@ -1251,6 +1291,19 @@ _INIT_STATIC(__boot_from_prom)
trap
_STATIC(__after_prom_start)
+ bl .reloc_offset
+ mr r26,r3
+#ifdef CONFIG_RELOCATABLE_PPC64
+ /*
+ * If its a relocatable kernel, no need to copy the kernel
+ * to PHYSICAL_START. Continue running from the same location
+ */
+ LOAD_REG_IMMEDIATE(r27, reloc_delta)
+ add r27,r27,r26
+ ld r28,0(r27)
+ cmpdi r28,0
+ bne .start_here_multiplatform
+#endif
/*
* We need to run with __start at physical address PHYSICAL_START.
@@ -1264,8 +1317,6 @@ _STATIC(__after_prom_start)
* r26 == relocation offset
* r27 == KERNELBASE
*/
- bl .reloc_offset
- mr r26,r3
LOAD_REG_IMMEDIATE(r27, KERNELBASE)
LOAD_REG_IMMEDIATE(r3, PHYSICAL_START) /* target addr */
@@ -1411,7 +1462,7 @@ __secondary_start:
bl .early_setup_secondary
/* Initialize the kernel stack. Just a repeat for iSeries. */
- LOAD_REG_ADDR(r3, current_set)
+ LOAD_REG_IMMEDIATE(r3, current_set)
sldi r28,r24,3 /* get current_set[cpu#] */
ldx r1,r3,r28
addi r1,r1,THREAD_SIZE-STACK_FRAME_OVERHEAD
@@ -1422,7 +1473,7 @@ __secondary_start:
mtlr r7
/* enable MMU and jump to start_secondary */
- LOAD_REG_ADDR(r3, .start_secondary_prolog)
+ LOAD_REG_IMMEDIATE(r3, .start_secondary_prolog)
LOAD_REG_IMMEDIATE(r4, MSR_KERNEL)
#ifdef CONFIG_PPC_ISERIES
BEGIN_FW_FTR_SECTION
Index: linux-2.6.26/arch/powerpc/kernel/machine_kexec.c
===================================================================
--- linux-2.6.26.orig/arch/powerpc/kernel/machine_kexec.c
+++ linux-2.6.26/arch/powerpc/kernel/machine_kexec.c
@@ -67,6 +67,11 @@ void __init reserve_crashkernel(void)
unsigned long long crash_size, crash_base;
int ret;
+#ifdef CONFIG_RELOCATABLE_PPC64
+ if (reloc_delta)
+ return;
+#endif
+
/* this is necessary because of lmb_phys_mem_size() */
lmb_analyze();
Index: linux-2.6.26/arch/powerpc/kernel/machine_kexec_64.c
===================================================================
--- linux-2.6.26.orig/arch/powerpc/kernel/machine_kexec_64.c
+++ linux-2.6.26/arch/powerpc/kernel/machine_kexec_64.c
@@ -43,7 +43,7 @@ int default_machine_kexec_prepare(struct
* overlaps kernel static data or bss.
*/
for (i = 0; i < image->nr_segments; i++)
- if (image->segment[i].mem < __pa(_end))
+ if (image->segment[i].mem < (__pa(_end) + kernel_base))
return -ETXTBSY;
/*
@@ -317,7 +317,7 @@ static void __init export_htab_values(vo
if (!node)
return;
- kernel_end = __pa(_end);
+ kernel_end = __pa(_end) + kernel_base;
prom_add_property(node, &kernel_end_prop);
/* On machines with no htab htab_address is NULL */
Index: linux-2.6.26/arch/powerpc/kernel/misc.S
===================================================================
--- linux-2.6.26.orig/arch/powerpc/kernel/misc.S
+++ linux-2.6.26/arch/powerpc/kernel/misc.S
@@ -20,6 +20,8 @@
#include <asm/asm-compat.h>
#include <asm/asm-offsets.h>
+#define RELOC_DELTA 0x4000000002000000
+
.text
/*
@@ -33,6 +35,17 @@ _GLOBAL(reloc_offset)
1: mflr r3
LOAD_REG_IMMEDIATE(r4,1b)
subf r3,r4,r3
+#ifdef CONFIG_RELOCATABLE_PPC64
+ LOAD_REG_IMMEDIATE(r5, RELOC_DELTA)
+ cmpd r3,r5
+ bne 2f
+ /*
+ * Don't return the offset if the difference is
+ * RELOC_DELTA
+ */
+ li r3,0
+2:
+#endif
mtlr r0
blr
@@ -40,14 +53,25 @@ _GLOBAL(reloc_offset)
* add_reloc_offset(x) returns x + reloc_offset().
*/
_GLOBAL(add_reloc_offset)
- mflr r0
- bl 1f
-1: mflr r5
- LOAD_REG_IMMEDIATE(r4,1b)
- subf r5,r4,r5
- add r3,r3,r5
- mtlr r0
- blr
+ mflr r0
+ bl 1f
+1: mflr r5
+ LOAD_REG_IMMEDIATE(r4,1b)
+ subf r5,r4,r5
+#ifdef CONFIG_RELOCATABLE_PPC64
+ LOAD_REG_IMMEDIATE(r4, RELOC_DELTA)
+ cmpd r5,r4
+ bne 2f
+ /*
+ * Don't add the offset if the difference is
+ * RELOC_DELTA
+ */
+ li r5,0
+2:
+#endif
+ add r3,r3,r5
+ mtlr r0
+ blr
_GLOBAL(kernel_execve)
li r0,__NR_execve
Index: linux-2.6.26/arch/powerpc/kernel/prom.c
===================================================================
--- linux-2.6.26.orig/arch/powerpc/kernel/prom.c
+++ linux-2.6.26/arch/powerpc/kernel/prom.c
@@ -65,6 +65,9 @@
static int __initdata dt_root_addr_cells;
static int __initdata dt_root_size_cells;
+unsigned long reloc_delta __attribute__ ((__section__ (".data")));
+unsigned long kernel_base __attribute__ ((__section__ (".data")));
+
#ifdef CONFIG_PPC64
int __initdata iommu_is_off;
int __initdata iommu_force_on;
@@ -1159,8 +1162,16 @@ void __init early_init_devtree(void *par
parse_early_param();
/* Reserve LMB regions used by kernel, initrd, dt, etc... */
- lmb_reserve(PHYSICAL_START, __pa(klimit) - PHYSICAL_START);
reserve_kdump_trampoline();
+#ifdef CONFIG_RELOCATABLE_PPC64
+ if (RELOC(kernel_base)) {
+ lmb_reserve(0, KDUMP_RESERVE_LIMIT);
+ lmb_reserve(kernel_base, __pa(klimit) - PHYSICAL_START);
+ } else
+ lmb_reserve(PHYSICAL_START, __pa(klimit) - PHYSICAL_START);
+#else
+ lmb_reserve(PHYSICAL_START, __pa(klimit) - PHYSICAL_START);
+#endif
reserve_crashkernel();
early_reserve_mem();
phyp_dump_reserve_mem();
Index: linux-2.6.26/arch/powerpc/kernel/prom_init.c
===================================================================
--- linux-2.6.26.orig/arch/powerpc/kernel/prom_init.c
+++ linux-2.6.26/arch/powerpc/kernel/prom_init.c
@@ -91,11 +91,9 @@ extern const struct linux_logo logo_linu
* fortunately don't get interpreted as two arguments).
*/
#ifdef CONFIG_PPC64
-#define RELOC(x) (*PTRRELOC(&(x)))
#define ADDR(x) (u32) add_reloc_offset((unsigned long)(x))
#define OF_WORKAROUNDS 0
#else
-#define RELOC(x) (x)
#define ADDR(x) (u32) (x)
#define OF_WORKAROUNDS of_workarounds
int of_workarounds;
@@ -1070,7 +1068,12 @@ static void __init prom_init_mem(void)
}
}
+#ifndef CONFIG_RELOCATABLE_PPC64
RELOC(alloc_bottom) = PAGE_ALIGN((unsigned long)&RELOC(_end) + 0x4000);
+#else
+ RELOC(alloc_bottom) = PAGE_ALIGN((unsigned long)&RELOC(_end) + 0x4000 +
+ RELOC(reloc_delta));
+#endif
/* Check if we have an initrd after the kernel, if we do move our bottom
* point to after it
@@ -1334,10 +1337,19 @@ static void __init prom_hold_cpus(void)
unsigned int cpu_threads, hw_cpu_num;
int propsize;
struct prom_t *_prom = &RELOC(prom);
+
+#ifndef CONFIG_RELOCATABLE_PPC64
unsigned long *spinloop
= (void *) LOW_ADDR(__secondary_hold_spinloop);
unsigned long *acknowledge
= (void *) LOW_ADDR(__secondary_hold_acknowledge);
+#else
+ unsigned long *spinloop
+ = (void *) &__secondary_hold_spinloop;
+ unsigned long *acknowledge
+ = (void *) &__secondary_hold_acknowledge;
+#endif
+
#ifdef CONFIG_PPC64
/* __secondary_hold is actually a descriptor, not the text address */
unsigned long secondary_hold
@@ -2399,8 +2411,15 @@ unsigned long __init prom_init(unsigned
/*
* Copy the CPU hold code
*/
- if (RELOC(of_platform) != PLATFORM_POWERMAC)
- copy_and_flush(0, KERNELBASE + offset, 0x100, 0);
+ if (RELOC(of_platform) != PLATFORM_POWERMAC) {
+#ifdef CONFIG_RELOCATABLE_PPC64
+ if (RELOC(reloc_delta))
+ copy_and_flush(0, KERNELBASE + RELOC(reloc_delta),
+ 0x100, 0);
+ else
+#endif
+ copy_and_flush(0, KERNELBASE + offset, 0x100, 0);
+ }
/*
* Do early parsing of command line
Index: linux-2.6.26/arch/powerpc/kernel/prom_init_check.sh
===================================================================
--- linux-2.6.26.orig/arch/powerpc/kernel/prom_init_check.sh
+++ linux-2.6.26/arch/powerpc/kernel/prom_init_check.sh
@@ -20,7 +20,7 @@ WHITELIST="add_reloc_offset __bss_start
_end enter_prom memcpy memset reloc_offset __secondary_hold
__secondary_hold_acknowledge __secondary_hold_spinloop __start
strcmp strcpy strlcpy strlen strncmp strstr logo_linux_clut224
-reloc_got2 kernstart_addr"
+reloc_got2 kernstart_addr reloc_delta"
NM="$1"
OBJ="$2"
Index: linux-2.6.26/arch/powerpc/kernel/setup_64.c
===================================================================
--- linux-2.6.26.orig/arch/powerpc/kernel/setup_64.c
+++ linux-2.6.26/arch/powerpc/kernel/setup_64.c
@@ -208,7 +208,6 @@ void __init early_setup(unsigned long dt
/* Probe the machine type */
probe_machine();
-
setup_kdump_trampoline();
DBG("Found, Initializing memory management...\n");
@@ -524,9 +523,9 @@ void __init setup_arch(char **cmdline_p)
if (ppc_md.panic)
setup_panic();
- init_mm.start_code = (unsigned long)_stext;
+ init_mm.start_code = (unsigned long)_stext + kernel_base;
init_mm.end_code = (unsigned long) _etext;
- init_mm.end_data = (unsigned long) _edata;
+ init_mm.end_data = (unsigned long) _edata + kernel_base;
init_mm.brk = klimit;
irqstack_early_init();
Index: linux-2.6.26/arch/powerpc/mm/hash_low_64.S
===================================================================
--- linux-2.6.26.orig/arch/powerpc/mm/hash_low_64.S
+++ linux-2.6.26/arch/powerpc/mm/hash_low_64.S
@@ -83,7 +83,7 @@ _GLOBAL(__hash_page_4K)
std r29,STK_REG(r29)(r1)
std r30,STK_REG(r30)(r1)
std r31,STK_REG(r31)(r1)
-
+
/* Step 1:
*
* Check permissions, atomically mark the linux PTE busy
@@ -168,7 +168,7 @@ END_FTR_SECTION(CPU_FTR_NOEXECUTE|CPU_FT
std r3,STK_PARM(r4)(r1)
/* Get htab_hash_mask */
- ld r4,htab_hash_mask@got(2)
+ LOAD_REG_IMMEDIATE(r4, htab_hash_mask)
ld r27,0(r4) /* htab_hash_mask -> r27 */
/* Check if we may already be in the hashtable, in this case, we
@@ -461,7 +461,7 @@ END_FTR_SECTION(CPU_FTR_NOEXECUTE|CPU_FT
std r3,STK_PARM(r4)(r1)
/* Get htab_hash_mask */
- ld r4,htab_hash_mask@got(2)
+ LOAD_REG_IMMEDIATE(r4, htab_hash_mask)
ld r27,0(r4) /* htab_hash_mask -> r27 */
/* Check if we may already be in the hashtable, in this case, we
@@ -792,7 +792,7 @@ END_FTR_SECTION(CPU_FTR_NOEXECUTE|CPU_FT
std r3,STK_PARM(r4)(r1)
/* Get htab_hash_mask */
- ld r4,htab_hash_mask@got(2)
+ LOAD_REG_IMMEDIATE(r4, htab_hash_mask)
ld r27,0(r4) /* htab_hash_mask -> r27 */
/* Check if we may already be in the hashtable, in this case, we
Index: linux-2.6.26/arch/powerpc/mm/init_64.c
===================================================================
--- linux-2.6.26.orig/arch/powerpc/mm/init_64.c
+++ linux-2.6.26/arch/powerpc/mm/init_64.c
@@ -79,10 +79,11 @@ phys_addr_t kernstart_addr;
void free_initmem(void)
{
- unsigned long addr;
+ unsigned long long addr, eaddr;
- addr = (unsigned long)__init_begin;
- for (; addr < (unsigned long)__init_end; addr += PAGE_SIZE) {
+ addr = (unsigned long long )__init_begin + kernel_base;
+ eaddr = (unsigned long long ) __init_end + kernel_base;
+ for (; addr < eaddr; addr += PAGE_SIZE) {
memset((void *)addr, POISON_FREE_INITMEM, PAGE_SIZE);
ClearPageReserved(virt_to_page(addr));
init_page_count(virt_to_page(addr));
Index: linux-2.6.26/arch/powerpc/mm/mem.c
===================================================================
--- linux-2.6.26.orig/arch/powerpc/mm/mem.c
+++ linux-2.6.26/arch/powerpc/mm/mem.c
@@ -400,7 +400,8 @@ void __init mem_init(void)
}
}
- codesize = (unsigned long)&_sdata - (unsigned long)&_stext;
+ codesize = (unsigned long)&_sdata - (unsigned long)&_stext
+ + kernel_base;
datasize = (unsigned long)&_edata - (unsigned long)&_sdata;
initsize = (unsigned long)&__init_end - (unsigned long)&__init_begin;
bsssize = (unsigned long)&__bss_stop - (unsigned long)&__bss_start;
Index: linux-2.6.26/arch/powerpc/mm/slb_low.S
===================================================================
--- linux-2.6.26.orig/arch/powerpc/mm/slb_low.S
+++ linux-2.6.26/arch/powerpc/mm/slb_low.S
@@ -128,7 +128,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_1T_SEGMENT
/* Now get to the array and obtain the sllp
*/
ld r11,PACATOC(r13)
- ld r11,mmu_psize_defs@got(r11)
+ LOAD_REG_IMMEDIATE(r11, mmu_psize_defs)
add r11,r11,r9
ld r11,MMUPSIZESLLP(r11)
ori r11,r11,SLB_VSID_USER
Index: linux-2.6.26/arch/powerpc/platforms/pseries/hvCall.S
===================================================================
--- linux-2.6.26.orig/arch/powerpc/platforms/pseries/hvCall.S
+++ linux-2.6.26/arch/powerpc/platforms/pseries/hvCall.S
@@ -55,7 +55,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_PURR);
/* calculate address of stat structure r4 = opcode */ \
srdi r4,r4,2; /* index into array */ \
mulli r4,r4,HCALL_STAT_SIZE; \
- LOAD_REG_ADDR(r7, per_cpu__hcall_stats); \
+ LOAD_REG_IMMEDIATE(r7, per_cpu__hcall_stats); \
add r4,r4,r7; \
ld r7,PACA_DATA_OFFSET(r13); /* per cpu offset */ \
add r4,r4,r7; \
Index: linux-2.6.26/include/asm-powerpc/exception.h
===================================================================
--- linux-2.6.26.orig/include/asm-powerpc/exception.h
+++ linux-2.6.26/include/asm-powerpc/exception.h
@@ -47,12 +47,6 @@
#define EX_R3 64
#define EX_LR 72
-/*
- * We're short on space and time in the exception prolog, so we can't
- * use the normal SET_REG_IMMEDIATE macro. Normally we just need the
- * low halfword of the address, but for Kdump we need the whole low
- * word.
- */
#ifdef CONFIG_CRASH_DUMP
#define LOAD_HANDLER(reg, label) \
oris reg,reg,(label)@h; /* virt addr of handler ... */ \
Index: linux-2.6.26/include/asm-powerpc/system.h
===================================================================
--- linux-2.6.26.orig/include/asm-powerpc/system.h
+++ linux-2.6.26/include/asm-powerpc/system.h
@@ -517,6 +517,11 @@ extern unsigned long add_reloc_offset(un
extern void reloc_got2(unsigned long);
#define PTRRELOC(x) ((typeof(x)) add_reloc_offset((unsigned long)(x)))
+#ifdef CONFIG_PPC64
+#define RELOC(x) (*PTRRELOC(&(x)))
+#else
+#define RELOC(x) (x)
+#endif
static inline void create_instruction(unsigned long addr, unsigned int instr)
{
Index: linux-2.6.26/include/asm-powerpc/sections.h
===================================================================
--- linux-2.6.26.orig/include/asm-powerpc/sections.h
+++ linux-2.6.26/include/asm-powerpc/sections.h
@@ -7,10 +7,12 @@
#ifdef __powerpc64__
extern char _end[];
+extern unsigned long kernel_base;
static inline int in_kernel_text(unsigned long addr)
{
- if (addr >= (unsigned long)_stext && addr < (unsigned long)__init_end)
+ if (addr >= (unsigned long)_stext && addr < (unsigned long)__init_end
+ + kernel_base)
return 1;
return 0;
Index: linux-2.6.26/include/asm-powerpc/prom.h
===================================================================
--- linux-2.6.26.orig/include/asm-powerpc/prom.h
+++ linux-2.6.26/include/asm-powerpc/prom.h
@@ -39,6 +39,8 @@
#define OF_DT_VERSION 0x10
+extern unsigned long reloc_delta, kernel_base;
+
/*
* This is what gets passed to the kernel by prom_init or kexec
*
Index: linux-2.6.26/arch/powerpc/kernel/iommu.c
===================================================================
--- linux-2.6.26.orig/arch/powerpc/kernel/iommu.c
+++ linux-2.6.26/arch/powerpc/kernel/iommu.c
@@ -473,7 +473,7 @@ struct iommu_table *iommu_init_table(str
spin_lock_init(&tbl->it_lock);
#ifdef CONFIG_CRASH_DUMP
- if (ppc_md.tce_get) {
+ if (reloc_delta && ppc_md.tce_get) {
unsigned long index;
unsigned long tceval;
unsigned long tcecount = 0;
@@ -499,7 +499,10 @@ struct iommu_table *iommu_init_table(str
index < tbl->it_size; index++)
__clear_bit(index, tbl->it_map);
}
- }
+ } else
+ /* Clear the hardware table in case firmware left allocations
+ in it */
+ ppc_md.tce_free(tbl, tbl->it_offset, tbl->it_size);
#else
/* Clear the hardware table in case firmware left allocations in it */
ppc_md.tce_free(tbl, tbl->it_offset, tbl->it_size);
Index: linux-2.6.26/arch/powerpc/platforms/pseries/iommu.c
===================================================================
--- linux-2.6.26.orig/arch/powerpc/platforms/pseries/iommu.c
+++ linux-2.6.26/arch/powerpc/platforms/pseries/iommu.c
@@ -262,7 +262,10 @@ static void iommu_table_setparms(struct
tbl->it_base = (unsigned long)__va(*basep);
-#ifndef CONFIG_CRASH_DUMP
+#ifdef CONFIG_CRASH_DUMP
+ if (!reloc_delta)
+ memset((void *)tbl->it_base, 0, *sizep);
+#else
memset((void *)tbl->it_base, 0, *sizep);
#endif
Index: linux-2.6.26/arch/powerpc/mm/hash_utils_64.c
===================================================================
--- linux-2.6.26.orig/arch/powerpc/mm/hash_utils_64.c
+++ linux-2.6.26/arch/powerpc/mm/hash_utils_64.c
@@ -638,8 +638,9 @@ void __init htab_initialize(void)
continue;
}
#endif /* CONFIG_U3_DART */
- BUG_ON(htab_bolt_mapping(base, base + size, __pa(base),
- mode_rw, mmu_linear_psize, mmu_kernel_ssize));
+ BUG_ON(htab_bolt_mapping(base + kernel_base, base + size,
+ __pa(base) + kernel_base, mode_rw, mmu_linear_psize,
+ mmu_kernel_ssize));
}
/*
^ permalink raw reply
* [RFC v3 PATCH 3/4] Apply relocation info to vmlinux
From: Mohan Kumar M @ 2008-07-17 18:45 UTC (permalink / raw)
To: ppcdev; +Cc: paulus, miltonm
In-Reply-To: <20080717183339.GA25070@in.ibm.com>
Apply relocation
This code is a wrapper around regular kernel. This checks whether the
kernel is loaded at 32MB, if its not loaded at 32MB, its treated as a
regular kernel and the control is given to the kernel immediately. If
the kernel is loaded at 32MB, it applies relocation delta to each offset
in the list which was generated and appended by patch 1 and 2. After
updating all offsets, control is given to relocatable kernel.
Signed-off-by: Mohan Kumar M <mohan@in.ibm.com>
---
arch/powerpc/boot/reloc_apply.S | 229 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 229 insertions(+)
Index: linux-2.6.26/arch/powerpc/boot/reloc_apply.S
===================================================================
--- /dev/null
+++ linux-2.6.26/arch/powerpc/boot/reloc_apply.S
@@ -0,0 +1,229 @@
+#include <asm/ppc_asm.h>
+
+#define RELOC_DELTA 0x4000000002000000
+
+#define LOADADDR(rn,name) \
+ lis rn,name##@highest; \
+ ori rn,rn,name##@higher; \
+ rldicr rn,rn,32,31; \
+ oris rn,rn,name##@h; \
+ ori rn,rn,name##@l
+
+
+/*
+ * Layout of vmlinux.reloc file
+ * Minimal part of relocation applying code +
+ * vmlinux +
+ * Rest of the relocation applying code
+ */
+
+.section .text.head
+
+.globl start_wrap
+start_wrap:
+ /* Get relocation offset in r15 */
+ bl 1f
+1: mflr r15
+ LOAD_REG_IMMEDIATE(r16,1b)
+ subf r15,r16,r15
+
+ LOAD_REG_IMMEDIATE(r17, _reloc)
+ add r17,r17,r15
+ mtctr r17
+ bctr /* Jump to start_reloc in section ".text.reloc" */
+
+/* Secondary cpus spin code */
+. = 0x60
+ /* Get relocation offset in r15 */
+ bl 1f
+1: mflr r15
+ LOAD_REG_IMMEDIATE(r16,1b)
+ subf r15,r16,r15
+
+ LOADADDR(r18, __spinloop)
+ add r18,r18,r15
+100: ld r19,0(r18)
+ cmpwi 0,r19,1
+ bne 100b
+
+ LOAD_REG_IMMEDIATE(r17, _reloc)
+ add r17,r17,r15
+ addi r17,r17,0x60
+ mtctr r17
+ /* Jump to start_reloc + 0x60 in section ".text.reloc" */
+ bctr
+
+/*
+ * Layout of vmlinux.reloc file
+ * Minimal part of relocation applying code +
+ * vmlinux +
+ * Rest of the relocation applying code
+ */
+
+
+.section .text.reloc
+
+start_reloc:
+ b master
+
+.org start_reloc + 0x60
+ LOADADDR(r18, __spinloop)
+ add r18,r18,r15
+100: ld r19,0(r18)
+ cmpwi 0,r19,2
+ bne 100b
+
+ /* Now vmlinux is at _head */
+ LOAD_REG_IMMEDIATE(r17, _head)
+ add r17,r17,r15
+ addi r17,r17,0x60
+ mtctr r17
+ bctr
+
+master:
+ LOAD_REG_IMMEDIATE(r16, output_len)
+ add r16,r16,r15
+
+ /*
+ * Load the delimiter to distinguish between different relocation
+ * types
+ */
+ LOAD_REG_IMMEDIATE(r24, __delimiter)
+ add r24,r24,r15
+ ld r24,0(r24)
+
+ LOAD_REG_IMMEDIATE(r17, _head)
+ LOAD_REG_IMMEDIATE(r21, _ehead)
+ sub r21,r21,r17 /* Number of bytes in head section */
+
+ sub r16,r16,r21 /* Original output_len */
+
+ /* Destination address */
+ LOAD_REG_IMMEDIATE(r17, _head) /* KERNELBASE */
+ add r17,r17,r15
+
+ /* Source address */
+ LOAD_REG_IMMEDIATE(r18, _text) /* Regular vmlinux */
+ add r18,r18,r15
+
+ /* Number of bytes to copy */
+ LOAD_REG_IMMEDIATE(r19, _etext)
+ add r19,r19,r15
+ sub r19,r19,r18
+
+ /* Move cpu spin code to "text.reloc" section */
+ LOADADDR(r23, __spinloop)
+ add r23,r23,r15
+ li r25,1
+ stw r25,0(r23)
+
+ /* Copy vmlinux code to physical address 0 */
+ bl .copy /* copy(_head, _text, _etext-_text) */
+
+ /*
+ * If its not running at 32MB, assume it to be a normal kernel.
+ * Copy the vmlinux code to KERNELBASE and jump to KERNELBASE
+ */
+ LOAD_REG_IMMEDIATE(r21, RELOC_DELTA)
+ cmpd r15,r21
+ beq apply_relocation
+ li r6,0
+ b skip_apply
+apply_relocation:
+
+ /* Kernel is running at 32MB */
+ mr r22,r15
+ xor r23,r23,r23
+ addi r23,r23,16
+ srw r22,r22,r23
+
+ li r25,0
+
+ LOAD_REG_IMMEDIATE(r26, _head)
+
+ /*
+ * Start reading the relocation offset list from end of file
+ * Based on the relocation type either add the relocation delta
+ * or do logical ORing the relocation delta
+ */
+3:
+ addi r16,r16,-8
+ ld r18,0(r16)
+ cmpdi r18,0 /* Processed all offsets */
+ beq 4f /* Start vmlinux */
+ /* Are we processing reloction type R_PPC64_ADDR16_HI */
+ cmpdi r25,1
+ beq rel_hi
+ cmpd r18,r24
+ beq set_rel_hi
+ /* Process 64bit absolute relocation update */
+rel_addr64:
+ add r18,r18,r15
+ ld r28,0(r18)
+ cmpdi r28,0
+ beq next
+ add r28,r28,r15 /* add relocation offset */
+ add r28,r28,r26 /* add KERNELBASE */
+ std r28,0(r18)
+ b next
+set_rel_hi: /* Enable R_PPC64_ADDR16_HI flag */
+ addi r25,r25,1
+ b 3b
+rel_hi:
+ add r18,r18,r15
+ lhz r28,0(r18)
+ or r28,r28,r22
+ sth r28,0(r18)
+next:
+ b 3b
+4:
+ mr r6,r15
+
+
+skip_apply:
+ isync
+ sync
+
+ /* Now vmlinux is at _head */
+ LOAD_REG_IMMEDIATE(r17, _head)
+ add r17,r17,r15
+ mtctr r17
+
+ /* Move cpu spin code to "text.reloc" section */
+ LOADADDR(r23, __spinloop)
+ add r23,r23,r15
+ li r25,2
+ stw r25,0(r23)
+
+ bctr
+
+/* r17 destination, r18 source, r19 size */
+.copy:
+ addi r19,r19,-8
+ li r22,-8
+4: li r21,8 /* Use the smallest common */
+ /* denominator cache line */
+ /* size. This results in */
+ /* extra cache line flushes */
+ /* but operation is correct. */
+ /* Can't get cache line size */
+ /* from NACA as it is being */
+ /* moved too. */
+
+ mtctr r21 /* put # words/line in ctr */
+3: addi r22,r22,8 /* copy a cache line */
+ ldx r21,r22,r18
+ stdx r21,r22,r17
+ bdnz 3b
+ dcbst r22,r17 /* write it to memory */
+ sync
+ icbi r22,r17 /* flush the icache line */
+ cmpld 0,r22,r19
+ blt 4b
+ sync
+ blr
+
+__delimiter:
+ .llong 0xffffffffffffffff
+__spinloop:
+ .llong 0x0
^ permalink raw reply
* [RFC v3 PATCH 2/4] Build files needed for relocation support
From: Mohan Kumar M @ 2008-07-17 18:42 UTC (permalink / raw)
To: ppcdev; +Cc: paulus, miltonm
In-Reply-To: <20080717183339.GA25070@in.ibm.com>
Build files needed for relocation
This patch builds vmlinux file with relocation sections and contents so
that relocs user space program can extract the required relocation
offsets. This packs final relocatable vmlinux kernel as following:
earlier part of relocation apply code, vmlinux, rest of relocation apply
code.
TODO:
Relocatable vmlinux image is built in arch/powerpc/boot as vmlinux.reloc.
But it should be built in top level directory of kernel source as vmlinux
instead of vmlinux.reloc
Signed-off-by: Mohan Kumar M <mohan@in.ibm.com>
---
arch/powerpc/Kconfig | 15 ++++++++++++---
arch/powerpc/Makefile | 9 +++++++--
arch/powerpc/boot/Makefile | 39 ++++++++++++++++++++++++++++++++++++---
arch/powerpc/boot/vmlinux.lds.S | 28 ++++++++++++++++++++++++++++
4 files changed, 83 insertions(+), 8 deletions(-)
Index: linux-2.6.26/arch/powerpc/Kconfig
===================================================================
--- linux-2.6.26.orig/arch/powerpc/Kconfig
+++ linux-2.6.26/arch/powerpc/Kconfig
@@ -317,6 +317,15 @@ config CRASH_DUMP
Don't change this unless you know what you are doing.
+config RELOCATABLE_PPC64
+ bool "Build a relocatable kernel (EXPERIMENTAL)"
+ depends on PPC_MULTIPLATFORM && PPC64 && CRASH_DUMP && EXPERIMENTAL
+ help
+ Build a kernel suitable for use as regular kernel and kdump capture
+ kernel.
+
+ Don't change this unless you know what you are doing.
+
config PHYP_DUMP
bool "Hypervisor-assisted dump (EXPERIMENTAL)"
depends on PPC_PSERIES && EXPERIMENTAL
@@ -656,7 +665,7 @@ config LOWMEM_SIZE
default "0x30000000"
config RELOCATABLE
- bool "Build a relocatable kernel (EXPERIMENTAL)"
+ bool "Build relocatable kernel (EXPERIMENTAL)"
depends on EXPERIMENTAL && ADVANCED_OPTIONS && FLATMEM && FSL_BOOKE
help
This builds a kernel image that is capable of running at the
@@ -776,11 +785,11 @@ config PAGE_OFFSET
default "0xc000000000000000"
config KERNEL_START
hex
- default "0xc000000002000000" if CRASH_DUMP
+ default "0xc000000002000000" if CRASH_DUMP && !RELOCATABLE_PPC64
default "0xc000000000000000"
config PHYSICAL_START
hex
- default "0x02000000" if CRASH_DUMP
+ default "0x02000000" if CRASH_DUMP && !RELOCATABLE_PPC64
default "0x00000000"
endif
Index: linux-2.6.26/arch/powerpc/Makefile
===================================================================
--- linux-2.6.26.orig/arch/powerpc/Makefile
+++ linux-2.6.26/arch/powerpc/Makefile
@@ -69,7 +69,7 @@ override CC += -m$(CONFIG_WORD_SIZE)
override AR := GNUTARGET=elf$(CONFIG_WORD_SIZE)-powerpc $(AR)
endif
-LDFLAGS_vmlinux := -Bstatic
+LDFLAGS_vmlinux := --emit-relocs
CFLAGS-$(CONFIG_PPC64) := -mminimal-toc -mtraceback=none -mcall-aixdesc
CFLAGS-$(CONFIG_PPC32) := -ffixed-r2 -mmultiple
@@ -152,11 +152,16 @@ core-$(CONFIG_KVM) += arch/powerpc/kvm
drivers-$(CONFIG_OPROFILE) += arch/powerpc/oprofile/
# Default to zImage, override when needed
+
+ifneq ($(CONFIG_RELOCATABLE_PPC64),y)
all: zImage
+else
+all: zImage vmlinux.reloc
+endif
CPPFLAGS_vmlinux.lds := -Upowerpc
-BOOT_TARGETS = zImage zImage.initrd uImage zImage% dtbImage% treeImage.% cuImage.% simpleImage.%
+BOOT_TARGETS = zImage vmlinux.reloc zImage.initrd uImage zImage% dtbImage% treeImage.% cuImage.% simpleImage.%
PHONY += $(BOOT_TARGETS)
Index: linux-2.6.26/arch/powerpc/boot/Makefile
===================================================================
--- linux-2.6.26.orig/arch/powerpc/boot/Makefile
+++ linux-2.6.26/arch/powerpc/boot/Makefile
@@ -17,7 +17,7 @@
# CROSS32_COMPILE is setup as a prefix just like CROSS_COMPILE
# in the toplevel makefile.
-all: $(obj)/zImage
+all: $(obj)/zImage $(obj)/vmlinux.reloc
BOOTCFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
-fno-strict-aliasing -Os -msoft-float -pipe \
@@ -120,18 +120,51 @@ $(patsubst %.S,%.o, $(filter %.S, $(src-
$(obj)/wrapper.a: $(obj-wlib) FORCE
$(call if_changed,bootar)
-hostprogs-y := addnote addRamDisk hack-coff mktree dtc
+hostprogs-y := addnote addRamDisk hack-coff mktree dtc relocs
targets += $(patsubst $(obj)/%,%,$(obj-boot) wrapper.a)
extra-y := $(obj)/wrapper.a $(obj-plat) $(obj)/empty.o \
$(obj)/zImage.lds $(obj)/zImage.coff.lds $(obj)/zImage.ps3.lds
+ifeq ($(CONFIG_RELOCATABLE_PPC64),y)
+extra-y += $(obj)/vmlinux.lds
+endif
+
dtstree := $(srctree)/$(src)/dts
wrapper :=$(srctree)/$(src)/wrapper
-wrapperbits := $(extra-y) $(addprefix $(obj)/,addnote hack-coff mktree dtc) \
+wrapperbits := $(extra-y) $(addprefix $(obj)/,addnote hack-coff mktree dtc relocs) \
$(wrapper) FORCE
+ifeq ($(CONFIG_RELOCATABLE_PPC64),y)
+
+targets += vmlinux.offsets vmlinux.bin vmlinux.bin.all vmlinux.reloc.elf vmlinux.reloc reloc_apply.o vmlinux.lds
+
+OBJCOPYFLAGS_vmlinux.bin := -O binary -R .note -R .comment -S
+$(obj)/vmlinux.bin: vmlinux FORCE
+ $(call if_changed,objcopy)
+
+quiet_cmd_relocbin = BUILD $@
+ cmd_relocbin = cat $(filter-out FORCE,$^) > $@
+
+quiet_cmd_relocs = RELOCS $@
+ cmd_relocs = $(obj)/relocs $< > $@
+
+$(obj)/vmlinux.offsets: vmlinux $(obj)/relocs FORCE
+ $(call if_changed,relocs)
+
+$(obj)/vmlinux.bin.all: $(obj)/vmlinux.bin $(obj)/vmlinux.offsets FORCE
+ $(call if_changed,relocbin)
+
+LDFLAGS_vmlinux.reloc.elf := -T $(obj)/vmlinux.reloc.scr -r --format binary --oformat elf64-powerpc
+$(obj)/vmlinux.reloc.elf: $(obj)/vmlinux.bin.all FORCE
+ $(call if_changed,ld)
+
+LDFLAGS_vmlinux.reloc := -T $(obj)/vmlinux.lds
+$(obj)/vmlinux.reloc: $(obj)/reloc_apply.o $(obj)/vmlinux.reloc.elf FORCE
+ $(call if_changed,ld)
+endif
+
#############
# Bits for building dtc
# DTC_GENPARSER := 1 # Uncomment to rebuild flex/bison output
Index: linux-2.6.26/arch/powerpc/boot/vmlinux.lds.S
===================================================================
--- /dev/null
+++ linux-2.6.26/arch/powerpc/boot/vmlinux.lds.S
@@ -0,0 +1,28 @@
+#include <asm/page.h>
+#include <asm-generic/vmlinux.lds.h>
+
+ENTRY(start_wrap)
+
+OUTPUT_ARCH(powerpc:common64)
+SECTIONS
+{
+ . = KERNELBASE;
+
+/*
+ * Text, read only data and other permanent read-only sections
+ */
+ /* Text and gots */
+ .text : {
+ _head = .;
+ *(.text.head)
+ _ehead = .;
+
+ _text = .;
+ *(.vmlinux)
+ _etext = .;
+
+ _reloc = .;
+ *(.text.reloc)
+ _ereloc = .;
+ }
+}
^ permalink raw reply
* Re: [patch 1/9] powerpc/cell/edac: log a syndrome code in case of correctable error
From: Doug Thompson @ 2008-07-17 18:35 UTC (permalink / raw)
To: benh, arnd; +Cc: Maxim Shchetynin, linuxppc-dev, cbe-oss-dev, bluesmoke-devel
In-Reply-To: <1216274347.7740.296.camel@pasglop>
--- Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> Arnd, Maxim, please, next time, send that patch or at least CC the
> bluesmoke-devel list for EDAC related bits.
>
> Doug, if you are ok with this patch, I'll merge it via the powerpc
fine with me, acked below
doug t
> tree.
>
> Cheers,
> Ben.
>
> On Tue, 2008-07-15 at 21:51 +0200, arnd@arndb.de
>
> > From: Maxim Shchetynin <maxim@de.ibm.com>
> >
> > If correctable error occurs the syndrome code was logged as 0. This patch
> > lets EDAC to log a correct syndrome code to make problem investigation
> > easier.
> >
> > Signed-off-by: Maxim Shchetynin <maxim@de.ibm.com>
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Doug Thompson <dougthompson@xmission.com>
> > ---
> > drivers/edac/cell_edac.c | 5 +++--
> > 1 files changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/edac/cell_edac.c b/drivers/edac/cell_edac.c
> > index b54112f..0e024fe 100644
> > --- a/drivers/edac/cell_edac.c
> > +++ b/drivers/edac/cell_edac.c
> > @@ -33,7 +33,7 @@ static void cell_edac_count_ce(struct mem_ctl_info *mci, int chan, u64 ar)
> > {
> > struct cell_edac_priv *priv = mci->pvt_info;
> > struct csrow_info *csrow = &mci->csrows[0];
> > - unsigned long address, pfn, offset;
> > + unsigned long address, pfn, offset, syndrome;
> >
> > dev_dbg(mci->dev, "ECC CE err on node %d, channel %d, ar = 0x%016lx\n",
> > priv->node, chan, ar);
> > @@ -44,10 +44,11 @@ static void cell_edac_count_ce(struct mem_ctl_info *mci, int chan, u64 ar)
> > address = (address << 1) | chan;
> > pfn = address >> PAGE_SHIFT;
> > offset = address & ~PAGE_MASK;
> > + syndrome = (ar & 0x000000001fe00000ul) >> 21;
> >
> > /* TODO: Decoding of the error addresss */
> > edac_mc_handle_ce(mci, csrow->first_page + pfn, offset,
> > - 0, 0, chan, "");
> > + syndrome, 0, chan, "");
> > }
> >
> > static void cell_edac_count_ue(struct mem_ctl_info *mci, int chan, u64 ar)
> > --
> > 1.5.4.3
> >
>
>
W1DUG
^ permalink raw reply
* [RFC v3 PATCH 1/4] Extract list of relocation offsets
From: Mohan Kumar M @ 2008-07-17 18:40 UTC (permalink / raw)
To: ppcdev; +Cc: paulus, miltonm
In-Reply-To: <20080717183339.GA25070@in.ibm.com>
Extract list of relocation offsets
Extract list of offsets in the vmlinux file for which the relocation
delta has to be patched. Currently only following type of relocation
types are considered: R_PPC64_ADDR16_HI, R_PPC64_TOC and R_PPC64_ADDR64
The offsets are sorted according to the relocation type and this
information is appended to the normal vmlinux file by using the patch
relocation_build.patch
Signed-off-by: Mohan Kumar M <mohan@in.ibm.com>
---
arch/powerpc/boot/relocs.c | 865 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 865 insertions(+)
Index: linux-2.6.26/arch/powerpc/boot/relocs.c
===================================================================
--- /dev/null
+++ linux-2.6.26/arch/powerpc/boot/relocs.c
@@ -0,0 +1,865 @@
+#include <stdio.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <elf.h>
+#include <byteswap.h>
+#define USE_BSD
+#include <endian.h>
+
+#define MAX_SHDRS 100
+static Elf64_Ehdr ehdr;
+static Elf64_Shdr shdr[MAX_SHDRS];
+static Elf64_Sym *symtab[MAX_SHDRS];
+static Elf64_Rel *reltab[MAX_SHDRS];
+static Elf64_Rela *reltaba[MAX_SHDRS];
+static char *strtab[MAX_SHDRS];
+static unsigned long reloc_count, reloc_idx;
+
+struct reloc_info {
+ unsigned int rel_type;
+ unsigned long long offset;
+};
+
+static struct reloc_info *relocs;
+
+/*
+ * Following symbols have been audited. There values are constant and do
+ * not change if bzImage is loaded at a different physical address than
+ * the address for which it has been compiled. Don't warn user about
+ * absolute relocations present w.r.t these symbols.
+ */
+static const char* safe_abs_relocs[] = {
+ "__kernel_vsyscall",
+ "__kernel_rt_sigreturn",
+ "__kernel_sigreturn",
+ "SYSENTER_RETURN",
+};
+
+static int is_safe_abs_reloc(const char* sym_name)
+{
+ int i, array_size;
+
+ array_size = sizeof(safe_abs_relocs)/sizeof(char*);
+
+ for(i = 0; i < array_size; i++) {
+ if (!strcmp(sym_name, safe_abs_relocs[i]))
+ /* Match found */
+ return 1;
+ }
+ if (strncmp(sym_name, "__crc_", 6) == 0)
+ return 1;
+ return 0;
+}
+
+static void die(char *fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ exit(1);
+}
+
+static const char *sym_type(unsigned type)
+{
+ static const char *type_name[] = {
+#define SYM_TYPE(X) [X] = #X
+ SYM_TYPE(STT_NOTYPE),
+ SYM_TYPE(STT_OBJECT),
+ SYM_TYPE(STT_FUNC),
+ SYM_TYPE(STT_SECTION),
+ SYM_TYPE(STT_FILE),
+ SYM_TYPE(STT_COMMON),
+ SYM_TYPE(STT_TLS),
+#undef SYM_TYPE
+ };
+ const char *s_type = "unknown sym type name";
+ if (type < sizeof(type_name)/sizeof(type_name[0])) {
+ s_type = type_name[type];
+ }
+ return s_type;
+}
+
+static const char *sym_bind(unsigned bind)
+{
+ static const char *bind_name[] = {
+#define SYM_BIND(X) [X] = #X
+ SYM_BIND(STB_LOCAL),
+ SYM_BIND(STB_GLOBAL),
+ SYM_BIND(STB_WEAK),
+#undef SYM_BIND
+ };
+ const char *s_bind = "unknown sym bind name";
+ if (bind < sizeof(bind_name)/sizeof(bind_name[0])) {
+ s_bind = bind_name[bind];
+ }
+ return s_bind;
+}
+
+static const char *sym_visibility(unsigned visibility)
+{
+ static const char *visibility_name[] = {
+#define SYM_VISIBILITY(X) [X] = #X
+ SYM_VISIBILITY(STV_DEFAULT),
+ SYM_VISIBILITY(STV_INTERNAL),
+ SYM_VISIBILITY(STV_HIDDEN),
+ SYM_VISIBILITY(STV_PROTECTED),
+#undef SYM_VISIBILITY
+ };
+ const char *name = "unknown sym visibility name";
+ if (visibility < sizeof(visibility_name)/sizeof(visibility_name[0])) {
+ name = visibility_name[visibility];
+ }
+ return name;
+}
+
+static const char *rel_type(unsigned type)
+{
+ static const char *type_name[] = {
+#define REL_TYPE(X) [X] = #X
+ REL_TYPE(R_PPC64_NONE),
+ REL_TYPE(R_PPC64_ADDR32),
+ REL_TYPE(R_PPC64_ADDR24),
+ REL_TYPE(R_PPC64_ADDR16),
+ REL_TYPE(R_PPC64_ADDR16_LO),
+ REL_TYPE(R_PPC64_ADDR16_HI),
+ REL_TYPE(R_PPC64_ADDR16_HA),
+ REL_TYPE(R_PPC64_ADDR14 ),
+ REL_TYPE(R_PPC64_ADDR14_BRTAKEN),
+ REL_TYPE(R_PPC64_ADDR14_BRNTAKEN),
+ REL_TYPE(R_PPC64_REL24),
+ REL_TYPE(R_PPC64_REL14),
+ REL_TYPE(R_PPC64_REL14_BRTAKEN),
+ REL_TYPE(R_PPC64_REL14_BRNTAKEN),
+ REL_TYPE(R_PPC64_GOT16),
+ REL_TYPE(R_PPC64_GOT16_LO),
+ REL_TYPE(R_PPC64_GOT16_HI),
+ REL_TYPE(R_PPC64_GOT16_HA),
+ REL_TYPE(R_PPC64_COPY),
+ REL_TYPE(R_PPC64_GLOB_DAT),
+ REL_TYPE(R_PPC64_JMP_SLOT),
+ REL_TYPE(R_PPC64_RELATIVE),
+ REL_TYPE(R_PPC64_UADDR32),
+ REL_TYPE(R_PPC64_UADDR16),
+ REL_TYPE(R_PPC64_REL32),
+ REL_TYPE(R_PPC64_PLT32),
+ REL_TYPE(R_PPC64_PLTREL32),
+ REL_TYPE(R_PPC64_PLT16_LO),
+ REL_TYPE(R_PPC64_PLT16_HI),
+ REL_TYPE(R_PPC64_PLT16_HA),
+ REL_TYPE(R_PPC64_SECTOFF),
+ REL_TYPE(R_PPC64_SECTOFF_LO),
+ REL_TYPE(R_PPC64_SECTOFF_HI),
+ REL_TYPE(R_PPC64_SECTOFF_HA),
+ REL_TYPE(R_PPC64_ADDR30),
+ REL_TYPE(R_PPC64_ADDR64),
+ REL_TYPE(R_PPC64_ADDR16_HIGHER),
+ REL_TYPE(R_PPC64_ADDR16_HIGHERA),
+ REL_TYPE(R_PPC64_ADDR16_HIGHEST),
+ REL_TYPE(R_PPC64_ADDR16_HIGHESTA),
+ REL_TYPE(R_PPC64_UADDR64),
+ REL_TYPE(R_PPC64_REL64),
+ REL_TYPE(R_PPC64_PLT64),
+ REL_TYPE(R_PPC64_PLTREL64),
+ REL_TYPE(R_PPC64_TOC16),
+ REL_TYPE(R_PPC64_TOC16_LO),
+ REL_TYPE(R_PPC64_TOC16_HI),
+ REL_TYPE(R_PPC64_TOC16_HA),
+ REL_TYPE(R_PPC64_TOC),
+ REL_TYPE(R_PPC64_PLTGOT16),
+ REL_TYPE(R_PPC64_PLTGOT16_LO),
+ REL_TYPE(R_PPC64_PLTGOT16_HI),
+ REL_TYPE(R_PPC64_PLTGOT16_HA),
+ REL_TYPE(R_PPC64_ADDR16_DS),
+ REL_TYPE(R_PPC64_ADDR16_LO_DS),
+ REL_TYPE(R_PPC64_GOT16_DS),
+ REL_TYPE(R_PPC64_GOT16_LO_DS),
+ REL_TYPE(R_PPC64_PLT16_LO_DS),
+ REL_TYPE(R_PPC64_SECTOFF_DS),
+ REL_TYPE(R_PPC64_SECTOFF_LO_DS),
+ REL_TYPE(R_PPC64_TOC16_DS),
+ REL_TYPE(R_PPC64_TOC16_LO_DS),
+ REL_TYPE(R_PPC64_PLTGOT16_DS),
+ REL_TYPE(R_PPC64_PLTGOT16_LO_DS),
+ REL_TYPE(R_PPC64_TLS),
+ REL_TYPE(R_PPC64_DTPMOD64),
+ REL_TYPE(R_PPC64_TPREL16),
+ REL_TYPE(R_PPC64_TPREL16_LO),
+ REL_TYPE(R_PPC64_TPREL16_HI),
+ REL_TYPE(R_PPC64_TPREL16_HA),
+ REL_TYPE(R_PPC64_TPREL64),
+ REL_TYPE(R_PPC64_DTPREL16),
+ REL_TYPE(R_PPC64_DTPREL16_LO),
+ REL_TYPE(R_PPC64_DTPREL16_HI),
+ REL_TYPE(R_PPC64_DTPREL16_HA),
+ REL_TYPE(R_PPC64_DTPREL64),
+ REL_TYPE(R_PPC64_GOT_TLSGD16),
+ REL_TYPE(R_PPC64_GOT_TLSGD16_LO),
+ REL_TYPE(R_PPC64_GOT_TLSGD16_HI),
+ REL_TYPE(R_PPC64_GOT_TLSGD16_HA),
+ REL_TYPE(R_PPC64_GOT_TLSLD16),
+ REL_TYPE(R_PPC64_GOT_TLSLD16_LO),
+ REL_TYPE(R_PPC64_GOT_TLSLD16_HI),
+ REL_TYPE(R_PPC64_GOT_TLSLD16_HA),
+ REL_TYPE(R_PPC64_GOT_TPREL16_DS),
+ REL_TYPE(R_PPC64_GOT_TPREL16_LO_DS),
+ REL_TYPE(R_PPC64_GOT_TPREL16_HI),
+ REL_TYPE(R_PPC64_GOT_TPREL16_HA),
+ REL_TYPE(R_PPC64_GOT_DTPREL16_DS),
+ REL_TYPE(R_PPC64_GOT_DTPREL16_LO_DS),
+ REL_TYPE(R_PPC64_GOT_DTPREL16_HI),
+ REL_TYPE(R_PPC64_GOT_DTPREL16_HA),
+ REL_TYPE(R_PPC64_TPREL16_DS),
+ REL_TYPE(R_PPC64_TPREL16_LO_DS),
+ REL_TYPE(R_PPC64_TPREL16_HIGHER),
+ REL_TYPE(R_PPC64_TPREL16_HIGHERA),
+ REL_TYPE(R_PPC64_TPREL16_HIGHEST),
+ REL_TYPE(R_PPC64_TPREL16_HIGHESTA),
+ REL_TYPE(R_PPC64_DTPREL16_DS),
+ REL_TYPE(R_PPC64_DTPREL16_LO_DS),
+ REL_TYPE(R_PPC64_DTPREL16_HIGHER),
+ REL_TYPE(R_PPC64_DTPREL16_HIGHERA),
+ REL_TYPE(R_PPC64_DTPREL16_HIGHEST),
+ REL_TYPE(R_PPC64_DTPREL16_HIGHESTA),
+#undef REL_TYPE
+ };
+ const char *name = "unknown type rel type name";
+ if (type < sizeof(type_name)/sizeof(type_name[0])) {
+ name = type_name[type];
+ }
+ return name;
+}
+
+static const char *sec_name(unsigned shndx)
+{
+ const char *sec_strtab;
+ const char *name;
+ sec_strtab = strtab[ehdr.e_shstrndx];
+ name = "<noname>";
+ if (shndx < ehdr.e_shnum) {
+ name = sec_strtab + shdr[shndx].sh_name;
+ }
+ else if (shndx == SHN_ABS) {
+ name = "ABSOLUTE";
+ }
+ else if (shndx == SHN_COMMON) {
+ name = "COMMON";
+ }
+ return name;
+}
+
+static const char *sym_name(const char *sym_strtab, Elf64_Sym *sym)
+{
+ const char *name;
+ name = "<noname>";
+ if (sym->st_name) {
+ name = sym_strtab + sym->st_name;
+ }
+ else {
+ name = sec_name(shdr[sym->st_shndx].sh_name);
+ }
+ return name;
+}
+
+
+
+#if BYTE_ORDER == BIG_ENDIAN
+#define be16_to_cpu(val) (val)
+#define be32_to_cpu(val) (val)
+#define be64_to_cpu(val) (val)
+#endif
+#if BYTE_ORDER == LITTLE_ENDIAN
+#define be16_to_cpu(val) bswap_16(val)
+#define be32_to_cpu(val) bswap_32(val)
+#define be64_to_cpu(val) bswap_64(val)
+#endif
+
+static uint16_t elf16_to_cpu(uint16_t val)
+{
+ return be16_to_cpu(val);
+}
+
+static uint32_t elf32_to_cpu(uint32_t val)
+{
+ return be32_to_cpu(val);
+}
+
+static uint64_t elf64_to_cpu(uint64_t val)
+{
+ return be64_to_cpu(val);
+}
+
+static void read_ehdr(FILE *fp)
+{
+ if (fread(&ehdr, sizeof(ehdr), 1, fp) != 1) {
+ die("Cannot read ELF header: %s\n",
+ strerror(errno));
+ }
+ if (memcmp(ehdr.e_ident, ELFMAG, 4) != 0) {
+ die("No ELF magic\n");
+ }
+ if (ehdr.e_ident[EI_CLASS] != ELFCLASS64) {
+ die("Not a 64 bit executable\n");
+ }
+ if (ehdr.e_ident[EI_DATA] != ELFDATA2MSB) {
+ die("Not a MSB ELF executable\n");
+ }
+ if (ehdr.e_ident[EI_VERSION] != EV_CURRENT) {
+ die("Unknown ELF version\n");
+ }
+ /* Convert the fields to native endian */
+ ehdr.e_type = elf16_to_cpu(ehdr.e_type);
+ ehdr.e_machine = elf16_to_cpu(ehdr.e_machine);
+ ehdr.e_version = elf32_to_cpu(ehdr.e_version);
+ ehdr.e_entry = elf64_to_cpu(ehdr.e_entry);
+ ehdr.e_phoff = elf64_to_cpu(ehdr.e_phoff);
+ ehdr.e_shoff = elf64_to_cpu(ehdr.e_shoff);
+ ehdr.e_flags = elf32_to_cpu(ehdr.e_flags);
+ ehdr.e_ehsize = elf16_to_cpu(ehdr.e_ehsize);
+ ehdr.e_phentsize = elf16_to_cpu(ehdr.e_phentsize);
+ ehdr.e_phnum = elf16_to_cpu(ehdr.e_phnum);
+ ehdr.e_shentsize = elf16_to_cpu(ehdr.e_shentsize);
+ ehdr.e_shnum = elf16_to_cpu(ehdr.e_shnum);
+ ehdr.e_shstrndx = elf16_to_cpu(ehdr.e_shstrndx);
+
+ if ((ehdr.e_type != ET_EXEC) && (ehdr.e_type != ET_DYN)) {
+ die("Unsupported ELF header type\n");
+ }
+ if (ehdr.e_machine != EM_PPC64) {
+ die("Not for PPC64\n");
+ }
+ if (ehdr.e_version != EV_CURRENT) {
+ die("Unknown ELF version\n");
+ }
+ if (ehdr.e_ehsize != sizeof(Elf64_Ehdr)) {
+ die("Bad Elf header size\n");
+ }
+ if (ehdr.e_phentsize != sizeof(Elf64_Phdr)) {
+ die("Bad program header entry\n");
+ }
+ if (ehdr.e_shentsize != sizeof(Elf64_Shdr)) {
+ die("Bad section header entry\n");
+ }
+ if (ehdr.e_shstrndx >= ehdr.e_shnum) {
+ die("String table index out of bounds\n");
+ }
+}
+
+static void read_shdrs(FILE *fp)
+{
+ int i;
+ if (ehdr.e_shnum > MAX_SHDRS) {
+ die("%d section headers supported: %d\n",
+ ehdr.e_shnum, MAX_SHDRS);
+ }
+ if (fseek(fp, ehdr.e_shoff, SEEK_SET) < 0) {
+ die("Seek to %d failed: %s\n",
+ ehdr.e_shoff, strerror(errno));
+ }
+ if (fread(&shdr, sizeof(shdr[0]), ehdr.e_shnum, fp) != ehdr.e_shnum) {
+ die("Cannot read ELF section headers: %s\n",
+ strerror(errno));
+ }
+ for(i = 0; i < ehdr.e_shnum; i++) {
+ shdr[i].sh_name = elf32_to_cpu(shdr[i].sh_name);
+ shdr[i].sh_type = elf32_to_cpu(shdr[i].sh_type);
+ shdr[i].sh_flags = elf64_to_cpu(shdr[i].sh_flags);
+ shdr[i].sh_addr = elf64_to_cpu(shdr[i].sh_addr);
+ shdr[i].sh_offset = elf64_to_cpu(shdr[i].sh_offset);
+ shdr[i].sh_size = elf64_to_cpu(shdr[i].sh_size);
+ shdr[i].sh_link = elf32_to_cpu(shdr[i].sh_link);
+ shdr[i].sh_info = elf32_to_cpu(shdr[i].sh_info);
+ shdr[i].sh_addralign = elf64_to_cpu(shdr[i].sh_addralign);
+ shdr[i].sh_entsize = elf64_to_cpu(shdr[i].sh_entsize);
+ }
+
+}
+
+static void read_strtabs(FILE *fp)
+{
+ int i;
+ for(i = 0; i < ehdr.e_shnum; i++) {
+ if (shdr[i].sh_type != SHT_STRTAB) {
+ continue;
+ }
+ strtab[i] = malloc(shdr[i].sh_size);
+ if (!strtab[i]) {
+ die("malloc of %d bytes for strtab failed\n",
+ shdr[i].sh_size);
+ }
+ if (fseek(fp, shdr[i].sh_offset, SEEK_SET) < 0) {
+ die("Seek to %d failed: %s\n",
+ shdr[i].sh_offset, strerror(errno));
+ }
+ if (fread(strtab[i], 1, shdr[i].sh_size, fp) != shdr[i].sh_size) {
+ die("Cannot read symbol table: %s\n",
+ strerror(errno));
+ }
+ }
+}
+
+static void read_symtabs(FILE *fp)
+{
+ int i,j;
+ for(i = 0; i < ehdr.e_shnum; i++) {
+ if (shdr[i].sh_type != SHT_SYMTAB) {
+ continue;
+ }
+ symtab[i] = malloc(shdr[i].sh_size);
+ if (!symtab[i]) {
+ die("malloc of %d bytes for symtab failed\n",
+ shdr[i].sh_size);
+ }
+ if (fseek(fp, shdr[i].sh_offset, SEEK_SET) < 0) {
+ die("Seek to %d failed: %s\n",
+ shdr[i].sh_offset, strerror(errno));
+ }
+ if (fread(symtab[i], 1, shdr[i].sh_size, fp) != shdr[i].sh_size) {
+ die("Cannot read symbol table: %s\n",
+ strerror(errno));
+ }
+ for(j = 0; j < shdr[i].sh_size/sizeof(symtab[i][0]); j++) {
+ symtab[i][j].st_name = elf32_to_cpu(symtab[i][j].st_name);
+ symtab[i][j].st_value = elf64_to_cpu(symtab[i][j].st_value);
+ symtab[i][j].st_size = elf64_to_cpu(symtab[i][j].st_size);
+ symtab[i][j].st_shndx = elf16_to_cpu(symtab[i][j].st_shndx);
+ }
+ }
+}
+
+
+static void read_relocs(FILE *fp)
+{
+ int i,j;
+ void *relp;
+
+ for(i = 0; i < ehdr.e_shnum; i++) {
+ if (shdr[i].sh_type != SHT_REL && shdr[i].sh_type != SHT_RELA)
+ continue;
+
+ if (shdr[i].sh_type == SHT_REL) {
+ reltab[i] = malloc(shdr[i].sh_size);
+ if (!reltab[i]) {
+ die("malloc of %d bytes for relocs failed\n",
+ shdr[i].sh_size);
+ }
+ relp = reltab[i];
+ } else {
+ reltaba[i] = malloc(shdr[i].sh_size);
+ if (!reltaba[i]) {
+ die("malloc of %d bytes for relocs failed\n",
+ shdr[i].sh_size);
+ }
+ relp = reltaba[i];
+ }
+
+ if (fseek(fp, shdr[i].sh_offset, SEEK_SET) < 0) {
+ die("Seek to %d failed: %s\n",
+ shdr[i].sh_offset, strerror(errno));
+ }
+ if (fread(relp, 1, shdr[i].sh_size, fp) != shdr[i].sh_size) {
+ die("Cannot read symbol table: %s\n",
+ strerror(errno));
+ }
+
+ if (shdr[i].sh_type == SHT_REL)
+ for(j = 0; j < shdr[i].sh_size/sizeof(reltab[0][0]); j++) {
+ reltab[i][j].r_offset = elf64_to_cpu(reltab[i][j].r_offset);
+ reltab[i][j].r_info = elf64_to_cpu(reltab[i][j].r_info);
+ }
+ else
+ for(j = 0; j < shdr[i].sh_size/sizeof(reltaba[0][0]); j++) {
+ reltaba[i][j].r_offset = elf64_to_cpu(reltaba[i][j].r_offset);
+ reltaba[i][j].r_info = elf64_to_cpu(reltaba[i][j].r_info);
+ reltaba[i][j].r_addend = elf64_to_cpu(reltaba[i][j].r_addend);
+ }
+ }
+}
+
+
+static void print_absolute_symbols(void)
+{
+ int i;
+ printf("Absolute symbols\n");
+ printf(" Num: Value Size Type Bind Visibility Name\n");
+ for(i = 0; i < ehdr.e_shnum; i++) {
+ char *sym_strtab;
+ Elf64_Sym *sh_symtab;
+ int j;
+ if (shdr[i].sh_type != SHT_SYMTAB) {
+ continue;
+ }
+ sh_symtab = symtab[i];
+ sym_strtab = strtab[shdr[i].sh_link];
+ for(j = 0; j < shdr[i].sh_size/sizeof(symtab[0][0]); j++) {
+ Elf64_Sym *sym;
+ const char *name;
+ sym = &symtab[i][j];
+ name = sym_name(sym_strtab, sym);
+ if (sym->st_shndx != SHN_ABS) {
+ continue;
+ }
+ printf("type:[%s]\n",
+ sym_type(ELF64_ST_TYPE(sym->st_info)));
+ printf("%5d %016llx %5d type:%s bind:%10s %12s %s %s\n", \
+ j, sym->st_value, sym->st_size, \
+ sym_type(ELF64_ST_TYPE(sym->st_info)), \
+ sym_bind(ELF64_ST_BIND(sym->st_info)), \
+ sym_visibility(ELF64_ST_VISIBILITY(sym->st_other)), \
+ name);
+ }
+ }
+ printf("\n");
+}
+
+static void print_absolute_relocs(void)
+{
+ int i, printed = 0;
+ int nr, sh_type;
+
+ for(i = 0; i < ehdr.e_shnum; i++) {
+ char *sym_strtab;
+ Elf64_Sym *sh_symtab;
+ unsigned sec_applies, sec_symtab;
+ int j;
+ if (shdr[i].sh_type != SHT_REL && shdr[i].sh_type != SHT_RELA) {
+ continue;
+ }
+ sec_symtab = shdr[i].sh_link;
+ sec_applies = shdr[i].sh_info;
+ if (!(shdr[sec_applies].sh_flags & SHF_ALLOC)) {
+ continue;
+ }
+ if (shdr[i].sh_type == SHT_REL) {
+ sh_type = SHT_REL;
+ nr = shdr[i].sh_size/sizeof(reltab[0][0]);
+ } else {
+ sh_type = SHT_RELA;
+ nr = shdr[i].sh_size/sizeof(reltaba[0][0]);
+ }
+
+ sh_symtab = symtab[sec_symtab];
+ sym_strtab = strtab[shdr[sec_symtab].sh_link];
+
+ for(j = 0; j < nr; j++) {
+ Elf64_Rel *rel;
+ Elf64_Rela *rela;
+ Elf64_Sym *sym;
+ const char *name;
+
+ if (sh_type == SHT_REL) {
+ rel = &reltab[i][j];
+ sym = &sh_symtab[ELF64_R_SYM(rel->r_info)];
+ } else {
+ rela = &reltaba[i][j];
+ sym = &sh_symtab[ELF64_R_SYM(rela->r_info)];
+ }
+
+ name = sym_name(sym_strtab, sym);
+ if (sym->st_shndx != SHN_ABS) {
+ continue;
+ }
+
+ /* Absolute symbols are not relocated if vmlinux is
+ * loaded at a non-compiled address. Display a warning
+ * to user at compile time about the absolute
+ * relocations present.
+ *
+ * User need to audit the code to make sure
+ * some symbols which should have been section
+ * relative have not become absolute because of some
+ * linker optimization or wrong programming usage.
+ *
+ * Before warning check if this absolute symbol
+ * relocation is harmless.
+ */
+ if (is_safe_abs_reloc(name))
+ continue;
+
+ if (!printed) {
+ printf("WARNING: Absolute relocations"
+ " present\n");
+ printf("Offset Info Type Sym.Value "
+ "Sym.Name\n");
+ printed = 1;
+ }
+
+ if (sh_type == SHT_REL)
+ printf("%016llx %016llx %10s %016llx %s\n",
+ rel->r_offset,
+ rel->r_info,
+ rel_type(ELF64_R_TYPE(rel->r_info)),
+ sym->st_value,
+ name);
+ else
+ printf("%016llx %016llx %10s %016llx %s\n",
+ rela->r_offset,
+ rela->r_info,
+ rel_type(ELF64_R_TYPE(rela->r_info)),
+ sym->st_value,
+ name);
+ }
+ }
+
+ if (printed)
+ printf("\n");
+}
+
+static void walk_relocs(void (*visit)(void *relp, Elf64_Sym *sym, int sh_type))
+{
+ int i;
+ /* Walk through the relocations */
+ for(i = 0; i < ehdr.e_shnum; i++) {
+ char *sym_strtab;
+ Elf64_Sym *sh_symtab;
+ unsigned sec_applies, sec_symtab;
+ int j, nr_entries, sh_type;
+ if (shdr[i].sh_type != SHT_REL && shdr[i].sh_type != SHT_RELA) {
+ continue;
+ }
+ sec_symtab = shdr[i].sh_link;
+ sec_applies = shdr[i].sh_info;
+ if (!(shdr[sec_applies].sh_flags & SHF_ALLOC)) {
+ continue;
+ }
+ sh_symtab = symtab[sec_symtab];
+ sym_strtab = strtab[shdr[sec_symtab].sh_link];
+ if (shdr[i].sh_type == SHT_REL) {
+ sh_type = SHT_REL;
+ nr_entries = shdr[i].sh_size/sizeof(reltab[0][0]);
+ } else {
+ sh_type = SHT_RELA;
+ nr_entries = shdr[i].sh_size/sizeof(reltaba[0][0]);
+ }
+
+ for(j = 0; j < nr_entries; j++) {
+ Elf64_Rel *rel;
+ Elf64_Rela *rela;
+ Elf64_Sym *sym;
+ void *relp;
+ unsigned r_type;
+
+ if (sh_type == SHT_REL) {
+ rel = &reltab[i][j];
+ sym = &sh_symtab[ELF64_R_SYM(rel->r_info)];
+ r_type = ELF64_R_TYPE(rel->r_info);
+ relp = rel;
+ } else {
+ rela = &reltaba[i][j];
+ sym = &sh_symtab[ELF64_R_SYM(rela->r_info)];
+ r_type = ELF64_R_TYPE(rela->r_info);
+ relp = rela;
+ }
+ /* Don't visit relocations to absolute symbols */
+ if (sym->st_shndx == SHN_ABS) {
+ continue;
+ }
+ /* PC relative relocations don't need to be adjusted */
+ switch (r_type) {
+ case R_PPC64_ADDR32:
+ case R_PPC64_ADDR16:
+ case R_PPC64_ADDR16_HI:
+ case R_PPC64_ADDR24:
+ case R_PPC64_ADDR64:
+ case R_PPC64_TOC:
+ /* Visit relocations that need to be adjusted */
+ visit(relp, sym, sh_type);
+ break;
+ case R_PPC64_ADDR16_LO:
+ case R_PPC64_REL24:
+ case R_PPC64_REL64:
+ case R_PPC64_TOC16:
+ case R_PPC64_ADDR16_LO_DS:
+ case R_PPC64_ADDR16_HIGHEST:
+ case R_PPC64_ADDR16_HIGHER:
+ case R_PPC64_GOT16_DS:
+ case R_PPC64_TOC16_DS:
+ case R_PPC64_REL14:
+ default:
+ break;
+ }
+ }
+ }
+}
+
+static void count_reloc(void *relp, Elf64_Sym *sym, int sh_type)
+{
+ reloc_count += 1;
+}
+
+static void collect_reloc(void *relp, Elf64_Sym *sym, int sh_type)
+{
+ Elf64_Rel *rel;
+ Elf64_Rela *rela;
+
+ /* Remember the address that needs to be adjusted. */
+ if (sh_type == SHT_REL) {
+ rel = (Elf64_Rel *)relp;
+ relocs[reloc_idx].offset = rel->r_offset;
+ relocs[reloc_idx++].rel_type = ELF64_R_TYPE(rel->r_info);
+ } else {
+ rela = (Elf64_Rela *)relp;
+ relocs[reloc_idx].offset = rela->r_offset;
+ relocs[reloc_idx++].rel_type = ELF64_R_TYPE(rela->r_info);
+ }
+}
+
+static int cmp_relocs(const void *va, const void *vb)
+{
+ const struct reloc_info *a, *b;
+ a = va; b = vb;
+ return (a->rel_type == b->rel_type)? 0 : (a->rel_type > b->rel_type)? 1 : -1;
+}
+
+static void emit_relocs(int as_text)
+{
+ int i;
+ int prev_r_type;
+ /* Count how many relocations I have and allocate space for them. */
+ reloc_count = 0;
+ walk_relocs(count_reloc);
+ relocs = malloc(reloc_count * sizeof(relocs[0]));
+ if (!relocs) {
+ die("malloc of %d entries for relocs failed\n",
+ reloc_count);
+ }
+ /* Collect up the relocations */
+ reloc_idx = 0;
+ walk_relocs(collect_reloc);
+
+ /* Order the relocations for more efficient processing */
+ qsort(relocs, reloc_count, sizeof(relocs[0]), cmp_relocs);
+
+ /* Print the relocations */
+ if (as_text) {
+ /* Print the relocations in a form suitable that
+ * gas will like.
+ */
+ printf(".section \".data.reloc\",\"a\"\n");
+ printf(".balign 4\n");
+
+ printf("\t .long 0x%016llx\n", relocs[0].offset);
+ prev_r_type = relocs[0].rel_type;
+
+ for(i = 1; i < reloc_count; i++) {
+ if (prev_r_type != relocs[i].rel_type && prev_r_type == R_PPC64_ADDR16_HI) {
+ printf("\t .long 0xffffffffffffffff\n");
+ prev_r_type = relocs[i].rel_type;
+ }
+ printf("\t .long 0x%016llx\n", relocs[i].offset);
+ }
+ printf("\n");
+ }
+ else {
+ unsigned char buf[8];
+ buf[0] = buf[1] = buf[2] = buf[3] = 0;
+ buf[4] = buf[5] = buf[6] = buf[7] = 0;
+
+ /* Print a stop */
+ printf("%c%c%c%c", buf[0], buf[1], buf[2], buf[3]);
+ printf("%c%c%c%c", buf[4], buf[5], buf[6], buf[7]);
+
+ buf[7] = (relocs[0].offset >> 0) & 0xff;
+ buf[6] = (relocs[0].offset >> 8) & 0xff;
+ buf[5] = (relocs[0].offset >> 16) & 0xff;
+ buf[4] = (relocs[0].offset >> 24) & 0xff;
+ buf[3] = (relocs[0].offset >> 32) & 0xff;
+ buf[2] = (relocs[0].offset >> 40) & 0xff;
+ buf[1] = (relocs[0].offset >> 48) & 0xff;
+ buf[0] = (relocs[0].offset >> 56) & 0xff;
+ printf("%c%c%c%c", buf[0], buf[1], buf[2], buf[3]);
+ printf("%c%c%c%c", buf[4], buf[5], buf[6], buf[7]);
+
+ prev_r_type = relocs[0].rel_type;
+
+ /* Now print each relocation */
+ for(i = 1; i < reloc_count; i++) {
+ if (prev_r_type != relocs[i].rel_type && prev_r_type == R_PPC64_ADDR16_HI) {
+ printf("%c%c%c%c", 0xff, 0xff, 0xff, 0xff);
+ printf("%c%c%c%c", 0xff, 0xff, 0xff, 0xff);
+ prev_r_type = relocs[i].rel_type;
+ }
+ buf[7] = (relocs[i].offset >> 0) & 0xff;
+ buf[6] = (relocs[i].offset >> 8) & 0xff;
+ buf[5] = (relocs[i].offset >> 16) & 0xff;
+ buf[4] = (relocs[i].offset >> 24) & 0xff;
+ buf[3] = (relocs[i].offset >> 32) & 0xff;
+ buf[2] = (relocs[i].offset >> 40) & 0xff;
+ buf[1] = (relocs[i].offset >> 48) & 0xff;
+ buf[0] = (relocs[i].offset >> 56) & 0xff;
+ printf("%c%c%c%c", buf[0], buf[1], buf[2], buf[3]);
+ printf("%c%c%c%c", buf[4], buf[5], buf[6], buf[7]);
+ }
+ buf[0] = buf[1] = buf[2] = buf[3] = 0;
+ buf[4] = buf[5] = buf[6] = buf[7] = 0;
+ }
+}
+
+static void usage(void)
+{
+ die("relocs [--abs-syms |--abs-relocs | --text] vmlinux\n");
+}
+
+int main(int argc, char **argv)
+{
+ int show_absolute_syms, show_absolute_relocs;
+ int as_text;
+ const char *fname;
+ FILE *fp;
+ int i;
+
+ show_absolute_syms = 0;
+ show_absolute_relocs = 0;
+ as_text = 0;
+ fname = NULL;
+ for(i = 1; i < argc; i++) {
+ char *arg = argv[i];
+ if (*arg == '-') {
+ if (strcmp(argv[1], "--abs-syms") == 0) {
+ show_absolute_syms = 1;
+ continue;
+ }
+
+ if (strcmp(argv[1], "--abs-relocs") == 0) {
+ show_absolute_relocs = 1;
+ continue;
+ }
+ else if (strcmp(argv[1], "--text") == 0) {
+ as_text = 1;
+ continue;
+ }
+ }
+ else if (!fname) {
+ fname = arg;
+ continue;
+ }
+ usage();
+ }
+ if (!fname) {
+ usage();
+ }
+ fp = fopen(fname, "r");
+ if (!fp) {
+ die("Cannot open %s: %s\n",
+ fname, strerror(errno));
+ }
+ read_ehdr(fp);
+ read_shdrs(fp);
+ read_strtabs(fp);
+ read_symtabs(fp);
+ read_relocs(fp);
+ if (show_absolute_syms) {
+ print_absolute_symbols();
+ return 0;
+ }
+ if (show_absolute_relocs) {
+ print_absolute_relocs();
+ return 0;
+ }
+ emit_relocs(as_text);
+ return 0;
+}
^ permalink raw reply
* [RFC v3 PATCH 0/4] Relocatable kernel support for PPC64
From: Mohan Kumar M @ 2008-07-17 18:33 UTC (permalink / raw)
To: ppcdev; +Cc: paulus, miltonm
Hi,
Following four patches enable the "relocatable kernel" feature for
PPC64 kernels.
1. extract_relocation_info.patch
2. relocation_build.patch
3. apply_relocation.patch
4. relocation_support.patch
With the patchset, vmcore image of a crashed system can be captured
using the same kernel binary.
Still the kernel is not a fully relocatable kernel. It can either run at
0 or 32MB based on which address its loaded. If its loaded by 'kexec -p',
it behaves as a relocatable kernel and runs at 32MB(even though its
compiled for 0). If the same kernel is loaded by yaboot or kexec -l, it
will behave as a normal kernel and will run at the compiled address.
Difference between v3 and v2
* Relocatable kernel build process is integrated with the kernel
build.
* The problem kdump kernel boot fail on some specific systems is fixed now.
Issues:
* Relocatable vmlinux image is built in arch/powerpc/boot as
vmlinux.reloc. But it should be built in top level directory of kernel
source as vmlinux instead of vmlinux.reloc
* During kdump kernel boot, all secondary processors are stuck up. But
during yaboot all secondary processors are brought online.
Tested on POWER5 systems.
Please send me your suggestions and feedbacks.
Regards,
Mohan.
^ permalink raw reply
* RE: 82xx performance
From: Rune Torgersen @ 2008-07-17 18:24 UTC (permalink / raw)
To: Arnd Bergmann, linuxppc-dev; +Cc: Milton Miller
In-Reply-To: <200807171747.28624.arnd@arndb.de>
Arnd Bergmann wrote:
> Seeing more hits in handle_mm_fault suggests that you have
> a higher page fault rate. A trivial reason for this might
> be that the amount of memory was misdetected in the new
> code (maybe broken device tree). What is the content of
> /proc/meminfo after a fresh boot?
Powerpc
MemTotal: 1011296 kB
MemFree: 953884 kB
Buffers: 20316 kB
Cached: 25896 kB
SwapCached: 0 kB
Active: 26228 kB
Inactive: 25652 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 132 kB
Writeback: 0 kB
AnonPages: 5684 kB
Mapped: 2436 kB
Slab: 2460 kB
SReclaimable: 732 kB
SUnreclaim: 1728 kB
PageTables: 208 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
CommitLimit: 505648 kB
Committed_AS: 11472 kB
VmallocTotal: 474756 kB
VmallocUsed: 8776 kB
VmallocChunk: 465664 kB
Ppc:
MemTotal: 1011500 kB
MemFree: 954868 kB
Buffers: 20696 kB
Cached: 25044 kB
SwapCached: 0 kB
Active: 26816 kB
Inactive: 24588 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 124 kB
Writeback: 0 kB
AnonPages: 5680 kB
Mapped: 2456 kB
Slab: 2056 kB
SReclaimable: 736 kB
SUnreclaim: 1320 kB
PageTables: 180 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
CommitLimit: 505748 kB
Committed_AS: 11468 kB
VmallocTotal: 245696 kB
VmallocUsed: 360 kB
VmallocChunk: 245276 kB
> If it's the same, try running a kernel build with 'time --verbose',
> using GNU time instead of the bash builtin time to see how the page
> fault rate changed.=20
Arch/powerpc
Command being timed: "make vmlinux"
User time (seconds): 4339.11
System time (seconds): 319.41
Percent of CPU this job got: 99%
Elapsed (wall clock) time (h:mm:ss or m:ss): 1:17:42
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
Maximum resident set size (kbytes): 0
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 0
Minor (reclaiming a frame) page faults: 4213347
Voluntary context switches: 53543
Involuntary context switches: 90165
Swaps: 0
File system inputs: 0
File system outputs: 0
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 0
Arch/ppc
Command being timed: "make vmlinux"
User time (seconds): 4177.11
System time (seconds): 295.00
Percent of CPU this job got: 99%
Elapsed (wall clock) time (h:mm:ss or m:ss): 1:14:35
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
Maximum resident set size (kbytes): 0
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 0
Minor (reclaiming a frame) page faults: 4203103
Voluntary context switches: 53812
Involuntary context switches: 85856
Swaps: 0
File system inputs: 0
File system outputs: 0
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 0
^ permalink raw reply
* [2.6 patch] powerpc/boot/dtc-src/dtc-lexer.l: add %option noinput
From: Adrian Bunk @ 2008-07-17 18:19 UTC (permalink / raw)
To: David Gibson, Paul Mackerras, benh; +Cc: linuxppc-dev
gcc 4.3 correctly determines that input() is unused and gives the
following warning:
<-- snip -->
...
HOSTCC arch/powerpc/boot/dtc-src/dtc-lexer.lex.o
dtc-lexer.lex.c:1436: warning: ‘input’ defined but not used
...
<-- snip -->
Fix it by adding %option noinput to
arch/powerpc/boot/dtc-src/dtc-lexer.l and
regeneration of arch/powerpc/boot/dtc-src/dtc-lexer.lex.c_shipped.
Signed-off-by: Adrian Bunk <bunk@kernel.org>
---
arch/powerpc/boot/dtc-src/dtc-lexer.l | 2
arch/powerpc/boot/dtc-src/dtc-lexer.lex.c_shipped | 127 +++++++++-----
2 files changed, 84 insertions(+), 45 deletions(-)
551cd080360b31cf9b8bb387916f3852e4fb6156
diff --git a/arch/powerpc/boot/dtc-src/dtc-lexer.l b/arch/powerpc/boot/dtc-src/dtc-lexer.l
index c811b22..1f76fea 100644
--- a/arch/powerpc/boot/dtc-src/dtc-lexer.l
+++ b/arch/powerpc/boot/dtc-src/dtc-lexer.l
@@ -18,7 +18,7 @@
* USA
*/
-%option noyywrap nounput yylineno
+%option noyywrap nounput yylineno noinput
%x INCLUDE
%x BYTESTRING
diff --git a/arch/powerpc/boot/dtc-src/dtc-lexer.lex.c_shipped b/arch/powerpc/boot/dtc-src/dtc-lexer.lex.c_shipped
index d0f7424..fa309bc 100644
--- a/arch/powerpc/boot/dtc-src/dtc-lexer.lex.c_shipped
+++ b/arch/powerpc/boot/dtc-src/dtc-lexer.lex.c_shipped
@@ -1,6 +1,6 @@
-#line 2 "dtc-lexer.lex.c"
+#line 2 "arch/powerpc/boot/dtc-src/dtc-lexer.lex.c"
-#line 4 "dtc-lexer.lex.c"
+#line 4 "arch/powerpc/boot/dtc-src/dtc-lexer.lex.c"
#define YY_INT_ALIGNED short int
@@ -9,7 +9,7 @@
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5
-#define YY_FLEX_SUBMINOR_VERSION 33
+#define YY_FLEX_SUBMINOR_VERSION 35
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif
@@ -31,7 +31,7 @@
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
-#if __STDC_VERSION__ >= 199901L
+#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
* if you want the limit (max/min) macros for int types.
@@ -54,7 +54,6 @@ typedef int flex_int32_t;
typedef unsigned char flex_uint8_t;
typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t;
-#endif /* ! C99 */
/* Limits of integral types. */
#ifndef INT8_MIN
@@ -85,6 +84,8 @@ typedef unsigned int flex_uint32_t;
#define UINT32_MAX (4294967295U)
#endif
+#endif /* ! C99 */
+
#endif /* ! FLEXINT_H */
#ifdef __cplusplus
@@ -94,11 +95,12 @@ typedef unsigned int flex_uint32_t;
#else /* ! __cplusplus */
-#if __STDC__
+/* C99 requires __STDC__ to be defined as 1. */
+#if defined (__STDC__)
#define YY_USE_CONST
-#endif /* __STDC__ */
+#endif /* defined (__STDC__) */
#endif /* ! __cplusplus */
#ifdef YY_USE_CONST
@@ -191,14 +193,9 @@ extern FILE *yyin, *yyout;
#define unput(c) yyunput( c, (yytext_ptr) )
-/* The following is because we cannot portably get our hands on size_t
- * (without autoconf's help, which isn't available because we want
- * flex-generated scanners to compile on their own).
- */
-
#ifndef YY_TYPEDEF_YY_SIZE_T
#define YY_TYPEDEF_YY_SIZE_T
-typedef unsigned int yy_size_t;
+typedef size_t yy_size_t;
#endif
#ifndef YY_STRUCT_YY_BUFFER_STATE
@@ -349,7 +346,7 @@ void yyfree (void * );
/* Begin user sect3 */
-#define yywrap() 1
+#define yywrap(n) 1
#define YY_SKIP_YYWRAP
typedef unsigned char YY_CHAR;
@@ -576,7 +573,7 @@ int yy_flex_debug = 0;
#define YY_MORE_ADJ 0
#define YY_RESTORE_YY_MORE_OFFSET
char *yytext;
-#line 1 "dtc-lexer.l"
+#line 1 "arch/powerpc/boot/dtc-src/dtc-lexer.l"
/*
* (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation. 2005.
*
@@ -596,11 +593,12 @@ char *yytext;
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*/
+#define YY_NO_INPUT 1
-#line 33 "dtc-lexer.l"
+#line 33 "arch/powerpc/boot/dtc-src/dtc-lexer.l"
#include "dtc.h"
#include "srcpos.h"
#include "dtc-parser.tab.h"
@@ -623,7 +621,7 @@ static int dts_version; /* = 0 */
DPRINT("<V1>\n"); \
BEGIN(V1); \
}
-#line 627 "dtc-lexer.lex.c"
+#line 625 "arch/powerpc/boot/dtc-src/dtc-lexer.lex.c"
#define INITIAL 0
#define INCLUDE 1
@@ -645,6 +643,35 @@ static int dts_version; /* = 0 */
static int yy_init_globals (void );
+/* Accessor methods to globals.
+ These are made visible to non-reentrant scanners for convenience. */
+
+int yylex_destroy (void );
+
+int yyget_debug (void );
+
+void yyset_debug (int debug_flag );
+
+YY_EXTRA_TYPE yyget_extra (void );
+
+void yyset_extra (YY_EXTRA_TYPE user_defined );
+
+FILE *yyget_in (void );
+
+void yyset_in (FILE * in_str );
+
+FILE *yyget_out (void );
+
+void yyset_out (FILE * out_str );
+
+int yyget_leng (void );
+
+char *yyget_text (void );
+
+int yyget_lineno (void );
+
+void yyset_lineno (int line_number );
+
/* Macros after this point can all be overridden by user definitions in
* section 1.
*/
@@ -685,7 +712,7 @@ static int input (void );
/* This used to be an fputs(), but since the string might contain NUL's,
* we now use fwrite().
*/
-#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
+#define ECHO fwrite( yytext, yyleng, 1, yyout )
#endif
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
@@ -778,9 +805,9 @@ YY_DECL
register char *yy_cp, *yy_bp;
register int yy_act;
-#line 57 "dtc-lexer.l"
+#line 57 "arch/powerpc/boot/dtc-src/dtc-lexer.l"
-#line 784 "dtc-lexer.lex.c"
+#line 811 "arch/powerpc/boot/dtc-src/dtc-lexer.lex.c"
if ( !(yy_init) )
{
@@ -875,12 +902,12 @@ do_action: /* This label is used only to access EOF actions. */
case 1:
YY_RULE_SETUP
-#line 58 "dtc-lexer.l"
+#line 58 "arch/powerpc/boot/dtc-src/dtc-lexer.l"
BEGIN(INCLUDE);
YY_BREAK
case 2:
YY_RULE_SETUP
-#line 60 "dtc-lexer.l"
+#line 60 "arch/powerpc/boot/dtc-src/dtc-lexer.l"
{
yytext[strlen(yytext) - 1] = 0;
if (!push_input_file(yytext + 1)) {
@@ -895,7 +922,7 @@ case YY_STATE_EOF(INCLUDE):
case YY_STATE_EOF(BYTESTRING):
case YY_STATE_EOF(PROPNODENAME):
case YY_STATE_EOF(V1):
-#line 70 "dtc-lexer.l"
+#line 70 "arch/powerpc/boot/dtc-src/dtc-lexer.l"
{
if (!pop_input_file()) {
yyterminate();
@@ -905,7 +932,7 @@ case YY_STATE_EOF(V1):
case 3:
/* rule 3 can match eol */
YY_RULE_SETUP
-#line 76 "dtc-lexer.l"
+#line 76 "arch/powerpc/boot/dtc-src/dtc-lexer.l"
{
yylloc.filenum = srcpos_filenum;
yylloc.first_line = yylineno;
@@ -918,7 +945,7 @@ YY_RULE_SETUP
YY_BREAK
case 4:
YY_RULE_SETUP
-#line 86 "dtc-lexer.l"
+#line 86 "arch/powerpc/boot/dtc-src/dtc-lexer.l"
{
yylloc.filenum = srcpos_filenum;
yylloc.first_line = yylineno;
@@ -930,7 +957,7 @@ YY_RULE_SETUP
YY_BREAK
case 5:
YY_RULE_SETUP
-#line 95 "dtc-lexer.l"
+#line 95 "arch/powerpc/boot/dtc-src/dtc-lexer.l"
{
yylloc.filenum = srcpos_filenum;
yylloc.first_line = yylineno;
@@ -941,7 +968,7 @@ YY_RULE_SETUP
YY_BREAK
case 6:
YY_RULE_SETUP
-#line 103 "dtc-lexer.l"
+#line 103 "arch/powerpc/boot/dtc-src/dtc-lexer.l"
{
yylloc.filenum = srcpos_filenum;
yylloc.first_line = yylineno;
@@ -953,7 +980,7 @@ YY_RULE_SETUP
YY_BREAK
case 7:
YY_RULE_SETUP
-#line 112 "dtc-lexer.l"
+#line 112 "arch/powerpc/boot/dtc-src/dtc-lexer.l"
{
yylloc.filenum = srcpos_filenum;
yylloc.first_line = yylineno;
@@ -971,7 +998,7 @@ YY_RULE_SETUP
YY_BREAK
case 8:
YY_RULE_SETUP
-#line 127 "dtc-lexer.l"
+#line 127 "arch/powerpc/boot/dtc-src/dtc-lexer.l"
{
yylloc.filenum = srcpos_filenum;
yylloc.first_line = yylineno;
@@ -982,7 +1009,7 @@ YY_RULE_SETUP
YY_BREAK
case 9:
YY_RULE_SETUP
-#line 135 "dtc-lexer.l"
+#line 135 "arch/powerpc/boot/dtc-src/dtc-lexer.l"
{
yylloc.filenum = srcpos_filenum;
yylloc.first_line = yylineno;
@@ -993,7 +1020,7 @@ YY_RULE_SETUP
YY_BREAK
case 10:
YY_RULE_SETUP
-#line 143 "dtc-lexer.l"
+#line 143 "arch/powerpc/boot/dtc-src/dtc-lexer.l"
{ /* label reference */
yylloc.filenum = srcpos_filenum;
yylloc.first_line = yylineno;
@@ -1004,7 +1031,7 @@ YY_RULE_SETUP
YY_BREAK
case 11:
YY_RULE_SETUP
-#line 151 "dtc-lexer.l"
+#line 151 "arch/powerpc/boot/dtc-src/dtc-lexer.l"
{ /* new-style path reference */
yylloc.filenum = srcpos_filenum;
yylloc.first_line = yylineno;
@@ -1016,7 +1043,7 @@ YY_RULE_SETUP
YY_BREAK
case 12:
YY_RULE_SETUP
-#line 160 "dtc-lexer.l"
+#line 160 "arch/powerpc/boot/dtc-src/dtc-lexer.l"
{ /* old-style path reference */
yylloc.filenum = srcpos_filenum;
yylloc.first_line = yylineno;
@@ -1027,7 +1054,7 @@ YY_RULE_SETUP
YY_BREAK
case 13:
YY_RULE_SETUP
-#line 168 "dtc-lexer.l"
+#line 168 "arch/powerpc/boot/dtc-src/dtc-lexer.l"
{
yylloc.filenum = srcpos_filenum;
yylloc.first_line = yylineno;
@@ -1038,7 +1065,7 @@ YY_RULE_SETUP
YY_BREAK
case 14:
YY_RULE_SETUP
-#line 176 "dtc-lexer.l"
+#line 176 "arch/powerpc/boot/dtc-src/dtc-lexer.l"
{
yylloc.filenum = srcpos_filenum;
yylloc.first_line = yylineno;
@@ -1049,7 +1076,7 @@ YY_RULE_SETUP
YY_BREAK
case 15:
YY_RULE_SETUP
-#line 184 "dtc-lexer.l"
+#line 184 "arch/powerpc/boot/dtc-src/dtc-lexer.l"
{
yylloc.filenum = srcpos_filenum;
yylloc.first_line = yylineno;
@@ -1062,13 +1089,13 @@ YY_RULE_SETUP
case 16:
/* rule 16 can match eol */
YY_RULE_SETUP
-#line 194 "dtc-lexer.l"
+#line 194 "arch/powerpc/boot/dtc-src/dtc-lexer.l"
/* eat whitespace */
YY_BREAK
case 17:
/* rule 17 can match eol */
YY_RULE_SETUP
-#line 196 "dtc-lexer.l"
+#line 196 "arch/powerpc/boot/dtc-src/dtc-lexer.l"
{
yylloc.filenum = srcpos_filenum;
yylloc.first_line = yylineno;
@@ -1079,12 +1106,12 @@ YY_RULE_SETUP
case 18:
/* rule 18 can match eol */
YY_RULE_SETUP
-#line 203 "dtc-lexer.l"
+#line 203 "arch/powerpc/boot/dtc-src/dtc-lexer.l"
/* eat line comments */
YY_BREAK
case 19:
YY_RULE_SETUP
-#line 205 "dtc-lexer.l"
+#line 205 "arch/powerpc/boot/dtc-src/dtc-lexer.l"
{
yylloc.filenum = srcpos_filenum;
yylloc.first_line = yylineno;
@@ -1104,10 +1131,10 @@ YY_RULE_SETUP
YY_BREAK
case 20:
YY_RULE_SETUP
-#line 222 "dtc-lexer.l"
+#line 222 "arch/powerpc/boot/dtc-src/dtc-lexer.l"
ECHO;
YY_BREAK
-#line 1111 "dtc-lexer.lex.c"
+#line 1138 "arch/powerpc/boot/dtc-src/dtc-lexer.lex.c"
case YY_END_OF_BUFFER:
{
@@ -1360,6 +1387,14 @@ static int yy_get_next_buffer (void)
else
ret_val = EOB_ACT_CONTINUE_SCAN;
+ if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+ /* Extend the array by 50%, plus the number we really need. */
+ yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
+ if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
+ }
+
(yy_n_chars) += number_to_move;
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
@@ -1743,7 +1778,9 @@ static void yyensure_buffer_stack (void)
(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
(num_to_alloc * sizeof(struct yy_buffer_state*)
);
-
+ if ( ! (yy_buffer_stack) )
+ YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
+
memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
(yy_buffer_stack_max) = num_to_alloc;
@@ -1761,6 +1798,8 @@ static void yyensure_buffer_stack (void)
((yy_buffer_stack),
num_to_alloc * sizeof(struct yy_buffer_state*)
);
+ if ( ! (yy_buffer_stack) )
+ YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
/* zero only the new slots.*/
memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
@@ -2062,7 +2101,7 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
-#line 222 "dtc-lexer.l"
+#line 222 "arch/powerpc/boot/dtc-src/dtc-lexer.l"
^ permalink raw reply related
* [2.6 patch] powerpc/boot/Makefile: change spaces to tabs
From: Adrian Bunk @ 2008-07-17 18:18 UTC (permalink / raw)
To: David Gibson, Paul Mackerras, benh; +Cc: linuxppc-dev
For C code spaces versus tabs is just a religious issue,
but for Makefiles it actually matters.
This patch fixes he following errors:
/home/bunk/linux/kernel-2.6/git/linux-2.6/arch/powerpc/boot/Makefile:166: *** missing separator. Stop.
/home/bunk/linux/kernel-2.6/git/linux-2.6/arch/powerpc/boot/Makefile:171: *** missing separator. Stop.
Since this was inside an ifdef DTC_GENPARSER it was not a problem unless
someone wanted to regenerate the shipped generated files.
Signed-off-by: Adrian Bunk <bunk@kernel.org>
---
arch/powerpc/boot/Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -163,12 +163,12 @@ quiet_cmd_flex = FLEX $@
cmd_flex = $(FLEX) -o$@ $<; cp $@ $@_shipped
$(obj)/dtc-src/dtc-parser.tab.c: $(src)/dtc-src/dtc-parser.y FORCE
- $(call if_changed,bison)
+ $(call if_changed,bison)
$(obj)/dtc-src/dtc-parser.tab.h: $(obj)/dtc-src/dtc-parser.tab.c
$(obj)/dtc-src/dtc-lexer.lex.c: $(src)/dtc-src/dtc-lexer.l FORCE
- $(call if_changed,flex)
+ $(call if_changed,flex)
endif
#############
^ permalink raw reply
* [2.6 patch] powerpc: remove duplicate 6xx option
From: Adrian Bunk @ 2008-07-17 18:18 UTC (permalink / raw)
To: paulus, benh; +Cc: linuxppc-dev
The real option is above in the same Kconfig file.
Signed-off-by: Adrian Bunk <bunk@kernel.org>
---
2251e74345df51309579a0a5fd8339e2f14762b9
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index 5bc4b61..6489d57 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -84,9 +84,6 @@ config TUNE_CELL
machines. When building a kernel that is supposed to run only
on Cell, you should also select the POWER4_ONLY option.
-config 6xx
- bool
-
# this is temp to handle compat with arch=ppc
config 8xx
bool
^ permalink raw reply related
* Re: [PATCH v3] leds: implement OpenFirmare GPIO LED driver
From: Grant Likely @ 2008-07-17 18:05 UTC (permalink / raw)
To: avorontsov
Cc: Stephen Rothwell, linux-kernel, linuxppc-dev, Richard Purdie,
Trent Piepho
In-Reply-To: <20080717152006.GA26120@polina.dev.rtsoft.ru>
On Thu, Jul 17, 2008 at 9:20 AM, Anton Vorontsov
<avorontsov@ru.mvista.com> wrote:
> On Thu, Jul 17, 2008 at 09:04:22AM -0600, Grant Likely wrote:
>> On Thu, Jul 17, 2008 at 06:13:35PM +0400, Anton Vorontsov wrote:
>> > On Thu, Jul 17, 2008 at 06:05:19PM +0400, Anton Vorontsov wrote:
>> > [...]
>> > > > I think it would be better to have a module that scans the device tree
>> > > > for LED nodes and registers a single leds-gpio platform device for the
>> > > > whole lot.
>> > > >
>> > > > Thoughts?
>> > >
>> > > I like the idea, thanks.
>> >
>> > Ugh, no. The idea sounds good, but in practice it isn't, since we'll
>> > have to handle suspend/resume ops ourselves. When we stick with the
>> > device/driver model we're getting all this for free.
>>
>> Won't the leds-gpio driver give you suspend/resume support?
>
> Ah. I just wrongly read your message. You're purposing to use gpio
> leds platform driver... I think this is doable, yes.
Alternately, I would also be okay with a scheme where all LED nodes
have a common parent and an of_platform driver would bind against the
parent node; not the individual children. Then the leds-gpio driver
could be refactored to have both platform and of_platform bus
bindings.
Cheers,
g.
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
^ permalink raw reply
* Re: [PATCH] i2c-mpc: suppress I2C device probing
From: Grant Likely @ 2008-07-17 18:02 UTC (permalink / raw)
To: Wolfgang Grandegger; +Cc: Jean Delvare, Linuxppc-dev
In-Reply-To: <487F20EC.9040503@grandegger.com>
On Thu, Jul 17, 2008 at 4:37 AM, Wolfgang Grandegger <wg@grandegger.com> wrote:
> This patch suppresses I2C device probing by clearing the class field
> of the "struct i2c_adapter" for the MPC I2C bus adapters. Some board
> configurations which rely on probing must be fixed up by adding a
> proper I2C device node to the DTS file, like the TQM85xx modules.
>
> Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
> ---
> drivers/i2c/busses/i2c-mpc.c | 1 -
> 1 file changed, 1 deletion(-)
>
> Index: powerpc/drivers/i2c/busses/i2c-mpc.c
> ===================================================================
> --- powerpc.orig/drivers/i2c/busses/i2c-mpc.c
> +++ powerpc/drivers/i2c/busses/i2c-mpc.c
> @@ -312,7 +312,6 @@ static struct i2c_adapter mpc_ops = {
> .name = "MPC adapter",
> .id = I2C_HW_MPC107,
> .algo = &mpc_algo,
> - .class = I2C_CLASS_HWMON | I2C_CLASS_SPD,
> .timeout = 1,
> };
>
>
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
^ permalink raw reply
* Re: [PATCH] elf loader support for auxvec base platform string
From: Nathan Lynch @ 2008-07-17 17:39 UTC (permalink / raw)
To: Andrew Morton; +Cc: Linus Torvalds, linux-kernel, roland, linuxppc-dev
In-Reply-To: <20080717000951.5f8cab37.akpm@linux-foundation.org>
Andrew Morton wrote:
> > On Tue, 2008-07-15 at 18:58 -0500, Nathan Lynch wrote:
> > > diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
> > > index d48ff5f..834c2c4 100644
> > > --- a/fs/binfmt_elf.c
> > > +++ b/fs/binfmt_elf.c
> > > @@ -131,6 +131,10 @@ static int padzero(unsigned long elf_bss)
> > > #define STACK_ALLOC(sp, len) ({ sp -= len ; sp; })
> > > #endif
> > >
> > > +#ifndef ELF_BASE_PLATFORM
> > > +#define ELF_BASE_PLATFORM NULL
> > > +#endif
>
> Please add a comment which explains what this is.
>
> Please also add a comment telling the world in which header file the
> architecture *must* define this macro and then ensure that that header is
> included into this file by reliable means. asm/elf.h looks OK.
Okay.
> > > @@ -172,6 +178,19 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec,
> > > return -EFAULT;
> > > }
> > >
> > > + /*
> > > + * If this architecture has a "base" platform capability
> > > + * string, copy it to userspace.
> > > + */
> > > + u_base_platform = NULL;
> > > + if (k_base_platform) {
> > > + size_t len = strlen(k_base_platform) + 1;
> > > +
> > > + u_base_platform = (elf_addr_t __user *)STACK_ALLOC(p, len);
> > > + if (__copy_to_user(u_base_platform, k_base_platform, len))
> > > + return -EFAULT;
> > > + }
>
> >From my reading, this change will result in no additional code
> generation on non-powerpc architectures. This is good. If poss, could
> you please verify that theory and perhaps drop a note in the changelog
> about that?
That was the intent, yes. However:
$ scripts/bloat-o-meter vmlinux-x86-{before,after}
add/remove: 0/0 grow/shrink: 2/0 up/down: 18/0 (18)
function old new delta
init_mm 784 800 +16
load_elf_binary 11946 11948 +2
(x86_64_defconfig, gcc 4.2.3)
The init_mm/mm_struct bloat is expected (although I'd like to avoid
that), but evidently it has some small effect on load_elf_binary.
^ permalink raw reply
* Re: Freescale UCC_GETH Half Duplex Patch
From: Kim Phillips @ 2008-07-17 17:01 UTC (permalink / raw)
To: Kim Phillips; +Cc: chuck, rmcguire, linuxppc-embedded
In-Reply-To: <20080711124604.caf199e9.kim.phillips@freescale.com>
On Fri, 11 Jul 2008 12:46:04 -0500
Kim Phillips <kim.phillips@freescale.com> wrote:
> It needs to be sent to the netdev mailing list, and see if you can get
> rid of the MIME-encoding (see linux-2.6/Documentation/email-clients.txt).
>
> And don't forget to add a signed-off-by line, too.
Hi Russell, may I have your signed-off-by so that I may submit this to
netdev to be applied on your behalf? I'll keep the attributions
intact, of course.
Kim
^ permalink raw reply
* Re: [PATCH 4/6] crypto: talitos - fix GFP flag usage
From: Kim Phillips @ 2008-07-17 16:22 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev, Herbert Xu, linux-crypto
In-Reply-To: <8819CEAD-C9D4-4645-A272-026AE2B39D7B@kernel.crashing.org>
On Thu, 17 Jul 2008 10:51:43 -0500
Kumar Gala <galak@kernel.crashing.org> wrote:
>
> On Jul 17, 2008, at 10:27 AM, Kim Phillips wrote:
>
> > On Thu, 17 Jul 2008 07:26:14 -0500
> > Kumar Gala <galak@kernel.crashing.org> wrote:
> >
> >>
> >> On Jul 17, 2008, at 7:17 AM, Herbert Xu wrote:
> >>
> >>> On Wed, Jul 16, 2008 at 06:33:45PM -0500, Kumar Gala wrote:
> >>>>
> >>>> On Jul 16, 2008, at 6:22 PM, Kim Phillips wrote:
> >>>>
> >>>>> use GFP_ATOMIC when necessary; use atomic_t when allocating
> >>>>> submit_count.
> >>>>
> >>>> why?
> >>>
> >>> You mean why are atomics required? Yes that is a good question.
> >>
> >> Yep. the commit message isn't explaining why, just what :)
> >
> > In honouring requests that don't have the CRYPTO_TFM_REQ_MAY_SLEEP
> > set,
> > afaict, it's the standard non-wait variant GFP that drivers use (see
> > the ixp4xx driver for e.g.).
>
> so GFP_ATOMIC and atomic_t aren't related. I can understand the need
> for GFP_ATOMIC, but I don't get why something needs to be declared
> atomic_t.
I see what the source of confusion is now; it appears I missed this
atomic_t clean-up when making the patchseries; the atomic_t fix belongs
in the previous "preempt overflow interrupts" patch (3/6).
atomic_t is needed for atomic operations which protect resource
contention on submit_count, which subsequently represents submission
slot availability on a particular SEC channel for multiple, potentially
simultaneous, users.
Kim
^ permalink raw reply
* Re: Calling the kernel from a mini-bootloader
From: Milton Miller @ 2008-07-17 16:14 UTC (permalink / raw)
To: Guillaume Dargaud; +Cc: ppcdev
On Thu Jul 17 at 23:22:28 EST in 2008, Guillaume Dargaud wrote:
> Hello all,
> I'm in the process of writing a mini-bootloaler for a custom board and
> would
> like some feedback on my boot methodology.
>
> Basically the kernel code (elf file) is copied into memory by a JTAG
> debugger. A custom program (yet to be finished) then copies it onto an
> onboard flash memory using serial commands. This flash is not part of
> the
> flat memory addressing.
>
> When I want to boot, I have a small bootloader put into an eprom that
> _is_
> part of the flat memory addressing. This (finished but not tested yet)
> bootloader basically does two things:
> - it copies the content of the first flash into RAM
> - it launches it using a custom function call like "0x400000();"
>
> Now, I'd like to know if this is a reasonable approach ? I couldn't
> think of
> a better way, but maybe there are issues I didn't think off.
This is a very reasonable approach, and is quite similar to what
I do.
You actually have a few choices. You can put just the loaded
data, or you can put the elf file and parse the header in your
boot loader. After seeing the advantages, I would keep the elf
header. One big advantage of keeping the elf header is you can
see how much data will be zeroed for bss when the kernel starts.
Another choice is rather than loading the kernel, build a zImage
of some kind (see the code in arch/powerpc/boot). This way the
kernel code and static data is compressed. I often see a 3-fold
reduction in size. You can also attach an initrd, should you
decide to use initramfs later. More o this below.
Both the kernel and zImage will build an elf file with a single
load header. Both can run regardless of where they are loaded,
so you don't have to worry about parsing the load address, just
calculating the relatve entry point. (The kernel will move
itself down to address 0 (except book-e parts), and the zImage
will run where it is started. However, the default zImage will
fail to start the kernel if it isn't loaded above the link size
of the kernel (including bss).
> One additional question, if the above is valid, is that I would like
> to pass
> a particular argument to the kernel to set its MAC address. I can read
> an
> external value (similar to jumpers) from the bootloader via GPIO. Is
> there a
> way to pass this value to the kernel so that a modified
> arch/ppc/boot/simple/embed_config.c can use it to set the MAC address ?
>
> Maybe the main() of the kernel can receive argv/argc the usual way,
> and I
> just need to call "0x400000(argc, argv);" but I have no idea if that
> works.
Ahh ... you are still on ppc. Please note that we just merged
the removal of arch/ppc, everyone needs to use powerpc now. The
good news is: its easier to state the requirements, and its
easier to share the code in vmlinux. The bad news is you have to
follow the rules for passing data to the kernel. Its not hard.
We have defined a data structure that is parsed to become a tree
of data describing the machine, and based the contents on open
firmware. We call this the flattened device tree.
To pass the MAC address, one uses a property to the device node
which also describes what the hardware is (by name) and the
address space it uses. Similarly, the kernel finds out how fast
the cpu and timebase are running by reading properties in the cpu
node.
Please read Documentation/powerpc/booting-without-of for more
information. To summarize, the kernel is started with a pointer
to the device tree structure, and it contains all the information
needed. All the data the kernel needs will be in one flat linear
chunk, but the kernel will move itself in memory to its linked
location. The 32 bit kernel does require r1 to be set to the
top of a memory block that can be used as a stack.
There are several options to get the data into the device tree.
If you choose to use the zImage format mentioned above, the
device tree library is compiled in and you would just write a bit
of c code to read your structure and tell the library to put it
in the device tree. The standard initialization preserves r3-r6
so you get 4 32 bit args (or maybe 5) to pass data or pointers.
Ohterwise, there is a tool called dtc (device tree compiler) that
that creates the binary structure from a source file that is
human readable. From this, there is a library that will modify
the tree at runtime.
Another approach is to modify the device tree directly from your
first stage. While you can link the library into your first
stage, you can also just tell dtc to output an assembly file with
symbolic labels on the data you need to modify. You would then
pass this structure to the zImage wrapper or directly to the
kernel.
To see how simple this approach can be when you only need to
modify a few parameters, I will point out my [qemu-rom v2 patch.
Hmm, thats not it, where is it? I thought I had posted this to
linuxppc-dev but can't find it.]
I will point out the minimal rom image I did for qemu where the
device tree is linked into the assembly, the kernel elf file is
already loaded, but I had to copy the nvram data serially into
ram and then poke the memory size and initrd location into the
device tree.
http://landley.net/hg/firmware/raw-file/92f89c9c9495/sources/toys/make-
ppc_rom.tar.bz2
> Thanks for suggestions.
You're welcome.
milton
^ permalink raw reply
* [PATCH] powerpc: FSL UPM NAND bindings, add read-fetch-delay property
From: Wolfgang Grandegger @ 2008-07-17 16:11 UTC (permalink / raw)
To: Linuxppc-dev
This patch adds the binding for the property "read-fetch-delay" to the
sub-nodes of the "fsl,upm-nand" compatible nodes. It will be used by a
patch extending the support of the FSL UPM NAND driver for the TQM8548
modules, which do not have the R/B pin of the NAND chip connected.
Furthermore it documents the missing FLASH partition bindings.
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
---
As soon as this new binding is accepted, I going to send the patch for
the FSL UPM NAND driver to the MTD mailing list. An old version can be
found here:
http://ozlabs.org/pipermail/linuxppc-dev/2008-June/057632.html
TIA.
Wolfgang.
Documentation/powerpc/dts-bindings/fsl/upm-nand.txt | 39 +++++++++++++++++---
1 file changed, 35 insertions(+), 4 deletions(-)
Index: linux-2.6-galak/Documentation/powerpc/dts-bindings/fsl/upm-nand.txt
===================================================================
--- linux-2.6-galak.orig/Documentation/powerpc/dts-bindings/fsl/upm-nand.txt
+++ linux-2.6-galak/Documentation/powerpc/dts-bindings/fsl/upm-nand.txt
@@ -1,11 +1,34 @@
Freescale Localbus UPM programmed to work with NAND flash
-Required properties:
+Properties:
- compatible : "fsl,upm-nand".
- reg : should specify localbus chip select and size used for the chip.
- fsl,upm-addr-offset : UPM pattern offset for the address latch.
- fsl,upm-cmd-offset : UPM pattern offset for the command latch.
-- gpios : may specify optional GPIO connected to the Ready-Not-Busy pin.
+- gpios : (optional) may specify GPIO connected to the Ready-Not-Busy
+ pin.
+
+Each NAND flash is represented as a sub-node of the UPM node. The
+nodes's name represents the name of the corresponding device.
+
+NAND flash properties:
+- compatible : (optional) not yet used.
+- read-fetch-delay : (optional) chip dependent delay for transferring
+ data from array to read regs (tR).
+
+Each partition is represented as a sub-node of the NAND flash device.
+Each node's name represents the name of the corresponding partition
+of the flash device.
+
+NAND flash partition properties:
+- reg : The partition's offset and size within the flash bank.
+- label : (optional) The label / name for this flash partition. If
+ omitted, the label is taken from the node name (excluding the unit
+ address).
+- read-only : (optional) This parameter, if present, is a hint to
+ Linux that this flash partition should only be mounted read-only.
+ This is usually used for flash partitions containing early-boot
+ firmware images or data which should not be clobbered.
Example:
@@ -20,9 +43,17 @@ upm@1,0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "...";
+ read-fetch-delay = 25
+
+ fs@0 {
+ label = "fs";
+ reg = <0x0 0xf80000>;
+ };
- partition@0 {
- ...
+ firmware@f80000 {
+ label ="firmware";
+ reg = <0xf80000 0x80000>;
+ read-only;
};
};
};
^ permalink raw reply
* Re: [PATCH] elf loader support for auxvec base platform string
From: Linus Torvalds @ 2008-07-17 16:10 UTC (permalink / raw)
To: Benjamin Herrenschmidt
Cc: linuxppc-dev, Andrew Morton, Nathan Lynch, linux-kernel, roland
In-Reply-To: <1216276539.7740.309.camel@pasglop>
On Thu, 17 Jul 2008, Benjamin Herrenschmidt wrote:
>
> Should I seek somebody's ack before merging a patch like the one below ?
>
> I'm a bit reluctant to merge via the powerpc.git tree some changes to
> generic files without at least an ack from somebody else :-)
Gaah. Generally we don't, but you're right to ask. The ELF loading keeps
on accumulating these things, and I'm not sure we have the right process
for things like this. They're all individually small and insignificant,
and they are all individually never going away and making the ELF loader
messier and messier.
I dunno.
Linus
^ permalink raw reply
* Re: [PATCH v2 3/3] ALSA SoC: Add Texas Instruments TLV320AIC26 codec driver
From: Timur Tabi @ 2008-07-17 16:02 UTC (permalink / raw)
To: Grant Likely; +Cc: linuxppc-dev, alsa-devel, liam.girdwood
In-Reply-To: <20080712083939.15025.31192.stgit@trillian.secretlab.ca>
Grant Likely wrote:
> + aic26->codec.reg_cache_size = sizeof(aic26->reg_cache);
> + aic26->codec.reg_cache = aic26->reg_cache;
...
> + /* Register the sysfs files for debugging */
> + /* Create SysFS files */
> + rc = device_create_file(&spi->dev, &dev_attr_regs);
> + rc |= device_create_file(&spi->dev, &dev_attr_regs_cache);
> + rc |= device_create_file(&spi->dev, &dev_attr_keyclick);
> + if (rc)
> + dev_info(&spi->dev, "error creating sysfs files\n");
I believe ASoC creates sysfs entries if you use reg_cache and reg_cache_size, so
you should not be creating your own sysfs entries if you use these variables.
> +
> +#if defined(CONFIG_SND_SOC_OF)
> + /* Tell the of_soc helper about this codec */
> + of_snd_soc_register_codec(&aic26_soc_codec_dev, aic26, &aic26_dai,
> + spi->dev.archdata.of_node);
> +#endif
I haven't paid any attention to the of_soc helper, because it's for ASoC V1
only. However, I don't understand why you need to reference it in the codec
driver. My CS4270 codec driver knows nothing about OF and works fine in
arch/powerpc.
--
Timur Tabi
Linux kernel developer at Freescale
^ permalink raw reply
* Re: [PATCH 4/6] crypto: talitos - fix GFP flag usage
From: Kumar Gala @ 2008-07-17 15:51 UTC (permalink / raw)
To: Kim Phillips; +Cc: linuxppc-dev, Herbert Xu, linux-crypto
In-Reply-To: <20080717102746.33381e30.kim.phillips@freescale.com>
On Jul 17, 2008, at 10:27 AM, Kim Phillips wrote:
> On Thu, 17 Jul 2008 07:26:14 -0500
> Kumar Gala <galak@kernel.crashing.org> wrote:
>
>>
>> On Jul 17, 2008, at 7:17 AM, Herbert Xu wrote:
>>
>>> On Wed, Jul 16, 2008 at 06:33:45PM -0500, Kumar Gala wrote:
>>>>
>>>> On Jul 16, 2008, at 6:22 PM, Kim Phillips wrote:
>>>>
>>>>> use GFP_ATOMIC when necessary; use atomic_t when allocating
>>>>> submit_count.
>>>>
>>>> why?
>>>
>>> You mean why are atomics required? Yes that is a good question.
>>
>> Yep. the commit message isn't explaining why, just what :)
>
> In honouring requests that don't have the CRYPTO_TFM_REQ_MAY_SLEEP
> set,
> afaict, it's the standard non-wait variant GFP that drivers use (see
> the ixp4xx driver for e.g.).
so GFP_ATOMIC and atomic_t aren't related. I can understand the need
for GFP_ATOMIC, but I don't get why something needs to be declared
atomic_t.
- k
^ permalink raw reply
* RE: 82xx performance
From: Rune Torgersen @ 2008-07-17 15:52 UTC (permalink / raw)
To: Arnd Bergmann, linuxppc-dev; +Cc: Milton Miller
In-Reply-To: <200807171747.28624.arnd@arndb.de>
Arnd Bergmann wrote:
> Seeing more hits in handle_mm_fault suggests that you have
> a higher page fault rate. A trivial reason for this might
> be that the amount of memory was misdetected in the new
> code (maybe broken device tree). What is the content of
> /proc/meminfo after a fresh boot?
I also just realized that the /aprch/ppc was set up without high-mem
support (using all 1G as lowmem), while the arch/powerpc was set up with
hightmem. I'm retrying a compile without highmem support and 1 G lowmem
on arch/powerpc now to see if it makes a difference.
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox