shmbridge: Force use of SELF_OWNER_BIT

If the number of vms is only one and it is not HLOS,
use SELF_OWNER_BIT instead of the vm list.

Change-Id: I749081976b14e888ee19d87e297d7389a55d0491
Signed-off-by: Amirreza Zarrabi <quic_azarrabi@quicinc.com>
This commit is contained in:
Amirreza Zarrabi 2023-02-12 20:18:39 -08:00 committed by Gerrit - the friendly Code Review server
parent 3eb23712fb
commit be8f7e29d7
2 changed files with 28 additions and 1 deletions

View File

@ -3,7 +3,7 @@
* QTI TEE shared memory bridge driver * QTI TEE shared memory bridge driver
* *
* Copyright (c) 2021, The Linux Foundation. All rights reserved. * Copyright (c) 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/module.h> #include <linux/module.h>
@ -20,6 +20,9 @@
#include <linux/qtee_shmbridge.h> #include <linux/qtee_shmbridge.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/gunyah/gh_errno.h>
#include <linux/gunyah/gh_rm_drv.h>
#include "qtee_shmbridge_internal.h" #include "qtee_shmbridge_internal.h"
#define DEFAULT_BRIDGE_SIZE SZ_4M /*4M*/ #define DEFAULT_BRIDGE_SIZE SZ_4M /*4M*/
@ -203,6 +206,8 @@ int32_t qtee_shmbridge_register(
uint64_t ns_vmids = 0; uint64_t ns_vmids = 0;
int i = 0; int i = 0;
gh_vmid_t temp_vmid;
if (!qtee_shmbridge_enabled) if (!qtee_shmbridge_enabled)
return 0; return 0;
@ -217,6 +222,23 @@ int32_t qtee_shmbridge_register(
if (ret) if (ret)
goto exit; goto exit;
if (support_hyp) {
/* Calls to create SHMBridge from HLOS-VM is handled by QHEEBSP AC Layer while from
* secondary CPU-VMs, such as OEM-VM and QTVM, it is handled by Hypervisor RM.
* RM always expects the destination VM fields to be 0 and only expects the self
* owner bit to be set.
*/
if (ns_vmid_num == 1) {
if (!gh_rm_get_this_vmid(&temp_vmid) &&
(temp_vmid == ns_vmid_list[0])) {
ns_vmid_num = 0;
}
}
}
for (i = 0; i < ns_vmid_num; i++) { for (i = 0; i < ns_vmid_num; i++) {
ns_perms = UPDATE_NS_PERMS(ns_perms, ns_vm_perm_list[i]); ns_perms = UPDATE_NS_PERMS(ns_perms, ns_vm_perm_list[i]);
ns_vmids = UPDATE_NS_VMIDS(ns_vmids, ns_vmid_list[i]); ns_vmids = UPDATE_NS_VMIDS(ns_vmids, ns_vmid_list[i]);

View File

@ -1,5 +1,10 @@
qcom_wdt_core.ko qcom_wdt_core.ko
gh_virt_wdt.ko gh_virt_wdt.ko
gh_arm_drv.ko
gh_ctrl.ko
gh_dbl.ko
gh_msgq.ko
gh_rm_drv.ko
clk-rpmh.ko clk-rpmh.ko
gcc-kalama.ko gcc-kalama.ko
icc-rpmh.ko icc-rpmh.ko