LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH 14/17] powerpc: crypto: nx driver code supporting nx encryption
From: Greg KH @ 2012-03-22  3:39 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: rcj, linux-kernel, linux-crypto, Kent Yoder, linuxppc-dev,
	David Miller
In-Reply-To: <1332385050.2982.71.camel@pasglop>

On Thu, Mar 22, 2012 at 01:57:30PM +1100, Benjamin Herrenschmidt wrote:
> +int __vio_register_driver(struct vio_driver *viodrv, struct module *owner,
> +			const char *mod_name)
>  {
>  	viodrv->driver.bus = &vio_bus_type;
> +	viodrv->driver.name = viodrv->name;
> +	viodrv->driver.bus = &vio_bus_type;
> +	viodrv->driver.owner = owner;
> +	viodrv->driver.mod_name = mod_name;

Any reason you set .bus twice?

^ permalink raw reply

* Re: [PATCH] EEH: remove eeh device from OF node
From: Gavin Shan @ 2012-03-22  3:28 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: sfr, linux-kernel, linux-next, paulus, linuxppc-dev
In-Reply-To: <1332288866.2982.33.camel@pasglop>

>> Originally, the PCI sensitive OF node is tracing the eeh device
>> through struct device_node::edev. However, it was regarded as
>> bad idea.
>> 
>> The patch removes struct device_node::edev. In addition, the
>> global list of eeh devices is introduced, and do retrival of
>> eeh device according to the given OF node through the global
>> list.
>
>So I'm not too happy with that. The main problem I see is that
>the code -constantly- calls of_node_to_eeh_dev.
>

Yes, it's somewhat expensive.

>IE. On any MMIO that happens to return all 1's, we'll call
>eeh_check_failure() for example, which does that. In fact for a hot path
>it's pretty horrid, it will:
>
> - Do an address cache lookup to get the pci_dev
> - Get the device-node frokm the pci_dev
> - Lookup your list to get the eeh_dev
>
>Shouldn't we instead change the address cache to contain eeh_dev
>instead ? And if you prefer keeping pci_dev, then it shouldn't be hard
>to stick a pointer to the eeh_dev in there via either struct archdata or
>maybe platform_data.
>
>The EEH code still, even after your rework, constantly pass "dn"'s as
>argument to functions just to convert it back to a struct eeh_dev rather
>than trying to pass the eeh_dev.
>

I'm working on explicit PE support and hopefully, I can send out
the code next week for review. The basic idea is to introuce
struct eeh_pe and attached eeh_dev to the corresponding PE. In turn,
eeh core will use PE as parameter instead of current eeh_dev ;-)

>So turning that into a list lookup will slow things down to a crawl.
>Also your patch never seems to remove anything from your list, which
>doesn't look right vs. hotplug.
>
>I suggest we fix that with a two phase approach:
>
> 1- ASAP so we can still get that into 3.4, move the eeh_dev pointer to
>struct pci_dn instead of struct device_node. This structure is
>accessible directly via dn->data and is ppc specific, that will be a
>better temporary solution and and adding stuff to the generic struct
>device_node.
>

I've sent patch again it and please take a look when you have time.

> 2- Then, what we need to do is generalize the use of eeh_dev rather
>than device_node as the main object being worked on in the eeh layer and
>thus as the argument to most functions.
>
>Cheers,
>Ben.
>

Thanks,
Gavin

>> Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
>> ---
>>  arch/powerpc/include/asm/eeh.h           |    7 +++++++
>>  arch/powerpc/platforms/pseries/eeh_dev.c |   29 ++++++++++++++++++++++++++++-
>>  include/linux/of.h                       |   10 ----------
>>  3 files changed, 35 insertions(+), 11 deletions(-)
>> 
>> diff --git a/arch/powerpc/include/asm/eeh.h b/arch/powerpc/include/asm/eeh.h
>> index d60f998..591e0a1 100644
>> --- a/arch/powerpc/include/asm/eeh.h
>> +++ b/arch/powerpc/include/asm/eeh.h
>> @@ -56,6 +56,7 @@ struct eeh_dev {
>>  	struct pci_controller *phb;	/* Associated PHB		*/
>>  	struct device_node *dn;		/* Associated device node	*/
>>  	struct pci_dev *pdev;		/* Associated PCI device	*/
>> +	struct list_head list;		/* Form the global link list	*/
>>  };
>>  
>>  static inline struct device_node *eeh_dev_to_of_node(struct eeh_dev *edev)
>> @@ -115,6 +116,7 @@ extern int eeh_subsystem_enabled;
>>   */
>>  #define EEH_MAX_ALLOWED_FREEZES 5
>>  
>> +struct eeh_dev *eeh_dev_from_of_node(struct device_node *dn);
>>  void * __devinit eeh_dev_init(struct device_node *dn, void *data);
>>  void __devinit eeh_dev_phb_init_dynamic(struct pci_controller *phb);
>>  void __init eeh_dev_phb_init(void);
>> @@ -132,6 +134,11 @@ void eeh_add_device_tree_early(struct device_node *);
>>  void eeh_add_device_tree_late(struct pci_bus *);
>>  void eeh_remove_bus_device(struct pci_dev *);
>>  
>> +static inline struct eeh_dev *of_node_to_eeh_dev(struct device_node *dn)
>> +{
>> +	return eeh_dev_from_of_node(dn);
>> +}
>> +
>>  /**
>>   * EEH_POSSIBLE_ERROR() -- test for possible MMIO failure.
>>   *
>> diff --git a/arch/powerpc/platforms/pseries/eeh_dev.c b/arch/powerpc/platforms/pseries/eeh_dev.c
>> index f3aed7d..925d3a3 100644
>> --- a/arch/powerpc/platforms/pseries/eeh_dev.c
>> +++ b/arch/powerpc/platforms/pseries/eeh_dev.c
>> @@ -34,6 +34,7 @@
>>  #include <linux/export.h>
>>  #include <linux/gfp.h>
>>  #include <linux/init.h>
>> +#include <linux/list.h>
>>  #include <linux/kernel.h>
>>  #include <linux/pci.h>
>>  #include <linux/string.h>
>> @@ -41,6 +42,30 @@
>>  #include <asm/pci-bridge.h>
>>  #include <asm/ppc-pci.h>
>>  
>> +/* eeh device list */
>> +static LIST_HEAD(eeh_dev_list);
>> +
>> +/**
>> + * eeh_dev_from_of_node - Retrieve EEH device according to OF node
>> + * @dn: OF node
>> + *
>> + * All existing eeh devices have been put into the global list.
>> + * In addition, the eeh device is tracing the corresponding
>> + * OF node. The function is used to retrieve the corresponding
>> + * eeh device according to the given OF node.
>> + */
>> +struct eeh_dev *eeh_dev_from_of_node(struct device_node *dn)
>> +{
>> +	struct eeh_dev *edev = NULL;
>> +
>> +	list_for_each_entry(edev, &eeh_dev_list, list) {
>> +		if (edev->dn && edev->dn == dn)
>> +			return edev;
>> +	}
>> +
>> +	return NULL;
>> +}
>> +
>>  /**
>>   * eeh_dev_init - Create EEH device according to OF node
>>   * @dn: device node
>> @@ -62,10 +87,12 @@ void * __devinit eeh_dev_init(struct device_node *dn, void *data)
>>  	}
>>  
>>  	/* Associate EEH device with OF node */
>> -	dn->edev  = edev;
>>  	edev->dn  = dn;
>>  	edev->phb = phb;
>>  
>> +	/* Add to global list */
>> +	list_add_tail(&edev->list, &eeh_dev_list);
>> +
>>  	return NULL;
>>  }
>>  
>> diff --git a/include/linux/of.h b/include/linux/of.h
>> index 3e710d8..a75a831 100644
>> --- a/include/linux/of.h
>> +++ b/include/linux/of.h
>> @@ -58,9 +58,6 @@ struct device_node {
>>  	struct	kref kref;
>>  	unsigned long _flags;
>>  	void	*data;
>> -#if defined(CONFIG_EEH)
>> -	struct eeh_dev *edev;
>> -#endif
>>  #if defined(CONFIG_SPARC)
>>  	char	*path_component_name;
>>  	unsigned int unique_id;
>> @@ -75,13 +72,6 @@ struct of_phandle_args {
>>  	uint32_t args[MAX_PHANDLE_ARGS];
>>  };
>>  
>> -#if defined(CONFIG_EEH)
>> -static inline struct eeh_dev *of_node_to_eeh_dev(struct device_node *dn)
>> -{
>> -	return dn->edev;
>> -}
>> -#endif
>> -
>>  #if defined(CONFIG_SPARC) || !defined(CONFIG_OF)
>>  /* Dummy ref counting routines - to be implemented later */
>>  static inline struct device_node *of_node_get(struct device_node *node)
>
>

^ permalink raw reply

* Re: [git pull] Please pull powerpc.git next branch
From: Tony Breeds @ 2012-03-22  3:01 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Russell King, Linux Kernel list, linuxppc-dev list, Kyle Moffett,
	Andrew Morton
In-Reply-To: <CA+55aFz-pyBHa73zkbkub4czwnU+k4_qKzBEaAGvi66MBBUTpQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 428 bytes --]

On Wed, Mar 21, 2012 at 07:02:00PM -0700, Linus Torvalds wrote:

> Ok, so this conflicted a bit with the generalized irq-domain stuff
> from Grant Likely, and while I tried to fix it up I can't even
> compile-test the end result, so you really need to verify my merge and
> perhaps send me fixups. Ok?

/me pimps his toolchains on kernel.org :)
	http://kernel.org/pub/tools/crosstool/files/bin/
Bug reports welcome.

Yours Tony

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply

* Re: [PATCH 14/17] powerpc: crypto: nx driver code supporting nx encryption
From: Benjamin Herrenschmidt @ 2012-03-22  2:57 UTC (permalink / raw)
  To: Kent Yoder, David Miller
  Cc: Greg KH, rcj, linuxppc-dev, linux-kernel, linux-crypto
In-Reply-To: <1332381004.2982.65.camel@pasglop>

On Thu, 2012-03-22 at 12:50 +1100, Benjamin Herrenschmidt wrote:
> On Wed, 2012-03-21 at 15:15 -0700, Greg KH wrote:
> > 
> > Really?  vio drivers are supposed to look like this with the .name and
> > .owner field manually being set in the static initialization of the
> > driver?  That's sad, and should be fixed, the vio core should do this
> > type of thing for you. 
> 
> Yeah, they still do it the old way, nobody got to fix that yet, should
> be pretty easy though.

Kent, Dave care to try this ? It's only compile tested.

powerpc+sparc/vio: Modernize driver registration

This makes vio_register_driver() get the module owner & name at compile
time like PCI drivers do, and adds a name pointer directly in struct
vio_driver to avoid having to explicitly initialize the embedded
struct device.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 arch/powerpc/include/asm/vio.h     |   10 +++++++++-
 arch/powerpc/kernel/vio.c          |    9 +++++++--
 arch/sparc/include/asm/vio.h       |    9 ++++++++-
 arch/sparc/kernel/ds.c             |    5 +----
 arch/sparc/kernel/vio.c            |    9 +++++++--
 drivers/block/sunvdc.c             |    5 +----
 drivers/net/ethernet/ibm/ibmveth.c |    7 ++-----
 drivers/net/ethernet/sun/sunvnet.c |    5 +----
 drivers/scsi/ibmvscsi/ibmvfc.c     |    7 ++-----
 drivers/scsi/ibmvscsi/ibmvscsi.c   |    7 ++-----
 drivers/scsi/ibmvscsi/ibmvstgt.c   |    5 +----
 drivers/tty/hvc/hvc_vio.c          |    7 ++-----
 drivers/tty/hvc/hvcs.c             |    5 +----
 13 files changed, 44 insertions(+), 46 deletions(-)

