From patchwork Sat Jun 15 18:54:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Lugou X-Patchwork-Id: 13699358 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 C7A8CC27C4F for ; Sat, 15 Jun 2024 18:57:46 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sIYZV-00019n-3C; Sat, 15 Jun 2024 14:56:17 -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 1sIYZR-00014s-Th; Sat, 15 Jun 2024 14:56:14 -0400 Received: from mail-mr2fra01on20715.outbound.protection.outlook.com ([2a01:111:f403:261c::715] helo=FRA01-MR2-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 1sIYZQ-00076c-Ac; Sat, 15 Jun 2024 14:56:13 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b9bDZVZsukwDycHc0WTXcrcUWkOpo4xau2KgBAeibwPhvunOYZ+NDTljRLECIO1mByQT74J1oGfPJQMLmVfr3A3AF1DyzK6fpHoeaBEbqe9+YnqFJOEZkamOt3oOEtXEj0eXJdhCk3htEzTruNYMJOELONCUZkCy1QvKKvuYLRVkJtuozXC5IqjIE1hZmyBkyL/LKcDZOhB9YEbZ8jsUeXaWFi1vkfvF9RU/IuO5I7cslpmji0Rkb5P9BuvDTo9CtUziv3y6+1Z3Ogy4XdGlx7oLGZS7f9NTMTvF8mLF12PPO/L4LT30zjGPLsv7CIC1/BGtGzoiKz86NCGZxu7Fvw== 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=dlJSt41gKHiEWb27Af6G6WBrPYOCMEPeGXr67enevB4=; b=alJDlejTxtTbm0MKQ+6vx+LFUHpt4/kw3x6VJenZycVzWiRWIKzIfriyDHo+Esqs+n3Kr2u6DrapRUphqGxOE9IQi08FqS1SIow6jfEZAJ6sTihZa0wKnArksfofrHqNMPaUQwe3TKAheT6taK+brpNcOeGuCnuDROpT8kpaO0fk+uJwRAnfNIhyuocLNXhWQhBLznONzoriVfY6RSuxLISU/KQ0+Sd2IQMlEre5fEyx0aPnf8aLN163ytAYQc14OYzKRhj53ulD4+TYxGecwm8zL70o2BW+ZYkxtVvBYS6ROpv3kouvE0ogcjVtJgKMNhwfQigqzkL3UfhTc9G3XQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=provenrun.com; dmarc=pass action=none header.from=provenrun.com; dkim=pass header.d=provenrun.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=provenrun.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dlJSt41gKHiEWb27Af6G6WBrPYOCMEPeGXr67enevB4=; b=eqBSdkPTlAU6MwFyC2GQRACERg1VPvC8JBBksMjXXtjcFszoNifrD1IdTmukjwhq986fyPOrmmp1EXtuhOGTvAaRby1r8pURfUvcirThTrsoPzZ9zaE/OewMUvvpMYq/x6GGjSlEbUvKwTLkNrLyy21mQvSbDRrZtZrxcb5dxsATa7LE3yEJLpshFHZg2Nn84rjmPkq5iZv/Zs/ScrC5qXswfXetqaHCn1b0YPDD8c3ylhW7CuQk/PAhXinmYyyBy8zRnsZbRyrGM4VZSFMT7FDoJLvcvxcjTCFLRCZPyRs73sfif7eiVXQl9A1Rg6woQH9DQ1Y+VGRycb7SFFJwAg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=provenrun.com; Received: from PAZP264MB2990.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:1f2::18) by MR1P264MB2210.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:15::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.29; Sat, 15 Jun 2024 18:56:06 +0000 Received: from PAZP264MB2990.FRAP264.PROD.OUTLOOK.COM ([fe80::ef1:e8a1:244f:3ca7]) by PAZP264MB2990.FRAP264.PROD.OUTLOOK.COM ([fe80::ef1:e8a1:244f:3ca7%3]) with mapi id 15.20.7677.029; Sat, 15 Jun 2024 18:56:06 +0000 From: Florian Lugou To: qemu-devel@nongnu.org Cc: Florian Lugou , Peter Maydell , qemu-arm@nongnu.org (open list:ARM TCG CPUs) Subject: [PATCH] target/arm/helper: Fix timer interrupt masking when HCR_EL2.E2H == 0 Date: Sat, 15 Jun 2024 20:54:23 +0200 Message-Id: <20240615185423.49474-1-florian.lugou@provenrun.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: LO4P123CA0599.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:295::11) To PAZP264MB2990.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:1f2::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAZP264MB2990:EE_|MR1P264MB2210:EE_ X-MS-Office365-Filtering-Correlation-Id: 4203f982-1c07-44bd-3a47-08dc8d6ccfe5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft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IULlwiu5MhxseM5oxlGyB1KRhrO2DtiRR+wajZ8a+EBkI9d9GPC0TegvJLgqBm4ybeQan88KgxWL3qQdYi1i4nOTkCGxHQ5j/mHf1L0hPmA6yy7Sj3M+oe/p7kk0zcayQVAxoUM7hPPoDGFjuhKhGzWkXGBrG83gtHSSvRZyqlGfRCttNZm+lRnn7D4fNmBbwxIp49os38mY7KbxDa8cIDzHD9yqC6ydKd2Q4ENgFeYYinGe/tfny/6sQXm09Y2oBer184yLkFjNdcdIPkAgtuPeKoZ/Gy/vIFtYeMHkIa6e7yub8NxREcfpw5jkpLsYtNe1wB X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAZP264MB2990.FRAP264.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(13230037)(366013)(52116011)(376011)(1800799021); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: oCP6CVuiDkZ6sjCvF2Sa//DtjBEY2voWHwNdywi8w2iI7NZBMPX49uumtgVZVGDJOudzj2pHiuiH+sIitQJt4jH9XFY+sibFwUT7MSjopY1WGDHB1aaJOzghLeuL6KvAxtN/vE3QmRmhITVdDbOhY7ij1WNM93/HNN8B8vF5m+4CjhKOvo86LrszQ3C/PBdzemfU0EDqucvbSuYfMNRPgMbcssbVfR0fdhLUBvA68r1GTB9edhlWFFwYTdkVJ79KsRU61/1RnHvqzwHA3M3BFGUKGjB2O3Ln/ADv2zEQ4UQxLuvyL+qTlfxUeOwdAV5wavygaNnKIbTzP+GKukHupCzWStXkMIxjvtSd4i64muLioSCncm1YW7+bZZqh8gGUZqvpCJMsB8bHT3Fz0HXPLD/MsOSgu0oqM7MH3CjxBFk0NYBHSeEYIkjmfvc3IoLt1BsYSOy/iaEw8IrB14iHVQ8iFAwKlZAHWLsM29Ha95YoEdQwUPCXYN0uuj3z1vSL9e6o2BZXYvh5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vHMt12x1eOZCELr047Jb3WCpPbuTMTwt6iCBtO50yOUX6C7oHKqCASG79rE3XaVY1th16wyJ1QA== X-OriginatorOrg: provenrun.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4203f982-1c07-44bd-3a47-08dc8d6ccfe5 X-MS-Exchange-CrossTenant-AuthSource: PAZP264MB2990.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2024 18:56:06.4979 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: ff654c30-3eb4-4445-b89f-a54a92b1f03d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: s6xWJ3fnLKEPmSyHMkki5rJazIhRi7ay2rwMWJv4kitQMRBycuQxgIc39JWwxQeQ08ErLidmNbb/hxgJhK0JF5XJFlYZrpKD2NNHeqdq47c= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MR1P264MB2210 Received-SPF: pass client-ip=2a01:111:f403:261c::715; envelope-from=florian.lugou@provenrun.com; helo=FRA01-MR2-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 CNTHCTL_EL2 based masking of timer interrupts was introduced in f6fc36deef6abcee406211f3e2f11ff894b87fa4. This masking was however effective no matter whether EL2 was enabled in the current security state or not, contrary to arm specification. Signed-off-by: Florian Lugou --- target/arm/helper.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index ce31957235..60e2344c68 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -2684,7 +2684,8 @@ static void gt_update_irq(ARMCPU *cpu, int timeridx) * If bit CNTHCTL_EL2.CNT[VP]MASK is set, it overrides IMASK. * It is RES0 in Secure and NonSecure state. */ - if ((ss == ARMSS_Root || ss == ARMSS_Realm) && + if ((arm_hcr_el2_eff(env) & HCR_E2H) && + (ss == ARMSS_Root || ss == ARMSS_Realm) && ((timeridx == GTIMER_VIRT && (cnthctl & R_CNTHCTL_CNTVMASK_MASK)) || (timeridx == GTIMER_PHYS && (cnthctl & R_CNTHCTL_CNTPMASK_MASK)))) { irqstate = 0;