[PATCH] powerpc/p1010rdb:update dts for pcie interrupt-map

2015-07-20 Thread Zhao Qiang
From: Zhao Qiang b45...@freescale.com

p1010rdb-pb use the irq[4:5] for inta and intb to pcie,
it is active-high, so set it.

Signed-off-by: Zhao Qiang b45...@freescale.com
Change-Id: I29db41b4a8b5a67c18151099884edda6de4d9d1a
Reviewed-on: http://git.am.freescale.net:8181/9915
Tested-by: Review Code-CDREVIEW cdrev...@freescale.com
Reviewed-by: Xiaobo Xie x@freescale.com
Reviewed-by: Jose Rivera german.riv...@freescale.com
---
 arch/powerpc/boot/dts/fsl/p1010si-post.dtsi | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/boot/dts/fsl/p1010si-post.dtsi 
b/arch/powerpc/boot/dts/fsl/p1010si-post.dtsi
index 1804ed7..4313ff6 100644
--- a/arch/powerpc/boot/dts/fsl/p1010si-post.dtsi
+++ b/arch/powerpc/boot/dts/fsl/p1010si-post.dtsi
@@ -59,8 +59,12 @@
interrupt-map-mask = 0xf800 0 0 7;
interrupt-map = 
/* IDSEL 0x0 */
-    0x0 0x0 0x1 mpic 0x4 0x1 0x0 0x0
-    0x0 0x0 0x2 mpic 0x5 0x1 0x0 0x0
+   /*
+*irq[4:5] only for PCIe in dts, set to active-high
+*irq[6:7] is pulled up on board, set to active-low
+*/
+    0x0 0x0 0x1 mpic 0x4 0x2 0x0 0x0
+    0x0 0x0 0x2 mpic 0x5 0x2 0x0 0x0
 0x0 0x0 0x3 mpic 0x6 0x1 0x0 0x0
 0x0 0x0 0x4 mpic 0x7 0x1 0x0 0x0
;
-- 
2.1.0.27.g96db324

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

Re: [PATCH RFC 02/10] dpaa_eth: add support for DPAA Ethernet

2015-07-20 Thread Joakim Tjernlund
On Wed, 2015-04-01 at 19:19 +0300, Madalin Bucur wrote:
 This introduces the Freescale Data Path Acceleration Architecture
 (DPAA) Ethernet driver (dpaa_eth) that builds upon the DPAA QMan,
 BMan, PAMU and FMan drivers to deliver Ethernet connectivity on
 the Freescale DPAA QorIQ platforms.
 
 Signed-off-by: Madalin Bucur madalin.bu...@freescale.com
 ---

 + net_dev = alloc_etherdev_mq(sizeof(*priv), DPAA_ETH_TX_QUEUES);
 + if (!net_dev) {
 + dev_err(dev, alloc_etherdev_mq() failed\n);
 + goto alloc_etherdev_mq_failed;
 + }
 +
 + snprintf(net_dev-name, IFNAMSIZ, fm%d-mac%d,
 +  dpa_mac_fman_index_get(pdev),
 +  dpa_mac_hw_index_get(pdev));

Should ethernet drivers dictate interface name in user space nowadays?
I would prefer if you didn't.

I am trying these patches on a custom T1042 board using Linux 4.1 but
I cannot get Fixed PHY to work:
libphy: PHY fixed-0:00 not found
fsl_dpa dpaa-ethernet.2 eth2: Could not connect to PHY fixed-0:00
fsl_dpa dpaa-ethernet.2 eth2: init_phy() = -19

Not sure what I have missed here, any ideas?

 Jocke

PS.
I would really appreciate if you could add new revisions of the FMAN/DPAA 
driver(s)
to http://git.freescale.com/git/cgit.cgi/ppc/upstream/linux.git/
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH] Fix crash due to processing memory-controller nodes as memory

2015-07-20 Thread Ian Munsie
From: Ian Munsie imun...@au1.ibm.com

If the system has a PCI device with a memory-controller device node,
kexec-lite would spew hundreds of double free warnings and eventually
segfault. This would result in a kexec load failed message from
petitboot.

This was due to kexec_memory_map() searching for memory nodes, but
actually matching any node that started with memory, including these
memory-controller nodes. This patch changes the search to look for
nodes starting with memory@, which should only match memory nodes.

An example of a device tree that can trigger this bug is as follows:

{
pciex@3fffe4000 {
...
pci@0 {
#address-cells = 0x3;
#size-cells = 0x2;
...
memory-controller@0 {
reg = 0x1 0x0 0x0 0x0 0x0;
...
};
};
};
};

Signed-off-by: Ian Munsie imun...@au1.ibm.com
---
 kexec_memory_map.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kexec_memory_map.c b/kexec_memory_map.c
index fc1b7af..7f18de7 100644
--- a/kexec_memory_map.c
+++ b/kexec_memory_map.c
@@ -192,7 +192,7 @@ void kexec_memory_map(void *fdt, int reserve_initrd)
 
name = fdt_get_name(fdt, nodeoffset, NULL);
 
-   if (!name || strncmp(name, memory, strlen(memory)))
+   if (!name || strncmp(name, memory@, strlen(memory@)))
continue;
 
reg = fdt_getprop(fdt, nodeoffset, reg, len);
-- 
2.1.4

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

Re: [PATCH v6 3/3] leds/powernv: Add driver for PowerNV platform

2015-07-20 Thread Jacek Anaszewski

On 19.07.2015 23:40, Jacek Anaszewski wrote:
[...]

+/* Platform driver probe */
+static int powernv_led_probe(struct platform_device *pdev)
+{
+int num_leds;
+struct device_node *led_node;
+struct powernv_leds_priv *priv;
+
+led_node = of_find_node_by_path(/ibm,opal/leds);
+if (!led_node) {
+dev_err(pdev-dev,
+%s: LED parent device node not found\n, __func__);
+return -EINVAL;
+}
+
+num_leds = powernv_leds_count(led_node);
+if (num_leds = 0) {
+dev_err(pdev-dev,
+%s: No location code found under LED node\n,
+__func__);
+return -EINVAL;
+}


You won't need to count the number of LEDs to register, just allocate
memory for each LED during parsing with managed resource allocation
API.


You can refer to drivers/leds/leds-bcm6328.c in order to gain
full picture on how this can look like.
struct powernv_led_data would have to carry the pointer to the
new common struct.

--
Best Regards,
Jacek Anaszewski
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

RE: [PATCH v2] powerpc/dts: Add and fix 1588 timer node for eTSEC

2015-07-20 Thread Lu Y . B .
 On Wed, 2015-07-15 at 21:37 -0500, Lu Yangbo-B47093 wrote:
  Any comments?
  Thanks.
 
 Sorry, I must have missed this on my last time through the patch queue.
 I see you've decimalized the fiper and max-adj properties, which is
 good... but does it really make sense for tmr-add?  I'm not familiar with
 what this value represents, but the numbers look more natural as hex (e.g.
 0xaaab versus 2863311531).

Yes, the fiper value would be writed into fiper registers. And max-adj value 
would be used in ptp driver in driver/ptp/.
But you insisted that values should be in decimalism in the v1 patch... :)

See the history :)

# history ##
  +   ptp_clock@b0e00 {
  +   compatible = fsl,etsec-ptp;
  +   reg = 0xb0e00 0xb0;
  +   interrupts = 68 2 0 0 69 2 0 0;
  +   fsl,tclk-period = 5;
  +   fsl,tmr-prsc= 2;
  +   fsl,tmr-add = 0xcccd;
  +   fsl,tmr-fiper1  = 0x3b9ac9fb;
  +   fsl,tmr-fiper2  = 0x00018696;
  +   fsl,max-adj = 24999;
 
 Please don't use hex for numbers that make more sense as decimal.
 [Lu Yangbo-B47093] The hex value is register value, I think it's better to 
 use hex.

Whether it goes into a register doesn't matter.  Hex values are useful for 
values which are subdivided into various bitfields, or whose hex representation 
is simpler than decimal.  I'm not familiar with the details of this hardware, 
but I doubt the former is the case for 0x3b9ac9fb == 95 or 0x18696 == 
0.

-Scott
##


 
   diff --git a/arch/powerpc/boot/dts/p2020rdb-pc.dtsi
   b/arch/powerpc/boot/dts/p2020rdb-pc.dtsi
   index c21d1c7..363172d 100644
   --- a/arch/powerpc/boot/dts/p2020rdb-pc.dtsi
   +++ b/arch/powerpc/boot/dts/p2020rdb-pc.dtsi
   @@ -215,12 +215,12 @@
   };
  
ptp_clock@24e00{
   -   fsl,tclk-period = 5;
   -   fsl,tmr-prsc = 200;
   -   fsl,tmr-add = 0xCCCD;
   -   fsl,tmr-fiper1 = 0x3B9AC9FB;
   -   fsl,tmr-fiper2 = 0x0001869B;
   -   fsl,max-adj = 24999;
   +   fsl,tclk-period = 5;
   +   fsl,tmr-prsc= 2;
   +   fsl,tmr-add = 2863311531;
   +   fsl,tmr-fiper1  = 5;
   +   fsl,tmr-fiper2  = 0;
   +   fsl,max-adj = 2;
   };
 
 And here, you're changing the value of fsl,tmr-add and fsl,max-adj.  Why?

The old values maybe not calculated base on the default eTSEC system clock 
value.
1588 timer couldn’t be adjusted correctly by old values.

 
 -Scott

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

Re: [PATCH RFC 02/10] dpaa_eth: add support for DPAA Ethernet

2015-07-20 Thread Joakim Tjernlund
On Mon, 2015-07-20 at 09:54 +0200, Joakim Tjernlund wrote:
 On Wed, 2015-04-01 at 19:19 +0300, Madalin Bucur wrote:
  This introduces the Freescale Data Path Acceleration Architecture
  (DPAA) Ethernet driver (dpaa_eth) that builds upon the DPAA QMan,
  BMan, PAMU and FMan drivers to deliver Ethernet connectivity on
  the Freescale DPAA QorIQ platforms.
  
  Signed-off-by: Madalin Bucur madalin.bu...@freescale.com
  ---
 
  +   net_dev = alloc_etherdev_mq(sizeof(*priv), DPAA_ETH_TX_QUEUES);
  +   if (!net_dev) {
  +   dev_err(dev, alloc_etherdev_mq() failed\n);
  +   goto alloc_etherdev_mq_failed;
  +   }
  +
  +   snprintf(net_dev-name, IFNAMSIZ, fm%d-mac%d,
  +dpa_mac_fman_index_get(pdev),
  +dpa_mac_hw_index_get(pdev));
 
 Should ethernet drivers dictate interface name in user space nowadays?
 I would prefer if you didn't.
 
 I am trying these patches on a custom T1042 board using Linux 4.1 but
 I cannot get Fixed PHY to work:
 libphy: PHY fixed-0:00 not found
 fsl_dpa dpaa-ethernet.2 eth2: Could not connect to PHY fixed-0:00
 fsl_dpa dpaa-ethernet.2 eth2: init_phy() = -19
 
 Not sure what I have missed here, any ideas?

I meant I am using http://git.freescale.com/git/cgit.cgi/ppc/upstream/linux.git/
on top of 4.1

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

RE: powerpc/corenet: enable eSDHC

2015-07-20 Thread Lu Y . B .
 OK, thanks.  Assuming no similar issues when testing, I'll apply this
 patch the next time I do a batch of patch application.
 
 Any thoughts regarding better error handling?
 
 -Scott

Do you mean SD test?
Actually SD patches needing to sent to upstream are tested on Li Yang's Linux 
tree.
And the JIRA ticket is QORIQLU-19.


 
 On Wed, 2015-07-15 at 21:37 -0500, Lu Yangbo-B47093 wrote:
  Hi Scott,
 
  Now the patch below has been merged on
  git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git.
  This issue should have been resolved.
  Thanks.
 
 
  commit 5fd26c7ecb32082745b0bd33c8e35badd1cb5a91
  Author: Ulf Hansson ulf.hans...@linaro.org
  Date:   Fri Jun 5 11:40:08 2015 +0200
 
  mmc: sdhci: Restore behavior while creating OCR mask
 
 
   -Original Message-
   From: Wood Scott-B07421
   Sent: Tuesday, June 09, 2015 4:31 AM
   To: Lu Yangbo-B47093
   Cc: linuxppc-dev@lists.ozlabs.org; linux-...@vger.kernel.org
   Subject: Re: powerpc/corenet: enable eSDHC
  
   On Mon, 2015-06-08 at 05:12 -0500, Lu Yangbo-B47093 wrote:
Thanks a lot, Scott.
And now a patch was merged on
git://git.linaro.org/people/ulf.hansson/mmc.git next branch to fix
this issue.
It should be no problem.
  
   Assuming that patch fixes it and gets pulled for 4.2, this config
   patch can go in for 4.3.
  
   That said, it would be nice if, apart from fixing the problem
   itself, the MMC code failed more gracefully instead of endlessly
   repeating and filling up the log/console.
  
   -Scott
 
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH] PowerPC: Add CPU hot plug feature to RCPM driver

2015-07-20 Thread b29983
From: Tang Yuantian yuantian.t...@freescale.com

PowerPC E500MC serial SoCs, like T2080 T1040 and T4240, use RCPM
to manage power consumption. This patch adds hot plug feature to
RCPM driver.

Signed-off-by: Chenhui Zhao chenhui.z...@freescale.com
Signed-off-by: Tang Yuantian yuantian.t...@freescale.com
---
 arch/powerpc/include/asm/fsl_pm.h |  2 ++
 arch/powerpc/sysdev/fsl_rcpm.c| 56 +++
 2 files changed, 58 insertions(+)

diff --git a/arch/powerpc/include/asm/fsl_pm.h 
b/arch/powerpc/include/asm/fsl_pm.h
index 4b09f09..0b03b03 100644
--- a/arch/powerpc/include/asm/fsl_pm.h
+++ b/arch/powerpc/include/asm/fsl_pm.h
@@ -33,6 +33,8 @@ struct fsl_pm_ops {
void (*irq_unmask)(int cpu);
void (*cpu_enter_state)(int cpu, int state);
void (*cpu_exit_state)(int cpu, int state);
+   void (*cpu_up)(int cpu);
+   void (*cpu_die)(int cpu);
int (*plat_enter_sleep)(void);
void (*freeze_time_base)(bool freeze);
 
diff --git a/arch/powerpc/sysdev/fsl_rcpm.c b/arch/powerpc/sysdev/fsl_rcpm.c
index 4bd2d64..acf3f94 100644
--- a/arch/powerpc/sysdev/fsl_rcpm.c
+++ b/arch/powerpc/sysdev/fsl_rcpm.c
@@ -128,6 +128,46 @@ static void rcpm_v2_cpu_enter_state(int cpu, int state)
}
 }
 
