All of lore.kernel.org
 help / color / mirror / Atom feed
From: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
To: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: "tee-dev@lists.linaro.org" <tee-dev@lists.linaro.org>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>,
	Wei Liu <wei.liu2@citrix.com>
Subject: [PATCH v5 09/10] tools/arm: tee: add "tee" option for xl.cfg
Date: Tue, 21 May 2019 21:26:18 +0000	[thread overview]
Message-ID: <20190521212530.12706-10-volodymyr_babchuk@epam.com> (raw)
In-Reply-To: <20190521212530.12706-1-volodymyr_babchuk@epam.com>

This enumeration controls TEE type for a domain. Currently there is
two possible options: either 'none' or 'optee'.

'none' is the default value and it basically disables TEE support at
all.

'native' enables access to a "real" OP-TEE installed on a platform.

It is possible to add another types in the future.

Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
---

 All the patches to optee.c should be merged together. They were
 split to ease up review. But they depend heavily on each other.

 Changes from v4:
  - "native" option was replaced with "optee"
  - "tee" property was moved from arch-specific section to the
     global one. Documentation moved inside "Devices" section.

 Changes from v3:
  - tee_enabled renamed to tee_type. Currently two types are supported
    as described in the commit message
  - Add LIBXL_HAVE_BUILDINFO_ARCH_ARM_TEE definition

 Changes from v2:
  - Use arch.tee_enabled instead of separate domctl
---
 docs/man/xl.cfg.5.pod.in    | 19 +++++++++++++++++++
 tools/libxl/libxl.h         |  5 +++++
 tools/libxl/libxl_arm.c     | 13 +++++++++++++
 tools/libxl/libxl_types.idl |  6 ++++++
 tools/xl/xl_parse.c         |  9 +++++++++
 5 files changed, 52 insertions(+)

diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in
index c7d70e618b..73c64dc896 100644
--- a/docs/man/xl.cfg.5.pod.in
+++ b/docs/man/xl.cfg.5.pod.in
@@ -1544,6 +1544,25 @@ Set maximum height for pointer device.
 
 =back
 
+=item B<tee=["none", "optee"]>
+
+Set TEE type for the guest. TEE is a Trusted Execution Environment -- separate
+secuse OS found on some platforms.
+
+=over 4
+
+=item B<"none">
+
+Disable TEE support at all. This is the default value.
+
+=item B<"optee">
+
+Allow guest to access to OP-TEE enabled on the platform. Guest will not be created
+if platform does not have OP-TEE with virtualization feature or if OP-TEE will
+deny access.
+
+=back
+
 =back
 
 =head2 Paravirtualised (PV) Guest Specific Options
diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
index 482499a6c0..294a92f645 100644
--- a/tools/libxl/libxl.h
+++ b/tools/libxl/libxl.h
@@ -273,6 +273,11 @@
  */
 #define LIBXL_HAVE_BUILDINFO_ARM_GIC_VERSION 1
 
