From: Tero Kristo <t-kristo@ti.com>
To: Kevin Hilman <khilman@ti.com>
Cc: linux-omap@vger.kernel.org, paul@pwsan.com,
linux-arm-kernel@lists.infradead.org,
Axel Haslam <axelhaslam@gmail.com>
Subject: Re: [PATCHv2 13/19] ARM: OMAP4: PM: Mark the PPI and SPI interrupts as non-secure for GP
Date: Mon, 21 May 2012 12:32:37 +0300 [thread overview]
Message-ID: <1337592757.28274.14.camel@sokoban> (raw)
In-Reply-To: <87ipfv4ril.fsf@ti.com>
On Wed, 2012-05-16 at 16:48 -0700, Kevin Hilman wrote:
> Tero Kristo <t-kristo@ti.com> writes:
>
> > From: Axel Haslam <axelhaslam@gmail.com>
> >
> > ROM code restores part of the GIC context during wakeup from device
> > off mode from the SAR RAM. If the PPI and SPI interrupts are not
> > marked as non-secure on GP chips, this crashes the device during
> > wakeup, thus mark them as non-secure.
> >
> > Signed-off-by: Axel Haslam <axelhaslam@gmail.com>
> > [t-kristo@ti.com: fixed commit message, merged multiple patches to one]
> > Signed-off-by: Tero Kristo <t-kristo@ti.com>
> > ---
> > arch/arm/mach-omap2/common.h | 1 +
> > arch/arm/mach-omap2/omap-wakeupgen.c | 21 +++++++++++++++++++++
> > arch/arm/mach-omap2/omap4-common.c | 5 +++++
> > arch/arm/mach-omap2/omap4-sar-layout.h | 3 +++
> > 4 files changed, 30 insertions(+), 0 deletions(-)
> >
> > diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
> > index 48d1ebe..0fbb4e2 100644
> > --- a/arch/arm/mach-omap2/common.h
> > +++ b/arch/arm/mach-omap2/common.h
> > @@ -200,6 +200,7 @@ static inline void __iomem *omap4_get_scu_base(void)
> >
> > extern void __init gic_init_irq(void);
> > extern void gic_dist_disable(void);
> > +extern u32 gic_readl(u32 offset, u8 idx);
> > extern void omap_smc1(u32 fn, u32 arg);
> > extern void __iomem *omap4_get_sar_ram_base(void);
> > extern void omap_do_wfi(void);
> > diff --git a/arch/arm/mach-omap2/omap-wakeupgen.c b/arch/arm/mach-omap2/omap-wakeupgen.c
> > index 805d08d..b2165e4 100644
> > --- a/arch/arm/mach-omap2/omap-wakeupgen.c
> > +++ b/arch/arm/mach-omap2/omap-wakeupgen.c
> > @@ -41,6 +41,7 @@
> > #define CPU_ENA_OFFSET 0x400
> > #define CPU0_ID 0x0
> > #define CPU1_ID 0x1
> > +#define GIC_ISR_NON_SECURE 0xffffffff
>
> nit: alignment with preceeding #defines
Will fix that.
>
> > static void __iomem *wakeupgen_base;
> > static void __iomem *sar_base;
> > @@ -387,6 +388,7 @@ int __init omap_wakeupgen_init(void)
> > {
> > int i;
> > unsigned int boot_cpu = smp_processor_id();
> > + int max_spi_reg;
> >
> > /* Not supported on OMAP4 ES1.0 silicon */
> > if (omap_rev() == OMAP4430_REV_ES1_0) {
> > @@ -422,6 +424,25 @@ int __init omap_wakeupgen_init(void)
> > for (i = 0; i < NR_IRQS; i++)
> > irq_target_cpu[i] = boot_cpu;
> >
> > + /*
> > + * Find out how many interrupts are supported.
> > + * OMAP4 supports max of 128 SPIs where as GIC can support
> > + * up to 1020 interrupt sources. On OMAP4, maximum SPIs are
> > + * fused in DIST_CTR bit-fields as 128. Hence the code is safe
> > + * from reserved register writes since its well within 1020.
> > + */
> > + max_spi_reg = gic_readl(GIC_DIST_CTR, 0) & 0x1f;
> > +
> > + if (omap_type() == OMAP2_DEVICE_TYPE_GP) {
> > + sar_base = ioremap(OMAP44XX_SAR_RAM_BASE, SZ_16K);
> > + sar_writel(GIC_ISR_NON_SECURE, ICDISR_CPU0_OFFSET, 0);
> > + sar_writel(GIC_ISR_NON_SECURE, ICDISR_CPU1_OFFSET, 0);
> > + for (i = 0; i < max_spi_reg; i++)
> > + sar_writel(GIC_ISR_NON_SECURE, ICDISR_SPI_OFFSET, i);
>
> The above 4 lines are begging for some comments (something like the
> changelog). Since later in the series more stuff is added here, the end
> result has some readability problems.
Will add.
>
> > + iounmap(sar_base);
> > + sar_base = NULL;
> > + }
> > irq_hotplug_init();
> > irq_pm_init();
> >
> > diff --git a/arch/arm/mach-omap2/omap4-common.c b/arch/arm/mach-omap2/omap4-common.c
> > index 7ea4652..f6019f6 100644
> > --- a/arch/arm/mach-omap2/omap4-common.c
> > +++ b/arch/arm/mach-omap2/omap4-common.c
> > @@ -112,6 +112,11 @@ void gic_dist_disable(void)
> > __raw_writel(0x0, gic_dist_base_addr + GIC_DIST_CTRL);
> > }
> >
> > +u32 gic_readl(u32 offset, u8 idx)
> > +{
>
> probably want an 'if (gic_dist_base_addr)' like gic_dist_disable()
Yea, will add that.
>
> > + return __raw_readl(gic_dist_base_addr + offset + 4 * idx);
> > +}
> > +
> > #ifdef CONFIG_CACHE_L2X0
> >
> > void __iomem *omap4_get_l2cache_base(void)
> > diff --git a/arch/arm/mach-omap2/omap4-sar-layout.h b/arch/arm/mach-omap2/omap4-sar-layout.h
> > index eef2839..0056667 100644
> > --- a/arch/arm/mach-omap2/omap4-sar-layout.h
> > +++ b/arch/arm/mach-omap2/omap4-sar-layout.h
> > @@ -85,6 +85,9 @@
> > #define SAR_BACKUP_STATUS_OFFSET (SAR_BANK3_OFFSET + 0x500)
> > #define SAR_SECURE_RAM_SIZE_OFFSET (SAR_BANK3_OFFSET + 0x504)
> > #define SAR_SECRAM_SAVED_AT_OFFSET (SAR_BANK3_OFFSET + 0x508)
> > +#define ICDISR_CPU0_OFFSET (SAR_BANK3_OFFSET + 0x50c)
> > +#define ICDISR_CPU1_OFFSET (SAR_BANK3_OFFSET + 0x510)
> > +#define ICDISR_SPI_OFFSET (SAR_BANK3_OFFSET + 0x514)
>
> SAR_ prefix?
Will add that too.
-Tero
>
> > /* WakeUpGen save restore offset from OMAP44XX_SAR_RAM_BASE */
> > #define WAKEUPGENENB_OFFSET_CPU0 (SAR_BANK3_OFFSET + 0x684)
>
> Kevin
next prev parent reply other threads:[~2012-05-21 9:32 UTC|newest]
Thread overview: 87+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-14 10:18 [PATCHv2 00/19] ARM: OMAP4: device off support Tero Kristo
2012-05-14 10:18 ` [PATCHv2 01/19] ARM: OMAP4: PM: powerdomain: Add HWSAR flag to L3INIT Tero Kristo
2012-05-16 18:27 ` Kevin Hilman
2012-05-14 10:18 ` [PATCHv2 02/19] ARM: OMAP4: Add SAR ROM base address Tero Kristo
2012-05-16 18:28 ` Kevin Hilman
2012-05-21 8:28 ` Tero Kristo
2012-05-14 10:18 ` [PATCHv2 03/19] ARM: OMAP4: PM: Add device-off support Tero Kristo
2012-05-16 22:36 ` Kevin Hilman
2012-05-17 7:10 ` Shilimkar, Santosh
2012-05-21 8:48 ` Tero Kristo
2012-05-21 14:05 ` Jean Pihet
2012-05-29 18:34 ` Kevin Hilman
2012-05-29 18:31 ` Kevin Hilman
2012-05-30 8:20 ` Tero Kristo
2012-05-14 10:18 ` [PATCHv2 04/19] ARM: OMAP4: PM: save/restore all DPLL settings in OFF mode Tero Kristo
2012-05-16 22:42 ` Kevin Hilman
2012-05-17 7:04 ` Shilimkar, Santosh
2012-05-17 8:52 ` Shilimkar, Santosh
2012-05-17 16:37 ` Kevin Hilman
2012-05-21 9:01 ` Tero Kristo
2012-05-29 19:46 ` Menon, Nishanth
2012-05-30 17:59 ` Kevin Hilman
2012-05-30 18:24 ` Menon, Nishanth
2012-05-30 22:09 ` Kevin Hilman
2012-05-31 2:38 ` Shilimkar, Santosh
2012-05-21 8:58 ` Tero Kristo
2012-05-14 10:18 ` [PATCHv2 05/19] ARM: OMAP4: PM: save/restore all CM1/2 " Tero Kristo
2012-05-16 22:48 ` Kevin Hilman
2012-05-17 7:05 ` Shilimkar, Santosh
2012-05-14 10:18 ` [PATCHv2 06/19] ARM: OMAP4: PM: Add SAR backup support towards device OFF Tero Kristo
2012-05-16 22:58 ` Kevin Hilman
2012-05-17 7:02 ` Shilimkar, Santosh
2012-05-17 16:42 ` Kevin Hilman
2012-05-18 5:53 ` Shilimkar, Santosh
2012-05-21 9:07 ` Tero Kristo
2012-05-14 10:18 ` [PATCHv2 07/19] ARM: OMAP4: Auto generate SAR layout contents Tero Kristo
2012-05-14 10:18 ` [PATCHv2 08/19] ARM: OMAP4: SAR: generate overwrite data based on SAR ROM contents Tero Kristo
2012-05-14 10:18 ` [PATCHv2 09/19] ARM: OMAP4: PM: add errata support Tero Kristo
2012-05-29 20:10 ` Menon, Nishanth
2012-05-30 8:32 ` Tero Kristo
2012-05-30 14:45 ` Menon, Nishanth
2012-05-14 10:18 ` [PATCHv2 10/19] ARM: OMAP4: PM: Work-around for ROM code BUG of IVAHD/TESLA Tero Kristo
2012-05-16 23:05 ` Kevin Hilman
2012-05-16 23:07 ` Kevin Hilman
2012-05-21 9:11 ` Tero Kristo
2012-05-29 20:13 ` Kevin Hilman
2012-05-17 6:52 ` Shilimkar, Santosh
2012-05-17 16:45 ` Kevin Hilman
2012-05-18 5:55 ` Shilimkar, Santosh
2012-05-14 10:18 ` [PATCHv2 11/19] ARM: OMAP4: PM: save/restore CM L3INSTR registers when MPU hits OSWR/OFF mode Tero Kristo
2012-05-16 23:17 ` Kevin Hilman
2012-05-17 6:53 ` Shilimkar, Santosh
2012-05-14 10:18 ` [PATCHv2 12/19] ARM: OMAP4: PM: update ROM return address for OSWR and OFF Tero Kristo
2012-05-16 23:36 ` Kevin Hilman
2012-05-21 9:29 ` Tero Kristo
2012-05-14 10:18 ` [PATCHv2 13/19] ARM: OMAP4: PM: Mark the PPI and SPI interrupts as non-secure for GP Tero Kristo
2012-05-16 23:48 ` Kevin Hilman
2012-05-21 9:32 ` Tero Kristo [this message]
2012-05-14 10:18 ` [PATCHv2 14/19] ARM: OMAP4: wakeupgen: enable clocks for save_secure_all Tero Kristo
2012-05-17 0:06 ` Kevin Hilman
2012-05-21 9:38 ` Tero Kristo
2012-05-21 9:43 ` Shilimkar, Santosh
2012-05-29 20:15 ` Kevin Hilman
2012-05-29 20:48 ` Menon, Nishanth
2012-05-30 8:44 ` Tero Kristo
2012-05-30 8:33 ` Tero Kristo
2012-05-17 0:17 ` Paul Walmsley
2012-05-21 9:35 ` Tero Kristo
2012-05-21 9:39 ` Shilimkar, Santosh
2012-05-14 10:18 ` [PATCHv2 15/19] ARM: OMAP4430: PM: workaround for DDR corruption on second CS Tero Kristo
2012-05-17 0:15 ` Kevin Hilman
2012-05-17 7:12 ` Shilimkar, Santosh
2012-05-17 16:47 ` Kevin Hilman
2012-05-18 5:55 ` Shilimkar, Santosh
2012-05-14 10:18 ` [PATCHv2 16/19] TEMP: ARM: OMAP4: prevent voltage transitions Tero Kristo
2012-05-14 10:18 ` [PATCHv2 17/19] ARM: OMAP4: put cpu1 back to sleep if no wake request Tero Kristo
2012-05-17 0:31 ` Kevin Hilman
2012-05-21 10:21 ` Tero Kristo
2012-05-21 10:40 ` Shilimkar, Santosh
2012-05-29 20:17 ` Kevin Hilman
2012-05-30 15:18 ` Menon, Nishanth
2012-05-14 10:18 ` [PATCHv2 18/19] ARM: OMAP4460: wakeupgen: set GIC_CPU0 backup status flag always Tero Kristo
2012-05-17 0:33 ` Kevin Hilman
2012-05-21 9:12 ` Tero Kristo
2012-05-14 10:18 ` [PATCHv2 19/19] ARM: OMAP4: powerdomain: update mpu / core off counters during device off Tero Kristo
2012-05-30 21:08 ` Menon, Nishanth
2012-05-31 6:50 ` Tero Kristo
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=1337592757.28274.14.camel@sokoban \
--to=t-kristo@ti.com \
--cc=axelhaslam@gmail.com \
--cc=khilman@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-omap@vger.kernel.org \
--cc=paul@pwsan.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;
as well as URLs for NNTP newsgroup(s).