From patchwork Wed Mar 22 20:25:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Lindsay X-Patchwork-Id: 13184654 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 877EFC6FD1F for ; Wed, 22 Mar 2023 20:27:52 +0000 (UTC) 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 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; 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 From: Aaron Lindsay To: qemu-devel@nongnu.org, qemu-arm@nongnu.org, Richard Henderson , Vincent Dehors , =?utf-8?q?Alex_Benn=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> 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: 4GV5vMOz1Uyltmwjb/sBko7UHf+dN5Vuh6iiZx2FVdkaAGH2huN+4Vl8DM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hwHJ2Vny88M+4t4Cls8TD+sJUKTftAB/Gpf+oWdBkw2GIwj/4QhMojLGNK59cBlYgoSv5cHH4YZZhbz7Efvf7uw9Vso1VvfXMoGhx/DRPzY6BxxBzciVKeWCcH4mboBrBGOvcUVQCL44HG80tR3FIH7Q05CYN1dc7I54mRXPSX4Wq2MNA9YDGVKn5buEUZFAXUNPwHTUWrRhbXupBByv9plsMcoxzafIK3gEoBdA2qr37U983bdypGJC9LDYQDA3eD8kvj03T2swqz8fHBWk7dRIh/sukyxvV5pgq44ZTAnkkscLpGbMUk1ZoDa4mhDQLzmKWjPzZWEXXq+AjGTTtumYaTdXBFFeUO2YLwilFmFumkmi1DtII7GHaqw1xDdAQCRnHn2fHRtHdpyjyZXroGmNxg8xQ/WzGQrIOJRHsOQAKZDlE6SoZaJ3AHBdck6AdjgNZNZsTntuwipFyMkeKH3tNLHLgIPcnfd2m1XaWpUj/esG4= 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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, uint64_t data, static uint64_t pauth_addpac(CPUARMState *env, uint64_t ptr, uint64_t modifier, ARMPACKey *key, bool data) { + ARMCPU *cpu = env_archcpu(env); ARMMMUIdx mmu_idx = arm_stage1_mmu_idx(env); ARMVAParameters param = 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 = sextract64(ptr, bot_bit, top_bit - bot_bit); if (test != 0 && test != -1) { - /* - * Note that our top_bit is one greater than the pseudocode's - * version, hence "- 2" here. - */ - pac ^= MAKE_64BIT_MASK(top_bit - 2, 1); + if (cpu_isar_feature(aa64_pauth_epac, cpu)) { + pac = 0; + } else { + /* + * Note that our top_bit is one greater than the pseudocode's + * version, hence "- 2" here. + */ + pac ^= MAKE_64BIT_MASK(top_bit - 2, 1); + } } /*