From 2d72c5a01c7d4fa3541d1bd8d44fa3bb43eca57c Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Sun, 11 Jul 2021 20:12:05 +0200 Subject: [PATCH] 4.19-stable patches added patches: mmc-block-disable-cmdq-on-the-ioctl-path.patch mmc-vub3000-fix-control-request-direction.patch --- ...block-disable-cmdq-on-the-ioctl-path.patch | 59 +++++++++++++++++++ ...ub3000-fix-control-request-direction.patch | 38 ++++++++++++ queue-4.19/series | 2 + 3 files changed, 99 insertions(+) create mode 100644 queue-4.19/mmc-block-disable-cmdq-on-the-ioctl-path.patch create mode 100644 queue-4.19/mmc-vub3000-fix-control-request-direction.patch diff --git a/queue-4.19/mmc-block-disable-cmdq-on-the-ioctl-path.patch b/queue-4.19/mmc-block-disable-cmdq-on-the-ioctl-path.patch new file mode 100644 index 00000000000..37ec9f8aad9 --- /dev/null +++ b/queue-4.19/mmc-block-disable-cmdq-on-the-ioctl-path.patch @@ -0,0 +1,59 @@ +From 70b52f09080565030a530a784f1c9948a7f48ca3 Mon Sep 17 00:00:00 2001 +From: Bean Huo +Date: Tue, 4 May 2021 22:32:09 +0200 +Subject: mmc: block: Disable CMDQ on the ioctl path +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Bean Huo + +commit 70b52f09080565030a530a784f1c9948a7f48ca3 upstream. + +According to the eMMC Spec: +"When command queuing is enabled (CMDQ Mode En bit in CMDQ_MODE_EN +field is set to ‘1’) class 11 commands are the only method through +which data transfer tasks can be issued. Existing data transfer +commands, namely CMD18/CMD17 and CMD25/CMD24, are not supported when +command queuing is enabled." +which means if CMDQ is enabled, the FFU commands will not be supported. +To fix this issue, just simply disable CMDQ on the ioctl path, and +re-enable CMDQ once ioctl request is completed. + +Tested-by: Michael Brunner +Signed-off-by: Bean Huo +Acked-by: Adrian Hunter +Fixes: 1e8e55b67030 (mmc: block: Add CQE support) +Cc: stable@vger.kernel.org +Link: https://lore.kernel.org/r/20210504203209.361597-1-huobean@gmail.com +Signed-off-by: Ulf Hansson +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/mmc/core/block.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +--- a/drivers/mmc/core/block.c ++++ b/drivers/mmc/core/block.c +@@ -1054,6 +1054,12 @@ static void mmc_blk_issue_drv_op(struct + + switch (mq_rq->drv_op) { + case MMC_DRV_OP_IOCTL: ++ if (card->ext_csd.cmdq_en) { ++ ret = mmc_cmdq_disable(card); ++ if (ret) ++ break; ++ } ++ fallthrough; + case MMC_DRV_OP_IOCTL_RPMB: + idata = mq_rq->drv_op_data; + for (i = 0, ret = 0; i < mq_rq->ioc_count; i++) { +@@ -1064,6 +1070,8 @@ static void mmc_blk_issue_drv_op(struct + /* Always switch back to main area after RPMB access */ + if (rpmb_ioctl) + mmc_blk_part_switch(card, 0); ++ else if (card->reenable_cmdq && !card->ext_csd.cmdq_en) ++ mmc_cmdq_enable(card); + break; + case MMC_DRV_OP_BOOT_WP: + ret = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_BOOT_WP, diff --git a/queue-4.19/mmc-vub3000-fix-control-request-direction.patch b/queue-4.19/mmc-vub3000-fix-control-request-direction.patch new file mode 100644 index 00000000000..1e5ed380715 --- /dev/null +++ b/queue-4.19/mmc-vub3000-fix-control-request-direction.patch @@ -0,0 +1,38 @@ +From 3c0bb3107703d2c58f7a0a7a2060bb57bc120326 Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Fri, 21 May 2021 15:30:26 +0200 +Subject: mmc: vub3000: fix control-request direction + +From: Johan Hovold + +commit 3c0bb3107703d2c58f7a0a7a2060bb57bc120326 upstream. + +The direction of the pipe argument must match the request-type direction +bit or control requests may fail depending on the host-controller-driver +implementation. + +Fix the SET_ROM_WAIT_STATES request which erroneously used +usb_rcvctrlpipe(). + +Fixes: 88095e7b473a ("mmc: Add new VUB300 USB-to-SD/SDIO/MMC driver") +Cc: stable@vger.kernel.org # 3.0 +Signed-off-by: Johan Hovold +Link: https://lore.kernel.org/r/20210521133026.17296-1-johan@kernel.org +Signed-off-by: Ulf Hansson +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/mmc/host/vub300.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/mmc/host/vub300.c ++++ b/drivers/mmc/host/vub300.c +@@ -2289,7 +2289,7 @@ static int vub300_probe(struct usb_inter + if (retval < 0) + goto error5; + retval = +- usb_control_msg(vub300->udev, usb_rcvctrlpipe(vub300->udev, 0), ++ usb_control_msg(vub300->udev, usb_sndctrlpipe(vub300->udev, 0), + SET_ROM_WAIT_STATES, + USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + firmware_rom_wait_states, 0x0000, NULL, 0, HZ); diff --git a/queue-4.19/series b/queue-4.19/series index bfe490b1083..ad2c4d22173 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -222,3 +222,5 @@ vfio-pci-handle-concurrent-vma-faults.patch mm-huge_memory.c-don-t-discard-hugepage-if-other-pro.patch selftests-vm-pkeys-fix-alloc_random_pkey-to-make-it-.patch perf-llvm-return-enomem-when-asprintf-fails.patch +mmc-block-disable-cmdq-on-the-ioctl-path.patch +mmc-vub3000-fix-control-request-direction.patch -- 2.47.2