[PATCHES] Bits and pieces for Power7 support in HV mode

2011-04-05 Thread Benjamin Herrenschmidt
Here's a patch series which adds bits and pieces (and in some case
not directly related cleanups that will be useful for the upcoming
platform that uses that stuff) to allow running a recent CPU in
hypervisor mode.

It applies on top of the few cleanups and the XICS rewrite I've
already posted and is a pre-requisite for the upcoming KVM support
and the non-virtualized platform (still brewing).

I've also put them in my test branch

Cheers,
Ben.

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 02/15] powerpc/rtas: Check RTAS presence when testing indicators

2011-04-05 Thread Benjamin Herrenschmidt
Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org
---
 arch/powerpc/kernel/rtas.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index 2097f2b..c2bfc4d 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -591,6 +591,8 @@ bool rtas_indicator_present(int token, int *maxindex)
u32 maxindex;
} *indicators;
 
+   if (!rtas.dev)
+   return false;
indicators = of_get_property(rtas.dev, rtas-indicators, proplen);
if (!indicators)
return false;
-- 
1.7.1

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 05/15] powerpc: In HV mode, use HSPRG0 for PACA

2011-04-05 Thread Benjamin Herrenschmidt
When running in Hypervisor mode (arch 2.06 or later), we store the PACA
in HSPRG0 instead of SPRG1. The architecture specifies that SPRGs may be
lost during a nap power management operation (though they aren't
currently on POWER7) and this enables use of SPRG1 by KVM guests.

Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org
---
 arch/powerpc/include/asm/exception-64s.h |6 +++---
 arch/powerpc/include/asm/reg.h   |   27 ++-
 arch/powerpc/kernel/entry_64.S   |4 ++--
 arch/powerpc/kernel/exceptions-64s.S |8 
 arch/powerpc/kernel/head_64.S|4 ++--
 arch/powerpc/kernel/paca.c   |   13 -
 arch/powerpc/kvm/book3s_rmhandlers.S |4 +---
 7 files changed, 50 insertions(+), 16 deletions(-)

diff --git a/arch/powerpc/include/asm/exception-64s.h 
b/arch/powerpc/include/asm/exception-64s.h
index 7778d6f..337b6fa 100644
--- a/arch/powerpc/include/asm/exception-64s.h
+++ b/arch/powerpc/include/asm/exception-64s.h
@@ -56,8 +56,8 @@
 #define LOAD_HANDLER(reg, label)   \
addireg,reg,(label)-_stext; /* virt addr of handler ... */
 
-#define EXCEPTION_PROLOG_1(area)   \
-   mfspr   r13,SPRN_SPRG_PACA; /* get paca address into r13 */ \
+#define EXCEPTION_PROLOG_1(area)   \
+   GET_PACA(r13);  \
std r9,area+EX_R9(r13); /* save r9 - r12 */ \
std r10,area+EX_R10(r13);   \
std r11,area+EX_R11(r13);   \
@@ -174,7 +174,7 @@ label##_pSeries:
\
HMT_MEDIUM; \
DO_KVM  n;  \
mtspr   SPRN_SPRG_SCRATCH0,r13; /* save r13 */  \
-   mfspr   r13,SPRN_SPRG_PACA; /* get paca address into r13 */ \
+   GET_PACA(r13);  \
std r9,PACA_EXGEN+EX_R9(r13);   /* save r9, r10 */  \
std r10,PACA_EXGEN+EX_R10(r13); \
lbz r10,PACASOFTIRQEN(r13); \
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
index 6eb1d77..13429a0 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -715,12 +715,15 @@
  * SPRG usage:
  *
  * All 64-bit:
- * - SPRG1 stores PACA pointer
+ * - SPRG1 stores PACA pointer except 64-bit server in
+ *HV mode in which case it is HSPRG0
  *
  * 64-bit server:
  * - SPRG0 unused (reserved for HV on Power4)
  * - SPRG2 scratch for exception vectors
  * - SPRG3 unused (user visible)
+ *  - HSPRG0 stores PACA in HV mode
+ *  - HSPRG1 scratch for HV exceptions
  *
  * 64-bit embedded
  * - SPRG0 generic exception scratch
@@ -783,6 +786,22 @@
 
 #ifdef CONFIG_PPC_BOOK3S_64
 #define SPRN_SPRG_SCRATCH0 SPRN_SPRG2
+#define SPRN_SPRG_HPACASPRN_HSPRG0
+#define SPRN_SPRG_HSCRATCH0SPRN_HSPRG1
+
+#define GET_PACA(rX)   \
+   BEGIN_FTR_SECTION_NESTED(66);   \
+   mfspr   rX,SPRN_SPRG_PACA;  \
+   FTR_SECTION_ELSE_NESTED(66);\
+   mfspr   rX,SPRN_SPRG_HPACA; \
+   ALT_FTR_SECTION_END_NESTED_IFCLR(CPU_FTR_HVMODE_206, 66)
+
+#define SET_PACA(rX)   \
+   BEGIN_FTR_SECTION_NESTED(66);   \
+   mtspr   SPRN_SPRG_PACA,rX;  \
+   FTR_SECTION_ELSE_NESTED(66);\
+   mtspr   SPRN_SPRG_HPACA,rX; \
+   ALT_FTR_SECTION_END_NESTED_IFCLR(CPU_FTR_HVMODE_206, 66)
 #endif
 
 #ifdef CONFIG_PPC_BOOK3E_64
@@ -792,6 +811,10 @@
 #define SPRN_SPRG_TLB_EXFRAME  SPRN_SPRG2
 #define SPRN_SPRG_TLB_SCRATCH  SPRN_SPRG6
 #define SPRN_SPRG_GEN_SCRATCH  SPRN_SPRG0
+
+#define SET_PACA(rX)   mtspr   SPRN_SPRG_PACA,rX
+#define GET_PACA(rX)   mfspr   rX,SPRN_SPRG_PACA
+
 #endif
 
 #ifdef CONFIG_PPC_BOOK3S_32
@@ -842,6 +865,8 @@
 #define SPRN_SPRG_SCRATCH1 SPRN_SPRG1
 #endif
 
+
+
 /*
  * An mtfsf instruction with the L bit set. On CPUs that support this a
  * full 64bits of FPSCR is restored and on other CPUs the L bit is ignored.
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index d82878c..dbf5bfa 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -838,7 +838,7 @@ _GLOBAL(enter_rtas)
 
 _STATIC(rtas_return_loc)
/* relocation is off at this point */
-   mfspr   r4,SPRN_SPRG_PACA   /* Get PACA */
+   GET_PACA(r4)
clrldi  r4,r4,2 /* convert to realmode address */
 
 

[PATCH 07/15] powerpc: More work to support HV exceptions

2011-04-05 Thread Benjamin Herrenschmidt
Rework exception macros a bit to split offset from vector and add
some basic support for HDEC, HDSI, HISI and a few more.

Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org
---
 arch/powerpc/include/asm/exception-64s.h  |   37 
 arch/powerpc/include/asm/feature-fixups.h |2 +-
 arch/powerpc/kernel/exceptions-64s.S  |   92 -
 3 files changed, 89 insertions(+), 42 deletions(-)

diff --git a/arch/powerpc/include/asm/exception-64s.h 
b/arch/powerpc/include/asm/exception-64s.h
index 1d98e05..fb5b0af 100644
--- a/arch/powerpc/include/asm/exception-64s.h
+++ b/arch/powerpc/include/asm/exception-64s.h
@@ -150,28 +150,27 @@
 /*
  * Exception vectors.
  */
-#define STD_EXCEPTION_PSERIES(n, label)\
-   . = n;  \
+#define STD_EXCEPTION_PSERIES(loc, vec, label) \
+   . = loc;\
.globl label##_pSeries; \
 label##_pSeries:   \
HMT_MEDIUM; \
-   DO_KVM  n;  \
+   DO_KVM  vec;\
mtspr   SPRN_SPRG_SCRATCH0,r13; /* save r13 */  \
EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common, EXC_STD)
 
-#define HSTD_EXCEPTION_PSERIES(n, label)   \
-   . = n;  \
-   .globl label##_pSeries; \
-label##_pSeries:   \
+#define STD_EXCEPTION_HV(loc, vec, label)  \
+   . = loc;\
+   .globl label##_hv;  \
+label##_hv:\
HMT_MEDIUM; \
-   DO_KVM  n;  \
+   DO_KVM  vec;\
mtspr   SPRN_SPRG_HSCRATCH0,r13;/* save r13 */  \
EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common, EXC_HV)
 
-
-#define __MASKABLE_EXCEPTION_PSERIES(n, label, h)  \
+#define __MASKABLE_EXCEPTION_PSERIES(vec, label, h)\
HMT_MEDIUM; \
-   DO_KVM  n;  \
+   DO_KVM  vec;\
mtspr   SPRN_SPRG_##h##SCRATCH0,r13;/* save r13 */  \
GET_PACA(r13);  \
std r9,PACA_EXGEN+EX_R9(r13);   /* save r9, r10 */  \
@@ -193,8 +192,20 @@ label##_pSeries:   \
mtspr   SPRN_##h##SRR1,r10; \
h##rfid;\
b   .   /* prevent speculative execution */
-#define MASKABLE_EXCEPTION_PSERIES(n, label, h)
\
-   __MASKABLE_EXCEPTION_PSERIES(n, label, h)
+#define _MASKABLE_EXCEPTION_PSERIES(vec, label, h) \
+   __MASKABLE_EXCEPTION_PSERIES(vec, label, h)
+
+#define MASKABLE_EXCEPTION_PSERIES(loc, vec, label)\
+   . = loc;\
+   .globl label##_pSeries; \
+label##_pSeries:   \
+   _MASKABLE_EXCEPTION_PSERIES(vec, label, EXC_STD)
+
+#define MASKABLE_EXCEPTION_HV(loc, vec, label) \
+   . = loc;\
+   .globl label##_hv;  \
+label##_hv:\
+   _MASKABLE_EXCEPTION_PSERIES(vec, label, EXC_HV)
 
 #ifdef CONFIG_PPC_ISERIES
 #define DISABLE_INTS   \
