From nobody Tue Nov 26 14:49:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.81 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=1573504588; cv=none; d=zoho.com; s=zohoarc; b=ODmN2xLrNEBaoGaJ9owfBz0MqvVFwkLKSzXljaFAzhUKcTmJPKtYd0+EybZd5hUUs+qT1zuweK5bm2ZY7B/op0rAMJJ6j6FsSVMKrreRB1WZ6QflsOFXNzKgPixBqQHVgXTdWKzGYE65Ld7rZucBh9vIwsxxwxLroWE9pazKWdo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573504588; 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; bh=m/WPTypBPKp9M3yxBy48voSUKHzMH73Fwjj+ZlMNMvA=; b=UmQL/Fis/E32hcKfuzET5dHJ2XX/AMGGOzJbP481JoRSqXgt8G6mUDkotKV/RLbXYtGjW41MxaHA7NQhCgzxjz2jSgjjFq/CrRU6N9lnEsX6kIKb4lVoFhsIcZCQ83l6Lz0pMFjI4ovrLWoZncp9+AJgNCIo8z0igMnNeb15mwA= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1573504588605292.67989581613006; Mon, 11 Nov 2019 12:36:28 -0800 (PST) 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-85-liK0n9CdPaW0ITXyyRTgrw-1; Mon, 11 Nov 2019 15:36:25 -0500 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 D0DAA801E51; Mon, 11 Nov 2019 20:36:20 +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 9EE8761081; Mon, 11 Nov 2019 20:36:20 +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 3DA98180202C; Mon, 11 Nov 2019 20:36:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xABKZi2J011634 for ; Mon, 11 Nov 2019 15:35:44 -0500 Received: by smtp.corp.redhat.com (Postfix) id 0709D60156; Mon, 11 Nov 2019 20:35:44 +0000 (UTC) Received: from orkuz.int.mamuti.net (ovpn-204-85.brq.redhat.com [10.40.204.85]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A5679600CC for ; Mon, 11 Nov 2019 20:35:40 +0000 (UTC) Received: by orkuz.int.mamuti.net (Postfix, from userid 500) id 6328B2A0B47; Mon, 11 Nov 2019 21:35:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573504587; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=m/WPTypBPKp9M3yxBy48voSUKHzMH73Fwjj+ZlMNMvA=; b=NHX1ZB1RxEQBtkjWU2jrjVgvcAJqK0Bz7SA7FqnmmcF3hfa1AjqUZXkCm1T37LWMLJOcOB 5wuD9fQTprBzO2cx5wKjCW4eiKaTSMCvTd+jM9zb2BnFd/7vSrd1LfDGmiOC/rZ5buWBu9 +CyvBzcZTeW9PALuogZmeCZgsDWhlyg= From: Jiri Denemark To: libvir-list@redhat.com Date: Mon, 11 Nov 2019 21:35:32 +0100 Message-Id: <1eaf1070c4d744aa098703a7452bd3302457638d.1573504055.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/6] cpu_conf: Pass policy to CPU feature filtering callbacks 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 X-MC-Unique: liK0n9CdPaW0ITXyyRTgrw-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark --- src/conf/cpu_conf.c | 6 +++--- src/conf/cpu_conf.h | 1 + src/cpu/cpu_x86.c | 13 ++++++++++++- src/cpu/cpu_x86.h | 2 ++ src/qemu/qemu_capabilities.c | 1 + src/qemu/qemu_capabilities.h | 1 + 6 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c index 2b644638a7..a38101d024 100644 --- a/src/conf/cpu_conf.c +++ b/src/conf/cpu_conf.c @@ -147,7 +147,7 @@ virCPUDefCopyModelFilter(virCPUDefPtr dst, dst->nfeatures =3D 0; =20 for (i =3D 0; i < src->nfeatures; i++) { - if (filter && !filter(src->features[i].name, opaque)) + if (filter && !filter(src->features[i].name, src->features[i].poli= cy, opaque)) continue; =20 n =3D dst->nfeatures++; @@ -937,7 +937,7 @@ virCPUDefFilterFeatures(virCPUDefPtr cpu, size_t i =3D 0; =20 while (i < cpu->nfeatures) { - if (filter(cpu->features[i].name, opaque)) { + if (filter(cpu->features[i].name, cpu->features[i].policy, opaque)= ) { i++; continue; } @@ -972,7 +972,7 @@ virCPUDefCheckFeatures(virCPUDefPtr cpu, *features =3D NULL; =20 for (i =3D 0; i < cpu->nfeatures; i++) { - if (filter(cpu->features[i].name, opaque)) { + if (filter(cpu->features[i].name, cpu->features[i].policy, opaque)= ) { if (virStringListAdd(&list, cpu->features[i].name) < 0) return -1; n++; diff --git a/src/conf/cpu_conf.h b/src/conf/cpu_conf.h index 30904fab95..a9f8abeef1 100644 --- a/src/conf/cpu_conf.h +++ b/src/conf/cpu_conf.h @@ -161,6 +161,7 @@ virCPUDefCopyModel(virCPUDefPtr dst, * Returns true if feature @name should copied, false otherwise. */ typedef bool (*virCPUDefFeatureFilter)(const char *name, + virCPUFeaturePolicy policy, void *opaque); =20 int diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index abe4865ec2..db34cbdb5c 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -3238,6 +3238,15 @@ virCPUx86ExpandFeatures(virCPUDefPtr cpu) } =20 =20 +static bool +x86FeatureFilterMigratable(const char *name, + virCPUFeaturePolicy policy G_GNUC_UNUSED, + void *cpu_map) +{ + return x86FeatureIsMigratable(name, cpu_map); +} + + static virCPUDefPtr virCPUx86CopyMigratable(virCPUDefPtr cpu) { @@ -3251,7 +3260,7 @@ virCPUx86CopyMigratable(virCPUDefPtr cpu) return NULL; =20 if (virCPUDefCopyModelFilter(copy, cpu, false, - x86FeatureIsMigratable, map) < 0) + x86FeatureFilterMigratable, map) < 0) goto error; =20 return copy; @@ -3386,6 +3395,7 @@ virCPUx86FeatureIsMSR(const char *name) */ bool virCPUx86FeatureFilterSelectMSR(const char *name, + virCPUFeaturePolicy policy G_GNUC_UNUSED, void *opaque G_GNUC_UNUSED) { return virCPUx86FeatureIsMSR(name); @@ -3402,6 +3412,7 @@ virCPUx86FeatureFilterSelectMSR(const char *name, */ bool virCPUx86FeatureFilterDropMSR(const char *name, + virCPUFeaturePolicy policy G_GNUC_UNUSED, void *opaque G_GNUC_UNUSED) { return !virCPUx86FeatureIsMSR(name); diff --git a/src/cpu/cpu_x86.h b/src/cpu/cpu_x86.h index 3ea38d1701..3b1aabe98d 100644 --- a/src/cpu/cpu_x86.h +++ b/src/cpu/cpu_x86.h @@ -42,7 +42,9 @@ int virCPUx86DataSetVendor(virCPUDataPtr cpuData, const char *vendor); =20 bool virCPUx86FeatureFilterSelectMSR(const char *name, + virCPUFeaturePolicy policy, void *opaque); =20 bool virCPUx86FeatureFilterDropMSR(const char *name, + virCPUFeaturePolicy policy, void *opaque); diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index fc6473651c..29e2d6d5d7 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -2910,6 +2910,7 @@ virQEMUCapsProbeQMPSEVCapabilities(virQEMUCapsPtr qem= uCaps, */ bool virQEMUCapsCPUFilterFeatures(const char *name, + virCPUFeaturePolicy policy G_GNUC_UNUSED, void *opaque) { virArch *arch =3D opaque; diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 32e9798cda..aa593396ce 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -667,6 +667,7 @@ bool virQEMUCapsGuestIsNative(virArch host, virArch guest); =20 bool virQEMUCapsCPUFilterFeatures(const char *name, + virCPUFeaturePolicy policy, void *opaque); =20 const char * --=20 2.24.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list