mmc: core: mmc sanitize feature support for v4.5
In the v4.5, there's no secure erase & trim support. Instead it supports the sanitize feature. Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com> Signed-off-by: Chris Ball <cjb@laptop.org>
This commit is contained in:
committed by
Chris Ball
parent
4e0a5adf46
commit
d9ddd62943
@@ -792,11 +792,18 @@ static int mmc_blk_issue_secdiscard_rq(struct mmc_queue *mq,
|
||||
unsigned int from, nr, arg;
|
||||
int err = 0, type = MMC_BLK_SECDISCARD;
|
||||
|
||||
if (!mmc_can_secure_erase_trim(card)) {
|
||||
if (!(mmc_can_secure_erase_trim(card) || mmc_can_sanitize(card))) {
|
||||
err = -EOPNOTSUPP;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* The sanitize operation is supported at v4.5 only */
|
||||
if (mmc_can_sanitize(card)) {
|
||||
err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
|
||||
EXT_CSD_SANITIZE_START, 1, 0);
|
||||
goto out;
|
||||
}
|
||||
|
||||
from = blk_rq_pos(req);
|
||||
nr = blk_rq_sectors(req);
|
||||
|
||||
|
@@ -140,7 +140,7 @@ static void mmc_queue_setup_discard(struct request_queue *q,
|
||||
/* granularity must not be greater than max. discard */
|
||||
if (card->pref_erase > max_discard)
|
||||
q->limits.discard_granularity = 0;
|
||||
if (mmc_can_secure_erase_trim(card))
|
||||
if (mmc_can_secure_erase_trim(card) || mmc_can_sanitize(card))
|
||||
queue_flag_set_unlocked(QUEUE_FLAG_SECDISCARD, q);
|
||||
}
|
||||
|
||||
|
@@ -1713,6 +1713,14 @@ int mmc_can_trim(struct mmc_card *card)
|
||||
}
|
||||
EXPORT_SYMBOL(mmc_can_trim);
|
||||
|
||||
int mmc_can_sanitize(struct mmc_card *card)
|
||||
{
|
||||
if (card->ext_csd.sec_feature_support & EXT_CSD_SEC_SANITIZE)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(mmc_can_sanitize);
|
||||
|
||||
int mmc_can_secure_erase_trim(struct mmc_card *card)
|
||||
{
|
||||
if (card->ext_csd.sec_feature_support & EXT_CSD_SEC_ER_EN)
|
||||
|
Reference in New Issue
Block a user