diff --git a/arch/powerpc/include/asm/feature-fixups.h 
b/arch/powerpc/include/asm/feature-fixups.h
index 921a847..bdc0d68 100644
--- a/arch/powerpc/include/asm/feature-fixups.h
+++ b/arch/powerpc/include/asm/feature-fixups.h
@@ -49,7 +49,7 @@ label##5: 
\
FTR_ENTRY_OFFSET label##2b-label##5b;   \
FTR_ENTRY_OFFSET label##3b-label##5b;   \
FTR_ENTRY_OFFSET label##4b-label##5b;   \
-   .ifgt (label##4b-label##3b)-(label##2b-label##1b);  \
+   .ifgt (label##4b- label##3b)-(label##2b- label##1b);\
.error Feature section else case larger than body;\
.endif; \
.popsection;
diff --git a/arch/powerpc/kernel/exceptions-64s.S 
b/arch/powerpc/kernel/exceptions-64s.S
index fdd677b..54429ee 100644
--- 

[PATCH 03/15] powerpc/xics: Make sure we have a sensible default distribution server

2011-04-05 Thread Benjamin Herrenschmidt
Even when nothing is specified in the device tree, and despite the
fact that we don't setup links properly yet, we still need a reasonable
value in there or some interrupts won't be setup properly to point to
an existing processor.

Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org
---
 arch/powerpc/sysdev/xics/xics-common.c |   12 +---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/sysdev/xics/xics-common.c 
b/arch/powerpc/sysdev/xics/xics-common.c
index ac26866..7c9cba3 100644
--- a/arch/powerpc/sysdev/xics/xics-common.c
+++ b/arch/powerpc/sysdev/xics/xics-common.c
@@ -57,7 +57,9 @@ void xics_update_irq_servers(void)
BUG_ON(!np);
 
hcpuid = get_hard_smp_processor_id(boot_cpuid);
-   xics_default_server = hcpuid;
+   xics_default_server = xics_default_distrib_server = hcpuid;
+
+   pr_devel(xics: xics_default_server = 0x%x\n, xics_default_server);
 
ireg = of_get_property(np, ibm,ppc-interrupt-gserver#s, ilen);
if (!ireg) {
@@ -75,9 +77,11 @@ void xics_update_irq_servers(void)
for (j = 0; j  i; j += 2) {
if (ireg[j] == hcpuid) {
xics_default_distrib_server = ireg[j+1];
+   break;
}
}
-
+   pr_devel(xics: xics_default_distrib_server = 0x%x\n,
+xics_default_distrib_server);
of_node_put(np);
 }
 
@@ -113,7 +117,7 @@ void xics_mask_unknown_vec(unsigned int vec)
 {
struct ics *ics;
 
-   pr_err(Interrupt %u (real) is invalid, disabling it.\n, vec);
+   pr_err(Interrupt 0x%x (real) is invalid, disabling it.\n, vec);
 
list_for_each_entry(ics, ics_list, link)
ics-mask_unknown(ics, vec);
@@ -293,6 +297,8 @@ unlock:
  * If not we set it to the first cpu in the mask, even if multiple cpus
  * are set. This is so things like irqbalance (which set core and package
  * wide affinities) do the right thing.
+ *
+ * We need to fix this to implement support for the links
  */
 int xics_get_irq_server(unsigned int virq, const struct cpumask *cpumask,
unsigned int strict_check)
-- 
1.7.1

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 09/15] powerpc: Initialize LPCR:DPFD on power7 to a sane default

2011-04-05 Thread Benjamin Herrenschmidt
This sets the default data stream prefetch size for operating
systems that don't set their own value in DSCR. We use 4 which
is medium.

Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org
---
 arch/powerpc/kernel/cpu_setup_power7.S |7 +++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/kernel/cpu_setup_power7.S 
b/arch/powerpc/kernel/cpu_setup_power7.S
index e801ef1..2390f6f 100644
--- a/arch/powerpc/kernel/cpu_setup_power7.S
+++ b/arch/powerpc/kernel/cpu_setup_power7.S
@@ -54,6 +54,7 @@ __init_LPCR:
 *
 *   LPES = 0b01 (HSRR0/1 used for 0x500)
 *   PECE = 0b111
+*   DPFD = 4
 *
 * Other bits untouched for now
 */
@@ -61,6 +62,12 @@ __init_LPCR:
ori r3,r3,(LPCR_LPES0|LPCR_LPES1)
xorir3,r3, LPCR_LPES0
ori r3,r3,(LPCR_PECE0|LPCR_PECE1|LPCR_PECE2)
+   li  r5,7
+   sldir5,r5,LPCR_DPFD_SH
+   andcr3,r3,r5
+   li  r5,4
+   sldir5,r5,LPCR_DPFD_SH
+   or  r3,r3,r5
mtspr   SPRN_LPCR,r3
isync
blr
-- 
1.7.1

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 12/15] powerpc: Properly handshake CPUs going out of boot spin loop

2011-04-05 Thread Benjamin Herrenschmidt
We need to wait a bit for them to have done their CPU setup
or we might end up with translation and EE on with different
LPCR values between threads

Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org
---
 arch/powerpc/include/asm/smp.h |1 +
 arch/powerpc/kernel/head_64.S  |   18 +-
 arch/powerpc/kernel/prom.c |   27 ++-
 arch/powerpc/kernel/setup_32.c |1 +
 arch/powerpc/kernel/setup_64.c |   13 -
 5 files changed, 37 insertions(+), 23 deletions(-)

diff --git a/arch/powerpc/include/asm/smp.h b/arch/powerpc/include/asm/smp.h
index a902a0d..bb4c033 100644
--- a/arch/powerpc/include/asm/smp.h
+++ b/arch/powerpc/include/asm/smp.h
@@ -29,6 +29,7 @@
 #include asm/percpu.h
 
 extern int boot_cpuid;
+extern int boot_cpu_count;
 
 extern void cpu_die(void);
 
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index 43a3cff..370afd4 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -242,23 +242,31 @@ generic_secondary_common_init:
ld  r23,0(r23)
ld  r23,CPU_SPEC_RESTORE(r23)
cmpdi   0,r23,0
-   beq 4f
+   beq 3f
ld  r23,0(r23)
mtctr   r23
bctrl
 
-3: HMT_LOW
+3: LOAD_REG_ADDR(r3, boot_cpu_count) /* Decrement boot_cpu_count */
+   lwarx   r4,0,r3
+   subir4,r4,1
+   stwcx.  r4,0,r3
+   bne 3b
+   isync
+
+4: HMT_LOW
lbz r23,PACAPROCSTART(r13)  /* Test if this processor should */
/* start.*/
 #ifndef CONFIG_SMP
-   b   3b  /* Never go on non-SMP   */
+   b   4b  /* Never go on non-SMP   */
 #else
cmpwi   0,r23,0
-   beq 3b  /* Loop until told to go */
+   beq 4b  /* Loop until told to go */
 
sync/* order paca.run and cur_cpu_spec */
+   isync   /* In case code patching happened */
 
-4: /* Create a temp kernel stack for use before relocation is on.  */
+   /* Create a temp kernel stack for use before relocation is on.  */
ld  r1,PACAEMERGSP(r13)
subir1,r1,STACK_FRAME_OVERHEAD
 
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 05b7139..236246f 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -268,13 +268,12 @@ static int __init early_init_dt_scan_cpus(unsigned long 
node,
  const char *uname, int depth,
  void *data)
 {
-   static int logical_cpuid = 0;
char *type = of_get_flat_dt_prop(node, device_type, NULL);
const u32 *prop;
const u32 *intserv;
int i, nthreads;
unsigned long len;
-   int found = 0;
+   int found = -1;
 
/* We are scanning cpu nodes only */
if (type == NULL || strcmp(type, cpu) != 0)
@@ -299,11 +298,8 @@ static int __init early_init_dt_scan_cpus(unsigned long 
node,
 * booted proc.
 */
if (initial_boot_params  initial_boot_params-version = 2) {
-   if (intserv[i] ==
-   initial_boot_params-boot_cpuid_phys) {
-   found = 1;
-   break;
-   }
+   if (intserv[i] == initial_boot_params-boot_cpuid_phys)
+   found = boot_cpu_count;
} else {
/*
 * Check if it's the boot-cpu, set it's hw index now,
@@ -311,23 +307,20 @@ static int __init early_init_dt_scan_cpus(unsigned long 
node,
 * off secondary threads.
 */
if (of_get_flat_dt_prop(node,
-   linux,boot-cpu, NULL) != NULL) {
-   found = 1;
-   break;
-   }
+   linux,boot-cpu, NULL) != NULL)
+   found = boot_cpu_count;
}
-
 #ifdef CONFIG_SMP
/* logical cpu id is always 0 on UP kernels */
-   logical_cpuid++;
+   boot_cpu_count++;
 #endif
}
 
-   if (found) {
-   DBG(boot cpu: logical %d physical %d\n, logical_cpuid,
+   if (found = 0) {
+   DBG(boot cpu: logical %d physical %d\n, found,
intserv[i]);
-   boot_cpuid = logical_cpuid;
-   set_hard_smp_processor_id(boot_cpuid, intserv[i]);
+   boot_cpuid = found;
+   set_hard_smp_processor_id(found, intserv[i]);
 
/*
 * PAPR 

[PATCH 06/15] powerpc: Base support for exceptions using HSRR0/1

2011-04-05 Thread Benjamin Herrenschmidt
Pass the register type to the prolog, also provides alternate HV
version of hardware interrupt (0x500) and adjust LPES accordingly

We tag those interrupts by setting bit 0x2 in the trap number

Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org
---
 arch/powerpc/include/asm/exception-64s.h   |   65 ++--
 arch/powerpc/include/asm/kvm_asm.h |1 +
 arch/powerpc/include/asm/kvm_book3s_asm.h  |1 +
 arch/powerpc/kernel/cpu_setup_power7.S |3 +-
 arch/powerpc/kernel/exceptions-64s.S   |   48 -
 arch/powerpc/kvm/book3s_rmhandlers.S   |1 +
 arch/powerpc/kvm/book3s_segment.S  |   10 +++-
 arch/powerpc/platforms/iseries/exception.S |2 +-
 arch/powerpc/platforms/iseries/exception.h |4 +-
 9 files changed, 86 insertions(+), 49 deletions(-)

diff --git a/arch/powerpc/include/asm/exception-64s.h 
b/arch/powerpc/include/asm/exception-64s.h
index 337b6fa..1d98e05 100644
--- a/arch/powerpc/include/asm/exception-64s.h
+++ b/arch/powerpc/include/asm/exception-64s.h
@@ -56,30 +56,37 @@
 #define LOAD_HANDLER(reg, label)   \
addireg,reg,(label)-_stext; /* virt addr of handler ... */
 
-#define EXCEPTION_PROLOG_1(area)   \
+/* Exception register prefixes */
+#define EXC_HV H
+#define EXC_STD
+
+#define __EXCEPTION_PROLOG_1(area, h)  \
GET_PACA(r13);  \
std r9,area+EX_R9(r13); /* save r9 - r12 */ \
std r10,area+EX_R10(r13);   \
std r11,area+EX_R11(r13);   \
std r12,area+EX_R12(r13);   \
-   mfspr   r9,SPRN_SPRG_SCRATCH0;  \
+   mfspr   r9,SPRN_SPRG_##h##SCRATCH0; \
std r9,area+EX_R13(r13);\
mfcrr9
+#define EXCEPTION_PROLOG_1(area, h) __EXCEPTION_PROLOG_1(area, h)
 
-#define EXCEPTION_PROLOG_PSERIES_1(label)  \
+#define __EXCEPTION_PROLOG_PSERIES_1(label, h) \
ld  r12,PACAKBASE(r13); /* get high part of label */   \
ld  r10,PACAKMSR(r13);  /* get MSR value for kernel */  \
-   mfspr   r11,SPRN_SRR0;  /* save SRR0 */ \
+   mfspr   r11,SPRN_##h##SRR0; /* save SRR0 */ \
LOAD_HANDLER(r12,label) \
-   mtspr   SPRN_SRR0,r12;  \
-   mfspr   r12,SPRN_SRR1;  /* and SRR1 */  \
-   mtspr   SPRN_SRR1,r10;  \
-   rfid;   \
+   mtspr   SPRN_##h##SRR0,r12; \
+   mfspr   r12,SPRN_##h##SRR1; /* and SRR1 */  \
+   mtspr   SPRN_##h##SRR1,r10; \
+   h##rfid;\
b   .   /* prevent speculative execution */
+#define EXCEPTION_PROLOG_PSERIES_1(label, h) \
+   __EXCEPTION_PROLOG_PSERIES_1(label, h)
 
-#define EXCEPTION_PROLOG_PSERIES(area, label)  \
-   EXCEPTION_PROLOG_1(area);   \
-   EXCEPTION_PROLOG_PSERIES_1(label);
+#define EXCEPTION_PROLOG_PSERIES(area, label, h)   \
+   EXCEPTION_PROLOG_1(area, h);\
+   EXCEPTION_PROLOG_PSERIES_1(label, h);
 
 /*
  * The common exception prolog is used for all except a few exceptions
@@ -150,50 +157,44 @@ label##_pSeries:  \
HMT_MEDIUM; \
DO_KVM  n;  \
mtspr   SPRN_SPRG_SCRATCH0,r13; /* save r13 */  \
-   EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common)
+   EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common, EXC_STD)
 
 #define HSTD_EXCEPTION_PSERIES(n, label)   \
. = n;  \
.globl label##_pSeries; \
 label##_pSeries:   \
HMT_MEDIUM; \
-   mtspr   SPRN_SPRG_SCRATCH0,r20; /* save r20 */  \
-   mfspr   r20,SPRN_HSRR0; /* copy HSRR0 to SRR0 */ \
-   mtspr   SPRN_SRR0,r20;  \
-   mfspr   r20,SPRN_HSRR1; /* copy HSRR0 to SRR0 */ \
-   mtspr   SPRN_SRR1,r20;  \
-   mfspr   r20,SPRN_SPRG_SCRATCH0; /* restore r20 */ \
-   mtspr   SPRN_SPRG_SCRATCH0,r13; /* save r13 */  \
-   

[PATCH 10/15] powerpc: Initialize TLB and LPID register on HV mode Power7

2011-04-05 Thread Benjamin Herrenschmidt
In case entry from the bootloader isn't clean

Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org
---
 arch/powerpc/kernel/cpu_setup_power7.S |   18 ++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/kernel/cpu_setup_power7.S 
b/arch/powerpc/kernel/cpu_setup_power7.S
index 2390f6f..4f9a93f 100644
--- a/arch/powerpc/kernel/cpu_setup_power7.S
+++ b/arch/powerpc/kernel/cpu_setup_power7.S
@@ -25,7 +25,10 @@ _GLOBAL(__setup_cpu_power7)
bl  __init_hvmode_206
mtlrr11
beqlr
+   li  r0,0
+   mtspr   SPRN_LPID,r0
bl  __init_LPCR
+   bl  __init_TLB
mtlrr11
blr
 
@@ -34,7 +37,10 @@ _GLOBAL(__restore_cpu_power7)
mfmsr   r3
rldicl. r0,r3,4,63
beqlr
+   li  r0,0
+   mtspr   SPRN_LPID,r0
bl  __init_LPCR
+   bl  __init_TLB
mtlrr11
blr
 
@@ -71,3 +77,15 @@ __init_LPCR:
mtspr   SPRN_LPCR,r3
isync
blr
+
+__init_TLB:
+   /* Clear the TLB */
+   li  r6,128
+   mtctr   r6
+   li  r7,0xc00/* IS field = 0b11 */
+   ptesync
+2: tlbiel  r7
+   addir7,r7,0x1000
+   bdnz2b
+   ptesync
+1: blr
-- 
1.7.1

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 11/15] powerpc: Call CPU -restore callback earlier on secondary CPUs

2011-04-05 Thread Benjamin Herrenschmidt
We do it before we loop on the PACA start flag. This way, we get a
chance to set critical SPRs on all CPUs before Linux tries to start
them up, which avoids problems when changing some bits such as LPCR
bits that need to be identical on all threads of a core or similar
things like that. Ideally, some of that should also be done before
the MMU is enabled, but that's a separate issue which would require
moving some of the SMP startup code earlier, let's not get there
for now, it works with that change alone.

Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org
---
 arch/powerpc/kernel/head_64.S |   22 +++---
 1 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index 53d3bfd..43a3cff 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -236,17 +236,6 @@ generic_secondary_common_init:
 
/* From now on, r24 is expected to be logical cpuid */
mr  r24,r5
-3: HMT_LOW
-   lbz r23,PACAPROCSTART(r13)  /* Test if this processor should */
-   /* start.*/
-
-#ifndef CONFIG_SMP
-   b   3b  /* Never go on non-SMP   */
-#else
-   cmpwi   0,r23,0
-   beq 3b  /* Loop until told to go */
-
-   sync/* order paca.run and cur_cpu_spec */
 
/* See if we need to call a cpu state restore handler */
LOAD_REG_ADDR(r23, cur_cpu_spec)
@@ -258,6 +247,17 @@ generic_secondary_common_init:
mtctr   r23
bctrl
 
+3: HMT_LOW
+   lbz r23,PACAPROCSTART(r13)  /* Test if this processor should */
+   /* start.*/
+#ifndef CONFIG_SMP
+   b   3b  /* Never go on non-SMP   */
+#else
+   cmpwi   0,r23,0
+   beq 3b  /* Loop until told to go */
+
+   sync/* order paca.run and cur_cpu_spec */
+
 4: /* Create a temp kernel stack for use before relocation is on.  */
ld  r1,PACAEMERGSP(r13)
subir1,r1,STACK_FRAME_OVERHEAD
-- 
1.7.1

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 13/15] powerpc: Add NAP mode support on Power7 in HV mode