+static void rcpm_v1_cpu_die(int cpu)
+{
+   rcpm_v1_cpu_enter_state(cpu, E500_PM_PH15);
+}
+
+static void qoriq_disable_thread(void *info)
+{
+   int hw_cpu = get_hard_smp_processor_id(*(const int *)info);
+   int thread = cpu_thread_in_core(hw_cpu);
+
+   mtspr(SPRN_TENC, TEN_THREAD(thread));
+}
+
+static void rcpm_v2_cpu_die(int cpu)
+{
+   int primary;
+
+   if (threads_per_core == 1) {
+   rcpm_v2_cpu_enter_state(cpu, E500_PM_PH20);
+   return;
+   }
+
+   primary = cpu_first_thread_sibling(cpu);
+   if (cpu_is_offline(primary)  cpu_is_offline(primary + 1)) {
+   /* when two threads are all offline, put core in PH20 */
+   rcpm_v2_cpu_enter_state(cpu, E500_PM_PH20);
+   } else {
+   /*
+* When one thread is offline, disable the thread
+* by running qoriq_disable_thread() on the other thread.
+*/
+   if (cpu_online(primary))
+   smp_call_function_single(primary,
+   qoriq_disable_thread, cpu, 1);
+   else
+   smp_call_function_single(primary + 1,
+   qoriq_disable_thread, cpu, 1);
+   }
+}
+
 static void rcpm_v1_cpu_exit_state(int cpu, int state)
 {
int hw_cpu = get_hard_smp_processor_id(cpu);
@@ -146,6 +186,12 @@ static void rcpm_v1_cpu_exit_state(int cpu, int state)
}
 }
 
+static void rcpm_v1_cpu_up(int cpu)
+{
+   rcpm_v1_cpu_exit_state(cpu, E500_PM_PH15);
+   rcpm_v1_irq_unmask(cpu);
+}
+
 static void rcpm_v2_cpu_exit_state(int cpu, int state)
 {
int hw_cpu = get_hard_smp_processor_id(cpu);
@@ -169,6 +215,12 @@ static void rcpm_v2_cpu_exit_state(int cpu, int state)
}
 }
 
+static void rcpm_v2_cpu_up(int cpu)
+{
+   rcpm_v2_cpu_exit_state(cpu, E500_PM_PH20);
+   rcpm_v2_irq_unmask(cpu);
+}
+
 static int rcpm_v1_plat_enter_state(int state)
 {
u32 *pmcsr_reg = rcpm_v1_regs-powmgtcsr;
@@ -275,6 +327,8 @@ static const struct fsl_pm_ops qoriq_rcpm_v1_ops = {
.irq_unmask = rcpm_v1_irq_unmask,
.cpu_enter_state = rcpm_v1_cpu_enter_state,
.cpu_exit_state = rcpm_v1_cpu_exit_state,
+   .cpu_up = rcpm_v1_cpu_up,
+   .cpu_die = rcpm_v1_cpu_die,
.plat_enter_sleep = rcpm_v1_plat_enter_sleep,
.set_ip_power = rcpm_v1_set_ip_power,
.freeze_time_base = rcpm_v1_freeze_time_base,
@@ -286,6 +340,8 @@ static const struct fsl_pm_ops qoriq_rcpm_v2_ops = {
.irq_unmask = rcpm_v2_irq_unmask,
.cpu_enter_state = rcpm_v2_cpu_enter_state,
.cpu_exit_state = rcpm_v2_cpu_exit_state,
+   .cpu_up = rcpm_v2_cpu_up,
+   .cpu_die = rcpm_v2_cpu_die,
.plat_enter_sleep = rcpm_v2_plat_enter_sleep,
.set_ip_power = rcpm_v2_set_ip_power,
.freeze_time_base = rcpm_v2_freeze_time_base,
-- 
2.1.0.27.g96db324

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

Re: [PATCH] Fix crash due to processing memory-controller nodes as memory

2015-07-20 Thread Ian Munsie
Whoops - subject line was supposed to say kexec-lite: ...

-Ian

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

[PATCH] powerpc/powernv: Fix the log message when disabling VF

2015-07-20 Thread Wei Yang
On powernv platform, IOV BAR would be shifted if necessary. While the log
message is not correct when disabling VFs.

This patch fixes this by print correct message based on the offset value.

Signed-off-by: Wei Yang weiy...@linux.vnet.ibm.com
---
 arch/powerpc/platforms/powernv/pci-ioda.c |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c 
b/arch/powerpc/platforms/powernv/pci-ioda.c
index d1530cb..80b8099 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -946,8 +946,9 @@ static int pnv_pci_vf_resource_shift(struct pci_dev *dev, 
int offset)
res2 = *res;
res-start += size * offset;
 
-   dev_info(dev-dev, VF BAR%d: %pR shifted to %pR (enabling %d 
VFs shifted by %d)\n,
-i, res2, res, num_vfs, offset);
+   dev_info(dev-dev, VF BAR%d: %pR shifted to %pR (%sabling %d 
VFs shifted by %d)\n,
+i, res2, res, (offset  0) ? En : Dis,
+num_vfs, offset);
pci_update_resource(dev, i + PCI_IOV_RESOURCES);
}
return 0;
-- 
1.7.9.5

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

Re: [PATCH] macintosh/ans-lcd: fix build failure after module_init/exit relocation

2015-07-20 Thread Luis Henriques
On Sat, Jul 18, 2015 at 07:45:17PM -0400, Paul Gortmaker wrote:
 [[PATCH] macintosh/ans-lcd: fix build failure after module_init/exit 
 relocation] On 17/07/2015 (Fri 14:20) Luis Henriques wrote:
 
  After commit 0fd972a7d91d (module: relocate module_init from init.h to 
  module.h)
  ans-lcd module fails to build with:
  
  drivers/macintosh/ans-lcd.c:201:1: warning: data definition has no type or 
  storage class [enabled by default]
   module_init(anslcd_init);
   ^
  drivers/macintosh/ans-lcd.c:201:1: error: type defaults to 'int' in 
  declaration of 'module_init' [-Werror=implicit-int]
  drivers/macintosh/ans-lcd.c:201:1: warning: parameter names (without types) 
  in function declaration [enabled by default]
  drivers/macintosh/ans-lcd.c:202:1: warning: data definition has no type or 
  storage class [enabled by default]
   module_exit(anslcd_exit);
   ^
  drivers/macintosh/ans-lcd.c:202:1: error: type defaults to 'int' in 
  declaration of 'module_exit' [-Werror=implicit-int]
  drivers/macintosh/ans-lcd.c:202:1: warning: parameter names (without types) 
  in function declaration [enabled by default]
  drivers/macintosh/ans-lcd.c:155:1: warning: 'anslcd_init' defined but not 
  used [-Wunused-function]
   anslcd_init(void)
   ^
  drivers/macintosh/ans-lcd.c:195:1: warning: 'anslcd_exit' defined but not 
  used [-Wunused-function]
   anslcd_exit(void)
   ^
  
  This commit fixes it by replacing linux/init.h by linux/module.h.
 
 Guess it was inevitable I miss at least one.   This old beast must not
 get coverage under any of the ppc defconfigs or allmodconfig, since I
 did both...  are you using a custom config for an older box?


I was actually just using a Debian config, which has CONFIG_ANSLCD=m

Cheers,
--
Luís

 Anyway, the thing is controlled by a tristate, so this is the right fix.
 
 I don't have _any_ other fixes queued for that cleanup series, so I'm fine
 with this going via the ppc tree, since I'm sure there will be pending
 commits there.
 
 Acked-by: Paul Gortmaker paul.gortma...@windriver.com
 
 Thanks,
 Paul.
 --
 
  
  Fixes: 0fd972a7d91d (module: relocate module_init from init.h to module.h)
  Signed-off-by: Luis Henriques luis.henriq...@canonical.com
  ---
   drivers/macintosh/ans-lcd.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
  
  diff --git a/drivers/macintosh/ans-lcd.c b/drivers/macintosh/ans-lcd.c
  index 1a57e88a38f7..cd35079c8c98 100644
  --- a/drivers/macintosh/ans-lcd.c
  +++ b/drivers/macintosh/ans-lcd.c
  @@ -7,7 +7,7 @@
   #include linux/kernel.h
   #include linux/miscdevice.h
   #include linux/fcntl.h
  -#include linux/init.h
  +#include linux/module.h
   #include linux/delay.h
   #include linux/fs.h
   
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH V3 2/2] kprobes: Mark OPTPROBES na for powerpc

2015-07-20 Thread Ananth N Mavinakayanahalli
Kprobes uses a breakpoint instruction to trap into execution flow
and the probed instruction is single-stepped from an alternate location.

On some architectures like x86, under certain conditions, the OPTPROBES
feature enables replacing the probed instruction with a jump instead,
resulting in a significant perfomance boost (both the breakpoint and
single-step exception is bypassed for each kprobe).

Powerpc has an in-kernel instruction emulator. Kprobes on powerpc uses
this emulator already and bypasses the single-step exception, with a
lot less complexity. There is a potential gain to be had with a direct
jump instead of a breakpoint, but the caveats need to be traded off
with the complexity it brings in.

For now, mark OPTPROBES na for powerpc.

Signed-off-by: Ananth N Mavinakayanahalli ana...@in.ibm.com
---
 .../features/debug/optprobes/arch-support.txt  |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/features/debug/optprobes/arch-support.txt 
b/Documentation/features/debug/optprobes/arch-support.txt
index b8999d8..73662f9 100644
--- a/Documentation/features/debug/optprobes/arch-support.txt
+++ b/Documentation/features/debug/optprobes/arch-support.txt
@@ -27,7 +27,7 @@
 |   nios2: | TODO |
 |openrisc: | TODO |
 |  parisc: | TODO |
-| powerpc: | TODO |
+| powerpc: |  na  |
 |s390: | TODO |
 |   score: | TODO |
 |  sh: | TODO |

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

[PATCH part3 v12 00/10] Cleanup platform pci_domain_nr()

2015-07-20 Thread Yijing Wang
This series is splitted out from previous patchset
Refine PCI scan interfaces and make generic pci host bridge.
It try to clean up all platform pci_domain_nr(), save domain
in pci_host_bridge, so we could get domain number from the
common interface. 

v11-v12:
  Introduce wrap function pci_create_root_bus_generic()
  and pci_create_root_bus_generic() for arm/arm64 which
  enable CONFIG_PCI_DOMAINS_GENERIC.
  Rebased this series based 4.2-rc1

Yijing Wang (10):
  PCI: Save domain in pci_host_bridge
  PCI: Move pci_bus_assign_domain_nr() declaration into
drivers/pci/pci.h
  PCI: Remove declaration for pci_get_new_domain_nr()
  PCI: Introduce pci_host_assign_domain_nr() to assign domain
  powerpc/PCI: Rename pcibios_root_bridge_prepare() to
pcibios_root_bus_prepare()
  PCI: Make pci_host_bridge hold sysdata in drvdata
  PCI: Create pci host bridge prior to root bus
  PCI: Introduce common pci_domain_nr() and remove platform specific
code
  PCI: Remove pci_bus_assign_domain_nr()
  IA64/PCI: Fix build warning found by kbuild test

 arch/alpha/include/asm/pci.h |2 -
 arch/alpha/kernel/pci.c  |4 +-
 arch/alpha/kernel/sys_nautilus.c |2 +-
 arch/arm/kernel/bios32.c |2 +-
 arch/arm/mach-dove/pcie.c|2 +-
 arch/arm/mach-iop13xx/pci.c  |4 +-
 arch/arm/mach-mv78xx0/pcie.c |2 +-
 arch/arm/mach-orion5x/pci.c  |4 +-
 arch/frv/mb93090-mb00/pci-vdk.c  |3 +-
 arch/ia64/include/asm/pci.h  |1 -
 arch/ia64/pci/pci.c  |6 +-
 arch/ia64/sn/kernel/io_acpi_init.c   |6 +-
 arch/ia64/sn/kernel/io_init.c|6 +-
 arch/m68k/coldfire/pci.c |2 +-
 arch/microblaze/include/asm/pci.h|2 -
 arch/microblaze/pci/pci-common.c |   15 +
 arch/mips/include/asm/pci.h  |2 -
 arch/mips/pci/pci.c  |4 +-
 arch/mn10300/unit-asb2305/pci.c  |3 +-
 arch/powerpc/include/asm/machdep.h   |2 +-
 arch/powerpc/include/asm/pci.h   |2 -
 arch/powerpc/kernel/pci-common.c |   21 ++-
 arch/powerpc/platforms/pseries/pci.c |2 +-
 arch/powerpc/platforms/pseries/pseries.h |2 +-
 arch/powerpc/platforms/pseries/setup.c   |2 +-
 arch/s390/include/asm/pci.h  |1 -
 arch/s390/pci/pci.c  |   10 +---
 arch/sh/drivers/pci/pci.c|4 +-
 arch/sh/include/asm/pci.h|2 -
 arch/sparc/include/asm/pci_64.h  |1 -
 arch/sparc/kernel/leon_pci.c |2 +-
 arch/sparc/kernel/pci.c  |   21 +--
 arch/sparc/kernel/pcic.c |2 +-
 arch/tile/include/asm/pci.h  |2 -
 arch/tile/kernel/pci.c   |4 +-
 arch/tile/kernel/pci_gx.c|4 +-
 arch/unicore32/kernel/pci.c  |2 +-
 arch/x86/include/asm/pci.h   |6 --
 arch/x86/pci/acpi.c  |6 +-
 arch/x86/pci/common.c|2 +-
 arch/xtensa/kernel/pci.c |2 +-
 drivers/parisc/dino.c|2 +-
 drivers/parisc/lba_pci.c |2 +-
 drivers/pci/host/pci-versatile.c |3 +-
 drivers/pci/host/pci-xgene.c |2 +-
 drivers/pci/host/pcie-designware.c   |2 +-
 drivers/pci/host/pcie-iproc.c|2 +-
 drivers/pci/host/pcie-xilinx.c   |2 +-
 drivers/pci/hotplug/ibmphp_core.c|2 +-
 drivers/pci/pci.c|   31 --
 drivers/pci/pci.h|1 +
 drivers/pci/probe.c  |   92 +-
 drivers/pci/xen-pcifront.c   |2 +-
 include/linux/pci.h  |   39 ++---
 54 files changed, 161 insertions(+), 195 deletions(-)

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

[PATCH part3 v12 02/10] PCI: Move pci_bus_assign_domain_nr() declaration into drivers/pci/pci.h

2015-07-20 Thread Yijing Wang
pci_bus_assign_domain_nr() is only called in probe.c,
Move pci_bus_assign_domain_nr() declaration into
drivers/pci/pci.h.

Signed-off-by: Yijing Wang wangyij...@huawei.com
---
 drivers/pci/pci.h   |9 +
 include/linux/pci.h |6 --
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 4ff0ff1..02192aa 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -335,4 +335,13 @@ static inline int pci_dev_specific_reset(struct pci_dev 
*dev, int probe)
 
 struct pci_host_bridge *pci_find_host_bridge(struct pci_bus *bus);
 
+#ifdef CONFIG_PCI_DOMAINS_GENERIC
+void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent);
+#else
+static inline void pci_bus_assign_domain_nr(struct pci_bus *bus,
+   struct device *parent)
+{
+}
+#endif
+
 #endif /* DRIVERS_PCI_H */
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 50c0c47..f7e4204 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1337,12 +1337,6 @@ static inline int pci_domain_nr(struct pci_bus *bus)
 {
return bus-domain_nr;
 }
