cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

smccc.c (783B)


      1// SPDX-License-Identifier: GPL-2.0-only
      2/*
      3 * Copyright (C) 2021 ARM Ltd.
      4 */
      5
      6#include <linux/printk.h>
      7
      8#include "common.h"
      9
     10static void __arm_ffa_fn_smc(ffa_value_t args, ffa_value_t *res)
     11{
     12	arm_smccc_1_2_smc(&args, res);
     13}
     14
     15static void __arm_ffa_fn_hvc(ffa_value_t args, ffa_value_t *res)
     16{
     17	arm_smccc_1_2_hvc(&args, res);
     18}
     19
     20int __init ffa_transport_init(ffa_fn **invoke_ffa_fn)
     21{
     22	enum arm_smccc_conduit conduit;
     23
     24	if (arm_smccc_get_version() < ARM_SMCCC_VERSION_1_2)
     25		return -EOPNOTSUPP;
     26
     27	conduit = arm_smccc_1_1_get_conduit();
     28	if (conduit == SMCCC_CONDUIT_NONE) {
     29		pr_err("%s: invalid SMCCC conduit\n", __func__);
     30		return -EOPNOTSUPP;
     31	}
     32
     33	if (conduit == SMCCC_CONDUIT_SMC)
     34		*invoke_ffa_fn = __arm_ffa_fn_smc;
     35	else
     36		*invoke_ffa_fn = __arm_ffa_fn_hvc;
     37
     38	return 0;
     39}