Re: [PATCH] tpm: avoid accessing cleared ops during shutdown

2020-07-10 Thread Andrey Pronin
On Fri, Jul 10, 2020 at 12:08 PM James Bottomley wrote: > > On Thu, 2020-07-09 at 17:22 -0700, Andrey Pronin wrote: > > This patch prevents NULL dereferencing when using chip->ops while > > sending TPM2_Shutdown command if both tpm_class_shutdown handler and > > tpm

Re: [PATCH] tpm: avoid accessing cleared ops during shutdown

2020-07-10 Thread Andrey Pronin
On Fri, Jul 10, 2020 at 4:40 AM Jarkko Sakkinen wrote: > > On Thu, Jul 09, 2020 at 05:22:09PM -0700, Andrey Pronin wrote: > > This patch prevents NULL dereferencing when using chip->ops while > > sending TPM2_Shutdown command if both tpm_class_shutdown handler and &g

[PATCH] tpm: avoid accessing cleared ops during shutdown

2020-07-09 Thread Andrey Pronin
ed-off-by: Andrey Pronin --- drivers/char/tpm/tpm-chip.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c index 8c77e88012e9..a410ca40a3c5 100644 --- a/drivers/char/tpm/tpm-chip.c +++ b/drivers/char/tpm/tpm-chip.c @@ -296,7

[PATCH v2] ecryptfs: sync before truncating lower inode

2017-04-26 Thread Andrey Pronin
t;; cat ./loop/mount/test.$i; echo fi done umount ./loop/mount umount ./loop losetup -d $LOOPDEV Signed-off-by: Andrey Pronin <apro...@chromium.org> --- Changes since v1: - Switched to datasync=1 for ecryptfs_fsync_lower() in truncate_upper() fs/ecryptfs/ecryptfs_kernel.h | 1 + fs/

[PATCH v2] ecryptfs: sync before truncating lower inode

2017-04-26 Thread Andrey Pronin
t;; cat ./loop/mount/test.$i; echo fi done umount ./loop/mount umount ./loop losetup -d $LOOPDEV Signed-off-by: Andrey Pronin --- Changes since v1: - Switched to datasync=1 for ecryptfs_fsync_lower() in truncate_upper() fs/ecryptfs/ecryptfs_kernel.h | 1 + fs/ecryptfs/inode.c |

Re: [PATCH] CHROMIUM: ecryptfs: sync before truncating lower inode

2017-04-26 Thread Andrey Pronin
On Fri, Apr 21, 2017 at 04:52:13PM -0700, Andrey Pronin wrote: > On Thu, Apr 20, 2017 at 06:27:52PM -0500, Tyler Hicks wrote: > > On 04/18/2017 06:36 PM, Andrey Pronin wrote: > > > If the updated ecryptfs header data is not written to disk before > > > the lower fil

Re: [PATCH] CHROMIUM: ecryptfs: sync before truncating lower inode

2017-04-26 Thread Andrey Pronin
On Fri, Apr 21, 2017 at 04:52:13PM -0700, Andrey Pronin wrote: > On Thu, Apr 20, 2017 at 06:27:52PM -0500, Tyler Hicks wrote: > > On 04/18/2017 06:36 PM, Andrey Pronin wrote: > > > If the updated ecryptfs header data is not written to disk before > > > the lower fil

Re: [PATCH] CHROMIUM: ecryptfs: sync before truncating lower inode

2017-04-21 Thread Andrey Pronin
On Thu, Apr 20, 2017 at 06:27:52PM -0500, Tyler Hicks wrote: > On 04/18/2017 06:36 PM, Andrey Pronin wrote: > > If the updated ecryptfs header data is not written to disk before > > the lower file is truncated, a crash may leave the filesystem > > in the state when the

Re: [PATCH] CHROMIUM: ecryptfs: sync before truncating lower inode

2017-04-21 Thread Andrey Pronin
On Thu, Apr 20, 2017 at 06:27:52PM -0500, Tyler Hicks wrote: > On 04/18/2017 06:36 PM, Andrey Pronin wrote: > > If the updated ecryptfs header data is not written to disk before > > the lower file is truncated, a crash may leave the filesystem > > in the state when the

[PATCH] CHROMIUM: ecryptfs: sync before truncating lower inode

2017-04-18 Thread Andrey Pronin
t;; cat ./loop/mount/test.$i; echo fi done umount ./loop/mount umount ./loop losetup -d $LOOPDEV Signed-off-by: Andrey Pronin <apro...@chromium.org> --- fs/ecryptfs/ecryptfs_kernel.h | 1 + fs/ecryptfs/inode.c | 6 ++ fs/ecryptfs/read_write.c | 22 ++

[PATCH] CHROMIUM: ecryptfs: sync before truncating lower inode

2017-04-18 Thread Andrey Pronin
t;; cat ./loop/mount/test.$i; echo fi done umount ./loop/mount umount ./loop losetup -d $LOOPDEV Signed-off-by: Andrey Pronin --- fs/ecryptfs/ecryptfs_kernel.h | 1 + fs/ecryptfs/inode.c | 6 ++ fs/ecryptfs/read_write.c | 22 ++ 3 files change

