From patchwork Tue Mar 6 12:55:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 130791 Delivered-To: patches@linaro.org Received: by 10.46.66.2 with SMTP id p2csp3903130lja; Tue, 6 Mar 2018 04:55:32 -0800 (PST) X-Google-Smtp-Source: AG47ELsNJLrNfXfwh+dfl2i2PUftuUrUK4psgD/IrLK5tVjPgmggynIoiGT4dqdGufE733b0Rtca X-Received: by 10.223.163.93 with SMTP id d29mr16770085wrb.187.1520340932126; Tue, 06 Mar 2018 04:55:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520340932; cv=none; d=google.com; s=arc-20160816; b=cZJtVBjxMJj4PPjH60J7k50VDiL9PSeIzos2N6J6pQsmDmIzb75xRtL1jDrshIp4PO DJxq+76OAlqo7XVgLMvk2l1cupTEJEd0/8wN0hSD6yFvPTdiTR7yrsf3SDiWsCbUkFCW PdAp+gLfygpa0jBli5t3GPRj7VxL/boI+6Vs9oDTtyzR104wPeAaKJCVhumx/xdlIfc4 PPmewhqbKmJNaTR9U6Kpugk+Bj4zd9BGIR41T/pa7Ckxn4jphGmCxvgft48l5mItpwDZ rKwvB331nUBNzyvzNAPRExdrIQmUR9tmqcVQSUx2bIytOSLHTjadpiOnDpSRifQLcyJM z4wQ== 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=swZCpyIxmNtZupe/BWVZaMk/478ba7WYRGLlZWC5elM=; b=EYbvOxaOxCYa2GYxvR4T0lYpGyxKFVK1UL3P5v9ntHy9qDCGBFA67TwzQ795lbEvP3 XyGUbnQZ40PBN5UTFSeLLrdY2BmIKPEqrNbXzGFmuNZpep/nC8WU5Mw3IMUa7NMHwl/M qQMPyYK7bnxZfiDcGDe3EM/OjOTG1JgZRdhz9Em/iQIrA69JeoCR8gCOnke+YabQ9sGE 2q5g2lhsybPJKW+41XLSXlJyW+VZMTBlYdxRnl1ElCiLJqdRJ1brERt8hZzx8UCl5eX9 fDipOGqlvlDYEAHIFHelGtyy/7VYjRO6efpRBg0DF6G8N2onwTQPhAg9HAIGvgNPjLzx wJbw== 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 a141si2486912wma.140.2018.03.06.04.55.32 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 06 Mar 2018 04:55:32 -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 1etC7v-0004Wn-Mg; Tue, 06 Mar 2018 12:55:31 +0000 From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: patches@linaro.org, Igor Mammedov , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?b?w6k=?= Subject: [PATCH v2 6/6] hw/arm/virt: Support -machine gic-version=max Date: Tue, 6 Mar 2018 12:55:26 +0000 Message-Id: <20180306125526.27838-7-peter.maydell@linaro.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180306125526.27838-1-peter.maydell@linaro.org> References: <20180306125526.27838-1-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.16.2 diff --git a/hw/arm/virt.c b/hw/arm/virt.c index cda4b83586..2c07245047 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1207,16 +1207,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); + } } } @@ -1480,9 +1487,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"); } }