linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH V3 3/6] arm: cache-l2x0: add support for Aurora L2 cache ctrl
Date: Sat, 15 Sep 2012 21:42:57 +0100	[thread overview]
Message-ID: <20120915204257.GL12245@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <1346852677-5381-4-git-send-email-gregory.clement@free-electrons.com>

On Wed, Sep 05, 2012 at 03:44:34PM +0200, Gregory CLEMENT wrote:
> @@ -275,6 +281,112 @@ static void l2x0_flush_range(unsigned long start, unsigned long end)
>  	cache_sync();
>  	raw_spin_unlock_irqrestore(&l2x0_lock, flags);
>  }
> +/*

Where's the blank line?

> + * Note that the end addresses passed to Linux primitives are
> + * noninclusive, while the hardware cache range operations use
> + * inclusive start and end addresses.
> + */
> +static unsigned long calc_range_end(unsigned long start, unsigned long end)
> +{
> +	if (!IS_ALIGNED(start, CACHE_LINE_SIZE)) {
> +		pr_warn("%s: start address not align on a cache line size\n",
> +			__func__);
> +		start &= ~(CACHE_LINE_SIZE-1);
> +	};

No semicolon here.  But why is this check even here?

> +
> +	if (!IS_ALIGNED(end, CACHE_LINE_SIZE)) {
> +		pr_warn("%s: end address not align on a cache line size\n",
> +			__func__);
> +		end = (PAGE_ALIGN(end));
> +	}

And this one - and why when it fails do you align to a page not a cache
line?

> +static void aurora_inv_range(unsigned long start, unsigned long end)
> +{
> +	/*
> +	 * round start and end adresses up to cache line size
> +	 */
> +	start &= ~(CACHE_LINE_SIZE - 1);
> +	end = ALIGN(end, CACHE_LINE_SIZE);
> +
> +	/*
> +	 * Invalidate all full cache lines between 'start' and 'end'.
> +	 */
> +	while (start < end) {
> +		unsigned long range_end = calc_range_end(start, end);

And note that you (above) guarantee that the start/end addresses are
cache line aligned.  It only goes wrong if your calc_range_end()
fails - but isn't that a matter of internal proving that your code is
correct, rather than lumbering all kernels with such checking?

  parent reply	other threads:[~2012-09-15 20:42 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-05 13:44 [PATCH V3] Add support for Aurora L2 Cache Controller Gregory CLEMENT
2012-09-05 13:44 ` [PATCH V3 1/6] arm: cache-l2x0: make outer_cache_fns a field of l2x0_of_data Gregory CLEMENT
2012-09-09 19:27   ` Jason Cooper
2012-09-15 20:35   ` Russell King - ARM Linux
2012-09-20  6:40     ` Gregory CLEMENT
2012-09-05 13:44 ` [PATCH V3 2/6] arm: cache-l2x0: add an optional register to save/restore Gregory CLEMENT
2012-09-09 19:28   ` Jason Cooper
2012-09-05 13:44 ` [PATCH V3 3/6] arm: cache-l2x0: add support for Aurora L2 cache ctrl Gregory CLEMENT
2012-09-06 11:11   ` Will Deacon
2012-09-06 11:49     ` Gregory CLEMENT
2012-09-06 13:02       ` Will Deacon
2012-09-09 19:33   ` Jason Cooper
2012-09-15 20:42   ` Russell King - ARM Linux [this message]
2012-09-20  7:26     ` Gregory CLEMENT
2012-09-05 13:44 ` [PATCH V3 4/6] arm: mvebu: add L2 cache support Gregory CLEMENT
2012-09-09 19:35   ` Jason Cooper
2012-09-05 13:44 ` [PATCH V3 5/6] arm: mvebu: add Aurora L2 Cache Controller to the DT Gregory CLEMENT
2012-09-09 19:36   ` Jason Cooper
2012-09-05 13:44 ` [PATCH V3 6/6] arm: l2x0: add aurora related properties to OF binding Gregory CLEMENT
2012-09-09 19:37   ` Jason Cooper

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=20120915204257.GL12245@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).