Re: [PATCH] tpm: Move Linux RNG connection to hwrng

2017-10-25 Thread Jason Gunthorpe
On Wed, Oct 25, 2017 at 10:00:30PM +0200, Jarkko Sakkinen wrote: > A minor tidbit: could the tpm_ prefix removed from those fields? Yes, in v2 I will send v2 when you land your rework patch as this will depend on it. Jason

Re: [PATCH] tpm: Move Linux RNG connection to hwrng

2017-10-25 Thread Jarkko Sakkinen
On Wed, Oct 25, 2017 at 01:37:07PM -0600, Jason Gunthorpe wrote: > On Wed, Oct 25, 2017 at 08:58:17PM +0200, Jarkko Sakkinen wrote: > > On Wed, Oct 25, 2017 at 08:15:09PM +0530, PrasannaKumar Muralidharan wrote: > > > > + if (!IS_ENABLED(CONFIG_HW_RANDOM_TPM)) > > > > + return 0

Re: [PATCH] tpm: Move Linux RNG connection to hwrng

2017-10-25 Thread Jason Gunthorpe
On Wed, Oct 25, 2017 at 08:58:17PM +0200, Jarkko Sakkinen wrote: > On Wed, Oct 25, 2017 at 08:15:09PM +0530, PrasannaKumar Muralidharan wrote: > > > + if (!IS_ENABLED(CONFIG_HW_RANDOM_TPM)) > > > + return 0; > > > > Can #ifndef CONFIG_HW_RANDOM_TPM be used instead? That way an

Re: [PATCH] tpm: Move Linux RNG connection to hwrng

2017-10-25 Thread Jarkko Sakkinen
On Wed, Oct 25, 2017 at 08:15:09PM +0530, PrasannaKumar Muralidharan wrote: > > + if (!IS_ENABLED(CONFIG_HW_RANDOM_TPM)) > > + return 0; > > Can #ifndef CONFIG_HW_RANDOM_TPM be used instead? That way an if > condition can be avoided. Nope. There is no reason to avoid the if-co

Re: [PATCH] tpm: Move Linux RNG connection to hwrng

2017-10-25 Thread PrasannaKumar Muralidharan
Hi Jason, On 25 October 2017 at 20:48, Jason Gunthorpe wrote: > On Wed, Oct 25, 2017 at 08:15:09PM +0530, PrasannaKumar Muralidharan > wrote: > >> > +static int tpm_add_hwrng(struct tpm_chip *chip) >> > +{ >> > + if (!IS_ENABLED(CONFIG_HW_RANDOM_TPM)) >> > + return 0; >> >> Ca

Re: [PATCH] tpm: Move Linux RNG connection to hwrng

2017-10-25 Thread Jason Gunthorpe
On Wed, Oct 25, 2017 at 08:15:09PM +0530, PrasannaKumar Muralidharan wrote: > > +static int tpm_add_hwrng(struct tpm_chip *chip) > > +{ > > + if (!IS_ENABLED(CONFIG_HW_RANDOM_TPM)) > > + return 0; > > Can #ifndef CONFIG_HW_RANDOM_TPM be used instead? That way an if > condition

Re: [PATCH] tpm: Move Linux RNG connection to hwrng

2017-10-25 Thread PrasannaKumar Muralidharan
Hi Jason, Nice to see this patch. Some minor comments below. On 25 October 2017 at 00:12, Jason Gunthorpe wrote: > The tpm-rng.c approach is completely inconsistent with how the kernel > handles hotplug. Instead manage a hwrng device for each TPM. This will > cause the kernel to read entropy fro

Re: [PATCH] tpm: Move Linux RNG connection to hwrng

2017-10-24 Thread Jarkko Sakkinen
On Tue, Oct 24, 2017 at 03:34:49PM -0600, Jason Gunthorpe wrote: > On Tue, Oct 24, 2017 at 12:42:35PM -0600, Jason Gunthorpe wrote: > > > This is compile tested only. > > 0day says the kconfig has a problem when randomized, here is the fix I > will roll into a v2 in a few days: I will probably h

Re: [PATCH] tpm: Move Linux RNG connection to hwrng

2017-10-24 Thread Jason Gunthorpe
On Tue, Oct 24, 2017 at 12:42:35PM -0600, Jason Gunthorpe wrote: > This is compile tested only. 0day says the kconfig has a problem when randomized, here is the fix I will roll into a v2 in a few days: diff --git a/drivers/char/tpm/Kconfig b/drivers/char/tpm/Kconfig index a95725fa77789e..ca89da3

[PATCH] tpm: Move Linux RNG connection to hwrng

2017-10-24 Thread Jason Gunthorpe
The tpm-rng.c approach is completely inconsistent with how the kernel handles hotplug. Instead manage a hwrng device for each TPM. This will cause the kernel to read entropy from the TPM when it is plugged in, and allow access to the TPM rng via /dev/hwrng. Signed-off-by: PrasannaKumar Muralidhara