Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp2537343ybg; Fri, 31 Jul 2020 02:47:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXDWoAYVFkv4e4eC08/B3JsTcHCT3wn6IsvC9V4zZa29S+pxvcLuXw3AGtFqdNZBILEWX2 X-Received: by 2002:aa7:cd08:: with SMTP id b8mr3094073edw.228.1596188875548; Fri, 31 Jul 2020 02:47:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596188875; cv=none; d=google.com; s=arc-20160816; b=oeBB1Xw4ZVwhC4DD5p0tN/Tk5v7nY2nCrFdxda1UHetv9iAGCF0gWMY/OFbNE02FUZ TTIEScaC/qOglhct1Zxpy7B1wYmGrgii6oI2FoFO/bYtHqkCgLusrOEIy8eBN7MBxOtQ 5X9RPECxKS9czheWZtLOt7Xy/Kbj1XXRV1YRB97jclrKFPIfUUiJnrbySx7WvJz21fOP UG+0FlXf1CroduENJupypfjcK7WsWq5nlf2lC+GsLBDrIqwUZpBAuRqC3zeGI5jDQ+1Q cjZKP3HZxuqCKSLtIIKnGyMOi9+G6xvBMdS2FI3gUbym/gfXoe9xht3EBY2GFiO9jmaP 9sbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=tZ9O2DdBrYGeD1w+cELld1WDpRellORsEe1t2UNy5sI=; b=WNURTCFGfx6JOyWeBV4AzQFru/JdsnrQH7A+NWzwWqZtxuEhJ+h2L+4bR6HWPzNJl4 Ynzkd1Ey2S+fBubNHjE32iofy5e330+EiQXzzJHVDhmFZGxRYL/U3xmOw7vwbd8F5/fH zz/uq8UzXuym3iyNoqKpNJKsWdxHq269G9vsuBgITv5F5DUX/BQ/ArtcU9ZAfvgyMVug kvdguXu9R6/P8yRQ6EhyKhfe6kyC1JUFVmtEwxI9dGOozRVsde72CZ78B8D5hKsvsZIM 2uEeiZ8taO+WaCMxU37eAvyJLca3HqaML4lXagRTW4ZjnVqd7tRwUz4EP7YqkIDcQ8s3 wuyA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k17si3796434eds.353.2020.07.31.02.47.33; Fri, 31 Jul 2020 02:47:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732244AbgGaJox (ORCPT + 99 others); Fri, 31 Jul 2020 05:44:53 -0400 Received: from foss.arm.com ([217.140.110.172]:53980 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732080AbgGaJox (ORCPT ); Fri, 31 Jul 2020 05:44:53 -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 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 Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, mike.leach@linaro.org, coresight@lists.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-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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