Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp1671230ioo; Sun, 22 May 2022 23:49:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8N6iaqKxaDWzAyTXqow/3tclJNNAhQ9Hsx6EEvmmcFU1ToefLcVKw72V33uOCSKWWZt5j X-Received: by 2002:aa7:9217:0:b0:518:367d:fa85 with SMTP id 23-20020aa79217000000b00518367dfa85mr22062665pfo.9.1653288581953; Sun, 22 May 2022 23:49:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1653288581; cv=pass; d=google.com; s=arc-20160816; b=KrvyQAQU5hFTX4Bhq7ujElO2ZWctgH+m/G0Sa387OLs67dw61xbPawCnhh8oISnLDB Z2bN5k6WjKP//3JSGEB2DKYPAHDWYZDSnB05rMG7n+C3W4XUU722G8RF+CcHkj/2qZKw ViHSDNTCO8i0WF7K8mlNmyx2NdowqHplzlaLPS2oWzJGVyvHaDRT3Uio62oU64pv4EXw USeXaTrYwB+Ytmn3+PTZUbtq3/fWJ8ehGo9RUncXfW+7wfGdV5vpYLzh7B40o6tOmUdr +S0gl+VzBf2rK3Ogj37aOKogdm/+P/Rnre8BYnFBKEaL17L7OQwZ54ZDR2+1J7JO+t+9 0oOg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Uv2pYJVnQP4MhtNzkeBH6lfqgjw43baCXJ3Djm3cSlQ=; b=CfTHvm+bkinNl73cCF37mli4j9J/U7/2wZQmHT1H6gWSxNnUP08u0+YBV7h9y6KCmk CG1JTCXiG2JjI+OvXCF+Sh4PB6QXSyyqXVcAxZRKRxRv5phmmMTI5KYG3bsdCycOJRqh dyXrVjMmCLXBy43pfIhgHBCW/92i7IsbW8zWqwZGiDgVzBaXAcC3/C8qS5Kkdb3SDGNd 6tmgVGD9oLmS5KhqopyExm69qf78x/frjcrO6x5nIbJwTvzK6GaJXHGho4hRzP7uwIt9 iDrcl66eXRBXItnI7LdX0M1Zu+nN3lygZcQJHZowG8nSgL61UEtsd2C8fM8Z4eQiMvej 6saA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@syrmia.com header.s=selector1 header.b=nAFI+QkJ; arc=pass (i=1 spf=pass spfdomain=syrmia.com dkim=pass dkdomain=syrmia.com dmarc=pass fromdomain=syrmia.com); spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id j8-20020a17090276c800b001618cb78b54si8217916plt.405.2022.05.22.23.49.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 May 2022 23:49:41 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@syrmia.com header.s=selector1 header.b=nAFI+QkJ; arc=pass (i=1 spf=pass spfdomain=syrmia.com dkim=pass dkdomain=syrmia.com dmarc=pass fromdomain=syrmia.com); spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9DB563EB9A; Sun, 22 May 2022 23:18:35 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242070AbiESSw0 (ORCPT + 99 others); Thu, 19 May 2022 14:52:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244126AbiESSv6 (ORCPT ); Thu, 19 May 2022 14:51:58 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2111.outbound.protection.outlook.com [40.107.22.111]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFA585E76D; Thu, 19 May 2022 11:51:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l2lhAyh1gKZRulKZ+07LW85Fgl9+KxsLaWt2/l08PIzCp5wtVGTIPekt7cKdydwk8Ea4oBmbZ02TN/dmg7Ft3GCznXpWQWlqASuODJw0xen1PyvQb7Sq9SxxjwMRDwAQ4+vWzbpRJDklaxlaqYcNX2/DGccos5zAVMLamlQpl+05rRslN4y5LRrkj8TuRCn2hKE36PB+2sXwFzf9DhiFk55gCha2qTeG/lRRIzbXqdd23b6vYW/4xCotreGDwgGRlc8pmE/J2Ct20N44O+hLKhgjP3fJMvbQ8PX6x1BRCPn2YwacKInpmERYPp9ZpnYPHF8xldbcilEta3aQzt7sIw== 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=Uv2pYJVnQP4MhtNzkeBH6lfqgjw43baCXJ3Djm3cSlQ=; b=Vr04rnz10RrLF5eokqJrBf2cb/oYMIwzGxJ/9HRXxcbrrrcb1rN5eYGvl8AeKRQEFs4UkhnLmKsMWuzWtHCufmG+BWcyYSRQqa4H6HoN2Q673QnY240hfAqHQW3qTVTc1lhprW2wYZtSmFpzrLpUL/fLJhfLMMIuNOLzeQnoBCZo+M5YufHkxp3RZdravRY2Ky0kcvJSHNRhfF63iku5+iYQgkLr+BPCu7pjJM0Q91KYt1zZroC9ETUx0dy4ex1qStOaSw2MurZmX/C2qtTwjIOgKjdHmgbSJYB74UUHluosQ31JPFqxR/p1NiJwKafOA3yQ6goaD9ySw8a8/604ZA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=syrmia.com; dmarc=pass action=none header.from=syrmia.com; dkim=pass header.d=syrmia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=syrmia.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Uv2pYJVnQP4MhtNzkeBH6lfqgjw43baCXJ3Djm3cSlQ=; b=nAFI+QkJGqI57fBeEvFNPBTDKaoar4N6lerWrKLIGlZqw+F8NSQsjM2nPm5XN3MimCCop7tQjHXntosEuomq1rDHuB86pbm5NISZ69D1lnSQVKAEwbZGkYNBG5OsNYj0cSS1RW/G/8a/XYlljaeSb6WsBsYAQL2/oAMG70SW97w= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=syrmia.com; Received: from VI1PR03MB4208.eurprd03.prod.outlook.com (2603:10a6:803:51::25) by AM5PR0301MB2546.eurprd03.prod.outlook.com (2603:10a6:203:a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.17; Thu, 19 May 2022 18:51:48 +0000 Received: from VI1PR03MB4208.eurprd03.prod.outlook.com ([fe80::b513:6272:f3c5:c709]) by VI1PR03MB4208.eurprd03.prod.outlook.com ([fe80::b513:6272:f3c5:c709%7]) with mapi id 15.20.5273.014; Thu, 19 May 2022 18:51:48 +0000 From: Dragan Mladjenovic To: Thomas Bogendoerfer Cc: Paul Burton , Serge Semin , Daniel Lezcano , Thomas Gleixner , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Chao-ying Fu Subject: [PATCH 08/12] clocksource: mips-gic-timer: Enable counter when CPUs start Date: Thu, 19 May 2022 20:51:21 +0200 Message-Id: <20220519185125.11686-9-Dragan.Mladjenovic@syrmia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220519185125.11686-1-Dragan.Mladjenovic@syrmia.com> References: <20220519185125.11686-1-Dragan.Mladjenovic@syrmia.com> Content-Type: text/plain X-ClientProxiedBy: VI1PR0602CA0016.eurprd06.prod.outlook.com (2603:10a6:800:bc::26) To VI1PR03MB4208.eurprd03.prod.outlook.com (2603:10a6:803:51::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3661252d-f3c6-48f5-1bc6-08da39c8a018 X-MS-TrafficTypeDiagnostic: AM5PR0301MB2546:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lhjgoD53Gv4X81dBPLl9Kq7mZz2huQCyi/X38C6BsE48e95DDC0FRpdY+Fp1YfKJlPd/ip0hhNV72NzkD1lbdgHA+a825Glq2lY2YywBwr9iHtXVyrpyEChDYMTT2QduM0WMLi7NPsVoRgqn9sLhc9DyiT21Ovs+S0xhRkgQBa0Z3QoR3X7KaR+Pak/0qQ/YEj6/U45NjSzPGb7jxKXxyjkpsz3rLrOSTr6ow7Wpo4rS/w9n5qM9YwepdRhVmxor1ecdP84VjClXJDZNL+T9MM12A5n9O76Ij7Up9QbXTa6vuiZFshuBxLRCnSeGsB7QGZmRMIyI4phu4r6zbUAQjn/On3OqYOa93HclmZcli3liGbWfrDi/2EGYXjosLz3wI0zS/M12fSCNkrZY1td7RTA3RJ7b5Y6vDZnSKf3PMNU6XhsEygL8rkGMIp1B5P7hE9LTQPwHAwWi7hY58zmwJyux+UefNJfbqBwcT8J+sSTfmtzux+dUTQ92paH6wBQPajmrLxwJ4pT3dqfM/iuSBeJ13tRNYTryF8UuPbxO4XFclT8+QA6DnBAMplMsB9Ct6QICPwJ+DRlpwE29Xw57nfaLDyjsfk4+iYVp8N6v+yBmaY70y63zAL2oPtrnQvpVlPwYTSkeeyi1xLCbsL7Fx9aOk1p4SXW4GUNTpaFxOx2Zw28IdlBqXm+XqCZvkxCvjE3Ou0kWbdv1qTITC+4wxQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4208.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(376002)(346002)(366004)(39840400004)(396003)(136003)(5660300002)(66476007)(66556008)(38100700002)(8676002)(38350700002)(4326008)(8936002)(66946007)(83380400001)(6512007)(26005)(86362001)(36756003)(52116002)(316002)(6666004)(41300700001)(2906002)(6916009)(54906003)(6506007)(6486002)(1076003)(2616005)(186003)(508600001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?lZBmzsKD2DjSq5vhtk3x4Sj9uuv6z6SA12/xkKRBrFeaiRHHIHvjjnsk/nY6?= =?us-ascii?Q?AgCGoo/EA7m/HjvZk2f7dnJfORNqt9VgFXJ7Fucd65fG5j2CXwJ2m566WsVD?= =?us-ascii?Q?r7MNljMk5lgLl1P8bsvWyhZB0SDBJMJeSn5fpIHoddAXNwrwtmsUgF0DxLgG?= =?us-ascii?Q?mJOIz4+it4cb6os3wcYSARquTuriEYfwVTrokTHdYrrAg2xhG8pFSXxalqJW?= =?us-ascii?Q?jIScPKrDHA0YXxvGxVViHSQp3+C5sIxVmQQdtGacbXD0zBi8MMLBgstXd7BZ?= =?us-ascii?Q?BzGrFBgrOT0lIOimSGc+raMTnCec0mtiM8nsEiTL0UqgKeLrzjdpaHiM8QNp?= =?us-ascii?Q?Iw7NsfAmkCe4WRRneAJ3dC9nGVoM29hLAU3fSxqi0hV1fMl0Wwjesk7ejMoi?= =?us-ascii?Q?loVQl0sgKHBuVNssM+7OCmYE8NoYUEv2o9StYzRWs+88U6bIj5Njvj6FFP7J?= =?us-ascii?Q?nD+zXkwiWtxcubSAmUsAadOQWFF9eFejIpL7qgl6S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ryxI5NKr3k7QjwWQndK2AicZwmdxeXCaHhWqsr4b4y8oW?= =?us-ascii?Q?B/OrP+R3CLEu9y2xW42OLC2TaRiG/WexCCYx/p7LPHEcQ5j4MS+e446dKAEI?= =?us-ascii?Q?LSYSz5WgrYox/w+W7grin02oM179pcHFgRYwCkf4mp7Pmke3kO/Ta7hIjOnA?= =?us-ascii?Q?gfXotg35F7R+kd4y04tDKHgd2D1XQGH7VyJrQcmt+Zgoi1ChkX6FmF4ce8x8?= =?us-ascii?Q?anBmiKKCKFEX4kL96mJaXAl2GJo28qDW+/455AXRuog+sujpZKN3MkXwQNGs?= =?us-ascii?Q?sYUP99YrBzCeDf1pI1XOPUaUSI1T0t0mPDTJlQFBI/QefUz7f6gChAHDs7EZ?= =?us-ascii?Q?RwfN0dCsSbEmOWZVfxe/0xK6wQlZiuc=3D?= X-OriginatorOrg: syrmia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3661252d-f3c6-48f5-1bc6-08da39c8a018 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4208.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2022 18:51:46.9773 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 19214a73-c1ab-4e19-8f59-14bdcb09a66e X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: NF4zaHWBryPKXSigaLzvjJspb3AVreDMDOUpdYuUgKqGZ9/WtkdgJJzXgjm8uDUGEtIyiWgR/SH1rEdageP3jpWZxqbqMInLIOUIJNa/4jI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0301MB2546 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Paul Burton In multi-cluster MIPS I6500 systems we have a GIC in each cluster, each with its own counter. When a cluster powers up the counter will be stopped, with the COUNTSTOP bit set in the GIC_CONFIG register. In single cluster systems it has been fine for us to clear COUNTSTOP once in gic_clocksource_of_init() in order to start the counter, since with only one cluster we know that we won't be resetting that cluster's GIC at any point (ignoring suspend/resume cycles which would need to handle clearing COUNTSTOP in the resume path). Once we support multi-cluster systems this will only have started the counter in the boot cluster, and any CPUs in other clusters will find their counter stopped which will break the GIC clock_event_device. Resolve this by having CPUs clear the COUNTSTOP bit when they come online, using the existing gic_starting_cpu() CPU hotplug callback. This will allow CPUs in secondary clusters to ensure that the cluster's GIC counter is running as expected. Signed-off-by: Paul Burton Signed-off-by: Chao-ying Fu diff --git a/drivers/clocksource/mips-gic-timer.c b/drivers/clocksource/mips-gic-timer.c index 6632d314a2c0..90a736a13115 100644 --- a/drivers/clocksource/mips-gic-timer.c +++ b/drivers/clocksource/mips-gic-timer.c @@ -119,6 +119,9 @@ static void gic_update_frequency(void *data) static int gic_starting_cpu(unsigned int cpu) { + /* Ensure the GIC counter is running */ + clear_gic_config(GIC_CONFIG_COUNTSTOP); + gic_clockevent_cpu_init(cpu, this_cpu_ptr(&gic_clockevent_device)); return 0; } @@ -289,9 +292,6 @@ static int __init gic_clocksource_of_init(struct device_node *node) pr_warn("Unable to register clock notifier\n"); } - /* And finally start the counter */ - clear_gic_config(GIC_CONFIG_COUNTSTOP); - /* * It's safe to use the MIPS GIC timer as a sched clock source only if * its ticks are stable, which is true on either the platforms with -- 2.17.1