-void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent);
-#else
-static inline void pci_bus_assign_domain_nr(struct pci_bus *bus,
-   struct device *parent)
-{
-}
 #endif
 
 /* some architectures require additional setup to direct VGA traffic */
-- 
1.7.1

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

Re: [PATCH] kprobes: Mark OPTPROBES n/a for powerpc

2015-07-20 Thread Ananth N Mavinakayanahalli
On Sun, Jul 19, 2015 at 11:21:50AM +0900, Masami Hiramatsu wrote:
 On 2015/07/16 19:56, Ananth N Mavinakayanahalli wrote:
  Kprobes uses a breakpoint instruction to trap into execution flow
  and the probed instruction is single-stepped from an alternate location.
  
  On some architectures like x86, under certain conditions, the OPTPROBES
  feature enables replacing the probed instruction with a jump instead,
  resulting in a significant perfomance boost (one single-step exception
  is bypassed for each kprobe).
 
 The OPTPROBE is not only for bypassing the single-step exception, but also
 the breakpoint exception.
 Please see commit 0dc016dbd820260b (ARM: kprobes: enable OPTPROBES for ARM 
 32) too,
 which shows how it is done on RISC processor.

Yes, will fix and send.

  Powerpc has an in-kernel instruction emulator. Kprobes on powerpc uses
  this emulator already and bypasses the single-step exception, with a
  lot less complexity.
 
 So, this might miss the point. Since it is impossible to do on some RISC
 processor, I agree with this change, but it should be committed with
 correct comments.

Sure, thanks!

Ananth

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

[PATCH kernel] powerpc/powernv/ioda2: Fix calculation for memory allocated for TCE table

2015-07-20 Thread Alexey Kardashevskiy
The existing code stores the amount of memory allocated for a TCE table.
At the moment it uses @offset which is a virtual offset in the TCE table
which is only correct for a one level tables and it does not include
memory allocated for intermediate levels. When multilevel TCE table is
requested, WARN_ON in tce_iommu_create_table() prints a warning.

This adds an additional counter to pnv_pci_ioda2_table_do_alloc_pages()
to count actually allocated memory.

Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru
---

I was sure I sent it already but could not find it anywhere so reposting.
Sorry if it is a duplicate.


---
 arch/powerpc/platforms/powernv/pci-ioda.c | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c 