Re: [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on shutdown

2017-01-23 Thread Andrey Pronin
On Mon, Jan 23, 2017 at 01:39:01PM -0700, Jason Gunthorpe wrote: > On Mon, Jan 23, 2017 at 12:02:46PM -0800, Andrey Pronin wrote: > > > > But if there is no actual need to do this right now then don't worry > > > about overdesigning things.. > > > > OK, I c

Re: [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on shutdown

2017-01-23 Thread Andrey Pronin
On Mon, Jan 23, 2017 at 01:39:01PM -0700, Jason Gunthorpe wrote: > On Mon, Jan 23, 2017 at 12:02:46PM -0800, Andrey Pronin wrote: > > > > But if there is no actual need to do this right now then don't worry > > > about overdesigning things.. > > > > OK, I c

Re: [tpmdd-devel] [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on shutdown

2017-01-23 Thread Andrey Pronin
On Mon, Jan 23, 2017 at 12:02:46PM -0800, Andrey Pronin wrote: > On Tue, Jan 17, 2017 at 04:22:07PM -0700, Jason Gunthorpe wrote: > > On Tue, Jan 17, 2017 at 03:00:53PM -0800, Andrey Pronin wrote: > > > > > Here I was talking not about tpm_tis_spi or tpm_tis. Those ca

Re: [tpmdd-devel] [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on shutdown

2017-01-23 Thread Andrey Pronin
On Mon, Jan 23, 2017 at 12:02:46PM -0800, Andrey Pronin wrote: > On Tue, Jan 17, 2017 at 04:22:07PM -0700, Jason Gunthorpe wrote: > > On Tue, Jan 17, 2017 at 03:00:53PM -0800, Andrey Pronin wrote: > > > > > Here I was talking not about tpm_tis_spi or tpm_tis. Those ca

Re: [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on shutdown

2017-01-23 Thread Andrey Pronin
On Tue, Jan 17, 2017 at 04:22:07PM -0700, Jason Gunthorpe wrote: > On Tue, Jan 17, 2017 at 03:00:53PM -0800, Andrey Pronin wrote: > > > Here I was talking not about tpm_tis_spi or tpm_tis. Those can > > continue relying on the core, or register the default handler u

Re: [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on shutdown

2017-01-23 Thread Andrey Pronin
On Tue, Jan 17, 2017 at 04:22:07PM -0700, Jason Gunthorpe wrote: > On Tue, Jan 17, 2017 at 03:00:53PM -0800, Andrey Pronin wrote: > > > Here I was talking not about tpm_tis_spi or tpm_tis. Those can > > continue relying on the core, or register the default handler u

Re: [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on shutdown

2017-01-17 Thread Andrey Pronin
On Tue, Jan 17, 2017 at 01:59:33PM -0700, Jason Gunthorpe wrote: > On Tue, Jan 17, 2017 at 12:13:36PM -0800, Andrey Pronin wrote: > > > Is there some way we can have the TPM core do this without requiring > > > the driver to add a shutdown the struct driver? > >

Re: [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on shutdown

2017-01-17 Thread Andrey Pronin
On Tue, Jan 17, 2017 at 01:59:33PM -0700, Jason Gunthorpe wrote: > On Tue, Jan 17, 2017 at 12:13:36PM -0800, Andrey Pronin wrote: > > > Is there some way we can have the TPM core do this without requiring > > > the driver to add a shutdown the struct driver? > >

Re: [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on shutdown

2017-01-17 Thread Andrey Pronin
On Tue, Jan 17, 2017 at 12:27:28PM -0700, Jason Gunthorpe wrote: > On Tue, Jan 17, 2017 at 09:58:27AM -0800, Andrey Pronin wrote: > > > Yes, sorry, I should have mentioned that.. Maybe that is too much to > > > fix.. > > > > If we fix sysfs to go through tp

Re: [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on shutdown

2017-01-17 Thread Andrey Pronin
On Tue, Jan 17, 2017 at 12:27:28PM -0700, Jason Gunthorpe wrote: > On Tue, Jan 17, 2017 at 09:58:27AM -0800, Andrey Pronin wrote: > > > Yes, sorry, I should have mentioned that.. Maybe that is too much to > > > fix.. > > > > If we fix sysfs to go through tp

Re: [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on shutdown

2017-01-17 Thread Andrey Pronin
On Mon, Jan 16, 2017 at 09:19:19AM -0700, Jason Gunthorpe wrote: > On Fri, Jan 13, 2017 at 04:42:30PM -0800, Andrey Pronin wrote: > > On Fri, Jan 13, 2017 at 05:28:57PM -0700, Jason Gunthorpe wrote: > > > On Fri, Jan 13, 2017 at 04:09:54PM -0800, Andrey Pronin wrote: > >

Re: [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on shutdown

2017-01-17 Thread Andrey Pronin
On Mon, Jan 16, 2017 at 09:19:19AM -0700, Jason Gunthorpe wrote: > On Fri, Jan 13, 2017 at 04:42:30PM -0800, Andrey Pronin wrote: > > On Fri, Jan 13, 2017 at 05:28:57PM -0700, Jason Gunthorpe wrote: > > > On Fri, Jan 13, 2017 at 04:09:54PM -0800, Andrey Pronin wrote: > >

Re: [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on shutdown

2017-01-13 Thread Andrey Pronin
On Fri, Jan 13, 2017 at 05:28:57PM -0700, Jason Gunthorpe wrote: > On Fri, Jan 13, 2017 at 04:09:54PM -0800, Andrey Pronin wrote: > > Resetting TPM while processing a command may lead to issues > > on the next boot. Ensure that we don't have any ongoing > > commands, and tha

Re: [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on shutdown

2017-01-13 Thread Andrey Pronin
On Fri, Jan 13, 2017 at 05:28:57PM -0700, Jason Gunthorpe wrote: > On Fri, Jan 13, 2017 at 04:09:54PM -0800, Andrey Pronin wrote: > > Resetting TPM while processing a command may lead to issues > > on the next boot. Ensure that we don't have any ongoing > > commands, and tha

[PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on shutdown

2017-01-13 Thread Andrey Pronin
command, if any, and then clears out chip->ops and unregisters sysfs entities. Signed-off-by: Andrey Pronin <apro...@chromium.org> --- drivers/char/tpm/tpm_i2c_infineon.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/char/tpm/tpm_i2c_infineon.c b/drivers

[PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on shutdown

2017-01-13 Thread Andrey Pronin
command, if any, and then clears out chip->ops and unregisters sysfs entities. Signed-off-by: Andrey Pronin --- drivers/char/tpm/tpm_i2c_infineon.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/char/tpm/tpm_i2c_infineon.c b/drivers/char/tpm/tpm_i2c_infineon.c in

Re: [PATCH v3 2/2] tpm: add driver for cr50 on SPI

2016-07-28 Thread Andrey Pronin
On Thu, Jul 28, 2016 at 05:17:06PM -0600, Jason Gunthorpe wrote: > On Thu, Jul 28, 2016 at 04:01:41PM -0700, Dmitry Torokhov wrote: > > > > + u8 tx_buf[MAX_SPI_FRAMESIZE]; > > > + u8 rx_buf[MAX_SPI_FRAMESIZE]; > > > > Both of these need to be annotated as "cacheline_aligned" since we > > eye

Re: [PATCH v3 2/2] tpm: add driver for cr50 on SPI

2016-07-28 Thread Andrey Pronin
On Thu, Jul 28, 2016 at 05:17:06PM -0600, Jason Gunthorpe wrote: > On Thu, Jul 28, 2016 at 04:01:41PM -0700, Dmitry Torokhov wrote: > > > > + u8 tx_buf[MAX_SPI_FRAMESIZE]; > > > + u8 rx_buf[MAX_SPI_FRAMESIZE]; > > > > Both of these need to be annotated as "cacheline_aligned" since we > > eye

[PATCH] tpm: fix cacheline alignment for DMA-able buffers

2016-07-28 Thread Andrey Pronin
Annotate buffers used in spi transactions as cacheline_aligned to use in DMA transfers. Signed-off-by: Andrey Pronin <apro...@chromium.org> --- drivers/char/tpm/st33zp24/spi.c | 4 ++-- drivers/char/tpm/tpm_tis_spi.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff

[PATCH] tpm: fix cacheline alignment for DMA-able buffers

2016-07-28 Thread Andrey Pronin
Annotate buffers used in spi transactions as cacheline_aligned to use in DMA transfers. Signed-off-by: Andrey Pronin --- drivers/char/tpm/st33zp24/spi.c | 4 ++-- drivers/char/tpm/tpm_tis_spi.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/char/tpm

[PATCH v4 0/2] tpm: add driver for cr50 on SPI

2016-07-28 Thread Andrey Pronin
potential race-condition with last_access_jiffies. Started using tx_buf/rx_buf in cr50_spi_phy to avoid potential problems with DMA. Removed DT properties for fw timing parameters. Fixed style. v4: Fixed cacheline alignment for xfer buffers. Andrey Pronin (2): tpm: devicetree: document

[PATCH v4 0/2] tpm: add driver for cr50 on SPI

2016-07-28 Thread Andrey Pronin
potential race-condition with last_access_jiffies. Started using tx_buf/rx_buf in cr50_spi_phy to avoid potential problems with DMA. Removed DT properties for fw timing parameters. Fixed style. v4: Fixed cacheline alignment for xfer buffers. Andrey Pronin (2): tpm: devicetree: document

[PATCH v4 2/2] tpm: add driver for cr50 on SPI

2016-07-28 Thread Andrey Pronin
of the next transaction; - if there is no spi activity for some time, it may go to sleep, and needs to be waken up before sending further commands; - access to vendor-specific registers. Signed-off-by: Andrey Pronin <apro...@chromium.org> --- drivers/char/tpm/Kconfig| 9 ++ d

[PATCH v4 2/2] tpm: add driver for cr50 on SPI

2016-07-28 Thread Andrey Pronin
of the next transaction; - if there is no spi activity for some time, it may go to sleep, and needs to be waken up before sending further commands; - access to vendor-specific registers. Signed-off-by: Andrey Pronin --- drivers/char/tpm/Kconfig| 9 ++ drivers/char/tpm/Makefile | 1

[PATCH v4 1/2] tpm: devicetree: document properties for cr50

2016-07-28 Thread Andrey Pronin
Add TPM2.0 PTP FIFO compatible SPI interface for chips with Cr50 firmware. Signed-off-by: Andrey Pronin <apro...@chromium.org> --- .../devicetree/bindings/security/tpm/cr50_spi.txt | 21 + 1 file changed, 21 insertions(+) create mode 100644 Documentation/devi

[PATCH v4 1/2] tpm: devicetree: document properties for cr50

2016-07-28 Thread Andrey Pronin
Add TPM2.0 PTP FIFO compatible SPI interface for chips with Cr50 firmware. Signed-off-by: Andrey Pronin --- .../devicetree/bindings/security/tpm/cr50_spi.txt | 21 + 1 file changed, 21 insertions(+) create mode 100644 Documentation/devicetree/bindings/security/tpm

[PATCH v3 1/2] tpm: devicetree: document properties for cr50

2016-07-27 Thread Andrey Pronin
Add TPM2.0 PTP FIFO compatible SPI interface for chips with Cr50 firmware. Signed-off-by: Andrey Pronin <apro...@chromium.org> --- .../devicetree/bindings/security/tpm/cr50_spi.txt | 21 + 1 file changed, 21 insertions(+) create mode 100644 Documentation/devi

[PATCH v3 1/2] tpm: devicetree: document properties for cr50

2016-07-27 Thread Andrey Pronin
Add TPM2.0 PTP FIFO compatible SPI interface for chips with Cr50 firmware. Signed-off-by: Andrey Pronin --- .../devicetree/bindings/security/tpm/cr50_spi.txt | 21 + 1 file changed, 21 insertions(+) create mode 100644 Documentation/devicetree/bindings/security/tpm

[PATCH v3 2/2] tpm: add driver for cr50 on SPI

2016-07-27 Thread Andrey Pronin
of the next transaction; - if there is no spi activity for some time, it may go to sleep, and needs to be waken up before sending further commands; - access to vendor-specific registers. Signed-off-by: Andrey Pronin <apro...@chromium.org> --- drivers/char/tpm/Kconfig| 9 ++ d

[PATCH v3 2/2] tpm: add driver for cr50 on SPI

2016-07-27 Thread Andrey Pronin
of the next transaction; - if there is no spi activity for some time, it may go to sleep, and needs to be waken up before sending further commands; - access to vendor-specific registers. Signed-off-by: Andrey Pronin --- drivers/char/tpm/Kconfig| 9 ++ drivers/char/tpm/Makefile | 1

[PATCH v3 0/2] tpm: add driver for cr50 on SPI

2016-07-27 Thread Andrey Pronin
potential race-condition with last_access_jiffies. Started using tx_buf/rx_buf in cr50_spi_phy to avoid potential problems with DMA. Removed DT properties for fw timing parameters. Fixed style. Andrey Pronin (2): tpm: devicetree: document properties for cr50 tpm: add driver for cr50

[PATCH v3 0/2] tpm: add driver for cr50 on SPI

2016-07-27 Thread Andrey Pronin
potential race-condition with last_access_jiffies. Started using tx_buf/rx_buf in cr50_spi_phy to avoid potential problems with DMA. Removed DT properties for fw timing parameters. Fixed style. Andrey Pronin (2): tpm: devicetree: document properties for cr50 tpm: add driver for cr50

[PATCH v3] tpm: add sysfs attributes for tpm2

2016-07-27 Thread Andrey Pronin
and lockout properties. v3: Avoid creating a separate 'show' function for each attribute. Signed-off-by: Andrey Pronin <apro...@chromium.org> --- drivers/char/tpm/tpm-chip.c | 4 +- drivers/char/tpm/tpm-sysfs.c | 122 +-- drivers/char/tpm/tpm.h

[PATCH v3] tpm: add sysfs attributes for tpm2

2016-07-27 Thread Andrey Pronin
and lockout properties. v3: Avoid creating a separate 'show' function for each attribute. Signed-off-by: Andrey Pronin --- drivers/char/tpm/tpm-chip.c | 4 +- drivers/char/tpm/tpm-sysfs.c | 122 +-- drivers/char/tpm/tpm.h | 30 +++ 3 files

[PATCH v3 1/2] tpm_tis_core: add optional max xfer size check

2016-07-27 Thread Andrey Pronin
the physical layer to reject xfer. Signed-off-by: Andrey Pronin <apro...@chromium.org> --- drivers/char/tpm/tpm_tis_core.c | 9 - drivers/char/tpm/tpm_tis_core.h | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/ch

[PATCH v3 1/2] tpm_tis_core: add optional max xfer size check

2016-07-27 Thread Andrey Pronin
the physical layer to reject xfer. Signed-off-by: Andrey Pronin --- drivers/char/tpm/tpm_tis_core.c | 9 - drivers/char/tpm/tpm_tis_core.h | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c index f22caf8

[PATCH v3 2/2] tpm_tis_spi: add max xfer size

2016-07-27 Thread Andrey Pronin
Reject burstcounts larger than 64 bytes reported by tpm. SPI Hardware Protocol defined in section 6.4 of TCG PTP Spec supports up to 64 bytes of data in a transaction. Signed-off-by: Andrey Pronin <apro...@chromium.org> --- drivers/char/tpm/tpm_tis_spi.c | 1 + 1 file changed, 1 ins

[PATCH v3 2/2] tpm_tis_spi: add max xfer size

2016-07-27 Thread Andrey Pronin
Reject burstcounts larger than 64 bytes reported by tpm. SPI Hardware Protocol defined in section 6.4 of TCG PTP Spec supports up to 64 bytes of data in a transaction. Signed-off-by: Andrey Pronin --- drivers/char/tpm/tpm_tis_spi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers

[PATCH v3 0/2] tpm: add optional max xfer size check

2016-07-27 Thread Andrey Pronin
ved unnecessary accessors in tpm_tis_core.h, fixed style v3: simplified logic: simply cap the burstcnt at max_xfer_size, don't attempt to re-request from tpm. Andrey Pronin (2): tpm_tis_core: add optional max xfer size check tpm_tis_spi: add max xfer size drivers/char/tpm/tpm_tis_core.c

[PATCH v3 0/2] tpm: add optional max xfer size check

2016-07-27 Thread Andrey Pronin
ved unnecessary accessors in tpm_tis_core.h, fixed style v3: simplified logic: simply cap the burstcnt at max_xfer_size, don't attempt to re-request from tpm. Andrey Pronin (2): tpm_tis_core: add optional max xfer size check tpm_tis_spi: add max xfer size drivers/char/tpm/tpm_tis_core.c

Re: [PATCH v2 0/2] tpm: add driver for cr50 on SPI

2016-07-27 Thread Andrey Pronin
Hi Peter, > > This patchset adds support for H1 Secure Microcontroller running > > Cr50 firmware. It implements several functions, including TPM-like > > functionality, and communicates over SPI using the FIFO protocol > > described in the PTP Spec, section 6. > > H1 is a proprietary chip that

Re: [PATCH v2 0/2] tpm: add driver for cr50 on SPI

2016-07-27 Thread Andrey Pronin
Hi Peter, > > This patchset adds support for H1 Secure Microcontroller running > > Cr50 firmware. It implements several functions, including TPM-like > > functionality, and communicates over SPI using the FIFO protocol > > described in the PTP Spec, section 6. > > H1 is a proprietary chip that

Re: [PATCH v2 1/2] tpm: devicetree: document properties for cr50

2016-07-27 Thread Andrey Pronin
On Wed, Jul 20, 2016 at 01:54:22PM -0600, Jason Gunthorpe wrote: > On Wed, Jul 20, 2016 at 12:49:12PM -0700, Andrey Pronin wrote: > > > Sorry, I just updated this patch description in v2 to indicate why they are > > not > > hard-coded, but didn't answer explicitly.

Re: [PATCH v2 1/2] tpm: devicetree: document properties for cr50

2016-07-27 Thread Andrey Pronin
On Wed, Jul 20, 2016 at 01:54:22PM -0600, Jason Gunthorpe wrote: > On Wed, Jul 20, 2016 at 12:49:12PM -0700, Andrey Pronin wrote: > > > Sorry, I just updated this patch description in v2 to indicate why they are > > not > > hard-coded, but didn't answer explicitly.

Re: [PATCH v2 1/2] tpm: devicetree: document properties for cr50

2016-07-27 Thread Andrey Pronin
On Thu, Jul 21, 2016 at 04:03:12PM -0500, Rob Herring wrote: > On Wed, Jul 20, 2016 at 12:49:12PM -0700, Andrey Pronin wrote: > > On Wed, Jul 20, 2016 at 02:03:03PM -0500, Rob Herring wrote: > > > On Tue, Jul 19, 2016 at 08:41:24PM -0700, Andrey Pronin wrote: > > >

Re: [PATCH v2 1/2] tpm: devicetree: document properties for cr50

2016-07-27 Thread Andrey Pronin
On Thu, Jul 21, 2016 at 04:03:12PM -0500, Rob Herring wrote: > On Wed, Jul 20, 2016 at 12:49:12PM -0700, Andrey Pronin wrote: > > On Wed, Jul 20, 2016 at 02:03:03PM -0500, Rob Herring wrote: > > > On Tue, Jul 19, 2016 at 08:41:24PM -0700, Andrey Pronin wrote: > > >

Re: [PATCH 2/2] tpm: add driver for cr50 on SPI

2016-07-21 Thread Andrey Pronin
On Wed, Jul 20, 2016 at 11:03:36AM -0600, Jason Gunthorpe wrote: > On Tue, Jul 19, 2016 at 05:24:11PM -0700, Andrey Pronin wrote: > > > The only two things that bother me with such approach are > > (1) whatever names I pick for the new set of functions, they > > wil

Re: [PATCH 2/2] tpm: add driver for cr50 on SPI

2016-07-21 Thread Andrey Pronin
On Wed, Jul 20, 2016 at 11:03:36AM -0600, Jason Gunthorpe wrote: > On Tue, Jul 19, 2016 at 05:24:11PM -0700, Andrey Pronin wrote: > > > The only two things that bother me with such approach are > > (1) whatever names I pick for the new set of functions, they > > wil

Re: [PATCH v2 1/2] tpm: devicetree: document properties for cr50

2016-07-20 Thread Andrey Pronin
On Wed, Jul 20, 2016 at 02:03:03PM -0500, Rob Herring wrote: > On Tue, Jul 19, 2016 at 08:41:24PM -0700, Andrey Pronin wrote: Hi Rob, > As I mentioned, there may be common properties. It doesn't seem you > looked, so I did: > > - spi-rx-delay-us - (optional) Microsecond del

Re: [PATCH v2 1/2] tpm: devicetree: document properties for cr50

2016-07-20 Thread Andrey Pronin
On Wed, Jul 20, 2016 at 02:03:03PM -0500, Rob Herring wrote: > On Tue, Jul 19, 2016 at 08:41:24PM -0700, Andrey Pronin wrote: Hi Rob, > As I mentioned, there may be common properties. It doesn't seem you > looked, so I did: > > - spi-rx-delay-us - (optional) Microsecond del

Re: [PATCH v2] tpm: add sysfs attributes for tpm2

2016-07-20 Thread Andrey Pronin
On Wed, Jul 20, 2016 at 11:05:53AM -0600, Jason Gunthorpe wrote: > On Tue, Jul 19, 2016 at 07:51:52PM -0700, Andrey Pronin wrote: > > Add sysfs attributes in TPM2.0 case for: > > - TPM_PT_PERMANENT flags > > - TPM_PT_STARTUP_CLEAR flags > > - lockout-related propert

Re: [PATCH v2] tpm: add sysfs attributes for tpm2

2016-07-20 Thread Andrey Pronin
On Wed, Jul 20, 2016 at 11:05:53AM -0600, Jason Gunthorpe wrote: > On Tue, Jul 19, 2016 at 07:51:52PM -0700, Andrey Pronin wrote: > > Add sysfs attributes in TPM2.0 case for: > > - TPM_PT_PERMANENT flags > > - TPM_PT_STARTUP_CLEAR flags > > - lockout-related propert

[PATCH v2 2/2] tpm: add driver for cr50 on SPI

2016-07-19 Thread Andrey Pronin
of the next transaction; - if there is no spi activity for some time, it may go to sleep, and needs to be waken up before sending further commands; - access to vendor-specific registers. Signed-off-by: Andrey Pronin <apro...@chromium.org> --- drivers/char/tpm/Kconfig| 9 + driver

[PATCH v2 2/2] tpm: add driver for cr50 on SPI

2016-07-19 Thread Andrey Pronin
of the next transaction; - if there is no spi activity for some time, it may go to sleep, and needs to be waken up before sending further commands; - access to vendor-specific registers. Signed-off-by: Andrey Pronin --- drivers/char/tpm/Kconfig| 9 + drivers/char/tpm/Makefile | 1

[PATCH v2 0/2] tpm: add driver for cr50 on SPI

2016-07-19 Thread Andrey Pronin
is investigating for inclusion in future Chromebooks. Depends on the following patchset: - tpm_tis_core: add optional max xfer size check v2: Removed driver-specific sysfs attributes. Compatible id changed to cr50 from cr50_spi. Updated descriptions of the supported device/interface. Andrey Pronin (2

[PATCH v2 0/2] tpm: add driver for cr50 on SPI

2016-07-19 Thread Andrey Pronin
is investigating for inclusion in future Chromebooks. Depends on the following patchset: - tpm_tis_core: add optional max xfer size check v2: Removed driver-specific sysfs attributes. Compatible id changed to cr50 from cr50_spi. Updated descriptions of the supported device/interface. Andrey Pronin (2

[PATCH v2 1/2] tpm: devicetree: document properties for cr50

2016-07-19 Thread Andrey Pronin
Add TPM2.0 PTP FIFO compatible SPI interface for chips with Cr50 firmware. Several timing-related properties that may differ from one firmware version to another are added to devicetree. Document these properties. Signed-off-by: Andrey Pronin <apro...@chromium.org> --- .../devicetree/bi

[PATCH v2 1/2] tpm: devicetree: document properties for cr50

2016-07-19 Thread Andrey Pronin
Add TPM2.0 PTP FIFO compatible SPI interface for chips with Cr50 firmware. Several timing-related properties that may differ from one firmware version to another are added to devicetree. Document these properties. Signed-off-by: Andrey Pronin --- .../devicetree/bindings/security/tpm

[PATCH v2] tpm: add sysfs attributes for tpm2

2016-07-19 Thread Andrey Pronin
and lockout properties. Signed-off-by: Andrey Pronin <apro...@chromium.org> --- drivers/char/tpm/tpm-chip.c | 4 +- drivers/char/tpm/tpm-sysfs.c | 108 +-- drivers/char/tpm/tpm.h | 30 3 files changed, 136 insertions(+), 6 del

[PATCH v2] tpm: add sysfs attributes for tpm2

2016-07-19 Thread Andrey Pronin
and lockout properties. Signed-off-by: Andrey Pronin --- drivers/char/tpm/tpm-chip.c | 4 +- drivers/char/tpm/tpm-sysfs.c | 108 +-- drivers/char/tpm/tpm.h | 30 3 files changed, 136 insertions(+), 6 deletions(-) diff --git a/drivers

[PATCH v2 1/2] tpm_tis_core: add optional max xfer size check

2016-07-19 Thread Andrey Pronin
). Without catching, causes the physical layer to reject xfer, while is easily preventable by re-querying TPM_STS. Signed-off-by: Andrey Pronin <apro...@chromium.org> --- drivers/char/tpm/tpm_tis_core.c | 18 -- drivers/char/tpm/tpm_tis_core.h | 1 + 2 files changed, 17 inse

[PATCH v2 0/2] tpm: add optional max xfer size check

2016-07-19 Thread Andrey Pronin
ved unnecessary accessors in tpm_tis_core.h, fixed style Andrey Pronin (2): tpm_tis_core: add optional max xfer size check tpm_tis_spi: add max xfer size drivers/char/tpm/tpm_tis_core.c | 18 -- drivers/char/tpm/tpm_tis_core.h | 1 + drivers/char/tpm/tpm_tis_spi.c | 1 + 3 fi

[PATCH v2 1/2] tpm_tis_core: add optional max xfer size check

2016-07-19 Thread Andrey Pronin
). Without catching, causes the physical layer to reject xfer, while is easily preventable by re-querying TPM_STS. Signed-off-by: Andrey Pronin --- drivers/char/tpm/tpm_tis_core.c | 18 -- drivers/char/tpm/tpm_tis_core.h | 1 + 2 files changed, 17 insertions(+), 2 deletions(-) diff

[PATCH v2 0/2] tpm: add optional max xfer size check

2016-07-19 Thread Andrey Pronin
ved unnecessary accessors in tpm_tis_core.h, fixed style Andrey Pronin (2): tpm_tis_core: add optional max xfer size check tpm_tis_spi: add max xfer size drivers/char/tpm/tpm_tis_core.c | 18 -- drivers/char/tpm/tpm_tis_core.h | 1 + drivers/char/tpm/tpm_tis_spi.c | 1 + 3 fi

[PATCH v2 2/2] tpm_tis_spi: add max xfer size

2016-07-19 Thread Andrey Pronin
Reject burstcounts larger than 64 bytes reported by tpm. SPI Hardware Protocol defined in section 6.4 of TCG PTP Spec supports up to 64 bytes of data in a transaction. Signed-off-by: Andrey Pronin <apro...@chromium.org> --- drivers/char/tpm/tpm_tis_spi.c | 1 + 1 file changed, 1 ins

[PATCH v2 2/2] tpm_tis_spi: add max xfer size

2016-07-19 Thread Andrey Pronin
Reject burstcounts larger than 64 bytes reported by tpm. SPI Hardware Protocol defined in section 6.4 of TCG PTP Spec supports up to 64 bytes of data in a transaction. Signed-off-by: Andrey Pronin --- drivers/char/tpm/tpm_tis_spi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers

Re: [PATCH 2/2] tpm: add driver for cr50 on SPI

2016-07-19 Thread Andrey Pronin
On Tue, Jul 19, 2016 at 03:55:27PM +0300, Jarkko Sakkinen wrote: > On Thu, Jul 14, 2016 at 08:44:44PM -0700, Andrey Pronin wrote: > > On Thu, Jul 14, 2016 at 09:32:36PM -0600, Jason Gunthorpe wrote: > > > On Thu, Jul 14, 2016 at 07:20:18PM -0700, Andrey Pronin wrote: > >

Re: [PATCH 2/2] tpm: add driver for cr50 on SPI

2016-07-19 Thread Andrey Pronin
On Tue, Jul 19, 2016 at 03:55:27PM +0300, Jarkko Sakkinen wrote: > On Thu, Jul 14, 2016 at 08:44:44PM -0700, Andrey Pronin wrote: > > On Thu, Jul 14, 2016 at 09:32:36PM -0600, Jason Gunthorpe wrote: > > > On Thu, Jul 14, 2016 at 07:20:18PM -0700, Andrey Pronin wrote: > >

Re: [PATCH 2/2] tpm: support driver-specific sysfs attrs in tpm_tis_core

2016-07-18 Thread Andrey Pronin
On Mon, Jul 18, 2016 at 10:11:41PM +0300, Jarkko Sakkinen wrote: > On Thu, Jul 14, 2016 at 06:51:36PM -0700, Andrey Pronin wrote: > > Add attr_group to phy_ops that a driver relying on tpm_tis_core_init > > can set to have its specific attributes registered in sysfs. > > >

Re: [PATCH 2/2] tpm: support driver-specific sysfs attrs in tpm_tis_core

2016-07-18 Thread Andrey Pronin
On Mon, Jul 18, 2016 at 10:11:41PM +0300, Jarkko Sakkinen wrote: > On Thu, Jul 14, 2016 at 06:51:36PM -0700, Andrey Pronin wrote: > > Add attr_group to phy_ops that a driver relying on tpm_tis_core_init > > can set to have its specific attributes registered in sysfs. > > >

Re: [PATCH 2/2] tpm: fix byte-order for the value read by tpm2_get_tpm_pt

2016-07-18 Thread Andrey Pronin
On Mon, Jul 18, 2016 at 10:04:21PM +0300, Jarkko Sakkinen wrote: > On Thu, Jul 14, 2016 at 06:07:18PM -0700, Andrey Pronin wrote: > > Change-Id: I7d71cd379b1a3b7659d20a1b6008216762596590 > > Signed-off-by: Andrey Pronin <apro...@chromium.org> > > Please remove the i

Re: [PATCH 2/2] tpm: fix byte-order for the value read by tpm2_get_tpm_pt

2016-07-18 Thread Andrey Pronin
On Mon, Jul 18, 2016 at 10:04:21PM +0300, Jarkko Sakkinen wrote: > On Thu, Jul 14, 2016 at 06:07:18PM -0700, Andrey Pronin wrote: > > Change-Id: I7d71cd379b1a3b7659d20a1b6008216762596590 > > Signed-off-by: Andrey Pronin > > Please remove the internal commit ID next time.

Re: [PATCH 2/2] tpm: fix byte-order for the value read by tpm2_get_tpm_pt

2016-07-15 Thread Andrey Pronin
On Thu, Jul 14, 2016 at 09:35:53PM -0600, Jason Gunthorpe wrote: > On Thu, Jul 14, 2016 at 08:17:01PM -0700, Andrey Pronin wrote: > > conversion. The only place tpm2_get_tpm_pt() was used before was in > > tpm2_gen_interrupt, which discarded the result. So, nobody noticed, > >

Re: [PATCH 2/2] tpm: fix byte-order for the value read by tpm2_get_tpm_pt

2016-07-15 Thread Andrey Pronin
On Thu, Jul 14, 2016 at 09:35:53PM -0600, Jason Gunthorpe wrote: > On Thu, Jul 14, 2016 at 08:17:01PM -0700, Andrey Pronin wrote: > > conversion. The only place tpm2_get_tpm_pt() was used before was in > > tpm2_gen_interrupt, which discarded the result. So, nobody noticed, > >

Re: [PATCH 1/2] tpm: devicetree: document properties for cr50

2016-07-15 Thread Andrey Pronin
On Thu, Jul 14, 2016 at 09:05:53PM -0700, Guenter Roeck wrote: > On Thu, Jul 14, 2016 at 7:20 PM, Andrey Pronin <apro...@chromium.org> wrote: > > + > > +Required properties: > > +- compatible: Should be "google,cr50_spi". > > google,cr50, maybe ? The

Re: [PATCH 1/2] tpm: devicetree: document properties for cr50

2016-07-15 Thread Andrey Pronin
On Thu, Jul 14, 2016 at 09:05:53PM -0700, Guenter Roeck wrote: > On Thu, Jul 14, 2016 at 7:20 PM, Andrey Pronin wrote: > > + > > +Required properties: > > +- compatible: Should be "google,cr50_spi". > > google,cr50, maybe ? The "_spi" seems re

Re: [PATCH 0/2] tpm: add driver for cr50 on SPI

2016-07-15 Thread Andrey Pronin
On Thu, Jul 14, 2016 at 09:28:14PM -0600, Jason Gunthorpe wrote: > On Thu, Jul 14, 2016 at 07:50:26PM -0700, Andrey Pronin wrote: > > Yes, it has a TCG-compliant interface, however, there are several things > > specific to this device: > > - need to ensure a certain delay bet

Re: [PATCH 0/2] tpm: add driver for cr50 on SPI

2016-07-15 Thread Andrey Pronin
On Thu, Jul 14, 2016 at 09:28:14PM -0600, Jason Gunthorpe wrote: > On Thu, Jul 14, 2016 at 07:50:26PM -0700, Andrey Pronin wrote: > > Yes, it has a TCG-compliant interface, however, there are several things > > specific to this device: > > - need to ensure a certain delay bet

Re: [PATCH 1/2] tpm: add sysfs attributes for tpm2

2016-07-15 Thread Andrey Pronin
On Thu, Jul 14, 2016 at 09:34:39PM -0600, Jason Gunthorpe wrote: > On Thu, Jul 14, 2016 at 08:32:01PM -0700, Andrey Pronin wrote: > > > tpm2 shares some of the attributes with tpm1 (e.g. timeouts). Do I still > > just add those separately for tpm2 to groups[1] and keep grou

Re: [PATCH 1/2] tpm: add sysfs attributes for tpm2

2016-07-15 Thread Andrey Pronin
On Thu, Jul 14, 2016 at 09:34:39PM -0600, Jason Gunthorpe wrote: > On Thu, Jul 14, 2016 at 08:32:01PM -0700, Andrey Pronin wrote: > > > tpm2 shares some of the attributes with tpm1 (e.g. timeouts). Do I still > > just add those separately for tpm2 to groups[1] and keep grou

Re: [PATCH 2/2] tpm: add driver for cr50 on SPI

2016-07-14 Thread Andrey Pronin
On Thu, Jul 14, 2016 at 09:32:36PM -0600, Jason Gunthorpe wrote: > On Thu, Jul 14, 2016 at 07:20:18PM -0700, Andrey Pronin wrote: > > > +static int cr50_spi_read16(struct tpm_tis_data *data, u32 addr, u16 > > *result) > > +{ > > + int rc; > > + > > +

Re: [PATCH 2/2] tpm: add driver for cr50 on SPI

2016-07-14 Thread Andrey Pronin
On Thu, Jul 14, 2016 at 09:32:36PM -0600, Jason Gunthorpe wrote: > On Thu, Jul 14, 2016 at 07:20:18PM -0700, Andrey Pronin wrote: > > > +static int cr50_spi_read16(struct tpm_tis_data *data, u32 addr, u16 > > *result) > > +{ > > + int rc; > > + > > +

Re: [PATCH 2/2] tpm: support driver-specific sysfs attrs in tpm_tis_core

2016-07-14 Thread Andrey Pronin
On Thu, Jul 14, 2016 at 09:23:27PM -0600, Jason Gunthorpe wrote: > On Thu, Jul 14, 2016 at 06:51:36PM -0700, Andrey Pronin wrote: > > - WARN_ON(chip->groups_cnt != 0); > > Nope. > > > - const struct attribute_group *groups[3]; > > + /* up to 4 attribute gro

Re: [PATCH 2/2] tpm: support driver-specific sysfs attrs in tpm_tis_core

2016-07-14 Thread Andrey Pronin
On Thu, Jul 14, 2016 at 09:23:27PM -0600, Jason Gunthorpe wrote: > On Thu, Jul 14, 2016 at 06:51:36PM -0700, Andrey Pronin wrote: > > - WARN_ON(chip->groups_cnt != 0); > > Nope. > > > - const struct attribute_group *groups[3]; > > + /* up to 4 attribute gro

Re: [PATCH 1/2] tpm: add sysfs attributes for tpm2

2016-07-14 Thread Andrey Pronin
On Thu, Jul 14, 2016 at 09:21:45PM -0600, Jason Gunthorpe wrote: > On Thu, Jul 14, 2016 at 06:51:35PM -0700, Andrey Pronin wrote: > > - sysfs_remove_link(>dev.parent->kobj, "ppi"); > > - > > - for (i = chip->groups[0]->attrs; *i != NULL; ++i) > >

Re: [PATCH 1/2] tpm: add sysfs attributes for tpm2

2016-07-14 Thread Andrey Pronin
On Thu, Jul 14, 2016 at 09:21:45PM -0600, Jason Gunthorpe wrote: > On Thu, Jul 14, 2016 at 06:51:35PM -0700, Andrey Pronin wrote: > > - sysfs_remove_link(>dev.parent->kobj, "ppi"); > > - > > - for (i = chip->groups[0]->attrs; *i != NULL; ++i) > >

Re: [PATCH 1/2] tpm_tis_core: add optional max xfer size check

2016-07-14 Thread Andrey Pronin
On Thu, Jul 14, 2016 at 09:13:51PM -0600, Jason Gunthorpe wrote: > On Thu, Jul 14, 2016 at 06:39:04PM -0700, Andrey Pronin wrote: > > > +static inline u16 tpm_tis_max_xfer_size(struct tpm_tis_data *data) > > +{ > > + return data->phy_ops->max_xfer_size; > &

Re: [PATCH 1/2] tpm_tis_core: add optional max xfer size check

2016-07-14 Thread Andrey Pronin
On Thu, Jul 14, 2016 at 09:13:51PM -0600, Jason Gunthorpe wrote: > On Thu, Jul 14, 2016 at 06:39:04PM -0700, Andrey Pronin wrote: > > > +static inline u16 tpm_tis_max_xfer_size(struct tpm_tis_data *data) > > +{ > > + return data->phy_ops->max_xfer_size; > &

Re: [PATCH 2/2] tpm: fix byte-order for the value read by tpm2_get_tpm_pt

2016-07-14 Thread Andrey Pronin
On Thu, Jul 14, 2016 at 09:10:46PM -0600, Jason Gunthorpe wrote: > On Thu, Jul 14, 2016 at 06:07:18PM -0700, Andrey Pronin wrote: > > Change-Id: I7d71cd379b1a3b7659d20a1b6008216762596590 > > Signed-off-by: Andrey Pronin <apro...@chromium.org> > > drivers/char/tpm/tp

  1   2   >