linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] powerpc/mpic_msgr: fix compile error when SMP disabled
@ 2012-04-16  2:05 Mingkai Hu
  2012-04-16  2:05 ` [PATCH 2/4] powerpc/mpic_msgr: add lock for MPIC message global variable Mingkai Hu
  2012-04-19 20:15 ` [PATCH 1/4] powerpc/mpic_msgr: fix compile error when SMP disabled Kumar Gala
  0 siblings, 2 replies; 8+ messages in thread
From: Mingkai Hu @ 2012-04-16  2:05 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Mingkai Hu

In file included from arch/powerpc/sysdev/mpic_msgr.c:20:0:
~/arch/powerpc/include/asm/mpic_msgr.h: In function 'mpic_msgr_set_destination':
~/arch/powerpc/include/asm/mpic_msgr.h:117:2:
error: implicit declaration of function 'get_hard_smp_processor_id'
make[1]: *** [arch/powerpc/sysdev/mpic_msgr.o] Error 1

Signed-off-by: Mingkai Hu <Mingkai.hu@freescale.com>
---
 arch/powerpc/include/asm/mpic_msgr.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/include/asm/mpic_msgr.h b/arch/powerpc/include/asm/mpic_msgr.h
index 3ec37dc..326d33c 100644
--- a/arch/powerpc/include/asm/mpic_msgr.h
+++ b/arch/powerpc/include/asm/mpic_msgr.h
@@ -13,6 +13,7 @@
 
 #include <linux/types.h>
 #include <linux/spinlock.h>
+#include <asm/smp.h>
 
 struct mpic_msgr {
 	u32 __iomem *base;
-- 
1.7.5.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/4] powerpc/mpic_msgr: add lock for MPIC message global variable
  2012-04-16  2:05 [PATCH 1/4] powerpc/mpic_msgr: fix compile error when SMP disabled Mingkai Hu
@ 2012-04-16  2:05 ` Mingkai Hu
  2012-04-16  2:05   ` [PATCH 3/4] powerpc/mpic_msgr: fix offset error when setting mer register Mingkai Hu
  2012-04-19 20:15   ` [PATCH 2/4] powerpc/mpic_msgr: add lock for MPIC message global variable Kumar Gala
  2012-04-19 20:15 ` [PATCH 1/4] powerpc/mpic_msgr: fix compile error when SMP disabled Kumar Gala
  1 sibling, 2 replies; 8+ messages in thread
From: Mingkai Hu @ 2012-04-16  2:05 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Mingkai Hu

Also fix issue of accessing invalid msgr pointer issue. The local
msgr pointer in fucntion mpic_msgr_get will be accessed before
getting a valid address which will cause kernel crash.

Signed-off-by: Mingkai Hu <Mingkai.hu@freescale.com>
---
 arch/powerpc/sysdev/mpic_msgr.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/sysdev/mpic_msgr.c b/arch/powerpc/sysdev/mpic_msgr.c
index 6e7fa38..dc1cfe3 100644
--- a/arch/powerpc/sysdev/mpic_msgr.c
+++ b/arch/powerpc/sysdev/mpic_msgr.c
@@ -27,6 +27,7 @@
 
 static struct mpic_msgr **mpic_msgrs;
 static unsigned int mpic_msgr_count;
+static DEFINE_RAW_SPINLOCK(msgrs_lock);
 
 static inline void _mpic_msgr_mer_write(struct mpic_msgr *msgr, u32 value)
 {
@@ -56,12 +57,11 @@ struct mpic_msgr *mpic_msgr_get(unsigned int reg_num)
 	if (reg_num >= mpic_msgr_count)
 		return ERR_PTR(-ENODEV);
 
-	raw_spin_lock_irqsave(&msgr->lock, flags);
-	if (mpic_msgrs[reg_num]->in_use == MSGR_FREE) {
-		msgr = mpic_msgrs[reg_num];
+	raw_spin_lock_irqsave(&msgrs_lock, flags);
+	msgr = mpic_msgrs[reg_num];
+	if (msgr->in_use == MSGR_FREE)
 		msgr->in_use = MSGR_INUSE;
-	}
-	raw_spin_unlock_irqrestore(&msgr->lock, flags);
+	raw_spin_unlock_irqrestore(&msgrs_lock, flags);
 
 	return msgr;
 }
