Commit 132f7629 authored by Ashley Lai's avatar Ashley Lai Committed by Kent Yoder

drivers/char/tpm: Add new device driver to support IBM vTPM

This patch adds a new device driver to support IBM virtual TPM
(vTPM) for PPC64.  IBM vTPM is supported through the adjunct
partition with firmware release 740 or higher.  With vTPM
support, each lpar is able to have its own vTPM without the
physical TPM hardware.

This driver provides TPM functionalities by communicating with
the vTPM adjunct partition through Hypervisor calls (Hcalls)
and Command/Response Queue (CRQ) commands.
Signed-off-by: default avatarAshley Lai <adlai@us.ibm.com>
Signed-off-by: default avatarKent Yoder <key@linux.vnet.ibm.com>
parent 7e72fe73
...@@ -73,4 +73,12 @@ config TCG_INFINEON ...@@ -73,4 +73,12 @@ config TCG_INFINEON
Further information on this driver and the supported hardware Further information on this driver and the supported hardware
can be found at http://www.trust.rub.de/projects/linux-device-driver-infineon-tpm/ can be found at http://www.trust.rub.de/projects/linux-device-driver-infineon-tpm/
config TCG_IBMVTPM
tristate "IBM VTPM Interface"
depends on PPC64
---help---
If you have IBM virtual TPM (VTPM) support 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_ibmvtpm.
endif # TCG_TPM endif # TCG_TPM
...@@ -11,3 +11,4 @@ obj-$(CONFIG_TCG_TIS_I2C_INFINEON) += tpm_i2c_infineon.o ...@@ -11,3 +11,4 @@ obj-$(CONFIG_TCG_TIS_I2C_INFINEON) += tpm_i2c_infineon.o
obj-$(CONFIG_TCG_NSC) += tpm_nsc.o obj-$(CONFIG_TCG_NSC) += tpm_nsc.o
obj-$(CONFIG_TCG_ATMEL) += tpm_atmel.o obj-$(CONFIG_TCG_ATMEL) += tpm_atmel.o
obj-$(CONFIG_TCG_INFINEON) += tpm_infineon.o obj-$(CONFIG_TCG_INFINEON) += tpm_infineon.o
obj-$(CONFIG_TCG_IBMVTPM) += tpm_ibmvtpm.o
...@@ -100,6 +100,7 @@ struct tpm_vendor_specific { ...@@ -100,6 +100,7 @@ struct tpm_vendor_specific {
bool timeout_adjusted; bool timeout_adjusted;
unsigned long duration[3]; /* jiffies */ unsigned long duration[3]; /* jiffies */
bool duration_adjusted; bool duration_adjusted;
void *data;
wait_queue_head_t read_queue; wait_queue_head_t read_queue;
wait_queue_head_t int_queue; wait_queue_head_t int_queue;
......
This diff is collapsed.
/*
* Copyright (C) 2012 IBM Corporation
*
* Author: Ashley Lai <adlai@us.ibm.com>
*
* Maintained by: <tpmdd-devel@lists.sourceforge.net>
*
* Device driver for TCG/TCPA TPM (trusted platform module).
* Specifications at www.trustedcomputinggroup.org
*
* 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.
*
*/
#ifndef __TPM_IBMVTPM_H__
#define __TPM_IBMVTPM_H__
/* vTPM Message Format 1 */
struct ibmvtpm_crq {
u8 valid;
u8 msg;
u16 len;
u32 data;
u64 reserved;
} __attribute__((packed, aligned(8)));
struct ibmvtpm_crq_queue {
struct ibmvtpm_crq *crq_addr;
u32 index;
u32 num_entry;
};
struct ibmvtpm_dev {
struct device *dev;
struct vio_dev *vdev;
struct ibmvtpm_crq_queue crq_queue;
dma_addr_t crq_dma_handle;
spinlock_t lock;
struct tasklet_struct tasklet;
u32 rtce_size;
void __iomem *rtce_buf;
dma_addr_t rtce_dma_handle;
spinlock_t rtce_lock;
struct ibmvtpm_crq crq_res;
u32 vtpm_version;
};
#define CRQ_RES_BUF_SIZE PAGE_SIZE
/* Initialize CRQ */
#define INIT_CRQ_CMD 0xC001000000000000LL /* Init cmd */
#define INIT_CRQ_COMP_CMD 0xC002000000000000LL /* Init complete cmd */
#define INIT_CRQ_RES 0x01 /* Init respond */
#define INIT_CRQ_COMP_RES 0x02 /* Init complete respond */
#define VALID_INIT_CRQ 0xC0 /* Valid command for init crq */
/* vTPM CRQ response is the message type | 0x80 */
#define VTPM_MSG_RES 0x80
#define IBMVTPM_VALID_CMD 0x80
/* vTPM CRQ message types */
#define VTPM_GET_VERSION 0x01
#define VTPM_GET_VERSION_RES (0x01 | VTPM_MSG_RES)
#define VTPM_TPM_COMMAND 0x02
#define VTPM_TPM_COMMAND_RES (0x02 | VTPM_MSG_RES)
#define VTPM_GET_RTCE_BUFFER_SIZE 0x03
#define VTPM_GET_RTCE_BUFFER_SIZE_RES (0x03 | VTPM_MSG_RES)
#define VTPM_PREPARE_TO_SUSPEND 0x04
#define VTPM_PREPARE_TO_SUSPEND_RES (0x04 | VTPM_MSG_RES)
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment