From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.7 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F9E3C31E45 for ; Thu, 13 Jun 2019 13:04:10 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 43118205ED for ; Thu, 13 Jun 2019 13:04:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ac0Iw3Bk" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 43118205ED Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Subject:To:From:Message-ID:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=lccW/5eczcUxeheEWs4RTP1BSYLgiG9Lt7/lRJMgs94=; b=ac0Iw3Bk1ltrET nqwxRz2ZGBS2HwJMyWoXGAGn9+kHZHyOsSYbrY+5PZWYE12lkKCfgX55pk7tAisLnHyEgdhLoasYz MqBiFnFYyygLMBcuuWJZpaxTDk9BVE6udvA05+K1dAxAlDXfZv7ALv9TZ64FslR8N66Hnj0eALjAc WdDDXrsNcVRN2rbzN5Bbzo6AUq36u/rsuiroX2dzOonEiedNqE5BRzIdL3ItNDNMT879MUtNEHN/Z iDPgBVFsUg3Oq1qrVJLQQNCAyP98+3Klzew/nwwyEgSHx6AOoVD8ZqNgEBsD6cb0oOYESWKolCO8J zlUBfIQnZyfllCIhm6rQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hbPOj-0001KI-3s; Thu, 13 Jun 2019 13:04:09 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hbPOg-0001Jp-KJ for linux-arm-kernel@lists.infradead.org; Thu, 13 Jun 2019 13:04:08 +0000 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 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") X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190613_060406_758022_ADF91211 X-CRM114-Status: GOOD ( 20.74 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Catalin Marinas , Daniel Lezcano , Will Deacon , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.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. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel