From: Suzuki K Poulose <Suzuki.Poulose@arm.com>
To: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, robh@kernel.org,
sudeep.holla@arm.com, frowand.list@gmail.com,
coresight@lists.linaro.org, mark.rutland@arm.com
Subject: Re: [PATCH 08/11] coresight: Add generic TMC sg table framework
Date: Fri, 25 May 2018 17:07:07 +0100 [thread overview]
Message-ID: <21fef51b-2afe-1a2c-6006-5cf3de4e74e8@arm.com> (raw)
In-Reply-To: <20180523202552.GA4609@xps15>
On 23/05/18 21:25, Mathieu Poirier wrote:
> On Fri, May 18, 2018 at 05:39:24PM +0100, Suzuki K Poulose wrote:
>> This patch introduces a generic sg table data structure and
>> associated operations. An SG table can be used to map a set
>> of Data pages where the trace data could be stored by the TMC
>> ETR. The information about the data pages could be stored in
>> different formats, depending on the type of the underlying
>> SG mechanism (e.g, TMC ETR SG vs Coresight CATU). The generic
>> structure provides book keeping of the pages used for the data
>> as well as the table contents. The table should be filled by
>> the user of the infrastructure.
>>
>> A table can be created by specifying the number of data pages
>> as well as the number of table pages required to hold the
>> pointers, where the latter could be different for different
>> types of tables. The pages are mapped in the appropriate dma
>> data direction mode (i.e, DMA_TO_DEVICE for table pages
>> and DMA_FROM_DEVICE for data pages). The framework can optionally
>> accept a set of allocated data pages (e.g, perf ring buffer) and
>> map them accordingly. The table and data pages are vmap'ed to allow
>> easier access by the drivers. The framework also provides helpers to
>> sync the data written to the pages with appropriate directions.
>>
>> This will be later used by the TMC ETR SG unit and CATU.
>>
>> Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
>> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
>> ---
>> Changes since v1:
>> - Address code style issues, more comments
>> ---
>> drivers/hwtracing/coresight/coresight-tmc-etr.c | 290 ++++++++++++++++++++++++
>> drivers/hwtracing/coresight/coresight-tmc.h | 50 ++++
>> 2 files changed, 340 insertions(+)
>>
>> diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c
>> index 9780798..1e844f8 100644
>> --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c
>> +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c
>> @@ -17,9 +17,299 @@
>> +static inline dma_addr_t tmc_sg_table_base_paddr(struct tmc_sg_table *sg_table)
>> +{
>> + if (WARN_ON(!sg_table->data_pages.pages[0]))
>> + return 0;
>> + return sg_table->table_daddr;
>> +}
>> +
>> +static inline void *tmc_sg_table_base_vaddr(struct tmc_sg_table *sg_table)
>> +{
>> + if (WARN_ON(!sg_table->data_pages.pages[0]))
>> + return NULL;
>> + return sg_table->table_vaddr;
>> +}
>
> The above two functions deal with DMA'able and virtual addresses for the table
> page buffer. Yet the test in the WARN_ON is done on the data page array.
> Shouldn't this be sg_table->table_pages.pages[0] instead?
The table is as good as empty if there are no data pages associated with
the table. Hence the data_pages check.
>
> If not please add a comment justifying your position so that someone else
> looking at the code does't end up thinking the same in a year from now.
I will add a comment to reflect the above.
>
>> +
>> +static inline void *
>> +tmc_sg_table_data_vaddr(struct tmc_sg_table *sg_table)
>> +{
>> + if (WARN_ON(!sg_table->data_pages.nr_pages))
>> + return 0;
>> + return sg_table->data_vaddr;
>> +}
>
> I see that tmc_sg_table_base_vaddr() and tmc_sg_table_data_vaddr() are both
> returning the virtual address of the contiguous buffer for table and data
> respectively. Yet there is a discrepency in the naming convention. I would
> have expected tmc_sg_table_base_vaddr() and tmc_sg_data_base_vaddr() so that
> there is a little symmetry between them.
Agree. I will fix it.
Suzuki
next prev parent reply other threads:[~2018-05-25 16:07 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-18 16:39 [PATCH 00/11] coresight: tmc-etr Transparent buffer management Suzuki K Poulose
2018-05-18 16:39 ` [PATCH 01/11] coresight: ETM: Add support for Arm Cortex-A73 and Cortex-A35 Suzuki K Poulose
2018-05-18 16:39 ` [PATCH 02/11] coresight: tmc: Hide trace buffer handling for file read Suzuki K Poulose
2018-05-18 16:39 ` [PATCH 03/11] coresight: tmc-etr: Do not clean trace buffer Suzuki K Poulose
2018-05-18 16:39 ` [PATCH 04/11] coresight: tmc-etr: Disallow perf mode Suzuki K Poulose
2018-05-18 16:39 ` [PATCH 05/11] coresight: Add helper for inserting synchronization packets Suzuki K Poulose
2018-05-18 16:39 ` [PATCH 06/11] dts: bindings: Restrict coresight tmc-etr scatter-gather mode Suzuki K Poulose
2018-05-23 18:18 ` Rob Herring
2018-05-18 16:39 ` [PATCH 07/11] dts: juno: Add scatter-gather support for all revisions Suzuki K Poulose
2018-05-23 17:39 ` Mathieu Poirier
2018-05-18 16:39 ` [PATCH 08/11] coresight: Add generic TMC sg table framework Suzuki K Poulose
2018-05-23 20:25 ` Mathieu Poirier
2018-05-25 16:07 ` Suzuki K Poulose [this message]
2018-05-25 16:43 ` Mathieu Poirier
2018-05-25 16:54 ` Suzuki K Poulose
2018-05-18 16:39 ` [PATCH 09/11] coresight: Add support for TMC ETR SG unit Suzuki K Poulose
2018-05-18 16:39 ` [PATCH 10/11] coresight: tmc-etr: Add transparent buffer management Suzuki K Poulose
2018-05-24 19:56 ` Mathieu Poirier
2018-05-18 16:39 ` [PATCH 11/11] coresight: tmc: Add configuration support for trace buffer size Suzuki K Poulose
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=21fef51b-2afe-1a2c-6006-5cf3de4e74e8@arm.com \
--to=suzuki.poulose@arm.com \
--cc=coresight@lists.linaro.org \
--cc=frowand.list@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mathieu.poirier@linaro.org \
--cc=robh@kernel.org \
--cc=sudeep.holla@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®