Move to Linux v5.1.15-openpower1 and buildroot 2019.02.3

This updates to a in-support stable Linux release, resolving potential
security and stability issues.

Buildroot stays on the same major version with the .2 and .3 stable
releases added in.

The skiroot defconfig is updated to ensure we still run the MMU in Radix
mode (see http://git.kernel.org/torvalds/c/8adddf349fda0). It also
disables xmon by default.

Signed-off-by: Joel Stanley <joel@jms.id.au>
diff --git a/openpower/configs/barreleye_defconfig b/openpower/configs/barreleye_defconfig
index 6bad11b..9a8469e 100644
--- a/openpower/configs/barreleye_defconfig
+++ b/openpower/configs/barreleye_defconfig
@@ -16,7 +16,7 @@
 BR2_ROOTFS_POST_BUILD_SCRIPT="../openpower/scripts/fixup-target-var ../openpower/scripts/firmware-whitelist"
 BR2_LINUX_KERNEL=y
 BR2_LINUX_KERNEL_CUSTOM_VERSION=y
-BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.0.7"
+BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.1.15"
 BR2_LINUX_KERNEL_PATCH="$(BR2_EXTERNAL_OP_BUILD_PATH)/linux"
 BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
 BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_OP_BUILD_PATH)/configs/linux/skiroot_defconfig"
diff --git a/openpower/configs/firenze_defconfig b/openpower/configs/firenze_defconfig
index 3466db7..290c623 100644
--- a/openpower/configs/firenze_defconfig
+++ b/openpower/configs/firenze_defconfig
@@ -14,7 +14,7 @@
 BR2_ROOTFS_POST_BUILD_SCRIPT="../openpower/scripts/fixup-target-var ../openpower/scripts/firmware-whitelist"
 BR2_LINUX_KERNEL=y
 BR2_LINUX_KERNEL_CUSTOM_VERSION=y
-BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.0.7"
+BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.1.15"
 BR2_LINUX_KERNEL_PATCH="$(BR2_EXTERNAL_OP_BUILD_PATH)/linux"
 BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
 BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_OP_BUILD_PATH)/configs/linux/skiroot_defconfig"
diff --git a/openpower/configs/firestone_defconfig b/openpower/configs/firestone_defconfig
index c81935e..3350b08 100644
--- a/openpower/configs/firestone_defconfig
+++ b/openpower/configs/firestone_defconfig
@@ -16,7 +16,7 @@
 BR2_ROOTFS_POST_BUILD_SCRIPT="../openpower/scripts/fixup-target-var ../openpower/scripts/firmware-whitelist"
 BR2_LINUX_KERNEL=y
 BR2_LINUX_KERNEL_CUSTOM_VERSION=y
-BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.0.7"
+BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.1.15"
 BR2_LINUX_KERNEL_PATCH="$(BR2_EXTERNAL_OP_BUILD_PATH)/linux"
 BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
 BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_OP_BUILD_PATH)/configs/linux/skiroot_defconfig"
diff --git a/openpower/configs/garrison_defconfig b/openpower/configs/garrison_defconfig
index f15ea2c..53a52be 100644
--- a/openpower/configs/garrison_defconfig
+++ b/openpower/configs/garrison_defconfig
@@ -16,7 +16,7 @@
 BR2_ROOTFS_POST_BUILD_SCRIPT="../openpower/scripts/fixup-target-var ../openpower/scripts/firmware-whitelist"
 BR2_LINUX_KERNEL=y
 BR2_LINUX_KERNEL_CUSTOM_VERSION=y
-BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.0.7"
+BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.1.15"
 BR2_LINUX_KERNEL_PATCH="$(BR2_EXTERNAL_OP_BUILD_PATH)/linux"
 BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
 BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_OP_BUILD_PATH)/configs/linux/skiroot_defconfig"
