1 Star 0 Fork 123

roy/qemu

forked from src-openEuler/qemu 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
target-i386-Introduce-header-file-csv.h.patch 2.44 KB
一键复制 编辑 原始数据 按行查看 历史
Jiabo Feng 提交于 2024-09-18 15:20 . QEMU update to version 8.2.0-18:
From 2bdf07593dbec66205f2f20fa5430595678ded89 Mon Sep 17 00:00:00 2001
From: hanliyang <hanliyang@hygon.cn>
Date: Thu, 14 Mar 2024 19:21:11 +0800
Subject: [PATCH] target/i386: Introduce header file csv.h
This header file is used to provide common helper functions
and data structures for Hygon CSV.
Signed-off-by: hanliyang <hanliyang@hygon.cn>
---
configs/devices/i386-softmmu/default.mak | 1 +
hw/i386/Kconfig | 5 +++
target/i386/csv.h | 47 ++++++++++++++++++++++++
3 files changed, 53 insertions(+)
create mode 100644 target/i386/csv.h
diff --git a/configs/devices/i386-softmmu/default.mak b/configs/devices/i386-softmmu/default.mak
index 598c6646df..db83ffcab9 100644
--- a/configs/devices/i386-softmmu/default.mak
+++ b/configs/devices/i386-softmmu/default.mak
@@ -23,6 +23,7 @@
#CONFIG_TPM_TIS_ISA=n
#CONFIG_VTD=n
#CONFIG_SGX=n
+#CONFIG_CSV=n
# Boards:
#
diff --git a/hw/i386/Kconfig b/hw/i386/Kconfig
index 55850791df..08f3ae43f8 100644
--- a/hw/i386/Kconfig
+++ b/hw/i386/Kconfig
@@ -10,6 +10,10 @@ config SGX
bool
depends on KVM
+config CSV
+ bool
+ depends on SEV
+
config PC
bool
imply APPLESMC
@@ -26,6 +30,7 @@ config PC
imply QXL
imply SEV
imply SGX
+ imply CSV
imply TEST_DEVICES
imply TPM_CRB
imply TPM_TIS_ISA
diff --git a/target/i386/csv.h b/target/i386/csv.h
new file mode 100644
index 0000000000..f935babe97
--- /dev/null
+++ b/target/i386/csv.h
@@ -0,0 +1,47 @@
+/*
+ * QEMU CSV support
+ *
+ * Copyright: Hygon Info Technologies Ltd. 2022
+ *
+ * Author:
+ * Jiang Xin <jiangxin@hygon.cn>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ *
+ */
+
+#ifndef I386_CSV_H
+#define I386_CSV_H
+
+#ifdef CONFIG_CSV
+
+#include "cpu.h"
+
+#define CPUID_VENDOR_HYGON_EBX 0x6f677948 /* "Hygo" */
+#define CPUID_VENDOR_HYGON_ECX 0x656e6975 /* "uine" */
+#define CPUID_VENDOR_HYGON_EDX 0x6e65476e /* "nGen" */
+
+static bool __attribute__((unused)) is_hygon_cpu(void)
+{
+ uint32_t ebx = 0;
+ uint32_t ecx = 0;
+ uint32_t edx = 0;
+
+ host_cpuid(0, 0, NULL, &ebx, &ecx, &edx);
+
+ if (ebx == CPUID_VENDOR_HYGON_EBX &&
+ ecx == CPUID_VENDOR_HYGON_ECX &&
+ edx == CPUID_VENDOR_HYGON_EDX)
+ return true;
+ else
+ return false;
+}
+
+#else
+
+#define is_hygon_cpu() (false)
+
+#endif
+
+#endif
--
2.41.0.windows.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/roygiteee/qemu.git
git@gitee.com:roygiteee/qemu.git
roygiteee
qemu
qemu
master

搜索帮助