inconsistent order of notify_die and kgdb/debugger between powerpc and x86

2011-03-14 Thread Fredrick Prashanth John Berchmans
I see in x86, the die chain notifiers are called first
before going to debugger but in powerpc its the
other way round.
Any reason for this inconsistency?
Because, I wanted to take some action before falling
to debugger in powerpc. Is there any cleaner way to do this which would work
irrespective of the architecture?

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


[PATCH] crypto: caam - standardize device tree naming convention to utilize '-vX.Y'

2011-03-14 Thread Kim Phillips
Help clarify that the number trailing in compatible nomenclature
is the version number of the device, i.e., change:

"fsl,p4080-sec4.0", "fsl,sec4.0";

to:

"fsl,p4080-sec-v4.0", "fsl,sec-v4.0";

Signed-off-by: Kim Phillips 
Cc: Kumar Gala 
Cc: Steve Cornelius 
---
 .../devicetree/bindings/crypto/fsl-sec4.txt|   68 ++--
 arch/powerpc/boot/dts/p4080ds.dts  |   41 ++--
 drivers/crypto/caam/caamalg.c  |4 +-
 drivers/crypto/caam/ctrl.c |6 +-
 4 files changed, 60 insertions(+), 59 deletions(-)

diff --git a/Documentation/devicetree/bindings/crypto/fsl-sec4.txt 
b/Documentation/devicetree/bindings/crypto/fsl-sec4.txt
index fce16a8..568aa3c 100644
--- a/Documentation/devicetree/bindings/crypto/fsl-sec4.txt
+++ b/Documentation/devicetree/bindings/crypto/fsl-sec4.txt
@@ -53,7 +53,7 @@ PROPERTIES
- compatible
   Usage: required
   Value type: 
-  Definition: Must include "fsl,p4080-sec4.0","fsl,sec-4.0"
+  Definition: Must include "fsl,p4080-sec-v4.0","fsl,sec-v4.0"
 
- #address-cells
Usage: required
@@ -72,7 +72,7 @@ PROPERTIES
   Usage: required
   Value type: 
   Definition: A standard property.  Specifies the physical
-  address and length of the SEC4.0 configuration registers.
+  address and length of the SEC4 configuration registers.
   registers
 
- ranges
@@ -105,7 +105,7 @@ PROPERTIES
 
 EXAMPLE
