[PATCH]qonverge/usb: Add first usb controller node

2013-02-28 Thread Ramneek Mehresh
Add first usb controller node for qonverge qoriq platforms like
B4860, etc

Signed-off-by: Ramneek Mehresh ramneek.mehr...@freescale.com
---
Applies on git://git.kernel.org/pub/scm/linux/kernel/git/galak/powerpc.git
(branch next)

 arch/powerpc/boot/dts/fsl/qonverge-usb2-dr-0.dtsi | 41 +++
 1 file changed, 41 insertions(+)
 create mode 100644 arch/powerpc/boot/dts/fsl/qonverge-usb2-dr-0.dtsi

diff --git a/arch/powerpc/boot/dts/fsl/qonverge-usb2-dr-0.dtsi 
b/arch/powerpc/boot/dts/fsl/qonverge-usb2-dr-0.dtsi
new file mode 100644
index 000..29dad72
--- /dev/null
+++ b/arch/powerpc/boot/dts/fsl/qonverge-usb2-dr-0.dtsi
@@ -0,0 +1,41 @@
+/*
+ * QorIQ Qonverge USB Host device tree stub [ controller @ offset 0x21 ]
+ *
+ * Copyright 2013 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.
+ */
+
+usb@21 {
+   compatible = fsl-usb2-dr;
+   reg = 0x21 0x1000;
+   #address-cells = 1;
+   #size-cells = 0;
+   interrupts = 44 0x2 0 0;
+};
-- 
1.7.11.4


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


Re: [PATCH] Enhanced support for MPC8xx/8xxx watchdog

2013-02-28 Thread leroy christophe

Hi Wim,

Le 27/02/2013 20:52, Wim Van Sebroeck a écrit :

The rest of the code is OK and when above comments are corrected,
I will add the patch to improve the userspace experience.

Kind regards,
Wim.


Ok, I'll fix and re-submit my patch according to your comments.

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


[PATCH v2] Enhanced support for MPC8xx/8xxx watchdog

2013-02-28 Thread Christophe Leroy
This patch modifies the behaviour of the MPC8xx/8xxx watchdog. On the MPC8xx,
at 133Mhz, the maximum timeout of the watchdog timer is 1s, which means it must
be pinged twice a second. This is not in line with the Linux watchdog concept
which is based on a default watchdog timeout around 60s.
This patch introduces an intermediate layer between the CPU and the userspace.
The kernel pings the watchdog at the required frequency at the condition that
userspace tools refresh it regularly.
Existing parameter 'timeout' is renamed 'hw_time'.
The new parameter 'timeout' allows to set up the userspace timeout.
The driver also implements the WDIOC_SETTIMEOUT ioctl.

Signed-off-by: Christophe Leroy christophe.le...@c-s.fr

diff -ur linux-3.7.9/drivers/watchdog/mpc8xxx_wdt.c 
linux/drivers/watchdog/mpc8xxx_wdt.c
--- linux-3.7.9/drivers/watchdog/mpc8xxx_wdt.c  2013-02-17 19:53:32.0 
+0100
+++ linux/drivers/watchdog/mpc8xxx_wdt.c2013-02-27 16:00:07.0 
+0100
@@ -52,10 +52,17 @@
 static struct mpc8xxx_wdt __iomem *wd_base;
 static int mpc8xxx_wdt_init_late(void);
 
-static u16 timeout = 0x;
-module_param(timeout, ushort, 0);
+#define WD_TIMO 10 /* Default timeout = 10 seconds */
+
+static uint timeout = WD_TIMO;
+module_param(timeout, uint, 0);
 MODULE_PARM_DESC(timeout,
-   Watchdog timeout in ticks. (0timeout65536, default=65535));
+   Watchdog SW timeout in seconds. (0  timeout  65536s, default = 
+   __MODULE_STRING(WD_TIMO) s));
+static u16 hw_timo = 0x;
+module_param(hw_timo, ushort, 0);
+MODULE_PARM_DESC(hw_timo,
+   Watchdog HW timeout in ticks. (0  hw_timo  65536, default = 65535));
 
 static bool reset = 1;
 module_param(reset, bool, 0);
