From patchwork Wed Mar 2 20:52:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 547535 Delivered-To: patch@linaro.org Received: by 2002:ac0:f585:0:0:0:0:0 with SMTP id s5csp41562imq; Wed, 2 Mar 2022 13:14:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJwV3BnyUajxuDZIl6CydONOAmKz0JHCq51abQNfEMmZXZHfQvcVwZtYzqRrkQjIQHRHUJw3 X-Received: by 2002:a05:6102:ec6:b0:31b:4882:8685 with SMTP id m6-20020a0561020ec600b0031b48828685mr14203616vst.70.1646255697641; Wed, 02 Mar 2022 13:14:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646255697; cv=none; d=google.com; s=arc-20160816; b=Q1cH3oqMB8bY9zKue9TQHXyYk3Os6UjpQ5B+ocSHu4o+XV359uCv7kcbDHu7+zFtGs 9NgwM8FHThQOhTZbbFh0U6+n15KeqUjhVyO006giGaarTktuwaw3oECpngppfGUc5Ale ZUfC/MNBT7Fq8/wKwMWy4NbRdgs0GxAcD5MVBwWZ3C4zCihB9Ct+nV2IqUG+TyhGpG9p A2XuspE38Vt2sYWiiHJmkkKjKnp4fuIHl7gr+mj2A0PWYc7IPi28VvjosusPhSb6XmIP YiQsM5dOTtCVxVzsXMY5ukAxhzmpgCpAddwSg1lKg7hKPRVOp/x4R1G3vGu/gBI2JBTi Ydiw== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=a6BM5prJChWZqJQTT1PzTDgjTHURzpRa12/wyNIbx18=; b=LHh/ipcP0v+GzLmmaw5jb7MQhlQWCATjt96VycbWLDhLMqdf0cFmxvbPMfhB3/5jv1 R2f47S5L7C2bUTPf+CW2m4pNnFm+RxeXIRaX1E/uMg9fcN7faQdo58ljIq6TQCtwlQVJ Jve3H/V5vIit+YLoy55POTTpmr6EvZC0MeReEGnbTV6tcuYel/7gF6Gon9G+5tkBK7qv qkWMgzLPNWBLcgoWNNMXyVoeHIQUb0CjJRPjZawFj9/sWnOkG0a07vSoD8P3VG6Nl4+4 BgJUC5UPinOvfRomiyg9/SdlpGdMgTH2Fz4nhB7/DyMTwl6lvitbPn2iNb9rQHPHXSA6 unGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DDAlN3Cb; 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=pass (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 r12-20020a67a64c000000b0031bb042e174si8300vsh.596.2022.03.02.13.14.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 02 Mar 2022 13:14:57 -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=pass header.i=@linaro.org header.s=google header.b=DDAlN3Cb; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:58000 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nPWJF-0007zP-53 for patch@linaro.org; Wed, 02 Mar 2022 16:14:57 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43508) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nPVxp-0005rJ-CT for qemu-devel@nongnu.org; Wed, 02 Mar 2022 15:52:51 -0500 Received: from [2a00:1450:4864:20::32f] (port=52060 helo=mail-wm1-x32f.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nPVxn-0008HT-RN for qemu-devel@nongnu.org; Wed, 02 Mar 2022 15:52:49 -0500 Received: by mail-wm1-x32f.google.com with SMTP id p4so1946252wmg.1 for ; Wed, 02 Mar 2022 12:52:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=a6BM5prJChWZqJQTT1PzTDgjTHURzpRa12/wyNIbx18=; b=DDAlN3CbmhnKG5xNfWo9TpC2VPU48k6thIy65fLnNhL4hT46OubyMN1cMVpxNXjVxr dDd/djwWU1qcbRa3J/7iL2reD/cgCp7HJ3gdsD0t36wQLk2lByukEiw93yjSpJUj/Rb5 xpwRU6e8b29tMbWEGwqq2j705SWREWULQ7/DyLr97eljKdUZ5+o4Zriz6kFhg8312P0s Av1O7IAhAF40CrQQVs9Ir6NKGtQTQvvwi9CHTKhr0vPJc8C/6xKzJGZY3GmFXEt1EkdV VjkmkrxuNQFwwlGQ5qLKfMXX80aFLVPas7ebn+RGUIKgeUwA1idtnyJo+4jwGRTkYIU9 4XcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=a6BM5prJChWZqJQTT1PzTDgjTHURzpRa12/wyNIbx18=; b=du1zXppQuaTZalxflUXjD0jztEghCoTNGVk8GST56x+2OaPAIONEK7wdvqs5YkXHYO pVM/lCJLJIzt1w/wTwxeM9/r7pn5xeRpikmiE9B+LLXE9bE1glrAyQ8XkHTuWEJzXA+d BkS0uNmePgWZ8gBu9istKRGNSpH0low6caWU5YwI8m2botmE1TzNWC1eMKY09kC+3ou7 TdZSgHS1b9kJ8hJ1KpQ+bNNJyYMbinnq3fHOx2k/86MddmamQ1xQbL04goZmea/KBvej ZcKAYD5NZ5U9zUOMe21aNSwiUjI0XvomeFbrPKjkYJqfFFExgaoj83wvdRiJ3tbCYE4U +9UA== X-Gm-Message-State: AOAM530qS5dkLREzTUqH3vyUm0GEhW4LwCa60CZ9o2zTFoz3IXnhoaC4 sB2lxbHKD83ArUYder64EfuB/I0ueW6EUw== X-Received: by 2002:a7b:c207:0:b0:381:6db7:d053 with SMTP id x7-20020a7bc207000000b003816db7d053mr1280380wmi.137.1646254366646; Wed, 02 Mar 2022 12:52:46 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id x13-20020adfec0d000000b001e31279cc38sm90801wrn.11.2022.03.02.12.52.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 12:52:46 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 16/26] target/arm: Implement FEAT_LVA Date: Wed, 2 Mar 2022 20:52:20 +0000 Message-Id: <20220302205230.2122390-17-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220302205230.2122390-1-peter.maydell@linaro.org> References: <20220302205230.2122390-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::32f (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32f.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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 This feature is relatively small, as it applies only to 64k pages and thus requires no additional changes to the table descriptor walking algorithm, only a change to the minimum TSZ (which is the inverse of the maximum virtual address space size). Note that this feature widens VBAR_ELx, but we already treat the register as being 64 bits wide. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220301215958.157011-10-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- docs/system/arm/emulation.rst | 1 + target/arm/cpu-param.h | 2 +- target/arm/cpu.h | 5 +++++ target/arm/cpu64.c | 1 + target/arm/helper.c | 9 ++++++++- 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/docs/system/arm/emulation.rst b/docs/system/arm/emulation.rst index 144dc491d95..f3eabddfb5a 100644 --- a/docs/system/arm/emulation.rst +++ b/docs/system/arm/emulation.rst @@ -27,6 +27,7 @@ the following architecture extensions: - FEAT_LRCPC (Load-acquire RCpc instructions) - FEAT_LRCPC2 (Load-acquire RCpc instructions v2) - FEAT_LSE (Large System Extensions) +- FEAT_LVA (Large Virtual Address space) - FEAT_MTE (Memory Tagging Extension) - FEAT_MTE2 (Memory Tagging Extension) - FEAT_MTE3 (MTE Asymmetric Fault Handling) diff --git a/target/arm/cpu-param.h b/target/arm/cpu-param.h index 7f38d33b8ea..5f9c288b1a6 100644 --- a/target/arm/cpu-param.h +++ b/target/arm/cpu-param.h @@ -11,7 +11,7 @@ #ifdef TARGET_AARCH64 # define TARGET_LONG_BITS 64 # define TARGET_PHYS_ADDR_SPACE_BITS 48 -# define TARGET_VIRT_ADDR_SPACE_BITS 48 +# define TARGET_VIRT_ADDR_SPACE_BITS 52 #else # define TARGET_LONG_BITS 32 # define TARGET_PHYS_ADDR_SPACE_BITS 40 diff --git a/target/arm/cpu.h b/target/arm/cpu.h index c6a4d50e821..c52d56f6699 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -4289,6 +4289,11 @@ static inline bool isar_feature_aa64_ccidx(const ARMISARegisters *id) return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, CCIDX) != 0; } +static inline bool isar_feature_aa64_lva(const ARMISARegisters *id) +{ + return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, VARANGE) != 0; +} + static inline bool isar_feature_aa64_tts2uxn(const ARMISARegisters *id) { return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, XNX) != 0; diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index 1171ab16b94..1de31ffb406 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -811,6 +811,7 @@ static void aarch64_max_initfn(Object *obj) t = FIELD_DP64(t, ID_AA64MMFR2, UAO, 1); t = FIELD_DP64(t, ID_AA64MMFR2, CNP, 1); /* TTCNP */ t = FIELD_DP64(t, ID_AA64MMFR2, ST, 1); /* TTST */ + t = FIELD_DP64(t, ID_AA64MMFR2, VARANGE, 1); /* FEAT_LVA */ cpu->isar.id_aa64mmfr2 = t; t = cpu->isar.id_aa64zfr0; diff --git a/target/arm/helper.c b/target/arm/helper.c index 2eff30d18c6..28b43472131 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -11271,7 +11271,14 @@ ARMVAParameters aa64_va_parameters(CPUARMState *env, uint64_t va, } else { max_tsz = 39; } - min_tsz = 16; /* TODO: ARMv8.2-LVA */ + + min_tsz = 16; + if (using64k) { + if (cpu_isar_feature(aa64_lva, env_archcpu(env))) { + min_tsz = 12; + } + } + /* TODO: FEAT_LPA2 */ if (tsz > max_tsz) { tsz = max_tsz;