crypto@30 {
-   compatible = "fsl,p4080-sec4.0", "fsl,sec4.0";
+   compatible = "fsl,p4080-sec-v4.0", "fsl,sec-v4.0";
#address-cells = <1>;
#size-cells = <1>;
reg = <0x30 0x1>;
@@ -127,7 +127,7 @@ P4080 Job Ring (JR) Node
   - compatible
   Usage: required
   Value type: 
-  Definition: Must include 
"fsl,p4080-sec4.0-job-ring","fsl,sec4.0-job-ring"
+  Definition: Must include 
"fsl,p4080-sec-v4.0-job-ring","fsl,sec-v4.0-job-ring"
 
   - reg
   Usage: required
@@ -163,8 +163,8 @@ P4080 Job Ring (JR) Node
 
 EXAMPLE
jr@1000 {
-   compatible = "fsl,p4080-sec4.0-job-ring",
-"fsl,sec4.0-job-ring";
+   compatible = "fsl,p4080-sec-v4.0-job-ring",
+"fsl,sec-v4.0-job-ring";
reg = <0x1000 0x1000>;
fsl,liodn = <0x081>;
interrupt-parent = <&mpic>;
@@ -186,7 +186,7 @@ P4080 Run Time Integrity Check (RTIC) Node
   - compatible
   Usage: required
   Value type: 
-  Definition: Must include "fsl,p4080-sec4.0-rtic","fsl,sec4.0-rtic".
+  Definition: Must include "fsl,p4080-sec-v4.0-rtic","fsl,sec-v4.0-rtic".
 
- #address-cells
Usage: required
@@ -219,8 +219,8 @@ P4080 Run Time Integrity Check (RTIC) Node
 
 EXAMPLE
rtic@6000 {
-   compatible = "fsl,p4080-sec4.0-rtic",
-"fsl,sec4.0-rtic";
+   compatible = "fsl,p4080-sec-v4.0-rtic",
+"fsl,sec-v4.0-rtic";
#address-cells = <1>;
#size-cells = <1>;
reg = <0x6000 0x100>;
@@ -238,7 +238,7 @@ P4080 Run Time Integrity Check (RTIC) Memory Node
   - compatible
   Usage: required
   Value type: 
-  Definition: Must include 
"fsl,p4080-sec4.0-rtic-memory","fsl,sec4.0-rtic-memory".
+  Definition: Must include 
"fsl,p4080-sec-v4.0-rtic-memory","fsl,sec-v4.0-rtic-memory".
 
   - reg
   Usage: required
@@ -270,8 +270,8 @@ P4080 Run Time Integrity Check (RTIC) Memory Node
 
 EXAMPLE
rtic-a@0 {
-   compatible = "fsl,p4080-sec4.0-rtic-memory",
-"fsl,sec4.0-rtic-memory";
+   compatible = "fsl,p4080-sec-v4.0-rtic-memory",
+"fsl,sec-v4.0-rtic-memory";
reg = <0x00 0x20 0x100 0x80>;
fsl,liodn   = <0x03c>;
fsl,rtic-region  = <0x12345678 0x12345678 0x12345678>;
@@ -288,7 +288,7 @@ P4080 Secure Non-Volatile Storage (SNVS) Node
   - compatible
   Usage: required
   Value type: 
-  Definition: Must include "fsl,p4080-sec4.0-mon", "fsl,sec4.0-mon".
+  Definition: Must include "fsl,p4080-sec-v4.0-mon", "fsl,sec-v4.0-mon".
 
   - reg
   Usage: required
@@ -315,7 +315,7 @@ P4080 Secure Non-Volatile Storage (SNVS) Node
 
 EXAMPLE
sec_mon@314000 {
-   compatible = "fsl,p4080-sec4.0-mon", "fsl,sec4.0-mon";
+   compatible = "fsl,p4080-sec-v4.0-mon", "fsl,sec-v4.0-mon";
reg = <0x314000 0x1000>;
interrupt-parent = <&mpic>;
interrupts = <93 2>;
@@ -325,7 +325,7 @@ EXAMPLE
 FULL EXAMPLE
 
crypto: crypto@30 {
-   compatible = "fsl,p4080-sec4.0", "fsl,sec4.0";
+   compatible = "fsl,p4080-sec-v4.0", "fsl,sec-v4.0";
#address-cells = <1>;

Re: linux-next: build failure after merge of the final tree (powerpc tree related)

2011-03-14 Thread Lennert Buytenhek
On Tue, Mar 15, 2011 at 07:37:54AM +1100, Benjamin Herrenschmidt wrote:

> > Hi all,
> > 
> > After merging the final tree, today's linux-next build (powerpc
> > allyesconfig) failed like this:
> > 
> > drivers/gpio/langwell_gpio.c: In function 'lnw_irq_handler':
> > drivers/gpio/langwell_gpio.c:210: error: 'struct irq_desc' has no member 
> > named 'chip'
> > drivers/gpio/langwell_gpio.c:211: error: 'struct irq_desc' has no member 
> > named 'chip'
> > 
> > Caused by commit 17b9f9e2653a ("powerpc: Enable
> > GENERIC_HARDIRQS_NO_DEPRECATED") enabling
> > CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED for powerpc without previously
> > fixing up the above driver.
> > 
> > I have reverted that commit for today.
> 
> Except that the above driver has nothing to do with powerpc, it's some
> Intel Moorestown stuff...

I sent this this morning:

http://marc.info/?l=linux-kernel&m=130009963219374&w=2
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 1/1] powerpc: Add page coalescing support

2011-03-14 Thread Brian King

Adds support for page coalescing, which is a feature on IBM Power servers
which allows for coalescing identical pages between logical partitions.
Hint text pages as coalesce candidates, since they are the most likely
pages to be able to be coalesced between partitions. This patch also
exports some page coalescing statistics available from firmware via
lparcfg.

Signed-off-by: Brian King 
---

 arch/powerpc/include/asm/firmware.h |3 +-
 arch/powerpc/include/asm/hvcall.h   |   12 
 arch/powerpc/include/asm/pSeries_reconfig.h |6 
 arch/powerpc/kernel/lparcfg.c   |   40 
 arch/powerpc/kernel/prom_init.c |4 ++
 arch/powerpc/kernel/rtas.c  |2 +
 arch/powerpc/platforms/pseries/lpar.c   |2 +
 arch/powerpc/platforms/pseries/setup.c  |   11 +++
 8 files changed, 78 insertions(+), 2 deletions(-)

diff -puN arch/powerpc/include/asm/hvcall.h~powerpc_coalesce 
arch/powerpc/include/asm/hvcall.h
--- linux-2.6/arch/powerpc/include/asm/hvcall.h~powerpc_coalesce
2011-03-14 15:45:12.0 -0500
+++ linux-2.6-bjking1/arch/powerpc/include/asm/hvcall.h 2011-03-14 
15:45:12.0 -0500
@@ -102,6 +102,7 @@
 #define H_ANDCOND  (1UL<<(63-33))
 #define H_ICACHE_INVALIDATE(1UL<<(63-40))  /* icbi, etc.  (ignored for IO 
pages) */
 #define H_ICACHE_SYNCHRONIZE   (1UL<<(63-41))  /* dcbst, icbi, etc (ignored 
for IO pages */
+#define H_COALESCE_CAND(1UL<<(63-42))  /* page is a good candidate for 
coalescing */
 #define H_ZERO_PAGE(1UL<<(63-48))  /* zero the page before mapping 
(ignored for IO pages) */
 #define H_COPY_PAGE(1UL<<(63-49))
 #define H_N(1UL<<(63-61))
@@ -234,6 +235,7 @@
 #define H_GET_MPP  0x2D4
 #define H_HOME_NODE_ASSOCIATIVITY 0x2EC
 #define H_BEST_ENERGY  0x2F4
+#define H_GET_MPP_X0x314
 #define MAX_HCALL_OPCODE   H_BEST_ENERGY
 
 #ifndef __ASSEMBLY__
@@ -312,6 +314,16 @@ struct hvcall_mpp_data {
 
 int h_get_mpp(struct hvcall_mpp_data *);
 
+struct hvcall_mpp_x_data {
+   unsigned long coalesced_bytes;
+   unsigned long pool_coalesced_bytes;
+   unsigned long pool_purr_cycles;
+   unsigned long pool_spurr_cycles;
+   unsigned long reserved[3];
+};
+
+int h_get_mpp_x(struct hvcall_mpp_x_data *mpp_x_data);
+
 #ifdef CONFIG_PPC_PSERIES
 extern int CMO_PrPSP;
 extern int CMO_SecPSP;
diff -puN arch/powerpc/platforms/pseries/setup.c~powerpc_coalesce 
arch/powerpc/platforms/pseries/setup.c
--- linux-2.6/arch/powerpc/platforms/pseries/setup.c~powerpc_coalesce   
2011-03-14 15:45:12.0 -0500
+++ linux-2.6-bjking1/arch/powerpc/platforms/pseries/setup.c2011-03-14 
15:45:12.0 -0500
@@ -392,6 +392,16 @@ static int pseries_set_xdabr(unsigned lo
 #define CMO_CHARACTERISTICS_TOKEN 44
 #define CMO_MAXLENGTH 1026
 
+void pSeries_coalesce_init(void)
+{
+   struct hvcall_mpp_x_data mpp_x_data;
+
+   if (firmware_has_feature(FW_FEATURE_CMO) && !h_get_mpp_x(&mpp_x_data))
+   powerpc_firmware_features |= FW_FEATURE_XCMO;
+   else
+   powerpc_firmware_features &= ~FW_FEATURE_XCMO;
+}
+
 /**
  * fw_cmo_feature_init - FW_FEATURE_CMO is not stored in 
ibm,hypertas-functions,
  * handle that here. (Stolen from parse_system_parameter_string)
@@ -461,6 +471,7 @@ void pSeries_cmo_feature_init(void)
pr_debug("CMO enabled, PrPSP=%d, SecPSP=%d\n", CMO_PrPSP,
 CMO_SecPSP);
powerpc_firmware_features |= FW_FEATURE_CMO;
+   pSeries_coalesce_init();
} else
pr_debug("CMO not enabled, PrPSP=%d, SecPSP=%d\n", CMO_PrPSP,
 CMO_SecPSP);
diff -puN arch/powerpc/kernel/prom_init.c~powerpc_coalesce 
arch/powerpc/kernel/prom_init.c
--- linux-2.6/arch/powerpc/kernel/prom_init.c~powerpc_coalesce  2011-03-14 
15:45:12.0 -0500
+++ linux-2.6-bjking1/arch/powerpc/kernel/prom_init.c   2011-03-14 
15:45:12.0 -0500
@@ -676,8 +676,10 @@ static void __init early_cmdline_parse(v
 #endif /* CONFIG_PCI_MSI */
 #ifdef CONFIG_PPC_SMLPAR
 #define OV5_CMO0x80/* Cooperative Memory 
Overcommitment */
+#define OV5_XCMO   0x40/* Page Coalescing */
 #else
 #define OV5_CMO0x00
+#define OV5_XCMO   0x00
 #endif
 #define OV5_TYPE1_AFFINITY 0x80/* Type 1 NUMA affinity */
 
@@ -732,7 +734,7 @@ static unsigned char ibm_architecture_ve
OV5_LPAR | OV5_SPLPAR | OV5_LARGE_PAGES | OV5_DRCONF_MEMORY |
OV5_DONATE_DEDICATE_CPU | OV5_MSI,
0,
-   OV5_CMO,
+   OV5_CMO | OV5_XCMO,
OV5_TYPE1_AFFINITY,
0,
0,
diff -puN arch/powerpc/kernel/lparcfg.c~powerpc_coalesce 
arch/powerpc/kernel/lparcfg.c
--- linux-2.6/arch/powerpc/kernel/lparcfg.c~powerpc_coalesce2011-03-14 
15:45:12.0 -0500
+++ linux-2.6-

Re: linux-next: build failure after merge of the final tree (powerpc tree related)

2011-03-14 Thread Thomas Gleixner
On Mon, 14 Mar 2011, David Miller wrote:

> From: Benjamin Herrenschmidt 
> Date: Tue, 15 Mar 2011 07:37:54 +1100
> 
> > On Mon, 2011-03-14 at 20:38 +1100, Stephen Rothwell wrote:
> >> Hi all,
> >> 
> >> After merging the final tree, today's linux-next build (powerpc
> >> allyesconfig) failed like this:
> >> 
> >> drivers/gpio/langwell_gpio.c: In function 'lnw_irq_handler':
> >> drivers/gpio/langwell_gpio.c:210: error: 'struct irq_desc' has no member 
> >> named 'chip'
> >> drivers/gpio/langwell_gpio.c:211: error: 'struct irq_desc' has no member 
> >> named 'chip'
> >> 
> >> Caused by commit 17b9f9e2653a ("powerpc: Enable
> >> GENERIC_HARDIRQS_NO_DEPRECATED") enabling
> >> CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED for powerpc without previously
> >> fixing up the above driver.
> >> 
> >> I have reverted that commit for today.
> > 
> > Except that the above driver has nothing to do with powerpc, it's some
> > Intel Moorestown stuff...
> > 
> > It should be fixed regardless I suppose, CC'ing Thomas.
> 
> I've had to make fixes to this driver in sparc64 allmodconfig builds
> too :-)

Sigh. Yes, this wants to depend on x86 in the first place.

But this is the second instance of blindly and mindlessly changing eoi
to irq_eoi w/o looking at the reason for this change.

Those patches should have been rejected based on their changelog in
the first place:

Latest kernel has many changes in IRQ subsystem and its interfaces, like
adding "irq_eoi" for struct irq_chip, this patch is a follow up change
for that.

When noone beats me to fix that mess, I'll do it tomorrow morning.

Thanks,

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


Re: [PATCH] cxgb4: use pgprot_writecombine() on powerpc

2011-03-14 Thread Steve Wise

On 03/14/2011 03:36 PM, Nishanth Aravamudan wrote:

Commit fe3cc0d99de6a9bf99b6c279a8afb5833888c1f7 ("powerpc: Add
pgprot_writecombine") in benh's tree exposes the pgprot_writecombine()
API to drivers on powerpc. cxgb4 has an open-coded version of the same,
so use the common API now that it's available.

Signed-off-by: Nishanth Aravamudan
Cc: Steve Wise
Cc: Anton Blanchard

---

Given that this depends on a patch in Ben's tree, should this go in via
the powerpc tree? Presuming Steve acks it, of course.

  drivers/infiniband/hw/cxgb4/t4.h |5 +
  1 files changed, 1 insertions(+), 4 deletions(-)



Acked-by: Steve Wise 

I suppose it should go into the same tree with the commit that adds this 
function.


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


Re: linux-next: build failure after merge of the final tree (powerpc tree related)

2011-03-14 Thread David Miller
From: Benjamin Herrenschmidt 
Date: Tue, 15 Mar 2011 07:37:54 +1100

> On Mon, 2011-03-14 at 20:38 +1100, Stephen Rothwell wrote:
>> Hi all,
>> 
>> After merging the final tree, today's linux-next build (powerpc
>> allyesconfig) failed like this:
>> 
>> drivers/gpio/langwell_gpio.c: In function 'lnw_irq_handler':
>> drivers/gpio/langwell_gpio.c:210: error: 'struct irq_desc' has no member 
>> named 'chip'
>> drivers/gpio/langwell_gpio.c:211: error: 'struct irq_desc' has no member 
>> named 'chip'
>> 
>> Caused by commit 17b9f9e2653a ("powerpc: Enable
>> GENERIC_HARDIRQS_NO_DEPRECATED") enabling
>> CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED for powerpc without previously
>> fixing up the above driver.
>> 
>> I have reverted that commit for today.
> 
> Except that the above driver has nothing to do with powerpc, it's some
> Intel Moorestown stuff...
> 
> It should be fixed regardless I suppose, CC'ing Thomas.

I've had to make fixes to this driver in sparc64 allmodconfig builds
too :-)
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: linux-next: build failure after merge of the final tree (powerpc tree related)

2011-03-14 Thread Benjamin Herrenschmidt
On Mon, 2011-03-14 at 20:38 +1100, Stephen Rothwell wrote:
> Hi all,
> 
> After merging the final tree, today's linux-next build (powerpc
> allyesconfig) failed like this:
> 
> drivers/gpio/langwell_gpio.c: In function 'lnw_irq_handler':
> drivers/gpio/langwell_gpio.c:210: error: 'struct irq_desc' has no member 
> named 'chip'
> drivers/gpio/langwell_gpio.c:211: error: 'struct irq_desc' has no member 
> named 'chip'
> 
> Caused by commit 17b9f9e2653a ("powerpc: Enable
> GENERIC_HARDIRQS_NO_DEPRECATED") enabling
> CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED for powerpc without previously
> fixing up the above driver.
> 
> I have reverted that commit for today.

Except that the above driver has nothing to do with powerpc, it's some
Intel Moorestown stuff...

It should be fixed regardless I suppose, CC'ing Thomas.

Cheers,
Ben.


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


[PATCH] cxgb4: use pgprot_writecombine() on powerpc

2011-03-14 Thread Nishanth Aravamudan
Commit fe3cc0d99de6a9bf99b6c279a8afb5833888c1f7 ("powerpc: Add
pgprot_writecombine") in benh's tree exposes the pgprot_writecombine()
API to drivers on powerpc. cxgb4 has an open-coded version of the same,
so use the common API now that it's available.

Signed-off-by: Nishanth Aravamudan 
Cc: Steve Wise 
Cc: Anton Blanchard 

---

Given that this depends on a patch in Ben's tree, should this go in via
the powerpc tree? Presuming Steve acks it, of course.

 drivers/infiniband/hw/cxgb4/t4.h |5 +
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/drivers/infiniband/hw/cxgb4/t4.h b/drivers/infiniband/hw/cxgb4/t4.h
index 7000442..2fce083 100644
--- a/drivers/infiniband/hw/cxgb4/t4.h
+++ b/drivers/infiniband/hw/cxgb4/t4.h
@@ -269,11 +269,8 @@ struct t4_swsqe {
 
 static inline pgprot_t t4_pgprot_wc(pgprot_t prot)
 {
-#if defined(__i386__) || defined(__x86_64__)
+#if defined(__i386__) || defined(__x86_64__) || defined(CONFIG_PPC64)
return pgprot_writecombine(prot);
-#elif defined(CONFIG_PPC64)
-   return __pgprot((pgprot_val(prot) | _PAGE_NO_CACHE) &
-   ~(pgprot_t)_PAGE_GUARDED);
 #else
return pgprot_noncached(prot);
 #endif
-- 
1.7.1

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


[PATCH v3 3/3] powerpc: Add IO event interrupt support

2011-03-14 Thread Tseng-Hui (Frank) Lin

This patch adds support for handling IO Event interrupts which come
through at the /event-sources/ibm,io-events device tree node.

The interrupts come through ibm,io-events device tree node are generated
by the firmware to report IO events. The firmware uses the same interrupt
to report multiple types of events for multiple devices. Each device may
have its own event handler. This patch implements a plateform interrupt
handler that is triggered by the IO event interrupts come through
ibm,io-events device tree node, pull in the IO events from RTAS and call
device event handlers registered in the notifier list.

Device event handlers are expected to use atomic_notifier_chain_register()
and atomic_notifier_chain_unregister() to register/unregister their
event handler in pseries_ioei_notifier_list list with IO event interrupt.
Device event handlers are responsible to identify if the event belongs
to the device event handler. The device event handle should return NOTIFY_OK
after the event is handled if the event belongs to the device event handler,
or NOTIFY_DONE otherwise.

Change log from V2:
- Re-implement interrupt call list with atomic notifier.

platforms/pseries/io_event_irq.c:
- Move IO Event data copy to ioei_interrupt(). Rename ioei_get_event()
  to ioei_find_event().
- Remove unused ioei_call_handlers(), pseries_ioei_register_handler(),
  pseries_ioei_unregister_handler() as the functions are replaced by
  notifier.

Signed-off-by: Mark Nelson 
Signed-off-by: Tseng-Hui (Frank) Lin 
---
 arch/powerpc/include/asm/io_event_irq.h   |   54 +++
 arch/powerpc/platforms/pseries/Kconfig|   19 ++
 arch/powerpc/platforms/pseries/Makefile   |1 +
 arch/powerpc/platforms/pseries/io_event_irq.c |  207 +
 4 files changed, 281 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/include/asm/io_event_irq.h 
b/arch/powerpc/include/asm/io_event_irq.h
new file mode 100644
index 000..cbaef02
--- /dev/null
+++ b/arch/powerpc/include/asm/io_event_irq.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2010, 2011 Mark Nelson and Tseng-Hui (Frank) Lin, IBM Corporation
+ *
+ *  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.
+ */
+
+#ifndef _ASM_POWERPC_IO_EVENT_IRQ_H
+#define _ASM_POWERPC_IO_EVENT_IRQ_H
+
+#include 
+#include 
+
+#define PSERIES_IOEI_RPC_MAX_LEN 216
+
+#define PSERIES_IOEI_TYPE_ERR_DETECTED 0x01
+#define PSERIES_IOEI_TYPE_ERR_RECOVERED0x02
+#define PSERIES_IOEI_TYPE_EVENT0x03
+#define PSERIES_IOEI_TYPE_RPC_PASS_THRU0x04
+
+#define PSERIES_IOEI_SUBTYPE_NOT_APP   0x00
+#define PSERIES_IOEI_SUBTYPE_REBALANCE_REQ 0x01
+#define PSERIES_IOEI_SUBTYPE_NODE_ONLINE   0x03
+#define PSERIES_IOEI_SUBTYPE_NODE_OFFLINE  0x04
+#define PSERIES_IOEI_SUBTYPE_DUMP_SIZE_CHANGE  0x05
+#define PSERIES_IOEI_SUBTYPE_TORRENT_IRV_UPDATE0x06
+#define PSERIES_IOEI_SUBTYPE_TORRENT_HFI_CFGED 0x07
+
+#define PSERIES_IOEI_SCOPE_NOT_APP 0x00
+#define PSERIES_IOEI_SCOPE_RIO_HUB 0x36
+#define PSERIES_IOEI_SCOPE_RIO_BRIDGE  0x37
+#define PSERIES_IOEI_SCOPE_PHB 0x38
+#define PSERIES_IOEI_SCOPE_EADS_GLOBAL 0x39
+#define PSERIES_IOEI_SCOPE_EADS_SLOT   0x3A
+#define PSERIES_IOEI_SCOPE_TORRENT_HUB 0x3B
+#define PSERIES_IOEI_SCOPE_SERVICE_PROC0x51
+
+/* Platform Event Log Format, Version 6, data portition of IO event section */
+struct pseries_io_event_sect_data {
+   uint8_t event_type; /* 0x00 IO-Event Type   */
+   uint8_t rpc_data_len;   /* 0x01 RPC data length */
+   uint8_t scope;  /* 0x02 Error/Event Scope   */
+   uint8_t event_subtype;  /* 0x03 I/O-Event Sub-Type  */
+   uint32_t drc_index; /* 0x04 DRC Index   */
+   uint8_t rpc_data[PSERIES_IOEI_RPC_MAX_LEN];
+   /* 0x08 RPC Data (0-216 bytes,  */
+   /* padded to 4 bytes alignment) */
+};
+
+extern struct atomic_notifier_head pseries_ioei_notifier_list;
+
+#endif /* _ASM_POWERPC_IO_EVENT_IRQ_H */
diff --git a/arch/powerpc/platforms/pseries/Kconfig 
b/arch/powerpc/platforms/pseries/Kconfig
index 5b3da4b..d44af70 100644
--- a/arch/powerpc/platforms/pseries/Kconfig
+++ b/arch/powerpc/platforms/pseries/Kconfig
@@ -52,6 +52,25 @@  bool
depends on PPC_PSERIES && RTAS_ERROR_LOGGING
default n

+config IO_EVENT_IRQ
+   bool "IO Event Interrupt support"
+   depends on PPC_PSERIES
+   select PSERIES_EVENT_LOG
+   default y
+   help
+ Select this option, if you want to enable support for IO Event
+ interrupts. IO event interrupt is a mechanis

[PATCH v3 2/3] powerpc: Add IO event interrupt support

2011-03-14 Thread Tseng-Hui (Frank) Lin

This patch adds IBM specific v6 extended log definition and utilities.

Change log from V2:
- Change the log name from error log to event log.
- Change function name from pseries_elog_find_section() to
  pseries_elog_find_sect_data().

Signed-off-by: Tseng-Hui (Frank) Lin 
---
 arch/powerpc/platforms/pseries/Kconfig |5 ++
 arch/powerpc/platforms/pseries/Makefile|1 +
 arch/powerpc/platforms/pseries/pseries_event_log.c |   61 
 arch/powerpc/platforms/pseries/pseries_event_log.h |   50 
 4 files changed, 117 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/Kconfig 
b/arch/powerpc/platforms/pseries/Kconfig
index 5b3da4b..98e5e39 100644
--- a/arch/powerpc/platforms/pseries/Kconfig
+++ b/arch/powerpc/platforms/pseries/Kconfig
@@ -47,6 +47,11 @@ config SCANLOG
tristate "Scanlog dump interface"
depends on RTAS_PROC && PPC_PSERIES
 
+config PSERIES_EVENT_LOG
+   bool
+   depends on PPC_PSERIES && RTAS_ERROR_LOGGING
+   default n
+
 config LPARCFG
bool "LPAR Configuration Data"
depends on PPC_PSERIES || PPC_ISERIES
diff --git a/arch/powerpc/platforms/pseries/Makefile 
b/arch/powerpc/platforms/pseries/Makefile
index fc52378..07bbf75 100644
--- a/arch/powerpc/platforms/pseries/Makefile
+++ b/arch/powerpc/platforms/pseries/Makefile
@@ -22,6 +22,7 @@ obj-$(CONFIG_HCALL_STATS) += hvCall_inst.o
 obj-$(CONFIG_PHYP_DUMP)+= phyp_dump.o
 obj-$(CONFIG_CMM)  += cmm.o
 obj-$(CONFIG_DTL)  += dtl.o
+obj-$(CONFIG_PSERIES_EVENT_LOG)+= pseries_event_log.o
 
 ifeq ($(CONFIG_PPC_PSERIES),y)
 obj-$(CONFIG_SUSPEND)  += suspend.o
diff --git a/arch/powerpc/platforms/pseries/pseries_event_log.c 
b/arch/powerpc/platforms/pseries/pseries_event_log.c
new file mode 100644
index 000..36ad8a1
--- /dev/null
+++ b/arch/powerpc/platforms/pseries/pseries_event_log.c
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2010, 2011 Tseng-Hui (Frank) Lin, IBM Corporation
+ *
+ *  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.
+ */
+
+/*
+ * IBM pSerie platform event log specific functions.
+ * All data in this file is in big endian.
+ */
+
+#include 
+#include 
+
+#include 
+
+#include "pseries_event_log.h"
+
+/*
+ * Find the size of the data portation of a platform event log section.
+ */
+size_t pseries_elog_sect_data_len(void *sect_data_p)
+{
+   struct pseries_elog_section *p;
+
+   p = container_of(sect_data_p, struct pseries_elog_section, sect_data);
+   return(p->length - offsetof(struct pseries_elog_section, sect_data));
+}
+
+/*
+ * Find data portion of a specific section in RTAS extended event log.
+ * Return:
+ * pointer to the section data of the specified section
+ * NULL if not found
+ */
+void *pseries_elog_find_sect_data(struct rtas_ext_event_log_v6 *v6ext,
+ size_t v6ext_len, uint16_t sect_id)
+{
+   struct pseries_elog_section *sect_p;
+   uint8_t *p, *log_end;
+
+   if ((v6ext_len < sizeof(struct rtas_ext_event_log_v6)) ||
+   (v6ext->log_format != RTAS_V6EXT_LOG_FORMAT_EVENT_LOG) ||
+   (v6ext->company_id != RTAS_V6EXT_COMPANY_ID_IBM))
+   return NULL;
+
+   log_end = (uint8_t *) v6ext + v6ext_len;
+   p = (uint8_t *) v6ext->vendor_log;
+   while (p < log_end) {
+   sect_p = (struct pseries_elog_section *) p;
+   if (sect_p->id == sect_id)
+   return sect_p->sect_data;
+   p += sect_p->length;
+   }
+
+   return NULL;
+}
+
diff --git a/arch/powerpc/platforms/pseries/pseries_event_log.h 
b/arch/powerpc/platforms/pseries/pseries_event_log.h
new file mode 100644
index 000..879f2ed
--- /dev/null
+++ b/arch/powerpc/platforms/pseries/pseries_event_log.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2010, 2011 Tseng-Hui (Frank) Lin, IBM Corporation
+ *
+ *  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.
+ */
+
+#ifndef _PSERIES_PSERIES_EVENT_LOG_H
+#define _PSERIES_PSERIES_EVENT_LOG_H
+
+#include 
+
+#include 
+
+/* Two bytes ASCII section IDs */
+#define PSERIES_ELOG_SECT_ID_PRIV_HDR  (('P' << 8) | 'H')
+#define PSERIES_ELOG_SECT_ID_USER_HDR  (('U' << 8) | 'H')
+#define PSERIES_ELOG_SECT_ID_PRIMARY_SRC   (('P' << 8) | 'S')
+#define PSERIES_ELOG_SECT_ID_EXTENDED_UH   (('E' << 8) | 'H')
+#define PSERIES_ELOG_SECT_ID_FAILING_MTMS  (('M' << 8) | 'T')
+#define PSERIES_ELOG_SECT_ID_SECONDARY_SRC (('S' << 8) | 'S')
+#define PSERIES_ELOG_SECT_ID_DUMP_LOCATOR  (('D' 

[PATCH v3 1/3] powerpc: Add IO event interrupt support

2011-03-14 Thread Tseng-Hui (Frank) Lin

This patch adds definitions of non-IBM specific v6 extended log definitions to 
rtas.h.

Change log from V2:
- rename RTAS general extended event log version 6 structure from
  rtas_error_log_v6ext to rtas_ext_event_log_v6.

Signed-off-by: Tseng-Hui (Frank) Lin 
---
 arch/powerpc/include/asm/rtas.h |   45 ++-
 1 files changed, 44 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/include/asm/rtas.h b/arch/powerpc/include/asm/rtas.h
index 9a1193e..58625d1 100644
--- a/arch/powerpc/include/asm/rtas.h
+++ b/arch/powerpc/include/asm/rtas.h
@@ -158,7 +158,50 @@ struct rtas_error_log {
unsigned long target:4; /* Target of failed operation */
unsigned long type:8;   /* General event or error*/
unsigned long extended_log_length:32;   /* length in bytes */
-   unsigned char buffer[1];
+   unsigned char buffer[1];/* Start of extended log */
+   /* Variable length.  */
+};
+
+#define RTAS_V6EXT_LOG_FORMAT_EVENT_LOG14
+
+#define RTAS_V6EXT_COMPANY_ID_IBM  (('I' << 24) | ('B' << 16) | ('M' << 8))
+
+/* RTAS general extended event log, Version 6. The extended log starts
+ * from "buffer" field of struct rtas_error_log defined above.
+ */
+struct rtas_ext_event_log_v6 {
+   /* Byte 0 */
+   uint32_t log_valid:1;   /* 1:Log valid */
+   uint32_t unrecoverable_error:1; /* 1:Unrecoverable error */
+   uint32_t recoverable_error:1;   /* 1:recoverable (correctable   */
+   /*   or successfully retried)   */
+   uint32_t degraded_operation:1;  /* 1:Unrecoverable err, bypassed*/
+   /*   - degraded operation (e.g. */
+   /*   CPU or mem taken off-line) */
+   uint32_t predictive_error:1;
+   uint32_t new_log:1; /* 1:"New" log (Always 1 for*/
+   /*   data returned from RTAS*/
+   uint32_t big_endian:1;  /* 1: Big endian */
+   uint32_t :1;/* reserved */
+   /* Byte 1 */
+   uint32_t :8;/* reserved */
+   /* Byte 2 */
+   uint32_t powerpc_format:1;  /* Set to 1 (indicating log is  */
+   /* in PowerPC format*/
+   uint32_t :3;/* reserved */
+   uint32_t log_format:4;  /* Log format indicator. Define */
+   /* format used for byte 12-2047 */
+   /* Byte 3 */
+   uint32_t :8;/* reserved */
+   /* Byte 4-11 */
+   uint8_t reserved[8];/* reserved */
+   /* Byte 12-15 */
+   uint32_t company_id;/* Company ID of the company*/
+   /* that defines the format for  */
+   /* the vendor specific log type */
+   /* Byte 16-end of log */
+   uint8_t vendor_log[1];  /* Start of vendor specific log */
+   /* Variable length. */
 };
 
 /*


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


[PATCH v3 0/3] powerpc: Add IO event interrupt support

2011-03-14 Thread Tseng-Hui (Frank) Lin

This series of patches adds support for handling IO Event interrupts which
come through at the /event-sources/ibm,io-events device tree node.

Change log from V2:

- rename RTAS general extended event log version 6 structure from
  rtas_error_log_v6ext to rtas_ext_event_log_v6.
- Re-implement interrupt call list with atomic notifier.

platforms/pseries/io_event_irq.c:
- Move IO Event data copy to ioei_interrupt(). Rename ioei_get_event()
  to ioei_find_event().
- Remove unused ioei_call_handlers(), pseries_ioei_register_handler(),
  pseries_ioei_unregister_handler() as the functions are replaced by
  notifier.

Change log from v1:
- Restructure the patch into 3 patches.
  = Move non-IBM specific v6 extended log definition to rtas.h.
  = Move IBM specific v6 extended log definition to pseries_event_log.h
and code to pseries_event_log.c.
- Add CONFIG_PSERIES_EVENT_LOG to pseries Kconfig
- Add CONFIG_IO_EVENT_IRQ to pseries Kconfig

io_events.h:
- Change C++ comments to C format.
- Add definitions for all known type, sub-types, and scopes.
- Change data type of rpc_data from u32 to u8 as the size of rpc_data is
  specified in rpc_field_len in bytes.
- Set maximum length for rpc_data.
- Change ioei_register_isr() and ioei_unregister_isr() declearation to match
  the change in io_events.c file

io_events.c:
- Use pseries_/PSERIES_ prefix for global symbols.
- Change to use list_head for ioei_consumer list.
- Remove scope from handler registeration.
- Change device_initcall() to machine_device_initcall()
- ioei_register_handler():
  = Return -ENODEV if IOEI not supported on the machine.
  = Change use spin_lock() to use spin_lock_irq().
- ioei_unregister_handler():
  = Change use spin_lock() to use spin_lock_irq().
- ioei_call_consumers():
  = Change spin_lock_irqsave() to spin_lock() because we are called from
an interrupt handler.
  = Return IRQ_HANDLED/IRQ_NONE if interrupt is handled/not handled.
  = Print an error message if no one claims the interrupt.
- io_event_interrupt():
  = Change to use rtas_data_buf and RTAS_DATA_BUF_SIZE for rtas_call().
  = Loop calling rtas_call() to pull in multiple events in one interrupt.
  = Split IO event section searching code into ioei_get_event().
- init_ioei_IRQ()
  = Check rtas_token() return code.


Signed-off-by: Mark Nelson 
Signed-off-by: Tseng-Hui (Frank) Lin 
---


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


[PATCH v5 3/3] powerpc: factoring mpic cpu id fetching into a function

2011-03-14 Thread Meador Inge
The following code snippet:

unsigned int cpu = 0;
if (mpic->flags & MPIC_PRIMARY)
cpu = hard_smp_processor_id();

is seen in several places in the 'mpic.c' code.  This changeset factors
that pattern out into a helper function called 'mpic_processor_id'.

Signed-off-by: Meador Inge 
Cc: Benjamin Herrenschmidt 
---
 arch/powerpc/sysdev/mpic.c |   31 ++-
 1 files changed, 14 insertions(+), 17 deletions(-)

diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 112bff0..bf77eb7 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -147,6 +147,16 @@ static u32 mpic_infos[][MPIC_IDX_END] = {
 
 #endif /* CONFIG_MPIC_WEIRD */
 
+static inline unsigned int mpic_processor_id(struct mpic *mpic)
+{
+   unsigned int cpu = 0;
+
+   if (mpic->flags & MPIC_PRIMARY)
+   cpu = hard_smp_processor_id();
+
+   return cpu;
+}
+
 /*
  * Register accessor functions
  */
@@ -210,19 +220,14 @@ static inline void _mpic_ipi_write(struct mpic *mpic, 
unsigned int ipi, u32 valu
 
 static inline u32 _mpic_cpu_read(struct mpic *mpic, unsigned int reg)
 {
-   unsigned int cpu = 0;
+   unsigned int cpu = mpic_processor_id(mpic);
 
-   if (mpic->flags & MPIC_PRIMARY)
-   cpu = hard_smp_processor_id();
return _mpic_read(mpic->reg_type, &mpic->cpuregs[cpu], reg);
 }
 
 static inline void _mpic_cpu_write(struct mpic *mpic, unsigned int reg, u32 
value)
 {
-   unsigned int cpu = 0;
-
-   if (mpic->flags & MPIC_PRIMARY)
-   cpu = hard_smp_processor_id();
+   unsigned int cpu = mpic_processor_id(mpic);
 
_mpic_write(mpic->reg_type, &mpic->cpuregs[cpu], reg, value);
 }
@@ -1005,13 +1010,8 @@ static int mpic_host_map(struct irq_host *h, unsigned 
int virq,
 * is done here.
 */
if (!mpic_is_ipi(mpic, hw) && (mpic->flags & MPIC_NO_RESET)) {
-   unsigned int cpu = 0;
-
-   if (mpic->flags & MPIC_PRIMARY)
-   cpu = hard_smp_processor_id();
-
mpic_set_vector(virq, hw);
-   mpic_set_destination(virq, cpu);
+   mpic_set_destination(virq, mpic_processor_id(mpic));
mpic_irq_set_priority(virq, 8);
}
 
@@ -1355,10 +1355,7 @@ void __init mpic_init(struct mpic *mpic)
 
mpic_pasemi_msi_init(mpic);
 
-   if (mpic->flags & MPIC_PRIMARY)
-   cpu = hard_smp_processor_id();
-   else
-   cpu = 0;
+   cpu = mpic_processor_id(mpic);
 
if (!(mpic->flags & MPIC_NO_RESET)) {
for (i = 0; i < mpic->num_sources; i++) {
-- 
1.6.3.3

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


[PATCH v5 2/3] powerpc: make MPIC honor the "pic-no-reset" device tree property

2011-03-14 Thread Meador Inge
This property, defined in the Open PIC binding, tells the kernel not to use
the reset bit in the global configuration register.  Additionally, its
presence mandates that only sources which are actually used (i.e. appear in
the device tree) should have their VECPRI bits initialized.

Although, "pic-no-reset" can be used for the same use cases that
"protected-sources" is covering, the "protected-sources" implementation was
left completely intact.  This is a more pragmatic approach as there are
already several existing systems which use protected sources.  If
"pic-no-reset" *and* "protected-sources" are both used, however, then
"pic-no-reset" takes precedence in terms of the init behavior and the
sanity checks done by protected sources will still take place.

Signed-off-by: Meador Inge 
Cc: Hollis Blanchard 
Cc: Benjamin Herrenschmidt 
---
 arch/powerpc/include/asm/mpic.h |4 ++
 arch/powerpc/sysdev/mpic.c  |   66 --
 2 files changed, 59 insertions(+), 11 deletions(-)

diff --git a/arch/powerpc/include/asm/mpic.h b/arch/powerpc/include/asm/mpic.h
index e000cce..1c19734 100644
--- a/arch/powerpc/include/asm/mpic.h
+++ b/arch/powerpc/include/asm/mpic.h
@@ -367,6 +367,10 @@ struct mpic
 #define MPIC_SINGLE_DEST_CPU   0x1000
 /* Enable CoreInt delivery of interrupts */
 #define MPIC_ENABLE_COREINT0x2000
+/* Disable resetting of the MPIC.
+ * NOTE: This flag trumps MPIC_WANTS_RESET.
+ */
+#define MPIC_NO_RESET  0x4000
 
 /* MPIC HW modification ID */
 #define MPIC_REGSET_MASK   0xf000
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index b0c8469..112bff0 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -906,6 +906,20 @@ void mpic_set_vector(unsigned int virq, unsigned int 
vector)
mpic_irq_write(src, MPIC_INFO(IRQ_VECTOR_PRI), vecpri);
 }
 
+void mpic_set_destination(unsigned int virq, unsigned int cpuid)
+{
+   struct mpic *mpic = mpic_from_irq(virq);
+   unsigned int src = mpic_irq_to_hw(virq);
+
+   DBG("mpic: set_destination(mpic:@%p,virq:%d,src:%d,cpuid:0x%x)\n",
+   mpic, virq, src, cpuid);
+
+   if (src >= mpic->irq_count)
+   return;
+
+   mpic_irq_write(src, MPIC_INFO(IRQ_DESTINATION), 1 << cpuid);
+}
+
 static struct irq_chip mpic_irq_chip = {
.mask   = mpic_mask_irq,
.unmask = mpic_unmask_irq,
@@ -986,6 +1000,21 @@ static int mpic_host_map(struct irq_host *h, unsigned int 
virq,
/* Set default irq type */
set_irq_type(virq, IRQ_TYPE_NONE);
 
+   /* If the MPIC was reset, then all vectors have already been
+* initialized.  Otherwise, a per source lazy initialization
+* is done here.
+*/
+   if (!mpic_is_ipi(mpic, hw) && (mpic->flags & MPIC_NO_RESET)) {
+   unsigned int cpu = 0;
+
+   if (mpic->flags & MPIC_PRIMARY)
+   cpu = hard_smp_processor_id();
+
+   mpic_set_vector(virq, hw);
+   mpic_set_destination(virq, cpu);
+   mpic_irq_set_priority(virq, 8);
+   }
+
return 0;
 }
 
@@ -1033,6 +1062,11 @@ static struct irq_host_ops mpic_host_ops = {
.xlate = mpic_host_xlate,
 };
 
+static int mpic_reset_prohibited(struct device_node *node)
+{
+   return node && of_get_property(node, "pic-no-reset", NULL);
+}
+
 /*
  * Exported functions
  */
@@ -1153,7 +1187,15 @@ struct mpic * __init mpic_alloc(struct device_node *node,
mpic_map(mpic, node, paddr, &mpic->tmregs, MPIC_INFO(TIMER_BASE), 
0x1000);
 
/* Reset */
-   if (flags & MPIC_WANTS_RESET) {
+
+   /* When using a device-node, reset requests are only honored if the MPIC
+* is allowed to reset.
+*/
+   if (mpic_reset_prohibited(node))
+   mpic->flags |= MPIC_NO_RESET;
+
+   if ((flags & MPIC_WANTS_RESET) && !(mpic->flags & MPIC_NO_RESET)) {
+   printk(KERN_DEBUG "mpic: Resetting\n");
mpic_write(mpic->gregs, MPIC_INFO(GREG_GLOBAL_CONF_0),
   mpic_read(mpic->gregs, MPIC_INFO(GREG_GLOBAL_CONF_0))
   | MPIC_GREG_GCONF_RESET);
@@ -1318,17 +1360,19 @@ void __init mpic_init(struct mpic *mpic)
else
cpu = 0;
 
-   for (i = 0; i < mpic->num_sources; i++) {
-   /* start with vector = source number, and masked */
-   u32 vecpri = MPIC_VECPRI_MASK | i |
-   (8 << MPIC_VECPRI_PRIORITY_SHIFT);
+   if (!(mpic->flags & MPIC_NO_RESET)) {
+   for (i = 0; i < mpic->num_sources; i++) {
+   /* start with vector = source number, and masked */
+   u32 vecpri = MPIC_VECPRI_MASK | i |
+   (8 << MPIC_VECPRI_PRIORITY_SHIFT);

-   /* check if protected */
-   if (mpic->protected && t

[PATCH v5 1/3] powerpc: document the Open PIC device tree binding

2011-03-14 Thread Meador Inge
This binding documents several properties that have been in use for quite
some time, and adds one new property 'pic-no-reset', which controls the
runtime initialization behavior of the PIC.  More specifically, the presence
of 'pic-no-reset' mandates that the PIC shall not be reset during runtime
initialization and that any initialization related to interrupt sources
shall be limited to sources explicitly referenced in the device tree.  This
functionality is useful in AMP systems where multiple OSes are sharing the
PIC and the reinitialization of the PIC can interfere with OSes that are
already up and running.

The interrupt specifier definition is based off of Stuart Yoder's FSL MPIC
binding.

Signed-off-by: Meador Inge 
Cc: Grant Likely 
Cc: Stuart Yoder 
Cc: Hollis Blanchard 
---
 Documentation/devicetree/bindings/open-pic.txt |   98 
 1 files changed, 98 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/open-pic.txt

diff --git a/Documentation/devicetree/bindings/open-pic.txt 
b/Documentation/devicetree/bindings/open-pic.txt
new file mode 100644
index 000..909a902
--- /dev/null
+++ b/Documentation/devicetree/bindings/open-pic.txt
@@ -0,0 +1,98 @@
+* Open PIC Binding
+
+This binding specifies what properties must be available in the device tree
+representation of an Open PIC compliant interrupt controller.  This binding is
+based on the binding defined for Open PIC in [1] and is a superset of that
+binding.
+
+Required properties:
+
+  NOTE: Many of these descriptions were paraphrased here from [1] to aid
+readability.
+
+- compatible: Specifies the compatibility list for the PIC.  The type
+  shall be  and the value shall include "open-pic".
+
+- reg: Specifies the base physical address(s) and size(s) of this
+  PIC's addressable register space.  The type shall be 
.
+
+- interrupt-controller: The presence of this property identifies the node
+  as an Open PIC.  No property value shall be defined.
+
+- #interrupt-cells: Specifies the number of cells needed to encode an
+  interrupt source.  The type shall be a  and the value shall be 2.
+
+- #address-cells: Specifies the number of cells needed to encode an
+  address.  The type shall be  and the value shall be 0.  As such,
+  'interrupt-map' nodes do not have to specify a parent unit address.
+
+Optional properties:
+
+- pic-no-reset: The presence of this property indicates that the PIC
+  shall not be reset during runtime initialization.  No property value 
shall
+  be defined.  The presence of this property also mandates that any
+  initialization related to interrupt sources shall be limited to sources
+  explicitly referenced in the device tree.
+
+* Interrupt Specifier Definition
+
+  Interrupt specifiers consists of 2 cells encoded as
+  follows:
+
+- <1st-cell>: The interrupt-number that identifies the interrupt source.
+
+- <2nd-cell>: The level-sense information, encoded as follows:
+0 = low-to-high edge triggered
+1 = active low level-sensitive
+2 = active high level-sensitive
+3 = high-to-low edge triggered
+
+* Examples
+
+Example 1:
+
+   /*
+* An Open PIC interrupt controller
+*/
+   mpic: pic@4 {
+   // This is an interrupt controller node.
+   interrupt-controller;
+
+   // No address cells so that 'interrupt-map' nodes which 
reference
+   // this Open PIC node do not need a parent address specifier.
+   #address-cells = <0>;
+
+   // Two cells to encode interrupt sources.
+   #interrupt-cells = <2>;
+
+   // Offset address of 0x4 and size of 0x4.
+   reg = <0x4 0x4>;
+
+   // Compatible with Open PIC.
+   compatible = "open-pic";
+
+   // The PIC shall not be reset.
+   pic-no-reset;
+   };
+
+Example 2:
+
+   /*
+* An interrupt generating device that is wired to an Open PIC.
+*/
+   serial0: serial@4500 {
+   // Interrupt source '42' that is active high level-sensitive.
+   // Note that there are only two cells as specified in the 
interrupt
+   // parent's '#interrupt-cells' property.
+   interrupts = <42 2>;
+
+   // The interrupt controller that this device is wired to.
+   interrupt-parent = <&mpic>;
+   };
+
+* References
+
+[1] Power.org (TM) Standard for Embedded Power Architecture (TM) Platform
+Requirements (ePAPR), Version 1.0, July 2008.
+(http://www.power.org/resources/downloads/Power_ePAPR_APPROVED_v1.0.pdf)
+
-- 
1.6.3.3

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


[PATCH v5 0/3] powerpc: Open PIC binding and "pic-no-reset"

2011-03-14 Thread Meador Inge
This patch set provides a binding for Open PIC and implements support for
a new property, specified by that binding, called "pic-no-reset".

v5 - Moved the Open PIC binding to its rightful home of
 ".../Documentation/devicetree/bindings/".  Also, fixed up
 the lazy reset code to take better advantage of existing
 functions.  Finally, did some minor refactoring to put
 cpu id fetching in its own helper function.

v4 - Per Ben's feedback the protected sources implementation was left
 completely intact.  As such, the DTS cleanup and "protected-sources"
 removal patches were dropped.

v3 - the Open PIC binding was changed to be more consistent with existing
 bindings, several DTS files were cleaned up, "no-reset" was changed to
 "pic-no-reset", and a check to treat "protected-sources" as a synonym for
 "pic-no-reset" was added.

Signed-off-by: Meador Inge 
Cc: Benjamin Herrenschmidt 
Cc: Hollis Blanchard 

Meador Inge (3):
  powerpc: document the Open PIC device tree binding
  powerpc: make MPIC honor the "pic-no-reset" device tree property
  powerpc: factoring mpic cpu id fetching into a function

 Documentation/devicetree/bindings/open-pic.txt |   98 
 arch/powerpc/include/asm/mpic.h|4 +
 arch/powerpc/sysdev/mpic.c |   85 +++-
 3 files changed, 165 insertions(+), 22 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/open-pic.txt

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


Re: [PATCH] powerpc: Add pgprot_writecombine

2011-03-14 Thread Steve Wise


On 03/14/2011 01:33 PM, Nishanth Aravamudan wrote:

On 01.03.2011 [17:00:47 +1100], Anton Blanchard wrote:

A number of drivers are using pgprot_writecombine() to enable write
combining on userspace mappings. Implement it on powerpc.

Given this patch, should drivers/infiniband/hw/cxgb4/t4.h

be updated?:



Yes.


static inline pgprot_t t4_pgprot_wc(pgprot_t prot)
{
#if defined(__i386__) || defined(__x86_64__)
 return pgprot_writecombine(prot);
#elif defined(CONFIG_PPC64)
 return __pgprot((pgprot_val(prot) | _PAGE_NO_CACHE)&
 ~(pgprot_t)_PAGE_GUARDED);
#else
 return pgprot_noncached(prot);
#endif
}

Thanks,
Nish


Signed-off-by: Anton Blanchard
---

diff --git a/arch/powerpc/include/asm/pgtable.h 
b/arch/powerpc/include/asm/pgtable.h
index 89f1587..88b0bd9 100644
--- a/arch/powerpc/include/asm/pgtable.h
+++ b/arch/powerpc/include/asm/pgtable.h
@@ -170,6 +170,7 @@ extern int ptep_set_access_flags(struct vm_area_struct 
*vma, unsigned long addre
  #define pgprot_cached_wthru(prot) (__pgprot((pgprot_val(prot)&  
~_PAGE_CACHE_CTL) | \
_PAGE_COHERENT | _PAGE_WRITETHRU))

+#define pgprot_writecombine pgprot_noncached_wc

  struct file;
  extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
___
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


[RFC][PATCH v2 23/23] __vmalloc: add gfp flags variant of pte, pmd, and pud allocation

2011-03-14 Thread Prasad Joshi
__vmalloc: propagating GFP allocation flag.

- Added __map_vm_area, __vmap_page_range, __vmap_page_range_noflush
to accept the gfp_t allocation flag
- Added pud_alloc_with_mask(), similar to pud_alloc(), but also
accepts allocation flag
- Added pmd_alloc_with_mask
- Added pte_alloc_kernel_with_mask
- Modified __pte_alloc_kernel to accept allocation flag
- Every architecture has to add a function
__pte_alloc_one_kernel(struct mm_struct*, unsigned long, gfp_t)
- Modified __pmd_alloc to accept the allocation flag
- Every architecture has to add a function __pmd_alloc_one(struct
mm_struct *, unsigned long, gfp_t)
- Changed __pud_alloc to accepts gfp allocation flag
- Every architecture that uses pud has to add a function
__pud_alloc_one(struct mm_struct *, unsigned long, gfp_t)
- fixes the Bug 30702 (__vmalloc(GFP_NOFS) can callback file system
  evict_inode).

Signed-off-by: Anand Mitra 
Signed-off-by: Prasad Joshi 
---
Chnagelog:
include/linux/mm.h |   40 +++-
mm/memory.c|   14 +++-
mm/vmalloc.c   |   57 ++-
3 files changed, 76 insertions(+), 35 deletions(-)
---
diff --git a/include/linux/mm.h b/include/linux/mm.h
index f6385fc..5ff89df 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1156,44 +1156,60 @@ static inline pte_t *get_locked_pte(struct
mm_struct *mm, unsigned long addr,

 #ifdef __PAGETABLE_PUD_FOLDED
 static inline int __pud_alloc(struct mm_struct *mm, pgd_t *pgd,
-   unsigned long address)
+   unsigned long address, gfp_t 
gfp_mask)
 {
return 0;
 }
 #else
-int __pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address);
+int __pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address,
+   gfp_t gfp_mask);
 #endif

 #ifdef __PAGETABLE_PMD_FOLDED
 static inline int __pmd_alloc(struct mm_struct *mm, pud_t *pud,
-   unsigned long address)
+   unsigned long address, gfp_t 
gfp_mask)
 {
return 0;
 }
 #else
-int __pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address);
+int __pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address,
+   gfp_t gfp_mask);
 #endif

 int __pte_alloc(struct mm_struct *mm, struct vm_area_struct *vma,
pmd_t *pmd, unsigned long address);
-int __pte_alloc_kernel(pmd_t *pmd, unsigned long address);
+int __pte_alloc_kernel(pmd_t *pmd, unsigned long address, gfp_t gfp_mask);

 /*
  * The following ifdef needed to get the 4level-fixup.h header to work.
  * Remove it when 4level-fixup.h has been removed.
  */
 #if defined(CONFIG_MMU) && !defined(__ARCH_HAS_4LEVEL_HACK)
-static inline pud_t *pud_alloc(struct mm_struct *mm, pgd_t *pgd,
unsigned long address)
+static inline pud_t *pud_alloc_with_mask(struct mm_struct *mm, pgd_t *pgd,
+   unsigned long address, gfp_t gfp_mask)
 {
-   return (unlikely(pgd_none(*pgd)) && __pud_alloc(mm, pgd, address))?
+   return (unlikely(pgd_none(*pgd)) && __pud_alloc(mm, pgd, address, 
gfp_mask))?
NULL: pud_offset(pgd, address);
 }

-static inline pmd_t *pmd_alloc(struct mm_struct *mm, pud_t *pud,
unsigned long address)
+static inline pud_t *pud_alloc(struct mm_struct *mm, pgd_t *pgd,
+   unsigned long address)
 {
-   return (unlikely(pud_none(*pud)) && __pmd_alloc(mm, pud, address))?
+   return pud_alloc_with_mask(mm, pgd, address, GFP_KERNEL);
+}
+
+static inline pmd_t *pmd_alloc_with_mask(struct mm_struct *mm, pud_t *pud,
+   unsigned long address, gfp_t gfp_mask)
+{
+   return (unlikely(pud_none(*pud)) && __pmd_alloc(mm, pud, address, 
gfp_mask))?
NULL: pmd_offset(pud, address);
 }
+
+static inline pmd_t *pmd_alloc(struct mm_struct *mm, pud_t *pud,
+   unsigned long address)
+{
+   return pmd_alloc_with_mask(mm, pud, address, GFP_KERNEL);
+}
 #endif /* CONFIG_MMU && !__ARCH_HAS_4LEVEL_HACK */

 #if USE_SPLIT_PTLOCKS
@@ -1254,8 +1270,12 @@ static inline void pgtable_page_dtor(struct page *page)
pmd, address))? \
NULL: pte_offset_map_lock(mm, pmd, address, ptlp))

+#define pte_alloc_kernel_with_mask(pmd, address, mask) \
+   ((unlikely(pmd_none(*(pmd))) && __pte_alloc_kernel(pmd, address, 
mask))? \
+   NULL: pte_offset_kernel(pmd, address))
+
 #define pte_alloc_kernel(pmd, address) \
-   ((unlikely(pmd_none(*(pmd))) && __pte_alloc_kernel(pmd, address))? \
+   ((unlikely(pmd_none(*(pmd))) && __pte_alloc_kernel(pmd, address,
GFP_KERNEL))? \
NULL: pte_offset_kernel(pmd, address))

 extern void free_area_init(unsigned long * zones_size);
diff --git a/mm/memory.c b/mm/memory.c
index 5823698..dc4964e 100644
--- a/mm/memory.c
+++ b/mm/mem

[RFC][PATCH v2 13/23] (powerpc) __vmalloc: add gfp flags variant of pte, pmd, and pud allocation

2011-03-14 Thread Prasad Joshi
__vmalloc: propagating GFP allocation flag.

- adds functions to allow caller to pass the GFP flag for memory allocation
- helps in fixing the Bug 30702 (__vmalloc(GFP_NOFS) can callback
  file system evict_inode).

Signed-off-by: Anand Mitra 
Signed-off-by: Prasad Joshi 
---
Chnagelog:
arch/powerpc/include/asm/pgalloc-32.h |2 ++
arch/powerpc/include/asm/pgalloc-64.h |   27 ++-
arch/powerpc/mm/pgtable_32.c  |   10 --
3 files changed, 32 insertions(+), 7 deletions(-)
---
diff --git a/arch/powerpc/include/asm/pgalloc-32.h
b/arch/powerpc/include/asm/pgalloc-32.h
index 580cf73..21b7a94 100644
--- a/arch/powerpc/include/asm/pgalloc-32.h
+++ b/arch/powerpc/include/asm/pgalloc-32.h
@@ -35,6 +35,8 @@ extern void pgd_free(struct mm_struct *mm, pgd_t *pgd);
 #endif

 extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr);
+extern pte_t *__pte_alloc_one_kernel(struct mm_struct *, unsigned long, gfp_t);
+
 extern pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long addr);

 static inline void pgtable_free(void *table, unsigned index_size)
diff --git a/arch/powerpc/include/asm/pgalloc-64.h
b/arch/powerpc/include/asm/pgalloc-64.h
index 292725c..e5ea650 100644
--- a/arch/powerpc/include/asm/pgalloc-64.h
+++ b/arch/powerpc/include/asm/pgalloc-64.h
@@ -51,10 +51,15 @@ static inline void pgd_free(struct mm_struct *mm,
pgd_t *pgd)

 #define pgd_populate(MM, PGD, PUD) pgd_set(PGD, PUD)

+static inline pud_t *
+__pud_alloc_one(struct mm_struct *mm, unsigned long addr, gfp_t gfp_mask)
+{
+   return kmem_cache_alloc(PGT_CACHE(PUD_INDEX_SIZE), gfp_mask);
+}
+
 static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr)
 {
-   return kmem_cache_alloc(PGT_CACHE(PUD_INDEX_SIZE),
-   GFP_KERNEL|__GFP_REPEAT);
+   return __pud_alloc_one(mm, addr, GFP_KERNEL | __GFP_REPEAT);
 }

 static inline void pud_free(struct mm_struct *mm, pud_t *pud)
@@ -89,10 +94,15 @@ static inline void pmd_populate_kernel(struct
mm_struct *mm, pmd_t *pmd,

 #endif /* CONFIG_PPC_64K_PAGES */

+static inline pmd_t *
+__pmd_alloc_one(struct mm_struct *mm, unsigned long addr, gfp_t gfp_mask)
+{
+   return kmem_cache_alloc(PGT_CACHE(PMD_INDEX_SIZE), gfp_mask);
+}
+
 static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
 {
-   return kmem_cache_alloc(PGT_CACHE(PMD_INDEX_SIZE),
-   GFP_KERNEL|__GFP_REPEAT);
+   return __pmd_alloc_one(mm, addr, GFP_KERNEL | __GFP_REPEAT);
 }

 static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
@@ -100,10 +110,17 @@ static inline void pmd_free(struct mm_struct
*mm, pmd_t *pmd)
kmem_cache_free(PGT_CACHE(PMD_INDEX_SIZE), pmd);
 }

+static inline pte_t *
+__pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address,
+   gfp_t gfp_mask)
+{
+return (pte_t *)__get_free_page(gfp_mask | __GFP_ZERO);
+}
+
 static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
  unsigned long address)
 {
-return (pte_t *)__get_free_page(GFP_KERNEL | __GFP_REPEAT |
__GFP_ZERO);
+   return __pte_alloc_one_kernel(mm, address, GFP_KERNEL | __GFP_REPEAT);
 }

 static inline pgtable_t pte_alloc_one(struct mm_struct *mm,
diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c
index 8dc41c0..736593f 100644
--- a/arch/powerpc/mm/pgtable_32.c
+++ b/arch/powerpc/mm/pgtable_32.c
@@ -95,14 +95,15 @@ void pgd_free(struct mm_struct *mm, pgd_t *pgd)
 #endif
 }

-__init_refok pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
unsigned long address)
+__init_refok pte_t *
+__pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address,
gfp_t gfp_mask)
 {
pte_t *pte;
extern int mem_init_done;
extern void *early_get_page(void);

if (mem_init_done) {
-   pte = (pte_t 
*)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
+   pte = (pte_t *)__get_free_page(gfp_mask | __GFP_ZERO);
} else {
pte = (pte_t *)early_get_page();
if (pte)
@@ -111,6 +112,11 @@ __init_refok pte_t *pte_alloc_one_kernel(struct
mm_struct *mm, unsigned long add
return pte;
 }

+__init_refok pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
unsigned long address)
+{
+   return __pte_alloc_one_kernel(mm, address, GFP_KERNEL | __GFP_REPEAT);
+}
+
 pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address)
 {
struct page *ptepage;
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[RFC][PATCH v2 00/23] __vmalloc: Propagating GFP allocation flag inside __vmalloc().

2011-03-14 Thread Prasad Joshi
A filesystem might run into a problem while calling
__vmalloc(GFP_NOFS) inside a lock.

It is expected than __vmalloc when called with GFP_NOFS should not
callback the filesystem code even incase of the increased memory
pressure. But the problem is that even if we pass this flag, __vmalloc
itself allocates memory with GFP_KERNEL.

Using GFP_KERNEL allocations may go into the memory reclaim path and
try to free memory by calling file system evict_inode function. Which
might lead into deadlock.

For further details
http://marc.info/?l=linux-mm&m=128942194520631&w=4
https://bugzilla.kernel.org/show_bug.cgi?id=30702

The patch passes the gfp allocation flag all the way down to those
allocating functions.

 arch/alpha/include/asm/pgalloc.h |   18 +++--
 arch/arm/include/asm/pgalloc.h   |   11 +-
 arch/avr32/include/asm/pgalloc.h |8 -
 arch/cris/include/asm/pgalloc.h  |   10 -
 arch/frv/include/asm/pgalloc.h   |3 ++
 arch/frv/include/asm/pgtable.h   |1 +
 arch/frv/mm/pgalloc.c|9 -
 arch/ia64/include/asm/pgalloc.h  |   24 +++--
 arch/m32r/include/asm/pgalloc.h  |   11 --
 arch/m68k/include/asm/motorola_pgalloc.h |   20 +--
 arch/m68k/include/asm/sun3_pgalloc.h |   14 ++--
 arch/m68k/mm/memory.c|9 -
 arch/microblaze/include/asm/pgalloc.h|3 ++
 arch/microblaze/mm/pgtable.c |   13 +--
 arch/mips/include/asm/pgalloc.h  |   22 
 arch/mn10300/include/asm/pgalloc.h   |2 +
 arch/mn10300/mm/pgtable.c|   10 -
 arch/parisc/include/asm/pgalloc.h|   21 ---
 arch/powerpc/include/asm/pgalloc-32.h|2 +
 arch/powerpc/include/asm/pgalloc-64.h|   27 +++---
 arch/powerpc/mm/pgtable_32.c |   10 -
 arch/s390/include/asm/pgalloc.h  |   30 +---
 arch/s390/mm/pgtable.c   |   22 +---
 arch/score/include/asm/pgalloc.h |   13 ---
 arch/sh/include/asm/pgalloc.h|8 -
 arch/sh/mm/pgtable.c |8 -
 arch/sparc/include/asm/pgalloc_32.h  |5 +++
 arch/sparc/include/asm/pgalloc_64.h  |   17 -
 arch/tile/include/asm/pgalloc.h  |   13 ++-
 arch/tile/mm/pgtable.c   |   10 -
 arch/um/include/asm/pgalloc.h|1 +
 arch/um/kernel/mem.c |   21 ---
 arch/x86/include/asm/pgalloc.h   |   17 -
 arch/x86/mm/pgtable.c|8 -
 arch/xtensa/include/asm/pgalloc.h|9 -
 arch/xtensa/mm/pgtable.c |   11 +-
 include/asm-generic/4level-fixup.h   |8 +++-
 include/asm-generic/pgtable-nopmd.h  |3 +-
 include/asm-generic/pgtable-nopud.h  |1 +
 include/linux/mm.h   |   40 -
 mm/memory.c  |   14 ---
 mm/vmalloc.c |   57 --
 42 files changed, 441 insertions(+), 123 deletions(-)
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH] powerpc: Add pgprot_writecombine

2011-03-14 Thread Nishanth Aravamudan
On 01.03.2011 [17:00:47 +1100], Anton Blanchard wrote:
> 
> A number of drivers are using pgprot_writecombine() to enable write
> combining on userspace mappings. Implement it on powerpc.

Given this patch, should drivers/infiniband/hw/cxgb4/t4.h

be updated?:

static inline pgprot_t t4_pgprot_wc(pgprot_t prot)
{
#if defined(__i386__) || defined(__x86_64__)
return pgprot_writecombine(prot);
#elif defined(CONFIG_PPC64)
return __pgprot((pgprot_val(prot) | _PAGE_NO_CACHE) &
~(pgprot_t)_PAGE_GUARDED);
#else
return pgprot_noncached(prot);
#endif
}

Thanks,
Nish

> Signed-off-by: Anton Blanchard 
> ---
> 
> diff --git a/arch/powerpc/include/asm/pgtable.h 
> b/arch/powerpc/include/asm/pgtable.h
> index 89f1587..88b0bd9 100644
> --- a/arch/powerpc/include/asm/pgtable.h
> +++ b/arch/powerpc/include/asm/pgtable.h
> @@ -170,6 +170,7 @@ extern int ptep_set_access_flags(struct vm_area_struct 
> *vma, unsigned long addre
>  #define pgprot_cached_wthru(prot) (__pgprot((pgprot_val(prot) & 
> ~_PAGE_CACHE_CTL) | \
>   _PAGE_COHERENT | _PAGE_WRITETHRU))
> 
> +#define pgprot_writecombine pgprot_noncached_wc
> 
>  struct file;
>  extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
> ___
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev

-- 
Nishanth Aravamudan 
IBM Linux Technology Center
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 1/2] kdump: Allow shrinking of kdump region to be overridden

2011-03-14 Thread Mahesh J Salgaonkar
On Wed, Mar 09, 2011 at 10:21:08PM +0800, Américo Wang wrote:
> On Wed, Mar 09, 2011 at 11:46:57PM +1100, Anton Blanchard wrote:
> >
> >Hi,
> >
> >> The crashkernel region is specified via kernel cmdline, so why
> >> not just drop a failure when it overlaps with RMO region?
> >> Am I missing something?
> >
> >Unfortunately a ppc64 kernel requires a chunk of RMO memory. We would
> >need the ability to specify multiple crashkernel regions - about 32MB
> >in the RMO and the rest can be anywhere. That sounds pretty fragile for
> >a user to configure successfully on the cmdline.
> >
> >Thats why the ppc64 crashkernel region begins mid way through the RMO
> >region. It means both kernels get a chunk of RMO and we only have to
> >deal with one crashkernel reservation in all the tools and
> >documentation.
> >
> 
> So, when I specify 128M in cmdline, 32M of them are RMO, and the
> rest 96M are normal memory? And when I want to free all of them,
> actually the 32M RMO will never be freed?

In ppc64 implementation the crashkernel region begins mid way through
the RMO and spans across into the normal memory. For e.g. on power system
with 128M RMO size, when user specifies 128M in cmdline, the crashkernel
starts from default offset 64M through 192M. Which means 64M in RMO region
and rest beyond RMO.

 <---RMO--->
 <---rtas-->
064M   128M End
|=|=|===||
   Crash_start|<128M--->| Crash End

During free we do free all of them including RMO region. But since the rtas
region is always on top of RMO, crashkernel memory overlaps rtas region and
we endup freeing that even, which is causing the crash.

> 
> 
> ___
> kexec mailing list
> ke...@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec

-- 
Signed-off-by: Mahesh Salgaonkar 
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: fsl_udc_core not initializing properly?

2011-03-14 Thread Matthew L. Creech
On Sat, Mar 12, 2011 at 3:00 AM, Anatolij Gustschin  wrote:
>
> Can you please apply the attached patch, then build with your
> linux.config and send me the kernel boot log? It will help to
> fix the issue.
>

Actually, this kernel seems to work:

...
Freescale PowerQUICC MII Bus: probed
tun: Universal TUN/TAP device driver, 1.6
tun: (C) 1999-2004 Max Krasnyansky 
fsl_usb2_mph_dr_of_probe
Freescale High-Speed USB SOC Device Controller driver (Apr 20, 2007)
fsl_udc_probe
g_ether gadget: using random self ethernet address
...

Oddly enough, the kernel I tried last week did the same thing (I
hard-coded "obj-y += usb/host/" into drivers/Makefile), but I had a
printk() at the top of fsl_udc_probe() that never got called.

Oh, I see the difference now: you added the usb/host/ entry before
usb/gadget/, while I added it afterward...  I forgot that link order
determines initialization order in the kernel.

Anyway, seems to work fine.  :)  Thanks Antolij!

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