2011-04-05 Thread Benjamin Herrenschmidt
Wakeup comes from the system reset handler with a potential loss of
the non-hypervisor CPU state. We save the non-volatile state on the
stack and a pointer to it in the PACA, which the system reset handler
uses to restore things

Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org
---
 arch/powerpc/include/asm/machdep.h|1 +
 arch/powerpc/include/asm/paca.h   |2 +-
 arch/powerpc/include/asm/ppc-opcode.h |6 ++
 arch/powerpc/kernel/Makefile  |1 +
 arch/powerpc/kernel/exceptions-64s.S  |   30 ++-
 arch/powerpc/kernel/idle_power7.S |   97 +
 arch/powerpc/platforms/Kconfig|4 ++
 7 files changed, 139 insertions(+), 2 deletions(-)
 create mode 100644 arch/powerpc/kernel/idle_power7.S

diff --git a/arch/powerpc/include/asm/machdep.h 
b/arch/powerpc/include/asm/machdep.h
index e4f0191..493dbb3 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -267,6 +267,7 @@ struct machdep_calls {
 
 extern void e500_idle(void);
 extern void power4_idle(void);
+extern void power7_idle(void);
 extern void ppc6xx_idle(void);
 extern void book3e_idle(void);
 
diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h
index ec57540..f6da4f5 100644
--- a/arch/powerpc/include/asm/paca.h
+++ b/arch/powerpc/include/asm/paca.h
@@ -125,7 +125,7 @@ struct paca_struct {
struct task_struct *__current;  /* Pointer to current */
u64 kstack; /* Saved Kernel stack addr */
u64 stab_rr;/* stab/slb round-robin counter */
-   u64 saved_r1;   /* r1 save for RTAS calls */
+   u64 saved_r1;   /* r1 save for RTAS calls or PM */
u64 saved_msr;  /* MSR saved here by enter_rtas */
u16 trap_save;  /* Used when bad stack is encountered */
u8 soft_enabled;/* irq soft-enable flag */
diff --git a/arch/powerpc/include/asm/ppc-opcode.h 
b/arch/powerpc/include/asm/ppc-opcode.h
index 1255569..384a96d 100644
--- a/arch/powerpc/include/asm/ppc-opcode.h
+++ b/arch/powerpc/include/asm/ppc-opcode.h
@@ -56,6 +56,9 @@
 #define PPC_INST_TLBSRX_DOT0x7c0006a5
 #define PPC_INST_XXLOR 0xf510
 
+#define PPC_INST_NAP   0x4c000364
+#define PPC_INST_SLEEP 0x4c0003a4
+
 /* macros to insert fields into opcodes */
 #define __PPC_RA(a)(((a)  0x1f)  16)
 #define __PPC_RB(b)(((b)  0x1f)  11)
@@ -126,4 +129,7 @@
 #define XXLOR(t, a, b) stringify_in_c(.long PPC_INST_XXLOR | \
   VSX_XX3((t), (a), (b)))
 
+#define PPC_NAPstringify_in_c(.long PPC_INST_NAP)
+#define PPC_SLEEP  stringify_in_c(.long PPC_INST_SLEEP)
+
 #endif /* _ASM_POWERPC_PPC_OPCODE_H */
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 7c6eb49..0fd6273 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -44,6 +44,7 @@ obj-$(CONFIG_PPC_BOOK3E_64)   += exceptions-64e.o 
idle_book3e.o
 obj-$(CONFIG_PPC64)+= vdso64/
 obj-$(CONFIG_ALTIVEC)  += vecemu.o
 obj-$(CONFIG_PPC_970_NAP)  += idle_power4.o
+obj-$(CONFIG_PPC_P7_NAP)   += idle_power7.o
 obj-$(CONFIG_PPC_OF)   += of_platform.o prom_parse.o
 obj-$(CONFIG_PPC_CLOCK)+= clock.o
 procfs-y   := proc_powerpc.o
diff --git a/arch/powerpc/kernel/exceptions-64s.S 
b/arch/powerpc/kernel/exceptions-64s.S
index 0c50a52..a6ead27 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
@@ -37,7 +37,35 @@
.globl __start_interrupts
 __start_interrupts:
 
-   STD_EXCEPTION_PSERIES(0x100, 0x100, system_reset)
+   .globl system_reset_pSeries;
+system_reset_pSeries:
+   HMT_MEDIUM;
+   DO_KVM  0x100;
+   SET_SCRATCH0(r13)
+#ifdef CONFIG_PPC_P7_NAP
+BEGIN_FTR_SECTION
+   /* Running native on arch 2.06 or later, check if we are
+* waking up from nap. We only handle no state loss and
+* supervisor state loss. We do -not- handle hypervisor
+* state loss at this time.
+*/
+   mfspr   r13,SPRN_SRR1
+   rlwinm  r13,r13,47-31,30,31
+   cmpwi   cr0,r13,1
+   bne 1f
+   b   .power7_wakeup_noloss
+1: cmpwi   cr0,r13,2
+   bne 1f
+   b   .power7_wakeup_loss
+   /* Total loss of HV state is fatal, we could try to use the
+* PIR to locate a PACA, then use an emergency stack etc...
+* but for now, let's just stay stuck here
+*/
+1: cmpwi   cr0,r13,3
+   beq .
+END_FTR_SECTION_IFSET(CPU_FTR_HVMODE_206)
+#endif /* CONFIG_PPC_P7_NAP */
+   EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, system_reset_common, EXC_STD)
 
. = 0x200
 _machine_check_pSeries:
diff --git a/arch/powerpc/kernel/idle_power7.S 

[PATCH 15/15] powerpc: Improve prom_printf()

2011-04-05 Thread Benjamin Herrenschmidt
Adds the ability to print decimal numbers and adds some more
format string variants

Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org
---
 arch/powerpc/kernel/prom_init.c |   26 +-
 1 files changed, 25 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 941ff4d..29c67e9 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -335,6 +335,7 @@ static void __init prom_printf(const char *format, ...)
const char *p, *q, *s;
va_list args;
unsigned long v;
+   long vs;
struct prom_t *_prom = RELOC(prom);
 
va_start(args, format);
@@ -368,12 +369,35 @@ static void __init prom_printf(const char *format, ...)
v = va_arg(args, unsigned long);
prom_print_hex(v);
break;
+   case 'd':
+   ++q;
+   vs = va_arg(args, long);
+   if (vs  0) {
+   prom_print(-);
+   vs = -vs;
+   }
+   prom_print_dec(vs);
+   break;
case 'l':
++q;
-   if (*q == 'u') { /* '%lu' */
+   if (*q == 0)
+   break;
+   else if (*q == 'x') {
+   ++q;
+   v = va_arg(args, unsigned long);
+   prom_print_hex(v);
+   } else if (*q == 'u') { /* '%lu' */
++q;
v = va_arg(args, unsigned long);
prom_print_dec(v);
+   } else if (*q == 'd') { /* %ld */
+   ++q;
+   vs = va_arg(args, long);
+   if (vs  0) {
+   prom_print(RELOC(-));
+   vs = -vs;
+   }
+   prom_print_dec(vs);
}
break;
}
-- 
1.7.1

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 08/15] powerpc: Always use SPRN_SPRG_HSCRATCH0 when running in HV mode

2011-04-05 Thread Benjamin Herrenschmidt
From: Paul Mackerras pau...@samba.org

This uses feature sections to arrange that we always use HSPRG1
as the scratch register in the interrupt entry code rather than
SPRG2 when we're running in hypervisor mode on POWER7.  This will
ensure that we don't trash the guest's SPRG2 when we are running
KVM guests.  To simplify the code, we define GET_SCRATCH0() and
SET_SCRATCH0() macros like the GET_PACA/SET_PACA macros.

Signed-off-by: Paul Mackerras pau...@samba.org
Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org
---
 arch/powerpc/include/asm/exception-64s.h   |   15 +++
 arch/powerpc/include/asm/reg.h |   14 ++
 arch/powerpc/kernel/exceptions-64s.S   |   26 +-
 arch/powerpc/kvm/book3s_rmhandlers.S   |6 +++---
 arch/powerpc/kvm/book3s_segment.S  |2 +-
 arch/powerpc/platforms/iseries/exception.S |2 +-
 arch/powerpc/platforms/iseries/exception.h |4 ++--
 7 files changed, 41 insertions(+), 28 deletions(-)

diff --git a/arch/powerpc/include/asm/exception-64s.h 
b/arch/powerpc/include/asm/exception-64s.h
index fb5b0af..d6b4849 100644
--- a/arch/powerpc/include/asm/exception-64s.h
+++ b/arch/powerpc/include/asm/exception-64s.h
@@ -60,16 +60,15 @@
 #define EXC_HV H
 #define EXC_STD
 
-#define __EXCEPTION_PROLOG_1(area, h)  \
+#define EXCEPTION_PROLOG_1(area)   \
GET_PACA(r13);  \
std r9,area+EX_R9(r13); /* save r9 - r12 */ \
std r10,area+EX_R10(r13);   \
std r11,area+EX_R11(r13);   \
std r12,area+EX_R12(r13);   \
-   mfspr   r9,SPRN_SPRG_##h##SCRATCH0; \
+   GET_SCRATCH0(r9);   \
std r9,area+EX_R13(r13);\
mfcrr9
-#define EXCEPTION_PROLOG_1(area, h) __EXCEPTION_PROLOG_1(area, h)
 
 #define __EXCEPTION_PROLOG_PSERIES_1(label, h) \
ld  r12,PACAKBASE(r13); /* get high part of label */   \
@@ -85,7 +84,7 @@
__EXCEPTION_PROLOG_PSERIES_1(label, h)
 
 #define EXCEPTION_PROLOG_PSERIES(area, label, h)   \
-   EXCEPTION_PROLOG_1(area, h);\
+   EXCEPTION_PROLOG_1(area);   \
EXCEPTION_PROLOG_PSERIES_1(label, h);
 
 /*
@@ -156,7 +155,7 @@
 label##_pSeries:   \
HMT_MEDIUM; \
DO_KVM  vec;\
-   mtspr   SPRN_SPRG_SCRATCH0,r13; /* save r13 */  \
+   SET_SCRATCH0(r13);  /* save r13 */  \
EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common, EXC_STD)
 
 #define STD_EXCEPTION_HV(loc, vec, label)  \
@@ -165,13 +164,13 @@ label##_pSeries:  \
 label##_hv:\
HMT_MEDIUM; \
DO_KVM  vec;\
-   mtspr   SPRN_SPRG_HSCRATCH0,r13;/* save r13 */  \
+   SET_SCRATCH0(r13);  /* save r13 */  \
EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common, EXC_HV)
 
 #define __MASKABLE_EXCEPTION_PSERIES(vec, label, h)\
HMT_MEDIUM; \
DO_KVM  vec;\
-   mtspr   SPRN_SPRG_##h##SCRATCH0,r13;/* save r13 */  \
+   SET_SCRATCH0(r13);/* save r13 */\
GET_PACA(r13);  \
std r9,PACA_EXGEN+EX_R9(r13);   /* save r9, r10 */  \
std r10,PACA_EXGEN+EX_R10(r13); \
@@ -179,7 +178,7 @@ label##_hv: \
mfcrr9; \
cmpwi   r10,0;  \
beq masked_##h##interrupt;  \
-   mfspr   r10,SPRN_SPRG_##h##SCRATCH0;\
+   GET_SCRATCH0(r10);  \
std r10,PACA_EXGEN+EX_R13(r13); \
std r11,PACA_EXGEN+EX_R11(r13); \
std r12,PACA_EXGEN+EX_R12(r13); \
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
index 13429a0..76d7d5f 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -802,6 +802,20 @@

