diff mbox

[U-Boot,v7,3/9] armv8: Add Secure Monitor/Hypervisor Call (SMC/HVC) infrastructure

Message ID 1444841757-28043-4-git-send-email-s.temerkhanov@gmail.com
State Accepted
Delegated to: Tom Rini
Headers show

Commit Message

Sergey Temerkhanov Oct. 14, 2015, 4:55 p.m. UTC
This commit adds functions issuing calls to secure monitor or
hypervisore. This allows using services such as Power State
Coordination Interface (PSCI) provided by firmware, e.g. ARM
Trusted Firmware (ATF)

The SMC call can destroy all registers declared temporary by the
calling conventions. The clobber list is "x0..x17" because of
this

Signed-off-by: Sergey Temerkhanov <s.temerkhanov@gmail.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
Signed-off-by: Radha Mohan Chintakuntla <rchintakuntla@cavium.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

---

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4:
- Document FW calls

Changes in v3:
- Fixed clobber lists (thanks to Corey)

Changes in v2: None

 arch/arm/cpu/armv8/Makefile   |  1 +
 arch/arm/cpu/armv8/fwcall.c   | 75 +++++++++++++++++++++++++++++++++++++++++++
 arch/arm/include/asm/system.h | 21 ++++++++++++
 3 files changed, 97 insertions(+)
 create mode 100644 arch/arm/cpu/armv8/fwcall.c

Comments

Mateusz Kulikowski Jan. 6, 2016, 1:04 p.m. UTC | #1
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 14.10.2015 18:55, Sergey Temerkhanov wrote:
> This commit adds functions issuing calls to secure monitor or
> hypervisore. This allows using services such as Power State
> Coordination Interface (PSCI) provided by firmware, e.g. ARM
> Trusted Firmware (ATF)
> 
> The SMC call can destroy all registers declared temporary by the
> calling conventions. The clobber list is "x0..x17" because of
> this
> 
> Signed-off-by: Sergey Temerkhanov <s.temerkhanov@gmail.com>
> Signed-off-by: Corey Minyard <cminyard@mvista.com>
> Signed-off-by: Radha Mohan Chintakuntla <rchintakuntla@cavium.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>

+1 (I may need it as well)

Tested-by: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>

Tested on: Hikey
Methodology:

Hacked smc handler in arm trusted firmware (x0=x0+x1, x1=x2+x3, x2=x4+x5, x3=x6+2)
+new u-boot command (smc/hvc) using functions from this patch;

I didn't tested hvc code (would need to make some fake hypervisor), but it's basically the same.

Idea: perhaps after this series is merged we can add 2 new commands to u-boot (SMC/HVC) to 
play with hypervisors/secure monitors (and perhaps use some simple functionality if needed).


@Sergey - you probably need to rebase the patch as it doesn't apply to master cleanly

Regards,
Mateusz

> 
> ---
> 
> Changes in v7: None
> Changes in v6: None
> Changes in v5: None
> Changes in v4:
> - Document FW calls
> 
> Changes in v3:
> - Fixed clobber lists (thanks to Corey)
> 
> Changes in v2: None
> 
>  arch/arm/cpu/armv8/Makefile   |  1 +
>  arch/arm/cpu/armv8/fwcall.c   | 75 +++++++++++++++++++++++++++++++++++++++++++
>  arch/arm/include/asm/system.h | 21 ++++++++++++
>  3 files changed, 97 insertions(+)
>  create mode 100644 arch/arm/cpu/armv8/fwcall.c
> 
> diff --git a/arch/arm/cpu/armv8/Makefile b/arch/arm/cpu/armv8/Makefile
> index adb11b3..7579ea7 100644
> --- a/arch/arm/cpu/armv8/Makefile
> +++ b/arch/arm/cpu/armv8/Makefile
> @@ -14,6 +14,7 @@ obj-y	+= exceptions.o
>  obj-y	+= cache.o
>  obj-y	+= tlb.o
>  obj-y	+= transition.o
> +obj-y	+= fwcall.o
>  
>  obj-$(CONFIG_FSL_LSCH3) += fsl-lsch3/
>  obj-$(CONFIG_ARCH_ZYNQMP) += zynqmp/
> diff --git a/arch/arm/cpu/armv8/fwcall.c b/arch/arm/cpu/armv8/fwcall.c
> new file mode 100644
> index 0000000..9efcc5a
> --- /dev/null
> +++ b/arch/arm/cpu/armv8/fwcall.c
> @@ -0,0 +1,75 @@
> +/**
> + * (C) Copyright 2014, Cavium Inc.
> + *
> + * SPDX-License-Identifier:	GPL-2.0+
> +**/
> +
> +#include <asm-offsets.h>
> +#include <config.h>
> +#include <version.h>
> +#include <asm/macro.h>
> +#include <asm/system.h>
> +
> +/*
> + * Issue the hypervisor call
> + *
> + * x0~x7: input arguments
> + * x0~x3: output arguments
> + */
> +void hvc_call(struct pt_regs *args)
> +{
> +	asm volatile(
> +		"ldr x0, %0\n"
> +		"ldr x1, %1\n"
> +		"ldr x2, %2\n"
> +		"ldr x3, %3\n"
> +		"ldr x4, %4\n"
> +		"ldr x5, %5\n"
> +		"ldr x6, %6\n"
> +		"ldr x7, %7\n"
> +		"hvc	#0\n"
> +		"str x0, %0\n"
> +		"str x1, %1\n"
> +		"str x2, %2\n"
> +		"str x3, %3\n"
> +		: "+m" (args->regs[0]), "+m" (args->regs[1]),
> +		  "+m" (args->regs[2]), "+m" (args->regs[3])
> +		: "m" (args->regs[4]), "m" (args->regs[5]),
> +		  "m" (args->regs[6]), "m" (args->regs[7])
> +		: "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7",
> +		  "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15",
> +		  "x16", "x17");
> +}
> +
> +/*
> + * void smc_call(arg0, arg1...arg7)
> + *
> + * issue the secure monitor call
> + *
> + * x0~x7: input arguments
> + * x0~x3: output arguments
> + */
> +
> +void smc_call(struct pt_regs *args)
> +{
> +	asm volatile(
> +		"ldr x0, %0\n"
> +		"ldr x1, %1\n"
> +		"ldr x2, %2\n"
> +		"ldr x3, %3\n"
> +		"ldr x4, %4\n"
> +		"ldr x5, %5\n"
> +		"ldr x6, %6\n"
> +		"smc	#0\n"
> +		"str x0, %0\n"
> +		"str x1, %1\n"
> +		"str x2, %2\n"
> +		"str x3, %3\n"
> +		: "+m" (args->regs[0]), "+m" (args->regs[1]),
> +		  "+m" (args->regs[2]), "+m" (args->regs[3])
> +		: "m" (args->regs[4]), "m" (args->regs[5]),
> +		  "m" (args->regs[6])
> +		: "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7",
> +		  "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15",
> +		  "x16", "x17");
> +}
> diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
> index 9288541..f3e2d1b 100644
> --- a/arch/arm/include/asm/system.h
> +++ b/arch/arm/include/asm/system.h
> @@ -1,6 +1,9 @@
>  #ifndef __ASM_ARM_SYSTEM_H
>  #define __ASM_ARM_SYSTEM_H
>  
> +#include <common.h>
> +#include <linux/compiler.h>
> +
>  #ifdef CONFIG_ARM64
>  
>  /*
> @@ -104,6 +107,24 @@ void smp_kick_all_cpus(void);
>  
>  void flush_l3_cache(void);
>  
> +/*
> + *Issue a hypervisor call in accordance with ARM "SMC Calling convention",
> + * DEN0028A
> + *
> + * @args: input and output arguments
> + *
> + */
> +void hvc_call(struct pt_regs *args);
> +
> +/*
> + *Issue a secure monitor call in accordance with ARM "SMC Calling convention",
> + * DEN0028A
> + *
> + * @args: input and output arguments
> + *
> + */
> +void smc_call(struct pt_regs *args);
> +
>  #endif	/* __ASSEMBLY__ */
>  
>  #else /* CONFIG_ARM64 */
> 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCAAGBQJWjRDgAAoJELvtohmVtQzBD/4IAJBh4uT99P/qRZtXr2SJhnIE
45wp3vuQw22IhwUiV0D/8V7dtElYLy8C3Ct4xbZF15oibSdto8k9tJjuuLw/DOdV
aYvNwCSc0eyckHAfwjUwMlW4rMFVYD4ik+kvDBb9Rr9b8rpJIPWWA0mBY95rHTq/
0uq2KsxHvbMCmmuNWksb6lk7s7fcrR3j2uavvtrFtMT255dKqw/kinWxXHDVKrWa
MBngc1rsa23u07oN9MyDpE0knCLB01l3pkmu4FB5CybJvJ7FPLxMPZNaataFo4Z/
6KM02h6RYhGntiveQ+2/vIm4BHK7XSkX9CBsi9SpV+opN8MSwhC3RKNFem72hBk=
=2qqk
-----END PGP SIGNATURE-----
Michal Simek Jan. 7, 2016, 3:06 p.m. UTC | #2
On 6.1.2016 14:04, Mateusz Kulikowski wrote:
> On 14.10.2015 18:55, Sergey Temerkhanov wrote:
>> This commit adds functions issuing calls to secure monitor or
>> hypervisore. This allows using services such as Power State
>> Coordination Interface (PSCI) provided by firmware, e.g. ARM
>> Trusted Firmware (ATF)
> 
>> The SMC call can destroy all registers declared temporary by the
>> calling conventions. The clobber list is "x0..x17" because of
>> this
> 
>> Signed-off-by: Sergey Temerkhanov <s.temerkhanov@gmail.com>
>> Signed-off-by: Corey Minyard <cminyard@mvista.com>
>> Signed-off-by: Radha Mohan Chintakuntla <rchintakuntla@cavium.com>
>> Reviewed-by: Simon Glass <sjg@chromium.org>
> 
> +1 (I may need it as well)
> 
> Tested-by: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
> 
> Tested on: Hikey
> Methodology:
> 
> Hacked smc handler in arm trusted firmware (x0=x0+x1, x1=x2+x3, x2=x4+x5, x3=x6+2)
> +new u-boot command (smc/hvc) using functions from this patch;
> 
> I didn't tested hvc code (would need to make some fake hypervisor), but it's basically the same.
> 
> Idea: perhaps after this series is merged we can add 2 new commands to u-boot (SMC/HVC) to 
> play with hypervisors/secure monitors (and perhaps use some simple functionality if needed).

