Loading drivers/mmc/card/block.c +9 −0 Original line number Diff line number Diff line Loading @@ -1040,6 +1040,12 @@ static int mmc_blk_ioctl_rpmb_cmd(struct block_device *bdev, goto idata_free; } /* * Ensure rpmb_req_pending flag is synchronized between multiple * entities which may use rpmb ioclts with a lock. */ mutex_lock(&card->host->rpmb_req_mutex); atomic_set(&card->host->rpmb_req_pending, 1); mmc_get_card(card); if (mmc_card_doing_bkops(card)) { Loading Loading @@ -1155,6 +1161,9 @@ static int mmc_blk_ioctl_rpmb_cmd(struct block_device *bdev, cmd_rel_host: mmc_put_card(card); atomic_set(&card->host->rpmb_req_pending, 0); mutex_unlock(&card->host->rpmb_req_mutex); idata_free: for (i = 0; i < MMC_IOC_MAX_RPMB_CMD; i++) { Loading drivers/mmc/card/queue.c +4 −1 Original line number Diff line number Diff line Loading @@ -98,7 +98,9 @@ static inline void mmc_cmdq_ready_wait(struct mmc_host *host, * be any other direct command active. * 3. cmdq state should be unhalted. * 4. cmdq state shouldn't be in error state. * 5. free tag available to process the new request. * 5. There is no outstanding RPMB request pending. * 6. free tag available to process the new request. * (This must be the last condtion to check) */ wait_event(ctx->wait, kthread_should_stop() || (mmc_peek_request(mq) && Loading @@ -109,6 +111,7 @@ static inline void mmc_cmdq_ready_wait(struct mmc_host *host, && !(!host->card->part_curr && mmc_host_cq_disable(host) && !mmc_card_suspended(host->card)) && !test_bit(CMDQ_STATE_ERR, &ctx->curr_state) && !atomic_read(&host->rpmb_req_pending) && !mmc_check_blk_queue_start_tag(q, mq->cmdq_req_peeked))); } Loading drivers/mmc/core/host.c +2 −0 Original line number Diff line number Diff line Loading @@ -717,6 +717,8 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev) INIT_DELAYED_WORK(&host->detect, mmc_rescan); setup_timer(&host->retune_timer, mmc_retune_timer, (unsigned long)host); mutex_init(&host->rpmb_req_mutex); /* * By default, hosts do not support SGIO or large requests. * They have to set these according to their abilities. Loading include/linux/mmc/host.h +3 −0 Original line number Diff line number Diff line Loading @@ -650,6 +650,9 @@ struct mmc_host { */ void *cmdq_private; struct mmc_request *err_mrq; atomic_t rpmb_req_pending; struct mutex rpmb_req_mutex; unsigned long private[0] ____cacheline_aligned; }; Loading Loading
drivers/mmc/card/block.c +9 −0 Original line number Diff line number Diff line Loading @@ -1040,6 +1040,12 @@ static int mmc_blk_ioctl_rpmb_cmd(struct block_device *bdev, goto idata_free; } /* * Ensure rpmb_req_pending flag is synchronized between multiple * entities which may use rpmb ioclts with a lock. */ mutex_lock(&card->host->rpmb_req_mutex); atomic_set(&card->host->rpmb_req_pending, 1); mmc_get_card(card); if (mmc_card_doing_bkops(card)) { Loading Loading @@ -1155,6 +1161,9 @@ static int mmc_blk_ioctl_rpmb_cmd(struct block_device *bdev, cmd_rel_host: mmc_put_card(card); atomic_set(&card->host->rpmb_req_pending, 0); mutex_unlock(&card->host->rpmb_req_mutex); idata_free: for (i = 0; i < MMC_IOC_MAX_RPMB_CMD; i++) { Loading
drivers/mmc/card/queue.c +4 −1 Original line number Diff line number Diff line Loading @@ -98,7 +98,9 @@ static inline void mmc_cmdq_ready_wait(struct mmc_host *host, * be any other direct command active. * 3. cmdq state should be unhalted. * 4. cmdq state shouldn't be in error state. * 5. free tag available to process the new request. * 5. There is no outstanding RPMB request pending. * 6. free tag available to process the new request. * (This must be the last condtion to check) */ wait_event(ctx->wait, kthread_should_stop() || (mmc_peek_request(mq) && Loading @@ -109,6 +111,7 @@ static inline void mmc_cmdq_ready_wait(struct mmc_host *host, && !(!host->card->part_curr && mmc_host_cq_disable(host) && !mmc_card_suspended(host->card)) && !test_bit(CMDQ_STATE_ERR, &ctx->curr_state) && !atomic_read(&host->rpmb_req_pending) && !mmc_check_blk_queue_start_tag(q, mq->cmdq_req_peeked))); } Loading
drivers/mmc/core/host.c +2 −0 Original line number Diff line number Diff line Loading @@ -717,6 +717,8 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev) INIT_DELAYED_WORK(&host->detect, mmc_rescan); setup_timer(&host->retune_timer, mmc_retune_timer, (unsigned long)host); mutex_init(&host->rpmb_req_mutex); /* * By default, hosts do not support SGIO or large requests. * They have to set these according to their abilities. Loading
include/linux/mmc/host.h +3 −0 Original line number Diff line number Diff line Loading @@ -650,6 +650,9 @@ struct mmc_host { */ void *cmdq_private; struct mmc_request *err_mrq; atomic_t rpmb_req_pending; struct mutex rpmb_req_mutex; unsigned long private[0] ____cacheline_aligned; }; Loading