[PATCH 14/15] powerpc: Perform an isync to synchronize CPUs coming out of secondary_hold

2011-04-05 Thread Benjamin Herrenschmidt
We need to do that to guarantee they see any code change done by
dynamic patching during boot.

Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org
---
 arch/powerpc/kernel/head_64.S |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index 370afd4..2505f78 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -147,6 +147,8 @@ __secondary_hold:
mtctr   r4
mr  r3,r24
li  r4,0
+   /* Make sure that patched code is visible */
+   isync
bctr
 #else
BUG_OPCODE
-- 
1.7.1

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 04/15] powerpc: Define CPU feature for Architected 2.06 HV mode

2011-04-05 Thread Benjamin Herrenschmidt
This bit indicates that we are operating in hypervisor mode on a CPU
compliant to architecture 2.06 or later (currently server only).

We set it on POWER7 and have a boot-time CPU setup function that
clears it if MSR:HV isn't set (booting under a hypervisor).

Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org
---
 arch/powerpc/include/asm/cputable.h|3 +-
 arch/powerpc/kernel/Makefile   |1 +
 arch/powerpc/kernel/cpu_setup_power7.S |   65 
 arch/powerpc/kernel/cputable.c |6 +++
 4 files changed, 74 insertions(+), 1 deletions(-)
 create mode 100644 arch/powerpc/kernel/cpu_setup_power7.S

diff --git a/arch/powerpc/include/asm/cputable.h 
b/arch/powerpc/include/asm/cputable.h
index be3cdf9..7d2eb44 100644
--- a/arch/powerpc/include/asm/cputable.h
+++ b/arch/powerpc/include/asm/cputable.h
@@ -181,6 +181,7 @@ extern const char *powerpc_base_platform;
 #define CPU_FTR_SLBLONG_ASM_CONST(0x0001)
 #define CPU_FTR_16M_PAGE   LONG_ASM_CONST(0x0002)
 #define CPU_FTR_TLBIEL LONG_ASM_CONST(0x0004)
+#define CPU_FTR_HVMODE_206 LONG_ASM_CONST(0x0008)
 #define CPU_FTR_IABR   LONG_ASM_CONST(0x0020)
 #define CPU_FTR_MMCRA  LONG_ASM_CONST(0x0040)
 #define CPU_FTR_CTRL   LONG_ASM_CONST(0x0080)
@@ -416,7 +417,7 @@ extern const char *powerpc_base_platform;
CPU_FTR_DSCR | CPU_FTR_UNALIGNED_LD_STD | \
CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB)
 #define CPU_FTRS_POWER7 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
-   CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
+   CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | CPU_FTR_HVMODE_206 |\
CPU_FTR_MMCRA | CPU_FTR_SMT | \
CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \
CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 3bb2a3e..7c6eb49 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -38,6 +38,7 @@ obj-$(CONFIG_PPC64)   += setup_64.o sys_ppc32.o \
   paca.o nvram_64.o firmware.o
 obj-$(CONFIG_HAVE_HW_BREAKPOINT)   += hw_breakpoint.o
 obj-$(CONFIG_PPC_BOOK3S_64)+= cpu_setup_ppc970.o cpu_setup_pa6t.o
+obj-$(CONFIG_PPC_BOOK3S_64)+= cpu_setup_power7.o
 obj64-$(CONFIG_RELOCATABLE)+= reloc_64.o
 obj-$(CONFIG_PPC_BOOK3E_64)+= exceptions-64e.o idle_book3e.o
 obj-$(CONFIG_PPC64)+= vdso64/
diff --git a/arch/powerpc/kernel/cpu_setup_power7.S 
b/arch/powerpc/kernel/cpu_setup_power7.S
new file mode 100644
index 000..f2b3178
--- /dev/null
+++ b/arch/powerpc/kernel/cpu_setup_power7.S
@@ -0,0 +1,65 @@
+/*
+ * This file contains low level CPU setup functions.
+ *Copyright (C) 2003 Benjamin Herrenschmidt (b...@kernel.crashing.org)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ *
+ */
+
+#include asm/processor.h
+#include asm/page.h
+#include asm/cputable.h
+#include asm/ppc_asm.h
+#include asm/asm-offsets.h
+#include asm/cache.h
+
+/* Entry: r3 = crap, r4 = ptr to cputable entry
+ *
+ * Note that we can be called twice for pseudo-PVRs
+ */
+_GLOBAL(__setup_cpu_power7)
+   mflrr11
+   bl  __init_hvmode_206
+   mtlrr11
+   beqlr
+   bl  __init_LPCR
+   mtlrr11
+   blr
+
+_GLOBAL(__restore_cpu_power7)
+   mflrr11
+   mfmsr   r3
+   rldicl. r0,r3,4,63
+   beqlr
+   bl  __init_LPCR
+   mtlrr11
+   blr
+
+__init_hvmode_206:
+   /* Disable CPU_FTR_HVMODE_206 and exit if MSR:HV is not set */
+   mfmsr   r3
+   rldicl. r0,r3,4,63
+   bnelr
+   ld  r5,CPU_SPEC_FEATURES(r4)
+   LOAD_REG_IMMEDIATE(r6,CPU_FTR_HVMODE_206)
+   xor r5,r5,r6
+   std r5,CPU_SPEC_FEATURES(r4)
+   blr
+
+__init_LPCR:
+   /* Setup a sane LPCR:
+*
+*   LPES = 0b11 (SRR0/1 used for 0x500)
+*   PECE = 0b111
+*
+* Other bits untouched for now
+*/
+   mfspr   r3,SPRN_LPCR
+   ori r3,r3,(LPCR_LPES0|LPCR_LPES1)
+   ori r3,r3,(LPCR_PECE0|LPCR_PECE1|LPCR_PECE2)
+   mtspr   SPRN_LPCR,r3
+   isync
+   blr
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index c9b68d0..867ae30 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -423,6 +423,8 @@ static struct cpu_spec __initdata cpu_specs[] = {
.dcache_bsize   = 128,
.oprofile_type  = PPC_OPROFILE_POWER4,
.oprofile_cpu_type  = 

Re: [PATCH] powerpc/85xx: Don't add disabled PCIe devices

2011-04-05 Thread Kumar Gala

On Mar 31, 2011, at 2:01 AM, Prabhakar Kushwaha wrote:

 PCIe nodes with the property status=disabled are not usable and so
 avoid adding disabled PCIe bridge with the system.
 
 Signed-off-by: Prabhakar Kushwaha prabha...@freescale.com
 Acked-by: Kumar Gala kumar.g...@freescale.com
 ---
 Based upon 
 git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git(branch 
 master)
 
 arch/powerpc/sysdev/fsl_pci.c |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

applied to merge

- k
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH] mm: Check we have the right vma in access_process_vm()

2011-04-05 Thread Michael Ellerman
In access_process_vm() we need to check that we have found the right
vma, not the following vma, before we try to access it. Otherwise
we might call the vma's access routine with an address which does
not fall inside the vma.

Signed-off-by: Michael Ellerman mich...@ellerman.id.au
---
 mm/memory.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mm/memory.c b/mm/memory.c
index 5823698..7e6f17b 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -3619,7 +3619,7 @@ int access_process_vm(struct task_struct *tsk, unsigned 
long addr, void *buf, in
 */
 #ifdef CONFIG_HAVE_IOREMAP_PROT
vma = find_vma(mm, addr);
-   if (!vma)
+   if (!vma || vma-vm_start  addr)
break;
if (vma-vm_ops  vma-vm_ops-access)
ret = vma-vm_ops-access(vma, addr, buf,
-- 
1.7.1

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH] powerpc/book3e: Fix extlb size

2011-04-05 Thread Michael Ellerman
The calculation of the size for the exception save area of the TLB
miss handler is wrong, luckily it's too big not too small.

Rework it to make it a bit clearer, and also correct. We want 3 save
areas, each EX_TLB_SIZE _bytes_.

Signed-off-by: Michael Ellerman mich...@ellerman.id.au
---
 arch/powerpc/include/asm/paca.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h
index ec57540..f7aa4fd 100644
--- a/arch/powerpc/include/asm/paca.h
+++ b/arch/powerpc/include/asm/paca.h
@@ -106,7 +106,7 @@ struct paca_struct {
pgd_t *pgd; /* Current PGD */
pgd_t *kernel_pgd;  /* Kernel PGD */
u64 exgen[8] __attribute__((aligned(0x80)));
-   u64 extlb[EX_TLB_SIZE*3] __attribute__((aligned(0x80)));
+   u64 extlb[3][EX_TLB_SIZE / sizeof(u64)] __attribute__((aligned(0x80)));
u64 exmc[8];/* used for machine checks */
u64 excrit[8];  /* used for crit interrupts */
u64 exdbg[8];   /* used for debug interrupts */
-- 
1.7.1

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH] powerpc/nohash: Allocate stale_map[cpu] on CPU_UP_PREPARE not CPU_ONLINE

2011-04-05 Thread Michael Ellerman
Currently we allocate the stale_map for a cpu when it comes online,
this leaves open a small window where a process can be scheduled
on the cpu before the stale_map is allocated. Instead allocate
the stale_map at CPU_UP_PREPARE time, that way it will be always
available before tasks start running.

Signed-off-by: Michael Ellerman mich...@ellerman.id.au
---
 arch/powerpc/mm/mmu_context_nohash.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/mm/mmu_context_nohash.c 
b/arch/powerpc/mm/mmu_context_nohash.c
index c0aab52..1bde0e8 100644
--- a/arch/powerpc/mm/mmu_context_nohash.c
+++ b/arch/powerpc/mm/mmu_context_nohash.c
@@ -338,8 +338,8 @@ static int __cpuinit mmu_context_cpu_notify(struct 
notifier_block *self,
return NOTIFY_OK;
 
switch (action) {
-   case CPU_ONLINE:
-   case CPU_ONLINE_FROZEN:
+   case CPU_UP_PREPARE:
+   case CPU_UP_PREPARE_FROZEN:
pr_devel(MMU: Allocating stale context map for CPU %d\n, cpu);
stale_map[cpu] = kzalloc(CTX_MAP_SIZE, GFP_KERNEL);
break;
-- 
1.7.1

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 04/15] powerpc: Define CPU feature for Architected 2.06 HV mode

2011-04-05 Thread Michael Neuling
In message 1301984051-18413-5-git-send-email-b...@kernel.crashing.org you 
wrote:
 This bit indicates that we are operating in hypervisor mode on a CPU
 compliant to architecture 2.06 or later (currently server only).
 
 We set it on POWER7 and have a boot-time CPU setup function that
 clears it if MSR:HV isn't set (booting under a hypervisor).

snip

 +#define CPU_FTR_HVMODE_206   LONG_ASM_CONST(0x0008)

FYI With this patch we could remove MMU_FTR_TLBIE_206.

Mikey
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 02/15] powerpc/rtas: Check RTAS presence when testing indicators

2011-04-05 Thread Michael Ellerman
On Tue, 2011-04-05 at 16:13 +1000, Benjamin Herrenschmidt wrote:
 Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org
 ---
  arch/powerpc/kernel/rtas.c |2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)
 
 diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
 index 2097f2b..c2bfc4d 100644
 --- a/arch/powerpc/kernel/rtas.c
 +++ b/arch/powerpc/kernel/rtas.c
 @@ -591,6 +591,8 @@ bool rtas_indicator_present(int token, int *maxindex)
   u32 maxindex;
   } *indicators;
  
 + if (!rtas.dev)
 + return false;
   indicators = of_get_property(rtas.dev, rtas-indicators, proplen);
   if (!indicators)
   return false;

Why? of_get_property() returns NULL if np is NULL, implemented in
of_find_property(). It doesn't look like a fast path.

cheers


signature.asc
Description: This is a digitally signed message part
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [RFC/PATCH] of: Match PCI devices to OF nodes generically

2011-04-05 Thread Benjamin Herrenschmidt

  The benefit is that all archs now get the matching for free. There's one
  hook the arch might want to provide to match a PHB bus to its device
  node. A default weak implementation is provided that looks for the
  parent device device node, but it's not entirely reliable on powerpc for
  various reasons so powerpc provides its own.
 
 Awesome.  I'm looking at doing pretty much exactly the same thing for
 USB and platform_devices on SoCs.  I'm glad to see this for pci.

Yeah, I figured it would come in handy :-)

