From nobody Tue Nov 18 07:46:12 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1608303458; cv=none; d=zohomail.com; s=zohoarc; b=WNHbIYa1smsNimrwLizTB9NUtI5NUF+TNpN6vwVxKgRNM0JAU9TjdQzS3zvT8sox7lnUh6kAbxZOon2epUQbaqi44mQ0drG5ppc4PBPYEr3XuwlBr//Jfc4CMkI97f85UwIm1BY+Nficta0AJoyH1vaCKgRhWGb2JCHdv2zjKs8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608303458; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=tQwn4qVMdGLGDq3gfktgy6B9oXejqFnPXqmiWAII9dk=; b=WyhxSaBV9q+oqmJ4w6gTz8vrjAiurhQfW7/f5itRlcAEhSZ7llDDbYyKFfzTq6wCCRdKIFQWwH9qQsbyXo/zPbHvBqjM25R3Imd7HiOpEouz+8FDPOhZ77YOHNr7JxlWt472wftIYA7ag9C/IvOmLwLVpSEyjhI1yaOvse8xdIE= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608303458131876.7133396700248; Fri, 18 Dec 2020 06:57:38 -0800 (PST) Received: from localhost ([::1]:47500 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kqGtv-0005s9-20 for importer@patchew.org; Fri, 18 Dec 2020 09:38:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41274) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kqGox-0001VZ-6A; Fri, 18 Dec 2020 09:33:29 -0500 Received: from poy.remlab.net ([2001:41d0:2:5a1a::]:56806 helo=ns207790.ip-94-23-215.eu) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kqGov-0007Y9-27; Fri, 18 Dec 2020 09:33:26 -0500 Received: from basile.remlab.net (ip6-localhost [IPv6:::1]) by ns207790.ip-94-23-215.eu (Postfix) with ESMTP id 6BE025FC85; Fri, 18 Dec 2020 15:33:21 +0100 (CET) From: remi.denis.courmont@huawei.com To: qemu-arm@nongnu.org Subject: [PATCH 1/3] target/arm: keep translation start level unsigned Date: Fri, 18 Dec 2020 16:33:19 +0200 Message-Id: <20201218143321.102872-1-remi.denis.courmont@huawei.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <7884934.NyiUUSuA9g@basile.remlab.net> References: <7884934.NyiUUSuA9g@basile.remlab.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41d0:2:5a1a::; envelope-from=remi@remlab.net; helo=ns207790.ip-94-23-215.eu X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.249, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" From: R=C3=A9mi Denis-Courmont Signed-off-by: R=C3=A9mi Denis-Courmont --- target/arm/helper.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index df195c314c..b927e53ab0 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -10821,17 +10821,12 @@ do_fault: * Returns true if the suggested S2 translation parameters are OK and * false otherwise. */ -static bool check_s2_mmu_setup(ARMCPU *cpu, bool is_aa64, int level, +static bool check_s2_mmu_setup(ARMCPU *cpu, bool is_aa64, uint32_t level, int inputsize, int stride) { const int grainsize =3D stride + 3; int startsizecheck; =20 - /* Negative levels are never allowed. */ - if (level < 0) { - return false; - } - startsizecheck =3D inputsize - ((3 - level) * stride + grainsize); if (startsizecheck < 1 || startsizecheck > stride + 4) { return false; @@ -10856,6 +10851,9 @@ static bool check_s2_mmu_setup(ARMCPU *cpu, bool is= _aa64, int level, if (level =3D=3D 0 && pamax <=3D 42) { return false; } + if (level =3D=3D 3) { + return false; + } break; default: g_assert_not_reached(); @@ -10871,7 +10869,7 @@ static bool check_s2_mmu_setup(ARMCPU *cpu, bool is= _aa64, int level, /* AArch32 only supports 4KB pages. Assert on that. */ assert(stride =3D=3D 9); =20 - if (level =3D=3D 0) { + if (level =3D=3D 0 || level >=3D 3) { return false; } } @@ -11203,7 +11201,7 @@ static bool get_phys_addr_lpae(CPUARMState *env, ui= nt64_t address, =20 if (!aarch64 || stride =3D=3D 9) { /* AArch32 or 4KB pages */ - startlevel =3D 2 - sl0; + startlevel =3D (2 - sl0) & 3; } else { /* 16KB or 64KB pages */ startlevel =3D 3 - sl0; --=20 2.29.2 From nobody Tue Nov 18 07:46:12 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1608303110; cv=none; d=zohomail.com; s=zohoarc; b=il608KFvQ5TLJq58bMCQSXq3ddC+MmguPgbU6lzWGBkZXvPnYaUB0hF3tyixoOgwwxiV8IjPtDfcM0nRuEufCb5GluQq0q/ZpRL1UlKaJVDXXZsOdT51O7+8Ag98qOwc4JI9r4BVrLT9xL+ejQy1mI/HacZzY8WoGR4Hp1DgqT8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608303110; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=aW/fktrJgU+OulOQxP/gQdwVSZ2bOGMXODCllo6M6Hw=; b=cIbIB0ceaYppIyM4/CTXPlAX1MdGcgUxg3y3wnaGyXA4rVlt6bA5geRvZqBuTCRGYP72BQjjov2XBjA2i4BrIL9W2X1OFr+IZ3FZ2H0yroL4POprQs8jOV2xvN5LBED5pmmWF0Qqo2kRVFHHyUBrY42lkiPESOdbs8HyI/pw9yU= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608303110346695.9595027376262; Fri, 18 Dec 2020 06:51:50 -0800 (PST) Received: from localhost ([::1]:43320 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kqGsJ-00046f-1m for importer@patchew.org; Fri, 18 Dec 2020 09:36:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41254) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kqGow-0001V7-1w; Fri, 18 Dec 2020 09:33:26 -0500 Received: from poy.remlab.net ([2001:41d0:2:5a1a::]:56808 helo=ns207790.ip-94-23-215.eu) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kqGot-0007YA-6e; Fri, 18 Dec 2020 09:33:25 -0500 Received: from basile.remlab.net (ip6-localhost [IPv6:::1]) by ns207790.ip-94-23-215.eu (Postfix) with ESMTP id BD0F65FD51; Fri, 18 Dec 2020 15:33:21 +0100 (CET) From: remi.denis.courmont@huawei.com To: qemu-arm@nongnu.org Subject: [PATCH 2/3] target/arm: ARMv8.4-TTST extension Date: Fri, 18 Dec 2020 16:33:20 +0200 Message-Id: <20201218143321.102872-2-remi.denis.courmont@huawei.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <7884934.NyiUUSuA9g@basile.remlab.net> References: <7884934.NyiUUSuA9g@basile.remlab.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41d0:2:5a1a::; envelope-from=remi@remlab.net; helo=ns207790.ip-94-23-215.eu X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.249, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" From: R=C3=A9mi Denis-Courmont This adds for the Small Translation tables extension in AArch64 state. Signed-off-by: R=C3=A9mi Denis-Courmont --- target/arm/cpu.h | 5 +++++ target/arm/helper.c | 13 ++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 39abb2a36b..604b9cdd0e 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -3991,6 +3991,11 @@ static inline bool isar_feature_aa64_uao(const ARMIS= ARegisters *id) return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, UAO) !=3D 0; } =20 +static inline bool isar_feature_aa64_st(const ARMISARegisters *id) +{ + return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, ST) !=3D 0; +} + static inline bool isar_feature_aa64_bti(const ARMISARegisters *id) { return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, BT) !=3D 0; diff --git a/target/arm/helper.c b/target/arm/helper.c index b927e53ab0..c3a186db35 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -10851,7 +10851,7 @@ static bool check_s2_mmu_setup(ARMCPU *cpu, bool is= _aa64, uint32_t level, if (level =3D=3D 0 && pamax <=3D 42) { return false; } - if (level =3D=3D 3) { + if (level =3D=3D 3 && !cpu_isar_feature(aa64_st, cpu)) { return false; } break; @@ -10946,7 +10946,7 @@ ARMVAParameters aa64_va_parameters(CPUARMState *env= , uint64_t va, { uint64_t tcr =3D regime_tcr(env, mmu_idx)->raw_tcr; bool epd, hpd, using16k, using64k; - int select, tsz, tbi; + int select, tsz, tbi, max_tsz; =20 if (!regime_has_2_ranges(mmu_idx)) { select =3D 0; @@ -10981,7 +10981,14 @@ ARMVAParameters aa64_va_parameters(CPUARMState *en= v, uint64_t va, hpd =3D extract64(tcr, 42, 1); } } - tsz =3D MIN(tsz, 39); /* TODO: ARMv8.4-TTST */ + + if (cpu_isar_feature(aa64_st, env_archcpu(env))) { + max_tsz =3D 48 - using64k; + } else { + max_tsz =3D 39; + } + + tsz =3D MIN(tsz, max_tsz); tsz =3D MAX(tsz, 16); /* TODO: ARMv8.2-LVA */ =20 /* Present TBI as a composite with TBID. */ --=20 2.29.2 From nobody Tue Nov 18 07:46:12 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1608306898; cv=none; d=zohomail.com; s=zohoarc; b=OJsHy981qIeNhiWqVpWF8oXHkO/CEuVn+zMPdbhZWESQ2jKWWcCwHAJQkiDZNuX1AQv4/zEcUQbzXVzECTi1iS9M1zScxfO+PbJdPzeWj0wKsktk39G5rCF+CrBgwLKHf5lnozssetIyypLRW3QrJnhKRO7K6Px3b2KLOTc07e8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608306898; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=fl6zaWovK9QmVLc9FgNyuGc9BhVvNvUwYhDm2CqMm/Q=; b=R7614oKUEXjM/MKJK8W3b5yaXhgpq/JjsQF6XAjRrBWQQOkkH5u4Yxhm1KK6oMREkO0G1aDs5HQ4QMnA7nVm9aJHK529DXvocHv4zTLQt4CI07glmK9k+d1DNGSSQlFpY/+1sclpOh913EWDBlZLAQJiid8PWf/JclduZ0/GJSk= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608306898214138.72766194697215; Fri, 18 Dec 2020 07:54:58 -0800 (PST) Received: from localhost ([::1]:44440 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kqGsb-0004Ze-69 for importer@patchew.org; Fri, 18 Dec 2020 09:37:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41256) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kqGow-0001V8-1z; Fri, 18 Dec 2020 09:33:26 -0500 Received: from poy.remlab.net ([2001:41d0:2:5a1a::]:56810 helo=ns207790.ip-94-23-215.eu) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kqGot-0007YD-8F; Fri, 18 Dec 2020 09:33:25 -0500 Received: from basile.remlab.net (ip6-localhost [IPv6:::1]) by ns207790.ip-94-23-215.eu (Postfix) with ESMTP id 102F85FFBB; Fri, 18 Dec 2020 15:33:22 +0100 (CET) From: remi.denis.courmont@huawei.com To: qemu-arm@nongnu.org Subject: [PATCH 3/3] target/arm: enable Small Translation tables in max CPU Date: Fri, 18 Dec 2020 16:33:21 +0200 Message-Id: <20201218143321.102872-3-remi.denis.courmont@huawei.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <7884934.NyiUUSuA9g@basile.remlab.net> References: <7884934.NyiUUSuA9g@basile.remlab.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41d0:2:5a1a::; envelope-from=remi@remlab.net; helo=ns207790.ip-94-23-215.eu X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.249, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" From: R=C3=A9mi Denis-Courmont Signed-off-by: R=C3=A9mi Denis-Courmont Reviewed-by: Richard Henderson --- target/arm/cpu64.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index 3dc2f5da6c..8d3473db3e 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -670,6 +670,7 @@ static void aarch64_max_initfn(Object *obj) t =3D cpu->isar.id_aa64mmfr2; t =3D FIELD_DP64(t, ID_AA64MMFR2, UAO, 1); t =3D FIELD_DP64(t, ID_AA64MMFR2, CNP, 1); /* TTCNP */ + t =3D FIELD_DP64(t, ID_AA64MMFR2, ST, 1); /* TTST */ cpu->isar.id_aa64mmfr2 =3D t; =20 /* Replicate the same data to the 32-bit id registers. */ --=20 2.29.2