From: Linus Walleij <linus.walleij@stericsson.com>
To: Colin Cross <ccross@android.com>
Cc: "linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
Gary King <gking@nvidia.com>,
Russell King <linux@arm.linux.org.uk>,
Rabin VINCENT <rabin.vincent@stericsson.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Rickard ANDERSSON <rickard.andersson@stericsson.com>
Subject: Re: [PATCH 1/2] gic: Add functions to save and restore gic state
Date: Tue, 5 Oct 2010 16:04:36 +0200 [thread overview]
Message-ID: <4CAB3074.5010106@stericsson.com> (raw)
In-Reply-To: <1285901335-26354-1-git-send-email-ccross@android.com>
Colin Cross wrote:
> on systems with idle states which power-gate the logic including
> the gic, such as tegra, the gic distributor needs to be shut down
> and restored on entry and exit from the architecture idle code
Nice!
> +
> +#ifdef CONFIG_PM
> +void gic_dist_save(unsigned int gic_nr)
> +{
> + unsigned int max_irq = gic_data[gic_nr].max_irq;
> + void __iomem *dist_base = gic_data[gic_nr].dist_base;
> + int i;
> +
> + if (gic_nr >= MAX_GIC_NR)
> + BUG();
> +
> + _gic_dist_exit(gic_nr);
> +
> + for (i = 0; i < DIV_ROUND_UP(max_irq, 16); i++)
> + gic_data[gic_nr].saved_conf[i] =
> + readl(dist_base + GIC_DIST_CONFIG + i * 4);
> +
> + for (i = 0; i < DIV_ROUND_UP(max_irq, 4); i++)
> + gic_data[gic_nr].saved_pri[i] =
> + readl(dist_base + GIC_DIST_PRI + i * 4);
> +
> + for (i = 0; i < DIV_ROUND_UP(max_irq, 4); i++)
> + gic_data[gic_nr].saved_target[i] =
> + readl(dist_base + GIC_DIST_TARGET + i * 4);
> +
> + for (i = 0; i < DIV_ROUND_UP(max_irq, 32); i++)
> + gic_data[gic_nr].saved_enable[i] =
> + readl(dist_base + GIC_DIST_ENABLE_SET + i * 4);
> +}
> +
> +void gic_dist_restore(unsigned int gic_nr)
> +{
> + unsigned int max_irq;
> + unsigned int i;
> + void __iomem *dist_base;
> + void __iomem *cpu_base;
> +
> + if (gic_nr >= MAX_GIC_NR)
> + BUG();
> +
> + _gic_dist_init(gic_nr);
> +
> + max_irq = gic_data[gic_nr].max_irq;
> + dist_base = gic_data[gic_nr].dist_base;
> + cpu_base = gic_data[gic_nr].cpu_base;
> +
> + for (i = 0; i < DIV_ROUND_UP(max_irq, 16); i++)
> + writel(gic_data[gic_nr].saved_conf[i],
> + dist_base + GIC_DIST_CONFIG + i * 4);
> +
> + for (i = 0; i < DIV_ROUND_UP(max_irq, 4); i++)
> + writel(gic_data[gic_nr].saved_pri[i],
> + dist_base + GIC_DIST_PRI + i * 4);
> +
> + for (i = 0; i < DIV_ROUND_UP(max_irq, 4); i++)
> + writel(gic_data[gic_nr].saved_target[i],
> + dist_base + GIC_DIST_TARGET + i * 4);
> +
> + for (i = 0; i < DIV_ROUND_UP(max_irq, 32); i++)
> + writel(gic_data[gic_nr].saved_enable[i],
> + dist_base + GIC_DIST_ENABLE_SET + i * 4);
> +
> + writel(1, dist_base + GIC_DIST_CTRL);
> + writel(0xf0, cpu_base + GIC_CPU_PRIMASK);
> + writel(1, cpu_base + GIC_CPU_CTRL);
> +}
> +#endif
For gic_dist_save()/gic_dist_restore() can you write some
comment to each function about the implicit semantics for
calling them?
If I *guess* correctly gic_dist_save() must be called in
something like a platform idle function after disabling all
IRQs but before sleeping, conversely gic_dist_restort()
must be called after sleeping but before re-enabling the
IRQs.
Apart from that it looks good to me so with this
simple comment-fix it's:
Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Yours,
Linus Walleij
prev parent reply other threads:[~2010-10-05 14:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-01 2:48 [PATCH 1/2] gic: Add functions to save and restore gic state Colin Cross
2010-10-01 2:48 ` [PATCH 2/2] gic: Export irq chip functions Colin Cross
2010-10-02 18:03 ` Linus Walleij
2010-10-02 20:21 ` Colin Cross
2010-10-05 14:04 ` Linus Walleij [this message]
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=4CAB3074.5010106@stericsson.com \
--to=linus.walleij@stericsson.com \
--cc=ccross@android.com \
--cc=gking@nvidia.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=rabin.vincent@stericsson.com \
--cc=rickard.andersson@stericsson.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