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=-12.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 8CB73C433DF for ; Fri, 31 Jul 2020 09:46:28 +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 5850520663 for ; Fri, 31 Jul 2020 09:46:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="d679S1fM" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5850520663 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+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-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=F91fPou0MIj3NKf3zoyZ1HJfDivm5z2kX7nQomK3+Oc=; b=d679S1fMhcveJvXWY5vUayCeU 5hI47iD6V6ac/srvug4q8p56W6cNK6YqyJkNS7aVEO7xygoE+2KS/iYTHajgvUmeuTC8+sNL4kZ10 NNR0Vuu6xtatMy9COECC3RrfKTYyCKBuHINvSy5dlXhyuItvfna9UZ1XG2HcQDQXlVQciMxOEww4y tJrNfHcB7w65ftf5lPt3LKJi1t57syy4dgAXLt08u8e+jotMPADBcJsrshXgP0OiO3MsvhCUCww1b 0ntSwg9nMBrj5wK8lwelfbm2cUmsNB1/rDW7FJFoDdW3u4WOzxvrB0A4qZ+gFa6hz+1jmr+NYhHvZ C2t9LRQ0g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k1Raz-0003g0-0o; Fri, 31 Jul 2020 09:44:57 +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 1k1Raw-0003eq-Kn for linux-arm-kernel@lists.infradead.org; Fri, 31 Jul 2020 09:44:55 +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 E6ED531B; Fri, 31 Jul 2020 02:44:52 -0700 (PDT) Received: from [10.37.12.83] (unknown [10.37.12.83]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E6C083F66E; Fri, 31 Jul 2020 02:44:50 -0700 (PDT) Subject: Re: [RFC PATCH 08/14] coresight: etm4x: Convert all register accesses To: mathieu.poirier@linaro.org References: <20200722172040.1299289-1-suzuki.poulose@arm.com> <20200722172040.1299289-9-suzuki.poulose@arm.com> <20200730202021.GE3155687@xps15> From: Suzuki K Poulose Message-ID: Date: Fri, 31 Jul 2020 10:49:37 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20200730202021.GE3155687@xps15> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200731_054454_797931_C906FE4E X-CRM114-Status: GOOD ( 21.00 ) 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: coresight@lists.linaro.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, mike.leach@linaro.org Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 07/30/2020 09:20 PM, Mathieu Poirier wrote: > On Wed, Jul 22, 2020 at 06:20:34PM +0100, Suzuki K Poulose wrote: >> Convert all register accesses from etm4x driver to use a wrapper >> to allow switching the access at runtime with little overhead. >> >> co-developed by sed tool ;-), mostly equivalent to : >> >> s/readl\(_relaxed\)\?(drvdata->base + \(.*\))/etm4x_\1_read32(csdev, \2) >> s/writel\(_relaxed\)\?(\(.*\), drvdata->base + \(.*\))/etm4x_\1_write32(csdev, \2, \3) >> >> We don't want to replace them with the csdev_access_* to >> avoid a function call for every register access for system >> register access. >> >> Cc: Mathieu Poirier >> Cc: Mike Leach >> Signed-off-by: Suzuki K Poulose >> --- >> .../coresight/coresight-etm4x-sysfs.c | 9 +- >> drivers/hwtracing/coresight/coresight-etm4x.c | 334 +++++++++--------- >> drivers/hwtracing/coresight/coresight-etm4x.h | 24 ++ >> 3 files changed, 189 insertions(+), 178 deletions(-) >> Agreed to all the comments. >> diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtracing/coresight/coresight-etm4x.h >> index b8283e1d6d88..2b51d03ab6d7 100644 >> --- a/drivers/hwtracing/coresight/coresight-etm4x.h >> +++ b/drivers/hwtracing/coresight/coresight-etm4x.h >> @@ -120,6 +120,30 @@ >> #define TRCCIDR2 0xFF8 >> #define TRCCIDR3 0xFFC >> >> +#define etm4x_relaxed_read32(csa, offset) \ >> + readl_relaxed((csa)->base + (offset)) >> + >> +#define etm4x_read32(csa, offset) \ >> + readl((csa)->base + (offset)) >> + >> +#define etm4x_relaxed_write32(csa, val, offset) \ >> + writel_relaxed((val), (csa)->base + (offset)) >> + >> +#define etm4x_write32(csa, val, offset) \ >> + writel((val), (csa)->base + (offset)) >> + >> +#define etm4x_relaxed_read64(csa, offset) \ >> + readq_relaxed((csa)->base + (offset)) >> + >> +#define etm4x_read64(csa, offset) \ >> + readq((csa)->base + (offset)) >> + >> +#define etm4x_relaxed_write64(csa, val, offset) \ >> + writeq_relaxed((val), (csa)->base + (offset)) >> + >> +#define etm4x_write64(csa, val, offset) \ >> + writeq((val), (csa)->base + (offset)) >> + > > Since I haven't gone through the rest of the patches I'll assume you want to > enhance the above to pick an access type at some point in the future. > Yes, they are plumbed in with the introduction of system instruction support. We don't want to the overhead of a function call for each register access. Also, we would like to avoid jumping through the large switch..cases for a compile time constant offset. Hence this macro. Cheers Suzuki _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel