From patchwork Wed Jun 26 14:46:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 167816 Delivered-To: patch@linaro.org Received: by 2002:ac9:6410:0:0:0:0:0 with SMTP id r16csp871039ock; Wed, 26 Jun 2019 07:47:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqwotjqI61k4SqrhLomBgLMfJzdeZw+cxTzRLWTJavhjX7eT9B/pPiA575O1uUowtfVQm+ys X-Received: by 2002:a63:4556:: with SMTP id u22mr3378468pgk.444.1561560466802; Wed, 26 Jun 2019 07:47:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561560466; cv=none; d=google.com; s=arc-20160816; b=f4Gh8F9tczNE/2y6VUt4sFs+ZDFPFOAvHM44QZ4H5jmz5tyq2m4XtvDciGjGJxP8LO /xO24DFkBDAUDdEtT85iDYAk/E+UylmMquRWGiJuY7orInGQ/vQGUvSB0SOag5No0LX3 VJLH+m+BWj7aHX8T2RSkmXzDEWRWR4+xfE//LRkqnkXDtMBnzhX4nqlqWkPlScWja2Bi GafH98dBVfotxEDZxjV3/3WUHXg/I3SRPpjoUGflP/VnB7U3Xt3EtD5MR5NXT61k09tF EaRIpJa8tBgHNvvsSjHhKApBmQwI9uACRnApYozG051nWW3WtWG7AQTbbQzT2VDRjFV9 bsTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=cbSVQ22cXPOUgxve/+oaGWixu1F5XT9Nb/A3w74S+UE=; b=v7I8UlfBRGj6ghEFBtoXt0jBApIIAXZi6nJ2QR/JrClicGJ2/ApONbqXPYgtMIHR39 MmYxXYcppJD0/3xxPxT8K+2rhpq6WE6sJQHRDiUCvWwSkt5pczGhW750FvAsGSnZ/buZ HabpA/TZ/s/3xrVZw7Nf6ThOs7d1byadD6eo08oi0LdV35W9Eb9jVaWh4IWaV8ZYttsS IXbSuhFFLyFBXnXxLnedgtKyYRWq7VJPwQGWcBEggasR42Xf7qBHqnJqLcIG9ppYdGg+ gLtgKbkp4AfRYGuZJCiPiSva/AouUecIRRDKNwFmccILIj6wtFEHlaII3UZcsBpaT4qy Eqhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ADrxohoq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a6si2177055pjo.91.2019.06.26.07.47.46; Wed, 26 Jun 2019 07:47:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ADrxohoq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728356AbfFZOrp (ORCPT + 30 others); Wed, 26 Jun 2019 10:47:45 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:37242 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728305AbfFZOrk (ORCPT ); Wed, 26 Jun 2019 10:47:40 -0400 Received: by mail-wr1-f68.google.com with SMTP id v14so3076014wrr.4 for ; Wed, 26 Jun 2019 07:47:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=cbSVQ22cXPOUgxve/+oaGWixu1F5XT9Nb/A3w74S+UE=; b=ADrxohoqxEA4hrkpsvA4KMOL9BPGGlrCiOlq/QZCevYKtpGMvxsSL52rFciR/q43DH F29Dg//dFlpDIO6EW1kiVSMeZktpL6pUM+nPBO4Ta8KaKFNthzMQ+3UnrxXX2IAFvNsr ttT1a1yAE4ZYsswIxky/yPdZFa0xdNutsvaa7q1rCZB6Mzvx8a1dAp8X311VyQDuF6Zi ASDFEI2fS3zPRj/Oudpv83ZAyCn7TXnh1n1wRQRZqwDtSfV2x+hLtzMc3LBCCHr+Nuqm LeJImWUPEKNBYULG7dzAKjxQPA5NoxP0pg+H0e98H0YnqSdUozrUrvMT1aq1d9c+Z4h3 UeyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=cbSVQ22cXPOUgxve/+oaGWixu1F5XT9Nb/A3w74S+UE=; b=Ep4eSjbYrPtEt79a7RIJvfkRrOYtq4NM92wb9VyP18wEAdqe7F8Vf0/ClmoxmmRcsc YCQSjSxowPTHXMFK5zY4VijUIPHTIQSn7cFDtIXCVe5PsivzgiB/KVQKPDPTLEkFMQ9y XyI8INIE3nXIvqy75X9U2ZfUzC78wN1ovz1bMLHkxR9dRqb9bo0ZpELwE2YDHoOzeYUA JapX4Ve7PO/8sTMP3BiDTMk+bZsFD6VRP24xNkP3eYPIu6532FoDca9EL9bz3sfV/KM3 uRxpxyBXoqOCYfu5wDjSLJ9Qx85ELN6jBEoaulJl4zvI/WlSuhftJItsXAdRQdWVNrgK RFeg== X-Gm-Message-State: APjAAAUiAUbKYKX9NXgjfoJCE7h14oxmoynONP3PR+xpLTMYXXVZ/ktV Dna1Bl2rfzDxTQi6zP5yAnvDFA== X-Received: by 2002:adf:ce88:: with SMTP id r8mr4326334wrn.42.1561560458255; Wed, 26 Jun 2019 07:47:38 -0700 (PDT) Received: from mai.imgcgcw.net (26.92.130.77.rev.sfr.net. [77.130.92.26]) by smtp.gmail.com with ESMTPSA id h84sm2718557wmf.43.2019.06.26.07.47.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Jun 2019 07:47:37 -0700 (PDT) From: Daniel Lezcano To: tglx@linutronix.de Cc: linux-kernel@vger.kernel.org, Andrew Murray , Mark Rutland , Will Deacon , Marc Zyngier , Russell King , Catalin Marinas , linux-arm-kernel@lists.infradead.org (moderated list:ARM ARCHITECTED TIMER DRIVER) Subject: [PATCH 15/25] clocksource/drivers/arm_arch_timer: Extract elf_hwcap use to arch-helper Date: Wed, 26 Jun 2019 16:46:41 +0200 Message-Id: <20190626144651.16742-15-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190626144651.16742-1-daniel.lezcano@linaro.org> References: <20190626144651.16742-1-daniel.lezcano@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andrew Murray Different mechanisms are used to test and set elf_hwcaps between ARM and ARM64, this results in the use of ifdeferry in this file when setting/testing for the EVTSTRM hwcap. Let's improve readability by extracting this to an arch helper. Signed-off-by: Andrew Murray Acked-by: Mark Rutland Acked-by: Will Deacon Signed-off-by: Daniel Lezcano --- arch/arm/include/asm/arch_timer.h | 10 ++++++++++ arch/arm64/include/asm/arch_timer.h | 13 +++++++++++++ drivers/clocksource/arm_arch_timer.c | 15 ++------------- 3 files changed, 25 insertions(+), 13 deletions(-) -- 2.17.1 diff --git a/arch/arm/include/asm/arch_timer.h b/arch/arm/include/asm/arch_timer.h index 4b66ecd6be99..99175812d903 100644 --- a/arch/arm/include/asm/arch_timer.h +++ b/arch/arm/include/asm/arch_timer.h @@ -4,6 +4,7 @@ #include #include +#include #include #include #include @@ -124,6 +125,15 @@ static inline void arch_timer_set_cntkctl(u32 cntkctl) isb(); } +static inline void arch_timer_set_evtstrm_feature(void) +{ + elf_hwcap |= HWCAP_EVTSTRM; +} + +static inline bool arch_timer_have_evtstrm_feature(void) +{ + return elf_hwcap & HWCAP_EVTSTRM; +} #endif #endif diff --git a/arch/arm64/include/asm/arch_timer.h b/arch/arm64/include/asm/arch_timer.h index 50b3ab7ded4f..a847a3ee6cab 100644 --- a/arch/arm64/include/asm/arch_timer.h +++ b/arch/arm64/include/asm/arch_timer.h @@ -20,6 +20,7 @@ #define __ASM_ARCH_TIMER_H #include +#include #include #include @@ -240,4 +241,16 @@ static inline int arch_timer_arch_init(void) return 0; } +static inline void arch_timer_set_evtstrm_feature(void) +{ + cpu_set_named_feature(EVTSTRM); +#ifdef CONFIG_COMPAT + compat_elf_hwcap |= COMPAT_HWCAP_EVTSTRM; +#endif +} + +static inline bool arch_timer_have_evtstrm_feature(void) +{ + return cpu_have_named_feature(EVTSTRM); +} #endif diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c index 5c69c9a9a6a4..3c8afcd3444c 100644 --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c @@ -804,14 +804,7 @@ static void arch_timer_evtstrm_enable(int divider) cntkctl |= (divider << ARCH_TIMER_EVT_TRIGGER_SHIFT) | ARCH_TIMER_VIRT_EVT_EN; arch_timer_set_cntkctl(cntkctl); -#ifdef CONFIG_ARM64 - cpu_set_named_feature(EVTSTRM); -#else - elf_hwcap |= HWCAP_EVTSTRM; -#endif -#ifdef CONFIG_COMPAT - compat_elf_hwcap |= COMPAT_HWCAP_EVTSTRM; -#endif + arch_timer_set_evtstrm_feature(); cpumask_set_cpu(smp_processor_id(), &evtstrm_available); } @@ -1040,11 +1033,7 @@ static int arch_timer_cpu_pm_notify(struct notifier_block *self, } else if (action == CPU_PM_ENTER_FAILED || action == CPU_PM_EXIT) { arch_timer_set_cntkctl(__this_cpu_read(saved_cntkctl)); -#ifdef CONFIG_ARM64 - if (cpu_have_named_feature(EVTSTRM)) -#else - if (elf_hwcap & HWCAP_EVTSTRM) -#endif + if (arch_timer_have_evtstrm_feature()) cpumask_set_cpu(smp_processor_id(), &evtstrm_available); } return NOTIFY_OK;