public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Scott Wood <oss@buserror.net>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 8/9] ARM: ARMv7: PSCI: ls102xa: add psci functions implemention
Date: Thu, 21 Jan 2016 16:56:19 -0600	[thread overview]
Message-ID: <1453416979.19133.81.camel@buserror.net> (raw)
In-Reply-To: <DB3PR04MB16946B95737724159A2CDE497C10@DB3PR04MB169.eurprd04.prod.outlook.com>

On Tue, 2016-01-19 at 06:28 +0000, Dongsheng Wang wrote:
> Hi Scott,
> 
> > On Mon, 2016-01-18 at 12:27 +0800, Dongsheng Wang wrote:
> > > From: Wang Dongsheng <dongsheng.wang@nxp.com>
> > > 
> > > Based on PSCI v1.0, implement interface for ls102xa SoC:
> > > psci_version,
> > > psci_features,
> > > psci_cpu_suspend,
> > > psci_affinity_info,
> > > psci_system_reset,
> > > psci_system_off.
> > > 
> > > Tested on LS1021aQDS, LS1021aTWR.
> > > 
> > > Signed-off-by: Wang Dongsheng <dongsheng.wang@nxp.com>
> > > ---
> > >  arch/arm/cpu/armv7/ls102xa/psci.S          | 110
> > > +++++++++++++++++++++++++++--
> > >  arch/arm/include/asm/arch-ls102xa/config.h |   1 +
> > >  board/freescale/ls1021aqds/Makefile        |   1 +
> > >  board/freescale/ls1021aqds/psci.S          |  36 ++++++++++
> > >  board/freescale/ls1021atwr/Makefile        |   1 +
> > >  board/freescale/ls1021atwr/psci.S          |  28 ++++++++
> > >  include/configs/ls1021aqds.h               |   3 +
> > >  include/configs/ls1021atwr.h               |   1 +
> > >  8 files changed, 177 insertions(+), 4 deletions(-)  create mode
> > > 100644 board/freescale/ls1021aqds/psci.S  create mode 100644
> > > board/freescale/ls1021atwr/psci.S
> > > 
> > > diff --git a/arch/arm/cpu/armv7/ls102xa/psci.S
> > > b/arch/arm/cpu/armv7/ls102xa/psci.S
> > > index 3091362..bfc908e 100644
> > > --- a/arch/arm/cpu/armv7/ls102xa/psci.S
> > > +++ b/arch/arm/cpu/armv7/ls102xa/psci.S
> > > @@ -12,19 +12,72 @@
> > >  #include <asm/arch-armv7/generictimer.h>  #include <asm/psci.h>
> > > 
> > > +#define RCPM_TWAITSR		0x04C
> > > +
> > >  #define SCFG_CORE0_SFT_RST      0x130
> > >  #define SCFG_CORESRENCR         0x204
> > > 
> > > -#define DCFG_CCSR_BRR           0x0E4
> > > -#define DCFG_CCSR_SCRATCHRW1    0x200
> > > +#define DCFG_CCSR_RSTCR			0x0B0
> > > +#define DCFG_CCSR_RSTCR_RESET_REQ	0x2
> > > +#define DCFG_CCSR_BRR			0x0E4
> > > +#define DCFG_CCSR_SCRATCHRW1		0x200
> > > +
> > > +#define PSCI_FN_PSCI_VERSION_FEATURE_MASK	0x0
> > > +#define PSCI_FN_CPU_SUSPEND_FEATURE_MASK	0x0
> > > +#define PSCI_FN_CPU_OFF_FEATURE_MASK		0x0
> > > +#define PSCI_FN_CPU_ON_FEATURE_MASK		0x0
> > > +#define PSCI_FN_AFFINITY_INFO_FEATURE_MASK	0x0
> > > +#define PSCI_FN_SYSTEM_OFF_FEATURE_MASK		0x0
> > > +#define PSCI_FN_SYSTEM_RESET_FEATURE_MASK	0x0
> > > 
> > >  	.pushsection ._secure.text, "ax"
> > > 
> > >  	.arch_extension sec
> > > 
> > > +	.align	5
> > > +
> > >  #define	ONE_MS		(GENERIC_TIMER_CLK / 1000)
> > >  #define	RESET_WAIT	(30 * ONE_MS)
> > > 
> > > +.globl	psci_version
> > > +psci_version:
> > > +	movw	r0, #0
> > > +	movt	r0, #1
> > > +
> > > +	bx	lr
> > > +
> > > +_ls102x_psci_supported_table:
> > > +	.word	PSCI_FN_PSCI_VERSION
> > > +	.word	PSCI_FN_PSCI_VERSION_FEATURE_MASK
> > > +	.word	PSCI_FN_CPU_SUSPEND
> > > +	.word	PSCI_FN_CPU_SUSPEND_FEATURE_MASK
> > > +	.word	PSCI_FN_CPU_OFF
> > > +	.word	PSCI_FN_CPU_OFF_FEATURE_MASK
> > > +	.word	PSCI_FN_CPU_ON
> > > +	.word	PSCI_FN_CPU_ON_FEATURE_MASK
> > > +	.word	PSCI_FN_AFFINITY_INFO
> > > +	.word	PSCI_FN_AFFINITY_INFO_FEATURE_MASK
> > > +	.word	PSCI_FN_SYSTEM_OFF
> > > +	.word	PSCI_FN_SYSTEM_OFF_FEATURE_MASK
> > > +	.word	PSCI_FN_SYSTEM_RESET
> > > +	.word	PSCI_FN_SYSTEM_RESET_FEATURE_MASK
> > > +	.word	0
> > > +	.word	PSCI_RET_NOT_SUPPORTED
> > 
> > Can you use the main _psci_table instead of duplicating it?
> > 
> 
> The main table does not apply here. Because this table shows what is
> supported in our platform.

