Re: [PATCH v7 03/16] virt: geniezone: Add GenieZone hypervisor driver

From: Marc Zyngier
Date: Thu Nov 16 2023 - 11:32:14 EST


On 2023-11-16 15:27, Yi-De Wu wrote:
From: "Yingshiuan Pan" <yingshiuan.pan@xxxxxxxxxxxx>

GenieZone hypervisor(gzvm) is a type-1 hypervisor that supports various
virtual machine types and provides security features such as TEE-like
scenarios and secure boot. It can create guest VMs for security use
cases and has virtualization capabilities for both platform and
interrupt. Although the hypervisor can be booted independently, it
requires the assistance of GenieZone hypervisor kernel driver(gzvm-ko)
to leverage the ability of Linux kernel for vCPU scheduling, memory
management, inter-VM communication and virtio backend support.

Add the basic hypervisor driver. Subsequent patches will add more
supported features to this driver.

Signed-off-by: Yingshiuan Pan <yingshiuan.pan@xxxxxxxxxxxx>
Signed-off-by: Jerry Wang <ze-yu.wang@xxxxxxxxxxxx>
Signed-off-by: Liju Chen <liju-clr.chen@xxxxxxxxxxxx>
Signed-off-by: Yi-De Wu <yi-de.wu@xxxxxxxxxxxx>
---
MAINTAINERS | 3 +
arch/arm64/Kbuild | 1 +
arch/arm64/geniezone/Makefile | 9 +++
arch/arm64/geniezone/gzvm_arch_common.h | 37 ++++++++++
arch/arm64/geniezone/vm.c | 40 +++++++++++
drivers/virt/Kconfig | 2 +
drivers/virt/geniezone/Kconfig | 16 +++++
drivers/virt/geniezone/Makefile | 10 +++
drivers/virt/geniezone/gzvm_main.c | 89 +++++++++++++++++++++++++
include/linux/gzvm_drv.h | 25 +++++++
10 files changed, 232 insertions(+)
create mode 100644 arch/arm64/geniezone/Makefile
create mode 100644 arch/arm64/geniezone/gzvm_arch_common.h
create mode 100644 arch/arm64/geniezone/vm.c
create mode 100644 drivers/virt/geniezone/Kconfig
create mode 100644 drivers/virt/geniezone/Makefile
create mode 100644 drivers/virt/geniezone/gzvm_main.c
create mode 100644 include/linux/gzvm_drv.h


[...]

diff --git a/arch/arm64/geniezone/gzvm_arch_common.h
b/arch/arm64/geniezone/gzvm_arch_common.h
new file mode 100644
index 000000000000..10037013ab91
--- /dev/null
+++ b/arch/arm64/geniezone/gzvm_arch_common.h
@@ -0,0 +1,37 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2023 MediaTek Inc.
+ */
+
+#ifndef __GZVM_ARCH_COMMON_H__
+#define __GZVM_ARCH_COMMON_H__
+
+#include <linux/arm-smccc.h>
+
+enum {
+ GZVM_FUNC_PROBE = 12,
+ NR_GZVM_FUNC,
+};
+
+#define SMC_ENTITY_MTK 59
+#define GZVM_FUNCID_START (0x1000)
+#define GZVM_HCALL_ID(func) \
+ ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, ARM_SMCCC_SMC_32, \
+ SMC_ENTITY_MTK, (GZVM_FUNCID_START + (func)))
+

ARM_SMCCC_SMC_32? Really? You never pass a 64bit quantity anywhere?

I'm half tempted to enforce the truncation to 32bit.

M.
--
Jazz is not dead. It just smells funny...