lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4CAB3074.5010106@stericsson.com>
Date:	Tue, 5 Oct 2010 16:04:36 +0200
From:	Linus Walleij <linus.walleij@...ricsson.com>
To:	Colin Cross <ccross@...roid.com>
Cc:	"linux-arm-kernel@...ts.infradead.org" 
	<linux-arm-kernel@...ts.infradead.org>,
	Gary King <gking@...dia.com>,
	Russell King <linux@....linux.org.uk>,
	Rabin VINCENT <rabin.vincent@...ricsson.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Rickard ANDERSSON <rickard.andersson@...ricsson.com>
Subject: Re: [PATCH 1/2] gic: Add functions to save and restore gic state

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@...ricsson.com>

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