Re: [tpmdd-devel] [PATCH RFC v2 3/5] tpm: infrastructure for TPM spaces

2017-01-16 Thread Jarkko Sakkinen
On Mon, Jan 16, 2017 at 06:58:44AM -0800, James Bottomley wrote: > On Mon, 2017-01-16 at 16:48 +0200, Jarkko Sakkinen wrote: > > On Mon, Jan 16, 2017 at 06:24:48AM -0800, James Bottomley wrote: > > > On Mon, 2017-01-16 at 11:09 +0200, Jarkko Sakkinen wrote: > > > > On Thu, Jan 12, 2017 at

Re: [tpmdd-devel] [PATCH RFC v2 3/5] tpm: infrastructure for TPM spaces

2017-01-16 Thread Jarkko Sakkinen
On Mon, Jan 16, 2017 at 06:58:44AM -0800, James Bottomley wrote: > On Mon, 2017-01-16 at 16:48 +0200, Jarkko Sakkinen wrote: > > On Mon, Jan 16, 2017 at 06:24:48AM -0800, James Bottomley wrote: > > > On Mon, 2017-01-16 at 11:09 +0200, Jarkko Sakkinen wrote: > > > > On Thu, Jan 12, 2017 at

Re: [tpmdd-devel] [PATCH RFC v2 3/5] tpm: infrastructure for TPM spaces

2017-01-16 Thread James Bottomley
On Mon, 2017-01-16 at 16:48 +0200, Jarkko Sakkinen wrote: > On Mon, Jan 16, 2017 at 06:24:48AM -0800, James Bottomley wrote: > > On Mon, 2017-01-16 at 11:09 +0200, Jarkko Sakkinen wrote: > > > On Thu, Jan 12, 2017 at 05:17:23PM -0800, James Bottomley wrote: > > > > On Thu, 2017-01-12 at 19:46

Re: [tpmdd-devel] [PATCH RFC v2 3/5] tpm: infrastructure for TPM spaces

2017-01-16 Thread James Bottomley
On Mon, 2017-01-16 at 16:48 +0200, Jarkko Sakkinen wrote: > On Mon, Jan 16, 2017 at 06:24:48AM -0800, James Bottomley wrote: > > On Mon, 2017-01-16 at 11:09 +0200, Jarkko Sakkinen wrote: > > > On Thu, Jan 12, 2017 at 05:17:23PM -0800, James Bottomley wrote: > > > > On Thu, 2017-01-12 at 19:46

Re: [tpmdd-devel] [PATCH RFC v2 3/5] tpm: infrastructure for TPM spaces

2017-01-16 Thread Jarkko Sakkinen
On Mon, Jan 16, 2017 at 06:24:48AM -0800, James Bottomley wrote: > On Mon, 2017-01-16 at 11:09 +0200, Jarkko Sakkinen wrote: > > On Thu, Jan 12, 2017 at 05:17:23PM -0800, James Bottomley wrote: > > > On Thu, 2017-01-12 at 19:46 +0200, Jarkko Sakkinen wrote: > > > > @@ -189,6 +190,12 @@ struct

Re: [tpmdd-devel] [PATCH RFC v2 3/5] tpm: infrastructure for TPM spaces

2017-01-16 Thread Jarkko Sakkinen
On Mon, Jan 16, 2017 at 06:24:48AM -0800, James Bottomley wrote: > On Mon, 2017-01-16 at 11:09 +0200, Jarkko Sakkinen wrote: > > On Thu, Jan 12, 2017 at 05:17:23PM -0800, James Bottomley wrote: > > > On Thu, 2017-01-12 at 19:46 +0200, Jarkko Sakkinen wrote: > > > > @@ -189,6 +190,12 @@ struct

Re: [tpmdd-devel] [PATCH RFC v2 3/5] tpm: infrastructure for TPM spaces

