Parcourir la source

Merge c363344909cee8bc15bfda1bc76f716352431042 on remote branch

Change-Id: Id935d8ec0925ae87930856e8114796d2d660d26d
Linux Build Service Account il y a 1 an
Parent
commit
4bb8f1ad6d
10 fichiers modifiés avec 56 ajouts et 31 suppressions
  1. 23 18
      Android.mk
  2. 2 0
      BUILD.bazel
  3. 1 1
      Makefile
  4. 15 0
      build/sun.bzl
  5. 2 2
      crypto-qti/qcedev.c
  6. 5 5
      hdcp/hdcp2p2.h
  7. 1 1
      hdcp/hdcp_smcinvoke.c
  8. 4 1
      qrng/msm_rng.c
  9. 2 3
      qseecom/qseecom.c
  10. 1 0
      securemsm_kernel.bzl

+ 23 - 18
Android.mk

@@ -1,15 +1,16 @@
 # Android makefile for securemsm kernel modules
 
-ENABLE_SECUREMSM_DLKM := false
-ifeq ($(TARGET_KERNEL_DLKM_DISABLE), true)
-ifeq ($(TARGET_KERNEL_DLKM_SECURE_MSM_OVERRIDE), true)
-ENABLE_SECUREMSM_DLKM := true
-endif
-else
 ENABLE_SECUREMSM_DLKM := true
-endif
+ENABLE_SECUREMSM_QTEE_DLKM := true
 
-ifeq ($(ENABLE_SECUREMSM_DLKM), true)
+ifeq ($(TARGET_KERNEL_DLKM_DISABLE), true)
+  ifeq ($(TARGET_KERNEL_DLKM_SECURE_MSM_OVERRIDE),false)
+    ENABLE_SECUREMSM_DLKM := false
+  endif
+  ifeq ($(TARGET_KERNEL_DLKM_SECUREMSM_QTEE_OVERRIDE),false)
+    ENABLE_SECUREMSM_QTEE_DLKM := false
+  endif
+endif
 
 LOCAL_PATH := $(call my-dir)
 DLKM_DIR := $(TOP)/device/qcom/common/dlkm
@@ -40,6 +41,8 @@ LOCAL_MODULE_PATH         := $(KERNEL_MODULES_OUT)
 include $(DLKM_DIR)/Build_external_kernelmodule.mk
 ###################################################
 ###################################################
+
+ifeq ($(ENABLE_SECUREMSM_QTEE_DLKM), true)
 include $(CLEAR_VARS)
 #LOCAL_SRC_FILES           := $(SSG_SRC_FILES)
 LOCAL_MODULE              := smcinvoke_dlkm.ko
@@ -59,8 +62,20 @@ LOCAL_MODULE_TAGS         := optional
 LOCAL_MODULE_DEBUG_ENABLE := true
 LOCAL_MODULE_PATH         := $(KERNEL_MODULES_OUT)
 include $(DLKM_DIR)/Build_external_kernelmodule.mk
+
+include $(CLEAR_VARS)
+LOCAL_SRC_FILES           := $(SSG_SRC_FILES)
+LOCAL_MODULE              := qseecom_dlkm.ko
+LOCAL_MODULE_KBUILD_NAME  := qseecom_dlkm.ko
+LOCAL_MODULE_TAGS         := optional
+LOCAL_MODULE_DEBUG_ENABLE := true
+LOCAL_MODULE_PATH         := $(KERNEL_MODULES_OUT)
+include $(DLKM_DIR)/Build_external_kernelmodule.mk
+endif #ENABLE_SECUREMSM_QTEE_DLKM
 ###################################################
 ###################################################
+
+ifeq ($(ENABLE_SECUREMSM_DLKM), true)
 include $(CLEAR_VARS)
 LOCAL_SRC_FILES           := $(SSG_SRC_FILES)
 LOCAL_MODULE              := qce50_dlkm.ko
