From nobody Sat Apr 27 05:17:37 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=1555303919; cv=none; d=zoho.com; s=zohoarc; b=KdNoIy2QtlIk9BB1bjEYd27I0F94r56CtBnAdVK3AXI56fMb6K7bnipaEoGu7h7k/Zu/dzNKOkaUsHRkpU/4GUg6Vz8YtkT0qtX6ZyEyOs+AHK/LaOnbO3kfsnFmtkw+OwHduYxmDyxFYvDRmqYxDFn0eh4ngDO5EPw4qaf7skY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555303919; h=Content-Type:Content-Transfer-Encoding:Cc: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=Wv5HR3Vf96NxyMbSlPbN+pfLQNUKCH5UTbiUGgIpdns=; b=GpmLMgGYCPtVsFzyZrVl8MXH9yVG87jrD7e8qpbAs4kixH/R1C0CVu2oEfXg4mw1H7Qa54vKDJzMbDZVMqD+dXD7pMLwxISqdxEiw1F3hUpWVyfxYRON7qBI7xZWXDMTbk6z9Xjf5621tSiKZQkxHs+GQbaQHch8BQbDpcreHxs= 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 1555303919076204.96289917311094; Sun, 14 Apr 2019 21:51:59 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 55FEE59441; Mon, 15 Apr 2019 04:51:57 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2388C6014E; Mon, 15 Apr 2019 04:51:57 +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 DBFDB181AC8F; Mon, 15 Apr 2019 04:51:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x3F4obW8004977 for ; Mon, 15 Apr 2019 00:50:37 -0400 Received: by smtp.corp.redhat.com (Postfix) id 73915608C1; Mon, 15 Apr 2019 04:50:37 +0000 (UTC) Received: from localhost.localdomain (unknown [10.35.206.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4843C608BF; Mon, 15 Apr 2019 04:50:35 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Mon, 15 Apr 2019 06:50:17 +0200 Message-Id: <375e18192379a333f582c15e7f119f9a0a21a32e.1555303284.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: bwalk@linux.ibm.com, jdenemar@redhat.com Subject: [libvirt] [PATCH 1/3] virhostcpu.c: Fix misalignment in virHostCPUGetMSRFromKVM comment 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 15 Apr 2019 04:51:57 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Michal Privoznik Reviewed-by: Jiri Denemark --- src/util/virhostcpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c index 10bf3a93d5..dabe3eed82 100644 --- a/src/util/virhostcpu.c +++ b/src/util/virhostcpu.c @@ -1301,7 +1301,7 @@ virHostCPUGetMSRFromKVM(unsigned long index ATTRIBUTE= _UNUSED, /* * Returns 0 on success, * 1 when the MSR is not supported by the host CPU, -* -1 on error. + * -1 on error. */ int virHostCPUGetMSR(unsigned long index, --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 05:17:37 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=1555303915; cv=none; d=zoho.com; s=zohoarc; b=kWBYIiczG4WCYgQ5KrRS7DA/bjgBmq7Pg2MPNvlHON7h7DdSXFMn9eWuKwifhW/LLVlHficlhEwqUAYIWPIfqoqFKw/KgRWNGST4idAECOfCFDop1qXYwnweT9mFsbeTPJ00Y4QuuIm+q9jjShlj+K27fq8zGVxJJAesyc5fk7g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555303915; h=Content-Type:Content-Transfer-Encoding:Cc: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=SYEhN1DqXQOHCIjJkD0l63Da80uKM+Xo1lQ0K1znCcY=; b=dCK082an1aXF0DSjwExtpr4rFt9MoONbE7dtXMfIitlSPRpVG75JqMLX+T7XqZZ5J2kEqMpgqOkLChUgbt6/qAeAXUF8IGOTeNHM97rkUBdD9U5G41lBWJ2fptpngsrvOlNgYtxvzgKY6m592jI5iZf0QtEuMEhRWuv2xxbO5YI= 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 1555303915143815.0393202427309; Sun, 14 Apr 2019 21:51:55 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5950030832CB; Mon, 15 Apr 2019 04:51:53 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 050FC1018A0C; Mon, 15 Apr 2019 04:51:53 +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 BE06F181AC47; Mon, 15 Apr 2019 04:51:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x3F4ogMg004993 for ; Mon, 15 Apr 2019 00:50:42 -0400 Received: by smtp.corp.redhat.com (Postfix) id 25729608C1; Mon, 15 Apr 2019 04:50:42 +0000 (UTC) Received: from localhost.localdomain (unknown [10.35.206.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4933D608BF; Mon, 15 Apr 2019 04:50:38 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Mon, 15 Apr 2019 06:50:18 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: bwalk@linux.ibm.com, jdenemar@redhat.com Subject: [libvirt] [PATCH 2/3] virhostcpu: Make virHostCPUGetMSR() work only on x86 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.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Mon, 15 Apr 2019 04:51:53 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Model specific registers are a thing only on x86. Also, the /dev/cpu/0/msr path exists only on Linux and the fallback mechanism (asking KVM) exists on Linux and FreeBSD only. Therefore, move the function within #ifdef that checks all aforementioned constraints and provide a dummy stub for all other cases. This fixes the build on my arm box, mingw-* builds, etc. Signed-off-by: Michal Privoznik Reviewed-by: Jiri Denemark --- src/util/virhostcpu.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c index dabe3eed82..f4a62c74fa 100644 --- a/src/util/virhostcpu.c +++ b/src/util/virhostcpu.c @@ -1257,7 +1257,9 @@ virHostCPUGetMicrocodeVersion(void) #endif /* __linux__ */ =20 =20 -#if HAVE_LINUX_KVM_H && defined(KVM_GET_MSRS) +#if HAVE_LINUX_KVM_H && defined(KVM_GET_MSRS) && \ + (defined(__i386__) || defined(__x86_64__)) && \ + (defined(__linux__) || defined(__FreeBSD__)) static int virHostCPUGetMSRFromKVM(unsigned long index, uint64_t *result) @@ -1285,19 +1287,6 @@ virHostCPUGetMSRFromKVM(unsigned long index, return 0; } =20 -#else - -static int -virHostCPUGetMSRFromKVM(unsigned long index ATTRIBUTE_UNUSED, - uint64_t *result ATTRIBUTE_UNUSED) -{ - virReportSystemError(ENOSYS, "%s", - _("Reading MSRs via KVM is not supported on this = platform")); - return -1; -} -#endif /* HAVE_LINUX_KVM_H && defined(KVM_GET_MSRS) */ - - /* * Returns 0 on success, * 1 when the MSR is not supported by the host CPU, @@ -1334,3 +1323,18 @@ virHostCPUGetMSR(unsigned long index, =20 return virHostCPUGetMSRFromKVM(index, msr); } + +#else + +int +virHostCPUGetMSR(unsigned long index ATTRIBUTE_UNUSED, + uint64_t *msr ATTRIBUTE_UNUSED) +{ + virReportSystemError(ENOSYS, "%s", + _("Reading MSRs is not supported on this platform= ")); + return -1; +} + +#endif /* HAVE_LINUX_KVM_H && defined(KVM_GET_MSRS) && \ + (defined(__i386__) || defined(__x86_64__)) && \ + (defined(__linux__) || defined(__FreeBSD__)) */ --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 05:17:37 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=1555303924; cv=none; d=zoho.com; s=zohoarc; b=ntH6LFd5ZEdK+IlGCoHRvgl/pm7J24vhAcejB4XvuS4Q4D7L7p+yRibFdcqPmAAYfcErwPRYRoPV2MP7ueafbW5s94cZoPSre+GDfn1r8kmKV6G/SQ80gz141v0z8A5LZSPU8pMaK/6vlSsRgovkWtid8IVARZr8uVv9/ykd39I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555303924; h=Content-Type:Content-Transfer-Encoding:Cc: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=Su7oRsF/ZZsPP+nexeizVxxpt+4pMa2eqcQxVZG3Mfg=; b=OsuUWYDeFGa8xj2q7kaV9hjCz9JW1KdOA6IipToSJpLjS9ppGOPN3hYlxyTHzJs1WaZHInjLodcEBIjD5doR6Vf6A1RJrOp0a9UMcWdP5X8GszANWytxSWy2r4FU0jzEntCJZXyaE/oFcxkm39i7Tng+xg8RYMOQfipi3IVmvCk= 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 1555303924973305.5399336078225; Sun, 14 Apr 2019 21:52:04 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E65713082E4B; Mon, 15 Apr 2019 04:52:01 +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 BF2D35D717; Mon, 15 Apr 2019 04:52:01 +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 79A3C41F3D; Mon, 15 Apr 2019 04:52:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x3F4okqc005012 for ; Mon, 15 Apr 2019 00:50:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2F340608C1; Mon, 15 Apr 2019 04:50:46 +0000 (UTC) Received: from localhost.localdomain (unknown [10.35.206.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2313D608BF; Mon, 15 Apr 2019 04:50:42 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Mon, 15 Apr 2019 06:50:19 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: bwalk@linux.ibm.com, jdenemar@redhat.com Subject: [libvirt] [PATCH 3/3] cpu_x86: Fix placement of *CheckFeature functions 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Mon, 15 Apr 2019 04:52:02 +0000 (UTC) Content-Type: text/plain; charset="utf-8" In e17d10386 these functions were mistakenly moved into an #ifdef block, but remained used outside of it leaving the build broken for platforms where #ifdef evaluated to false. Signed-off-by: Michal Privoznik Reviewed-by: Jiri Denemark --- src/cpu/cpu_x86.c | 68 ++++++++++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 33 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 1fe6770d57..f05bfa24e0 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -2707,39 +2707,6 @@ cpuidSet(uint32_t base, virCPUDataPtr data) } =20 =20 -static int -virCPUx86CheckFeature(const virCPUDef *cpu, - const char *name) -{ - int ret =3D -1; - virCPUx86MapPtr map; - virCPUx86ModelPtr model =3D NULL; - - if (!(map =3D virCPUx86GetMap())) - return -1; - - if (!(model =3D x86ModelFromCPU(cpu, map, -1))) - goto cleanup; - - ret =3D x86FeatureInData(name, &model->data, map); - - cleanup: - x86ModelFree(model); - return ret; -} - - -static int -virCPUx86DataCheckFeature(const virCPUData *data, - const char *name) -{ - virCPUx86MapPtr map; - - if (!(map =3D virCPUx86GetMap())) - return -1; - - return x86FeatureInData(name, &data->data.x86, map); -} =20 =20 static int @@ -2769,6 +2736,41 @@ virCPUx86GetHost(virCPUDefPtr cpu, #endif =20 =20 +static int +virCPUx86CheckFeature(const virCPUDef *cpu, + const char *name) +{ + int ret =3D -1; + virCPUx86MapPtr map; + virCPUx86ModelPtr model =3D NULL; + + if (!(map =3D virCPUx86GetMap())) + return -1; + + if (!(model =3D x86ModelFromCPU(cpu, map, -1))) + goto cleanup; + + ret =3D x86FeatureInData(name, &model->data, map); + + cleanup: + x86ModelFree(model); + return ret; +} + + +static int +virCPUx86DataCheckFeature(const virCPUData *data, + const char *name) +{ + virCPUx86MapPtr map; + + if (!(map =3D virCPUx86GetMap())) + return -1; + + return x86FeatureInData(name, &data->data.x86, map); +} + + static virCPUDefPtr virCPUx86Baseline(virCPUDefPtr *cpus, unsigned int ncpus, --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list