Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 51115737 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "mmc: card: Requeue the request if it fails during issuing"

parents a41b5926 e73adf4e
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
@@ -3184,6 +3184,16 @@ static struct mmc_cmdq_req *mmc_blk_cmdq_rw_prep(
	return &mqrq->cmdq_req;
}

static void mmc_blk_cmdq_requeue_rw_rq(struct mmc_queue *mq,
				struct request *req)
{
	struct mmc_card *card = mq->card;
	struct mmc_host *host = card->host;

	blk_requeue_request(req->q, req);
	mmc_put_card(host->card);
}

static int mmc_blk_cmdq_issue_rw_rq(struct mmc_queue *mq, struct request *req)
{
	struct mmc_queue_req *active_mqrq;
@@ -3231,6 +3241,15 @@ static int mmc_blk_cmdq_issue_rw_rq(struct mmc_queue *mq, struct request *req)
		wait_event_interruptible(ctx->queue_empty_wq,
					(!ctx->active_reqs));

	if (ret) {
		/* clear pending request */
		WARN_ON(!test_and_clear_bit(req->tag,
				&host->cmdq_ctx.data_active_reqs));
		WARN_ON(!test_and_clear_bit(req->tag,
				&host->cmdq_ctx.active_reqs));
		mmc_cmdq_clk_scaling_stop_busy(host, true, false);
	}

	return ret;
}

@@ -4058,6 +4077,13 @@ static int mmc_blk_cmdq_issue_rq(struct mmc_queue *mq, struct request *req)
			ret = mmc_blk_cmdq_issue_flush_rq(mq, req);
		} else {
			ret = mmc_blk_cmdq_issue_rw_rq(mq, req);
			/*
			 * If issuing of the request fails with eitehr EBUSY or
			 * EAGAIN error, re-queue the request.
			 * This case would occur with ICE calls.
			 */
			if (ret == -EBUSY || ret == -EAGAIN)
				mmc_blk_cmdq_requeue_rw_rq(mq, req);
		}
	}

+19 −8
Original line number Diff line number Diff line
@@ -1249,9 +1249,11 @@ static int mmc_cmdq_check_retune(struct mmc_host *host)
	return err;
}

static void mmc_start_cmdq_request(struct mmc_host *host,
static int mmc_start_cmdq_request(struct mmc_host *host,
				   struct mmc_request *mrq)
{
	int ret = 0;

	if (mrq->data) {
		pr_debug("%s:     blksz %d blocks %d flags %08x tsac %lu ms nsac %d\n",
			mmc_hostname(host), mrq->data->blksz,
@@ -1274,11 +1276,21 @@ static void mmc_start_cmdq_request(struct mmc_host *host,

	mmc_host_clk_hold(host);
	mmc_cmdq_check_retune(host);
	if (likely(host->cmdq_ops->request))
		host->cmdq_ops->request(host, mrq);
	else
		pr_err("%s: %s: issue request failed\n", mmc_hostname(host),
				__func__);
	if (likely(host->cmdq_ops->request)) {
		ret = host->cmdq_ops->request(host, mrq);
	} else {
		ret = -ENOENT;
		pr_err("%s: %s: cmdq request host op is not available\n",
			mmc_hostname(host), __func__);
	}

	if (ret) {
		mmc_host_clk_release(host);
		pr_err("%s: %s: issue request failed, err=%d\n",
			mmc_hostname(host), __func__, ret);
	}

	return ret;
}

/**
@@ -1810,8 +1822,7 @@ int mmc_cmdq_start_req(struct mmc_host *host, struct mmc_cmdq_req *cmdq_req)
		mrq->cmd->error = -ENOMEDIUM;
		return -ENOMEDIUM;
	}
	mmc_start_cmdq_request(host, mrq);
	return 0;
	return mmc_start_cmdq_request(host, mrq);
}
EXPORT_SYMBOL(mmc_cmdq_start_req);

+18 −2
Original line number Diff line number Diff line
@@ -806,7 +806,7 @@ static int cmdq_request(struct mmc_host *mmc, struct mmc_request *mrq)
			mmc->err_stats[MMC_ERR_ICE_CFG]++;
			pr_err("%s: failed to configure crypto: err %d tag %d\n",
					mmc_hostname(mmc), err, tag);
			goto out;
			goto ice_err;
		}
	}

@@ -824,7 +824,7 @@ static int cmdq_request(struct mmc_host *mmc, struct mmc_request *mrq)
	if (err) {
		pr_err("%s: %s: failed to setup tx desc: %d\n",
		       mmc_hostname(mmc), __func__, err);
		goto out;
		goto desc_err;
	}

	cq_host->mrq_slot[tag] = mrq;
@@ -844,6 +844,22 @@ static int cmdq_request(struct mmc_host *mmc, struct mmc_request *mrq)
	/* Commit the doorbell write immediately */
	wmb();

	return err;

desc_err:
	if (cq_host->ops->crypto_cfg_end) {
		err = cq_host->ops->crypto_cfg_end(mmc, mrq);
		if (err) {
			pr_err("%s: failed to end ice config: err %d tag %d\n",
					mmc_hostname(mmc), err, tag);
		}
	}
	if (!(cq_host->caps & CMDQ_CAP_CRYPTO_SUPPORT) &&
			cq_host->ops->crypto_cfg_reset)
		cq_host->ops->crypto_cfg_reset(mmc, tag);
ice_err:
	if (err)
		cmdq_runtime_pm_put(cq_host);
out:
	return err;
}