From patchwork Thu Dec 7 18:14:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 121045 Delivered-To: patches@linaro.org Received: by 10.140.22.227 with SMTP id 90csp8688656qgn; Thu, 7 Dec 2017 10:14:59 -0800 (PST) X-Google-Smtp-Source: AGs4zMa+8N77c00l16VCc1twkVPZFBdbA/YiFfhKBtnmuuG2pAiY4E9FrZyJXMWTxAK75cafiXu/ X-Received: by 10.223.150.46 with SMTP id b43mr24139408wra.5.1512670499204; Thu, 07 Dec 2017 10:14:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512670499; cv=none; d=google.com; s=arc-20160816; b=JVl2UcM6u4GXsCK8BtFxYuX9oqEWtVD8aPED8DVsGVpBlJnah2avBdEXyrKR2dZYGZ MIQPoOOkmhSyX42er8ZYVnNeq4vrI2LKJzBa2vptLqBCOM9gNkcNcfWiHBJ9UQ16o21T 5ClYSdXoET7q50ksAyFyByAJ66gLHrkzpnMcsHT1v3qCw+gyeKafsdDSTAw6oBzl3S0h kGPu4+GXcc8QBtMwYMhU2oPQTdECC3yk9XntwqsiJQHfLQfT8ytN75m5d3wHg8mGIQSI zE3hjlgph8xKsJWvwbGJ8katNNs0K8SRNr14HlrhddgABZk939CwAR9N++VbQ55U28T4 8Tug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=TdebkGqS8kSAy121qHa0qfoa5/4I+I/q5ImO+eNsURk=; b=yn6MwNzewtCMuBkq3MJTJKVHIDJfFNrdrvgVqRZ/bs+meQe2gkoZFmA8txJqbAFH8G 1Im895VzBNwJ6vDbgCeyx5X5xWqP3JSVUe00+Szua7SpyEjDV0m9jND4Z1xDHK8wQgz4 CVK373DPQmRLR8A+F6AbKr4tULGoA+qyqQhvPLotBbAgUR1rpqRklrwJVyzYrkGf0EGq VsugjEKpM7xwWnXcW6pn+AVDsVmwg69pujsy25rCesSu69JbRdyUcE0/Vj4hNBPY00PN DWFll9bczBh80uNQqzTm1XgfNvu3VhE2bVnoLoRaiC8RgWBQbsYBuI7NOrbDzZK84Wk9 gBbA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::2 as permitted sender) smtp.mailfrom=pm215@archaic.org.uk; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by mx.google.com with ESMTPS id 203si3999045wmn.160.2017.12.07.10.14.58 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 07 Dec 2017 10:14:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::2 as permitted sender) client-ip=2001:8b0:1d0::2; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::2 as permitted sender) smtp.mailfrom=pm215@archaic.org.uk; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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 Cc: patches@linaro.org, Eduardo Habkost , "Richard W . M . Jones" Subject: [PATCH 6/6] hw/arm/virt: Support -machine gic-version=max 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> 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=max' 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(-) -- 2.7.4 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 <= 0) { + /* "host" or "max" */ if (!kvm_enabled()) { - error_report("gic-version=host requires KVM"); - exit(1); - } - - vms->gic_version = kvm_arm_vgic_probe(); - if (!vms->gic_version) { - error_report("Unable to determine GIC version supported by host"); - exit(1); + if (vms->gic_version == 0) { + error_report("gic-version=host requires KVM"); + exit(1); + } else { + /* "max": currently means 3 for TCG */ + vms->gic_version = 3; + } + } else { + vms->gic_version = kvm_arm_vgic_probe(); + if (!vms->gic_version) { + error_report( + "Unable to determine GIC version supported by host"); + exit(1); + } } } @@ -1539,9 +1546,11 @@ static void virt_set_gic_version(Object *obj, const char *value, Error **errp) vms->gic_version = 2; } else if (!strcmp(value, "host")) { vms->gic_version = 0; /* Will probe later */ + } else if (!strcmp(value, "max")) { + vms->gic_version = -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"); } }