I looked a bit at USB and the main issue is that it's unclear in the
binding whether the root hub is exposed in the device-tree as a hub or
not. The tendency from what I can see of Apple and Sun produced trees is
that it's -not- there.

  diff --git a/arch/powerpc/include/asm/pci-bridge.h 
  b/arch/powerpc/include/asm/pci-bridge.h
  index 5e156e0..6912c45 100644
  --- a/arch/powerpc/include/asm/pci-bridge.h
  +++ b/arch/powerpc/include/asm/pci-bridge.h
  @@ -169,18 +169,22 @@ static inline struct pci_controller 
  *pci_bus_to_host(const struct pci_bus *bus)
  return bus-sysdata;
   }
   
  -#ifndef CONFIG_PPC64
  +static inline struct device_node *pci_device_to_OF_node(struct pci_dev 
  *dev)
  +{
  +   return dev-dev.of_node;
  +}
   
   static inline struct device_node *pci_bus_to_OF_node(struct pci_bus *bus)
   {
  -   struct pci_controller *host;
  -
  -   if (bus-self)
  -   return pci_device_to_OF_node(bus-self);
  -   host = pci_bus_to_host(bus);
  -   return host ? host-dn : NULL;
  +   return bus-dev.of_node;
   }
 
 Should these two inlines move to include/linux/of_pci.h?  Microblaze
 defines it differently, but I don't think it should be.  Sparc also
 has a different variant in arch/sparc/kernel/pci.c, but not in
 arch/sparc/kernel/pcic.c.  It looks to me like this should be the
 common case unless a specific platform needs otherwise.

I didn't like the function name and though it would be better to
deprecate it and have users peek at the struct device - of_node
instead, but if you think it's worthwhile I can factor that out.

I haven't looked at microblaze PCI code yet so I might be breaking
it... it looks like an old variant of the ppc32 one :-) They should
never have copied the OF node map stuff for example or the bus
renumbering for that matter :-)

The main thing is to get the node of the PHB. The default
weak function looks for the parent struct device you pass to
pci_create_bus() but it's often NULL if you detect your PHBs
very early like we do on most powerpc platforms.

That's why I have my override, and from what I can tell, microblaze
would need to copy it over too (and probably get rid of a lot of crap
they copied from me that they really really don't need :-)

 .../...

  --- a/drivers/pci/hotplug/rpadlpar_core.c
  +++ b/drivers/pci/hotplug/rpadlpar_core.c
  @@ -158,7 +158,7 @@ static void dlpar_pci_add_bus(struct device_node *dn)
  /* Scan below the new bridge */
  if (dev-hdr_type == PCI_HEADER_TYPE_BRIDGE ||
  dev-hdr_type == PCI_HEADER_TYPE_CARDBUS)
  -   of_scan_pci_bridge(dn, dev);
  +   of_scan_pci_bridge(dev);
   
  /* Map IO space for child bus, which may or may not succeed */
  pcibios_map_io_space(dev-subordinate);
  diff --git a/drivers/pci/of.c b/drivers/pci/of.c
  new file mode 100644
  index 000..fff7270
  --- /dev/null
  +++ b/drivers/pci/of.c
 
 Should this be consolidated with drivers/of/of_pci.c?  I don't have
 strong opinions about where the result lives, but I don't think they
 should be split up.

I assume your comment refers to the rest of the code in that file (ie to
the file name above and not to the rpadlpar hunk :-)

This is my rationale for the split:

 - Bits in drivers/of/of_pci.c contain basic routines to parse
PCI device reg properties and locate devices in the device-tree
that don't involve the Linux PCI layer. This can be used by the later
(as it is below) but it can also be used by early boot platform code
that might need to locate PCI devices before the linux PCI probe
happens, that sort of thing. It's pretty clear that those functions
don't rely on anything from the linux PCI code

 - Bits in drivers/pci/of.c that contain the glue to actually populate
the pci_dev's and which use the parsers in the previous file. These
functions are strictly hooks that are called by the linux PCI layer to
populate it's nodes (along with the weak overridable one for getting
to the PHB device node).

There's a clear distinction here I believe and I think it's worth
keeping. I don't like having drivers/pci/probe.c call into
drivers/of/of_pci.c directly basically. The glue layer that way is more
obvious.

  .../...

  diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
  index 44cbbba..347349b 100644
  --- a/drivers/pci/probe.c
  +++ b/drivers/pci/probe.c
  @@ -89,6 +89,7 @@ static void release_pcibus_dev(struct device *dev)
  if (pci_bus-bridge)
  put_device(pci_bus-bridge);
  

Re: [PATCH] mm: Check we have the right vma in access_process_vm()

2011-04-05 Thread Michel Lespinasse
On Mon, Apr 4, 2011 at 11:24 PM, Michael Ellerman
mich...@ellerman.id.au wrote:
 In access_process_vm() we need to check that we have found the right
 vma, not the following vma, before we try to access it. Otherwise
 we might call the vma's access routine with an address which does
 not fall inside the vma.

 Signed-off-by: Michael Ellerman mich...@ellerman.id.au

Please note that the code has moved into __access_remote_vm() in
current linus tree. Also, should len be truncated before calling
vma-vm_ops-access() so that we can guarantee it won't overflow past
the end of the vma ?

 diff --git a/mm/memory.c b/mm/memory.c
 index 5823698..7e6f17b 100644
 --- a/mm/memory.c
 +++ b/mm/memory.c
 @@ -3619,7 +3619,7 @@ int access_process_vm(struct task_struct *tsk, unsigned 
 long addr, void *buf, in
                         */
  #ifdef CONFIG_HAVE_IOREMAP_PROT
                        vma = find_vma(mm, addr);
 -                       if (!vma)
 +                       if (!vma || vma-vm_start  addr)
                                break;
                        if (vma-vm_ops  vma-vm_ops-access)
                                ret = vma-vm_ops-access(vma, addr, buf,
 --
 1.7.1

-- 
Michel Walken Lespinasse
A program is never fully debugged until the last user dies.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 15/15] powerpc: Improve prom_printf()

2011-04-05 Thread Segher Boessenkool
Hi Ben,

 + case 'd':
 + ++q;
 + vs = va_arg(args, long);

'd' takes an int, not a long.

 + if (vs  0) {
 + prom_print(-);

RELOC()?


Segher

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 04/15] powerpc: Define CPU feature for Architected 2.06 HV mode

2011-04-05 Thread Benjamin Herrenschmidt
On Tue, 2011-04-05 at 16:30 +1000, Michael Neuling wrote:
 In message 1301984051-18413-5-git-send-email-b...@kernel.crashing.org you 
 wrote:
  This bit indicates that we are operating in hypervisor mode on a CPU
  compliant to architecture 2.06 or later (currently server only).
  
  We set it on POWER7 and have a boot-time CPU setup function that
  clears it if MSR:HV isn't set (booting under a hypervisor).
 
 snip
 
  +#define CPU_FTR_HVMODE_206 LONG_ASM_CONST(0x0008)
 
 FYI With this patch we could remove MMU_FTR_TLBIE_206.

We could... care to send a patch ? :-)

Cheers,
Ben.

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 02/15] powerpc/rtas: Check RTAS presence when testing indicators

2011-04-05 Thread Benjamin Herrenschmidt

 Why? of_get_property() returns NULL if np is NULL, implemented in
 of_find_property(). It doesn't look like a fast path.

Fun... not sure, I though I had a problem but maybe I don't remember
properly :-)

Cheers,
Ben.


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH] powerpc/nohash: Allocate stale_map[cpu] on CPU_UP_PREPARE not CPU_ONLINE

2011-04-05 Thread Michael Ellerman
Currently we allocate the stale_map for a cpu when it comes online,
this leaves open a small window where a process can be scheduled
on the cpu before the stale_map is allocated. Instead allocate
the stale_map at CPU_UP_PREPARE time, that way it will be always
available before tasks start running.

It is possible the cpu fails to come up, in which case we should free
the stale_map, so add a CPU_UP_CANCELED case to do that.

Signed-off-by: Michael Ellerman mich...@ellerman.id.au
---
 arch/powerpc/mm/mmu_context_nohash.c |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/mm/mmu_context_nohash.c 
