From: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
To: Nayna Jain <nayna-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
Cc: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: [PATCH v2 1/3] TPM2.0: Refactored eventlog init functions.
Date: Tue, 9 Aug 2016 16:27:40 -0600 [thread overview]
Message-ID: <20160809222740.GD5535@obsidianresearch.com> (raw)
In-Reply-To: <1470771295-15680-2-git-send-email-nayna-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
On Tue, Aug 09, 2016 at 03:34:53PM -0400, Nayna Jain wrote:
> Refactored eventlog.c file into tpm_eventlog.c and tpm_eventlog_init.c
>
> Breakdown is:
>
> * tpm_eventlog_init.c : Moved eventlog initialization methods like
> to setup securityfs, to open and release seqfile from tpm_eventlog.c
> to this file. This is to keep the logic of initialization for TPM1.2
> and TPM2.0 in common file.
>
> * tpm_eventlog.c : This file now has only methods specific to parsing
> and iterate TPM1.2 entry log formats. It can understand only TPM1.2
> and is called by methods in tpm_eventlog_init if identified TPM device
> is TPM1.2.
>
> Changelog v2:
>
> * Using of_node property of device rather than direct reading
> the device node.
> * Cleaned up the code to have generic open() for ascii and bios
> measurements
> * Removed dyncamic allocation for bios_dir and having dentry array
> directly into tpm-chip.
> * Using dev_dbg instead of pr_err in tpm_of.c
> * readlog(...) now accepts struct tpm_chip * as parameter.
This patch needs to be split.
One patch per idea please.
> ifdef CONFIG_ACPI
> - tpm-y += tpm_eventlog.o tpm_acpi.o
> + tpm-y += tpm_eventlog_init.o tpm_eventlog.o tpm_acpi.o
> else
> ifdef CONFIG_TCG_IBMVTPM
> - tpm-y += tpm_eventlog.o tpm_of.o
> + tpm-y += tpm_eventlog_init.o tpm_eventlog.o tpm_of.o
> endif
Still need to fix this, more like
tpm_of should be included if CONFIG_OF is set,
and tpm_acpi if CONFIG_ACPI is set, do not do this based on random
other configus..
> endif
> obj-$(CONFIG_TCG_TIS_CORE) += tpm_tis_core.o
> diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c
> index e595013..7f6cdab 100644
> +++ b/drivers/char/tpm/tpm-chip.c
> @@ -171,6 +171,8 @@ struct tpm_chip *tpm_chip_alloc(struct device *dev,
> chip->dev.release = tpm_dev_release;
> chip->dev.parent = dev;
> chip->dev.groups = chip->groups;
> + if (dev->of_node)
> + chip->dev.of_node = dev->of_node;
No. chip->dev.parent->of_node.
> -extern struct dentry **tpm_bios_log_setup(const char *);
> -extern void tpm_bios_log_teardown(struct dentry **);
> +extern void tpm_bios_log_setup(struct tpm_chip *chip);
> +extern void tpm_bios_log_teardown(struct tpm_chip *chip);
We are trying to get rid of these extra externs..
> +
> + bin_file =
> + securityfs_create_file("binary_bios_measurements",
No, do
chip->bios_dir_count = 0;
chip->bios_dir[chip->bios_dir_count] = [..]
if (is_bad(chip->bios_dir[chip->bios_dir_count])
goto err
chip->bios_dir_count++
err:
for (I = 0; I != chip->bios_dir_count; ++I)
securityfs_remove(chip->bios_dir[I]);
> + for (i = 0; i < 3; i++) {
> + if (chip->bios_dir[i])
> + securityfs_remove(chip->bios_dir[i]);
Same logic as err: example above
>
> - np = of_find_node_by_name(NULL, "vtpm");
> + if (chip->dev.of_node)
> + np = chip->dev.of_node;
> if (!np) {
> - pr_err("%s: ERROR - IBMVTPM not supported\n", __func__);
> + dev_dbg(&chip->dev, "%s: ERROR - IBMVTPM not supported\n",
> + __func__);
> return -ENODEV;
> }
Where you able to test this on IBM's 'vtpm' stuff as well?
>
> sizep = of_get_property(np, "linux,sml-size", NULL);
> if (sizep == NULL) {
> - pr_err("%s: ERROR - SML size not found\n", __func__);
> + dev_dbg(&chip->dev, "%s: ERROR - SML size not found\n",
> + __func__);
> goto cleanup_eio;
> }
> if (*sizep == 0) {
> - pr_err("%s: ERROR - event log area empty\n", __func__);
> + dev_dbg(&chip->dev, "%s: ERROR - event log area empty\n",
> + __func__);
> goto cleanup_eio;
> }
>
> basep = of_get_property(np, "linux,sml-base", NULL);
> if (basep == NULL) {
> - pr_err("%s: ERROR - SML not found\n", __func__);
> + dev_dbg(&chip->dev, "%s: ERROR - SML not found\n",
> + __func__);
> goto cleanup_eio;
> }
>
> log->bios_event_log = kmalloc(*sizep, GFP_KERNEL);
> if (!log->bios_event_log) {
> - pr_err("%s: ERROR - Not enough memory for BIOS measurements\n",
> - __func__);
> of_node_put(np);
Why is there an of_node_put here but not in other error paths? Where is
the get this is putting?
Jason
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity
planning reports. http://sdm.link/zohodev2dev
next prev parent reply other threads:[~2016-08-09 22:27 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-09 19:34 [PATCH v2 0/3] TPM2.0: Added eventlog support for TPM2.0 Nayna Jain
[not found] ` <1470771295-15680-1-git-send-email-nayna-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2016-08-09 19:34 ` [PATCH v2 1/3] TPM2.0: Refactored eventlog init functions Nayna Jain
[not found] ` <1470771295-15680-2-git-send-email-nayna-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2016-08-09 22:27 ` Jason Gunthorpe [this message]
[not found] ` <20160809222740.GD5535-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-08-10 10:51 ` Jarkko Sakkinen
2016-08-10 11:12 ` Nayna
[not found] ` <57AB0C14.8080305-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2016-08-13 2:45 ` Jason Gunthorpe
[not found] ` <20160813024540.GB26929-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-08-16 9:05 ` Nayna
2016-08-10 11:12 ` Jarkko Sakkinen
2016-08-09 19:34 ` [PATCH v2 2/3] TPM2.0: TPM Device Tree Documentation Nayna Jain
[not found] ` <1470771295-15680-3-git-send-email-nayna-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2016-08-09 22:12 ` Jason Gunthorpe
[not found] ` <20160809221239.GB5535-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-08-12 12:36 ` Nayna
[not found] ` <57ADC2B5.3040903-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2016-08-13 2:42 ` Jason Gunthorpe
[not found] ` <20160813024230.GA26929-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-08-16 18:00 ` Nayna
[not found] ` <57B354C8.5040906-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2016-08-18 20:06 ` Jason Gunthorpe
[not found] ` <20160818200637.GF3676-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-08-30 4:56 ` Nayna
2016-08-10 11:28 ` Jarkko Sakkinen
2016-08-09 19:34 ` [PATCH v2 3/3] TPM2.0:Adds securityfs support for TPM2.0 eventlog Nayna Jain
[not found] ` <1470771295-15680-4-git-send-email-nayna-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2016-08-09 22:19 ` Jason Gunthorpe
2016-08-10 11:25 ` Jarkko Sakkinen
[not found] ` <20160810112142.GC13929-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-08-10 11:26 ` Jarkko Sakkinen
2016-08-10 11:32 ` [PATCH v2 0/3] TPM2.0: Added eventlog support for TPM2.0 Jarkko Sakkinen
[not found] ` <20160810113243.GF13929-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-08-10 17:19 ` Jarkko Sakkinen
[not found] ` <20160810171900.GA11543-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-08-11 10:48 ` Nayna
[not found] ` <57AC5802.1090109-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2016-08-11 12:58 ` Jarkko Sakkinen
[not found] ` <20160811125818.GA9303-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-08-12 12:32 ` Nayna
[not found] ` <57ADC1C0.4030406-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2016-08-15 21:26 ` Jarkko Sakkinen
[not found] ` <20160815212612.GC25212-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-08-16 19:16 ` Nayna
[not found] ` <57B36698.7040904-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2016-08-16 19:48 ` Jarkko Sakkinen
[not found] ` <20160816194853.GA26364-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-08-17 4:15 ` Jarkko Sakkinen
[not found] ` <20160817041502.GA8656-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-08-17 5:58 ` Nayna
[not found] ` <57B3FD1B.9040606-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2016-08-17 8:09 ` Jarkko Sakkinen
[not found] ` <20160817080914.GA8384-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-08-18 19:59 ` Jason Gunthorpe
[not found] ` <20160818195900.GD3676-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-08-25 19:49 ` Nayna
2016-08-25 21:13 ` Jarkko Sakkinen
[not found] ` <20160825211304.GC8658-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-08-25 21:20 ` Jason Gunthorpe
[not found] ` <20160825212038.GB8502-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-08-26 1:25 ` Jarkko Sakkinen
[not found] ` <20160826012536.GA16846-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-08-26 11:43 ` Jarkko Sakkinen
[not found] ` <20160826114316.GA18279-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-08-26 16:12 ` Jarkko Sakkinen
2016-08-13 2:59 ` Jason Gunthorpe
[not found] ` <20160813025915.GC26929-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-08-16 8:51 ` Nayna
[not found] ` <57B2D429.8050508-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2016-08-18 19:55 ` Jason Gunthorpe
[not found] ` <20160818195521.GC3676-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-08-30 5:01 ` Nayna
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=20160809222740.GD5535@obsidianresearch.com \
--to=jgunthorpe-epgobjl8dl3ta4ec/59zmfatqe2ktcn/@public.gmane.org \
--cc=nayna-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org \
--cc=tpmdd-devel-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 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).