From patchwork Mon Sep 4 11:42:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ganapatrao Kulkarni X-Patchwork-Id: 13373710 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 5C1B4C83F2C for ; Mon, 4 Sep 2023 11:43:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=yc/3CUXrHZmL9sJZB7PvOBTPM0knupIU+bHOdwTdiiU=; b=UD+mUrJCr/9Z53 ytUY37RPK1Dk41SZkYDEIQWOTsmYdw6Ims3GRWmBMjJuSMT36Kz1vVnajSJFKwCyrraN6IESutDsO S1aw8HQNvryFWPeVGfhhWsBJY+n8h3ILAHqIiUM3dcVVohcfkHoDsE66pXdP7+zzqCuC11bZDO0li UUQ9Y2YBK+tMTT6DIqmu8GbIilZZoklXGZDdfsiU2g0+48hSmXHjdq8ye7oijd2jmrrEXSKCZxFKb mFt4QgNQVNqmV/jIyDBepXXG9B3XQhOP26DA8MFcCax9WUV4mlpWEVszk5sgw9qX9pTKraalYGzRo TWfp7kxwDhHYdeHsm34g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qd7yw-0040yB-36; Mon, 04 Sep 2023 11:43:02 +0000 Received: from mail-bn8nam12on20726.outbound.protection.outlook.com ([2a01:111:f400:fe5b::726] helo=NAM12-BN8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qd7yu-0040xZ-17 for linux-arm-kernel@lists.infradead.org; Mon, 04 Sep 2023 11:43:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SNF7NVqDvD4ZtHqdqvKNi27a6xmr1giK+KGpRQeTa6+SBQi41PaMnQUEZoqN7nsQSRdODrkQGvM3d4pJWtEYxCEC9I3mvpj7UWXpNmVFK18tyP95wlC4GqrX7pj/O/uVGxcyp782ykvk7OZcG7II8oosVVfYq4kCgA7NUphst13zCOBixLPZLX0nlHpmp3zgbjsooPP4id+8Qvu9B6HHcJ53wInmKPX5yL+wPOfJBbm6MlU+TQ83VlC0jlBWgecEUMTr5MO1Cm3hWEOyaCkauNGrGNKvJLnh2k+uMty8YbbaYoCAvAqAcvZMc5iluAxSGvbhyfiHo/suXXsF8ZebzQ== 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=eAWHa3Rzkfi0jSRL4txY+3k0+qOfPGWEp0Mmjerpemg=; b=lxzyYniWbBCBUi4HHvhC0GZuNED6d5tr6hkHyk8qDlVZ7Y+kFb8wan0MII/hJMeqejfTDS4aFQHM/yZu+c4FS1W1CVLV2SKEmw3jt7ZPEyH6zFOIBhlbyU0uFfpO+bBj7e1hBeIN+qBzq800/GxOvHTY5RFvOuZBpzQGYbirnoD8p0B+WF1cjy9fuRBvoDPgx63ZCx6PDqPjCHh1d00lX5RUYWb+FxFhzce0X04UAZjYxlE5RPHT9ill6XYlxFz9GLg7olmspE4sHSrbdvU5XrUZwfBySqAdU0PsvNKoXxyIMcak8e3BUkzjGunBgIdY/H2PENrAwfI3l1/UbFfP6Q== 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=eAWHa3Rzkfi0jSRL4txY+3k0+qOfPGWEp0Mmjerpemg=; b=qrU9ShS2pwbn84D+tRkOjSQafbIdheyqf4s2/PmC8t1oS2/8SWEK31nTrXlGY6NR/JnKPMpDKxfcKhRe9+IedjkkQFLujXL5jfPF6GzPxCahuBz3MiljN5kKGgoxaNYJOzjFnZbxzf6HZqr4sKRlXTG15HG4GGyPJFQ22ybUjVA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; Received: from SJ2PR01MB8101.prod.exchangelabs.com (2603:10b6:a03:4f6::10) by SJ2PR01MB8008.prod.exchangelabs.com (2603:10b6:a03:4cb::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.30; Mon, 4 Sep 2023 11:42:43 +0000 Received: from SJ2PR01MB8101.prod.exchangelabs.com ([fe80::460c:bded:60ff:3254]) by SJ2PR01MB8101.prod.exchangelabs.com ([fe80::460c:bded:60ff:3254%7]) with mapi id 15.20.6745.030; Mon, 4 Sep 2023 11:42:42 +0000 From: Ganapatrao Kulkarni To: linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, maz@kernel.org Cc: Christoffer.Dall@arm.com, eauger@redhat.com, miguel.luis@oracle.com, darren@os.amperecomputing.com, scott@os.amperecomputing.com, gankulkarni@os.amperecomputing.com Subject: [PATCH v2 0/2] Avoid spurious ptimer interrupts for non-zero cntpoff Date: Mon, 4 Sep 2023 04:42:16 -0700 Message-Id: <20230904114218.590304-1-gankulkarni@os.amperecomputing.com> X-Mailer: git-send-email 2.38.1 X-ClientProxiedBy: CH2PR16CA0024.namprd16.prod.outlook.com (2603:10b6:610:50::34) To SJ2PR01MB8101.prod.exchangelabs.com (2603:10b6:a03:4f6::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ2PR01MB8101:EE_|SJ2PR01MB8008:EE_ X-MS-Office365-Filtering-Correlation-Id: 1423fa02-af62-4153-7d20-08dbad3c0c74 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9qI2L1+SoqSVQl2DpHwV93d6w7vYxN+0xiwCcaVSJzbgGkk4gETPRv9B4VBvvcqz6elOO4m4It8u7qsk5OhRYbCk9A1Egcm14xBca2qC5bPHaJD+hyz+envLVqrhghNLmrRXMrJU+/3lsMZZ3S/D+BrWNK4iYlp8RsOFWrGpz7dO4c3sJ3pc/Pe5FYC95w4Uc1+kKNWNaASfQLGqALxBFC16MBLNgeHCXeMFF79PtkNmKDM1V/sFOoiwsxkNidrgGhpvB1qwT83fcslgPRe/PaRJ6cfnjx7rxCvHaYspOdfyuLdNt2FpLtg7okqvFsHsmgeXlXyXOWOW0UI8YxCStuaoH9JSbvbdFeIyellHLgqqXh0LjLbCDjY2ITzprbqQ2kueYad1MV6LIDHGqS7bkzKlAMJF59knSUhtP4+URX8Kp7BeK2JliLl6E3avIUzCRqLdAvrKITm88Uxb+V9RLBbvUgMcF8lds8s86ZAoUPGosWQXq7N/phUErhhsQac9Rs3YSpWWpD2cQ9Bb0CSKJKrSN99KqO372gDVCv6WSHX2fSbRQDN6ck9XAgDwGgwGBsO5SBJY58TOCY3fqq1oXo8IU+4wreh+xiNKq1jvUwCP9YgjanyqKHtzdquVXR+JgwTy3Fl3uCcQQLi01kk4yQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SJ2PR01MB8101.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230031)(376002)(366004)(346002)(136003)(39850400004)(396003)(451199024)(186009)(1800799009)(38100700002)(38350700002)(41300700001)(5660300002)(86362001)(83380400001)(66476007)(66556008)(66946007)(26005)(1076003)(107886003)(2616005)(478600001)(6666004)(966005)(8676002)(4326008)(316002)(8936002)(6512007)(52116002)(6486002)(2906002)(6506007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: OYzWxSy0Afh/1qqnEujkCNjNlQqLPbe8Lr/nCkTvIEgJ+FgW7CIUtM7UQl7wvxZEvClpnCjZ4UYsElHWuDVtq1zWT+KbPs0fLUqASxReBp39PSE1EOrfD1RoMIl9v8rcFZ+h1sW4n74tHDEIUqyFzY5taAdgoBKtQyAK3jD4rIOs49UGVtn/YAe1MctyHmAIMVd5Te+xyVRtj6LP8vRe1d44cXeKkc3LHDpfUOjVXb0Wm15nXOHoy9YvFx3n6EiJIYSQT990GZbm6qYPjz07ZepTB8qLT84mCdde2i02clJ/4otkt5/dQMK3XMHDP358nH1qjyvq601Zo1P6mLUmFPnW4Mhsl0C6u6MTX/r02CbQBvsyCwBf6e/xBKOwiTlJcf2JGG3blvg7caSh7vzT9SPhkR7fKZIpSobv0X6FOVHj8WOUUeDN+KPnMRXyoiBw5o7gcZSiGsG7TzVqljlp4MRtW4+llU6vdOBrSgGMVseq2ehZ39QFsY1a6Q5TypqohjkdIr/KgQS9efxoI7TtH5wPkNh3ghWQna2/CtX0KUCd5Pf5rmtIFjHq+IZ2Q/cI+0lyQv9gsAlW2wqT6p3e/kU9zTdf5tL0qxVP79M2yZ+9IwiVgLBCXptZabkXHouGNRnd3HOPnvncq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bad3c0c74 X-MS-Exchange-CrossTenant-AuthSource: SJ2PR01MB8101.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Sep 2023 11:42:42.4810 (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: vx6o4VpzQDXGdWhTCjrYE2uz8i9AvkhSKQONrdIFhRObXF7HeHcVP13uqa+mgGwuLmzblSV6p2R6tVp3hjP7FZpeXDjdcG80NAF8LWt09hdosnvnHWN7cs1WTbpHC3wC X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR01MB8008 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230904_044300_436937_6784C826 X-CRM114-Status: UNSURE ( 9.75 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Guest-Hypervisor(NV use-case) uses ptimer as an arch_timer. While running Guest-Hypervisor from a VHE host on a platform which supports FEAT_ECV/CNTPOFF_EL2, burst of spurious ptimer interrupts were generated for a non-zero offset, causing the boot to hang. The issue is due to the value of CNTPOFF_EL2 is treated as zero while on VHE host. This patch fixes the issue by adjusting the CVAL of a loaded ptimer across the entry and exit of a guest. v2: Updated as per review comment [1]. [1] https://lore.kernel.org/lkml/a4dac5af-44e2-0485-446f-fae09fa66a3c@os.amperecomputing.com/ This patchset is rebased on NV-V10[2][3]. [2] https://lore.kernel.org/linux-arm-kernel/19c775ad-9573-b4d4-886d-c631b468856f@redhat.com/T/ [3] https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git/log/?h=kvm-arm64/nv-6.5-WIP-6.4 Ganapatrao Kulkarni (2): KVM: arm64: timers: Move helper has_cntpoff to a header file KVM: arm64: timers: Adjust CVAL of a ptimer across guest entry and exits arch/arm64/include/asm/virt.h | 5 +++ arch/arm64/kvm/arch_timer.c | 65 ++++++++++++++++++++++++++++----- arch/arm64/kvm/hyp/vhe/switch.c | 13 +++++++ include/kvm/arm_arch_timer.h | 1 + 4 files changed, 74 insertions(+), 10 deletions(-)