From ffc41530ad3b923d41a64cd890060607de770df0 Mon Sep 17 00:00:00 2001 From: Pradeep P V K Date: Tue, 4 Aug 2020 12:05:28 +0530 Subject: [PATCH] mmc: host: Use request queue pointer for mmc crypto To use block crypto based inline encryption mechanism storage device driver should create a keyslot manager and register it with device request queue. To achieve this pass request queue pointer during host controller initialization where request queue can be updated with keyslot manager. Change-Id: I71f0005a1ad8867b6210e92878b8c112d436688e Signed-off-by: Pradeep P V K --- drivers/mmc/core/queue.c | 3 +++ drivers/mmc/host/cmdq_hci.c | 7 +++++++ include/linux/mmc/host.h | 7 +++++++ 3 files changed, 17 insertions(+) diff --git a/drivers/mmc/core/queue.c b/drivers/mmc/core/queue.c index ecc794323729..ba338d2a1c00 100644 --- a/drivers/mmc/core/queue.c +++ b/drivers/mmc/core/queue.c @@ -437,6 +437,9 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, /* hook for pm qos cmdq init */ if (card->host->cmdq_ops->init) card->host->cmdq_ops->init(card->host); + if (host->cmdq_ops->cqe_crypto_update_queue) + host->cmdq_ops->cqe_crypto_update_queue(host, + mq->queue); mq->thread = kthread_run(mmc_cmdq_thread, mq, "mmc-cmdqd/%d%s", host->index, diff --git a/drivers/mmc/host/cmdq_hci.c b/drivers/mmc/host/cmdq_hci.c index 87c1cb7abf39..f1e4ba86f5d4 100644 --- a/drivers/mmc/host/cmdq_hci.c +++ b/drivers/mmc/host/cmdq_hci.c @@ -1277,6 +1277,12 @@ static int cmdq_late_init(struct mmc_host *mmc) return 0; } +static void cqhci_crypto_update_queue(struct mmc_host *mmc, + struct request_queue *queue) +{ + //struct cqhci_host *cq_host = mmc->cqe_private; +} + static const struct mmc_cmdq_host_ops cmdq_host_ops = { .init = cmdq_late_init, .enable = cmdq_enable, @@ -1286,6 +1292,7 @@ static const struct mmc_cmdq_host_ops cmdq_host_ops = { .halt = cmdq_halt, .reset = cmdq_reset, .dumpstate = cmdq_dumpstate, + .cqe_crypto_update_queue = cqhci_crypto_update_queue, }; struct cmdq_host *cmdq_pltfm_init(struct platform_device *pdev) diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 3c2b261b9c79..ab2c6af4dca1 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -122,6 +122,13 @@ struct mmc_cmdq_host_ops { int (*halt)(struct mmc_host *host, bool halt); void (*reset)(struct mmc_host *host, bool soft); void (*dumpstate)(struct mmc_host *host); + /* + * Update the request queue with keyslot manager details. This keyslot + * manager will be used by block crypto to configure the crypto Engine + * for data encryption. + */ + void (*cqe_crypto_update_queue)(struct mmc_host *host, + struct request_queue *queue); }; struct mmc_host_ops {