2017-01-16 Thread James Bottomley
On Mon, 2017-01-16 at 11:09 +0200, Jarkko Sakkinen wrote: > On Thu, Jan 12, 2017 at 05:17:23PM -0800, James Bottomley wrote: > > On Thu, 2017-01-12 at 19:46 +0200, Jarkko Sakkinen wrote: > > > @@ -189,6 +190,12 @@ struct tpm_chip *tpm_chip_alloc(struct > > > device > > > *pdev, > > >

Re: [tpmdd-devel] [PATCH RFC v2 3/5] tpm: infrastructure for TPM spaces

2017-01-16 Thread James Bottomley
On Mon, 2017-01-16 at 11:09 +0200, Jarkko Sakkinen wrote: > On Thu, Jan 12, 2017 at 05:17:23PM -0800, James Bottomley wrote: > > On Thu, 2017-01-12 at 19:46 +0200, Jarkko Sakkinen wrote: > > > @@ -189,6 +190,12 @@ struct tpm_chip *tpm_chip_alloc(struct > > > device > > > *pdev, > > >

Re: [tpmdd-devel] [PATCH RFC v2 3/5] tpm: infrastructure for TPM spaces

2017-01-16 Thread Jarkko Sakkinen
On Sat, Jan 14, 2017 at 12:53:15PM -0500, Ken Goldman wrote: > On 1/13/2017 11:28 AM, Jarkko Sakkinen wrote: > > > > > + > > > > + if (!tpm2_find_cc_attrs(chip, cc, )) { > > > > + /* should never happen */ > > > > + dev_err(>dev, "TPM returned a different CC: > >

Re: [tpmdd-devel] [PATCH RFC v2 3/5] tpm: infrastructure for TPM spaces

2017-01-16 Thread Jarkko Sakkinen
On Sat, Jan 14, 2017 at 12:53:15PM -0500, Ken Goldman wrote: > On 1/13/2017 11:28 AM, Jarkko Sakkinen wrote: > > > > > + > > > > + if (!tpm2_find_cc_attrs(chip, cc, )) { > > > > + /* should never happen */ > > > > + dev_err(>dev, "TPM returned a different CC: > >

Re: [tpmdd-devel] [PATCH RFC v2 3/5] tpm: infrastructure for TPM spaces

2017-01-16 Thread Jarkko Sakkinen
On Thu, Jan 12, 2017 at 05:17:23PM -0800, James Bottomley wrote: > On Thu, 2017-01-12 at 19:46 +0200, Jarkko Sakkinen wrote: > > @@ -189,6 +190,12 @@ struct tpm_chip *tpm_chip_alloc(struct device > > *pdev, > > chip->cdev.owner = THIS_MODULE; > > chip->cdev.kobj.parent = >dev.kobj; > > >

Re: [tpmdd-devel] [PATCH RFC v2 3/5] tpm: infrastructure for TPM spaces

2017-01-16 Thread Jarkko Sakkinen
On Thu, Jan 12, 2017 at 05:17:23PM -0800, James Bottomley wrote: > On Thu, 2017-01-12 at 19:46 +0200, Jarkko Sakkinen wrote: > > @@ -189,6 +190,12 @@ struct tpm_chip *tpm_chip_alloc(struct device > > *pdev, > > chip->cdev.owner = THIS_MODULE; > > chip->cdev.kobj.parent = >dev.kobj; > > >

Re: [tpmdd-devel] [PATCH RFC v2 3/5] tpm: infrastructure for TPM spaces

2017-01-13 Thread Jarkko Sakkinen
On Thu, Jan 12, 2017 at 05:17:23PM -0800, James Bottomley wrote: > On Thu, 2017-01-12 at 19:46 +0200, Jarkko Sakkinen wrote: > > @@ -189,6 +190,12 @@ struct tpm_chip *tpm_chip_alloc(struct device > > *pdev, > > chip->cdev.owner = THIS_MODULE; > > chip->cdev.kobj.parent = >dev.kobj; > > >

Re: [tpmdd-devel] [PATCH RFC v2 3/5] tpm: infrastructure for TPM spaces

2017-01-13 Thread Jarkko Sakkinen
On Thu, Jan 12, 2017 at 05:17:23PM -0800, James Bottomley wrote: > On Thu, 2017-01-12 at 19:46 +0200, Jarkko Sakkinen wrote: > > @@ -189,6 +190,12 @@ struct tpm_chip *tpm_chip_alloc(struct device > > *pdev, > > chip->cdev.owner = THIS_MODULE; > > chip->cdev.kobj.parent = >dev.kobj; > > >

Re: [tpmdd-devel] [PATCH RFC v2 3/5] tpm: infrastructure for TPM spaces

2017-01-13 Thread Jarkko Sakkinen
On Thu, Jan 12, 2017 at 12:38:52PM -0800, James Bottomley wrote: > On Thu, 2017-01-12 at 19:46 +0200, Jarkko Sakkinen wrote: > > +static int tpm2_map_response(struct tpm_chip *chip, u32 cc, u8 *rsp, > > size_t len) > > +{ > > + struct tpm_space *space = >work_space; > > + u32 phandle;

Re: [tpmdd-devel] [PATCH RFC v2 3/5] tpm: infrastructure for TPM spaces

2017-01-13 Thread Jarkko Sakkinen
On Thu, Jan 12, 2017 at 12:38:52PM -0800, James Bottomley wrote: > On Thu, 2017-01-12 at 19:46 +0200, Jarkko Sakkinen wrote: > > +static int tpm2_map_response(struct tpm_chip *chip, u32 cc, u8 *rsp, > > size_t len) > > +{ > > + struct tpm_space *space = >work_space; > > + u32 phandle;

Re: [tpmdd-devel] [PATCH RFC v2 3/5] tpm: infrastructure for TPM spaces

2017-01-12 Thread James Bottomley
On Thu, 2017-01-12 at 19:46 +0200, Jarkko Sakkinen wrote: > @@ -189,6 +190,12 @@ struct tpm_chip *tpm_chip_alloc(struct device > *pdev, > chip->cdev.owner = THIS_MODULE; > chip->cdev.kobj.parent = >dev.kobj; > > + chip->work_space.context_buf = kzalloc(PAGE_SIZE, > GFP_KERNEL); >

Re: [tpmdd-devel] [PATCH RFC v2 3/5] tpm: infrastructure for TPM spaces

2017-01-12 Thread James Bottomley
On Thu, 2017-01-12 at 19:46 +0200, Jarkko Sakkinen wrote: > @@ -189,6 +190,12 @@ struct tpm_chip *tpm_chip_alloc(struct device > *pdev, > chip->cdev.owner = THIS_MODULE; > chip->cdev.kobj.parent = >dev.kobj; > > + chip->work_space.context_buf = kzalloc(PAGE_SIZE, > GFP_KERNEL); >

Re: [tpmdd-devel] [PATCH RFC v2 3/5] tpm: infrastructure for TPM spaces

2017-01-12 Thread James Bottomley
On Thu, 2017-01-12 at 19:46 +0200, Jarkko Sakkinen wrote: > +static int tpm2_map_response(struct tpm_chip *chip, u32 cc, u8 *rsp, > size_t len) > +{ > + struct tpm_space *space = >work_space; > + u32 phandle; > + u32 vhandle; > + u32 attrs; > + int i; > + int

Re: [tpmdd-devel] [PATCH RFC v2 3/5] tpm: infrastructure for TPM spaces

2017-01-12 Thread James Bottomley
On Thu, 2017-01-12 at 19:46 +0200, Jarkko Sakkinen wrote: > +static int tpm2_map_response(struct tpm_chip *chip, u32 cc, u8 *rsp, > size_t len) > +{ > + struct tpm_space *space = >work_space; > + u32 phandle; > + u32 vhandle; > + u32 attrs; > + int i; > + int

Re: [tpmdd-devel] [PATCH RFC v2 3/5] tpm: infrastructure for TPM spaces

2017-01-12 Thread Jarkko Sakkinen
On Thu, Jan 12, 2017 at 10:38:30AM -0800, James Bottomley wrote: > On Thu, 2017-01-12 at 19:46 +0200, Jarkko Sakkinen wrote: > > @@ -435,17 +440,23 @@ ssize_t tpm_transmit(struct tpm_chip *chip, > > const u8 *buf, size_t bufsiz, > > goto out; > > > > out_recv: > > - rc =

Re: [tpmdd-devel] [PATCH RFC v2 3/5] tpm: infrastructure for TPM spaces

2017-01-12 Thread Jarkko Sakkinen
On Thu, Jan 12, 2017 at 10:38:30AM -0800, James Bottomley wrote: > On Thu, 2017-01-12 at 19:46 +0200, Jarkko Sakkinen wrote: > > @@ -435,17 +440,23 @@ ssize_t tpm_transmit(struct tpm_chip *chip, > > const u8 *buf, size_t bufsiz, > > goto out; > > > > out_recv: > > - rc =

Re: [tpmdd-devel] [PATCH RFC v2 3/5] tpm: infrastructure for TPM spaces

2017-01-12 Thread James Bottomley
On Thu, 2017-01-12 at 19:46 +0200, Jarkko Sakkinen wrote: > @@ -435,17 +440,23 @@ ssize_t tpm_transmit(struct tpm_chip *chip, > const u8 *buf, size_t bufsiz, > goto out; > > out_recv: > - rc = chip->ops->recv(chip, (u8 *) buf, bufsiz); > - if (rc < 0) > + len =

Re: [tpmdd-devel] [PATCH RFC v2 3/5] tpm: infrastructure for TPM spaces

2017-01-12 Thread James Bottomley
On Thu, 2017-01-12 at 19:46 +0200, Jarkko Sakkinen wrote: > @@ -435,17 +440,23 @@ ssize_t tpm_transmit(struct tpm_chip *chip, > const u8 *buf, size_t bufsiz, > goto out; > > out_recv: > - rc = chip->ops->recv(chip, (u8 *) buf, bufsiz); > - if (rc < 0) > + len =