Loading drivers/mmc/core/block.c +8 −0 Original line number Diff line number Diff line Loading @@ -908,6 +908,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 @@ -1023,6 +1029,8 @@ 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/core/host.c +2 −0 Original line number Diff line number Diff line Loading @@ -698,6 +698,8 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev) INIT_DELAYED_WORK(&host->sdio_irq_work, sdio_irq_work); 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 drivers/mmc/core/queue.c +4 −1 Original line number Diff line number Diff line Loading @@ -84,7 +84,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 @@ -96,6 +98,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 include/linux/mmc/host.h +3 −0 Original line number Diff line number Diff line Loading @@ -704,6 +704,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/core/block.c +8 −0 Original line number Diff line number Diff line Loading @@ -908,6 +908,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 @@ -1023,6 +1029,8 @@ 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/core/host.c +2 −0 Original line number Diff line number Diff line Loading @@ -698,6 +698,8 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev) INIT_DELAYED_WORK(&host->sdio_irq_work, sdio_irq_work); 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
drivers/mmc/core/queue.c +4 −1 Original line number Diff line number Diff line Loading @@ -84,7 +84,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 @@ -96,6 +98,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
include/linux/mmc/host.h +3 −0 Original line number Diff line number Diff line Loading @@ -704,6 +704,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