From nobody Thu May 2 12:58:46 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=os.amperecomputing.com); dmarc=pass(p=quarantine dis=none) header.from=os.amperecomputing.com ARC-Seal: i=2; a=rsa-sha256; t=1679516872; cv=pass; d=zohomail.com; s=zohoarc; b=VzXfW2p/L6UFaxvmPLTcCvo9FiW6AZBMNjWZhfK608mTlePt/eYDjF8nILpGasiahckdIurKt1lvrqy0LEpKBhYwA2rOwHwq5hXGw/lfRwToOhrzyoX6JmJvowKXiYqdKSYMs/T6TlM00Tr6vvuPkQq4XtuLcgQ9lq8SEZgdW+U= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1679516872; 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=cjMpdvpZf2EKvduNMnVcLvrq5EToUqvotgBHgsD+Aos=; b=Lq8e1LJu6oq48T8/YnCkT8lHqqvE4jIAt5eszJ3FCtV512BnZV7GbuisY64Qb2QTADy48ynVybrkxoKjXc34ao5/5GjhI47zTpNzKRJh56MQ0ktmVYWt0t5RF5TRxCJwZNk8QdexZt/jPt+BfA+97hO6Y7dbAwR7LWGlTGiRoJA= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=os.amperecomputing.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1679516872779824.2487961301171; Wed, 22 Mar 2023 13:27:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pf52L-0001cv-7t; Wed, 22 Mar 2023 16:26:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pf52I-0001bI-LT; Wed, 22 Mar 2023 16:26:18 -0400 Received: from mail-dm6nam10on20714.outbound.protection.outlook.com ([2a01:111:f400:7e88::714] helo=NAM10-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pf52G-0004y6-LI; Wed, 22 Mar 2023 16:26:17 -0400 Received: from CH0PR01MB7124.prod.exchangelabs.com (2603:10b6:610:f3::20) by SN6PR0102MB3406.prod.exchangelabs.com (2603:10b6:805:7::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.26; Wed, 22 Mar 2023 20:26:11 +0000 Received: from CH0PR01MB7124.prod.exchangelabs.com ([fe80::cf62:d511:8228:b39c]) by CH0PR01MB7124.prod.exchangelabs.com ([fe80::cf62:d511:8228:b39c%8]) with mapi id 15.20.6222.010; Wed, 22 Mar 2023 20:26:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W13wJokKe5kKubJc1QCatZzEeprlJQpZ1pqGyRROsZmRGD2LNRluty9QdF7uSfcAbNTncCcJKBBL8Hov6nKoCXDUaPrVbxxiQZNM3Q98A4T+J2d2txKR01bfHFMzb+MoJKXeBwbs2I++4Xnm+uCoPhKCDf51oba8/7hLtheyuf5GR9vQnVgFDJW/YuHsPEzUo4nSco3enrmCl0UyLzX/Xb/9iVzkYI2nTBBJb0E4hGwB0oiFTLyKPNsc2PrvzyVf5pxHx64pdGFSmRJw/Sw5mqJAHM1pozXCNVAfpVKVM0LSs5bWSI5UNzq+nXlFgTwIwEgPYbmxwfGAeYLLDWJ1ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=cjMpdvpZf2EKvduNMnVcLvrq5EToUqvotgBHgsD+Aos=; b=OEYTRINjAul62AiQkeKWob5gl/FUxoZxxHteNnAisHbrHp2XjhYIqna9/Tk89v/nOAhUq1znjUYk9OpZTQynyAeve05rRoEsstIXd0M19Siuyp6j9cIcy7a90k25rQ+WLNXSei94G+JzR4aiM0c8j6Hpx6mhVdinb7hZuGOyhbIyB5icaJ/8pJDmWKO3LpdYqTU6EXMEBoZBW0oHqSBoXLrTHDjXf/cIOSExyz25iiCkbjsC6RA0tgNGf/XrK9gibNr1nh1HFMqCjgnDmWUBLnm3ORty/LlosMJzz19gXGWfb0f64ecS9nG80DPILlHtgCX0YYj9F8OKM9OuTisA5g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cjMpdvpZf2EKvduNMnVcLvrq5EToUqvotgBHgsD+Aos=; b=ur0o0IWDVgjnwnGR0gJX62KMmBFafl4bRaThMptJ/1XFmt5wUV564tHrKmAwzjU+PEo3OxfO7JG/Ox4MtQ//1G9yNxegJk0Vkfa7VXlZhVaLVGjzOrnIaNQ2b4NPjJFFIImsv6lQdYX5th5Udl9g4PsvmIW1QriWXRdLT4tNInI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; From: Aaron Lindsay To: qemu-devel@nongnu.org, qemu-arm@nongnu.org, Richard Henderson , Vincent Dehors , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Peter Maydell Cc: Aaron Lindsay Subject: [PATCH v3 1/8] target/arm: Add ID_AA64ISAR2_EL1 Date: Wed, 22 Mar 2023 16:25:34 -0400 Message-Id: <20230322202541.1404058-2-aaron@os.amperecomputing.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230322202541.1404058-1-aaron@os.amperecomputing.com> References: <20230322202541.1404058-1-aaron@os.amperecomputing.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: CH2PR03CA0008.namprd03.prod.outlook.com (2603:10b6:610:59::18) To CH0PR01MB7124.prod.exchangelabs.com (2603:10b6:610:f3::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR01MB7124:EE_|SN6PR0102MB3406:EE_ X-MS-Office365-Filtering-Correlation-Id: aac51025-5554-4202-5035-08db2b13ad4e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5v9nlYvbg7qFXKAIb96U4ibMk/zRTerxf3DyxljpXrtZgsvzrvB8wVCNqXt82a81lMGwcFFugDunbLTlANY4VUNGko798nwBp/Cyo0LSJPAziPUC81wVbDi9zwP63nh3P/5IrlYopWYKxwcqwaSgRDtPwOFiElygszdJf5FlNQxav3JHplHXDqL8Hv4N3d8GNB0p1Gd91A+oY/eFjSp/70Yz2QrjJtTSBdG4e/qUd0im82EQsXC4jnVEtyr03PXYhNVmf0xI0UxtqzrNZielYhoM4ozu3geup60HJBzhmpC+IYd7sU4FrtzQvtpwtgloAZFxWqi3u2Ct1t3BUBlFEDWWNxPwIoLyNohf03ZQiI9GRgG1DyxGt0qmjCDNx9eo/6Rvw8UY4DLlcUsETXZj+Q01ipiG54O1G9tvy8NomE4QSlmuYU0Nm/kuCWhbpQh5qYwApnk5ylBG0J2nzsUVFoGZ8USu6IzOAWuOKNTLLjZhhijzCggAB2hOxn7Ers7AZgsIKMKIU/OMxvU5S9jxI3wTVtSPptWK2n0ynLpqHk20C9buHm2qzSPY0aaI4sUrhzXPFRPI0ZqUhp/ZoD+5k91MkJMA4oUSCLoOfsEeqDlWwQzCqAiEFVX5hwYN4o+moivRBHkdqgBSjnMjSqeKA1ds/D3hgkPNCW8K0L6XW1fT4MAu+o736vMD/REO3I93C70WtScUP0C1ChJRcjkeUA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH0PR01MB7124.prod.exchangelabs.com; PTR:; CAT:NONE; SFS:(13230025)(4636009)(376002)(366004)(39850400004)(346002)(136003)(396003)(451199018)(66476007)(316002)(1076003)(6486002)(186003)(4326008)(41300700001)(5660300002)(83380400001)(8676002)(66556008)(8936002)(2616005)(6666004)(6512007)(86362001)(110136005)(52116002)(26005)(107886003)(478600001)(66946007)(6506007)(2906002)(38100700002)(38350700002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?Wg/vlHplJRld7fr/y2AuAwPhXHjuEnPzRuL15YDtK1mz4UIM3hPtHfk/R+LU?= =?us-ascii?Q?g9MEC3qIL4eYr82/ioOd1aLZcfcXwH1u5koMdqDji1xN3kJajcu83RtW6AvU?= =?us-ascii?Q?/Oyve9Xt+19nuCJTZLAcH3SeCaKgyq3wUNNyuEODP8kNzqq0tMhYXcDbiiXL?= =?us-ascii?Q?c9cokMofA90IfnZkZko8pLKjusTkvEn2tJGVcIFfUaUp/YDZMOH5eunSjsqM?= =?us-ascii?Q?Fz+XM/ejtgZflGEfhcgmyoo05q8iv543ANQn0a+0/vY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mH3YHdoq1RSFuCaCyAmh77DGK21c5oDJOFaX9iu1xUwpH?= =?us-ascii?Q?8FYsQmGAss83jjWzE8/jJN2zE8WsY5rljq9UB9w+CEaxM7O/eimzbw5CoErk?= =?us-ascii?Q?YkWJu+3okghI38c+ehKCsy9xwy4ywpj46PBxxiMa5CwWh0E66PhoMmLn2drB?= =?us-ascii?Q?gaZFSXywMBIPYVPc46hFGkg0gH0ceWy6aH3PEtumF7lvCtthgneNiFR0KNkd?= =?us-ascii?Q?0AgU5/QYI0CYUQ6gFJ1kk7l/AKKhe2ryQNtY5Lb4ZDdmn9X4nmZ+VOo6kyg7?= =?us-ascii?Q?UcvbVCoPhHJsmMuUpm1QxEWjG2dtkIBNknId09912GiBrGooiBMpHAVEOhQ7?= =?us-ascii?Q?ZHJ1c2NWtdy1wBmwlUqkeJ9OjshoySAeDrknClV6zTNdSKqV/214SFfvXSmW?= =?us-ascii?Q?9lqAxoFeUeuvuma1N9z+8POzK8dA712LAorFkS+uaSgZFoOPF7Ym1z7IvvRL?= =?us-ascii?Q?eUlsxw1uDZexeADDpOwbG9o=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: aac51025-5554-4202-5035-08db2b13ad4e X-MS-Exchange-CrossTenant-AuthSource: CH0PR01MB7124.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Mar 2023 20:26:11.6464 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: iN6KjH4weaQnssMrJwl0mXujdkfCS15YUMPfhSRnzLsl9jOCebgYlrqm0zFPOttGjOI3oe9kupsAp41Fyv3+0Eo55K5XQdJ9ykIIuZzG6YbTdWkQyB15I0fglq4PBQZk X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR0102MB3406 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a01:111:f400:7e88::714; envelope-from=aaron@os.amperecomputing.com; helo=NAM10-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham 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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @os.amperecomputing.com) X-ZM-MESSAGEID: 1679516874670100005 Content-Type: text/plain; charset="utf-8" Signed-off-by: Aaron Lindsay Reviewed-by: Richard Henderson --- target/arm/cpu.h | 1 + target/arm/helper.c | 4 ++-- target/arm/hvf/hvf.c | 1 + target/arm/kvm64.c | 2 ++ 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index c097cae988..f0f27f259d 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -1015,6 +1015,7 @@ struct ArchCPU { uint32_t dbgdevid1; uint64_t id_aa64isar0; uint64_t id_aa64isar1; + uint64_t id_aa64isar2; uint64_t id_aa64pfr0; uint64_t id_aa64pfr1; uint64_t id_aa64mmfr0; diff --git a/target/arm/helper.c b/target/arm/helper.c index 2297626bfb..32426495c0 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -8204,11 +8204,11 @@ void register_cp_regs_for_features(ARMCPU *cpu) .access =3D PL1_R, .type =3D ARM_CP_CONST, .accessfn =3D access_aa64_tid3, .resetvalue =3D cpu->isar.id_aa64isar1 }, - { .name =3D "ID_AA64ISAR2_EL1_RESERVED", .state =3D ARM_CP_STA= TE_AA64, + { .name =3D "ID_AA64ISAR2_EL1", .state =3D ARM_CP_STATE_AA64, .opc0 =3D 3, .opc1 =3D 0, .crn =3D 0, .crm =3D 6, .opc2 =3D = 2, .access =3D PL1_R, .type =3D ARM_CP_CONST, .accessfn =3D access_aa64_tid3, - .resetvalue =3D 0 }, + .resetvalue =3D cpu->isar.id_aa64isar2 }, { .name =3D "ID_AA64ISAR3_EL1_RESERVED", .state =3D ARM_CP_STA= TE_AA64, .opc0 =3D 3, .opc1 =3D 0, .crn =3D 0, .crm =3D 6, .opc2 =3D = 3, .access =3D PL1_R, .type =3D ARM_CP_CONST, diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index ad65603445..4d7366b761 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -507,6 +507,7 @@ static bool hvf_arm_get_host_cpu_features(ARMHostCPUFea= tures *ahcf) { HV_SYS_REG_ID_AA64DFR1_EL1, &host_isar.id_aa64dfr1 }, { HV_SYS_REG_ID_AA64ISAR0_EL1, &host_isar.id_aa64isar0 }, { HV_SYS_REG_ID_AA64ISAR1_EL1, &host_isar.id_aa64isar1 }, + { HV_SYS_REG_ID_AA64ISAR2_EL1, &host_isar.id_aa64isar2 }, { HV_SYS_REG_ID_AA64MMFR0_EL1, &host_isar.id_aa64mmfr0 }, { HV_SYS_REG_ID_AA64MMFR1_EL1, &host_isar.id_aa64mmfr1 }, { HV_SYS_REG_ID_AA64MMFR2_EL1, &host_isar.id_aa64mmfr2 }, diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c index 1197253d12..4b71306f92 100644 --- a/target/arm/kvm64.c +++ b/target/arm/kvm64.c @@ -590,6 +590,8 @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *= ahcf) ARM64_SYS_REG(3, 0, 0, 6, 0)); err |=3D read_sys_reg64(fdarray[2], &ahcf->isar.id_aa64isar1, ARM64_SYS_REG(3, 0, 0, 6, 1)); + err |=3D read_sys_reg64(fdarray[2], &ahcf->isar.id_aa64isar2, + ARM64_SYS_REG(3, 0, 0, 6, 2)); err |=3D read_sys_reg64(fdarray[2], &ahcf->isar.id_aa64mmfr0, ARM64_SYS_REG(3, 0, 0, 7, 0)); err |=3D read_sys_reg64(fdarray[2], &ahcf->isar.id_aa64mmfr1, --=20 2.25.1 From nobody Thu May 2 12:58:46 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=os.amperecomputing.com); dmarc=pass(p=quarantine dis=none) header.from=os.amperecomputing.com ARC-Seal: i=2; a=rsa-sha256; t=1679516846; cv=pass; d=zohomail.com; s=zohoarc; b=UKxV+oqqhewQd+7nRAKTlTG2ZUHVEuYITzO0SKBkCblhlIpcs45G0nzpRxor9ablizHeelzF5oiBIoH5eMLl6tqYtHUAjrOlQCSRpb6QbpVME5m0da67GBALYYYqhXo8f/Ibo9sqSkQUVThhaFF5LrefGvMDerrnPyZDOwtx+5Q= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1679516846; 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=TdfL3qq8rA/s4So09okVjkRZBCdHigcO1J1Q9wwuI28=; b=L5myJ6c0YBagPkHdxYZlFbKYfGAVgX2Mnj3PBA3Qq+Tv/QZFDjSWcYF+p0rXZUyTfmRyzC8b+nig8CQLdJbDbmfewPGm0XJNY1m3WWst1GUe0EP11+qYAzWyi49R/sDWzJJ9FjMGQGvwQxffmejRnGPKBhoZt/8erNsIvLaPdTk= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=os.amperecomputing.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1679516846321884.4457197125499; Wed, 22 Mar 2023 13:27:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pf52J-0001bY-0h; Wed, 22 Mar 2023 16:26:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pf52H-0001b4-9m; Wed, 22 Mar 2023 16:26:17 -0400 Received: from mail-bn7nam10on20707.outbound.protection.outlook.com ([2a01:111:f400:7e8a::707] helo=NAM10-BN7-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pf52F-0004xk-KS; Wed, 22 Mar 2023 16:26:17 -0400 Received: from CH0PR01MB7124.prod.exchangelabs.com (2603:10b6:610:f3::20) by SA1PR01MB7342.prod.exchangelabs.com (2603:10b6:806:1f5::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.8; Wed, 22 Mar 2023 20:26:13 +0000 Received: from CH0PR01MB7124.prod.exchangelabs.com ([fe80::cf62:d511:8228:b39c]) by CH0PR01MB7124.prod.exchangelabs.com ([fe80::cf62:d511:8228:b39c%8]) with mapi id 15.20.6222.010; Wed, 22 Mar 2023 20:26:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fiywDrckkYI4lKDky6gNvr4gQAgd97GeOryrdeRignDJbTbIVoBQwbfeh5Q+Z0D9KxYGM3UWgEWaB+Eg3eFkTJcMdArYneuIB0A8rhdFOtgcZxOqlrfsmhwYIzChf1sVivtNxZBLOtEPke/OdpxxoQf/Swq4YQWPDJmF0y/866zNtoWd/ECNBFvM8X525V6RM6354ujZP3XJw9EcjSmLby4Cq2wPvOT+BAc9movxq0wzrBBwP+jNWG2CI/sFa953zDiadtaIVk8RoArnAP0AmR7dYsqtv1K4yJIcvm/jl4rT+72OSQs9pTev2027EAYmTgp6u7R4cceVd0Pl9XdiLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=TdfL3qq8rA/s4So09okVjkRZBCdHigcO1J1Q9wwuI28=; b=QoCCdegDp9zdLfxAWMDlBYBiZu5xNtEoEENTiOgWBYrGid+1MX12wdRp5cLD2Ma4N0pns8mdKP8GOQUq/knogH+RSzJ8ztVcgmZnVDNOxpU3lmW8TalZTD8edPPRV5IsPWlnNJFTJ7RKuj+5T3I/Bie9XjfUGvYzRHhv8hCAwrEr1izbd7zqurWswSywLQ/W7UsNCxJ0iR2Uj+WeD3wU9wCM9bm50fHUOeWC3wy8ajsWm8x/b34QILCBCIgJQjraT06puDC1k9oK3QTa1lDDalJshyhb9dRu8z4rE5q54RBLi6Sizmc1xkc300RGakrLcztRembFNm+Y2GiULXPrSQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TdfL3qq8rA/s4So09okVjkRZBCdHigcO1J1Q9wwuI28=; b=NDosxppWiGFA2Nti3hZbY7f8yOtuOB3Ap0DF+R8xZbAMuHrKISMSwEqSVx+LHJFfWYMsZwOF3oxXT3ffQ2ybMCm6rGWzt7BYHozgZjxq9RLHwSvlKYXji3mTKzlFzXG8QapqsZltcNz4tWNgWqBd0AMoJO6Vm1u++73k9IfwVRo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; From: Aaron Lindsay To: qemu-devel@nongnu.org, qemu-arm@nongnu.org, Richard Henderson , Vincent Dehors , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Peter Maydell Cc: Aaron Lindsay Subject: [PATCH v3 2/8] target/arm: v8.3 PAC ID_AA64ISAR[12] feature-detection Date: Wed, 22 Mar 2023 16:25:35 -0400 Message-Id: <20230322202541.1404058-3-aaron@os.amperecomputing.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230322202541.1404058-1-aaron@os.amperecomputing.com> References: <20230322202541.1404058-1-aaron@os.amperecomputing.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: CH2PR03CA0008.namprd03.prod.outlook.com (2603:10b6:610:59::18) To CH0PR01MB7124.prod.exchangelabs.com (2603:10b6:610:f3::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR01MB7124:EE_|SA1PR01MB7342:EE_ X-MS-Office365-Filtering-Correlation-Id: dd28482a-b316-43f4-c151-08db2b13ae35 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VipGi5kCUVRiTk6lzQZ+SWDZUwxuwcZ62M1trJ/tt4894h/yaSiUDAlWFIotRpas375fwzGKuzQu8QoZDkemlQ6CasSEEUw/aclqOtnJjCF8VqjWedpb3q43+pep23eCcNHTlG8S41didRpt+W7AREuxmMtjMS4Ga6jYLIJWj0KnV74HIY/Di0cthIo8qSvwWPzIqaZwgfgpvo02LQsKgJnnd5HpewTelcBH3Nvq0YezvjxFHmsWdAX2kZlyYy4mYGlYRM9ov1TWZfdbySuYbH3/i/G/pAEnsxUs0jrbvyzHahWHFZyq3M0zcFx8yMiPEE+eyNES/QQCQXZnwGlIlf0eobhB8OBf2aT8i0xOenvPfroV2FaGxBF7LhrAkvtcoX/yOne6AEMp3RaPNghzXbTpPdbmy1ayzbzeMMCp2tgarrsrNS3X6YD+rWznDJL8porauP4kc9GocsOpyi8AQXMiS/m1djgCy77EhvksRD6Sm29ne1lThReREZowtFnGZdrTD7dpPUDNYS8DTSrXVNOD43vwHYC4VtrN6EquaP4l1PrKvfbZtyOjOOjPpEihZrp9UDBAwx40bozOvTApQdsGVzbcqRJtHIJLyIH1FexByPFs/+qQRQiHxwUko5s+eLfv9AorBb4MVEVZb68p+a1SgzjNZsJ2BPjDQXSofksW3DLRI6huItbci05re4hDTd3kmSjolCDZJIg3ORTDMA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH0PR01MB7124.prod.exchangelabs.com; PTR:; CAT:NONE; SFS:(13230025)(4636009)(346002)(136003)(366004)(396003)(376002)(39850400004)(451199018)(83380400001)(38350700002)(6486002)(186003)(6506007)(86362001)(26005)(6512007)(2616005)(1076003)(38100700002)(6666004)(107886003)(5660300002)(4326008)(52116002)(66476007)(41300700001)(110136005)(66946007)(478600001)(8936002)(2906002)(8676002)(316002)(66556008); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?QQkrMfcHSAwKc579X5umsm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ux?= =?us-ascii?Q?CIUGfNQoxvEKYGG08dD45Zu6OYRz+YLffQ1s9D1R5hsz4Gk16SAI/X4DVKxS?= =?us-ascii?Q?rbxtWCNLdzop2XlvPa3puzJQOguQmhAiUBsG/Zu4Xp6QIuuHQBT4diW+eIdg?= =?us-ascii?Q?2LysaH/hD3hwnmfowrJHioJ/iCXcnlxj+QWDai6fnfXXDzef8KTpS5NNpYrC?= =?us-ascii?Q?1bGif7QmT+Hfp/fNVayc1WaaKAn5HxNqkAgD7aQMuzxQ4ZdzWsCkZpUIrvO0?= =?us-ascii?Q?PdRoL7gdzbUPrnSlPSzWtgmqfhlyFkN8CU5ni+zUaMwzN5qPH4N0V6KAwpOM?= =?us-ascii?Q?QTbdhdWT+L6U8DPR5g97Z7tNILEa9i1ybvBhpDRn1mivu95tjrYL1NuXkoPM?= =?us-ascii?Q?pTPQq9FtuDDdRoX6H/bA2YXqJ574v31d0y7K3+DiC36qvqnmfvcHvw7GbPGg?= =?us-ascii?Q?4o6FxZD2ydVCoPdvK5QU4uUfppu2koluScW7jMLpULK8VQJJhme8dcog9yem?= =?us-ascii?Q?8TTFliSWt3YZKkLnh56/wVX/mbkau8mlyN1mQBwS35Au+BS79ilAQTIhLmq/?= =?us-ascii?Q?GKj3t9Y+gC4Oabvqu7Lp42UWZOLABbrloQbJOeWm7i7XKapHobVRRFL1LPJw?= =?us-ascii?Q?5HOWP4v18T8BjVfT0eCQvLL0pEUk8WTWLpVYXoX9mMqcdQ1OGxb5HVA+n/9D?= =?us-ascii?Q?tsolxjhfR7L+jtjuYIuPfCxKTe+xUI0kx5ofCOSsNd8f7xayCHBs//0tvaLd?= =?us-ascii?Q?mSzvvyJ7GuxA4aBO6/Ky8mQ=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: dd28482a-b316-43f4-c151-08db2b13ae35 X-MS-Exchange-CrossTenant-AuthSource: CH0PR01MB7124.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Mar 2023 20:26:13.2158 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: /sYJBnXXs6oCNs7DzmaTNQoy6UIz5NpC0Y20379iZu71zWWhdyS+88IRynscB8f5NdyzO4oB6pkN6KIndc5OUCOJ2jU1OfNNvzQ6i1hnhrkvHE5U2ygvJKjBuNoyW4t8 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR01MB7342 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a01:111:f400:7e8a::707; envelope-from=aaron@os.amperecomputing.com; helo=NAM10-BN7-obe.outbound.protection.outlook.com X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham 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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @os.amperecomputing.com) X-ZM-MESSAGEID: 1679516847003100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Aaron Lindsay Reviewed-by: Richard Henderson --- target/arm/cpu.h | 65 +++++++++++++++++++++++++++++++++-- target/arm/tcg/pauth_helper.c | 2 +- 2 files changed, 63 insertions(+), 4 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index f0f27f259d..868d844d5a 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -3705,18 +3705,77 @@ static inline bool isar_feature_aa64_pauth(const AR= MISARegisters *id) (FIELD_DP64(0, ID_AA64ISAR1, APA, 0xf) | FIELD_DP64(0, ID_AA64ISAR1, API, 0xf) | FIELD_DP64(0, ID_AA64ISAR1, GPA, 0xf) | - FIELD_DP64(0, ID_AA64ISAR1, GPI, 0xf))) !=3D 0; + FIELD_DP64(0, ID_AA64ISAR1, GPI, 0xf))) !=3D 0 || + (id->id_aa64isar2 & + (FIELD_DP64(0, ID_AA64ISAR2, APA3, 0xf) | + FIELD_DP64(0, ID_AA64ISAR2, GPA3, 0xf))) !=3D 0; } =20 -static inline bool isar_feature_aa64_pauth_arch(const ARMISARegisters *id) +static inline bool isar_feature_aa64_pauth_arch_qarma5(const ARMISARegiste= rs *id) { /* - * Return true if pauth is enabled with the architected QARMA algorith= m. + * Return true if pauth is enabled with the architected QARMA5 algorit= hm. * QEMU will always set APA+GPA to the same value. */ return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, APA) !=3D 0; } =20 +static inline bool isar_feature_aa64_pauth_arch_qarma3(const ARMISARegiste= rs *id) +{ + /* + * Return true if pauth is enabled with the architected QARMA3 algorit= hm. + * QEMU will always set APA3+GPA3 to the same result. + */ + return FIELD_EX64(id->id_aa64isar2, ID_AA64ISAR2, APA3) !=3D 0; +} + +static inline bool isar_feature_aa64_pauth_arch(const ARMISARegisters *id) +{ + return isar_feature_aa64_pauth_arch_qarma5(id) || + isar_feature_aa64_pauth_arch_qarma3(id); +} + +static inline int isar_feature_pauth_get_features(const ARMISARegisters *i= d) +{ + if (isar_feature_aa64_pauth_arch_qarma5(id)) { + return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, APA); + } else if (isar_feature_aa64_pauth_arch_qarma3(id)) { + return FIELD_EX64(id->id_aa64isar2, ID_AA64ISAR2, APA3); + } else { + return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, API); + } +} + +static inline bool isar_feature_aa64_pauth_epac(const ARMISARegisters *id) +{ + /* + * Note that unlike most AArch64 features, EPAC is treated (in the ARM + * psedocode, at least) as not being implemented by larger values of t= his + * field. Our usage of '>=3D' rather than '=3D=3D' here causes our imp= lementation + * of PAC logic to diverge from ARM pseudocode - we must check that + * isar_feature_aa64_pauth2() returns false AND + * isar_feature_aa64_pauth_epac() returns true, where the pseudocode r= eads + * as if EPAC is not implemented if the value of this register is > 0b= 10. + * See the implementation of pauth_addpac() for an example. + */ + return isar_feature_pauth_get_features(id) >=3D 0b0010; +} + +static inline bool isar_feature_aa64_pauth2(const ARMISARegisters *id) +{ + return isar_feature_pauth_get_features(id) >=3D 0b0011; +} + +static inline bool isar_feature_aa64_fpac(const ARMISARegisters *id) +{ + return isar_feature_pauth_get_features(id) >=3D 0b0100; +} + +static inline bool isar_feature_aa64_fpac_combine(const ARMISARegisters *i= d) +{ + return isar_feature_pauth_get_features(id) >=3D 0b0101; +} + static inline bool isar_feature_aa64_tlbirange(const ARMISARegisters *id) { return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, TLB) =3D=3D 2; diff --git a/target/arm/tcg/pauth_helper.c b/target/arm/tcg/pauth_helper.c index 20f347332d..6bb3b5b9e5 100644 --- a/target/arm/tcg/pauth_helper.c +++ b/target/arm/tcg/pauth_helper.c @@ -282,7 +282,7 @@ static uint64_t pauth_computepac_impdef(uint64_t data, = uint64_t modifier, static uint64_t pauth_computepac(CPUARMState *env, uint64_t data, uint64_t modifier, ARMPACKey key) { - if (cpu_isar_feature(aa64_pauth_arch, env_archcpu(env))) { + if (cpu_isar_feature(aa64_pauth_arch_qarma5, env_archcpu(env))) { return pauth_computepac_architected(data, modifier, key); } else { return pauth_computepac_impdef(data, modifier, key); --=20 2.25.1 From nobody Thu May 2 12:58:46 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=os.amperecomputing.com); dmarc=pass(p=quarantine dis=none) header.from=os.amperecomputing.com ARC-Seal: i=2; a=rsa-sha256; t=1679516846; cv=pass; d=zohomail.com; s=zohoarc; b=oFURM0PG2ATKHwCkxwLX1ZzsuO5XQ1GCi+8RWJe98LeInMbyuwnm/8IATYqDUMWdnEyJzeUgxnC6VeJAHQYzAPSlHYiyrU3NtbIq4NwrippA6YIFur2sYXr37j8a47vYhqAN2HJZx3OJ/BT2CxG4/N8kcsVceuQxCN+3ffBOuZo= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1679516846; 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=/KpQDBbV4ZoaZNGpwMYw5mYnydjnhod82UGpd8bY4XU=; b=Q1h7t7xB2RgiiiOd+G3aNm4zbGZKgNUMDwNXWec5wLwyPgLAM+sYlSm82hiq/rGth6QkWxZGkZMqTIJawEvqwkbTrY+DXz0ZRVe7ZNhZutkMd6b5J2oh1aRn89iKlgYBjJDqQpjHzsBUhoRQkXrXGvxQ8qqb2YM3G1ki6Lrfi50= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=os.amperecomputing.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1679516846322801.9962871807904; Wed, 22 Mar 2023 13:27:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pf52K-0001cU-Ue; Wed, 22 Mar 2023 16:26:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pf52J-0001c6-CS; Wed, 22 Mar 2023 16:26:19 -0400 Received: from mail-bn7nam10on20707.outbound.protection.outlook.com ([2a01:111:f400:7e8a::707] helo=NAM10-BN7-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pf52H-0004xk-Or; Wed, 22 Mar 2023 16:26:19 -0400 Received: from CH0PR01MB7124.prod.exchangelabs.com (2603:10b6:610:f3::20) by SA1PR01MB7342.prod.exchangelabs.com (2603:10b6:806:1f5::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.8; Wed, 22 Mar 2023 20:26:14 +0000 Received: from CH0PR01MB7124.prod.exchangelabs.com ([fe80::cf62:d511:8228:b39c]) by CH0PR01MB7124.prod.exchangelabs.com ([fe80::cf62:d511:8228:b39c%8]) with mapi id 15.20.6222.010; Wed, 22 Mar 2023 20:26:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QAoO976hiQnI9lRhlm9rYdbD9PE5n/LiJuPfmfHSiccwS1x29jRksfK3900w5JHAM97oBk4dgi5TpcKkc21ImEeP2f+ne8mcdVmEdFFGWdxNrwaa3VsTe5HuMgybBxVg/T40ba/iFD1cGj0jPUdSKhiC0ZCpq/9hYw3rpRevFOwHNIA5NVoOHrvmIIpf5T5CheQrWxqXZ9N3lx5Uz31lGKrZ9Fdv6WTE/0SZg/kl5MwyQRtw6f0Ij82WzCj761ncLtrhAfe1aCApgKGJg5kQHEaJj9u0vcAVN24xYlKgvELBq4NZI7L13SJ6fKBeuN+zrh4Q+kDQC5wsBhfAr3rwbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/KpQDBbV4ZoaZNGpwMYw5mYnydjnhod82UGpd8bY4XU=; b=iYaYkainbuJuce+iBE8GdY0o9hoMXQkEvylJrcazb8Bmrt6ul4xN9L7qQDv9i/R9IJ9KKQCtTXWy9nMBEYOF5Y1K1w/JVs/Rh3iK/Ji/FtpeqPZKm3sdqDCGkYguIlPO4FAX8RPHI3qFQPqef6b8xiOQulHsXhUOwraKkE+X4k/WBMRfrl9AXM67dQh49h6Rq3QvTSdToyvCZ6dTzc26dA0IjNUoEuaMC37sDjBfhRZgEAuxD8ZonQBCK5YN++tMbVUACjd4tCdasegxk1TSi4BB6GHyqPeXfp8VspYf1+hUQRxxeRrcsgMeQGi4e8VgjpXkGMBzZExK+L1M+4HFCA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/KpQDBbV4ZoaZNGpwMYw5mYnydjnhod82UGpd8bY4XU=; b=cyw7LkHUMhd+qh6NJQjGSheEXJ96Qh0hKvnkytYrxL/Vv9pblqivDXcmIICBSLwwFPqxjgKiohLz6/G0nQNBbdv3cdmwtYP3xmH+EG53UD/uMU9wE5zwiRU6UqiNRcqQGSzUONHXXCSNSu19N/dCWncNdATmYVny8whG782fKBg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; From: Aaron Lindsay To: qemu-devel@nongnu.org, qemu-arm@nongnu.org, Richard Henderson , Vincent Dehors , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Peter Maydell Cc: Aaron Lindsay Subject: [PATCH v3 3/8] target/arm: Implement v8.3 QARMA3 PAC cipher Date: Wed, 22 Mar 2023 16:25:36 -0400 Message-Id: <20230322202541.1404058-4-aaron@os.amperecomputing.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230322202541.1404058-1-aaron@os.amperecomputing.com> References: <20230322202541.1404058-1-aaron@os.amperecomputing.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: CH2PR03CA0008.namprd03.prod.outlook.com (2603:10b6:610:59::18) To CH0PR01MB7124.prod.exchangelabs.com (2603:10b6:610:f3::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR01MB7124:EE_|SA1PR01MB7342:EE_ X-MS-Office365-Filtering-Correlation-Id: 6eff3615-ecc9-4f33-4dd6-08db2b13aeed X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EXjbuQRu06oXUCgeUHyxj2O+QQtmstBj8KzBVGVvUAnkWqWw9XMxOLhL3HkI3tFbQ5+Me9jtlW22w6gshG/b/93r7I0sFrxoSiEBQITLVfYz7xqUP2stt7cdBiU+gqrzkh9TiOoLgOUtbSARYIONiPEVirxdm5SMwn2AzrdhFVgWHm1iAcmZVcrJCRJ0Py5HDcsmMIgLdyhFM18qm5w1cIgaWInbNCpF1cnQwTJw7axvCqI7lCVF1NOp0zXTUQxQ9TIpIYb6dv0FySUO0WsWbRTXiI96pshkmU0X8BgWpHwMA/ri7AssmxT4J2nOkNSBn2RWylMYnc6tqWrVMNcGqSVlaBxOq6rBMyfv7PYR6wrsHJakPqWIhTqj+Fg36JR1T+pvh98q0OWudmU9srYVNbwP/BFQCOFxmUnxPNxgGoNTCA/4m0nJaJhS8ohBwbNumy0uiGz6/YUBCU73csRZTj5Iq0f0dyPpVKWiC+fEWz0P4jhIstPE60c6eO10lEIsahsVzSMDjmabPKDF9ySSfvxsF6pFExHy/Z8IV9c8VKOjgZO6oxklh23YJpIPJgcdwv4nkwtOL/JRCsuIm2RQniXRLA+HphXiMEPh2bnoB5JNxo06coRwfIT38p6yL1JCNk8yMMGrqZtnVWBg0F27uF+rA+zFJKjchGSjvnD9+1gVaUvcKU+iIaNcV8mrekha5wVmZMrPCd9fsvMBd0BQFw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH0PR01MB7124.prod.exchangelabs.com; PTR:; CAT:NONE; SFS:(13230025)(4636009)(346002)(136003)(366004)(396003)(376002)(39850400004)(451199018)(83380400001)(38350700002)(6486002)(186003)(6506007)(86362001)(26005)(6512007)(2616005)(1076003)(38100700002)(6666004)(107886003)(5660300002)(4326008)(52116002)(66476007)(41300700001)(110136005)(66946007)(478600001)(8936002)(2906002)(8676002)(316002)(66556008); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?SxYa/DCdzT8XkQhWBEKRdbItpbiPL7VTROY0vTWATLJ+LJCNGSOfvk6SO+2Y?= =?us-ascii?Q?g1zETb/17juzhi5VuiiCAgLktgj6B7Il85c80hUG0TtRfdDBt+ZtLLYLIln4?= =?us-ascii?Q?jSc510jv9p5iRjs0+Efrq/mg5OdcqK7HtdoB8r7uurABB4+wwGbhdO9yp7fn?= =?us-ascii?Q?i7dl/tyUpyNkOt7+qgcMENBPICJcCTvwFF2gZ3clQhhHIl2/bDAWjmTmKGjI?= =?us-ascii?Q?e57/ItaZUYbovnEg6caeDZ7rJgETVv+A1eafABB86qW5Rz3I5sRJs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3yxV9mAXHpcqrQlXU85GHaWmOClsWnOCHQFmHExps1RWPQZ?= =?us-ascii?Q?WcphfahqI/rgEnhtQ7Y7eONihcwK53CQiwvQXAv5V1awyG21YBrDiq/Pu/8g?= =?us-ascii?Q?OT8X/3a5bHIsiaV9/qBndwvYEh1KM/ERq8gQmUSijKEIOSZgDfW6mz+jn158?= =?us-ascii?Q?NWfSQP+rjV7h0r5kEU5ly8k8pWQYRN/bFbEayvYKDEexdUN6eejsaLyXobsc?= =?us-ascii?Q?IV7IUY1V1eO+i8Q2x/nfyooIfL1fHbrNEaUwQkMBrK7yVUauqYL5I19SOROU?= =?us-ascii?Q?Ry6r9SIu5YPXmc5qpawfIMXD9H3+rkhjUz6VE8Ev3CrKq/e5l+YL+T32wEdh?= =?us-ascii?Q?uFK4yL/OthX1pZsyCgxFlF/zs9MyL8bvoTM8IVGUuH6EbCO4F30dXK/Cn0ul?= =?us-ascii?Q?25l1XoZMUIY5uQJ4VR7ywGiJRpZcxO+07BesSkk5ArIl8YELxNpSBHbt1bZ0?= =?us-ascii?Q?ld2G8oeWC+AaAUwWPN3FgsE=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6eff3615-ecc9-4f33-4dd6-08db2b13aeed X-MS-Exchange-CrossTenant-AuthSource: CH0PR01MB7124.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Mar 2023 20:26:14.4559 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: YadIwk+3zjVLQEZ/jcIQYUYViDKHg3xTduzT6o9+Kdia3A4DONmFHQwMSR22XjSYuhiKeIkoNIcMQjR/Vv/Z9eyFWTInZjrlEyIU6+e1pFoEEgeW74YIOWmsODvVWM1J X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR01MB7342 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a01:111:f400:7e8a::707; envelope-from=aaron@os.amperecomputing.com; helo=NAM10-BN7-obe.outbound.protection.outlook.com X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham 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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @os.amperecomputing.com) X-ZM-MESSAGEID: 1679516847684100007 Content-Type: text/plain; charset="utf-8" Signed-off-by: Aaron Lindsay Reviewed-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/tcg/pauth_helper.c | 54 ++++++++++++++++++++++++++++------- 1 file changed, 44 insertions(+), 10 deletions(-) diff --git a/target/arm/tcg/pauth_helper.c b/target/arm/tcg/pauth_helper.c index 6bb3b5b9e5..122c208de2 100644 --- a/target/arm/tcg/pauth_helper.c +++ b/target/arm/tcg/pauth_helper.c @@ -96,6 +96,21 @@ static uint64_t pac_sub(uint64_t i) return o; } =20 +static uint64_t pac_sub1(uint64_t i) +{ + static const uint8_t sub1[16] =3D { + 0xa, 0xd, 0xe, 0x6, 0xf, 0x7, 0x3, 0x5, + 0x9, 0x8, 0x0, 0xc, 0xb, 0x1, 0x2, 0x4, + }; + uint64_t o =3D 0; + int b; + + for (b =3D 0; b < 64; b +=3D 4) { + o |=3D (uint64_t)sub1[(i >> b) & 0xf] << b; + } + return o; +} + static uint64_t pac_inv_sub(uint64_t i) { static const uint8_t inv_sub[16] =3D { @@ -209,7 +224,7 @@ static uint64_t tweak_inv_shuffle(uint64_t i) } =20 static uint64_t pauth_computepac_architected(uint64_t data, uint64_t modif= ier, - ARMPACKey key) + ARMPACKey key, bool isqarma3) { static const uint64_t RC[5] =3D { 0x0000000000000000ull, @@ -219,6 +234,7 @@ static uint64_t pauth_computepac_architected(uint64_t d= ata, uint64_t modifier, 0x452821E638D01377ull, }; const uint64_t alpha =3D 0xC0AC29B7C97C50DDull; + int iterations =3D isqarma3 ? 2 : 4; /* * Note that in the ARM pseudocode, key0 contains bits <127:64> * and key1 contains bits <63:0> of the 128-bit key. @@ -231,7 +247,7 @@ static uint64_t pauth_computepac_architected(uint64_t d= ata, uint64_t modifier, runningmod =3D modifier; workingval =3D data ^ key0; =20 - for (i =3D 0; i <=3D 4; ++i) { + for (i =3D 0; i <=3D iterations; ++i) { roundkey =3D key1 ^ runningmod; workingval ^=3D roundkey; workingval ^=3D RC[i]; @@ -239,32 +255,48 @@ static uint64_t pauth_computepac_architected(uint64_t= data, uint64_t modifier, workingval =3D pac_cell_shuffle(workingval); workingval =3D pac_mult(workingval); } - workingval =3D pac_sub(workingval); + if (isqarma3) { + workingval =3D pac_sub1(workingval); + } else { + workingval =3D pac_sub(workingval); + } runningmod =3D tweak_shuffle(runningmod); } roundkey =3D modk0 ^ runningmod; workingval ^=3D roundkey; workingval =3D pac_cell_shuffle(workingval); workingval =3D pac_mult(workingval); - workingval =3D pac_sub(workingval); + if (isqarma3) { + workingval =3D pac_sub1(workingval); + } else { + workingval =3D pac_sub(workingval); + } workingval =3D pac_cell_shuffle(workingval); workingval =3D pac_mult(workingval); workingval ^=3D key1; workingval =3D pac_cell_inv_shuffle(workingval); - workingval =3D pac_inv_sub(workingval); + if (isqarma3) { + workingval =3D pac_sub1(workingval); + } else { + workingval =3D pac_inv_sub(workingval); + } workingval =3D pac_mult(workingval); workingval =3D pac_cell_inv_shuffle(workingval); workingval ^=3D key0; workingval ^=3D runningmod; - for (i =3D 0; i <=3D 4; ++i) { - workingval =3D pac_inv_sub(workingval); - if (i < 4) { + for (i =3D 0; i <=3D iterations; ++i) { + if (isqarma3) { + workingval =3D pac_sub1(workingval); + } else { + workingval =3D pac_inv_sub(workingval); + } + if (i < iterations) { workingval =3D pac_mult(workingval); workingval =3D pac_cell_inv_shuffle(workingval); } runningmod =3D tweak_inv_shuffle(runningmod); roundkey =3D key1 ^ runningmod; - workingval ^=3D RC[4 - i]; + workingval ^=3D RC[iterations - i]; workingval ^=3D roundkey; workingval ^=3D alpha; } @@ -283,7 +315,9 @@ static uint64_t pauth_computepac(CPUARMState *env, uint= 64_t data, uint64_t modifier, ARMPACKey key) { if (cpu_isar_feature(aa64_pauth_arch_qarma5, env_archcpu(env))) { - return pauth_computepac_architected(data, modifier, key); + return pauth_computepac_architected(data, modifier, key, false); + } else if (cpu_isar_feature(aa64_pauth_arch_qarma3, env_archcpu(env)))= { + return pauth_computepac_architected(data, modifier, key, true); } else { return pauth_computepac_impdef(data, modifier, key); } --=20 2.25.1 From nobody Thu May 2 12:58:46 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=os.amperecomputing.com); dmarc=pass(p=quarantine dis=none) header.from=os.amperecomputing.com ARC-Seal: i=2; a=rsa-sha256; t=1679516872; cv=pass; d=zohomail.com; s=zohoarc; b=ZEXy/wEl3ISmy1975mm5TAeBx9VRBk34eEuebXDv33iPbaFRnFCo8lHJ+GhkzJ+4P65zn9B6uFRemKwcfz2P3wSuG9aevSqh13pE6LQrVAV2zHpgAUsCSndfq6cQhAVsJ1FPualZuyYxq3k+sSVu0WnfAzMLxYALs+LMWxJkcPM= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1679516872; 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=2oydfMauGhlnnMmxDhw9rIOlP5mOwX8uAtTjkbj35pc=; b=AQs8SZ6Ceso+x2wYbFuw6KSGvWKMUne3b/Odh/+h4jhA7w+0kg3saFjry1hxkR3+VgBurUx9gzmJaFGoyXGbZ+YdwQQxujHBZnPRxd5TC5CCha4jGKnfuaTsLhmysrrxl27qSmLk4NYFbzx7bMHiqLht7R7vedDFlsKi6+5sm8I= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=os.amperecomputing.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1679516872663442.3491114601859; Wed, 22 Mar 2023 13:27:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pf52N-0001df-EL; Wed, 22 Mar 2023 16:26:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pf52L-0001dA-DW; Wed, 22 Mar 2023 16:26:21 -0400 Received: from mail-bn7nam10on20707.outbound.protection.outlook.com ([2a01:111:f400:7e8a::707] helo=NAM10-BN7-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pf52J-0004xk-QE; Wed, 22 Mar 2023 16:26:21 -0400 Received: from CH0PR01MB7124.prod.exchangelabs.com (2603:10b6:610:f3::20) by SA1PR01MB7342.prod.exchangelabs.com (2603:10b6:806:1f5::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.8; Wed, 22 Mar 2023 20:26:17 +0000 Received: from CH0PR01MB7124.prod.exchangelabs.com ([fe80::cf62:d511:8228:b39c]) by CH0PR01MB7124.prod.exchangelabs.com ([fe80::cf62:d511:8228:b39c%8]) with mapi id 15.20.6222.010; Wed, 22 Mar 2023 20:26:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U42rI2ID/qB2g32RX7BS2F3a3g4uNBKdi8iVrXq6bu5pl710WaufsE83VFdHccjbyBzswjK8JrvylJODJRdjKqD3R0od33geisgE71D4wU0oUiAwPmFFoD8YLBuBu3iRxz1KgYbljSrPHovcgHg7Q8FlZDIGFjxnk/0SeRP0BtpyHk3htTysmHDc83YvC536gpox3AHex0hlnfk4MPtWxpokQpoZeNVWVoa6sAPeX78d4Ty5qq7MNBEy4LaOykObqTytEy2oEPs+XAOOkBxhfl2tF7F6YMeQ48anSmA8M2KjUPSraZRqS8jk4YwlOuLkLplbF5MTM12IeIwlo3I5Ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=2oydfMauGhlnnMmxDhw9rIOlP5mOwX8uAtTjkbj35pc=; b=W/yuXbKf39SjDWFeC/3cLSw/ASS5VIQIiDa4rY5R+enMrJfafqFeh3SUt4AUsrz77JXzvdKVHEZgsqoTBISMcOjPEB8mB3WSEFldpNN8vikOIexvCD3U0KaYc6htPxM6uADXJGdFl9dHdcgorOY+Fg6f9sRujqJ8a5C2MyZ/gpZPxdEy2c3ZwgGYugg7TWnxS9xI5i+9JP4hNmzqVv3u3ybfHNZRjiSE3cZZ1D3dF87MJzJDr7MsIcSgqk/ukFC4l2UCPxKy5MHCUOcMDKgE+e4Nwxblzhua99VAlTxEVE5yVXWOSeKSzWz09czv6y9/ETAQpdUK+IIr1IwcKh3Pxg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2oydfMauGhlnnMmxDhw9rIOlP5mOwX8uAtTjkbj35pc=; b=fru7Iy9KKXD7TK2W1utYMcweN1sTvpFYFOSDnxidHqj0korhsn6aYedNdgRx2DB1ylm7v7w0AigFo//CGjlrl+777lmJIIlNhX5cUedurXn5fFKr7kxAHHfQ+W/97Q9UpE6AIAPHXOtaNI4XxJAxMyzESDaz145pLaDQH8pw7Ek= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; From: Aaron Lindsay To: qemu-devel@nongnu.org, qemu-arm@nongnu.org, Richard Henderson , Vincent Dehors , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Peter Maydell Cc: Aaron Lindsay Subject: [PATCH v3 4/8] target/arm: Implement v8.3 EnhancedPAC Date: Wed, 22 Mar 2023 16:25:37 -0400 Message-Id: <20230322202541.1404058-5-aaron@os.amperecomputing.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230322202541.1404058-1-aaron@os.amperecomputing.com> References: <20230322202541.1404058-1-aaron@os.amperecomputing.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: CH2PR03CA0008.namprd03.prod.outlook.com (2603:10b6:610:59::18) To CH0PR01MB7124.prod.exchangelabs.com (2603:10b6:610:f3::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR01MB7124:EE_|SA1PR01MB7342:EE_ X-MS-Office365-Filtering-Correlation-Id: 01a15c47-cc8f-4db6-2845-08db2b13b06d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: t068BVYxhdCNRLaKJWAalZ7aw/Mc1/PbwS+y6IxiwVhaN01eCLkpYOSiMGcQaCaQ/mteD7jjoD5FOu0yT8ZVwRCplMCJCgMlv/4vGXQ9NWUxQdXkYeC/joCuxzSUveGPA+1sCx5dCIuUTgUiBd0LeENr35gkJyHI4qDRBSlLk3nuP5G5PWd0IZxQIdvQ57AuSPuov88/hIBnkMFklILu+WWLesdJHnYvnBIYcioMUPCTaw8LyQzR/+Ly2VSoV+93jxXlK0haw2pFpdFo4AFt/8Xt+HhBK5EzWYDEMmSflke5YDpCpjBeXJ3veDEPvbtEA8j+gY/6j+vXND7fsieUCJMuS8G5i+9dnMbRO0r1OhHrASsoNvER43qStyXnwxckJz8RL7MvLouneHlrIg79eNXJk0Gjz1Kiq1aMKElYR6FmRKeCowl+r5l4rvCMO2F/7FQ7sjOG1dv6yH+z8P0PlAPusjCVyqyvXsaFMLZvuXb0cfeuY0nMTT7TA4UqYxiG79NJH7wY4pjo5eDpacWfBfSmHfF3gurB4OENx4o7PN6UQELtcUPG/rppoXZDKjqixTjaIkI8EfhLIPC5bdB31REAOfXYYTzfth4DtrLSmf7k71Flbt3LMhYXTwZPQoRuW39nf6+7skK3RrwzTzWkVXpY68VqRCk5loDYggnNPSoQ00ii4Tvxsjgvq++dleOKofDh8nzpkKbFIUCzSrKcCA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH0PR01MB7124.prod.exchangelabs.com; PTR:; CAT:NONE; SFS:(13230025)(4636009)(346002)(136003)(366004)(396003)(376002)(39850400004)(451199018)(83380400001)(38350700002)(6486002)(186003)(6506007)(86362001)(26005)(6512007)(2616005)(1076003)(38100700002)(6666004)(107886003)(5660300002)(4326008)(52116002)(66476007)(41300700001)(110136005)(66946007)(478600001)(8936002)(2906002)(8676002)(316002)(66556008); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?4GV5vMOz1Uyltmwjb/sBko7UHf+dN5Vuh6iiZx2FVdkaAGH2huN+4Vl8DM78?= =?us-ascii?Q?7YKUskAvdBipre+daEmoYFvYart/RceHJ+cOIRROclOAKZTnHCjj5KNrI1Jr?= =?us-ascii?Q?1JytLv9lclD2tSRlUQjS5B1tTih/Hvjz3u6Fmw+0VK+U+f3WiHQ4BqqAX2ca?= =?us-ascii?Q?K0Ubtpvzf23j9mAOx1Y3hE0GuVIe1myJLsN+Yj1hhlw/3NRIteCgJ9F9NK9k?= =?us-ascii?Q?LWReFJL6zKRFqNsJFjG63cNXA7YRqRT7PNCg5UG4wsFN/lUrZLIE3DCPyr+j?= =?us-ascii?Q?IUAFmBuvbB4A//P+vjlQkiN3jIDBj6tU2D8zXrROpULywYAe5avzUqy3oDan?= =?us-ascii?Q?l4vPq/2v56lM7HbccJa0WhFTRf6THfT8qRhXzgEUNsWXbskwUROaPf2s/dFm?= =?us-ascii?Q?KlwSr5rVVAlfvOKOPnv14ezkuynary0vlseyM1HGOekepMw8TQXwiPH+xBqV?= =?us-ascii?Q?9G8ClWbiSu9ePND8R2gnJrmm7hrV7b7ursEtTRzJC3SuOOmQgl56VC8QIYYa?= =?us-ascii?Q?Lc1whqvvM7mvqTjphCbOe4IVueKGaAgJCivD0YY8XqtU7m7DHQ2UR0XgiNcV?= =?us-ascii?Q?kXTcjyd/A2YSOYpkWSG7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-ascii?Q?2YLwilFmFumkmi1DtII7GHaqw1xDdAQCRnHn2fHRtHdpyjyZXroGmNxg8xQ/?= =?us-ascii?Q?WzGQrIOJRHsOQAKZDlE6SoZaJ3AHBdck6AdjgNZNZsTntuwipFyMkeKH3tNL?= =?us-ascii?Q?HLgIPcnfd2m1XaWpUj/esG4=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 01a15c47-cc8f-4db6-2845-08db2b13b06d X-MS-Exchange-CrossTenant-AuthSource: CH0PR01MB7124.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Mar 2023 20:26:16.8838 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 4PuqMmImlDR7TVwIqdfZxbBsPDTmUWAuedaoNaoLgEMEe2lbrHlv0gEsOjgFjRblEZ4Lgg2+qB368VeFy6Bx+AOjzK36FbVTKUA3lZ1k+Yh5pCrbvkEo3jPbeI42RbaM X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR01MB7342 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a01:111:f400:7e8a::707; envelope-from=aaron@os.amperecomputing.com; helo=NAM10-BN7-obe.outbound.protection.outlook.com X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham 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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @os.amperecomputing.com) X-ZM-MESSAGEID: 1679516874680100006 Content-Type: text/plain; charset="utf-8" Signed-off-by: Aaron Lindsay Reviewed-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/tcg/pauth_helper.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/target/arm/tcg/pauth_helper.c b/target/arm/tcg/pauth_helper.c index 122c208de2..7682f139ef 100644 --- a/target/arm/tcg/pauth_helper.c +++ b/target/arm/tcg/pauth_helper.c @@ -326,6 +326,7 @@ static uint64_t pauth_computepac(CPUARMState *env, uint= 64_t data, static uint64_t pauth_addpac(CPUARMState *env, uint64_t ptr, uint64_t modi= fier, ARMPACKey *key, bool data) { + ARMCPU *cpu =3D env_archcpu(env); ARMMMUIdx mmu_idx =3D arm_stage1_mmu_idx(env); ARMVAParameters param =3D aa64_va_parameters(env, ptr, mmu_idx, data); uint64_t pac, ext_ptr, ext, test; @@ -351,11 +352,15 @@ static uint64_t pauth_addpac(CPUARMState *env, uint64= _t ptr, uint64_t modifier, */ test =3D sextract64(ptr, bot_bit, top_bit - bot_bit); if (test !=3D 0 && test !=3D -1) { - /* - * Note that our top_bit is one greater than the pseudocode's - * version, hence "- 2" here. - */ - pac ^=3D MAKE_64BIT_MASK(top_bit - 2, 1); + if (cpu_isar_feature(aa64_pauth_epac, cpu)) { + pac =3D 0; + } else { + /* + * Note that our top_bit is one greater than the pseudocode's + * version, hence "- 2" here. + */ + pac ^=3D MAKE_64BIT_MASK(top_bit - 2, 1); + } } =20 /* --=20 2.25.1 From nobody Thu May 2 12:58:46 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=os.amperecomputing.com); dmarc=pass(p=quarantine dis=none) header.from=os.amperecomputing.com ARC-Seal: i=2; a=rsa-sha256; t=1679516887; cv=pass; d=zohomail.com; s=zohoarc; b=QieYfSihk3VMP+PKtlFSkYlx3msa3fpwcuR7oP8GhyycGkTp4BspT9Pfhp5ycS541RD85qchNAyI+RJQm2kQG4MPBYhu/Gstm4eu1bc+8KlP+yGLBIfML8BjWYvL616lCGtMzgEYe7NqhN4byQbE5ivHt+E55BArCRtmwRakb8A= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1679516887; 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=Z+VGBZAF/st+ysD7A6pDdoonFVJM2RxzmwLO71SPFcg=; b=YfIXRsR+GC7SHeKNUbZzlz6LY/pUQbaC/x52mOPvnC4+Em8T4HPuecgtM8w2VbqeBA4dFOvbFPlgoarOY1ujhqGoVPwCCL2XmB9rF/nsQNVIg7utdlsrbKpyvx/7Wqw2fBQmt6pVQEzK84/qw1F+JKUe+zTB7vCvlW4P/ORetHI= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=os.amperecomputing.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1679516887608970.7740230221904; Wed, 22 Mar 2023 13:28:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pf52P-0001eW-8w; Wed, 22 Mar 2023 16:26:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pf52N-0001e9-LK; Wed, 22 Mar 2023 16:26:23 -0400 Received: from mail-bn7nam10on20707.outbound.protection.outlook.com ([2a01:111:f400:7e8a::707] helo=NAM10-BN7-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pf52L-0004xk-Su; Wed, 22 Mar 2023 16:26:23 -0400 Received: from CH0PR01MB7124.prod.exchangelabs.com (2603:10b6:610:f3::20) by SA1PR01MB7342.prod.exchangelabs.com (2603:10b6:806:1f5::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.8; Wed, 22 Mar 2023 20:26:18 +0000 Received: from CH0PR01MB7124.prod.exchangelabs.com ([fe80::cf62:d511:8228:b39c]) by CH0PR01MB7124.prod.exchangelabs.com ([fe80::cf62:d511:8228:b39c%8]) with mapi id 15.20.6222.010; Wed, 22 Mar 2023 20:26:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UV6YNmlVnSZTYQzAxpIZmcIxip1C/tv1qbIv6cQ3vJ0JwMmMySaAFSaybUVleNx7ygPTQe/goh69ioraXqS//LCSmTSVjIVmgi5d/RLdItW2S19MjCn7lVAirjb5TJpSPoBcD0C9FEtUq9CCV/+4HaAUGdQ9OYxnLTzvHPSHvhWseoEu83rezTF5OMrhMSK1lzag754v9Mg0F+xlu4qY7rhJr5AJfljQ+lkh2OY4dxqZg/WicDu3HSH1yiouTdSDLVNMzkWoi+eZZWi4tmmfYWTDoOa7+dtr8Caz5rJe/zXvXNEz9rPSi7XA4eE7waYetQKB4DMo12sI7g6la0VR5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Z+VGBZAF/st+ysD7A6pDdoonFVJM2RxzmwLO71SPFcg=; b=JZkvaxR2GJxMMxEd+T7WkWz4l0ZLOEAiG9Et+CmW44SILcZFYMZZrLhQwDakLCHx8P/fmDAnY4mw2BqmrXg8buU9xMmLtVOVfyfwQ2nwYwjQFgD3nF1KSWXxySl4IKXWttT2yKnk+rTHoMuEXxuBccvIQ9qWYCgnS+c3Z5i+vc9tdRxkNaLRGO3wazuBsGjo65mCIPzWn17CLG3M7f78cg74tN+XUlCk69vYsra76J/hu4e828juIve33ShjqorCzDVnzRcRsEnaWjvrNJ9F39rswtYOguudLTpB6UifUi0dcR9HB2eRBI7AIdghk/7hMrdyhvTzU5iN5lHDU97Ryg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Z+VGBZAF/st+ysD7A6pDdoonFVJM2RxzmwLO71SPFcg=; b=hbCMTMBOFPbOugDeah/a587q2NENcYmkBPepXHcay1Qyfo/2oH8tJaz+OrSPPmVcZnU0a8EmNAhTrGww0ygMrTeU5k0teKVHjuhlg3z5sUVIYsoaNWa+gDw3Ow7SN73vWm4ihrTX0NgBjMLC1Bo21whOr+c5sDrNAgY2oPr3QXc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; From: Aaron Lindsay To: qemu-devel@nongnu.org, qemu-arm@nongnu.org, Richard Henderson , Vincent Dehors , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Peter Maydell Cc: Aaron Lindsay Subject: [PATCH v3 5/8] target/arm: Implement v8.3 Pauth2 Date: Wed, 22 Mar 2023 16:25:38 -0400 Message-Id: <20230322202541.1404058-6-aaron@os.amperecomputing.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230322202541.1404058-1-aaron@os.amperecomputing.com> References: <20230322202541.1404058-1-aaron@os.amperecomputing.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: CH2PR03CA0008.namprd03.prod.outlook.com (2603:10b6:610:59::18) To CH0PR01MB7124.prod.exchangelabs.com (2603:10b6:610:f3::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR01MB7124:EE_|SA1PR01MB7342:EE_ X-MS-Office365-Filtering-Correlation-Id: fe1eeee7-dd28-4942-4ad8-08db2b13b127 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IW5BuifnD8dSu1WzJPYWhrli7MsybAEsNPHRGZ/QR70pAgQIKOfha2eq3u9Xy74Er8K3SWToALHon6AZDR62EIQbPVCHmT3/dv+k+dydk7ax5IJEPhUhw+45KAgD0Gr+guInnYx1CcOF1oU7MrNZfz0coD8JsPBT7vI3QkgRhB3BrYmiKLyNS7P5+ZeSMQreqBi01vzDrGRToK/7wKDb70VF1wQy0WFBSq93otzC+1KbcLEZToAO2y9Od+5r11KUnrJ5gH9jM+rShqXpRhwK3FN3FJrAxNnoqXVqSMzVDazhqkLofHoFecBFUrghLedq8zozSfp9QYKwVn0OEg5fyLrqk85dwP57IeceFcnB3kQOdnh+PJYbMGgsIHueQVuUTetwxd78uOxYJ0pnpXVIjDC3mdpshdTy2YlZzKAkS/hiYYCavZeynkDwfBd2/uTLmf+qYdelGs9XCINK0KPbrDKnMYLz/IKkWwqj4HPYlOb4hsJWzQeYEAcycW4C6WlftCgLJNh5U7rtS4gxRrgjrUXdf0hPZfQZotGGKZJflBBfTacSinvEsinN4f4SsJpmeRZF4aq8KKqztfEbzNwC9mmwQNWxgDRuOvj4h73rX4SPbjO6BRaXPg2SO4yVs/C7iJTiJBl7tCJRNVAHJLSKIQvB9OTUXv1V/2BLbwQqjbGlRDhcyPS2tYRi8wlQgvqze9eIbu/YNF4WOdSDBe8hKw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH0PR01MB7124.prod.exchangelabs.com; PTR:; CAT:NONE; SFS:(13230025)(4636009)(346002)(136003)(366004)(396003)(376002)(39850400004)(451199018)(83380400001)(38350700002)(6486002)(186003)(6506007)(86362001)(26005)(6512007)(2616005)(1076003)(38100700002)(6666004)(107886003)(5660300002)(4326008)(52116002)(66476007)(41300700001)(110136005)(66946007)(478600001)(8936002)(2906002)(8676002)(316002)(66556008); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?wAVK6ztMuMJnJnsOyls2H8jSdTIl2onp2KPR9yuAm/eAIGIYI3BnOS+pPGlz?= =?us-ascii?Q?rQtTt2xtgviVi2r5yrR6efYfzZ2MoNPqqRa9VP+uxorewEcaRQwdjxKpS4mB?= =?us-ascii?Q?gNeZ2/zr7F8nfZD5g/ZT+nmkiM3L7y424V+kxoX4GH0D/aakky+z0aBJTVH1?= =?us-ascii?Q?QKnKnYkXkIzuEoHPJzIvV+PGxFopEqJMFxA+E80mx5kRsKH+RPMjbXusZjYr?= =?us-ascii?Q?d6xn6zH+1bL0wcEYYleOE87IQ0Vn5kimL5Zaa44/umplqUwCdPGa9gkcxy53?= =?us-ascii?Q?PxP1Rqne+iFsfWvF/WASrXcHdZHCk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= =?us-ascii?Q?f25pjFciKaykzwXggCeNCcZFrb8TsTzb4ip4Y+kHU8kx5yqI6VSBV/NBGK2d?= =?us-ascii?Q?jC9/n5aXu1Xg7GwVz9IwiJhDfSeL5ph6b5pDJtyO0LlnN/498BDo2/MfbXi7?= =?us-ascii?Q?GcatkUq5MBVuqLkvJpVxNPb/EELhA6AEwn1Tw+ro978BuxPF0QEI4EuvJJFG?= =?us-ascii?Q?4RLHKwolLvtFJPYsaY5kq/aui8YA9Gxfmudp6q67n7gYOEsttLLbF2dKIwZm?= =?us-ascii?Q?J7GfNmpxEACnWIFAUmpFo1dpnqvJOiQfBeebScaaU3utBeqjxmX42fbtARES?= =?us-ascii?Q?t2h587o4lgnL48bT+nL8QE7mc9pxpWwwtMlq6m4CX4Jv3l3f4sNk5vyWjB2U?= =?us-ascii?Q?xJaTzbwWceY7Pxa7LWSJ/hvmHK7lMSSemlN58LQ2r3jmY93zCnn9UT8hgydI?= =?us-ascii?Q?gHC0FA7l2JbSd+ZeM6tZqoc=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: fe1eeee7-dd28-4942-4ad8-08db2b13b127 X-MS-Exchange-CrossTenant-AuthSource: CH0PR01MB7124.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Mar 2023 20:26:18.1253 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: VKwAykNz216kzicW40a882szWyLoDRsmcNoJAidGClP+6xoHQc6wAzDrvw7ABhXB4zGepipLYfhHvr9nPO8CTgqxQUlDyfufmnEnNJ1hC7Uc/CcX/sXhvSLdDWojXMvG X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR01MB7342 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a01:111:f400:7e8a::707; envelope-from=aaron@os.amperecomputing.com; helo=NAM10-BN7-obe.outbound.protection.outlook.com X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham 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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @os.amperecomputing.com) X-ZM-MESSAGEID: 1679516889011100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Aaron Lindsay Reviewed-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/tcg/pauth_helper.c | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/target/arm/tcg/pauth_helper.c b/target/arm/tcg/pauth_helper.c index 7682f139ef..1148a21ce6 100644 --- a/target/arm/tcg/pauth_helper.c +++ b/target/arm/tcg/pauth_helper.c @@ -352,7 +352,9 @@ static uint64_t pauth_addpac(CPUARMState *env, uint64_t= ptr, uint64_t modifier, */ test =3D sextract64(ptr, bot_bit, top_bit - bot_bit); if (test !=3D 0 && test !=3D -1) { - if (cpu_isar_feature(aa64_pauth_epac, cpu)) { + if (cpu_isar_feature(aa64_pauth2, cpu)) { + /* No action required */ + } else if (cpu_isar_feature(aa64_pauth_epac, cpu)) { pac =3D 0; } else { /* @@ -367,6 +369,9 @@ static uint64_t pauth_addpac(CPUARMState *env, uint64_t= ptr, uint64_t modifier, * Preserve the determination between upper and lower at bit 55, * and insert pointer authentication code. */ + if (cpu_isar_feature(aa64_pauth2, cpu)) { + pac ^=3D ptr; + } if (param.tbi) { ptr &=3D ~MAKE_64BIT_MASK(bot_bit, 55 - bot_bit + 1); pac &=3D MAKE_64BIT_MASK(bot_bit, 54 - bot_bit + 1); @@ -409,26 +414,34 @@ uint64_t pauth_ptr_mask(CPUARMState *env, uint64_t pt= r, bool data) static uint64_t pauth_auth(CPUARMState *env, uint64_t ptr, uint64_t modifi= er, ARMPACKey *key, bool data, int keynumber) { + ARMCPU *cpu =3D env_archcpu(env); ARMMMUIdx mmu_idx =3D arm_stage1_mmu_idx(env); ARMVAParameters param =3D aa64_va_parameters(env, ptr, mmu_idx, data); int bot_bit, top_bit; - uint64_t pac, orig_ptr, test; + uint64_t pac, orig_ptr, test, result; =20 orig_ptr =3D pauth_original_ptr(ptr, param); pac =3D pauth_computepac(env, orig_ptr, modifier, *key); bot_bit =3D 64 - param.tsz; top_bit =3D 64 - 8 * param.tbi; =20 - test =3D (pac ^ ptr) & ~MAKE_64BIT_MASK(55, 1); - if (unlikely(extract64(test, bot_bit, top_bit - bot_bit))) { - int error_code =3D (keynumber << 1) | (keynumber ^ 1); - if (param.tbi) { - return deposit64(orig_ptr, 53, 2, error_code); - } else { - return deposit64(orig_ptr, 61, 2, error_code); + if (cpu_isar_feature(aa64_pauth2, cpu)) { + uint64_t xor_mask =3D MAKE_64BIT_MASK(bot_bit, top_bit - bot_bit += 1) & + ~MAKE_64BIT_MASK(55, 1); + result =3D ptr ^ (pac & xor_mask); + } else { + test =3D (pac ^ ptr) & ~MAKE_64BIT_MASK(55, 1); + if (unlikely(extract64(test, bot_bit, top_bit - bot_bit))) { + int error_code =3D (keynumber << 1) | (keynumber ^ 1); + if (param.tbi) { + return deposit64(orig_ptr, 53, 2, error_code); + } else { + return deposit64(orig_ptr, 61, 2, error_code); + } } + result =3D orig_ptr; } - return orig_ptr; + return result; } =20 static uint64_t pauth_strip(CPUARMState *env, uint64_t ptr, bool data) --=20 2.25.1 From nobody Thu May 2 12:58:46 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=os.amperecomputing.com); dmarc=pass(p=quarantine dis=none) header.from=os.amperecomputing.com ARC-Seal: i=2; a=rsa-sha256; t=1679516850; cv=pass; d=zohomail.com; s=zohoarc; b=e6nmH7ecrkf/NxFjK/ya1n7InOS9uTRSkoG+xd7Cv0wpRvh3+Nz3pTZ3x68OTV0GerkQPnVc8ObzvG5vMlOENYyNrTHRYs/XzrUY65GlnV/dTdwsc58OkorurLE22VI0c1/nZ1WuGVl/r9ubfu0wn0Iu8DoRaJat/58m62BWVN8= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1679516850; 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=19pSyUl9Kzc3k/BE9fHxbqrjW3rbzjji+u6bUWw7fzE=; b=PksZU8wd9KmgRr2ybT+Op1TxWuIijLVI06YhMibY8nkyvPH92zp79qNAMgb+wjB7vDw1I2FooIBYsSf/dk8Ug1XZjMdlEAgSNeJSEbU+yqtGXokdF6m0ocmCx9zV6vPsMaYWeZUtpqnP4HHlMF1+MU+W4xDy6QBeqx9qO1+8Scc= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=os.amperecomputing.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1679516850987204.4501163379432; Wed, 22 Mar 2023 13:27:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pf52R-0001fV-Me; Wed, 22 Mar 2023 16:26:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pf52Q-0001f7-67; Wed, 22 Mar 2023 16:26:26 -0400 Received: from mail-bn7nam10on20707.outbound.protection.outlook.com ([2a01:111:f400:7e8a::707] helo=NAM10-BN7-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pf52O-0004xk-77; Wed, 22 Mar 2023 16:26:25 -0400 Received: from CH0PR01MB7124.prod.exchangelabs.com (2603:10b6:610:f3::20) by SA1PR01MB7342.prod.exchangelabs.com (2603:10b6:806:1f5::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.8; Wed, 22 Mar 2023 20:26:19 +0000 Received: from CH0PR01MB7124.prod.exchangelabs.com ([fe80::cf62:d511:8228:b39c]) by CH0PR01MB7124.prod.exchangelabs.com ([fe80::cf62:d511:8228:b39c%8]) with mapi id 15.20.6222.010; Wed, 22 Mar 2023 20:26:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WNWakDTxO6HmpwJx6Qd5iyZxc3S8IQEqRbziCLLUwUsWZikiEkyAvf43boCOyEgnpNpTdYwXDcbvwsPEa3kwpN5Yg6+SerlAtVS/TfiQQbTIMQCQzSdXwkJcY2/JzhQoLKNN/k+defgj3lk8P37Ag5eyY1Wg4xCUSwH2fA0xCNUWnxIuAd4ZAXR4EhZPnf0GnlnL+NZIFJJqmsy1tsBembz3twEGJPC6z/yiTtnhPFdnxcmMNpnCamz28GcdqkpQPeN+jqCdo4ihEyUSUsPE4DMm6qo8V3DiaqsvdEIzjfwJZDMBwVZbW8GbJxVdpQnmTdmGwaz8PTrEYjGAAr+Cnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=19pSyUl9Kzc3k/BE9fHxbqrjW3rbzjji+u6bUWw7fzE=; b=cIs5WpMpfze2jpgUdiBoFnvFCz7/jFv7POaNJMFOSc/QPxsCYU8qeDWZD3EXFfgVhXh2bc2N2BlRzpEGZKGQtNwdewpFfdRUkjwi+9ZQSyk5SfVkNQIxbuirn+KcsVtxLvBFM4sM2SfJBQf9RcUNTei0/b0s0q+N+JphoeH/SV4dnSKvqpsVj7KUKt5ZKcqWiobTuiveNBdk8im+I9tYN1QM7SvqPbwPXZC/vMiRdgQY8MgFTLrvLsGlMoHhH0Q7iKZNbA7Yx764xmdutkDOjZTzktKOocme9XTqzBPJiEsan3rlrrtyLpxXtAqP7s11ZAPVNRWLAukYbAhlgj45SQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=19pSyUl9Kzc3k/BE9fHxbqrjW3rbzjji+u6bUWw7fzE=; b=gNq5G6G5qO2b2TAHkp9DRIvKcF4XHn3hoB6Cx28XPLcAmcp9oHach2q8kMfc5VX4tP+z6LsLBqbzCm9VxLUbvsOIUxE63btXhtlhG/BF8GJriYir4ApfM4p0czMjH+zF5+SsAtCr9kwlziAZoljrgs3D+2V/EsL3gsDoj7lzoKU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; From: Aaron Lindsay To: qemu-devel@nongnu.org, qemu-arm@nongnu.org, Richard Henderson , Vincent Dehors , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Peter Maydell Cc: Aaron Lindsay Subject: [PATCH v3 6/8] targer/arm: Inform helpers whether a PAC instruction is 'combined' Date: Wed, 22 Mar 2023 16:25:39 -0400 Message-Id: <20230322202541.1404058-7-aaron@os.amperecomputing.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230322202541.1404058-1-aaron@os.amperecomputing.com> References: <20230322202541.1404058-1-aaron@os.amperecomputing.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: CH2PR03CA0008.namprd03.prod.outlook.com (2603:10b6:610:59::18) To CH0PR01MB7124.prod.exchangelabs.com (2603:10b6:610:f3::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR01MB7124:EE_|SA1PR01MB7342:EE_ X-MS-Office365-Filtering-Correlation-Id: faf27ef5-c230-4737-bf9b-08db2b13b1ef X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QCTydHcpu/RKLUOhKCXct8ro6igRRLt8xzuPw0OQrzwq6FIGf3zafIrDijQNUklewNlAZVNhRB9HMjxrvW73qnXOPCdIwFTGwv2p7iM3iDSPEFziFXn2dVHAxTX/BdrOXhSu2xA9u9e+rwD1f+lJJZIiXJi2pyminGPY6ulU2JDbfi5ZlCh0CvL6vACl37igniEc51LRSXonB1D0vQpqSEYDNsXftzxm3+bYf6TrvVsc9yWb+TGGSejJnugFah9eTkSvhrVWhGOVpNhH7T9O9xrjabN7/YytFqwINt1pOef/1AmA/lgKHoXke48AxpSBmqJLkwAf9jzSRuPmbKReOM82IH+VX/bI9dU1VFJ/XAJNYWKfOFUTWJJtbcFT7lmSomiDBUb0NABBuPygHIQw1T/Tcxw+pO/pyERl96PQl0/lfgcmrIX6s8LSArflod2h92YofXRBDCzFYAI2trWOwdzYTbYFoDk1zTvz7+3WnsKkg1n7sQ+0bJ3iYY6s7DoJOp1NHjWGEvAR3QqMPkqcVUtD7jIiBkstXUW1CmYGEO/GhGksKJnC6fZgSelHmRvpeIzqrfaKSwgjjWfeGPwaYUQqtbx2XwXqCadaDUa02rEJVbolm83rP6PWkaVwWo8dNZFV0hotgYETbkJIoghGUPyQ2OUBWPAuJH7tzuETOFeFG6HPHyOyG3YAR4Zo0Ia/uBznyp4NyS5HYHWKcTlwvA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH0PR01MB7124.prod.exchangelabs.com; PTR:; CAT:NONE; SFS:(13230025)(4636009)(346002)(136003)(366004)(396003)(376002)(39850400004)(451199018)(83380400001)(38350700002)(6486002)(186003)(6506007)(86362001)(26005)(6512007)(2616005)(1076003)(38100700002)(6666004)(107886003)(5660300002)(4326008)(52116002)(66476007)(41300700001)(110136005)(66946007)(478600001)(8936002)(2906002)(8676002)(316002)(66556008); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?RYQUUlhy4oT4akmeroDOm8/4WqwEbFL6tyI1qp6n6L1OSDOH0kDSTdTQC6ZD?= =?us-ascii?Q?4W44FAZdTqyWQGyyP5TJzJtdHld9bdPoqH/wn3siF/jRzoFAXshQuwsMuc8N?= =?us-ascii?Q?UFzdKWnw0Q+PNmtLxuz8BTaOthqg+qLf50vH3TRtSCF9aGtee26N1Z1WWXd5?= =?us-ascii?Q?TgqPYqlaSoq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gyi?= =?us-ascii?Q?LadVLBXhgwtG2Odz9TyWRVp3JMNOs4YO8t2k3Djl+mTsx1FUzZ1vhZAH2fv7?= =?us-ascii?Q?6bktXdZSZNN7uNFHhjpbpMXGvuwel+nTGmpcdDeuoBS5Qnz+ocZ9N9F4vm7w?= =?us-ascii?Q?EqTt/cNeCPU2hla9dR5pVvck/iwDvCn0FClTp3jyHputnGyX00Br3RKB6jNh?= =?us-ascii?Q?FYpUMO0laFiGRcFe7HyNpFEYT3ctsaL6IXzha/EoP7t7XSR4NHZGR83w3tcn?= =?us-ascii?Q?xLv7da8gfvLo1zIXbdgtPVvY4RXBVoY3ewO6Eo3/tb9K4OyJBtLhbQcFo1WJ?= =?us-ascii?Q?M8WRCX4XgFIndFzCh7qzN2DsudMJGuKULnpovjwahOAUZ+8Rswauq2oO7JVl?= =?us-ascii?Q?gVCdiukeNUMn0aRtOmQXMXUdmEAJivpkmTILk+Bofl5hHYrTgmwAgo4mOZL7?= =?us-ascii?Q?Cm3x6jly5aFBnSPHWD2elNB/0YeI/fXOW0GQdbqPDE8pHfAPgtpBcLIKNK43?= =?us-ascii?Q?dyazPHB0aMXiPYHAJoOIR6YMwdbvzbHSbK76pnNf96pG4W/KBLiT7olUxR0l?= =?us-ascii?Q?x9vuR87z9PBOw/Gu4CBiZOs=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: faf27ef5-c230-4737-bf9b-08db2b13b1ef X-MS-Exchange-CrossTenant-AuthSource: CH0PR01MB7124.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Mar 2023 20:26:19.5208 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ojKDjPcWHrX8IrNEaoQnn8i7ZZZemVSddLrAfXfm1IjQNMS55ppWt9BZEXnnpFdjXEHPiKt4RmxH244RKjh541n+0V2XSeM72Mb04qex0m5dXEHh2yA9xrcbm9gzNki5 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR01MB7342 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a01:111:f400:7e8a::707; envelope-from=aaron@os.amperecomputing.com; helo=NAM10-BN7-obe.outbound.protection.outlook.com X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham 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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @os.amperecomputing.com) X-ZM-MESSAGEID: 1679516852584100001 Content-Type: text/plain; charset="utf-8" An instruction is a 'combined' Pointer Authentication instruction if it does something in addition to PAC - for instance, branching to or loading an address from the authenticated pointer. Knowing whether a PAC operation is 'combined' is needed to implement the FPACCOMBINE feature for ARMv8.3. Signed-off-by: Aaron Lindsay Reviewed-by: Richard Henderson --- target/arm/helper-a64.h | 4 ++ target/arm/tcg/pauth_helper.c | 71 +++++++++++++++++++++++++++------- target/arm/tcg/translate-a64.c | 20 +++++----- 3 files changed, 72 insertions(+), 23 deletions(-) diff --git a/target/arm/helper-a64.h b/target/arm/helper-a64.h index ff56807247..79d06e820a 100644 --- a/target/arm/helper-a64.h +++ b/target/arm/helper-a64.h @@ -90,9 +90,13 @@ DEF_HELPER_FLAGS_3(pacda, TCG_CALL_NO_WG, i64, env, i64,= i64) DEF_HELPER_FLAGS_3(pacdb, TCG_CALL_NO_WG, i64, env, i64, i64) DEF_HELPER_FLAGS_3(pacga, TCG_CALL_NO_WG, i64, env, i64, i64) DEF_HELPER_FLAGS_3(autia, TCG_CALL_NO_WG, i64, env, i64, i64) +DEF_HELPER_FLAGS_3(autia_combined, TCG_CALL_NO_WG, i64, env, i64, i64) DEF_HELPER_FLAGS_3(autib, TCG_CALL_NO_WG, i64, env, i64, i64) +DEF_HELPER_FLAGS_3(autib_combined, TCG_CALL_NO_WG, i64, env, i64, i64) DEF_HELPER_FLAGS_3(autda, TCG_CALL_NO_WG, i64, env, i64, i64) +DEF_HELPER_FLAGS_3(autda_combined, TCG_CALL_NO_WG, i64, env, i64, i64) DEF_HELPER_FLAGS_3(autdb, TCG_CALL_NO_WG, i64, env, i64, i64) +DEF_HELPER_FLAGS_3(autdb_combined, TCG_CALL_NO_WG, i64, env, i64, i64) DEF_HELPER_FLAGS_2(xpaci, TCG_CALL_NO_RWG_SE, i64, env, i64) DEF_HELPER_FLAGS_2(xpacd, TCG_CALL_NO_RWG_SE, i64, env, i64) =20 diff --git a/target/arm/tcg/pauth_helper.c b/target/arm/tcg/pauth_helper.c index 1148a21ce6..90ad6453e5 100644 --- a/target/arm/tcg/pauth_helper.c +++ b/target/arm/tcg/pauth_helper.c @@ -412,7 +412,8 @@ uint64_t pauth_ptr_mask(CPUARMState *env, uint64_t ptr,= bool data) } =20 static uint64_t pauth_auth(CPUARMState *env, uint64_t ptr, uint64_t modifi= er, - ARMPACKey *key, bool data, int keynumber) + ARMPACKey *key, bool data, int keynumber, + uintptr_t ra, bool is_combined) { ARMCPU *cpu =3D env_archcpu(env); ARMMMUIdx mmu_idx =3D arm_stage1_mmu_idx(env); @@ -534,44 +535,88 @@ uint64_t HELPER(pacga)(CPUARMState *env, uint64_t x, = uint64_t y) return pac & 0xffffffff00000000ull; } =20 -uint64_t HELPER(autia)(CPUARMState *env, uint64_t x, uint64_t y) +static uint64_t pauth_autia(CPUARMState *env, uint64_t x, uint64_t y, + uintptr_t ra, bool is_combined) { int el =3D arm_current_el(env); if (!pauth_key_enabled(env, el, SCTLR_EnIA)) { return x; } - pauth_check_trap(env, el, GETPC()); - return pauth_auth(env, x, y, &env->keys.apia, false, 0); + pauth_check_trap(env, el, ra); + return pauth_auth(env, x, y, &env->keys.apia, false, 0, ra, is_combine= d); } =20 -uint64_t HELPER(autib)(CPUARMState *env, uint64_t x, uint64_t y) +uint64_t HELPER(autia)(CPUARMState *env, uint64_t x, uint64_t y) +{ + return pauth_autia(env, x, y, GETPC(), false); +} + +uint64_t HELPER(autia_combined)(CPUARMState *env, uint64_t x, uint64_t y) +{ + return pauth_autia(env, x, y, GETPC(), true); +} + +static uint64_t pauth_autib(CPUARMState *env, uint64_t x, uint64_t y, + uintptr_t ra, bool is_combined) { int el =3D arm_current_el(env); if (!pauth_key_enabled(env, el, SCTLR_EnIB)) { return x; } - pauth_check_trap(env, el, GETPC()); - return pauth_auth(env, x, y, &env->keys.apib, false, 1); + pauth_check_trap(env, el, ra); + return pauth_auth(env, x, y, &env->keys.apib, false, 1, ra, is_combine= d); } =20 -uint64_t HELPER(autda)(CPUARMState *env, uint64_t x, uint64_t y) +uint64_t HELPER(autib)(CPUARMState *env, uint64_t x, uint64_t y) +{ + return pauth_autib(env, x, y, GETPC(), false); +} + +uint64_t HELPER(autib_combined)(CPUARMState *env, uint64_t x, uint64_t y) +{ + return pauth_autib(env, x, y, GETPC(), true); +} + +static uint64_t pauth_autda(CPUARMState *env, uint64_t x, uint64_t y, + uintptr_t ra, bool is_combined) { int el =3D arm_current_el(env); if (!pauth_key_enabled(env, el, SCTLR_EnDA)) { return x; } - pauth_check_trap(env, el, GETPC()); - return pauth_auth(env, x, y, &env->keys.apda, true, 0); + pauth_check_trap(env, el, ra); + return pauth_auth(env, x, y, &env->keys.apda, true, 0, ra, is_combined= ); } =20 -uint64_t HELPER(autdb)(CPUARMState *env, uint64_t x, uint64_t y) +uint64_t HELPER(autda)(CPUARMState *env, uint64_t x, uint64_t y) +{ + return pauth_autda(env, x, y, GETPC(), false); +} + +uint64_t HELPER(autda_combined)(CPUARMState *env, uint64_t x, uint64_t y) +{ + return pauth_autda(env, x, y, GETPC(), true); +} + +static uint64_t pauth_autdb(CPUARMState *env, uint64_t x, uint64_t y, + uintptr_t ra, bool is_combined) { int el =3D arm_current_el(env); if (!pauth_key_enabled(env, el, SCTLR_EnDB)) { return x; } - pauth_check_trap(env, el, GETPC()); - return pauth_auth(env, x, y, &env->keys.apdb, true, 1); + pauth_check_trap(env, el, ra); + return pauth_auth(env, x, y, &env->keys.apdb, true, 1, ra, is_combined= ); +} + +uint64_t HELPER(autdb)(CPUARMState *env, uint64_t x, uint64_t y) +{ + return pauth_autdb(env, x, y, GETPC(), false); +} + +uint64_t HELPER(autdb_combined)(CPUARMState *env, uint64_t x, uint64_t y) +{ + return pauth_autdb(env, x, y, GETPC(), true); } =20 uint64_t HELPER(xpaci)(CPUARMState *env, uint64_t a) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index dff391bfe2..8da83664a7 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -2232,9 +2232,9 @@ static void disas_uncond_b_reg(DisasContext *s, uint3= 2_t insn) if (s->pauth_active) { dst =3D tcg_temp_new_i64(); if (op3 =3D=3D 2) { - gen_helper_autia(dst, cpu_env, cpu_reg(s, rn), modifie= r); + gen_helper_autia_combined(dst, cpu_env, cpu_reg(s, rn)= , modifier); } else { - gen_helper_autib(dst, cpu_env, cpu_reg(s, rn), modifie= r); + gen_helper_autib_combined(dst, cpu_env, cpu_reg(s, rn)= , modifier); } } else { dst =3D cpu_reg(s, rn); @@ -2270,9 +2270,9 @@ static void disas_uncond_b_reg(DisasContext *s, uint3= 2_t insn) dst =3D tcg_temp_new_i64(); modifier =3D cpu_reg_sp(s, op4); if (op3 =3D=3D 2) { - gen_helper_autia(dst, cpu_env, cpu_reg(s, rn), modifier); + gen_helper_autia_combined(dst, cpu_env, cpu_reg(s, rn), mo= difier); } else { - gen_helper_autib(dst, cpu_env, cpu_reg(s, rn), modifier); + gen_helper_autib_combined(dst, cpu_env, cpu_reg(s, rn), mo= difier); } } else { dst =3D cpu_reg(s, rn); @@ -2327,9 +2327,9 @@ static void disas_uncond_b_reg(DisasContext *s, uint3= 2_t insn) if (s->pauth_active) { modifier =3D cpu_X[31]; if (op3 =3D=3D 2) { - gen_helper_autia(dst, cpu_env, dst, modifier); + gen_helper_autia_combined(dst, cpu_env, dst, modifier); } else { - gen_helper_autib(dst, cpu_env, dst, modifier); + gen_helper_autib_combined(dst, cpu_env, dst, modifier); } } break; @@ -3479,11 +3479,11 @@ static void disas_ldst_pac(DisasContext *s, uint32_= t insn, =20 if (s->pauth_active) { if (use_key_a) { - gen_helper_autda(dirty_addr, cpu_env, dirty_addr, - tcg_constant_i64(0)); + gen_helper_autda_combined(dirty_addr, cpu_env, dirty_addr, + tcg_constant_i64(0)); } else { - gen_helper_autdb(dirty_addr, cpu_env, dirty_addr, - tcg_constant_i64(0)); + gen_helper_autdb_combined(dirty_addr, cpu_env, dirty_addr, + tcg_constant_i64(0)); } } =20 --=20 2.25.1 From nobody Thu May 2 12:58:46 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=os.amperecomputing.com); dmarc=pass(p=quarantine dis=none) header.from=os.amperecomputing.com ARC-Seal: i=2; a=rsa-sha256; t=1679516846; cv=pass; d=zohomail.com; s=zohoarc; b=WkZMG6UNe+ZZNzV5p8C1VKnyIaR/1yNkEjLcBwKm4km9M/I6mLgWhuFgh9BtHbeZsaYc4hel+tB4rJiEr4mF4GdR50BIr3wNz/0DOE3og1Vb27tAUvp+FgSyAZXC0U6WkoOyNYh9ntZNWN1ih/1gT8W51HzeEkwQDS4kzSYVIJ8= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1679516846; 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=U2ZfgdN8+zYvoOSje9XTIhRJCOB6L8pzpI0E8ObLWmQ=; b=WvZIIq1OP61e3QFr11VwuLFh+pBHZTSG491MqKaipziZCuviMQUhO4VPQcPb5yxWl79xWUXJQ63xEVeYH/Wk5hHA+A8IFbI/qmectMfIeJdLV8pGoYRsgUsPO85dr3nwljLtMrqHjQBYDb2EYKkX3Ua1+RE+x2u8PK0wvFGtQCw= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=os.amperecomputing.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1679516846750123.30944718892545; Wed, 22 Mar 2023 13:27:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pf52U-0001gd-Sx; Wed, 22 Mar 2023 16:26:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pf52S-0001g5-BU; Wed, 22 Mar 2023 16:26:28 -0400 Received: from mail-bn7nam10on20707.outbound.protection.outlook.com ([2a01:111:f400:7e8a::707] helo=NAM10-BN7-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pf52Q-0004xk-MH; Wed, 22 Mar 2023 16:26:28 -0400 Received: from CH0PR01MB7124.prod.exchangelabs.com (2603:10b6:610:f3::20) by SA1PR01MB7342.prod.exchangelabs.com (2603:10b6:806:1f5::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.8; Wed, 22 Mar 2023 20:26:20 +0000 Received: from CH0PR01MB7124.prod.exchangelabs.com ([fe80::cf62:d511:8228:b39c]) by CH0PR01MB7124.prod.exchangelabs.com ([fe80::cf62:d511:8228:b39c%8]) with mapi id 15.20.6222.010; Wed, 22 Mar 2023 20:26:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IhSnxoK0HTi1+RaPFwtoXWaVgn/A6gzWydAYIt55IfD1xFome+pjQ5knjfhfGEZLi1XSVF9GDoEpVU6BpX8QD68HZjW0Mp/qNMiLS4WlxIJwtMfvtWKgGw7j4oFrbVN0vBLh5qs9QjM9V/9sLDhTZ0zp37wPGro6k0zHmn56hqug4CXz1c4LWhfF7O+gi8AexOOqxEoQGkBiAMVStbH3oG56dVYBINVUE76HGd/AlEFQFXEim1lxXL8VYC0emXmMNIT38VSniJHpMK3sLq96Az7ehzEtXNTZYUJcnY0doIdtsEMMWw3Kvxxm3S9YKc4//pkLzLjNYFQS3B+JORtpVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=U2ZfgdN8+zYvoOSje9XTIhRJCOB6L8pzpI0E8ObLWmQ=; b=O3Ig1uTSy5eq9rz1B5G16YzNP3QR7o7P2layUxCZnLI+wZvp2/IqBDQ/ZSXhWDBdbqu3cG2Ct3mz15S41XeOWalmHlRUMwm4vQaMD2YvGxsV888/2cHY3Hb+k3CMAyUK7ahImC2ePRPZRu61LUn9o2Iv5wyjK8cm6vyoz5Lg5nPfEf8ok4lx18m4a0HhKQzFDJYv+f48cuHVUyO6mavmG9o68TLm3xC68SXrFHaLYf8h7PKpwNEWbXxGxtOTiXq7xoXv51kML7tX8T0JBXkPKymnPP2pv7fcRPF5BIgaZ0X12kDP5mSv2t+lpHQc1qNR209M5+JAV23vJkZ7prLIOA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=U2ZfgdN8+zYvoOSje9XTIhRJCOB6L8pzpI0E8ObLWmQ=; b=EaDlm3bDrHESjm/rDFdIkABdAlgruVap3y/QkhbQ9hYE1t6iOKbCgBTXoZEZ0MCc4M0uax6JQHVIECXgKAuC/gg+Q20LDykBy6lGMIHPDFTSy/98GoLjPRWaf/p4QKc5/UndH7eh15yyJxNizOSyRJmtCf8nM8L+ev5p60CbgXY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; From: Aaron Lindsay To: qemu-devel@nongnu.org, qemu-arm@nongnu.org, Richard Henderson , Vincent Dehors , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Peter Maydell Cc: Aaron Lindsay Subject: [PATCH v3 7/8] target/arm: Implement v8.3 FPAC and FPACCOMBINE Date: Wed, 22 Mar 2023 16:25:40 -0400 Message-Id: <20230322202541.1404058-8-aaron@os.amperecomputing.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230322202541.1404058-1-aaron@os.amperecomputing.com> References: <20230322202541.1404058-1-aaron@os.amperecomputing.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: CH2PR03CA0008.namprd03.prod.outlook.com (2603:10b6:610:59::18) To CH0PR01MB7124.prod.exchangelabs.com (2603:10b6:610:f3::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR01MB7124:EE_|SA1PR01MB7342:EE_ X-MS-Office365-Filtering-Correlation-Id: 6c4de457-507e-4b0f-f24b-08db2b13b2b0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xfl/7RHAjFkbKP/RIIO+AbvCxlU7UT4LZeVKUMBLQp3mIMr/DJo626vDqXDhyzhlVqhqDa8j71H58kCeEyf8jJYMThZHc2RkGKQwmvjy5hUOIR8w78j7Q7p+lL6Zr54EcLyMMyCadK5esgDGuLfk5b15mSmewYv7E1u/PnKQKxao4aIc3gQo8Z7HwoYg48igqo6od4XPtF68QDRH2N12M6qtNvZLWUdPbrhAp4SSMttC50oWfn50d6AltJPElg+1kL9fzN4lC3Fn3/6tneS1z89YVblgloFlmZnOPJ11c3IklWlT4BbRXmvhuQeq7Q7LDy3D4x0ZKfZBmsueun8UMDIYHMFGJWHpb3n8LXbNisWlRMeSeqReKU+huPklQFIkSrQ3BHGwFczSoN9SfQgmaBA7/HZQeXmIe8MwasMk6YyAR0oLP9QNyFGjN2OfutiyWJUzCOozKjBASfBts5z3PWM2m0yyhV60UYR2t9HiTatrQtH+m3fVDZGBlW6FS0iD6pIr1xUD/3YRb275iU+DwkKqCBWiGdWQEbBAtvS6LUCfr79+l1qLhs6L7JS8m4yBt910xc7sCMxF1xY3N3nk4yt13lQKc9YaqxrtycOJ3cVjO3sTdh0T3Vu89wPEu7AGuGPD9I8Zbbati429CoqaBuMJmpFFbzVLjIE8tqJT5Fgyb3hYxYMfJo2Sc76v1Rb5iBJtlaT4DRXQLAQZsSdkLw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH0PR01MB7124.prod.exchangelabs.com; PTR:; CAT:NONE; SFS:(13230025)(4636009)(346002)(136003)(366004)(396003)(376002)(39850400004)(451199018)(83380400001)(38350700002)(6486002)(186003)(6506007)(86362001)(26005)(6512007)(2616005)(1076003)(38100700002)(6666004)(107886003)(5660300002)(4326008)(52116002)(66476007)(41300700001)(110136005)(66946007)(478600001)(8936002)(2906002)(8676002)(316002)(66556008); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?f/VCFi64ewsaIGUyl9aU4qB26O3UgD7GFg+U50oWMvgVdO85bCtBDC8jpS+2?= =?us-ascii?Q?bt9kYKNIFh1fJelKdLqSVENnm9UW/7skgRgSAY9ORmdr6M138mlx0vvwMSHm?= =?us-ascii?Q?+mMyTYhJik2lU4WMK5Ep83zrihwGh/35QwtZhYOp0a9z3BA69BwhrIDPVcOr?= =?us-ascii?Q?8XeCWttvDV2//LZfNvfkCNoMDaG58MW7U2oNdcUz+5XDM55mHSir/m+3UGwP?= =?us-ascii?Q?LPPyJx368q7qVcxDQ8Z1JkvuakWWbwADj4M8NEcQXwZPZi3rvNI0ylrjCuIc?= =?us-ascii?Q?6qe5qSCmiUTmNNYL5vDNeNaRt3kOnrJyijZRBUO1b4rRzp8CtRr1Jho3xcSL?= =?us-ascii?Q?atvq4BMjAEiFfd/509Ac6AoyBlDsryxWCY8Uuxv4/NuhVmpE8dtIDI2cr/NO?= =?us-ascii?Q?9rZRrSAFalwwlisHfOQdbDKGu4PBRpUytKGtx58kRx9rqIudCXsT/FkAzjoK?= =?us-ascii?Q?1ng+wbNhnegxlwbITTdjcOcsId80jwtBX0kbQ0Jp/HMfZFXSdRFxIMgr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komng79uYFAPjr5OyrvCrFNdvCx4840tUVuDB68?= =?us-ascii?Q?NgOKgc3m/A0ln3XPRHBwdjIy25Avu8TQlrCil+s2GYnt7y5xuytP7WKi3Lxo?= =?us-ascii?Q?IvuKXiD1o/iCMtMAji8oZXkeiEnzTbSupAzTUHspTDLoHSbmBkDNTDsn6o8B?= =?us-ascii?Q?qUyPZMjlP1tIkQeiWU1sZdqsZ+UXa8DjcaH6ugSQuVw6UNizQx2Hn+uF8dAv?= =?us-ascii?Q?WiGQe+2QLBTcddomeyhwFqA=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6c4de457-507e-4b0f-f24b-08db2b13b2b0 X-MS-Exchange-CrossTenant-AuthSource: CH0PR01MB7124.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Mar 2023 20:26:20.7383 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: nUGBxtBXpjJwg8YpPwDrfnGRClnXksdeDXB3sdqMj9BSCni4rwKnllTGpy03UD+dGtMA0K7fHnYCzSH3W+U+z8T0Q7PdTRhi9gWK7+R0qO8UBnz8JW8WtLLGcIY4HuoW X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR01MB7342 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a01:111:f400:7e8a::707; envelope-from=aaron@os.amperecomputing.com; helo=NAM10-BN7-obe.outbound.protection.outlook.com X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham 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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @os.amperecomputing.com) X-ZM-MESSAGEID: 1679516848576100011 Content-Type: text/plain; charset="utf-8" Signed-off-by: Aaron Lindsay --- target/arm/syndrome.h | 7 +++++++ target/arm/tcg/pauth_helper.c | 16 ++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/target/arm/syndrome.h b/target/arm/syndrome.h index d27d1bc31f..bf79c539d9 100644 --- a/target/arm/syndrome.h +++ b/target/arm/syndrome.h @@ -49,6 +49,7 @@ enum arm_exception_class { EC_SYSTEMREGISTERTRAP =3D 0x18, EC_SVEACCESSTRAP =3D 0x19, EC_ERETTRAP =3D 0x1a, + EC_PACFAIL =3D 0x1c, EC_SMETRAP =3D 0x1d, EC_INSNABORT =3D 0x20, EC_INSNABORT_SAME_EL =3D 0x21, @@ -231,6 +232,12 @@ static inline uint32_t syn_smetrap(SMEExceptionType et= ype, bool is_16bit) | (is_16bit ? 0 : ARM_EL_IL) | etype; } =20 +static inline uint32_t syn_pacfail(bool data, int keynumber) +{ + int error_code =3D (data << 1) | keynumber; + return (EC_PACFAIL << ARM_EL_EC_SHIFT) | ARM_EL_IL | error_code; +} + static inline uint32_t syn_pactrap(void) { return EC_PACTRAP << ARM_EL_EC_SHIFT; diff --git a/target/arm/tcg/pauth_helper.c b/target/arm/tcg/pauth_helper.c index 90ad6453e5..bb3dc7ff54 100644 --- a/target/arm/tcg/pauth_helper.c +++ b/target/arm/tcg/pauth_helper.c @@ -411,6 +411,13 @@ uint64_t pauth_ptr_mask(CPUARMState *env, uint64_t ptr= , bool data) return pauth_ptr_mask_internal(param); } =20 +static G_NORETURN +void pauth_fail_exception(CPUARMState *env, bool data, int keynumber, uint= ptr_t ra) +{ + int target_el =3D exception_target_el(env); + raise_exception_ra(env, EXCP_UDEF, syn_pacfail(data, keynumber), targe= t_el, ra); +} + static uint64_t pauth_auth(CPUARMState *env, uint64_t ptr, uint64_t modifi= er, ARMPACKey *key, bool data, int keynumber, uintptr_t ra, bool is_combined) @@ -430,6 +437,15 @@ static uint64_t pauth_auth(CPUARMState *env, uint64_t = ptr, uint64_t modifier, uint64_t xor_mask =3D MAKE_64BIT_MASK(bot_bit, top_bit - bot_bit += 1) & ~MAKE_64BIT_MASK(55, 1); result =3D ptr ^ (pac & xor_mask); + if (cpu_isar_feature(aa64_fpac_combine, cpu) + || (cpu_isar_feature(aa64_fpac, cpu) && !is_combined)) { + int fpac_top =3D param.tbi ? 55 : 64; + uint64_t fpac_mask =3D MAKE_64BIT_MASK(bot_bit, fpac_top - bot= _bit); + test =3D (result ^ sextract64(result, 55, 1)) & fpac_mask; + if (unlikely(test)) { + pauth_fail_exception(env, data, keynumber, ra); + } + } } else { test =3D (pac ^ ptr) & ~MAKE_64BIT_MASK(55, 1); if (unlikely(extract64(test, bot_bit, top_bit - bot_bit))) { --=20 2.25.1 From nobody Thu May 2 12:58:46 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=os.amperecomputing.com); dmarc=pass(p=quarantine dis=none) header.from=os.amperecomputing.com ARC-Seal: i=2; a=rsa-sha256; t=1679516879; cv=pass; d=zohomail.com; s=zohoarc; b=eTBrekgf+7DqKda8SZb8ClYgYjvmRpR7cyRLzyBWwjU8sR/MnI/d+xvvkI3mE+2G2jLdS/L4ESOwLqauTlcZkUjR89luQ0/SU7UfcssF+9GAr+IqPMnuXXdXNUzusg0Vkdv6YXqiZMitPUnfM2dpcN+Xa5yORgLL8HkfFXXx8ic= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1679516879; 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=rQg4ICfwAhtvzfCWmDWPTHMw0PD4ZTDTP9tnV0MQv3I=; b=XG3vXO+6Fcfh9c2V4NCPS0frFePEFTAc2qj/hO6/NWpR1ZY0QDVuM4kzGoTUZ2XOtnE3s0AaWMakxnyUtK7g6XLryJrPNXHjYGBrXmhBDBJteUWL/13xaqiPGtWR+Wo0/VhHqKTPZ6wML0sELfcpEyIaYDtGjqttZ7aJYtSqy1I= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=os.amperecomputing.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1679516879472143.99382531388858; Wed, 22 Mar 2023 13:27:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pf52W-0001hE-1R; Wed, 22 Mar 2023 16:26:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pf52U-0001gU-GH; Wed, 22 Mar 2023 16:26:30 -0400 Received: from mail-bn7nam10on20707.outbound.protection.outlook.com ([2a01:111:f400:7e8a::707] helo=NAM10-BN7-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pf52S-0004xk-V2; Wed, 22 Mar 2023 16:26:30 -0400 Received: from CH0PR01MB7124.prod.exchangelabs.com (2603:10b6:610:f3::20) by SA1PR01MB7342.prod.exchangelabs.com (2603:10b6:806:1f5::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.8; Wed, 22 Mar 2023 20:26:21 +0000 Received: from CH0PR01MB7124.prod.exchangelabs.com ([fe80::cf62:d511:8228:b39c]) by CH0PR01MB7124.prod.exchangelabs.com ([fe80::cf62:d511:8228:b39c%8]) with mapi id 15.20.6222.010; Wed, 22 Mar 2023 20:26:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NjtfB96b4rNcNBAZlxD4LtcdDJ1ej0q2BsHw8s/nNQPKaBK8EurtfONVLTPg2RosqN0282c43HSK2OBbCkE2cQ3DxC+J7ZCr5MjeXiwA3ksALqU/a/GBKr2RQeAzInGw63SaIniHhFrgJNO881fzbnQHIh3PzGuezOTmf4DuaQr2kBlxiEWfCtXEy8X81vl5qWFGoxwxl1VCecjCxy76VD57QmyCO6wyUlQW3ait6ADZLU/2pAD/VuPevopNwQxHrmm9by6bFumqCtzGmnsmlr9AnJt3YgmST9GPPu2Kyr3ZDKf5QFHVwJSEkU15f1i7LTSUKJBz0nnGr4jsx3j1lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=rQg4ICfwAhtvzfCWmDWPTHMw0PD4ZTDTP9tnV0MQv3I=; b=SoC0iEZPJ9Y4fOoK5aACQfwGJ1od52IzQ+6ysl/ybonS07SUT5X70Fo5tlIwpQyYy1QMDeJooctLNb7FlKbLuZAt1Sp3CM+8my++uc8EMuIv+/r7jld/mIvYIpOemcDeMPEpPQ9+J4WVhLydX2PVol8iRq1QXMMdjb6ptnq3EaNr5A8rW4b8M7JdmNeQo+2vSc/ng0M/+QTysWq/Vc7PpLSK2JpiobM667RJFYSOnlx6VaUVEerb8BPsmCvKD/+P/A//LXhu9XZ64+eGBl++oNUQ1DLvn14NcT/buLPWUdcudj3g3D8dXcPWQ0o9bnlMH3+oOInxSgiaPvuasCFcuA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rQg4ICfwAhtvzfCWmDWPTHMw0PD4ZTDTP9tnV0MQv3I=; b=TkzZqSCulyLeTr11eDZKB5JCEf/yvnw7Pm785Ab2vyKj7qXh7/0UVra1knMS1y5fm+1vLlFR4UI2bNUdfjOl7vvXbx70+6Yy4a/lJLnLPfeL3wug/fbxId7MwQo5Rmv9lcFlAfXrOXPBg7TvX6wU7fx0nbTxLbBHnEv3B1AriqE= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; From: Aaron Lindsay To: qemu-devel@nongnu.org, qemu-arm@nongnu.org, Richard Henderson , Vincent Dehors , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Peter Maydell Cc: Aaron Lindsay Subject: [PATCH v3 8/8] target/arm: Add CPU property for QARMA3, enable FPACCombined by default Date: Wed, 22 Mar 2023 16:25:41 -0400 Message-Id: <20230322202541.1404058-9-aaron@os.amperecomputing.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230322202541.1404058-1-aaron@os.amperecomputing.com> References: <20230322202541.1404058-1-aaron@os.amperecomputing.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: CH2PR03CA0008.namprd03.prod.outlook.com (2603:10b6:610:59::18) To CH0PR01MB7124.prod.exchangelabs.com (2603:10b6:610:f3::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR01MB7124:EE_|SA1PR01MB7342:EE_ X-MS-Office365-Filtering-Correlation-Id: c6abfe1c-4d02-45b5-f5b7-08db2b13b35e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IjIo1nsitJUNUim3lWmf1sys44kqYh+A1V6V776xbuyqzJ8R7Zug0dNmuYj/DDrDxMyIpjbghVlclBn9I0roEp3EDiHbZ6gHRFg1WXB2UEyH/BZ7pblyhjc/+47oBd1aDK1IWRFRbXrEXhYvqJ4EkOnkM9VN7cMoT7GbCF2wfY13zq/Av4vkvS3KXHWPkMn1pGxpgXDnSHUuj3WTUvrF2h3YtVuAx0oNCPyhrpldqSJterLidkJhys/a3Rk+F72do2VqD0X67vXyi3K5zaAiAG3r4ZSNvzJ/6BZIxag7d02Af5TENEc9tU4jxJC6tpwBUhcb2qVqqmsgUYeKyRkQCJGK2c6M4QB2jp1AFlUzLFDNHPyNY0K/ReQUh0OHyRWb8VWBPgKev3TgcjgwdyWUBHMR7x0KjR54lgXtc1lOf3qHLe6HbNhAXP+NDwde1eq3gruPSoL5/GeS25i47CI4w33jjyk8PezB0lZwwzZtRUe/sHu1if4nOe9kHUoeHF9OZCNzTMpa7GrHCUtzMAEB9vefX0a/9zJtKweK0k/tUTVcbhTFKmMh07fGTGGTKMFOfkV3ITuTAvsGFtpZCLkm58isTBOwJSZJYQ1L19/EdVGjAKktk2RQo0VtIb+LDVEiktM97c8VGJs7oG6XI7j8i2N78IxLo/HRyA9FwZI9UjcpniTxe+1wyPV2+QJ69RKHIkrDnZKNTGwummR7U1SyeA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH0PR01MB7124.prod.exchangelabs.com; PTR:; CAT:NONE; SFS:(13230025)(4636009)(346002)(136003)(366004)(396003)(376002)(39850400004)(451199018)(83380400001)(38350700002)(6486002)(186003)(6506007)(86362001)(26005)(6512007)(2616005)(1076003)(38100700002)(6666004)(107886003)(5660300002)(4326008)(52116002)(66476007)(41300700001)(110136005)(66946007)(478600001)(8936002)(2906002)(8676002)(316002)(66556008); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?jPH5uu6lG1FU51SNr9pkhP/xvVcDGhBnlteApXiE9F/Po8y8Y6SGVhYHHMTQ?= =?us-ascii?Q?Cr8wQ6xknQd6fMRHu0ecOPVspE/uRC9LoTbcwFNCjqSaH2k/727gfh0+3wuu?= =?us-ascii?Q?kgZ/qUyrnM6nCj10aig1iNTH6bk9hMeq8Rh9l93LznucsVL1BeLb4mqp0iJQ?= =?us-ascii?Q?x93mRrOAK7bT0QlmUlEdjWVziISBi9FvnZUrI01Pxa/aXJ9uB7WwevVFqlha?= =?us-ascii?Q?70DW4X4ZFqNCZcXIoJ+GyM7n/PXCMAZtVdH3BsKgE4WPaCUmMuV7ZCt01qn3?= =?us-ascii?Q?X3363JSfMKaXaOVA9Sex4bVYakc0tUOQx/VB0zFiToiwHtMh/SyUHW+i62U0?= =?us-ascii?Q?ofkKvrNFgNMg0Uy5RnO97G0lswK8ifRFKSC4fGbfIP6a0/twrJVfU4gPkl7D?= =?us-ascii?Q?PJdDCi6sBFS9GDp8yhYvGzOSxKRwwc+AQvqkV+ntY0xk25hDcwPhI3TwaZUf?= =?us-ascii?Q?ozt6EWr2vS9VC03du5xttnGEqivsb7Vs2oP7E7l1Sq3Wq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oc3efeL1Tborbh10u/sS8/qSBZyCXFzN7flgHxCm1XUYuEqavks?= =?us-ascii?Q?SZ+G+LuaJsDOeYmdTGcoxqLkDSkltc0LkoxMMt1hP+IiDHMNM2b+l7iC7mcd?= =?us-ascii?Q?NUiLsLqKVzjc0jM8v1UBhiIp3Lg3QGlxPp+9ZpjNtXt/fNvHaakGkK7YG3JM?= =?us-ascii?Q?BRI/sw7XmyB02QUJxtFhWrXxNCu3IurOFx8qPChvUTxr2gjfnVOMTRlQhMI3?= =?us-ascii?Q?7WAj8CzegUMRgL5j6ygabKY=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: c6abfe1c-4d02-45b5-f5b7-08db2b13b35e X-MS-Exchange-CrossTenant-AuthSource: CH0PR01MB7124.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Mar 2023 20:26:21.8217 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: EcMZ4thfUNB8noEB6zsmvFoLk/8VEUEcw8LY/1xuF31gSlO+tzbkTJxOg8Hne3fZ5T5AnMcy4Hu7zmSkX6CgMgbvtTJ5UN70cMAa3j5/U/kOFhFS8fo4v6jyVqeTNgvf X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR01MB7342 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a01:111:f400:7e8a::707; envelope-from=aaron@os.amperecomputing.com; helo=NAM10-BN7-obe.outbound.protection.outlook.com X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham 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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @os.amperecomputing.com) X-ZM-MESSAGEID: 1679516880775100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Aaron Lindsay --- target/arm/cpu.h | 1 + target/arm/cpu64.c | 48 +++++++++++++++++++++++++++++++--------------- 2 files changed, 34 insertions(+), 15 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 868d844d5a..80683c428f 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -1053,6 +1053,7 @@ struct ArchCPU { */ bool prop_pauth; bool prop_pauth_impdef; + bool prop_pauth_qarma3; bool prop_lpa2; =20 /* DCZ blocksize, in log_2(words), ie low 4 bits of DCZID_EL0 */ diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index 0fb07cc7b6..a5f4540c73 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -591,9 +591,6 @@ static void aarch64_add_sme_properties(Object *obj) =20 void arm_cpu_pauth_finalize(ARMCPU *cpu, Error **errp) { - int arch_val =3D 0, impdef_val =3D 0; - uint64_t t; - /* Exit early if PAuth is enabled, and fall through to disable it */ if ((kvm_enabled() || hvf_enabled()) && cpu->prop_pauth) { if (!cpu_isar_feature(aa64_pauth, cpu)) { @@ -604,30 +601,50 @@ void arm_cpu_pauth_finalize(ARMCPU *cpu, Error **errp) return; } =20 - /* TODO: Handle HaveEnhancedPAC, HaveEnhancedPAC2, HaveFPAC. */ + /* Write the features into the correct field for the algorithm in use = */ if (cpu->prop_pauth) { + uint64_t t; + + if (cpu->prop_pauth_impdef && cpu->prop_pauth_qarma3) { + error_setg(errp, "Cannot set both qarma3 ('pauth-qarma3') and " + "impdef ('pauth-impdef') pointer authentication cipher= s"); + return; + } + + /* Implement FEAT_FPACCOMBINE for address authentication and enable + * generic authentication for the chosen cipher. + */ + int address_auth =3D 0b0101; + int generic_auth =3D 0b0001; + if (cpu->prop_pauth_impdef) { - impdef_val =3D 1; + t =3D cpu->isar.id_aa64isar1; + t =3D FIELD_DP64(t, ID_AA64ISAR1, API, address_auth); + t =3D FIELD_DP64(t, ID_AA64ISAR1, GPI, generic_auth); + cpu->isar.id_aa64isar1 =3D t; + } else if (cpu->prop_pauth_qarma3) { + t =3D cpu->isar.id_aa64isar2; + t =3D FIELD_DP64(t, ID_AA64ISAR2, APA3, address_auth); + t =3D FIELD_DP64(t, ID_AA64ISAR2, GPA3, generic_auth); + cpu->isar.id_aa64isar2 =3D t; } else { - arch_val =3D 1; + t =3D cpu->isar.id_aa64isar1; + t =3D FIELD_DP64(t, ID_AA64ISAR1, APA, address_auth); + t =3D FIELD_DP64(t, ID_AA64ISAR1, GPA, generic_auth); + cpu->isar.id_aa64isar1 =3D t; } - } else if (cpu->prop_pauth_impdef) { - error_setg(errp, "cannot enable pauth-impdef without pauth"); + } else if (cpu->prop_pauth_impdef || cpu->prop_pauth_qarma3) { + error_setg(errp, "cannot enable pauth-impdef or pauth-qarma3 witho= ut pauth"); error_append_hint(errp, "Add pauth=3Don to the CPU property list.\= n"); } - - t =3D cpu->isar.id_aa64isar1; - t =3D FIELD_DP64(t, ID_AA64ISAR1, APA, arch_val); - t =3D FIELD_DP64(t, ID_AA64ISAR1, GPA, arch_val); - t =3D FIELD_DP64(t, ID_AA64ISAR1, API, impdef_val); - t =3D FIELD_DP64(t, ID_AA64ISAR1, GPI, impdef_val); - cpu->isar.id_aa64isar1 =3D t; } =20 static Property arm_cpu_pauth_property =3D DEFINE_PROP_BOOL("pauth", ARMCPU, prop_pauth, true); static Property arm_cpu_pauth_impdef_property =3D DEFINE_PROP_BOOL("pauth-impdef", ARMCPU, prop_pauth_impdef, false); +static Property arm_cpu_pauth_qarma3_property =3D + DEFINE_PROP_BOOL("pauth-qarma3", ARMCPU, prop_pauth_qarma3, false); =20 static void aarch64_add_pauth_properties(Object *obj) { @@ -647,6 +664,7 @@ static void aarch64_add_pauth_properties(Object *obj) cpu->prop_pauth =3D cpu_isar_feature(aa64_pauth, cpu); } else { qdev_property_add_static(DEVICE(obj), &arm_cpu_pauth_impdef_proper= ty); + qdev_property_add_static(DEVICE(obj), &arm_cpu_pauth_qarma3_proper= ty); } } =20 --=20 2.25.1