1 Star 0 Fork 38

xisme/qemu-kvm_src-anolis

forked from src-anolis-os/qemu-kvm 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
1055-anolis-target-i386-csv-Move-is_hygon_cpu-to-header-f.patch 2.20 KB
一键复制 编辑 原始数据 按行查看 历史
From 00e7b439f3c514d8ae20c20d5f18d24d71351c7d Mon Sep 17 00:00:00 2001
From: hanliyang <hanliyang@hygon.cn>
Date: Wed, 1 Nov 2023 06:00:11 +0000
Subject: [PATCH 18/29] anolis: target/i386: csv: Move is_hygon_cpu() to header
file csv.h
The helper function is_hygon_cpu() will be called by functions out of
target/i386/csv.c. Move it to header file csv.h so that it can be a
common helper function.
Signed-off-by: hanliyang <hanliyang@hygon.cn>
---
target/i386/csv.c | 20 --------------------
target/i386/csv.h | 22 ++++++++++++++++++++++
2 files changed, 22 insertions(+), 20 deletions(-)
diff --git a/target/i386/csv.c b/target/i386/csv.c
index d166d3775..161cad39a 100644
--- a/target/i386/csv.c
+++ b/target/i386/csv.c
@@ -27,28 +27,8 @@
CsvGuestState csv_guest = { 0 };
-#define CPUID_VENDOR_HYGON_EBX 0x6f677948 /* "Hygo" */
-#define CPUID_VENDOR_HYGON_ECX 0x656e6975 /* "uine" */
-#define CPUID_VENDOR_HYGON_EDX 0x6e65476e /* "nGen" */
-
#define GUEST_POLICY_CSV_BIT (1 << 6)
-static bool 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;
-}
-
int
csv_init(uint32_t policy, int fd, void *state, struct sev_ops *ops)
{
diff --git a/target/i386/csv.h b/target/i386/csv.h
index 7dc5c7536..4f5b2773c 100644
--- a/target/i386/csv.h
+++ b/target/i386/csv.h
@@ -16,6 +16,28 @@
#include "qapi/qapi-commands-misc-target.h"
+#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 __attribute__((unused)) bool 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;
+}
+
#ifdef CONFIG_CSV
bool csv_enabled(void);
#else
--
2.31.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/xisme/qemu-kvm_src-anolis.git
git@gitee.com:xisme/qemu-kvm_src-anolis.git
xisme
qemu-kvm_src-anolis
qemu-kvm_src-anolis
vtkm_support_csv

搜索帮助

371d5123 14472233 46e8bd33 14472233