qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv2] add optee dts entry for secure machine
@ 2020-04-22 13:07 Maxim Uvarov
  2020-04-29 21:22 ` Maxim Uvarov
  0 siblings, 1 reply; 2+ messages in thread
From: Maxim Uvarov @ 2020-04-22 13:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: Maxim Uvarov

Add optee compatible string for dtb to force linux
to boot optee module.

Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
---
 v2: added method.
 hw/arm/virt.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 656b008..c937a82 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -1335,6 +1335,23 @@ static void create_platform_bus(VirtMachineState *vms)
                                 sysbus_mmio_get_region(s, 0));
 }
 
+static void create_secure_tee(VirtMachineState *vms)
+{
+    char *firmware;
+    char *optee;
+
+    firmware = g_strdup_printf("/firmware");
+    qemu_fdt_add_subnode(vms->fdt, firmware);
+
+    optee = g_strdup_printf("/firmware/optee");
+    qemu_fdt_add_subnode(vms->fdt, optee);
+    qemu_fdt_setprop_string(vms->fdt, optee, "compatible", "linaro,optee-tz");
+    qemu_fdt_setprop_string(vms->fdt, optee, "method", "smc");
+
+    g_free(optee);
+    g_free(firmware);
+}
+
 static void create_secure_ram(VirtMachineState *vms,
                               MemoryRegion *secure_sysmem)
 {
@@ -1720,6 +1737,7 @@ static void machvirt_init(MachineState *machine)
     if (vms->secure) {
         create_secure_ram(vms, secure_sysmem);
         create_uart(vms, VIRT_SECURE_UART, secure_sysmem, serial_hd(1));
+        create_secure_tee(vms);
     }
 
     vms->highmem_ecam &= vms->highmem && (!firmware_loaded || aarch64);
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCHv2] add optee dts entry for secure machine
  2020-04-22 13:07 [PATCHv2] add optee dts entry for secure machine Maxim Uvarov
@ 2020-04-29 21:22 ` Maxim Uvarov
  0 siblings, 0 replies; 2+ messages in thread
From: Maxim Uvarov @ 2020-04-29 21:22 UTC (permalink / raw)
  To: qemu-devel

Kindly ping to merge this patch.
For more detail. This patch creates a dtb entry to load the optee
driver which is needed for secure boot (atf+optee+uboot+linux). Kernel
part is already there:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/tee/optee/core.c?h=v5.7-rc3#n705
.compatible = "linaro,optee-tz"

Thank you,
Maxim.

On Wed, 22 Apr 2020 at 16:07, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:
>
> Add optee compatible string for dtb to force linux
> to boot optee module.
>
> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
> ---
>  v2: added method.
>  hw/arm/virt.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
>
> diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> index 656b008..c937a82 100644
> --- a/hw/arm/virt.c
> +++ b/hw/arm/virt.c
> @@ -1335,6 +1335,23 @@ static void create_platform_bus(VirtMachineState *vms)
>                                  sysbus_mmio_get_region(s, 0));
>  }
>
> +static void create_secure_tee(VirtMachineState *vms)
> +{
> +    char *firmware;
> +    char *optee;
> +
> +    firmware = g_strdup_printf("/firmware");
> +    qemu_fdt_add_subnode(vms->fdt, firmware);
> +
> +    optee = g_strdup_printf("/firmware/optee");
> +    qemu_fdt_add_subnode(vms->fdt, optee);
> +    qemu_fdt_setprop_string(vms->fdt, optee, "compatible", "linaro,optee-tz");
> +    qemu_fdt_setprop_string(vms->fdt, optee, "method", "smc");
> +
> +    g_free(optee);
> +    g_free(firmware);
> +}
> +
>  static void create_secure_ram(VirtMachineState *vms,
>                                MemoryRegion *secure_sysmem)
>  {
> @@ -1720,6 +1737,7 @@ static void machvirt_init(MachineState *machine)
>      if (vms->secure) {
>          create_secure_ram(vms, secure_sysmem);
>          create_uart(vms, VIRT_SECURE_UART, secure_sysmem, serial_hd(1));
> +        create_secure_tee(vms);
>      }
>
>      vms->highmem_ecam &= vms->highmem && (!firmware_loaded || aarch64);
> --
> 2.17.1
>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-29 21:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-22 13:07 [PATCHv2] add optee dts entry for secure machine Maxim Uvarov
2020-04-29 21:22 ` Maxim Uvarov

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).