From nobody Wed Jan 15 17:07:17 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 171099203945414.335671955573048; Wed, 20 Mar 2024 20:33:59 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 48A7E1F4A; Wed, 20 Mar 2024 23:33:58 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 79C3220EA; Wed, 20 Mar 2024 23:32:33 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id B35F71D46; Wed, 20 Mar 2024 23:32:26 -0400 (EDT) Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by lists.libvirt.org (Postfix) with ESMTP id E1AC61D46 for ; Wed, 20 Mar 2024 23:32:06 -0400 (EDT) Received: from loongson.cn (unknown [10.2.5.185]) by gateway (Coremail) with SMTP id _____8BxC+neqftlw6cbAA--.45895S3; Thu, 21 Mar 2024 11:30:38 +0800 (CST) Received: from localhost.localdomain (unknown [10.2.5.185]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Cxf8_VqftlE2JfAA--.54088S5; Thu, 21 Mar 2024 11:30:38 +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: [libvirt PATCH V4 3/4] Implement the method of getting host info for loongarch Date: Thu, 21 Mar 2024 11:30:28 +0800 Message-Id: X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 X-CM-TRANSID: AQAAf8Cxf8_VqftlE2JfAA--.54088S5 X-CM-SenderInfo: 5ol0xt5qjotxo6or00hjvr0hdfq/ X-Coremail-Antispam: 1Uk129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7KY7 ZEXasCq-sGcSsGvfJ3UbIjqfuFe4nvWSU5nxnvy29KBjDU0xBIdaVrnUUvcSsGvfC2Kfnx nUUI43ZEXa7xR_UUUUUUUUU== Message-ID-Hash: 46MIQYAUPOMCKX3COTOM6ZTMM63UCD5Z X-Message-ID-Hash: 46MIQYAUPOMCKX3COTOM6ZTMM63UCD5Z 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, lixianglai@loongson.cn 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: 1710992040559100001 Implement method for loongarch to get host info, such as cpu frequency, system info, etc. 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 8545f993ea..a94318da0d 100644 --- a/src/util/virarch.c +++ b/src/util/virarch.c @@ -223,6 +223,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 a3781ca870..01de69c0d1 100644 --- a/src/util/virhostcpu.c +++ b/src/util/virhostcpu.c @@ -575,6 +575,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", @@ -601,7 +603,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. */ @@ -1672,7 +1674,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