@@ -111,16 +126,6 @@ LOCAL_MODULE_PATH         := $(KERNEL_MODULES_OUT)
 include $(DLKM_DIR)/Build_external_kernelmodule.mk
 ###################################################
 ###################################################
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES           := $(SSG_SRC_FILES)
-LOCAL_MODULE              := qseecom_dlkm.ko
-LOCAL_MODULE_KBUILD_NAME  := qseecom_dlkm.ko
-LOCAL_MODULE_TAGS         := optional
-LOCAL_MODULE_DEBUG_ENABLE := true
-LOCAL_MODULE_PATH         := $(KERNEL_MODULES_OUT)
-include $(DLKM_DIR)/Build_external_kernelmodule.mk
-###################################################
-###################################################
 ifeq ($(TARGET_USES_SMMU_PROXY), true)
 include $(CLEAR_VARS)
 #LOCAL_SRC_FILES           := $(SSG_SRC_FILES)

+ 2 - 0
BUILD.bazel

@@ -75,6 +75,8 @@ ddk_headers(
 
 load(":build/pineapple.bzl", "define_pineapple")
 load(":build/blair.bzl", "define_blair")
+load(":build/sun.bzl", "define_sun")
 
 define_pineapple()
 define_blair()
+define_sun()

+ 1 - 1
Makefile

@@ -6,7 +6,7 @@ KBUILD_OPTIONS+=SSG_MODULE_ROOT=$(SSG_MODULE_ROOT)
 all: modules
 
 clean:
-	$(MAKE) -C $(KERNEL_SRC) M=$(M) clean
+	rm -f *.cmd *.d *.mod *.o *.ko *.mod.c *.mod.o Module.symvers modules.order
 
 %:
 	$(MAKE) -C $(KERNEL_SRC) M=$(M) $(INC) $@ $(KBUILD_OPTIONS)

+ 15 - 0
build/sun.bzl

@@ -0,0 +1,15 @@
+load(":securemsm_kernel.bzl", "define_consolidate_gki_modules")
+
+def define_sun():
+    define_consolidate_gki_modules(
+        target = "sun",
+        modules = [
+            "smcinvoke_dlkm",
+            "tz_log_dlkm",
+            "qseecom_dlkm"
+         ],
+         extra_options = [
+             "CONFIG_QCOM_SMCINVOKE",
+             "CONFIG_QSEECOM_COMPAT",
+         ],
+     )

+ 2 - 2
crypto-qti/qcedev.c

@@ -396,7 +396,7 @@ void qcedev_cipher_req_cb(void *cookie, unsigned char *icv,
 		return;
 	qcedev_areq = podev->active_command;
 
-	if (iv)
+	if (iv && qcedev_areq)
 		memcpy(&qcedev_areq->cipher_op_req.iv[0], iv,
 					qcedev_areq->cipher_op_req.ivlen);
 	tasklet_schedule(&podev->done_tasklet);
@@ -524,7 +524,7 @@ void qcedev_offload_cipher_req_cb(void *cookie, unsigned char *icv,
 		return;
 	qcedev_areq = podev->active_command;
 
-	if (iv)
+	if (iv && qcedev_areq)
 		memcpy(&qcedev_areq->offload_cipher_op_req.iv[0], iv,
 			qcedev_areq->offload_cipher_op_req.ivlen);
 

+ 5 - 5
hdcp/hdcp2p2.h

@@ -90,7 +90,7 @@ static inline int32_t hdcp2p2_rcvd_msg(
 		uint32_t m_timeout;
 		uint32_t m_flag;
 		uint32_t m_state;
-	} o;
+	} o = {0, 0, 0};
 	a[2].b = (struct ObjectBuf) {&o, 12};
 	a[0].bi = (struct ObjectBufIn) {reqMsg_ptr, reqMsg_len * 1};
 	a[1].b = (struct ObjectBuf) {&ctxhandle_val, sizeof(uint32_t)};
@@ -219,7 +219,7 @@ static inline int32_t hdcp2p2_start_auth(struct Object self, uint32_t ctxhandle_
 		uint32_t m_timeout;
 		uint32_t m_flag;
 		uint32_t m_tzctxhandle;
-	} o;
+	} o = {0, 0, 0};
 
 	a[1].b = (struct ObjectBuf) {&o, 12};
 	a[0].b = (struct ObjectBuf) {&ctxhandle_val, sizeof(uint32_t)};
@@ -249,7 +249,7 @@ static inline int32_t hdcp2p2_session_open_stream(struct Object self,
 		uint32_t m_vcpayloadid;
 		uint32_t m_stream_number;
 		uint32_t m_streamMediaType;
-	} i;
+	} i = {0, 0, 0, 0};
 
 	a[0].b = (struct ObjectBuf) {&i, 16};
 	i.m_sessionid = sessionid_val;