diff --git a/arch/powerpc/include/asm/vio.h b/arch/powerpc/include/asm/vio.h
index 0a290a1..6bfd5ff 100644
--- a/arch/powerpc/include/asm/vio.h
+++ b/arch/powerpc/include/asm/vio.h
@@ -69,6 +69,7 @@ struct vio_dev {
 };
 
 struct vio_driver {
+	const char *name;
 	const struct vio_device_id *id_table;
 	int (*probe)(struct vio_dev *dev, const struct vio_device_id *id);
 	int (*remove)(struct vio_dev *dev);
@@ -76,10 +77,17 @@ struct vio_driver {
 	 * be loaded in a CMO environment if it uses DMA.
 	 */
 	unsigned long (*get_desired_dma)(struct vio_dev *dev);
+	const struct dev_pm_ops *pm;
 	struct device_driver driver;
 };
 
-extern int vio_register_driver(struct vio_driver *drv);
+extern int __vio_register_driver(struct vio_driver *drv, struct module *owner,
+				 const char *mod_name);
+/*
+ * vio_register_driver must be a macro so that KBUILD_MODNAME can be expanded
+ */
+#define vio_register_driver(driver)		\
+	__vio_register_driver(driver, THIS_MODULE, KBUILD_MODNAME)
 extern void vio_unregister_driver(struct vio_driver *drv);
 
 extern int vio_cmo_entitlement_update(size_t);
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index bca3fc4..879dd25 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -1159,17 +1159,22 @@ static int vio_bus_remove(struct device *dev)
  * vio_register_driver: - Register a new vio driver
  * @drv:	The vio_driver structure to be registered.
  */
-int vio_register_driver(struct vio_driver *viodrv)
+int __vio_register_driver(struct vio_driver *viodrv, struct module *owner,
+			  const char *mod_name)
 {
 	printk(KERN_DEBUG "%s: driver %s registering\n", __func__,
 		viodrv->driver.name);
 
 	/* fill in 'struct driver' fields */
+	viodrv->driver.name = viodrv->name;
+	viodrv->driver.pm = viodrv->pm;
 	viodrv->driver.bus = &vio_bus_type;
+	viodrv->driver.owner = owner;
+	viodrv->driver.mod_name = mod_name;
 
 	return driver_register(&viodrv->driver);
 }
-EXPORT_SYMBOL(vio_register_driver);
+EXPORT_SYMBOL(__vio_register_driver);
 
 /**
  * vio_unregister_driver - Remove registration of vio driver.
diff --git a/arch/sparc/include/asm/vio.h b/arch/sparc/include/asm/vio.h
index 9d83d3b..432afa8 100644
--- a/arch/sparc/include/asm/vio.h
+++ b/arch/sparc/include/asm/vio.h
@@ -284,6 +284,7 @@ struct vio_dev {
 };
 
 struct vio_driver {
+	const char			*name;
 	struct list_head		node;
 	const struct vio_device_id	*id_table;
 	int (*probe)(struct vio_dev *dev, const struct vio_device_id *id);
@@ -371,7 +372,13 @@ do {	if (vio->debug & VIO_DEBUG_##TYPE) \
 		       vio->vdev->channel_id, ## a); \
 } while (0)
 
-extern int vio_register_driver(struct vio_driver *drv);
+extern int __vio_register_driver(struct vio_driver *drv, struct module *owner,
+				 const char *mod_name);
+/*
+ * vio_register_driver must be a macro so that KBUILD_MODNAME can be expanded
+ */
+#define vio_register_driver(driver)		\
+	__vio_register_driver(driver, THIS_MODULE, KBUILD_MODNAME)
 extern void vio_unregister_driver(struct vio_driver *drv);
 
 static inline struct vio_driver *to_vio_driver(struct device_driver *drv)
diff --git a/arch/sparc/kernel/ds.c b/arch/sparc/kernel/ds.c
index 381edcd..fea13c7 100644
--- a/arch/sparc/kernel/ds.c
+++ b/arch/sparc/kernel/ds.c
@@ -1244,10 +1244,7 @@ static struct vio_driver ds_driver = {
 	.id_table	= ds_match,
 	.probe		= ds_probe,
 	.remove		= ds_remove,
-	.driver		= {
-		.name	= "ds",
-		.owner	= THIS_MODULE,
-	}
+	.name		= "ds",
 };
 
 static int __init ds_init(void)
diff --git a/arch/sparc/kernel/vio.c b/arch/sparc/kernel/vio.c
index f67e28e..6758b0b 100644
--- a/arch/sparc/kernel/vio.c
+++ b/arch/sparc/kernel/vio.c
@@ -119,13 +119,18 @@ static struct bus_type vio_bus_type = {
 	.remove		= vio_device_remove,
 };
 
-int vio_register_driver(struct vio_driver *viodrv)
+int __vio_register_driver(struct vio_driver *viodrv, struct module *owner,
+			const char *mod_name)
 {
 	viodrv->driver.bus = &vio_bus_type;
+	viodrv->driver.name = viodrv->name;
+	viodrv->driver.bus = &vio_bus_type;
+	viodrv->driver.owner = owner;
+	viodrv->driver.mod_name = mod_name;
 
 	return driver_register(&viodrv->driver);
 }
-EXPORT_SYMBOL(vio_register_driver);
+EXPORT_SYMBOL(__vio_register_driver);
 
 void vio_unregister_driver(struct vio_driver *viodrv)
 {
diff --git a/drivers/block/sunvdc.c b/drivers/block/sunvdc.c
index 48e8fee..9dcf76a 100644
--- a/drivers/block/sunvdc.c
+++ b/drivers/block/sunvdc.c
@@ -839,10 +839,7 @@ static struct vio_driver vdc_port_driver = {
 	.id_table	= vdc_port_match,
 	.probe		= vdc_port_probe,
 	.remove		= vdc_port_remove,
-	.driver		= {
-		.name	= "vdc_port",
-		.owner	= THIS_MODULE,
-	}
+	.name		= "vdc_port",
 };
 
 static int __init vdc_init(void)
diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c
index e877371..9010cea 100644
--- a/drivers/net/ethernet/ibm/ibmveth.c
+++ b/drivers/net/ethernet/ibm/ibmveth.c
@@ -1616,11 +1616,8 @@ static struct vio_driver ibmveth_driver = {
 	.probe		= ibmveth_probe,
 	.remove		= ibmveth_remove,
 	.get_desired_dma = ibmveth_get_desired_dma,
-	.driver		= {
-		.name	= ibmveth_driver_name,
-		.owner	= THIS_MODULE,
-		.pm = &ibmveth_pm_ops,
-	}
+	.name		= ibmveth_driver_name,
+	.pm		= &ibmveth_pm_ops,
 };
 
 static int __init ibmveth_module_init(void)
diff --git a/drivers/net/ethernet/sun/sunvnet.c b/drivers/net/ethernet/sun/sunvnet.c
index 8c6c059..998c0f0 100644
--- a/drivers/net/ethernet/sun/sunvnet.c
+++ b/drivers/net/ethernet/sun/sunvnet.c
@@ -1264,10 +1264,7 @@ static struct vio_driver vnet_port_driver = {
 	.id_table	= vnet_port_match,
 	.probe		= vnet_port_probe,
 	.remove		= vnet_port_remove,
-	.driver		= {
-		.name	= "vnet_port",
-		.owner	= THIS_MODULE,
-	}
+	.name		= "vnet_port",
 };
 
 static int __init vnet_init(void)
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
index bdfa223..134a0ae 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.c
+++ b/drivers/scsi/ibmvscsi/ibmvfc.c
@@ -4890,11 +4890,8 @@ static struct vio_driver ibmvfc_driver = {
 	.probe = ibmvfc_probe,
 	.remove = ibmvfc_remove,
 	.get_desired_dma = ibmvfc_get_desired_dma,
-	.driver = {
-		.name = IBMVFC_NAME,
-		.owner = THIS_MODULE,
-		.pm = &ibmvfc_pm_ops,
-	}
+	.name = IBMVFC_NAME,
+	.pm = &ibmvfc_pm_ops,
 };
 
 static struct fc_function_template ibmvfc_transport_functions = {
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index e984951..3a6c474 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -2061,11 +2061,8 @@ static struct vio_driver ibmvscsi_driver = {
 	.probe = ibmvscsi_probe,
 	.remove = ibmvscsi_remove,
 	.get_desired_dma = ibmvscsi_get_desired_dma,
-	.driver = {
-		.name = "ibmvscsi",
-		.owner = THIS_MODULE,
-		.pm = &ibmvscsi_pm_ops,
-	}
+	.name = "ibmvscsi",
+	.pm = &ibmvscsi_pm_ops,
 };
 
 static struct srp_function_template ibmvscsi_transport_functions = {
diff --git a/drivers/scsi/ibmvscsi/ibmvstgt.c b/drivers/scsi/ibmvscsi/ibmvstgt.c
index 2256bab..aa7ed81 100644
--- a/drivers/scsi/ibmvscsi/ibmvstgt.c
+++ b/drivers/scsi/ibmvscsi/ibmvstgt.c
@@ -918,10 +918,7 @@ static struct vio_driver ibmvstgt_driver = {
 	.id_table = ibmvstgt_device_table,
 	.probe = ibmvstgt_probe,
 	.remove = ibmvstgt_remove,
-	.driver = {
-		.name = "ibmvscsis",
-		.owner = THIS_MODULE,
-	}
+	.name = "ibmvscsis",
 };
 
 static int get_system_info(void)
diff --git a/drivers/tty/hvc/hvc_vio.c b/drivers/tty/hvc/hvc_vio.c
index 3a0d53d..ee30779 100644
--- a/drivers/tty/hvc/hvc_vio.c
+++ b/drivers/tty/hvc/hvc_vio.c
@@ -310,11 +310,8 @@ static int __devexit hvc_vio_remove(struct vio_dev *vdev)
 static struct vio_driver hvc_vio_driver = {
 	.id_table	= hvc_driver_table,
 	.probe		= hvc_vio_probe,
-	.remove		= __devexit_p(hvc_vio_remove),
-	.driver		= {
-		.name	= hvc_driver_name,
-		.owner	= THIS_MODULE,
-	}
+	.remove		= hvc_vio_remove,
+	.name		= hvc_driver_name,
 };
 
 static int __init hvc_vio_init(void)
diff --git a/drivers/tty/hvc/hvcs.c b/drivers/tty/hvc/hvcs.c
index d237591..3436436 100644
--- a/drivers/tty/hvc/hvcs.c
+++ b/drivers/tty/hvc/hvcs.c
@@ -879,10 +879,7 @@ static struct vio_driver hvcs_vio_driver = {
 	.id_table	= hvcs_driver_table,
 	.probe		= hvcs_probe,
 	.remove		= __devexit_p(hvcs_remove),
-	.driver		= {
-		.name	= hvcs_driver_name,
-		.owner	= THIS_MODULE,
-	}
+	.name		= hvcs_driver_name,
 };
 
 /* Only called from hvcs_get_pi please */

^ permalink raw reply related

* Re: [git pull] Please pull powerpc.git next branch
From: Benjamin Herrenschmidt @ 2012-03-22  2:44 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Russell King, Linux Kernel list, linuxppc-dev list, Kyle Moffett,
	Andrew Morton
In-Reply-To: <CA+55aFz-pyBHa73zkbkub4czwnU+k4_qKzBEaAGvi66MBBUTpQ@mail.gmail.com>

On Wed, 2012-03-21 at 19:02 -0700, Linus Torvalds wrote:
> 
> Ok, so this conflicted a bit with the generalized irq-domain stuff
> from Grant Likely, and while I tried to fix it up I can't even
> compile-test the end result, so you really need to verify my merge and
> perhaps send me fixups. Ok?

Ok, I expected some of that, I'll run some tests today.

> Especially the sysdev/mpic.c resolution needs somebody who knows the
> code to verify. Added Grant and Kyle explicitly to the cc..

Thanks !

Cheers,
Ben.

^ permalink raw reply

* Re: [git pull] Please pull powerpc.git next branch
From: Linus Torvalds @ 2012-03-22  2:02 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Grant Likely, Kyle Moffett
  Cc: linuxppc-dev list, Andrew Morton, Russell King, Linux Kernel list
In-Reply-To: <1332377206.2982.60.camel@pasglop>

On Wed, Mar 21, 2012 at 5:46 PM, Benjamin Herrenschmidt
<benh@kernel.crashing.org> wrote:
>
> Here's the powerpc batch for this merge window. It is going to be a bit
> more nasty than usual as in touching things outside of arch/powerpc
> mostly due to the big iSeriesectomy :-) We finally got rid of the bugger
> (legacy iSeries support) which was a PITA to maintain and that nobody
> really used anymore.
>
> Here are some of the highlights:

Ok, so this conflicted a bit with the generalized irq-domain stuff
from Grant Likely, and while I tried to fix it up I can't even
compile-test the end result, so you really need to verify my merge and
perhaps send me fixups. Ok?

Especially the sysdev/mpic.c resolution needs somebody who knows the
code to verify. Added Grant and Kyle explicitly to the cc..

                      Linus

^ permalink raw reply

* [PATCH 6/6] powerpc/pseries: Cut down on enthusiastic use of defines in RAS code
From: Anton Blanchard @ 2012-03-22  1:59 UTC (permalink / raw)
  To: benh, paulus; +Cc: linuxppc-dev
In-Reply-To: <20120322125803.40bb5e34@kryten>


So many defines for such a little file. Most of them can go.

Also remove the single entry changelog, we have git for that.

Signed-off-by: Anton Blanchard <anton@samba.org>
---

Index: linux-build/arch/powerpc/platforms/pseries/ras.c
===================================================================
--- linux-build.orig/arch/powerpc/platforms/pseries/ras.c	2012-03-22 12:44:13.306570733 +1100
+++ linux-build/arch/powerpc/platforms/pseries/ras.c	2012-03-22 12:44:24.798779279 +1100
@@ -16,39 +16,15 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  */
 
-/* Change Activity:
- * 2001/09/21 : engebret : Created with minimal EPOW and HW exception support.
- * End Change Activity
- */
-
-#include <linux/errno.h>
-#include <linux/threads.h>
-#include <linux/kernel_stat.h>
-#include <linux/signal.h>
 #include <linux/sched.h>
-#include <linux/ioport.h>
 #include <linux/interrupt.h>
-#include <linux/timex.h>
-#include <linux/init.h>
-#include <linux/delay.h>
 #include <linux/irq.h>
-#include <linux/random.h>
-#include <linux/sysrq.h>
-#include <linux/bitops.h>
+#include <linux/of.h>
 #include <linux/fs.h>
 #include <linux/reboot.h>
 
-#include <asm/uaccess.h>
-#include <asm/system.h>
-#include <asm/io.h>
-#include <asm/pgtable.h>
-#include <asm/irq.h>
-#include <asm/cache.h>
-#include <asm/prom.h>
-#include <asm/ptrace.h>
 #include <asm/machdep.h>
 #include <asm/rtas.h>
-#include <asm/udbg.h>
 #include <asm/firmware.h>
 
 #include "pseries.h"

^ permalink raw reply

* [PATCH 5/6] powerpc/pseries: Clean up ras_error_interrupt code
From: Anton Blanchard @ 2012-03-22  1:58 UTC (permalink / raw)
  To: benh, paulus; +Cc: linuxppc-dev
In-Reply-To: <20120322125649.434c6f5e@kryten>


The RAS error interrupt is no longer used but we may as well
mirror the changes we made to the EPOW interrupt.

Signed-off-by: Anton Blanchard <anton@samba.org>
---

Index: linux-build/arch/powerpc/platforms/pseries/ras.c
===================================================================
--- linux-build.orig/arch/powerpc/platforms/pseries/ras.c	2012-03-22 12:43:56.574267101 +1100
+++ linux-build/arch/powerpc/platforms/pseries/ras.c	2012-03-22 12:44:13.306570733 +1100
@@ -246,7 +246,7 @@ static irqreturn_t ras_epow_interrupt(in
 static irqreturn_t ras_error_interrupt(int irq, void *dev_id)
 {
 	struct rtas_error_log *rtas_elog;
-	int status = 0xdeadbeef;
+	int status;
 	int fatal;
 
 	spin_lock(&ras_log_buf_lock);
@@ -254,7 +254,7 @@ static irqreturn_t ras_error_interrupt(i
 	status = rtas_call(ras_check_exception_token, 6, 1, NULL,
 			   RTAS_VECTOR_EXTERNAL_INTERRUPT,
 			   virq_to_hw(irq),
-			   RTAS_INTERNAL_ERROR, 1 /*Time Critical */,
+			   RTAS_INTERNAL_ERROR, 1 /* Time Critical */,
 			   __pa(&ras_log_buf),
 				rtas_get_error_log_max());
 
@@ -269,24 +269,13 @@ static irqreturn_t ras_error_interrupt(i
 	log_error(ras_log_buf, ERR_TYPE_RTAS_LOG, fatal);
 
 	if (fatal) {
-		udbg_printf("Fatal HW Error <0x%lx 0x%x>\n",
-			    *((unsigned long *)&ras_log_buf), status);
-		printk(KERN_EMERG "Error: Fatal hardware error <0x%lx 0x%x>\n",
-		       *((unsigned long *)&ras_log_buf), status);
-
-#ifndef DEBUG_RTAS_POWER_OFF
-		/* Don't actually power off when debugging so we can test
-		 * without actually failing while injecting errors.
-		 * Error data will not be logged to syslog.
-		 */
-		ppc_md.power_off();
-#endif
+		pr_emerg("Fatal hardware error reported by firmware");
+		pr_emerg("Check RTAS error log for details");
+		pr_emerg("Immediate power off");
+		emergency_sync();
+		kernel_power_off();
 	} else {
-		udbg_printf("Recoverable HW Error <0x%lx 0x%x>\n",
-			    *((unsigned long *)&ras_log_buf), status);
-		printk(KERN_WARNING
-		       "Warning: Recoverable hardware error <0x%lx 0x%x>\n",
-		       *((unsigned long *)&ras_log_buf), status);
+		pr_err("Recoverable hardware error reported by firmware");
 	}
 
 	spin_unlock(&ras_log_buf_lock);

^ permalink raw reply

* [PATCH 4/6] powerpc/pseries: Remove RTAS_POWERMGM_EVENTS
From: Anton Blanchard @ 2012-03-22  1:56 UTC (permalink / raw)
  To: benh, paulus; +Cc: linuxppc-dev
In-Reply-To: <20120322125343.63d77e82@kryten>


IBM bit 2 in the rtas event-scan and check-exception calls is
marked reserved in the PAPR, so remove it from our RAS code.

Signed-off-by: Anton Blanchard <anton@samba.org>
---

Index: linux-build/arch/powerpc/include/asm/rtas.h
===================================================================
--- linux-build.orig/arch/powerpc/include/asm/rtas.h	2012-03-22 12:41:38.079754144 +1100
+++ linux-build/arch/powerpc/include/asm/rtas.h	2012-03-22 12:43:56.574267101 +1100
@@ -74,7 +74,6 @@ struct rtas_suspend_me_data {
 /* RTAS event classes */
 #define RTAS_INTERNAL_ERROR		0x80000000 /* set bit 0 */
 #define RTAS_EPOW_WARNING		0x40000000 /* set bit 1 */
-#define RTAS_POWERMGM_EVENTS		0x20000000 /* set bit 2 */
 #define RTAS_HOTPLUG_EVENTS		0x10000000 /* set bit 3 */
 #define RTAS_IO_EVENTS			0x08000000 /* set bit 4 */
 #define RTAS_EVENT_SCAN_ALL_EVENTS	0xffffffff
Index: linux-build/arch/powerpc/platforms/pseries/ras.c
===================================================================
--- linux-build.orig/arch/powerpc/platforms/pseries/ras.c	2012-03-22 12:43:50.842163086 +1100
+++ linux-build/arch/powerpc/platforms/pseries/ras.c	2012-03-22 12:43:56.574267101 +1100
@@ -223,7 +223,7 @@ static irqreturn_t ras_epow_interrupt(in
 	status = rtas_call(ras_check_exception_token, 6, 1, NULL,
 			   RTAS_VECTOR_EXTERNAL_INTERRUPT,
 			   virq_to_hw(irq),
-			   RTAS_EPOW_WARNING | RTAS_POWERMGM_EVENTS,
+			   RTAS_EPOW_WARNING,
 			   critical, __pa(&ras_log_buf),
 				rtas_get_error_log_max());
 

^ permalink raw reply

* [PATCH 3/6] powerpc/pseries: Use rtas_get_sensor in RAS code
From: Anton Blanchard @ 2012-03-22  1:53 UTC (permalink / raw)
  To: benh, paulus; +Cc: linuxppc-dev
In-Reply-To: <20120322124707.3cd3037f@kryten>


We have rtas_get_sensor so we may as well use it.

Signed-off-by: Anton Blanchard <anton@samba.org>
---

Index: linux-build/arch/powerpc/platforms/pseries/ras.c
===================================================================
--- linux-build.orig/arch/powerpc/platforms/pseries/ras.c	2012-03-22 12:42:54.473140239 +1100
+++ linux-build/arch/powerpc/platforms/pseries/ras.c	2012-03-22 12:43:28.957765972 +1100
@@ -59,7 +59,6 @@ static DEFINE_SPINLOCK(ras_log_buf_lock)
 static char global_mce_data_buf[RTAS_ERROR_LOG_MAX];
 static DEFINE_PER_CPU(__u64, mce_data_buf);
 
-static int ras_get_sensor_state_token;
 static int ras_check_exception_token;
 
 #define EPOW_SENSOR_TOKEN	9
@@ -77,7 +76,6 @@ static int __init init_ras_IRQ(void)
 {
 	struct device_node *np;
 
-	ras_get_sensor_state_token = rtas_token("get-sensor-state");
 	ras_check_exception_token = rtas_token("check-exception");
 
 	/* Internal Errors */
@@ -213,8 +211,7 @@ static irqreturn_t ras_epow_interrupt(in
 	int state;
 	int critical;
 
-	status = rtas_call(ras_get_sensor_state_token, 2, 2, &state,
-			   EPOW_SENSOR_TOKEN, EPOW_SENSOR_INDEX);
+	status = rtas_get_sensor(EPOW_SENSOR_TOKEN, EPOW_SENSOR_INDEX, &state);
 
 	if (state > 3)
 		critical = 1;		/* Time Critical */

^ permalink raw reply

* Re: [PATCH 14/17] powerpc: crypto: nx driver code supporting nx encryption
From: Benjamin Herrenschmidt @ 2012-03-22  1:50 UTC (permalink / raw)
  To: Greg KH; +Cc: Kent Yoder, linuxppc-dev, linux-kernel, rcj, linux-crypto
In-Reply-To: <20120321221517.GB30748@kroah.com>

On Wed, 2012-03-21 at 15:15 -0700, Greg KH wrote:
> 
> Really?  vio drivers are supposed to look like this with the .name and
> .owner field manually being set in the static initialization of the
> driver?  That's sad, and should be fixed, the vio core should do this
> type of thing for you. 

Yeah, they still do it the old way, nobody got to fix that yet, should
be pretty easy though.

Cheers,
Ben.

^ permalink raw reply

* [PATCH 2/6] powerpc/pseries: Parse and handle EPOW interrupts
From: Anton Blanchard @ 2012-03-22  1:49 UTC (permalink / raw)
  To: benh, paulus; +Cc: linuxppc-dev
In-Reply-To: <20120322124707.3cd3037f@kryten>


We have code to take environmental and power warning (EPOW)
interrupts but it simply prints a terse error message:

EPOW <0x6240040000000b8 0x0 0x0>

which tells us nothing about what happened. Even worse, if we
don't correctly respond to the interrupt we may get terminated
by firmware.

Add code to printk some useful information when we get EPOW events.
We want to make it clear that we have an error, that it was
reported by firmware and that the RTAS error log will have more
detailed information. eg:

	Ambient temperature too high reported by firmware.
	Check RTAS error log for details

Depending on the error encountered, we now issue an immediate or
an orderly power down.

Move initialization of the EPOW interrupt earlier in boot since we
want to respond to them as early as possible.

Signed-off-by: Anton Blanchard <anton@samba.org>
---

Index: linux-build/arch/powerpc/platforms/pseries/ras.c
===================================================================
--- linux-build.orig/arch/powerpc/platforms/pseries/ras.c	2012-03-22 12:24:24.980892033 +1100
+++ linux-build/arch/powerpc/platforms/pseries/ras.c	2012-03-22 12:25:06.857659239 +1100
@@ -35,6 +35,8 @@
 #include <linux/random.h>
 #include <linux/sysrq.h>
 #include <linux/bitops.h>
+#include <linux/fs.h>
+#include <linux/reboot.h>
 
 #include <asm/uaccess.h>
 #include <asm/system.h>
@@ -95,26 +97,127 @@ static int __init init_ras_IRQ(void)
 
 	return 0;
 }
-__initcall(init_ras_IRQ);
+subsys_initcall(init_ras_IRQ);
 
-/*
- * Handle power subsystem events (EPOW).
- *
- * Presently we just log the event has occurred.  This should be fixed
- * to examine the type of power failure and take appropriate action where
- * the time horizon permits something useful to be done.
- */
+#define EPOW_SHUTDOWN_NORMAL				1
+#define EPOW_SHUTDOWN_ON_UPS				2
+#define EPOW_SHUTDOWN_LOSS_OF_CRITICAL_FUNCTIONS	3
+#define EPOW_SHUTDOWN_AMBIENT_TEMPERATURE_TOO_HIGH	4
+
+static void handle_system_shutdown(char event_modifier)
+{
+	switch (event_modifier) {
+	case EPOW_SHUTDOWN_NORMAL:
+		pr_emerg("Firmware initiated power off");
+		orderly_poweroff(1);
+		break;
+
+	case EPOW_SHUTDOWN_ON_UPS:
+		pr_emerg("Loss of power reported by firmware, system is "
+			"running on UPS/battery");
+		break;
+
+	case EPOW_SHUTDOWN_LOSS_OF_CRITICAL_FUNCTIONS:
+		pr_emerg("Loss of system critical functions reported by "
+			"firmware");
+		pr_emerg("Check RTAS error log for details");
+		orderly_poweroff(1);
+		break;
+
+	case EPOW_SHUTDOWN_AMBIENT_TEMPERATURE_TOO_HIGH:
+		pr_emerg("Ambient temperature too high reported by firmware");
+		pr_emerg("Check RTAS error log for details");
+		orderly_poweroff(1);
+		break;
+
+	default:
+		pr_err("Unknown power/cooling shutdown event (modifier %d)",
+			event_modifier);
+	}
+}
+
+struct epow_errorlog {
+	unsigned char sensor_value;
+	unsigned char event_modifier;
+	unsigned char extended_modifier;
+	unsigned char reserved;
+	unsigned char platform_reason;
+};
+
+#define EPOW_RESET			0
+#define EPOW_WARN_COOLING		1
+#define EPOW_WARN_POWER			2
+#define EPOW_SYSTEM_SHUTDOWN		3
+#define EPOW_SYSTEM_HALT		4
+#define EPOW_MAIN_ENCLOSURE		5
+#define EPOW_POWER_OFF			7
+
+void rtas_parse_epow_errlog(struct rtas_error_log *log)
+{
+	struct pseries_errorlog *pseries_log;
+	struct epow_errorlog *epow_log;
+	char action_code;
+	char modifier;
+
+	pseries_log = get_pseries_errorlog(log, PSERIES_ELOG_SECT_ID_EPOW);
+	if (pseries_log == NULL)
+		return;
+
+	epow_log = (struct epow_errorlog *)pseries_log->data;
+	action_code = epow_log->sensor_value & 0xF;	/* bottom 4 bits */
+	modifier = epow_log->event_modifier & 0xF;	/* bottom 4 bits */
+
+	switch (action_code) {
+	case EPOW_RESET:
+		pr_err("Non critical power or cooling issue cleared");
+		break;
+
+	case EPOW_WARN_COOLING:
+		pr_err("Non critical cooling issue reported by firmware");
+		pr_err("Check RTAS error log for details");
+		break;
+
+	case EPOW_WARN_POWER:
+		pr_err("Non critical power issue reported by firmware");
+		pr_err("Check RTAS error log for details");
+		break;
+
+	case EPOW_SYSTEM_SHUTDOWN:
+		handle_system_shutdown(epow_log->event_modifier);
+		break;
+
+	case EPOW_SYSTEM_HALT:
+		pr_emerg("Firmware initiated power off");
+		orderly_poweroff(1);
+		break;
+
+	case EPOW_MAIN_ENCLOSURE:
+	case EPOW_POWER_OFF:
+		pr_emerg("Critical power/cooling issue reported by firmware");
+		pr_emerg("Check RTAS error log for details");
+		pr_emerg("Immediate power off");
+		emergency_sync();
+		kernel_power_off();
+		break;
+
+	default:
+		pr_err("Unknown power/cooling event (action code %d)",
+			action_code);
+	}
+}
+
+/* Handle environmental and power warning (EPOW) interrupts. */
 static irqreturn_t ras_epow_interrupt(int irq, void *dev_id)
 {
-	int status = 0xdeadbeef;
-	int state = 0;
+	int status;
+	int state;
 	int critical;
 
 	status = rtas_call(ras_get_sensor_state_token, 2, 2, &state,
 			   EPOW_SENSOR_TOKEN, EPOW_SENSOR_INDEX);
 
 	if (state > 3)
-		critical = 1;  /* Time Critical */
+		critical = 1;		/* Time Critical */
 	else
 		critical = 0;
 
@@ -127,14 +230,10 @@ static irqreturn_t ras_epow_interrupt(in
 			   critical, __pa(&ras_log_buf),
 				rtas_get_error_log_max());
 
-	udbg_printf("EPOW <0x%lx 0x%x 0x%x>\n",
-		    *((unsigned long *)&ras_log_buf), status, state);
-	printk(KERN_WARNING "EPOW <0x%lx 0x%x 0x%x>\n",
-	       *((unsigned long *)&ras_log_buf), status, state);
-
-	/* format and print the extended information */
 	log_error(ras_log_buf, ERR_TYPE_RTAS_LOG, 0);
 
+	rtas_parse_epow_errlog((struct rtas_error_log *)ras_log_buf);
+
 	spin_unlock(&ras_log_buf_lock);
 	return IRQ_HANDLED;
 }

^ permalink raw reply

* [PATCH 1/6] powerpc: Make function that parses RTAS error logs global
From: Anton Blanchard @ 2012-03-22  1:47 UTC (permalink / raw)
  To: benh, paulus; +Cc: linuxppc-dev


The IO event interrupt code has a function that finds specific
sections in an RTAS error log. We want to use it in the EPOW
code so make it global.

Rename things to make it less cryptic:

find_xelog_section() -> get_pseries_errorlog()
struct pseries_elog_section -> struct pseries_errorlog

Signed-off-by: Anton Blanchard <anton@samba.org>
---

Index: linux-build/arch/powerpc/include/asm/rtas.h
===================================================================
--- linux-build.orig/arch/powerpc/include/asm/rtas.h	2012-03-22 11:46:57.408187770 +1100
+++ linux-build/arch/powerpc/include/asm/rtas.h	2012-03-22 11:48:25.221771962 +1100
@@ -204,6 +203,39 @@ struct rtas_ext_event_log_v6 {
 					/* Variable length.		*/
 };
 
+/* pSeries event log format */
+
+/* Two bytes ASCII section IDs */
+#define PSERIES_ELOG_SECT_ID_PRIV_HDR		(('P' << 8) | 'H')
+#define PSERIES_ELOG_SECT_ID_USER_HDR		(('U' << 8) | 'H')
+#define PSERIES_ELOG_SECT_ID_PRIMARY_SRC	(('P' << 8) | 'S')
+#define PSERIES_ELOG_SECT_ID_EXTENDED_UH	(('E' << 8) | 'H')
+#define PSERIES_ELOG_SECT_ID_FAILING_MTMS	(('M' << 8) | 'T')
+#define PSERIES_ELOG_SECT_ID_SECONDARY_SRC	(('S' << 8) | 'S')
+#define PSERIES_ELOG_SECT_ID_DUMP_LOCATOR	(('D' << 8) | 'H')
+#define PSERIES_ELOG_SECT_ID_FW_ERROR		(('S' << 8) | 'W')
+#define PSERIES_ELOG_SECT_ID_IMPACT_PART_ID	(('L' << 8) | 'P')
+#define PSERIES_ELOG_SECT_ID_LOGIC_RESOURCE_ID	(('L' << 8) | 'R')
+#define PSERIES_ELOG_SECT_ID_HMC_ID		(('H' << 8) | 'M')
+#define PSERIES_ELOG_SECT_ID_EPOW		(('E' << 8) | 'P')
+#define PSERIES_ELOG_SECT_ID_IO_EVENT		(('I' << 8) | 'E')
+#define PSERIES_ELOG_SECT_ID_MANUFACT_INFO	(('M' << 8) | 'I')
+#define PSERIES_ELOG_SECT_ID_CALL_HOME		(('C' << 8) | 'H')
+#define PSERIES_ELOG_SECT_ID_USER_DEF		(('U' << 8) | 'D')
+
+/* Vendor specific Platform Event Log Format, Version 6, section header */
+struct pseries_errorlog {
+	uint16_t id;			/* 0x00 2-byte ASCII section ID	*/
+	uint16_t length;		/* 0x02 Section length in bytes	*/
+	uint8_t version;		/* 0x04 Section version		*/
+	uint8_t subtype;		/* 0x05 Section subtype		*/
+	uint16_t creator_component;	/* 0x06 Creator component ID	*/
+	uint8_t data[];			/* 0x08 Start of section data	*/
+};
+
+struct pseries_errorlog *get_pseries_errorlog(struct rtas_error_log *log,
+					      uint16_t section_id);
+
 /*
  * This can be set by the rtas_flash module so that it can get called
  * as the absolutely last thing before the kernel terminates.
Index: linux-build/arch/powerpc/kernel/rtas.c
===================================================================
--- linux-build.orig/arch/powerpc/kernel/rtas.c	2012-03-22 11:46:57.424188057 +1100
+++ linux-build/arch/powerpc/kernel/rtas.c	2012-03-22 11:48:25.221771962 +1100
@@ -868,6 +868,40 @@ int rtas_ibm_suspend_me(struct rtas_args
 }
 #endif
 
+/**
+ * Find a specific pseries error log in an RTAS extended event log.
+ * @log: RTAS error/event log
+ * @section_id: two character section identifier
+ *
+ * Returns a pointer to the specified errorlog or NULL if not found.
+ */
+struct pseries_errorlog *get_pseries_errorlog(struct rtas_error_log *log,
+					      uint16_t section_id)
+{
+	struct rtas_ext_event_log_v6 *ext_log =
+		(struct rtas_ext_event_log_v6 *)log->buffer;
+	struct pseries_errorlog *sect;
+	unsigned char *p, *log_end;
+
+	/* Check that we understand the format */
+	if (log->extended_log_length < sizeof(struct rtas_ext_event_log_v6) ||
+	    ext_log->log_format != RTAS_V6EXT_LOG_FORMAT_EVENT_LOG ||
+	    ext_log->company_id != RTAS_V6EXT_COMPANY_ID_IBM)
+		return NULL;
+
+	log_end = log->buffer + log->extended_log_length;
+	p = ext_log->vendor_log;
+
+	while (p < log_end) {
+		sect = (struct pseries_errorlog *)p;
+		if (sect->id == section_id)
+			return sect;
+		p += sect->length;
+	}
+
+	return NULL;
+}
+
 asmlinkage int ppc_rtas(struct rtas_args __user *uargs)
 {
 	struct rtas_args args;
Index: linux-build/arch/powerpc/platforms/pseries/io_event_irq.c
===================================================================
--- linux-build.orig/arch/powerpc/platforms/pseries/io_event_irq.c	2012-03-22 11:46:57.444188419 +1100
+++ linux-build/arch/powerpc/platforms/pseries/io_event_irq.c	2012-03-22 11:48:25.221771962 +1100
@@ -63,73 +63,9 @@ EXPORT_SYMBOL_GPL(pseries_ioei_notifier_
 
 static int ioei_check_exception_token;
 
-/* pSeries event log format */
-
-/* Two bytes ASCII section IDs */
-#define PSERIES_ELOG_SECT_ID_PRIV_HDR		(('P' << 8) | 'H')
-#define PSERIES_ELOG_SECT_ID_USER_HDR		(('U' << 8) | 'H')
-#define PSERIES_ELOG_SECT_ID_PRIMARY_SRC	(('P' << 8) | 'S')
-#define PSERIES_ELOG_SECT_ID_EXTENDED_UH	(('E' << 8) | 'H')
-#define PSERIES_ELOG_SECT_ID_FAILING_MTMS	(('M' << 8) | 'T')
-#define PSERIES_ELOG_SECT_ID_SECONDARY_SRC	(('S' << 8) | 'S')
-#define PSERIES_ELOG_SECT_ID_DUMP_LOCATOR	(('D' << 8) | 'H')
-#define PSERIES_ELOG_SECT_ID_FW_ERROR		(('S' << 8) | 'W')
-#define PSERIES_ELOG_SECT_ID_IMPACT_PART_ID	(('L' << 8) | 'P')
-#define PSERIES_ELOG_SECT_ID_LOGIC_RESOURCE_ID	(('L' << 8) | 'R')
-#define PSERIES_ELOG_SECT_ID_HMC_ID		(('H' << 8) | 'M')
-#define PSERIES_ELOG_SECT_ID_EPOW		(('E' << 8) | 'P')
-#define PSERIES_ELOG_SECT_ID_IO_EVENT		(('I' << 8) | 'E')
-#define PSERIES_ELOG_SECT_ID_MANUFACT_INFO	(('M' << 8) | 'I')
-#define PSERIES_ELOG_SECT_ID_CALL_HOME		(('C' << 8) | 'H')
-#define PSERIES_ELOG_SECT_ID_USER_DEF		(('U' << 8) | 'D')
-
-/* Vendor specific Platform Event Log Format, Version 6, section header */
-struct pseries_elog_section {
-	uint16_t id;			/* 0x00 2-byte ASCII section ID	*/
-	uint16_t length;		/* 0x02 Section length in bytes	*/
-	uint8_t version;		/* 0x04 Section version		*/
-	uint8_t subtype;		/* 0x05 Section subtype		*/
-	uint16_t creator_component;	/* 0x06 Creator component ID	*/
-	uint8_t data[];			/* 0x08 Start of section data	*/
-};
-
 static char ioei_rtas_buf[RTAS_DATA_BUF_SIZE] __cacheline_aligned;
 
 /**
- * Find data portion of a specific section in RTAS extended event log.
- * @elog: RTAS error/event log.
- * @sect_id: secsion ID.
- *
- * Return:
- *	pointer to the section data of the specified section
- *	NULL if not found
- */
-static struct pseries_elog_section *find_xelog_section(struct rtas_error_log *elog,
-						       uint16_t sect_id)
-{
-	struct rtas_ext_event_log_v6 *xelog =
-		(struct rtas_ext_event_log_v6 *) elog->buffer;
-	struct pseries_elog_section *sect;
-	unsigned char *p, *log_end;
-
-	/* Check that we understand the format */
-	if (elog->extended_log_length < sizeof(struct rtas_ext_event_log_v6) ||
-	    xelog->log_format != RTAS_V6EXT_LOG_FORMAT_EVENT_LOG ||
-	    xelog->company_id != RTAS_V6EXT_COMPANY_ID_IBM)
-		return NULL;
-
-	log_end = elog->buffer + elog->extended_log_length;
-	p = xelog->vendor_log;
-	while (p < log_end) {
-		sect = (struct pseries_elog_section *)p;
-		if (sect->id == sect_id)
-			return sect;
-		p += sect->length;
-	}
-	return NULL;
-}
-
-/**
  * Find the data portion of an IO Event section from event log.
  * @elog: RTAS error/event log.
  *
@@ -138,7 +74,7 @@ static struct pseries_elog_section *find
  */
 static struct pseries_io_event * ioei_find_event(struct rtas_error_log *elog)
 {
-	struct pseries_elog_section *sect;
+	struct pseries_errorlog *sect;
 
 	/* We should only ever get called for io-event interrupts, but if
 	 * we do get called for another type then something went wrong so
@@ -152,7 +88,7 @@ static struct pseries_io_event * ioei_fi
 		return NULL;
 	}
 
-	sect = find_xelog_section(elog, PSERIES_ELOG_SECT_ID_IO_EVENT);
+	sect = get_pseries_errorlog(elog, PSERIES_ELOG_SECT_ID_IO_EVENT);
 	if (unlikely(!sect)) {
 		printk_once(KERN_WARNING "io_event_irq: RTAS extended event "
 			    "log does not contain an IO Event section. "

^ permalink raw reply

* [PATCH 2/3] powerpc/eeh: remove eeh information from pci_dn
From: Gavin Shan @ 2012-03-21  7:30 UTC (permalink / raw)
  To: linuxppc-dev, benh; +Cc: sfr, shangw
In-Reply-To: <1332315029-29688-1-git-send-email-shangw@linux.vnet.ibm.com>

The patch removes the eeh information from pci_dn since the eeh
device (struct eeh_dev) already contained those information.
Also, the pseries IOMMU mapping functions have been changed
for a little bit to retrieve PE address from eeh device instead
of pci_dn.

Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
---
 arch/powerpc/include/asm/pci-bridge.h  |    8 --------
 arch/powerpc/platforms/pseries/iommu.c |   29 +++++++++++++----------------
 2 files changed, 13 insertions(+), 24 deletions(-)

diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index 21f99ae..ac39e6a 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -156,14 +156,6 @@ struct pci_dn {
 	struct	pci_dev *pcidev;	/* back-pointer to the pci device */
 #ifdef CONFIG_EEH
 	struct eeh_dev *edev;		/* eeh device */
-	int	class_code;		/* pci device class */
-	int	eeh_mode;		/* See eeh.h for possible EEH_MODEs */
-	int	eeh_config_addr;
-	int	eeh_pe_config_addr; /* new-style partition endpoint address */
-	int	eeh_check_count;	/* # times driver ignored error */
-	int	eeh_freeze_count;	/* # times this device froze up. */
-	int	eeh_false_positives;	/* # times this device reported #ff's */
-	u32	config_space[16];	/* saved PCI config space */
 #endif
 #define IODA_INVALID_PE		(-1)
 #ifdef CONFIG_PPC_POWERNV
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index c442f2b..0915b1a 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -809,8 +809,7 @@ machine_arch_initcall(pseries, find_existing_ddw_windows);
 static int query_ddw(struct pci_dev *dev, const u32 *ddw_avail,
 			struct ddw_query_response *query)
 {
-	struct device_node *dn;
-	struct pci_dn *pcidn;
+	struct eeh_dev *edev;
 	u32 cfg_addr;
 	u64 buid;
 	int ret;
@@ -821,12 +820,12 @@ static int query_ddw(struct pci_dev *dev, const u32 *ddw_avail,
 	 * Retrieve them from the pci device, not the node with the
 	 * dma-window property
 	 */
-	dn = pci_device_to_OF_node(dev);
-	pcidn = PCI_DN(dn);
-	cfg_addr = pcidn->eeh_config_addr;
-	if (pcidn->eeh_pe_config_addr)
-		cfg_addr = pcidn->eeh_pe_config_addr;
-	buid = pcidn->phb->buid;
+	edev = pci_dev_to_eeh_dev(dev);
+	cfg_addr = edev->config_addr;
+	if (edev->pe_config_addr)
+		cfg_addr = edev->pe_config_addr;
+	buid = edev->phb->buid;
+
 	ret = rtas_call(ddw_avail[0], 3, 5, (u32 *)query,
 		  cfg_addr, BUID_HI(buid), BUID_LO(buid));
 	dev_info(&dev->dev, "ibm,query-pe-dma-windows(%x) %x %x %x"
@@ -839,8 +838,7 @@ static int create_ddw(struct pci_dev *dev, const u32 *ddw_avail,
 			struct ddw_create_response *create, int page_shift,
 			int window_shift)
 {
-	struct device_node *dn;
-	struct pci_dn *pcidn;
+	struct eeh_dev *edev;
 	u32 cfg_addr;
 	u64 buid;
 	int ret;
@@ -851,12 +849,11 @@ static int create_ddw(struct pci_dev *dev, const u32 *ddw_avail,
 	 * Retrieve them from the pci device, not the node with the
 	 * dma-window property
 	 */
-	dn = pci_device_to_OF_node(dev);
-	pcidn = PCI_DN(dn);
-	cfg_addr = pcidn->eeh_config_addr;
-	if (pcidn->eeh_pe_config_addr)
-		cfg_addr = pcidn->eeh_pe_config_addr;
-	buid = pcidn->phb->buid;
+	edev = pci_dev_to_eeh_dev(dev);
+	cfg_addr = edev->config_addr;
+	if (edev->pe_config_addr)
+		cfg_addr = edev->pe_config_addr;
+	buid = edev->phb->buid;
 
 	do {
 		/* extra outputs are LIOBN and dma-addr (hi, lo) */
-- 
1.7.5.4

^ permalink raw reply related

* [PATCH 3/3] powerpc/eeh: Retrieve PHB from global list
From: Gavin Shan @ 2012-03-21  7:30 UTC (permalink / raw)
  To: linuxppc-dev, benh; +Cc: sfr, shangw
In-Reply-To: <1332315029-29688-1-git-send-email-shangw@linux.vnet.ibm.com>

Currently, the existing PHBs are retrieved from the FDT (Flat
Device Tree) based on the name of FDT node. Specificly, those
FDT nodes whose names have prefix "pci" are regarded as PHBs.
That's inappropriate because some PCI bridges possibilly have
names leading with "pci". It caused EEH is enabled on same
PCI devices for towice.

The patch fixes the above issue. Besides, the PHBs are expected
to be figured out from FDT before enable EEH on them. Therefore,
it's resonable to retrieve the PHBs from the global linked list
traced by variable "hose_list" insteading poking them from FDT.

For the EEH implementation on pSeries platform, RTAS is critical
because all low-level functions are implemented based on RTAS.
Therefore, we should make sure "/rtas" OF node is available and
ready before to enable EEH core. However, it actually introduced
duplicate since the previous pSeries platform dependent initialization
function already do the check. Besides, we want to make eeh core
platform independent, so RTAS related staff should be removed there.
The patch removes the duplicate check on "/rtas" OF node for eeh
core.

Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
---
 arch/powerpc/platforms/pseries/eeh.c |   19 +++++--------------
 1 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/platforms/pseries/eeh.c
index 8011088..309d38e 100644
--- a/arch/powerpc/platforms/pseries/eeh.c
+++ b/arch/powerpc/platforms/pseries/eeh.c
@@ -984,7 +984,8 @@ int __exit eeh_ops_unregister(const char *name)
  */
 void __init eeh_init(void)
 {
-	struct device_node *phb, *np;
+	struct pci_controller *hose, *tmp;
+	struct device_node *phb;
 	int ret;
 
 	/* call platform initialization function */
@@ -1000,19 +1001,9 @@ void __init eeh_init(void)
 
 	raw_spin_lock_init(&confirm_error_lock);
 
-	np = of_find_node_by_path("/rtas");
-	if (np == NULL)
-		return;
-
-	/* Enable EEH for all adapters.  Note that eeh requires buid's */
-	for (phb = of_find_node_by_name(NULL, "pci"); phb;
-	     phb = of_find_node_by_name(phb, "pci")) {
-		unsigned long buid;
-
-		buid = get_phb_buid(phb);
-		if (buid == 0 || !of_node_to_eeh_dev(phb))
-			continue;
-
+	/* Enable EEH for all adapters */
+	list_for_each_entry_safe(hose, tmp, &hose_list, list_node) {
+		phb = hose->dn;
 		traverse_pci_devices(phb, eeh_early_enable, NULL);
 	}
 
-- 
1.7.5.4

^ permalink raw reply related

* [PATCH 1/3] powerpc/eeh: remove eeh device from OF node
From: Gavin Shan @ 2012-03-21  7:30 UTC (permalink / raw)
  To: linuxppc-dev, benh; +Cc: sfr, shangw

Originally, the PCI sensitive OF node is tracing the eeh device
through struct device_node::edev. However, it was regarded as
bad idea.

The patch removes struct device_node::edev and uses PCI_DN to
trace the corresponding eeh device according to BenH's comments.

Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
---
 arch/powerpc/include/asm/pci-bridge.h    |    8 ++++++++
 arch/powerpc/platforms/pseries/eeh_dev.c |    2 +-
 include/linux/of.h                       |   10 ----------
 3 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index 5d48765..21f99ae 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -155,6 +155,7 @@ struct pci_dn {
 
 	struct	pci_dev *pcidev;	/* back-pointer to the pci device */
 #ifdef CONFIG_EEH
+	struct eeh_dev *edev;		/* eeh device */
 	int	class_code;		/* pci device class */
 	int	eeh_mode;		/* See eeh.h for possible EEH_MODEs */
 	int	eeh_config_addr;
@@ -185,6 +186,13 @@ static inline int pci_device_from_OF_node(struct device_node *np,
 	return 0;
 }
 
+#if defined(CONFIG_EEH)
+static inline struct eeh_dev *of_node_to_eeh_dev(struct device_node *dn)
+{
+	return PCI_DN(dn)->edev;
+}
+#endif
+
 /** Find the bus corresponding to the indicated device node */
 extern struct pci_bus *pcibios_find_pci_bus(struct device_node *dn);
 
diff --git a/arch/powerpc/platforms/pseries/eeh_dev.c b/arch/powerpc/platforms/pseries/eeh_dev.c
index f3aed7d..c4507d0 100644
--- a/arch/powerpc/platforms/pseries/eeh_dev.c
+++ b/arch/powerpc/platforms/pseries/eeh_dev.c
@@ -62,7 +62,7 @@ void * __devinit eeh_dev_init(struct device_node *dn, void *data)
 	}
 
 	/* Associate EEH device with OF node */
-	dn->edev  = edev;
+	PCI_DN(dn)->edev = edev;
 	edev->dn  = dn;
 	edev->phb = phb;
 
diff --git a/include/linux/of.h b/include/linux/of.h
index bdb1c07..92cf6ad 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -58,9 +58,6 @@ struct device_node {
 	struct	kref kref;
 	unsigned long _flags;
 	void	*data;
-#if defined(CONFIG_EEH)
-	struct eeh_dev *edev;
-#endif
 #if defined(CONFIG_SPARC)
 	char	*path_component_name;
 	unsigned int unique_id;
@@ -75,13 +72,6 @@ struct of_phandle_args {
 	uint32_t args[MAX_PHANDLE_ARGS];
 };
 
-#if defined(CONFIG_EEH)
-static inline struct eeh_dev *of_node_to_eeh_dev(struct device_node *dn)
-{
-	return dn->edev;
-}
-#endif
-
 #if defined(CONFIG_SPARC) || !defined(CONFIG_OF)
 /* Dummy ref counting routines - to be implemented later */
 static inline struct device_node *of_node_get(struct device_node *node)
-- 
1.7.5.4

^ permalink raw reply related

* [git pull] Please pull powerpc.git next branch
From: Benjamin Herrenschmidt @ 2012-03-22  0:46 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: linuxppc-dev list, Andrew Morton, Russell King, Linux Kernel list

Hi Linus !

Here's the powerpc batch for this merge window. It is going to be a bit
more nasty than usual as in touching things outside of arch/powerpc
mostly due to the big iSeriesectomy :-) We finally got rid of the bugger
(legacy iSeries support) which was a PITA to maintain and that nobody
really used anymore.

Here are some of the highlights:

 - Legacy iSeries is gone. Thanks Stephen ! There's still some bits and
pieces remaining if you do a grep -ir series arch/powerpc but they are
harmless and will be removed in the next few weeks hopefully.

 - The 'fadump' functionality (Firmware Assisted Dump) replaces the
previous (equivalent) "pHyp assisted dump"... it's a rewrite of a
mechanism to get the hypervisor to do crash dumps on pSeries, the new
implementation hopefully being much more reliable. Thanks Mahesh
Salgaonkar.

 - The "EEH" code (pSeries PCI error handling & recovery) got a big
spring cleaning, motivated by the need to be able to implement a new
backend for it on top of some new different type of firwmare. The work
isn't complete yet, but a good chunk of the cleanups is there. Note that
this adds a field to struct device_node which is not very nice and which
Grant objects to. I will have a patch soon that moves that to a powerpc
private data structure (hopefully before rc1) and we'll improve things
further later on (hopefully getting rid of the need for that pointer
completely). Thanks Gavin Shan.

 - I dug into our exception & interrupt handling code to improve the way
we do lazy interrupt handling (and make it work properly with "edge"
triggered interrupt sources), and while at it found & fixed a wagon of
issues in those areas, including adding support for page fault retry &
fatal signals on page faults.

 - Your usual random batch of small fixes & updates, including a bunch
of new embedded boards, both Freescale and APM based ones, etc...

Cheers,
Ben.

The following changes since commit 203738e548cefc3fc3c2f73a9063176c9f3583d5:

  Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net (2012-02-26 12:47:17 -0800)

are available in the git repository at:


  git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc.git next

for you to fetch changes up to dfbc2d75c1bd47c3186fa91f1655ea2f3825b0ec:

  powerpc/ps3: Do not adjust the wrapper load address (2012-03-21 11:16:13 +1100)

----------------------------------------------------------------
Akinobu Mita (1):
      powerpc/pmac: Use string library in nvram code

Andrea Gelmini (1):
      Documentation/powerpc/mpc52xx.txt: Checkpatch cleanup

Anton Blanchard (2):
      atomic: Allow atomic_inc_not_zero to be overridden
      powerpc/atomic: Implement atomic*_inc_not_zero

Benjamin Herrenschmidt (21):
      Merge remote-tracking branch 'origin/master' into next
      powerpc/mpic: Fix allocation of reverse-map for multi-ISU mpics
      powerpc: Remove legacy iSeries bits from assembly files
      powerpc: Use the same interrupt prolog for perfmon as other interrupts
      powerpc: Rework runlatch code
      powerpc: Improve 64-bit syscall entry/exit
      powerpc: Improve behaviour of irq tracing on 64-bit exception entry
      powerpc: Call do_page_fault() with interrupts off
      powerpc: Disable interrupts in 64-bit kernel FP and vector faults
      powerpc: Add support for page fault retry and fatal signals
      powerpc/xmon: Add display of soft & hard irq states
      powerpc: Fix register clobbering when accumulating stolen time
      powerpc: Fix 64-bit BookE FP unavailable exceptions
      powerpc: Replace mfmsr instructions with load from PACA kernel_msr field
      powerpc: Rework lazy-interrupt handling
      Merge branch 'eeh' into next
      powerpc/hvc_udbg: Don't crash when udbg_putc is NULL
      powerpc: Fix power4/970 idle code regression with lockdep
      Merge remote-tracking branch 'jwb/next' into next
      Merge remote-tracking branch 'kumar/next' into next
      powerpc/spufs: Fix double unlocks

Claudiu Manoil (2):
      powerpc/85xx: Fix compiler error with THIS_MODULE and related
      powerpc/85xx: Add missing config option for CACHE SRAM code

Danny Kukawka (2):
      arch/powerpc/kvm/book3s_hv.c: included linux/sched.h twice
      arch/powerpc/platforms/powernv/setup.c: included asm/xics.h twice

Diana CRACIUN (1):
      powerpc/fsl: Added aliased MSIIR register address to MSI node in dts

Gavin Shan (21):
      powerpc/eeh: Cleanup comments in the EEH core
      powerpc/eeh: Cleanup function names in the EEH core
      powerpc/eeh: Platform dependent EEH operations
      powerpc/eeh: pseries platform EEH initialization
      powerpc/eeh: pseries platform EEH operations
      powerpc/eeh: pseries platform EEH PE address retrieval
      powerpc/eeh: pseries platform PE state retrieval
      powerpc/eeh: pseries platform EEH wait PE state
      powerpc/eeh: pseries platform EEH reset PE
      powerpc/eeh: pseries platform EEH error log retrieval
      powerpc/eeh: pseries platform EEH configure bridge
      powerpc/pseries: Cleanup comments in EEH aux components
      powerpc/eeh: Cleanup function names in EEH aux components
      powerpc/eeh: Introduce EEH device
      powerpc/eeh: Replace pci_dn with eeh_dev for EEH sysfs
      powerpc/eeh: Replace pci_dn with eeh_dev for EEH address cache
      powerpc/eeh: Replace pci_dn with eeh_dev for EEH core
      powerpc/eeh: Replace pci_dn with eeh_dev for EEH aux components
      powerpc/eeh: Replace pci_dn with eeh_dev for EEH on pSeries
      powerpc/eeh: Introduce struct eeh_stats for EEH
      powerpc/eeh: pseries platform config space access in EEH

Grant Likely (2):
      powerpc: Make SPARSE_IRQ required
      powerpc/5200: convert mpc5200 to use of_platform_populate()

Gustavo Zacarias (1):
      powerpc/85xx: fix typo in p1010rdb.dtsi

Heiko Schocher (3):
      powerpc/mpc5200: update mpc5200_defconfig to fit for charon board
      powerpc/mpc52xx: add a4m072 board support
      powerpc/mpc5200: add options to mpc5200_defconfig

Ira Snyder (2):
      carma-fpga: fix lockdep warning
      carma-fpga: fix race between data dumping and DMA callback

Jerry Huang (2):
      powerpc/85xx: add P1020MBG-PC platform support
      powerpc/85xx: add P1020UTM-PC platform support

Jia Hongtao (3):
      powerpc/85xx: Clean up partition nodes in dts for MPC8572DS
      powerpc: add support for MPIC message register API
      powerpc: document the FSL MPIC message register binding

Jimi Xenidis (1):
      powerpc/icswx: Fix race condition with IPI setting ACOP

Joe Perches (1):
      powerpc: Use vsprintf extention %pf with builtin_return_address

Josh Boyer (1):
      MAINTAINERS: Update PowerPC 4xx tree

Kumar Gala (2):
      powerpc/fsl-booke: Fixup calc_cam_sz to support MMU v2
      powerpc: Add initial e6500 cpu support

Kyle Moffett (6):
      powerpc/mpic: Fix use of "flags" variable in mpic_alloc()
      fsl/mpic: Document and use the "big-endian" device-tree flag
      fsl/mpic: Create and document the "single-cpu-affinity" device-tree flag
      powerpc/mpic: Remove MPIC_BROKEN_FRR_NIRQS and duplicate irq_count
      powerpc/mpic: Add "last-interrupt-source" property to override hardware
      powerpc/mpic: Remove duplicate MPIC_WANTS_RESET flag

Liu Gang (2):
      powerpc/srio: Fix the relocation errors when building with 64bit
      powerpc/srio: Fix the compile errors when building with 64bit

Liu Shuo (2):
      powerpc/fsl_msi: return proper error value when ioremap failed.
      powerpc/dts: fix the compatible string of sec 4.0

Mahesh Salgaonkar (10):
      fadump: Add documentation for firmware-assisted dump.
      fadump: Reserve the memory for firmware assisted dump.
      fadump: Register for firmware assisted dump.
      fadump: Initialize elfcore header and add PT_LOAD program headers.
      fadump: Convert firmware-assisted cpu state dump data into elf notes.
      fadump: Add PT_NOTE program header for vmcoreinfo
      fadump: Introduce cleanup routine to invalidate /proc/vmcore.
      fadump: Invalidate registration and release reserved memory for general use.
      fadump: Invalidate the fadump registration during machine shutdown.
      fadump: Remove the phyp assisted dump code.

Martyn Welch (4):
      powerpc: Add GE FPGA config option
      gpio: Move GE GPIO driver to reside within GPIO subsystem
      powerpc: Move GE PIC drivers
      powerpc/85xx: Board support for GE IMP3A

Masanari Iida (1):
      macintosh: Fix typo in mediabay.c

Matt Fleming (1):
      powerpc: Use set_current_blocked() and block_sigmask()

Michael Ellerman (1):
      powerpc/perf: Move perf core & PMU code into a subdirectory

Nishanth Aravamudan (1):
      powerpc/prom: Remove limit on maximum size of properties

Paul Gortmaker (2):
      powerpc/85xx: fix Kconfig warning about missing 8250 dependency
      powerpc/83xx: mpc836x - fix failed phy detection for ucc ethernet on MDS

Prabhakar Kushwaha (1):
      NAND Machine support for Integrated Flash Controller

Ramneek Mehresh (1):
      powerpc/85xx: Add usb controller version info

Sebastian Andrzej Siewior (2):
      powerpc/85xx: p2020rdb - move the NAND address.
      powerpc/85xx: p2020rdb & p1010rdb - lower spi flash freq to 40Mhz

Stephen Rothwell (15):
      powerpc: remove CONFIG_PPC_ISERIES from the architecture Kconfig files
      powerpc: Remove the main legacy iSerie platform code
      net: powerpc: remove the legacy iSeries ethernet driver
      powerpc: remove the legacy iSeries part of ibmvscsi
      tty: powerpc: remove hvc_iseries
      tty: powerpc: remove SERIAL_ICOM dependency on PPC_ISERIES
      driver-core: remove legacy iSeries hack
      powerpc: clean up vio.c
      powerpc: Remove some of the legacy iSeries specific device drivers
      tty/hvc_vio: FW_FEATURE_ISERIES is no longer selectable
      powerpc: Remove FW_FEATURE ISERIES from arch code
      init: Remove CONFIG_PPC_ISERIES
      powerpc: Remove the remaining CONFIG_PPC_ISERIES pieces
      powerpc: Remove the rest of the legacy iSeries include files
      powerpc/ps3: Do not adjust the wrapper load address

Tang Yuantian (2):
      powerpc/85xx: Adds Support for P2020RDB-PC board
      powerpc/85xx: Add p2020rdb-pc dts support

Timur Tabi (4):
      powerpc/85xx: create 32-bit DTS for the P1022DS
      powerpc/85xx: p1022ds: disable the NOR flash node if video is enabled
      powerpc/85xx: p1022ds: enable monitor switching via pixis indirect mode
      powerpc/85xx: allow CONFIG_PHYS_64BIT to be selectable

Vinh Nguyen Huu Tuong (3):
      powerpc/44x: The bug fixed support for APM821xx SoC and Bluestone board
      powerpc/44x: Add support PCI-E for APM821xx SoC and Bluestone board
      powerpc/44x: Add additional device support for APM821xx SoC and Bluestone board

Xie Xiaobo (2):
      powerpc/85xx: Add some DTS nodes and attributes for mpc8536ds
      powerpc/85xx: Add magic-packet properties for etsec

Xu Jiucheng (2):
      powerpc/85xx: Added dts for P1021RDB-PC board
      powerpc/85xx: Added P1021RDB-PC Platform support

Zhao Chenhui (3):
      powerpc/85xx: mpc8548cds - fix alias in mpc8548si-pre.dtsi
      powerpc/85xx: Refactor mpc8548cds device tree
      powerpc/85xx: mpc8548cds - add 36-bit dts

Zhicheng Fan (6):
      powerpc/85xx: Add p1025rdb platform support
      powerpc/85xx: Add dts for p1025rdb board
      powerpc/85xx: Add p1020rdb-pc platform support
      powerpc/85xx: Add dts for p1020rdb-pc board
      powerpc/85xx: Abstract common define of signal multiplex control for qe
      powerpc/85xx: Add Quicc Engine support for p1025rdb

chenhui zhao (5):
      powerpc/85xx: l2sram - Add compatible entry for mpc8548 L2 controller
      powerpc/85xx: mpc85xxcds - Fix PCI I/O space resource of PCI bridge
      powerpc/85xx: mpc8548cds - Add NOR flash node to dts
      powerpc/85xx: mpc8548cds - Add RapidIO node to dts
      powerpc/85xx: mpc8548cds - Add FPGA node to dts

 .../devicetree/bindings/powerpc/fsl/mpic-msgr.txt  |   63 +
 .../devicetree/bindings/powerpc/fsl/mpic.txt       |   22 +-
 .../devicetree/bindings/powerpc/fsl/msi-pic.txt    |    6 +-
 Documentation/powerpc/firmware-assisted-dump.txt   |  270 +++
 Documentation/powerpc/mpc52xx.txt                  |   12 +-
 Documentation/powerpc/phyp-assisted-dump.txt       |  127 --
 MAINTAINERS                                        |    2 +-
 arch/powerpc/Kconfig                               |   18 +-
 arch/powerpc/Kconfig.debug                         |    7 -
 arch/powerpc/Makefile                              |    1 +
 arch/powerpc/boot/Makefile                         |   11 +-
 arch/powerpc/boot/dts/a4m072.dts                   |  168 ++
 arch/powerpc/boot/dts/bluestone.dts                |  127 ++-
 arch/powerpc/boot/dts/fsl/mpc8536si-post.dtsi      |    4 +-
 arch/powerpc/boot/dts/fsl/mpc8548si-post.dtsi      |   16 +
 arch/powerpc/boot/dts/fsl/mpc8548si-pre.dtsi       |    4 +-
 arch/powerpc/boot/dts/fsl/p1010si-post.dtsi        |    3 +
 arch/powerpc/boot/dts/fsl/p1020si-post.dtsi        |    6 +
 arch/powerpc/boot/dts/fsl/p1021si-post.dtsi        |    7 +
 arch/powerpc/boot/dts/fsl/p1022si-post.dtsi        |   12 +-
 arch/powerpc/boot/dts/fsl/p1023si-post.dtsi        |    3 +
 arch/powerpc/boot/dts/fsl/p2020si-post.dtsi        |    3 +
 arch/powerpc/boot/dts/fsl/p2041si-post.dtsi        |    2 +
 arch/powerpc/boot/dts/fsl/p3041si-post.dtsi        |    2 +
 arch/powerpc/boot/dts/fsl/p3060si-post.dtsi        |    6 +
 arch/powerpc/boot/dts/fsl/p5020si-post.dtsi        |    2 +
 arch/powerpc/boot/dts/fsl/pq3-etsec1-0.dtsi        |    3 +-
 arch/powerpc/boot/dts/fsl/pq3-etsec1-1.dtsi        |    3 +-
 arch/powerpc/boot/dts/fsl/pq3-etsec1-2.dtsi        |    3 +-
 arch/powerpc/boot/dts/fsl/pq3-etsec1-3.dtsi        |    3 +-
 arch/powerpc/boot/dts/fsl/pq3-mpic.dtsi            |    3 +
 arch/powerpc/boot/dts/fsl/pq3-sec4.4-0.dtsi        |   10 +-
 arch/powerpc/boot/dts/fsl/qoriq-mpic.dtsi          |    6 +-
 arch/powerpc/boot/dts/ge_imp3a.dts                 |  255 +++
 arch/powerpc/boot/dts/mpc836x_mds.dts              |    4 +
 arch/powerpc/boot/dts/mpc8536ds.dts                |    6 +-
 arch/powerpc/boot/dts/mpc8536ds.dtsi               |   93 ++
 arch/powerpc/boot/dts/mpc8536ds_36b.dts            |    8 +-
 arch/powerpc/boot/dts/mpc8548cds.dts               |  306 ----
 arch/powerpc/boot/dts/mpc8548cds.dtsi              |  306 ++++
 arch/powerpc/boot/dts/mpc8548cds_32b.dts           |   86 +
 arch/powerpc/boot/dts/mpc8548cds_36b.dts           |   86 +
 arch/powerpc/boot/dts/mpc8572ds.dtsi               |   50 +-
 arch/powerpc/boot/dts/p1010rdb.dtsi                |    4 +-
 arch/powerpc/boot/dts/p1020rdb-pc.dtsi             |  247 +++
 arch/powerpc/boot/dts/p1020rdb-pc_32b.dts          |   90 +
 arch/powerpc/boot/dts/p1020rdb-pc_36b.dts          |   90 +
 arch/powerpc/boot/dts/p1020rdb-pc_camp_core0.dts   |   64 +
 arch/powerpc/boot/dts/p1020rdb-pc_camp_core1.dts   |  142 ++
 arch/powerpc/boot/dts/p1021rdb.dts                 |   96 ++
 arch/powerpc/boot/dts/p1021rdb.dtsi                |  236 +++
 arch/powerpc/boot/dts/p1021rdb_36b.dts             |   96 ++
 arch/powerpc/boot/dts/p1022ds.dts                  |  274 ----
 arch/powerpc/boot/dts/p1022ds.dtsi                 |  234 +++
 arch/powerpc/boot/dts/p1022ds_32b.dts              |  103 ++
 arch/powerpc/boot/dts/p1022ds_36b.dts              |  103 ++
 arch/powerpc/boot/dts/p1025rdb.dtsi                |  286 ++++
 arch/powerpc/boot/dts/p1025rdb_32b.dts             |  135 ++
 arch/powerpc/boot/dts/p1025rdb_36b.dts             |   88 +
 arch/powerpc/boot/dts/p2020rdb-pc.dtsi             |  241 +++
 arch/powerpc/boot/dts/p2020rdb-pc_32b.dts          |   96 ++
 arch/powerpc/boot/dts/p2020rdb-pc_36b.dts          |   96 ++
 arch/powerpc/boot/dts/p2020rdb.dts                 |    4 +-
 arch/powerpc/boot/wrapper                          |   22 +-
 arch/powerpc/configs/85xx/ge_imp3a_defconfig       |  257 +++
 arch/powerpc/configs/86xx/gef_ppc9a_defconfig      |    1 +
 arch/powerpc/configs/86xx/gef_sbc310_defconfig     |    1 +
 arch/powerpc/configs/86xx/gef_sbc610_defconfig     |    2 +
 arch/powerpc/configs/iseries_defconfig             |  236 ---
 arch/powerpc/configs/mpc5200_defconfig             |   27 +-
 arch/powerpc/configs/mpc85xx_defconfig             |    1 +
 arch/powerpc/configs/mpc85xx_smp_defconfig         |    1 +
 arch/powerpc/include/asm/abs_addr.h                |   21 +-
 arch/powerpc/include/asm/atomic.h                  |   59 +-
 arch/powerpc/include/asm/cputable.h                |   12 +-
 arch/powerpc/include/asm/device.h                  |    3 +
 arch/powerpc/include/asm/dma.h                     |    4 -
 arch/powerpc/include/asm/eeh.h                     |  134 ++-
 arch/powerpc/include/asm/eeh_event.h               |   33 +-
 arch/powerpc/include/asm/exception-64s.h           |  113 +-
 arch/powerpc/include/asm/fadump.h                  |  218 +++
 arch/powerpc/include/asm/firmware.h                |    9 -
 arch/powerpc/include/asm/fsl_guts.h                |    6 +-
 arch/powerpc/include/asm/hw_irq.h                  |   63 +-
 arch/powerpc/include/asm/irqflags.h                |   37 +-
 arch/powerpc/include/asm/iseries/alpaca.h          |   31 -
 arch/powerpc/include/asm/iseries/hv_call.h         |  111 --
 arch/powerpc/include/asm/iseries/hv_call_event.h   |  201 ---
 arch/powerpc/include/asm/iseries/hv_call_sc.h      |   50 -
 arch/powerpc/include/asm/iseries/hv_call_xm.h      |   61 -
 arch/powerpc/include/asm/iseries/hv_lp_config.h    |  128 --
 arch/powerpc/include/asm/iseries/hv_lp_event.h     |  162 --
 arch/powerpc/include/asm/iseries/hv_types.h        |  112 --
 arch/powerpc/include/asm/iseries/iommu.h           |   37 -
 arch/powerpc/include/asm/iseries/it_lp_queue.h     |   78 -
 arch/powerpc/include/asm/iseries/lpar_map.h        |   85 -
 arch/powerpc/include/asm/iseries/mf.h              |   51 -
 arch/powerpc/include/asm/iseries/vio.h             |  265 ---
 arch/powerpc/include/asm/lppaca.h                  |    8 -
 arch/powerpc/include/asm/mpic.h                    |    9 +-
 arch/powerpc/include/asm/mpic_msgr.h               |  132 ++
 arch/powerpc/include/asm/paca.h                    |    2 +-
 arch/powerpc/include/asm/phyp_dump.h               |   47 -
 arch/powerpc/include/asm/ppc-pci.h                 |   89 +-
 arch/powerpc/include/asm/ppc_asm.h                 |    2 +
 arch/powerpc/include/asm/reg.h                     |   22 +-
 arch/powerpc/include/asm/reg_booke.h               |    1 +
 arch/powerpc/include/asm/spinlock.h                |    5 +-
 arch/powerpc/include/asm/system.h                  |   38 +
 arch/powerpc/include/asm/thread_info.h             |    9 +-
 arch/powerpc/include/asm/time.h                    |   15 -
 arch/powerpc/kernel/Makefile                       |   10 +-
 arch/powerpc/kernel/asm-offsets.c                  |   16 +-
 arch/powerpc/kernel/cputable.c                     |   20 +-
 arch/powerpc/kernel/dbell.c                        |    2 +
 arch/powerpc/kernel/entry_64.S                     |  250 ++--
 arch/powerpc/kernel/exceptions-64e.S               |  236 ++-
 arch/powerpc/kernel/exceptions-64s.S               |  314 +---
 arch/powerpc/kernel/fadump.c                       | 1315 +++++++++++++++
 arch/powerpc/kernel/head_32.S                      |    4 +-
 arch/powerpc/kernel/head_40x.S                     |    4 +-
 arch/powerpc/kernel/head_64.S                      |   62 +-
 arch/powerpc/kernel/head_8xx.S                     |    4 +-
 arch/powerpc/kernel/head_booke.h                   |    4 +-
 arch/powerpc/kernel/head_fsl_booke.S               |    2 +-
 arch/powerpc/kernel/idle.c                         |    6 +-
 arch/powerpc/kernel/idle_book3e.S                  |   25 +-
 arch/powerpc/kernel/idle_power4.S                  |   24 +-
 arch/powerpc/kernel/idle_power7.S                  |   23 +-
 arch/powerpc/kernel/iommu.c                        |    8 +-
 arch/powerpc/kernel/irq.c                          |  212 ++-
 arch/powerpc/kernel/isa-bridge.c                   |    3 -
 arch/powerpc/kernel/lparcfg.c                      |  108 +--
 arch/powerpc/kernel/misc.S                         |    1 -
 arch/powerpc/kernel/of_platform.c                  |    6 +-
 arch/powerpc/kernel/paca.c                         |   12 +-
 arch/powerpc/kernel/pci-common.c                   |   15 -
 arch/powerpc/kernel/process.c                      |   27 +-
 arch/powerpc/kernel/prom.c                         |   98 +-
 arch/powerpc/kernel/prom_init.c                    |   15 -
 arch/powerpc/kernel/rtas_pci.c                     |    3 +
 arch/powerpc/kernel/setup-common.c                 |   14 +
 arch/powerpc/kernel/signal.c                       |   13 +-
 arch/powerpc/kernel/signal_32.c                    |   11 +-
 arch/powerpc/kernel/sysfs.c                        |    7 +-
 arch/powerpc/kernel/time.c                         |  116 +--
 arch/powerpc/kernel/traps.c                        |    6 +
 arch/powerpc/kernel/vio.c                          |   18 +-
 arch/powerpc/kernel/vmlinux.lds.S                  |    5 -
 arch/powerpc/kvm/book3s_hv.c                       |    1 -
 arch/powerpc/lib/locks.c                           |   24 +-
 arch/powerpc/mm/fault.c                            |  181 ++-
 arch/powerpc/mm/fsl_booke_mmu.c                    |   19 +-
 arch/powerpc/mm/hash_utils_64.c                    |   20 +-
 arch/powerpc/mm/icswx.c                            |   23 +-
 arch/powerpc/mm/icswx.h                            |    6 +
 arch/powerpc/mm/pgtable_32.c                       |    2 +-
 arch/powerpc/mm/slb.c                              |    6 -
 arch/powerpc/mm/slb_low.S                          |   16 -
 arch/powerpc/mm/stab.c                             |    9 -
 arch/powerpc/oprofile/common.c                     |    3 -
 arch/powerpc/perf/Makefile                         |   14 +
 .../{kernel/perf_callchain.c => perf/callchain.c}  |    2 +-
 .../{kernel/perf_event.c => perf/core-book3s.c}    |    0
 .../perf_event_fsl_emb.c => perf/core-fsl-emb.c}   |    0
 arch/powerpc/{kernel => perf}/e500-pmu.c           |    0
 arch/powerpc/{kernel => perf}/mpc7450-pmu.c        |    0
 arch/powerpc/{kernel => perf}/power4-pmu.c         |    0
 arch/powerpc/{kernel => perf}/power5+-pmu.c        |    0
 arch/powerpc/{kernel => perf}/power5-pmu.c         |    0
 arch/powerpc/{kernel => perf}/power6-pmu.c         |    2 +-
 arch/powerpc/{kernel => perf}/power7-pmu.c         |    0
 arch/powerpc/{kernel => perf}/ppc970-pmu.c         |    2 +-
 arch/powerpc/platforms/44x/Kconfig                 |    1 +
 arch/powerpc/platforms/44x/currituck.c             |    2 +-
 arch/powerpc/platforms/44x/iss4xx.c                |    3 +-
 arch/powerpc/platforms/44x/ppc44x_simple.c         |    2 +-
 arch/powerpc/platforms/52xx/mpc5200_simple.c       |    1 +
 arch/powerpc/platforms/52xx/mpc52xx_common.c       |   10 +-
 arch/powerpc/platforms/85xx/Kconfig                |   27 +-
 arch/powerpc/platforms/85xx/Makefile               |    1 +
 arch/powerpc/platforms/85xx/corenet_ds.c           |    4 +-
 arch/powerpc/platforms/85xx/ge_imp3a.c             |  246 +++
 arch/powerpc/platforms/85xx/ksi8560.c              |    3 +-
 arch/powerpc/platforms/85xx/mpc8536_ds.c           |    4 +-
 arch/powerpc/platforms/85xx/mpc85xx_ads.c          |    3 +-
 arch/powerpc/platforms/85xx/mpc85xx_cds.c          |   84 +-
 arch/powerpc/platforms/85xx/mpc85xx_ds.c           |    6 +-
 arch/powerpc/platforms/85xx/mpc85xx_mds.c          |   40 +-
 arch/powerpc/platforms/85xx/mpc85xx_rdb.c          |  222 +++-
 arch/powerpc/platforms/85xx/p1010rdb.c             |    5 +-
 arch/powerpc/platforms/85xx/p1022_ds.c             |  207 +++-
 arch/powerpc/platforms/85xx/p1023_rds.c            |    5 +-
 arch/powerpc/platforms/85xx/sbc8548.c              |    3 +-
 arch/powerpc/platforms/85xx/sbc8560.c              |    3 +-
 arch/powerpc/platforms/85xx/socrates.c             |    3 +-
 arch/powerpc/platforms/85xx/stx_gp3.c              |    3 +-
 arch/powerpc/platforms/85xx/tqm85xx.c              |    2 +-
 arch/powerpc/platforms/85xx/xes_mpc85xx.c          |    4 +-
 arch/powerpc/platforms/86xx/Kconfig                |    3 +
 arch/powerpc/platforms/86xx/Makefile               |    7 +-
 arch/powerpc/platforms/86xx/gef_ppc9a.c            |    2 +-
 arch/powerpc/platforms/86xx/gef_sbc310.c           |    2 +-
 arch/powerpc/platforms/86xx/gef_sbc610.c           |    2 +-
 arch/powerpc/platforms/86xx/pic.c                  |    5 +-
 arch/powerpc/platforms/Kconfig                     |   11 +-
 arch/powerpc/platforms/Makefile                    |    1 -
 arch/powerpc/platforms/cell/setup.c                |    3 +-
 arch/powerpc/platforms/cell/spufs/inode.c          |    1 +
 arch/powerpc/platforms/cell/spufs/syscalls.c       |    2 -
 arch/powerpc/platforms/chrp/setup.c                |    3 +-
 arch/powerpc/platforms/embedded6xx/holly.c         |    6 +-
 arch/powerpc/platforms/embedded6xx/linkstation.c   |    3 +-
 arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c  |    6 +-
 arch/powerpc/platforms/embedded6xx/storcenter.c    |    3 +-
 arch/powerpc/platforms/iseries/Kconfig             |   38 -
 arch/powerpc/platforms/iseries/Makefile            |    9 -
 arch/powerpc/platforms/iseries/call_hpt.h          |  102 --
 arch/powerpc/platforms/iseries/call_pci.h          |  309 ----
 arch/powerpc/platforms/iseries/call_sm.h           |   37 -
 arch/powerpc/platforms/iseries/dt.c                |  643 --------
 arch/powerpc/platforms/iseries/exception.S         |  311 ----
 arch/powerpc/platforms/iseries/exception.h         |   58 -
 arch/powerpc/platforms/iseries/htab.c              |  257 ---
 arch/powerpc/platforms/iseries/hvcall.S            |   94 --
 arch/powerpc/platforms/iseries/hvlog.c             |   35 -
 arch/powerpc/platforms/iseries/hvlpconfig.c        |   39 -
 arch/powerpc/platforms/iseries/iommu.c             |  260 ---
 arch/powerpc/platforms/iseries/ipl_parms.h         |   68 -
 arch/powerpc/platforms/iseries/irq.c               |  400 -----
 arch/powerpc/platforms/iseries/irq.h               |   13 -
 arch/powerpc/platforms/iseries/it_exp_vpd_panel.h  |   51 -
 arch/powerpc/platforms/iseries/it_lp_naca.h        |   80 -
 arch/powerpc/platforms/iseries/ksyms.c             |   21 -
 arch/powerpc/platforms/iseries/lpardata.c          |  318 ----
 arch/powerpc/platforms/iseries/lpevents.c          |  341 ----
 arch/powerpc/platforms/iseries/main_store.h        |  165 --
 arch/powerpc/platforms/iseries/mf.c                | 1275 ---------------
 arch/powerpc/platforms/iseries/misc.S              |   26 -
 arch/powerpc/platforms/iseries/naca.h              |   24 -
 arch/powerpc/platforms/iseries/pci.c               |  919 -----------
 arch/powerpc/platforms/iseries/pci.h               |   58 -
 arch/powerpc/platforms/iseries/proc.c              |  120 --
 arch/powerpc/platforms/iseries/processor_vpd.h     |   85 -
 arch/powerpc/platforms/iseries/release_data.h      |   63 -
 arch/powerpc/platforms/iseries/setup.c             |  722 ---------
 arch/powerpc/platforms/iseries/setup.h             |   27 -
 arch/powerpc/platforms/iseries/smp.c               |   88 -
 arch/powerpc/platforms/iseries/spcomm_area.h       |   34 -
 arch/powerpc/platforms/iseries/vio.c               |  556 -------
 arch/powerpc/platforms/iseries/viopath.c           |  677 --------
 arch/powerpc/platforms/iseries/vpd_areas.h         |   88 -
 arch/powerpc/platforms/maple/setup.c               |    2 +-
 arch/powerpc/platforms/pasemi/setup.c              |    2 +-
 arch/powerpc/platforms/powermac/nvram.c            |   42 +-
 arch/powerpc/platforms/powermac/pic.c              |    1 -
 arch/powerpc/platforms/powernv/pci.c               |    1 +
 arch/powerpc/platforms/powernv/setup.c             |    1 -
 arch/powerpc/platforms/pseries/Kconfig             |    2 +-
 arch/powerpc/platforms/pseries/Makefile            |    4 +-
 arch/powerpc/platforms/pseries/eeh.c               | 1044 ++++++-------
 arch/powerpc/platforms/pseries/eeh_cache.c         |   44 +-
 arch/powerpc/platforms/pseries/eeh_dev.c           |  102 ++
 arch/powerpc/platforms/pseries/eeh_driver.c        |  213 ++--
 arch/powerpc/platforms/pseries/eeh_event.c         |   55 +-
 arch/powerpc/platforms/pseries/eeh_pseries.c       |  565 +++++++
 arch/powerpc/platforms/pseries/eeh_sysfs.c         |   25 +-
 arch/powerpc/platforms/pseries/lpar.c              |    1 +
 arch/powerpc/platforms/pseries/msi.c               |    2 +-
 arch/powerpc/platforms/pseries/pci_dlpar.c         |    3 +
 arch/powerpc/platforms/pseries/phyp_dump.c         |  513 ------
 arch/powerpc/platforms/pseries/processor_idle.c    |   18 +-
 arch/powerpc/platforms/pseries/setup.c             |   12 +-
 arch/powerpc/sysdev/Kconfig                        |    4 +
 arch/powerpc/sysdev/Makefile                       |    4 +
 arch/powerpc/sysdev/fsl_85xx_cache_sram.c          |    1 +
 arch/powerpc/sysdev/fsl_85xx_l2ctlr.c              |    4 +
 arch/powerpc/sysdev/fsl_msi.c                      |    1 +
 arch/powerpc/sysdev/fsl_rio.c                      |    4 +-
 arch/powerpc/sysdev/fsl_rmu.c                      |   42 +-
 arch/powerpc/sysdev/ge/Makefile                    |    1 +
 .../86xx/gef_pic.c => sysdev/ge/ge_pic.c}          |    2 +-
 .../86xx/gef_pic.h => sysdev/ge/ge_pic.h}          |    0
 arch/powerpc/sysdev/mpic.c                         |  107 +-
 arch/powerpc/sysdev/mpic_msgr.c                    |  282 ++++
 arch/powerpc/sysdev/mpic_msi.c                     |    4 +-
 arch/powerpc/sysdev/ppc4xx_pci.c                   |   70 +
 arch/powerpc/xmon/xmon.c                           |   33 +-
 drivers/base/driver.c                              |   30 -
 drivers/block/viodasd.c                            |  809 ---------
 drivers/cdrom/viocd.c                              |  739 ---------
 drivers/char/viotape.c                             | 1041 ------------
 drivers/gpio/Kconfig                               |   11 +
 drivers/gpio/Makefile                              |    1 +
 .../86xx/gef_gpio.c => drivers/gpio/gpio-ge.c      |   30 +-
 drivers/macintosh/mediabay.c                       |    2 +-
 drivers/misc/carma/carma-fpga.c                    |  114 +-
 drivers/mtd/nand/Kconfig                           |   10 +
 drivers/mtd/nand/Makefile                          |    1 +
 drivers/mtd/nand/fsl_ifc_nand.c                    | 1072 ++++++++++++
 drivers/net/ethernet/ibm/Kconfig                   |    4 -
 drivers/net/ethernet/ibm/Makefile                  |    1 -
 drivers/net/ethernet/ibm/iseries_veth.c            | 1710 --------------------
 drivers/scsi/Kconfig                               |    3 +-
 drivers/scsi/ibmvscsi/Makefile                     |    1 -
 drivers/scsi/ibmvscsi/ibmvscsi.c                   |   12 +-
 drivers/scsi/ibmvscsi/ibmvscsi.h                   |    1 -
 drivers/scsi/ibmvscsi/iseries_vscsi.c              |  173 --
 drivers/tty/hvc/Kconfig                            |   14 +-
 drivers/tty/hvc/Makefile                           |    1 -
 drivers/tty/hvc/hvc_iseries.c                      |  599 -------
 drivers/tty/hvc/hvc_udbg.c                         |    8 +-
 drivers/tty/hvc/hvc_vio.c                          |    4 -
 drivers/tty/serial/Kconfig                         |    2 +-
 drivers/watchdog/Kconfig                           |    2 +-
 fs/proc/vmcore.c                                   |   23 +
 include/linux/atomic.h                             |    2 +
 include/linux/device.h                             |    4 -
 include/linux/of.h                                 |   10 +
 include/linux/pci.h                                |    7 +
 init/do_mounts_rd.c                                |    4 +-
 321 files changed, 11235 insertions(+), 19006 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/powerpc/fsl/mpic-msgr.txt
 create mode 100644 Documentation/powerpc/firmware-assisted-dump.txt
 delete mode 100644 Documentation/powerpc/phyp-assisted-dump.txt
 create mode 100644 arch/powerpc/boot/dts/a4m072.dts
 create mode 100644 arch/powerpc/boot/dts/ge_imp3a.dts
 delete mode 100644 arch/powerpc/boot/dts/mpc8548cds.dts
 create mode 100644 arch/powerpc/boot/dts/mpc8548cds.dtsi
 create mode 100644 arch/powerpc/boot/dts/mpc8548cds_32b.dts
 create mode 100644 arch/powerpc/boot/dts/mpc8548cds_36b.dts
 create mode 100644 arch/powerpc/boot/dts/p1020rdb-pc.dtsi
 create mode 100644 arch/powerpc/boot/dts/p1020rdb-pc_32b.dts
 create mode 100644 arch/powerpc/boot/dts/p1020rdb-pc_36b.dts
 create mode 100644 arch/powerpc/boot/dts/p1020rdb-pc_camp_core0.dts
 create mode 100644 arch/powerpc/boot/dts/p1020rdb-pc_camp_core1.dts
 create mode 100644 arch/powerpc/boot/dts/p1021rdb.dts
 create mode 100644 arch/powerpc/boot/dts/p1021rdb.dtsi
 create mode 100644 arch/powerpc/boot/dts/p1021rdb_36b.dts
 delete mode 100644 arch/powerpc/boot/dts/p1022ds.dts
 create mode 100644 arch/powerpc/boot/dts/p1022ds.dtsi
 create mode 100644 arch/powerpc/boot/dts/p1022ds_32b.dts
 create mode 100644 arch/powerpc/boot/dts/p1022ds_36b.dts
 create mode 100644 arch/powerpc/boot/dts/p1025rdb.dtsi
 create mode 100644 arch/powerpc/boot/dts/p1025rdb_32b.dts
 create mode 100644 arch/powerpc/boot/dts/p1025rdb_36b.dts
 create mode 100644 arch/powerpc/boot/dts/p2020rdb-pc.dtsi
 create mode 100644 arch/powerpc/boot/dts/p2020rdb-pc_32b.dts
 create mode 100644 arch/powerpc/boot/dts/p2020rdb-pc_36b.dts
 create mode 100644 arch/powerpc/configs/85xx/ge_imp3a_defconfig
 delete mode 100644 arch/powerpc/configs/iseries_defconfig
 create mode 100644 arch/powerpc/include/asm/fadump.h
 delete mode 100644 arch/powerpc/include/asm/iseries/alpaca.h
 delete mode 100644 arch/powerpc/include/asm/iseries/hv_call.h
 delete mode 100644 arch/powerpc/include/asm/iseries/hv_call_event.h
 delete mode 100644 arch/powerpc/include/asm/iseries/hv_call_sc.h
 delete mode 100644 arch/powerpc/include/asm/iseries/hv_call_xm.h
 delete mode 100644 arch/powerpc/include/asm/iseries/hv_lp_config.h
 delete mode 100644 arch/powerpc/include/asm/iseries/hv_lp_event.h
 delete mode 100644 arch/powerpc/include/asm/iseries/hv_types.h
 delete mode 100644 arch/powerpc/include/asm/iseries/iommu.h
 delete mode 100644 arch/powerpc/include/asm/iseries/it_lp_queue.h
 delete mode 100644 arch/powerpc/include/asm/iseries/lpar_map.h
 delete mode 100644 arch/powerpc/include/asm/iseries/mf.h
 delete mode 100644 arch/powerpc/include/asm/iseries/vio.h
 create mode 100644 arch/powerpc/include/asm/mpic_msgr.h
 delete mode 100644 arch/powerpc/include/asm/phyp_dump.h
 create mode 100644 arch/powerpc/kernel/fadump.c
 create mode 100644 arch/powerpc/perf/Makefile
 rename arch/powerpc/{kernel/perf_callchain.c => perf/callchain.c} (99%)
 rename arch/powerpc/{kernel/perf_event.c => perf/core-book3s.c} (100%)
 rename arch/powerpc/{kernel/perf_event_fsl_emb.c => perf/core-fsl-emb.c} (100%)
 rename arch/powerpc/{kernel => perf}/e500-pmu.c (100%)
 rename arch/powerpc/{kernel => perf}/mpc7450-pmu.c (100%)
 rename arch/powerpc/{kernel => perf}/power4-pmu.c (100%)
 rename arch/powerpc/{kernel => perf}/power5+-pmu.c (100%)
 rename arch/powerpc/{kernel => perf}/power5-pmu.c (100%)
 rename arch/powerpc/{kernel => perf}/power6-pmu.c (99%)
 rename arch/powerpc/{kernel => perf}/power7-pmu.c (100%)
 rename arch/powerpc/{kernel => perf}/ppc970-pmu.c (99%)
 create mode 100644 arch/powerpc/platforms/85xx/ge_imp3a.c
 delete mode 100644 arch/powerpc/platforms/iseries/Kconfig
 delete mode 100644 arch/powerpc/platforms/iseries/Makefile
 delete mode 100644 arch/powerpc/platforms/iseries/call_hpt.h
 delete mode 100644 arch/powerpc/platforms/iseries/call_pci.h
 delete mode 100644 arch/powerpc/platforms/iseries/call_sm.h
 delete mode 100644 arch/powerpc/platforms/iseries/dt.c
 delete mode 100644 arch/powerpc/platforms/iseries/exception.S
 delete mode 100644 arch/powerpc/platforms/iseries/exception.h
 delete mode 100644 arch/powerpc/platforms/iseries/htab.c
 delete mode 100644 arch/powerpc/platforms/iseries/hvcall.S
 delete mode 100644 arch/powerpc/platforms/iseries/hvlog.c
 delete mode 100644 arch/powerpc/platforms/iseries/hvlpconfig.c
 delete mode 100644 arch/powerpc/platforms/iseries/iommu.c
 delete mode 100644 arch/powerpc/platforms/iseries/ipl_parms.h
 delete mode 100644 arch/powerpc/platforms/iseries/irq.c
 delete mode 100644 arch/powerpc/platforms/iseries/irq.h
 delete mode 100644 arch/powerpc/platforms/iseries/it_exp_vpd_panel.h
 delete mode 100644 arch/powerpc/platforms/iseries/it_lp_naca.h
 delete mode 100644 arch/powerpc/platforms/iseries/ksyms.c
 delete mode 100644 arch/powerpc/platforms/iseries/lpardata.c
 delete mode 100644 arch/powerpc/platforms/iseries/lpevents.c
 delete mode 100644 arch/powerpc/platforms/iseries/main_store.h
 delete mode 100644 arch/powerpc/platforms/iseries/mf.c
 delete mode 100644 arch/powerpc/platforms/iseries/misc.S
 delete mode 100644 arch/powerpc/platforms/iseries/naca.h
 delete mode 100644 arch/powerpc/platforms/iseries/pci.c
 delete mode 100644 arch/powerpc/platforms/iseries/pci.h
 delete mode 100644 arch/powerpc/platforms/iseries/proc.c
 delete mode 100644 arch/powerpc/platforms/iseries/processor_vpd.h
 delete mode 100644 arch/powerpc/platforms/iseries/release_data.h
 delete mode 100644 arch/powerpc/platforms/iseries/setup.c
 delete mode 100644 arch/powerpc/platforms/iseries/setup.h
 delete mode 100644 arch/powerpc/platforms/iseries/smp.c
 delete mode 100644 arch/powerpc/platforms/iseries/spcomm_area.h
 delete mode 100644 arch/powerpc/platforms/iseries/vio.c
 delete mode 100644 arch/powerpc/platforms/iseries/viopath.c
 delete mode 100644 arch/powerpc/platforms/iseries/vpd_areas.h
 create mode 100644 arch/powerpc/platforms/pseries/eeh_dev.c
 create mode 100644 arch/powerpc/platforms/pseries/eeh_pseries.c
 delete mode 100644 arch/powerpc/platforms/pseries/phyp_dump.c
 create mode 100644 arch/powerpc/sysdev/ge/Makefile
 rename arch/powerpc/{platforms/86xx/gef_pic.c => sysdev/ge/ge_pic.c} (99%)
 rename arch/powerpc/{platforms/86xx/gef_pic.h => sysdev/ge/ge_pic.h} (100%)
 create mode 100644 arch/powerpc/sysdev/mpic_msgr.c
 delete mode 100644 drivers/block/viodasd.c
 delete mode 100644 drivers/cdrom/viocd.c
 delete mode 100644 drivers/char/viotape.c
 rename arch/powerpc/platforms/86xx/gef_gpio.c => drivers/gpio/gpio-ge.c (83%)
 create mode 100644 drivers/mtd/nand/fsl_ifc_nand.c
 delete mode 100644 drivers/net/ethernet/ibm/iseries_veth.c
 delete mode 100644 drivers/scsi/ibmvscsi/iseries_vscsi.c
 delete mode 100644 drivers/tty/hvc/hvc_iseries.c

^ permalink raw reply

* Re: [PATCH 15/17] powerpc: crypto: sysfs routines and docs for the nx device driver
From: Kent Yoder @ 2012-03-21 22:46 UTC (permalink / raw)
  To: Greg KH; +Cc: rcj, linuxppc-dev, linux-kernel, linux-crypto
In-Reply-To: <20120321221122.GA30748@kroah.com>

Hi Greg,

On Wed, 2012-03-21 at 15:11 -0700, Greg KH wrote:
> On Wed, Mar 21, 2012 at 04:41:20PM -0500, Kent Yoder wrote:
> > These routines add sysfs files supporting the Power7+ in-Nest encryption
> > accelerator driver.
> > 
> > Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
> > ---
> >  Documentation/powerpc/pfo-nx-crypto.txt |   52 ++++++++
> 
> Please put sysfs file information in Documentation/ABI/ where it
> belongs.

  Will do, I see debugfs docs in there too.

> Shouldn't the first just be debugfs files, as no "normal" user will ever
> care about such a thing?
> 
> Actually, why are these sysfs files at all, how about all of this going
> into debugfs?

  Yes, that's fine.  These really are just for checking 'am I really
doing hardware encryption' and debugging any return codes that may come
back from the hcall. The error return is probably more easily dev_err'd
though.

> 
> > +Error Detection
> > +===============
> 
> <snip>
> 
> What can anyone do with any of these files?  What use are they to users?
> 
> > +Device Use
> > +==========
> 
> Again, what does a user care about these items for?
> 
> > +int
> > +nx_sysfs_init(struct device_driver *drv)
> > +{
> > +	int rc;
> > +
> > +	rc = driver_create_file(drv, &driver_attr_aes_ops);
> > +	if (rc)
> > +		goto out;
> 
> <snip>
> 
> Oh, ${DIETY}, no.  Please don't create files one by one, we do have
> functions that do all of this for you automatically, why aren't you
> using them?

  Ok, I'll go look for some debugfs wrappers.

> > +void
> > +nx_sysfs_fini(struct device_driver *drv)
> > +{
> > +	driver_remove_file(drv, &driver_attr_sync_ops);
> > +	driver_remove_file(drv, &driver_attr_aes_bytes);
> > +	driver_remove_file(drv, &driver_attr_aes_ops);
> > +	driver_remove_file(drv, &driver_attr_sha256_bytes);
> > +	driver_remove_file(drv, &driver_attr_sha256_ops);
> > +	driver_remove_file(drv, &driver_attr_sha512_bytes);
> > +	driver_remove_file(drv, &driver_attr_sha512_ops);
> 
> Same here, don't do this, do it all at once.
> 
> > +}
> 
> Who is calling these functions?  Where in the device lifecycle are the
> files being created?  Did you just race userspace with how they are
> created, or are you doing it "properly"?  (hint, odds are, as you are
> trying to manually create and remove these by hand, you aren't doing it
> properly...)

  We're not racing here, other than with cat.  Just so an admin can see
his workload is getting offloaded.

Thanks,
Kent

> thanks,
> 
> greg k-h
> 

^ permalink raw reply

* Re: kilauea compilation breaks with v3.3 kernel and ELDK 4.2
From: Wolfgang Denk @ 2012-03-21 22:34 UTC (permalink / raw)
  To: Tony Breeds; +Cc: linuxppc-dev, Robert Berger
In-Reply-To: <20120321221402.GA18735@thor.bakeyournoodle.com>

Dear Tony,

In message <20120321221402.GA18735@thor.bakeyournoodle.com> you wrote:
> 
> > What puzzles me is that also stuff for boards is being compiled which is
> > not really needed like treeboot-currituck.c even when I configure the
> > kernel for a kilauea board.
> 
> Can you either propvide the config file or the name of the config target
> so I look into why it's enabling the currituck platform.

Robert mentioned it in the Subjct:  he was building for the Kilauea
board, i. e. 40x/kilauea_defconfig 


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
I must follow the people.  Am I not their leader? - Benjamin Disraeli

^ permalink raw reply

* Re: [PATCH 14/17] powerpc: crypto: nx driver code supporting nx encryption
From: Greg KH @ 2012-03-21 22:15 UTC (permalink / raw)
  To: Kent Yoder; +Cc: rcj, linuxppc-dev, linux-kernel, linux-crypto
In-Reply-To: <1332366068.3858.50.camel@key-ThinkPad-W510>

On Wed, Mar 21, 2012 at 04:41:08PM -0500, Kent Yoder wrote:
> +static int nx_register_algs(void)
> +{
> +	int rc = -1;
> +
> +	if (nx_driver.of.flags != NX_OF_FLAG_MASK_READY)
> +		goto out;
> +
> +	memset(&nx_driver.stats, 0, sizeof(struct nx_stats));
> +
> +	rc = nx_sysfs_init(&nx_driver.viodriver.driver);

Ok, that's not bad, you are doing it from the probe() function of your
bus.  As long as the bus got things right on when uevents get sent to
userspace, does it?

> +static struct vio_device_id nx_crypto_driver_ids[] __devinitdata = {
> +	{ "ibm,sym-encryption-v1", "ibm,sym-encryption" },
> +	{ "", "" }
> +};
> +MODULE_DEVICE_TABLE(vio, nx_crypto_driver_ids);
> +
> +/* driver state structure */
> +struct nx_crypto_driver nx_driver = {
> +	.viodriver = {
> +		.id_table = nx_crypto_driver_ids,
> +		.probe = nx_probe,
> +		.remove = nx_remove,
> +		.driver = {
> +			.name  = "nx",
> +			.owner = THIS_MODULE,
> +		},

Really?  vio drivers are supposed to look like this with the .name and
.owner field manually being set in the static initialization of the
driver?  That's sad, and should be fixed, the vio core should do this
type of thing for you.

greg k-h

^ permalink raw reply

* Re: kilauea compilation breaks with v3.3 kernel and ELDK 4.2
From: Tony Breeds @ 2012-03-21 22:14 UTC (permalink / raw)
  To: Robert Berger; +Cc: linuxppc-dev
In-Reply-To: <4F69C553.6070409@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1018 bytes --]

On Wed, Mar 21, 2012 at 02:10:59PM +0200, Robert Berger wrote:
> Hi,
> 
> Up to 3.2.x I was able to compile a mainline kernel for the kilauea
> board, but...
> 
> http://git.denx.de/?p=linux-denx.git;a=commitdiff;h=075bcf5879225d0c2a119c23d8046b890e051e81
> 
> shows, that mfdcrx was introduced in the v3.3 kernel.
> 
> The problem is that for ppc-linux-gcc (GCC) 4.2.2 (which comes with the
> ELDK 4.2) this assembly instruction is not known and the build breaks.

If the instruction is available on your platform but not in your
toolchain we can do something ugly (as we hav in the past) and replace
"mfdrcx" with ".long xxxx".  That will bypass the compiler breakage.
 
> What puzzles me is that also stuff for boards is being compiled which is
> not really needed like treeboot-currituck.c even when I configure the
> kernel for a kilauea board.

Can you either propvide the config file or the name of the config target
so I look into why it's enabling the currituck platform.

Yours Tony

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply

* Re: [PATCH 15/17] powerpc: crypto: sysfs routines and docs for the nx device driver
From: Greg KH @ 2012-03-21 22:11 UTC (permalink / raw)
  To: Kent Yoder; +Cc: rcj, linuxppc-dev, linux-kernel, linux-crypto
In-Reply-To: <1332366080.3858.52.camel@key-ThinkPad-W510>

On Wed, Mar 21, 2012 at 04:41:20PM -0500, Kent Yoder wrote:
> These routines add sysfs files supporting the Power7+ in-Nest encryption
> accelerator driver.
> 
> Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
> ---
>  Documentation/powerpc/pfo-nx-crypto.txt |   52 ++++++++

Please put sysfs file information in Documentation/ABI/ where it
belongs.

>  arch/powerpc/crypto/nx/nx_sysfs.c       |  194 +++++++++++++++++++++++++++++++
>  2 files changed, 246 insertions(+), 0 deletions(-)
>  create mode 100644 Documentation/powerpc/pfo-nx-crypto.txt
>  create mode 100644 arch/powerpc/crypto/nx/nx_sysfs.c
> 
> diff --git a/Documentation/powerpc/pfo-nx-crypto.txt b/Documentation/powerpc/pfo-nx-crypto.txt
> new file mode 100644
> index 0000000..63440d3
> --- /dev/null
> +++ b/Documentation/powerpc/pfo-nx-crypto.txt
> @@ -0,0 +1,52 @@
> +
> +Documentation for the sysfs interfaces provided by the nx-crypto driver, built
> +in arch/powerpc/crypto/nx.
> +
> +The driver provides 2 sets of sysfs files, 1 for confirming that the device is
> +actually being used and 1 for error detection.

Shouldn't the first just be debugfs files, as no "normal" user will ever
care about such a thing?

Actually, why are these sysfs files at all, how about all of this going
into debugfs?


> +Error Detection
> +===============

<snip>

What can anyone do with any of these files?  What use are they to users?

> +Device Use
> +==========

Again, what does a user care about these items for?

> +int
> +nx_sysfs_init(struct device_driver *drv)
> +{
> +	int rc;
> +
> +	rc = driver_create_file(drv, &driver_attr_aes_ops);
> +	if (rc)
> +		goto out;

<snip>

Oh, ${DIETY}, no.  Please don't create files one by one, we do have
functions that do all of this for you automatically, why aren't you
using them?

> +void
> +nx_sysfs_fini(struct device_driver *drv)
> +{
> +	driver_remove_file(drv, &driver_attr_sync_ops);
> +	driver_remove_file(drv, &driver_attr_aes_bytes);
> +	driver_remove_file(drv, &driver_attr_aes_ops);
> +	driver_remove_file(drv, &driver_attr_sha256_bytes);
> +	driver_remove_file(drv, &driver_attr_sha256_ops);
> +	driver_remove_file(drv, &driver_attr_sha512_bytes);
> +	driver_remove_file(drv, &driver_attr_sha512_ops);

Same here, don't do this, do it all at once.

> +}

Who is calling these functions?  Where in the device lifecycle are the
files being created?  Did you just race userspace with how they are
created, or are you doing it "properly"?  (hint, odds are, as you are
trying to manually create and remove these by hand, you aren't doing it
properly...)

thanks,

greg k-h

^ permalink raw reply

* [PATCH 17/17] powerpc: crypto: enable the PFO-based encryption device
From: Kent Yoder @ 2012-03-21 21:41 UTC (permalink / raw)
  To: linux-kernel; +Cc: rcj, linuxppc-dev, linux-crypto
In-Reply-To: <1332365297.3858.5.camel@key-ThinkPad-W510>

This patch adds the cas bits to advertise support for the Platform
Facilities Option (PFO) based encryption accelerator device. The nx
device driver provides support for this hardware feature.

Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
---
 arch/powerpc/kernel/prom_init.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 6691077..fb5412e 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -716,6 +716,12 @@ static void __init early_cmdline_parse(void)
 #else
 #define OV5_PFO_HW_RNG		0x00
 #endif
+#if defined(CONFIG_CRYPTO_DEV_NX) || \
+	defined(CONFIG_CRYPTO_DEV_NX_MODULE)
+#define OV5_PFO_HW_ENCR		0x20
+#else
+#define OV5_PFO_HW_ENCR		0x00
+#endif
 
 /* Option Vector 6: IBM PAPR hints */
 #define OV6_LINUX		0x02	/* Linux is our OS */
@@ -783,7 +789,7 @@ static unsigned char ibm_architecture_vec[] = {
 	0,
 	0,
 	0,
-	OV5_PFO_HW_RNG,
+	OV5_PFO_HW_RNG | OV5_PFO_HW_ENCR,
 
 	/* option vector 6: IBM PAPR hints */
 	4 - 2,				/* length */
-- 
1.7.1

^ permalink raw reply related

* [PATCH 15/17] powerpc: crypto: sysfs routines and docs for the nx device driver
From: Kent Yoder @ 2012-03-21 21:41 UTC (permalink / raw)
  To: linux-kernel; +Cc: rcj, linuxppc-dev, linux-crypto
In-Reply-To: <1332365297.3858.5.camel@key-ThinkPad-W510>

These routines add sysfs files supporting the Power7+ in-Nest encryption
accelerator driver.

Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
---
 Documentation/powerpc/pfo-nx-crypto.txt |   52 ++++++++
 arch/powerpc/crypto/nx/nx_sysfs.c       |  194 +++++++++++++++++++++++++++++++
 2 files changed, 246 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/powerpc/pfo-nx-crypto.txt
 create mode 100644 arch/powerpc/crypto/nx/nx_sysfs.c

diff --git a/Documentation/powerpc/pfo-nx-crypto.txt b/Documentation/powerpc/pfo-nx-crypto.txt
new file mode 100644
index 0000000..63440d3
--- /dev/null
+++ b/Documentation/powerpc/pfo-nx-crypto.txt
@@ -0,0 +1,52 @@
+
+Documentation for the sysfs interfaces provided by the nx-crypto driver, built
+in arch/powerpc/crypto/nx.
+
+The driver provides 2 sets of sysfs files, 1 for confirming that the device is
+actually being used and 1 for error detection.
+
+All sysfs files can be found in:
+
+	/sys/bus/vio/drivers/nx
+
+Error Detection
+===============
+
+errors:
+- A u32 providing a total count of errors since the driver was loaded. The
+only errors counted here are those returned from the hcall, H_COP_OP.
+
+last_error:
+- The most recent non-zero return code from the H_COP_OP hcall. -EBUSY is not
+recorded here (the hcall will retry until -EBUSY goes away).
+
+last_error_pid:
+- The process ID of the process who received the most recent error from the
+hcall.
+
+Notes on error detection:
+  H_RH_PARM (invalid hardware resource ID) and H_HARDWARE (hardware failure)
+are not recorded in the errors or last_error sysfs files, since they are
+signals to the driver to fall back to software.
+
+Device Use
+==========
+
+aes_bytes:
+- The total number of bytes encrypted using AES in any of the driver's
+supported modes.
+
+aes_ops:
+- The total number of AES operations submitted to the hardware.
+
+sha256_bytes:
+- The total number of bytes hashed by the hardware using SHA-256.
+
+sha256_ops:
+- The total number of SHA-256 operations submitted to the hardware.
+
+sha512_bytes:
+- The total number of bytes hashed by the hardware using SHA-512.
+
+sha512_ops:
+- The total number of SHA-512 operations submitted to the hardware.
diff --git a/arch/powerpc/crypto/nx/nx_sysfs.c b/arch/powerpc/crypto/nx/nx_sysfs.c
new file mode 100644
index 0000000..02c84e7
--- /dev/null
+++ b/arch/powerpc/crypto/nx/nx_sysfs.c
@@ -0,0 +1,194 @@
+/**
+ * sysfs routines supporting the Power 7+ Nest Accelerators driver
+ *
+ * Copyright (C) 2011-2012 International Business Machines Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Author: Kent Yoder <yoder1@us.ibm.com>
+ */
+
+#include <linux/device.h>
+#include <linux/kobject.h>
+#include <linux/string.h>
+#include <linux/sysfs.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/crypto.h>
+#include <crypto/hash.h>
+#include <asm/vio.h>
+
+#include "nx_csbcpb.h"
+#include "nx.h"
+
+
+/* sysfs attributes and callbacks
+ *
+ * For documentation on these attributes, please see:
+ *
+ * Documentation/powerpc/pfo-nx-crypto.txt
+ */
+static ssize_t
+nx_attr_show_sha256_ops(struct device_driver *driver, char *buf)
+{
+	return sprintf(buf, "%d\n", atomic_read(&nx_driver.stats.sha256_ops));
+}
+static DRIVER_ATTR(sha256_ops, S_IRUGO, nx_attr_show_sha256_ops, NULL);
+
+static ssize_t
+nx_attr_show_sha256_bytes(struct device_driver *driver, char *buf)
+{
+	return sprintf(buf, "%ld\n",
+		       atomic64_read(&nx_driver.stats.sha256_bytes));
+}
+static DRIVER_ATTR(sha256_bytes, S_IRUGO, nx_attr_show_sha256_bytes, NULL);
+
+static ssize_t
+nx_attr_show_sha512_ops(struct device_driver *driver, char *buf)
+{
+	return sprintf(buf, "%d\n", atomic_read(&nx_driver.stats.sha512_ops));
+}
+static DRIVER_ATTR(sha512_ops, S_IRUGO, nx_attr_show_sha512_ops, NULL);
+
+static ssize_t
+nx_attr_show_sha512_bytes(struct device_driver *driver, char *buf)
+{
+	return sprintf(buf, "%ld\n",
+		       atomic64_read(&nx_driver.stats.sha512_bytes));
+}
+static DRIVER_ATTR(sha512_bytes, S_IRUGO, nx_attr_show_sha512_bytes, NULL);
+
+static ssize_t
+nx_attr_show_aes_ops(struct device_driver *driver, char *buf)
+{
+	return sprintf(buf, "%d\n", atomic_read(&nx_driver.stats.aes_ops));
+}
+static DRIVER_ATTR(aes_ops, S_IRUGO, nx_attr_show_aes_ops, NULL);
+
+static ssize_t
+nx_attr_show_aes_bytes(struct device_driver *driver, char *buf)
+{
+	return sprintf(buf, "%ld\n", atomic64_read(&nx_driver.stats.aes_bytes));
+}
+static DRIVER_ATTR(aes_bytes, S_IRUGO, nx_attr_show_aes_bytes, NULL);
+
+static ssize_t
+nx_attr_show_sync_ops(struct device_driver *driver, char *buf)
+{
+	return sprintf(buf, "%d\n", atomic_read(&nx_driver.stats.sync_ops));
+}
+static DRIVER_ATTR(sync_ops, S_IRUGO, nx_attr_show_sync_ops, NULL);
+
+static ssize_t
+nx_attr_show_errors(struct device_driver *driver, char *buf)
+{
+	return sprintf(buf, "%d\n", atomic_read(&nx_driver.stats.errors));
+}
+static DRIVER_ATTR(errors, S_IRUGO, nx_attr_show_errors, NULL);
+
+static ssize_t
+nx_attr_show_last_error(struct device_driver *driver, char *buf)
+{
+	return sprintf(buf, "%d\n", atomic_read(&nx_driver.stats.last_error));
+}
+static DRIVER_ATTR(last_error, S_IRUGO, nx_attr_show_last_error, NULL);
+
+static ssize_t
+nx_attr_show_last_error_pid(struct device_driver *driver, char *buf)
+{
+	return sprintf(buf, "%d\n",
+		       atomic_read(&nx_driver.stats.last_error_pid));
+}
+static DRIVER_ATTR(last_error_pid, S_IRUGO, nx_attr_show_last_error_pid, NULL);
+
+int
+nx_sysfs_init(struct device_driver *drv)
+{
+	int rc;
+
+	rc = driver_create_file(drv, &driver_attr_aes_ops);
+	if (rc)
+		goto out;
+
+	rc = driver_create_file(drv, &driver_attr_aes_bytes);
+	if (rc)
+		goto out2_unreg;
+
+	rc = driver_create_file(drv, &driver_attr_sync_ops);
+	if (rc)
+		goto out3_unreg;
+
+	rc = driver_create_file(drv, &driver_attr_sha256_ops);
+	if (rc)
+		goto out4_unreg;
+
+	rc = driver_create_file(drv, &driver_attr_sha256_bytes);
+	if (rc)
+		goto out5_unreg;
+
+	rc = driver_create_file(drv, &driver_attr_sha512_ops);
+	if (rc)
+		goto out6_unreg;
+
+	rc = driver_create_file(drv, &driver_attr_sha512_bytes);
+	if (rc)
+		goto out7_unreg;
+
+	rc = driver_create_file(drv, &driver_attr_errors);
+	if (rc)
+		goto out8_unreg;
+
+	rc = driver_create_file(drv, &driver_attr_last_error);
+	if (rc)
+		goto out9_unreg;
+
+	rc = driver_create_file(drv, &driver_attr_last_error_pid);
+	if (rc)
+		goto out10_unreg;
+
+	goto out;
+
+out10_unreg:
+	driver_remove_file(drv, &driver_attr_last_error);
+out9_unreg:
+	driver_remove_file(drv, &driver_attr_errors);
+out8_unreg:
+	driver_remove_file(drv, &driver_attr_sha512_bytes);
+out7_unreg:
+	driver_remove_file(drv, &driver_attr_sha512_ops);
+out6_unreg:
+	driver_remove_file(drv, &driver_attr_sha256_bytes);
+out5_unreg:
+	driver_remove_file(drv, &driver_attr_sha256_ops);
+out4_unreg:
+	driver_remove_file(drv, &driver_attr_sync_ops);
+out3_unreg:
+	driver_remove_file(drv, &driver_attr_aes_bytes);
+out2_unreg:
+	driver_remove_file(drv, &driver_attr_aes_ops);
+out:
+	return rc;
+}
+
+void
+nx_sysfs_fini(struct device_driver *drv)
+{
+	driver_remove_file(drv, &driver_attr_sync_ops);
+	driver_remove_file(drv, &driver_attr_aes_bytes);
+	driver_remove_file(drv, &driver_attr_aes_ops);
+	driver_remove_file(drv, &driver_attr_sha256_bytes);
+	driver_remove_file(drv, &driver_attr_sha256_ops);
+	driver_remove_file(drv, &driver_attr_sha512_bytes);
+	driver_remove_file(drv, &driver_attr_sha512_ops);
+}
-- 
1.7.1

^ permalink raw reply related

* [PATCH 14/17] powerpc: crypto: nx driver code supporting nx encryption
From: Kent Yoder @ 2012-03-21 21:41 UTC (permalink / raw)
  To: linux-kernel; +Cc: rcj, linuxppc-dev, linux-crypto
In-Reply-To: <1332365297.3858.5.camel@key-ThinkPad-W510>

These routines add the base device driver code supporting the Power7+
in-Nest encryption accelerator (nx) device.

Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
---
 arch/powerpc/crypto/nx/nx.c        |  710 ++++++++++++++++++++++++++++++++++++
 arch/powerpc/crypto/nx/nx.h        |  190 ++++++++++
 arch/powerpc/crypto/nx/nx_csbcpb.h |  246 +++++++++++++
 3 files changed, 1146 insertions(+), 0 deletions(-)
 create mode 100644 arch/powerpc/crypto/nx/nx.c
 create mode 100644 arch/powerpc/crypto/nx/nx.h
 create mode 100644 arch/powerpc/crypto/nx/nx_csbcpb.h

diff --git a/arch/powerpc/crypto/nx/nx.c b/arch/powerpc/crypto/nx/nx.c
new file mode 100644
index 0000000..b5730b7
--- /dev/null
+++ b/arch/powerpc/crypto/nx/nx.c
@@ -0,0 +1,710 @@
+/**
+ * Routines supporting the Power 7+ Nest Accelerators driver
+ *
+ * Copyright (C) 2011-2012 International Business Machines Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 only.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Author: Kent Yoder <yoder1@us.ibm.com>
+ */
+
+#include <crypto/internal/hash.h>
+#include <crypto/hash.h>
+#include <crypto/aes.h>
+#include <crypto/sha.h>
+#include <crypto/algapi.h>
+#include <crypto/scatterwalk.h>
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/types.h>
+#include <linux/mm.h>
+#include <linux/crypto.h>
+#include <linux/scatterlist.h>
+#include <linux/device.h>
+#include <linux/of.h>
+#include <asm/pSeries_reconfig.h>
+#include <asm/abs_addr.h>
+#include <asm/hvcall.h>
+#include <asm/vio.h>
+
+#include "nx_csbcpb.h"
+#include "nx.h"
+
+
+/**
+ * nx_hcall_sync - make an H_COP_OP hcall for the passed in op structure
+ *
+ * @nx_ctx: the crypto context handle
+ * @op: PFO operation struct to pass in
+ *
+ * Make the hcall, retrying while the hardware is busy
+ */
+int nx_hcall_sync(struct nx_crypto_ctx *nx_ctx, struct vio_pfo_op *op)
+{
+	int rc;
+	struct vio_dev *viodev = nx_driver.viodev;
+
+	atomic_inc(&(nx_ctx->stats->sync_ops));
+
+	do {
+		rc = vio_h_cop_sync(viodev, op);
+	} while (rc == -EBUSY);
+
+	if (rc) {
+		dev_dbg(&viodev->dev, "vio_h_cop_sync failed: rc: %d "
+			"hcall rc: %ld\n", rc, op->hcall_err);
+		atomic_inc(&(nx_ctx->stats->errors));
+		atomic_set(&(nx_ctx->stats->last_error), op->hcall_err);
+		atomic_set(&(nx_ctx->stats->last_error_pid), current->pid);
+	}
+
+	return rc;
+}
+
+/**
+ * nx_build_sg_list - build an NX scatter list describing a single  buffer
+ *
+ * @sg_head: pointer to the first scatter list element to build
+ * @start_addr: pointer to the linear buffer
+ * @len: length of the data at @start_addr
+ * @sgmax: the largest number of scatter list elements we're allowed to create
+ *
+ * This function will start writing nx_sg elements at @sg_head and keep
+ * writing them until all of the data from @start_addr is described or
+ * until sgmax elements have been written. Scatter list elements will be
+ * created such that none of the elements describes a buffer that crosses a 4K
+ * boundary.
+ */
+struct nx_sg *nx_build_sg_list(struct nx_sg *sg_head,
+			       u8           *start_addr,
+			       unsigned int  len,
+			       u32           sgmax)
+{
+	unsigned int sg_len = 0;
+	struct nx_sg *sg;
+	u64 sg_addr = (u64)start_addr;
+	u64 end_addr;
+
+	if (is_vmalloc_addr(start_addr))
+		sg_addr = phys_to_abs(page_to_phys(vmalloc_to_page(start_addr)))
+			  + offset_in_page(sg_addr);
+	else
+		sg_addr = virt_to_abs(sg_addr);
+
+	end_addr = sg_addr + len;
+
+	for (sg = sg_head; sg_len < len; sg++) {
+		sg->addr = sg_addr;
+		sg_addr = min_t(u64, NX_PAGE_NUM(sg_addr + 4096), end_addr);
+		sg->len = sg_addr - sg->addr;
+		sg_len += sg->len;
+
+		if ((sg - sg_head) == sgmax) {
+			pr_err("nx: scatter/gather list overflow, pid: %d\n",
+			       current->pid);
+			return NULL;
+		}
+	}
+
+	/* return the moved sg_head pointer */
+	return sg;
+}
+
+/**
+ * nx_walk_and_build - walk a linux scatterlist and build an nx scatterlist
+ *
+ * @nx_dst: pointer to the first nx_sg element to write
+ * @sglen: max number of nx_sg entries we're allowed to write
+ * @sg_src: pointer to the source linux scatterlist to walk
+ * @start: number of bytes to fast-forward past at the beginning of @sg_src
+ * @src_len: number of bytes to walk in @sg_src
+ */
+struct nx_sg *nx_walk_and_build(struct nx_sg       *nx_dst,
+				unsigned int        sglen,
+				struct scatterlist *sg_src,
+				unsigned int        start,
+				unsigned int        src_len)
+{
+	struct scatter_walk walk;
+	struct nx_sg *nx_sg = nx_dst;
+	unsigned int n, offset = 0, len = src_len;
+	char *dst;
+
+	/* we need to fast forward through @start bytes first */
+	for (;;) {
+		scatterwalk_start(&walk, sg_src);
+
+		if (start < offset + sg_src->length)
+			break;
+
+		offset += sg_src->length;
+		sg_src = scatterwalk_sg_next(sg_src);
+	}
+
+	/* start - offset is the number of bytes to advance in the scatterlist
+	 * element we're currently looking at */
+	scatterwalk_advance(&walk, start - offset);
+
+	while (len && nx_sg) {
+		n = scatterwalk_clamp(&walk, len);
+		if (!n) {
+			scatterwalk_start(&walk, sg_next(walk.sg));
+			n = scatterwalk_clamp(&walk, len);
+		}
+		dst = scatterwalk_map(&walk, SCATTERWALK_FROM_SG);
+
+		nx_sg = nx_build_sg_list(nx_sg, dst, n, sglen);
+		len -= n;
+
+		scatterwalk_unmap(dst, SCATTERWALK_FROM_SG);
+		scatterwalk_advance(&walk, n);
+		scatterwalk_done(&walk, SCATTERWALK_FROM_SG, len);
+	}
+
+	/* return the moved destination pointer */
+	return nx_sg;
+}
+
+/**
+ * nx_build_sg_lists - walk the input scatterlists and build arrays of NX
+ *                     scatterlists based on them.
+ *
+ * @nx_ctx: NX crypto context for the lists we're building
+ * @desc: the block cipher descriptor for the operation
+ * @dst: destination scatterlist
+ * @src: source scatterlist
+ * @nbytes: length of data described in the scatterlists
+ * @iv: destination for the iv data, if the algorithm requires it
+ *
+ * This is common code shared by all the AES algorithms. It uses the block
+ * cipher walk routines to traverse input and output scatterlists, building
+ * corresponding NX scatterlists
+ */
+int nx_build_sg_lists(struct nx_crypto_ctx  *nx_ctx,
+		      struct blkcipher_desc *desc,
+		      struct scatterlist    *dst,
+		      struct scatterlist    *src,
+		      unsigned int           nbytes,
+		      u8                    *iv)
+{
+	struct nx_sg *nx_insg = nx_ctx->in_sg;
+	struct nx_sg *nx_outsg = nx_ctx->out_sg;
+	struct blkcipher_walk walk;
+	int rc;
+
+	blkcipher_walk_init(&walk, dst, src, nbytes);
+	rc = blkcipher_walk_virt_block(desc, &walk, AES_BLOCK_SIZE);
+	if (rc)
+		goto out;
+
+	if (iv)
+		memcpy(iv, walk.iv, AES_BLOCK_SIZE);
+
+	while (walk.nbytes) {
+		nx_insg = nx_build_sg_list(nx_insg, walk.src.virt.addr,
+					   walk.nbytes, nx_ctx->ap->sglen);
+		nx_outsg = nx_build_sg_list(nx_outsg, walk.dst.virt.addr,
+					    walk.nbytes, nx_ctx->ap->sglen);
+
+		rc = blkcipher_walk_done(desc, &walk, 0);
+		if (rc)
+			break;
+	}
+
+	if (walk.nbytes) {
+		nx_insg = nx_build_sg_list(nx_insg, walk.src.virt.addr,
+					   walk.nbytes, nx_ctx->ap->sglen);
+		nx_outsg = nx_build_sg_list(nx_outsg, walk.dst.virt.addr,
+					    walk.nbytes, nx_ctx->ap->sglen);
+
+		rc = 0;
+	}
+
+	/* these lengths should be negative, which will indicate to phyp that
+	 * the input and output parameters are scatterlists, not linear
+	 * buffers */
+	nx_ctx->op.inlen = (nx_ctx->in_sg - nx_insg) * sizeof(struct nx_sg);
+	nx_ctx->op.outlen = (nx_ctx->out_sg - nx_outsg) * sizeof(struct nx_sg);
+out:
+	return rc;
+}
+
+/**
+ * nx_ctx_init - initialize an nx_ctx's vio_pfo_op struct
+ *
+ * @nx_ctx: the nx context to initialize
+ * @function: the function code for the op
+ */
+void nx_ctx_init(struct nx_crypto_ctx *nx_ctx, unsigned int function)
+{
+	memset(nx_ctx->csbcpb, 0, sizeof(struct nx_csbcpb));
+	nx_ctx->csbcpb->csb.valid_bit = 1;
+
+	nx_ctx->op.flags = function;
+	nx_ctx->op.csbcpb = virt_to_abs(nx_ctx->csbcpb);
+	nx_ctx->op.in = virt_to_abs(nx_ctx->in_sg);
+	nx_ctx->op.out = virt_to_abs(nx_ctx->out_sg);
+
+	if (nx_ctx->csbcpb_aead) {
+		memset(nx_ctx->csbcpb_aead, 0, sizeof(struct nx_csbcpb));
+		nx_ctx->csbcpb_aead->csb.valid_bit = 1;
+
+		nx_ctx->op_aead.flags = function;
+		nx_ctx->op_aead.csbcpb = virt_to_abs(nx_ctx->csbcpb_aead);
+		nx_ctx->op_aead.in = virt_to_abs(nx_ctx->in_sg);
+		nx_ctx->op_aead.out = virt_to_abs(nx_ctx->out_sg);
+	}
+}
+
+static void nx_of_update_status(struct device   *dev,
+			       struct property *p,
+			       struct nx_of    *props)
+{
+	if (!strncmp(p->value, "okay", p->length)) {
+		props->status = NX_WAITING;
+		props->flags |= NX_OF_FLAG_STATUS_SET;
+	} else {
+		dev_info(dev, "%s: status '%s' is not 'okay'\n", __func__,
+			 (char *)p->value);
+	}
+}
+
+static void nx_of_update_sglen(struct device   *dev,
+			       struct property *p,
+			       struct nx_of    *props)
+{
+	if (p->length != sizeof(props->max_sg_len)) {
+		dev_err(dev, "%s: unexpected format for "
+			"ibm,max-sg-len property\n", __func__);
+		dev_dbg(dev, "%s: ibm,max-sg-len is %d bytes "
+			"long, expected %zd bytes\n", __func__,
+			p->length, sizeof(props->max_sg_len));
+		return;
+	}
+
+	props->max_sg_len = *(u32 *)p->value;
+	props->flags |= NX_OF_FLAG_MAXSGLEN_SET;
+}
+
+static void nx_of_update_msc(struct device   *dev,
+			     struct property *p,
+			     struct nx_of    *props)
+{
+	struct msc_triplet *trip;
+	struct max_sync_cop *msc;
+	unsigned int bytes_so_far, i, lenp;
+
+	msc = (struct max_sync_cop *)p->value;
+	lenp = p->length;
+
+	/* You can't tell if the data read in for this property is sane by its
+	 * size alone. This is because there are sizes embedded in the data
+	 * structure. The best we can do is check lengths as we parse and bail
+	 * as soon as a length error is detected. */
+	bytes_so_far = 0;
+
+	while ((bytes_so_far + sizeof(struct max_sync_cop)) <= lenp) {
+		bytes_so_far += sizeof(struct max_sync_cop);
+
+		trip = msc->trip;
+
+		for (i = 0;
+		     ((bytes_so_far + sizeof(struct msc_triplet)) <= lenp) &&
+		     i < msc->triplets;
+		     i++) {
+			if (msc->fc > NX_MAX_FC || msc->mode > NX_MAX_MODE) {
+				dev_err(dev, "unknown function code/mode "
+					"combo: %d/%d (ignored)\n", msc->fc,
+					msc->mode);
+				goto next_loop;
+			}
+
+			switch (trip->keybitlen) {
+			case 128:
+			case 160:
+				props->ap[msc->fc][msc->mode][0].databytelen =
+					trip->databytelen;
+				props->ap[msc->fc][msc->mode][0].sglen =
+					trip->sglen;
+				break;
+			case 192:
+				props->ap[msc->fc][msc->mode][1].databytelen =
+					trip->databytelen;
+				props->ap[msc->fc][msc->mode][1].sglen =
+					trip->sglen;
+				break;
+			case 256:
+				if (msc->fc == NX_FC_AES) {
+					props->ap[msc->fc][msc->mode][2].
+						databytelen = trip->databytelen;
+					props->ap[msc->fc][msc->mode][2].sglen =
+						trip->sglen;
+				} else if (msc->fc == NX_FC_AES_HMAC ||
+					   msc->fc == NX_FC_SHA) {
+					props->ap[msc->fc][msc->mode][1].
+						databytelen = trip->databytelen;
+					props->ap[msc->fc][msc->mode][1].sglen =
+						trip->sglen;
+				} else {
+					dev_warn(dev, "unknown function "
+						"code/key bit len combo"
+						": (%u/256)\n", msc->fc);
+				}
+				break;
+			case 512:
+				props->ap[msc->fc][msc->mode][2].databytelen =
+					trip->databytelen;
+				props->ap[msc->fc][msc->mode][2].sglen =
+					trip->sglen;
+				break;
+			default:
+				dev_warn(dev, "unknown function code/key bit "
+					 "len combo: (%u/%u)\n", msc->fc,
+					 trip->keybitlen);
+				break;
+			}
+next_loop:
+			bytes_so_far += sizeof(struct msc_triplet);
+			trip++;
+		}
+
+		msc = (struct max_sync_cop *)trip;
+	}
+
+	props->flags |= NX_OF_FLAG_MAXSYNCCOP_SET;
+}
+
+/**
+ * nx_of_init - read openFirmware values from the device tree
+ *
+ * @dev: device handle
+ * @props: pointer to struct to hold the properties values
+ *
+ * Called once at driver probe time, this function will read out the
+ * openFirmware properties we use at runtime. If all the OF properties are
+ * acceptable, when we exit this function props->flags will indicate that
+ * we're ready to register our crypto algorithms.
+ */
+static void nx_of_init(struct device *dev, struct nx_of *props)
+{
+	struct device_node *base_node = dev->of_node;
+	struct property *p;
+
+	p = of_find_property(base_node, "status", NULL);
+	if (!p)
+		dev_info(dev, "%s: property 'status' not found\n", __func__);
+	else
+		nx_of_update_status(dev, p, props);
+
+	p = of_find_property(base_node, "ibm,max-sg-len", NULL);
+	if (!p)
+		dev_info(dev, "%s: property 'ibm,max-sg-len' not found\n",
+			 __func__);
+	else
+		nx_of_update_sglen(dev, p, props);
+
+	p = of_find_property(base_node, "ibm,max-sync-cop", NULL);
+	if (!p)
+		dev_info(dev, "%s: property 'ibm,max-sync-cop' not found\n",
+			 __func__);
+	else
+		nx_of_update_msc(dev, p, props);
+}
+
+/**
+ * nx_register_algs - register algorithms with the crypto API
+ *
+ * Called from nx_probe()
+ *
+ * If all OF properties are in an acceptable state, the driver flags will
+ * indicate that we're ready and we'll create our sysfs files and register
+ * out crypto algorithms.
+ */
+static int nx_register_algs(void)
+{
+	int rc = -1;
+
+	if (nx_driver.of.flags != NX_OF_FLAG_MASK_READY)
+		goto out;
+
+	memset(&nx_driver.stats, 0, sizeof(struct nx_stats));
+
+	rc = nx_sysfs_init(&nx_driver.viodriver.driver);
+	if (rc)
+		goto out;
+
+	rc = crypto_register_alg(&nx_ecb_aes_alg);
+	if (rc)
+		goto out;
+
+	rc = crypto_register_alg(&nx_cbc_aes_alg);
+	if (rc)
+		goto out_unreg_ecb;
+
+	rc = crypto_register_alg(&nx_ctr_aes_alg);
+	if (rc)
+		goto out_unreg_cbc;
+
+	rc = crypto_register_alg(&nx_ctr3686_aes_alg);
+	if (rc)
+		goto out_unreg_ctr;
+
+	rc = crypto_register_alg(&nx_gcm_aes_alg);
+	if (rc)
+		goto out_unreg_ctr3686;
+
+	rc = crypto_register_alg(&nx_gcm4106_aes_alg);
+	if (rc)
+		goto out_unreg_gcm;
+
+	rc = crypto_register_alg(&nx_ccm_aes_alg);
+	if (rc)
+		goto out_unreg_gcm4106;
+
+	rc = crypto_register_alg(&nx_ccm4309_aes_alg);
+	if (rc)
+		goto out_unreg_ccm;
+
+	rc = crypto_register_shash(&nx_shash_sha256_alg);
+	if (rc)
+		goto out_unreg_ccm4309;
+
+	rc = crypto_register_shash(&nx_shash_sha512_alg);
+	if (rc)
+		goto out_unreg_s256;
+
+	rc = crypto_register_shash(&nx_shash_aes_xcbc_alg);
+	if (rc)
+		goto out_unreg_s512;
+
+	nx_driver.of.status = NX_OKAY;
+
+	goto out;
+
+out_unreg_s512:
+	crypto_unregister_shash(&nx_shash_sha512_alg);
+out_unreg_s256:
+	crypto_unregister_shash(&nx_shash_sha256_alg);
+out_unreg_ccm4309:
+	crypto_unregister_alg(&nx_ccm4309_aes_alg);
+out_unreg_ccm:
+	crypto_unregister_alg(&nx_ccm_aes_alg);
+out_unreg_gcm4106:
+	crypto_unregister_alg(&nx_gcm4106_aes_alg);
+out_unreg_gcm:
+	crypto_unregister_alg(&nx_gcm_aes_alg);
+out_unreg_ctr3686:
+	crypto_unregister_alg(&nx_ctr3686_aes_alg);
+out_unreg_ctr:
+	crypto_unregister_alg(&nx_ctr_aes_alg);
+out_unreg_cbc:
+	crypto_unregister_alg(&nx_cbc_aes_alg);
+out_unreg_ecb:
+	crypto_unregister_alg(&nx_ecb_aes_alg);
+out:
+	return rc;
+}
+
+/**
+ * nx_crypto_ctx_init - create and initialize a crypto api context
+ *
+ * @nx_ctx: the crypto api context
+ * @fc: function code for the context
+ * @mode: the function code specific mode for this context
+ */
+static int nx_crypto_ctx_init(struct nx_crypto_ctx *nx_ctx, u32 fc, u32 mode)
+{
+	if (nx_driver.of.status != NX_OKAY) {
+		pr_err("Attempt to initialize NX crypto context while device "
+		       "is not available!\n");
+		return -1;
+	}
+
+	nx_ctx->csbcpb = kzalloc(NX_CRYPTO_CTX_SIZE, GFP_KERNEL);
+	if (!nx_ctx->csbcpb)
+		return -ENOMEM;
+
+	if (mode == NX_MODE_AES_GCM || mode == NX_MODE_AES_CCM) {
+		nx_ctx->csbcpb_aead = kzalloc(NX_CRYPTO_CTX_SIZE, GFP_KERNEL);
+		if (!nx_ctx->csbcpb_aead) {
+			kfree(nx_ctx->csbcpb);
+			return -ENOMEM;
+		}
+	}
+
+	/* the input scatterlist and output scatterlist are stored in pages
+	 * 2 and 3 of the csbcpb space */
+	nx_ctx->in_sg = (struct nx_sg *)((u8 *)nx_ctx->csbcpb + 4096ULL);
+	nx_ctx->out_sg = (struct nx_sg *)((u8 *)nx_ctx->in_sg + 4096ULL);
+
+	/* give each context a pointer to global stats and their OF
+	 * properties */
+	nx_ctx->stats = &nx_driver.stats;
+	memcpy(nx_ctx->props, nx_driver.of.ap[fc][mode],
+	       sizeof(struct alg_props) * 3);
+
+	return 0;
+}
+
+/* entry points from the crypto tfm initializers */
+int nx_crypto_ctx_aes_ccm_init(struct crypto_tfm *tfm)
+{
+	return nx_crypto_ctx_init(crypto_tfm_ctx(tfm), NX_FC_AES,
+				  NX_MODE_AES_CCM);
+}
+
+int nx_crypto_ctx_aes_gcm_init(struct crypto_tfm *tfm)
+{
+	return nx_crypto_ctx_init(crypto_tfm_ctx(tfm), NX_FC_AES,
+				  NX_MODE_AES_GCM);
+}
+
+int nx_crypto_ctx_aes_ctr_init(struct crypto_tfm *tfm)
+{
+	return nx_crypto_ctx_init(crypto_tfm_ctx(tfm), NX_FC_AES,
+				  NX_MODE_AES_CTR);
+}
+
+int nx_crypto_ctx_aes_cbc_init(struct crypto_tfm *tfm)
+{
+	return nx_crypto_ctx_init(crypto_tfm_ctx(tfm), NX_FC_AES,
+				  NX_MODE_AES_CBC);
+}
+
+int nx_crypto_ctx_aes_ecb_init(struct crypto_tfm *tfm)
+{
+	return nx_crypto_ctx_init(crypto_tfm_ctx(tfm), NX_FC_AES,
+				  NX_MODE_AES_ECB);
+}
+
+int nx_crypto_ctx_sha_init(struct crypto_tfm *tfm)
+{
+	return nx_crypto_ctx_init(crypto_tfm_ctx(tfm), NX_FC_SHA, NX_MODE_SHA);
+}
+
+int nx_crypto_ctx_aes_xcbc_init(struct crypto_tfm *tfm)
+{
+	return nx_crypto_ctx_init(crypto_tfm_ctx(tfm), NX_FC_AES,
+				  NX_MODE_AES_XCBC_MAC);
+}
+
+/**
+ * nx_crypto_ctx_exit - destroy a crypto api context
+ *
+ * @tfm: the crypto transform pointer for the context
+ *
+ * As crypto API contexts are destroyed, this exit hook is called to free the
+ * memory associated with it.
+ */
+void nx_crypto_ctx_exit(struct crypto_tfm *tfm)
+{
+	struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(tfm);
+
+	if (nx_ctx->csbcpb_aead) {
+		kzfree(nx_ctx->csbcpb_aead);
+		nx_ctx->csbcpb_aead = NULL;
+	}
+
+	kzfree(nx_ctx->csbcpb);
+	nx_ctx->csbcpb = NULL;
+	nx_ctx->in_sg = NULL;
+	nx_ctx->out_sg = NULL;
+}
+
+static int __devinit nx_probe(struct vio_dev *viodev,
+			      const struct vio_device_id *id)
+{
+	int rc;
+
+	dev_dbg(&viodev->dev, "driver probed: %s resource id: 0x%x\n",
+		viodev->name, viodev->resource_id);
+
+	if (nx_driver.viodev) {
+		dev_err(&viodev->dev, "%s: Attempt to register more than one "
+			"instance of the hardware\n", __func__);
+		rc = -EINVAL;
+		goto out;
+	}
+
+	nx_driver.viodev = viodev;
+
+	nx_of_init(&viodev->dev, &nx_driver.of);
+
+	rc = nx_register_algs();
+out:
+	return rc;
+}
+
+static int __devexit nx_remove(struct vio_dev *viodev)
+{
+	dev_dbg(&viodev->dev, "entering nx_remove for UA 0x%x\n",
+		viodev->unit_address);
+
+	if (nx_driver.of.status == NX_OKAY) {
+		nx_sysfs_fini(&nx_driver.viodriver.driver);
+
+		crypto_unregister_alg(&nx_ccm_aes_alg);
+		crypto_unregister_alg(&nx_ccm4309_aes_alg);
+		crypto_unregister_alg(&nx_gcm_aes_alg);
+		crypto_unregister_alg(&nx_gcm4106_aes_alg);
+		crypto_unregister_alg(&nx_ctr_aes_alg);
+		crypto_unregister_alg(&nx_ctr3686_aes_alg);
+		crypto_unregister_alg(&nx_cbc_aes_alg);
+		crypto_unregister_alg(&nx_ecb_aes_alg);
+		crypto_unregister_shash(&nx_shash_sha256_alg);
+		crypto_unregister_shash(&nx_shash_sha512_alg);
+		crypto_unregister_shash(&nx_shash_aes_xcbc_alg);
+	}
+
+	return 0;
+}
+
+
+/* module wide initialization/cleanup */
+static int __init nx_init(void)
+{
+	return vio_register_driver(&nx_driver.viodriver);
+}
+
+static void __exit nx_fini(void)
+{
+	vio_unregister_driver(&nx_driver.viodriver);
+}
+
+static struct vio_device_id nx_crypto_driver_ids[] __devinitdata = {
+	{ "ibm,sym-encryption-v1", "ibm,sym-encryption" },
+	{ "", "" }
+};
+MODULE_DEVICE_TABLE(vio, nx_crypto_driver_ids);
+
+/* driver state structure */
+struct nx_crypto_driver nx_driver = {
+	.viodriver = {
+		.id_table = nx_crypto_driver_ids,
+		.probe = nx_probe,
+		.remove = nx_remove,
+		.driver = {
+			.name  = "nx",
+			.owner = THIS_MODULE,
+		},
+	},
+};
+
+module_init(nx_init);
+module_exit(nx_fini);
+
+MODULE_AUTHOR("Kent Yoder <yoder1@us.ibm.com>");
+MODULE_DESCRIPTION(NX_STRING);
+MODULE_LICENSE("GPL");
+MODULE_VERSION(NX_VERSION);
diff --git a/arch/powerpc/crypto/nx/nx.h b/arch/powerpc/crypto/nx/nx.h
new file mode 100644
index 0000000..27c6188
--- /dev/null
+++ b/arch/powerpc/crypto/nx/nx.h
@@ -0,0 +1,190 @@
+
+#ifndef __NX_H__
+#define __NX_H__
+
+#define NX_STRING	"IBM Power7+ Nest Accelerator Crypto Driver"
+#define NX_VERSION	"1.0"
+
+static const char nx_driver_name[] = "nx";
+static const char nx_driver_string[] = NX_STRING;
+static const char nx_driver_version[] = NX_VERSION;
+
+/* a scatterlist in the format PHYP is expecting */
+struct nx_sg {
+	u64 addr;
+	u32 rsvd;
+	u32 len;
+} __attribute((packed));
+
+#define NX_MAX_SG_ENTRIES	(4096/(sizeof(struct nx_sg)))
+
+enum nx_status {
+	NX_DISABLED,
+	NX_WAITING,
+	NX_OKAY
+};
+
+/* msc_triplet and max_sync_cop are used only to assist in parsing the
+ * openFirmware property */
+struct msc_triplet {
+	u32 keybitlen;
+	u32 databytelen;
+	u32 sglen;
+} __packed;
+
+struct max_sync_cop {
+	u32 fc;
+	u32 mode;
+	u32 triplets;
+	struct msc_triplet trip[0];
+} __packed;
+
+struct alg_props {
+	u32 databytelen;
+	u32 sglen;
+};
+
+#define NX_OF_FLAG_MAXSGLEN_SET		(1)
+#define NX_OF_FLAG_STATUS_SET		(2)
+#define NX_OF_FLAG_MAXSYNCCOP_SET	(4)
+#define NX_OF_FLAG_MASK_READY		(NX_OF_FLAG_MAXSGLEN_SET | \
+					 NX_OF_FLAG_STATUS_SET |   \
+					 NX_OF_FLAG_MAXSYNCCOP_SET)
+struct nx_of {
+	u32 flags;
+	u32 max_sg_len;
+	enum nx_status status;
+	struct alg_props ap[NX_MAX_FC][NX_MAX_MODE][3];
+};
+
+struct nx_stats {
+	atomic_t aes_ops;
+	atomic64_t aes_bytes;
+	atomic_t sha256_ops;
+	atomic64_t sha256_bytes;
+	atomic_t sha512_ops;
+	atomic64_t sha512_bytes;
+
+	atomic_t sync_ops;
+
+	atomic_t errors;
+	atomic_t last_error;
+	atomic_t last_error_pid;
+};
+
+struct nx_crypto_driver {
+	struct nx_stats       stats;
+	struct nx_of          of;
+	struct vio_dev __rcu *viodev;
+	struct vio_driver     viodriver;
+};
+
+#define NX_GCM4106_NONCE_LEN		(4)
+#define NX_GCM_CTR_OFFSET		(12)
+struct nx_gcm_priv {
+	u8 iv[16];
+	u8 iauth_tag[16];
+	u8 nonce[NX_GCM4106_NONCE_LEN];
+};
+
+#define NX_CCM_AES_KEY_LEN		(16)
+#define NX_CCM4309_AES_KEY_LEN		(19)
+#define NX_CCM4309_NONCE_LEN		(3)
+struct nx_ccm_priv {
+	u8 iv[16];
+	u8 b0[16];
+	u8 iauth_tag[16];
+	u8 oauth_tag[16];
+	u8 nonce[NX_CCM4309_NONCE_LEN];
+};
+
+struct nx_xcbc_priv {
+	u8 key[16];
+};
+
+struct nx_ctr_priv {
+	u8 iv[16];
+};
+
+/* 3 pages, the context, in scatterlist, out scatterlist */
+#define NX_CRYPTO_CTX_SIZE		(4096 * 3)
+
+struct nx_crypto_ctx {
+	struct nx_csbcpb *csbcpb; /* aligned pages given to phyp @ hcall time */
+	struct vio_pfo_op op;     /* operation struct with hcall parameters */
+	struct nx_csbcpb *csbcpb_aead; /* secondary csbcpb used by AEAD algs */
+	struct vio_pfo_op op_aead;/* operation struct for csbcpb_aead */
+
+	struct nx_sg *in_sg;      /* pointer into csbcpb to an sg list */
+	struct nx_sg *out_sg;     /* pointer into csbcpb to an sg list */
+
+	struct alg_props *ap;	  /* pointer into props based on our key size */
+	struct alg_props props[3];/* openFirmware properties for requests */
+	struct nx_stats *stats;   /* pointer into an nx_crypto_driver for stats
+				     reporting */
+
+	union {
+		struct nx_gcm_priv gcm;
+		struct nx_ccm_priv ccm;
+		struct nx_xcbc_priv xcbc;
+		struct nx_ctr_priv ctr;
+	} priv;
+
+	union {
+		struct crypto_blkcipher *blk;
+		struct crypto_aead *aead;
+		struct crypto_shash *shash;
+	} fallback;
+};
+
+struct blk_fallback_req {
+	struct blkcipher_desc *desc;
+	struct scatterlist *src;
+	struct scatterlist *dst;
+	unsigned int nbytes;
+	u8 *key;
+	unsigned int key_len;
+	int enc;
+};
+
+/* prototypes */
+int nx_crypto_ctx_aes_ccm_init(struct crypto_tfm *tfm);
+int nx_crypto_ctx_aes_gcm_init(struct crypto_tfm *tfm);
+int nx_crypto_ctx_aes_xcbc_init(struct crypto_tfm *tfm);
+int nx_crypto_ctx_aes_ctr_init(struct crypto_tfm *tfm);
+int nx_crypto_ctx_aes_cbc_init(struct crypto_tfm *tfm);
+int nx_crypto_ctx_aes_ecb_init(struct crypto_tfm *tfm);
+int nx_crypto_ctx_sha_init(struct crypto_tfm *tfm);
+void nx_crypto_ctx_exit(struct crypto_tfm *tfm);
+void nx_ctx_init(struct nx_crypto_ctx *nx_ctx, unsigned int function);
+int nx_hcall_sync(struct nx_crypto_ctx *ctx, struct vio_pfo_op *op);
+struct nx_sg *nx_build_sg_list(struct nx_sg *, u8 *, unsigned int, u32);
+int nx_build_sg_lists(struct nx_crypto_ctx *, struct blkcipher_desc *,
+		      struct scatterlist *, struct scatterlist *, unsigned int,
+		      u8 *);
+struct nx_sg *nx_walk_and_build(struct nx_sg *, unsigned int,
+				struct scatterlist *, unsigned int,
+				unsigned int);
+int nx_sysfs_init(struct device_driver *);
+void nx_sysfs_fini(struct device_driver *);
+
+#define NX_PAGE_NUM(x)		((u64)(x) & 0xfffffffffffff000ULL)
+
+extern struct crypto_alg nx_cbc_aes_alg;
+extern struct crypto_alg nx_ecb_aes_alg;
+extern struct crypto_alg nx_gcm_aes_alg;
+extern struct crypto_alg nx_gcm4106_aes_alg;
+extern struct crypto_alg nx_ctr_aes_alg;
+extern struct crypto_alg nx_ctr3686_aes_alg;
+extern struct crypto_alg nx_ccm_aes_alg;
+extern struct crypto_alg nx_ccm4309_aes_alg;
+extern struct shash_alg nx_shash_aes_xcbc_alg;
+extern struct shash_alg nx_shash_sha512_alg;
+extern struct shash_alg nx_shash_sha256_alg;
+
+extern struct nx_crypto_driver nx_driver;
+
+#define SCATTERWALK_TO_SG	1
+#define SCATTERWALK_FROM_SG	0
+
+#endif
diff --git a/arch/powerpc/crypto/nx/nx_csbcpb.h b/arch/powerpc/crypto/nx/nx_csbcpb.h
new file mode 100644
index 0000000..ec793a9
--- /dev/null
+++ b/arch/powerpc/crypto/nx/nx_csbcpb.h
@@ -0,0 +1,246 @@
+
+#ifndef __NX_CSBCPB_H__
+#define __NX_CSBCPB_H__
+
+struct cop_symcpb_fdm {
+	u8 ende:1;
+	u8 operand_overlap:1;
+	u8 padding_rules:2;
+	u8 __rsvd:2;
+	u8 continuation:1;
+	u8 intermediate:1;
+} __packed;
+
+struct cop_symcpb_header {
+	u8 mode;
+	struct cop_symcpb_fdm fdm;
+	u8 key_size:4;
+	u8 digest_size:4;
+	u8 pad_byte;
+	u8 __rsvd[12];
+} __packed;
+
+struct cop_symcpb_aes_ecb {
+	u8 key[32];
+	u8 __rsvd[80];
+} __packed;
+
+struct cop_symcpb_aes_cbc {
+	u8 iv[16];
+	u8 key[32];
+	u8 cv[16];
+	u32 spbc;
+	u8 __rsvd[44];
+} __packed;
+
+struct cop_symcpb_aes_gmac {
+	u8 in_pat[16];
+	u8 iv[16];
+	u64 bit_length_aad;
+	u64 bit_length_data;
+	u8 in_s0[16];
+	u8 key[32];
+	u8 __rsvd1[16];
+	u8 out_pat_or_mac[16];
+	u8 out_s0[16];
+	u32 spbc;
+	u8 __rsvd2[28];
+} __packed;
+
+struct cop_symcpb_aes_gca {
+	u8 in_pat[16];
+	u8 key[32];
+	u8 out_pat[16];
+	u32 spbc;
+	u8 __rsvd[44];
+} __packed;
+
+struct cop_symcpb_aes_gcm {
+	u8 in_pat_or_aad[16];
+	u8 iv_or_cnt[16];
+	u64 bit_length_aad;
+	u64 bit_length_data;
+	u8 in_s0[16];
+	u8 key[32];
+	u8 __rsvd1[16];
+	u8 out_pat_or_mac[16];
+	u8 out_s0[16];
+	u8 out_cnt[16];
+	u32 spbc;
+	u8 __rsvd2[12];
+} __packed;
+
+struct cop_symcpb_aes_ctr {
+	u8 iv[16];
+	u8 key[32];
+	u8 cv[16];
+	u32 spbc;
+	u8 __rsvd2[44];
+} __packed;
+
+struct cop_symcpb_aes_cca {
+	u8 b0[16];
+	u8 b1[16];
+	u8 key[16];
+	u8 out_pat_or_b0[16];
+	u32 spbc;
+	u8 __rsvd[44];
+} __packed;
+
+struct cop_symcpb_aes_ccm {
+	u8 in_pat_or_b0[16];
+	u8 iv_or_ctr[16];
+	u8 in_s0[16];
+	u8 key[16];
+	u8 __rsvd1[48];
+	u8 out_pat_or_mac[16];
+	u8 out_s0[16];
+	u8 out_ctr[16];
+	u32 spbc;
+	u8 __rsvd2[12];
+} __packed;
+
+struct cop_symcpb_aes_xcbc {
+	u8 cv[16];
+	u8 key[16];
+	u8 __rsvd1[16];
+	u8 out_cv_mac[16];
+	u32 spbc;
+	u8 __rsvd2[44];
+} __packed;
+
+struct cop_symcpb_sha256 {
+	u64 message_bit_length;
+	u64 __rsvd1;
+	u8 input_partial_digest[32];
+	u8 message_digest[32];
+	u32 spbc;
+	u8 __rsvd2[44];
+} __packed;
+
+struct cop_symcpb_sha512 {
+	u64 message_bit_length_hi;
+	u64 message_bit_length_lo;
+	u8 input_partial_digest[64];
+	u8 __rsvd1[32];
+	u8 message_digest[64];
+	u32 spbc;
+	u8 __rsvd2[76];
+} __packed;
+
+struct cop_symcpb_sha256_hmac {
+	u64 MBLe;
+	u64 __rsvd1;
+	u8 key[64];
+	u8 input_partial_message[32];
+	u8 message_digest[32];
+	u32 spbc;
+	u8 __rsvd2[28];
+} __packed;
+
+struct cop_symcpb_sha512_hmac {
+	u64 MBLe;
+	u64 __reserved1;
+	u8 key[128];
+	u8 input_partial_message[64];
+	u8 __rsvd2[32];
+	u8 message_digest[64];
+	u32 spbc;
+	u8 __rsvd3[60];
+} __packed;
+
+struct cop_parameter_block {
+	struct cop_symcpb_header hdr;
+	union {
+		struct cop_symcpb_aes_ecb     aes_ecb;
+		struct cop_symcpb_aes_cbc     aes_cbc;
+		struct cop_symcpb_aes_gmac    aes_gmac;
+		struct cop_symcpb_aes_gca     aes_gca;
+		struct cop_symcpb_aes_gcm     aes_gcm;
+		struct cop_symcpb_aes_cca     aes_cca;
+		struct cop_symcpb_aes_ccm     aes_ccm;
+		struct cop_symcpb_aes_ctr     aes_ctr;
+		struct cop_symcpb_aes_xcbc    aes_xcbc;
+		struct cop_symcpb_sha256      sha256;
+		struct cop_symcpb_sha512      sha512;
+		struct cop_symcpb_sha256_hmac sha256_hmac;
+		struct cop_symcpb_sha512_hmac sha512_hmac;
+	};
+} __packed;
+
+/* co-processor status block */
+struct cop_status_block {
+	u32 valid_bit:1;
+	u32 reserved_0:4;
+	u32 format:1;
+	u32 ch:2;
+	u32 crb_seq_number:8;
+	u32 completion_code:8;
+	u32 completion_extension:8;
+	u32 processed_byte_count;
+	u64 address;
+} __packed;
+
+/* Nest accelerator workbook section 4.4 */
+struct nx_csbcpb {
+	unsigned char __rsvd[112];
+	struct cop_status_block csb;
+	struct cop_parameter_block cpb;
+} __packed;
+
+/* nx_csbcpb related definitions */
+#define NX_MODE_AES_ECB			0
+#define NX_MODE_AES_CBC			1
+#define NX_MODE_AES_GMAC		2
+#define NX_MODE_AES_GCA			3
+#define NX_MODE_AES_GCM			4
+#define NX_MODE_AES_CCA			5
+#define NX_MODE_AES_CCM			6
+#define NX_MODE_AES_CTR			7
+#define NX_MODE_AES_XCBC_MAC		20
+#define NX_MODE_SHA			0
+#define NX_MODE_SHA_HMAC		1
+#define NX_MODE_AES_CBC_HMAC_ETA	8
+#define NX_MODE_AES_CBC_HMAC_ATE	9
+#define NX_MODE_AES_CBC_HMAC_EAA	10
+#define NX_MODE_AES_CTR_HMAC_ETA	12
+#define NX_MODE_AES_CTR_HMAC_ATE	13
+#define NX_MODE_AES_CTR_HMAC_EAA	14
+
+#define NX_FDM_ENDE_ENCRYPT	1
+#define NX_FDM_ENDE_DECRYPT	0
+
+#define NX_FDM_CI_FULL		0
+#define NX_FDM_CI_FIRST		1
+#define NX_FDM_CI_LAST		2
+#define NX_FDM_CI_MIDDLE	3
+
+#define NX_FDM_PR_NONE		0
+#define NX_FDM_PR_PAD		1
+
+#define NX_KS_AES_128		1
+#define NX_KS_AES_192		2
+#define NX_KS_AES_256		3
+
+#define NX_DS_SHA256		2
+#define NX_DS_SHA512		3
+
+#define NX_FC_AES		0
+#define NX_FC_SHA		2
+#define NX_FC_AES_HMAC		6
+
+#define NX_MAX_FC		(NX_FC_AES_HMAC + 1)
+#define NX_MAX_MODE		(NX_MODE_AES_XCBC_MAC + 1)
+
+#define HCOP_FC_AES          NX_FC_AES
+#define HCOP_FC_SHA          NX_FC_SHA
+#define HCOP_FC_AES_HMAC     NX_FC_AES_HMAC
+
+/* indices into the array of algorithm properties */
+#define NX_PROPS_AES_128		0
+#define NX_PROPS_AES_192		1
+#define NX_PROPS_AES_256		2
+#define NX_PROPS_SHA256			1
+#define NX_PROPS_SHA512			2
+
+#endif
-- 
1.7.1

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox