qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Niederl <andreas.niederl@iaik.tugraz.at>
To: qemu-devel@nongnu.org
Cc: Andreas Niederl <andreas.niederl@iaik.tugraz.at>
Subject: [Qemu-devel] [PATCH 4/5] Add configure script and command line options for TPM interface.
Date: Fri, 18 Feb 2011 16:33:34 +0100	[thread overview]
Message-ID: <1298043215-10083-5-git-send-email-andreas.niederl@iaik.tugraz.at> (raw)
In-Reply-To: <1298043215-10083-1-git-send-email-andreas.niederl@iaik.tugraz.at>

Signed-off-by: Andreas Niederl <andreas.niederl@iaik.tugraz.at>
---
 configure       |    9 +++++++++
 qemu-config.c   |   16 ++++++++++++++++
 qemu-config.h   |    1 +
 qemu-options.hx |    6 ++++++
 vl.c            |   22 ++++++++++++++++++++++
 5 files changed, 54 insertions(+), 0 deletions(-)

diff --git a/configure b/configure
index a3f5345..7addec3 100755
--- a/configure
+++ b/configure
@@ -316,6 +316,7 @@ case "$cpu" in
   ;;
 esac
 
+tpm="no"
 # OS specific
 if check_define __linux__ ; then
   targetos="Linux"
@@ -455,6 +456,7 @@ Haiku)
   usb="linux"
   if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
     audio_possible_drivers="$audio_possible_drivers fmod"
+    tpm="yes"
   fi
 ;;
 esac
@@ -713,6 +715,8 @@ for opt do
   ;;
   --enable-vhost-net) vhost_net="yes"
   ;;
+  --disable-tpm) tpm="no"
+  ;;
   --*dir)
   ;;
   --disable-rbd) rbd="no"
@@ -914,6 +918,7 @@ echo "                           Default:trace-<pid>"
 echo "  --disable-spice          disable spice"
 echo "  --enable-spice           enable spice"
 echo "  --enable-rbd             enable building the rados block device (rbd)"
+echo "  --disable-tpm            disable tpm passthrough device emulation"
 echo ""
 echo "NOTE: The object files are built at the place where configure is launched"
 exit 1
@@ -2478,6 +2483,7 @@ echo "Trace output file $trace_file-<pid>"
 echo "spice support     $spice"
 echo "rbd support       $rbd"
 echo "xfsctl support    $xfs"
+echo "tpm support       $tpm"
 
 if test $sdl_too_old = "yes"; then
 echo "-> Your SDL version is too old - please upgrade to have SDL support"
@@ -2739,6 +2745,9 @@ fi
 if test "$fdatasync" = "yes" ; then
   echo "CONFIG_FDATASYNC=y" >> $config_host_mak
 fi
+if test "$tpm" = "yes" ; then
+  echo "CONFIG_TPM=y" >> $config_host_mak
+fi
 if test "$madvise" = "yes" ; then
   echo "CONFIG_MADVISE=y" >> $config_host_mak
 fi
diff --git a/qemu-config.c b/qemu-config.c
index 323d3c2..fe3a2ae 100644
--- a/qemu-config.c
+++ b/qemu-config.c
@@ -451,6 +451,22 @@ QemuOptsList qemu_option_rom_opts = {
     },
 };
 
+QemuOptsList qemu_tpm_opts = {
+    .name = "tpm",
+    .implied_opt_name = "type",
+    .head = QTAILQ_HEAD_INITIALIZER(qemu_tpm_opts.head),
+    .desc = {
+        {
+            .name = "type",
+            .type = QEMU_OPT_STRING,
+        },{
+            .name = "path",
+            .type = QEMU_OPT_STRING,
+        },
+        { /*End of list */ }
+    },
+};
+
 static QemuOptsList *vm_config_groups[32] = {
     &qemu_drive_opts,
     &qemu_chardev_opts,
diff --git a/qemu-config.h b/qemu-config.h
index 20d707f..eed9b3f 100644
--- a/qemu-config.h
+++ b/qemu-config.h
@@ -4,6 +4,7 @@
 extern QemuOptsList qemu_fsdev_opts;
 extern QemuOptsList qemu_virtfs_opts;
 extern QemuOptsList qemu_spice_opts;
+extern QemuOptsList qemu_tpm_opts;
 
 QemuOptsList *qemu_find_opts(const char *group);
 void qemu_add_opts(QemuOptsList *list);
diff --git a/qemu-options.hx b/qemu-options.hx
index 945edf3..cf4494d 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -2339,6 +2339,12 @@ STEXI
 Specify a trace file to log output traces to.
 ETEXI
 #endif
+#ifdef CONFIG_TPM
+DEF("tpm", HAS_ARG, QEMU_OPTION_tpm,
+    "-tpm host,id=id,path=path\n"
+    "                enable TPM support and forward commands to the given TPM device file\n",
+    QEMU_ARCH_I386)
+#endif
 
 HXCOMM This is the last statement. Insert new options before this line!
 STEXI
diff --git a/vl.c b/vl.c
index f74f37a..4bafcce 100644
--- a/vl.c
+++ b/vl.c
@@ -1651,6 +1651,14 @@ static int fsdev_init_func(QemuOpts *opts, void *opaque)
 #endif
 
 #ifdef CONFIG_TPM
+static int tpm_init_func(QemuOpts *opts, void *opaque)
+{
+    int ret;
+    ret = qemu_tpm_add(opts);
+
+    return ret;
+}
+
 static int tpm_acpi_init_func(QemuOpts *opts, void *opaque)
 {
     int ret = 0;
@@ -1993,6 +2001,10 @@ int main(int argc, char **argv, char **envp)
     tb_size = 0;
     autostart= 1;
 
+#ifdef CONFIG_TPM
+    qemu_add_opts(&qemu_tpm_opts);
+#endif
+
     /* first pass of option parsing */
     optind = 1;
     while (optind < argc) {
@@ -2493,6 +2505,13 @@ int main(int argc, char **argv, char **envp)
                 qemu_free(arg_9p);
                 break;
             }
+            case QEMU_OPTION_tpm:
+               opts = qemu_opts_parse(qemu_find_opts("tpm"), optarg, 0);
+               if (!opts) {
+                   fprintf(stderr, "parse error: %s\n", optarg);
+                   exit(1);
+               }
+               break;
             case QEMU_OPTION_serial:
                 add_device_config(DEV_SERIAL, optarg);
                 default_serial = 0;
@@ -2881,6 +2900,9 @@ int main(int argc, char **argv, char **envp)
 #endif
 
 #ifdef CONFIG_TPM
+    if (qemu_opts_foreach(qemu_find_opts("tpm"), tpm_init_func, NULL, 1) != 0) {
+        exit(1);
+    }
     /* register TPM acpi table before machine->init is called */
     if (qemu_opts_foreach(qemu_find_opts("device"), tpm_acpi_init_func, NULL, 1) != 0) {
         exit(1);
-- 
1.7.4.1

  parent reply	other threads:[~2011-02-18 15:33 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-18 15:33 [Qemu-devel] [PATCH 0/5] TPM device emulation Andreas Niederl
2011-02-18 15:33 ` [Qemu-devel] [PATCH 1/5] Add TPM 1.2 device interface Andreas Niederl
2011-02-18 16:37   ` Stefan Berger
2011-02-18 17:37     ` Andreas Niederl
2011-02-18 20:27       ` Stefan Berger
2011-02-21 17:03         ` Andreas Niederl
2011-02-22 16:47           ` Stefan Berger
2011-02-24 15:30     ` Andreas Niederl
2011-02-24 17:44       ` Stefan Berger
2011-02-18 21:03   ` Stefan Berger
2011-02-21 17:13     ` Andreas Niederl
2011-02-18 15:33 ` [Qemu-devel] [PATCH 2/5] Provide SSDT for enabled TPM device Andreas Niederl
2011-02-18 17:02   ` Stefan Berger
2011-02-21 16:55     ` Andreas Niederl
2011-02-18 15:33 ` [Qemu-devel] [PATCH 3/5] Add TPM host passthrough device backend Andreas Niederl
2011-02-18 15:33 ` Andreas Niederl [this message]
2011-02-18 15:33 ` [Qemu-devel] [PATCH 5/5] Adapt TPM host backend to use threadlets Andreas Niederl

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=1298043215-10083-5-git-send-email-andreas.niederl@iaik.tugraz.at \
    --to=andreas.niederl@iaik.tugraz.at \
    --cc=qemu-devel@nongnu.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).