From patchwork Mon Oct 8 12:50:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 10630679 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0914414DB for ; Mon, 8 Oct 2018 12:57:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EC66728AD4 for ; Mon, 8 Oct 2018 12:57:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E075428B1B; Mon, 8 Oct 2018 12:57:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 784F828AD4 for ; Mon, 8 Oct 2018 12:57:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-reply-to:Message-id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=1xbu4LQyoKt5tC3/2G+T7Zbo18FlTHtvUeatVY1cyWI=; b=bpmfuCzQB5zfDPR+CIPxcv9YgD vOzxVcoYqjKTicfyjKg4LKe/dmtnjrg9kU9DXhk7H6ius6xQ3KtRQx/IElXMfBNthYnCsL8RynbPJ CVyo4hAfv+8Jg7rCU02pwkjZYggVLlBtKy904u4g9fKFqz7lGVaqTl9ijWktAYoo2gHMRMDT562Rc 5F81iBZJmd2JQ3jwZTarF0Kv0LLWpq3UxKVzgaw22prVoosjLBJ79dFl/o5MfspYc4Ea/oXZ80DMg nF8wIok7nT2AVl+UapFgZxF+w++TwV7rdL6mxwogxtv504KRjpg76pH8ZwOUU1PMjxUU2cTrShhXH 6dwFUIdQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g9V5q-0007tz-NE; Mon, 08 Oct 2018 12:57:02 +0000 Received: from mailout1.w1.samsung.com ([210.118.77.11]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g9V03-0003uH-QY for linux-arm-kernel@lists.infradead.org; Mon, 08 Oct 2018 12:52:31 +0000 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20181008125049euoutp01f8e1d9ad897bdf8c59b4561fe9d5aaf7~box62aSo91950919509euoutp01c; Mon, 8 Oct 2018 12:50:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20181008125049euoutp01f8e1d9ad897bdf8c59b4561fe9d5aaf7~box62aSo91950919509euoutp01c DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1539003050; bh=u6Fux9B2+gCCVTDUtsb3Uk1X1p5dp09XsTAiT796EMU=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=f0l1ajDBjczHRJtWiAwBiGGYoZVR8neWNvm6sYGD/V3lfbicY9NlR8DhNrF8/vJzg iGF/KihBv1KfOfSh/hwNiVwxHWx8PIrMnn7cfq+mZOfABGB884h1sZjNETZEKagWBV qZEJ338ZKfL4sMLDE5Mou/a5QD2ilaeIUB53UBJw= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20181008125049eucas1p262f8e181df7030cb7ae556e8678702af~box6TP2_60784307843eucas1p2n; Mon, 8 Oct 2018 12:50:49 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 78.21.04806.8A25BBB5; Mon, 8 Oct 2018 13:50:49 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20181008125048eucas1p229a94c202596ddd0a65009c15d9e3001~box5elyRs1879418794eucas1p2r; Mon, 8 Oct 2018 12:50:48 +0000 (GMT) X-AuditID: cbfec7f5-367ff700000012c6-85-5bbb52a8a3c7 Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id C4.39.04128.8A25BBB5; Mon, 8 Oct 2018 13:50:48 +0100 (BST) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PGA006EA6BYW230@eusync1.samsung.com>; Mon, 08 Oct 2018 13:50:48 +0100 (BST) From: Marek Szyprowski To: linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/7] clocksource: arch_timer: Add support for not-fw-configured timer on ARM64 Date: Mon, 08 Oct 2018 14:50:06 +0200 Message-id: <20181008125009.3721-5-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20181008125009.3721-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrAIsWRmVeSWpSXmKPExsWy7djP87org3ZHG7yYwGSxccZ6Vov3y3oY La5/ec5qMe+zr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JYcFm84uRhgQbGd8JdjJwcEgImEns/X2LpYuTiEBJYwiix4+0cRginiUli6fKX 7CBVbAKGEl1vu9hAbBGBbIn5e7vB4swCS5glbt53ALGFBRIk7lyeygRiswioSvze08wMYvMK 2EhsXdrHCLFNXmL1hgNgcU4BW4knXatYQGwhoJre6RdZJzDyLGBkWMUoklpanJueW2ykV5yY W1yal66XnJ+7iREYhtuO/dyyg7HrXfAhRgEORiUe3hUBu6KFWBPLiitzDzFKcDArifCKbgcK 8aYkVlalFuXHF5XmpBYfYpTmYFES5z1vUBklJJCeWJKanZpakFoEk2Xi4JRqYOw4xb9Lcfrj gKS5K7582/f9142or1pbLJStRa4eFt9yxF0x4Pts6U9TEttKn3641Zcq19/+6o6Aqpr/gxVT dvR6Hz3Gt/3yHj7hxLehFgdleiY88zAr/3ttTnBkhZnKgZTzT/oOiMxZkn5ZeNayZ1wGX/fc Oliucahy8uy9J+oktt6SfXt/yeXnSizFGYmGWsxFxYkA/YrTkz8CAAA= X-CMS-MailID: 20181008125048eucas1p229a94c202596ddd0a65009c15d9e3001 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181008125048eucas1p229a94c202596ddd0a65009c15d9e3001 References: <20181008125009.3721-1-m.szyprowski@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181008_055104_124977_A3966B37 X-CRM114-Status: GOOD ( 19.09 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartlomiej Zolnierkiewicz , Marc Zyngier , Catalin Marinas , Daniel Lezcano , Will Deacon , Krzysztof Kozlowski , Inki Dae , Chanwoo Choi , Thomas Gleixner , Marek Szyprowski MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Use common infrastructure for ARM Architected Timers erratum to enable support for systems with broken CPU firmware (timer registers not properly configured). This mode has been already availabled on ARM (32bits) architecture. This enables to run Linux kernel on ARM64 boards using physical architected timers instead of the virtual ones. Examples of such system with broken firmware are Samsung Exynos5433 SoC based TM2(e) boards, which is already deployed for years and updating firmware is not possible. Signed-off-by: Marek Szyprowski --- drivers/clocksource/Kconfig | 11 +++++++++++ drivers/clocksource/arm_arch_timer.c | 15 ++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig index a11f4ba98b05..a30752579b03 100644 --- a/drivers/clocksource/Kconfig +++ b/drivers/clocksource/Kconfig @@ -364,6 +364,17 @@ config ARM64_ERRATUM_858921 The workaround will be dynamically enabled when an affected core is detected. +config ARCH_TIMER_REGISTERS_NOT_FW_CONFIGURED + bool "Workaround for arch timer registers not configured by firmware" + default y + select ARM_ARCH_TIMER_OOL_WORKAROUND + depends on ARM_ARCH_TIMER && ARM64 + help + This option enables a workaround for boards, on which arch timer + registers are not properly configured by the board firmware. + The workaround will be dynamically enabled when an affected + board is detected. + config ARM_GLOBAL_TIMER bool "Support for the ARM global timer" if COMPILE_TEST select TIMER_OF if OF diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c index 9a7d4dc00b6e..b6f109654daf 100644 --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c @@ -423,6 +423,14 @@ static const struct arch_timer_erratum_workaround ool_workarounds[] = { .read_cntvct_el0 = arm64_1188873_read_cntvct_el0, }, #endif +#ifdef CONFIG_ARCH_TIMER_REGISTERS_NOT_FW_CONFIGURED + { + .match_type = ate_match_dt, + .id = "arm,cpu-registers-not-fw-configured", + .desc = "broken CPU firmware (timer registers not configured)", + .read_cntvct_el0 = arch_counter_get_cntpct, + }, +#endif }; typedef bool (*ate_match_fn_t)(const struct arch_timer_erratum_workaround *, @@ -1234,9 +1242,10 @@ static int __init arch_timer_of_init(struct device_node *np) * If we cannot rely on firmware initializing the timer registers then * we should use the physical timers instead. */ - if (IS_ENABLED(CONFIG_ARM) && - of_property_read_bool(np, "arm,cpu-registers-not-fw-configured")) - arch_timer_uses_ppi = ARCH_TIMER_PHYS_SECURE_PPI; + if (of_property_read_bool(np, "arm,cpu-registers-not-fw-configured")) + arch_timer_uses_ppi = IS_ENABLED(CONFIG_ARM64) ? + ARCH_TIMER_PHYS_NONSECURE_PPI : + ARCH_TIMER_PHYS_SECURE_PPI; else arch_timer_uses_ppi = arch_timer_select_ppi();