How does that set differ from what's in the main table?

> And this table also contains the sub-feature mask of PSCI functions.

...which is always zero.  As of PSCI 1.0 there's only one function that
supports subfeatures, and you could put an explicit check in for that if it
ever needs a non-zero value.

> > > +
> > > +.globl	psci_features
> > > +psci_features:
> > > +	adr	r2, _ls102x_psci_supported_table
> > > +1:	ldr	r3, [r2]
> > > +	cmp	r3, #0
> > > +	beq	out_psci_features
> > > +	cmp	r1, r3
> > > +	addne	r2, r2, #8
> > > +	bne	1b
> > 
> > Why are you adding 8 here?
> > 
> 
> +4 is the sub-feature mask of the PSCI function. So we need to +8 to jump to
> next PSCI function.
> .word	PSCI_FN_PSCI_VERSION
> .word	PSCI_FN_PSCI_VERSION_FEATURE_MASK
>
> > > +
> > > +out_psci_features:
> > > +	ldr	r0, [r2, #4]
> > > +	bx	lr
> > 
> > If you find a match, you're supposed to return zero, not the next function
> > id in
> > the table.
> > How did you test this?  There should really be a test suite for runtime
> > services
> > such as this, especially when trying to comply with a standard.
> 
> I think maybe you missed something about this code. The return value is
> PSCI_FN_PSCI_XXXXXX_FEATURE_MASK,
> not return next function ID.

Yes, I misread the table and missed the masks.  But see above about them being
unnecessary.

In any case, a test suite would be very helpful.

-Scott

  reply	other threads:[~2016-01-21 22:56 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-18  4:27 [U-Boot] [PATCH 0/9] ARM: ARMv7: PSCI: add PSCI v1.0 support Dongsheng Wang
2016-01-18  4:27 ` [U-Boot] [PATCH 1/9] ARM: PSCI: Change function ID base value Dongsheng Wang
2016-01-18  4:27 ` [U-Boot] [PATCH 2/9] ARM: PSCI: Change PSCI related macro definition style Dongsheng Wang
2016-01-18  4:27 ` [U-Boot] [PATCH 3/9] ARM: ARMv7: PSCI: move target PC in each CPU stack no longer is shared Dongsheng Wang
2016-03-16  7:04   ` Chenhui Zhao
2016-03-16  8:29     ` Hongbo Zhang
     [not found]     ` <DB3PR04MB0812BFF5181A4DDE5FE8267A848A0@DB3PR04MB0812.eurprd04.prod.outlook.com>
2016-03-16  8:29       ` Wang Dongsheng
2016-01-18  4:27 ` [U-Boot] [PATCH 4/9] ARM: ARMv7: PSCI: Factor out reusable psci_cpu_on_common Dongsheng Wang
2016-01-18  4:27 ` [U-Boot] [PATCH 5/9] ARM: ARMv7: PSCI: Pass contextID to target CPU Dongsheng Wang
2016-01-18  4:27 ` [U-Boot] [PATCH 6/9] ARM: ARMv7: PSCI: ls102xa: Verify CPU ID for CPU_ON Dongsheng Wang
2016-01-18 23:01   ` Scott Wood
2016-01-19  6:31     ` Dongsheng Wang
2016-01-18  4:27 ` [U-Boot] [PATCH 7/9] ARM: ARMv7: PSCI: Add PSCI 1.0 version support Dongsheng Wang
2016-01-18 22:30   ` Scott Wood
2016-01-19  5:52     ` Dongsheng Wang
2016-01-18  4:27 ` [U-Boot] [PATCH 8/9] ARM: ARMv7: PSCI: ls102xa: add psci functions implemention Dongsheng Wang
2016-01-18 22:52   ` Scott Wood
2016-01-19  6:28     ` Dongsheng Wang
2016-01-21 22:56       ` Scott Wood [this message]
2016-01-22  2:46         ` Dongsheng Wang
2016-03-03  3:54         ` Dongsheng Wang
2016-01-18  4:27 ` [U-Boot] [PATCH 9/9] ARM: ARMv7: PSCI: ls102xa: put secure text section into OCRAM Dongsheng Wang
2016-03-03  3:51 ` [U-Boot] [PATCH 0/9] ARM: ARMv7: PSCI: add PSCI v1.0 support Dongsheng Wang

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=1453416979.19133.81.camel@buserror.net \
    --to=oss@buserror.net \
    --cc=u-boot@lists.denx.de \
    /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