Release v4.4.3-openpower2 kernel

  - ast: Switch SCU to VGA output on POST
  - scsi: ignore errors from scsi_dh_add_device()
  - mlx4: Set UAR page size to 4KB regardless of system page size
  - bnx2x: moved to firmware required for 4.4 kernels

Signed-off-by: Joel Stanley <joel@jms.id.au>
diff --git a/openpower/linux/linux-0001-xhci-Use-xhci_pci_remove-for-xhci-device-shutdown.patch b/openpower/linux/linux-0001-xhci-Use-xhci_pci_remove-for-xhci-device-shutdown.patch
index d3dbb0d..dba2f12 100644
--- a/openpower/linux/linux-0001-xhci-Use-xhci_pci_remove-for-xhci-device-shutdown.patch
+++ b/openpower/linux/linux-0001-xhci-Use-xhci_pci_remove-for-xhci-device-shutdown.patch
@@ -1,7 +1,7 @@
-From 0e7a4fdbfa121ea4b6f34e3138a8d1d3bc6c1968 Mon Sep 17 00:00:00 2001
+From f9f63ceed65d3dae3eddb8ac1b513c41999d881b Mon Sep 17 00:00:00 2001
 From: Thadeu Lima De Souza Cascardo <thadeul@br.ibm.com>
 Date: Tue, 25 Mar 2014 10:45:16 -0400
-Subject: [PATCH 1/5] xhci: Use xhci_pci_remove for xhci device shutdown
+Subject: [PATCH 1/7] xhci: Use xhci_pci_remove for xhci device shutdown
 
 Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
 Signed-off-by: Joel Stanley <joel@jms.id.au>
diff --git a/openpower/linux/linux-0002-Revert-usb-xhci-stop-everything-on-the-first-call-to.patch b/openpower/linux/linux-0002-Revert-usb-xhci-stop-everything-on-the-first-call-to.patch
index 7db0e9b..b1a98a9 100644
--- a/openpower/linux/linux-0002-Revert-usb-xhci-stop-everything-on-the-first-call-to.patch
+++ b/openpower/linux/linux-0002-Revert-usb-xhci-stop-everything-on-the-first-call-to.patch
@@ -1,7 +1,7 @@
-From 26096712324781dbc4156f51dfd7e69847e1bbd0 Mon Sep 17 00:00:00 2001
+From 39013a21f92d0d4aa0a9588ba380037af33f3c1a Mon Sep 17 00:00:00 2001
 From: Joel Stanley <joel@jms.id.au>
 Date: Thu, 28 Jan 2016 13:07:06 +1030
-Subject: [PATCH 2/5] Revert "usb: xhci: stop everything on the first call to
+Subject: [PATCH 2/7] Revert "usb: xhci: stop everything on the first call to
  xhci_stop"
 
 This reverts commit 8c24d6d7b09deee3036ddc4f2b81b53b28c8f877.
@@ -17,7 +17,7 @@
  1 file changed, 15 insertions(+), 5 deletions(-)
 
 diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
-index dca0a4692f08..6df15fd445e6 100644
+index 776d59c32bc5..cef80e930db9 100644
 --- a/drivers/usb/host/xhci.c
 +++ b/drivers/usb/host/xhci.c
 @@ -665,6 +665,15 @@ int xhci_run(struct usb_hcd *hcd)
diff --git a/openpower/linux/linux-0003-xhci-do-not-halt-the-secondary-HCD.patch b/openpower/linux/linux-0003-xhci-do-not-halt-the-secondary-HCD.patch
index cee39dd..3c6657a 100644
--- a/openpower/linux/linux-0003-xhci-do-not-halt-the-secondary-HCD.patch
+++ b/openpower/linux/linux-0003-xhci-do-not-halt-the-secondary-HCD.patch
@@ -1,7 +1,7 @@
-From 11e2befd6a0f7f5d6d01b3f48b8129089ca930d4 Mon Sep 17 00:00:00 2001
+From ca2c088493b9c02f33934d6c6dfb327b6dac3bd0 Mon Sep 17 00:00:00 2001
 From: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>
 Date: Mon, 10 Mar 2014 13:02:13 -0300
