mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
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: Xianglai Li <lixianglai@loongson.cn> Reviewed-by: Andrea Bolognani <abologna@redhat.com>
This commit is contained in:
parent
3243783c32
commit
0038b155ec
@ -223,6 +223,8 @@ virArch virArchFromHost(void)
|
|||||||
arch = VIR_ARCH_X86_64;
|
arch = VIR_ARCH_X86_64;
|
||||||
} else if (STREQ(ut.machine, "arm64")) {
|
} else if (STREQ(ut.machine, "arm64")) {
|
||||||
arch = VIR_ARCH_AARCH64;
|
arch = VIR_ARCH_AARCH64;
|
||||||
|
} else if (STREQ(ut.machine, "loongarch64")) {
|
||||||
|
arch = VIR_ARCH_LOONGARCH64;
|
||||||
} else {
|
} else {
|
||||||
/* Otherwise assume the canonical name */
|
/* Otherwise assume the canonical name */
|
||||||
if ((arch = virArchFromString(ut.machine)) == VIR_ARCH_NONE) {
|
if ((arch = virArchFromString(ut.machine)) == VIR_ARCH_NONE) {
|
||||||
|
@ -575,6 +575,8 @@ virHostCPUParseFrequency(FILE *cpuinfo,
|
|||||||
prefix = "clock";
|
prefix = "clock";
|
||||||
else if (ARCH_IS_S390(arch))
|
else if (ARCH_IS_S390(arch))
|
||||||
prefix = "cpu MHz dynamic";
|
prefix = "cpu MHz dynamic";
|
||||||
|
else if (ARCH_IS_LOONGARCH(arch))
|
||||||
|
prefix = "CPU MHz";
|
||||||
|
|
||||||
if (!prefix) {
|
if (!prefix) {
|
||||||
VIR_WARN("%s is not supported by the %s parser",
|
VIR_WARN("%s is not supported by the %s parser",
|
||||||
@ -601,7 +603,7 @@ virHostCPUParsePhysAddrSize(FILE *cpuinfo, unsigned int *addrsz)
|
|||||||
char *str;
|
char *str;
|
||||||
char *endptr;
|
char *endptr;
|
||||||
|
|
||||||
if (!(str = STRSKIP(line, "address sizes")))
|
if (!(str = STRCASESKIP(line, "address sizes")))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Skip the colon. */
|
/* Skip the colon. */
|
||||||
@ -1672,7 +1674,8 @@ virHostCPUGetPhysAddrSize(const virArch hostArch,
|
|||||||
{
|
{
|
||||||
g_autoptr(FILE) cpuinfo = NULL;
|
g_autoptr(FILE) cpuinfo = NULL;
|
||||||
|
|
||||||
if (!(ARCH_IS_X86(hostArch) || ARCH_IS_SH4(hostArch))) {
|
if (!(ARCH_IS_X86(hostArch) || ARCH_IS_SH4(hostArch) ||
|
||||||
|
ARCH_IS_LOONGARCH(hostArch))) {
|
||||||
/* Ensure size is set to 0 as physical address size is unknown */
|
/* Ensure size is set to 0 as physical address size is unknown */
|
||||||
*size = 0;
|
*size = 0;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1248,7 +1248,8 @@ virSysinfoRead(void)
|
|||||||
#elif !defined(WIN32) && \
|
#elif !defined(WIN32) && \
|
||||||
(defined(__x86_64__) || \
|
(defined(__x86_64__) || \
|
||||||
defined(__i386__) || \
|
defined(__i386__) || \
|
||||||
defined(__amd64__))
|
defined(__amd64__) || \
|
||||||
|
defined(__loongarch__))
|
||||||
return virSysinfoReadDMI();
|
return virSysinfoReadDMI();
|
||||||
#else /* WIN32 || not supported arch */
|
#else /* WIN32 || not supported arch */
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user