From patchwork Thu Sep 27 21:13:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 147738 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp2525705lji; Thu, 27 Sep 2018 14:38:32 -0700 (PDT) X-Google-Smtp-Source: ACcGV62kFtg0Z74pNX0soSTepzPJmD3qhi6+zfq5omvcHFcAlQfVj4Q7vbv0KDJLsIwDWs1fJtIN X-Received: by 2002:ad4:50ce:: with SMTP id e14-v6mr9353698qvq.232.1538084312772; Thu, 27 Sep 2018 14:38:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538084312; cv=none; d=google.com; s=arc-20160816; b=Yd9wsT6pGNwrErrqzMqF1GQS+rtVGsRcXiUlXGFSU32gWLEEnIEnGOPqQTVbWUAYxU rTf89cB4tDuTca3WfBeqK8OY7gy1gUHLnT2IHtPNSrfKPFTZiMASsfsnk+jUk4mRGgnd QyRyDQVK7SgvZkSZiT8cx3smFnUheEnaggGdqb9yLgFSOHlIuNTMaVXc/ruCi/XjI57g HbSSNArjLyH7Otu5iioyG0KnOVAjk4x1hjsiwrViTtzJkYBWKOmnJ+x3elYySq5nVl/i gPFPC5FU4EAiFe4p9vfKc5+Np9lLqxeEvmgB4YeULg+6b87h6brCyDd8TIXeruK8B0F4 jTWQ== 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:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=vwSuxrZ2VlCD5l422rszUmQTYeTh9YcaszJJagMtUh8=; b=Z/HW3ay8RZ7ZAEEmxPhkPVdJ5L+breqmv5ssaW2ExEDH6AV06pCTm/sNZF70D9itpp TQL90zNCV9o0aR+hlgf4Vj1recsY43o/3AwdKZCFsWEVXeQIs/jBNEjMU/7rjA6vy19r /c+/XlwagxorU9w8vwHqS43ciw4s52pp9gru6ICMaanA7bvU9ypmklgMSJZUmenmb7VY z/una4NHFDyKukBPafnBdgULziFwerbXAWkVJXPR9ZfRS9CtsQR7CCo0+0nOoHJkawiY YYwxmqueBOOZyLFMYKAU4tqKJ+qbS38jsh7jafbszgskj9VQxnOvCF5u1RbfCCAy8y0w qPhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=XoUNHGna; 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 k58-v6si2119784qtf.286.2018.09.27.14.38.32 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 27 Sep 2018 14:38:32 -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=XoUNHGna; 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]:39585 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g5dzU-0002Xe-5e for patch@linaro.org; Thu, 27 Sep 2018 17:38:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53588) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g5dpX-0002Hp-4u for qemu-devel@nongnu.org; Thu, 27 Sep 2018 17:28:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g5dbR-0000pb-76 for qemu-devel@nongnu.org; Thu, 27 Sep 2018 17:13:45 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]:34131) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g5dbM-0000br-F0 for qemu-devel@nongnu.org; Thu, 27 Sep 2018 17:13:39 -0400 Received: by mail-pf1-x431.google.com with SMTP id k19-v6so2770514pfi.1 for ; Thu, 27 Sep 2018 14:13:35 -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:in-reply-to:references; bh=vwSuxrZ2VlCD5l422rszUmQTYeTh9YcaszJJagMtUh8=; b=XoUNHGnaSj734F0IjTtDdbJKoqNdRbfjMEbUrZ4z1JM8tmgzyfqDX68TXj5eMWWMvK H0dj+8dPRGInqt3UzMAFPIMo/oVHZNDqN0mw6L/4G1Rmm/gbZSjnv9XDZUG7i61kT/P7 qjcz8lnXVesEiArig8hoA81dG2fcDvMqMMMec= 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:in-reply-to :references; bh=vwSuxrZ2VlCD5l422rszUmQTYeTh9YcaszJJagMtUh8=; b=BZ29gq2yFYMLO2agXzCjOGGj6JII0Ss8y1bG58iMHXZjjl5W7051UKHOpid5ssMucj Uqs214nRo+ItFsZRtUOkbJ9Xfjrv2LvbmkN2bD1NmBKM/kJx1GZJpvDM3qBzf3f6t/IW gMA76YHdk87PjwaXNkzcMQ6qg4gbdkL8BVvxHJISnhYj2lyZl1Oe36ZI9tWYRI6P/O5u H9aOWVvxo4kFIsusgW0OpCMlCTzqsh+stDdJlD5W7cv3gDTz+PMv9ohLYvbBfUTx+ymw 9UFS8KKnKhmxUsI/b8uT+PkQMN4eRtv1NqIrMilYXviS8lavQ8BZUKqgBmgZkoEIMZN9 M/Lg== X-Gm-Message-State: ABuFfogAh0sFlgpUr2Vjtpwgr5ycxSlIuHZlnKZbyyLsIflPYtRiUZsi XbMEOZxAz93Ip69/qnsse9MayHUhmZI= X-Received: by 2002:a63:a0d:: with SMTP id 13-v6mr12298840pgk.318.1538082814195; Thu, 27 Sep 2018 14:13:34 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-8-179.tukw.qwest.net. [97.113.8.179]) by smtp.gmail.com with ESMTPSA id l26-v6sm5395884pfg.161.2018.09.27.14.13.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Sep 2018 14:13:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 27 Sep 2018 14:13:19 -0700 Message-Id: <20180927211322.16118-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180927211322.16118-1-richard.henderson@linaro.org> References: <20180927211322.16118-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::431 Subject: [Qemu-devel] [PATCH v2 6/9] 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: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Having V6 alone imply jazelle was wrong for cortex-m0. Change to an assertion for V6 & !M. Signed-off-by: Richard Henderson --- target/arm/cpu.h | 6 +++++- target/arm/translate.h | 1 + target/arm/cpu.c | 17 ++++++++++++++--- target/arm/translate.c | 2 +- 4 files changed, 21 insertions(+), 5 deletions(-) -- 2.17.1 Reviewed-by: Philippe Mathieu-Daudé diff --git a/target/arm/cpu.h b/target/arm/cpu.h index cd57c5aae0..c9996d2534 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -1557,7 +1557,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 */ @@ -3119,6 +3118,11 @@ static inline bool aa32_feature_arm_div(ARMCPU *cpu) return FIELD_EX32(cpu->id_isar0, ID_ISAR0, DIVIDE) > 1; } +static inline bool aa32_feature_jazelle(ARMCPU *cpu) +{ + return FIELD_EX32(cpu->id_isar1, ID_ISAR1, JAZELLE) != 0; +} + static inline bool aa32_feature_aes(ARMCPU *cpu) { return FIELD_EX32(cpu->id_isar5, ID_ISAR5, AES) != 0; diff --git a/target/arm/translate.h b/target/arm/translate.h index 3eb863ae43..d8eafbe88d 100644 --- a/target/arm/translate.h +++ b/target/arm/translate.h @@ -196,6 +196,7 @@ static inline TCGv_i32 get_ahp_flag(void) FORWARD_FEATURE(thumb_div) FORWARD_FEATURE(arm_div) +FORWARD_FEATURE(jazelle) FORWARD_FEATURE(aes) FORWARD_FEATURE(pmull) FORWARD_FEATURE(sha1) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 4f2372c6d7..41a1b27c61 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -850,8 +850,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(aa32_feature_jazelle(cpu)); set_feature(env, ARM_FEATURE_AUXCR); } } @@ -1078,11 +1078,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. + */ + FIELD_DP32(cpu->id_isar1, ID_ISAR1, JAZELLE, 1); } static void arm946_initfn(Object *obj) @@ -1108,12 +1113,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. + */ + FIELD_DP32(cpu->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 c94c69e331..4036be6828 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 aa32_dc_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)