b/arch/powerpc/mm/mmu_context_nohash.c
index c0aab52..4d8fa91 100644
--- a/arch/powerpc/mm/mmu_context_nohash.c
+++ b/arch/powerpc/mm/mmu_context_nohash.c
@@ -338,12 +338,14 @@ static int __cpuinit mmu_context_cpu_notify(struct 
notifier_block *self,
return NOTIFY_OK;
 
switch (action) {
-   case CPU_ONLINE:
-   case CPU_ONLINE_FROZEN:
+   case CPU_UP_PREPARE:
+   case CPU_UP_PREPARE_FROZEN:
pr_devel(MMU: Allocating stale context map for CPU %d\n, cpu);
stale_map[cpu] = kzalloc(CTX_MAP_SIZE, GFP_KERNEL);
break;
 #ifdef CONFIG_HOTPLUG_CPU
+   case CPU_UP_CANCELED:
+   case CPU_UP_CANCELED_FROZEN:
case CPU_DEAD:
case CPU_DEAD_FROZEN:
pr_devel(MMU: Freeing stale context map for CPU %d\n, cpu);
-- 
1.7.1

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


RE: [PATCH v10 03/10] USB/ppc4xx: Add Synopsys DWC OTG Core Interface Layer (CIL)

2011-04-05 Thread Keshava Munegowda
 -Original Message-
 From: Sergei Shtylyov [mailto:sshtyl...@mvista.com]
 Sent: Saturday, April 02, 2011 12:26 AM
 To: Tirumala Marri
 Cc: Keshava Munegowda; linux-...@vger.kernel.org;
linuxppc-dev@lists.ozlabs.org; g...@kroah.com;
 Fushen Chen; Mark Miesfeld
 Subject: Re: [PATCH v10 03/10] USB/ppc4xx: Add Synopsys DWC OTG Core
Interface Layer (CIL)

 Hello.

 Tirumala Marri wrote:

  +void dwc_otg_core_init(struct core_if *core_if)
  +{
  + u32 i;
  + ulong global_reg = core_if-core_global_regs;
  + struct device_if *dev_if = core_if-dev_if;
  + u32 ahbcfg = 0;
  + u32 i2cctl = 0;
  + u32 gusbcfg;

  Tabify the declarations ;

  [Marri] When I checked again in my source, I do see the tabs added
before
  declarations.

 He means that tabs should be between the variable's type and name,
but
 there's no such requirement actually.

I am sorry if there is no such requirement, since I had such comments and
I fixed it and
Now I have commented.

Keshava Munegowda
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH v10 03/10] USB/ppc4xx: Add Synopsys DWC OTG Core Interface Layer (CIL)

2011-04-05 Thread Felipe Balbi
On Tue, Apr 05, 2011 at 12:38:03PM +0530, Keshava Munegowda wrote:
  -Original Message-
  From: Sergei Shtylyov [mailto:sshtyl...@mvista.com]
  Sent: Saturday, April 02, 2011 12:26 AM
  To: Tirumala Marri
  Cc: Keshava Munegowda; linux-...@vger.kernel.org;
 linuxppc-dev@lists.ozlabs.org; g...@kroah.com;
  Fushen Chen; Mark Miesfeld
  Subject: Re: [PATCH v10 03/10] USB/ppc4xx: Add Synopsys DWC OTG Core
 Interface Layer (CIL)
 
  Hello.
 
  Tirumala Marri wrote:
 
   +void dwc_otg_core_init(struct core_if *core_if)
   +{
   +   u32 i;
   +   ulong global_reg = core_if-core_global_regs;
   +   struct device_if *dev_if = core_if-dev_if;
   +   u32 ahbcfg = 0;
   +   u32 i2cctl = 0;
   +   u32 gusbcfg;
 
   Tabify the declarations ;
 
   [Marri] When I checked again in my source, I do see the tabs added
 before
   declarations.
 
  He means that tabs should be between the variable's type and name,
 but
  there's no such requirement actually.
 
 I am sorry if there is no such requirement, since I had such comments and
 I fixed it and
 Now I have commented.

it's true we don't have that requirement, but it does look better when
we have many local variables. IMHO, whatever we can do to go easy on the
eyes, we should.

-- 
balbi
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH] powerpc: Replace open coded instruction patching with patch_instruction/patch_branch

2011-04-05 Thread Anton Blanchard

There are a few places we patch instructions without using
patch_instruction and patch_branch, probably because they
predated it. Fix it.
 
Signed-off-by: Anton Blanchard an...@samba.org 
---

Index: powerpc.git/arch/powerpc/mm/hash_utils_64.c
===
--- powerpc.git.orig/arch/powerpc/mm/hash_utils_64.c2011-02-25 
14:15:49.972437235 +1100
+++ powerpc.git/arch/powerpc/mm/hash_utils_64.c 2011-04-05 18:43:33.860987967 
+1000
@@ -53,6 +53,7 @@
 #include asm/sections.h
 #include asm/spu.h
 #include asm/udbg.h
+#include asm/code-patching.h
 
 #ifdef DEBUG
 #define DBG(fmt...) udbg_printf(fmt)
@@ -547,15 +548,7 @@ int remove_section_mapping(unsigned long
 }
 #endif /* CONFIG_MEMORY_HOTPLUG */
 
-static inline void make_bl(unsigned int *insn_addr, void *func)
-{
-   unsigned long funcp = *((unsigned long *)func);
-   int offset = funcp - (unsigned long)insn_addr;
-
-   *insn_addr = (unsigned int)(0x4801 | (offset  0x03fc));
-   flush_icache_range((unsigned long)insn_addr, 4+
-  (unsigned long)insn_addr);
-}
+#define FUNCTION_TEXT(A)   ((*(unsigned long *)(A)))
 
 static void __init htab_finish_init(void)
 {
@@ -570,16 +563,33 @@ static void __init htab_finish_init(void
extern unsigned int *ht64_call_hpte_remove;
extern unsigned int *ht64_call_hpte_updatepp;
 
-   make_bl(ht64_call_hpte_insert1, ppc_md.hpte_insert);
-   make_bl(ht64_call_hpte_insert2, ppc_md.hpte_insert);
-   make_bl(ht64_call_hpte_remove, ppc_md.hpte_remove);
-   make_bl(ht64_call_hpte_updatepp, ppc_md.hpte_updatepp);
+   patch_branch(ht64_call_hpte_insert1,
+   FUNCTION_TEXT(ppc_md.hpte_insert),
+   BRANCH_SET_LINK);
+   patch_branch(ht64_call_hpte_insert2,
+   FUNCTION_TEXT(ppc_md.hpte_insert),
+   BRANCH_SET_LINK);
+   patch_branch(ht64_call_hpte_remove,
+   FUNCTION_TEXT(ppc_md.hpte_remove),
+   BRANCH_SET_LINK);
+   patch_branch(ht64_call_hpte_updatepp,
+   FUNCTION_TEXT(ppc_md.hpte_updatepp),
+   BRANCH_SET_LINK);
+
 #endif /* CONFIG_PPC_HAS_HASH_64K */
 
-   make_bl(htab_call_hpte_insert1, ppc_md.hpte_insert);
-   make_bl(htab_call_hpte_insert2, ppc_md.hpte_insert);
-   make_bl(htab_call_hpte_remove, ppc_md.hpte_remove);
-   make_bl(htab_call_hpte_updatepp, ppc_md.hpte_updatepp);
+   patch_branch(htab_call_hpte_insert1,
+   FUNCTION_TEXT(ppc_md.hpte_insert),
+   BRANCH_SET_LINK);
+   patch_branch(htab_call_hpte_insert2,
+   FUNCTION_TEXT(ppc_md.hpte_insert),
+   BRANCH_SET_LINK);
+   patch_branch(htab_call_hpte_remove,
+   FUNCTION_TEXT(ppc_md.hpte_remove),
+   BRANCH_SET_LINK);
+   patch_branch(htab_call_hpte_updatepp,
+   FUNCTION_TEXT(ppc_md.hpte_updatepp),
+   BRANCH_SET_LINK);
 }
 
 static void __init htab_initialize(void)
Index: powerpc.git/arch/powerpc/mm/slb.c
===
--- powerpc.git.orig/arch/powerpc/mm/slb.c  2011-02-25 14:15:49.952435267 
+1100
+++ powerpc.git/arch/powerpc/mm/slb.c   2011-04-05 18:42:27.018630388 +1000
@@ -24,6 +24,7 @@
 #include asm/firmware.h
 #include linux/compiler.h
 #include asm/udbg.h
+#include asm/code-patching.h
 
 
 extern void slb_allocate_realmode(unsigned long ea);
@@ -249,9 +250,8 @@ void switch_slb(struct task_struct *tsk,
 static inline void patch_slb_encoding(unsigned int *insn_addr,
  unsigned int immed)
 {
-   *insn_addr = (*insn_addr  0x) | immed;
-   flush_icache_range((unsigned long)insn_addr, 4+
-  (unsigned long)insn_addr);
+   int insn = (*insn_addr  0x) | immed;
+   patch_instruction(insn_addr, insn);
 }
 
 void slb_set_size(u16 size)
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: Revert 737a3bb9416ce2a7c7a4170852473a4fcc9c67e8 ?

2011-04-05 Thread Michel Dänzer
On Die, 2011-04-05 at 01:52 +0200, Gabriel Paubert wrote: 
 
 Actually I thought that the name radeon_cp that is registered there
 would appear somwhere under /sys (or /proc) but failed to find it...

FWIW the radeon_cp* functions are in drivers/gpu/drm/radeon.


-- 
Earthling Michel Dänzer   |http://www.vmware.com
Libre software enthusiast |  Debian, X and DRI developer
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[git pull] Please pull powerpc.git merge branch

2011-04-05 Thread Benjamin Herrenschmidt
Hi Linus !

Some minor powerpc fixes for you, freescale device-tree updates
and a few nits like wrong ifdef's etc... 

Cheers,
Ben.

The following changes since commit b2a8b4b81966094703088a7bc76a313af841924d:

  Merge branch 'drm-fixes' of 
git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6 (2011-04-04 
17:56:07 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc.git merge

Benjamin Herrenschmidt (2):
  Merge remote branch 'kumar/merge' into merge
  powerpc/pseries: Don't register global initcall

Kumar Gala (1):
  edac/mpc85xx: Limit setting/clearing of HID1[RFXE] to e500v1/v2 cores

Matt Evans (1):
  powerpc/pseries: Fix build without CONFIG_HOTPLUG_CPU

Paul Gortmaker (1):
  powerpc/kexec: Fix mismatched ifdefs for PPC64/SMP.

Prabhakar Kushwaha (1):
  powerpc/85xx: Update dts for PCIe memory maps to match u-boot of Px020RDB

Ryan Grimm (1):
  powerpc: Set nr_cpu_ids early and use it to free PACAs

 arch/powerpc/boot/dts/p1020rdb.dts|   12 +-
 arch/powerpc/boot/dts/p2020rdb.dts|   12 +-
 arch/powerpc/boot/dts/p2020rdb_camp_core0.dts |4 +-
 arch/powerpc/boot/dts/p2020rdb_camp_core1.dts |   10 
 arch/powerpc/kernel/crash.c   |6 ++--
 arch/powerpc/kernel/paca.c|2 +-
 arch/powerpc/kernel/setup-common.c|3 ++
 arch/powerpc/platforms/pseries/setup.c|2 +-
 arch/powerpc/platforms/pseries/smp.c  |   17 ++-
 drivers/edac/mpc85xx_edac.c   |   27 +---
 10 files changed, 57 insertions(+), 38 deletions(-)


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: checking status semantics with compatible functions

2011-04-05 Thread Benjamin Herrenschmidt
On Wed, 2011-03-30 at 08:31 -0600, Grant Likely wrote:
 Yes, of_device_is_available() should be checked, but it should not be
 added directly to of_device_is_compatible().  I'm okay with adding
 a helper variant that does the of_device_is_compatible() check.
 
 In that particular case, I'd also suggest using
 for_each_matching_node().

Agreed. A device might be unavailable due to how FW configured the
machine, but made later on available by the kernel, that shouldn't
impact the interface compatibility test.

Cheers,
Ben.


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH] powerpc/book3e: Fix extlb size

2011-04-05 Thread Kumar Gala

On Apr 5, 2011, at 1:28 AM, Michael Ellerman wrote:

 The calculation of the size for the exception save area of the TLB
 miss handler is wrong, luckily it's too big not too small.
 
 Rework it to make it a bit clearer, and also correct. We want 3 save
 areas, each EX_TLB_SIZE _bytes_.

Where does the 3 come from?  I have a guess, and think its possible we (FSL) 
want 4?

 
 Signed-off-by: Michael Ellerman mich...@ellerman.id.au
 ---
 arch/powerpc/include/asm/paca.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
 
 diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h
 index ec57540..f7aa4fd 100644
 --- a/arch/powerpc/include/asm/paca.h
 +++ b/arch/powerpc/include/asm/paca.h
 @@ -106,7 +106,7 @@ struct paca_struct {
   pgd_t *pgd; /* Current PGD */
   pgd_t *kernel_pgd;  /* Kernel PGD */
   u64 exgen[8] __attribute__((aligned(0x80)));
 - u64 extlb[EX_TLB_SIZE*3] __attribute__((aligned(0x80)));
 + u64 extlb[3][EX_TLB_SIZE / sizeof(u64)] __attribute__((aligned(0x80)));
   u64 exmc[8];/* used for machine checks */
   u64 excrit[8];  /* used for crit interrupts */
   u64 exdbg[8];   /* used for debug interrupts */
 -- 
 1.7.1
 
 ___
 Linuxppc-dev mailing list
 Linuxppc-dev@lists.ozlabs.org
 https://lists.ozlabs.org/listinfo/linuxppc-dev

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 03/34] powerpc: Call gzip with -n

2011-04-05 Thread Michal Marek
The timestamps recorded in the .gz files add no value.

Cc: Benjamin Herrenschmidt b...@kernel.crashing.org
Cc: Paul Mackerras pau...@samba.org
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Michal Marek mma...@suse.cz
---
 arch/powerpc/boot/wrapper |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
index cb97e75..854797b 100755
--- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrapper
@@ -251,7 +251,7 @@ if [ -z $cacheit -o ! -f $vmz$gzip -o $vmz$gzip -ot 
$kernel ]; then
 ${CROSS}objcopy $objflags $kernel $vmz.$$
 
 if [ -n $gzip ]; then
-gzip -f -9 $vmz.$$
+gzip -n -f -9 $vmz.$$
 fi
 
 if [ -n $cacheit ]; then
@@ -336,7 +336,7 @@ coff)
 $objbin/hack-coff $ofile
 ;;
 cuboot*)
-gzip -f -9 $ofile
+gzip -n -f -9 $ofile
 ${MKIMAGE} -A ppc -O linux -T kernel -C gzip -a $base -e $entry \
 $uboot_version -d $ofile.gz $ofile
 ;;
@@ -383,6 +383,6 @@ ps3)
 
 odir=$(dirname $ofile.bin)
 rm -f $odir/otheros.bld
-gzip --force -9 --stdout $ofile.bin  $odir/otheros.bld
+gzip -n --force -9 --stdout $ofile.bin  $odir/otheros.bld
 ;;
 esac
-- 
1.7.4.1

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 05/34] powerpc: Use the deterministic mode of ar

2011-04-05 Thread Michal Marek
Cc: Benjamin Herrenschmidt b...@kernel.crashing.org
Cc: Paul Mackerras pau...@samba.org
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Michal Marek mma...@suse.cz
---
 arch/powerpc/boot/Makefile |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 8917816..d028a65 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -127,7 +127,7 @@ quiet_cmd_bootas = BOOTAS  $@
   cmd_bootas = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $
 
 quiet_cmd_bootar = BOOTAR  $@
-  cmd_bootar = $(CROSS32AR) -cr $@. $(filter-out FORCE,$^); mv $@. 
$@
+  cmd_bootar = $(CROSS32AR) -crD $@. $(filter-out FORCE,$^); mv 
$@. $@
 
 $(obj-libfdt): $(obj)/%.o: $(srctree)/scripts/dtc/libfdt/%.c FORCE
$(call if_changed_dep,bootcc)
-- 
1.7.4.1

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 00/34] Make kernel build deterministic

2011-04-05 Thread Michal Marek

Hi,

this series makes it possible to build bit-identical kernel image and
modules from identical sources. Of course the build is already
deterministic in terms of behavior of the code, but the various
timestamps embedded in the object files make it hard to compare two
builds, for instance to verify that a makefile cleanup didn't
accidentally change something. A prime example is /proc/config.gz, which
has both a timestamp in the gzip header and a timestamp in the payload
data. With this series applied, a script like this will produce
identical kernels each time:

#!/bin/bash
rm -rf /dev/shm/{source,build}{,1,2}
export KCONFIG_NOTIMESTAMP=1
export KBUILD_BUILD_TIMESTAMP='Sun May  1 12:00:00 CEST 2011'
export KBUILD_BUILD_USER=user
export KBUILD_BUILD_HOST=host
export ROOT_DEV=FLOPPY
for i in 1 2; do
mkdir /dev/shm/source
# randomize the inode order just for fun
git ls-tree -r -z --name-only HEAD | sort -R -z | xargs -0 \
cp --parents --target=/dev/shm/source
pushd /dev/shm/source
mkdir /dev/shm/build
/dev/shm/build/all.config
for opt in GCOV_KERNEL UBIFS_FS_DEBUG; do
echo # CONFIG_$opt is not set /dev/shm/build/all.config
done
make O=/dev/shm/build KCONFIG_ALLCONFIG=1 allmodconfig
make O=/dev/shm/build -j64
popd
mv /dev/shm/source /dev/shm/source$i
mv /dev/shm/build /dev/shm/build$i
done
diff -rq /dev/shm/build{1,2}

Unfortunatelly, this cannot be used to validate indentation-only
patches, even if CONFIG_DEBUG_INFO is turned off. This is because of the
__FILE__ and __LINE__ macros used in many places. For the same reason,
the source and build directory needs to be the same, otherwise the
results will differ. This was tested on
x86_64/{defconfig,allmodconfig,allyesconfig} and ppc64/defconfig. The
series is also available at

git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6.git 
deterministic-build-v1

Michal


Michal Marek (34):
  kconfig: Do not record timestamp in auto.conf and autoconf.h
  kbuild: Call gzip with -n
  powerpc: Call gzip with -n
  kbuild: Use the deterministic mode of ar
  powerpc: Use the deterministic mode of ar
  kbuild: Drop unused LINUX_COMPILE_TIME and LINUX_COMPILE_DOMAIN
