From 591237cc65b88290b282882e0d9d5552972327af Mon Sep 17 00:00:00 2001 From: Stefano Stabellini Date: Mon, 15 Jul 2019 12:39:59 -0700 Subject: [PATCH] xen: add a separate platform file for Versal Let all the EEMI calls to go through for Dom0. Block access for domUs. Signed-off-by: Stefano Stabellini --- xen/arch/arm/platforms/Makefile | 1 + xen/arch/arm/platforms/xilinx-versal.c | 72 ++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 xen/arch/arm/platforms/xilinx-versal.c diff --git a/xen/arch/arm/platforms/Makefile b/xen/arch/arm/platforms/Makefile index 8632f4115f..0aeb8d17b4 100644 --- a/xen/arch/arm/platforms/Makefile +++ b/xen/arch/arm/platforms/Makefile @@ -9,5 +9,6 @@ obj-$(CONFIG_ALL_PLAT) += sunxi.o obj-$(CONFIG_ALL64_PLAT) += thunderx.o obj-$(CONFIG_ALL64_PLAT) += xgene-storm.o obj-$(CONFIG_ALL64_PLAT) += brcm-raspberry-pi.o +obj-$(CONFIG_ALL64_PLAT) += xilinx-versal.o obj-$(CONFIG_MPSOC_PLATFORM) += xilinx-zynqmp.o obj-$(CONFIG_MPSOC_PLATFORM) += xilinx-zynqmp-eemi.o diff --git a/xen/arch/arm/platforms/xilinx-versal.c b/xen/arch/arm/platforms/xilinx-versal.c new file mode 100644 index 0000000000..aae32531a3 --- /dev/null +++ b/xen/arch/arm/platforms/xilinx-versal.c @@ -0,0 +1,72 @@ +/* + * xen/arch/arm/platforms/xilinx-versal.c + * + * Xilinx Versal setup + * + * Copyright (c) 2019 Xilinx Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include + +static const char * const versal_dt_compat[] __initconst = +{ + "xlnx,versal", + NULL +}; + +static bool versal_smc(struct cpu_user_regs *regs) +{ + struct arm_smccc_res res; + + if ( !cpus_have_const_cap(ARM_SMCCC_1_1) ) + { + printk_once(XENLOG_WARNING + "ZynqMP firmware Error: no SMCCC 1.1 support. Disabling firmware calls\n"); + + return false; + } + + if ( !is_hardware_domain(current->domain) ) + return false; + + arm_smccc_1_1_smc(get_user_reg(regs, 0), + get_user_reg(regs, 1), + get_user_reg(regs, 2), + get_user_reg(regs, 3), + get_user_reg(regs, 4), + get_user_reg(regs, 5), + get_user_reg(regs, 6), + get_user_reg(regs, 7), + &res); + + set_user_reg(regs, 0, res.a0); + set_user_reg(regs, 1, res.a1); + set_user_reg(regs, 2, res.a2); + set_user_reg(regs, 3, res.a3); + return true; +} + +PLATFORM_START(xilinx_versal, "Xilinx Versal") + .compatible = versal_dt_compat, + .smc = versal_smc, +PLATFORM_END + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */ -- 2.39.5