From nobody Thu Jan 2 16:24:29 2025 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 170485723519357.25853136423643; Tue, 9 Jan 2024 19:27:15 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 24C871CBC; Tue, 9 Jan 2024 22:27:14 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 8F02F1BB2; Tue, 9 Jan 2024 22:21:23 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id BB8C81B57; Tue, 9 Jan 2024 22:21:12 -0500 (EST) Received: from mx2.osci.io (francine.osci.io [8.43.85.230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id A06AD1B57 for ; Tue, 9 Jan 2024 22:21:10 -0500 (EST) Received: by mx2.osci.io (Postfix, from userid 994) id 6F5AB413C4; Tue, 9 Jan 2024 22:21:10 -0500 (EST) Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by mx2.osci.io (Postfix) with ESMTP id B2E5B41925 for ; Tue, 9 Jan 2024 22:21:07 -0500 (EST) Received: from loongson.cn (unknown [10.2.5.185]) by gateway (Coremail) with SMTP id _____8DxzvAhDZ5lJLcDAA--.11478S3; Wed, 10 Jan 2024 11:21:05 +0800 (CST) Received: from localhost.localdomain (unknown [10.2.5.185]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Bx+90YDZ5lPBoKAA--.27070S9; Wed, 10 Jan 2024 11:21:04 +0800 (CST) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 From: Xianglai Li To: devel@lists.libvirt.org Subject: [PATCH 3/4] Implement the method of getting host info for loongarch Date: Wed, 10 Jan 2024 11:07:52 +0800 Message-Id: <20240110030812.878812-3-lixianglai@loongson.cn> X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 X-CM-TRANSID: AQAAf8Bx+90YDZ5lPBoKAA--.27070S9 X-CM-SenderInfo: 5ol0xt5qjotxo6or00hjvr0hdfq/ X-Coremail-Antispam: 1Uk129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7KY7 ZEXasCq-sGcSsGvfJ3UbIjqfuFe4nvWSU5nxnvy29KBjDU0xBIdaVrnUUvcSsGvfC2Kfnx nUUI43ZEXa7xR_UUUUUUUUU== Message-ID-Hash: NOAEPJPXXSBK7S6QDRHHWJPZ4ZXGBK5K X-Message-ID-Hash: NOAEPJPXXSBK7S6QDRHHWJPZ4ZXGBK5K X-MailFrom: lixianglai@loongson.cn X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: maobibo@loongson.cn, lichao@loongson.cn, jiyin@redhat.com, xianglai li X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1704857237454100001 From: xianglai li Implement method for loongarch to get host info, such as cpu frequency, system info, etc. Signed-off-by: "Xianglai Li" Signed-off-by: Xianglai Li --- src/util/virarch.c | 2 ++ src/util/virhostcpu.c | 7 +++++-- src/util/virsysinfo.c | 3 ++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/util/virarch.c b/src/util/virarch.c index 74b7ec6f1b..20f54a6040 100644 --- a/src/util/virarch.c +++ b/src/util/virarch.c @@ -224,6 +224,8 @@ virArch virArchFromHost(void) arch =3D VIR_ARCH_X86_64; } else if (STREQ(ut.machine, "arm64")) { arch =3D VIR_ARCH_AARCH64; + } else if (STREQ(ut.machine, "loongarch64")) { + arch =3D VIR_ARCH_LOONGARCH64; } else { /* Otherwise assume the canonical name */ if ((arch =3D virArchFromString(ut.machine)) =3D=3D VIR_ARCH_NONE)= { diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c index 4027547e1e..c809fc0d7a 100644 --- a/src/util/virhostcpu.c +++ b/src/util/virhostcpu.c @@ -553,6 +553,8 @@ virHostCPUParseFrequency(FILE *cpuinfo, prefix =3D "clock"; else if (ARCH_IS_S390(arch)) prefix =3D "cpu MHz dynamic"; + else if (ARCH_IS_LOONGARCH(arch)) + prefix =3D "CPU MHz"; =20 if (!prefix) { VIR_WARN("%s is not supported by the %s parser", @@ -579,7 +581,7 @@ virHostCPUParsePhysAddrSize(FILE *cpuinfo, unsigned int= *addrsz) char *str; char *endptr; =20 - if (!(str =3D STRSKIP(line, "address sizes"))) + if (!(str =3D STRCASESKIP(line, "address sizes"))) continue; =20 /* Skip the colon. */ @@ -1650,7 +1652,8 @@ virHostCPUGetPhysAddrSize(const virArch hostArch, { g_autoptr(FILE) cpuinfo =3D NULL; =20 - 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 */ *size =3D 0; return 0; diff --git a/src/util/virsysinfo.c b/src/util/virsysinfo.c index 36a861c53f..4a03fc3246 100644 --- a/src/util/virsysinfo.c +++ b/src/util/virsysinfo.c @@ -1248,7 +1248,8 @@ virSysinfoRead(void) #elif !defined(WIN32) && \ (defined(__x86_64__) || \ defined(__i386__) || \ - defined(__amd64__)) + defined(__amd64__) || \ + defined(__loongarch__)) return virSysinfoReadDMI(); #else /* WIN32 || not supported arch */ /* --=20 2.39.1 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org