Procházet zdrojové kódy

mm-drivers: hw_fence: resolve compilation errors for kalama

Fix compilation errors for kalama target, where cpusys vm share
memory driver is not present.

Change-Id: I4f7762ad747490ba166f8e9ae27dd0191de3f021
Signed-off-by: Ingrid Gallardo <[email protected]>
Ingrid Gallardo před 1 rokem
rodič
revize
6db4e6a849
1 změnil soubory, kde provedl 12 přidání a 1 odebrání
  1. 12 1
      hw_fence/src/hw_fence_drv_utils.c

+ 12 - 1
hw_fence/src/hw_fence_drv_utils.c

@@ -10,7 +10,9 @@
 #include <linux/gunyah/gh_dbl.h>
 #include <linux/qcom_scm.h>
 #include <linux/version.h>
+#if (KERNEL_VERSION(6, 1, 0) <= LINUX_VERSION_CODE)
 #include <linux/gh_cpusys_vm_mem_access.h>
+#endif
 #include <soc/qcom/secure_buffer.h>
 
 #include "hw_fence_drv_priv.h"
@@ -343,6 +345,15 @@ static int hw_fence_gunyah_share_mem(struct hw_fence_driver_data *drv_data,
 	return ret;
 }
 
+static int _is_mem_shared(struct resource *res)
+{
+#if (KERNEL_VERSION(6, 1, 0) <= LINUX_VERSION_CODE)
+	return gh_cpusys_vm_get_share_mem_info(res);
+#else
+	return -EINVAL;
+#endif
+}
+
 static int hw_fence_rm_cb(struct notifier_block *nb, unsigned long cmd, void *data)
 {
 	struct gh_rm_notif_vm_status_payload *vm_status_payload;
@@ -383,7 +394,7 @@ static int hw_fence_rm_cb(struct notifier_block *nb, unsigned long cmd, void *da
 
 	switch (vm_status_payload->vm_status) {
 	case GH_RM_VM_STATUS_READY:
-		ret = gh_cpusys_vm_get_share_mem_info(&res);
+		ret = _is_mem_shared(&res);
 		if (ret) {
 			HWFNC_DBG_INIT("mem not shared ret:%d, attempt share\n", ret);
 			if (hw_fence_gunyah_share_mem(drv_data, self_vmid, peer_vmid))