[RFC Part4 v1 11/17] PCI, MSI: Rename __read_msi_msg() as __pci_read_msi_msg()

2014-11-09 Thread Jiang Liu
Rename __read_msi_msg() as __pci_read_msi_msg() and kill unused
read_msi_msg(). It's a preparation to separate generic MSI code
from PCI core.

Signed-off-by: Jiang Liu jiang@linux.intel.com
---
 arch/powerpc/platforms/pseries/msi.c |2 +-
 arch/x86/pci/xen.c   |2 +-
 drivers/pci/msi.c|9 +
 include/linux/msi.h  |3 +--
 4 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/msi.c 
b/arch/powerpc/platforms/pseries/msi.c
index 8ab5add4ac82..90f756d0f58f 100644
--- a/arch/powerpc/platforms/pseries/msi.c
+++ b/arch/powerpc/platforms/pseries/msi.c
@@ -476,7 +476,7 @@ again:
irq_set_msi_desc(virq, entry);
 
/* Read config space back so we can restore after reset */
-   __read_msi_msg(entry, msg);
+   __pci_read_msi_msg(entry, msg);
entry-msg = msg;
}
 
diff --git a/arch/x86/pci/xen.c b/arch/x86/pci/xen.c
index 093f5f4272d3..a48ca2f8b93e 100644
--- a/arch/x86/pci/xen.c
+++ b/arch/x86/pci/xen.c
@@ -229,7 +229,7 @@ static int xen_hvm_setup_msi_irqs(struct pci_dev *dev, int 
nvec, int type)
return 1;
 
list_for_each_entry(msidesc, dev-msi_list, list) {
-   __read_msi_msg(msidesc, msg);
+   __pci_read_msi_msg(msidesc, msg);
pirq = MSI_ADDR_EXT_DEST_ID(msg.address_hi) |
((msg.address_lo  MSI_ADDR_DEST_ID_SHIFT)  0xff);
if (msg.data != XEN_PIRQ_MSI_DATA ||
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index e1814f4be4b9..6011dfb475a1 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -243,7 +243,7 @@ void default_restore_msi_irqs(struct pci_dev *dev)
default_restore_msi_irq(dev, entry-irq);
 }
 
-void __read_msi_msg(struct msi_desc *entry, struct msi_msg *msg)
+void __pci_read_msi_msg(struct msi_desc *entry, struct msi_msg *msg)
 {
BUG_ON(entry-dev-current_state != PCI_D0);
 
@@ -273,13 +273,6 @@ void __read_msi_msg(struct msi_desc *entry, struct msi_msg 
*msg)
}
 }
 
