From patchwork Fri Oct 19 16:56:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 149297 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp3550954lji; Fri, 19 Oct 2018 10:03:28 -0700 (PDT) X-Google-Smtp-Source: ACcGV619fXPAMkTGBLQ1QzD2tm3M90rK+geQn4puZHNPs8HFa+nxoolWXbcElPBNKwHBpr69eEz0 X-Received: by 2002:a0c:ac87:: with SMTP id m7mr30554806qvc.112.1539968608511; Fri, 19 Oct 2018 10:03:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539968608; cv=none; d=google.com; s=arc-20160816; b=XSctDAW/o7Ws50dUQ95aXRVonX3c7QMbIG1PIyaBvaQB26ZmQ3NyZDH6bY9aZlo7kR z2qY/l62zf7cSFpQ+qHJfxJ5b6sis3NXhUh7T2Jvvpj/jYwvDMqxIhjUN6BrJ6krjWdo /i9s5U/ZgY+4Q3RbYfujjuaZyubnRIXggAoF+8IMUO07KzbP/F6IbzXjvOb4fiMcAldR 1Ui6oKFxNWHFNSE+ZKofON+jgsZulC/d+gQ7XHRy8Zul+u0noOfS7Mdso9aQfdl2YTB2 DNp0ogI0ErPtnzwncbpgdamo7hdZhfOnV7u48FXIJY8ZGH+txI0h5ohLfAwUHvC8tvvy aHCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from; bh=fZGa4ZNpYAiOG7lXbwqMpMJ1DzrgVmRHDvhXzc+Bp5w=; b=k7cbyw1NhMI2AR2SkMdKrl1A42alYZAVbXLeLAQrFBY9sa+06JhC0BlBhYD3P0Ngyn arridk43e2rVmeppwbMCYqthforOoLBFzdWlqJdNYjHI+BZsBobz6pHrUADbQVfM8pgk SHXvu8fiLUIZ4z7LtDGITpASQKxVb+b69sJT22aD5YznEyiuUyzJchCZ0+R75RA0bYy4 8CA9d6eSACOEhLKkTdx404PQStimIUk7XDS4ZIbA13W4fZCCmw71sV4wfAAYFC61Co7O lQKjkcZnmL+Z3otxgHuF+wGIw81a4dTAWxi77qCl874lPTjIlSZEghA3/l+F7vuopPOF EL8g== ARC-Authentication-Results: i=1; mx.google.com; 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 u9-v6si1353734qki.158.2018.10.19.10.03.28 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 19 Oct 2018 10:03:28 -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; 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]:51720 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDYBL-00075E-S0 for patch@linaro.org; Fri, 19 Oct 2018 13:03:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47490) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDY5r-0001Pg-1b for qemu-devel@nongnu.org; Fri, 19 Oct 2018 12:57:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDY5p-0001vU-Pl for qemu-devel@nongnu.org; Fri, 19 Oct 2018 12:57:46 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:51976) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDY5p-0001uO-H1 for qemu-devel@nongnu.org; Fri, 19 Oct 2018 12:57:45 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1gDY5o-0006gt-Ks for qemu-devel@nongnu.org; Fri, 19 Oct 2018 17:57:44 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Fri, 19 Oct 2018 17:56:57 +0100 Message-Id: <20181019165735.22511-8-peter.maydell@linaro.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181019165735.22511-1-peter.maydell@linaro.org> References: <20181019165735.22511-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PULL 07/45] target/arm: Convert jazelle from feature bit to isar1 test 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Having V6 alone imply jazelle was wrong for cortex-m0. Change to an assertion for V6 & !M. This was harmless, because the only place we tested ARM_FEATURE_JAZELLE was for 'bxj' in disas_arm(), which is unreachable for M-profile cores. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Message-id: 20181016223115.24100-6-richard.henderson@linaro.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/cpu.h | 6 +++++- target/arm/cpu.c | 17 ++++++++++++++--- target/arm/translate.c | 2 +- 3 files changed, 20 insertions(+), 5 deletions(-) -- 2.19.1 diff --git a/target/arm/cpu.h b/target/arm/cpu.h index f1c2ec64616..1683ee98d60 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -1593,7 +1593,6 @@ enum arm_features { ARM_FEATURE_PMU, /* has PMU support */ ARM_FEATURE_VBAR, /* has cp15 VBAR */ ARM_FEATURE_M_SECURITY, /* M profile Security Extension */ - ARM_FEATURE_JAZELLE, /* has (trivial) Jazelle implementation */ ARM_FEATURE_SVE, /* has Scalable Vector Extension */ ARM_FEATURE_V8_FP16, /* implements v8.2 half-precision float */ ARM_FEATURE_M_MAIN, /* M profile Main Extension */ @@ -3160,6 +3159,11 @@ static inline bool isar_feature_arm_div(const ARMISARegisters *id) return FIELD_EX32(id->id_isar0, ID_ISAR0, DIVIDE) > 1; } +static inline bool isar_feature_jazelle(const ARMISARegisters *id) +{ + return FIELD_EX32(id->id_isar1, ID_ISAR1, JAZELLE) != 0; +} + static inline bool isar_feature_aa32_aes(const ARMISARegisters *id) { return FIELD_EX32(id->id_isar5, ID_ISAR5, AES) != 0; diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 9319f92f1f3..8f16e96b6c8 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -854,8 +854,8 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) } if (arm_feature(env, ARM_FEATURE_V6)) { set_feature(env, ARM_FEATURE_V5); - set_feature(env, ARM_FEATURE_JAZELLE); if (!arm_feature(env, ARM_FEATURE_M)) { + assert(cpu_isar_feature(jazelle, cpu)); set_feature(env, ARM_FEATURE_AUXCR); } } @@ -1082,11 +1082,16 @@ static void arm926_initfn(Object *obj) set_feature(&cpu->env, ARM_FEATURE_VFP); set_feature(&cpu->env, ARM_FEATURE_DUMMY_C15_REGS); set_feature(&cpu->env, ARM_FEATURE_CACHE_TEST_CLEAN); - set_feature(&cpu->env, ARM_FEATURE_JAZELLE); cpu->midr = 0x41069265; cpu->reset_fpsid = 0x41011090; cpu->ctr = 0x1dd20d2; cpu->reset_sctlr = 0x00090078; + + /* + * ARMv5 does not have the ID_ISAR registers, but we can still + * set the field to indicate Jazelle support within QEMU. + */ + cpu->isar.id_isar1 = FIELD_DP32(cpu->isar.id_isar1, ID_ISAR1, JAZELLE, 1); } static void arm946_initfn(Object *obj) @@ -1112,12 +1117,18 @@ static void arm1026_initfn(Object *obj) set_feature(&cpu->env, ARM_FEATURE_AUXCR); set_feature(&cpu->env, ARM_FEATURE_DUMMY_C15_REGS); set_feature(&cpu->env, ARM_FEATURE_CACHE_TEST_CLEAN); - set_feature(&cpu->env, ARM_FEATURE_JAZELLE); cpu->midr = 0x4106a262; cpu->reset_fpsid = 0x410110a0; cpu->ctr = 0x1dd20d2; cpu->reset_sctlr = 0x00090078; cpu->reset_auxcr = 1; + + /* + * ARMv5 does not have the ID_ISAR registers, but we can still + * set the field to indicate Jazelle support within QEMU. + */ + cpu->isar.id_isar1 = FIELD_DP32(cpu->isar.id_isar1, ID_ISAR1, JAZELLE, 1); + { /* The 1026 had an IFAR at c6,c0,0,1 rather than the ARMv6 c6,c0,0,2 */ ARMCPRegInfo ifar = { diff --git a/target/arm/translate.c b/target/arm/translate.c index 8b2be714390..e56b5cdff77 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -42,7 +42,7 @@ #define ENABLE_ARCH_5 arm_dc_feature(s, ARM_FEATURE_V5) /* currently all emulated v5 cores are also v5TE, so don't bother */ #define ENABLE_ARCH_5TE arm_dc_feature(s, ARM_FEATURE_V5) -#define ENABLE_ARCH_5J arm_dc_feature(s, ARM_FEATURE_JAZELLE) +#define ENABLE_ARCH_5J dc_isar_feature(jazelle, s) #define ENABLE_ARCH_6 arm_dc_feature(s, ARM_FEATURE_V6) #define ENABLE_ARCH_6K arm_dc_feature(s, ARM_FEATURE_V6K) #define ENABLE_ARCH_6T2 arm_dc_feature(s, ARM_FEATURE_THUMB2)