From patchwork Fri Nov 2 13:41:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 150036 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2096599ljp; Fri, 2 Nov 2018 06:42:17 -0700 (PDT) X-Google-Smtp-Source: AJdET5dYmzQ/vo83iy4mMwWlpLMjNG3rSbUa65fTAqcl9ZJEu9F21ZqG1L9Kk1tVpwtsO0ASnvop X-Received: by 2002:a0c:ade7:: with SMTP id x36mr10538519qvc.66.1541166137221; Fri, 02 Nov 2018 06:42:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541166137; cv=none; d=google.com; s=arc-20160816; b=Qkuons3tSJDHtEHB0jhHzzR0TQ+XTj+TMscvkqgLx/xEL3+SgMBfw+Ie6hKnpkRTNA QORSknNSf3bY4ECyNbUMFIvh0EcGgQUQptGtH35qlb96rUl7DcgMU7yPeGY4eCHHiBDn 2RZ3bpLwhEtVkxLi1oejuA6XctixsUvUbIDVnfNOrYNF1Z9ClVQ6FcKqWqX+Ne5y4vAe rNXWLsuq745lYx+HCu41DfvZtDVSYi0Qmvc78fb0zO3eMVdlW3hndeflHCoFv7yH1HHv Ps9t/TmjDG/w1j/P8ngiIoMJmJkIArna0UH9tqr1wthbIbU6sqwSwnUbX98s0ET+Cedo bVWQ== 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=ibpO8aAfuGlV+RemFfOG8a6k0Psov4g1AaQlMHudcgg=; b=sT75l99yqDyMaQbrZcseb44b2SOHXl5UL3kG2jQj8Q1vIflANOxXpLzkpUiRxDaWPY vMS+2yxFTL+wWtNPHKGoEOPBc6rWoJ7ZQrOzflqc7HyQnYaZzik6T1+EJiBCtWB4tTk5 AvjlJJ3m+StlOqRQATIimsrh8j22mTlbH5eZKPq+WxuG7OFH8n8x4t3dHfvMHYsE56bM 5ioLBP3VDZSH93ZERikXmReXUDc+2wc57DQLvTNYQq/FbsSIWFqq4CRe7N1F8q6E96cS wjn58ChNh7YxOh8voB1u7+GYOI7zXXg9f/Avjm/bi/ho6UWYijN7KtyqfJnDSrPg1BXA 4uvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=dYYanNyp; 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 x36-v6si4714625qte.376.2018.11.02.06.42.17 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 02 Nov 2018 06:42:17 -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=dYYanNyp; 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]:51761 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gIZiK-0007Gj-KJ for patch@linaro.org; Fri, 02 Nov 2018 09:42:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60713) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gIZhl-00078v-AL for qemu-devel@nongnu.org; Fri, 02 Nov 2018 09:41:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gIZhj-0007Mc-Dp for qemu-devel@nongnu.org; Fri, 02 Nov 2018 09:41:41 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:37029) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gIZhj-0007BJ-48 for qemu-devel@nongnu.org; Fri, 02 Nov 2018 09:41:39 -0400 Received: by mail-wm1-x342.google.com with SMTP id p2-v6so1946947wmc.2 for ; Fri, 02 Nov 2018 06:41:21 -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=ibpO8aAfuGlV+RemFfOG8a6k0Psov4g1AaQlMHudcgg=; b=dYYanNypVMR8K+kdz6rgbEYv+mhyF/Nm0Yq/babvhX6H3pulHbuR1kbYYBgCMlKmEu cLa3RoyHPum81BJEnwG8cmWudlH+CclPrYnD5rJ5tKa3v5HXTGkYRfMqfu6D6k9L/14I Wv9+zx2hLL5FqsM3zE2CjwYp2e3E96fCIGPEY= 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=ibpO8aAfuGlV+RemFfOG8a6k0Psov4g1AaQlMHudcgg=; b=Rue4IkxptEic4hQXr7q/hpx5Zk3WqRRF6zvzyamWEBKXDW+D9k6ReT3krFyIulqMEk pNTTl+WeOF13LmKHf3V+QPjJBdCKMhQ+fXeORmiV2CRsWgXP9ev5FdgUjupRaby6iSxt U29iDBpB6+nVrpdj+ehKaeGRzmTNlk9ppMsJ4CgLglvgqN8STL0V0nXWgWdyK+K4VAxF ISm2zsKxXpD1ivG2EREopMsdh1GeIzGPvhT+KLWHXfTI/24Jr5B96l/9fGcGkKC08HRa prZuPeRZ3ZPaSdyBvqHFOFfB6LNv4OQYFRFfvyvw4bGADXL24LV7XHXukas1/DLW+leH K8fw== X-Gm-Message-State: AGRZ1gJnyKOjNSXkBiV2g9IoM+xIGtmk1gHFQ6GKps9p0eWkIBG1PtlY t0focg4SFNhT1qGfMOIiTKXr7TzBVYw= X-Received: by 2002:a1c:8d2:: with SMTP id 201-v6mr13439wmi.132.1541166079880; Fri, 02 Nov 2018 06:41:19 -0700 (PDT) Received: from cloudburst.Home ([2a02:c7f:504f:6300:a3de:88d8:75ae:bf4c]) by smtp.gmail.com with ESMTPSA id e10-v6sm1629686wrp.56.2018.11.02.06.41.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Nov 2018 06:41:19 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 2 Nov 2018 13:41:10 +0000 Message-Id: <20181102134112.26370-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181102134112.26370-1-richard.henderson@linaro.org> References: <20181102134112.26370-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::342 Subject: [Qemu-devel] [PATCH for-4.0 2/4] target/arm: Implement the ARMv8.1-LOR extension 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: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Provide a trivial implementation with zero limited ordering regions, which causes the LDLAR and STLLR instructions to devolve into the LDAR and STLR instructions from the base ARMv8.0 instruction set. Signed-off-by: Richard Henderson --- target/arm/cpu.h | 5 +++++ target/arm/cpu64.c | 4 ++++ target/arm/helper.c | 26 ++++++++++++++++++++++++++ target/arm/translate-a64.c | 12 ++++++++++++ 4 files changed, 47 insertions(+) -- 2.17.2 diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 2ce5e80dfc..f12a6afddc 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -3278,6 +3278,11 @@ static inline bool isar_feature_aa64_atomics(const ARMISARegisters *id) return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, ATOMIC) != 0; } +static inline bool isar_feature_aa64_lor(const ARMISARegisters *id) +{ + return FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR1, LO) != 0; +} + static inline bool isar_feature_aa64_rdm(const ARMISARegisters *id) { return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, RDM) != 0; diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index 0babe483ac..aac6283018 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -324,6 +324,10 @@ static void aarch64_max_initfn(Object *obj) t = FIELD_DP64(t, ID_AA64PFR0, ADVSIMD, 1); cpu->isar.id_aa64pfr0 = t; + t = cpu->isar.id_aa64mmfr1; + t = FIELD_DP64(t, ID_AA64MMFR1, LO, 1); + cpu->isar.id_aa64mmfr1 = t; + /* Replicate the same data to the 32-bit id registers. */ u = cpu->isar.id_isar5; u = FIELD_DP32(u, ID_ISAR5, AES, 2); /* AES + PMULL */ diff --git a/target/arm/helper.c b/target/arm/helper.c index 70376764cb..758ddac5e9 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -5714,6 +5714,32 @@ void register_cp_regs_for_features(ARMCPU *cpu) define_one_arm_cp_reg(cpu, &sctlr); } + if (cpu_isar_feature(aa64_lor, cpu)) { + /* + * A trivial implementation of ARMv8.1-LOR leaves all of these + * registers fixed at 0, which indicates that there are zero + * supported Limited Ordering regions. + */ + static const ARMCPRegInfo lor_reginfo[] = { + { .name = "LORSA_EL1", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 0, + .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, + { .name = "LOREA_EL1", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 1, + .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, + { .name = "LORN_EL1", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 2, + .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, + { .name = "LORC_EL1", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 3, + .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, + { .name = "LORID_EL1", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 7, + .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, + }; + define_arm_cp_regs(cpu, lor_reginfo); + } + if (cpu_isar_feature(aa64_sve, cpu)) { define_one_arm_cp_reg(cpu, &zcr_el1_reginfo); if (arm_feature(env, ARM_FEATURE_EL2)) { diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 88195ab949..2307a18d5a 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -2290,6 +2290,12 @@ static void disas_ldst_excl(DisasContext *s, uint32_t insn) } return; + case 0x8: /* STLLR */ + if (!dc_isar_feature(aa64_lor, s)) { + break; + } + /* StoreLORelease is the same as Store-Release for QEMU. */ + /* fallthru */ case 0x9: /* STLR */ /* Generate ISS for non-exclusive accesses including LASR. */ if (rn == 31) { @@ -2301,6 +2307,12 @@ static void disas_ldst_excl(DisasContext *s, uint32_t insn) disas_ldst_compute_iss_sf(size, false, 0), is_lasr); return; + case 0xc: /* LDLAR */ + if (!dc_isar_feature(aa64_lor, s)) { + break; + } + /* LoadLOAcquire is the same as Load-Acquire for QEMU. */ + /* fallthru */ case 0xd: /* LDAR */ /* Generate ISS for non-exclusive accesses including LASR. */ if (rn == 31) {