macros
  kbuild: Allow to override LINUX_COMPILE_BY and LINUX_COMPILE_HOST
macros
  initramfs: Use KBUILD_BUILD_TIMESTAMP for generated entries
  x86: Allow to override the ROOT_DEV variable
  cyclades: Drop __TIME__ usage
  nozomi: Drop __TIME__ usage
  isdn/diva: Drop __TIME__ usage
  media/radio-maxiradio: Drop __TIME__ usage
  media/cx231xx: Drop __TIME__ usage
  baycom: Drop __TIME__ usage
  nand/denali: Drop __TIME__ usage
  hdlcdrv: Drop __TIME__ usage
  wan/pc300: Drop __TIME__ usage
  rt2x00: Drop __TIME__ usage
  parport: Drop __TIME__ usage
  aacraid: Drop __TIME__ usage
  scsi/in2000: Drop __TIME__ usage
  scsi/wd33c93: Drop __TIME__ usage
  usb/u132-hcd: Drop __TIME__ usage
  usb/ftdi-elan: Drop __TIME__ usage
  dlm: Drop __TIME__ usage
  gfs2: Drop __TIME__ usage
  atm: Drop __TIME__ usage
  tipc: Drop __TIME__ usage
  rio: Drop __DATE__ usage
  edac: Drop __DATE__ usage
  pmcraid: Drop __DATE__ usage
  usb/lh7a40x_udc: Drop __DATE__ usage
  checkpatch: Warn about usage of __DATE__, __TIME__ and __TIMESTAMP__

 Documentation/kbuild/kbuild.txt  |   12 ++
 arch/powerpc/boot/Makefile   |2 +-
 arch/powerpc/boot/wrapper|6 ++--
 arch/x86/boot/Makefile   |2 +-
 drivers/char/cyclades.c  |3 +-
 drivers/char/nozomi.c|3 +-
 drivers/char/rio/rioinit.c   |2 +-
 drivers/edac/amd76x_edac.c   |2 +-
 drivers/edac/amd8111_edac.c  |2 +-
 drivers/edac/amd8131_edac.c  |2 +-
 drivers/edac/cpc925_edac.c   |2 +-
 drivers/edac/e752x_edac.c|2 +-
 drivers/edac/e7xxx_edac.c|2 +-
 drivers/edac/edac_module.c   |2 +-
 drivers/edac/i5000_edac.c|2 +-
 drivers/edac/i5400_edac.c|2 +-
 drivers/edac/i7300_edac.c|2 +-
 drivers/edac/i7core_edac.c   |2 +-
 drivers/edac/i82860_edac.c   |2 +-
 drivers/edac/i82875p_edac.c  |2 +-
 drivers/edac/i82975x_edac.c  |2 +-
 drivers/edac/mpc85xx_edac.h  |2 +-
 drivers/edac/mv64x60_edac.h  |2 +-
 drivers/edac/ppc4xx_edac.c   |2 +-
 drivers/edac/r82600_edac.c   |2 +-
 drivers/isdn/hardware/eicon/divasfunc.c  |5 +--
 drivers/media/radio/radio-maxiradio.c|3 +-
 drivers/media/video/cx231xx/cx231xx-avcore.c |2 +-
 drivers/mtd/nand/denali.c|3 +-
 

[RFC 2/5]arch:powerpc:sysdev:Makefile Remove unused config in the Makefile.

2011-04-05 Thread Justin P. Mattock
The patch below removes an unused config variable found by using a kernel
cleanup script.
Note: I did try to cross compile these but hit erros while doing so..
(gcc is not setup to cross compile) and am unsure if anymore needs to be done.
Please have a look if/when anybody has free time.

Signed-off-by: Justin P. Mattock justinmatt...@gmail.com
CC: Benjamin Herrenschmidt b...@kernel.crashing.org
CC: linuxppc-dev@lists.ozlabs.org

---
 arch/powerpc/sysdev/Makefile |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/sysdev/Makefile b/arch/powerpc/sysdev/Makefile
index 1e0c933..243b6ad 100644
--- a/arch/powerpc/sysdev/Makefile
+++ b/arch/powerpc/sysdev/Makefile
@@ -18,7 +18,6 @@ obj-$(CONFIG_FSL_PMC) += fsl_pmc.o
 obj-$(CONFIG_FSL_LBC)  += fsl_lbc.o
 obj-$(CONFIG_FSL_GTM)  += fsl_gtm.o
 obj-$(CONFIG_MPC8xxx_GPIO) += mpc8xxx_gpio.o
-obj-$(CONFIG_FSL_85XX_CACHE_SRAM)  += fsl_85xx_l2ctlr.o 
fsl_85xx_cache_sram.o
 obj-$(CONFIG_SIMPLE_GPIO)  += simple_gpio.o
 obj-$(CONFIG_FSL_RIO)  += fsl_rio.o
 obj-$(CONFIG_TSI108_BRIDGE)+= tsi108_pci.o tsi108_dev.o
-- 
1.7.4.2

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[RFC 5/5]arch:powerpc:kernel:Makefile Remove unused config in the Makefile.

2011-04-05 Thread Justin P. Mattock
The patch below removes an unused config variable found by using a kernel
cleanup script.
Note: I did try to cross compile these but hit erros while doing so..
(gcc is not setup to cross compile) and am unsure if anymore needs to be done.
Please have a look if/when anybody has free time.

Signed-off-by: Justin P. Mattock justinmatt...@gmail.com
CC: Benjamin Herrenschmidt b...@kernel.crashing.org
Cc: linuxppc-dev@lists.ozlabs.org

---
 arch/powerpc/kernel/Makefile |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 3bb2a3e..4fa0d52 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -75,7 +75,6 @@ obj-$(CONFIG_PPC_FSL_BOOK3E)  += cpu_setup_fsl_booke.o dbell.o
 obj-$(CONFIG_PPC_BOOK3E_64)+= dbell.o
 
 extra-y:= head_$(CONFIG_WORD_SIZE).o
-extra-$(CONFIG_PPC_BOOK3E_32)  := head_new_booke.o
 extra-$(CONFIG_40x):= head_40x.o
 extra-$(CONFIG_44x):= head_44x.o
 extra-$(CONFIG_FSL_BOOKE)  := head_fsl_booke.o
-- 
1.7.4.2

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [RFC 2/5]arch:powerpc:sysdev:Makefile Remove unused config in the Makefile.

2011-04-05 Thread Scott Wood
On Tue, 5 Apr 2011 09:58:19 -0700
Justin P. Mattock justinmatt...@gmail.com wrote:

 The patch below removes an unused config variable found by using a kernel
 cleanup script.
 Note: I did try to cross compile these but hit erros while doing so..
 (gcc is not setup to cross compile) and am unsure if anymore needs to be done.
 Please have a look if/when anybody has free time.
 
 Signed-off-by: Justin P. Mattock justinmatt...@gmail.com
 CC: Benjamin Herrenschmidt b...@kernel.crashing.org
 CC: linuxppc-dev@lists.ozlabs.org
 
 ---
  arch/powerpc/sysdev/Makefile |1 -
  1 files changed, 0 insertions(+), 1 deletions(-)
 
 diff --git a/arch/powerpc/sysdev/Makefile b/arch/powerpc/sysdev/Makefile
 index 1e0c933..243b6ad 100644
 --- a/arch/powerpc/sysdev/Makefile
 +++ b/arch/powerpc/sysdev/Makefile
 @@ -18,7 +18,6 @@ obj-$(CONFIG_FSL_PMC)   += fsl_pmc.o
  obj-$(CONFIG_FSL_LBC)+= fsl_lbc.o
  obj-$(CONFIG_FSL_GTM)+= fsl_gtm.o
  obj-$(CONFIG_MPC8xxx_GPIO)   += mpc8xxx_gpio.o
 -obj-$(CONFIG_FSL_85XX_CACHE_SRAM)+= fsl_85xx_l2ctlr.o 
 fsl_85xx_cache_sram.o
  obj-$(CONFIG_SIMPLE_GPIO)+= simple_gpio.o
  obj-$(CONFIG_FSL_RIO)+= fsl_rio.o
  obj-$(CONFIG_TSI108_BRIDGE)  += tsi108_pci.o tsi108_dev.o

Those files do exist, and aren't pulled in by any other means I can see.
It was introduced by commit 6db92cc9d07db9f713da8554b4bcdfc8e54ad386, whose
changelog says:
Drivers can do the following in Kconfig to use these APIs select
FSL_85XX_CACHE_SRAM if MPC85xx

Now, the absence of such a kconfig option[1] is a problem, but I don't think
outright removal (labelled trivial cleanup) is appropriate, unless nobody
fixes it after the problem is pointed out.  And if it is removed, the files
should go with it.

-Scott

[1] and of any drivers that select it, though this was added fairly
recently -- perhaps such a driver change is on its way?

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 00/34] Make kernel build deterministic

2011-04-05 Thread James Bottomley
On Tue, 2011-04-05 at 08:49 -0700, Greg KH wrote:
 On Tue, Apr 05, 2011 at 04:58:47PM +0200, Michal Marek wrote:
  
  Hi,
  
  this series makes it possible to build bit-identical kernel image and
  modules from identical sources. Of course the build is already
  deterministic in terms of behavior of the code, but the various
  timestamps embedded in the object files make it hard to compare two
  builds, for instance to verify that a makefile cleanup didn't
  accidentally change something. A prime example is /proc/config.gz, which
  has both a timestamp in the gzip header and a timestamp in the payload
  data. With this series applied, a script like this will produce
  identical kernels each time:
 
 Very nice stuff.  Do you want to take the individual patches through one
 of your trees, or do you mind if the subsystem maintainers take them
 through theirs?

I'm happy for this to go through a single tree.

James


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 00/34] Make kernel build deterministic

2011-04-05 Thread Mauro Carvalho Chehab
Em 05-04-2011 15:16, James Bottomley escreveu:
 On Tue, 2011-04-05 at 08:49 -0700, Greg KH wrote:
 On Tue, Apr 05, 2011 at 04:58:47PM +0200, Michal Marek wrote:

 Hi,

 this series makes it possible to build bit-identical kernel image and
 modules from identical sources. Of course the build is already
 deterministic in terms of behavior of the code, but the various
 timestamps embedded in the object files make it hard to compare two
 builds, for instance to verify that a makefile cleanup didn't
 accidentally change something. A prime example is /proc/config.gz, which
 has both a timestamp in the gzip header and a timestamp in the payload
 data. With this series applied, a script like this will produce
 identical kernels each time:

 Very nice stuff.  Do you want to take the individual patches through one
 of your trees, or do you mind if the subsystem maintainers take them
 through theirs?
 
 I'm happy for this to go through a single tree.

Me too.

With respect to the patches I was c/c (patches 13, 14, 31):

Acked-by: Mauro Carvalho Chehab mche...@redhat.com

Thanks,
Mauro.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


sdhc/mpc8536 - SDCard always detected like read-only

2011-04-05 Thread Carlos Roberto Moratelli
Hello,

I am working in a MPC8536e custom board. Our custom board has a slot to 
SDCards conected to the MPC8536e's eSDHC controller. We are using just
4-serial data pins of eSDHC controller.

My kernel is 2.6.35.7 and I am using buildroot to build the root system
with uClib.

I can mount and read the data from SDCards in the slot. But I am facing
errors when I try write something in the card. 

I am testing two SDcards: Kingston and a LG, both with 2GB capacity. I
tryed ext3 and fat32 filesystems with the same results.

When the card is detected the log is (observe the ro flag in the first
line):

mmcblk0: mmc0:57f7 SD02G 1.83 GiB (ro)
mmcblk0:
mmc0: starting CMD18 arg  flags 00b5
mmc0: blksz 512 blocks 8 flags 0200 tsac 100 ms nsac 0
mmc0: CMD12 arg  flags 049d
sdhci [sdhci_irq()]: *** mmc0 got interrupt: 0x0001
sdhci [sdhci_irq()]: *** mmc0 got interrupt: 0x000a
sdhci [sdhci_irq()]: *** mmc0 got interrupt: 0x0001
mmc0: req done (CMD18): 0: 0900   
mmc0: 4096 bytes transferred: 0
mmc0: (CMD12): 0: 0b00   
p1

I am sure the write protection mechanism on SDCard is in the unlock
position, but the kernel drivers detects the card like read-only.

Has someone idea why this happen?

Every idea or tip is apreciated.

Regards,

Moratelli.

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: sdhc/mpc8536 - SDCard always detected like read-only

2011-04-05 Thread Wolfram Sang
 Every idea or tip is apreciated.

Please post your dts.

-- 
Pengutronix e.K.   | Wolfram Sang|
Industrial Linux Solutions | http://www.pengutronix.de/  |


signature.asc
Description: Digital signature
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: sdhc/mpc8536 - SDCard always detected like read-only

2011-04-05 Thread Carlos Roberto Moratelli
Em Ter, 2011-04-05 às 21:02 +0200, Wolfram Sang escreveu:
  Every idea or tip is apreciated.
 
 Please post your dts.
 