-- 
1.7.5.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/4] powerpc/mpic_msgr: fix offset error when setting mer register
  2012-04-16  2:05 ` [PATCH 2/4] powerpc/mpic_msgr: add lock for MPIC message global variable Mingkai Hu
@ 2012-04-16  2:05   ` Mingkai Hu
  2012-04-16  2:05     ` [PATCH 4/4] powerpc/mpc85xx: add MPIC message dts node Mingkai Hu
  2012-04-19 20:15     ` [PATCH 3/4] powerpc/mpic_msgr: fix offset error when setting mer register Kumar Gala
  2012-04-19 20:15   ` [PATCH 2/4] powerpc/mpic_msgr: add lock for MPIC message global variable Kumar Gala
  1 sibling, 2 replies; 8+ messages in thread
From: Mingkai Hu @ 2012-04-16  2:05 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Mingkai Hu

Signed-off-by: Mingkai Hu <Mingkai.hu@freescale.com>
---
 arch/powerpc/sysdev/mpic_msgr.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/sysdev/mpic_msgr.c b/arch/powerpc/sysdev/mpic_msgr.c
index dc1cfe3..483d8fa 100644
--- a/arch/powerpc/sysdev/mpic_msgr.c
+++ b/arch/powerpc/sysdev/mpic_msgr.c
@@ -228,7 +228,7 @@ static __devinit int mpic_msgr_probe(struct platform_device *dev)
 
 		reg_number = block_number * MPIC_MSGR_REGISTERS_PER_BLOCK + i;
 		msgr->base = msgr_block_addr + i * MPIC_MSGR_STRIDE;
-		msgr->mer = msgr->base + MPIC_MSGR_MER_OFFSET;
+		msgr->mer = (u32 *)((u8 *)msgr->base + MPIC_MSGR_MER_OFFSET);
 		msgr->in_use = MSGR_FREE;
 		msgr->num = i;
 		raw_spin_lock_init(&msgr->lock);
-- 
1.7.5.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 4/4] powerpc/mpc85xx: add MPIC message dts node
  2012-04-16  2:05   ` [PATCH 3/4] powerpc/mpic_msgr: fix offset error when setting mer register Mingkai Hu
@ 2012-04-16  2:05     ` Mingkai Hu
  2012-04-19 20:15       ` Kumar Gala
  2012-04-19 20:15     ` [PATCH 3/4] powerpc/mpic_msgr: fix offset error when setting mer register Kumar Gala
  1 sibling, 1 reply; 8+ messages in thread
From: Mingkai Hu @ 2012-04-16  2:05 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Mingkai Hu

Signed-off-by: Mingkai Hu <Mingkai.hu@freescale.com>
---
 arch/powerpc/boot/dts/fsl/pq3-mpic-message-B.dtsi |   43 +++++++++++++++++++++
 arch/powerpc/boot/dts/fsl/pq3-mpic.dtsi           |   10 +++++
 2 files changed, 53 insertions(+), 0 deletions(-)
 create mode 100644 arch/powerpc/boot/dts/fsl/pq3-mpic-message-B.dtsi

diff --git a/arch/powerpc/boot/dts/fsl/pq3-mpic-message-B.dtsi b/arch/powerpc/boot/dts/fsl/pq3-mpic-message-B.dtsi
new file mode 100644
index 0000000..1cf0b77
--- /dev/null
+++ b/arch/powerpc/boot/dts/fsl/pq3-mpic-message-B.dtsi
@@ -0,0 +1,43 @@
+/*
+ * PQ3 MPIC Message (Group B) device tree stub [ controller @ offset 0x42400 ]
+ *
+ * Copyright 2012 Freescale Semiconductor Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Freescale Semiconductor nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ *
+ * ALTERNATIVELY, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") as published by the Free Software
+ * Foundation, either version 2 of that License or (at your option) any
+ * later version.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+message@42400 {
+	compatible = "fsl,mpic-v3.1-msgr";
+	reg = <0x42400 0x200>;
+	interrupts = <
+		0xb4 2 0 0
+		0xb5 2 0 0
+		0xb6 2 0 0
+		0xb7 2 0 0>;
+};
diff --git a/arch/powerpc/boot/dts/fsl/pq3-mpic.dtsi b/arch/powerpc/boot/dts/fsl/pq3-mpic.dtsi
index fdedf7b..71c30eb 100644
--- a/arch/powerpc/boot/dts/fsl/pq3-mpic.dtsi
+++ b/arch/powerpc/boot/dts/fsl/pq3-mpic.dtsi
@@ -53,6 +53,16 @@ timer@41100 {
 		      3 0 3 0>;
 };
 
+message@41400 {
+	compatible = "fsl,mpic-v3.1-msgr";
+	reg = <0x41400 0x200>;
+	interrupts = <
+		0xb0 2 0 0
+		0xb1 2 0 0
+		0xb2 2 0 0
+		0xb3 2 0 0>;
+};
+
 msi@41600 {
 	compatible = "fsl,mpic-msi";
 	reg = <0x41600 0x80>;
-- 
1.7.5.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/4] powerpc/mpic_msgr: fix compile error when SMP disabled
  2012-04-16  2:05 [PATCH 1/4] powerpc/mpic_msgr: fix compile error when SMP disabled Mingkai Hu
  2012-04-16  2:05 ` [PATCH 2/4] powerpc/mpic_msgr: add lock for MPIC message global variable Mingkai Hu