b/arch/powerpc/platforms/powernv/pci-ioda.c
index 5738d31..85cbc96 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -2220,7 +2220,7 @@ static void pnv_pci_ioda_setup_opal_tce_kill(struct 
pnv_phb *phb)
 
 static __be64 *pnv_pci_ioda2_table_do_alloc_pages(int nid, unsigned shift,
unsigned levels, unsigned long limit,
-   unsigned long *current_offset)
+   unsigned long *current_offset, unsigned long *total_allocated)
 {
struct page *tce_mem = NULL;
__be64 *addr, *tmp;
@@ -2236,6 +2236,7 @@ static __be64 *pnv_pci_ioda2_table_do_alloc_pages(int 
nid, unsigned shift,
}
addr = page_address(tce_mem);
memset(addr, 0, allocated);
+   *total_allocated += allocated;
 
--levels;
if (!levels) {
@@ -2245,7 +2246,7 @@ static __be64 *pnv_pci_ioda2_table_do_alloc_pages(int 
nid, unsigned shift,
 
for (i = 0; i  entries; ++i) {
tmp = pnv_pci_ioda2_table_do_alloc_pages(nid, shift,
-   levels, limit, current_offset);
+   levels, limit, current_offset, total_allocated);
if (!tmp)
break;
 
@@ -2267,7 +2268,7 @@ static long pnv_pci_ioda2_table_alloc_pages(int nid, 
__u64 bus_offset,
struct iommu_table *tbl)
 {
void *addr;
-   unsigned long offset = 0, level_shift;
+   unsigned long offset = 0, level_shift, total_allocated = 0;
const unsigned window_shift = ilog2(window_size);
unsigned entries_shift = window_shift - page_shift;
unsigned table_shift = max_t(unsigned, entries_shift + 3, PAGE_SHIFT);
@@ -2286,7 +2287,7 @@ static long pnv_pci_ioda2_table_alloc_pages(int nid, 
__u64 bus_offset,
 
/* Allocate TCE table */
addr = pnv_pci_ioda2_table_do_alloc_pages(nid, level_shift,
-   levels, tce_table_size, offset);
+   levels, tce_table_size, offset, total_allocated);
 
/* addr==NULL means that the first level allocation failed */
if (!addr)
@@ -2308,7 +2309,7 @@ static long pnv_pci_ioda2_table_alloc_pages(int nid, 
__u64 bus_offset,
page_shift);
tbl-it_level_size = 1ULL  (level_shift - 3);
tbl-it_indirect_levels = levels - 1;
-   tbl-it_allocated_size = offset;
+   tbl-it_allocated_size = total_allocated;
 
pr_devel(Created TCE table: ws=%08llx ts=%lx @%08llx\n,
window_size, tce_table_size, bus_offset);
-- 
2.4.0.rc3.8.gfb3e7d5

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

[PATCH part3 v12 10/10] IA64/PCI: Fix build warning found by kbuild test

2015-07-20 Thread Yijing Wang
Kbuild test robot found we passed a pci_dev * to
pci_domain_nr(). In old IA64 specific pci_domain_nr()
It was macro defines:

#define PCI_CONTROLLER(busdev) ((struct pci_controller *) busdev-sysdata)
#define pci_domain_nr(busdev)(PCI_CONTROLLER(busdev)-segment)

Both pci_dev * and pci_bus * have opaque sysdata, so IA64 specific
pci_domain_nr() could get the pci_controller and return the exact
domain number, but now we use common pci_domain_nr() functions, so we
should fix this warning.

Signed-off-by: Yijing Wang wangyij...@huawei.com
---
 arch/ia64/sn/kernel/io_acpi_init.c |6 +++---
 arch/ia64/sn/kernel/io_init.c  |2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/ia64/sn/kernel/io_acpi_init.c 
b/arch/ia64/sn/kernel/io_acpi_init.c
index 0640739..2fd7414 100644
--- a/arch/ia64/sn/kernel/io_acpi_init.c
+++ b/arch/ia64/sn/kernel/io_acpi_init.c
@@ -364,12 +364,12 @@ sn_acpi_get_pcidev_info(struct pci_dev *dev, struct 
pcidev_info **pcidev_info,
 status = acpi_evaluate_integer(rootbus_handle, METHOD_NAME__SEG, NULL,
segment);
 if (ACPI_SUCCESS(status)) {
-   if (segment != pci_domain_nr(dev)) {
+   if (segment != pci_domain_nr(dev-bus)) {
acpi_get_name(rootbus_handle, ACPI_FULL_PATHNAME,
name_buffer);
printk(KERN_ERR
   %s: Segment number mismatch, 0x%llx vs 0x%x 
for: %s\n,
-  __func__, segment, pci_domain_nr(dev),
+  __func__, segment, pci_domain_nr(dev-bus),
   (char *)name_buffer.pointer);
kfree(name_buffer.pointer);
return 1;
@@ -407,7 +407,7 @@ sn_acpi_get_pcidev_info(struct pci_dev *dev, struct 
pcidev_info **pcidev_info,
/* Build up the pcidev_info.pdi_slot_host_handle */
host_devfn = get_host_devfn(pcidev_match.handle, rootbus_handle);
(*pcidev_info)-pdi_slot_host_handle =
-   ((unsigned long) pci_domain_nr(dev)  40) |
+   ((unsigned long) pci_domain_nr(dev-bus)  40) |
/* bus == 0 */
host_devfn;
return 0;
diff --git a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c
index d528814..0bdab82 100644
--- a/arch/ia64/sn/kernel/io_init.c
+++ b/arch/ia64/sn/kernel/io_init.c
@@ -164,7 +164,7 @@ sn_io_slot_fixup(struct pci_dev *dev)
panic(%s: Unable to alloc memory for sn_irq_info, __func__);
 
/* Call to retrieve pci device information needed by kernel. */
-   status = sal_get_pcidev_info((u64) pci_domain_nr(dev),
+   status = sal_get_pcidev_info((u64) pci_domain_nr(dev-bus),
(u64) dev-bus-number,
dev-devfn,
(u64) __pa(pcidev_info),
-- 
1.7.1

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

[PATCH part3 v12 07/10] PCI: Create pci host bridge prior to root bus

2015-07-20 Thread Yijing Wang
Pci_host_bridge hold the domain number, we need
to assign domain number prior to root bus creation,
because root bus need to know the domain number
to check whether it's alreay exist. Also it's
preparation for separating pci_host_bridge creation
from pci_create_root_bus().

Signed-off-by: Yijing Wang wangyij...@huawei.com
---
 drivers/pci/probe.c |   58 +++---
 1 files changed, 31 insertions(+), 27 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 0ae8bf2..cb525aa 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -515,7 +515,7 @@ static void pci_release_host_bridge_dev(struct device *dev)
kfree(bridge);
 }
 
-static struct pci_host_bridge *pci_alloc_host_bridge(struct pci_bus *b)
+static struct pci_host_bridge *pci_alloc_host_bridge(void)
 {
struct pci_host_bridge *bridge;
 
@@ -524,7 +524,6 @@ static struct pci_host_bridge *pci_alloc_host_bridge(struct 
pci_bus *b)
return NULL;
 
INIT_LIST_HEAD(bridge-windows);
-   bridge-bus = b;
return bridge;
 }
 
@@ -1938,48 +1937,53 @@ struct pci_bus *pci_create_root_bus(struct device 
*parent, int domain,
 {
int error;
struct pci_host_bridge *bridge;
-   struct pci_bus *b, *b2;
+   struct pci_bus *b;
struct resource_entry *window, *n;
struct resource *res;
resource_size_t offset;
char bus_addr[64];
char *fmt;
 
-   b = pci_alloc_bus(NULL);
-   if (!b)
+   bridge = pci_alloc_host_bridge();
+   if (!bridge)
return NULL;
 
-   b-sysdata = sysdata;
-   b-ops = ops;
-   b-number = b-busn_res.start = bus;
-   pci_bus_assign_domain_nr(b, parent);
-   b2 = pci_find_bus(pci_domain_nr(b), bus);
-   if (b2) {
+   bridge-dev.parent = parent;
+   pci_host_assign_domain_nr(bridge, domain);
+
+   b = pci_find_bus(bridge-domain, bus);
+   if (b) {
/* If we already got to this bus through a different bridge, 
ignore it */
-   dev_dbg(b2-dev, bus already known\n);
-   goto err_out;
+   dev_dbg(b-dev, bus already known\n);
+   kfree(bridge);
+   return NULL;
}
 
-   bridge = pci_alloc_host_bridge(b);
-   if (!bridge)
-   goto err_out;
-
-   bridge-domain = domain;
-   bridge-dev.parent = parent;
bridge-dev.release = pci_release_host_bridge_dev;
dev_set_drvdata(bridge-dev, sysdata);
-   dev_set_name(bridge-dev, pci%04x:%02x, pci_domain_nr(b), bus);
+   dev_set_name(bridge-dev, pci%04x:%02x, bridge-domain, bus);
error = pcibios_root_bridge_prepare(bridge);
if (error) {
kfree(bridge);
-   goto err_out;
+   return NULL;
}
 
error = device_register(bridge-dev);
if (error) {
put_device(bridge-dev);
-   goto err_out;
+   return NULL;
}
+
+   b = pci_alloc_bus(NULL);
+   if (!b)
+   goto unregister_host;
+
+   bridge-bus = b;
+   b-sysdata = sysdata;
+   b-ops = ops;
+   b-number = b-busn_res.start = bus;
+   pci_bus_assign_domain_nr(b, parent);
+
b-bridge = get_device(bridge-dev);
device_enable_async_suspend(b-bridge);
pci_set_bus_of_node(b);
@@ -1992,11 +1996,11 @@ struct pci_bus *pci_create_root_bus(struct device 
*parent, int domain,
dev_set_name(b-dev, %04x:%02x, pci_domain_nr(b), bus);
error = pcibios_root_bus_prepare(bridge);
if (error)
-   goto class_dev_reg_err;
+   goto free_bus;
 
error = device_register(b-dev);
if (error)
-   goto class_dev_reg_err;
+   goto free_bus;
 
pcibios_add_bus(b);
 
@@ -2036,11 +2040,11 @@ struct pci_bus *pci_create_root_bus(struct device 
*parent, int domain,
 
return b;
 
-class_dev_reg_err:
+free_bus:
+   kfree(b);
put_device(bridge-dev);
+unregister_host:
device_unregister(bridge-dev);
-err_out:
-   kfree(b);
return NULL;
 }
 EXPORT_SYMBOL_GPL(pci_create_root_bus);
-- 
1.7.1

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

[PATCH part3 v12 04/10] PCI: Introduce pci_host_assign_domain_nr() to assign domain

2015-07-20 Thread Yijing Wang
Introduce pci_host_assign_domain_nr() to assign domain number
for pci_host_bridge.

Signed-off-by: Yijing Wang wangyij...@huawei.com
---
 drivers/pci/pci.c |   24 +++-
 drivers/pci/pci.h |1 +
 2 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 59032e2..79d01e4 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -4484,10 +4484,10 @@ static int pci_get_new_domain_nr(void)
return atomic_inc_return(__domain_nr);
 }
 
-void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
+static int pci_assign_domain_nr(struct device *dev)
 {
static int use_dt_domains = -1;
-   int domain = of_get_pci_domain_nr(parent-of_node);
+   int domain = of_get_pci_domain_nr(dev-of_node);
 
/*
 * Check DT domain and use_dt_domains values.
@@ -4521,16 +4521,30 @@ void pci_bus_assign_domain_nr(struct pci_bus *bus, 
struct device *parent)
use_dt_domains = 0;
domain = pci_get_new_domain_nr();
} else {
-   dev_err(parent, Node %s has inconsistent \linux,pci-domain\ 
property in DT\n,
-   parent-of_node-full_name);
+   dev_err(dev, Node %s has inconsistent \linux,pci-domain\ 
property in DT\n,
+   dev-of_node-full_name);
domain = -1;
}
 
-   bus-domain_nr = domain;
+   return domain;
+}
+
+void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
+{
+   bus-domain_nr = pci_assign_domain_nr(parent);
 }
 #endif
 #endif
 
+void pci_host_assign_domain_nr(struct pci_host_bridge *host, int domain)
+{
+#ifdef CONFIG_PCI_DOMAINS_GENERIC
+   host-domain = pci_assign_domain_nr(host-dev.parent);
+#else
+   host-domain = domain;
+#endif
+}
+
 /**
  * pci_ext_cfg_avail - can we access extended PCI config space?
  *
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 02192aa..4a815c9 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -344,4 +344,5 @@ static inline void pci_bus_assign_domain_nr(struct pci_bus 
*bus,
 }
 #endif
 
+void pci_host_assign_domain_nr(struct pci_host_bridge *host, int domain);
 #endif /* DRIVERS_PCI_H */
-- 
1.7.1

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

Re: [RFC,v3,12/12] fsl/fman: Add FMan MAC driver

2015-07-20 Thread Joakim Tjernlund
On Wed, 2015-04-29 at 12:29 +0300, Igal.Liberman wrote:
 From: Igal Liberman igal.liber...@freescale.com
 
 This patch adds the Ethernet MAC driver support.
 
 Signed-off-by: Igal Liberman igal.liber...@freescale.com
 ---
  drivers/net/ethernet/freescale/fman/inc/mac.h |  125 +
  drivers/net/ethernet/freescale/fman/mac/Makefile  |3 +-
  drivers/net/ethernet/freescale/fman/mac/mac-api.c |  605 
 +
  drivers/net/ethernet/freescale/fman/mac/mac.c |  527 ++
  4 files changed, 1259 insertions(+), 1 deletion(-)
  create mode 100644 drivers/net/ethernet/freescale/fman/inc/mac.h
  create mode 100644 drivers/net/ethernet/freescale/fman/mac/mac-api.c
  create mode 100644 drivers/net/ethernet/freescale/fman/mac/mac.c
 
 diff --git a/drivers/net/ethernet/freescale/fman/inc/mac.h 
 b/drivers/net/ethernet/freescale/fman/inc/mac.h
 new file mode 100644
 index 000..2d27331
 --- /dev/null
 +++ b/drivers/net/ethernet/freescale/fman/inc/mac.h
.
 + /* Get the rest of the PHY information */
 + mac_dev-phy_node = of_parse_phandle(mac_node, phy-handle, 0);
 + if (!mac_dev-phy_node) {
 + int sz;
 + const u32 *phy_id = of_get_property(mac_node, fixed-link,
 + sz);
 + if (!phy_id || sz  sizeof(*phy_id)) {
 + dev_err(dev, No PHY (or fixed link) found\n);
 + _errno = -EINVAL;
 + goto _return_dev_set_drvdata;
 + }
 +
 + sprintf(mac_dev-fixed_bus_id, PHY_ID_FMT, fixed-0,
 + phy_id[0]);
 + }

The above for fixed PHY does not work for me, changing it to does:

diff --git a/drivers/net/ethernet/freescale/fman/mac/mac.c 
b/drivers/net/ethernet/freescale/fman/mac/mac.c
index 4eb8f7c..a8be96a 100644
--- a/drivers/net/ethernet/freescale/fman/mac/mac.c
+++ b/drivers/net/ethernet/freescale/fman/mac/mac.c
@@ -42,6 +42,7 @@
 #include linux/module.h
 #include linux/of_address.h
 #include linux/of_platform.h
+#include linux/of_mdio.h
 #include linux/of_net.h
 #include linux/device.h
 #include linux/phy.h
@@ -399,7 +400,7 @@ static int __cold mac_probe(struct platform_device *_of_dev)
 
/* Get the rest of the PHY information */
mac_dev-phy_node = of_parse_phandle(mac_node, phy-handle, 0);
-   if (!mac_dev-phy_node) {
+   if (0  !mac_dev-phy_node) {
int sz;
const u32 *phy_id = of_get_property(mac_node, fixed-link,
sz);
@@ -412,6 +413,16 @@ static int __cold mac_probe(struct platform_device 
*_of_dev)
sprintf(mac_dev-fixed_bus_id, PHY_ID_FMT, fixed-0,
phy_id[0]);
}
+   if (!mac_dev-phy_node  of_phy_is_fixed_link(mac_node)) {
+   /*
+* In the case of a fixed PHY, the DT node associated
+* to the PHY is the Ethernet MAC DT node.
+*/
+   _errno = of_phy_register_fixed_link(mac_node);
+   if (_errno)
+   return _errno;
+   mac_dev-phy_node = of_node_get(mac_node);
+   }
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

RE: [PATCH RFC 02/10] dpaa_eth: add support for DPAA Ethernet

2015-07-20 Thread Madalin-Cristian Bucur
Hi Joakim

 -Original Message-
 From: Joakim Tjernlund [mailto:joakim.tjernl...@transmode.se]
 Sent: Monday, July 20, 2015 10:57 AM
 To: linuxppc-dev@lists.ozlabs.org; net...@vger.kernel.org; Bucur Madalin-
 Cristian-B32716
 Cc: linux-ker...@vger.kernel.org
 Subject: Re: [PATCH RFC 02/10] dpaa_eth: add support for DPAA Ethernet
 
 On Mon, 2015-07-20 at 09:54 +0200, Joakim Tjernlund wrote:
  On Wed, 2015-04-01 at 19:19 +0300, Madalin Bucur wrote:
   This introduces the Freescale Data Path Acceleration Architecture
   (DPAA) Ethernet driver (dpaa_eth) that builds upon the DPAA QMan,
   BMan, PAMU and FMan drivers to deliver Ethernet connectivity on
   the Freescale DPAA QorIQ platforms.
  
   Signed-off-by: Madalin Bucur madalin.bu...@freescale.com
   ---
  
   + snprintf(net_dev-name, IFNAMSIZ, fm%d-mac%d,
   +  dpa_mac_fman_index_get(pdev),
   +  dpa_mac_hw_index_get(pdev));
 
  Should ethernet drivers dictate interface name in user space nowadays?
  I would prefer if you didn't.

The preformatted interface name was thought as a helper for quick interface
identification. It also ensures constant naming of the interfaces, i.e. if you
add/remove PCI network cards. One can make use of udev rules to override
default interface names (eth%d) in userspace.

Another reason for using this is that the interface name was also used for the
debugfs file name and when compiling dpaa_eth as a module there was a
problem with udev concurrently renaming interfaces from eth0 to something
like fmx-macy, making the next probed DPAA interface temporarily get the
eth0 name (before being renamed fmx-macw). Subsequently,
the debugfs_create_file(net_dev-name,...) call failed because of duplicated
names.

If this is considered more of a bug than a feature, I can remove it and only 
change
the naming of the debugfs entries to avoid the udev issue.

  I am trying these patches on a custom T1042 board using Linux 4.1 but
  I cannot get Fixed PHY to work:
  libphy: PHY fixed-0:00 not found
  fsl_dpa dpaa-ethernet.2 eth2: Could not connect to PHY fixed-0:00
  fsl_dpa dpaa-ethernet.2 eth2: init_phy() = -19
 
  Not sure what I have missed here, any ideas?
 
 I meant I am using
 http://git.freescale.com/git/cgit.cgi/ppc/upstream/linux.git/
 on top of 4.1
 
  Jocke

Please make sure you have CONFIG_FIXED_PHY=y in your .config.
Can you please share the device tree part where you've added the fixed-link 
entry?

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

Re: [RFC,v3,12/12] fsl/fman: Add FMan MAC driver

2015-07-20 Thread Joakim Tjernlund
On Mon, 2015-07-20 at 12:28 +, Madalin-Cristian Bucur wrote:
 Hi Joakim,
 
 It seems we just need to align to the API introduced by Thomas Petazzoni
 in 3be2a49e.
 
 Madalin

So it seems, any idea when the next spin will be ready?
Could you also push it onto 
  http://git.freescale.com/git/cgit.cgi/ppc/upstream/linux.git/
?

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

[PATCH part3 v12 03/10] PCI: Remove declaration for pci_get_new_domain_nr()

2015-07-20 Thread Yijing Wang
pci_get_new_domain_nr() is only used in drivers/pci/pci.c,
remove the declaration in include/linux/pci.h.

Signed-off-by: Yijing Wang wangyij...@huawei.com
---
 drivers/pci/pci.c   |4 ++--
 include/linux/pci.h |3 ---
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 0008c95..59032e2 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -4476,14 +4476,14 @@ static void pci_no_domains(void)
 }
 
 #ifdef CONFIG_PCI_DOMAINS
+#ifdef CONFIG_PCI_DOMAINS_GENERIC
 static atomic_t __domain_nr = ATOMIC_INIT(-1);
 
-int pci_get_new_domain_nr(void)
+static int pci_get_new_domain_nr(void)
 {
return atomic_inc_return(__domain_nr);
 }
 
-#ifdef CONFIG_PCI_DOMAINS_GENERIC
 void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
 {
static int use_dt_domains = -1;
diff --git a/include/linux/pci.h b/include/linux/pci.h
index f7e4204..4524592 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1319,12 +1319,10 @@ void pci_cfg_access_unlock(struct pci_dev *dev);
  */
 #ifdef CONFIG_PCI_DOMAINS
 extern int pci_domains_supported;
-int pci_get_new_domain_nr(void);
 #else
 enum { pci_domains_supported = 0 };
 static inline int pci_domain_nr(struct pci_bus *bus) { return 0; }
 static inline int pci_proc_domain(struct pci_bus *bus) { return 0; }
-static inline int pci_get_new_domain_nr(void) { return -ENOSYS; }
 #endif /* CONFIG_PCI_DOMAINS */
 
 /*
@@ -1445,7 +1443,6 @@ static inline struct pci_dev 
*pci_get_bus_and_slot(unsigned int bus,
 
 static inline int pci_domain_nr(struct pci_bus *bus) { return 0; }
 static inline struct pci_dev *pci_dev_get(struct pci_dev *dev) { return NULL; }
-static inline int pci_get_new_domain_nr(void) { return -ENOSYS; }
 
 #define dev_is_pci(d) (false)
 #define dev_is_pf(d) (false)
-- 
1.7.1

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

[PATCH part3 v12 01/10] PCI: Save domain in pci_host_bridge

2015-07-20 Thread Yijing Wang
Save domain in pci_host_bridge, so we could get domain
from pci_host_bridge, and at the end of series, we could
clean up the arch specific pci_domain_nr(). For arm/arm64,
the domain argument is pointless, because they enable
CONFIG_PCI_DOMAINS_GENERIC, PCI core would assign domain
number for them, so introduce pci_create_root_bus_generic
and pci_scan_root_bus_generic() which simply assign domain
number to -1.

Tested-by: Gregory CLEMENT gregory.clem...@free-electrons.com #mvebu part
Signed-off-by: Yijing Wang wangyij...@huawei.com
---
 arch/alpha/kernel/pci.c|4 ++--
 arch/alpha/kernel/sys_nautilus.c   |2 +-
 arch/arm/kernel/bios32.c   |2 +-
 arch/arm/mach-dove/pcie.c  |2 +-
 arch/arm/mach-iop13xx/pci.c|4 ++--
 arch/arm/mach-mv78xx0/pcie.c   |2 +-
 arch/arm/mach-orion5x/pci.c|4 ++--
 arch/frv/mb93090-mb00/pci-vdk.c|3 ++-
 arch/ia64/pci/pci.c|4 ++--
 arch/ia64/sn/kernel/io_init.c  |4 ++--
 arch/m68k/coldfire/pci.c   |2 +-
 arch/microblaze/pci/pci-common.c   |4 ++--
 arch/mips/pci/pci.c|4 ++--
 arch/mn10300/unit-asb2305/pci.c|3 ++-
 arch/powerpc/kernel/pci-common.c   |4 ++--
 arch/s390/pci/pci.c|4 ++--
 arch/sh/drivers/pci/pci.c  |4 ++--
 arch/sparc/kernel/leon_pci.c   |2 +-
 arch/sparc/kernel/pci.c|4 ++--
 arch/sparc/kernel/pcic.c   |2 +-
 arch/tile/kernel/pci.c |4 ++--
 arch/tile/kernel/pci_gx.c  |4 ++--
 arch/unicore32/kernel/pci.c|2 +-
 arch/x86/pci/acpi.c|4 ++--
 arch/x86/pci/common.c  |2 +-
 arch/xtensa/kernel/pci.c   |2 +-
 drivers/parisc/dino.c  |2 +-
 drivers/parisc/lba_pci.c   |2 +-
 drivers/pci/host/pci-versatile.c   |3 ++-
 drivers/pci/host/pci-xgene.c   |2 +-
 drivers/pci/host/pcie-designware.c |2 +-
 drivers/pci/host/pcie-iproc.c  |2 +-
 drivers/pci/host/pcie-xilinx.c |2 +-
 drivers/pci/hotplug/ibmphp_core.c  |2 +-
 drivers/pci/probe.c|   21 +
 drivers/pci/xen-pcifront.c |2 +-
 include/linux/pci.h|   20 +---
 37 files changed, 82 insertions(+), 60 deletions(-)

diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c
index 82f738e..2b0bce9 100644
--- a/arch/alpha/kernel/pci.c
+++ b/arch/alpha/kernel/pci.c
@@ -336,8 +336,8 @@ common_init_pci(void)
pci_add_resource_offset(resources, hose-mem_space,
hose-mem_space-start);
 
-   bus = pci_scan_root_bus(NULL, next_busno, alpha_mv.pci_ops,
-   hose, resources);
+   bus = pci_scan_root_bus(NULL, hose-index, next_busno,
+   alpha_mv.pci_ops, hose, resources);
if (!bus)
continue;
hose-bus = bus;
diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c
index 2cfaa0e..5d4f56f 100644
--- a/arch/alpha/kernel/sys_nautilus.c
+++ b/arch/alpha/kernel/sys_nautilus.c
@@ -205,7 +205,7 @@ nautilus_init_pci(void)
unsigned long memtop = max_low_pfn  PAGE_SHIFT;
 
/* Scan our single hose.  */
-   bus = pci_scan_bus(0, alpha_mv.pci_ops, hose);
+   bus = pci_scan_bus(hose-index, 0, alpha_mv.pci_ops, hose);
if (!bus)
return;
 
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
index fc1..c7919c5 100644
--- a/arch/arm/kernel/bios32.c
+++ b/arch/arm/kernel/bios32.c
@@ -486,7 +486,7 @@ static void pcibios_init_hw(struct device *parent, struct 
hw_pci *hw,
if (hw-scan)
sys-bus = hw-scan(nr, sys);
else
-   sys-bus = pci_scan_root_bus(parent, sys-busnr,
+   sys-bus = pci_scan_root_bus_generic(parent, 
sys-busnr,
hw-ops, sys, sys-resources);
 
if (!sys-bus)
diff --git a/arch/arm/mach-dove/pcie.c b/arch/arm/mach-dove/pcie.c
index 91fe971..2bbdd3f 100644
--- a/arch/arm/mach-dove/pcie.c
+++ b/arch/arm/mach-dove/pcie.c
@@ -160,7 +160,7 @@ dove_pcie_scan_bus(int nr, struct pci_sys_data *sys)
return NULL;
}
 
-   return pci_scan_root_bus(NULL, sys-busnr, pcie_ops, sys,
+   return pci_scan_root_bus_generic(NULL, sys-busnr, pcie_ops, sys,
 sys-resources);
 }
 
diff --git a/arch/arm/mach-iop13xx/pci.c b/arch/arm/mach-iop13xx/pci.c
index 9082b84..0b60464 100644
--- a/arch/arm/mach-iop13xx/pci.c
+++ b/arch/arm/mach-iop13xx/pci.c
@@ -535,12 +535,12 @@ struct pci_bus *iop13xx_scan_bus(int nr, struct 
pci_sys_data *sys)
while(time_before(jiffies, 

[PATCH part3 v12 06/10] PCI: Make pci_host_bridge hold sysdata in drvdata

2015-07-20 Thread Yijing Wang
Now platform specific sysdata is saved in pci_bus,
and pcibios_root_bridge_prepare() need to know
the sysdata. Later, we would move pcibios_root_bridge_prepare()
prior to root bus creation, so we need to make
pci_host_bridge hold sysdata.

Signed-off-by: Yijing Wang wangyij...@huawei.com
---
 arch/ia64/pci/pci.c |2 +-
 arch/x86/pci/acpi.c |2 +-
 drivers/pci/probe.c |1 +
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index 67ffe1f..8f79852 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -485,7 +485,7 @@ int pcibios_root_bridge_prepare(struct pci_host_bridge 
*bridge)
 * that case.
 */
if (!bridge-dev.parent) {
-   struct pci_controller *controller = bridge-bus-sysdata;
+   struct pci_controller *controller = 
dev_get_drvdata(bridge-dev);
ACPI_COMPANION_SET(bridge-dev, controller-companion);
}
return 0;
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index 629fc3b..38ce348 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -502,7 +502,7 @@ int pcibios_root_bridge_prepare(struct pci_host_bridge 
*bridge)
 * that case.
 */
if (!bridge-dev.parent) {
-   struct pci_sysdata *sd = bridge-bus-sysdata;
+   struct pci_sysdata *sd = dev_get_drvdata(bridge-dev);
ACPI_COMPANION_SET(bridge-dev, sd-companion);
}
return 0;
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 0eba126..0ae8bf2 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1967,6 +1967,7 @@ struct pci_bus *pci_create_root_bus(struct device 
*parent, int domain,
bridge-domain = domain;
bridge-dev.parent = parent;
bridge-dev.release = pci_release_host_bridge_dev;
+   dev_set_drvdata(bridge-dev, sysdata);
dev_set_name(bridge-dev, pci%04x:%02x, pci_domain_nr(b), bus);
error = pcibios_root_bridge_prepare(bridge);
if (error) {
-- 
1.7.1

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

[PATCH part3 v12 09/10] PCI: Remove pci_bus_assign_domain_nr()

2015-07-20 Thread Yijing Wang
Now we save the domain number in pci_host_bridge,
we could remove pci_bus_assign_domain_nr() and
clean the domain member in pci_bus.

Signed-off-by: Yijing Wang wangyij...@huawei.com
---
 drivers/pci/pci.c   |5 -
 drivers/pci/pci.h   |9 -
 drivers/pci/probe.c |   11 +++
 include/linux/pci.h |3 ---
 4 files changed, 3 insertions(+), 25 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 0074420..cac136a 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -4536,11 +4536,6 @@ static int pci_assign_domain_nr(struct device *dev)
 
return domain;
 }
-
-void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
-{
-   bus-domain_nr = pci_assign_domain_nr(parent);
-}
 #endif
 #endif
 
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 4a815c9..5c4b0dd 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -335,14 +335,5 @@ static inline int pci_dev_specific_reset(struct pci_dev 
*dev, int probe)
 
 struct pci_host_bridge *pci_find_host_bridge(struct pci_bus *bus);
 
-#ifdef CONFIG_PCI_DOMAINS_GENERIC
-void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent);
-#else
-static inline void pci_bus_assign_domain_nr(struct pci_bus *bus,
-   struct device *parent)
-{
-}
-#endif
-
 void pci_host_assign_domain_nr(struct pci_host_bridge *host, int domain);
 #endif /* DRIVERS_PCI_H */
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index cb525aa..5f2388b 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -481,7 +481,7 @@ void pci_read_bridge_bases(struct pci_bus *child)
}
 }
 
-static struct pci_bus *pci_alloc_bus(struct pci_bus *parent)
+static struct pci_bus *pci_alloc_bus(void)
 {
struct pci_bus *b;
 
@@ -496,10 +496,6 @@ static struct pci_bus *pci_alloc_bus(struct pci_bus 
*parent)
INIT_LIST_HEAD(b-resources);
b-max_bus_speed = PCI_SPEED_UNKNOWN;
b-cur_bus_speed = PCI_SPEED_UNKNOWN;
-#ifdef CONFIG_PCI_DOMAINS_GENERIC
-   if (parent)
-   b-domain_nr = parent-domain_nr;
-#endif
return b;
 }
 
@@ -670,7 +666,7 @@ static struct pci_bus *pci_alloc_child_bus(struct pci_bus 
*parent,
/*
 * Allocate a new bus, and inherit stuff from the parent..
 */
-   child = pci_alloc_bus(parent);
+   child = pci_alloc_bus();
if (!child)
return NULL;
 
@@ -1974,7 +1970,7 @@ struct pci_bus *pci_create_root_bus(struct device 
*parent, int domain,
return NULL;
}
 
-   b = pci_alloc_bus(NULL);
+   b = pci_alloc_bus();
if (!b)
goto unregister_host;
 
@@ -1982,7 +1978,6 @@ struct pci_bus *pci_create_root_bus(struct device 
*parent, int domain,
b-sysdata = sysdata;
b-ops = ops;
b-number = b-busn_res.start = bus;
-   pci_bus_assign_domain_nr(b, parent);
 
b-bridge = get_device(bridge-dev);
device_enable_async_suspend(b-bridge);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 6b4789c..8293f61 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -461,9 +461,6 @@ struct pci_bus {
unsigned char   primary;/* number of primary bridge */
unsigned char   max_bus_speed;  /* enum pci_bus_speed */
unsigned char   cur_bus_speed;  /* enum pci_bus_speed */
-#ifdef CONFIG_PCI_DOMAINS_GENERIC
-   int domain_nr;
-#endif
 
charname[48];
 
-- 
1.7.1

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

Re: [PATCH RFC 02/10] dpaa_eth: add support for DPAA Ethernet

2015-07-20 Thread Joakim Tjernlund
On Mon, 2015-07-20 at 12:18 +, Madalin-Cristian Bucur wrote:
 Hi Joakim
 
  -Original Message-
  From: Joakim Tjernlund [mailto:joakim.tjernl...@transmode.se]
  Sent: Monday, July 20, 2015 10:57 AM
  To: linuxppc-dev@lists.ozlabs.org; net...@vger.kernel.org; Bucur Madalin-
  Cristian-B32716
  Cc: linux-ker...@vger.kernel.org
  Subject: Re: [PATCH RFC 02/10] dpaa_eth: add support for DPAA Ethernet
  
  On Mon, 2015-07-20 at 09:54 +0200, Joakim Tjernlund wrote:
   On Wed, 2015-04-01 at 19:19 +0300, Madalin Bucur wrote:
This introduces the Freescale Data Path Acceleration Architecture
(DPAA) Ethernet driver (dpaa_eth) that builds upon the DPAA QMan,
BMan, PAMU and FMan drivers to deliver Ethernet connectivity on
the Freescale DPAA QorIQ platforms.

Signed-off-by: Madalin Bucur madalin.bu...@freescale.com
---
   
+   snprintf(net_dev-name, IFNAMSIZ, fm%d-mac%d,
+dpa_mac_fman_index_get(pdev),
+dpa_mac_hw_index_get(pdev));
   
   Should ethernet drivers dictate interface name in user space nowadays?
   I would prefer if you didn't.
 
 The preformatted interface name was thought as a helper for quick interface
 identification. It also ensures constant naming of the interfaces, i.e. if you
 add/remove PCI network cards. One can make use of udev rules to override
 default interface names (eth%d) in userspace.

I am not well versed in ethernet interface naming but I think you are just 
creating
another name space here. To me one either have the old eth%d names or let udev 
do
the naming so there is some order w.r.t interface naming.

I also find it handy to be able to control which I/F is eth0 etc. just by 
changing
the order they are listed in the device tree. This makes our application happy 
:)

 
 Another reason for using this is that the interface name was also used for the
 debugfs file name and when compiling dpaa_eth as a module there was a
 problem with udev concurrently renaming interfaces from eth0 to something
 like fmx-macy, making the next probed DPAA interface temporarily get the
 eth0 name (before being renamed fmx-macw). Subsequently,
 the debugfs_create_file(net_dev-name,...) call failed because of duplicated
 names.
 
 If this is considered more of a bug than a feature, I can remove it and only 
 change
 the naming of the debugfs entries to avoid the udev issue.

Perhaps netdev list can advise?

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

RE: [RFC,v3,12/12] fsl/fman: Add FMan MAC driver

2015-07-20 Thread Madalin-Cristian Bucur
Hi Joakim,

It seems we just need to align to the API introduced by Thomas Petazzoni
in 3be2a49e.

Madalin

 -Original Message-
 From: Joakim Tjernlund [mailto:joakim.tjernl...@transmode.se]
 Sent: Monday, July 20, 2015 3:16 PM
 To: net...@vger.kernel.org; Liberman Igal-B31950
 Cc: linuxppc-dev@lists.ozlabs.org; linux-ker...@vger.kernel.org; Bucur
 Madalin-Cristian-B32716
 Subject: Re: [RFC,v3,12/12] fsl/fman: Add FMan MAC driver
 
 On Wed, 2015-04-29 at 12:29 +0300, Igal.Liberman wrote:
  From: Igal Liberman igal.liber...@freescale.com
 
  This patch adds the Ethernet MAC driver support.
 
  Signed-off-by: Igal Liberman igal.liber...@freescale.com
  ---
   drivers/net/ethernet/freescale/fman/inc/mac.h |  125 +
   drivers/net/ethernet/freescale/fman/mac/Makefile  |3 +-
   drivers/net/ethernet/freescale/fman/mac/mac-api.c |  605
 +
   drivers/net/ethernet/freescale/fman/mac/mac.c |  527
 ++
   4 files changed, 1259 insertions(+), 1 deletion(-)
   create mode 100644 drivers/net/ethernet/freescale/fman/inc/mac.h
   create mode 100644 drivers/net/ethernet/freescale/fman/mac/mac-api.c
   create mode 100644 drivers/net/ethernet/freescale/fman/mac/mac.c
 
  diff --git a/drivers/net/ethernet/freescale/fman/inc/mac.h
 b/drivers/net/ethernet/freescale/fman/inc/mac.h
  new file mode 100644
  index 000..2d27331
  --- /dev/null
  +++ b/drivers/net/ethernet/freescale/fman/inc/mac.h
 .
  +   /* Get the rest of the PHY information */
  +   mac_dev-phy_node = of_parse_phandle(mac_node, phy-handle,
 0);
  +   if (!mac_dev-phy_node) {
  +   int sz;
  +   const u32 *phy_id = of_get_property(mac_node, fixed-
 link,
  +   sz);
  +   if (!phy_id || sz  sizeof(*phy_id)) {
  +   dev_err(dev, No PHY (or fixed link) found\n);
  +   _errno = -EINVAL;
  +   goto _return_dev_set_drvdata;
  +   }
  +
  +   sprintf(mac_dev-fixed_bus_id, PHY_ID_FMT, fixed-0,
  +   phy_id[0]);
  +   }
 
 The above for fixed PHY does not work for me, changing it to does:
 
 diff --git a/drivers/net/ethernet/freescale/fman/mac/mac.c
 b/drivers/net/ethernet/freescale/fman/mac/mac.c
 index 4eb8f7c..a8be96a 100644
 --- a/drivers/net/ethernet/freescale/fman/mac/mac.c
 +++ b/drivers/net/ethernet/freescale/fman/mac/mac.c
 @@ -42,6 +42,7 @@
  #include linux/module.h
  #include linux/of_address.h
  #include linux/of_platform.h
 +#include linux/of_mdio.h
  #include linux/of_net.h
  #include linux/device.h
  #include linux/phy.h
 @@ -399,7 +400,7 @@ static int __cold mac_probe(struct platform_device
 *_of_dev)
 
 /* Get the rest of the PHY information */
 mac_dev-phy_node = of_parse_phandle(mac_node, phy-handle, 0);
 -   if (!mac_dev-phy_node) {
 +   if (0  !mac_dev-phy_node) {
 int sz;
 const u32 *phy_id = of_get_property(mac_node, fixed-link,
 sz);
 @@ -412,6 +413,16 @@ static int __cold mac_probe(struct platform_device
 *_of_dev)
 sprintf(mac_dev-fixed_bus_id, PHY_ID_FMT, fixed-0,
 phy_id[0]);
 }
 +   if (!mac_dev-phy_node  of_phy_is_fixed_link(mac_node)) {
 +   /*
 +* In the case of a fixed PHY, the DT node associated
 +* to the PHY is the Ethernet MAC DT node.
 +*/
 +   _errno = of_phy_register_fixed_link(mac_node);
 +   if (_errno)
 +   return _errno;
 +   mac_dev-phy_node = of_node_get(mac_node);
 +   }
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH part3 v12 08/10] PCI: Introduce common pci_domain_nr() and remove platform specific code

2015-07-20 Thread Yijing Wang
Now pci_host_bridge holds the domain number, we could
introduce common pci_domain_nr(), and remove platform specific code.

Signed-off-by: Yijing Wang wangyij...@huawei.com
---
 arch/alpha/include/asm/pci.h  |2 --
 arch/ia64/include/asm/pci.h   |1 -
 arch/microblaze/include/asm/pci.h |2 --
 arch/microblaze/pci/pci-common.c  |   11 ---
 arch/mips/include/asm/pci.h   |2 --
 arch/powerpc/include/asm/pci.h|2 --
 arch/powerpc/kernel/pci-common.c  |   11 ---
 arch/s390/include/asm/pci.h   |1 -
 arch/s390/pci/pci.c   |6 --
 arch/sh/include/asm/pci.h |2 --
 arch/sparc/include/asm/pci_64.h   |1 -
 arch/sparc/kernel/pci.c   |   17 -
 arch/tile/include/asm/pci.h   |2 --
 arch/x86/include/asm/pci.h|6 --
 drivers/pci/pci.c |8 
 include/linux/pci.h   |7 +--
 16 files changed, 9 insertions(+), 72 deletions(-)

diff --git a/arch/alpha/include/asm/pci.h b/arch/alpha/include/asm/pci.h
index 98f2eee..1f50c81 100644
--- a/arch/alpha/include/asm/pci.h
+++ b/arch/alpha/include/asm/pci.h
@@ -79,8 +79,6 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, 
int channel)
return channel ? 15 : 14;
 }
 
-#define pci_domain_nr(bus) ((struct pci_controller *)(bus)-sysdata)-index
-
 static inline int pci_proc_domain(struct pci_bus *bus)
 {
struct pci_controller *hose = bus-sysdata;
diff --git a/arch/ia64/include/asm/pci.h b/arch/ia64/include/asm/pci.h
index 36d2c1e..ba6c40a 100644
--- a/arch/ia64/include/asm/pci.h
+++ b/arch/ia64/include/asm/pci.h
@@ -80,7 +80,6 @@ struct pci_controller {
 
 
 #define PCI_CONTROLLER(busdev) ((struct pci_controller *) busdev-sysdata)
-#define pci_domain_nr(busdev)(PCI_CONTROLLER(busdev)-segment)
 
 extern struct pci_ops pci_root_ops;
 
diff --git a/arch/microblaze/include/asm/pci.h 
b/arch/microblaze/include/asm/pci.h
index dc9eb66..a452163 100644
--- a/arch/microblaze/include/asm/pci.h
+++ b/arch/microblaze/include/asm/pci.h
@@ -42,8 +42,6 @@
  */
 #define pcibios_assign_all_busses()0
 
-extern int pci_domain_nr(struct pci_bus *bus);
-
 /* Decide whether to display the domain number in /proc */
 extern int pci_proc_domain(struct pci_bus *bus);
 
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
index d232c8a..6f64908 100644
--- a/arch/microblaze/pci/pci-common.c
+++ b/arch/microblaze/pci/pci-common.c
@@ -123,17 +123,6 @@ unsigned long pci_address_to_pio(phys_addr_t address)
 }
 EXPORT_SYMBOL_GPL(pci_address_to_pio);
 
-/*
- * Return the domain number for this bus.
- */
-int pci_domain_nr(struct pci_bus *bus)
-{
-   struct pci_controller *hose = pci_bus_to_host(bus);
-
-   return hose-global_number;
-}
-EXPORT_SYMBOL(pci_domain_nr);
-
 /* This routine is meant to be used early during boot, when the
  * PCI bus numbers have not yet been assigned, and you need to
  * issue PCI config cycles to an OF device.
diff --git a/arch/mips/include/asm/pci.h b/arch/mips/include/asm/pci.h
index 98c31e5..8757775 100644
--- a/arch/mips/include/asm/pci.h
+++ b/arch/mips/include/asm/pci.h
@@ -114,8 +114,6 @@ struct pci_dev;
 extern unsigned int PCI_DMA_BUS_IS_PHYS;
 
 #ifdef CONFIG_PCI_DOMAINS
-#define pci_domain_nr(bus) ((struct pci_controller *)(bus)-sysdata)-index
-
 static inline int pci_proc_domain(struct pci_bus *bus)
 {
struct pci_controller *hose = bus-sysdata;
diff --git a/arch/powerpc/include/asm/pci.h b/arch/powerpc/include/asm/pci.h
index 3453bd8..f83b8c8 100644
--- a/arch/powerpc/include/asm/pci.h
+++ b/arch/powerpc/include/asm/pci.h
@@ -73,8 +73,6 @@ extern struct dma_map_ops *get_pci_dma_ops(void);
 
 #endif /* CONFIG_PPC64 */
 
-extern int pci_domain_nr(struct pci_bus *bus);
-
 /* Decide whether to display the domain number in /proc */
 extern int pci_proc_domain(struct pci_bus *bus);
 
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 3e398c8..42928a0 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -196,17 +196,6 @@ unsigned long pci_address_to_pio(phys_addr_t address)
 }
 EXPORT_SYMBOL_GPL(pci_address_to_pio);
 
-/*
- * Return the domain number for this bus.
- */
-int pci_domain_nr(struct pci_bus *bus)
-{
-   struct pci_controller *hose = pci_bus_to_host(bus);
-
-   return hose-global_number;
-}
-EXPORT_SYMBOL(pci_domain_nr);
-
 /* This routine is meant to be used early during boot, when the
  * PCI bus numbers have not yet been assigned, and you need to
  * issue PCI config cycles to an OF device.
diff --git a/arch/s390/include/asm/pci.h b/arch/s390/include/asm/pci.h
index a648338..fe605b5 100644
--- a/arch/s390/include/asm/pci.h
+++ b/arch/s390/include/asm/pci.h
@@ -20,7 +20,6 @@
 
 void __iomem *pci_iomap(struct pci_dev *, int, unsigned long);
 void pci_iounmap(struct pci_dev *, void __iomem *);
-int pci_domain_nr(struct pci_bus *);
 int 

[PATCH part3 v12 05/10] powerpc/PCI: Rename pcibios_root_bridge_prepare() to pcibios_root_bus_prepare()

2015-07-20 Thread Yijing Wang
Pcibios_root_bridge_prepare() in powerpc set root bus
speed, it's not the preparation for pci host bridge.
For better separation of host bridge and root bus creation,
It's need to rename it to another weak function.

Signed-off-by: Yijing Wang wangyij...@huawei.com
---
 arch/powerpc/include/asm/machdep.h   |2 +-
 arch/powerpc/kernel/pci-common.c |6 +++---
 arch/powerpc/platforms/pseries/pci.c |2 +-
 arch/powerpc/platforms/pseries/pseries.h |2 +-
 arch/powerpc/platforms/pseries/setup.c   |2 +-
 drivers/pci/probe.c  |9 +
 6 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/include/asm/machdep.h 
b/arch/powerpc/include/asm/machdep.h
index 952579f..dbd5e8b 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -100,7 +100,7 @@ struct machdep_calls {
/* Called after allocating resources */
void(*pcibios_fixup)(void);
void(*pci_irq_fixup)(struct pci_dev *dev);
-   int (*pcibios_root_bridge_prepare)(struct pci_host_bridge
+   int (*pcibios_root_bus_prepare)(struct pci_host_bridge
*bridge);
 
/* To setup PHBs when using automatic OF platform driver for PCI */
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index df7f018..3e398c8 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -782,10 +782,10 @@ int pci_proc_domain(struct pci_bus *bus)
return 1;
 }
 
-int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
+int pcibios_root_bus_prepare(struct pci_host_bridge *bridge)
 {
-   if (ppc_md.pcibios_root_bridge_prepare)
-   return ppc_md.pcibios_root_bridge_prepare(bridge);
+   if (ppc_md.pcibios_root_bus_prepare)
+   return ppc_md.pcibios_root_bus_prepare(bridge);
 
return 0;
 }
diff --git a/arch/powerpc/platforms/pseries/pci.c 
b/arch/powerpc/platforms/pseries/pci.c
index fe16a50..885f9ff 100644
--- a/arch/powerpc/platforms/pseries/pci.c
+++ b/arch/powerpc/platforms/pseries/pci.c
@@ -110,7 +110,7 @@ static void fixup_winbond_82c105(struct pci_dev* dev)
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_82C105,
 fixup_winbond_82c105);
 
-int pseries_root_bridge_prepare(struct pci_host_bridge *bridge)
+int pseries_root_bus_prepare(struct pci_host_bridge *bridge)
 {
struct device_node *dn, *pdn;
struct pci_bus *bus;
diff --git a/arch/powerpc/platforms/pseries/pseries.h 
b/arch/powerpc/platforms/pseries/pseries.h
index 8411c27..41310dc 100644
--- a/arch/powerpc/platforms/pseries/pseries.h
+++ b/arch/powerpc/platforms/pseries/pseries.h
@@ -75,7 +75,7 @@ static inline int dlpar_memory(struct pseries_hp_errorlog 
*hp_elog)
 
 /* PCI root bridge prepare function override for pseries */
 struct pci_host_bridge;
-int pseries_root_bridge_prepare(struct pci_host_bridge *bridge);
+int pseries_root_bus_prepare(struct pci_host_bridge *bridge);
 
 extern struct pci_controller_ops pseries_pci_controller_ops;
 
diff --git a/arch/powerpc/platforms/pseries/setup.c 
b/arch/powerpc/platforms/pseries/setup.c
index df6a704..2815309 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -537,7 +537,7 @@ static void __init pSeries_setup_arch(void)
ppc_md.enable_pmcs = power4_enable_pmcs;
}
 
-   ppc_md.pcibios_root_bridge_prepare = pseries_root_bridge_prepare;
+   ppc_md.pcibios_root_bus_prepare = pseries_root_bus_prepare;
 
if (firmware_has_feature(FW_FEATURE_SET_MODE)) {
long rc;
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index b49deb8..0eba126 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1919,6 +1919,11 @@ int __weak pcibios_root_bridge_prepare(struct 
pci_host_bridge *bridge)
return 0;
 }
 
+int __weak pcibios_root_bus_prepare(struct pci_host_bridge *bridge)
+{
+   return 0;
+}
+
 void __weak pcibios_add_bus(struct pci_bus *bus)
 {
 }
@@ -1984,6 +1989,10 @@ struct pci_bus *pci_create_root_bus(struct device 
*parent, int domain,
b-dev.class = pcibus_class;
b-dev.parent = b-bridge;
dev_set_name(b-dev, %04x:%02x, pci_domain_nr(b), bus);
+   error = pcibios_root_bus_prepare(bridge);
+   if (error)
+   goto class_dev_reg_err;
+
error = device_register(b-dev);
if (error)
goto class_dev_reg_err;
-- 
1.7.1

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

Re: [PATCH V3 2/2] kprobes: Mark OPTPROBES na for powerpc

2015-07-20 Thread Segher Boessenkool
On Mon, Jul 20, 2015 at 04:24:22PM +0530, Ananth N Mavinakayanahalli wrote:
 There is a potential gain to be had with a direct
 jump instead of a breakpoint, but the caveats need to be traded off
 with the complexity it brings in.
 
 For now, mark OPTPROBES na for powerpc.

If we haven't yet investigated whether this feature is something beneficial
to the powerpc kernel, it should just stay as TODO, not be marked as n/a.


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

RE: [RFC,v3,12/12] fsl/fman: Add FMan MAC driver

2015-07-20 Thread Madalin-Cristian Bucur
 -Original Message-
 From: Joakim Tjernlund [mailto:joakim.tjernl...@transmode.se]
 Sent: Monday, July 20, 2015 3:57 PM
 To: net...@vger.kernel.org; Liberman Igal-B31950; Bucur Madalin-Cristian-
 B32716
 Cc: linuxppc-dev@lists.ozlabs.org; linux-ker...@vger.kernel.org
 Subject: Re: [RFC,v3,12/12] fsl/fman: Add FMan MAC driver
 
 On Mon, 2015-07-20 at 12:28 +, Madalin-Cristian Bucur wrote:
  Hi Joakim,
 
  It seems we just need to align to the API introduced by Thomas Petazzoni
  in 3be2a49e.
 
  Madalin
 
 So it seems, any idea when the next spin will be ready?
 Could you also push it onto
   http://git.freescale.com/git/cgit.cgi/ppc/upstream/linux.git/
 ?
 
  Jocke

We're working on addressing all the feedback received to date (you've just added
a bit more) then we'll re-submit the FMan driver together with the DPAA Ethernet
driver. A push in the public git is also going to take place after the patches 
are sent
for review.

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

Re: [Xen-devel] [PATCH v2 1/3] drivers/xen/preempt: use need_resched() instead of should_resched()

2015-07-20 Thread David Vrabel
On 15/07/15 10:52, Konstantin Khlebnikov wrote:
 This code is used only when CONFIG_PREEMPT=n and only in non-atomic context:
 xen_in_preemptible_hcall is set only in privcmd_ioctl_hypercall().
 Thus preempt_count is zero and should_resched() is equal to need_resched().

Applied to for-linus-4.3, thanks.

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

[PATCH 4.2-rc3] macintosh/ans-lcd.c: Missing include causes compile failure

2015-07-20 Thread tim . gardner
From: Tim Gardner tim.gard...@canonical.com

drivers/macintosh/ans-lcd.c:201:1: warning: data definition has no type or 
storage class
 module_init(anslcd_init);
 ^
drivers/macintosh/ans-lcd.c:201:1: error: type defaults to 'int' in declaration 
of 'module_init' [-Werror=implicit-int]

gcc version 4.9.3 (Ubuntu 4.9.3-1ubuntu1)

Cc: Benjamin Herrenschmidt b...@kernel.crashing.org
Signed-off-by: Tim Gardner tim.gard...@canonical.com
---

This is a compile regression from v4.2-rc2

 drivers/macintosh/ans-lcd.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/macintosh/ans-lcd.c b/drivers/macintosh/ans-lcd.c
index 1a57e88..36a0047 100644
--- a/drivers/macintosh/ans-lcd.c
+++ b/drivers/macintosh/ans-lcd.c
@@ -5,6 +5,7 @@
 #include linux/types.h
 #include linux/errno.h
 #include linux/kernel.h
+#include linux/module.h
 #include linux/miscdevice.h
 #include linux/fcntl.h
 #include linux/init.h
-- 
1.9.1

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

Re: [PATCH v5 0/7]powerpc/powernv: Nest Instrumentation support

2015-07-20 Thread Sukadev Bhattiprolu
Madhavan Srinivasan [ma...@linux.vnet.ibm.com] wrote:
| This patchset enables Nest Instrumentation support on powerpc.
| POWER8 has per-chip Nest Intrumentation which provides various
| per-chip metrics like memory, powerbus, Xlink and Alink
| bandwidth.
| 
snip

| Cc: Michael Ellerman m...@ellerman.id.au
| Cc: Benjamin Herrenschmidt b...@kernel.crashing.org
| Cc: Paul Mackerras pau...@samba.org
| Cc: Anton Blanchard an...@samba.org
| Cc: Sukadev Bhattiprolu suka...@linux.vnet.ibm.com
| Cc: Anshuman Khandual khand...@linux.vnet.ibm.com
| Cc: Stephane Eranian eran...@google.com
| Signed-off-by: Madhavan Srinivasan ma...@linux.vnet.ibm.com

Thanks for addressing my comments from earlier version.

Reviewed-by: Sukadev Bhattiprolu suka...@linux.vnet.ibm.com

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

Re: [PATCH v6 3/3] leds/powernv: Add driver for PowerNV platform

2015-07-20 Thread Vasant Hegde
On 07/20/2015 11:46 AM, Jacek Anaszewski wrote:
 On 19.07.2015 23:40, Jacek Anaszewski wrote:
 [...]
 +/* Platform driver probe */
 +static int powernv_led_probe(struct platform_device *pdev)
 +{
 +int num_leds;
 +struct device_node *led_node;
 +struct powernv_leds_priv *priv;
 +
 +led_node = of_find_node_by_path(/ibm,opal/leds);
 +if (!led_node) {
 +dev_err(pdev-dev,
 +%s: LED parent device node not found\n, __func__);
 +return -EINVAL;
 +}
 +
 +num_leds = powernv_leds_count(led_node);
 +if (num_leds = 0) {
 +dev_err(pdev-dev,
 +%s: No location code found under LED node\n,
 +__func__);
 +return -EINVAL;
 +}

 You won't need to count the number of LEDs to register, just allocate
 memory for each LED during parsing with managed resource allocation
 API.

Jacek,

 
 You can refer to drivers/leds/leds-bcm6328.c in order to gain
 full picture on how this can look like.
 struct powernv_led_data would have to carry the pointer to the
 new common struct.
 

Sure.. Will though this code and will fix powernv code..

Thanks
-Vasant

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

Re: [PATCH v3 26/46] usb: gadget: pch_ud: add ep capabilities support

2015-07-20 Thread Krzysztof Opasiak



On 07/15/2015 08:32 AM, Robert Baldyga wrote:

Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga r.bald...@samsung.com
---
  drivers/usb/gadget/udc/pch_udc.c | 14 --
  1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/udc/pch_udc.c b/drivers/usb/gadget/udc/pch_udc.c
index 613547f..cc8fb3c 100644
--- a/drivers/usb/gadget/udc/pch_udc.c
+++ b/drivers/usb/gadget/udc/pch_udc.c
@@ -2895,11 +2895,21 @@ static void pch_udc_pcd_reinit(struct pch_udc_dev *dev)
ep-in = ~i  1;
ep-ep.name = ep_string[i];
ep-ep.ops = pch_udc_ep_ops;
-   if (ep-in)
+   if (ep-in) {
ep-offset_addr = ep-num * UDC_EP_REG_SHIFT;
-   else
+   ep-ep.caps.dir_in = true;
+   } else {
ep-offset_addr = (UDC_EPINT_OUT_SHIFT + ep-num) *
  UDC_EP_REG_SHIFT;
+   ep-ep.caps.dir_out = true;
+   }
+   if (i == UDC_EP0IN_IDX || i == UDC_EP0OUT_IDX) {
+   ep-ep.caps.type_control = true;


In all previous patches you set both dir_in and dir_out to true for ep0 
but in this patch you don't do this. Is there some reason for this or 
it's just a mistake?



+   } else {
+   ep-ep.caps.type_iso = true;
+   ep-ep.caps.type_bulk = true;
+   ep-ep.caps.type_int = true;
+   }
/* need to set ep-ep.maxpacket and set Default Configuration?*/
usb_ep_set_maxpacket_limit(ep-ep, UDC_BULK_MAX_PKT_SIZE);
list_add_tail(ep-ep.ep_list, dev-gadget.ep_list);



Best Regards,

--
Krzysztof Opasiak
Samsung RD Institute Poland
Samsung Electronics
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH v3 01/46] usb: gadget: encapsulate endpoint claiming mechanism

2015-07-20 Thread Krzysztof Opasiak



On 07/15/2015 08:31 AM, Robert Baldyga wrote:

So far it was necessary for usb functions to set ep-driver_data in
endpoint obtained from autoconfig to non-null value, to indicate that
endpoint is claimed by function (in autoconfig it was checked if endpoint
has set this field to non-null value, and if it has, it was assumed that
it is claimed). It could cause bugs becouse if some function doesn't


s/becouse/because

Best regards,
--
Krzysztof Opasiak
Samsung RD Institute Poland
Samsung Electronics
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH] powerpc/rtas: Introduce rtas_get_sensor_fast() for IRQ handlers

2015-07-20 Thread Nathan Fontenot
On 07/17/2015 05:46 AM, Thomas Huth wrote:
 The EPOW interrupt handler uses rtas_get_sensor(), which in turn
 uses rtas_busy_delay() to wait for RTAS becoming ready in case it
 is necessary. But rtas_busy_delay() is annotated with might_sleep()
 and thus may not be used by interrupts handlers like the EPOW handler!
 This leads to the following BUG when CONFIG_DEBUG_ATOMIC_SLEEP is
 enabled:
 
  BUG: sleeping function called from invalid context at 
 arch/powerpc/kernel/rtas.c:496
  in_atomic(): 1, irqs_disabled(): 1, pid: 0, name: swapper/1
  CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.2.0-rc2-thuth #6
  Call Trace:
  [c0007ffe7b90] [c0807670] dump_stack+0xa0/0xdc (unreliable)
  [c0007ffe7bc0] [c00e1f14] ___might_sleep+0x134/0x180
  [c0007ffe7c20] [c002aec0] rtas_busy_delay+0x30/0xd0
  [c0007ffe7c50] [c002bde4] rtas_get_sensor+0x74/0xe0
  [c0007ffe7ce0] [c0083264] ras_epow_interrupt+0x44/0x450
  [c0007ffe7d90] [c0120260] handle_irq_event_percpu+0xa0/0x300
  [c0007ffe7e70] [c0120524] handle_irq_event+0x64/0xc0
  [c0007ffe7eb0] [c0124dbc] handle_fasteoi_irq+0xec/0x260
  [c0007ffe7ef0] [c011f4f0] generic_handle_irq+0x50/0x80
  [c0007ffe7f20] [c0010f3c] __do_irq+0x8c/0x200
  [c0007ffe7f90] [c00236cc] call_do_irq+0x14/0x24
  [c0007e6f39e0] [c0011144] do_IRQ+0x94/0x110
  [c0007e6f3a30] [c0002594] hardware_interrupt_common+0x114/0x180
 
 Fix this issue by introducing a new rtas_get_sensor_fast() function
 that does not use rtas_busy_delay() - and thus can only be used for
 sensors that do not cause a BUSY condition (which should be the case
 for the sensor that is queried by the EPOW IRQ handler).
 
 Signed-off-by: Thomas Huth th...@redhat.com

Reviewed-by: Nathan Fontenot nf...@linux.vnet.ibm.com

 ---
  arch/powerpc/include/asm/rtas.h  |  1 +
  arch/powerpc/kernel/rtas.c   | 17 +
  arch/powerpc/platforms/pseries/ras.c |  3 ++-
  3 files changed, 20 insertions(+), 1 deletion(-)

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

Re: [V2] powerpc/signal: Add helper function to fetch quad word aligned pointer

2015-07-20 Thread Michael Ellerman
On Mon, 2015-20-07 at 02:58:43 UTC, Anshuman Khandual wrote:
 This patch adds one helper function 'sigcontext_vmx_regs' which computes
 quad word aligned pointer for 'vmx_reserve' array element in sigcontext
 structure making the code more readable.
 
 diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
 index c7c24d2..bb9c939 100644
 --- a/arch/powerpc/kernel/signal_64.c
 +++ b/arch/powerpc/kernel/signal_64.c
 @@ -74,6 +74,16 @@ static const char fmt64[] = KERN_INFO \
   %s[%d]: bad frame in %s: %016lx nip %016lx lr %016lx\n;
  
  /*
 + * This computes quad word aligned pointer for 'vmx_reserve' array element
 + * which is used primarily in assigning to the preceding pointer 'v_regs'
 + * in sigcontext structure.

How about:

  * This computes a quad word aligned pointer inside the vmx_reserve array
  * element. For historical reasons sigcontext might not be quad word aligned,
  * but the location we write the VMX regs to must be. See the comment in
  * sigcontext for more detail.


 + */
 +static elf_vrreg_t __user *sigcontext_vmx_regs(struct sigcontext __user *sc)
 +{
 + return (elf_vrreg_t __user *) (((unsigned long)sc-vmx_reserve + 15)  
 ~0xful);
 +}

This doesn't build for ppc64e_defconfig:

  arch/powerpc/kernel/signal_64.c:82:28: error: 'sigcontext_vmx_regs' defined 
but not used [-Werror=unused-function]
   static elf_vrreg_t __user *sigcontext_vmx_regs(struct sigcontext __user *sc)
^

For now I'll just #ifdef it.

Please do a test build of ppc64e_defconfig in future.

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

Re: [PATCH] Fix crash due to processing memory-controller nodes as memory

2015-07-20 Thread Anton Blanchard
Hi Ian,

 From: Ian Munsie imun...@au1.ibm.com
 
 If the system has a PCI device with a memory-controller device node,
 kexec-lite would spew hundreds of double free warnings and eventually
 segfault. This would result in a kexec load failed message from
 petitboot.
 
 This was due to kexec_memory_map() searching for memory nodes, but
 actually matching any node that started with memory, including these
 memory-controller nodes. This patch changes the search to look for
 nodes starting with memory@, which should only match memory nodes.

Nice catch! I wonder if we should be checking for device_type
memory. Ben?

Anton

 An example of a device tree that can trigger this bug is as follows:
 
 {
   pciex@3fffe4000 {
   ...
   pci@0 {
   #address-cells = 0x3;
   #size-cells = 0x2;
   ...
   memory-controller@0 {
   reg = 0x1 0x0 0x0 0x0 0x0;
   ...
   };
   };
   };
 };
 
 Signed-off-by: Ian Munsie imun...@au1.ibm.com
 ---
  kexec_memory_map.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/kexec_memory_map.c b/kexec_memory_map.c
 index fc1b7af..7f18de7 100644
 --- a/kexec_memory_map.c
 +++ b/kexec_memory_map.c
 @@ -192,7 +192,7 @@ void kexec_memory_map(void *fdt, int
 reserve_initrd) 
   name = fdt_get_name(fdt, nodeoffset, NULL);
  
 - if (!name || strncmp(name, memory,
 strlen(memory)))
 + if (!name || strncmp(name, memory@,
 strlen(memory@))) continue;
  
   reg = fdt_getprop(fdt, nodeoffset, reg, len);

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

Re: [PATCH] kprobes: Mark OPTPROBES n/a for powerpc

2015-07-20 Thread Michael Ellerman
On Sun, 2015-07-19 at 11:21 +0900, Masami Hiramatsu wrote:
 On 2015/07/16 19:56, Ananth N Mavinakayanahalli wrote:
  Kprobes uses a breakpoint instruction to trap into execution flow
  and the probed instruction is single-stepped from an alternate location.
  
  On some architectures like x86, under certain conditions, the OPTPROBES
  feature enables replacing the probed instruction with a jump instead,
  resulting in a significant perfomance boost (one single-step exception
  is bypassed for each kprobe).
 
 The OPTPROBE is not only for bypassing the single-step exception, but also
 the breakpoint exception.
 Please see commit 0dc016dbd820260b (ARM: kprobes: enable OPTPROBES for ARM 
 32) too,
 which shows how it is done on RISC processor.
 
  Powerpc has an in-kernel instruction emulator. Kprobes on powerpc uses
  this emulator already and bypasses the single-step exception, with a
  lot less complexity.
 
 So, this might miss the point. Since it is impossible to do on some RISC
 processor, I agree with this change, but it should be committed with
 correct comments.

I don't think it's impossible on powerpc.

So we should leave it as a TODO for now.

cheers


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

Re: [PATCH] Fix crash due to processing memory-controller nodes as memory

2015-07-20 Thread Benjamin Herrenschmidt
On Tue, 2015-07-21 at 12:45 +1000, Anton Blanchard wrote:
 Hi Ian,
 
  From: Ian Munsie imun...@au1.ibm.com
  
  If the system has a PCI device with a memory-controller device node,
  kexec-lite would spew hundreds of double free warnings and eventually
  segfault. This would result in a kexec load failed message from
  petitboot.
  
  This was due to kexec_memory_map() searching for memory nodes, but
  actually matching any node that started with memory, including these
  memory-controller nodes. This patch changes the search to look for
  nodes starting with memory@, which should only match memory nodes.
 
 Nice catch! I wonder if we should be checking for device_type
 memory. Ben?

Or at least check for the nodes at the root of the DT only.

Cheers,
Ben.

 Anton
 
  An example of a device tree that can trigger this bug is as follows:
  
  {
  pciex@3fffe4000 {
  ...
  pci@0 {
  #address-cells = 0x3;
  #size-cells = 0x2;
  ...
  memory-controller@0 {
  reg = 0x1 0x0 0x0 0x0 0x0;
  ...
  };
  };
  };
  };
  
  Signed-off-by: Ian Munsie imun...@au1.ibm.com
  ---
   kexec_memory_map.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
  
  diff --git a/kexec_memory_map.c b/kexec_memory_map.c
  index fc1b7af..7f18de7 100644
  --- a/kexec_memory_map.c
  +++ b/kexec_memory_map.c
  @@ -192,7 +192,7 @@ void kexec_memory_map(void *fdt, int
  reserve_initrd) 
  name = fdt_get_name(fdt, nodeoffset, NULL);
   
  -   if (!name || strncmp(name, memory,
  strlen(memory)))
  +   if (!name || strncmp(name, memory@,
  strlen(memory@))) continue;
   
  reg = fdt_getprop(fdt, nodeoffset, reg, len);


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

Re: [PATCH] Fix crash due to processing memory-controller nodes as memory

2015-07-20 Thread Michael Ellerman
On Tue, 2015-07-21 at 12:45 +1000, Anton Blanchard wrote:
 Hi Ian,
 
  From: Ian Munsie imun...@au1.ibm.com
  
  If the system has a PCI device with a memory-controller device node,
  kexec-lite would spew hundreds of double free warnings and eventually
  segfault. This would result in a kexec load failed message from
  petitboot.
  
  This was due to kexec_memory_map() searching for memory nodes, but
  actually matching any node that started with memory, including these
  memory-controller nodes. This patch changes the search to look for
  nodes starting with memory@, which should only match memory nodes.
 
 Nice catch! I wonder if we should be checking for device_type
 memory. Ben?

Yes. That's what Linux does.

cheers


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

next is open

2015-07-20 Thread Michael Ellerman
Hi folks,

Just letting you know that powerpc next is open.

So now is the time to start sending patches for 4.3.

Ben  I now have a shared powerpc tree on kernel.org, so that is the place you
should be looking at if you want to see what's in next:

  https://git.kernel.org/cgit/linux/kernel/git/powerpc/linux.git


For now you should ignore our personal trees unless we tell you otherwise.

cheers



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

Re: [PATCH] kprobes: Mark OPTPROBES n/a for powerpc

2015-07-20 Thread Ananth N Mavinakayanahalli
On Tue, Jul 21, 2015 at 12:53:07PM +1000, Michael Ellerman wrote:
 On Sun, 2015-07-19 at 11:21 +0900, Masami Hiramatsu wrote:
  On 2015/07/16 19:56, Ananth N Mavinakayanahalli wrote:
   Kprobes uses a breakpoint instruction to trap into execution flow
   and the probed instruction is single-stepped from an alternate location.
   
   On some architectures like x86, under certain conditions, the OPTPROBES
   feature enables replacing the probed instruction with a jump instead,
   resulting in a significant perfomance boost (one single-step exception
   is bypassed for each kprobe).
  
  The OPTPROBE is not only for bypassing the single-step exception, but also
  the breakpoint exception.
  Please see commit 0dc016dbd820260b (ARM: kprobes: enable OPTPROBES for ARM 
  32) too,
  which shows how it is done on RISC processor.
  
   Powerpc has an in-kernel instruction emulator. Kprobes on powerpc uses
   this emulator already and bypasses the single-step exception, with a
   lot less complexity.
  
  So, this might miss the point. Since it is impossible to do on some RISC
  processor, I agree with this change, but it should be committed with
  correct comments.
 
 I don't think it's impossible on powerpc.
 
 So we should leave it as a TODO for now.

OK. I put it on my TODO list.

Ananth

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

Re: [3/6] pseries: Update CPU hotplug error recovery

2015-07-20 Thread Michael Ellerman
On Mon, 2015-22-06 at 20:59:20 UTC, Nathan Fontenot wrote:
 Update the cpu dlpar add/remove paths to do better error recovery when 
 a failure occurs during the add/remove operation. This includes adding
 some pr_info and pr_debug statements.

So I'm happy with the idea there, but ..

 diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c 
 b/arch/powerpc/platforms/pseries/hotplug-cpu.c
 index f58d902..7890b2f 100644
 --- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
 +++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
 @@ -18,6 +18,8 @@
   *  2 of the License, or (at your option) any later version.
   */
  
 +#define pr_fmt(fmt) pseries-hotplug-cpu:  fmt

This is good.

  #include linux/kernel.h
  #include linux/interrupt.h
  #include linux/delay.h
 @@ -386,22 +388,35 @@ static ssize_t dlpar_cpu_add(struct device_node 
 *parent, u32 drc_index)
   struct device_node *dn;
   int rc;
  
 + pr_info(Attempting to add CPU, drc index %x\n, drc_index);
 +
   rc = dlpar_acquire_drc(drc_index);
   if (rc)
   return -EINVAL;
  
   dn = dlpar_configure_connector(cpu_to_be32(drc_index), parent);
 - if (!dn)
 + if (!dn) {
 + pr_debug(Failed call to configure-connector\n);
 + dlpar_release_drc(drc_index);
   return -EINVAL;
 + }
  
   rc = dlpar_attach_node(dn);
   if (rc) {
 + pr_debug(Failed to attach node (%d)\n, rc);
   dlpar_release_drc(drc_index);
   dlpar_free_cc_nodes(dn);
   return rc;
   }
  
   rc = dlpar_online_cpu(dn);
 + if (rc) {
 + pr_debug(Failed to online cpu (%d)\n, rc);
 + dlpar_detach_node(dn);
 + dlpar_release_drc(drc_index);
 + }
 +
 + pr_info(Successfully added CPU, drc index %x\n, drc_index);
   return rc;


But this is the opposite of what we want.

By default this will print two info lines for each successful cpu hotplug, but
when we get an error nothing will be printed - because pr_debug() is off by
default. What's worse, if dlpar_online_cpu() fails, the pr_debug() will produce
nothing but we will *still* print Successfully added CPU.

So the pr_info()s should go entirely and the pr_debugs() should become
pr_warns(). The warning messages should become more verbose so they stand on
their own, ie. include the drc_index.

When everything goes perfectly there should be no output.


 @@ -465,18 +480,29 @@ static ssize_t dlpar_cpu_remove(struct device_node *dn, 
 u32 drc_index)
  {
   int rc;
  
 + pr_info(Attemping to remove CPU, drc index %x\n, drc_index);
 +
   rc = dlpar_offline_cpu(dn);
 - if (rc)
 + if (rc) {
 + pr_debug(Failed top offline cpu (%d)\n, rc);
   ^
   should be to

   return -EINVAL;
 + }
  
   rc = dlpar_release_drc(drc_index);
 - if (rc)
 + if (rc) {
 + pr_debug(Failed to release drc (%d)\n, rc);
 + dlpar_online_cpu(dn);
   return rc;
 + }
  
   rc = dlpar_detach_node(dn);
 - if (rc)
 + if (rc) {
 + pr_debug(Failed to detach cpu node (%d)\n, rc);
   dlpar_acquire_drc(drc_index);

But that can fail?

 + dlpar_online_cpu(dn);

And if it did this would presumably not be safe?


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

Re: [V2] powerpc/signal: Add helper function to fetch quad word aligned pointer

2015-07-20 Thread Anshuman Khandual
On 07/21/2015 07:07 AM, Michael Ellerman wrote:
 On Mon, 2015-20-07 at 02:58:43 UTC, Anshuman Khandual wrote:
 This patch adds one helper function 'sigcontext_vmx_regs' which computes
 quad word aligned pointer for 'vmx_reserve' array element in sigcontext
 structure making the code more readable.

 diff --git a/arch/powerpc/kernel/signal_64.c 
 b/arch/powerpc/kernel/signal_64.c
 index c7c24d2..bb9c939 100644
 --- a/arch/powerpc/kernel/signal_64.c
 +++ b/arch/powerpc/kernel/signal_64.c
 @@ -74,6 +74,16 @@ static const char fmt64[] = KERN_INFO \
  %s[%d]: bad frame in %s: %016lx nip %016lx lr %016lx\n;
  
  /*
 + * This computes quad word aligned pointer for 'vmx_reserve' array element
 + * which is used primarily in assigning to the preceding pointer 'v_regs'
 + * in sigcontext structure.
 
 How about:
 
   * This computes a quad word aligned pointer inside the vmx_reserve array
   * element. For historical reasons sigcontext might not be quad word aligned,
   * but the location we write the VMX regs to must be. See the comment in
   * sigcontext for more detail.

Yeah, its way better. Thanks !

 
 
 + */
 +static elf_vrreg_t __user *sigcontext_vmx_regs(struct sigcontext __user *sc)
 +{
 +return (elf_vrreg_t __user *) (((unsigned long)sc-vmx_reserve + 15)  
 ~0xful);
 +}
 
 This doesn't build for ppc64e_defconfig:

This time, I did build test for some of the configs but not the entire
comprehensive list. Sorry, missed this one though, will take care next
time around.

 
   arch/powerpc/kernel/signal_64.c:82:28: error: 'sigcontext_vmx_regs' defined 
 but not used [-Werror=unused-function]
static elf_vrreg_t __user *sigcontext_vmx_regs(struct sigcontext __user 
 *sc)
 ^
 
 For now I'll just #ifdef it.
 
 Please do a test build of ppc64e_defconfig in future.

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

Re: [PATCH V3 2/2] kprobes: Mark OPTPROBES na for powerpc

2015-07-20 Thread Michael Ellerman
On Mon, 2015-07-20 at 08:41 -0500, Segher Boessenkool wrote:
 On Mon, Jul 20, 2015 at 04:24:22PM +0530, Ananth N Mavinakayanahalli wrote:
  There is a potential gain to be had with a direct
  jump instead of a breakpoint, but the caveats need to be traded off
  with the complexity it brings in.
  
  For now, mark OPTPROBES na for powerpc.
 
 If we haven't yet investigated whether this feature is something beneficial
 to the powerpc kernel, it should just stay as TODO, not be marked as n/a.

Yep, agreed. As discussed in the other thread we'll leave this as TODO until we
know it's either not a win or not worth the complexity.

cheers


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

Re: [PATCH kernel] powerpc/powernv/ioda2: Fix calculation for memory allocated for TCE table

2015-07-20 Thread David Gibson
On Mon, Jul 20, 2015 at 08:45:51PM +1000, Alexey Kardashevskiy wrote:
 The existing code stores the amount of memory allocated for a TCE table.
 At the moment it uses @offset which is a virtual offset in the TCE table
 which is only correct for a one level tables and it does not include
 memory allocated for intermediate levels. When multilevel TCE table is
 requested, WARN_ON in tce_iommu_create_table() prints a warning.
 
 This adds an additional counter to pnv_pci_ioda2_table_do_alloc_pages()
 to count actually allocated memory.
 
 Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru

Reviewed-by: David Gibson da...@gibson.dropbear.id.au

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson


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

Re: [PATCH v6 3/3] leds/powernv: Add driver for PowerNV platform

2015-07-20 Thread Vasant Hegde
On 07/20/2015 03:10 AM, Jacek Anaszewski wrote:
 Hi Vasant,
 

Jacek,

 I've revised your patch and found few more issues.
 Please refer to my comments below.

Thanks.

.../...


 Please don't exceed 75 character line length limit.

 Ok. I will fix it.. But I thought 80 character is the limit.
 
 checkpatch.pl reports this.

Ah! I was running checkpatch.pl against source. Let me fix this.
.../...

 +/*
 + * LED set routines have been implemented as work queue tasks scheduled
 + * on the global work queue. Individual task calls OPAL interface to set
 + * the LED state which might sleep for some time.
 + */
 +struct powernv_led_data {
 +struct led_classdevcdev;
 +char*loc_code;/* LED location code */
 +intled_type;/* OPAL_SLOT_LED_TYPE_* */
 +enum led_brightnessvalue;/* Brightness value */
 +struct mutexlock;
 
 You're unnecessarily adding mutex for each LED class device.
 The shared resource to protect is here powernv led interface,
 so one mutex will suffice.


Ok. Let me move that to common structure.

 
 
 +struct work_structwork_led;/* LED update workqueue */
 +};
 +
 +struct powernv_leds_priv {
 +int num_leds;
 +struct powernv_led_data powernv_leds[];
 +};
 
 powernv_led_data doesn't have to be retained in the array. You access
 the array elements only upon creation of LED class devices. When using
 managed resource allocation you don't need to bother with freeing
 resources, so you don't need to keep reference to the data.
 
 I propose to drop struct powernv_leds_priv and instead introduce
 a structure that would aggregate common driver data like mutex,
 led_disable and max_led_type.

I still think we need two structures.. One for common driver data like mutex,
led_disable etc and other one for led data itself .. like
struct powernv_led_data {
struct led_classdev cdev;
char*loc_code; -- pointer to DT node
int led_type;   /* OPAL_SLOT_LED_TYPE_* 
*/
enum led_brightness value;  /* Brightness value */
};

struct powernv_led_common {
bool led_disable;
int max_led_type;
struct mutexlock;
};

 
 +
 +static __be64 max_led_type = cpu_to_be64(OPAL_SLOT_LED_TYPE_MAX);

 The C standard prohibits initialization of global objects with non-constant
 values. Section 6.7.8 of the C99 standard states:

 All the expressions in an initializer for an object that has static storage
 duration shall be constant expressions or string literals.

 Compilation succeeds when using powerpc64-linux-gcc because then
 the following version of macro is used:

 #define cpu_to_be64(x) (x)

 and not

 #define cpu_to_be64(x) swab64(x)

 Please move max_led_type also to the struct powernv_leds_priv
 and initialize it dynamically.

 Yeah.. I should have added this to structure itself. Will fix.


 +
 +
 +static inline int sizeof_powernv_leds_priv(int num_leds)
 +{
 +return sizeof(struct powernv_leds_priv) +
 +(sizeof(struct powernv_led_data) * num_leds);
 +}
 +/* Returns OPAL_SLOT_LED_TYPE_* for given led type string */
 +static int powernv_get_led_type(const char *led_type_desc)
 +{
 +int i;
 +
 +for (i = 0; i  ARRAY_SIZE(led_type_map); i++)
 +if (!strcmp(led_type_map[i].desc, led_type_desc))
 +return led_type_map[i].type;
 +
 +return -1;
 +}
 +
 +/*
 + * This commits the state change of the requested LED through an OPAL 
 call.
 + * This function is called from work queue task context when ever it gets
 + * scheduled. This function can sleep at opal_async_wait_response call.
 + */
 +static void powernv_led_set(struct powernv_led_data *powernv_led)
 +{
 +int rc, token;
 +u64 led_mask, led_value = 0;
 +__be64 max_type;
 +struct opal_msg msg;
 +struct device *dev = powernv_led-cdev.dev;
 +
 +/* Prepare for the OPAL call */
 +max_type = max_led_type;
 +led_mask = OPAL_SLOT_LED_STATE_ON  powernv_led-led_type;
 +if (powernv_led-value)
 +led_value = led_mask;
 +
 +/* OPAL async call */
 +token = opal_async_get_token_interruptible();
 +if (token  0) {
 +if (token != -ERESTARTSYS)
 +dev_err(dev, %s: Couldn't get OPAL async token\n,
 +__func__);
 +return;
 +}
 +
 +rc = opal_leds_set_ind(token, powernv_led-loc_code,
 +   led_mask, led_value, max_type);
 +if (rc != OPAL_ASYNC_COMPLETION) {
 +dev_err(dev, %s: OPAL set LED call failed for %s [rc=%d]\n,
 +__func__, powernv_led-loc_code, rc);
 +goto out_token;
 +}
 +
 +rc = opal_async_wait_response(token, msg);
 +if (rc) {
 +dev_err(dev,
 +%s: Failed to wait for the async response [rc=%d]\n,
 +__func__, rc);
 +goto out_token;
 +}
 +
 +