From patchwork Tue Oct 16 22:31:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 149001 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp5668745lji; Tue, 16 Oct 2018 15:34:12 -0700 (PDT) X-Google-Smtp-Source: ACcGV61hI4he7xwICoTPI1VNDb/Q705F7cJPS8SnVGMuABQP6GEVSDxurU8RVA4ZkHg9dzjQngd0 X-Received: by 2002:a37:d6c2:: with SMTP id p63-v6mr22250818qkl.190.1539729252319; Tue, 16 Oct 2018 15:34:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539729252; cv=none; d=google.com; s=arc-20160816; b=Wrp7gxr9VB0efnVMvLwWsbvLEKeggm5v6Ywqi54kt+T0SMADsFr8mY+IKJ6L4Y9/xn VmAV6Mtriem7bHIWcGXCkG9BSV/umYH+frG5Q/EdI+xB0RJl8K2KmBq77UUZ9BJkW18H 6X2RHPuoCM6BUF73fp63fhPlaka5mRuwaAWYj7k684EmrSvRXfeN9uxMC4BrsyvNh+9E 4/U+vyDBAZmCTRbx3xbGdJbzDIWk0K30ON9TE7yj1h2goe0+SIWkgSr6870UMOFDpfVW 1vOsQdOMHBt0vEOC0Kr+FqLo7KW0enQts38En/D8ZVs60QeZwK5SFDr8QXyPHYFxwjRl B3dw== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=2bzU8lG8drgMg4KC0ysLIKiccci5Uymtc7dafrI+w/M=; b=znk+f/iZmtL9NOfujoTPSI/i17NQd3n6MrfQTu0G0P1coHNRfydRJmG6JNEBr9hd7z AtkcjguPiyA27J4923AHmdx8HpiURP22U0Rz3jtFLFeLY3guaLZAz+A7aB9LNsugTrDA bP7jan6KeB7ohjcz9MO3NozW51oEpgde5hUi+9eC5bbBK+FveOwHw/U+WJQrJN44iDYM vD0IbT8ng46OjsSF8dNRqxWTaZqAK9KN75rE6lQE+Ohi6ewNnl2rIIBwfQzLib8bwVgI Sq4ZurFZilWkVbdW7cI9lZEbbzXJqwqPciOA0//SI+w3YQPOhorUTzFoSNWZH2Zg08jp jd+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=MQXXcWpN; 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 l22-v6si7513868qki.23.2018.10.16.15.34.12 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 16 Oct 2018 15:34:12 -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=MQXXcWpN; 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]:60407 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gCXul-0003fj-Oj for patch@linaro.org; Tue, 16 Oct 2018 18:34:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53634) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gCXsC-0001Vm-PS for qemu-devel@nongnu.org; Tue, 16 Oct 2018 18:31:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gCXsA-0005VG-EO for qemu-devel@nongnu.org; Tue, 16 Oct 2018 18:31:32 -0400 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]:43107) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gCXs8-0005LU-DV for qemu-devel@nongnu.org; Tue, 16 Oct 2018 18:31:29 -0400 Received: by mail-pf1-x444.google.com with SMTP id p24-v6so12138889pff.10 for ; Tue, 16 Oct 2018 15:31:27 -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 :mime-version:content-transfer-encoding; bh=2bzU8lG8drgMg4KC0ysLIKiccci5Uymtc7dafrI+w/M=; b=MQXXcWpNw4JdkAgDjuilYU3Jm/6tT+Az9pXrnLcr0ava5HpxAL4BjOU6c+X3K135Ev ZnurC5KsOndaQNO4jM3jF+3fnJnNGQTI20AXcgWYGTm6aB3ebog6xjeKnsCIV4qJ/jDK mGf3lD6/dY0P5xTEEYuJjzIeu7wKT+YIIBOZo= 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:mime-version:content-transfer-encoding; bh=2bzU8lG8drgMg4KC0ysLIKiccci5Uymtc7dafrI+w/M=; b=Dh6UP/1yftn6lj0zg9EjtzKv1MRY6pEENbXcuSOUAe6LvoVrgRUjlw/6pdcxOBQ9LM EH+KhEYuZcQ4RXbGKLfADYmw6HYcYaFvOvpDwgrT2Bsbn7mVlN+O4NuomTEnl3zXBJ7w EzCq1zZAw+QsC77VeSrmXH6GDqo0LpgTnhmAWSLADFfxXQYlrti38Bu9Cv2dfAeMfpR4 zfNHmBPf5gY/DZcQYZVh+4NMEQQDLhz9WhbfxcMBTX18W8rVggLFwF08u+mwjcbIgxqD 3MvqoJUJDmYNJ+d1Qoqgrdoh9ULy0n5mDxmbMHHJQOYzp9V6xgY19qASxZ1JsTTyK+bu NZHg== X-Gm-Message-State: ABuFfohGDINuLi7D4HO/2NPonU84c7ULK0oHHJwv0WooM8t6rZyTq9KF N/3iXdtx8axjpFSsGo9RbJ2tuVvWxyY= X-Received: by 2002:a65:6295:: with SMTP id f21-v6mr22213943pgv.167.1539729086553; Tue, 16 Oct 2018 15:31:26 -0700 (PDT) Received: from cloudburst.twiddle.net (174-21-9-133.tukw.qwest.net. [174.21.9.133]) by smtp.gmail.com with ESMTPSA id a79-v6sm23094458pfa.124.2018.10.16.15.31.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 16 Oct 2018 15:31:25 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 16 Oct 2018 15:31:12 -0700 Message-Id: <20181016223115.24100-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181016223115.24100-1-richard.henderson@linaro.org> References: <20181016223115.24100-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::444 Subject: [Qemu-devel] [PATCH v4 5/8] 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. 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 --- target/arm/cpu.h | 6 +++++- target/arm/cpu.c | 17 ++++++++++++++--- target/arm/translate.c | 2 +- 3 files changed, 20 insertions(+), 5 deletions(-) -- 2.17.2 diff --git a/target/arm/cpu.h b/target/arm/cpu.h index a757aecd57..4fdace5de1 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -1586,7 +1586,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 */ @@ -3153,6 +3152,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 9319f92f1f..8f16e96b6c 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 8b2be71439..e56b5cdff7 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)