securemsm-kernel: enable non-qtee modules

Fix compilation issues and enable all modules bound
by TARGET_KERNEL_DLKM_SECURE_MSM_OVERRIDE.

Change-Id: Id8e2d5ecb580d5fd200fe5e5e899202046136976
Signed-off-by: Gaurav Kashyap <quic_gaurkash@quicinc.com>
This commit is contained in:
Gaurav Kashyap 2023-09-20 11:41:10 -07:00
parent c363344909
commit 154b6011b0
10 changed files with 88 additions and 16 deletions

2
Kbuild
View File

@ -44,7 +44,7 @@ hdcp_qseecom_dlkm-objs := hdcp/hdcp_main.o hdcp/hdcp_smcinvoke.o hdcp/hdcp_qseec
obj-$(CONFIG_HW_RANDOM_MSM_LEGACY) += qrng_dlkm.o
qrng_dlkm-objs := qrng/msm_rng.o
ifneq (, $(filter y, $(ARCH_QTI_VM) $(CONFIG_ARCH_PINEAPPLE)))
ifneq (, $(filter y, $(ARCH_QTI_VM) $(CONFIG_ARCH_PINEAPPLE) $(CONFIG_ARCH_SUN)))
include $(SSG_MODULE_ROOT)/config/sec-kernel_defconfig_smmu_proxy.conf
LINUXINCLUDE += -include $(SSG_MODULE_ROOT)/config/sec-kernel_defconfig_smmu_proxy.h

View File