@@ -72,10 +79,12 @@
  * to 0
  */
 static int prescale = 1;
-static unsigned int timeout_sec;
+static unsigned int hw_timo_sec;
 
+static int wdt_auto = 1;
 static unsigned long wdt_is_open;
 static DEFINE_SPINLOCK(wdt_spinlock);
+static unsigned long wdt_last_ping;
 
 static void mpc8xxx_wdt_keepalive(void)
 {
@@ -91,9 +100,20 @@
 
 static void mpc8xxx_wdt_timer_ping(unsigned long arg)
 {
-   mpc8xxx_wdt_keepalive();
-   /* We're pinging it twice faster than needed, just to be sure. */
-   mod_timer(wdt_timer, jiffies + HZ * timeout_sec / 2);
+   if (wdt_auto)
+   wdt_last_ping = jiffies;
+
+   if (jiffies - wdt_last_ping = timeout * HZ) {
+   mpc8xxx_wdt_keepalive();
+   /* We're pinging it twice faster than needed, to be sure. */
+   mod_timer(wdt_timer, jiffies + HZ * hw_timo_sec / 2);
+   }
+}
+
+static void mpc8xxx_wdt_sw_keepalive(void)
+{
+   wdt_last_ping = jiffies;
+   mpc8xxx_wdt_timer_ping(0);
 }
 
 static void mpc8xxx_wdt_pr_warn(const char *msg)
@@ -106,7 +126,7 @@
 size_t count, loff_t *ppos)
 {
if (count)
-   mpc8xxx_wdt_keepalive();
+   mpc8xxx_wdt_sw_keepalive();
return count;
 }
 
@@ -126,11 +146,11 @@
if (reset)
tmp |= SWCRR_SWRI;
 
-   tmp |= timeout  16;
+   tmp |= hw_timo  16;
 
out_be32(wd_base-swcrr, tmp);
 
-   del_timer_sync(wdt_timer);
+   wdt_auto = 0;
 
return nonseekable_open(inode, file);
 }
@@ -138,7 +158,8 @@
 static int mpc8xxx_wdt_release(struct inode *inode, struct file *file)
 {
if (!nowayout)
-   mpc8xxx_wdt_timer_ping(0);
+   wdt_auto = 1;
+
else
mpc8xxx_wdt_pr_warn(watchdog closed);
clear_bit(0, wdt_is_open);
@@ -163,10 +184,12 @@
case WDIOC_GETBOOTSTATUS:
return put_user(0, p);
case WDIOC_KEEPALIVE:
-   mpc8xxx_wdt_keepalive();
+   mpc8xxx_wdt_sw_keepalive();
return 0;
case WDIOC_GETTIMEOUT:
-   return put_user(timeout_sec, p);
+   return put_user(timeout, p);
+   case WDIOC_SETTIMEOUT:
+   return get_user(timeout, p);
default:
return -ENOTTY;
}
@@ -215,12 +238,14 @@
ret = -ENOSYS;
goto err_unmap;
}
+   if (enabled)
+   hw_timo = in_be32(wd_base-swcrr)  16;
 
/* Calculate the timeout in seconds */
if (prescale)
-   timeout_sec = (timeout * wdt_type-prescaler) / freq;
+   hw_timo_sec = (hw_timo * wdt_type-prescaler) / freq;
else
-   timeout_sec = timeout / freq;
+   hw_timo_sec = hw_timo / freq;
 
 #ifdef MODULE
ret = mpc8xxx_wdt_init_late();
@@ -228,8 +253,8 @@
goto err_unmap;
 #endif
 