Re: any chance to use a modern linux kernel on Pegasos1 G3 ?

2011-03-14 Thread nello martuscielli
On Sat, Mar 12, 2011 at 8:38 PM, kevin diggs  wrote:
> Hi,
>
> For what it is worth, I can boot 2.6.36 on a PowerMac 8600 with a
> 750GX processor in it. I have to compile the kernel with gcc 4.1.2.
> Figuring out why 4.3.5 won't work is ... a work in progress (maybe an
> exorcism will help?).
>

hi Kevin,
thanks for your suggestion. I just tried but it doesn't work for me.
I've the same freeze also compiling with the old gcc-4.1.2.


Nel
--
Power Mac G4 AGP 450MHz - CRUX PPC (32bit) 2.7
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH] langwell_gpio: fix CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED build

2011-03-14 Thread Lennert Buytenhek
When CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED is defined, struct irq_desc
no longer contains a ->chip member pointing to the corresponding struct
irq_chip, leading to the following build error:

drivers/gpio/langwell_gpio.c: In function 'lnw_irq_handler':
drivers/gpio/langwell_gpio.c:210: error: 'struct irq_desc' has no 
member named 'chip'
drivers/gpio/langwell_gpio.c:211: error: 'struct irq_desc' has no 
member named 'chip'

