-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
firmware: arm_ffa: Add support for SMCCC as transport to FFA driver
There are requests to keep the transport separate in order to allow other possible transports like virtio. So let us keep the SMCCC transport specific routines abstracted. It is kept simple for now. Once we add another transport, we can develop better abstraction. Link: https://lore.kernel.org/r/20210521151033.181846-4-sudeep.holla@arm.com Tested-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
- Loading branch information
Sudeep Holla
committed
May 26, 2021
1 parent
3bbfe98
commit 714be77
Showing
4 changed files
with
50 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
# SPDX-License-Identifier: GPL-2.0-only | ||
ffa-bus-y = bus.o | ||
ffa-driver-y = driver.o | ||
ffa-module-objs := $(ffa-bus-y) $(ffa-driver-y) | ||
ffa-transport-$(CONFIG_ARM_FFA_SMCCC) += smccc.o | ||
ffa-module-objs := $(ffa-bus-y) $(ffa-driver-y) $(ffa-transport-y) | ||
obj-$(CONFIG_ARM_FFA_TRANSPORT) = ffa-module.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// SPDX-License-Identifier: GPL-2.0-only | ||
/* | ||
* Copyright (C) 2021 ARM Ltd. | ||
*/ | ||
|
||
#include <linux/printk.h> | ||
|
||
#include "common.h" | ||
|
||
static void __arm_ffa_fn_smc(ffa_value_t args, ffa_value_t *res) | ||
{ | ||
arm_smccc_1_2_smc(&args, res); | ||
} | ||
|
||
static void __arm_ffa_fn_hvc(ffa_value_t args, ffa_value_t *res) | ||
{ | ||
arm_smccc_1_2_hvc(&args, res); | ||
} | ||
|
||
int __init ffa_transport_init(ffa_fn **invoke_ffa_fn) | ||
{ | ||
enum arm_smccc_conduit conduit; | ||
|
||
if (arm_smccc_get_version() < ARM_SMCCC_VERSION_1_2) | ||
return -EOPNOTSUPP; | ||
|
||
conduit = arm_smccc_1_1_get_conduit(); | ||
if (conduit == SMCCC_CONDUIT_NONE) { | ||
pr_err("%s: invalid SMCCC conduit\n", __func__); | ||
return -EOPNOTSUPP; | ||
} | ||
|
||
if (conduit == SMCCC_CONDUIT_SMC) | ||
*invoke_ffa_fn = __arm_ffa_fn_smc; | ||
else | ||
*invoke_ffa_fn = __arm_ffa_fn_hvc; | ||
|
||
return 0; | ||
} |