From: Stefan Berger <stefanb@linux.vnet.ibm.com>
To: tpmdd-devel@lists.sourceforge.net
Cc: jarkko.sakkinen@linux.intel.com, jgunthorpe@obsidianresearch.com,
linux-security-module@vger.kernel.org,
linux-kernel@vger.kernel.org,
Stefan Berger <stefanb@linux.vnet.ibm.com>
Subject: [PATCH v11 2/4] tpm: Introduce TPM_CHIP_FLAG_VIRTUAL
Date: Mon, 18 Apr 2016 13:26:14 -0400 [thread overview]
Message-ID: <1461000376-2888-3-git-send-email-stefanb@linux.vnet.ibm.com> (raw)
In-Reply-To: <1461000376-2888-1-git-send-email-stefanb@linux.vnet.ibm.com>
Introduce TPM_CHIP_FLAG_VIRTUAL to be used when the chip device has no
parent device.
Prevent sysfs entries requiring a parent device from being created.
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
---
drivers/char/tpm/tpm-chip.c | 7 +++++--
drivers/char/tpm/tpm.h | 1 +
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c
index 7e2c9cf..a12db8e 100644
--- a/drivers/char/tpm/tpm-chip.c
+++ b/drivers/char/tpm/tpm-chip.c
@@ -181,6 +181,9 @@ struct tpm_chip *tpm_chip_alloc(struct device *dev,
if (rc)
goto out;
+ if (!dev)
+ chip->flags |= TPM_CHIP_FLAG_VIRTUAL;
+
cdev_init(&chip->cdev, &tpm_fops);
chip->cdev.owner = THIS_MODULE;
chip->cdev.kobj.parent = &chip->dev.kobj;
@@ -297,7 +300,7 @@ static void tpm_del_legacy_sysfs(struct tpm_chip *chip)
{
struct attribute **i;
- if (chip->flags & TPM_CHIP_FLAG_TPM2)
+ if (chip->flags & (TPM_CHIP_FLAG_TPM2 | TPM_CHIP_FLAG_VIRTUAL))
return;
sysfs_remove_link(&chip->dev.parent->kobj, "ppi");
@@ -315,7 +318,7 @@ static int tpm_add_legacy_sysfs(struct tpm_chip *chip)
struct attribute **i;
int rc;
- if (chip->flags & TPM_CHIP_FLAG_TPM2)
+ if (chip->flags & (TPM_CHIP_FLAG_TPM2 | TPM_CHIP_FLAG_VIRTUAL))
return 0;
rc = __compat_only_sysfs_link_entry_to_kobj(
diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
index 508e8e0..ff4e53c 100644
--- a/drivers/char/tpm/tpm.h
+++ b/drivers/char/tpm/tpm.h
@@ -138,6 +138,7 @@ enum tpm_chip_flags {
TPM_CHIP_FLAG_REGISTERED = BIT(0),
TPM_CHIP_FLAG_TPM2 = BIT(1),
TPM_CHIP_FLAG_IRQ = BIT(2),
+ TPM_CHIP_FLAG_VIRTUAL = BIT(3),
};
struct tpm_chip {
--
2.4.3
next prev parent reply other threads:[~2016-04-18 17:26 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-18 17:26 [PATCH v11 0/4] Multi-instance vTPM proxy driver Stefan Berger
2016-04-18 17:26 ` [PATCH v11 1/4] tpm: Remove all uses of drvdata from the TPM Core Stefan Berger
2016-04-19 10:12 ` Jarkko Sakkinen
2016-04-19 10:36 ` Stefan Berger
2016-04-19 17:06 ` Jason Gunthorpe
2016-04-20 5:33 ` Jarkko Sakkinen
2016-04-19 17:21 ` Jarkko Sakkinen
2016-04-22 15:06 ` Jarkko Sakkinen
2016-04-25 19:13 ` Stefan Berger
2016-05-10 13:55 ` [BUG, bisect] " Jeremiah Mahler
2016-05-10 14:38 ` Jarkko Sakkinen
[not found] ` <201605101505.u4AF5nHd032349@d03av04.boulder.ibm.com>
2016-05-11 1:26 ` [tpmdd-devel] " Jeremiah Mahler
[not found] ` <201605111027.u4BARtQ4021061@d01av01.pok.ibm.com>
2016-05-11 14:29 ` Jeremiah Mahler
2016-05-11 15:20 ` Stefan Berger
2016-04-18 17:26 ` Stefan Berger [this message]
2016-04-22 16:46 ` [PATCH v11 2/4] tpm: Introduce TPM_CHIP_FLAG_VIRTUAL Jarkko Sakkinen
2016-04-18 17:26 ` [PATCH v11 3/4] tpm: Proxy driver for supporting multiple emulated TPMs Stefan Berger
2016-04-22 16:47 ` Jarkko Sakkinen
2016-04-18 17:26 ` [PATCH v11 4/4] tpm: Add documentation for the tpm_vtpm_proxy device driver Stefan Berger
2016-04-22 16:47 ` Jarkko Sakkinen
2016-04-22 16:54 ` [PATCH v11 0/4] Multi-instance vTPM proxy driver Jarkko Sakkinen
2016-04-26 9:28 ` [tpmdd-devel] " Jarkko Sakkinen
2016-04-26 11:30 ` Stefan Berger
2016-04-27 12:56 ` Jarkko Sakkinen
2016-04-27 16:27 ` Stefan Berger
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=1461000376-2888-3-git-send-email-stefanb@linux.vnet.ibm.com \
--to=stefanb@linux.vnet.ibm.com \
--cc=jarkko.sakkinen@linux.intel.com \
--cc=jgunthorpe@obsidianresearch.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®