How this should look like?

Definitely I would like to see this code in mainline because we have
code which needs to call SMCs.

Thanks,
Michal
Tom Rini Jan. 7, 2016, 4:26 p.m. UTC | #3
On Thu, Jan 07, 2016 at 04:06:55PM +0100, Michal Simek wrote:
> On 6.1.2016 14:04, Mateusz Kulikowski wrote:
> > On 14.10.2015 18:55, Sergey Temerkhanov wrote:
> >> This commit adds functions issuing calls to secure monitor or
> >> hypervisore. This allows using services such as Power State
> >> Coordination Interface (PSCI) provided by firmware, e.g. ARM
> >> Trusted Firmware (ATF)
> > 
> >> The SMC call can destroy all registers declared temporary by the
> >> calling conventions. The clobber list is "x0..x17" because of
> >> this
> > 
> >> Signed-off-by: Sergey Temerkhanov <s.temerkhanov@gmail.com>
> >> Signed-off-by: Corey Minyard <cminyard@mvista.com>
> >> Signed-off-by: Radha Mohan Chintakuntla <rchintakuntla@cavium.com>
> >> Reviewed-by: Simon Glass <sjg@chromium.org>
> > 
> > +1 (I may need it as well)
> > 
> > Tested-by: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
> > 
> > Tested on: Hikey
> > Methodology:
> > 
> > Hacked smc handler in arm trusted firmware (x0=x0+x1, x1=x2+x3, x2=x4+x5, x3=x6+2)
> > +new u-boot command (smc/hvc) using functions from this patch;
> > 
> > I didn't tested hvc code (would need to make some fake hypervisor), but it's basically the same.
> > 
> > Idea: perhaps after this series is merged we can add 2 new commands to u-boot (SMC/HVC) to 
> > play with hypervisors/secure monitors (and perhaps use some simple functionality if needed).
> 
> How this should look like?
> 
> Definitely I would like to see this code in mainline because we have
> code which needs to call SMCs.

I guess the answer is we either need the cavium board series re-posted
without the device-tree binding change that is causing consternation
elsewhere or come up with something else there, or I just pull parts of
the series.  I'm not quite sure which is best at this point..
Michal Simek Jan. 7, 2016, 7 p.m. UTC | #4
On 7.1.2016 17:26, Tom Rini wrote:
> On Thu, Jan 07, 2016 at 04:06:55PM +0100, Michal Simek wrote:
>> On 6.1.2016 14:04, Mateusz Kulikowski wrote:
>>> On 14.10.2015 18:55, Sergey Temerkhanov wrote:
>>>> This commit adds functions issuing calls to secure monitor or
>>>> hypervisore. This allows using services such as Power State
>>>> Coordination Interface (PSCI) provided by firmware, e.g. ARM
>>>> Trusted Firmware (ATF)
>>>
>>>> The SMC call can destroy all registers declared temporary by the
>>>> calling conventions. The clobber list is "x0..x17" because of
>>>> this
>>>
>>>> Signed-off-by: Sergey Temerkhanov <s.temerkhanov@gmail.com>
>>>> Signed-off-by: Corey Minyard <cminyard@mvista.com>
>>>> Signed-off-by: Radha Mohan Chintakuntla <rchintakuntla@cavium.com>
>>>> Reviewed-by: Simon Glass <sjg@chromium.org>
>>>
>>> +1 (I may need it as well)
>>>
>>> Tested-by: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
>>>
>>> Tested on: Hikey
>>> Methodology:
>>>
>>> Hacked smc handler in arm trusted firmware (x0=x0+x1, x1=x2+x3, x2=x4+x5, x3=x6+2)
>>> +new u-boot command (smc/hvc) using functions from this patch;
>>>
>>> I didn't tested hvc code (would need to make some fake hypervisor), but it's basically the same.
>>>
>>> Idea: perhaps after this series is merged we can add 2 new commands to u-boot (SMC/HVC) to 
>>> play with hypervisors/secure monitors (and perhaps use some simple functionality if needed).
>>
>> How this should look like?
>>
>> Definitely I would like to see this code in mainline because we have
>> code which needs to call SMCs.
> 
> I guess the answer is we either need the cavium board series re-posted
> without the device-tree binding change that is causing consternation
> elsewhere or come up with something else there, or I just pull parts of
> the series.  I'm not quite sure which is best at this point..

This patch can go standalone I believe. Should it go via Albert or
directly through you?
I think that make sense to add it in merge window.
I am happy to test it on zynqmp.

Thanks,
Michal
Mateusz Kulikowski Jan. 7, 2016, 9:39 p.m. UTC | #5
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 07.01.2016 16:06, Michal Simek wrote:
> On 6.1.2016 14:04, Mateusz Kulikowski wrote:
>> On 14.10.2015 18:55, Sergey Temerkhanov wrote:
[...]

>>
>> Idea: perhaps after this series is merged we can add 2 new commands to u-boot (SMC/HVC) to 
>> play with hypervisors/secure monitors (and perhaps use some simple functionality if needed).
> 
> How this should look like?

I thought of something like this (I did such code few times):

u-boot> smc 42 42 42 42 42 42
ret => (0x1, 0x2, 0x3, 0x4)

Or something similar (perhaps setting env variables so return value can be used in scripts)

