Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp7026892ybi; Thu, 13 Jun 2019 08:21:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqzfQ+tAdkvUrFVUHX0i2TuVLlZ3o7An78O1ISqHfL2gQgTAnsy3PGjbJpKeQ7BIAr9TEwzN X-Received: by 2002:a62:1ec1:: with SMTP id e184mr2485527pfe.185.1560439282615; Thu, 13 Jun 2019 08:21:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560439282; cv=none; d=google.com; s=arc-20160816; b=KBGth7E1Cg2eY9Hv9d18jJyFunj2Z29dC+zCDFvSzBtz1zJJKH2UOFM9QBE8DHC3Sd s+hBlstyZ0seZLGsjYgOzDpsiiYKdK4oGcpUggWvKyUkkVKMTDlafP3cUYY6e0ZI4jVo Oky/53nKKNBF1V6Jo2XU8aCUZoMMiApktHiPAko1/tPqmq2MacwbfnaWaI73D5L7DLnR M1uRp32i+MRlp45q01OdDkiyyOa7OgBHBnvPJRORoQ6Lx1gG8gpKPXhvE4Ro8jh57Rgq 9C5XTG0k6uwR7J153KDj3AkXXFONPPUZRUmxPuvc6fuW+Vi47YlN6u+RT8lPVlkmPRS1 taNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:organization:user-agent :references:in-reply-to:subject:cc:to:from:message-id:date; bh=5/dixlmdpNfslGWEol8xl4sf8rklleb+mZXsUo47F/U=; b=DJ1XC4WtMX1AUaKNc/qyscV+Lw5SJ4GR95V3/oVnX8KVAicrF1m0bbwlQ+DPmDKR8n ku4Dd3XY4sEJg1XrF9uCzN/pVO0A2WWMdp1aDssJqBlJbcd/5jKuVp4xAEtJYcLD/ykd uUIjPzVYz/pcr/LqYI1gRtPrcjQcm//6y1MaPyyDswCuqebhxGTU0iomei7GlDvBT4dO ylTitAzhBucVOMw2bw0i0AYCckOMIhX2aPq+AyfffDiluiI7AQsKOv0ZeqosEyOuO6GV gbfRBvKfLTMGabYVYsTneVM3ck44Qdgx3QfbIbgukLMrenlUH2gAl9f33mjNGlIpmiDN InCw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j20si16879pjn.6.2019.06.13.08.21.06; Thu, 13 Jun 2019 08:21:22 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732847AbfFMPSv (ORCPT + 99 others); Thu, 13 Jun 2019 11:18:51 -0400 Received: from foss.arm.com ([217.140.110.172]:39582 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732146AbfFMNEE (ORCPT ); Thu, 13 Jun 2019 09:04:04 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 37EAA2B; Thu, 13 Jun 2019 06:04:04 -0700 (PDT) Received: from big-swifty.misterjones.org (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 736773F694; Thu, 13 Jun 2019 06:04:01 -0700 (PDT) Date: Thu, 13 Jun 2019 14:03:53 +0100 Message-ID: <86imt9bps6.wl-marc.zyngier@arm.com> From: Marc Zyngier To: Andrew Murray Cc: Mark Rutland , Catalin Marinas , Will Deacon , , , Daniel Lezcano Subject: Re: [PATCH v2] clocksource/arm_arch_timer: extract elf_hwcap use to arch-helper In-Reply-To: <20190613125102.23879-1-andrew.murray@arm.com> References: <20190613125102.23879-1-andrew.murray@arm.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 EasyPG/1.0.0 Emacs/26 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) Organization: ARM Ltd MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org + Daniel On Thu, 13 Jun 2019 13:51:02 +0100, Andrew Murray wrote: > > 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 Acked-by: Marc Zyngier Daniel, can you please take this though the clocksource tree? Thanks, M. > --- > 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(-) > > diff --git a/arch/arm/include/asm/arch_timer.h b/arch/arm/include/asm/arch_timer.h > index 4b66ecd6be99..ae533caec1e9 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 bool 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 b2a951a798e2..3583a92ad960 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; > -- > 2.21.0 > -- Jazz is not dead, it just smells funny.