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=-3.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 A9102C00A89 for ; Thu, 5 Nov 2020 13:28:34 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 216BC20719 for ; Thu, 5 Nov 2020 13:28:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="0qtuiTf5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 216BC20719 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=deqT/155PQzC1kKC5gk36FWETvGX+IQalIxiq+/BepQ=; b=0qtuiTf5hHHc8Fy+qU9eHyBID N4ishaQZYLvuKl2jimX6I6/oF+XExHK4kDmG3+0+4LyiPDgZQbiDEJSL2NbUc7wK2XtJYzF+nF8ft pqpxwl2dKr3QbqmCinBlccLdmXB1WOsDktv+liClN2761ukx3qN1KcR74O0KFfNDZ9OXX38D2g08M xnYw9RXySya8ZfL/hns+mr8mPDRZCOXZv+rmPKt4QBBjqGTli85mSupLwXDH2GZ1K4qe7YIvOLOAL QRrbCRiPptufPrfeDCGndJMQ53aJQ9U3UJqmXeOru0MjMZKMdDRp208E72o8GByrOdu8TEcs79LO3 Ptjqc7wbg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kafIM-0000m2-HF; Thu, 05 Nov 2020 13:27:18 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kafIK-0000kj-BK for linux-arm-kernel@lists.infradead.org; Thu, 05 Nov 2020 13:27:17 +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 A6D06142F; Thu, 5 Nov 2020 05:27:09 -0800 (PST) Received: from C02TD0UTHF1T.local (unknown [10.57.58.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D7EFC3F719; Thu, 5 Nov 2020 05:27:07 -0800 (PST) Date: Thu, 5 Nov 2020 13:27:05 +0000 From: Mark Rutland To: Ionela Voinescu Subject: Re: [PATCH v3 1/3] arm64: wrap and generalise counter read functions Message-ID: <20201105132705.GF82102@C02TD0UTHF1T.local> References: <20201105122702.13916-1-ionela.voinescu@arm.com> <20201105122702.13916-2-ionela.voinescu@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201105122702.13916-2-ionela.voinescu@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201105_082716_448012_9D3BE987 X-CRM114-Status: GOOD ( 11.54 ) 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: morten.rasmussen@arm.com, souvik.chakravarty@arm.com, catalin.marinas@arm.com, sudeep.holla@arm.com, linux-kernel@vger.kernel.org, dietmar.eggemann@arm.com, viresh.kumar@linaro.org, will@kernel.org, valentin.schneider@arm.com, 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+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Ionela, On Thu, Nov 05, 2020 at 12:27:00PM +0000, Ionela Voinescu wrote: > -#ifdef CONFIG_ARM64_AMU_EXTN > +#define COUNTER_READ_STORE(NAME, VAL) \ > +static inline u64 read_##NAME(void) \ > +{ \ > + return VAL; \ > +} \ > +static inline void store_##NAME(void *val) \ > +{ \ > + *(u64 *)val = read_##NAME(); \ > +} > > -#undef pr_fmt > -#define pr_fmt(fmt) "AMU: " fmt > +#ifdef CONFIG_ARM64_AMU_EXTN > +COUNTER_READ_STORE(corecnt, read_sysreg_s(SYS_AMEVCNTR0_CORE_EL0)); > +COUNTER_READ_STORE(constcnt, read_sysreg_s(SYS_AMEVCNTR0_CONST_EL0)); > +#else > +COUNTER_READ_STORE(corecnt, 0); > +COUNTER_READ_STORE(constcnt, 0); > +#endif I think this level of indirection is confusing (e.g. since you can't grep for `read_constcnt` to find the implementation). I also don't think we need to store_* functions here -- they're only needed by patch 3, and they can be wrapped in helper functions there (which should also solve the warning you mention in the cover letter). I think if we need these wrappers, it'd be better to have: #ifdef CONFIG_ARM64_AMU_EXTN #define read_corecnt() read_sysreg_s(SYS_AMEVCNTR0_CORE_EL0) #define read_constcnt() read_sysreg_s(SYS_AMEVCNTR0_CONST_EL0) #else #define read_corecnt() (0UL) #define read_constcnt() (0UL) #endif Thanks, Mark. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel