All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ashley Lai <adlai@linux.vnet.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: linux-security-module@vger.kernel.org,
	tpmdd-devel@lists.sourceforge.net, benh@kernel.crashing.org,
	linuxppc-dev@lists.ozlabs.org, rcj@linux.vnet.ibm.com,
	key@linux.vnet.ibm.com, adlai@us.ibm.com,
	adlai@linux.vnet.ibm.com
Subject: [PATCH V3 2/3] PPC64: Add support for instantiating SML from Open Firmware
Date: Tue, 14 Aug 2012 18:34:57 -0500	[thread overview]
Message-ID: <1344987297.4430.27.camel@footlong> (raw)
In-Reply-To: <1344986638.4430.22.camel@footlong>

This patch instantiate Stored Measurement Log (SML) and put the
log address and size in the device tree.

Signed-off-by: Ashley Lai <adlai@us.ibm.com>
---
 arch/powerpc/kernel/prom_init.c |   62 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 62 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 0794a30..e144498 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -1624,6 +1624,63 @@ static void __init prom_instantiate_rtas(void)
 
 #ifdef CONFIG_PPC64
 /*
+ * Allocate room for and instantiate Stored Measurement Log (SML)
+ */
+static void __init prom_instantiate_sml(void)
+{
+	phandle ibmvtpm_node;
+	ihandle ibmvtpm_inst;
+	u32 entry = 0, size = 0;
+	u64 base;
+
+	prom_debug("prom_instantiate_sml: start...\n");
+
+	ibmvtpm_node = call_prom("finddevice", 1, 1, ADDR("/ibm,vtpm"));
+	prom_debug("ibmvtpm_node: %x\n", ibmvtpm_node);
+	if (!PHANDLE_VALID(ibmvtpm_node))
+		return;
+
+	ibmvtpm_inst = call_prom("open", 1, 1, ADDR("/ibm,vtpm"));
+	if (!IHANDLE_VALID(ibmvtpm_inst)) {
+		prom_printf("opening vtpm package failed (%x)\n", ibmvtpm_inst);
+		return;
+	}
+
+	if (call_prom_ret("call-method", 2, 2, &size,
+			  ADDR("sml-get-handover-size"),
+			  ibmvtpm_inst) != 0 || size == 0) {
+		prom_printf("SML get handover size failed\n");
+		return;
+	}
+
+	base = alloc_down(size, PAGE_SIZE, 0);
+	if (base == 0)
+		prom_panic("Could not allocate memory for sml\n");
+
+	prom_printf("instantiating sml at 0x%x...", base);
+
+	if (call_prom_ret("call-method", 4, 2, &entry,
+			  ADDR("sml-handover"),
+			  ibmvtpm_inst, size, base) != 0 || entry == 0) {
+		prom_printf("SML handover failed\n");
+		return;
+	}
+	prom_printf(" done\n");
+
+	reserve_mem(base, size);
+
+	prom_setprop(ibmvtpm_node, "/ibm,vtpm", "linux,sml-base",
+		     &base, sizeof(base));
+	prom_setprop(ibmvtpm_node, "/ibm,vtpm", "linux,sml-size",
+		     &size, sizeof(size));
+
+	prom_debug("sml base     = 0x%x\n", base);
+	prom_debug("sml size     = 0x%x\n", (long)size);
+
+	prom_debug("prom_instantiate_sml: end...\n");
+}
+
+/*
  * Allocate room for and initialize TCE tables
  */
 static void __init prom_initialize_tce_table(void)
@@ -2916,6 +2973,11 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4,
 		prom_instantiate_opal();
 #endif
 
