From patchwork Thu Nov 1 21:57:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 149993 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1318905ljp; Thu, 1 Nov 2018 14:59:31 -0700 (PDT) X-Google-Smtp-Source: AJdET5c6tqwx7R+uojhdGcCEtChWT1fhEmkzWDm48LbQvLbuw0Ew7aT14ijNcxF4tgdQesp5EQ8v X-Received: by 2002:ae9:de46:: with SMTP id s67-v6mr8245111qkf.257.1541109571864; Thu, 01 Nov 2018 14:59:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541109571; cv=none; d=google.com; s=arc-20160816; b=tK/SkkJ+F/cUCbDZEQIKvWRhzXLjeF1fwwx3nFKWcFB+NDy4OTSFatrbhgGeLurZDA /jnRNyaNdwSypN30BxAZkKDX3UWJ2pEYonmfwcNOsncg5ghmGlNNJXcozMYYFbG3F1wT MEVDNjZtU/XvObWulrB6ijEbYvv+mdz/0c8vLZleKZp0jTkbMk6CFF4x2IRCgAo1hszm TdxF/1zCGaC+6ibYJTI3o5mYrbU+UyfZYkH4kDFCqLhBIhCgvl0z2nIl9sNXYOqwUnFv 45dRZ9sqafCAok3B91BKt7kjHtOzdivHkz0ACoVuz8MO1gLDMvou4WNZk8wOll1lr2/m lIcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:message-id:date:to:from :dkim-signature; bh=u221p/mvanPpxL+7LLMnkQM0lXO6kCqomlyWCZtueQ8=; b=QabOVlv4haFt2KzC2gosN/nlf7H4W91Fm6RGmOmDErpk801kncPC1c1wn12dN2NeJC 16TDVsVKgsWtHlbak6xSOXLqi6FuEezd4pcrPiuzjOorDesZkVmCzJZX22d8AYu0yiWG 0dKY48ofvJ3ooi/loP9mfn9agPJKPXm9vfGQrlB1UsIzLnQPHKPIoaxlFDMsJBlPJ+Tx g1jgnQCHuQB2S5nbKFVR76zX/qlbSCtM/67evUQReKheU8QpBhNva16xxn+EPY4nMOV7 b/AU/lSptnxiFX5fdKkZzwNl9iEZXZjaulYu1iGhpJXmjx0KCVrlvH6JKneUL7GDPlg3 Svjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="dvfoAG/+"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id p9si653617qvq.61.2018.11.01.14.59.31 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 01 Nov 2018 14:59:31 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="dvfoAG/+"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:46315 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gIKzz-0007PS-Cy for patch@linaro.org; Thu, 01 Nov 2018 17:59:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37048) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gIKyW-0005u1-94 for qemu-devel@nongnu.org; Thu, 01 Nov 2018 17:58:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gIKyG-00022X-NS for qemu-devel@nongnu.org; Thu, 01 Nov 2018 17:57:56 -0400 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:35633) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gIKyG-00020Z-5x for qemu-devel@nongnu.org; Thu, 01 Nov 2018 17:57:44 -0400 Received: by mail-wr1-x442.google.com with SMTP id z16-v6so4744wrv.2 for ; Thu, 01 Nov 2018 14:57:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=u221p/mvanPpxL+7LLMnkQM0lXO6kCqomlyWCZtueQ8=; b=dvfoAG/+NZDTyoMVzPu/EZKX/+TLAqJrjhik9modH3gDf+8bktGGSN0Gov/1E+rQqN ISy1NxKxoxN6GivcqoDdr+IPKIOL5LjeGCyqY/JxYCQtOVXvFZvFWmwQEnjlXDkZ5DDL RW+Wxgyi/mdvhDognW/l3sLj4gfgCrIEbE2Bk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=u221p/mvanPpxL+7LLMnkQM0lXO6kCqomlyWCZtueQ8=; b=K7P+re9pWJOqrhGC7qfILrvszP4SRbYbr6iUIlWkJcPMF1YY2pG1YZ5xeJIE6u9LOl 6sCtZUm+W2BMmTqaFRJuguLvvgvijgNL3Zgf4IF6HgZ32TLjASzGMOgO92cdTYKbc82X FiABfLJvZzqMqQci8kfSo/Iy0uvZ2QCeHWXaxUty4LzdK4wHLy5cefBXWelEYBhb8oVI SpFR/nyaA6TQ+zv14zaXpdnUVPHK21CKLqw7rHNAlSAA4TiXTezLd7A5ZBXXeaofwt+A DaqWNG2EAMDlC5IHwtoixdQ8Pux7kD84R+tOdqacMmLdsPqU3/ks3pXMj99wbcV7NNyA 6GTA== X-Gm-Message-State: AGRZ1gLh+2dQVqS7uQ2TzCqq/ixPvV1CqP2fLPDwCijwehh0tBywD8dE vMuItSIcmpzOeul96k8Pycl9PE1D64M= X-Received: by 2002:adf:9102:: with SMTP id j2-v6mr8146577wrj.3.1541109462538; Thu, 01 Nov 2018 14:57:42 -0700 (PDT) Received: from cloudburst.Home ([2a02:c7f:504f:6300:a3de:88d8:75ae:bf4c]) by smtp.gmail.com with ESMTPSA id i10-v6sm764923wrr.69.2018.11.01.14.57.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Nov 2018 14:57:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 1 Nov 2018 21:57:39 +0000 Message-Id: <20181101215739.29788-1-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::442 Subject: [Qemu-devel] [PATCH] target/arm: Conditionalize arm_div assert on aarch32 support 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: peter.maydell@linaro.org, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" When populating id registers from kvm, on a host that doesn't support aarch32 mode at all, aa32_arm_div will not be supported either. Signed-off-by: Richard Henderson --- "Tested" on an APM Mustang, which does support AArch32. I'm not sure, off hand, which cpu(s) don't have it, and Alex didn't say in his bug report. Tsk tsk. ;-) r~ --- target/arm/cpu.h | 5 +++++ target/arm/cpu.c | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) -- 2.17.2 diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 895f9909d8..4521ad5ae8 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -3300,6 +3300,11 @@ static inline bool isar_feature_aa64_fp16(const ARMISARegisters *id) return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, FP) == 1; } +static inline bool isar_feature_aa64_a32(const ARMISARegisters *id) +{ + return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, EL0) == 2; +} + static inline bool isar_feature_aa64_sve(const ARMISARegisters *id) { return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, SVE) != 0; diff --git a/target/arm/cpu.c b/target/arm/cpu.c index e08a2d2d79..988d97d1f1 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -828,8 +828,16 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) * include the various other features that V7VE implies. * Presence of EL2 itself is ARM_FEATURE_EL2, and of the * Security Extensions is ARM_FEATURE_EL3. + * + * V7VE requires ARM division. However, there exist AArch64 cpus + * without AArch32 support. When KVM queries ID_ISAR0_EL1 on such + * a host, the value is UNKNOWN. Similarly, we cannot check + * ID_AA64PFR0 without AArch64 support. Check everything in order. */ - assert(cpu_isar_feature(arm_div, cpu)); + if (arm_feature(&cpu->env, ARM_FEATURE_AARCH64) + && cpu_isar_feature(aa64_a32, cpu)) { + assert(cpu_isar_feature(arm_div, cpu)); + } set_feature(env, ARM_FEATURE_LPAE); set_feature(env, ARM_FEATURE_V7); }