From nobody Sun Feb 8 21:33:42 2026 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=1612879172; cv=none; d=zohomail.com; s=zohoarc; b=djO2S9TKmzOZDS4d3FBiAdrSZGBwWTUJdn8MC7eTGSfHqJSfIAioKAZPf2Qs8uZmKqF/MYgvQlooWaXKs0GLxL7ZMobZmSUbC7f183buOJDvWvhUU/bZXVBYVoWvcFw1hGj4enYDxMTNGdydcPxicOZG/SJs5u5EtwMAFQoWDVo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612879172; 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=4+GC9MN02/p3W5/CsA01WocpT86LHhyZlDGlxtAnp80=; b=LrxCx37d50zmpZx910PC3ngJVunEhelWveb1AYvbM0yARQAULgIXaov5oZhB9wGewyyfddh1yQ5qzPMlsLmFy3wXgCMLB3cnU0Dkgh/OyHUQ+ztXU3HidvY4qFp6EasOsVR2LlansZAa81qK2LO+Nruj4i12l2f4DvFZ6cJi8C0= 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) header.from= 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 1612879171996935.6854457776705; Tue, 9 Feb 2021 05:59:31 -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-387--jhB4x4PP0WekBiwHrjKLA-1; Tue, 09 Feb 2021 08:59:27 -0500 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 242531084C84; Tue, 9 Feb 2021 13:59:20 +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 E9C5810016FC; Tue, 9 Feb 2021 13:59:19 +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 AF09A58073; Tue, 9 Feb 2021 13:59:19 +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 119DxGCF024644 for ; Tue, 9 Feb 2021 08:59:16 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9F15919C97; Tue, 9 Feb 2021 13:59:16 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-66.ams2.redhat.com [10.36.115.66]) by smtp.corp.redhat.com (Postfix) with ESMTP id 897565B4B5; Tue, 9 Feb 2021 13:59:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612879171; 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=4+GC9MN02/p3W5/CsA01WocpT86LHhyZlDGlxtAnp80=; b=MzLkLniRgbfXllZUoDfBTTrC+h9NS3dBIm7F4eRBjzYTzuqCxnyGkHhduYPIHMc2dzPSIM 1Lmj6FHy6a07pgn/5jYaijfX8sX1hdBLL7ZKvSILu7Y2jgmox4rOGrACfpucIMhBi04Kol 1JPbKmHyKvSZPA7TSQ8hlfVX9OTjMWw= X-MC-Unique: -jhB4x4PP0WekBiwHrjKLA-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 3/5] cpu: wire up support for maximum CPU mode Date: Tue, 9 Feb 2021 13:58:59 +0000 Message-Id: <20210209135901.1225861-4-berrange@redhat.com> In-Reply-To: <20210209135901.1225861-1-berrange@redhat.com> References: <20210209135901.1225861-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Jiri Denemark 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) The logic applied in the ppc64 case isn't quite correct, as the interpretation of maximum mode depends on whether hardware virt is used or not. This is information the CPU driver doesn't have. Signed-off-by: Daniel P. Berrang=C3=A9 --- src/cpu/cpu.c | 3 ++- src/cpu/cpu_ppc64.c | 10 ++++++++-- src/cpu/cpu_x86.c | 3 ++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index 6ff88d6a9f..dfedf5bbf0 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -884,7 +884,8 @@ virCPUTranslate(virArch arch, return -1; =20 if (cpu->mode =3D=3D VIR_CPU_MODE_HOST_MODEL || - cpu->mode =3D=3D VIR_CPU_MODE_HOST_PASSTHROUGH) + cpu->mode =3D=3D VIR_CPU_MODE_HOST_PASSTHROUGH || + cpu->mode =3D=3D VIR_CPU_MODE_MAXIMUM) return 0; =20 if (virCPUModelIsAllowed(cpu->model, models)) diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c index d71d147207..3e34b14f79 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -474,8 +474,14 @@ ppc64Compute(virCPUDefPtr host, G_GNUC_FALLTHROUGH; =20 case VIR_CPU_MODE_HOST_PASSTHROUGH: - /* host-model and host-passthrough: - * the guest CPU is the same as the host */ + case VIR_CPU_MODE_MAXIMUM: + /* host-model, host-passthrough & maximum: + * the guest CPU is the same as the host. + * + * Note for maximum, with non hardware virt + * the guest CPU is actually arbitrarily defined by + * the emulator, so this isn't strictly correct. + */ guest_model =3D ppc64ModelCopy(host_model); break; =20 diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 2422e258ec..fe423f38f9 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -3050,7 +3050,8 @@ virCPUx86UpdateLive(virCPUDefPtr cpu, virCPUDataPtr dataEnabled, virCPUDataPtr dataDisabled) { - bool hostPassthrough =3D cpu->mode =3D=3D VIR_CPU_MODE_HOST_PASSTHROUG= H; + bool hostPassthrough =3D (cpu->mode =3D=3D VIR_CPU_MODE_HOST_PASSTHROU= GH || + cpu->mode =3D=3D VIR_CPU_MODE_MAXIMUM); virCPUx86MapPtr map; g_autoptr(virCPUx86Model) model =3D NULL; g_autoptr(virCPUx86Model) modelDisabled =3D NULL; --=20 2.29.2