1 Star 0 Fork 71

梓瑶/libvirt

forked from src-openEuler/libvirt 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Implement-the-method-of-getting-host-info-for-loonga.patch 2.19 KB
一键复制 编辑 原始数据 按行查看 历史
zhaotianrui 提交于 2023-03-18 10:38 . libvirt update to version 6.2.0-52
From 4123437e633f05af0ae8091d5db440597394ba36 Mon Sep 17 00:00:00 2001
From: zhaotianrui <zhaotianrui@loongson.cn>
Date: Wed, 11 Jan 2023 14:09:41 -0500
Subject: [PATCH 4/4] Implement the method of getting host info for loongarch
Implement method for loongarch to get host info, such as
cpu frequency, system info, etc.
Signed-off-by: zhaotianrui <zhaotianrui@loongson.cn>
---
src/util/virarch.c | 2 ++
src/util/virhostcpu.c | 2 +-
src/util/virsysinfo.c | 3 ++-
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/util/virarch.c b/src/util/virarch.c
index decdbdd7ac..0520a1c80b 100644
--- a/src/util/virarch.c
+++ b/src/util/virarch.c
@@ -227,6 +227,8 @@ virArch virArchFromHost(void)
arch = VIR_ARCH_X86_64;
} else if (STREQ(ut.machine, "sw_64")) {
arch = VIR_ARCH_SW_64;
+ } else if (STREQ(ut.machine, "loongarch64")) {
+ arch = VIR_ARCH_LOONGARCH64;
} else {
/* Otherwise assume the canonical name */
if ((arch = virArchFromString(ut.machine)) == VIR_ARCH_NONE) {
diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c
index 5ec98d6016..ce3da7e6ec 100644
--- a/src/util/virhostcpu.c
+++ b/src/util/virhostcpu.c
@@ -577,7 +577,7 @@ virHostCPUParseFrequency(FILE *cpuinfo,
char line[1024];
/* No sensible way to retrieve CPU frequency */
- if (ARCH_IS_ARM(arch))
+ if (ARCH_IS_ARM(arch) || ARCH_IS_LOONGARCH(arch))
return 0;
if (ARCH_IS_X86(arch))
diff --git a/src/util/virsysinfo.c b/src/util/virsysinfo.c
index 8a53702224..6d4778fed7 100644
--- a/src/util/virsysinfo.c
+++ b/src/util/virsysinfo.c
@@ -1190,7 +1190,7 @@ virSysinfoRead(void)
{
#if defined(__powerpc__)
return virSysinfoReadPPC();
-#elif defined(__arm__) || defined(__aarch64__)
+#elif defined(__arm__) || defined(__aarch64__) || defined(__loongarch__)
return virSysinfoReadARM();
#elif defined(__s390__) || defined(__s390x__)
return virSysinfoReadS390();
@@ -1198,6 +1198,7 @@ virSysinfoRead(void)
(defined(__x86_64__) || \
defined(__i386__) || \
defined(__amd64__) || \
+ defined(__loongarch__) || \
defined(__sw_64__))
return virSysinfoReadDMI();
#else /* WIN32 || not supported arch */
--
2.25.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ziyao233/libvirt.git
git@gitee.com:ziyao233/libvirt.git
ziyao233
libvirt
libvirt
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385