Skip to contentSkip to conversation

arm64: Add SMC and HVC commands

PATCH New Michalis Pappas 4 participants 6 messages Apr 6, 2018 – Apr 9, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64: Add SMC and HVC commands

This patch adds smc and hvc commands, that allow issuing Secure Monitor Calls and Hypervisor Calls conforming to the ARM SMC Calling Convention.

Add Kconfig items to allow each command to be individually enabled.

---

 cmd/Kconfig  | 14 ++++++++++
 cmd/Makefile |  2 ++
 cmd/smccc.c  | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 88 insertions(+)
 create mode 100644 cmd/smccc.c
cmd/Kconfig +14 -0
index 136836d146..bed6835eca 100644
@@ -1348,6 +1348,20 @@ config CMD_HASH
 	  saved to memory or to an environment variable. It is also possible
 	  to verify a hash against data in memory.
 
+config CMD_HVC
+	bool "Support the 'hvc' command"
+	depends on ARM64
+	default n
+	help
+	  Allows issuing Hypervisor Calls (HVCs)
+
+config CMD_SMC
+	bool "Support the 'smc' command"
+	depends on ARM64
+	default n
+	help
+	  Allows issuing Secure Monitor Calls (SMCs)
+
 config HASH_VERIFY
 	bool "hash -v"
 	depends on CMD_HASH
cmd/Makefile +2 -0
index 9a358e4801..5656a1a40a 100644
@@ -61,6 +61,7 @@ obj-$(CONFIG_CMD_FS_GENERIC) += fs.o
 obj-$(CONFIG_CMD_FUSE) += fuse.o
 obj-$(CONFIG_CMD_GETTIME) += gettime.o
 obj-$(CONFIG_CMD_GPIO) += gpio.o
+obj-$(CONFIG_CMD_HVC) += smccc.o
 obj-$(CONFIG_CMD_I2C) += i2c.o
 obj-$(CONFIG_CMD_IOTRACE) += iotrace.o
 obj-$(CONFIG_CMD_HASH) += hash.o
@@ -113,6 +114,7 @@ obj-$(CONFIG_CMD_SHA1SUM) += sha1sum.o
 obj-$(CONFIG_CMD_SETEXPR) += setexpr.o
 obj-$(CONFIG_CMD_SPI) += spi.o
 obj-$(CONFIG_CMD_STRINGS) += strings.o
+obj-$(CONFIG_CMD_SMC) += smccc.o
 obj-$(CONFIG_CMD_TERMINAL) += terminal.o
 obj-$(CONFIG_CMD_TIME) += time.o
 obj-$(CONFIG_CMD_TRACE) += trace.o
cmd/smccc.c new file +72 -0

72 lines not on this page · raw message

--
2.17.0

#1 lore raw

PATCH 1/1 arm64: Add SMC and HVC commands

Hi,

Quoted 19 lines · Michalis Pappas

This patch adds smc and hvc commands, that allow issuing Secure Monitor Calls and Hypervisor Calls conforming to the ARM SMC Calling Convention.

Add Kconfig items to allow each command to be individually enabled.

---

 cmd/Kconfig  | 14 ++++++++++
 cmd/Makefile |  2 ++
 cmd/smccc.c  | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 88 insertions(+)
 create mode 100644 cmd/smccc.c
cmd/Kconfig +0 -0
index 136836d146..bed6835eca 100644

cmd/Kconfig config CMD_HASH · line 1356

Quoted 9 lines
cmd/Kconfig +6 -0
@@ -1348,6 +1348,20 @@ config CMD_HASH
          saved to memory or to an environment variable. It is also possible
          to verify a hash against data in memory.
 
+config CMD_HVC
+       bool "Support the 'hvc' command"
+       depends on ARM64
+       default n
+       help
+         Allows issuing Hypervisor Calls (HVCs)

Please expand on this. Why do you want to do this, what sort of things can you do?

Other than that:

#2 lore raw

PATCH 1/1 arm64: Add SMC and HVC commands

Quoted 6 lines · Simon Glass

Please expand on this. Why do you want to do this, what sort of things can you do?

Other than that:

The main usecase is development / testing.

My motivation was testing the Secure Payload of ARM Trusted Firmware on QEMU.
For HVC, I don't have a usecase TBH, but I still think it's useful (at a minimum, one can perform Call Count, UID and Revision queries).

Michalis

#3 lore raw

PATCH 1/1 arm64: Add SMC and HVC commands

Quoted 7 lines · Michalis Pappas
Quoted 5 lines · Simon Glass

Please expand on this. Why do you want to do this, what sort of things can you do?

Other than that:

Quoted 7 lines
Quoted 1 line

The main usecase is development / testing.

My motivation was testing the Secure Payload of ARM Trusted Firmware on QEMU.
For HVC, I don't have a usecase TBH, but I still think it's useful (at a minimum, one can perform Call Count, UID and Revision queries).

Please word that into an updated help message, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180408/4303ad69/attachment.sig>
#4 lore raw

PATCH 1/1 arm64: Add SMC and HVC commands

In reply to Michalis Pappas

cmd/Kconfig config CMD_HASH · line 1354

Quoted 4 lines · Michalis Pappas
cmd/Kconfig +4 -0
+config CMD_HVC
+       bool "Support the 'hvc' command"
+       depends on ARM64
+       default n

No need to pass 'default n' as this is already the default behavior.

cmd/Kconfig config CMD_HASH · line 1361

Quoted 7 lines
cmd/Kconfig +7 -0
+       help
+         Allows issuing Hypervisor Calls (HVCs)
+
+config CMD_SMC
+       bool "Support the 'smc' command"
+       depends on ARM64
+       default n

Ditto.

#5 lore raw

PATCH 1/1 arm64: Add SMC and HVC commands

Thanks for the feedback, I just sent a v2 addressing both issues

Quoted 16 lines · Fabio Estevam

cmd/Kconfig config CMD_HASH · line 1354

Quoted 4 lines · Michalis Pappas
cmd/Kconfig +4 -0
+config CMD_HVC
+       bool "Support the 'hvc' command"
+       depends on ARM64
+       default n

No need to pass 'default n' as this is already the default behavior.

cmd/Kconfig config CMD_HASH · line 1361

Quoted 7 lines
cmd/Kconfig +7 -0
+       help
+         Allows issuing Hypervisor Calls (HVCs)
+
+config CMD_SMC
+       bool "Support the 'smc' command"
+       depends on ARM64
+       default n

Ditto.