diff --git a/openpower/configs/habanero_defconfig b/openpower/configs/habanero_defconfig
index 629890f..b0cd6b5 100644
--- a/openpower/configs/habanero_defconfig
+++ b/openpower/configs/habanero_defconfig
@@ -16,7 +16,7 @@
 BR2_ROOTFS_POST_BUILD_SCRIPT="../openpower/scripts/fixup-target-var ../openpower/scripts/firmware-whitelist"
 BR2_LINUX_KERNEL=y
 BR2_LINUX_KERNEL_CUSTOM_VERSION=y
-BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.0.7"
+BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.1.15"
 BR2_LINUX_KERNEL_PATCH="$(BR2_EXTERNAL_OP_BUILD_PATH)/linux"
 BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
 BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_OP_BUILD_PATH)/configs/linux/skiroot_defconfig"
diff --git a/openpower/configs/linux/skiroot_defconfig b/openpower/configs/linux/skiroot_defconfig
index 51d6ed2..054789d 100644
--- a/openpower/configs/linux/skiroot_defconfig
+++ b/openpower/configs/linux/skiroot_defconfig
@@ -30,6 +30,7 @@
 # CONFIG_COMPAT_BRK is not set
 CONFIG_SLAB_FREELIST_HARDENED=y
 CONFIG_JUMP_LABEL=y
+CONFIG_STRICT_KERNEL_RWX=y
 CONFIG_MODULES=y
 CONFIG_MODULE_UNLOAD=y
 CONFIG_MODULE_SIG=y
@@ -267,6 +268,7 @@
 CONFIG_MSDOS_FS=m
 CONFIG_VFAT_FS=m
 CONFIG_PROC_KCORE=y
+CONFIG_HUGETLBFS=y
 # CONFIG_MISC_FILESYSTEMS is not set
 # CONFIG_NETWORK_FILESYSTEMS is not set
 CONFIG_NLS=y
@@ -295,7 +297,6 @@
 # CONFIG_FTRACE is not set
 # CONFIG_RUNTIME_TESTING_MENU is not set
 CONFIG_XMON=y
-CONFIG_XMON_DEFAULT=y
 CONFIG_ENCRYPTED_KEYS=y
 # CONFIG_CRYPTO_ECHAINIV is not set
 # CONFIG_CRYPTO_HW is not set
diff --git a/openpower/configs/opal_defconfig b/openpower/configs/opal_defconfig
index ecbd209..73d6128 100644
--- a/openpower/configs/opal_defconfig
+++ b/openpower/configs/opal_defconfig
@@ -12,7 +12,7 @@
 BR2_ROOTFS_POST_BUILD_SCRIPT="../openpower/scripts/fixup-target-var ../openpower/scripts/firmware-whitelist"
 BR2_LINUX_KERNEL=y
 BR2_LINUX_KERNEL_CUSTOM_VERSION=y
-BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.0.7"
+BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.1.15"
 BR2_LINUX_KERNEL_PATCH="$(BR2_EXTERNAL_OP_BUILD_PATH)/linux"
 BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
 BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_OP_BUILD_PATH)/configs/linux/skiroot_defconfig"
diff --git a/openpower/configs/p8dtu_defconfig b/openpower/configs/p8dtu_defconfig
index 4d88124..22b1348 100644
--- a/openpower/configs/p8dtu_defconfig
+++ b/openpower/configs/p8dtu_defconfig
@@ -17,7 +17,7 @@
 BR2_ROOTFS_POST_BUILD_SCRIPT="../openpower/scripts/fixup-target-var ../openpower/scripts/firmware-whitelist"
 BR2_LINUX_KERNEL=y
 BR2_LINUX_KERNEL_CUSTOM_VERSION=y
-BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.0.7"
+BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.1.15"
 BR2_LINUX_KERNEL_PATCH="$(BR2_EXTERNAL_OP_BUILD_PATH)/linux"
 BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
 BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_OP_BUILD_PATH)/configs/linux/skiroot_defconfig"
diff --git a/openpower/configs/p9dsu_defconfig b/openpower/configs/p9dsu_defconfig
index b81830c..7098561 100644
--- a/openpower/configs/p9dsu_defconfig
+++ b/openpower/configs/p9dsu_defconfig
@@ -16,7 +16,7 @@
 BR2_ROOTFS_POST_BUILD_SCRIPT="../openpower/scripts/fixup-target-var ../openpower/scripts/firmware-whitelist"
 BR2_LINUX_KERNEL=y
 BR2_LINUX_KERNEL_CUSTOM_VERSION=y
-BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.0.7"
+BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.1.15"
 BR2_LINUX_KERNEL_PATCH="$(BR2_EXTERNAL_OP_BUILD_PATH)/linux"
 BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
 BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_OP_BUILD_PATH)/configs/linux/skiroot_defconfig"
diff --git a/openpower/configs/palmetto_defconfig b/openpower/configs/palmetto_defconfig
index 8ef70db..917ec9a 100644
--- a/openpower/configs/palmetto_defconfig
+++ b/openpower/configs/palmetto_defconfig
@@ -14,7 +14,7 @@
 BR2_ROOTFS_POST_BUILD_SCRIPT="../openpower/scripts/fixup-target-var ../openpower/scripts/firmware-whitelist"
 BR2_LINUX_KERNEL=y
 BR2_LINUX_KERNEL_CUSTOM_VERSION=y
-BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.0.7"
+BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.1.15"
 BR2_LINUX_KERNEL_PATCH="$(BR2_EXTERNAL_OP_BUILD_PATH)/linux"
 BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
 BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_OP_BUILD_PATH)/configs/linux/skiroot_defconfig"
diff --git a/openpower/configs/pseries_defconfig b/openpower/configs/pseries_defconfig
index 882f872..5a75bc4 100644
--- a/openpower/configs/pseries_defconfig
+++ b/openpower/configs/pseries_defconfig
@@ -15,7 +15,7 @@
 BR2_ROOTFS_POST_BUILD_SCRIPT="../openpower/scripts/fixup-target-var ../openpower/scripts/firmware-whitelist"
 BR2_LINUX_KERNEL=y
 BR2_LINUX_KERNEL_CUSTOM_VERSION=y
-BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.0.7"
+BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.1.15"
 BR2_LINUX_KERNEL_PATCH="$(BR2_EXTERNAL_OP_BUILD_PATH)/linux"
 BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
 BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_OP_BUILD_PATH)/configs/linux/pseries_skiroot_defconfig"
diff --git a/openpower/configs/romulus_defconfig b/openpower/configs/romulus_defconfig
index 4ff51df..33562aa 100644
--- a/openpower/configs/romulus_defconfig
+++ b/openpower/configs/romulus_defconfig
@@ -16,7 +16,7 @@
 BR2_ROOTFS_POST_BUILD_SCRIPT="../openpower/scripts/fixup-target-var ../openpower/scripts/firmware-whitelist"
 BR2_LINUX_KERNEL=y
 BR2_LINUX_KERNEL_CUSTOM_VERSION=y
-BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.0.7"
+BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.1.15"
 BR2_LINUX_KERNEL_PATCH="$(BR2_EXTERNAL_OP_BUILD_PATH)/linux"
 BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
 BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_OP_BUILD_PATH)/configs/linux/skiroot_defconfig"
diff --git a/openpower/configs/vesnin_defconfig b/openpower/configs/vesnin_defconfig
index 12bf68d..cfda022 100644
--- a/openpower/configs/vesnin_defconfig
+++ b/openpower/configs/vesnin_defconfig
@@ -15,7 +15,7 @@
 BR2_ROOTFS_POST_BUILD_SCRIPT="../openpower/scripts/fixup-target-var ../openpower/scripts/firmware-whitelist"
 BR2_LINUX_KERNEL=y
 BR2_LINUX_KERNEL_CUSTOM_VERSION=y
-BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.0.7"
+BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.1.15"
 BR2_LINUX_KERNEL_PATCH="$(BR2_EXTERNAL_OP_BUILD_PATH)/linux"
 BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
 BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_OP_BUILD_PATH)/configs/linux/skiroot_defconfig"
diff --git a/openpower/configs/witherspoon_defconfig b/openpower/configs/witherspoon_defconfig
index 9d2371a..1d08424 100644
--- a/openpower/configs/witherspoon_defconfig
+++ b/openpower/configs/witherspoon_defconfig
@@ -16,7 +16,7 @@
 BR2_ROOTFS_POST_BUILD_SCRIPT="../openpower/scripts/fixup-target-var ../openpower/scripts/firmware-whitelist"
 BR2_LINUX_KERNEL=y
 BR2_LINUX_KERNEL_CUSTOM_VERSION=y
-BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.0.7"
+BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.1.15"
 BR2_LINUX_KERNEL_PATCH="$(BR2_EXTERNAL_OP_BUILD_PATH)/linux"
 BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
 BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_OP_BUILD_PATH)/configs/linux/skiroot_defconfig"
diff --git a/openpower/configs/zaius_defconfig b/openpower/configs/zaius_defconfig
index d097242..b0dc89b 100644
--- a/openpower/configs/zaius_defconfig
+++ b/openpower/configs/zaius_defconfig
@@ -16,7 +16,7 @@
 BR2_ROOTFS_POST_BUILD_SCRIPT="../openpower/scripts/fixup-target-var ../openpower/scripts/firmware-whitelist"
 BR2_LINUX_KERNEL=y
 BR2_LINUX_KERNEL_CUSTOM_VERSION=y
-BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.0.7"
+BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.1.15"
 BR2_LINUX_KERNEL_PATCH="$(BR2_EXTERNAL_OP_BUILD_PATH)/linux"
 BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
 BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_OP_BUILD_PATH)/configs/linux/skiroot_defconfig"
diff --git a/openpower/configs/zz_defconfig b/openpower/configs/zz_defconfig
index 50e59e0..6c94573 100644
--- a/openpower/configs/zz_defconfig
+++ b/openpower/configs/zz_defconfig
@@ -14,7 +14,7 @@
 BR2_ROOTFS_POST_BUILD_SCRIPT="../openpower/scripts/fixup-target-var ../openpower/scripts/firmware-whitelist"
 BR2_LINUX_KERNEL=y
 BR2_LINUX_KERNEL_CUSTOM_VERSION=y
-BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.0.7"
+BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.1.15"
 BR2_LINUX_KERNEL_PATCH="$(BR2_EXTERNAL_OP_BUILD_PATH)/linux"
 BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
 BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_OP_BUILD_PATH)/configs/linux/skiroot_defconfig"
diff --git a/openpower/linux/0001-xhci-Reset-controller-on-xhci-shutdown.patch b/openpower/linux/0001-xhci-Reset-controller-on-xhci-shutdown.patch
index 0381a06..d25646e 100644
--- a/openpower/linux/0001-xhci-Reset-controller-on-xhci-shutdown.patch
+++ b/openpower/linux/0001-xhci-Reset-controller-on-xhci-shutdown.patch
@@ -1,7 +1,7 @@
 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
 From: Brian King <brking@linux.vnet.ibm.com>
 Date: Wed, 25 Oct 2017 10:42:59 +1100
-Subject: [PATCH 1/3] xhci: Reset controller on xhci shutdown
+Subject: [PATCH 1/2] xhci: Reset controller on xhci shutdown
 
 Fixes kexec boot. Without a hard reset, some USB chips will fail to
 initialize in a kexec booted kernel.
@@ -14,10 +14,10 @@
  1 file changed, 1 insertion(+)
 
 diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
-index 005e65922608..946a826d0d8d 100644
+index f39ca3980e48..bd7011c1ad34 100644
 --- a/drivers/usb/host/xhci.c
 +++ b/drivers/usb/host/xhci.c
-@@ -795,6 +795,7 @@ static void xhci_shutdown(struct usb_hcd *hcd)
+@@ -793,6 +793,7 @@ static void xhci_shutdown(struct usb_hcd *hcd)
  	/* Yet another workaround for spurious wakeups at shutdown with HSW */
  	if (xhci->quirks & XHCI_SPURIOUS_WAKEUP)
  		pci_set_power_state(to_pci_dev(hcd->self.sysdev), PCI_D3hot);
diff --git a/openpower/linux/0003-Release-OpenPower-kernel.patch b/openpower/linux/0002-Release-OpenPower-kernel.patch
similarity index 72%
rename from openpower/linux/0003-Release-OpenPower-kernel.patch
rename to openpower/linux/0002-Release-OpenPower-kernel.patch
index 1deaa86..48feb75 100644
--- a/openpower/linux/0003-Release-OpenPower-kernel.patch
+++ b/openpower/linux/0002-Release-OpenPower-kernel.patch
@@ -1,7 +1,7 @@
 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
 From: Joel Stanley <joel@jms.id.au>
-Date: Mon, 8 Apr 2019 16:42:01 +0930
-Subject: [PATCH 3/3] Release OpenPower kernel
+Date: Tue, 25 Jun 2019 14:32:27 +0930
+Subject: [PATCH 2/2] Release OpenPower kernel
 
 Signed-off-by: Joel Stanley <joel@jms.id.au>
 ---
@@ -9,13 +9,13 @@
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/Makefile b/Makefile
-index af99c77c7066..cd31b792f27c 100644
+index d7b3c8e3ff3e..0b8b4ae447bc 100644
 --- a/Makefile
 +++ b/Makefile
 @@ -2,7 +2,7 @@
  VERSION = 5
- PATCHLEVEL = 0
- SUBLEVEL = 7
+ PATCHLEVEL = 1
+ SUBLEVEL = 15
 -EXTRAVERSION =
 +EXTRAVERSION = -openpower1
  NAME = Shy Crocodile