-void read_msi_msg(unsigned int irq, struct msi_msg *msg)
-{
-   struct msi_desc *entry = irq_get_msi_desc(irq);
-
-   __read_msi_msg(entry, msg);
-}
-
 void __write_msi_msg(struct msi_desc *entry, struct msi_msg *msg)
 {
if (entry-dev-current_state != PCI_D0) {
diff --git a/include/linux/msi.h b/include/linux/msi.h
index 19502186a64d..4b0d070ff481 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -61,9 +61,8 @@ void msi_domain_deactivate(struct irq_domain *domain,
 
 #ifdef CONFIG_PCI_MSI
 /* Helper functions */
-void __read_msi_msg(struct msi_desc *entry, struct msi_msg *msg);
+void __pci_read_msi_msg(struct msi_desc *entry, struct msi_msg *msg);
 void __write_msi_msg(struct msi_desc *entry, struct msi_msg *msg);
-void read_msi_msg(unsigned int irq, struct msi_msg *msg);
 void write_msi_msg(unsigned int irq, struct msi_msg *msg);
 
 /*
-- 
1.7.10.4

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

Re: [PATCH v2] hwmon: (ibmpowernv) Use platform 'id_table' to probe the device

2014-11-09 Thread Michael Ellerman
On Wed, 2014-11-05 at 06:21 -0800, Guenter Roeck wrote:
 On Wed, Nov 05, 2014 at 04:45:14PM +0530, Neelesh Gupta wrote:
  The current driver probe() function assumes the sensor device to be
  alwary present and gets executed every time if the driver is loaded,
  but the appropriate hardware could not be present.
  
  So, move the platform device creation as part of platform init code
  and use the 'id_table' to check if the device present or not.
  
  Signed-off-by: Neelesh Gupta neele...@linux.vnet.ibm.com
 
 Looks good. We'll need an ack from one of the powerpc maintainers to proceed.

Looks OK to me.

Acked-by: Michael Ellerman m...@ellerman.id.au

cheers


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

[PATCH v6 08/48] kernel: Move pm_power_off to common code

2014-11-09 Thread Guenter Roeck
pm_power_off is defined for all architectures. Move it to common code.

Have all architectures call do_kernel_power_off instead of pm_power_off.
Some architectures point pm_power_off to machine_power_off. For those,
call do_kernel_power_off from machine_power_off instead.

Acked-by: David Vrabel david.vra...@citrix.com
Acked-by: Geert Uytterhoeven ge...@linux-m68k.org
Acked-by: Hirokazu Takata tak...@linux-m32r.org
Acked-by: James Hogan james.ho...@imgtec.com
Acked-by: Jesper Nilsson jesper.nils...@axis.com
Acked-by: Max Filippov jcmvb...@gmail.com
Acked-by: Rafael J. Wysocki r...@rjwysocki.net
Acked-by: Richard Weinberger rich...@nod.at
Acked-by: Xuetao Guan g...@mprc.pku.edu.cn
Acked-by: Ralf Baechle r...@linux-mips.org
Signed-off-by: Guenter Roeck li...@roeck-us.net
---
v6:
- No change.
v5:
- Rebase to v3.18-rc3
- Update powerpc code to reflect merged power-off handler changes
v4:
- No change
v3:
- Replace poweroff in all newly introduced variables and in text
  with power_off or power-off as appropriate
v2:
- do_kernel_poweroff - do_kernel_power_off
- have_kernel_poweroff - have_kernel_power_off

 arch/alpha/kernel/process.c|  9 +++--
 arch/arc/kernel/reset.c|  5 +
 arch/arm/kernel/process.c  |  5 +
 arch/arm64/kernel/process.c|  5 +
 arch/avr32/kernel/process.c|  6 +-
 arch/blackfin/kernel/process.c |  3 ---
 arch/blackfin/kernel/reboot.c  |  2 ++
 arch/c6x/kernel/process.c  |  9 +
 arch/cris/kernel/process.c |  4 +---
 arch/frv/kernel/process.c  |  5 ++---
 arch/hexagon/kernel/reset.c|  5 ++---
 arch/ia64/kernel/process.c |  5 +
 arch/m32r/kernel/process.c |  8 
 arch/m68k/kernel/process.c |  6 +-
 arch/metag/kernel/process.c|  6 +-
 arch/microblaze/kernel/process.c   |  3 ---
 arch/microblaze/kernel/reset.c |  1 +
 arch/mips/kernel/reset.c   |  6 +-
 arch/mn10300/kernel/process.c  |  8 ++--
 arch/openrisc/kernel/process.c |  8 +---
 arch/parisc/kernel/process.c   |  8 
 arch/powerpc/kernel/setup-common.c |  6 +-
 arch/powerpc/xmon/xmon.c   |  3 +--
 arch/s390/kernel/setup.c   |  8 ++--
 arch/score/kernel/process.c|  8 
 arch/sh/kernel/reboot.c|  6 +-
 arch/sparc/kernel/process_32.c | 10 ++
 arch/sparc/kernel/reboot.c |  8 ++--
 arch/tile/kernel/reboot.c  |  7 +++
 arch/um/kernel/reboot.c|  2 --
 arch/unicore32/kernel/process.c|  9 +
 arch/x86/kernel/reboot.c   | 11 +++
 arch/x86/xen/enlighten.c   |  3 +--
 arch/xtensa/kernel/process.c   |  4 
 drivers/parisc/power.c |  3 +--
 kernel/power/power_off_handler.c   |  9 +
 kernel/reboot.c|  4 ++--
 37 files changed, 68 insertions(+), 150 deletions(-)

diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c
index 1941a07..81c43f8 100644
--- a/arch/alpha/kernel/process.c
+++ b/arch/alpha/kernel/process.c
@@ -24,6 +24,7 @@
 #include linux/vt.h
 #include linux/mman.h
 #include linux/elfcore.h
+#include linux/pm.h
 #include linux/reboot.h
 #include linux/tty.h
 #include linux/console.h
@@ -40,12 +41,6 @@
 #include proto.h
 #include pci_impl.h
 
-/*
- * Power off function, if any
- */
-void (*pm_power_off)(void) = machine_power_off;
-EXPORT_SYMBOL(pm_power_off);
-
 #ifdef CONFIG_ALPHA_WTINT
 /*
  * Sleep the CPU.
@@ -184,6 +179,8 @@ machine_halt(void)
 void
 machine_power_off(void)
 {
+   do_kernel_power_off();
+
common_shutdown(LINUX_REBOOT_CMD_POWER_OFF, NULL);
 }
 
diff --git a/arch/arc/kernel/reset.c b/arch/arc/kernel/reset.c
index 2768fa1..0758d9d 100644
--- a/arch/arc/kernel/reset.c
+++ b/arch/arc/kernel/reset.c
@@ -26,9 +26,6 @@ void machine_restart(char *__unused)
 
 void machine_power_off(void)
 {
-   /* FIXME ::  power off ??? */
+   do_kernel_power_off();
machine_halt();
 }
-
-void (*pm_power_off) (void) = NULL;
-EXPORT_SYMBOL(pm_power_off);
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index fe972a2..aa3f656 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -117,8 +117,6 @@ void soft_restart(unsigned long addr)
 /*
  * Function pointers to optional machine specific functions
  */
-void (*pm_power_off)(void);
-EXPORT_SYMBOL(pm_power_off);
 
 void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd);
 
@@ -205,8 +203,7 @@ void machine_power_off(void)
local_irq_disable();
smp_send_stop();
 
-   if (pm_power_off)
-   pm_power_off();
+   do_kernel_power_off();
 }
 
 /*
diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
index fde9923..6f623a0 100644
--- a/arch/arm64/kernel/process.c
+++ b/arch/arm64/kernel/process.c
@@ -68,8 +68,6 @@ void soft_restart(unsigned long addr)
 /*
  * Function pointers to optional 

[PATCH v6 41/48] powerpc: Register with kernel power-off handler

2014-11-09 Thread Guenter Roeck
Register with kernel power-off handler instead of setting pm_power_off
directly.

If there is an indication that there can be more than one power-off handler,
use register_power_off_handler, otherwise use register_power_off_handler_simple
to register the power-off handler.

If the power-off handler only resets or stops the system, select the fallback
priority to indicate that the power-off handler is one of last resort.
If the power-off handler powers off the system, select the default priority,
unless the power-off handler installation code suggests that there can be
more than one power-off handler and the new handler is only installed
conditionally. In this case, install the handler with low priority.

Cc: Alexander Graf ag...@suse.de
Cc: Michael Ellerman m...@ellerman.id.au
Signed-off-by: Guenter Roeck li...@roeck-us.net
---
v6:
- This patch: No change.
  Global: Replaced priority defines with enum.
v5:
- New patch

 arch/powerpc/platforms/44x/ppc476.c  |  3 ++-
 arch/powerpc/platforms/52xx/efika.c  |  3 ++-
 arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c   | 30 
 arch/powerpc/platforms/85xx/corenet_generic.c|  3 ++-
 arch/powerpc/platforms/85xx/sgy_cts1000.c| 16 +++--
 arch/powerpc/platforms/cell/celleb_setup.c   |  6 +++--
 arch/powerpc/platforms/cell/qpace_setup.c|  3 ++-
 arch/powerpc/platforms/cell/setup.c  |  3 ++-
 arch/powerpc/platforms/chrp/setup.c  |  3 ++-
 arch/powerpc/platforms/embedded6xx/gamecube.c|  3 ++-
 arch/powerpc/platforms/embedded6xx/linkstation.c |  3 ++-
 arch/powerpc/platforms/embedded6xx/wii.c |  3 ++-
 arch/powerpc/platforms/maple/setup.c |  6 +++--
 arch/powerpc/platforms/powermac/setup.c  |  3 ++-
 arch/powerpc/platforms/powernv/setup.c   |  6 +++--
 arch/powerpc/platforms/ps3/setup.c   |  3 ++-
 arch/powerpc/platforms/pseries/setup.c   |  3 ++-
 arch/powerpc/sysdev/fsl_soc.c|  6 ++---
 18 files changed, 73 insertions(+), 33 deletions(-)

diff --git a/arch/powerpc/platforms/44x/ppc476.c 
b/arch/powerpc/platforms/44x/ppc476.c
index c11ce65..590d31f 100644
--- a/arch/powerpc/platforms/44x/ppc476.c
+++ b/arch/powerpc/platforms/44x/ppc476.c
@@ -94,7 +94,8 @@ static int avr_probe(struct i2c_client *client,
 {
avr_i2c_client = client;
ppc_md.restart = avr_reset_system;
-   pm_power_off = avr_power_off_system;
+   register_power_off_handler_simple(avr_power_off_system,
+ POWER_OFF_PRIORITY_DEFAULT);
return 0;
 }
 
diff --git a/arch/powerpc/platforms/52xx/efika.c 
b/arch/powerpc/platforms/52xx/efika.c
index 6af651e..321a7a7 100644
--- a/arch/powerpc/platforms/52xx/efika.c
+++ b/arch/powerpc/platforms/52xx/efika.c
@@ -212,7 +212,8 @@ static int __init efika_probe(void)
DMA_MODE_READ = 0x44;
DMA_MODE_WRITE = 0x48;
 
-   pm_power_off = rtas_power_off;
+   register_power_off_handler_simple(rtas_power_off,
+ POWER_OFF_PRIORITY_DEFAULT);
 
return 1;
 }
diff --git a/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c 
b/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
index 15e8021..1bf6b0e 100644
--- a/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
+++ b/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
@@ -19,6 +19,7 @@
 #include linux/gpio.h
 #include linux/of.h
 #include linux/of_gpio.h
+#include linux/pm.h
 #include linux/slab.h
 #include linux/kthread.h
 #include linux/reboot.h
@@ -86,7 +87,7 @@ static ssize_t show_status(struct device *d,
 }
 static DEVICE_ATTR(status, S_IRUGO, show_status, NULL);
 
-static void mcu_power_off(void)
+static void mcu_power_off(struct power_off_handler_block *this)
 {
struct mcu *mcu = glob_mcu;
 
@@ -97,6 +98,11 @@ static void mcu_power_off(void)
mutex_unlock(mcu-lock);
 }
 
+static struct power_off_handler_block mcu_power_off_hb = {
+   .handler = mcu_power_off,
+   .priority = POWER_OFF_PRIORITY_LOW,
+};
+
 static void mcu_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val)
 {
struct mcu *mcu = container_of(gc, struct mcu, gc);
@@ -167,13 +173,15 @@ static int mcu_probe(struct i2c_client *client, const 
struct i2c_device_id *id)
if (ret)
goto err;
 
-   /* XXX: this is potentially racy, but there is no lock for pm_power_off 
*/
-   if (!pm_power_off) {
-   glob_mcu = mcu;
-   pm_power_off = mcu_power_off;
-   dev_info(client-dev, will provide power-off service\n);
+   glob_mcu = mcu;
+   ret = register_power_off_handler(mcu_power_off_hb);
+   if (ret) {
+   dev_err(client-dev, Failed to register power-off handler\n);
+   goto err_handler;
}
 
+   dev_info(client-dev, will provide power-off service\n);
+
if (device_create_file(client-dev, dev_attr_status))

Re: [PATCH 0/2] Add IPMI support for powernv powerpc machines

2014-11-09 Thread Jeremy Kerr
Hi Corey,

Thanks for the review.

 IPMI folks: the IPMI driver could do with a little review, as it's
 not a conventional BT/KCS/SMI SI, in that the low-level send/recv
 interface will handle the entire message at once.
 
 Handling the entire message at once should be fine, as that's what
 this driver level is designed to do for the message handler.  That
 part all looks correct.  The code itself looks good, but I have a
 couple of high-level comments.
 
 The driver at this level can receive more than one message to handle
 at a time, so it needs some sort of queue.  This is to allow multiple
 users and to allow the message handler to send its own commands while
 other commands are going on.  You might argue that the queuing should
 be done in ipmi_msghandler, and you would probably be right.

Ah, that's what I'd been assuming was being done - I missed the
xmit_list in the si_intf code. It'd be great if this could be in the
generic msghandler code, otherwise I'd just be duplicating the si_intf
logic.

 I'll look at doing that.  If that is the case, then your NULL check
 for current message should probably be a BUG_ON().

OK, I'll update this when the msghandler bit is implemented.

 Do you need to handle any BMC flags?  Particularly incoming events?

Not at this stage - we may in future though.

Cheers,


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

Re: [PATCH] cpufreq: qoriq: Make the driver usable on all QorIQ platforms

2014-11-09 Thread Viresh Kumar
On 27 October 2014 09:09, Yuantian Tang yuantian.t...@freescale.com wrote:
 Do we have a conclusion yet?

No. You can keep your initial duplication of Kconfig entries for the time being.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH 0/2] Add IPMI support for powernv powerpc machines