+/*
+ * libxl_domain_build_info has the arch_arm.tee field.
+ */
+#define LIBXL_HAVE_BUILDINFO_ARCH_ARM_TEE 1
+
 /*
  * LIBXL_HAVE_SOFT_RESET indicates that libxl supports performing
  * 'soft reset' for domains and there is 'soft_reset' shutdown reason
diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
index 141e159043..6b72c00960 100644
--- a/tools/libxl/libxl_arm.c
+++ b/tools/libxl/libxl_arm.c
@@ -89,6 +89,19 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc,
         return ERROR_FAIL;
     }
 
+    switch (d_config->b_info.tee) {
+    case LIBXL_TEE_TYPE_NONE:
+        config->arch.tee_type = XEN_DOMCTL_CONFIG_TEE_NONE;
+        break;
+    case LIBXL_TEE_TYPE_OPTEE:
+        config->arch.tee_type = XEN_DOMCTL_CONFIG_TEE_OPTEE;
+        break;
+    default:
+        LOG(ERROR, "Unknown TEE type %d",
+            d_config->b_info.tee);
+        return ERROR_FAIL;
+    }
+
     return 0;
 }
 
diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
index cb4702fd7a..4eaccd2cc7 100644
--- a/tools/libxl/libxl_types.idl
+++ b/tools/libxl/libxl_types.idl
@@ -460,6 +460,11 @@ libxl_gic_version = Enumeration("gic_version", [
     (0x30, "v3")
     ], init_val = "LIBXL_GIC_VERSION_DEFAULT")
 
+libxl_tee_type = Enumeration("tee_type", [
+    (0, "none"),
+    (1, "optee")
+    ], init_val = "LIBXL_TEE_TYPE_NONE")
+
 libxl_rdm_reserve = Struct("rdm_reserve", [
     ("strategy",    libxl_rdm_reserve_strategy),
     ("policy",      libxl_rdm_reserve_policy),
@@ -537,6 +542,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
     ("nested_hvm",       libxl_defbool),
     ("apic",             libxl_defbool),
     ("dm_restrict",      libxl_defbool),
+    ("tee",              libxl_tee_type),
     ("u", KeyedUnion(None, libxl_domain_type, "type",
                 [("hvm", Struct(None, [("firmware",         string),
                                        ("bios",             libxl_bios_type),
diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
index 352cd214dd..d98ad0cffb 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -2690,6 +2690,15 @@ skip_usbdev:
         }
     }
 
+    if (!xlu_cfg_get_string (config, "tee", &buf, 1)) {
+        e = libxl_tee_type_from_string(buf, &b_info->tee);
+        if (e) {
+            fprintf(stderr,
+                    "Unknown tee \"%s\" specified\n", buf);
+            exit(-ERROR_FAIL);
+        }
+    }
+
     parse_vkb_list(config, d_config);
 
     xlu_cfg_destroy(config);
-- 
2.21.0

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

WARNING: multiple messages have this Message-ID (diff)
From: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
To: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: "tee-dev@lists.linaro.org" <tee-dev@lists.linaro.org>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>,
	Wei Liu <wei.liu2@citrix.com>
Subject: [Xen-devel] [PATCH v5 09/10] tools/arm: tee: add "tee" option for xl.cfg
Date: Tue, 21 May 2019 21:26:18 +0000	[thread overview]
Message-ID: <20190521212530.12706-10-volodymyr_babchuk@epam.com> (raw)
Message-ID: <20190521212618.FGo1LzJfPm5ZuydMiYocmrMq1WqVV0aM_hW-PlVrzTs@z> (raw)
In-Reply-To: <20190521212530.12706-1-volodymyr_babchuk@epam.com>

This enumeration controls TEE type for a domain. Currently there is
two possible options: either 'none' or 'optee'.

'none' is the default value and it basically disables TEE support at
all.

'native' enables access to a "real" OP-TEE installed on a platform.

It is possible to add another types in the future.

Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
---

 All the patches to optee.c should be merged together. They were
 split to ease up review. But they depend heavily on each other.

 Changes from v4:
  - "native" option was replaced with "optee"
  - "tee" property was moved from arch-specific section to the
     global one. Documentation moved inside "Devices" section.

 Changes from v3:
  - tee_enabled renamed to tee_type. Currently two types are supported
    as described in the commit message
  - Add LIBXL_HAVE_BUILDINFO_ARCH_ARM_TEE definition

 Changes from v2:
  - Use arch.tee_enabled instead of separate domctl
---
 docs/man/xl.cfg.5.pod.in    | 19 +++++++++++++++++++
 tools/libxl/libxl.h         |  5 +++++
 tools/libxl/libxl_arm.c     | 13 +++++++++++++
 tools/libxl/libxl_types.idl |  6 ++++++
 tools/xl/xl_parse.c         |  9 +++++++++
 5 files changed, 52 insertions(+)

diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in
index c7d70e618b..73c64dc896 100644
--- a/docs/man/xl.cfg.5.pod.in
+++ b/docs/man/xl.cfg.5.pod.in
@@ -1544,6 +1544,25 @@ Set maximum height for pointer device.
 
 =back
 
+=item B<tee=["none", "optee"]>
+
+Set TEE type for the guest. TEE is a Trusted Execution Environment -- separate
+secuse OS found on some platforms.
+
+=over 4
+
+=item B<"none">
+
+Disable TEE support at all. This is the default value.
+
+=item B<"optee">
+
+Allow guest to access to OP-TEE enabled on the platform. Guest will not be created
+if platform does not have OP-TEE with virtualization feature or if OP-TEE will
+deny access.
+
+=back
+
 =back
 
 =head2 Paravirtualised (PV) Guest Specific Options
diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
index 482499a6c0..294a92f645 100644
--- a/tools/libxl/libxl.h
+++ b/tools/libxl/libxl.h
@@ -273,6 +273,11 @@
  */
 #define LIBXL_HAVE_BUILDINFO_ARM_GIC_VERSION 1
 