diff --git a/openpower/linux/0002-block-Revert-v5.0-blk_mq_request_issue_directly-chan.patch b/openpower/linux/0002-block-Revert-v5.0-blk_mq_request_issue_directly-chan.patch
deleted file mode 100644
index 7048c4a..0000000
--- a/openpower/linux/0002-block-Revert-v5.0-blk_mq_request_issue_directly-chan.patch
+++ /dev/null
@@ -1,285 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Bart Van Assche <bvanassche@acm.org>
-Date: Thu, 4 Apr 2019 10:08:43 -0700
-Subject: [PATCH 2/3] block: Revert v5.0 blk_mq_request_issue_directly()
- changes
-
-blk_mq_try_issue_directly() can return BLK_STS*_RESOURCE for requests that
-have been queued. If that happens when blk_mq_try_issue_directly() is called
-by the dm-mpath driver then dm-mpath will try to resubmit a request that is
-already queued and a kernel crash follows. Since it is nontrivial to fix
-blk_mq_request_issue_directly(), revert the blk_mq_request_issue_directly()
-changes that went into kernel v5.0.
-
-This patch reverts the following commits:
-* d6a51a97c0b2 ("blk-mq: replace and kill blk_mq_request_issue_directly") # v5.0.
-* 5b7a6f128aad ("blk-mq: issue directly with bypass 'false' in blk_mq_sched_insert_requests") # v5.0.
-* 7f556a44e61d ("blk-mq: refactor the code of issue request directly") # v5.0.
-
-Cc: Christoph Hellwig <hch@infradead.org>
-Cc: Ming Lei <ming.lei@redhat.com>
-Cc: Jianchao Wang <jianchao.w.wang@oracle.com>
-Cc: Hannes Reinecke <hare@suse.com>
-Cc: Johannes Thumshirn <jthumshirn@suse.de>
-Cc: James Smart <james.smart@broadcom.com>
-Cc: Dongli Zhang <dongli.zhang@oracle.com>
-Cc: Laurence Oberman <loberman@redhat.com>
-Cc: <stable@vger.kernel.org>
-Reported-by: Laurence Oberman <loberman@redhat.com>
-Tested-by: Laurence Oberman <loberman@redhat.com>
-Fixes: 7f556a44e61d ("blk-mq: refactor the code of issue request directly") # v5.0.
-Signed-off-by: Bart Van Assche <bvanassche@acm.org>
-Signed-off-by: Jens Axboe <axboe@kernel.dk>
-(cherry picked from commit fd9c40f64c514bdc585a21e2e33fa5f83ca8811b)
-Signed-off-by: Joel Stanley <joel@jms.id.au>
----
- block/blk-core.c     |   4 +-
- block/blk-mq-sched.c |   8 +--
- block/blk-mq.c       | 122 ++++++++++++++++++++++---------------------
- block/blk-mq.h       |   6 +--
- 4 files changed, 71 insertions(+), 69 deletions(-)
-
-diff --git a/block/blk-core.c b/block/blk-core.c
-index 6b78ec56a4f2..5bde73a49399 100644
---- a/block/blk-core.c
-+++ b/block/blk-core.c
-@@ -1246,8 +1246,6 @@ static int blk_cloned_rq_check_limits(struct request_queue *q,
-  */
- blk_status_t blk_insert_cloned_request(struct request_queue *q, struct request *rq)
- {
--	blk_qc_t unused;
--
- 	if (blk_cloned_rq_check_limits(q, rq))
- 		return BLK_STS_IOERR;
- 
-@@ -1263,7 +1261,7 @@ blk_status_t blk_insert_cloned_request(struct request_queue *q, struct request *
- 	 * bypass a potential scheduler on the bottom device for
- 	 * insert.
- 	 */
--	return blk_mq_try_issue_directly(rq->mq_hctx, rq, &unused, true, true);
-+	return blk_mq_request_issue_directly(rq, true);
- }
- EXPORT_SYMBOL_GPL(blk_insert_cloned_request);
- 
-diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c
-index 140933e4a7d1..0c98b6c1ca49 100644
---- a/block/blk-mq-sched.c
-+++ b/block/blk-mq-sched.c
-@@ -423,10 +423,12 @@ void blk_mq_sched_insert_requests(struct blk_mq_hw_ctx *hctx,
- 		 * busy in case of 'none' scheduler, and this way may save
- 		 * us one extra enqueue & dequeue to sw queue.
- 		 */
--		if (!hctx->dispatch_busy && !e && !run_queue_async)
-+		if (!hctx->dispatch_busy && !e && !run_queue_async) {
- 			blk_mq_try_issue_list_directly(hctx, list);
--		else
--			blk_mq_insert_requests(hctx, ctx, list);
-+			if (list_empty(list))
-+				return;
-+		}
-+		blk_mq_insert_requests(hctx, ctx, list);
- 	}
- 
- 	blk_mq_run_hw_queue(hctx, run_queue_async);
-diff --git a/block/blk-mq.c b/block/blk-mq.c
-index b9283b63d116..16f9675c57e6 100644
---- a/block/blk-mq.c
-+++ b/block/blk-mq.c
-@@ -1805,74 +1805,76 @@ static blk_status_t __blk_mq_issue_directly(struct blk_mq_hw_ctx *hctx,
- 	return ret;
- }
- 
--blk_status_t blk_mq_try_issue_directly(struct blk_mq_hw_ctx *hctx,
-+static blk_status_t __blk_mq_try_issue_directly(struct blk_mq_hw_ctx *hctx,
- 						struct request *rq,
- 						blk_qc_t *cookie,
--						bool bypass, bool last)
-+						bool bypass_insert, bool last)
- {
- 	struct request_queue *q = rq->q;
- 	bool run_queue = true;
--	blk_status_t ret = BLK_STS_RESOURCE;
--	int srcu_idx;
--	bool force = false;
- 
--	hctx_lock(hctx, &srcu_idx);
- 	/*
--	 * hctx_lock is needed before checking quiesced flag.
-+	 * RCU or SRCU read lock is needed before checking quiesced flag.
- 	 *
--	 * When queue is stopped or quiesced, ignore 'bypass', insert
--	 * and return BLK_STS_OK to caller, and avoid driver to try to
--	 * dispatch again.
-+	 * When queue is stopped or quiesced, ignore 'bypass_insert' from
-+	 * blk_mq_request_issue_directly(), and return BLK_STS_OK to caller,
-+	 * and avoid driver to try to dispatch again.
- 	 */
--	if (unlikely(blk_mq_hctx_stopped(hctx) || blk_queue_quiesced(q))) {
-+	if (blk_mq_hctx_stopped(hctx) || blk_queue_quiesced(q)) {
- 		run_queue = false;
--		bypass = false;
--		goto out_unlock;
-+		bypass_insert = false;
-+		goto insert;
- 	}
- 
--	if (unlikely(q->elevator && !bypass))
--		goto out_unlock;
-+	if (q->elevator && !bypass_insert)
-+		goto insert;
- 
- 	if (!blk_mq_get_dispatch_budget(hctx))
--		goto out_unlock;
-+		goto insert;
- 
- 	if (!blk_mq_get_driver_tag(rq)) {
- 		blk_mq_put_dispatch_budget(hctx);
--		goto out_unlock;
-+		goto insert;
- 	}
- 
--	/*
--	 * Always add a request that has been through
--	 *.queue_rq() to the hardware dispatch list.
--	 */
--	force = true;
--	ret = __blk_mq_issue_directly(hctx, rq, cookie, last);
--out_unlock:
-+	return __blk_mq_issue_directly(hctx, rq, cookie, last);
-+insert:
-+	if (bypass_insert)
-+		return BLK_STS_RESOURCE;
-+
-+	blk_mq_request_bypass_insert(rq, run_queue);
-+	return BLK_STS_OK;
-+}
-+
-+static void blk_mq_try_issue_directly(struct blk_mq_hw_ctx *hctx,
-+		struct request *rq, blk_qc_t *cookie)
-+{
-+	blk_status_t ret;
-+	int srcu_idx;
-+
-+	might_sleep_if(hctx->flags & BLK_MQ_F_BLOCKING);
-+
-+	hctx_lock(hctx, &srcu_idx);
-+
-+	ret = __blk_mq_try_issue_directly(hctx, rq, cookie, false, true);
-+	if (ret == BLK_STS_RESOURCE || ret == BLK_STS_DEV_RESOURCE)
-+		blk_mq_request_bypass_insert(rq, true);
-+	else if (ret != BLK_STS_OK)
-+		blk_mq_end_request(rq, ret);
-+
-+	hctx_unlock(hctx, srcu_idx);
-+}
-+
-+blk_status_t blk_mq_request_issue_directly(struct request *rq, bool last)
-+{
-+	blk_status_t ret;
-+	int srcu_idx;
-+	blk_qc_t unused_cookie;
-+	struct blk_mq_hw_ctx *hctx = rq->mq_hctx;
-+
-+	hctx_lock(hctx, &srcu_idx);
-+	ret = __blk_mq_try_issue_directly(hctx, rq, &unused_cookie, true, last);
- 	hctx_unlock(hctx, srcu_idx);
--	switch (ret) {
--	case BLK_STS_OK:
--		break;
--	case BLK_STS_DEV_RESOURCE:
--	case BLK_STS_RESOURCE:
--		if (force) {
--			blk_mq_request_bypass_insert(rq, run_queue);
--			/*
--			 * We have to return BLK_STS_OK for the DM
--			 * to avoid livelock. Otherwise, we return
--			 * the real result to indicate whether the
--			 * request is direct-issued successfully.
--			 */
--			ret = bypass ? BLK_STS_OK : ret;
--		} else if (!bypass) {
--			blk_mq_sched_insert_request(rq, false,
--						    run_queue, false);
--		}
--		break;
--	default:
--		if (!bypass)
--			blk_mq_end_request(rq, ret);
--		break;
--	}
- 
- 	return ret;
- }
-@@ -1880,20 +1882,22 @@ blk_status_t blk_mq_try_issue_directly(struct blk_mq_hw_ctx *hctx,
- void blk_mq_try_issue_list_directly(struct blk_mq_hw_ctx *hctx,
- 		struct list_head *list)
- {
--	blk_qc_t unused;
--	blk_status_t ret = BLK_STS_OK;
--
- 	while (!list_empty(list)) {
-+		blk_status_t ret;
- 		struct request *rq = list_first_entry(list, struct request,
- 				queuelist);
- 
- 		list_del_init(&rq->queuelist);
--		if (ret == BLK_STS_OK)
--			ret = blk_mq_try_issue_directly(hctx, rq, &unused,
--							false,
-+		ret = blk_mq_request_issue_directly(rq, list_empty(list));
-+		if (ret != BLK_STS_OK) {
-+			if (ret == BLK_STS_RESOURCE ||
-+					ret == BLK_STS_DEV_RESOURCE) {
-+				blk_mq_request_bypass_insert(rq,
- 							list_empty(list));
--		else
--			blk_mq_sched_insert_request(rq, false, true, false);
-+				break;
-+			}
-+			blk_mq_end_request(rq, ret);
-+		}
- 	}
- 
- 	/*
-@@ -1901,7 +1905,7 @@ void blk_mq_try_issue_list_directly(struct blk_mq_hw_ctx *hctx,
- 	 * the driver there was more coming, but that turned out to
- 	 * be a lie.
- 	 */
--	if (ret != BLK_STS_OK && hctx->queue->mq_ops->commit_rqs)
-+	if (!list_empty(list) && hctx->queue->mq_ops->commit_rqs)
- 		hctx->queue->mq_ops->commit_rqs(hctx);
- }
- 
-@@ -2014,13 +2018,13 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio)
- 		if (same_queue_rq) {
- 			data.hctx = same_queue_rq->mq_hctx;
- 			blk_mq_try_issue_directly(data.hctx, same_queue_rq,
--					&cookie, false, true);
-+					&cookie);
- 		}
- 	} else if ((q->nr_hw_queues > 1 && is_sync) || (!q->elevator &&
- 			!data.hctx->dispatch_busy)) {
- 		blk_mq_put_ctx(data.ctx);
- 		blk_mq_bio_to_request(rq, bio);
--		blk_mq_try_issue_directly(data.hctx, rq, &cookie, false, true);
-+		blk_mq_try_issue_directly(data.hctx, rq, &cookie);
- 	} else {
- 		blk_mq_put_ctx(data.ctx);
- 		blk_mq_bio_to_request(rq, bio);
-diff --git a/block/blk-mq.h b/block/blk-mq.h
-index d0b3dd54ef8d..a3a684a8c633 100644
---- a/block/blk-mq.h
-+++ b/block/blk-mq.h
-@@ -67,10 +67,8 @@ void blk_mq_request_bypass_insert(struct request *rq, bool run_queue);
- void blk_mq_insert_requests(struct blk_mq_hw_ctx *hctx, struct blk_mq_ctx *ctx,
- 				struct list_head *list);
- 
--blk_status_t blk_mq_try_issue_directly(struct blk_mq_hw_ctx *hctx,
--						struct request *rq,
--						blk_qc_t *cookie,
--						bool bypass, bool last);
-+/* Used by blk_insert_cloned_request() to issue request directly */
-+blk_status_t blk_mq_request_issue_directly(struct request *rq, bool last);
- void blk_mq_try_issue_list_directly(struct blk_mq_hw_ctx *hctx,
- 				    struct list_head *list);
-