-   pr_info(WDT driver for MPC8xxx initialized. mode:%s timeout=%d (%d 
seconds)\n,
-   reset ? reset : interrupt, timeout, timeout_sec);
+   pr_info(WDT driver for MPC8xxx initialized. mode:%s timeout = %d (%d 
seconds)\n,
+   reset ? reset : interrupt, hw_timo, 

Re: [PATCH] drivers/tty/hvc: using strlcpy instead of strncpy

2013-02-28 Thread Jiri Slaby
On 02/26/2013 04:43 AM, Chen Gang wrote:
 
   when strlen pi-location_code is larger than HVCS_CLC_LENGTH + 1,
 original implementation can not let hvcsd-p_location_code NUL terminated.
   so need fix it (also can simplify the code)

It should never be larger because the +1 is exactly for NUL. But it is a
cleanup, so why not...

 Signed-off-by: Chen Gang gang.c...@asianux.com
 ---
  drivers/tty/hvc/hvcs.c |9 ++---
  1 files changed, 2 insertions(+), 7 deletions(-)
 
 diff --git a/drivers/tty/hvc/hvcs.c b/drivers/tty/hvc/hvcs.c
 index 1956593..81e939e 100644
 --- a/drivers/tty/hvc/hvcs.c
 +++ b/drivers/tty/hvc/hvcs.c
 @@ -881,17 +881,12 @@ static struct vio_driver hvcs_vio_driver = {
  /* Only called from hvcs_get_pi please */
  static void hvcs_set_pi(struct hvcs_partner_info *pi, struct hvcs_struct 
 *hvcsd)
  {
 - int clclength;
 -
   hvcsd-p_unit_address = pi-unit_address;
   hvcsd-p_partition_ID  = pi-partition_ID;
 - clclength = strlen(pi-location_code[0]);
 - if (clclength  HVCS_CLC_LENGTH)
 - clclength = HVCS_CLC_LENGTH;
  
   /* copy the null-term char too */
 - strncpy(hvcsd-p_location_code[0],
 - pi-location_code[0], clclength + 1);
 + strlcpy(hvcsd-p_location_code[0],
 + pi-location_code[0], sizeof(hvcsd-p_location_code));
  }
  
  /*
 


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


Re: [PATCH] drivers/tty/hvc: using strlcpy instead of strncpy

2013-02-28 Thread Chen Gang
于 2013年02月28日 18:41, Jiri Slaby 写道:
 On 02/26/2013 04:43 AM, Chen Gang wrote:
  
when strlen pi-location_code is larger than HVCS_CLC_LENGTH + 1,
  original implementation can not let hvcsd-p_location_code NUL 
  terminated.
so need fix it (also can simplify the code)
 It should never be larger because the +1 is exactly for NUL. But it is a
 cleanup, so why not...


  when strlen(pi-location_code[0]) == HVCS_CLC_LENGTH + 2
then clclength will be reset to HVCS_CLC_LENGTH.

when call strncpy, the clclength + 1 == HVCS_CLS_LENGTH + 1
  but the '\0' of src buf is located at HVCS_CLS_LENGTH + 2.
  so no '\0' copied to dest buf.

then the dest buf will not be ended by '\0'.

  is it correct ?

  :-)

gchen.
 
  Signed-off-by: Chen Gang gang.c...@asianux.com
  ---
   drivers/tty/hvc/hvcs.c |9 ++---
   1 files changed, 2 insertions(+), 7 deletions(-)
  
  diff --git a/drivers/tty/hvc/hvcs.c b/drivers/tty/hvc/hvcs.c
  index 1956593..81e939e 100644
  --- a/drivers/tty/hvc/hvcs.c
  +++ b/drivers/tty/hvc/hvcs.c
  @@ -881,17 +881,12 @@ static struct vio_driver hvcs_vio_driver = {
   /* Only called from hvcs_get_pi please */
   static void hvcs_set_pi(struct hvcs_partner_info *pi, struct hvcs_struct 
  *hvcsd)
   {
  -  int clclength;
  -
 hvcsd-p_unit_address = pi-unit_address;
 hvcsd-p_partition_ID  = pi-partition_ID;
  -  clclength = strlen(pi-location_code[0]);
  -  if (clclength  HVCS_CLC_LENGTH)
  -  clclength = HVCS_CLC_LENGTH;
   
 /* copy the null-term char too */
  -  strncpy(hvcsd-p_location_code[0],
  -  pi-location_code[0], clclength + 1);
  +  strlcpy(hvcsd-p_location_code[0],
  +  pi-location_code[0], sizeof(hvcsd-p_location_code));
   }
   
   /*
  


-- 
Chen Gang

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

Re: [PATCH] drivers/tty/hvc: using strlcpy instead of strncpy

2013-02-28 Thread Chen Gang
于 2013年02月28日 19:13, Chen Gang 写道:
 于 2013年02月28日 18:41, Jiri Slaby 写道:
 On 02/26/2013 04:43 AM, Chen Gang wrote:

   when strlen pi-location_code is larger than HVCS_CLC_LENGTH + 1,
 original implementation can not let hvcsd-p_location_code NUL 
 terminated.
   so need fix it (also can simplify the code)
 It should never be larger because the +1 is exactly for NUL. But it is a
 cleanup, so why not...

 
   when strlen(pi-location_code[0]) == HVCS_CLC_LENGTH + 2
 then clclength will be reset to HVCS_CLC_LENGTH.
 
 when call strncpy, the clclength + 1 == HVCS_CLS_LENGTH + 1
   but the '\0' of src buf is located at HVCS_CLS_LENGTH + 2.
but the '\0' of src buf is located at HVCS_CLS_LENGTH + 3. (not + 2)

   so no '\0' copied to dest buf.
 
 then the dest buf will not be ended by '\0'.
 
   is it correct ?
 
   :-)
 
 gchen.
  
 Signed-off-by: Chen Gang gang.c...@asianux.com
 ---
  drivers/tty/hvc/hvcs.c |9 ++---
  1 files changed, 2 insertions(+), 7 deletions(-)

 diff --git a/drivers/tty/hvc/hvcs.c b/drivers/tty/hvc/hvcs.c
 index 1956593..81e939e 100644
 --- a/drivers/tty/hvc/hvcs.c
 +++ b/drivers/tty/hvc/hvcs.c
 @@ -881,17 +881,12 @@ static struct vio_driver hvcs_vio_driver = {
  /* Only called from hvcs_get_pi please */
  static void hvcs_set_pi(struct hvcs_partner_info *pi, struct hvcs_struct 
 *hvcsd)
  {
 -  int clclength;
 -
hvcsd-p_unit_address = pi-unit_address;
hvcsd-p_partition_ID  = pi-partition_ID;
 -  clclength = strlen(pi-location_code[0]);
 -  if (clclength  HVCS_CLC_LENGTH)
 -  clclength = HVCS_CLC_LENGTH;
  
/* copy the null-term char too */
 -  strncpy(hvcsd-p_location_code[0],
 -  pi-location_code[0], clclength + 1);
 +  strlcpy(hvcsd-p_location_code[0],
 +  pi-location_code[0], sizeof(hvcsd-p_location_code));
  }
  
  /*

 
 


-- 
Chen Gang

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

Re: [PATCH -V1 05/24] powerpc: Move the pte free routines from common header

2013-02-28 Thread Paul Mackerras
On Tue, Feb 26, 2013 at 01:34:55PM +0530, Aneesh Kumar K.V wrote:
 From: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com
 
 This patch move the common code to 32/64 bit headers. We will
 ^ moves

 later change the 64 bit version to support smaller PTE fragments
 
 Signed-off-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com

Acked-by: Paul Mackerras pau...@samba.org
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH v6 04/46] percpu_rwlock: Implement the core design of Per-CPU Reader-Writer Locks

2013-02-28 Thread Michel Lespinasse
On Thu, Feb 28, 2013 at 3:25 AM, Oleg Nesterov o...@redhat.com wrote:
 On 02/27, Michel Lespinasse wrote:

 +void lg_rwlock_local_read_lock(struct lgrwlock *lgrw)
 +{
 +   preempt_disable();
 +
 +   if (__this_cpu_read(*lgrw-local_refcnt) ||
 +   arch_spin_trylock(this_cpu_ptr(lgrw-lglock-lock))) {
 +   __this_cpu_inc(*lgrw-local_refcnt);

 Please look at __this_cpu_generic_to_op(). You need this_cpu_inc()
 to avoid the race with irs. The same for _read_unlock.

Hmmm, I was thinking that this was safe because while interrupts might
modify local_refcnt to acquire a nested read lock, they are expected
to release that lock as well which would set local_refcnt back to its
original value ???

-- 
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] drivers/tty/hvc: using strlcpy instead of strncpy

2013-02-28 Thread Jiri Slaby
On 02/28/2013 12:15 PM, Chen Gang wrote:
 于 2013年02月28日 19:13, Chen Gang 写道:
 于 2013年02月28日 18:41, Jiri Slaby 写道:
 On 02/26/2013 04:43 AM, Chen Gang wrote:

   when strlen pi-location_code is larger than HVCS_CLC_LENGTH + 1,
 original implementation can not let hvcsd-p_location_code NUL 
 terminated.
   so need fix it (also can simplify the code)
 It should never be larger because the +1 is exactly for NUL. But it is a
 cleanup, so why not...


   when strlen(pi-location_code[0]) == HVCS_CLC_LENGTH + 2

It cannot, pi-location_code is defined as char[HVCS_CLC_LENGTH + 1].


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

[PATCH 014/139] uprobes/powerpc: Add dependency on single step emulation

2013-02-28 Thread Luis Henriques
3.5.7.7 -stable review patch.  If anyone has any objections, please let me know.

--

From: Suzuki K. Poulose suz...@in.ibm.com

commit 5e249d4528528c9a77da051a89ec7f99d31b83eb upstream.

Uprobes uses emulate_step in sstep.c, but we haven't explicitly specified
the dependency. On pseries HAVE_HW_BREAKPOINT protects us, but 44x has no
such luxury.

Consolidate other users that depend on sstep and create a new config option.

Signed-off-by: Ananth N Mavinakayanahalli ana...@in.ibm.com
Signed-off-by: Suzuki K. Poulose suz...@in.ibm.com
Cc: linuxppc-...@ozlabs.org
Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org
[ luis: adjust context ]
Signed-off-by: Luis Henriques luis.henriq...@canonical.com
---
 arch/powerpc/Kconfig  | 4 
 arch/powerpc/lib/Makefile | 4 +---
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 050cb37..4d8336c 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -264,6 +264,10 @@ config PPC_ADV_DEBUG_DAC_RANGE
depends on PPC_ADV_DEBUG_REGS  44x
default y
 
+config PPC_EMULATE_SSTEP
+   bool
+   default y if KPROBES || UPROBES || XMON || HAVE_HW_BREAKPOINT
+
 source init/Kconfig
 
 source kernel/Kconfig.freezer
diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
index 7735a2c..3230bc1 100644
--- a/arch/powerpc/lib/Makefile
+++ b/arch/powerpc/lib/Makefile
@@ -18,9 +18,7 @@ obj-$(CONFIG_PPC64)   += copypage_64.o copyuser_64.o \
   memcpy_64.o usercopy_64.o mem_64.o string.o \
   checksum_wrappers_64.o hweight_64.o \
   copyuser_power7.o
-obj-$(CONFIG_XMON) += sstep.o ldstfp.o
-obj-$(CONFIG_KPROBES)  += sstep.o ldstfp.o
-obj-$(CONFIG_HAVE_HW_BREAKPOINT)   += sstep.o ldstfp.o
+obj-$(CONFIG_PPC_EMULATE_SSTEP)+= sstep.o ldstfp.o
 
 ifeq ($(CONFIG_PPC64),y)
 obj-$(CONFIG_SMP)  += locks.o
-- 
1.8.1.2

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


Re: [PATCH 2/6] powerpc/fsl_pci: Store the platform device information corresponding to the pci controller.

2013-02-28 Thread Kumar Gala

On Feb 27, 2013, at 4:56 AM, Sethi Varun-B16395 wrote:

 This patch is present in the next branch of linux ppc tree maintained by 
 Kumar Gala.
 Following is the commit id:
 52c5affc545053d37c0b05224bbf70f5336caa20
 
 I am not sure if this would be part of 3.9-rc1.
 
 Regards
 varun

This is now in Linus's tree so will be in 3.9-rc1

- k

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


Re: [PATCH 3/6] powerpc/fsl_pci: Added defines for the FSL PCI controller BRR1 register.

2013-02-28 Thread Kumar Gala

On Feb 27, 2013, at 5:33 AM, Joerg Roedel wrote:

 On Mon, Feb 18, 2013 at 06:22:16PM +0530, Varun Sethi wrote:
 Macros for checking FSL PCI controller version.
 
 Signed-off-by: Varun Sethi varun.se...@freescale.com
 ---
 arch/powerpc/include/asm/pci-bridge.h |4 
 1 files changed, 4 insertions(+), 0 deletions(-)
 
 diff --git a/arch/powerpc/include/asm/pci-bridge.h 
 b/arch/powerpc/include/asm/pci-bridge.h
 index 025a130..c12ed78 100644
 --- a/arch/powerpc/include/asm/pci-bridge.h
 +++ b/arch/powerpc/include/asm/pci-bridge.h
 @@ -14,6 +14,10 @@
 
 struct device_node;
 
 +/* FSL PCI controller BRR1 register */
 +#define PCI_FSL_BRR1  0xbf8
 +#define PCI_FSL_BRR1_VER 0x
 +
 
 
 Please merge this patch with the one where you actually make use of
 these defines for the first time.
 
 
   Joerg

This also seems an odd place for these defines.

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


Re: [PATCH 1/6 v8] iommu/fsl: Store iommu domain information pointer in archdata.

2013-02-28 Thread Kumar Gala

On Feb 27, 2013, at 6:04 AM, Sethi Varun-B16395 wrote:

 Hi Kumar,Ben,
 I am implementing the Freescale PAMU (IOMMU) driver using the Linux IOMMU 
 API. In this particular patch, I have added a new field to dev_archdata 
 structure to store the dma domain information.
 This field is updated whenever we attach a device to an iommu domain.
 
 Regards
 Varun

Would be good to see if this overlaps with Alexey's work for IOMMU driver for 
powernv.

- k

 
 -Original Message-
 From: Joerg Roedel [mailto:j...@8bytes.org]
 Sent: Wednesday, February 27, 2013 5:01 PM
 To: Sethi Varun-B16395
 Cc: io...@lists.linux-foundation.org; linuxppc-dev@lists.ozlabs.org;
 linux-ker...@vger.kernel.org; Wood Scott-B07421; Yoder Stuart-B08248
 Subject: Re: [PATCH 1/6 v8] iommu/fsl: Store iommu domain information
 pointer in archdata.
 
 On Mon, Feb 18, 2013 at 06:22:14PM +0530, Varun Sethi wrote:
 Add a new field in the device (powerpc) archdata structure for storing
 iommu domain information pointer. This pointer is stored when the
 device is attached to a particular domain.
 
 
 Signed-off-by: Varun Sethi varun.se...@freescale.com
 ---
 - no change.
 arch/powerpc/include/asm/device.h |4 
 1 files changed, 4 insertions(+), 0 deletions(-)
 
 diff --git a/arch/powerpc/include/asm/device.h
 b/arch/powerpc/include/asm/device.h
 index 77e97dd..6dc79fe 100644
 --- a/arch/powerpc/include/asm/device.h
 +++ b/arch/powerpc/include/asm/device.h
 @@ -28,6 +28,10 @@ struct dev_archdata {
 void*iommu_table_base;
 } dma_data;
 
 +   /* IOMMU domain information pointer. This would be set
 +* when this device is attached to an iommu_domain.
 +*/
 +   void*iommu_domain;
 
 Please Cc the PowerPC Maintainers on this, so that they can have a look
 at it. This also must be put this into an #ifdef CONFIG_IOMMU_API.
 
 
  Joerg
 
 
 
 
 --
 To unsubscribe from this list: send the line unsubscribe linux-kernel in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 Please read the FAQ at  http://www.tux.org/lkml/

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


Re: [PATCH v6 04/46] percpu_rwlock: Implement the core design of Per-CPU Reader-Writer Locks

2013-02-28 Thread Oleg Nesterov
On 02/28, Michel Lespinasse wrote:

 On Thu, Feb 28, 2013 at 3:25 AM, Oleg Nesterov o...@redhat.com wrote:
  On 02/27, Michel Lespinasse wrote:
 
  +void lg_rwlock_local_read_lock(struct lgrwlock *lgrw)
  +{
  +   preempt_disable();
  +
  +   if (__this_cpu_read(*lgrw-local_refcnt) ||
  +   arch_spin_trylock(this_cpu_ptr(lgrw-lglock-lock))) {
  +   __this_cpu_inc(*lgrw-local_refcnt);
 
  Please look at __this_cpu_generic_to_op(). You need this_cpu_inc()
  to avoid the race with irs. The same for _read_unlock.

 Hmmm, I was thinking that this was safe because while interrupts might
 modify local_refcnt to acquire a nested read lock, they are expected
 to release that lock as well which would set local_refcnt back to its
 original value ???

Yes, yes, this is correct.

I meant that (in general, x86 is fine) __this_cpu_inc() itself is not
irq-safe. It simply does pcp += 1.

this_cpu_inc() is fine, _this_cpu_generic_to_op() does cli/sti around.

I know this only because I did the same mistake recently, and Srivatsa
explained the problem to me ;)

Oleg.

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


Re: [PATCH v6 04/46] percpu_rwlock: Implement the core design of Per-CPU Reader-Writer Locks

2013-02-28 Thread Oleg Nesterov
On 02/28, Oleg Nesterov wrote:
 On 02/28, Michel Lespinasse wrote:
 
  On Thu, Feb 28, 2013 at 3:25 AM, Oleg Nesterov o...@redhat.com wrote:
   On 02/27, Michel Lespinasse wrote:
  
   +void lg_rwlock_local_read_lock(struct lgrwlock *lgrw)
   +{
   +   preempt_disable();
   +
   +   if (__this_cpu_read(*lgrw-local_refcnt) ||
   +   arch_spin_trylock(this_cpu_ptr(lgrw-lglock-lock))) {
   +   __this_cpu_inc(*lgrw-local_refcnt);
  
   Please look at __this_cpu_generic_to_op(). You need this_cpu_inc()
   to avoid the race with irs. The same for _read_unlock.
 
  Hmmm, I was thinking that this was safe because while interrupts might
  modify local_refcnt to acquire a nested read lock, they are expected
  to release that lock as well which would set local_refcnt back to its
  original value ???

 Yes, yes, this is correct.

 I meant that (in general, x86 is fine) __this_cpu_inc() itself is not
 irq-safe. It simply does pcp += 1.

 this_cpu_inc() is fine, _this_cpu_generic_to_op() does cli/sti around.

Just in case, it is not that I really understand why __this_cpu_inc() can
race with irq in this particular case (given that irq handler should
restore the counter).

So perhaps I am wrong again. The comments in include/linux/percpu.h look
confusing to me, and I simply know nothing about !x86 architectures. But
since, say, preempt_disable() doesn't do anything special then probably
__this_cpu_inc() is fine too.

In short: please ignore me ;)

Oleg.

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


Re: [PATCH 1/6 v8] iommu/fsl: Store iommu domain information pointer in archdata.

2013-02-28 Thread Alexey Kardashevskiy

Hi!

On POWERNV we use only the part of IOMMU API which handles devices and 
groups. We do not use IOMMU domains as VFIO containers do everything we 
need for VFIO and we do not implement iommu_ops as it is not very relevant 
to our architecture (does not give dma window properties, etc).


So your work does not overlap with my work :)


On 01/03/13 02:51, Kumar Gala wrote:


On Feb 27, 2013, at 6:04 AM, Sethi Varun-B16395 wrote:


Hi Kumar,Ben,
I am implementing the Freescale PAMU (IOMMU) driver using the Linux IOMMU API. 
In this particular patch, I have added a new field to dev_archdata structure to 
store the dma domain information.
This field is updated whenever we attach a device to an iommu domain.

Regards
Varun


Would be good to see if this overlaps with Alexey's work for IOMMU driver for 
powernv.

- k




-Original Message-
From: Joerg Roedel [mailto:j...@8bytes.org]
Sent: Wednesday, February 27, 2013 5:01 PM
To: Sethi Varun-B16395
Cc: io...@lists.linux-foundation.org; linuxppc-dev@lists.ozlabs.org;
linux-ker...@vger.kernel.org; Wood Scott-B07421; Yoder Stuart-B08248
Subject: Re: [PATCH 1/6 v8] iommu/fsl: Store iommu domain information
pointer in archdata.

On Mon, Feb 18, 2013 at 06:22:14PM +0530, Varun Sethi wrote:

Add a new field in the device (powerpc) archdata structure for storing
iommu domain information pointer. This pointer is stored when the
device is attached to a particular domain.


Signed-off-by: Varun Sethi varun.se...@freescale.com
---
- no change.
arch/powerpc/include/asm/device.h |4 
1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/include/asm/device.h
b/arch/powerpc/include/asm/device.h
index 77e97dd..6dc79fe 100644
--- a/arch/powerpc/include/asm/device.h
+++ b/arch/powerpc/include/asm/device.h
@@ -28,6 +28,10 @@ struct dev_archdata {
void*iommu_table_base;
} dma_data;

+   /* IOMMU domain information pointer. This would be set
+* when this device is attached to an iommu_domain.
+*/
+   void*iommu_domain;


Please Cc the PowerPC Maintainers on this, so that they can have a look
at it. This also must be put this into an #ifdef CONFIG_IOMMU_API.



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


Re: [PATCH 0/3] Enable multiple MSI feature in pSeries

2013-02-28 Thread Mike
Hi all

Any comments? or any questions about my patchset?

Thanks
Mike
在 2013-01-15二的 15:38 +0800,Mike Qiu写道:
 Currently, multiple MSI feature hasn't been enabled in pSeries,
 These patches try to enbale this feature.
 
 These patches have been tested by using ipr driver, and the driver patch
 has been made by Wen Xiong wenxi...@linux.vnet.ibm.com:
 
 [PATCH 0/7] Add support for new IBM SAS controllers
 
 Test platform: One partition of pSeries with one cpu core(4 SMTs) and 
RAID bus controller: IBM PCI-E IPR SAS Adapter (ASIC) in POWER7
 OS version: SUSE Linux Enterprise Server 11 SP2  (ppc64) with 3.8-rc3 kernel 
 
 IRQ 21 and 22 are assigned to the ipr device which support 2 mutiple MSI.
 
 The test results is shown by 'cat /proc/interrups':
   CPU0   CPU1   CPU2   CPU3   
 16: 240458 261601 226310 200425  XICS Level IPI
 17:  0  0  0  0  XICS Level RAS_EPOW
 18: 10  0  3  2  XICS Level 
 hvc_console
 19: 122182  28481  28527  28864  XICS Level ibmvscsi
 20:5067388226108118  XICS Level eth0
 21:  6  5  5  5  XICS Level host1-0
 22:817814816813  XICS Level host1-1
 LOC: 398077 316725 231882 203049   Local timer interrupts
 SPU:   1659919961903   Spurious interrupts
 CNT:  0  0  0  0   Performance
 monitoring interrupts
 MCE:  0  0  0  0   Machine check exceptions
 
 Mike Qiu (3):
   irq: Set multiple MSI descriptor data for multiple IRQs
   irq: Add hw continuous IRQs map to virtual continuous IRQs support
   powerpc/pci: Enable pSeries multiple MSI feature
 
  arch/powerpc/kernel/msi.c|4 --
  arch/powerpc/platforms/pseries/msi.c |   62 -
  include/linux/irq.h  |4 ++
  include/linux/irqdomain.h|3 ++
  kernel/irq/chip.c|   40 -
  kernel/irq/irqdomain.c   |   61 +
  6 files changed, 158 insertions(+), 16 deletions(-)
 



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

Re: [PATCH 0/3] Enable multiple MSI feature in pSeries

2013-02-28 Thread Michael Ellerman
On Fri, Mar 01, 2013 at 11:08:45AM +0800, Mike wrote:
 Hi all
 
 Any comments? or any questions about my patchset?

You were going to get some performance numbers that show a definite
benefit for using more than one MSI.

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