+#ifdef CONFIG_PPC64
+	/* instantiate sml */
+	prom_instantiate_sml();
+#endif
+
 	/*
 	 * On non-powermacs, put all CPUs in spin-loops.
 	 *
-- 
1.7.1



WARNING: multiple messages have this Message-ID (diff)
From: Ashley Lai <adlai@linux.vnet.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: rcj@linux.vnet.ibm.com, adlai@linux.vnet.ibm.com,
	linux-security-module@vger.kernel.org,
	tpmdd-devel@lists.sourceforge.net, adlai@us.ibm.com,
	key@linux.vnet.ibm.com, linuxppc-dev@lists.ozlabs.org
Subject: [PATCH V3 2/3] PPC64: Add support for instantiating SML from Open Firmware
Date: Tue, 14 Aug 2012 18:34:57 -0500	[thread overview]
Message-ID: <1344987297.4430.27.camel@footlong> (raw)
In-Reply-To: <1344986638.4430.22.camel@footlong>

This patch instantiate Stored Measurement Log (SML) and put the
log address and size in the device tree.

Signed-off-by: Ashley Lai <adlai@us.ibm.com>
---
 arch/powerpc/kernel/prom_init.c |   62 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 62 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 0794a30..e144498 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -1624,6 +1624,63 @@ static void __init prom_instantiate_rtas(void)
 
 #ifdef CONFIG_PPC64
 /*
+ * Allocate room for and instantiate Stored Measurement Log (SML)
+ */
+static void __init prom_instantiate_sml(void)
+{
+	phandle ibmvtpm_node;
+	ihandle ibmvtpm_inst;
+	u32 entry = 0, size = 0;
+	u64 base;
+
+	prom_debug("prom_instantiate_sml: start...\n");
+
+	ibmvtpm_node = call_prom("finddevice", 1, 1, ADDR("/ibm,vtpm"));
+	prom_debug("ibmvtpm_node: %x\n", ibmvtpm_node);
+	if (!PHANDLE_VALID(ibmvtpm_node))
+		return;
+
+	ibmvtpm_inst = call_prom("open", 1, 1, ADDR("/ibm,vtpm"));
+	if (!IHANDLE_VALID(ibmvtpm_inst)) {
+		prom_printf("opening vtpm package failed (%x)\n", ibmvtpm_inst);
+		return;
+	}
+
+	if (call_prom_ret("call-method", 2, 2, &size,
+			  ADDR("sml-get-handover-size"),
+			  ibmvtpm_inst) != 0 || size == 0) {
+		prom_printf("SML get handover size failed\n");
+		return;
+	}
+
+	base = alloc_down(size, PAGE_SIZE, 0);
+	if (base == 0)
+		prom_panic("Could not allocate memory for sml\n");
+
+	prom_printf("instantiating sml at 0x%x...", base);
+
+	if (call_prom_ret("call-method", 4, 2, &entry,
+			  ADDR("sml-handover"),
+			  ibmvtpm_inst, size, base) != 0 || entry == 0) {
+		prom_printf("SML handover failed\n");
+		return;
+	}
+	prom_printf(" done\n");
+
+	reserve_mem(base, size);
+
+	prom_setprop(ibmvtpm_node, "/ibm,vtpm", "linux,sml-base",
+		     &base, sizeof(base));
+	prom_setprop(ibmvtpm_node, "/ibm,vtpm", "linux,sml-size",
+		     &size, sizeof(size));
+
+	prom_debug("sml base     = 0x%x\n", base);
+	prom_debug("sml size     = 0x%x\n", (long)size);
+
+	prom_debug("prom_instantiate_sml: end...\n");
+}
+
+/*
  * Allocate room for and initialize TCE tables
  */
 static void __init prom_initialize_tce_table(void)
@@ -2916,6 +2973,11 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4,
 		prom_instantiate_opal();
 #endif
 
+#ifdef CONFIG_PPC64
+	/* instantiate sml */
+	prom_instantiate_sml();
+#endif
+
 	/*
 	 * On non-powermacs, put all CPUs in spin-loops.
 	 *
-- 
1.7.1

  parent reply	other threads:[~2012-08-14 23:34 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-14 23:23 [PATCH V3 0/3] tpm: Add new vTPM device driver for PPC64 Ashley Lai
2012-08-14 23:23 ` Ashley Lai
2012-08-14 23:34 ` [PATCH V3 1/3] drivers/char/tpm: Add new device driver to support IBM vTPM Ashley Lai
2012-08-14 23:34   ` Ashley Lai
2012-08-22 21:17   ` Ashley Lai
2012-08-22 21:17     ` Ashley Lai
2012-08-22 21:42     ` Kent Yoder
2012-08-22 21:42       ` Kent Yoder
2012-09-05  3:40       ` Benjamin Herrenschmidt
2012-09-05  3:40         ` Benjamin Herrenschmidt
2012-09-05 15:46         ` Kent Yoder
2012-09-05 15:46           ` Kent Yoder
2012-09-05 21:11           ` Benjamin Herrenschmidt
2012-09-05 21:11             ` Benjamin Herrenschmidt
2012-09-07 17:38             ` Kent Yoder
2012-09-07 17:38               ` Kent Yoder
2012-09-12  3:16               ` James Morris
2012-09-12  3:16                 ` James Morris
2012-09-05 17:25         ` Ashley Lai
2012-09-05 17:25           ` Ashley Lai
2012-09-12 17:49     ` [PATCH 1/1] drivers/char/tpm: remove tasklet and cleanup Ashley Lai
2012-09-12 17:49       ` Ashley Lai
2012-09-24  2:26       ` James Morris
2012-09-24  2:26         ` James Morris
2012-09-24 14:10         ` key
2012-09-24 14:10           ` key
2012-09-24 15:48           ` key
2012-09-24 15:48             ` key
2012-09-26 13:55             ` key
2012-09-26 13:55               ` key
2012-09-27 14:46               ` Ashley Lai
2012-09-27 14:46                 ` Ashley Lai
2012-08-14 23:34 ` Ashley Lai [this message]
2012-08-14 23:34   ` [PATCH V3 2/3] PPC64: Add support for instantiating SML from Open Firmware Ashley Lai
2012-08-14 23:35 ` [PATCH V3 3/3] drivers/char/tpm: Add securityfs support for event log Ashley Lai
2012-08-14 23:35   ` Ashley Lai
2012-08-15 19:59 ` [PATCH V3 0/3] tpm: Add new vTPM device driver for PPC64 Kent Yoder
2012-08-15 19:59   ` Kent Yoder

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=1344987297.4430.27.camel@footlong \
    --to=adlai@linux.vnet.ibm.com \
    --cc=adlai@us.ibm.com \
    --cc=benh@kernel.crashing.org \
    --cc=key@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=rcj@linux.vnet.ibm.com \
    --cc=tpmdd-devel@lists.sourceforge.net \
    /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.