2014-11-09 Thread Benjamin Herrenschmidt
On Mon, 2014-11-10 at 11:26 +0800, Jeremy Kerr wrote:
 Hi Corey,
 
 Thanks for the review.
 
  IPMI folks: the IPMI driver could do with a little review, as it's
  not a conventional BT/KCS/SMI SI, in that the low-level send/recv
  interface will handle the entire message at once.
  
  Handling the entire message at once should be fine, as that's what
  this driver level is designed to do for the message handler.  That
  part all looks correct.  The code itself looks good, but I have a
  couple of high-level comments.
  
  The driver at this level can receive more than one message to handle
  at a time, so it needs some sort of queue.  This is to allow multiple
  users and to allow the message handler to send its own commands while
  other commands are going on.  You might argue that the queuing should
  be done in ipmi_msghandler, and you would probably be right.
 
 Ah, that's what I'd been assuming was being done - I missed the
 xmit_list in the si_intf code. It'd be great if this could be in the
 generic msghandler code, otherwise I'd just be duplicating the si_intf
 logic.

Our OPAL interface can only do one at a time ? Because our underlying FW
driver already has a queue ..

  I'll look at doing that.  If that is the case, then your NULL check
  for current message should probably be a BUG_ON().
 
 OK, I'll update this when the msghandler bit is implemented.
 
  Do you need to handle any BMC flags?  Particularly incoming events?
 
 Not at this stage - we may in future though.
 
 Cheers,
 
 
 Jeremy
 ___
 Linuxppc-dev mailing list
 Linuxppc-dev@lists.ozlabs.org
 https://lists.ozlabs.org/listinfo/linuxppc-dev


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

