From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 3/3] pm: at91: add disable/enable the L1/L2 cache while suspend/resume
Date: Thu, 29 Jan 2015 11:34:50 +0000 [thread overview]
Message-ID: <20150129113450.GW26493@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <1422411844-13241-1-git-send-email-wenyou.yang@atmel.com>
On Wed, Jan 28, 2015 at 10:24:04AM +0800, Wenyou Yang wrote:
> + /*
> + * Clean and invalidate the L2 cache.
> + * Common cache-l2x0.c functions can't be used here since it
> + * uses spinlocks. We are out of coherency here with data cache
> + * disabled. The spinlock implementation uses exclusive load/store
> + * instruction which can fail without data cache being enabled.
> + * Because of this, CPU can lead to deadlock.
We really need to stop needing platforms to create their own L2 handling
code. Please move this to a helper function in arch/arm/mm/l2c-l...-clean.S,
replacing ... with the appropriate part for the code fragment.
> + */
> + ldr r1, at91_l2cc_base_addr
> + ldr r2, [r1]
> + cmp r2, #0
> + beq skip_l2disable
> + mov r0, #0xff
> + str r0, [r2, #L2X0_CLEAN_INV_WAY]
> +wait:
> + ldr r0, [r2, #L2X0_CLEAN_INV_WAY]
> + mov r1, #0xff
> + ands r0, r0, r1
> + bne wait
> +
> + mov r0, #0
> + str r0, [r2, #L2X0_CTRL]
> +
> +l2x_sync:
> + ldr r0, [r2, #L2X0_CACHE_SYNC]
> + bic r0, r0, #0x1
> + str r0, [r2, #L2X0_CACHE_SYNC]
I wonder whether you've actually read the documentation for this. You
don't need to read-modify-write this register. The C code doesn't even
do this. A write to this register is sufficient - a write issues the
sync, a read returns the completion status.
> +sync:
> + ldr r0, [r2, #L2X0_CACHE_SYNC]
> + ands r0, r0, #0x1
> + bne sync
Moreover, do you actually need this - it depends on the L2C model. Only
L2C220 needs to spin waiting for the sync operation to complete.
Also, are you sure the "clean+invalidate, disable, sync" sequence is
correct? Should it not be "clean+invalidate, sync, disable" ?
--
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.
next prev parent reply other threads:[~2015-01-29 11:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-28 2:21 [PATCH v2 0/3] AT91 pm improvements for 3.20 Wenyou Yang
2015-01-28 2:22 ` [PATCH v2 1/3] pm: at91: pm_suspend: add the WFI support for ARMv7 Wenyou Yang
2015-01-28 2:23 ` [PATCH v2 2/3] pm: at91: pm_suspend: MOR register KEY was missing Wenyou Yang
2015-01-28 2:24 ` [PATCH v2 3/3] pm: at91: add disable/enable the L1/L2 cache while suspend/resume Wenyou Yang
2015-01-28 10:09 ` Sergei Shtylyov
2015-01-29 2:22 ` Yang, Wenyou
2015-01-29 11:34 ` Russell King - ARM Linux [this message]
2015-01-30 7:32 ` Yang, Wenyou
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=20150129113450.GW26493@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).