+/*
+ * libxl_domain_build_info has the arch_arm.tee field.
+ */
+#define LIBXL_HAVE_BUILDINFO_ARCH_ARM_TEE 1
+
 /*
  * LIBXL_HAVE_SOFT_RESET indicates that libxl supports performing
  * 'soft reset' for domains and there is 'soft_reset' shutdown reason
diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
index 141e159043..6b72c00960 100644
--- a/tools/libxl/libxl_arm.c
+++ b/tools/libxl/libxl_arm.c
@@ -89,6 +89,19 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc,
         return ERROR_FAIL;
     }
 
+    switch (d_config->b_info.tee) {
+    case LIBXL_TEE_TYPE_NONE:
+        config->arch.tee_type = XEN_DOMCTL_CONFIG_TEE_NONE;
+        break;
+    case LIBXL_TEE_TYPE_OPTEE:
+        config->arch.tee_type = XEN_DOMCTL_CONFIG_TEE_OPTEE;
+        break;
+    default:
+        LOG(ERROR, "Unknown TEE type %d",
+            d_config->b_info.tee);
+        return ERROR_FAIL;
+    }
+
     return 0;
 }
 
diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
index cb4702fd7a..4eaccd2cc7 100644
--- a/tools/libxl/libxl_types.idl
+++ b/tools/libxl/libxl_types.idl
@@ -460,6 +460,11 @@ libxl_gic_version = Enumeration("gic_version", [
     (0x30, "v3")
     ], init_val = "LIBXL_GIC_VERSION_DEFAULT")
 
+libxl_tee_type = Enumeration("tee_type", [
+    (0, "none"),
+    (1, "optee")
+    ], init_val = "LIBXL_TEE_TYPE_NONE")
+
 libxl_rdm_reserve = Struct("rdm_reserve", [
     ("strategy",    libxl_rdm_reserve_strategy),
     ("policy",      libxl_rdm_reserve_policy),
@@ -537,6 +542,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
     ("nested_hvm",       libxl_defbool),
     ("apic",             libxl_defbool),
     ("dm_restrict",      libxl_defbool),
+    ("tee",              libxl_tee_type),
     ("u", KeyedUnion(None, libxl_domain_type, "type",
                 [("hvm", Struct(None, [("firmware",         string),
                                        ("bios",             libxl_bios_type),
diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
index 352cd214dd..d98ad0cffb 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -2690,6 +2690,15 @@ skip_usbdev:
         }
     }
 
+    if (!xlu_cfg_get_string (config, "tee", &buf, 1)) {
+        e = libxl_tee_type_from_string(buf, &b_info->tee);
+        if (e) {
+            fprintf(stderr,
+                    "Unknown tee \"%s\" specified\n", buf);
+            exit(-ERROR_FAIL);
+        }
+    }
+
     parse_vkb_list(config, d_config);
 
     xlu_cfg_destroy(config);
-- 
2.21.0

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  parent reply	other threads:[~2019-05-21 21:26 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-21 21:25 [PATCH v5 00/10] TEE mediator (and OP-TEE) support in XEN Volodymyr Babchuk
2019-05-21 21:25 ` [Xen-devel] " Volodymyr Babchuk
2019-05-21 21:25 ` [PATCH v5 01/10] xen/arm: add generic TEE mediator framework Volodymyr Babchuk
2019-05-21 21:25   ` [Xen-devel] " Volodymyr Babchuk
2019-05-22  8:45   ` Jan Beulich
2019-05-22  8:45     ` [Xen-devel] " Jan Beulich
2019-05-22  9:27     ` Julien Grall
2019-05-22  9:27       ` [Xen-devel] " Julien Grall
2019-05-22 10:02       ` Jan Beulich
2019-05-22 10:02         ` [Xen-devel] " Jan Beulich
2019-05-22 12:04         ` Julien Grall
2019-05-22 12:04           ` [Xen-devel] " Julien Grall
2019-06-03 11:46   ` Julien Grall
2019-06-03 11:46     ` [Xen-devel] " Julien Grall
2019-06-03 11:48   ` Julien Grall
2019-06-03 11:48     ` [Xen-devel] " Julien Grall
2019-06-06 16:02   ` Julien Grall
2019-06-07  9:36     ` Julien Grall
2019-06-11 18:18       ` Volodymyr Babchuk
2019-06-11 18:26         ` Julien Grall
2019-05-21 21:25 ` [PATCH v5 02/10] xen/arm: optee: add OP-TEE header files Volodymyr Babchuk
2019-05-21 21:25   ` [Xen-devel] " Volodymyr Babchuk
2019-06-03 11:49   ` Julien Grall
2019-06-03 11:49     ` [Xen-devel] " Julien Grall
2019-06-10 18:20     ` Volodymyr Babchuk
2019-06-10 18:53       ` Julien Grall
2019-05-21 21:25 ` [PATCH v5 03/10] xen/arm: optee: add OP-TEE mediator skeleton Volodymyr Babchuk
2019-05-21 21:25   ` [Xen-devel] " Volodymyr Babchuk
2019-06-03 12:34   ` Julien Grall
2019-06-03 12:34     ` [Xen-devel] " Julien Grall
2019-05-21 21:25 ` [PATCH v5 04/10] xen/arm: optee: add fast calls handling Volodymyr Babchuk
2019-05-21 21:25   ` [Xen-devel] " Volodymyr Babchuk
2019-06-03 12:34   ` Julien Grall
2019-06-03 12:34     ` [Xen-devel] " Julien Grall
2019-05-21 21:26 ` [PATCH v5 05/10] xen/arm: optee: add std call handling Volodymyr Babchuk
2019-05-21 21:26   ` [Xen-devel] " Volodymyr Babchuk
2019-06-03 12:34   ` Julien Grall
2019-06-03 12:34     ` [Xen-devel] " Julien Grall
2019-05-21 21:26 ` [PATCH v5 06/10] xen/arm: optee: add support for RPC SHM buffers Volodymyr Babchuk
2019-05-21 21:26   ` [Xen-devel] " Volodymyr Babchuk
2019-06-03 12:33   ` Julien Grall
2019-06-03 12:33     ` [Xen-devel] " Julien Grall
2019-05-21 21:26 ` [PATCH v5 07/10] xen/arm: optee: add support for arbitrary shared memory Volodymyr Babchuk
2019-05-21 21:26   ` [Xen-devel] " Volodymyr Babchuk
2019-06-03 12:29   ` Julien Grall
2019-06-03 12:29     ` [Xen-devel] " Julien Grall
2019-05-21 21:26 ` [PATCH v5 08/10] xen/arm: optee: add support for RPC commands Volodymyr Babchuk
2019-05-21 21:26   ` [Xen-devel] " Volodymyr Babchuk
2019-06-03 12:33   ` Julien Grall
2019-06-03 12:33     ` [Xen-devel] " Julien Grall
2019-05-21 21:26 ` Volodymyr Babchuk [this message]
2019-05-21 21:26   ` [Xen-devel] [PATCH v5 09/10] tools/arm: tee: add "tee" option for xl.cfg Volodymyr Babchuk
2019-06-03 12:44   ` Julien Grall
2019-06-03 12:44     ` [Xen-devel] " Julien Grall
2019-06-03 14:47   ` Ian Jackson
2019-06-03 14:47     ` [Xen-devel] " Ian Jackson
2019-05-21 21:26 ` [PATCH v5 10/10] tools/arm: optee: create optee firmware node in DT if tee=optee Volodymyr Babchuk
2019-05-21 21:26   ` [Xen-devel] " Volodymyr Babchuk
2019-06-03 14:50   ` Ian Jackson
2019-06-03 14:50     ` [Xen-devel] " Ian Jackson
2019-06-01 14:50 ` [PATCH v5 00/10] TEE mediator (and OP-TEE) support in XEN Julien Grall
2019-06-01 14:50   ` [Xen-devel] " Julien Grall
2019-06-01 16:07   ` Volodymyr Babchuk
2019-06-01 16:07     ` [Xen-devel] " Volodymyr Babchuk
2019-06-01 16:55     ` Julien Grall
2019-06-01 16:55       ` [Xen-devel] " Julien Grall
2019-06-04 13:31       ` Volodymyr Babchuk
2019-06-06 15:33         ` Julien Grall

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=20190521212530.12706-10-volodymyr_babchuk@epam.com \
    --to=volodymyr_babchuk@epam.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=tee-dev@lists.linaro.org \
    --cc=wei.liu2@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.