From patchwork Thu Feb 28 02:24:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 159304 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp111307jad; Wed, 27 Feb 2019 18:26:58 -0800 (PST) X-Google-Smtp-Source: AHgI3IYRME1sUOGdl+2Rk+lKaXdOiHBbEPjAE0cDItw9UQVasplUfypdebUcU5rrMtvf0spj5d6M X-Received: by 2002:a81:3d07:: with SMTP id k7mr3755346ywa.262.1551320818273; Wed, 27 Feb 2019 18:26:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551320818; cv=none; d=google.com; s=arc-20160816; b=SMmvkslS04TPXdqPcYtTKizzv1ccN++i22wg+KHf2FPpG1gDJtPDjdUOoRuRUJyy2/ sFVqJKtuULfm+85APCs78Ve8XOvZ6QNBEORWcyczjNC+vQl79554T/0au0zoqTY+78rH ejPSxyO0+CjR0eR1U7yai8E1h2uPKs5Nri/nj/EdhjEqgM+cabVBcich9bYtUxSDhMqT M1BLNtWALiXLW5AQ3AhNkLMwNafaYN4xqNp/CS5BOyxuQaDCgQBNGhy4brNOtYRZGb97 y9i6aFIuOoZNHVNVsAL4eG+z73tcJOfq3/ZS+hH+JHCz2YBFERVRWZVCQtGjO7wKVdZi 7YAQ== 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=LChsYdkE7QTme6BJYdMYtByCP2AoIgVkch18ulXBP7c=; b=ySpqYccjjW136Z2ZD3WydfqFuQSSXSOMDTXrjWZXQowvsRRK6HLg8Y8iu6hDiF+NlR G2W9G2/8N9fgzSOUoq+NnrPWxS45+1ZmUn6W52G/Ig225pTQuww4pGknAT+IB/QqEvjZ zVl/13+wRkK8G/ROC/YT+OsYr1ioZMDbSwGnLubkRypypsZQWw/b7ERxvMThB4O4+7Hh Oxx0FtOycnZbcD0TBJQIErf9EuuGm2n+PNTWTfrWEf16JYshLl/9ulCqx9RqeBKB1ksZ 0yQn6PjAyp7CBnuZdYmdm8Gk6vp3NhyBflHJ/2XkV2kSFebSFtLdEzIInNy9JZi0nN9z 5NmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="e7/wSX0f"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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. [209.51.188.17]) by mx.google.com with ESMTPS id m143si10613850ywd.453.2019.02.27.18.26.58 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 27 Feb 2019 18:26:58 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="e7/wSX0f"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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 ([127.0.0.1]:55326 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gzBPV-0004Mn-Kr for patch@linaro.org; Wed, 27 Feb 2019 21:26:57 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43948) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gzBN8-0003OJ-JV for qemu-devel@nongnu.org; Wed, 27 Feb 2019 21:24:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gzBN0-00055X-KP for qemu-devel@nongnu.org; Wed, 27 Feb 2019 21:24:23 -0500 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]:37197) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gzBN0-00054M-Av for qemu-devel@nongnu.org; Wed, 27 Feb 2019 21:24:22 -0500 Received: by mail-pl1-x644.google.com with SMTP id q3so8959335pll.4 for ; Wed, 27 Feb 2019 18:24:22 -0800 (PST) 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=LChsYdkE7QTme6BJYdMYtByCP2AoIgVkch18ulXBP7c=; b=e7/wSX0frBPLA0M/g7kFGgF0ngm8cs5fHzXxcUzaGt9pdg7w5jGf9PPoGB+r4fBiKd yNQKVgBDvf1nOH5NWXUPQRAfnY+RukL3w9ykNfixHXTSaRoz66J4vTgSnNMMkbRURhsG HaTwzaJtIIwBHW38yPoK57pJTS5tDs60z6u4NARojR57hx8VInBNMbrXubbYrH0qzhZz UeqCBQNYcV33lPBnny3f2WhVtEtLPOx6dZVcf4xS6MddcHhgXrACUbS/UzHm1N6B9yM2 6w7AIIbtQFuGBuiqxg7njXdZ8rTRBwvC301iX29I02KXSkLpq0fPHpv6TT71V/mKQl+x gkiw== 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=LChsYdkE7QTme6BJYdMYtByCP2AoIgVkch18ulXBP7c=; b=pGpYCe2CPdf5mxleetwiJAZRFnuZfAz/5ijUZJROdPbsHdPvXbiiOLjm5Dxdg9UrGK S1+7kZrFHezeZjjQ34tDaKDbkzq/1cgyqgOKaqVmDhXOMtVW/u2scRZsjgKB+ZmdxSex VObFBd2+WnzlFF1CZ1QB3xVZNa6TgTJVqERDZet2ForQ1ZM6+/+MkQXO+ckyVTmGD4Ju qKDAAgxfNVmwIrrqPi3BIVfO3vsx3/eiNaJa+lIuqcGuZG3p78N4ZFON7P6FmvBssiyB PgNYnjdIMG+f9aDfZ/H81LpyTatCat3Zt6YK64oJA1n3p77Lirkw/fFLa/kfxuan1Y15 CQKw== X-Gm-Message-State: AHQUAuac18BUEinAh6c+avqASckx8ibSi/SZ3P+y2fQAqM5Zbpi/WNAI km1mrZXDJHc/wmt9ybXlFjec9L+XnEA= X-Received: by 2002:a17:902:9683:: with SMTP id n3mr5526321plp.333.1551320660883; Wed, 27 Feb 2019 18:24:20 -0800 (PST) Received: from cloudburst.dc.rr.com ([2605:e000:100e:478c:cfa2:eb27:db4f:e85]) by smtp.gmail.com with ESMTPSA id l28sm11928346pfi.186.2019.02.27.18.24.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 27 Feb 2019 18:24:20 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 27 Feb 2019 18:24:14 -0800 Message-Id: <20190228022415.27878-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190228022415.27878-1-richard.henderson@linaro.org> References: <20190228022415.27878-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::644 Subject: [Qemu-devel] [PATCH v2 2/3] target/arm: Implement ARMv8.0-SB 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" Signed-off-by: Richard Henderson --- target/arm/cpu.h | 10 ++++++++++ linux-user/elfload.c | 1 + target/arm/cpu.c | 1 + target/arm/cpu64.c | 2 ++ target/arm/translate-a64.c | 14 ++++++++++++++ target/arm/translate.c | 22 ++++++++++++++++++++++ 6 files changed, 50 insertions(+) -- 2.17.2 diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 9a4c56826a..1a6ca35ea7 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -3289,6 +3289,11 @@ static inline bool isar_feature_aa32_dp(const ARMISARegisters *id) return FIELD_EX32(id->id_isar6, ID_ISAR6, DP) != 0; } +static inline bool isar_feature_aa32_sb(const ARMISARegisters *id) +{ + return FIELD_EX32(id->id_isar6, ID_ISAR6, SB) != 0; +} + static inline bool isar_feature_aa32_fp16_arith(const ARMISARegisters *id) { /* @@ -3387,6 +3392,11 @@ static inline bool isar_feature_aa64_pauth(const ARMISARegisters *id) FIELD_DP64(0, ID_AA64ISAR1, GPI, 0xf))) != 0; } +static inline bool isar_feature_aa64_sb(const ARMISARegisters *id) +{ + return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, SB) != 0; +} + static inline bool isar_feature_aa64_fp16(const ARMISARegisters *id) { /* We always set the AdvSIMD and FP fields identically wrt FP16. */ diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 3a50d587ff..b7484f6d82 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -602,6 +602,7 @@ static uint32_t get_elf_hwcap(void) GET_FEATURE_ID(aa64_fcma, ARM_HWCAP_A64_FCMA); GET_FEATURE_ID(aa64_sve, ARM_HWCAP_A64_SVE); GET_FEATURE_ID(aa64_pauth, ARM_HWCAP_A64_PACA | ARM_HWCAP_A64_PACG); + GET_FEATURE_ID(aa64_sb, ARM_HWCAP_A64_SB); #undef GET_FEATURE_ID diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 8ea6569088..7940d49c1d 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -2003,6 +2003,7 @@ static void arm_max_initfn(Object *obj) t = cpu->isar.id_isar6; t = FIELD_DP32(t, ID_ISAR6, JSCVT, 1); t = FIELD_DP32(t, ID_ISAR6, DP, 1); + t = FIELD_DP32(t, ID_ISAR6, SB, 1); cpu->isar.id_isar6 = t; t = cpu->id_mmfr4; diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index 69e4134f79..168aa9e0f1 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -317,6 +317,7 @@ static void aarch64_max_initfn(Object *obj) t = FIELD_DP64(t, ID_AA64ISAR1, API, 0); t = FIELD_DP64(t, ID_AA64ISAR1, GPA, 1); t = FIELD_DP64(t, ID_AA64ISAR1, GPI, 0); + t = FIELD_DP64(t, ID_AA64ISAR1, SB, 1); cpu->isar.id_aa64isar1 = t; t = cpu->isar.id_aa64pfr0; @@ -347,6 +348,7 @@ static void aarch64_max_initfn(Object *obj) u = cpu->isar.id_isar6; u = FIELD_DP32(u, ID_ISAR6, JSCVT, 1); u = FIELD_DP32(u, ID_ISAR6, DP, 1); + u = FIELD_DP32(u, ID_ISAR6, SB, 1); cpu->isar.id_isar6 = u; /* diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index c56e878787..7c00d084ce 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -1637,7 +1637,21 @@ static void handle_sync(DisasContext *s, uint32_t insn, reset_btype(s); gen_goto_tb(s, 0, s->pc); return; + + case 7: /* SB */ + if (crm != 0 || !dc_isar_feature(aa64_sb, s)) { + goto do_unallocated; + } + /* + * TODO: There is no speculation barrier opcode for TCG; + * MB and end the TB instead. + */ + tcg_gen_mb(TCG_MO_ALL | TCG_BAR_SC); + gen_goto_tb(s, 0, s->pc); + return; + default: + do_unallocated: unallocated_encoding(s); return; } diff --git a/target/arm/translate.c b/target/arm/translate.c index c1175798ac..b86086ada9 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -9208,6 +9208,17 @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) */ gen_goto_tb(s, 0, s->pc & ~1); return; + case 7: /* sb */ + if ((insn & 0xf) || !dc_isar_feature(aa32_sb, s)) { + goto illegal_op; + } + /* + * TODO: There is no speculation barrier opcode + * for TCG; MB and end the TB instead. + */ + tcg_gen_mb(TCG_MO_ALL | TCG_BAR_SC); + gen_goto_tb(s, 0, s->pc & ~1); + return; default: goto illegal_op; } @@ -11826,6 +11837,17 @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) */ gen_goto_tb(s, 0, s->pc & ~1); break; + case 7: /* sb */ + if ((insn & 0xf) || !dc_isar_feature(aa32_sb, s)) { + goto illegal_op; + } + /* + * TODO: There is no speculation barrier opcode + * for TCG; MB and end the TB instead. + */ + tcg_gen_mb(TCG_MO_ALL | TCG_BAR_SC); + gen_goto_tb(s, 0, s->pc & ~1); + break; default: goto illegal_op; }