Fix this up by using get_irq_desc_chip(desc) to get the irq_chip,
instead of trying to get it via desc->chip directly.

Reported-by: Stephen Rothwell 
Signed-off-by: Lennert Buytenhek 

diff --git a/drivers/gpio/langwell_gpio.c b/drivers/gpio/langwell_gpio.c
index 54d70a4..56eb66a 100644
--- a/drivers/gpio/langwell_gpio.c
+++ b/drivers/gpio/langwell_gpio.c
@@ -191,6 +191,7 @@ static void lnw_irq_handler(unsigned irq, struct irq_desc 
*desc)
u32 base, gpio;
void __iomem *gedr;
u32 gedr_v;
+   struct irq_chip *chip;
 
/* check GPIO controller to check which pin triggered the interrupt */
for (base = 0; base < lnw->chip.ngpio; base += 32) {
@@ -207,8 +208,9 @@ static void lnw_irq_handler(unsigned irq, struct irq_desc 
*desc)
writel(gedr_v, gedr);
}
 
-   if (desc->chip->irq_eoi)
-   desc->chip->irq_eoi(irq_get_irq_data(irq));
+   chip = get_irq_desc_chip(desc);
+   if (chip->irq_eoi)
+   chip->irq_eoi(irq_get_irq_data(irq));
else
dev_warn(lnw->chip.dev, "missing EOI handler for irq %d\n", 
irq);
 
