From: Julien Grall <julien.grall@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Julien Grall <julien.grall@citrix.com>,
Andre Przywara <andre.przywara@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com
Subject: [PATCH 1/2] xen/arm: Add support of PSCI v1.0 for the host
Date: Thu, 8 Oct 2015 19:45:00 +0100 [thread overview]
Message-ID: <1444329901-19055-2-git-send-email-julien.grall@citrix.com> (raw)
In-Reply-To: <1444329901-19055-1-git-send-email-julien.grall@citrix.com>
>From Xen point of view, PSCI v0.2 and PSCI v1.0 are very similar. All
the PSCI calls used within Xen (PSCI_VERSION, CPU_ON, SYSTEM_OFF and
SYSTEM_RESET) behaves exactly the same.
While there is no compatible string to represent PSCI v1.0 in the DT,
it's possible to detect it using the function PSCI_VERSION.
The compatible string is now used to detect if the platform may support
PSCI v0.2 or higher.
Signed-off-by: Julien Grall <julien.grall@citrix.com>
---
Cc: Andre Przywara <andre.przywara@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
---
xen/arch/arm/psci.c | 9 +++++----
xen/include/asm-arm/psci.h | 13 +++++++++++++
2 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/xen/arch/arm/psci.c b/xen/arch/arm/psci.c
index 172c6e7..53ee2e4 100644
--- a/xen/arch/arm/psci.c
+++ b/xen/arch/arm/psci.c
@@ -122,15 +122,16 @@ int __init psci_init_0_2(void)
psci_ver = call_smc(PSCI_0_2_FN_PSCI_VERSION, 0, 0, 0);
- if ( psci_ver != XEN_PSCI_V_0_2 )
+ if ( psci_ver != PSCI_VERSION(0, 2) && psci_ver != PSCI_VERSION(1, 0) )
{
- printk("Error: PSCI version %#x is not supported.\n", psci_ver);
- return -EOPNOTSUPP;
+ printk("Error: Conflicting PSCI version detected (%#x)\n", psci_ver);
+ return -EINVAL;
}
psci_cpu_on_nr = PSCI_0_2_FN_NATIVE(CPU_ON);
- printk(XENLOG_INFO "Using PSCI-0.2 for SMP bringup\n");
+ printk(XENLOG_INFO "Using PSCI-%u.%u for SMP bringup\n",
+ PSCI_VERSION_MAJOR(psci_ver), PSCI_VERSION_MINOR(psci_ver));
return 0;
}
diff --git a/xen/include/asm-arm/psci.h b/xen/include/asm-arm/psci.h
index 5d17ee3..d8a109f 100644
--- a/xen/include/asm-arm/psci.h
+++ b/xen/include/asm-arm/psci.h
@@ -87,6 +87,19 @@ void do_psci_0_2_system_reset(void);
#define PSCI_0_2_POWER_STATE_TYPE_MASK \
(0x1 << PSCI_0_2_POWER_STATE_TYPE_SHIFT)
+/* PSCI version decoding (independent of PSCI version) */
+#define PSCI_VERSION_MAJOR_SHIFT 16
+#define PSCI_VERSION_MINOR_MASK \
+ ((1U << PSCI_VERSION_MAJOR_SHIFT) - 1)
+#define PSCI_VERSION_MAJOR_MASK ~PSCI_VERSION_MINOR_MASK
+#define PSCI_VERSION_MAJOR(ver) \
+ (((ver) & PSCI_VERSION_MAJOR_MASK) >> PSCI_VERSION_MAJOR_SHIFT)
+#define PSCI_VERSION_MINOR(ver) \
+ ((ver) & PSCI_VERSION_MINOR_MASK)
+
+#define PSCI_VERSION(major, minor) \
+ (((major) << PSCI_VERSION_MAJOR_SHIFT) | (minor))
+
#endif /* __ASM_PSCI_H__ */
/*
--
2.1.4
next prev parent reply other threads:[~2015-10-08 18:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-08 18:44 [PATCH 0/2] xen/arm: Add support for PSCI v1.0 Julien Grall
2015-10-08 18:45 ` Julien Grall [this message]
2015-10-09 15:08 ` [PATCH 1/2] xen/arm: Add support of PSCI v1.0 for the host Ian Campbell
2015-10-09 15:17 ` Mark Rutland
2015-10-09 15:30 ` Ian Campbell
2015-10-09 15:30 ` Julien Grall
2015-10-09 15:24 ` Julien Grall
2015-10-08 18:45 ` [PATCH 2/2] xen/arm: Replace XEN_PSCI_* by PSCI_VERSION(major, minor) Julien Grall
2015-10-09 15:10 ` Ian Campbell
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=1444329901-19055-2-git-send-email-julien.grall@citrix.com \
--to=julien.grall@citrix.com \
--cc=andre.przywara@arm.com \
--cc=ian.campbell@citrix.com \
--cc=mark.rutland@arm.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=xen-devel@lists.xenproject.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).