mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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
Subject: Re: [PATCH 5/6] coresight: catu: Add support for scatter gather tables
Date: Fri, 22 Jun 2018 10:01:24 +0100	[thread overview]
Message-ID: <d5bbff9b-2730-f708-8a4e-f16241f6f5ce@arm.com> (raw)
In-Reply-To: <20180621171337.GA10307@xps15>

Hi Mathieu,

On 21/06/18 18:13, Mathieu Poirier wrote:

>> +
>> +/*
>> + * catu_populate_table : Populate the given CATU table.
>> + * The table is always populated as a circular table.
>> + * i.e, the "prev" link of the "first" table points to the "last"
>> + * table and the "next" link of the "last" table points to the
>> + * "first" table. The buffer should be made linear by calling
>> + * catu_set_table().
>> + */
>> +static void
>> +catu_populate_table(struct tmc_sg_table *catu_table)
>> +{
>> +	int i, dpidx, s_dpidx;
>> +	unsigned long offset, buf_size, last_offset;
>> +	dma_addr_t data_daddr;
>> +	dma_addr_t prev_taddr, next_taddr, cur_taddr;
>> +	cate_t *table_ptr, *next_table;
>> +
>> +	buf_size = tmc_sg_table_buf_size(catu_table);
>> +	dpidx = s_dpidx = 0;
> 
>  From the reading the code below variable s_dpidx stands for "small" data page
> index, which isn't obvious from the get go and could easily be mistaken for
> "system" data page index.  Please add a comment to make your intentions clear.

Sure, I will add comments. They are supposed to mean :

dpidx => Data page index
s_dpidx => Sub-page index within the System page.

May be I can rename the variables to =>

sys_pidx and catu_pidx


> 
>> +	offset = 0;
>> +
>> +	table_ptr = catu_get_table(catu_table, 0, &cur_taddr);
>> +	prev_taddr = 0;	/* Prev link for the first table */
>> +
>> +	while (offset < buf_size) {
>> +		/*
>> +		 * The @offset is always 1M aligned here and we have an
>> +		 * empty table @table_ptr to fill. Each table can address
>> +		 * upto 1MB data buffer. The last table may have fewer
>> +		 * entries if the buffer size is not aligned.
>> +		 */
>> +		last_offset = (offset + SZ_1M) < buf_size ?
>> +			      (offset + SZ_1M) : buf_size;
>> +		for (i = 0; offset < last_offset;
>> +		     i++, offset += CATU_PAGE_SIZE) {
> 
> I really like the choice of "table_end" in function catu_dump_table().  I think
> using the same denomination here would make it easier to understand the code.
> 
> I wouldn't bother with such details if you weren't respinning this set.  But now
> that you are and these are extremely simple I think it's worth it, and it will
> help slowing the prolifiration of gray hair around my head when I look back at
> this a year or two down the road.

Sure, I can make those changes in the next revision. Thanks for the review.

Cheers
Suzuki

  reply	other threads:[~2018-06-22  9:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-18 10:56 [PATCH 0/6] coresight: Coresight Address Translation Unit support Suzuki K Poulose
2018-06-18 10:56 ` [PATCH 1/6] coresight: Cleanup device subtype struct Suzuki K Poulose
2018-06-18 10:56 ` [PATCH 2/6] coresight: Add helper device type Suzuki K Poulose
2018-06-18 10:56 ` [PATCH 3/6] coresight: Introduce support for Coresight Address Translation Unit Suzuki K Poulose
2018-06-20 21:41   ` Mathieu Poirier
2018-06-21  9:37     ` Suzuki K Poulose
2018-06-18 10:56 ` [PATCH 4/6] dts: bindings: Document device tree binding for CATU Suzuki K Poulose
2018-06-18 10:56 ` [PATCH 5/6] coresight: catu: Add support for scatter gather tables Suzuki K Poulose
2018-06-21 17:13   ` Mathieu Poirier
2018-06-22  9:01     ` Suzuki K Poulose [this message]
2018-06-22 14:38       ` Mathieu Poirier
2018-06-18 10:56 ` [PATCH 6/6] coresight: catu: Plug in CATU as a backend for ETR buffer 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=d5bbff9b-2730-f708-8a4e-f16241f6f5ce@arm.com \
    --to=suzuki.poulose@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    /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®