/*
 * MPC8536 DS Device Tree Source
 *
 * Copyright 2008-2009 Freescale Semiconductor, Inc.
 *
 * This program is free software; you can redistribute  it and/or modify
it
 * under  the terms of  the GNU General  Public License as published by
the
 * Free Software Foundation;  either version 2 of the  License, or (at
your
 * option) any later version.
 */

/dts-v1/;

/ {
model = fsl,mpc8536ds;
compatible = fsl,mpc8536ds;
#address-cells = 2;
#size-cells = 2;

aliases {
ethernet0 = enet0;
serial0 = serial0;
serial1 = serial1;
pci1 = pci1;
};

cpus {
#cpus = 1;
#address-cells = 1;
#size-cells = 0;

PowerPC,8536@0 {
device_type = cpu;
reg = 0;
next-level-cache = L2;
};
};

memory {
device_type = memory;
reg = 0 0 0 0;// Filled by U-Boot
};

soc@fffe0 {
#address-cells = 1;
#size-cells = 1;
device_type = soc;
compatible = simple-bus;
ranges = 0x0 0xf 0xffe0 0x10;
bus-frequency = 0;// Filled out by uboot.

ecm-law@0 {
compatible = fsl,ecm-law;
reg = 0x0 0x1000;
fsl,num-laws = 12;
};

ecm@1000 {
compatible = fsl,mpc8536-ecm, fsl,ecm;
reg = 0x1000 0x1000;
interrupts = 17 2;
interrupt-parent = mpic;
};

memory-controller@2000 {
compatible = fsl,mpc8536-memory-controller;
reg = 0x2000 0x1000;
interrupt-parent = mpic;
interrupts = 18 0x2;
};

L2: l2-cache-controller@2 {
compatible = fsl,mpc8536-l2-cache-controller;
reg = 0x2 0x1000;
interrupt-parent = mpic;
interrupts = 16 0x2;
};

i2c@3000 {
#address-cells = 1;
#size-cells = 0;
cell-index = 0;
compatible = fsl-i2c;
reg = 0x3000 0x100;
interrupts = 43 0x2;
interrupt-parent = mpic;
dfsrr;

hwmon@48 {
compatible = national,lm73;
reg = 0x49;
};

rtc@68 {
compatible = rtc-m41t80,m41t82;
reg = 0x68;
};

lm90@4C {
compatible = lm90,adt7461;
reg = 0x4C;
};


};

i2c@3100 {
#address-cells = 1;
#size-cells = 0;
cell-index = 1;
compatible = fsl-i2c;
reg = 0x3100 0x100;
interrupts = 43 0x2;
interrupt-parent = mpic;
dfsrr;

sfp@50 {
compatible = sfp_teste,sfp_teste;
reg = 0x50;
};

bcm56334@44{
compatible = bcm56334,bcm56334;
reg = 0x44;
};

};

spi@7000 {
cell-index = 0;
#address-cells = 1;
#size-cells = 0;
compatible = fsl,mpc8536-espi;
reg = 0x7000 0x1000;
interrupts = 59 0x2;
interrupt-parent = mpic;
fsl,espi-num-chipselects = 4;
mode = cpu;

};

dma@21300 {
#address-cells = 1;
#size-cells = 1;
compatible = fsl,mpc8536-dma, fsl,eloplus-dma;
reg = 0x21300 4;
ranges = 0 0x21100 0x200;
cell-index = 0;
dma-channel@0 {
compatible 

Re: [PATCH 00/34] Make kernel build deterministic

2011-04-05 Thread Greg KH
On Tue, Apr 05, 2011 at 03:29:19PM -0300, Mauro Carvalho Chehab wrote:
 Em 05-04-2011 15:16, James Bottomley escreveu:
  On Tue, 2011-04-05 at 08:49 -0700, Greg KH wrote:
  On Tue, Apr 05, 2011 at 04:58:47PM +0200, Michal Marek wrote:
 
  Hi,
 
  this series makes it possible to build bit-identical kernel image and
  modules from identical sources. Of course the build is already
  deterministic in terms of behavior of the code, but the various
  timestamps embedded in the object files make it hard to compare two
  builds, for instance to verify that a makefile cleanup didn't
  accidentally change something. A prime example is /proc/config.gz, which
  has both a timestamp in the gzip header and a timestamp in the payload
  data. With this series applied, a script like this will produce
  identical kernels each time:
 
  Very nice stuff.  Do you want to take the individual patches through one
  of your trees, or do you mind if the subsystem maintainers take them
  through theirs?
  
  I'm happy for this to go through a single tree.
 
 Me too.
 
 With respect to the patches I was c/c (patches 13, 14, 31):
 
 Acked-by: Mauro Carvalho Chehab mche...@redhat.com

Me too.

Acked-by: Greg Kroah-Hartman gre...@suse.de

on the patches I was copied on.

thanks,

greg k-h

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 00/34] Make kernel build deterministic

2011-04-05 Thread Artem Bityutskiy
On Tue, 2011-04-05 at 08:49 -0700, Greg KH wrote:
 On Tue, Apr 05, 2011 at 04:58:47PM +0200, Michal Marek wrote:
  
  Hi,
  
  this series makes it possible to build bit-identical kernel image and
  modules from identical sources. Of course the build is already
  deterministic in terms of behavior of the code, but the various
  timestamps embedded in the object files make it hard to compare two
  builds, for instance to verify that a makefile cleanup didn't
  accidentally change something. A prime example is /proc/config.gz, which
  has both a timestamp in the gzip header and a timestamp in the payload
  data. With this series applied, a script like this will produce
  identical kernels each time:
 
 Very nice stuff.  Do you want to take the individual patches through one
 of your trees, or do you mind if the subsystem maintainers take them
 through theirs?

But unfortunately, it is very easy to break this and for sure it'll be
broken very soon.

So additionally, I'd suggest:
1. Instrument checkpatch.pl and make it err or warn on timestamps.
2. Probably instrument linux-next to rise a warning when people break
   this.

-- 
Best Regards,
Artem Bityutskiy (Битюцкий Артём)

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Combining multiple NAND MTDs

2011-04-05 Thread Barry G
Hello,

I have an 8308 using the fsl_elbc_nand NAND controller.  I have
chip selects 2  3 hooked up to a single die multiple chip select NAND
chip.  I have programmed u-boot and the kernel correctly and the
NAND chips are found:
NAND device: Manufacturer ID: 0xec, Chip ID: 0xd3 (Samsung NAND 1GiB
3,3V 8-bit)
eLBC NAND device at 0xe060, bank 1
NAND device: Manufacturer ID: 0xec, Chip ID: 0xd3 (Samsung NAND 1GiB
3,3V 8-bit)
eLBC NAND device at 0xe0608000, bank 2

The nand chips are correctly show up:
# cat /proc/mtd
dev:size   erasesize  name
mtd0: 0200 0002 fe00.flash
mtd1: 4000 0002 e060.flash
mtd2: 4000 0002 e0608000.flash

(mtd0 is unrelated NOR part).

I want to run UBIFS on the combined 2 gigs of flash.  Whats the best
way to do this?

I tried using the mtdconcat stuff and wrote a small driver
but I am not sure how to populate the mtd_info structure since do_probe_map
doesn't work with NAND AFAIK.

I see that fsl_elbc_select_chip says hardware does not seem to support this.
Not sure if this is related.

I see some comments in mtd-physmap.txt about using multiple reg ranges?
Does this work with NAND?

Thanks for any pointers,

Barry
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH] powerpc/book3e: Fix extlb size

2011-04-05 Thread Benjamin Herrenschmidt
On Tue, 2011-04-05 at 07:41 -0500, Kumar Gala wrote:
  Rework it to make it a bit clearer, and also correct. We want 3 save
  areas, each EX_TLB_SIZE _bytes_.
 
 Where does the 3 come from?  I have a guess, and think its possible we
 (FSL) want 4?

Wrong guess :-) It's not about exception levels. It's about how much
the handler can re-enter (2 with E.PT, 3 with virtual linear)

For MC's, CRITs etc... which we don't support on Book3E 64-bit at this
stage, you'll have to probably backup the whole area... that or move
the TLB frame pointer SPR to a separate set of 3 levels, but then you'd
have to fix the code that makes assumption about level 0 being at a
fixed offset in the PACA and instead use alignment tricks. We need that
because that's how we reset the TLB frame when a second level finds
a fault.

Cheers,
Ben.



___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: sdhc/mpc8536 - SDCard always detected like read-only

2011-04-05 Thread Wolfram Sang
   sdhci@2e000 {
   compatible = fsl,mpc8536-esdhc, fsl,esdhc;
   reg = 0x2e000 0x1000;
   interrupts = 72 0x2;
   interrupt-parent = mpic;
   /* Filled in by U-Boot */
   clock-frequency = 0;
   };

Hmm, I am not too familiar with those SoCs, yet some 83xx needed

sdhci,wp-inverted;

here. Maybe yours, too? Would fit the symptoms.

Regards,

   Wolfram

-- 
Pengutronix e.K.   | Wolfram Sang|
Industrial Linux Solutions | http://www.pengutronix.de/  |


signature.asc
Description: Digital signature
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH] powerpc/book3e: Fix extlb size

2011-04-05 Thread Kumar Gala

On Apr 5, 2011, at 6:39 PM, Benjamin Herrenschmidt wrote:

 On Tue, 2011-04-05 at 07:41 -0500, Kumar Gala wrote:
 Rework it to make it a bit clearer, and also correct. We want 3 save
 areas, each EX_TLB_SIZE _bytes_.
 
 Where does the 3 come from?  I have a guess, and think its possible we
 (FSL) want 4?
 
 Wrong guess :-) It's not about exception levels. It's about how much
 the handler can re-enter (2 with E.PT, 3 with virtual linear)
 
 For MC's, CRITs etc... which we don't support on Book3E 64-bit at this
 stage, you'll have to probably backup the whole area... that or move
 the TLB frame pointer SPR to a separate set of 3 levels, but then you'd
 have to fix the code that makes assumption about level 0 being at a
 fixed offset in the PACA and instead use alignment tricks. We need that
 because that's how we reset the TLB frame when a second level finds
 a fault.
 
 Cheers,
 Ben.

Gotcha, can we add a comment here about what the '3' is about.

- k
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[RFC][PATCH] powerpc/book3e: Fix CPU feature handling on e5500

2011-04-05 Thread Kumar Gala
The CPU_FTRS_POSSIBLE and CPU_FTRS_ALWAYS defines did not encompass
e5500 CPU features when built for 64-bit.  This causes issues with
cpu_has_feature() as it utilizes the POSSIBLE  ALWAYS defines as part
of its check.

Signed-off-by: Kumar Gala ga...@kernel.crashing.org
---
* I'm concerned if its ok to assume 'enum' can handle a 64-bit mask or not.
  I'm assuming this is the reason that we use a #define on __powerpc64__

 arch/powerpc/include/asm/cputable.h |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/include/asm/cputable.h 
b/arch/powerpc/include/asm/cputable.h
index be3cdf9..8200e9d 100644
--- a/arch/powerpc/include/asm/cputable.h
+++ b/arch/powerpc/include/asm/cputable.h
@@ -434,7 +434,7 @@ extern const char *powerpc_base_platform;
CPU_FTR_PURR | CPU_FTR_REAL_LE | CPU_FTR_NO_SLBIE_B)
 #define CPU_FTRS_COMPATIBLE(CPU_FTR_USE_TB | CPU_FTR_PPCAS_ARCH_V2)
 
-#ifdef __powerpc64__
+#if defined(__powerpc64__)  !defined(CONFIG_PPC_BOOK3E)
 #define CPU_FTRS_POSSIBLE  \
(CPU_FTRS_POWER3 | CPU_FTRS_RS64 | CPU_FTRS_POWER4 |\
CPU_FTRS_PPC970 | CPU_FTRS_POWER5 | CPU_FTRS_POWER6 |   \
@@ -478,7 +478,7 @@ enum {
 };
 #endif /* __powerpc64__ */
 
-#ifdef __powerpc64__
+#if defined(__powerpc64__)  !defined(CONFIG_PPC_BOOK3E)
 #define CPU_FTRS_ALWAYS\
(CPU_FTRS_POWER3  CPU_FTRS_RS64  CPU_FTRS_POWER4 \
CPU_FTRS_PPC970  CPU_FTRS_POWER5  CPU_FTRS_POWER6\
-- 
1.7.3.4

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [RFC][PATCH] powerpc/book3e: Fix CPU feature handling on e5500

2011-04-05 Thread Stephen Rothwell
Hi Kumar,

On Wed,  6 Apr 2011 00:29:32 -0500 Kumar Gala ga...@kernel.crashing.org wrote:

 * I'm concerned if its ok to assume 'enum' can handle a 64-bit mask or not.
   I'm assuming this is the reason that we use a #define on __powerpc64__

enums are *ints* and therefore 32 bit.  gcc can cope, but warns about it
(I think). So we must use the #define if any of the included bits are
above 2^32.

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/


pgpyjmkHUlgyg.pgp
Description: PGP signature
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev