From nobody Mon Feb 9 23:58:09 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1512670661494692.2076769527222; Thu, 7 Dec 2017 10:17:41 -0800 (PST) Received: from localhost ([::1]:33732 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eN0je-0001De-Uq for importer@patchew.org; Thu, 07 Dec 2017 13:17:26 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38853) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eN0hK-0008GQ-S5 for qemu-devel@nongnu.org; Thu, 07 Dec 2017 13:15:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eN0hJ-0006nI-Jt for qemu-devel@nongnu.org; Thu, 07 Dec 2017 13:15:02 -0500 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:38906) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eN0hH-0006ly-G0; Thu, 07 Dec 2017 13:14:59 -0500 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1eN0hG-000836-IH; Thu, 07 Dec 2017 18:14:58 +0000 From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Thu, 7 Dec 2017 18:14:53 +0000 Message-Id: <1512670493-18114-7-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512670493-18114-1-git-send-email-peter.maydell@linaro.org> References: <1512670493-18114-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PATCH 6/6] hw/arm/virt: Support -machine gic-version=max X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Richard W . M . Jones" , Eduardo Habkost , patches@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add support for passing 'max' to -machine gic-version. By analogy with the -cpu max option, this picks the "best available" GIC version whether you're using KVM or TCG, so it behaves like 'host' when using KVM, and gives you GICv3 when using TCG. Also like '-cpu host', using -machine gic-version=3Dmax' means there is no guarantee of migration compatibility between QEMU versions; in future 'max' might mean '4'. Signed-off-by: Peter Maydell --- hw/arm/virt.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 92bd776..603ba56 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1265,16 +1265,23 @@ static void machvirt_init(MachineState *machine) /* We can probe only here because during property set * KVM is not available yet */ - if (!vms->gic_version) { + if (vms->gic_version <=3D 0) { + /* "host" or "max" */ if (!kvm_enabled()) { - error_report("gic-version=3Dhost requires KVM"); - exit(1); - } - - vms->gic_version =3D kvm_arm_vgic_probe(); - if (!vms->gic_version) { - error_report("Unable to determine GIC version supported by hos= t"); - exit(1); + if (vms->gic_version =3D=3D 0) { + error_report("gic-version=3Dhost requires KVM"); + exit(1); + } else { + /* "max": currently means 3 for TCG */ + vms->gic_version =3D 3; + } + } else { + vms->gic_version =3D kvm_arm_vgic_probe(); + if (!vms->gic_version) { + error_report( + "Unable to determine GIC version supported by host"); + exit(1); + } } } =20 @@ -1539,9 +1546,11 @@ static void virt_set_gic_version(Object *obj, const = char *value, Error **errp) vms->gic_version =3D 2; } else if (!strcmp(value, "host")) { vms->gic_version =3D 0; /* Will probe later */ + } else if (!strcmp(value, "max")) { + vms->gic_version =3D -1; /* Will probe later */ } else { error_setg(errp, "Invalid gic-version value"); - error_append_hint(errp, "Valid values are 3, 2, host.\n"); + error_append_hint(errp, "Valid values are 3, 2, host, max.\n"); } } =20 --=20 2.7.4