From nobody Tue Apr 16 17:03:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1557490836; cv=none; d=zoho.com; s=zohoarc; b=MJvDoTw06KILpYjXr7tzjHMGK3eTA94pl/436hqYasCI9Dbo3S7bi7JOAejny9Hdamq+gBWPotfBQ65lWj0ajKaW/tOQlaV0H/QuqLjVK5yjiFwbAlNz3oXANhIH/HMbmbLnAZtKGu9VdlIJJeKnWN0G0L1wF6p8crH+wDMiVJc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557490836; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=y2unKlfdpN/I7BBRlRHF5OQsQLK09DRror4odiGUsko=; b=MmaDM5C2BYoW+Z8eudwiOUqLJW/LxRgrXNaliR5s06cq/Y5HvbpDZJ/cOFCUaEAsspy4c4nflGnAyn1EHSZ6X1cYAhnY5Q9C+6sLhIDA2zsEtLlHni197yy4XqoVPuMNLePzhuQmn1mGSaO///YhLw0HEDc1TP/iNolFMWG7Ppo= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1557490836151606.3529998871371; Fri, 10 May 2019 05:20:36 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5596C3084021; Fri, 10 May 2019 12:20:34 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 22268646D8; Fri, 10 May 2019 12:20:34 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id C7BCF41F56; Fri, 10 May 2019 12:20:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x4ACKWhT019503 for ; Fri, 10 May 2019 08:20:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5142660FFD; Fri, 10 May 2019 12:20:32 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id CE16A60BFB for ; Fri, 10 May 2019 12:20:29 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Fri, 10 May 2019 14:20:24 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 1/2] virsysinfo: Rename virSysinfoReadX86 to virSysinfoReadDMI X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Fri, 10 May 2019 12:20:34 +0000 (UTC) Content-Type: text/plain; charset="utf-8" There's nothing x86 specific about this function. Rename the function so that it has DMI suffix which enables it to be reused on different arches (as using X86 from say ARM would look suspicious). Signed-off-by: Michal Privoznik --- src/libvirt_private.syms | 2 +- src/util/virsysinfo.c | 4 ++-- src/util/virsysinfopriv.h | 2 +- tests/sysinfotest.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 909975750c..f2b8dc445d 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -3070,9 +3070,9 @@ virSysinfoSystemDefFree; =20 # util/virsysinfopriv.h virSysinfoReadARM; +virSysinfoReadDMI; virSysinfoReadPPC; virSysinfoReadS390; -virSysinfoReadX86; =20 =20 # util/virsystemd.h diff --git a/src/util/virsysinfo.c b/src/util/virsysinfo.c index 6c3adc23ab..b371e8dd26 100644 --- a/src/util/virsysinfo.c +++ b/src/util/virsysinfo.c @@ -1139,7 +1139,7 @@ virSysinfoParseX86Memory(const char *base, virSysinfo= DefPtr ret) } =20 virSysinfoDefPtr -virSysinfoReadX86(void) +virSysinfoReadDMI(void) { char *path; virSysinfoDefPtr ret =3D NULL; @@ -1220,7 +1220,7 @@ virSysinfoRead(void) (defined(__x86_64__) || \ defined(__i386__) || \ defined(__amd64__)) - return virSysinfoReadX86(); + return virSysinfoReadDMI(); #else /* WIN32 || not supported arch */ /* * this can probably be extracted from Windows using API or registry diff --git a/src/util/virsysinfopriv.h b/src/util/virsysinfopriv.h index 3ef675441e..b7beb44807 100644 --- a/src/util/virsysinfopriv.h +++ b/src/util/virsysinfopriv.h @@ -39,6 +39,6 @@ virSysinfoDefPtr virSysinfoReadS390(void); =20 virSysinfoDefPtr -virSysinfoReadX86(void); +virSysinfoReadDMI(void); =20 #endif /* LIBVIRT_VIRSYSINFOPRIV_H */ diff --git a/tests/sysinfotest.c b/tests/sysinfotest.c index 7fa9a2dfd6..4d03fd3809 100644 --- a/tests/sysinfotest.c +++ b/tests/sysinfotest.c @@ -133,7 +133,7 @@ mymain(void) TEST("s390", virSysinfoReadS390); TEST("s390-freq", virSysinfoReadS390); TEST("ppc", virSysinfoReadPPC); - TEST_FULL("x86", virSysinfoReadX86, "/sysinfodata/dmidecode.sh"); + TEST_FULL("x86", virSysinfoReadDMI, "/sysinfodata/dmidecode.sh"); TEST("arm", virSysinfoReadARM); TEST("arm-rpi2", virSysinfoReadARM); TEST("aarch64", virSysinfoReadARM); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 16 17:03:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1557490837; cv=none; d=zoho.com; s=zohoarc; b=SG0y9RCb8xoXmdgZ8jF1X/fZM1KSq0XVmme8o/KfAohGxPsXfPrYRCIpoT2hFbw4GFWcbzCltFs8+hv/DkJSitWcOMoZ18gR7WqTljPKdkotfDy4OMOpQIwaIdz+c8Kpqf5oJ3TtEcRpQGNconbnH7fO9nzkuolQ8qryTAkFv2o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557490837; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=UO1P+zAOeg3soMxcKRZwXXuf9F69RvawAIySODeth/o=; b=jidkXrN6v2YV4BdrzHAijR8xs8xa4DOwhWoJ0f37pH1+HeYeqVvIkJYwICrXGfmE7m4bn3mLfpbKJfoRMDgZ4tvUcmrxcLUd0aA5JcfxDY/QC45s/K8t5/f29t5IxsI+7ip0Pl1/I7etK7XJdgGVKn/bSTF/IxYCrH9D1n3LNJ0= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1557490837276906.5204448435455; Fri, 10 May 2019 05:20:37 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9933F59450; Fri, 10 May 2019 12:20:35 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 769C26108E; Fri, 10 May 2019 12:20:35 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 2B41D41F5C; Fri, 10 May 2019 12:20:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x4ACKYUa019513 for ; Fri, 10 May 2019 08:20:34 -0400 Received: by smtp.corp.redhat.com (Postfix) id A68D460FFD; Fri, 10 May 2019 12:20:34 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2E3F760BFB for ; Fri, 10 May 2019 12:20:32 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Fri, 10 May 2019 14:20:25 +0200 Message-Id: <507e939e695922036354f1a1055b2dbdc2d4fbd6.1557490416.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 2/2] virSysinfoReadARM: Try reading DMI table X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 10 May 2019 12:20:36 +0000 (UTC) Content-Type: text/plain; charset="utf-8" https://bugzilla.redhat.com/show_bug.cgi?id=3D1426162 Turns out, some aarch64 systems have SMBIOS info. That means we can use dmidecode to fetch some information. If that fails, fall back to the old behaviour. Signed-off-by: Michal Privoznik --- src/util/virsysinfo.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/util/virsysinfo.c b/src/util/virsysinfo.c index b371e8dd26..83da3897ce 100644 --- a/src/util/virsysinfo.c +++ b/src/util/virsysinfo.c @@ -192,6 +192,14 @@ void virSysinfoDefFree(virSysinfoDefPtr def) } =20 =20 +static bool +virSysinfoDefEmpty(const virSysinfoDef *def) +{ + return !(def->bios || def->system || def->nbaseBoard || + def->chassis || def->nprocessor || def->nmemory || def->oemSt= rings); +} + + static int virSysinfoParsePPCSystem(const char *base, virSysinfoSystemDefPtr *sysdef) { @@ -433,6 +441,16 @@ virSysinfoReadARM(void) virSysinfoDefPtr ret =3D NULL; char *outbuf =3D NULL; =20 + /* Some ARM systems have DMI tables available. */ + if ((ret =3D virSysinfoReadDMI())) { + if (!virSysinfoDefEmpty(ret)) + return ret; + virSysinfoDefFree(ret); + } + + /* Well, we've tried. Fall back to parsing cpuinfo */ + virResetLastError(); + if (VIR_ALLOC(ret) < 0) goto no_memory; =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list