From nobody Fri Nov 7 15:40:03 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; spf=pass (zoho.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 1548457587616686.7519908088253; Fri, 25 Jan 2019 15:06:27 -0800 (PST) Received: from localhost ([127.0.0.1]:52141 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gnAYJ-0003g2-NJ for importer@patchew.org; Fri, 25 Jan 2019 18:06:23 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52539) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gn9M7-0001SV-Q0 for qemu-devel@nongnu.org; Fri, 25 Jan 2019 16:49:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gn9M6-00034j-Oq for qemu-devel@nongnu.org; Fri, 25 Jan 2019 16:49:43 -0500 Received: from poy.remlab.net ([2001:41d0:2:5a1a::]:42980 helo=ns207790.ip-94-23-215.eu) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gn9M4-0002wd-4s; Fri, 25 Jan 2019 16:49:40 -0500 Received: from basile.remlab.net (ip6-localhost [IPv6:::1]) by ns207790.ip-94-23-215.eu (Postfix) with ESMTP id 7918C5FA32; Fri, 25 Jan 2019 22:49:26 +0100 (CET) From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= To: qemu-arm@nongnu.org Date: Fri, 25 Jan 2019 23:49:24 +0200 Message-Id: <20190125214926.3204-1-remi@remlab.net> X-Mailer: git-send-email 2.20.1 In-Reply-To: <1648289.tQCHxfjYn9@basile.remlab.net> References: <1648289.tQCHxfjYn9@basile.remlab.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:41d0:2:5a1a:: X-Mailman-Approved-At: Fri, 25 Jan 2019 18:02:26 -0500 Subject: [Qemu-devel] [PATCH 1/3] target/arm: fix AArch64 virtual address space size 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-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Remi Denis-Courmont Since QEMU does not support the ARMv8.2-LVA, Large Virtual Address, extension (yet), the VA address space is signed 48-bits. User mode can only handle the positive half of the address space, so that makes a limit of 47 bits. (With LVA, it would be 52 and 51 bits respectively.) The incorrectly large address space conflicts with PAuth instructions, which bits 48-54 and 56-63 for the pointer authentication code. This also conflicts with (as yet unsupported by QEMU) data tagging and with the ARMv8.5-MTE extension. Signed-off-by: Remi Denis-Courmont --- target/arm/cpu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index ff81db420d..2ccd04b8f7 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -2503,7 +2503,7 @@ bool write_cpustate_to_list(ARMCPU *cpu); =20 #if defined(TARGET_AARCH64) # define TARGET_PHYS_ADDR_SPACE_BITS 48 -# define TARGET_VIRT_ADDR_SPACE_BITS 64 +# define TARGET_VIRT_ADDR_SPACE_BITS 47 #else # define TARGET_PHYS_ADDR_SPACE_BITS 40 # define TARGET_VIRT_ADDR_SPACE_BITS 32 --=20 2.20.1 From nobody Fri Nov 7 15:40:03 2025 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1548485662478323.8772119819164; Fri, 25 Jan 2019 22:54:22 -0800 (PST) Received: from localhost ([127.0.0.1]:55915 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gnHr1-00058K-IO for importer@patchew.org; Sat, 26 Jan 2019 01:54:11 -0500 Received: from eggs.gnu.org ([209.51.188.92]:33587) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gnHpb-0004SF-Ck for qemu-devel@nongnu.org; Sat, 26 Jan 2019 01:52:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gnHpY-0001Mw-GT for qemu-devel@nongnu.org; Sat, 26 Jan 2019 01:52:42 -0500 Received: from poy.remlab.net ([2001:41d0:2:5a1a::]:48100 helo=ns207790.ip-94-23-215.eu) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gnHp8-0000yD-JQ; Sat, 26 Jan 2019 01:52:14 -0500 Received: from basile.remlab.net (ip6-localhost [IPv6:::1]) by ns207790.ip-94-23-215.eu (Postfix) with ESMTP id C98715FA43; Sat, 26 Jan 2019 07:52:11 +0100 (CET) From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= To: qemu-arm@nongnu.org Date: Sat, 26 Jan 2019 08:52:10 +0200 Message-Id: <20190126065211.3587-1-remi@remlab.net> X-Mailer: git-send-email 2.20.1 In-Reply-To: <1648289.tQCHxfjYn9@basile.remlab.net> References: <1648289.tQCHxfjYn9@basile.remlab.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:41d0:2:5a1a:: Subject: [Qemu-devel] [PATCHv2 1/3] target/arm: fix AArch64 virtual address space size 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-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Remi Denis-Courmont Since QEMU does not support the ARMv8.2-LVA, Large Virtual Address, extension (yet), the VA address space is 48-bits plus a sign bit. User mode can only handle the positive half of the address space, so that makes a limit of 48 bits. (With LVA, it would be 53 and 52 bits respectively.) The incorrectly large address space conflicts with PAuth instructions, which bits 48-54 and 56-63 for the pointer authentication code. This also conflicts with (as yet unsupported by QEMU) data tagging and with the ARMv8.5-MTE extension. Signed-off-by: Remi Denis-Courmont Reviewed-by: Richard Henderson --- target/arm/cpu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index ff81db420d..a3781600ba 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -2503,7 +2503,7 @@ bool write_cpustate_to_list(ARMCPU *cpu); =20 #if defined(TARGET_AARCH64) # define TARGET_PHYS_ADDR_SPACE_BITS 48 -# define TARGET_VIRT_ADDR_SPACE_BITS 64 +# define TARGET_VIRT_ADDR_SPACE_BITS 48 #else # define TARGET_PHYS_ADDR_SPACE_BITS 40 # define TARGET_VIRT_ADDR_SPACE_BITS 32 --=20 2.20.1 From nobody Fri Nov 7 15:40:03 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; spf=pass (zoho.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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1548457472564787.0089655395976; Fri, 25 Jan 2019 15:04:32 -0800 (PST) Received: from localhost ([127.0.0.1]:52093 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gnAWN-00028V-Lc for importer@patchew.org; Fri, 25 Jan 2019 18:04:23 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52578) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gn9M8-0001Sj-Kp for qemu-devel@nongnu.org; Fri, 25 Jan 2019 16:49:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gn9M7-00035o-Ai for qemu-devel@nongnu.org; Fri, 25 Jan 2019 16:49:44 -0500 Received: from poy.remlab.net ([2001:41d0:2:5a1a::]:42982 helo=ns207790.ip-94-23-215.eu) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gn9M5-0002wk-BT; Fri, 25 Jan 2019 16:49:41 -0500 Received: from basile.remlab.net (ip6-localhost [IPv6:::1]) by ns207790.ip-94-23-215.eu (Postfix) with ESMTP id 126DB5FBCB; Fri, 25 Jan 2019 22:49:27 +0100 (CET) From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= To: qemu-arm@nongnu.org Date: Fri, 25 Jan 2019 23:49:25 +0200 Message-Id: <20190125214926.3204-2-remi@remlab.net> X-Mailer: git-send-email 2.20.1 In-Reply-To: <1648289.tQCHxfjYn9@basile.remlab.net> References: <1648289.tQCHxfjYn9@basile.remlab.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:41d0:2:5a1a:: X-Mailman-Approved-At: Fri, 25 Jan 2019 18:02:26 -0500 Subject: [Qemu-devel] [PATCH 2/3] target/arm: actually enable PAuth in user mode 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-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Remi Denis-Courmont This always enables IA, IB, DA and DB keys in user mode on the maximum CPU, in a manner that is consistent with the other CPUs. That is to say redefining the reset value of SCTLR_ELx registers. Without this patch, the PAC* and AUT* instructions have no effects (except PACGA of course). Signed-off-by: Remi Denis-Courmont --- target/arm/cpu64.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index e9bc461c36..148c103ca4 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -413,8 +413,8 @@ static void aarch64_max_initfn(Object *obj) (void *)&apdb_bit, &error_fatal); =20 /* Enable all PAC keys by default. */ - cpu->env.cp15.sctlr_el[1] |=3D SCTLR_EnIA | SCTLR_EnIB; - cpu->env.cp15.sctlr_el[1] |=3D SCTLR_EnDA | SCTLR_EnDB; + cpu->reset_sctlr |=3D SCTLR_EnIA | SCTLR_EnIB; + cpu->reset_sctlr |=3D SCTLR_EnDA | SCTLR_EnDB; } #endif =20 --=20 2.20.1 From nobody Fri Nov 7 15:40:03 2025 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1548485662032212.6245159254363; Fri, 25 Jan 2019 22:54:22 -0800 (PST) Received: from localhost ([127.0.0.1]:55913 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gnHr0-00057J-E7 for importer@patchew.org; Sat, 26 Jan 2019 01:54:10 -0500 Received: from eggs.gnu.org ([209.51.188.92]:33675) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gnHpd-0004SI-2R for qemu-devel@nongnu.org; Sat, 26 Jan 2019 01:52:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gnHpb-0001PD-1Y for qemu-devel@nongnu.org; Sat, 26 Jan 2019 01:52:43 -0500 Received: from poy.remlab.net ([2001:41d0:2:5a1a::]:48102 helo=ns207790.ip-94-23-215.eu) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gnHp8-0000z7-M1; Sat, 26 Jan 2019 01:52:14 -0500 Received: from basile.remlab.net (ip6-localhost [IPv6:::1]) by ns207790.ip-94-23-215.eu (Postfix) with ESMTP id 9EEBD5FE59; Sat, 26 Jan 2019 07:52:12 +0100 (CET) From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= To: qemu-arm@nongnu.org Date: Sat, 26 Jan 2019 08:52:11 +0200 Message-Id: <20190126065211.3587-2-remi@remlab.net> X-Mailer: git-send-email 2.20.1 In-Reply-To: <1648289.tQCHxfjYn9@basile.remlab.net> References: <1648289.tQCHxfjYn9@basile.remlab.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:41d0:2:5a1a:: Subject: [Qemu-devel] [PATCHv2 2/3] target/arm: actually enable PAuth in user mode 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-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Remi Denis-Courmont This always enables IA, IB, DA and DB keys in user mode on the maximum CPU, in a manner that is consistent with the other CPUs. That is to say redefining the reset value of SCTLR_ELx registers. Without this patch, the PAC* and AUT* instructions have no effects (except PACGA of course). Signed-off-by: Remi Denis-Courmont Reviewed-by: Richard Henderson --- target/arm/cpu64.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index e9bc461c36..c8ed943c65 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -287,7 +287,7 @@ static void cpu_max_get_packey(Object *obj, Visitor *v,= const char *name, { ARMCPU *cpu =3D ARM_CPU(obj); const uint64_t *bit =3D opaque; - bool enabled =3D (cpu->env.cp15.sctlr_el[1] & *bit) !=3D 0; + bool enabled =3D (cpu->reset_sctlr & *bit) !=3D 0; =20 visit_type_bool(v, name, &enabled, errp); } @@ -304,9 +304,9 @@ static void cpu_max_set_packey(Object *obj, Visitor *v,= const char *name, =20 if (!err) { if (enabled) { - cpu->env.cp15.sctlr_el[1] |=3D *bit; + cpu->reset_sctlr |=3D *bit; } else { - cpu->env.cp15.sctlr_el[1] &=3D ~*bit; + cpu->reset_sctlr &=3D ~*bit; } } error_propagate(errp, err); @@ -413,8 +413,8 @@ static void aarch64_max_initfn(Object *obj) (void *)&apdb_bit, &error_fatal); =20 /* Enable all PAC keys by default. */ - cpu->env.cp15.sctlr_el[1] |=3D SCTLR_EnIA | SCTLR_EnIB; - cpu->env.cp15.sctlr_el[1] |=3D SCTLR_EnDA | SCTLR_EnDB; + cpu->reset_sctlr |=3D SCTLR_EnIA | SCTLR_EnIB; + cpu->reset_sctlr |=3D SCTLR_EnDA | SCTLR_EnDB; } #endif =20 --=20 2.20.1 From nobody Fri Nov 7 15:40:03 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; spf=pass (zoho.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 1548457479104762.5867129377768; Fri, 25 Jan 2019 15:04:39 -0800 (PST) Received: from localhost ([127.0.0.1]:52097 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gnAWU-0002EE-GE for importer@patchew.org; Fri, 25 Jan 2019 18:04:30 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52576) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gn9M8-0001Si-Jl for qemu-devel@nongnu.org; Fri, 25 Jan 2019 16:49:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gn9M7-00035D-0Q for qemu-devel@nongnu.org; Fri, 25 Jan 2019 16:49:44 -0500 Received: from poy.remlab.net ([2001:41d0:2:5a1a::]:42984 helo=ns207790.ip-94-23-215.eu) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gn9M4-0002wn-Tc; Fri, 25 Jan 2019 16:49:41 -0500 Received: from basile.remlab.net (ip6-localhost [IPv6:::1]) by ns207790.ip-94-23-215.eu (Postfix) with ESMTP id 7BE355FCE9; Fri, 25 Jan 2019 22:49:27 +0100 (CET) From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= To: qemu-arm@nongnu.org Date: Fri, 25 Jan 2019 23:49:26 +0200 Message-Id: <20190125214926.3204-3-remi@remlab.net> X-Mailer: git-send-email 2.20.1 In-Reply-To: <1648289.tQCHxfjYn9@basile.remlab.net> References: <1648289.tQCHxfjYn9@basile.remlab.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:41d0:2:5a1a:: X-Mailman-Approved-At: Fri, 25 Jan 2019 18:02:26 -0500 Subject: [Qemu-devel] [PATCH 3/3] target/arm: fix decoding of B{,L}RA{A,B} 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-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Remi Denis-Courmont A flawed test lead to the instructions always being treated as unallocated encodings. Signed-off-by: Remi Denis-Courmont Reviewed-by: Richard Henderson --- target/arm/translate-a64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 4d28a27c3b..c550a3f013 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -2036,7 +2036,7 @@ static void disas_uncond_b_reg(DisasContext *s, uint3= 2_t insn) if (!dc_isar_feature(aa64_pauth, s)) { goto do_unallocated; } - if (op3 !=3D 2 || op3 !=3D 3) { + if ((op3 & ~1) !=3D 2) { goto do_unallocated; } if (s->pauth_active) { --=20 2.20.1