-Subject: [PATCH 3/5] xhci: do not halt the secondary HCD
+Subject: [PATCH 3/7] xhci: do not halt the secondary HCD
 
 We can't halt the secondary HCD, because it's also the primary HCD,
 which will cause problems if we have devices attached to the primary
@@ -14,7 +14,7 @@
  1 file changed, 12 insertions(+), 1 deletion(-)
 
 diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
-index 6df15fd445e6..478b4fd3d182 100644
+index cef80e930db9..90f48eb32d93 100644
 --- a/drivers/usb/host/xhci.c
 +++ b/drivers/usb/host/xhci.c
 @@ -670,7 +670,18 @@ static void xhci_only_stop_hcd(struct usb_hcd *hcd)
diff --git a/openpower/linux/linux-0004-drivers-drm-ast-Switch-SCU-to-VGA-output-on-POST.patch b/openpower/linux/linux-0004-drivers-drm-ast-Switch-SCU-to-VGA-output-on-POST.patch
new file mode 100644
index 0000000..311f35b
--- /dev/null
+++ b/openpower/linux/linux-0004-drivers-drm-ast-Switch-SCU-to-VGA-output-on-POST.patch
@@ -0,0 +1,72 @@
+From c530d7ca1a5e8645b8a8a9496131ff9b6b896450 Mon Sep 17 00:00:00 2001
+From: Jeremy Kerr <jk@ozlabs.org>
+Date: Wed, 2 Mar 2016 11:25:47 +0800
+Subject: [PATCH 4/7] drivers/drm/ast: Switch SCU to VGA output on POST
+
+On AST BMC platforms, the BMC may be using the VGA device for UART
+mirroring. In this case, we need to switch the DAC output to
+VGA mode.
+
+Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
+Signed-off-by: Joel Stanley <joel@jms.id.au>
+---
+ drivers/gpu/drm/ast/ast_post.c | 32 ++++++++++++++++++++++++++++++++
+ 1 file changed, 32 insertions(+)
+
+diff --git a/drivers/gpu/drm/ast/ast_post.c b/drivers/gpu/drm/ast/ast_post.c
+index 810c51d92b99..703dba2ba84b 100644
+--- a/drivers/gpu/drm/ast/ast_post.c
++++ b/drivers/gpu/drm/ast/ast_post.c
+@@ -32,6 +32,7 @@
+ #include "ast_dram_tables.h"
+ 
+ static void ast_init_dram_2300(struct drm_device *dev);
++static void ast_init_output_control(struct drm_device *dev);
+ 
+ void ast_enable_vga(struct drm_device *dev)
+ {
+@@ -384,6 +385,9 @@ void ast_post_gpu(struct drm_device *dev)
+ 	else
+ 		ast_init_dram_reg(dev);
+ 
++	if (ast->chip == AST2400)
++		ast_init_output_control(dev);
++
+ 	ast_init_3rdtx(dev);
+ }
+ 
+@@ -1655,3 +1659,31 @@ static void ast_init_dram_2300(struct drm_device *dev)
+ 	} while ((reg & 0x40) == 0);
+ }
+ 
++static void ast_init_output_control(struct drm_device *dev)
++{
++	struct ast_private *ast = dev->dev_private;
++	const uint32_t scu_addr = 0x1e6e2000;
++	const uint32_t scu_key = 0x1688a8a8;
++	uint32_t val;
++
++	/* unlock write access to SCUs */
++	val = ast_mindwm(ast, scu_addr);
++	ast_moutdwm(ast, scu_addr, scu_key);
++
++	/* configure SCU2C with the appropriate video output mode */
++	val = ast_mindwm(ast, scu_addr | 0x2c);
++
++	switch (ast->tx_chip_type) {
++	case AST_TX_SIL164:
++	case AST_TX_DP501:
++		/* Enable DVO output */
++		val &= ~0x40000;
++		break;
++	default:
++		/* VGA only: enable DAC output */
++		val &= ~0x30000;
++		break;
++	}
++
++	ast_moutdwm(ast, scu_addr | 0x2c, val);
++}
+-- 
+2.7.0
+
diff --git a/openpower/linux/linux-0004-powerpc-eeh-Fix-PE-location-code.patch b/openpower/linux/linux-0004-powerpc-eeh-Fix-PE-location-code.patch
deleted file mode 100644
index 79bd3ef..0000000
--- a/openpower/linux/linux-0004-powerpc-eeh-Fix-PE-location-code.patch
+++ /dev/null
@@ -1,75 +0,0 @@
-From c82da6da37a975fb2b8d07723b76be3b339b5291 Mon Sep 17 00:00:00 2001
-From: Gavin Shan <gwshan@linux.vnet.ibm.com>
-Date: Thu, 28 Jan 2016 16:18:37 +1100
-Subject: [PATCH 4/5] powerpc/eeh: Fix PE location code
-
-In eeh_pe_loc_get(), the PE location code is retrieved from the
-"ibm,loc-code" property of the device node for the bridge of the
-PE's primary bus. It's not correct because the property indicates
-the parent PE's location code.
-
-This reads the correct PE location code from "ibm,io-base-loc-code"
-or "ibm,slot-location-code" property of PE parent bus's device node.
-
-Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
-Signed-off-by: Sam Mendoza-Jonas <sam@mendozajonas.com>
-Signed-off-by: Joel Stanley <joel@jms.id.au>
----
- arch/powerpc/kernel/eeh_pe.c | 33 +++++++++++++++------------------
- 1 file changed, 15 insertions(+), 18 deletions(-)
-
-diff --git a/arch/powerpc/kernel/eeh_pe.c b/arch/powerpc/kernel/eeh_pe.c
-index 8654cb166c19..ca9e5371930e 100644
---- a/arch/powerpc/kernel/eeh_pe.c
-+++ b/arch/powerpc/kernel/eeh_pe.c
-@@ -883,32 +883,29 @@ void eeh_pe_restore_bars(struct eeh_pe *pe)
- const char *eeh_pe_loc_get(struct eeh_pe *pe)
- {
- 	struct pci_bus *bus = eeh_pe_bus_get(pe);
--	struct device_node *dn = pci_bus_to_OF_node(bus);
-+	struct device_node *dn;
- 	const char *loc = NULL;
- 
--	if (!dn)
--		goto out;
-+	while (bus) {
-+		dn = pci_bus_to_OF_node(bus);
-+		if (!dn) {
-+			bus = bus->parent;
-+			continue;
-+		}
- 
--	/* PHB PE or root PE ? */
--	if (pci_is_root_bus(bus)) {
--		loc = of_get_property(dn, "ibm,loc-code", NULL);
--		if (!loc)
-+		if (pci_is_root_bus(bus))
- 			loc = of_get_property(dn, "ibm,io-base-loc-code", NULL);
-+		else
-+			loc = of_get_property(dn, "ibm,slot-location-code",
-+					      NULL);
-+
- 		if (loc)
--			goto out;
-+			return loc;
- 
--		/* Check the root port */
--		dn = dn->child;
--		if (!dn)
--			goto out;
-+		bus = bus->parent;
- 	}
- 
--	loc = of_get_property(dn, "ibm,loc-code", NULL);
--	if (!loc)
--		loc = of_get_property(dn, "ibm,slot-location-code", NULL);
--
--out:
--	return loc ? loc : "N/A";
-+	return "N/A";
- }
- 
- /**
--- 
-2.7.0
-
diff --git a/openpower/linux/linux-0005-Release-4.4.2-openpower1.patch b/openpower/linux/linux-0005-Release-4.4.2-openpower1.patch
deleted file mode 100644
index 5039fc3..0000000
--- a/openpower/linux/linux-0005-Release-4.4.2-openpower1.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From efc2650479967c72bca3d6e128ac774a3be22bf7 Mon Sep 17 00:00:00 2001
-From: Joel Stanley <joel@jms.id.au>
-Date: Tue, 20 Oct 2015 15:01:06 +1030
-Subject: [PATCH 5/5] Release 4.4.2-openpower1
-
-Signed-off-by: Joel Stanley <joel@jms.id.au>
----
- Makefile | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/Makefile b/Makefile
-index e7a2958eb771..8b2c855b6f37 100644
---- a/Makefile
-+++ b/Makefile
-@@ -1,7 +1,7 @@
- VERSION = 4
- PATCHLEVEL = 4
- SUBLEVEL = 2
--EXTRAVERSION =
-+EXTRAVERSION = -openpower1
- NAME = Blurry Fish Butt
- 
- # *DOCUMENTATION*
--- 
-2.7.0
-
diff --git a/openpower/linux/linux-0005-scsi-ignore-errors-from-scsi_dh_add_device.patch b/openpower/linux/linux-0005-scsi-ignore-errors-from-scsi_dh_add_device.patch
new file mode 100644
index 0000000..03e8664
--- /dev/null
+++ b/openpower/linux/linux-0005-scsi-ignore-errors-from-scsi_dh_add_device.patch
@@ -0,0 +1,42 @@
+From db2e8cc68f99b3c8f7fe01600ed62450dd7bd12e Mon Sep 17 00:00:00 2001
+From: Hannes Reinecke <hare@suse.de>
+Date: Tue, 1 Mar 2016 13:57:59 +1100
+Subject: [PATCH 5/7] scsi: ignore errors from scsi_dh_add_device()
+
+device handler initialisation might fail due to a number of
+reasons. But as device_handlers are optional this shouldn't
+cause us to disable the device entirely.
+So just ignore errors from scsi_dh_add_device().
+
+Reviewed-by: Johannes Thumshirn <jthumshirn@suse.com>
+Reviewed-by: Christoph Hellwig <hch@lst.de>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Joel Stanley <joel@jms.id.au>
+---
+ drivers/scsi/scsi_sysfs.c | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
+index c8115b4fe474..750df9b9b11c 100644
+--- a/drivers/scsi/scsi_sysfs.c
++++ b/drivers/scsi/scsi_sysfs.c
+@@ -1058,11 +1058,12 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev)
+ 	}
+ 
+ 	error = scsi_dh_add_device(sdev);
+-	if (error) {
++	if (error)
++		/*
++		 * device_handler is optional, so any error can be ignored
++		 */
+ 		sdev_printk(KERN_INFO, sdev,
+ 				"failed to add device handler: %d\n", error);
+-		return error;
+-	}
+ 
+ 	device_enable_async_suspend(&sdev->sdev_dev);
+ 	error = device_add(&sdev->sdev_dev);
+-- 
+2.7.0
+
diff --git a/openpower/linux/linux-0006-net-mlx4_core-Set-UAR-page-size-to-4KB-regardless-of.patch b/openpower/linux/linux-0006-net-mlx4_core-Set-UAR-page-size-to-4KB-regardless-of.patch
new file mode 100644
index 0000000..9fb0097
--- /dev/null
+++ b/openpower/linux/linux-0006-net-mlx4_core-Set-UAR-page-size-to-4KB-regardless-of.patch
@@ -0,0 +1,299 @@
+From c8c04de128263a3122517a70935e60aed357b1be Mon Sep 17 00:00:00 2001
+From: Huy Nguyen <huyn@mellanox.com>
+Date: Wed, 17 Feb 2016 17:24:26 +0200
+Subject: [PATCH 6/7] net/mlx4_core: Set UAR page size to 4KB regardless of
+ system page size
+
+problem description:
+
+The current code sets UAR page size equal to system page size.
+The ConnectX-3 and ConnectX-3 Pro HWs require minimum 128 UAR pages.
+The mlx4 kernel drivers are not loaded if there is less than 128 UAR pages.
+
+solution:
+
+Always set UAR page to 4KB. This allows more UAR pages if the OS
+has PAGE_SIZE larger than 4KB. For example, PowerPC kernel use 64KB
+system page size, with 4MB uar region, there are 4MB/2/64KB = 32
+uars (half for uar, half for blueflame). This does not meet minimum 128
+UAR pages requirement. With 4KB UAR page, there are 4MB/2/4KB = 512 uars
+which meet the minimum requirement.
+
+Note that only codes in mlx4_core that deal with firmware know that uar
+page size is 4KB. Codes that deal with usr page in cq and qp context
+(mlx4_ib, mlx4_en and part of mlx4_core) still have the same assumption
+that uar page size equals to system page size.
+
+Note that with this implementation, on 64KB system page size kernel, there
+are 16 uars per system page but only one uars is used. The other 15
+uars are ignored because of the above assumption.
+
+Regarding SR-IOV, mlx4_core in hypervisor will set the uar page size
+to 4KB and mlx4_core code in virtual OS will obtain the uar page size from
+firmware.
+
+Regarding backward compatibility in SR-IOV, if hypervisor has this new code,
+the virtual OS must be updated. If hypervisor has old code, and the virtual
+OS has this new code, the new code will be backward compatible with the
+old code. If the uar size is big enough, this new code in VF continues to
+work with 64 KB uar page size (on PowerPc kernel). If the uar size does not
+meet 128 uars requirement, this new code not loaded in VF and print the same
+error message as the old code in Hypervisor.
+
+Signed-off-by: Huy Nguyen <huyn@mellanox.com>
+Reviewed-by: Yishai Hadas <yishaih@mellanox.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+(cherry picked from commit 85743f1eb34548ba4b056d2f184a3d107a3b8917)
+Signed-off-by: Joel Stanley <joel@jms.id.au>
+---
+ drivers/infiniband/hw/mlx4/qp.c                   |  7 ++-
+ drivers/net/ethernet/mellanox/mlx4/cq.c           |  4 +-
+ drivers/net/ethernet/mellanox/mlx4/en_resources.c |  3 +-
+ drivers/net/ethernet/mellanox/mlx4/en_tx.c        |  4 +-
+ drivers/net/ethernet/mellanox/mlx4/eq.c           |  7 +--
+ drivers/net/ethernet/mellanox/mlx4/main.c         | 56 ++++++++++++++++++-----
+ drivers/net/ethernet/mellanox/mlx4/pd.c           | 12 +++--
+ include/linux/mlx4/device.h                       | 13 ++++++
+ 8 files changed, 84 insertions(+), 22 deletions(-)
+
+diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
+index 13eaaf45288f..c981fba11da8 100644
+--- a/drivers/infiniband/hw/mlx4/qp.c
++++ b/drivers/infiniband/hw/mlx4/qp.c
+@@ -1591,9 +1591,12 @@ static int __mlx4_ib_modify_qp(struct ib_qp *ibqp,
+ 	}
+ 
+ 	if (qp->ibqp.uobject)
+-		context->usr_page = cpu_to_be32(to_mucontext(ibqp->uobject->context)->uar.index);
++		context->usr_page = cpu_to_be32(
++			mlx4_to_hw_uar_index(dev->dev,
++					     to_mucontext(ibqp->uobject->context)->uar.index));
+ 	else
+-		context->usr_page = cpu_to_be32(dev->priv_uar.index);
++		context->usr_page = cpu_to_be32(
++			mlx4_to_hw_uar_index(dev->dev, dev->priv_uar.index));
+ 
+ 	if (attr_mask & IB_QP_DEST_QPN)
+ 		context->remote_qpn = cpu_to_be32(attr->dest_qp_num);
+diff --git a/drivers/net/ethernet/mellanox/mlx4/cq.c b/drivers/net/ethernet/mellanox/mlx4/cq.c
+index 3348e646db70..a849da92f857 100644
+--- a/drivers/net/ethernet/mellanox/mlx4/cq.c
++++ b/drivers/net/ethernet/mellanox/mlx4/cq.c
+@@ -318,7 +318,9 @@ int mlx4_cq_alloc(struct mlx4_dev *dev, int nent,
+ 	if (timestamp_en)
+ 		cq_context->flags  |= cpu_to_be32(1 << 19);
+ 
+-	cq_context->logsize_usrpage = cpu_to_be32((ilog2(nent) << 24) | uar->index);
++	cq_context->logsize_usrpage =
++		cpu_to_be32((ilog2(nent) << 24) |
++			    mlx4_to_hw_uar_index(dev, uar->index));
+ 	cq_context->comp_eqn	    = priv->eq_table.eq[MLX4_CQ_TO_EQ_VECTOR(vector)].eqn;
+ 	cq_context->log_page_size   = mtt->page_shift - MLX4_ICM_PAGE_SHIFT;
+ 
+diff --git a/drivers/net/ethernet/mellanox/mlx4/en_resources.c b/drivers/net/ethernet/mellanox/mlx4/en_resources.c
+index 12aab5a659d3..02e925d6f734 100644
+--- a/drivers/net/ethernet/mellanox/mlx4/en_resources.c
++++ b/drivers/net/ethernet/mellanox/mlx4/en_resources.c
+@@ -58,7 +58,8 @@ void mlx4_en_fill_qp_context(struct mlx4_en_priv *priv, int size, int stride,
+ 	} else {
+ 		context->sq_size_stride = ilog2(TXBB_SIZE) - 4;
+ 	}
+-	context->usr_page = cpu_to_be32(mdev->priv_uar.index);
++	context->usr_page = cpu_to_be32(mlx4_to_hw_uar_index(mdev->dev,
++					mdev->priv_uar.index));
+ 	context->local_qpn = cpu_to_be32(qpn);
+ 	context->pri_path.ackto = 1 & 0x07;
+ 	context->pri_path.sched_queue = 0x83 | (priv->port - 1) << 6;
+diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
+index 4421bf5463f6..e0946ab22010 100644
+--- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c
++++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
+@@ -213,7 +213,9 @@ int mlx4_en_activate_tx_ring(struct mlx4_en_priv *priv,
+ 	mlx4_en_fill_qp_context(priv, ring->size, ring->stride, 1, 0, ring->qpn,
+ 				ring->cqn, user_prio, &ring->context);
+ 	if (ring->bf_alloced)
+-		ring->context.usr_page = cpu_to_be32(ring->bf.uar->index);
++		ring->context.usr_page =
++			cpu_to_be32(mlx4_to_hw_uar_index(mdev->dev,
++							 ring->bf.uar->index));
+ 
+ 	err = mlx4_qp_to_ready(mdev->dev, &ring->wqres.mtt, &ring->context,
+ 			       &ring->qp, &ring->qp_state);
+diff --git a/drivers/net/ethernet/mellanox/mlx4/eq.c b/drivers/net/ethernet/mellanox/mlx4/eq.c
+index 603d1c3d3b2e..ad6240e45441 100644
+--- a/drivers/net/ethernet/mellanox/mlx4/eq.c
++++ b/drivers/net/ethernet/mellanox/mlx4/eq.c
+@@ -924,9 +924,10 @@ static void __iomem *mlx4_get_eq_uar(struct mlx4_dev *dev, struct mlx4_eq *eq)
+ 
+ 	if (!priv->eq_table.uar_map[index]) {
+ 		priv->eq_table.uar_map[index] =
+-			ioremap(pci_resource_start(dev->persist->pdev, 2) +
+-				((eq->eqn / 4) << PAGE_SHIFT),
+-				PAGE_SIZE);
++			ioremap(
++				pci_resource_start(dev->persist->pdev, 2) +
++				((eq->eqn / 4) << (dev->uar_page_shift)),
++				(1 << (dev->uar_page_shift)));
+ 		if (!priv->eq_table.uar_map[index]) {
+ 			mlx4_err(dev, "Couldn't map EQ doorbell for EQN 0x%06x\n",
+ 				 eq->eqn);
+diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
+index 31c491e02e69..225551150442 100644
+--- a/drivers/net/ethernet/mellanox/mlx4/main.c
++++ b/drivers/net/ethernet/mellanox/mlx4/main.c
+@@ -168,6 +168,20 @@ struct mlx4_port_config {
+ 
+ static atomic_t pf_loading = ATOMIC_INIT(0);
+ 
++static inline void mlx4_set_num_reserved_uars(struct mlx4_dev *dev,
++					      struct mlx4_dev_cap *dev_cap)
++{
++	/* The reserved_uars is calculated by system page size unit.
++	 * Therefore, adjustment is added when the uar page size is less
++	 * than the system page size
++	 */
++	dev->caps.reserved_uars	=
++		max_t(int,
++		      mlx4_get_num_reserved_uar(dev),
++		      dev_cap->reserved_uars /
++			(1 << (PAGE_SHIFT - dev->uar_page_shift)));
++}
++
+ int mlx4_check_port_params(struct mlx4_dev *dev,
+ 			   enum mlx4_port_type *port_type)
+ {
+@@ -386,8 +400,6 @@ static int mlx4_dev_cap(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap)
+ 	dev->caps.reserved_mtts      = dev_cap->reserved_mtts;
+ 	dev->caps.reserved_mrws	     = dev_cap->reserved_mrws;
+ 
+-	/* The first 128 UARs are used for EQ doorbells */
+-	dev->caps.reserved_uars	     = max_t(int, 128, dev_cap->reserved_uars);
+ 	dev->caps.reserved_pds	     = dev_cap->reserved_pds;
+ 	dev->caps.reserved_xrcds     = (dev->caps.flags & MLX4_DEV_CAP_FLAG_XRC) ?
+ 					dev_cap->reserved_xrcds : 0;
+@@ -405,6 +417,15 @@ static int mlx4_dev_cap(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap)
+ 	dev->caps.max_gso_sz	     = dev_cap->max_gso_sz;
+ 	dev->caps.max_rss_tbl_sz     = dev_cap->max_rss_tbl_sz;
+ 
++	/* Save uar page shift */
++	if (!mlx4_is_slave(dev)) {
++		/* Virtual PCI function needs to determine UAR page size from
++		 * firmware. Only master PCI function can set the uar page size
++		 */
++		dev->uar_page_shift = DEFAULT_UAR_PAGE_SHIFT;
++		mlx4_set_num_reserved_uars(dev, dev_cap);
++	}
++
+ 	if (dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_PHV_EN) {
+ 		struct mlx4_init_hca_param hca_param;
+ 
+@@ -815,16 +836,25 @@ static int mlx4_slave_cap(struct mlx4_dev *dev)
+ 		return -ENODEV;
+ 	}
+ 
+-	/* slave gets uar page size from QUERY_HCA fw command */
+-	dev->caps.uar_page_size = 1 << (hca_param.uar_page_sz + 12);
++	/* Set uar_page_shift for VF */
++	dev->uar_page_shift = hca_param.uar_page_sz + 12;
+ 
+-	/* TODO: relax this assumption */
+-	if (dev->caps.uar_page_size != PAGE_SIZE) {
+-		mlx4_err(dev, "UAR size:%d != kernel PAGE_SIZE of %ld\n",
+-			 dev->caps.uar_page_size, PAGE_SIZE);
+-		return -ENODEV;
++	/* Make sure the master uar page size is valid */
++	if (dev->uar_page_shift > PAGE_SHIFT) {
++		mlx4_err(dev,
++			 "Invalid configuration: uar page size is larger than system page size\n");
++		return  -ENODEV;
+ 	}
+ 
++	/* Set reserved_uars based on the uar_page_shift */
++	mlx4_set_num_reserved_uars(dev, &dev_cap);
++
++	/* Although uar page size in FW differs from system page size,
++	 * upper software layers (mlx4_ib, mlx4_en and part of mlx4_core)
++	 * still works with assumption that uar page size == system page size
++	 */
++	dev->caps.uar_page_size = PAGE_SIZE;
++
+ 	memset(&func_cap, 0, sizeof(func_cap));
+ 	err = mlx4_QUERY_FUNC_CAP(dev, 0, &func_cap);
+ 	if (err) {
+@@ -2092,8 +2122,12 @@ static int mlx4_init_hca(struct mlx4_dev *dev)
+ 
+ 		dev->caps.max_fmr_maps = (1 << (32 - ilog2(dev->caps.num_mpts))) - 1;
+ 
+-		init_hca.log_uar_sz = ilog2(dev->caps.num_uars);
+-		init_hca.uar_page_sz = PAGE_SHIFT - 12;
++		/* Always set UAR page size 4KB, set log_uar_sz accordingly */
++		init_hca.log_uar_sz = ilog2(dev->caps.num_uars) +
++				      PAGE_SHIFT -
++				      DEFAULT_UAR_PAGE_SHIFT;
++		init_hca.uar_page_sz = DEFAULT_UAR_PAGE_SHIFT - 12;
++
+ 		init_hca.mw_enabled = 0;
+ 		if (dev->caps.flags & MLX4_DEV_CAP_FLAG_MEM_WINDOW ||
+ 		    dev->caps.bmme_flags & MLX4_BMME_FLAG_TYPE_2_WIN)
+diff --git a/drivers/net/ethernet/mellanox/mlx4/pd.c b/drivers/net/ethernet/mellanox/mlx4/pd.c
+index 609c59dc854e..b3cc3ab63799 100644
+--- a/drivers/net/ethernet/mellanox/mlx4/pd.c
++++ b/drivers/net/ethernet/mellanox/mlx4/pd.c
+@@ -269,9 +269,15 @@ EXPORT_SYMBOL_GPL(mlx4_bf_free);
+ 
+ int mlx4_init_uar_table(struct mlx4_dev *dev)
+ {
+-	if (dev->caps.num_uars <= 128) {
+-		mlx4_err(dev, "Only %d UAR pages (need more than 128)\n",
+-			 dev->caps.num_uars);
++	int num_reserved_uar = mlx4_get_num_reserved_uar(dev);
++
++	mlx4_dbg(dev, "uar_page_shift = %d", dev->uar_page_shift);
++	mlx4_dbg(dev, "Effective reserved_uars=%d", dev->caps.reserved_uars);
++
++	if (dev->caps.num_uars <= num_reserved_uar) {
++		mlx4_err(
++			dev, "Only %d UAR pages (need more than %d)\n",
++			dev->caps.num_uars, num_reserved_uar);
+ 		mlx4_err(dev, "Increase firmware log2_uar_bar_megabytes?\n");
+ 		return -ENODEV;
+ 	}
+diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
+index d3133be12d92..8bab38f8872a 100644
+--- a/include/linux/mlx4/device.h
++++ b/include/linux/mlx4/device.h
+@@ -44,6 +44,8 @@
+ 
+ #include <linux/timecounter.h>
+ 
++#define DEFAULT_UAR_PAGE_SHIFT  12
++
+ #define MAX_MSIX_P_PORT		17
+ #define MAX_MSIX		64
+ #define MIN_MSIX_P_PORT		5
+@@ -853,6 +855,7 @@ struct mlx4_dev {
+ 	u64			regid_promisc_array[MLX4_MAX_PORTS + 1];
+ 	u64			regid_allmulti_array[MLX4_MAX_PORTS + 1];
+ 	struct mlx4_vf_dev     *dev_vfs;
++	u8  uar_page_shift;
+ };
+ 
+ struct mlx4_clock_params {
+@@ -1527,4 +1530,14 @@ int mlx4_ACCESS_PTYS_REG(struct mlx4_dev *dev,
+ int mlx4_get_internal_clock_params(struct mlx4_dev *dev,
+ 				   struct mlx4_clock_params *params);
+ 
++static inline int mlx4_to_hw_uar_index(struct mlx4_dev *dev, int index)
++{
++	return (index << (PAGE_SHIFT - dev->uar_page_shift));
++}
++
++static inline int mlx4_get_num_reserved_uar(struct mlx4_dev *dev)
++{
++	/* The first 128 UARs are used for EQ doorbells */
++	return (128 >> (PAGE_SHIFT - dev->uar_page_shift));
++}
+ #endif /* MLX4_DEVICE_H */
+-- 
+2.7.0
+
diff --git a/openpower/linux/linux-0007-Release-4.4.3-openpower2.patch b/openpower/linux/linux-0007-Release-4.4.3-openpower2.patch
new file mode 100644
index 0000000..c9f7628
--- /dev/null
+++ b/openpower/linux/linux-0007-Release-4.4.3-openpower2.patch
@@ -0,0 +1,30 @@
+From b7817dfcac99fc23993be54fe1a6fbbe3416bc79 Mon Sep 17 00:00:00 2001
+From: Joel Stanley <joel@jms.id.au>
+Date: Tue, 20 Oct 2015 15:01:06 +1030
+Subject: [PATCH 7/7] Release 4.4.3-openpower2
+
+ - ast: Switch SCU to VGA output on POST
+ - scsi: ignore errors from scsi_dh_add_device()
+ - mlx4: Set UAR page size to 4KB regardless of system page size
+
+Signed-off-by: Joel Stanley <joel@jms.id.au>
+---
+ Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makefile b/Makefile
+index 802be10c40c5..898d37d2de72 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,7 +1,7 @@
+ VERSION = 4
+ PATCHLEVEL = 4
+ SUBLEVEL = 3
+-EXTRAVERSION =
++EXTRAVERSION = -openpower2
+ NAME = Blurry Fish Butt
+ 
+ # *DOCUMENTATION*
+-- 
+2.7.0
+