@@ -270,7 +270,7 @@ static inline int32_t hdcp2p2_session_close_stream(struct Object self,
 	struct {
 		uint32_t m_sessionid;
 		uint32_t m_streamId;
-	} i;
+	} i = {0, 0};
 
 	a[0].b = (struct ObjectBuf) {&i, 8};
 	i.m_sessionid = sessionid_val;
@@ -288,7 +288,7 @@ static inline int32_t hdcp2p2_force_encryption(struct Object self,
 	struct {
 		uint32_t m_ctxhandle;
 		uint32_t m_enable;
-	} i;
+	} i = {0, 0};
 
 	a[0].b = (struct ObjectBuf) {&i, 8};
 	i.m_ctxhandle = ctxhandle_val;

+ 1 - 1
hdcp/hdcp_smcinvoke.c

@@ -45,7 +45,7 @@ static int hdcp1_key_set(struct hdcp1_smcinvoke_handle *handle,
 	uint8_t *ksvRes = NULL;
 	size_t ksvResLen = 0;
 
-	ksvRes = kmalloc(HDCP1_AKSV_SIZE, GFP_KERNEL);
+	ksvRes = kzalloc(HDCP1_AKSV_SIZE, GFP_KERNEL);
 	if (!ksvRes)
 		return -EINVAL;
 

+ 4 - 1
qrng/msm_rng.c

@@ -2,7 +2,7 @@
 /*
  * Copyright (c) 2011-2013, 2015, 2017-2021 The Linux Foundation. All rights
  * reserved.
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
  */
 #include <linux/kernel.h>
 #include <linux/module.h>
@@ -367,6 +367,9 @@ static int msm_rng_remove(struct platform_device *pdev)
 {
 	struct msm_rng_device *msm_rng_dev = platform_get_drvdata(pdev);
 
+	cdev_del(&msm_rng_cdev);
+	device_destroy(msm_rng_class, MKDEV(QRNG_IOC_MAGIC, 0));
+	class_destroy(msm_rng_class);
 	unregister_chrdev(QRNG_IOC_MAGIC, DRIVER_NAME);
 	hwrng_unregister(&msm_rng);
 	if (msm_rng_dev->prng_clk)

+ 2 - 3
qseecom/qseecom.c

@@ -22,7 +22,6 @@
 #include <linux/mutex.h>
 #include <linux/io.h>
 #include <linux/dma-buf.h>
-#include <linux/ion.h>
 #include <linux/msm_ion.h>
 #include <linux/types.h>
 #include <linux/clk.h>
@@ -2034,8 +2033,8 @@ static int qseecom_set_client_mem_param(struct qseecom_dev_handle *data,
 
 	if ((req.ifd_data_fd <= 0) || (req.virt_sb_base == NULL) ||
 					(req.sb_len == 0)) {
-		pr_err("Invalid input(s)ion_fd(%d), sb_len(%d), vaddr(0x%pK)\n",
-			req.ifd_data_fd, req.sb_len, req.virt_sb_base);
+		pr_err("Invalid input(s)ion_fd(%d), sb_len(%d)\n",
+			req.ifd_data_fd, req.sb_len);
 		return -EFAULT;
 	}
 	if (!access_ok((void __user *)req.virt_sb_base,

+ 1 - 0
securemsm_kernel.bzl

@@ -109,3 +109,4 @@ def define_target_variant_modules(target, variant, modules, extra_options = [],
 def define_consolidate_gki_modules(target, modules, extra_options = [], config_option = None):
     define_target_variant_modules(target, "consolidate", modules, extra_options, config_option)
     define_target_variant_modules(target, "gki", modules, extra_options, config_option)
+    define_target_variant_modules(target, "perf", modules, extra_options, config_option)