From nobody Sat Dec 21 16:09:40 2024 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 1704857121750798.5854609267409; Tue, 9 Jan 2024 19:25:21 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id B0C891C10; Tue, 9 Jan 2024 22:25:20 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id DDAE91B96; Tue, 9 Jan 2024 22:21:21 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 248D11B57; Tue, 9 Jan 2024 22:21:07 -0500 (EST) Received: from mx1.osci.io (polly.osci.io [8.43.85.229]) (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 9BB361AED for ; Tue, 9 Jan 2024 22:21:06 -0500 (EST) Received: by mx1.osci.io (Postfix, from userid 994) id 5437F2210C; Tue, 9 Jan 2024 22:21:06 -0500 (EST) Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by mx1.osci.io (Postfix) with ESMTP id 48398220FD for ; Tue, 9 Jan 2024 22:21:05 -0500 (EST) Received: from loongson.cn (unknown [10.2.5.185]) by gateway (Coremail) with SMTP id _____8DxvrseDZ5lHLcDAA--.3230S3; Wed, 10 Jan 2024 11:21:02 +0800 (CST) Received: from localhost.localdomain (unknown [10.2.5.185]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Bx+90YDZ5lPBoKAA--.27070S5; Wed, 10 Jan 2024 11:21:01 +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 V2 3/4] Implement the method of getting host info for loongarch Date: Wed, 10 Jan 2024 11:07:48 +0800 Message-Id: <09a5a680264fe209abdb8cc7c5cbf799a3983f9e.1704369486.git.lixianglai@loongson.cn> X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 X-CM-TRANSID: AQAAf8Bx+90YDZ5lPBoKAA--.27070S5 X-CM-SenderInfo: 5ol0xt5qjotxo6or00hjvr0hdfq/ X-Coremail-Antispam: 1Uk129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7KY7 ZEXasCq-sGcSsGvfJ3UbIjqfuFe4nvWSU5nxnvy29KBjDU0xBIdaVrnUUvcSsGvfC2Kfnx nUUI43ZEXa7xR_UUUUUUUUU== Message-ID-Hash: E4E7E57DGMRDY65C2L2S3AG2JGZ3IJOE X-Message-ID-Hash: E4E7E57DGMRDY65C2L2S3AG2JGZ3IJOE X-MailFrom: SRS0=i89f=IU=loongson.cn=lixianglai@osci.io 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: 1704857123030100001 From: xianglai li 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 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