From: "Peter Hüwe" <PeterHuewe-Mmb7MZpHnFY@public.gmane.org>
To: Jarkko Sakkinen
<jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Cc: Ashley Lai <ashley-fm2HMyfA2y6tG0bUXCXiUA@public.gmane.org>,
Marcel Selhorst <tpmdd-yWjUBOtONefk1uMJSBkQmQ@public.gmane.org>,
tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
josh.triplett-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
christophe.ricard-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
jason.gunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org,
linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
trousers-tech-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: [PATCH v9 7/8] tpm: TPM 2.0 CRB Interface
Date: Thu, 4 Dec 2014 23:55:14 +0100 [thread overview]
Message-ID: <201412042355.15131.PeterHuewe@gmx.de> (raw)
In-Reply-To: <1417672518-4530-8-git-send-email-jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Am Donnerstag, 4. Dezember 2014, 06:55:17 schrieb Jarkko Sakkinen:
> tpm_crb is a driver for TPM 2.0 Command Response Buffer (CRB) Interface
> as defined in PC Client Platform TPM Profile (PTP) Specification.
>
> Only polling and single locality is supported as these are the limitations
> of the available hardware, Platform Trust Techonlogy (PTT) in Haswell
> CPUs.
>
> The driver always applies CRB with ACPI start because PTT reports using
> only ACPI start as start method but as a result of my testing it requires
> also CRB start.
>
> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> ---
> drivers/char/tpm/Kconfig | 9 ++
> drivers/char/tpm/Makefile | 1 +
> drivers/char/tpm/tpm_crb.c | 356
> +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 366
> insertions(+)
> create mode 100644 drivers/char/tpm/tpm_crb.c
>
> diff --git a/drivers/char/tpm/Kconfig b/drivers/char/tpm/Kconfig
> index 3d0873b..9d4e375 100644
> --- a/drivers/char/tpm/Kconfig
> +++ b/drivers/char/tpm/Kconfig
> @@ -122,4 +122,13 @@ config TCG_XEN
> To compile this driver as a module, choose M here; the module
> will be called xen-tpmfront.
>
> +config TCG_CRB
> + tristate "TPM 2.0 CRB Interface"
> + depends on X86 && ACPI
> + ---help---
> + If you have a TPM security chip that is compliant with the
> + TCG CRB 2.0 TPM specification say Yes and it will be accessible
> + from within Linux. To compile this driver as a module, choose
> + M here; the module will be called tpm_crb.
> +
> endif # TCG_TPM
> diff --git a/drivers/char/tpm/Makefile b/drivers/char/tpm/Makefile
> index 88848ed..990cf18 100644
> --- a/drivers/char/tpm/Makefile
> +++ b/drivers/char/tpm/Makefile
> @@ -22,3 +22,4 @@ obj-$(CONFIG_TCG_INFINEON) += tpm_infineon.o
> obj-$(CONFIG_TCG_IBMVTPM) += tpm_ibmvtpm.o
> obj-$(CONFIG_TCG_TIS_I2C_ST33) += tpm_i2c_stm_st33.o
> obj-$(CONFIG_TCG_XEN) += xen-tpmfront.o
> +obj-$(CONFIG_TCG_CRB) += tpm_crb.o
> diff --git a/drivers/char/tpm/tpm_crb.c b/drivers/char/tpm/tpm_crb.c
> new file mode 100644
> index 0000000..eb78f93
> --- /dev/null
> +++ b/drivers/char/tpm/tpm_crb.c
> @@ -0,0 +1,356 @@
> +/*
> + * Copyright (C) 2014 Intel Corporation
> + *
> + * Authors:
> + * Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> + *
> + * Maintained by: <tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
> + *
> + * This device driver implements the TPM interface as defined in
> + * the TCG CRB 2.0 TPM specification.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; version 2
> + * of the License.
> + */
> +
> +#include <linux/acpi.h>
> +#include <linux/highmem.h>
> +#include <linux/rculist.h>
> +#include <linux/module.h>
> +#include <linux/platform_device.h>
> +#include "tpm.h"
> +
> +#define ACPI_SIG_TPM2 "TPM2"
> +
> +static const u8 CRB_ACPI_START_UUID[] = {
> + /* 0000 */ 0xAB, 0x6C, 0xBF, 0x6B, 0x63, 0x54, 0x14, 0x47,
> + /* 0008 */ 0xB7, 0xCD, 0xF0, 0x20, 0x3C, 0x03, 0x68, 0xD4
> +};
> +
> +enum crb_defaults {
> + CRB_ACPI_START_REVISION_ID = 1,
> + CRB_ACPI_START_INDEX = 1,
> +};
> +
> +enum crb_start_method {
> + CRB_SM_ACPI_START = 2,
> + CRB_SM_CRB = 7,
> + CRB_SM_CRB_WITH_ACPI_START = 8,
> +};
> +
> +struct acpi_tpm2 {
> + struct acpi_table_header hdr;
> + u16 platform_class;
> + u16 reserved;
> + u64 control_area_pa;
> + u32 start_method;
> +} __packed;
> +
> +enum crb_ca_request {
> + CRB_CA_REQ_GO_IDLE = BIT(0),
> + CRB_CA_REQ_CMD_READY = BIT(1),
> +};
> +
> +enum crb_ca_status {
> + CRB_CA_STS_ERROR = BIT(0),
> + CRB_CA_STS_TPM_IDLE = BIT(1),
> +};
> +
> +enum crb_start {
> + CRB_START_INVOKE = BIT(0),
> +};
> +
> +enum crb_cancel {
> + CRB_CANCEL_INVOKE = BIT(0),
> +};
> +
> +struct crb_control_area {
> + u32 req;
> + u32 sts;
> + u32 cancel;
> + u32 start;
> + u32 int_enable;
> + u32 int_sts;
> + u32 cmd_size;
> + u64 cmd_pa;
> + u32 rsp_size;
> + u64 rsp_pa;
> +} __packed;
> +
> +enum crb_status {
> + CRB_STS_COMPLETE = BIT(0),
> +};
> +
> +enum crb_flags {
> + CRB_FL_ACPI_START = BIT(0),
> + CRB_FL_CRB_START = BIT(1),
> +};
> +
> +struct crb_priv {
> + unsigned int flags;
> + struct crb_control_area *cca;
> + u8 *cmd;
> + u8 *rsp;
> +};
> +
> +#ifdef CONFIG_PM_SLEEP
> +int crb_suspend(struct device *dev)
> +{
> + return 0;
> +}
> +
> +static int crb_resume(struct device *dev)
> +{
> + struct tpm_chip *chip = dev_get_drvdata(dev);
> +
> + (void) tpm2_do_selftest(chip);
^^^^^ ??????? What's this?
> +
> + return 0;
> +}
> +#endif
Peter
WARNING: multiple messages have this Message-ID (diff)
From: "Peter Hüwe" <PeterHuewe@gmx.de>
To: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Cc: Ashley Lai <ashley@ashleylai.com>,
Marcel Selhorst <tpmdd@selhorst.net>,
tpmdd-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org,
josh.triplett@intel.com, christophe.ricard@gmail.com,
jason.gunthorpe@obsidianresearch.com, linux-api@vger.kernel.org,
trousers-tech@lists.sourceforge.net
Subject: Re: [PATCH v9 7/8] tpm: TPM 2.0 CRB Interface
Date: Thu, 4 Dec 2014 23:55:14 +0100 [thread overview]
Message-ID: <201412042355.15131.PeterHuewe@gmx.de> (raw)
In-Reply-To: <1417672518-4530-8-git-send-email-jarkko.sakkinen@linux.intel.com>
Am Donnerstag, 4. Dezember 2014, 06:55:17 schrieb Jarkko Sakkinen:
> tpm_crb is a driver for TPM 2.0 Command Response Buffer (CRB) Interface
> as defined in PC Client Platform TPM Profile (PTP) Specification.
>
> Only polling and single locality is supported as these are the limitations
> of the available hardware, Platform Trust Techonlogy (PTT) in Haswell
> CPUs.
>
> The driver always applies CRB with ACPI start because PTT reports using
> only ACPI start as start method but as a result of my testing it requires
> also CRB start.
>
> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
> ---
> drivers/char/tpm/Kconfig | 9 ++
> drivers/char/tpm/Makefile | 1 +
> drivers/char/tpm/tpm_crb.c | 356
> +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 366
> insertions(+)
> create mode 100644 drivers/char/tpm/tpm_crb.c
>
> diff --git a/drivers/char/tpm/Kconfig b/drivers/char/tpm/Kconfig
> index 3d0873b..9d4e375 100644
> --- a/drivers/char/tpm/Kconfig
> +++ b/drivers/char/tpm/Kconfig
> @@ -122,4 +122,13 @@ config TCG_XEN
> To compile this driver as a module, choose M here; the module
> will be called xen-tpmfront.
>
> +config TCG_CRB
> + tristate "TPM 2.0 CRB Interface"
> + depends on X86 && ACPI
> + ---help---
> + If you have a TPM security chip that is compliant with the
> + TCG CRB 2.0 TPM specification say Yes and it will be accessible
> + from within Linux. To compile this driver as a module, choose
> + M here; the module will be called tpm_crb.
> +
> endif # TCG_TPM
> diff --git a/drivers/char/tpm/Makefile b/drivers/char/tpm/Makefile
> index 88848ed..990cf18 100644
> --- a/drivers/char/tpm/Makefile
> +++ b/drivers/char/tpm/Makefile
> @@ -22,3 +22,4 @@ obj-$(CONFIG_TCG_INFINEON) += tpm_infineon.o
> obj-$(CONFIG_TCG_IBMVTPM) += tpm_ibmvtpm.o
> obj-$(CONFIG_TCG_TIS_I2C_ST33) += tpm_i2c_stm_st33.o
> obj-$(CONFIG_TCG_XEN) += xen-tpmfront.o
> +obj-$(CONFIG_TCG_CRB) += tpm_crb.o
> diff --git a/drivers/char/tpm/tpm_crb.c b/drivers/char/tpm/tpm_crb.c
> new file mode 100644
> index 0000000..eb78f93
> --- /dev/null
> +++ b/drivers/char/tpm/tpm_crb.c
> @@ -0,0 +1,356 @@
> +/*
> + * Copyright (C) 2014 Intel Corporation
> + *
> + * Authors:
> + * Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
> + *
> + * Maintained by: <tpmdd-devel@lists.sourceforge.net>
> + *
> + * This device driver implements the TPM interface as defined in
> + * the TCG CRB 2.0 TPM specification.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; version 2
> + * of the License.
> + */
> +
> +#include <linux/acpi.h>
> +#include <linux/highmem.h>
> +#include <linux/rculist.h>
> +#include <linux/module.h>
> +#include <linux/platform_device.h>
> +#include "tpm.h"
> +
> +#define ACPI_SIG_TPM2 "TPM2"
> +
> +static const u8 CRB_ACPI_START_UUID[] = {
> + /* 0000 */ 0xAB, 0x6C, 0xBF, 0x6B, 0x63, 0x54, 0x14, 0x47,
> + /* 0008 */ 0xB7, 0xCD, 0xF0, 0x20, 0x3C, 0x03, 0x68, 0xD4
> +};
> +
> +enum crb_defaults {
> + CRB_ACPI_START_REVISION_ID = 1,
> + CRB_ACPI_START_INDEX = 1,
> +};
> +
> +enum crb_start_method {
> + CRB_SM_ACPI_START = 2,
> + CRB_SM_CRB = 7,
> + CRB_SM_CRB_WITH_ACPI_START = 8,
> +};
> +
> +struct acpi_tpm2 {
> + struct acpi_table_header hdr;
> + u16 platform_class;
> + u16 reserved;
> + u64 control_area_pa;
> + u32 start_method;
> +} __packed;
> +
> +enum crb_ca_request {
> + CRB_CA_REQ_GO_IDLE = BIT(0),
> + CRB_CA_REQ_CMD_READY = BIT(1),
> +};
> +
> +enum crb_ca_status {
> + CRB_CA_STS_ERROR = BIT(0),
> + CRB_CA_STS_TPM_IDLE = BIT(1),
> +};
> +
> +enum crb_start {
> + CRB_START_INVOKE = BIT(0),
> +};
> +
> +enum crb_cancel {
> + CRB_CANCEL_INVOKE = BIT(0),
> +};
> +
> +struct crb_control_area {
> + u32 req;
> + u32 sts;
> + u32 cancel;
> + u32 start;
> + u32 int_enable;
> + u32 int_sts;
> + u32 cmd_size;
> + u64 cmd_pa;
> + u32 rsp_size;
> + u64 rsp_pa;
> +} __packed;
> +
> +enum crb_status {
> + CRB_STS_COMPLETE = BIT(0),
> +};
> +
> +enum crb_flags {
> + CRB_FL_ACPI_START = BIT(0),
> + CRB_FL_CRB_START = BIT(1),
> +};
> +
> +struct crb_priv {
> + unsigned int flags;
> + struct crb_control_area *cca;
> + u8 *cmd;
> + u8 *rsp;
> +};
> +
> +#ifdef CONFIG_PM_SLEEP
> +int crb_suspend(struct device *dev)
> +{
> + return 0;
> +}
> +
> +static int crb_resume(struct device *dev)
> +{
> + struct tpm_chip *chip = dev_get_drvdata(dev);
> +
> + (void) tpm2_do_selftest(chip);
^^^^^ ??????? What's this?
> +
> + return 0;
> +}
> +#endif
Peter
next prev parent reply other threads:[~2014-12-04 22:55 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-04 5:55 [PATCH v9 0/8] TPM 2.0 support Jarkko Sakkinen
2014-12-04 5:55 ` Jarkko Sakkinen
2014-12-04 5:55 ` [PATCH v9 1/8] tpm: merge duplicate transmit_cmd() functions Jarkko Sakkinen
2014-12-04 5:55 ` [PATCH v9 2/8] tpm: two-phase chip management functions Jarkko Sakkinen
2014-12-04 5:55 ` [PATCH v9 3/8] tpm: fix raciness of PPI interface lookup Jarkko Sakkinen
[not found] ` <1417672518-4530-4-git-send-email-jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2014-12-04 20:34 ` Peter Hüwe
2014-12-04 20:34 ` Peter Hüwe
[not found] ` <1417672518-4530-1-git-send-email-jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2014-12-04 5:55 ` [PATCH v9 4/8] tpm: rename chip->dev to chip->pdev Jarkko Sakkinen
2014-12-04 5:55 ` Jarkko Sakkinen
[not found] ` <1417672518-4530-5-git-send-email-jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2014-12-04 20:49 ` Peter Hüwe
2014-12-04 20:49 ` Peter Hüwe
2014-12-04 5:55 ` [PATCH v9 5/8] tpm: device class for tpm Jarkko Sakkinen
2014-12-04 5:55 ` [PATCH v9 6/8] tpm: TPM 2.0 baseline support Jarkko Sakkinen
[not found] ` <1417672518-4530-7-git-send-email-jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2014-12-04 23:17 ` Peter Hüwe
2014-12-04 23:17 ` Peter Hüwe
[not found] ` <201412050017.40668.PeterHuewe-Mmb7MZpHnFY@public.gmane.org>
2014-12-05 14:13 ` Jarkko Sakkinen
2014-12-05 14:13 ` Jarkko Sakkinen
[not found] ` <20141205141303.GF6993-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-12-05 14:35 ` Aw: " Peter Huewe
2014-12-05 14:35 ` Peter Huewe
2014-12-06 11:54 ` Jarkko Sakkinen
2014-12-06 11:54 ` Jarkko Sakkinen
2014-12-04 5:55 ` [PATCH v9 7/8] tpm: TPM 2.0 CRB Interface Jarkko Sakkinen
2014-12-04 20:19 ` Peter Hüwe
[not found] ` <201412042119.21493.PeterHuewe-Mmb7MZpHnFY@public.gmane.org>
2014-12-05 13:10 ` Jarkko Sakkinen
2014-12-05 13:10 ` Jarkko Sakkinen
[not found] ` <1417672518-4530-8-git-send-email-jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2014-12-04 22:55 ` Peter Hüwe [this message]
2014-12-04 22:55 ` Peter Hüwe
2014-12-04 5:55 ` [PATCH v9 8/8] tpm: TPM 2.0 FIFO Interface Jarkko Sakkinen
2014-12-04 21:46 ` Peter Hüwe
[not found] ` <201412042246.25662.PeterHuewe-Mmb7MZpHnFY@public.gmane.org>
2014-12-05 13:06 ` Jarkko Sakkinen
2014-12-05 13:06 ` Jarkko Sakkinen
[not found] ` <1417672518-4530-9-git-send-email-jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2014-12-04 15:25 ` [tpmdd-devel] " Scot Doyle
2014-12-04 15:25 ` Scot Doyle
[not found] ` <alpine.DEB.2.11.1412041459470.5705-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2014-12-05 13:05 ` Jarkko Sakkinen
2014-12-05 13:05 ` Jarkko Sakkinen
2014-12-04 22:18 ` Peter Hüwe
2014-12-04 22:18 ` Peter Hüwe
[not found] ` <201412042318.33889.PeterHuewe-Mmb7MZpHnFY@public.gmane.org>
2014-12-04 22:28 ` [tpmdd-devel] " Peter Hüwe
2014-12-04 22:28 ` Peter Hüwe
[not found] ` <201412042328.29578.PeterHuewe-Mmb7MZpHnFY@public.gmane.org>
2014-12-05 15:01 ` Aw: " Peter Huewe
2014-12-05 15:01 ` Peter Huewe
2014-12-05 20:44 ` Stefan Berger
2014-12-05 20:44 ` Stefan Berger
2014-12-09 15:47 ` Jarkko Sakkinen
2014-12-09 15:47 ` Jarkko Sakkinen
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=201412042355.15131.PeterHuewe@gmx.de \
--to=peterhuewe-mmb7mzphnfy@public.gmane.org \
--cc=ashley-fm2HMyfA2y6tG0bUXCXiUA@public.gmane.org \
--cc=christophe.ricard-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
--cc=jason.gunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org \
--cc=josh.triplett-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
--cc=tpmdd-yWjUBOtONefk1uMJSBkQmQ@public.gmane.org \
--cc=trousers-tech-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.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.