* [PATCH] powerpc: rework 4xx PTE access and TLB miss
From: Benjamin Herrenschmidt @ 2008-07-01 4:35 UTC (permalink / raw)
To: Josh Boyer; +Cc: linuxppc-dev
This is some preliminary work to improve TLB management on SW loaded
TLB powerpc platforms. This introduce support for non-atomic PTE
operations in pgtable-ppc32.h and removes write back to the PTE from
the TLB miss handlers. In addition, the DSI interrupt code no longer
tries to fixup write permission, this is left to generic code, and
_PAGE_HWWRITE is gone.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
This is a first step, plan is to do the same for FSL BookE, 405 and
possibly 8xx too. From there, I want to rework a bit the execute
permission handling to avoid multiple faults, add support for
_PAGE_EXEC (no executable mappings), for prefaulting (especially
for kmap) and proper SMP support for future SMP capable BookE
platforms.
This version fixes a couple of typos, add a few comments and
change use of flush_instruction_cache() to flush_icache_range()
which will be more appropriate if there is ever an SMP variant.
arch/powerpc/kernel/head_44x.S | 279 ++++++++++++------------------------
arch/powerpc/kernel/head_booke.h | 8 +
arch/powerpc/mm/44x_mmu.c | 29 +++
include/asm-powerpc/pgtable-ppc32.h | 61 +++++--
4 files changed, 177 insertions(+), 200 deletions(-)
--- linux-work.orig/arch/powerpc/kernel/head_44x.S 2008-06-26 15:05:48.000000000 +1000
+++ linux-work/arch/powerpc/kernel/head_44x.S 2008-07-01 14:19:18.000000000 +1000
@@ -293,112 +293,7 @@ interrupt_base:
MCHECK_EXCEPTION(0x0210, MachineCheckA, machine_check_exception)
/* Data Storage Interrupt */
- START_EXCEPTION(DataStorage)
- mtspr SPRN_SPRG0, r10 /* Save some working registers */
- mtspr SPRN_SPRG1, r11
- mtspr SPRN_SPRG4W, r12
- mtspr SPRN_SPRG5W, r13
- mfcr r11
- mtspr SPRN_SPRG7W, r11
-
- /*
- * Check if it was a store fault, if not then bail
- * because a user tried to access a kernel or
- * read-protected page. Otherwise, get the
- * offending address and handle it.
- */
- mfspr r10, SPRN_ESR
- andis. r10, r10, ESR_ST@h
- beq 2f
-
- mfspr r10, SPRN_DEAR /* Get faulting address */
-
- /* If we are faulting a kernel address, we have to use the
- * kernel page tables.
- */
- lis r11, PAGE_OFFSET@h
- cmplw r10, r11
- blt+ 3f
- lis r11, swapper_pg_dir@h
- ori r11, r11, swapper_pg_dir@l
-
- mfspr r12,SPRN_MMUCR
- rlwinm r12,r12,0,0,23 /* Clear TID */
-
- b 4f
-
- /* Get the PGD for the current thread */
-3:
- mfspr r11,SPRN_SPRG3
- lwz r11,PGDIR(r11)
-
- /* Load PID into MMUCR TID */
- mfspr r12,SPRN_MMUCR /* Get MMUCR */
- mfspr r13,SPRN_PID /* Get PID */
- rlwimi r12,r13,0,24,31 /* Set TID */
-
-4:
- mtspr SPRN_MMUCR,r12
-
- rlwinm r12, r10, 13, 19, 29 /* Compute pgdir/pmd offset */
- lwzx r11, r12, r11 /* Get pgd/pmd entry */
- rlwinm. r12, r11, 0, 0, 20 /* Extract pt base address */
- beq 2f /* Bail if no table */
-
- rlwimi r12, r10, 23, 20, 28 /* Compute pte address */
- lwz r11, 4(r12) /* Get pte entry */
-
- andi. r13, r11, _PAGE_RW /* Is it writeable? */
- beq 2f /* Bail if not */
-
- /* Update 'changed'.
- */
- ori r11, r11, _PAGE_DIRTY|_PAGE_ACCESSED|_PAGE_HWWRITE
- stw r11, 4(r12) /* Update Linux page table */
-
- li r13, PPC44x_TLB_SR@l /* Set SR */
- rlwimi r13, r11, 29, 29, 29 /* SX = _PAGE_HWEXEC */
- rlwimi r13, r11, 0, 30, 30 /* SW = _PAGE_RW */
- rlwimi r13, r11, 29, 28, 28 /* UR = _PAGE_USER */
- rlwimi r12, r11, 31, 26, 26 /* (_PAGE_USER>>1)->r12 */
- rlwimi r12, r11, 29, 30, 30 /* (_PAGE_USER>>3)->r12 */
- and r12, r12, r11 /* HWEXEC/RW & USER */
- rlwimi r13, r12, 0, 26, 26 /* UX = HWEXEC & USER */
- rlwimi r13, r12, 3, 27, 27 /* UW = RW & USER */
-
- rlwimi r11,r13,0,26,31 /* Insert static perms */
-
- rlwinm r11,r11,0,20,15 /* Clear U0-U3 */
-
- /* find the TLB index that caused the fault. It has to be here. */
- tlbsx r10, 0, r10
-
- tlbwe r11, r10, PPC44x_TLB_ATTRIB /* Write ATTRIB */
-
- /* Done...restore registers and get out of here.
- */
- mfspr r11, SPRN_SPRG7R
- mtcr r11
- mfspr r13, SPRN_SPRG5R
- mfspr r12, SPRN_SPRG4R
-
- mfspr r11, SPRN_SPRG1
- mfspr r10, SPRN_SPRG0
- rfi /* Force context change */
-
-2:
- /*
- * The bailout. Restore registers to pre-exception conditions
- * and call the heavyweights to help us out.
- */
- mfspr r11, SPRN_SPRG7R
- mtcr r11
- mfspr r13, SPRN_SPRG5R
- mfspr r12, SPRN_SPRG4R
-
- mfspr r11, SPRN_SPRG1
- mfspr r10, SPRN_SPRG0
- b data_access
+ DATA_STORAGE_EXCEPTION
/* Instruction Storage Interrupt */
INSTRUCTION_STORAGE_EXCEPTION
@@ -418,7 +313,6 @@ interrupt_base:
#else
EXCEPTION(0x2010, FloatingPointUnavailable, unknown_exception, EXC_XFER_EE)
#endif
-
/* System Call Interrupt */
START_EXCEPTION(SystemCall)
NORMAL_EXCEPTION_PROLOG
@@ -479,18 +373,57 @@ interrupt_base:
4:
mtspr SPRN_MMUCR,r12
+ /* Mask of required permission bits. Note that while we
+ * do copy ESR:ST to _PAGE_RW position as trying to write
+ * to an RO page is pretty common, we don't do it with
+ * _PAGE_DIRTY. We could do it, but it's a fairly rare
+ * event so I'd rather take the overhead when it happens
+ * rather than adding an instruction here. We should measure
+ * whether the whole thing is worth it in the first place
+ * as we could avoid loading SPRN_ESR completely in the first
+ * place...
+ *
+ * TODO: Is it worth doing that mfspr & rlwimi in the first
+ * place or can we save a couple of instructions here ?
+ */
+ mfspr r12,SPRN_ESR
+ li r13,_PAGE_PRESENT|_PAGE_ACCESSED
+ rlwimi r13,r12,10,30,30
+
+ /* Load the PTE */
rlwinm r12, r10, 13, 19, 29 /* Compute pgdir/pmd offset */
lwzx r11, r12, r11 /* Get pgd/pmd entry */
rlwinm. r12, r11, 0, 0, 20 /* Extract pt base address */
beq 2f /* Bail if no table */
rlwimi r12, r10, 23, 20, 28 /* Compute pte address */
- lwz r11, 4(r12) /* Get pte entry */
- andi. r13, r11, _PAGE_PRESENT /* Is the page present? */
- beq 2f /* Bail if not present */
+ lwz r11, 0(r12) /* Get high word of pte entry */
+ lwz r12, 4(r12) /* Get low word of pte entry */
+
+ lis r10,tlb_44x_index@ha
+
+ andc. r13,r13,r12 /* Check permission */
+
+ /* Load the next available TLB index */
+ lwz r13,tlb_44x_index@l(r10)
- ori r11, r11, _PAGE_ACCESSED
- stw r11, 4(r12)
+ bne 2f /* Bail if permission mismach */
+
+ /* Increment, rollover, and store TLB index */
+ addi r13,r13,1
+
+ /* Compare with watermark (instruction gets patched) */
+ .globl tlb_44x_patch_hwater_D
+tlb_44x_patch_hwater_D:
+ cmpwi 0,r13,1 /* reserve entries */
+ ble 5f
+ li r13,0
+5:
+ /* Store the next available TLB index */
+ stw r13,tlb_44x_index@l(r10)
+
+ /* Re-load the faulting address */
+ mfspr r10,SPRN_DEAR
/* Jump to common tlb load */
b finish_tlb_load
@@ -505,7 +438,7 @@ interrupt_base:
mfspr r12, SPRN_SPRG4R
mfspr r11, SPRN_SPRG1
mfspr r10, SPRN_SPRG0
- b data_access
+ b DataStorage
/* Instruction TLB Error Interrupt */
/*
@@ -549,18 +482,42 @@ interrupt_base:
4:
mtspr SPRN_MMUCR,r12
+ /* Make up the required permissions */
+ li r13,_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_HWEXEC
+
rlwinm r12, r10, 13, 19, 29 /* Compute pgdir/pmd offset */
lwzx r11, r12, r11 /* Get pgd/pmd entry */
rlwinm. r12, r11, 0, 0, 20 /* Extract pt base address */
beq 2f /* Bail if no table */
rlwimi r12, r10, 23, 20, 28 /* Compute pte address */
- lwz r11, 4(r12) /* Get pte entry */
- andi. r13, r11, _PAGE_PRESENT /* Is the page present? */
- beq 2f /* Bail if not present */
+ lwz r11, 0(r12) /* Get high word of pte entry */
+ lwz r12, 4(r12) /* Get low word of pte entry */
- ori r11, r11, _PAGE_ACCESSED
- stw r11, 4(r12)
+ lis r10,tlb_44x_index@ha
+
+ andc. r13,r13,r12 /* Check permission */
+
+ /* Load the next available TLB index */
+ lwz r13,tlb_44x_index@l(r10)
+
+ bne 2f /* Bail if permission mismach */
+
+ /* Increment, rollover, and store TLB index */
+ addi r13,r13,1
+
+ /* Compare with watermark (instruction gets patched) */
+ .globl tlb_44x_patch_hwater_I
+tlb_44x_patch_hwater_I:
+ cmpwi 0,r13,1 /* reserve entries */
+ ble 5f
+ li r13,0
+5:
+ /* Store the next available TLB index */
+ stw r13,tlb_44x_index@l(r10)
+
+ /* Re-load the faulting address */
+ mfspr r10,SPRN_SRR0
/* Jump to common TLB load point */
b finish_tlb_load
@@ -582,86 +539,40 @@ interrupt_base:
/*
* Local functions
- */
- /*
- * Data TLB exceptions will bail out to this point
- * if they can't resolve the lightweight TLB fault.
- */
-data_access:
- NORMAL_EXCEPTION_PROLOG
- mfspr r5,SPRN_ESR /* Grab the ESR, save it, pass arg3 */
- stw r5,_ESR(r11)
- mfspr r4,SPRN_DEAR /* Grab the DEAR, save it, pass arg2 */
- EXC_XFER_EE_LITE(0x0300, handle_page_fault)
+ */
/*
* Both the instruction and data TLB miss get to this
* point to load the TLB.
* r10 - EA of fault
- * r11 - available to use
- * r12 - Pointer to the 64-bit PTE
- * r13 - available to use
+ * r11 - PTE high word value
+ * r12 - PTE low word value
+ * r13 - TLB index
* MMUCR - loaded with proper value when we get here
* Upon exit, we reload everything and RFI.
*/
finish_tlb_load:
- /*
- * We set execute, because we don't have the granularity to
- * properly set this at the page level (Linux problem).
- * If shared is set, we cause a zero PID->TID load.
- * Many of these bits are software only. Bits we don't set
- * here we (properly should) assume have the appropriate value.
- */
-
- /* Load the next available TLB index */
- lis r13, tlb_44x_index@ha
- lwz r13, tlb_44x_index@l(r13)
- /* Load the TLB high watermark */
- lis r11, tlb_44x_hwater@ha
- lwz r11, tlb_44x_hwater@l(r11)
-
- /* Increment, rollover, and store TLB index */
- addi r13, r13, 1
- cmpw 0, r13, r11 /* reserve entries */
- ble 7f
- li r13, 0
-7:
- /* Store the next available TLB index */
- lis r11, tlb_44x_index@ha
- stw r13, tlb_44x_index@l(r11)
-
- lwz r11, 0(r12) /* Get MS word of PTE */
- lwz r12, 4(r12) /* Get LS word of PTE */
- rlwimi r11, r12, 0, 0 , 19 /* Insert RPN */
- tlbwe r11, r13, PPC44x_TLB_XLAT /* Write XLAT */
+ /* Combine RPN & ERPN an write WS 0 */
+ rlwimi r11,r12,0,0,19
+ tlbwe r11,r13,PPC44x_TLB_XLAT
/*
- * Create PAGEID. This is the faulting address,
+ * Create WS1. This is the faulting address (EPN),
* page size, and valid flag.
*/
- li r11, PPC44x_TLB_VALID | PPC44x_TLB_4K
- rlwimi r10, r11, 0, 20, 31 /* Insert valid and page size */
- tlbwe r10, r13, PPC44x_TLB_PAGEID /* Write PAGEID */
-
- li r10, PPC44x_TLB_SR@l /* Set SR */
- rlwimi r10, r12, 0, 30, 30 /* Set SW = _PAGE_RW */
- rlwimi r10, r12, 29, 29, 29 /* SX = _PAGE_HWEXEC */
- rlwimi r10, r12, 29, 28, 28 /* UR = _PAGE_USER */
- rlwimi r11, r12, 31, 26, 26 /* (_PAGE_USER>>1)->r12 */
- and r11, r12, r11 /* HWEXEC & USER */
- rlwimi r10, r11, 0, 26, 26 /* UX = HWEXEC & USER */
-
- rlwimi r12, r10, 0, 26, 31 /* Insert static perms */
-
- /*
- * Clear U0-U3 and WL1 IL1I IL1D IL2I IL2D bits which are added
- * on newer 440 cores like the 440x6 used on AMCC 460EX/460GT (see
- * include/asm-powerpc/pgtable-ppc32.h for details).
- */
- rlwinm r12, r12, 0, 20, 10
-
- tlbwe r12, r13, PPC44x_TLB_ATTRIB /* Write ATTRIB */
+ li r11,PPC44x_TLB_VALID | PPC44x_TLB_4K
+ rlwimi r10,r11,0,20,31 /* Insert valid and page size*/
+ tlbwe r10,r13,PPC44x_TLB_PAGEID /* Write PAGEID */
+
+ /* And WS 2 */
+ li r10,0xf85 /* Mask to apply from PTE */
+ rlwimi r10,r12,29,30,30 /* DIRTY -> SW position */
+ and r11,r12,r10 /* Mask PTE bits to keep */
+ andi. r10,r12,_PAGE_USER /* User page ? */
+ beq 1f /* nope, leave U bits empty */
+ rlwimi r11,r11,3,26,28 /* yes, copy S bits to U */
+1: tlbwe r11,r13,PPC44x_TLB_ATTRIB /* Write ATTRIB */
/* Done...restore registers and get out of here.
*/
Index: linux-work/arch/powerpc/mm/44x_mmu.c
===================================================================
--- linux-work.orig/arch/powerpc/mm/44x_mmu.c 2008-05-07 09:53:16.000000000 +1000
+++ linux-work/arch/powerpc/mm/44x_mmu.c 2008-07-01 14:32:32.000000000 +1000
@@ -27,6 +27,7 @@
#include <asm/mmu.h>
#include <asm/system.h>
#include <asm/page.h>
+#include <asm/cacheflush.h>
#include "mmu_decl.h"
@@ -37,11 +38,35 @@ unsigned int tlb_44x_index; /* = 0 */
unsigned int tlb_44x_hwater = PPC44x_TLB_SIZE - 1 - PPC44x_EARLY_TLBS;
int icache_44x_need_flush;
+static void __init ppc44x_update_tlb_hwater(void)
+{
+ extern unsigned int tlb_44x_patch_hwater_D[];
+ extern unsigned int tlb_44x_patch_hwater_I[];
+
+ /* The TLB miss handlers hard codes the watermark in a cmpli
+ * instruction to improve performances rather than loading it
+ * from the global variable. Thus, we patch the instructions
+ * in the 2 TLB miss handlers when updating the value
+ */
+ tlb_44x_patch_hwater_D[0] = (tlb_44x_patch_hwater_D[0] & 0xffff0000) |
+ tlb_44x_hwater;
+ flush_icache_range((unsigned long)&tlb_44x_patch_hwater_D[0],
+ (unsigned long)&tlb_44x_patch_hwater_D[1]);
+ tlb_44x_patch_hwater_I[0] = (tlb_44x_patch_hwater_I[0] & 0xffff0000) |
+ tlb_44x_hwater;
+ flush_icache_range((unsigned long)&tlb_44x_patch_hwater_I[0],
+ (unsigned long)&tlb_44x_patch_hwater_I[1]);
+}
+
/*
* "Pins" a 256MB TLB entry in AS0 for kernel lowmem
*/
static void __init ppc44x_pin_tlb(unsigned int virt, unsigned int phys)
{
+ unsigned int entry = tlb_44x_hwater--;
+
+ ppc44x_update_tlb_hwater();
+
__asm__ __volatile__(
"tlbwe %2,%3,%4\n"
"tlbwe %1,%3,%5\n"
@@ -50,7 +75,7 @@ static void __init ppc44x_pin_tlb(unsign
: "r" (PPC44x_TLB_SW | PPC44x_TLB_SR | PPC44x_TLB_SX | PPC44x_TLB_G),
"r" (phys),
"r" (virt | PPC44x_TLB_VALID | PPC44x_TLB_256M),
- "r" (tlb_44x_hwater--), /* slot for this TLB entry */
+ "r" (entry),
"i" (PPC44x_TLB_PAGEID),
"i" (PPC44x_TLB_XLAT),
"i" (PPC44x_TLB_ATTRIB));
@@ -58,6 +83,8 @@ static void __init ppc44x_pin_tlb(unsign
void __init MMU_init_hw(void)
{
+ ppc44x_update_tlb_hwater();
+
flush_instruction_cache();
}
Index: linux-work/include/asm-powerpc/pgtable-ppc32.h
===================================================================
--- linux-work.orig/include/asm-powerpc/pgtable-ppc32.h 2008-05-28 09:31:19.000000000 +1000
+++ linux-work/include/asm-powerpc/pgtable-ppc32.h 2008-07-01 14:19:18.000000000 +1000
@@ -182,6 +182,9 @@ extern int icache_44x_need_flush;
#define _PMD_SIZE_16M 0x0e0
#define PMD_PAGE_SIZE(pmdval) (1024 << (((pmdval) & _PMD_SIZE) >> 4))
+/* Until my rework is finished, 40x still needs atomic PTE updates */
+#define PTE_ATOMIC_UPDATES 1
+
#elif defined(CONFIG_44x)
/*
* Definitions for PPC440
@@ -253,17 +256,17 @@ extern int icache_44x_need_flush;
*/
#define _PAGE_PRESENT 0x00000001 /* S: PTE valid */
-#define _PAGE_RW 0x00000002 /* S: Write permission */
+#define _PAGE_RW 0x00000002 /* S: Write permission */
#define _PAGE_FILE 0x00000004 /* S: nonlinear file mapping */
+#define _PAGE_HWEXEC 0x00000004 /* H: Execute permission */
#define _PAGE_ACCESSED 0x00000008 /* S: Page referenced */
-#define _PAGE_HWWRITE 0x00000010 /* H: Dirty & RW */
-#define _PAGE_HWEXEC 0x00000020 /* H: Execute permission */
-#define _PAGE_USER 0x00000040 /* S: User page */
-#define _PAGE_ENDIAN 0x00000080 /* H: E bit */
-#define _PAGE_GUARDED 0x00000100 /* H: G bit */
-#define _PAGE_DIRTY 0x00000200 /* S: Page dirty */
-#define _PAGE_NO_CACHE 0x00000400 /* H: I bit */
-#define _PAGE_WRITETHRU 0x00000800 /* H: W bit */
+#define _PAGE_DIRTY 0x00000010 /* S: Page dirty */
+#define _PAGE_USER 0x00000040 /* S: User page */
+#define _PAGE_ENDIAN 0x00000080 /* H: E bit */
+#define _PAGE_GUARDED 0x00000100 /* H: G bit */
+#define _PAGE_COHERENT 0x00000200 /* H: M bit */
+#define _PAGE_NO_CACHE 0x00000400 /* H: I bit */
+#define _PAGE_WRITETHRU 0x00000800 /* H: W bit */
/* TODO: Add large page lowmem mapping support */
#define _PMD_PRESENT 0
@@ -273,6 +276,7 @@ extern int icache_44x_need_flush;
/* ERPN in a PTE never gets cleared, ignore it */
#define _PTE_NONE_MASK 0xffffffff00000000ULL
+
#elif defined(CONFIG_FSL_BOOKE)
/*
MMU Assist Register 3:
@@ -315,6 +319,9 @@ extern int icache_44x_need_flush;
#define _PMD_PRESENT_MASK (PAGE_MASK)
#define _PMD_BAD (~PAGE_MASK)
+/* Until my rework is finished, FSL BookE still needs atomic PTE updates */
+#define PTE_ATOMIC_UPDATES 1
+
#elif defined(CONFIG_8xx)
/* Definitions for 8xx embedded chips. */
#define _PAGE_PRESENT 0x0001 /* Page is valid */
@@ -345,6 +352,9 @@ extern int icache_44x_need_flush;
#define _PTE_NONE_MASK _PAGE_ACCESSED
+/* Until my rework is finished, 8xx still needs atomic PTE updates */
+#define PTE_ATOMIC_UPDATES 1
+
#else /* CONFIG_6xx */
/* Definitions for 60x, 740/750, etc. */
#define _PAGE_PRESENT 0x001 /* software: pte contains a translation */
@@ -365,6 +375,10 @@ extern int icache_44x_need_flush;
#define _PMD_PRESENT 0
#define _PMD_PRESENT_MASK (PAGE_MASK)
#define _PMD_BAD (~PAGE_MASK)
+
+/* Hash table based platforms need atomic updates of the linux PTE */
+#define PTE_ATOMIC_UPDATES 1
+
#endif
/*
@@ -557,9 +571,11 @@ extern void add_hash_page(unsigned conte
* low PTE word since we expect ALL flag bits to be there
*/
#ifndef CONFIG_PTE_64BIT
-static inline unsigned long pte_update(pte_t *p, unsigned long clr,
+static inline unsigned long pte_update(pte_t *p,
+ unsigned long clr,
unsigned long set)
{
+#ifdef PTE_ATOMIC_UPDATES
unsigned long old, tmp;
__asm__ __volatile__("\
@@ -572,16 +588,26 @@ static inline unsigned long pte_update(p
: "=&r" (old), "=&r" (tmp), "=m" (*p)
: "r" (p), "r" (clr), "r" (set), "m" (*p)
: "cc" );
+#else /* PTE_ATOMIC_UPDATES */
+ unsigned long old = pte_val(*p);
+ *p = __pte((old & ~clr) | set);
+#endif /* !PTE_ATOMIC_UPDATES */
+
#ifdef CONFIG_44x
if ((old & _PAGE_USER) && (old & _PAGE_HWEXEC))
icache_44x_need_flush = 1;
#endif
return old;
}
-#else
-static inline unsigned long long pte_update(pte_t *p, unsigned long clr,
- unsigned long set)
+#else /* CONFIG_PTE_64BIT */
+/* TODO: Change that to only modify the low word and move set_pte_at()
+ * out of line
+ */
+static inline unsigned long long pte_update(pte_t *p,
+ unsigned long clr,
+ unsigned long set)
{
+#ifdef PTE_ATOMIC_UPDATES
unsigned long long old;
unsigned long tmp;
@@ -596,13 +622,18 @@ static inline unsigned long long pte_upd
: "=&r" (old), "=&r" (tmp), "=m" (*p)
: "r" (p), "r" ((unsigned long)(p) + 4), "r" (clr), "r" (set), "m" (*p)
: "cc" );
+#else /* PTE_ATOMIC_UPDATES */
+ unsigned long long old = pte_val(*p);
+ *p = __pte((old & ~clr) | set);
+#endif /* !PTE_ATOMIC_UPDATES */
+
#ifdef CONFIG_44x
if ((old & _PAGE_USER) && (old & _PAGE_HWEXEC))
icache_44x_need_flush = 1;
#endif
return old;
}
-#endif
+#endif /* CONFIG_PTE_64BIT */
/*
* set_pte stores a linux PTE into the linux page table.
@@ -665,7 +696,7 @@ static inline void __ptep_set_access_fla
({ \
int __changed = !pte_same(*(__ptep), __entry); \
if (__changed) { \
- __ptep_set_access_flags(__ptep, __entry, __dirty); \
+ __ptep_set_access_flags(__ptep, __entry, __dirty); \
flush_tlb_page_nohash(__vma, __address); \
} \
__changed; \
Index: linux-work/arch/powerpc/kernel/head_booke.h
===================================================================
--- linux-work.orig/arch/powerpc/kernel/head_booke.h 2008-06-26 15:05:48.000000000 +1000
+++ linux-work/arch/powerpc/kernel/head_booke.h 2008-07-01 14:19:18.000000000 +1000
@@ -327,6 +327,14 @@ label:
addi r3,r1,STACK_FRAME_OVERHEAD; \
EXC_XFER_TEMPLATE(DebugException, 0x2002, (MSR_KERNEL & ~(MSR_ME|MSR_DE|MSR_CE)), NOCOPY, crit_transfer_to_handler, ret_from_crit_exc)
+#define DATA_STORAGE_EXCEPTION \
+ START_EXCEPTION(DataStorage) \
+ NORMAL_EXCEPTION_PROLOG; \
+ mfspr r5,SPRN_ESR; /* Grab the ESR and save it */ \
+ stw r5,_ESR(r11); \
+ mfspr r4,SPRN_DEAR; /* Grab the DEAR */ \
+ EXC_XFER_EE_LITE(0x0300, handle_page_fault)
+
#define INSTRUCTION_STORAGE_EXCEPTION \
START_EXCEPTION(InstructionStorage) \
NORMAL_EXCEPTION_PROLOG; \
^ permalink raw reply
* Re: Commits added to powerpc.git master and powerpc-next branches
From: Kumar Gala @ 2008-07-01 4:05 UTC (permalink / raw)
To: benh; +Cc: linuxppc-dev, Paul Mackerras
In-Reply-To: <1214880241.20711.71.camel@pasglop>
On Jun 30, 2008, at 9:44 PM, Benjamin Herrenschmidt wrote:
>
>>> Any chance to get my 4xx PTE rework in too ?
>>
>> I asked you about that 2 weeks ago. I also asked you to spin a v2
>> with
>> the comments Kumar asked for. I got nothing back.
>>
>> If you want it in 2.6.27, do that soon please :)
>
> Oops... though I did it. Let me check what I have ...
I've you post a new version I'll look at getting the changes for FSL
Book-E MMU that match it.
- k
^ permalink raw reply
* [PATCH 1/2] powerpc: Fix compile error for CONFIG_VSX
From: Michael Neuling @ 2008-07-01 4:01 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev
In-Reply-To: <1214884899.54079.831141965275.qpush@coopers>
Fix compile error when CONFIG_VSX is enabled.
arch/powerpc/kernel/signal_64.c: In function 'restore_sigcontext':
arch/powerpc/kernel/signal_64.c:241: error: 'i' undeclared (first use in this function)
Signed-off-by: Michael Neuling <mikey@neuling.org>
---
arch/powerpc/kernel/signal_64.c | 1 +
1 file changed, 1 insertion(+)
Index: linux-2.6-ozlabs/arch/powerpc/kernel/signal_64.c
===================================================================
--- linux-2.6-ozlabs.orig/arch/powerpc/kernel/signal_64.c
+++ linux-2.6-ozlabs/arch/powerpc/kernel/signal_64.c
@@ -167,6 +167,7 @@ static long restore_sigcontext(struct pt
#endif
#ifdef CONFIG_VSX
double buf[FP_REGS_SIZE];
+ int i;
#endif
unsigned long err = 0;
unsigned long save_r13 = 0;
^ permalink raw reply
* [PATCH 2/2] powerpc: Update for VSX core file and ptrace
From: Michael Neuling @ 2008-07-01 4:01 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev
In-Reply-To: <1214884899.54079.831141965275.qpush@coopers>
This correctly hooks the VSX dump into Roland McGrath core file
infrastructure. It adds the VSX dump information as an additional elf
note in the core file (after talking more to the tool chain/gdb guys).
This also ensures the formats are consistent between signals, ptrace
and core files.
Signed-off-by: Michael Neuling <mikey@neuling.org>
---
arch/powerpc/kernel/process.c | 19 +------------------
arch/powerpc/kernel/ptrace.c | 21 +++++++++++++--------
include/asm-powerpc/elf.h | 4 ++--
include/linux/elf.h | 1 +
4 files changed, 17 insertions(+), 28 deletions(-)
Index: linux-2.6-ozlabs/arch/powerpc/kernel/process.c
===================================================================
--- linux-2.6-ozlabs.orig/arch/powerpc/kernel/process.c
+++ linux-2.6-ozlabs/arch/powerpc/kernel/process.c
@@ -162,7 +162,7 @@ void flush_altivec_to_thread(struct task
}
}
-int dump_task_altivec(struct task_struct *tsk, elf_vrreg_t *vrregs)
+int dump_task_altivec(struct task_struct *tsk, elf_vrregset_t *vrregs)
{
/* ELF_NVRREG includes the VSCR and VRSAVE which we need to save
* separately, see below */
@@ -249,23 +249,6 @@ int dump_task_vsx(struct task_struct *ts
}
#endif /* CONFIG_VSX */
-int dump_task_vector(struct task_struct *tsk, elf_vrregset_t *vrregs)
-{
- int rc = 0;
- elf_vrreg_t *regs = (elf_vrreg_t *)vrregs;
-#ifdef CONFIG_ALTIVEC
- rc = dump_task_altivec(tsk, regs);
- if (rc)
- return rc;
- regs += ELF_NVRREG;
-#endif
-
-#ifdef CONFIG_VSX
- rc = dump_task_vsx(tsk, regs);
-#endif
- return rc;
-}
-
#ifdef CONFIG_SPE
void enable_kernel_spe(void)
Index: linux-2.6-ozlabs/arch/powerpc/kernel/ptrace.c
===================================================================
--- linux-2.6-ozlabs.orig/arch/powerpc/kernel/ptrace.c
+++ linux-2.6-ozlabs/arch/powerpc/kernel/ptrace.c
@@ -368,13 +368,15 @@ static int vsr_get(struct task_struct *t
unsigned int pos, unsigned int count,
void *kbuf, void __user *ubuf)
{
- int ret;
+ double buf[32];
+ int ret, i;
flush_vsx_to_thread(target);
+ for (i = 0; i < 32 ; i++)
+ buf[i] = current->thread.fpr[i][TS_VSRLOWOFFSET];
ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
- target->thread.fpr, 0,
- 32 * sizeof(vector128));
+ buf, 0, 32 * sizeof(double));
return ret;
}
@@ -383,13 +385,16 @@ static int vsr_set(struct task_struct *t
unsigned int pos, unsigned int count,
const void *kbuf, const void __user *ubuf)
{
- int ret;
+ double buf[32];
+ int ret,i;
flush_vsx_to_thread(target);
ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
- target->thread.fpr, 0,
- 32 * sizeof(vector128));
+ buf, 0, 32 * sizeof(double));
+ for (i = 0; i < 32 ; i++)
+ current->thread.fpr[i][TS_VSRLOWOFFSET] = buf[i];
+
return ret;
}
@@ -499,8 +504,8 @@ static const struct user_regset native_r
#endif
#ifdef CONFIG_VSX
[REGSET_VSX] = {
- .n = 32,
- .size = sizeof(vector128), .align = sizeof(vector128),
+ .core_note_type = NT_PPC_VSX, .n = 32,
+ .size = sizeof(double), .align = sizeof(double),
.active = vsr_active, .get = vsr_get, .set = vsr_set
},
#endif
Index: linux-2.6-ozlabs/include/asm-powerpc/elf.h
===================================================================
--- linux-2.6-ozlabs.orig/include/asm-powerpc/elf.h
+++ linux-2.6-ozlabs/include/asm-powerpc/elf.h
@@ -221,8 +221,8 @@ extern int dump_task_fpu(struct task_str
typedef elf_vrregset_t elf_fpxregset_t;
#ifdef CONFIG_ALTIVEC
-extern int dump_task_vector(struct task_struct *, elf_vrregset_t *vrregs);
-#define ELF_CORE_COPY_XFPREGS(tsk, regs) dump_task_vector(tsk, regs)
+extern int dump_task_altivec(struct task_struct *, elf_vrregset_t *vrregs);
+#define ELF_CORE_COPY_XFPREGS(tsk, regs) dump_task_altivec(tsk, regs)
#define ELF_CORE_XFPREG_TYPE NT_PPC_VMX
#endif
Index: linux-2.6-ozlabs/include/linux/elf.h
===================================================================
--- linux-2.6-ozlabs.orig/include/linux/elf.h
+++ linux-2.6-ozlabs/include/linux/elf.h
@@ -358,6 +358,7 @@ typedef struct elf64_shdr {
#define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/elf/common.h */
#define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */
#define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */
+#define NT_PPC_VSX 0x102 /* PowerPC VSX registers */
#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */
^ permalink raw reply
* [PATCH 0/2] powerpc: Update VSX support
From: Michael Neuling @ 2008-07-01 4:01 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev
In-Reply-To: <18537.30774.608486.268257@cargo.ozlabs.ibm.com>
Below are a couple of fixes for VSX.
Signed-off-by: Michael Neuling <mikey@neuling.org>
---
Paulus: please apply to your powerpc-next tree
^ permalink raw reply
* RE: [PATCH] DMA Engine: fix error path(s) in fsl-dma driver
From: Li Yang @ 2008-07-01 3:38 UTC (permalink / raw)
To: Sebastian Siewior; +Cc: Zhang Wei, linux-kernel, linuxppc-embedded
In-Reply-To: <20080630181856.GA6980@www.tglx.de>
> -----Original Message-----
> From: Sebastian Siewior [mailto:bigeasy@linutronix.de]=20
> Sent: Tuesday, July 01, 2008 2:19 AM
> To: Li Yang
> Cc: Zhang Wei; linuxppc-embedded@ozlabs.org;=20
> linux-kernel@vger.kernel.org
> Subject: [PATCH] DMA Engine: fix error path(s) in fsl-dma driver
>=20
> of_fsl_dma_probe:
> - kfree(NULL) doesn't hurt but dereferencing the pointer in=20
> iounmap does
> - also, the irq can be freed
>=20
> of_fsl_dma_chan_probe:
> - iounmap(NULL) resolved in vunmap() what which in turn is=20
> able to handle NULL
> pointer but dereferencing still doesn't work
> - don't clean up not yet allocated ressources, like list_del=20
> before list_add
>=20
> fsl_dma_self_test:
> - call fsl_dma_free_chan_resources() if the first dma trans=20
> didn't complete
Thanks Sebastian,
But similar patch has already been waiting in sub-system maintainer's =
tree which can be found at=20
http://git.kernel.org/?p=3Dlinux/kernel/git/djbw/async_tx.git;a=3Dcommit;=
h=3D29ec9bdef73d68134e7070ee91ccda0718d46150
- Leo
^ permalink raw reply
* Re: Commits added to powerpc.git master and powerpc-next branches
From: Benjamin Herrenschmidt @ 2008-07-01 2:44 UTC (permalink / raw)
To: Josh Boyer; +Cc: linuxppc-dev, Paul Mackerras
In-Reply-To: <20080630223040.32ee04e1@zod.rchland.ibm.com>
> > Any chance to get my 4xx PTE rework in too ?
>
> I asked you about that 2 weeks ago. I also asked you to spin a v2 with
> the comments Kumar asked for. I got nothing back.
>
> If you want it in 2.6.27, do that soon please :)
Oops... though I did it. Let me check what I have ...
Ben.
^ permalink raw reply
* Re: Commits added to powerpc.git master and powerpc-next branches
From: Josh Boyer @ 2008-07-01 2:30 UTC (permalink / raw)
To: benh; +Cc: linuxppc-dev, Paul Mackerras
In-Reply-To: <1214876710.20711.69.camel@pasglop>
On Tue, 01 Jul 2008 11:45:10 +1000
Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> On Tue, 2008-07-01 at 11:27 +1000, Paul Mackerras wrote:
> > Paul Mackerras writes:
> >
> > > The following commits have been added to the master and powerpc-next
> > > branches of the powerpc.git repository. This includes patches pulled
> > > from Kumar's and Josh's trees.
> >
> > Hold off from pulling this for now, everyone... I inadvertently broke
> > builds with 64k pages by leaving in some stuff that was purely for
> > testing in my "Only demote individual slices rather than whole
> > process" patch. I'll re-do the tree in order to avoid breaking
> > bisection.
>
> Any chance to get my 4xx PTE rework in too ?
I asked you about that 2 weeks ago. I also asked you to spin a v2 with
the comments Kumar asked for. I got nothing back.
If you want it in 2.6.27, do that soon please :)
josh
^ permalink raw reply
* Re: Commits added to powerpc.git master and powerpc-next branches
From: Paul Mackerras @ 2008-07-01 2:01 UTC (permalink / raw)
To: linuxppc-dev
In-Reply-To: <18537.34789.355993.604857@cargo.ozlabs.ibm.com>
I wrote:
> Hold off from pulling this for now, everyone... I inadvertently broke
> builds with 64k pages by leaving in some stuff that was purely for
> testing in my "Only demote individual slices rather than whole
> process" patch. I'll re-do the tree in order to avoid breaking
> bisection.
I have redone the tree now. If you have pulled within the last one
and a half hours, you'll need to do a git pull -f. Sorry about that.
Paul.
^ permalink raw reply
* Re: Commits added to powerpc.git master and powerpc-next branches
From: Benjamin Herrenschmidt @ 2008-07-01 1:45 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev
In-Reply-To: <18537.34789.355993.604857@cargo.ozlabs.ibm.com>
On Tue, 2008-07-01 at 11:27 +1000, Paul Mackerras wrote:
> Paul Mackerras writes:
>
> > The following commits have been added to the master and powerpc-next
> > branches of the powerpc.git repository. This includes patches pulled
> > from Kumar's and Josh's trees.
>
> Hold off from pulling this for now, everyone... I inadvertently broke
> builds with 64k pages by leaving in some stuff that was purely for
> testing in my "Only demote individual slices rather than whole
> process" patch. I'll re-do the tree in order to avoid breaking
> bisection.
Any chance to get my 4xx PTE rework in too ?
Cheers,
Ben.
^ permalink raw reply
* Re: [BUILD-FAILURE] linux-next: Tree for June 30 - powerpc - build failure at arch_add_memory()
From: Tony Breeds @ 2008-07-01 1:34 UTC (permalink / raw)
To: Kamalesh Babulal
Cc: Stephen Rothwell, linux-kbuild, LKML, linuxppc-dev, linux-next,
Sam Ravnborg
In-Reply-To: <486924FE.4090801@linux.vnet.ibm.com>
On Mon, Jun 30, 2008 at 11:55:02PM +0530, Kamalesh Babulal wrote:
> Hi Stephen,
>
> next-20080630 kernel build fails on powerpc, with randconfig
>
> CC arch/powerpc/mm/mem.o
> arch/powerpc/mm/mem.c: In function ‘arch_add_memory’:
> arch/powerpc/mm/mem.c:130: error: implicit declaration of function ‘create_section_mapping’
> make[1]: *** [arch/powerpc/mm/mem.o] Error 1
> make: *** [arch/powerpc/mm] Error 2
This problem exists in in 2.6.26-rc8, so it's not specifially linux-next
realted. The patch at:
http://patchwork.ozlabs.org/linuxppc/patch?id=19347
should fix it but is un-ACK'd ;P
Yours Tony
linux.conf.au http://www.marchsouth.org/
Jan 19 - 24 2009 The Australian Linux Technical Conference!
^ permalink raw reply
* [PATCH 1/1] Fix Building of arch/powerpc/mm/mem.o when MEMORY_HOTPLUG=y and SPARSEMEM=n
From: Tony Breeds @ 2008-07-01 1:30 UTC (permalink / raw)
To: Paul Mackerras, linuxppc-dev
Currently the kernel fails to build with the above config options with:
CC arch/powerpc/mm/mem.o
arch/powerpc/mm/mem.c: In function 'arch_add_memory':
arch/powerpc/mm/mem.c:130: error: implicit declaration of function 'create_section_mapping'
This patch explicitly includes asm/sparsemem.h in arch/powerpc/mm/mem.c and
moves the guards in include/asm-powerpc/sparsemem.h to protect the
SPARSEMEM specific portions only.
Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
---
arch/powerpc/mm/mem.c | 1 +
include/asm-powerpc/sparsemem.h | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index 51f82d8..776ba6a 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -44,6 +44,7 @@
#include <asm/btext.h>
#include <asm/tlb.h>
#include <asm/sections.h>
+#include <asm/sparsemem.h>
#include <asm/vdso.h>
#include <asm/fixmap.h>
diff --git a/include/asm-powerpc/sparsemem.h b/include/asm-powerpc/sparsemem.h
index 9aea8e9..54a47ea 100644
--- a/include/asm-powerpc/sparsemem.h
+++ b/include/asm-powerpc/sparsemem.h
@@ -13,6 +13,8 @@
#define MAX_PHYSADDR_BITS 44
#define MAX_PHYSMEM_BITS 44
+#endif /* CONFIG_SPARSEMEM */
+
#ifdef CONFIG_MEMORY_HOTPLUG
extern void create_section_mapping(unsigned long start, unsigned long end);
extern int remove_section_mapping(unsigned long start, unsigned long end);
@@ -26,7 +28,5 @@ static inline int hot_add_scn_to_nid(unsigned long scn_addr)
#endif /* CONFIG_NUMA */
#endif /* CONFIG_MEMORY_HOTPLUG */
-#endif /* CONFIG_SPARSEMEM */
-
#endif /* __KERNEL__ */
#endif /* _ASM_POWERPC_SPARSEMEM_H */
--
1.5.6
^ permalink raw reply related
* Re: Commits added to powerpc.git master and powerpc-next branches
From: Paul Mackerras @ 2008-07-01 1:27 UTC (permalink / raw)
To: linuxppc-dev
In-Reply-To: <18537.30774.608486.268257@cargo.ozlabs.ibm.com>
Paul Mackerras writes:
> The following commits have been added to the master and powerpc-next
> branches of the powerpc.git repository. This includes patches pulled
> from Kumar's and Josh's trees.
Hold off from pulling this for now, everyone... I inadvertently broke
builds with 64k pages by leaving in some stuff that was purely for
testing in my "Only demote individual slices rather than whole
process" patch. I'll re-do the tree in order to avoid breaking
bisection.
Paul.
^ permalink raw reply
* Re: [PATCH v2] update crypto node definition and device tree instances
From: Kim Phillips @ 2008-07-01 0:38 UTC (permalink / raw)
To: Segher Boessenkool; +Cc: linuxppc-dev
In-Reply-To: <f34059884cc9de85e6e0fe8a934ae06e@kernel.crashing.org>
On Tue, 1 Jul 2008 01:27:58 +0200
Segher Boessenkool <segher@kernel.crashing.org> wrote:
> >> Yes. As a side note, since there are multiple devices that contain
> >> e.g. a sec-1.0, it would be prudent to describe the exact incarnation
> >> in the device tree, like "mpc8272-sec" or something, in either "model"
> >
> > but 'fsl,sec-X.Y' /does/ describe the exact incarnation,
>
> No it doesn't. If it's on a different SoC, it can have different
> bugs. It might be _meant_ to be exactly the same, but that's not
> the same thing.
It might not be to you, but to me and others it's true; some of these
SoCs truly share the exact same SEC block.
> > whereas
> > 'fsl,mpc8349-sec' /does not/. "fsl,mpc8349-sec' might mean the SEC 2.1
> > or the SEC 2.4, it depends on the revision of the mpc8349.
>
> Oh, nasty. That just means you'll need to put the revision of
> the 8349 in there as well, though -- "fsl,mpc8349-rev2-sec" or
> something.
so according to this and your above statement, it sounds like the scheme
you're proposing either warrants a separate device tree for each
revision of each SoC, with "fsl,mpcXXXX-revY.Z-whatever" property
values, or forces u-boot to fixup all compatible =
"fsl,mpcXXXX-whatever" properties with to a
"fsl,mpcXXXX-revY.Z-whatever" replacement, regardless whether that
"whatever" device is an SEC device or not. That can easily lead to
considerable bloat, esp. since SoC-specific data (such as mpcXXXX and
its revision) belong as a single occurence in the SoC node (and can be
reached via of_get_parent).
If a driver comes to the point where it actually, specifically cares
about a specific erratum on a specific revision of a specific SoC, then
it can easily look up the ID register of the device (not SoC) it's
driving and modify the precise point of its behaviour change. That's a
much simpler, direct solution, plus it's its responsibility as a device
driver to know and handle minor details like this anyway.
> >> or "compatible", just in case a problem shows up with one of them.
> >
> > I thought 'model' was superseded by 'compatible';
>
> "model" is still a valid property. "model" shouldn't be needed
> to find which device driver to use, but any specific device driver
> can use it just fine.
>
sure, but it doesn't provide anything extra, and afaict, it doesn't
come with conveniences such as of_device_is_compatible.
> > that's why it's taken out here, along with device_type.
>
> "device_type" simply isn't useful for flat device trees (in pretty
> much all cases), since it describes the OF programming model of a
> device, and almost none of that applies to flat trees. So yeah,
> taking that out is a good thing (esp. in a case like this, where
> it isn't defined anywhere what device_type "crypto" means).
wunderbar.
> >>>> I can't find a manual online for "freescale sec"; googling
> >>>> for "freescale sec-1.0" finds a manual for the PowerQUICC I;
> >>>> is that the right one? I don't know, so the binding needs
> >>>> to explain it to me.
> >>>
> >>> the binding shouldn't be responsible for google's shortcomings
> >>
> >> The binding needs to describe what device it is for. I am a stupid
> >> user, just like most users, so if the binding doesn't tell me I turn
> >> to google. Don't blame them for not finding it; the binding should
> >> have told me in the first place!
> >
> > Again, I don't see how google's results are pertinent in this
> > discussion.
>
> It's not about google. It's about a user who needs to find out
> what a certain "compatible" entry means, or who needs to find out
this goes back to the lack of a single piece of documentation that goes
over SEC version differences in detail, which I don't have. I have seen
somewhat-useful bits in later revisions of the SEC that I know the
driver could use, e.g., a hardware integrity check feature in revs 2.1
and above.
> what value to use for a certain device.
one good thing about freescale parts documentation is that it clearly
informs you of what SEC version you're on.
> > btw, the title for the binding is:
> >
> > g) Freescale SOC SEC Security Engines
> >
> > Is that what you are looking for?
>
> I'm not looking for the binding, I know where it is, thanks; I'm
> looking for information in the binding that tells me what "compatible"
> value means what.
ok, I don't have that specific level of data. sorry.
> > If not, what precisely? a list of
> > all the parts? There's an SEC in every mpc8[35]xxE!
>
> You could do a list of all, sure. You could also say what a
I'd rather use expressions.
> "compatible" value looks like, and give some representative
> examples.
um, there is one in the patch already.
> >> The binding at a minimum should describe how to identify each
> >> unique version from the device tree, no matter how miniscule
> >> those differences are. Just a specific "compatible" value will
> >> do.
> >
> > I'm at a loss; isn't that what this patch does?
>
> I lost the patch, sorry. I came into this thread at the point where
> Grant said that "fsl,sec1.0" is a horrible "compatible" value.
>
> > Currently the driver matches on "fsl,sec2.0", and if needs be, will
> > call of_device_is_compatible with the version number that introduces
> > the feature it wants to implement.
>
> That's okay I suppose. Each device tree still should put the exact
> version of the chip in there as well.
see above.
Kim
^ permalink raw reply
* Commits added to powerpc.git master and powerpc-next branches
From: Paul Mackerras @ 2008-07-01 0:20 UTC (permalink / raw)
To: linuxppc-dev
The following commits have been added to the master and powerpc-next
branches of the powerpc.git repository. This includes patches pulled
from Kumar's and Josh's trees.
Paul.
Adrian Bunk (3):
drivers/macintosh: Various cleanups
powerpc: Don't export asm/asm-compat.h to userspace
powerpc: asm/elf.h: Reduce userspace header
Andrew Lewis (1):
powerpc: Prevent memory corruption due to cache invalidation of unaligned DMA buffer
Andy Whitcroft (1):
powerpc: Add 64 bit version of huge_ptep_set_wrprotect
Anton Vorontsov (9):
powerpc/sysdev: implement FSL GTM support
powerpc/QE: add support for QE USB clocks routing
powerpc/QE: prepare QE PIO code for GPIO LIB support
powerpc/QE: implement support for the GPIO LIB API
powerpc/83xx: new board support: MPC8360E-RDK
powerpc/QE: switch to the cpm_muram implementation
powerpc/QE: qe_reset should be __init
powerpc/QE: use arch_initcall to probe QUICC Engine GPIOs
powerpc: Implement OF PCI address accessors stubs for CONFIG_PCI=n
Arnd Bergmann (4):
powerpc: Provide dummy crash_shutdown_register
powerpc/pseries: Call pseries_kexec_setup only on pseries
powerpc/cell: Disable ptcal in case of crash kdump
powerpc: Increase CRASH_HANDLER_MAX
Bart Van Assche (1):
powerpc: Make sure that include/asm-powerpc/spinlock.h does not trigger compilation warnings
Becky Bruce (3):
powerpc: Silly spelling fix in pgtable-ppc32
powerpc: Change BAT code to use phys_addr_t
powerpc: Get rid of bitfields in ppc_bat struct
Benjamin Herrenschmidt (1):
powerpc: Free a PTE bit on ppc64 with 64K pages
Bernhard Walle (1):
powerpc: Remove experimental status of kdump on 64-bit powerpc
Daniel Walker (2):
macintosh/therm_windtunnel: Convert semaphore to mutex
macintosh/media bay: Convert semaphore to mutex
Dave Kleikamp (1):
powerpc: hash_huge_page() should get the WIMG bits from the lpte
Giuseppe Coviello (2):
powerpc/4xx: Sam440ep support
powerpc/4xx: Convert Sam440ep DTS to dts-v1
Imre Kaloz (1):
powerpc/4xx: MTD support for the AMCC Taishan Board
Jerone Young (1):
powerpc/booke: Fix definitions for dbcr[1-2] and dbsr registers
Joel Schopp (2):
powerpc: Add cputable entry for Power7 architected mode
powerpc: Tell firmware we support architecture V2.06
Josh Boyer (2):
Revert "[POWERPC] 4xx: Fix 460GT support to not enable FPU"
powerpc/4xx: Workaround for PPC440EPx/GRx PCI_28 Errata
Julia Lawall (1):
drivers/macintosh/smu.c: Improve error handling
Kumar Gala (12):
powerpc/booke: Fix some comments related to debug level exceptions
powerpc/booke: Add support for new e500mc core
powerpc/85xx: add DOZE/NAP support for e500 core
powerpc/e500mc: flush L2 on NAP for e500mc
cpm_uart: fix whitespace issues
cpm_uart: Remove !CONFIG_PPC_CPM_NEW_BINDING code
powerpc/cpm: Remove !CONFIG_PPC_CPM_NEW_BINDING code
powerpc/kprobes: Some minor fixes
powerpc/booke: Add kprobes support for booke style processors
powerpc: Add dma nodes to 83xx, 85xx and 86xx boards
powerpc: Move common module code into its own file
powerpc/bootwrapper: Pad .dtb by default
Michael Ellerman (14):
powerpc: Move code patching code into arch/powerpc/lib/code-patching.c
powerpc: Allow create_branch() to return errors
powerpc: Make create_branch() return errors if the branch target is too large
powerpc: Add ppc_function_entry() which gets the entry point for a function
powerpc: Add new code patching routines
powerpc: Add tests of the code patching routines
powerpc: Add PPC_NOP_INSTR, a hash define for the preferred nop instruction
powerpc: Split out do_feature_fixups() from cputable.c
powerpc: Consolidate CPU and firmware feature fixup macros
powerpc: Consolidate feature fixup macros for 64/32 bit
powerpc: Introduce infrastructure for feature sections with alternatives
powerpc: Add logic to patch alternative feature sections
powerpc: Add self-tests of the feature fixup code
powerpc: Use an alternative feature section in entry_64.S
Michael Neuling (10):
powerpc: Add cputable entry for POWER7
powerpc: Fix MSR setting in 32 bit signal code
powerpc: Add macros to access floating point registers in thread_struct.
powerpc: Move altivec_unavailable
powerpc: Make load_up_fpu and load_up_altivec callable
powerpc: Introduce VSX thread_struct and CONFIG_VSX
powerpc: Add VSX CPU feature
powerpc: Add VSX assembler code macros
powerpc: Add VSX context save/restore, ptrace and signal support
powerpc: Add CONFIG_VSX config option
Nick Piggin (2):
powerpc: Optimise smp_wmb on 64-bit processors
spufs: Convert nopfn to fault
Paul Mackerras (1):
powerpc: Only demote individual slices rather than whole process
Scott Wood (1):
powerpc: Fix copy-and-paste error in clrsetbits_le16
Segher Boessenkool (1):
powerpc: Get rid of CROSS32{AS,LD,OBJCOPY}
Stefan Roese (1):
powerpc/4xx: PCIe driver now detects if a port is disabled via the dev-tree
Stephen Rothwell (7):
viotape: Use unlocked_ioctl
pasemi-rng: Use linux/of_platform.h instead of asm
hwmon: Use linux/of_platform.h instead of asm
macintosh: Use linux/of_{device,platform}.h instead of asm
drivers/net: Use linux/of_{device,platform}.h instead of asm
pcmcia: Use linux/of_{device,platform}.h instead of asm
powerpc: Explicitly copy elements of pt_regs
Tony Breeds (1):
powerpc: Change the default link address for pSeries zImage kernels
Valentine Barshak (1):
powerpc/4xx: Fix resource issue in warp-nand.c
Vitaly Bordug (1):
powerpc/85xx: Update pin setup for 8560ads
Wolfgang Grandegger (4):
powerpc/85xx: correct vendor prefix in DTS files for TQM85xx modules
powerpc/85xx: add board support for the TQM8548 modules
powerpc/85xx: support for the TQM8548 module using the big Flash
powerpc/85xx: add local bus nodes for Flash and CAN to tqm8560.dts
^ permalink raw reply
* Re: [PATCH v2] update crypto node definition and device tree instances
From: Segher Boessenkool @ 2008-06-30 23:27 UTC (permalink / raw)
To: Kim Phillips; +Cc: linuxppc-dev
In-Reply-To: <20080630173008.d6762380.kim.phillips@freescale.com>
>> Yes. As a side note, since there are multiple devices that contain
>> e.g. a sec-1.0, it would be prudent to describe the exact incarnation
>> in the device tree, like "mpc8272-sec" or something, in either "model"
>
> but 'fsl,sec-X.Y' /does/ describe the exact incarnation,
No it doesn't. If it's on a different SoC, it can have different
bugs. It might be _meant_ to be exactly the same, but that's not
the same thing.
> whereas
> 'fsl,mpc8349-sec' /does not/. "fsl,mpc8349-sec' might mean the SEC 2.1
> or the SEC 2.4, it depends on the revision of the mpc8349.
Oh, nasty. That just means you'll need to put the revision of
the 8349 in there as well, though -- "fsl,mpc8349-rev2-sec" or
something.
>> or "compatible", just in case a problem shows up with one of them.
>
> I thought 'model' was superseded by 'compatible';
"model" is still a valid property. "model" shouldn't be needed
to find which device driver to use, but any specific device driver
can use it just fine.
> that's why it's taken out here, along with device_type.
"device_type" simply isn't useful for flat device trees (in pretty
much all cases), since it describes the OF programming model of a
device, and almost none of that applies to flat trees. So yeah,
taking that out is a good thing (esp. in a case like this, where
it isn't defined anywhere what device_type "crypto" means).
>>>> I can't find a manual online for "freescale sec"; googling
>>>> for "freescale sec-1.0" finds a manual for the PowerQUICC I;
>>>> is that the right one? I don't know, so the binding needs
>>>> to explain it to me.
>>>
>>> the binding shouldn't be responsible for google's shortcomings
>>
>> The binding needs to describe what device it is for. I am a stupid
>> user, just like most users, so if the binding doesn't tell me I turn
>> to google. Don't blame them for not finding it; the binding should
>> have told me in the first place!
>
> Again, I don't see how google's results are pertinent in this
> discussion.
It's not about google. It's about a user who needs to find out
what a certain "compatible" entry means, or who needs to find out
what value to use for a certain device.
> btw, the title for the binding is:
>
> g) Freescale SOC SEC Security Engines
>
> Is that what you are looking for?
I'm not looking for the binding, I know where it is, thanks; I'm
looking for information in the binding that tells me what "compatible"
value means what.
> If not, what precisely? a list of
> all the parts? There's an SEC in every mpc8[35]xxE!
You could do a list of all, sure. You could also say what a
"compatible" value looks like, and give some representative
examples.
>> The binding at a minimum should describe how to identify each
>> unique version from the device tree, no matter how miniscule
>> those differences are. Just a specific "compatible" value will
>> do.
>
> I'm at a loss; isn't that what this patch does?
I lost the patch, sorry. I came into this thread at the point where
Grant said that "fsl,sec1.0" is a horrible "compatible" value.
> Currently the driver matches on "fsl,sec2.0", and if needs be, will
> call of_device_is_compatible with the version number that introduces
> the feature it wants to implement.
That's okay I suppose. Each device tree still should put the exact
version of the chip in there as well.
Segher
^ permalink raw reply
* [PATCH 2/2] Add the of_find_i2c_device_by_node function, V4
From: Jon Smirl @ 2008-06-30 23:01 UTC (permalink / raw)
To: i2c, Linuxppc-dev
In-Reply-To: <20080630230126.12482.87927.stgit@terra>
Add the of_find_i2c_device_by_node function. This allows you to follow a reference in the device to an i2c device node and then locate the linux device instantiated by the device tree. Example use, an i2s codec controlled by i2c.
---
drivers/i2c/i2c-core.c | 2 +-
drivers/of/of_i2c.c | 37 ++++++++++++++++++++++++++-----------
include/linux/i2c.h | 3 +++
include/linux/of_i2c.h | 2 ++
4 files changed, 32 insertions(+), 12 deletions(-)
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index d0175f4..e3abe1b 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -208,7 +208,7 @@ static struct device_attribute i2c_dev_attrs[] = {
{ },
};
-static struct bus_type i2c_bus_type = {
+struct bus_type i2c_bus_type = {
.name = "i2c",
.dev_attrs = i2c_dev_attrs,
.match = i2c_device_match,
diff --git a/drivers/of/of_i2c.c b/drivers/of/of_i2c.c
index 715a444..ca69a16 100644
--- a/drivers/of/of_i2c.c
+++ b/drivers/of/of_i2c.c
@@ -75,7 +75,7 @@ static int of_find_i2c_driver(struct device_node *node,
void of_register_i2c_devices(struct i2c_adapter *adap,
struct device_node *adap_node)
{
- void *result;
+ struct i2c_client *i2c_dev;
struct device_node *node;
for_each_child_of_node(adap_node, node) {
@@ -90,29 +90,44 @@ void of_register_i2c_devices(struct i2c_adapter *adap,
continue;
}
- info.irq = irq_of_parse_and_map(node, 0);
- if (info.irq == NO_IRQ)
- info.irq = -1;
-
- if (of_find_i2c_driver(node, &info) < 0) {
- irq_dispose_mapping(info.irq);
+ if (of_find_i2c_driver(node, &info) < 0)
continue;
- }
+ info.irq = irq_of_parse_and_map(node, 0);
info.addr = *addr;
- request_module(info.type);
+ request_module("%s", info.type);
- result = i2c_new_device(adap, &info);
- if (result == NULL) {
+ i2c_dev = i2c_new_device(adap, &info);
+ if (i2c_dev == NULL) {
printk(KERN_ERR
"of-i2c: Failed to load driver for %s\n",
info.type);
irq_dispose_mapping(info.irq);
continue;
}
+
+ i2c_dev->dev.archdata.of_node = of_node_get(node);
}
}
EXPORT_SYMBOL(of_register_i2c_devices);
+static int of_dev_node_match(struct device *dev, void *data)
+{
+ return dev->archdata.of_node == data;
+}
+
+struct i2c_client *of_find_i2c_device_by_node(struct device_node *node)
+{
+ struct device *dev;
+
+ dev = bus_find_device(&i2c_bus_type, NULL, node,
+ of_dev_node_match);
+ if (!dev)
+ return NULL;
+
+ return to_i2c_client(dev);
+}
+EXPORT_SYMBOL(of_find_i2c_device_by_node);
+
MODULE_LICENSE("GPL");
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index fb9af6a..186b22d 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -92,6 +92,9 @@ extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client * client,
extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client * client,
u8 command, u8 length,
const u8 *values);
+
+/* Base of the i2c bus */
+extern struct bus_type i2c_bus_type;
/*
* A driver is capable of handling one or more physical devices present on
diff --git a/include/linux/of_i2c.h b/include/linux/of_i2c.h
index bd2a870..17d5897 100644
--- a/include/linux/of_i2c.h
+++ b/include/linux/of_i2c.h
@@ -16,5 +16,7 @@
void of_register_i2c_devices(struct i2c_adapter *adap,
struct device_node *adap_node);
+struct i2c_client *of_find_i2c_device_by_node(struct device_node *node);
+
#endif /* __LINUX_OF_I2C_H */
^ permalink raw reply related
* [PATCH 1/2] Convert i2c-mpc from a platform driver into a of_platform driver, V4
From: Jon Smirl @ 2008-06-30 23:01 UTC (permalink / raw)
To: i2c, Linuxppc-dev
Convert i2c-mpc to an of_platform driver. Utilize the code in drivers/of-i2c.c to make i2c modules dynamically loadable by the device tree.
Signed-off-by: Jon Smirl <jonsmirl@gmail.com>
---
arch/powerpc/sysdev/fsl_soc.c | 122 -----------------------------------------
drivers/i2c/busses/i2c-mpc.c | 104 ++++++++++++++++++++---------------
2 files changed, 60 insertions(+), 166 deletions(-)
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index 3a7054e..ebcec73 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -414,128 +414,6 @@ err:
arch_initcall(gfar_of_init);
-#ifdef CONFIG_I2C_BOARDINFO
-#include <linux/i2c.h>
-struct i2c_driver_device {
- char *of_device;
- char *i2c_type;
-};
-
-static struct i2c_driver_device i2c_devices[] __initdata = {
- {"ricoh,rs5c372a", "rs5c372a"},
- {"ricoh,rs5c372b", "rs5c372b"},
- {"ricoh,rv5c386", "rv5c386"},
- {"ricoh,rv5c387a", "rv5c387a"},
- {"dallas,ds1307", "ds1307"},
- {"dallas,ds1337", "ds1337"},
- {"dallas,ds1338", "ds1338"},
- {"dallas,ds1339", "ds1339"},
- {"dallas,ds1340", "ds1340"},
- {"stm,m41t00", "m41t00"},
- {"dallas,ds1374", "rtc-ds1374"},
-};
-
-static int __init of_find_i2c_driver(struct device_node *node,
- struct i2c_board_info *info)
-{
- int i;
-
- for (i = 0; i < ARRAY_SIZE(i2c_devices); i++) {
- if (!of_device_is_compatible(node, i2c_devices[i].of_device))
- continue;
- if (strlcpy(info->type, i2c_devices[i].i2c_type,
- I2C_NAME_SIZE) >= I2C_NAME_SIZE)
- return -ENOMEM;
- return 0;
- }
- return -ENODEV;
-}
-
-static void __init of_register_i2c_devices(struct device_node *adap_node,
- int bus_num)
-{
- struct device_node *node = NULL;
-
- while ((node = of_get_next_child(adap_node, node))) {
- struct i2c_board_info info = {};
- const u32 *addr;
- int len;
-
- addr = of_get_property(node, "reg", &len);
- if (!addr || len < sizeof(int) || *addr > (1 << 10) - 1) {
- printk(KERN_WARNING "fsl_soc.c: invalid i2c device entry\n");
- continue;
- }
-
- info.irq = irq_of_parse_and_map(node, 0);
- if (info.irq == NO_IRQ)
- info.irq = -1;
-
- if (of_find_i2c_driver(node, &info) < 0)
- continue;
-
- info.addr = *addr;
-
- i2c_register_board_info(bus_num, &info, 1);
- }
-}
-
-static int __init fsl_i2c_of_init(void)
-{
- struct device_node *np;
- unsigned int i = 0;
- struct platform_device *i2c_dev;
- int ret;
-
- for_each_compatible_node(np, NULL, "fsl-i2c") {
- struct resource r[2];
- struct fsl_i2c_platform_data i2c_data;
- const unsigned char *flags = NULL;
-
- memset(&r, 0, sizeof(r));
- memset(&i2c_data, 0, sizeof(i2c_data));
-
- ret = of_address_to_resource(np, 0, &r[0]);
- if (ret)
- goto err;
-
- of_irq_to_resource(np, 0, &r[1]);
-
- i2c_dev = platform_device_register_simple("fsl-i2c", i, r, 2);
- if (IS_ERR(i2c_dev)) {
- ret = PTR_ERR(i2c_dev);
- goto err;
- }
-
- i2c_data.device_flags = 0;
- flags = of_get_property(np, "dfsrr", NULL);
- if (flags)
- i2c_data.device_flags |= FSL_I2C_DEV_SEPARATE_DFSRR;
-
- flags = of_get_property(np, "fsl5200-clocking", NULL);
- if (flags)
- i2c_data.device_flags |= FSL_I2C_DEV_CLOCK_5200;
-
- ret =
- platform_device_add_data(i2c_dev, &i2c_data,
- sizeof(struct
- fsl_i2c_platform_data));
- if (ret)
- goto unreg;
-
- of_register_i2c_devices(np, i++);
- }
-
- return 0;
-
-unreg:
- platform_device_unregister(i2c_dev);
-err:
- return ret;
-}
-
-arch_initcall(fsl_i2c_of_init);
-#endif
#ifdef CONFIG_PPC_83xx
static int __init mpc83xx_wdt_init(void)
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index a076129..4fdfb62 100644
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -17,7 +17,8 @@
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/init.h>
-#include <linux/platform_device.h>
+#include <linux/of_platform.h>
+#include <linux/of_i2c.h>
#include <asm/io.h>
#include <linux/fsl_devices.h>
@@ -25,13 +26,13 @@
#include <linux/interrupt.h>
#include <linux/delay.h>
-#define MPC_I2C_ADDR 0x00
+#define DRV_NAME "mpc-i2c"
+
#define MPC_I2C_FDR 0x04
#define MPC_I2C_CR 0x08
#define MPC_I2C_SR 0x0c
#define MPC_I2C_DR 0x10
#define MPC_I2C_DFSRR 0x14
-#define MPC_I2C_REGION 0x20
#define CCR_MEN 0x80
#define CCR_MIEN 0x40
@@ -315,102 +316,117 @@ static struct i2c_adapter mpc_ops = {
.timeout = 1,
};
-static int fsl_i2c_probe(struct platform_device *pdev)
+static int __devinit fsl_i2c_probe(struct of_device *op, const struct of_device_id *match)
{
int result = 0;
struct mpc_i2c *i2c;
- struct fsl_i2c_platform_data *pdata;
- struct resource *r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-
- pdata = (struct fsl_i2c_platform_data *) pdev->dev.platform_data;
i2c = kzalloc(sizeof(*i2c), GFP_KERNEL);
if (!i2c)
return -ENOMEM;
- i2c->irq = platform_get_irq(pdev, 0);
- if (i2c->irq < 0)
- i2c->irq = NO_IRQ; /* Use polling */
+ if (of_get_property(op->node, "dfsrr", NULL))
+ i2c->flags |= FSL_I2C_DEV_SEPARATE_DFSRR;
- i2c->flags = pdata->device_flags;
- init_waitqueue_head(&i2c->queue);
+ if (of_device_is_compatible(op->node, "fsl,mpc5200-i2c") ||
+ of_device_is_compatible(op->node, "mpc5200-i2c"))
+ i2c->flags |= FSL_I2C_DEV_CLOCK_5200;
- i2c->base = ioremap((phys_addr_t)r->start, MPC_I2C_REGION);
+ init_waitqueue_head(&i2c->queue);
+ i2c->base = of_iomap(op->node, 0);
if (!i2c->base) {
printk(KERN_ERR "i2c-mpc - failed to map controller\n");
result = -ENOMEM;
goto fail_map;
}
- if (i2c->irq != NO_IRQ)
- if ((result = request_irq(i2c->irq, mpc_i2c_isr,
- IRQF_SHARED, "i2c-mpc", i2c)) < 0) {
- printk(KERN_ERR
- "i2c-mpc - failed to attach interrupt\n");
- goto fail_irq;
+ i2c->irq = irq_of_parse_and_map(op->node, 0);
+ if (i2c->irq != NO_IRQ) { /* i2c->irq = NO_IRQ implies polling */
+ result = request_irq(i2c->irq, mpc_i2c_isr,
+ IRQF_SHARED, "i2c-mpc", i2c);
+ if (result < 0) {
+ printk(KERN_ERR "i2c-mpc - failed to attach interrupt\n");
+ goto fail_request;
}
-
+ }
+
mpc_i2c_setclock(i2c);
- platform_set_drvdata(pdev, i2c);
+
+ dev_set_drvdata(&op->dev, i2c);
i2c->adap = mpc_ops;
- i2c->adap.nr = pdev->id;
i2c_set_adapdata(&i2c->adap, i2c);
- i2c->adap.dev.parent = &pdev->dev;
- if ((result = i2c_add_numbered_adapter(&i2c->adap)) < 0) {
+ i2c->adap.dev.parent = &op->dev;
+
+ result = i2c_add_adapter(&i2c->adap);
+ if (result < 0) {
printk(KERN_ERR "i2c-mpc - failed to add adapter\n");
goto fail_add;
}
+ of_register_i2c_devices(&i2c->adap, op->node);
return result;
- fail_add:
- if (i2c->irq != NO_IRQ)
- free_irq(i2c->irq, i2c);
- fail_irq:
- iounmap(i2c->base);
- fail_map:
+ fail_add:
+ dev_set_drvdata(&op->dev, NULL);
+ free_irq(i2c->irq, i2c);
+ fail_request:
+ irq_dispose_mapping(i2c->irq);
+ iounmap(i2c->base);
+ fail_map:
kfree(i2c);
return result;
};
-static int fsl_i2c_remove(struct platform_device *pdev)
+static int __devexit fsl_i2c_remove(struct of_device *op)
{
- struct mpc_i2c *i2c = platform_get_drvdata(pdev);
+ struct mpc_i2c *i2c = dev_get_drvdata(&op->dev);
i2c_del_adapter(&i2c->adap);
- platform_set_drvdata(pdev, NULL);
+ dev_set_drvdata(&op->dev, NULL);
if (i2c->irq != NO_IRQ)
free_irq(i2c->irq, i2c);
+ irq_dispose_mapping(i2c->irq);
iounmap(i2c->base);
kfree(i2c);
return 0;
};
-/* work with hotplug and coldplug */
-MODULE_ALIAS("platform:fsl-i2c");
+static const struct of_device_id mpc_i2c_of_match[] = {
+ {.compatible = "fsl-i2c",},
+ {},
+};
+MODULE_DEVICE_TABLE(of, mpc_i2c_of_match);
+
/* Structure for a device driver */
-static struct platform_driver fsl_i2c_driver = {
- .probe = fsl_i2c_probe,
- .remove = fsl_i2c_remove,
- .driver = {
- .owner = THIS_MODULE,
- .name = "fsl-i2c",
+static struct of_platform_driver mpc_i2c_driver = {
+ .match_table = mpc_i2c_of_match,
+ .probe = fsl_i2c_probe,
+ .remove = __devexit_p(fsl_i2c_remove),
+ .driver = {
+ .owner = THIS_MODULE,
+ .name = DRV_NAME,
},
};
static int __init fsl_i2c_init(void)
{
- return platform_driver_register(&fsl_i2c_driver);
+ int rv;
+
+ rv = of_register_platform_driver(&mpc_i2c_driver);
+ if (rv)
+ printk(KERN_ERR DRV_NAME
+ " of_register_platform_driver failed (%i)\n", rv);
+ return rv;
}
static void __exit fsl_i2c_exit(void)
{
- platform_driver_unregister(&fsl_i2c_driver);
+ of_unregister_platform_driver(&mpc_i2c_driver);
}
module_init(fsl_i2c_init);
^ permalink raw reply related
* Re: [PATCH] powerpc: Xilinx: PS2: Added new XPS PS2 driver
From: Grant Likely @ 2008-06-30 22:45 UTC (permalink / raw)
To: John Linn; +Cc: linuxppc-dev, dmitry.torokhov, linux-input, Sadanand Mutyala
In-Reply-To: <20080630200015.06E6E1F8054@mail93-va3.bigfish.com>
On Mon, Jun 30, 2008 at 02:00:12PM -0600, John Linn wrote:
> >
> >Since xps2_recv() and xps2_send() are used by the sxps2_* routines and
> >by the irq handler, they should be moved to about them in this file.
> >
>
> OK, keeping them close makes maintenance easier I guess.
>
Oops, there is a typo in my comment:
"... they should be moved to *above* them in this file." 'about' doesn't
make much sense.
g.
^ permalink raw reply
* Re: [PATCH v2] update crypto node definition and device tree instances
From: Kim Phillips @ 2008-06-30 22:30 UTC (permalink / raw)
To: Segher Boessenkool; +Cc: linuxppc-dev
In-Reply-To: <e07b0ce3c375e9418ac976256c731f03@kernel.crashing.org>
On Mon, 30 Jun 2008 23:19:05 +0200
Segher Boessenkool <segher@kernel.crashing.org> wrote:
> >>>> Also, these made-up names make you do more work: you'll need to
> >>>
> >>> who said they were made up?
> >>
> >> I did. These names do not refer to some physical part you can buy.
> >
> > right, they refer to devices in multiple physical parts you can buy.
> > Part-you-can-buy documentation clearly indicates the SEC version in
> > that part, in the form "SEC X.Y", i.e, it's not something made up
> > that's not already in freescale documentation.
>
> Yes. As a side note, since there are multiple devices that contain
> e.g. a sec-1.0, it would be prudent to describe the exact incarnation
> in the device tree, like "mpc8272-sec" or something, in either "model"
but 'fsl,sec-X.Y' /does/ describe the exact incarnation, whereas
'fsl,mpc8349-sec' /does not/. "fsl,mpc8349-sec' might mean the SEC 2.1
or the SEC 2.4, it depends on the revision of the mpc8349.
> or "compatible", just in case a problem shows up with one of them.
I thought 'model' was superseded by 'compatible'; that's why it's taken
out here, along with device_type.
> >>>> write up a binding for them, explaining exactly what a 1.0 device
> >>>> etc. is (or at least point to documentation for it). If you use
> >>>> a name that refers to some device that people can easily google
> >>>> for documentation, you can skip this (well, you might need to
> >>>> write a binding anyway; but at least you won't have to explain
> >>>> what the device _is_).
> >>>
> >>> documentation is available in the usual places, and it specifically
> >>> points out which SEC version it references.
> >>
> >> I can't find a manual online for "freescale sec"; googling
> >> for "freescale sec-1.0" finds a manual for the PowerQUICC I;
> >> is that the right one? I don't know, so the binding needs
> >> to explain it to me.
> >
> > the binding shouldn't be responsible for google's shortcomings
>
> The binding needs to describe what device it is for. I am a stupid
> user, just like most users, so if the binding doesn't tell me I turn
> to google. Don't blame them for not finding it; the binding should
> have told me in the first place!
Again, I don't see how google's results are pertinent in this
discussion. The fact that Freescale doesn't publish a separate SEC
manual is not what this patch is trying to address.
btw, the title for the binding is:
g) Freescale SOC SEC Security Engines
Is that what you are looking for? If not, what precisely? a list of
all the parts? There's an SEC in every mpc8[35]xxE!
> >>> Plus, as I mentioned
> >>> before, a lot of the differences between the SEC versions are
> >>> miniscule
> >>> feature bits scattered across the programming model.
> >>
> >> I don't see how this is relevant, sorry.
> >>
> > I'm under the impression that listing the differences (assuming they're
> > easily obtainable) would lead to unnecessary b-w-of bloat.
>
> The binding at a minimum should describe how to identify each
> unique version from the device tree, no matter how miniscule
> those differences are. Just a specific "compatible" value will
> do.
I'm at a loss; isn't that what this patch does?
> > I don't know what google does; I'd search freescale documentation
> > directly.
>
> Or the binding could just bloody say what it is talking about in the
> first place, heh.
Again, I'm at a loss here. Can you give a specific example of what
you're looking for here?
> Anyway, how about we do something constructive? If you still want to
> use "fsl,sec-N.M" names, that's fine with me. Each specific device
> tree needs to still say which exact device it contains, so an entry
> would look like e.g.
>
> compatible = "fsl,mpc8272-sec", "fsl,sec-3.0";
>
> and the driver can just probe for "fsl,sec-3.0" if it doesn't need
> to know about the exact version; but it _can_ use it if it _does_
> need to know.
Currently the driver matches on "fsl,sec2.0", and if needs be, will
call of_device_is_compatible with the version number that introduces
the feature it wants to implement.
Kim
^ permalink raw reply
* Re: [PATCH 08/18 v2] powerpc: Do not probe PCI buses or eBus devices if CMO is enabled
From: Brian King @ 2008-06-30 21:56 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev, David Darrington
In-Reply-To: <18536.25052.228270.743669@cargo.ozlabs.ibm.com>
Paul Mackerras wrote:
> Robert Jennings writes:
>
>> From: Brian King <brking@linux.vnet.ibm.com>
>>
>> The Cooperative Memory Overcommit (CMO) on System p does not currently
>> support native PCI devices or eBus devices when enabled.
>
> Then why would we get any native PCI or eBus devices in the device
> tree?
We shouldn't. The reason the patch exists is so that *if* firmware were to
add support for physical PCI/eBus devices in CMO mode in the future, then
we could get into a scenario where there are such devices in the device
tree and we would want to prevent them from getting initialized
on a kernel without the code needed to support such a feature.
-Brian
--
Brian King
Linux on Power Virtualization
IBM Linux Technology Center
^ permalink raw reply
* RE: [PATCH] [V2] powerpc: Xilinx: PS2: Added new XPS PS2 driver
From: John Linn @ 2008-06-30 21:28 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linuxppc-dev, Sadanand Mutyala, linux-input
In-Reply-To: <20080630141552.ZZRA012@mailhub.coreip.homeip.net>
Thanks Dmitry, see my comments inline.
-- John
>On Mon, Jun 30, 2008 at 08:38:21AM -0700, John Linn wrote:
>> + spin_lock_init(&drvdata->lock);
>> + dev_set_drvdata(dev, (void *)drvdata);
>
>No need to cast to void *.
OK.
>
>> +
>> + if (!regs_res || !irq_res) {
>> + dev_err(dev, "IO resource(s) not found\n");
>> + retval =3D -EFAULT;
>> + goto failed1;
>> + }
>> +
>> + drvdata->irq =3D irq_res->start;
>> + remap_size =3D regs_res->end - regs_res->start + 1;
>> + if (!request_mem_region(regs_res->start, remap_size,
DRIVER_NAME)) {
>> +
>> + dev_err(dev, "Couldn't lock memory region at 0x%08X\n",
>> + (unsigned int)regs_res->start);
>> + retval =3D -EBUSY;
>> + goto failed1;
>> + }
>> +
>> + /* Fill in configuration data and add them to the list */
>> + drvdata->phys_addr =3D regs_res->start;
>> + drvdata->remap_size =3D remap_size;
>> + drvdata->base_address =3D ioremap(regs_res->start, remap_size);
>> + if (drvdata->base_address =3D=3D NULL) {
>> +
>> + dev_err(dev, "Couldn't ioremap memory at 0x%08X\n",
>> + (unsigned int)regs_res->start);
>> + retval =3D -EFAULT;
>> + goto failed2;
>> + }
>> +
>> + /* Initialize the PS/2 interface */
>> + down(&cfg_sem);
>> + if (xps2_initialize(drvdata)) {
>> + up(&cfg_sem);
>> + dev_err(dev, "Could not initialize device\n");
>> + retval =3D -ENODEV;
>> + goto failed3;
>> + }
>> + up(&cfg_sem);
>
>Do you need a counting semaphore here?
>
Seems like a simpler kind of mutal exclusion would do the job, like a
spinlock.
Looks like mutual exclusion is needed as the device contains 2 ps2
controllers.
>> +
>> + dev_info(dev, "Xilinx PS2 at 0x%08X mapped to 0x%08X, irq=3D%d\n",
>> + drvdata->phys_addr, (u32)drvdata->base_address,
drvdata->irq);
>> +
>> + drvdata->serio.id.type =3D SERIO_8042;
>> + drvdata->serio.write =3D sxps2_write;
>> + drvdata->serio.open =3D sxps2_open;
>> + drvdata->serio.close =3D sxps2_close;
>> + drvdata->serio.port_data =3D drvdata;
>> + drvdata->serio.dev.parent =3D dev;
>> + snprintf(drvdata->serio.name, sizeof(drvdata->serio.name),
>> + XPS2_NAME_DESC, id);
>> + snprintf(drvdata->serio.phys, sizeof(drvdata->serio.phys),
>> + XPS2_PHYS_DESC, id);
>
>I bet if you make a temp variable for drvdata->serio the code size wil
>shrink a tiny bit.
Ok, not sure the complexity of the temp is worth the tiny code
shrinkage.
I would think the compiler should optimize it as well but your
experience
must say otherwise.
>
>-- =
>Dmitry
>
-----Original Message-----
From: Dmitry Torokhov [mailto:dmitry.torokhov@gmail.com] =
Sent: Monday, June 30, 2008 12:21 PM
To: John Linn
Cc: linuxppc-dev@ozlabs.org; linux-input@vger.kernel.org; Sadanand
Mutyala
Subject: Re: [PATCH] [V2] powerpc: Xilinx: PS2: Added new XPS PS2 driver
On Mon, Jun 30, 2008 at 08:38:21AM -0700, John Linn wrote:
> + spin_lock_init(&drvdata->lock);
> + dev_set_drvdata(dev, (void *)drvdata);
No need to cast to void *.
> +
> + if (!regs_res || !irq_res) {
> + dev_err(dev, "IO resource(s) not found\n");
> + retval =3D -EFAULT;
> + goto failed1;
> + }
> +
> + drvdata->irq =3D irq_res->start;
> + remap_size =3D regs_res->end - regs_res->start + 1;
> + if (!request_mem_region(regs_res->start, remap_size,
DRIVER_NAME)) {
> +
> + dev_err(dev, "Couldn't lock memory region at 0x%08X\n",
> + (unsigned int)regs_res->start);
> + retval =3D -EBUSY;
> + goto failed1;
> + }
> +
> + /* Fill in configuration data and add them to the list */
> + drvdata->phys_addr =3D regs_res->start;
> + drvdata->remap_size =3D remap_size;
> + drvdata->base_address =3D ioremap(regs_res->start, remap_size);
> + if (drvdata->base_address =3D=3D NULL) {
> +
> + dev_err(dev, "Couldn't ioremap memory at 0x%08X\n",
> + (unsigned int)regs_res->start);
> + retval =3D -EFAULT;
> + goto failed2;
> + }
> +
> + /* Initialize the PS/2 interface */
> + down(&cfg_sem);
> + if (xps2_initialize(drvdata)) {
> + up(&cfg_sem);
> + dev_err(dev, "Could not initialize device\n");
> + retval =3D -ENODEV;
> + goto failed3;
> + }
> + up(&cfg_sem);
Do you need a counting semaphore here?
> +
> + dev_info(dev, "Xilinx PS2 at 0x%08X mapped to 0x%08X, irq=3D%d\n",
> + drvdata->phys_addr, (u32)drvdata->base_address,
drvdata->irq);
> +
> + drvdata->serio.id.type =3D SERIO_8042;
> + drvdata->serio.write =3D sxps2_write;
> + drvdata->serio.open =3D sxps2_open;
> + drvdata->serio.close =3D sxps2_close;
> + drvdata->serio.port_data =3D drvdata;
> + drvdata->serio.dev.parent =3D dev;
> + snprintf(drvdata->serio.name, sizeof(drvdata->serio.name),
> + XPS2_NAME_DESC, id);
> + snprintf(drvdata->serio.phys, sizeof(drvdata->serio.phys),
> + XPS2_PHYS_DESC, id);
I bet if you make a temp variable for drvdata->serio the code size wil
shrink a tiny bit.
-- =
Dmitry
This email and any attachments are intended for the sole use of the named r=
ecipient(s) and contain(s) confidential information that may be proprietary=
, privileged or copyrighted under applicable law. If you are not the intend=
ed recipient, do not read, copy, or forward this email message or any attac=
hments. Delete this email message and any attachments immediately.
^ permalink raw reply
* Re: [PATCH v2] update crypto node definition and device tree instances
From: Segher Boessenkool @ 2008-06-30 21:19 UTC (permalink / raw)
To: Kim Phillips; +Cc: linuxppc-dev
In-Reply-To: <20080630131441.e9b9ac1c.kim.phillips@freescale.com>
>>>> Also, these made-up names make you do more work: you'll need to
>>>
>>> who said they were made up?
>>
>> I did. These names do not refer to some physical part you can buy.
>
> right, they refer to devices in multiple physical parts you can buy.
> Part-you-can-buy documentation clearly indicates the SEC version in
> that part, in the form "SEC X.Y", i.e, it's not something made up
> that's not already in freescale documentation.
Yes. As a side note, since there are multiple devices that contain
e.g. a sec-1.0, it would be prudent to describe the exact incarnation
in the device tree, like "mpc8272-sec" or something, in either "model"
or "compatible", just in case a problem shows up with one of them.
>>>> write up a binding for them, explaining exactly what a 1.0 device
>>>> etc. is (or at least point to documentation for it). If you use
>>>> a name that refers to some device that people can easily google
>>>> for documentation, you can skip this (well, you might need to
>>>> write a binding anyway; but at least you won't have to explain
>>>> what the device _is_).
>>>
>>> documentation is available in the usual places, and it specifically
>>> points out which SEC version it references.
>>
>> I can't find a manual online for "freescale sec"; googling
>> for "freescale sec-1.0" finds a manual for the PowerQUICC I;
>> is that the right one? I don't know, so the binding needs
>> to explain it to me.
>
> the binding shouldn't be responsible for google's shortcomings
The binding needs to describe what device it is for. I am a stupid
user, just like most users, so if the binding doesn't tell me I turn
to google. Don't blame them for not finding it; the binding should
have told me in the first place!
> (that hit is correct, btw).
Okay, cool.
>> Going from SoC name -> SEC version is easy, but the other way around
>> not so.
>>
>> Anyway, minor stuff.
>
> sounds like you're pointing out a lack of "SEC versions guide"
> documentation of Freescale..
Yes, that would have helped.
>>> Plus, as I mentioned
>>> before, a lot of the differences between the SEC versions are
>>> miniscule
>>> feature bits scattered across the programming model.
>>
>> I don't see how this is relevant, sorry.
>>
> I'm under the impression that listing the differences (assuming they're
> easily obtainable) would lead to unnecessary b-w-of bloat.
The binding at a minimum should describe how to identify each
unique version from the device tree, no matter how miniscule
those differences are. Just a specific "compatible" value will
do.
> I don't know what google does; I'd search freescale documentation
> directly.
Or the binding could just bloody say what it is talking about in the
first place, heh.
Anyway, how about we do something constructive? If you still want to
use "fsl,sec-N.M" names, that's fine with me. Each specific device
tree needs to still say which exact device it contains, so an entry
would look like e.g.
compatible = "fsl,mpc8272-sec", "fsl,sec-3.0";
and the driver can just probe for "fsl,sec-3.0" if it doesn't need
to know about the exact version; but it _can_ use it if it _does_
need to know.
Segher
^ permalink raw reply
* Re: [PATCH v2] powerpc: Add dma nodes to 83xx, 85xx and 86xx boards
From: Segher Boessenkool @ 2008-06-30 20:56 UTC (permalink / raw)
To: Kumar Gala; +Cc: Scott Wood, linuxppc-dev@ozlabs.org list, Timur Tabi
In-Reply-To: <D70C5CB6-5066-4AD3-9367-879AF39FB8E1@kernel.crashing.org>
>>> What's the cell-index in these nodes used to index? Given the
>>> confusion there's been about the proper use of this property, a
>>> comment indicating which shared registers this is used to index is
>>> probably a good idea.
>>
>> There's supposed to be a cell-index in the *channels* to index into
>> the
>> shared summary register (the "reg" of the dma node itself). I don't
>> see any
>> purpose for a cell-index in the main dma node, though.
>
> I believe this comes into play when we have more than one DMA
> controller and sometimes there are special uses like on 8610.
There is no need to guess what it is or isn't used for. Just look
it up in the binding for this device.
Segher
^ permalink raw reply
* Re: [PATCH] fsl-diu-fb: Update Freescale DIU driver to use page_alloc_exact()
From: Andrew Morton @ 2008-06-30 20:24 UTC (permalink / raw)
To: Timur Tabi; +Cc: linuxppc-dev, linux-fbdev-devel, linux-kernel
In-Reply-To: <1214325853-26150-1-git-send-email-timur@freescale.com>
On Tue, 24 Jun 2008 11:44:13 -0500
Timur Tabi <timur@freescale.com> wrote:
> Update the Freescale DIU driver to use page_alloc_exact() to allocate a
> DMA buffer. This also eliminates the rheap-based memory allocator. We
> can do this now because commit 6ccf61f9 allows us to allocate 8MB physically-
> contiguous memory blocks.
>
> Signed-off-by: Timur Tabi <timur@freescale.com>
> ---
>
> My other patch, "Add alloc_pages_exact() and free_pages_exact()", must be
> applied first, otherwise drivers/video/fsl-diu-fb.c will not compile.
>
> drivers/video/fsl-diu-fb.c | 59 +++++++++++++++----------------------------
> 1 files changed, 21 insertions(+), 38 deletions(-)
>
> diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c
> index 0a27853..d15d265 100644
> --- a/drivers/video/fsl-diu-fb.c
> +++ b/drivers/video/fsl-diu-fb.c
> @@ -279,58 +279,41 @@ static struct diu_hw dr = {
>
> static struct diu_pool pool;
>
> -/* To allocate memory for framebuffer. First try __get_free_pages(). If it
> - * fails, try rh_alloc. The reason is __get_free_pages() cannot allocate
> - * very large memory (more than 4MB). We don't want to allocate all memory
> - * in rheap since small memory allocation/deallocation will fragment the
> - * rheap and make the furture large allocation fail.
> +/**
> + * fsl_diu_alloc - allocate memory for the DIU
> + * @size: number of bytes to allocate
> + * @param: returned physical address of memory
> + *
> + * This function allocates a physically-contiguous block of memory.
> */
> -
> -void *fsl_diu_alloc(unsigned long size, phys_addr_t *phys)
> +static void *fsl_diu_alloc(size_t size, phys_addr_t *phys)
> {
> void *virt;
>
> - pr_debug("size=%lu\n", size);
> + pr_debug("size=%u\n", size);
Nope, this will generate warnings on some architectures.
The way to print a size_t is with %zu or %zd. I guess the latter is for
ssize_t.
> - virt = (void *)__get_free_pages(GFP_DMA | __GFP_ZERO, get_order(size));
> + virt = alloc_pages_exact(size, GFP_DMA | __GFP_ZERO);
> if (virt) {
> *phys = virt_to_phys(virt);
> - pr_debug("virt %p, phys=%llx\n", virt, (uint64_t) *phys);
> - return virt;
> - }
> - if (!diu_ops.diu_mem) {
> - printk(KERN_INFO "%s: no diu_mem."
> - " To reserve more memory, put 'diufb=15M' "
> - "in the command line\n", __func__);
> - return NULL;
> - }
> -
> - virt = (void *)rh_alloc(&diu_ops.diu_rh_info, size, "DIU");
> - if (virt) {
> - *phys = virt_to_bus(virt);
> - memset(virt, 0, size);
> + pr_debug("virt=%p, phys=%llx\n", virt, (uint64_t) *phys);
This is also incorrect. We cannot pass u64 or uint64_t into printk at
all. We do not know what type the architectures uses to implement
them. It should be cast to a known type. In this case `unsigned long
long'.
^ 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