@ 2012-04-19 20:15 ` Kumar Gala
  1 sibling, 0 replies; 8+ messages in thread
From: Kumar Gala @ 2012-04-19 20:15 UTC (permalink / raw)
  To: Mingkai Hu; +Cc: linuxppc-dev


On Apr 15, 2012, at 9:05 PM, Mingkai Hu wrote:

> In file included from arch/powerpc/sysdev/mpic_msgr.c:20:0:
> ~/arch/powerpc/include/asm/mpic_msgr.h: In function =
'mpic_msgr_set_destination':
> ~/arch/powerpc/include/asm/mpic_msgr.h:117:2:
> error: implicit declaration of function 'get_hard_smp_processor_id'
> make[1]: *** [arch/powerpc/sysdev/mpic_msgr.o] Error 1
>=20
> Signed-off-by: Mingkai Hu <Mingkai.hu@freescale.com>
> ---
> arch/powerpc/include/asm/mpic_msgr.h |    1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)

applied to merge

- k=

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/4] powerpc/mpic_msgr: add lock for MPIC message global variable
  2012-04-16  2:05 ` [PATCH 2/4] powerpc/mpic_msgr: add lock for MPIC message global variable Mingkai Hu
  2012-04-16  2:05   ` [PATCH 3/4] powerpc/mpic_msgr: fix offset error when setting mer register Mingkai Hu
@ 2012-04-19 20:15   ` Kumar Gala
  1 sibling, 0 replies; 8+ messages in thread
From: Kumar Gala @ 2012-04-19 20:15 UTC (permalink / raw)
  To: Mingkai Hu; +Cc: linuxppc-dev


On Apr 15, 2012, at 9:05 PM, Mingkai Hu wrote:

> Also fix issue of accessing invalid msgr pointer issue. The local
> msgr pointer in fucntion mpic_msgr_get will be accessed before
> getting a valid address which will cause kernel crash.
> 
> Signed-off-by: Mingkai Hu <Mingkai.hu@freescale.com>
> ---
> arch/powerpc/sysdev/mpic_msgr.c |   10 +++++-----
> 1 files changed, 5 insertions(+), 5 deletions(-)

applied to merge

- k

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/4] powerpc/mpic_msgr: fix offset error when setting mer register
  2012-04-16  2:05   ` [PATCH 3/4] powerpc/mpic_msgr: fix offset error when setting mer register Mingkai Hu
  2012-04-16  2:05     ` [PATCH 4/4] powerpc/mpc85xx: add MPIC message dts node Mingkai Hu
@ 2012-04-19 20:15     ` Kumar Gala
  1 sibling, 0 replies; 8+ messages in thread
From: Kumar Gala @ 2012-04-19 20:15 UTC (permalink / raw)
  To: Mingkai Hu; +Cc: linuxppc-dev


On Apr 15, 2012, at 9:05 PM, Mingkai Hu wrote:

> Signed-off-by: Mingkai Hu <Mingkai.hu@freescale.com>
> ---
> arch/powerpc/sysdev/mpic_msgr.c |    2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)

applied to merge

- k

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 4/4] powerpc/mpc85xx: add MPIC message dts node
  2012-04-16  2:05     ` [PATCH 4/4] powerpc/mpc85xx: add MPIC message dts node Mingkai Hu
@ 2012-04-19 20:15       ` Kumar Gala
  0 siblings, 0 replies; 8+ messages in thread
From: Kumar Gala @ 2012-04-19 20:15 UTC (permalink / raw)
  To: Mingkai Hu; +Cc: linuxppc-dev


On Apr 15, 2012, at 9:05 PM, Mingkai Hu wrote:

> Signed-off-by: Mingkai Hu <Mingkai.hu@freescale.com>
> ---
> arch/powerpc/boot/dts/fsl/pq3-mpic-message-B.dtsi |   43 =
+++++++++++++++++++++
> arch/powerpc/boot/dts/fsl/pq3-mpic.dtsi           |   10 +++++
> 2 files changed, 53 insertions(+), 0 deletions(-)
> create mode 100644 arch/powerpc/boot/dts/fsl/pq3-mpic-message-B.dtsi

applied to merge

- k=

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-04-19 20:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-16  2:05 [PATCH 1/4] powerpc/mpic_msgr: fix compile error when SMP disabled Mingkai Hu
2012-04-16  2:05 ` [PATCH 2/4] powerpc/mpic_msgr: add lock for MPIC message global variable Mingkai Hu
2012-04-16  2:05   ` [PATCH 3/4] powerpc/mpic_msgr: fix offset error when setting mer register Mingkai Hu
2012-04-16  2:05     ` [PATCH 4/4] powerpc/mpc85xx: add MPIC message dts node Mingkai Hu
2012-04-19 20:15       ` Kumar Gala
2012-04-19 20:15     ` [PATCH 3/4] powerpc/mpic_msgr: fix offset error when setting mer register Kumar Gala
2012-04-19 20:15   ` [PATCH 2/4] powerpc/mpic_msgr: add lock for MPIC message global variable Kumar Gala
2012-04-19 20:15 ` [PATCH 1/4] powerpc/mpic_msgr: fix compile error when SMP disabled Kumar Gala

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).