From nobody Tue Apr 23 10:24:46 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 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=1633950171; cv=none; d=zohomail.com; s=zohoarc; b=WVCOUYkD0SxxGt8BbeC3+e610GOnb82mozQEVk2VsBSrfYEMLsNCRkR+DrtL4R5UY/L7pyRundRq+u+7rxluUyqtvT+uPTgrD8J96lp9JhbUbvdan569CYb+rQnElkZi5IwXOH97mEKlDU2R9Kf3YRQxWKvod2Nh8lHytZk9Djc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633950171; 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; bh=kLoMDo5AAjI7fd1RBrr3KLzQIEMuA17rIRI8I0Upu/w=; b=dqexPNq66rgufydTL+Qcv8/pRyYORXtfLLBaPExc7FqxZt06EM2D9Q7FN1ctLuNoMXrlkBsKU1Z823Jl1XMELBQI4n6b7wAxns8ol6E+NwswvWMQx55kcQSdXmrEupeeVCgQdbeK415hViC6Ywz+JI8j291T4yegEZa0NnqSLuQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1633950170863253.83741957168615; Mon, 11 Oct 2021 04:02:50 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-56-gWBpgpALMKug61OVduVT7A-1; Mon, 11 Oct 2021 07:02:48 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 07B7A10A8E01; Mon, 11 Oct 2021 11:02:43 +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 93C3E1017E28; Mon, 11 Oct 2021 11:02:42 +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 CCD4E4E590; Mon, 11 Oct 2021 11:02:41 +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 19BB2em5012788 for ; Mon, 11 Oct 2021 07:02:40 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1DA9D60C5F; Mon, 11 Oct 2021 11:02:40 +0000 (UTC) Received: from work.redhat.com (unknown [10.39.193.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5244460BF4; Mon, 11 Oct 2021 11:02:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633950169; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=kLoMDo5AAjI7fd1RBrr3KLzQIEMuA17rIRI8I0Upu/w=; b=W9wxSNF9hHKZaDLkT6YmrtwR3rMOgO2uFo3KTMgzwrb3XhZU64BrCJFgapRxvFmo2hlW8e m/99SJrUvF3oNEJd/Oie6V/zjUlmMY/fA3uloEz0+/qN8XUkZFaW7ocMJDjuRpqLFvh45i yAHC3DFwzf2jxin7Ttc4mWMU+WIv5cM= X-MC-Unique: gWBpgpALMKug61OVduVT7A-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 1/5] cpu_arm: No need to protect macro definitions Date: Mon, 11 Oct 2021 13:02:24 +0200 Message-Id: <20211011110228.46312-2-twiederh@redhat.com> In-Reply-To: <20211011110228.46312-1-twiederh@redhat.com> References: <20211011110228.46312-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633950172348100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake --- src/cpu/cpu_arm.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c index 09ade1d422..ac174891b7 100644 --- a/src/cpu/cpu_arm.c +++ b/src/cpu/cpu_arm.c @@ -39,12 +39,11 @@ #include "virxml.h" =20 #define VIR_FROM_THIS VIR_FROM_CPU -#if defined(__aarch64__) + /* Shift bit mask for parsing cpu flags */ -# define BIT_SHIFTS(n) (1UL << (n)) +#define BIT_SHIFTS(n) (1UL << (n)) /* The current max number of cpu flags on ARM is 32 */ -# define MAX_CPU_FLAGS 32 -#endif +#define MAX_CPU_FLAGS 32 =20 =20 VIR_LOG_INIT("cpu.cpu_arm"); --=20 2.31.1 From nobody Tue Apr 23 10:24:46 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 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=1633950172; cv=none; d=zohomail.com; s=zohoarc; b=HmRU3e6yrHvr4mc2/lprekJl46+aNouEAn9SLJe9eOQniE3QIXW30r+9rClqPPfedxLNAB/fQChaH5jtupP49NE270LaV9ExrGJxnacTN2kXxswY14y7xiVbzZKbInwFvWFza3kdOBvCRMoSIrHiqWlxsSWA4D/x2Z9apztZW0g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633950172; 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; bh=Z5ESqERTUKvOD2D04N/qkVXct7XrAo3iBXW5/G6FUlU=; b=V8E0aIiwbjElyXQ542CuiAUYABz3zsbZHI0vgxWp+nc/zrCpraGyW27ymNJpwq/afdap8Qr2sG/2tFWBl25x9BVcdgHyB8yFtsI1tKUgzMw82zKKnHIdmJa6wWLRoEwQrEmPP71gg3TIsrwLX0DWkpZ2TvfV6H03ytZg8q3cKyc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1633950172592907.1474798425636; Mon, 11 Oct 2021 04:02:52 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-394-NVN1O2AePYufnA9tKDrT6A-1; Mon, 11 Oct 2021 07:02:49 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 580BD10A8E04; Mon, 11 Oct 2021 11:02:44 +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 37DE95C23A; Mon, 11 Oct 2021 11:02:44 +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 D3B724EA37; Mon, 11 Oct 2021 11:02:43 +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 19BB2flO012795 for ; Mon, 11 Oct 2021 07:02:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2D31360C82; Mon, 11 Oct 2021 11:02:41 +0000 (UTC) Received: from work.redhat.com (unknown [10.39.193.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6FE2960BF4; Mon, 11 Oct 2021 11:02:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633950171; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Z5ESqERTUKvOD2D04N/qkVXct7XrAo3iBXW5/G6FUlU=; b=Ww0K4XtwomvOjBEFohHgIKZnxoSofAts1eONFcZJKxzzX2I+5dLVes/4oxUagpupGy/09Z vXGOXjQaSxJEDRI2AHq1vqStZMiuXJcnRAsu2rGNUNastbQtSRwzpAM98kAGwP9hgWR6fC QRWNIAH+Fu9q0m4aBxLo1MhKaC6b8Ws= X-MC-Unique: NVN1O2AePYufnA9tKDrT6A-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 2/5] cpu: Add virCPUDataIsIdentical Date: Mon, 11 Oct 2021 13:02:25 +0200 Message-Id: <20211011110228.46312-3-twiederh@redhat.com> In-Reply-To: <20211011110228.46312-1-twiederh@redhat.com> References: <20211011110228.46312-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633950174685100002 Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake --- src/cpu/cpu.c | 29 +++++++++++++++++++++++++++++ src/cpu/cpu.h | 9 +++++++++ src/libvirt_private.syms | 1 + 3 files changed, 39 insertions(+) diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index b4965f3ee0..a3531dd665 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -1128,6 +1128,35 @@ virCPUDataAddFeature(virCPUData *cpuData, } =20 =20 +/** + * virCPUDataIsIdentical: + * + * Returns VIR_CPU_COMPARE_IDENTICAL if @a and @b are identical, + * VIR_CPU_COMPARE_INCOMPATIBLE if @a and @b are not identical, or + * VIR_CPU_COMPARE_ERROR on error. + */ +virCPUCompareResult +virCPUDataIsIdentical(const virCPUData *a, + const virCPUData *b) +{ + struct cpuArchDriver *driver; + + VIR_DEBUG("a=3D%p, b=3D%p", a, b); + + if (!a || !b) + return VIR_CPU_COMPARE_ERROR; + + if (!(driver =3D cpuGetSubDriver(a->arch))) + return VIR_CPU_COMPARE_ERROR; + + if (!driver->dataIsIdentical) { + return VIR_CPU_COMPARE_ERROR; + } + + return driver->dataIsIdentical(a, b); +} + + /** * virCPUArchIsSupported: * diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h index d11d2641fc..e752126813 100644 --- a/src/cpu/cpu.h +++ b/src/cpu/cpu.h @@ -123,6 +123,10 @@ typedef int (*virCPUArchDataAddFeature)(virCPUData *cpuData, const char *name); =20 +typedef virCPUCompareResult +(*virCPUArchDataIsIdentical)(const virCPUData *a, + const virCPUData *b); + struct cpuArchDriver { const char *name; const virArch *arch; @@ -146,6 +150,7 @@ struct cpuArchDriver { virCPUArchCopyMigratable copyMigratable; virCPUArchValidateFeatures validateFeatures; virCPUArchDataAddFeature dataAddFeature; + virCPUArchDataIsIdentical dataIsIdentical; }; =20 =20 @@ -275,6 +280,10 @@ int virCPUDataAddFeature(virCPUData *cpuData, const char *name); =20 +virCPUCompareResult +virCPUDataIsIdentical(const virCPUData *a, + const virCPUData *b); + bool virCPUArchIsSupported(virArch arch); =20 diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index fd0eea0777..b63165f354 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1459,6 +1459,7 @@ virCPUDataAddFeature; virCPUDataCheckFeature; virCPUDataFormat; virCPUDataFree; +virCPUDataIsIdentical; virCPUDataNew; virCPUDataParse; virCPUExpandFeatures; --=20 2.31.1 From nobody Tue Apr 23 10:24:46 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 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=1633950182; cv=none; d=zohomail.com; s=zohoarc; b=Q36nmo2LF48n7vSS/KRmV5G3KqgEXMuls7nPnx/Hw/2i/lEN65RTzaqeVwXdE0QQLEG+iNpMzuAQ6lYM6LcsoWBjtYg9JrH4lU0l5XHU/CTCX8m+48yMsulU6ZBQcxsUjeJ8vYQPC7y6VuSEthecFUOPeEDXEQjPFOypCtqMy/Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633950182; 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; bh=yR2uCobIsfplugaadmV4MH6FUJKx10v1D5VB1yNgz5o=; b=b9biUgjXy0r5yf9QIgU7686/+tOx88m/W4I1Sg1sjCGpQyQmTrhxqbDDWRIRC9FPEXvK7bG25TZu3Bbt5QcLyDOvnPK5L3iTV3FqCJ7LyfHYTsuHdEIx9YvfNVNO91XUnQZWH3/wgI7g3Y/Ls0wNTwTE/n5in9ruYU2cDqLn5p4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1633950182383947.998157915658; Mon, 11 Oct 2021 04:03:02 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-110-cedCLs8YM8G0-76ZqGHZ7w-1; Mon, 11 Oct 2021 07:02:59 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2557150754; Mon, 11 Oct 2021 11:02:52 +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 C55005FC08; Mon, 11 Oct 2021 11:02:51 +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 3ACB5180598A; Mon, 11 Oct 2021 11:02:51 +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 19BB2gEY012806 for ; Mon, 11 Oct 2021 07:02:42 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3C5BF60C5F; Mon, 11 Oct 2021 11:02:42 +0000 (UTC) Received: from work.redhat.com (unknown [10.39.193.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 85BFE60BF4; Mon, 11 Oct 2021 11:02:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633950181; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=yR2uCobIsfplugaadmV4MH6FUJKx10v1D5VB1yNgz5o=; b=U5MJjVt/BLBCX4RuI/VX5l4Aeccua+YNa0Pr3eY0Ptv5W7HgX89dRsctS+mjNhIGEaNgDh ZfU/cLD7QkTKf/Qxa1Oj8B57LMQGZRySXGG1qnGt9uwN0fkS9A6OGm5v8N2tIV7pmuvk+M 9Ex1CmmdPW5O9eoO2ABzoEkZVV+Z2Xw= X-MC-Unique: cedCLs8YM8G0-76ZqGHZ7w-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 3/5] cpu_x86: Implement virCPUDataIsIdentical for x86 Date: Mon, 11 Oct 2021 13:02:26 +0200 Message-Id: <20211011110228.46312-4-twiederh@redhat.com> In-Reply-To: <20211011110228.46312-1-twiederh@redhat.com> References: <20211011110228.46312-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633950182782100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake --- src/cpu/cpu_x86.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 1b829e5658..55da407ec4 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -3369,6 +3369,74 @@ virCPUx86DataAddFeature(virCPUData *cpuData, } =20 =20 +static bool +virCPUx86DataItemIsIdentical(const virCPUx86DataItem *a, + const virCPUx86DataItem *b) +{ + if (a->type !=3D b->type) + return false; + + switch (a->type) { + case VIR_CPU_X86_DATA_NONE: + break; + + case VIR_CPU_X86_DATA_CPUID: + return a->data.cpuid.eax_in =3D=3D b->data.cpuid.eax_in && + a->data.cpuid.ecx_in =3D=3D b->data.cpuid.ecx_in && + a->data.cpuid.eax =3D=3D b->data.cpuid.eax && + a->data.cpuid.ebx =3D=3D b->data.cpuid.ebx && + a->data.cpuid.ecx =3D=3D b->data.cpuid.ecx && + a->data.cpuid.edx =3D=3D b->data.cpuid.edx; + + case VIR_CPU_X86_DATA_MSR: + return a->data.msr.index =3D=3D b->data.msr.index && + a->data.msr.eax =3D=3D b->data.msr.eax && + a->data.msr.edx =3D=3D b->data.msr.edx; + } + + return true; +} + +static virCPUCompareResult +virCPUx86DataIsIdentical(const virCPUData *a, + const virCPUData *b) +{ + const virCPUx86Data *adata; + const virCPUx86Data *bdata; + size_t i; + size_t j; + + if (!a || !b) + return VIR_CPU_COMPARE_ERROR; + + if (a->arch !=3D b->arch) + return VIR_CPU_COMPARE_INCOMPATIBLE; + + if (!((adata =3D &a->data.x86) && (bdata =3D &b->data.x86))) + return VIR_CPU_COMPARE_ERROR; + + if (adata->len !=3D bdata->len) + return VIR_CPU_COMPARE_INCOMPATIBLE; + + for (i =3D 0; i < adata->len; ++i) { + bool found =3D false; + + for (j =3D 0; j < bdata->len; ++j) { + if (!virCPUx86DataItemIsIdentical(&adata->items[i], + &bdata->items[j])) + continue; + + found =3D true; + break; + } + + if (!found) + return VIR_CPU_COMPARE_INCOMPATIBLE; + } + + return VIR_CPU_COMPARE_IDENTICAL; +} + static bool virCPUx86FeatureIsMSR(const char *name) { @@ -3452,4 +3520,5 @@ struct cpuArchDriver cpuDriverX86 =3D { .copyMigratable =3D virCPUx86CopyMigratable, .validateFeatures =3D virCPUx86ValidateFeatures, .dataAddFeature =3D virCPUx86DataAddFeature, + .dataIsIdentical =3D virCPUx86DataIsIdentical, }; --=20 2.31.1 From nobody Tue Apr 23 10:24:46 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1633950182; cv=none; d=zohomail.com; s=zohoarc; b=gsWWVohR/VCMO2y6litiD8PuD85gUSMMkS4eWQm5rhPkke2JhJBGjplLnvPSUDyG4ZzdSIa9/IWrDhOcYj++7Qxho/OIejCA6zkVvaI4H31/IoDQRZ//G0vfk5nPqsWjrtPN4ew8WUAQqlqvhYYVV0QEU89q+dvSB/q9A7YCCT4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633950182; 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; bh=x7DtqHaKi5SqaqJIKEmI+SZdxqzVZY83/PrZQUZ7JcA=; b=fxmcktdMsUqbnH7y3juZKszqqa+uuydb5V61d7AUVcshQyDX5pDCkJx+5vaOZgK3oy9yRxDuy5Accr3aYLFFo2ADR2ySR1pgQFLdaJimv5uhy99IjaK20J8UDgQy4hbnanYfAM+2qYg7452DO4mJ2T6rBE+IM8MoDPu0QUOV27Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1633950182677626.5439343946132; Mon, 11 Oct 2021 04:03:02 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-549-zQd1NbGyMkq_DeAVRZD7fA-1; Mon, 11 Oct 2021 07:02:57 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0E6C010A8E07; Mon, 11 Oct 2021 11:02:52 +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 C3D1F18B5E; Mon, 11 Oct 2021 11:02:51 +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 3BB291806D00; Mon, 11 Oct 2021 11:02:51 +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 19BB2hpw012818 for ; Mon, 11 Oct 2021 07:02:43 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4FC6960C82; Mon, 11 Oct 2021 11:02:43 +0000 (UTC) Received: from work.redhat.com (unknown [10.39.193.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8FCDF60BF4; Mon, 11 Oct 2021 11:02:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633950181; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=x7DtqHaKi5SqaqJIKEmI+SZdxqzVZY83/PrZQUZ7JcA=; b=ZxL0UDRCpm/tyGaS+4GbBFJA5YLzBxPxo5Lh2z9ncig5hde18Gy/Vw9uUw3AxxpIOODd/H lMO523BHyTdvqLI23fL33IkJwBcSD7BXaydDtKJWBJEJ8cKFL5Cmm/AuXyZ6WVrgIWlqH/ 4AZXxejAevcmWr8rL7xiedue62WQL+g= X-MC-Unique: zQd1NbGyMkq_DeAVRZD7fA-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 4/5] cpu_arm: Implement virCPUDataIsIdentical for arm Date: Mon, 11 Oct 2021 13:02:27 +0200 Message-Id: <20211011110228.46312-5-twiederh@redhat.com> In-Reply-To: <20211011110228.46312-1-twiederh@redhat.com> References: <20211011110228.46312-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633950184716100005 Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake --- src/cpu/cpu_arm.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c index ac174891b7..c9114d53bf 100644 --- a/src/cpu/cpu_arm.c +++ b/src/cpu/cpu_arm.c @@ -124,6 +124,32 @@ virCPUarmDataClear(virCPUarmData *data) g_strfreev(data->features); } =20 +static virCPUCompareResult +virCPUarmDataIsIdentical(const virCPUData *a, + const virCPUData *b) +{ + size_t i; + + if (!a || !b) + return VIR_CPU_COMPARE_ERROR; + + if (a->arch !=3D b->arch) + return VIR_CPU_COMPARE_INCOMPATIBLE; + + if (a->data.arm.pvr !=3D b->data.arm.pvr) + return VIR_CPU_COMPARE_INCOMPATIBLE; + + if (a->data.arm.vendor_id !=3D b->data.arm.vendor_id) + return VIR_CPU_COMPARE_INCOMPATIBLE; + + for (i =3D 0; i < MAX_CPU_FLAGS; ++i) { + if (STRNEQ(a->data.arm.features[i], b->data.arm.features[i])) + return VIR_CPU_COMPARE_INCOMPATIBLE; + } + + return VIR_CPU_COMPARE_IDENTICAL; +} + static void virCPUarmDataFree(virCPUData *cpuData) { @@ -674,4 +700,5 @@ struct cpuArchDriver cpuDriverArm =3D { .baseline =3D virCPUarmBaseline, .update =3D virCPUarmUpdate, .validateFeatures =3D virCPUarmValidateFeatures, + .dataIsIdentical =3D virCPUarmDataIsIdentical, }; --=20 2.31.1 From nobody Tue Apr 23 10:24:46 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1633950181; cv=none; d=zohomail.com; s=zohoarc; b=LTrsPUPStT0necu7mTXZBF9D8MIg7I68SiCj5U4hITZtIZ/H4QkcBSi30asahsBmDERL7n1yKRspXWomkT/yeV/H4NWFJyMi+Hz0dYvRDSSddrbssc3YhuBWeJXA4r+kb+I5NfB3dL4naly6wyJXYwPHRtf75nP8dKooMG2MfrM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633950181; 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; bh=R9siTCEIsGzPSqwN6BpvP0ctGLWdIVv5TRt1inYmDnU=; b=egLb6VJDXcvAJgaaeUJgustLVAb6Tv6VeVadyaUSNUz6J56npUVYllWj2tAoXiYIN/i2ThoVFTh/JQ5tybmA9hZjjP0824gUlbUXF4fxxyZMb4AiZgUVPpjtkHMY1LW1ykew2o0a9XRQUArQy9UOSFv8ZgLnIHfHT/0M6/4Up7o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1633950181056271.0887748238416; Mon, 11 Oct 2021 04:03:01 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-363-uWB7R1elOjetaHoisb5H3g-1; Mon, 11 Oct 2021 07:02:56 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4885810A8E05; Mon, 11 Oct 2021 11:02:51 +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 1BC2560C5F; Mon, 11 Oct 2021 11:02:51 +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 BF6D24EA3C; Mon, 11 Oct 2021 11:02:50 +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 19BB2igg012828 for ; Mon, 11 Oct 2021 07:02:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5E95360C82; Mon, 11 Oct 2021 11:02:44 +0000 (UTC) Received: from work.redhat.com (unknown [10.39.193.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id A75D460C5F; Mon, 11 Oct 2021 11:02:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633950180; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=R9siTCEIsGzPSqwN6BpvP0ctGLWdIVv5TRt1inYmDnU=; b=glJBSKt7SKVWevtpW0phSjHG1DxOQS9taB6nVr54xPFWVHPwc48x8F75ylr3oce2LWKPnf CMWKh2pNH3Ue5ZDsxYYiMRvWhAVltowfBvE3kc4C3i+56r7nyhUR9LE1b48JP/t1mhLA27 OvHacKir+58tjnacwi+qjxlYF+vVh9U= X-MC-Unique: uWB7R1elOjetaHoisb5H3g-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 5/5] cpu_ppc64: Implement virCPUDataIsIdentical for ppc64 Date: Mon, 11 Oct 2021 13:02:28 +0200 Message-Id: <20211011110228.46312-6-twiederh@redhat.com> In-Reply-To: <20211011110228.46312-1-twiederh@redhat.com> References: <20211011110228.46312-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633950182467100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake --- src/cpu/cpu_ppc64.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c index 4909f61ff1..fcd68c8a7c 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -578,6 +578,31 @@ ppc64DriverDecode(virCPUDef *cpu, return 0; } =20 +static virCPUCompareResult +virCPUppc64DataIsIdentical(const virCPUData *a, + const virCPUData *b) +{ + size_t i; + + if (!a || !b) + return VIR_CPU_COMPARE_ERROR; + + if (a->arch !=3D b->arch) + return VIR_CPU_COMPARE_INCOMPATIBLE; + + if (a->data.ppc64.len !=3D b->data.ppc64.len) + return VIR_CPU_COMPARE_INCOMPATIBLE; + + for (i =3D 0; i < a->data.ppc64.len; ++i) { + if (a->data.ppc64.pvr[i].mask !=3D b->data.ppc64.pvr[i].mask) + return VIR_CPU_COMPARE_INCOMPATIBLE; + if (a->data.ppc64.pvr[i].value !=3D b->data.ppc64.pvr[i].value) + return VIR_CPU_COMPARE_INCOMPATIBLE; + } + + return VIR_CPU_COMPARE_IDENTICAL; +} + static void virCPUppc64DataFree(virCPUData *data) { @@ -749,4 +774,5 @@ struct cpuArchDriver cpuDriverPPC64 =3D { .update =3D virCPUppc64Update, .getModels =3D virCPUppc64DriverGetModels, .convertLegacy =3D virCPUppc64ConvertLegacy, + .dataIsIdentical =3D virCPUppc64DataIsIdentical, }; --=20 2.31.1