Received: by 10.192.165.148 with SMTP id m20csp4499003imm; Tue, 8 May 2018 09:22:03 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqZ76bIex3ja5nV27zPGoCKjQ4PAycke0AOeYfhvFJzOBlVvMDJosWN4EQEO2FmZ+zTlRC2 X-Received: by 10.98.18.17 with SMTP id a17mr40940639pfj.104.1525796523702; Tue, 08 May 2018 09:22:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525796523; cv=none; d=google.com; s=arc-20160816; b=LRvezALRGgo9ilyWPKrNsg0XNMeIDnonfmub8GBvVazSukpSucB3PMl47ffNl2kTIc zv/RSoHUVmNV6TES2vjLCgD3guTpycNsEwGYsGRm/JlaAdvoKG8v7OcqljWx9jpXhYoI nHGytBw3EzZRUl42Ed5Memdu3n5Dg8SkHI2QK+o0SwJIoCRd6YGYsvXLqG606fAK9t4S QmCOIEiWlzg7HA/32b2LdyFDnbK72EmE/o4LZAqQNKtEpk0bs2SfnHfaazKhhkj7+yk5 l/Usf5XkYZ8Z592gG7iG95bVW627tctEPBxITfWTj1CR3hh8TRfdy0huww+IvMKnpsHQ kcpg== 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:arc-authentication-results; bh=yz8obnDOPoWITdW8tEQVc1iS1+X/SL6LMJfaesJm7oo=; b=Yar1kE6SXbD0+8eEZ0zolcWJsgfgQkhhkVqb7mqvN3K3qFwRggjW3oKT9d55Pk3VWg rmaKmisMUuv4rZZyfjP6+8UM0qctjpFG+gl/0DxvnP3pMS+jC/59xAy35B8TzQ2GIfTR cy6n21uE8mTy2HWre0j86pLyAfXNt22JBJKBAQsjEdyHU4i1pT52Ee6nBcwGERogpo1L TlekyzCuJhwe2WaUNxuGmv285DBI/jHI225tCjC/TBEd7SDW4OXduGI1A68BSkhjMnoL 0xD4L/HZgXBzD0k8nS2KAyuBOEqEhU743ew6hnRzS7BAveqD3u4iQ37lHPsJGeDsFzzk xEGg== 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 p10-v6si19615936pgv.598.2018.05.08.09.21.49; Tue, 08 May 2018 09:22:03 -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 S1755474AbeEHQV2 (ORCPT + 99 others); Tue, 8 May 2018 12:21:28 -0400 Received: from foss.arm.com ([217.140.101.70]:60592 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755384AbeEHQV0 (ORCPT ); Tue, 8 May 2018 12:21:26 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BF0FA80D; Tue, 8 May 2018 09:21:25 -0700 (PDT) Received: from [10.1.206.73] (en101.cambridge.arm.com [10.1.206.73]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D038A3F25D; Tue, 8 May 2018 09:21:23 -0700 (PDT) Subject: Re: [PATCH v2 19/27] coresight: catu: Plug in CATU as a backend for ETR buffer To: Mathieu Poirier Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, mike.leach@linaro.org, robert.walker@arm.com, mark.rutland@arm.com, will.deacon@arm.com, robin.murphy@arm.com, sudeep.holla@arm.com, frowand.list@gmail.com, robh@kernel.org, john.horley@arm.com References: <1525165857-11096-1-git-send-email-suzuki.poulose@arm.com> <1525165857-11096-20-git-send-email-suzuki.poulose@arm.com> <20180507220249.GA22194@xps15> From: Suzuki K Poulose Message-ID: <6145aae1-8d0c-2720-5e3b-bcbd4d4ddb58@arm.com> Date: Tue, 8 May 2018 17:21:22 +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: <20180507220249.GA22194@xps15> Content-Type: text/plain; charset=us-ascii; 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/05/18 23:02, Mathieu Poirier wrote: > On Tue, May 01, 2018 at 10:10:49AM +0100, Suzuki K Poulose wrote: >> Now that we can use a CATU with a scatter gather table, add support >> for the TMC ETR to make use of the connected CATU in translate mode. >> This is done by adding CATU as new buffer mode. CATU's SLADDR must >> always be 4K aligned. Thus the INADDR (base VA) is always 1M aligned >> and we adjust the DBA for the ETR to align to the "offset" within >> the 1MB page. >> diff --git a/drivers/hwtracing/coresight/coresight-catu.h b/drivers/hwtracing/coresight/coresight-catu.h >> index cd58d6f..b673a73 100644 >> --- a/drivers/hwtracing/coresight/coresight-catu.h >> +++ b/drivers/hwtracing/coresight/coresight-catu.h >> @@ -29,6 +29,32 @@ >> >> +extern const struct etr_buf_operations etr_catu_buf_ops; >> + >> diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c >> index 25e7feb..41dde0a 100644 >> --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c >> +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c >> @@ -941,6 +941,9 @@ static const struct etr_buf_operations etr_sg_buf_ops = { >> static const struct etr_buf_operations *etr_buf_ops[] = { >> [ETR_MODE_FLAT] = &etr_flat_buf_ops, >> [ETR_MODE_ETR_SG] = &etr_sg_buf_ops, >> +#ifdef CONFIG_CORESIGHT_CATU >> + [ETR_MODE_CATU] = &etr_catu_buf_ops, >> +#endif ... >> static inline int tmc_etr_mode_alloc_buf(int mode, >> @@ -953,6 +956,9 @@ static inline int tmc_etr_mode_alloc_buf(int mode, >> switch (mode) { >> case ETR_MODE_FLAT: >> case ETR_MODE_ETR_SG: >> +#ifdef CONFIG_CORESIGHT_CATU >> + case ETR_MODE_CATU: >> +#endif > > I really wish we could avoid doing something like this (and the above) but every > alternate solution I come up with is either uglier or on par with it... > Unless someone comes up with a bright idea we'll simply have to let it be. We could do a little trick in the coresight-catu.h : #ifdef CONFIG_CORESIGHT_CATU extern struct etr_buf_operations etr_catu_buf_ops; #else static struct etr_buf_opertaions etr_catu_buf_ops; #endif And then add the following check to get rid of the #ifdef above in tmc_etr_mode_alloc_buf(). if (etr_buf_ops[mode]->alloc) rc = etr_buf_ops[mode]->alloc(drvdata, etr_buf, node, pages); >> rc = etr_buf_ops[mode]->alloc(drvdata, etr_buf, node, pages); > > While looking for a solution I noticed that tmc_etr_get_catu_device() > could be moved to coresight-catu.h. That way we wouldn't have to include > coresight-catu.h every time coresight-tmc.h is present in a file. Yes, we could do that. I don't remember if there was a specific reason behind it. May be it is a left over from the rebases and how the CATU link was evolved. I will clean it up. Cheers Suzuki