@ -6,7 +6,13 @@ def define_sun():
modules = [
"smcinvoke_dlkm",
"tz_log_dlkm",
"qseecom_dlkm"
"qseecom_dlkm",
"hdcp_qseecom_dlkm",
"qce50_dlkm",
"qcedev-mod_dlkm",
"qrng_dlkm",
"qcrypto-msm_dlkm",
"smmu_proxy_dlkm"
],
extra_options = [
"CONFIG_QCOM_SMCINVOKE",

View File

@ -3,6 +3,7 @@
* QTI Over the Air (OTA) Crypto driver
*
* Copyright (c) 2010-2014,2017-2020 The Linux Foundation. All rights reserved.
* Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/types.h>
@ -21,7 +22,7 @@
#include <linux/uaccess.h>
#include <linux/debugfs.h>
#include <linux/cache.h>
#include <linux/version.h>
#include "linux/qcota.h"
#include "qce.h"
@ -673,7 +674,11 @@ static int qcota_probe(struct platform_device *pdev)
return rc;
}
#if (KERNEL_VERSION(6, 3, 0) <= LINUX_VERSION_CODE)
driver_class = class_create(QCOTA_DEV);
#else
driver_class = class_create(THIS_MODULE, QCOTA_DEV);
#endif
if (IS_ERR(driver_class)) {
rc = -ENOMEM;
pr_err("class_create failed %d\n", rc);

View File

@ -415,6 +415,7 @@ static int _probe_ce_engine(struct qce_device *pce_dev)
{
unsigned int rev;
unsigned int maj_rev, min_rev, step_rev;
int i = 0;
rev = readl_relaxed(pce_dev->iobase + CRYPTO_VERSION_REG);
/*
@ -461,12 +462,17 @@ static int _probe_ce_engine(struct qce_device *pce_dev)
pce_dev->ce_bam_info.ce_burst_size = MAX_CE_BAM_BURST_SIZE;
dev_dbg(pce_dev->pdev, "CE device = %#x IO base, CE = %pK Consumer (IN) PIPE %d,\nProducer (OUT) PIPE %d IO base BAM = %pK\nBAM IRQ %d Engines Availability = %#x\n",
dev_dbg(pce_dev->pdev, "CE device = %#x IO base, CE = %pK, IO base BAM = %pK\nBAM IRQ %d Engines Availability = %#x\n",
pce_dev->ce_bam_info.ce_device, pce_dev->iobase,
pce_dev->ce_bam_info.dest_pipe_index,
pce_dev->ce_bam_info.src_pipe_index,
pce_dev->ce_bam_info.bam_iobase,
pce_dev->ce_bam_info.bam_irq, pce_dev->engines_avail);
for (i = 0; i < QCE_OFFLOAD_OPER_LAST; i++) {
dev_dbg(pce_dev->pdev, "Consumer pipe IN [%d] = %d, Producer Pipe OUT [%d] = %d\n",
i, pce_dev->ce_bam_info.src_pipe_index[i],
i, pce_dev->ce_bam_info.dest_pipe_index[i]);
}
return 0;
};

View File

@ -26,6 +26,7 @@
#include "linux/qcedev.h"
#include <linux/interconnect.h>
#include <linux/delay.h>
#include <linux/version.h>
#include <crypto/hash.h>
#include "qcedevi.h"
@ -2519,7 +2520,11 @@ static int qcedev_probe_device(struct platform_device *pdev)
return rc;
}
#if (KERNEL_VERSION(6, 3, 0) <= LINUX_VERSION_CODE)
driver_class = class_create(QCEDEV_DEV);
#else
driver_class = class_create(THIS_MODULE, QCEDEV_DEV);
#endif
if (IS_ERR(driver_class)) {
rc = -ENOMEM;
pr_err("class_create failed %d\n", rc);

View File

@ -28,6 +28,7 @@
#include <linux/cache.h>
#include <linux/interconnect.h>
#include <linux/hardirq.h>
#include <linux/version.h>
#include "qcrypto.h"
#include "qcom_crypto_device.h"
@ -912,9 +913,12 @@ static void _qcrypto_ahash_cra_exit(struct crypto_tfm *tfm)
}
}
#if (KERNEL_VERSION(6, 2, 0) <= LINUX_VERSION_CODE)
static void _crypto_sha_hmac_ahash_req_complete(void *data, int err);
#else
static void _crypto_sha_hmac_ahash_req_complete(
struct crypto_async_request *req, int err);
struct crypto_async_request *req, int err);
#endif
static int _qcrypto_ahash_hmac_cra_init(struct crypto_tfm *tfm)
{
@ -3134,14 +3138,22 @@ static void _qcrypto_aead_aes_192_fb_a_cb(struct qcrypto_cipher_req_ctx *rctx,
areq->complete(areq, res);
}
#if (KERNEL_VERSION(6, 2, 0) <= LINUX_VERSION_CODE)
static void _aead_aes_fb_stage2_ahash_complete(void *data, int err)
#else
static void _aead_aes_fb_stage2_ahash_complete(
struct crypto_async_request *base, int err)
struct crypto_async_request *base, int err)
#endif
{
struct qcrypto_cipher_req_ctx *rctx;
struct aead_request *req;
struct qcrypto_cipher_ctx *ctx;
#if (KERNEL_VERSION(6, 2, 0) <= LINUX_VERSION_CODE)
rctx = data;
#else
rctx = base->data;
#endif
req = rctx->aead_req;
ctx = crypto_tfm_ctx(req->base.tfm);
/* copy icv */
@ -3153,7 +3165,6 @@ static void _aead_aes_fb_stage2_ahash_complete(
_qcrypto_aead_aes_192_fb_a_cb(rctx, err);
}
static int _start_aead_aes_fb_stage2_hmac(struct qcrypto_cipher_req_ctx *rctx)
{
struct ahash_request *ahash_req;
@ -3165,12 +3176,20 @@ static int _start_aead_aes_fb_stage2_hmac(struct qcrypto_cipher_req_ctx *rctx)
return crypto_ahash_digest(ahash_req);
}
#if (KERNEL_VERSION(6, 2, 0) <= LINUX_VERSION_CODE)
static void _aead_aes_fb_stage2_decrypt_complete(void *data, int err)
#else
static void _aead_aes_fb_stage2_decrypt_complete(
struct crypto_async_request *base, int err)
struct crypto_async_request *base, int err)
#endif
{
struct qcrypto_cipher_req_ctx *rctx;
#if (KERNEL_VERSION(6, 2, 0) <= LINUX_VERSION_CODE)
rctx = data;
#else
rctx = base->data;
#endif
_qcrypto_aead_aes_192_fb_a_cb(rctx, err);
}
@ -3185,14 +3204,22 @@ static int _start_aead_aes_fb_stage2_decrypt(
return crypto_skcipher_decrypt(aes_req);
}
#if (KERNEL_VERSION(6, 2, 0) <= LINUX_VERSION_CODE)
static void _aead_aes_fb_stage1_ahash_complete(void *data, int err)
#else
static void _aead_aes_fb_stage1_ahash_complete(
struct crypto_async_request *base, int err)
struct crypto_async_request *base, int err)
#endif
{
struct qcrypto_cipher_req_ctx *rctx;
struct aead_request *req;
struct qcrypto_cipher_ctx *ctx;
#if (KERNEL_VERSION(6, 2, 0) <= LINUX_VERSION_CODE)
rctx = data;
#else
rctx = base->data;
#endif
req = rctx->aead_req;
ctx = crypto_tfm_ctx(req->base.tfm);
@ -3222,14 +3249,22 @@ ret:
}
#if (KERNEL_VERSION(6, 2, 0) <= LINUX_VERSION_CODE)
static void _aead_aes_fb_stage1_encrypt_complete(void *data, int err)
#else
static void _aead_aes_fb_stage1_encrypt_complete(
struct crypto_async_request *base, int err)
struct crypto_async_request *base, int err)
#endif
{
struct qcrypto_cipher_req_ctx *rctx;
struct aead_request *req;
struct qcrypto_cipher_ctx *ctx;
#if (KERNEL_VERSION(6, 2, 0) <= LINUX_VERSION_CODE)
rctx = data;
#else
rctx = base->data;
#endif
req = rctx->aead_req;
ctx = crypto_tfm_ctx(req->base.tfm);
@ -3926,10 +3961,16 @@ static int _sha256_digest(struct ahash_request *req)
return _sha_digest(req);
}
#if (KERNEL_VERSION(6, 2, 0) <= LINUX_VERSION_CODE)
static void _crypto_sha_hmac_ahash_req_complete(void *data, int err)
{
struct completion *ahash_req_complete = data;
#else
static void _crypto_sha_hmac_ahash_req_complete(
struct crypto_async_request *req, int err)
struct crypto_async_request *req, int err)
{
struct completion *ahash_req_complete = req->data;
#endif
if (err == -EINPROGRESS)
return;

View File

@ -14,7 +14,6 @@
#include <linux/fs.h>
#include <linux/hdcp_qseecom.h>
#include <linux/io.h>
#include <linux/ion.h>
#include <linux/kernel.h>
#include <linux/kthread.h>
#include <linux/list.h>

View File

@ -24,6 +24,7 @@
#include <crypto/internal/rng.h>
#include <linux/interconnect.h>
#include <linux/sched/signal.h>
#include <linux/version.h>
#define DRIVER_NAME "msm_rng"
@ -325,7 +326,11 @@ static int msm_rng_probe(struct platform_device *pdev)
goto err_reg_chrdev;
}
#if (KERNEL_VERSION(6, 3, 0) <= LINUX_VERSION_CODE)
msm_rng_class = class_create("msm-rng");
#else
msm_rng_class = class_create(THIS_MODULE, "msm-rng");
#endif
if (IS_ERR(msm_rng_class)) {
pr_err("class_create failed\n");
error = PTR_ERR(msm_rng_class);

View File

@ -4,6 +4,7 @@
*/
#include <linux/cdev.h>
#include <linux/version.h>
#include "qti-smmu-proxy-common.h"
#include "smcinvoke_object.h"
#include "../include/linux/ITrustedCameraDriver.h"
@ -75,7 +76,11 @@ int smmu_proxy_create_dev(const struct file_operations *fops)
if (ret < 0)
return ret;
#if (KERNEL_VERSION(6, 3, 0) <= LINUX_VERSION_CODE)
smmu_proxy_class = class_create("qti-smmu-proxy");
#else
smmu_proxy_class = class_create(THIS_MODULE, "qti-smmu-proxy");
#endif
if (IS_ERR(smmu_proxy_class)) {
ret = PTR_ERR(smmu_proxy_class);
goto err_class_create;

View File

@ -259,7 +259,7 @@ static int sender_probe_handler(struct platform_device *pdev)
msgq_hdl = gh_msgq_register(GH_MSGQ_LABEL_SMMU_PROXY);
if (IS_ERR(msgq_hdl)) {
ret = PTR_ERR(msgq_hdl);
pr_err("%s: Queue registration failed rc: %d!\n", __func__, PTR_ERR(msgq_hdl));
pr_err("%s: Queue registration failed rc: %ld!\n", __func__, PTR_ERR(msgq_hdl));
return ret;
}