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 2/3] Add command line options for TPM interface
Date: Wed, 25 Aug 2010 18:33:01 +0200 [thread overview]
Message-ID: <1282753982-1761-2-git-send-email-andreas.niederl@iaik.tugraz.at> (raw)
In-Reply-To: <1282753982-1761-1-git-send-email-andreas.niederl@iaik.tugraz.at>
Signed-off-by: Andreas Niederl <andreas.niederl@iaik.tugraz.at>
---
hw/pc.h | 5 +++++
qemu-config.c | 12 ++++++++++++
qemu-config.h | 1 +
qemu-options.hx | 6 ++++++
vl.c | 25 +++++++++++++++++++++++++
5 files changed, 49 insertions(+), 0 deletions(-)
diff --git a/hw/pc.h b/hw/pc.h
index 63b0249..d95020c 100644
--- a/hw/pc.h
+++ b/hw/pc.h
@@ -176,4 +176,9 @@ void isa_ne2000_init(int base, int irq, NICInfo *nd);
int e820_add_entry(uint64_t, uint64_t, uint32_t);
+#ifdef CONFIG_TPM
+/* tpm.c */
+extern int tpm_init(QemuOpts *opts);
+#endif
+
#endif
diff --git a/qemu-config.c b/qemu-config.c
index 3abe655..aedca13 100644
--- a/qemu-config.c
+++ b/qemu-config.c
@@ -336,6 +336,18 @@ static QemuOptsList qemu_cpudef_opts = {
},
};
+QemuOptsList qemu_tpm_opts = {
+ .name = "tpm",
+ .head = QTAILQ_HEAD_INITIALIZER(qemu_tpm_opts.head),
+ .desc = {
+ {
+ .name = "dev",
+ .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 533a049..492a35d 100644
--- a/qemu-config.h
+++ b/qemu-config.h
@@ -3,6 +3,7 @@
extern QemuOptsList qemu_fsdev_opts;
extern QemuOptsList qemu_virtfs_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 453f129..771990b 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -2230,6 +2230,12 @@ Normally QEMU loads a configuration file from @var{sysconfdir}/qemu.conf and
@var{sysconfdir}/target-@var{ARCH}.conf on startup. The @code{-nodefconfig}
option will prevent QEMU from loading these configuration files at startup.
ETEXI
+#ifdef CONFIG_TPM
+DEF("tpm", HAS_ARG, QEMU_OPTION_tpm,
+ "-tpm dev=<device>\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 91d1684..fe35f49 100644
--- a/vl.c
+++ b/vl.c
@@ -1541,6 +1541,16 @@ static int fsdev_init_func(QemuOpts *opts, void *opaque)
}
#endif
+#ifdef CONFIG_TPM
+static int tpm_init_func(QemuOpts *opts, void *opaque)
+{
+ if (tpm_init(opts) != 0) {
+ return 1;
+ }
+ return 0;
+}
+#endif
+
static int mon_init_func(QemuOpts *opts, void *opaque)
{
CharDriverState *chr;
@@ -1860,6 +1870,10 @@ int main(int argc, char **argv, char **envp)
qemu_add_opts(&qemu_virtfs_opts);
#endif
+#ifdef CONFIG_TPM
+ qemu_add_opts(&qemu_tpm_opts);
+#endif
+
/* first pass of option parsing */
optind = 1;
while (optind < argc) {
@@ -2360,6 +2374,12 @@ int main(int argc, char **argv, char **envp)
qemu_free(arg_9p);
break;
}
+ case QEMU_OPTION_tpm:
+ opts = qemu_opts_parse(&qemu_tpm_opts, optarg, 0);
+ if (!opts) {
+ exit(1);
+ }
+ break;
case QEMU_OPTION_serial:
add_device_config(DEV_SERIAL, optarg);
default_serial = 0;
@@ -2713,6 +2733,11 @@ int main(int argc, char **argv, char **envp)
exit(1);
}
#endif
+#ifdef CONFIG_TPM
+ if (qemu_opts_foreach(&qemu_tpm_opts, tpm_init_func, NULL, 1) != 0) {
+ exit(1);
+ }
+#endif
os_daemonize();
--
1.7.2.2
next prev parent reply other threads:[~2010-08-25 16:33 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-25 16:33 [Qemu-devel] [PATCH 1/3] Add TPM 1.2 host device passthrough interface Andreas Niederl
2010-08-25 16:33 ` Andreas Niederl [this message]
2010-08-25 19:15 ` [Qemu-devel] [PATCH 2/3] Add command line options for TPM interface Blue Swirl
2010-08-25 16:33 ` [Qemu-devel] [PATCH 3/3] seabios: Add DSDT entry for an emulated TPM 1.2 device Andreas Niederl
2010-08-25 16:46 ` [Qemu-devel] [PATCH 1/3] Add TPM 1.2 host device passthrough interface Anthony Liguori
2010-08-25 19:46 ` Blue Swirl
2010-08-25 20:46 ` malc
2010-08-26 17:22 ` Blue Swirl
2010-08-26 21:44 ` malc
2010-08-26 21:57 ` Anthony Liguori
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=1282753982-1761-2-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).