Regards,
Mateusz
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCAAGBQJWjtsVAAoJELvtohmVtQzBa9oH/3/wQfIjTBeRqTUJw/spaojw
skkTAGjYVJXrlQJJw6YNi7z1uYhA91VEkF/04u0wT45JU/SUjHtCtdqWnYwwIAPK
r4zAoPpr5VLxLbvAiIBQLC+DkkvtTES3bSvPvI5NVM7hiIvnzJNmXfgLpG+ju+qZ
IHrteaN6Idt1LZOGBiz5/aIaXpGkii85U6eSViH/bj9Ocpjv0aj+BDjQVZaM7OSr
3YHy2Mbi0eN97KrUWm+w1DxaFvoSJvtbzfZDdgTAiZlWcL7zSkL6SquD4eDMSnOc
gJPLoURHQCZxD3zwLKMYVL+St1oE2k1HrwfeWE4ypBRsV6R2++9JETfdBFphn+A=
=v6rh
-----END PGP SIGNATURE-----
Michal Simek Jan. 8, 2016, 10:19 a.m. UTC | #6
On 7.1.2016 22:39, Mateusz Kulikowski wrote:
> On 07.01.2016 16:06, Michal Simek wrote:
>> On 6.1.2016 14:04, Mateusz Kulikowski wrote:
>>> On 14.10.2015 18:55, Sergey Temerkhanov wrote:
> [...]
> 
>>>
>>> Idea: perhaps after this series is merged we can add 2 new commands to u-boot (SMC/HVC) to 
>>> play with hypervisors/secure monitors (and perhaps use some simple functionality if needed).
> 
>> How this should look like?
> 
> I thought of something like this (I did such code few times):
> 
> u-boot> smc 42 42 42 42 42 42
> ret => (0x1, 0x2, 0x3, 0x4)
> 
> Or something similar (perhaps setting env variables so return value can be used in scripts)

I have no problem with that.

M
Tom Rini Jan. 19, 2016, 10:34 p.m. UTC | #7
On Wed, Oct 14, 2015 at 09:55:46AM -0700, Sergey Temerkhanov wrote:

> This commit adds functions issuing calls to secure monitor or
> hypervisore. This allows using services such as Power State
> Coordination Interface (PSCI) provided by firmware, e.g. ARM
> Trusted Firmware (ATF)
> 
> The SMC call can destroy all registers declared temporary by the
> calling conventions. The clobber list is "x0..x17" because of
> this
> 
> Signed-off-by: Sergey Temerkhanov <s.temerkhanov@gmail.com>
> Signed-off-by: Corey Minyard <cminyard@mvista.com>
> Signed-off-by: Radha Mohan Chintakuntla <rchintakuntla@cavium.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Tested-by: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>

Applied to u-boot/master, thanks!
Behme Dirk (CM/ESO2) June 23, 2016, 11:33 a.m. UTC | #8
Hi Mateusz,

On 07.01.2016 22:39, Mateusz Kulikowski wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> On 07.01.2016 16:06, Michal Simek wrote:
>> On 6.1.2016 14:04, Mateusz Kulikowski wrote:
>>> On 14.10.2015 18:55, Sergey Temerkhanov wrote:
> [...]
>
>>>
>>> Idea: perhaps after this series is merged we can add 2 new commands to u-boot (SMC/HVC) to
>>> play with hypervisors/secure monitors (and perhaps use some simple functionality if needed).
>>
>> How this should look like?
>
> I thought of something like this (I did such code few times):
>
> u-boot> smc 42 42 42 42 42 42
> ret => (0x1, 0x2, 0x3, 0x4)


Could you share any (example?) code you have for such an smc/hvc U-Boot 
command?

Best regards

Dirk
Mateusz Kulikowski June 25, 2016, 7:04 p.m. UTC | #9
Hi Dirk,

On 23.06.2016 13:33, Dirk Behme wrote:
[...]
>>>>
>>>> Idea: perhaps after this series is merged we can add 2 new commands to u-boot (SMC/HVC) to
>>>> play with hypervisors/secure monitors (and perhaps use some simple functionality if needed).
>>>
>>> How this should look like?
>>
>> I thought of something like this (I did such code few times):
>>
>> u-boot> smc 42 42 42 42 42 42
>> ret => (0x1, 0x2, 0x3, 0x4)
> 
> 
> Could you share any (example?) code you have for such an smc/hvc U-Boot command?

I'm afraid I don't have it anymore :(

SMC call itself is trivial, you can use smc_call @ u-boot:
arch/arm/cpu/armv8/fwcall.c
(this is code for armv8 in 64-bit mode, but you can easily port it to armv7)

As for adding custom commands - just use any existing as template (sleep may be a good idea :) ).

Regards,
Mateusz
diff mbox

Patch

diff --git a/arch/arm/cpu/armv8/Makefile b/arch/arm/cpu/armv8/Makefile
index adb11b3..7579ea7 100644
--- a/arch/arm/cpu/armv8/Makefile
+++ b/arch/arm/cpu/armv8/Makefile
@@ -14,6 +14,7 @@  obj-y	+= exceptions.o
 obj-y	+= cache.o
 obj-y	+= tlb.o
 obj-y	+= transition.o
+obj-y	+= fwcall.o
 
 obj-$(CONFIG_FSL_LSCH3) += fsl-lsch3/
 obj-$(CONFIG_ARCH_ZYNQMP) += zynqmp/
diff --git a/arch/arm/cpu/armv8/fwcall.c b/arch/arm/cpu/armv8/fwcall.c
new file mode 100644
index 0000000..9efcc5a
--- /dev/null
+++ b/arch/arm/cpu/armv8/fwcall.c
@@ -0,0 +1,75 @@ 
+/**
+ * (C) Copyright 2014, Cavium Inc.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+**/
+
+#include <asm-offsets.h>
+#include <config.h>
+#include <version.h>
+#include <asm/macro.h>
+#include <asm/system.h>
+
+/*
+ * Issue the hypervisor call
+ *
+ * x0~x7: input arguments
+ * x0~x3: output arguments
+ */
+void hvc_call(struct pt_regs *args)
+{
+	asm volatile(
+		"ldr x0, %0\n"
+		"ldr x1, %1\n"
+		"ldr x2, %2\n"
+		"ldr x3, %3\n"
+		"ldr x4, %4\n"
+		"ldr x5, %5\n"
+		"ldr x6, %6\n"
+		"ldr x7, %7\n"
+		"hvc	#0\n"
+		"str x0, %0\n"
+		"str x1, %1\n"
+		"str x2, %2\n"
+		"str x3, %3\n"
+		: "+m" (args->regs[0]), "+m" (args->regs[1]),
+		  "+m" (args->regs[2]), "+m" (args->regs[3])
+		: "m" (args->regs[4]), "m" (args->regs[5]),
+		  "m" (args->regs[6]), "m" (args->regs[7])
+		: "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7",
+		  "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15",
+		  "x16", "x17");
+}
+
+/*
+ * void smc_call(arg0, arg1...arg7)
+ *
+ * issue the secure monitor call
+ *
+ * x0~x7: input arguments
+ * x0~x3: output arguments
+ */
+
+void smc_call(struct pt_regs *args)
+{
+	asm volatile(
+		"ldr x0, %0\n"
+		"ldr x1, %1\n"
+		"ldr x2, %2\n"
+		"ldr x3, %3\n"
+		"ldr x4, %4\n"
+		"ldr x5, %5\n"
+		"ldr x6, %6\n"
+		"smc	#0\n"
+		"str x0, %0\n"
+		"str x1, %1\n"
+		"str x2, %2\n"
+		"str x3, %3\n"
+		: "+m" (args->regs[0]), "+m" (args->regs[1]),
+		  "+m" (args->regs[2]), "+m" (args->regs[3])
+		: "m" (args->regs[4]), "m" (args->regs[5]),
+		  "m" (args->regs[6])
+		: "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7",
+		  "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15",
+		  "x16", "x17");
+}
diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
index 9288541..f3e2d1b 100644
--- a/arch/arm/include/asm/system.h
+++ b/arch/arm/include/asm/system.h
@@ -1,6 +1,9 @@ 
 #ifndef __ASM_ARM_SYSTEM_H
 #define __ASM_ARM_SYSTEM_H
 
+#include <common.h>
+#include <linux/compiler.h>
+
 #ifdef CONFIG_ARM64
 
 /*
@@ -104,6 +107,24 @@  void smp_kick_all_cpus(void);
 
 void flush_l3_cache(void);
 
+/*
+ *Issue a hypervisor call in accordance with ARM "SMC Calling convention",
+ * DEN0028A
+ *
+ * @args: input and output arguments
+ *
+ */
+void hvc_call(struct pt_regs *args);
+
+/*
+ *Issue a secure monitor call in accordance with ARM "SMC Calling convention",
+ * DEN0028A
+ *
+ * @args: input and output arguments
+ *
+ */
+void smc_call(struct pt_regs *args);
+
 #endif	/* __ASSEMBLY__ */
 
 #else /* CONFIG_ARM64 */