[PATCH] i2c: Driver to expose PowerNV platform i2c busses

2014-11-09 Thread Neelesh Gupta
The patch exposes the available i2c busses on the PowerNV platform
to the kernel and implements the bus driver to support i2c and
smbus commands.
The driver uses the platform device infrastructure to probe the busses
on the platform and registers them with the i2c driver framework.

Signed-off-by: Neelesh Gupta neele...@linux.vnet.ibm.com
Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org
---
 arch/powerpc/include/asm/opal.h|   21 ++
 arch/powerpc/platforms/powernv/opal-wrappers.S |1 
 arch/powerpc/platforms/powernv/opal.c  |   48 +++-
 drivers/i2c/busses/Kconfig |   11 +
 drivers/i2c/busses/Makefile|1 
 drivers/i2c/busses/i2c-opal.c  |  276 
 6 files changed, 349 insertions(+), 9 deletions(-)
 create mode 100644 drivers/i2c/busses/i2c-opal.c

diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
index 9124b0e..7e94577 100644
--- a/arch/powerpc/include/asm/opal.h
+++ b/arch/powerpc/include/asm/opal.h
@@ -154,6 +154,7 @@ struct opal_sg_list {
 #define OPAL_HANDLE_HMI98
 #define OPAL_REGISTER_DUMP_REGION  101
 #define OPAL_UNREGISTER_DUMP_REGION102
+#define OPAL_I2C_REQUEST   109
 
 #ifndef __ASSEMBLY__
 
@@ -801,6 +802,24 @@ typedef struct oppanel_line {
uint64_tline_len;
 } oppanel_line_t;
 
+/* OPAL I2C request */
+struct opal_i2c_request {
+   uint8_t type;
+#define OPAL_I2C_RAW_READ  0
+#define OPAL_I2C_RAW_WRITE 1
+#define OPAL_I2C_SM_READ   2
+#define OPAL_I2C_SM_WRITE  3
+   uint8_t flags;
+#define OPAL_I2C_ADDR_10   0x01/* Not supported yet */
+   uint8_t subaddr_sz; /* Max 4 */
+   uint8_t reserved;
+   __be16 addr;/* 7 or 10 bit address */
+   __be16 reserved2;
+   __be32 subaddr; /* Sub-address if any */
+   __be32 size;/* Data size */
+   __be64 buffer_ra;   /* Buffer real address */
+};
+
 /* /sys/firmware/opal */
 extern struct kobject *opal_kobj;
 
@@ -963,6 +982,8 @@ int64_t opal_handle_hmi(void);
 int64_t opal_register_dump_region(uint32_t id, uint64_t start, uint64_t end);
 int64_t opal_unregister_dump_region(uint32_t id);
 int64_t opal_pci_set_phb_cxl_mode(uint64_t phb_id, uint64_t mode, uint64_t 
pe_number);
+int64_t opal_i2c_request(uint64_t async_token, uint32_t bus_id,
+struct opal_i2c_request *oreq);
 
 /* Internal functions */
 extern int early_init_dt_scan_opal(unsigned long node, const char *uname,
diff --git a/arch/powerpc/platforms/powernv/opal-wrappers.S 
b/arch/powerpc/platforms/powernv/opal-wrappers.S
index e9e2450..b84224b 100644
--- a/arch/powerpc/platforms/powernv/opal-wrappers.S
+++ b/arch/powerpc/platforms/powernv/opal-wrappers.S
@@ -250,3 +250,4 @@ OPAL_CALL(opal_handle_hmi,  
OPAL_HANDLE_HMI);
 OPAL_CALL(opal_register_dump_region,   OPAL_REGISTER_DUMP_REGION);
 OPAL_CALL(opal_unregister_dump_region, OPAL_UNREGISTER_DUMP_REGION);
 OPAL_CALL(opal_pci_set_phb_cxl_mode,   OPAL_PCI_SET_PHB_CXL_MODE);
+OPAL_CALL(opal_i2c_request,OPAL_I2C_REQUEST);
diff --git a/arch/powerpc/platforms/powernv/opal.c 
b/arch/powerpc/platforms/powernv/opal.c
index d019b08..217630b 100644
--- a/arch/powerpc/platforms/powernv/opal.c
+++ b/arch/powerpc/platforms/powernv/opal.c
@@ -644,17 +644,10 @@ static void __init opal_dump_region_init(void)
pr_warn(DUMP: Failed to register kernel log buffer. 
rc = %d\n, rc);
 }
-static int __init opal_init(void)
+
+static void opal_console_create_devs(void)
 {
struct device_node *np, *consoles;
-   const __be32 *irqs;
-   int rc, i, irqlen;
-
-   opal_node = of_find_node_by_path(/ibm,opal);
-   if (!opal_node) {
-   pr_warn(opal: Node not found\n);
-   return -ENODEV;
-   }
 
/* Register OPAL consoles if any ports */
if (firmware_has_feature(FW_FEATURE_OPALv2))
@@ -670,6 +663,21 @@ static int __init opal_init(void)
of_node_put(consoles);
}
 
+}
+
+static void opal_i2c_create_devs(void)
+{
+   struct device_node *np;
+
+   for_each_compatible_node(np, NULL, ibm,power8-i2c-port)
+   of_platform_device_create(np, NULL, NULL);
+}
+
+static void opal_request_interrupts(void)
+{
+   const __be32 *irqs;
+   int rc, i, irqlen;
+
/* Find all OPAL interrupts and request them */
irqs = of_get_property(opal_node, opal-interrupts, irqlen);
pr_debug(opal: Found %d interrupts reserved for OPAL\n,
@@ -689,6 +697,26 @@ static int __init opal_init(void)
(0x%x)\n, rc, irq, hwirq);
opal_irqs[i] = irq;
}
+}
+
+static int __init opal_init(void)
+{
+   int rc;
+
+   opal_node = 

[PATCH v2 net-next] PPC: bpf_jit_comp: add SKF_AD_HATYPE instruction

2014-11-09 Thread Denis Kirjanov
Add BPF extension SKF_AD_HATYPE to ppc JIT to check
the hw type of the interface

Before:
[   57.723666] test_bpf: #20 LD_HATYPE
[   57.723675] BPF filter opcode 0020 (@0) unsupported
[   57.724168] 48 48 PASS

After:
[  103.053184] test_bpf: #20 LD_HATYPE 7 6 PASS

CC: Alexei Starovoitovalexei.starovoi...@gmail.com
CC: Daniel Borkmanndbork...@redhat.com
CC: Philippe Bergheaudfe...@linux.vnet.ibm.com
Signed-off-by: Denis Kirjanov k...@linux-powerpc.org

v2: address Alexei's comments
---
 arch/powerpc/net/bpf_jit_comp.c | 17 +
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c
index d110e28..d3fa80d 100644
--- a/arch/powerpc/net/bpf_jit_comp.c
+++ b/arch/powerpc/net/bpf_jit_comp.c
@@ -361,6 +361,11 @@ static int bpf_jit_build_body(struct bpf_prog *fp, u32 
*image,
protocol));
break;
case BPF_ANC | SKF_AD_IFINDEX:
+   case BPF_ANC | SKF_AD_HATYPE:
+   BUILD_BUG_ON(FIELD_SIZEOF(struct net_device,
+   ifindex) != 4);
+   BUILD_BUG_ON(FIELD_SIZEOF(struct net_device,
+   type) != 2);
PPC_LD_OFFS(r_scratch1, r_skb, offsetof(struct sk_buff,
dev));
PPC_CMPDI(r_scratch1, 0);
@@ -368,14 +373,18 @@ static int bpf_jit_build_body(struct bpf_prog *fp, u32 
*image,
PPC_BCC(COND_EQ, addrs[ctx-pc_ret0]);
} else {
/* Exit, returning 0; first pass hits here. */
-   PPC_BCC_SHORT(COND_NE, (ctx-idx*4)+12);
+   PPC_BCC_SHORT(COND_NE, ctx-idx * 4 + 12);
PPC_LI(r_ret, 0);
PPC_JMP(exit_addr);
}
-   BUILD_BUG_ON(FIELD_SIZEOF(struct net_device,
- ifindex) != 4);
-   PPC_LWZ_OFFS(r_A, r_scratch1,
+   if (code == (BPF_ANC | SKF_AD_IFINDEX)) {
+   PPC_LWZ_OFFS(r_A, r_scratch1,
 offsetof(struct net_device, ifindex));
+   } else {
+   PPC_LHZ_OFFS(r_A, r_scratch1,
+offsetof(struct net_device, type));
+   }
+
break;
case BPF_ANC | SKF_AD_MARK:
BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, mark) != 4);
-- 
2.1.0

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