---
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


RE: [PATCH][v3] driver/FSL SATA:Fix wrong Device Error Register usage

2011-03-14 Thread Kushwaha Prabhakar-B32579
Hi Jeff,

I am not finding any new comments on this.

Could you please ACK this patch so that it can be applied on external list. 

--Prabhakar


> -Original Message-
> From: Kushwaha Prabhakar-B32579
> Sent: Wednesday, March 09, 2011 12:47 PM
> To: linux-...@vger.kernel.org
> Cc: linuxppc-dev@lists.ozlabs.org; jgar...@pobox.com;
> meet2pra...@gmail.com; Kushwaha Prabhakar-B32579; Kalra Ashish-B00888
> Subject: [PATCH][v3] driver/FSL SATA:Fix wrong Device Error Register
> usage
> 
> When a single device error is detected, the device under the error is
> indicated by the error bit set in the DER. There is a one to one mapping
> between register bit and devices on Port multiplier(PMP) i.e. bit 0
> represents PMP device 0 and bit 1 represents PMP device 1 etc.
> 
> Current implementation treats Device error register value as device
> number not set of bits representing multiple device on PMP. It is changed
> to consider bit level.
> No need to check for each set bit as all command is going to be aborted.
> 
> Signed-off-by: Ashish Kalra 
> Signed-off-by: Prabhakar Kushwaha 
> ---
> 
>  git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
> (branch master)
> 
>  This patch is already gone through review of linuxppc-dev mail list.
>  Making CC linuxppc-dev@lists.ozlabs.org
> 
>  Changes for v2: Incorporated Sergei Shtylyov's comment
>   - Put space after -
>   - added a line
>  Changes for v3: Incorporated David Laight's comment
>   - Condition check for dereg 0 for hardware error
> 
>  drivers/ata/sata_fsl.c |7 +--
>  1 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c index
> b0214d0..ad84ddc 100644
> --- a/drivers/ata/sata_fsl.c
> +++ b/drivers/ata/sata_fsl.c
> @@ -1040,12 +1040,15 @@ static void sata_fsl_error_intr(struct ata_port
> *ap)
> 
>   /* find out the offending link and qc */
>   if (ap->nr_pmp_links) {
> + unsigned int dev_num;
> +
>   dereg = ioread32(hcr_base + DE);
>   iowrite32(dereg, hcr_base + DE);
>   iowrite32(cereg, hcr_base + CE);
> 
> - if (dereg < ap->nr_pmp_links) {
> - link = &ap->pmp_link[dereg];
> + dev_num = ffs(dereg) - 1;
> + if (dev_num < ap->nr_pmp_links && dereg != 0) {
> + link = &ap->pmp_link[dev_num];
>   ehi = &link->eh_info;
>   qc = ata_qc_from_tag(ap, link->active_tag);
>   /*
> --
> 1.7.3


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


Re: linux-next: build failure after merge of the final tree (block tree related)

2011-03-14 Thread Lars Ellenberg
On Fri, Mar 11, 2011 at 08:12:38AM +0100, Jens Axboe wrote:
> On 2011-03-11 07:58, Stephen Rothwell wrote:
> > Hi all,
> > 
> > After merging the final tree, today's linux-next build (powerpc
> > allyesconfig) failed like this:
> > 
> > drivers/char/tpm/tpm_tis.c:96: warning: 'is_itpm' defined but not used
> > drivers/block/drbd/drbd_bitmap.c: In function '__bm_change_bits_to':
> > drivers/block/drbd/drbd_bitmap.c:1287: error: implicit declaration of 
> > function 'generic___test_and_set_le_bit'
> > drivers/block/drbd/drbd_bitmap.c:1289: error: implicit declaration of 
> > function 'generic___test_and_clear_le_bit'
> > drivers/block/drbd/drbd_bitmap.c: In function 'drbd_bm_test_bit':
> > drivers/block/drbd/drbd_bitmap.c:1438: error: implicit declaration of 
> > function 'generic_test_le_bit'
> > 
> > Caused by commit 4b0715f09655 ("drbd: allow petabyte storage on 64bit
> > arch").
> > 
> > I have applied this patch for today (surely there is a better way):
> 
> Thanks for not dropping it, I'll let the drbd guys send in a proper fix
> and get it committed.

Should that be fixed by adding
#include 
to 
arch/powerpc/include/asm/bitops.h
(and arch/s390/include/asm/bitops.h, possibly others?)

Or are we expected to include that ourselves, directly?

We probably need to select CONFIG_GENERIC_FIND_NEXT_BIT
from our Kconfig as well?

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


linux-next: build failure after merge of the final tree (powerpc tree related)

2011-03-14 Thread Stephen Rothwell
Hi all,

After merging the final tree, today's linux-next build (powerpc
allyesconfig) failed like this:

drivers/gpio/langwell_gpio.c: In function 'lnw_irq_handler':
drivers/gpio/langwell_gpio.c:210: error: 'struct irq_desc' has no member named 
'chip'
drivers/gpio/langwell_gpio.c:211: error: 'struct irq_desc' has no member named 
'chip'

Caused by commit 17b9f9e2653a ("powerpc: Enable
GENERIC_HARDIRQS_NO_DEPRECATED") enabling
CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED for powerpc without previously
fixing up the above driver.

I have reverted that commit for today.
-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/


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

Re: [PATCH][v3] driver/FSL SATA:Fix wrong Device Error Register usage

2011-03-14 Thread Jeff Garzik

On 03/09/2011 02:17 AM, Prabhakar Kushwaha wrote:

When a single device error is detected, the device under the error is indicated
by the error bit set in the DER. There is a one to one mapping between register
bit and devices on Port multiplier(PMP) i.e. bit 0 represents PMP device 0 and
bit 1 represents PMP device 1 etc.

Current implementation treats Device error register value as device number not
set of bits representing multiple device on PMP. It is changed to consider bit
level.
No need to check for each set bit as all command is going to be aborted.

Signed-off-by: Ashish Kalra
Signed-off-by: Prabhakar Kushwaha
---

  git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git (branch 
master)

  This patch is already gone through review of linuxppc-dev mail list.
  Making CC linuxppc-dev@lists.ozlabs.org

  Changes for v2: Incorporated Sergei Shtylyov's comment
- Put space after -
- added a line
  Changes for v3: Incorporated David Laight's comment
- Condition check for dereg 0 for hardware error

  drivers/ata/sata_fsl.c |7 +--
  1 files changed, 5 insertions(+), 2 deletions(-)


applied


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