Re: [PATCH 0/2] Add IPMI support for powernv powerpc machines

2014-11-09 Thread Jeremy Kerr
Hi Ben,

 Our OPAL interface can only do one at a time ? Because our underlying
 FW driver already has a queue ..

The Linux driver needs to match responses to their requests, so the
driver needs to keep a reference to the requests that we've sent. The
current implementation is very simple: we just keep one pointer, and
require that there's only one outstanding request.

To have multiple outstanding requests, our options here are that we either:

1) duplicate the si_intf's queuing code in the powernv driver; or

2) move the queuing code from the si_intf component to the generic
   IPMI msghander, and use that (so all drivers can assume a single
   outstanding request)

Corey has suggested the latter, which will only require a minimal change
to the powerpv IPMI driver.

Cheers,


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

[PATCH] tty: pr_warning-pr_warn and logging neatening

2014-11-09 Thread Joe Perches
Convert the pr_warning to the more common pr_warn.

Other miscellanea:

o Convert unusual PR_FMT define and uses to pr_fmt
o Remove unnecessary OOM message
o Fix grammar in an error message
o Convert a pr_warning with a KERN_ERR to pr_err

Signed-off-by: Joe Perches j...@perches.com
---
 drivers/tty/ehv_bytechan.c   |  4 ++--
 drivers/tty/hvc/hvcs.c   |  2 +-
 drivers/tty/isicom.c | 14 +++---
 drivers/tty/serial/bfin_sport_uart.c |  5 +++--
 drivers/tty/serial/mfd.c |  2 +-
 drivers/tty/serial/mrst_max3110.c| 27 ---
 drivers/tty/vt/keyboard.c|  6 +++---
 drivers/tty/vt/vt.c  |  4 ++--
 8 files changed, 31 insertions(+), 33 deletions(-)

diff --git a/drivers/tty/ehv_bytechan.c b/drivers/tty/ehv_bytechan.c
index 4f485e8..9d29d7e 100644
--- a/drivers/tty/ehv_bytechan.c
+++ b/drivers/tty/ehv_bytechan.c
@@ -309,8 +309,8 @@ static int __init ehv_bc_console_init(void)
 * handle for udbg.
 */
if (stdout_bc != CONFIG_PPC_EARLY_DEBUG_EHV_BC_HANDLE)
-   pr_warning(ehv-bc: udbg handle %u is not the stdout handle\n,
-  CONFIG_PPC_EARLY_DEBUG_EHV_BC_HANDLE);
+   pr_warn(ehv-bc: udbg handle %u is not the stdout handle\n,
+   CONFIG_PPC_EARLY_DEBUG_EHV_BC_HANDLE);
 #endif
 
/* add_preferred_console() must be called before register_console(),
diff --git a/drivers/tty/hvc/hvcs.c b/drivers/tty/hvc/hvcs.c
index 81e939e..00bec633 100644
--- a/drivers/tty/hvc/hvcs.c
+++ b/drivers/tty/hvc/hvcs.c
@@ -1575,7 +1575,7 @@ static int __init hvcs_module_init(void)
 */
rc = driver_create_file((hvcs_vio_driver.driver), driver_attr_rescan);
if (rc)
-   pr_warning(KERN_ERR HVCS: Failed to create rescan file (err 
%d)\n, rc);
+   pr_err(HVCS: Failed to create rescan file (err %d)\n, rc);
 
return 0;
 }
diff --git a/drivers/tty/isicom.c b/drivers/tty/isicom.c
index 858291c..59ed783 100644
--- a/drivers/tty/isicom.c
+++ b/drivers/tty/isicom.c
@@ -249,7 +249,7 @@ static int lock_card(struct isi_board *card)
spin_unlock_irqrestore(card-card_lock, card-flags);
msleep(10);
}
-   pr_warning(Failed to lock Card (0x%lx)\n, card-base);
+   pr_warn(Failed to lock Card (0x%lx)\n, card-base);
 
return 0;   /* Failed to acquire the card! */
 }
@@ -378,13 +378,13 @@ static inline int __isicom_paranoia_check(struct isi_port 
const *port,
char *name, const char *routine)
 {
if (!port) {
-   pr_warning(Warning: bad isicom magic for dev %s in %s.\n,
-  name, routine);
+   pr_warn(Warning: bad isicom magic for dev %s in %s\n,
+   name, routine);
return 1;
}
if (port-magic != ISICOM_MAGIC) {
-   pr_warning(Warning: NULL isicom port for dev %s in %s.\n,
-  name, routine);
+   pr_warn(Warning: NULL isicom port for dev %s in %s\n,
+   name, routine);
return 1;
}
 
@@ -546,8 +546,8 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id)
byte_count = header  0xff;
 
if (channel + 1  card-port_count) {
-   pr_warning(%s(0x%lx): %d(channel)  port_count.\n,
-  __func__, base, channel+1);
+   pr_warn(%s(0x%lx): %d(channel)  port_count\n,
+   __func__, base, channel + 1);
outw(0x, base+0x04); /* enable interrupts */
spin_unlock(card-card_lock);
return IRQ_HANDLED;
diff --git a/drivers/tty/serial/bfin_sport_uart.c 
b/drivers/tty/serial/bfin_sport_uart.c
index d62d8da..67d4083 100644
--- a/drivers/tty/serial/bfin_sport_uart.c
+++ b/drivers/tty/serial/bfin_sport_uart.c
@@ -517,14 +517,15 @@ static void sport_set_termios(struct uart_port *port,
up-csize = 5;
break;
default:
-   pr_warning(requested word length not supported\n);
+   pr_warn(requested word length not supported\n);
+   break;
}
 
if (termios-c_cflag  CSTOPB) {
up-stopb = 1;
}
if (termios-c_cflag  PARENB) {
-   pr_warning(PAREN bits is not supported yet\n);
+   pr_warn(PAREN bit is not supported yet\n);
/* up-parib = 1; */
}
 
diff --git a/drivers/tty/serial/mfd.c b/drivers/tty/serial/mfd.c
index 445799d..e1f4fda 100644
--- a/drivers/tty/serial/mfd.c
+++ b/drivers/tty/serial/mfd.c
@@ -1371,7 +1371,7 @@ static void hsu_global_init(void)
hsu-iolen = 0x1000;
 
if (!(request_mem_region(hsu-paddr, hsu-iolen, HSU global)))
-   pr_warning(HSU: error in request mem region\n);
+   pr_warn(HSU: error in request mem region\n);
 
hsu-reg = 

Re: [PATCH 0/2] Add IPMI support for powernv powerpc machines

2014-11-09 Thread Benjamin Herrenschmidt
On Mon, 2014-11-10 at 17:01 +1100, Alistair Popple wrote:
 Ben,
 
  
  Our OPAL interface can only do one at a time ? Because our underlying FW
  driver already has a queue ..
 
 The OPAL interface supports sending more than one message at a time using the 
 underlying FW queue as you suggest. However in theory the interface doesn't 
 make any response order guarantees, but in practice they should be ordered as 
 our BMC doesn't send out-of-order responses.

Can't we put some ID in the response message ? OPAL messages have
room...

Cheers,
Ben.

 Regards,
 
 Alistair
 
I'll look at doing that.  If that is the case, then your NULL check
for current message should probably be a BUG_ON().
   
   OK, I'll update this when the msghandler bit is implemented.
   
Do you need to handle any BMC flags?  Particularly incoming events?
   
   Not at this stage - we may in future though.
   
   Cheers,
   
   
   Jeremy
   ___
   Linuxppc-dev mailing list
   Linuxppc-dev@lists.ozlabs.org
   https://lists.ozlabs.org/listinfo/linuxppc-dev
  
  ___
  Linuxppc-dev mailing list
  Linuxppc-dev@lists.ozlabs.org
  https://lists.ozlabs.org/listinfo/linuxppc-dev


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