[PATCH v3 5/7] tpm_tis: Clean up the force=1 module parameter

2015-12-17 Thread Jason Gunthorpe
nisms. All this structure is needed anyhow to enable TPM for OF environments. Finally, since the entire flow is changing convert the init/exit to use the modern ifdef-less coding style when possible Reported-by: "Wilck, Martin" <martin.wi...@ts.fujitsu.com> Signed-off-by: Jason Gunthorpe <jg

Re: [PATCH v3 1/7] tpm_crb: Use the common ACPI definition of struct acpi_tpm2

2016-01-04 Thread Jason Gunthorpe
On Sun, Jan 03, 2016 at 07:09:06PM +0200, Jarkko Sakkinen wrote: > On Thu, Dec 17, 2015 at 11:23:14AM -0700, Jason Gunthorpe wrote: > > include/acpi/actbl2.h is the proper place for these definitions > > and the needed TPM2 ones have been there since > > commit 413d4a6defe0

Re: [PATCH v3 2/7] tpm_tis: Disable interrupt auto probing on a per-device basis

2016-01-04 Thread Jason Gunthorpe
On Sun, Jan 03, 2016 at 07:20:40PM +0200, Jarkko Sakkinen wrote: > On Thu, Dec 17, 2015 at 11:23:15AM -0700, Jason Gunthorpe wrote: > > Instead of clearing the global interrupts flag when any device > > does not have an interrupt just pass -1 through tpm_info.irq. > > > &g

Re: [PATCH v3 5/7] tpm_tis: Clean up the force=1 module parameter

2016-01-04 Thread Jason Gunthorpe
On Sun, Jan 03, 2016 at 07:26:50PM +0200, Jarkko Sakkinen wrote: > > @@ -695,8 +685,8 @@ static int tpm_tis_init(struct device *dev, struct > > tpm_info *tpm_info, > > #endif > > > > chip->vendor.iobase = devm_ioremap_resource(dev, _info->res); > > - if (!chip->vendor.iobase) > > -

Re: [PATCH v3 7/7] tpm_crb: Use devm_ioremap_resource

2016-01-04 Thread Jason Gunthorpe
On Sun, Jan 03, 2016 at 07:32:13PM +0200, Jarkko Sakkinen wrote: > On Thu, Dec 17, 2015 at 11:23:20AM -0700, Jason Gunthorpe wrote: > > To support the force mode in tpm_tis we need to use resource locking > > in tpm_crb as well, via devm_ioremap_resource. > > > > The

Re: [PATCH v3 3/7] tpm_tis: Do not fall back to a hardcoded address for TPM2

2015-12-18 Thread Jason Gunthorpe
On Fri, Dec 18, 2015 at 11:34:32AM +0200, Jarkko Sakkinen wrote: > > + st = acpi_get_table(ACPI_SIG_TPM2, 1, > > + (struct acpi_table_header **) ); > > + if (ACPI_FAILURE(st) || tbl->header.length < sizeof(*tbl)) { > > + dev_err(_dev->dev, > > +

Re: [tpmdd-devel] [PATCH] base/platform: fix panic when probe function is NULL

2015-11-26 Thread Jason Gunthorpe
On Thu, Nov 26, 2015 at 08:01:34PM +0100, martin.wi...@ts.fujitsu.com wrote: > From: Martin Wilck > > Since b8b2c7d845d5, platform_drv_probe() is called for all platform > devices. If drv->probe is NULL, and dev_pm_domain_attach() fails, > platform_drv_probe() will

Re: [PATCH 2/9] IB: add a proper completion queue abstraction

2015-11-23 Thread Jason Gunthorpe
On Sat, Nov 14, 2015 at 08:08:49AM +0100, Christoph Hellwig wrote: > On Fri, Nov 13, 2015 at 11:25:13AM -0700, Jason Gunthorpe wrote: > > For instance, like this, not fulling draining the cq and then doing: > > > > > + completed = __ib_process_cq(cq, budget); > &

Re: [PATCH 2/9] IB: add a proper completion queue abstraction

2015-11-23 Thread Jason Gunthorpe
On Sat, Nov 14, 2015 at 08:13:44AM +0100, Christoph Hellwig wrote: > On Fri, Nov 13, 2015 at 03:06:36PM -0700, Jason Gunthorpe wrote: > > Looking at that thread and then at the patch a bit more.. > > > > +void ib_process_cq_direct(struct ib_cq *cq) > > [..] > >

Re: [tpmdd-devel] [PATCH] base/platform: fix panic when probe function is NULL

2015-11-28 Thread Jason Gunthorpe
On Sat, Nov 28, 2015 at 06:40:03PM +0200, Jarkko Sakkinen wrote: > > I have some patches to do this that are part of my OF enablement > > series, but I can make something simpler that would deal with this > > fairly quickly if you can test. > > Does the patch set that you sent include the fix or

Re: [PATCH 2/9] IB: add a proper completion queue abstraction

2015-11-24 Thread Jason Gunthorpe
On Tue, Nov 24, 2015 at 10:08:39AM -0700, c...@asomi.com wrote: >>> My recollection of the IB verbs is that they were unlikely to have >>> overlooked something like that. If it did slip through then there >>> should be an errata. >>verbs reflects the wire protocol and the wire

Re: [PATCH 2/9] IB: add a proper completion queue abstraction

2015-11-24 Thread Jason Gunthorpe
On Tue, Nov 24, 2015 at 06:47:14PM -0800, Caitlin Bestler wrote: > Acknowledge packet for the last packet of the request has been > committed to the wire (including the appropriate fields for RDMA > READ response). > The target side cannot generate a response before it

tpm_tis: Clean up force module parameter

2015-11-30 Thread Jason Gunthorpe
will be 'attached' to things created through platform_device_register_simple, which causes the tpm core to blow up. Jason Gunthorpe (2): tpm_tis: Disable interrupt auto probing on a per-device basis tpm_tis: Clean up the force=1 module parameter drivers/char/tpm/tpm_tis.c | 177

[PATCH 2/2] tpm_tis: Clean up the force=1 module parameter

2015-11-30 Thread Jason Gunthorpe
tin" <martin.wi...@ts.fujitsu.com> Signed-off-by: Jason Gunthorpe <jguntho...@obsidianresearch.com> --- drivers/char/tpm/tpm_tis.c | 161 - 1 file changed, 101 insertions(+), 60 deletions(-) diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/

[PATCH 1/2] tpm_tis: Disable interrupt auto probing on a per-device basis

2015-11-30 Thread Jason Gunthorpe
Instead of clearing the global interrupts flag when any device does not have an interrupt just pass -1 through tpm_info.irq. The only thing that asks for autoprobing is the force=1 path. Signed-off-by: Jason Gunthorpe <jguntho...@obsidianresearch.com> --- drivers/char/tpm/tpm_tis.

Re: [PATCH 2/9] IB: add a proper completion queue abstraction

2015-11-23 Thread Jason Gunthorpe
On Mon, Nov 23, 2015 at 01:54:05PM -0800, Bart Van Assche wrote: > Not really ... Please have a look at the SRP initiator source code. What the > SRP initiator does is to poll the send queue before sending a new > SCSI I see that. What I don't see is how SRP handles things when the sendq fills

Re: [PATCH 2/9] IB: add a proper completion queue abstraction

2015-11-23 Thread Jason Gunthorpe
On Mon, Nov 23, 2015 at 02:33:05PM -0800, Bart Van Assche wrote: > On 11/23/2015 02:18 PM, Jason Gunthorpe wrote: > >On Mon, Nov 23, 2015 at 01:54:05PM -0800, Bart Van Assche wrote: > >What I don't see is how SRP handles things when the > >sendq fills up, ie the case

Re: [PATCH 2/9] IB: add a proper completion queue abstraction

2015-11-23 Thread Jason Gunthorpe
On Mon, Nov 23, 2015 at 06:35:28PM -0800, Caitlin Bestler wrote: > Is it possible for an IB HCA to transmit a response on a QP and not > in that packet or a previous packet acknowledge something that it > has delivered to the user? AFAIK, the rules of ack coalescing do not interact with the send

Re: [PATCH 2/9] IB: add a proper completion queue abstraction

2015-11-23 Thread Jason Gunthorpe
On Mon, Nov 23, 2015 at 07:34:53PM -0500, Tom Talpey wrote: > Been there, seen that. Bluescreened on it, mysteriously. Yes, me too :( Jason -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at

Re: [PATCH 2/9] IB: add a proper completion queue abstraction

2015-11-23 Thread Jason Gunthorpe
On Mon, Nov 23, 2015 at 03:30:42PM -0800, Caitlin Bestler wrote: >The receive completion can be safely assumed to indicate transmit >completion over a reliable connection unless your peer has gone >completely bonkers and is replying to a command that it did not >receive. Perhaps

Re: [PATCH 2/9] IB: add a proper completion queue abstraction

2015-11-23 Thread Jason Gunthorpe
On Mon, Nov 23, 2015 at 01:04:25PM -0800, Bart Van Assche wrote: > Considerable time ago the send queue in the SRP initiator driver was > modified from signaled to non-signaled to reduce the number of interrupts > triggered by the SRP initiator driver. The SRP initiator driver polls the > send

Re: [tpmdd-devel] [PATCH v4 3/4] tpm: Allow TPM chip drivers to override reported command durations

2016-06-08 Thread Jason Gunthorpe
On Tue, Jun 07, 2016 at 05:45:39PM -0700, Ed Swierk wrote: > + case 0x32041114: /* Atmel 3204 */ > + chip->vendor.timeout_a = TIS_SHORT_TIMEOUT * HZ / 1000; > + chip->vendor.timeout_b = TIS_LONG_TIMEOUT * HZ / 1000; > + chip->vendor.timeout_c =

Re: [tpmdd-devel] [PATCH 3/3] tpm, tpm_crb: runtime power management

2016-06-16 Thread Jason Gunthorpe
On Thu, Jun 16, 2016 at 11:26:48PM +0300, Tomas Winkler wrote: > > It is compiled out if it is unused. Why would you want to trash the code > > with #ifdef cages if they are not necessary? I can add /* CONFIG_PM */ > > before the function if that makes it cleaner. > > I'm not sure about that, I

Re: [PATCH] mellanox: mlx5: Use logging functions to reduce text ~10k/5%

2016-06-22 Thread Jason Gunthorpe
On Wed, Jun 22, 2016 at 11:23:59AM -0700, Joe Perches wrote: > The output changes now do not include line #, but do include the > function offset. I've been using a technique like this in some code with good results: struct source_location { const char *file; const char *func; const

Re: [PATCH] tpm: vtpm_proxy: Introduce flag to prevent sysfs entries

2016-06-24 Thread Jason Gunthorpe
On Fri, Jun 24, 2016 at 10:36:55AM -0400, Stefan Berger wrote: > Introduce TPM_VTPM_PROXY_NO_SYSFS flag that prevents a vtpm_proxy driver > instance from having the typical sysfs entries that shows the state of the > TPM. The flag is to be set in the ioctl creating the vtpm_proxy device > pair and

Re: [PATCH v8 1/5] tpm_tis: Improve reporting of IO errors

2016-06-24 Thread Jason Gunthorpe
> expected = be32_to_cpu(*(__be32 *) (buf + 2)); > if (expected > count) { > + dev_err(chip->pdev, "Response too long (wanted %zd, got %d)\n", > + count, expected); This all needs to be rebased on Jarkko's tree I guess, chip->pdev is gone now.

Re: [PATCH v8 2/5] tpm: Add optional logging of TPM command durations

2016-06-24 Thread Jason Gunthorpe
On Tue, Jun 21, 2016 at 06:10:28PM -0700, Ed Swierk wrote: > if (chip->ops->req_canceled(chip, status)) { > dev_err(chip->pdev, "Operation Canceled\n"); > + dev_dbg(chip->pdev, "canceled command %d after %d ms\n", > +

Re: [PATCH v8 1/5] tpm_tis: Improve reporting of IO errors

2016-06-27 Thread Jason Gunthorpe
On Sat, Jun 25, 2016 at 06:47:45PM +0300, Jarkko Sakkinen wrote: > My repositories are ready for next pull request. The master has been > rebased to James' tree and merged to next. This seems fine.. Generally you shouldn't rebase to create pull requests, but this seemed needed.. Organize your

Re: [PATCH v8 1/5] tpm_tis: Improve reporting of IO errors

2016-06-24 Thread Jason Gunthorpe
On Fri, Jun 24, 2016 at 11:21:31PM +0300, Jarkko Sakkinen wrote: > Hmm... Do you mean by 4 month old stuff the stuff that is in mainline > and not in my master branch? I mean the stuff that is in your branch but not in mainline. $ git log --pretty=oneline jarkko/master ^v4.7-rc3 | wc -l 73 >

Re: [PATCH 1/5] tpm: unify tpm_gen_interrupt()

2016-06-24 Thread Jason Gunthorpe
On Fri, Jun 17, 2016 at 11:10:43PM +0200, Jarkko Sakkinen wrote: > extern int tpm_get_timeouts(struct tpm_chip *); > -extern void tpm_gen_interrupt(struct tpm_chip *); > +void tpm_gen_interrupt(struct tpm_chip *); Dropping the argument name is not the kernel standard, if these lines are going to

Re: [PATCH] tpm: vtpm_proxy: Introduce flag to prevent sysfs entries

2016-06-24 Thread Jason Gunthorpe
On Fri, Jun 24, 2016 at 02:43:00PM -0400, Stefan Berger wrote: > On 06/24/2016 01:48 PM, Jason Gunthorpe wrote: > >On Fri, Jun 24, 2016 at 10:36:55AM -0400, Stefan Berger wrote: > >>Introduce TPM_VTPM_PROXY_NO_SYSFS flag that prevents a vtpm_proxy driver > >>instance fr

Re: [tpmdd-devel] [PATCH] tpm: fix the cleanup of struct tpm_chip

2016-02-08 Thread Jason Gunthorpe
On Tue, Feb 09, 2016 at 05:30:30AM +0200, Jarkko Sakkinen wrote: > If the initialization fails before tpm_chip_register(), put_device() > will be not called, which causes release callback not to be called. > This patch fixes the issue by adding put_device() to devres list of > the parent device.

Re: [tpmdd-devel] [PATCH] tpm: fix the cleanup of struct tpm_chip

2016-02-09 Thread Jason Gunthorpe
On Tue, Feb 09, 2016 at 08:27:35AM +0200, Jarkko Sakkinen wrote: > On Tue, Feb 09, 2016 at 08:19:51AM +0200, Jarkko Sakkinen wrote: > > On Mon, Feb 08, 2016 at 10:26:55PM -0700, Jason Gunthorpe wrote: > > > On Tue, Feb 09, 2016 at 05:30:30AM +0200, Jar

Re: [tpmdd-devel] [PATCH] tpm: fix the cleanup of struct tpm_chip

2016-02-11 Thread Jason Gunthorpe
On Tue, Feb 09, 2016 at 05:30:30AM +0200, Jarkko Sakkinen wrote: > If the initialization fails before tpm_chip_register(), put_device() > will be not called, which causes release callback not to be called. > This patch fixes the issue by adding put_device() to devres list of > the parent device. >

Re: [PATCH 1/3] tpm: Hold the kref during tpm_chip_find_get

2016-02-13 Thread Jason Gunthorpe
Hi Jarkko, I found a bug in this last night, please hold off. Jason On Feb 13, 2016 3:08 AM, Jarkko Sakkinen <jarkko.sakki...@linux.intel.com> wrote: > > On Fri, Feb 12, 2016 at 05:04:29PM -0700, Jason Gunthorpe wrote: > > This was missed during the struct device conver

Re: [PATCH v2 0/4] tpm: last minute critical fixes for Linux 4.5

2016-02-13 Thread Jason Gunthorpe
or policy based sealing correct. > > Harald Hoyer (1): >   tpm_eventlog.c: fix binary_bios_measurements > > Jarkko Sakkinen (2): >   tpm: fix: keep auth session intact after unseal operation >   tpm: fix: rollback when devm_add_action() fails > > Jason Gun

Re: [tpmdd-devel] [PATCH] tpm: fix rollback when adding char dev fails

2016-02-02 Thread Jason Gunthorpe
return rc; > } > @@ -162,13 +161,14 @@ static int tpm_dev_add_device(struct tpm_chip *chip) > chip->devname, MAJOR(chip->dev.devt), > MINOR(chip->dev.devt), rc); > > + cdev_del(>cdev); > return rc; Yep. Reviewed-By: Jason Gunthorpe <jguntho...@obsidianresearch.com> Jason

Re: [tpmdd-devel] [PATCH] tpm: fix rollback/cleanup before tpm_chip_register()

2016-02-02 Thread Jason Gunthorpe
On Sat, Jan 30, 2016 at 06:05:42PM -0800, Jarkko Sakkinen wrote: > The release-callback is not used before the device is attached to the > device hierarchy. This caused resources not to cleanup properly if the > device driver initialization failed before tpm_chip_register(). This commentary is

Re: [tpmdd-devel] [PATCH] tpm, tpm_crb: fix control area resource mapping

2016-01-29 Thread Jason Gunthorpe
On Fri, Jan 29, 2016 at 02:26:54PM -0800, Jarkko Sakkinen wrote: > On Fri, Jan 29, 2016 at 02:21:08PM -0800, Jarkko Sakkinen wrote: > > On Fri, Jan 29, 2016 at 01:48:27PM -0700, Jason Gunthorpe wrote: > > > On Thu, Jan 28, 2016 at 11:13:59PM -0800, Jar

Re: [tpmdd-devel] [PATCH] tpm: fix rollback/cleanup before tpm_chip_register()

2016-02-03 Thread Jason Gunthorpe
On Wed, Feb 03, 2016 at 08:02:35AM -0800, Jarkko Sakkinen wrote: > Would s/the platform device/the parent device/ be better? Yes > > > + /* Associate character device with the platform device only after > > > + * it is properly initialized. > > > + */ > > > + dev_set_drvdata(pdev, chip); > >

Re: [tpmdd-devel] [PATCH] tpm, tpm_crb: fix control area resource mapping

2016-01-29 Thread Jason Gunthorpe
On Thu, Jan 28, 2016 at 11:13:59PM -0800, Jarkko Sakkinen wrote: > - struct resource tmp = {}; > - > - tmp.start = start; > - tmp.end = start + size - 1; > - tmp.flags = IORESOURCE_MEM; > + struct resource new_res = { > + .start = start, > + .end=

Re: [GIT PULL] remaining tpmdd fixes for Linux 4.5

2016-02-22 Thread Jason Gunthorpe
On Mon, Feb 22, 2016 at 09:08:28PM +0200, Jarkko Sakkinen wrote: > On Mon, Feb 22, 2016 at 10:52:45AM -0700, Jason Gunthorpe wrote: > > On Mon, Feb 22, 2016 at 04:50:23PM +0200, Jarkko Sakkinen wrote: > > > > > I already pushed a fix to my master for this issue: > &g

Re: [GIT PULL] remaining tpmdd fixes for Linux 4.5

2016-02-22 Thread Jason Gunthorpe
On Mon, Feb 22, 2016 at 04:50:23PM +0200, Jarkko Sakkinen wrote: > I already pushed a fix to my master for this issue: > > https://github.com/jsakkine/linux-tpmdd/commit/6386544ad7bceb3d0248b85da29d4d99eebe9161 The goal is to reduce the number of #ifdef'd code segments so we have fewer problems

Re: [PATCH] IB/sysfs: remove unused va_list args

2016-01-25 Thread Jason Gunthorpe
in.k...@canonical.com> Yep. This is bad new breakage too. Care to add a fixes line? Reviewed-by: Jason Gunthorpe <jguntho...@obsidianresearch.com> Jason

Re: [PATCH 2/3] tpm: Get rid of chip->pdev

2016-02-12 Thread Jason Gunthorpe
On Fri, Feb 12, 2016 at 08:31:21PM -0500, Stefan Berger wrote: > The vtpm driver will introduce chip->priv, which will point to > vtpm_dev. For Why not just use chip->vendor.priv? Aka TPM_VPRIV > this reason we need to hold a reference to the vtpm_dev->dev in the > front end. Yes, but all

Re: [PATCH 2/3] tpm: Get rid of chip->pdev

2016-02-12 Thread Jason Gunthorpe
On Fri, Feb 12, 2016 at 07:37:10PM -0500, Stefan Berger wrote: > Jason Gunthorpe <jguntho...@obsidianresearch.com> wrote on 02/12/2016 >07:04:30 PM: >> >> This is a hold over from before the struct device conversion. >> >> - Al

[PATCH 1/3] tpm: Hold the kref during tpm_chip_find_get

2016-02-12 Thread Jason Gunthorpe
This was missed during the struct device conversion, we need to hold a kref on the chip to make sure it isn't freed. Signed-off-by: Jason Gunthorpe <jguntho...@obsidianresearch.com> --- drivers/char/tpm/tpm-chip.c | 2 ++ drivers/char/tpm/tpm.h | 1 + 2 files changed, 3 insertions(+)

[PATCH 2/3] tpm: Get rid of chip->pdev

2016-02-12 Thread Jason Gunthorpe
hip->dev.parent instead - We no longer need to get_device(pdev) in any places since it is no longer used by any of the code. The kref on the parent is held by the device core during device_add and dropped in device_del Signed-off-by: Jason Gunthorpe <jguntho...@obsidianresearch.com> --- driv

[PATCH 0/3] Various struct device cleanups

2016-02-12 Thread Jason Gunthorpe
These little clean ups were missed during the struct device conversion of tpm_chip. There were noticed when looking at Stefan's vtpm patch sets. Nothing very significant - Add some missing krefs - Replace chip->devname with dev_name - Replace chip->pdev with chip->dev.parent Jason

[PATCH 3/3] tpm: Get rid of devname

2016-02-12 Thread Jason Gunthorpe
Now that we have a proper struct device just use dev_name() to access this value instead of keeping two copies. Signed-off-by: Jason Gunthorpe <jguntho...@obsidianresearch.com> --- drivers/char/tpm/tpm-chip.c| 17 +++-- drivers/char/tpm/tpm.h | 1 - driver

Re: [PATCH 2/3] tpm: Get rid of chip->pdev

2016-02-12 Thread Jason Gunthorpe
while /dev/tpmX is open, that is no longer needed for corectness. >From 52c5710ff585e936687e57ca5e267e82e334ebc5 Mon Sep 17 00:00:00 2001 From: Jason Gunthorpe <jguntho...@obsidianresearch.com> Date: Fri, 12 Feb 2016 20:29:53 -0700 Subject: [PATCH 3/3] tpm: Provide strong locking for device re

Re: [PATCH 3/3] tpm: Get rid of devname

2016-02-12 Thread Jason Gunthorpe
On Sat, Feb 13, 2016 at 09:01:06AM +0800, kbuild test robot wrote: > url: > https://github.com/0day-ci/linux/commits/Jason-Gunthorpe/tpm-Hold-the-kref-during-tpm_chip_find_get/20160213-080824 > config: xtensa-allyesconfig (attached as .config) > reproduce: >

Re: [PATCH 2/3] tpm: Get rid of chip->pdev

2016-02-13 Thread Jason Gunthorpe
On Sun, Feb 14, 2016 at 07:24:14AM +0200, Jarkko Sakkinen wrote: > > This should take care of it for all drivers including vtpm. > > > > https://github.com/jgunthorpe/linux/commits/for-jarkko > > > > At the very least this turns silent use after free into a null pointer > > oops. > > > > We

Re: [tpmdd-devel] [PATCH] tpm_crb: fix bad name pointer usage with struct resource

2016-02-16 Thread Jason Gunthorpe
On Wed, Feb 17, 2016 at 02:27:54AM +0200, Jarkko Sakkinen wrote: > - if (acpi_dev_resource_memory(ares, )) > + if (acpi_dev_resource_memory(ares, )) { > + res.name = NULL; What? How is this not a bug in acpi_dev_resource_memory? Maybe it needs to memcpy into devm allocated

Re: [tpmdd-devel] [PATCH] tpm_crb: fix bad name pointer usage with struct resource

2016-02-18 Thread Jason Gunthorpe
On Wed, Feb 17, 2016 at 04:20:16PM +0200, Jarkko Sakkinen wrote: > Maybe for the release the safest bet would be anyway explicitly not > use the name field? That's the safest bet given the release time > frame. nulling it in the acpi paths of tis and crb, if you know those are broken seems good

Re: [tpmdd-devel] [PATCH] tpm_crb: fix: associate to the correct device

2016-02-18 Thread Jason Gunthorpe
On Wed, Feb 17, 2016 at 01:23:31PM +0200, Jarkko Sakkinen wrote: > At the moment for tpm_crb /proc/iomem shows the HW interface and not the > device using the memory range. This patch fixes the issue by associating > memory mappings to the TPM character device. > > The end result is this: > > $

Re: [tpmdd-devel] [PATCH] tpm_crb: fix bad name pointer usage with struct resource

2016-02-19 Thread Jason Gunthorpe
On Fri, Feb 19, 2016 at 05:06:06PM +0200, Jarkko Sakkinen wrote: > Can you quickly check the two top-most patches: > > https://github.com/jsakkine/linux-tpmdd/commits/master Drop the change to crb_map_res, the memset is not needed. The shutdown change is probably OK for a rc fix, but it is

Re: [PATCH 1/3] tpm: Hold the kref during tpm_chip_find_get

2016-02-13 Thread Jason Gunthorpe
On Sun, Feb 14, 2016 at 06:55:12AM +0200, Jarkko Sakkinen wrote: > On Fri, Feb 12, 2016 at 05:04:29PM -0700, Jason Gunthorpe wrote: > > This was missed during the struct device conversion, we > > need to hold a kref on the chip to make sure it isn't freed. > > > > Sig

Re: [tpmdd-devel] [PATCH 2/3] tpm: Get rid of chip->pdev

2016-02-13 Thread Jason Gunthorpe
On Sat, Feb 13, 2016 at 10:39:11AM -0500, Stefan Berger wrote: > >@@ -347,8 +347,8 @@ static int i2c_nuvoton_recv(struct tpm_chip *chip, u8 > >*buf, size_t count) > > */ > > static int i2c_nuvoton_send(struct tpm_chip *chip, u8 *buf, size_t len) > > { > >-struct device *dev = chip->pdev;

Re: [PATCH v6 08/11] tpm: Driver for supporting multiple emulated TPMs

2016-03-10 Thread Jason Gunthorpe
On Thu, Mar 10, 2016 at 06:39:15PM +0200, Jarkko Sakkinen wrote: > Some might want to use this in a way that the created virtual device > is not closed when /dev/vtpmx is closed. No, there is no reason to create an API like that - TPM's are stateful, one cannot close the server side and

Re: [PATCH] tpm: remove redundant code from self-test functions

2016-03-30 Thread Jason Gunthorpe
On Wed, Mar 30, 2016 at 04:20:45PM +0300, Jarkko Sakkinen wrote: > - rc = be32_to_cpu(cmd.header.out.return_code); > if (rc == TPM_ERR_DISABLED || rc == TPM_ERR_DEACTIVATED) { This line is the entire reason it is open coded, I see it being removed, but I don't see how

Re: [PATCH] tpm: fix crash in tpm_tis deinitialization

2016-04-12 Thread Jason Gunthorpe
On Tue, Apr 12, 2016 at 07:26:27AM +0300, Jarkko Sakkinen wrote: > > This needs to be after ops is fenced, something like this. > > I would appreciate a supporting argument. > > I guess the argument here is that this will prevent user space from > issuing TPM commands after the shutdown command

Re: [PATCH] tpm: fix crash in tpm_tis deinitialization

2016-04-11 Thread Jason Gunthorpe
On Mon, Apr 11, 2016 at 07:05:20PM +0300, Jarkko Sakkinen wrote: > rmmod crashes the driver because tpm_chip_unregister() already sets ops > to NULL. This commit fixes the issue by moving tpm2_shutdown() to > tpm_chip_unregister(). This commit is also cleanup because it removes > duplicate code

Re: [PATCH v9 2/4] tpm: Proxy driver for supporting multiple emulated TPMs

2016-04-11 Thread Jason Gunthorpe
On Mon, Apr 11, 2016 at 11:43:58AM +0300, Jarkko Sakkinen wrote: > On Thu, Apr 07, 2016 at 11:49:44AM -0400, Stefan Berger wrote: > > On 04/07/2016 08:35 AM, Jarkko Sakkinen wrote: > > >On Tue, Mar 29, 2016 at 02:19:12PM -0400, Stefan Berger wrote: > > >>This patch implements a proxy driver for

Re: [tpmdd-devel] [PATCH] tpm: drop int_queue from tpm_vendor_specific

2016-03-22 Thread Jason Gunthorpe
do this one step at a time in order not to break anything. > > Signed-off-by: Jarkko Sakkinen <jarkko.sakki...@linux.intel.com> Reviewed-by: Jason Gunthorpe <jguntho...@obsidianresearch.com> > drivers/char/tpm/tpm.h | 1 - > drivers/char/tpm/tpm_i2c_nuvoton.c

Re: [PATCH] tpm: drop 'base' from struct tpm_vendor_specific

2016-03-23 Thread Jason Gunthorpe
e atmel_get_priv(chip) ((struct tpm_atmel_priv *) chip->vendor.priv) This should be a static inline function not a define > +#define tpm_nsc_get_priv(chip) ((struct tpm_nsc_priv *) chip->vendor.priv) Ditto Otherwise looks ok Reviewed-by: Jason Gunthorpe <jguntho...@obsidianresearch.com> Jason

Re: [PATCH] tpm_tis: drop manufacturer_id from struct tpm_vendor_specific

2016-03-23 Thread Jason Gunthorpe
On Wed, Mar 23, 2016 at 07:31:56AM +0200, Jarkko Sakkinen wrote: > Dropped manufacturer_id from struct tpm_vendor_specific and redeclared > it in the private struct priv_data that tpm_tis uses because the field > is only used tpm_tis. Reviewed-by: Jason Gunthorpe <jguntho...@obsidian

Re: [PATCH] tpm: drop the field 'time_expired' from struct tpm_chip

2016-03-23 Thread Jason Gunthorpe
On Wed, Mar 23, 2016 at 08:23:39AM +0200, Jarkko Sakkinen wrote: > Removed the field because it is not used for anything. Reviewed-by: Jason Gunthorpe <jguntho...@obsidianresearch.com> Jason

Re: [PATCH] tpm_atmel: drop tpm_atmel specific fields from tpm_vendor_specific

2016-03-23 Thread Jason Gunthorpe
ine to me Reviewd-by: Jason Gunthorpe <jguntho...@obsidianresearch.com> Although I think we should delete this driver Jason

Re: [PATCH] tpm: fix tpm_bios_log_setup stub prototype

2016-03-19 Thread Jason Gunthorpe
On Wed, Mar 16, 2016 at 12:13:41PM +0200, Jarkko Sakkinen wrote: > On Wed, Mar 16, 2016 at 09:19:48AM +0100, Arnd Bergmann wrote: > > A cleanup patch changed the prototype of the regular tpm_bios_log_setup > > function, but not that of the stub that is used when the TPM is disabled, > > causing a

Re: [PATCH v8 08/10] tpm: Proxy driver for supporting multiple emulated TPMs

2016-03-19 Thread Jason Gunthorpe
On Wed, Mar 16, 2016 at 02:09:16PM +0200, Jarkko Sakkinen wrote: > On Sun, Mar 13, 2016 at 06:54:38PM -0400, Stefan Berger wrote: > Alternative to this would be to have /dev/vtpmx create: > > * /dev/vtpm0 for the server > * /dev/tpm0 for the client > > This is how David Howell's PoC worked and

Re: [PATCH] tpm: remove redundant code from self-test functions

2016-04-01 Thread Jason Gunthorpe
On Thu, Mar 31, 2016 at 09:37:56AM +0300, Jarkko Sakkinen wrote: > On Wed, Mar 30, 2016 at 11:46:23PM -0600, Jason Gunthorpe wrote: > > On Wed, Mar 30, 2016 at 04:20:45PM +0300, Jarkko Sakkinen wrote: > > > > > - rc = be32_to_cpu(cmd.header.out.return_code)

Re: [PATCH] tpm: fix crash in tpm_tis deinitialization

2016-04-13 Thread Jason Gunthorpe
On Wed, Apr 13, 2016 at 09:58:05AM +0300, Jarkko Sakkinen wrote: > > > It prevents everything including the kernel from issuing a command > > > > > > That lock is not used to exclude kernel access. Read lock is only taken > > for the user space device

Re: [PATCH v3] tpm: fix crash in tpm_tis deinitialization

2016-04-13 Thread Jason Gunthorpe
for device > removal") You patch got a little mangled.. The v2/v3 should be after the diffstat, not in the commit message and the --- after the SOB section is missing.. Otherwise it looks fine Reviewed-by: Jason Gunthorpe <jguntho...@obsidianresearch.com> > extern int tpm2_star

Re: [PATCH] tpm: check for TPM_CHIP_FLAG_TPM2 before calling tpm2_shutdown()

2016-04-25 Thread Jason Gunthorpe
On Mon, Apr 25, 2016 at 12:21:30PM +0300, Jarkko Sakkinen wrote: > Signed-off-by: Jarkko Sakkinen <jarkko.sakki...@linux.intel.com> > Reported-by: Stefan Berger <stef...@linux.vnet.ibm.com> > drivers/char/tpm/tpm-chip.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletio

Re: [PATCH] tpm: use devm_add_action_or_reset

2016-04-25 Thread Jason Gunthorpe
r. Seems reasonable to me. Reviewed-by: Jason Gunthorpe <jguntho...@obsidianresearch.com>

Re: [PATCH 0/7] IB/hfi1: Remove write() and use ioctl() for user access

2016-04-20 Thread Jason Gunthorpe
On Thu, Apr 14, 2016 at 01:52:44PM -0400, Dennis Dalessandro wrote: > The eprom device is for low level programming of the eprom on the > chip. We do not use i2c for this because the eprom is directly > attached to the chip and not accessible via i2c, requires register > access. Okay, but the

[PATCH] tpm: Fix IRQ unwind ordering in TIS

2016-04-27 Thread Jason Gunthorpe
chip->pdev") Signed-off-by: Jason Gunthorpe <jguntho...@obsidianresearch.com> Tested-by: Stefan Berger <stef...@linux.vnet.ibm.com> --- drivers/char/tpm/tpm_tis.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/t

Re: [PATCH 0/7] IB/hfi1: Remove write() and use ioctl() for user access

2016-04-26 Thread Jason Gunthorpe
On Fri, Apr 22, 2016 at 02:38:45PM -0400, Dennis Dalessandro wrote: > >Stuff like this should be a build bug: > >/* NOTE: assumes unsigned long is 8 bytes */ > > Our Kconfig depends on X86_64. Should we add a BUILD_BUG_ON or something? Yes > as we can maintain the same functionality, which

Re: [PATCH v2 0/5] IB/hfi1: Remove write() and use ioctl() for user access

2016-05-12 Thread Jason Gunthorpe
On Thu, May 12, 2016 at 03:07:38PM -0400, Dennis Dalessandro wrote: > >>There is also a driver software version being exported via a sysfs > >>file. This is needed so that user space applications (psm) can > >>determine if it needs to do ioctl() or write(). > > > >Why? Don't do this, just call

Re: [PATCH v2 3/5] IB/hfi1: Add ioctl() interface for user commands

2016-05-12 Thread Jason Gunthorpe
On Thu, May 12, 2016 at 03:27:27PM -0400, Dennis Dalessandro wrote: > >I thought we agreed to get rid of this as well? It certainly does not > >belong here, and as a general rule, I don't think ioctls should be > >doing capable tests.. > > Yeah. I left it in this patch set because this just

Re: [PATCH v2 3/5] IB/hfi1: Add ioctl() interface for user commands

2016-05-12 Thread Jason Gunthorpe
On Thu, May 12, 2016 at 10:18:47AM -0700, Dennis Dalessandro wrote: > + case HFI1_IOCTL_EP_INFO: > + case HFI1_IOCTL_EP_ERASE_CHIP: > + case HFI1_IOCTL_EP_ERASE_RANGE: > + case HFI1_IOCTL_EP_READ_RANGE: > + case HFI1_IOCTL_EP_WRITE_RANGE: > + if

Re: [PATCH v2 0/5] IB/hfi1: Remove write() and use ioctl() for user access

2016-05-12 Thread Jason Gunthorpe
On Thu, May 12, 2016 at 10:18:27AM -0700, Dennis Dalessandro wrote: > There is also a driver software version being exported via a sysfs > file. This is needed so that user space applications (psm) can > determine if it needs to do ioctl() or write(). Why? Don't do this, just call ioctl() and if

Re: [PATCH v2] tpm: Factor out common startup code

2016-05-17 Thread Jason Gunthorpe
On Tue, May 17, 2016 at 07:15:57AM +0300, Jarkko Sakkinen wrote: > On Mon, May 16, 2016 at 12:25:47PM -0600, Jason Gunthorpe wrote: > > Provide some flags in tpm_class_ops to allow drivers to opt-in to the > > common startup sequence. This is the sequence used by tpm_tis

[PATCH v2] tpm: Factor out common startup code

2016-05-16 Thread Jason Gunthorpe
Provide some flags in tpm_class_ops to allow drivers to opt-in to the common startup sequence. This is the sequence used by tpm_tis and tpm_crb. All drivers should set this flag. Signed-off-by: Jason Gunthorpe <jguntho...@obsidianresearch.com> Tested-by: Andrew Zamansky <and

Re: [PATCH v2] tpm: Factor out common startup code

2016-05-18 Thread Jason Gunthorpe
On Wed, May 18, 2016 at 12:59:24PM +0300, Jarkko Sakkinen wrote: > On Tue, May 17, 2016 at 10:53:04AM -0600, Jason Gunthorpe wrote: > > On Tue, May 17, 2016 at 07:15:57AM +0300, Jarkko Sakkinen wrote: > > > On Mon, May 16, 2016 at 12:25:47PM -0600, Jason Gunthorpe wrote: > >

Re: [PATCH v2 0/5] IB/hfi1: Remove write() and use ioctl() for user access

2016-05-12 Thread Jason Gunthorpe
On Thu, May 12, 2016 at 03:53:04PM -0400, Dennis Dalessandro wrote: > >>Is it really that big of a deal to export a version number? > > > >If it isn't needed, don't add it.. > > For the reason I gave, I think it is needed so unless you are vehemently > opposed to it I would prefer to leave it.

Re: [PATCH v2 3/5] IB/hfi1: Add ioctl() interface for user commands

2016-05-12 Thread Jason Gunthorpe
On Thu, May 12, 2016 at 03:48:16PM -0400, Doug Ledford wrote: > were going to rip out the EEPROM code. In any case, the best fix would > be to rebase the two series that are remaining and move any "rip out > things like eeprom support" patches to prior to the ioctl patches and > make it so that

Re: [PATCH v10 4/5] tpm: Initialize TPM and get durations and timeouts

2016-04-15 Thread Jason Gunthorpe
ize_t > count) > { > struct proxy_dev *proxy_dev = dev_get_drvdata(>dev); > if (!proxy_dev) > return -EIO; Is that actually possible? It shouldn't be. If not please drop it an related. For both: Reviewed-by: Jason Gunthorpe <jguntho...@obsidianresearch.com> Jason

Re: [PATCH v10 2/5] tpm: Introduce TPM_CHIP_FLAG_VIRTUAL

2016-04-15 Thread Jason Gunthorpe
..@linux.vnet.ibm.com> > drivers/char/tpm/tpm-chip.c | 7 +-- > drivers/char/tpm/tpm.h | 1 + > 2 files changed, 6 insertions(+), 2 deletions(-) Reviewed-by: Jason Gunthorpe <jguntho...@obsidianresearch.com> Jason

Re: [PATCH 0/7] IB/hfi1: Remove write() and use ioctl() for user access

2016-04-14 Thread Jason Gunthorpe
On Thu, Apr 14, 2016 at 01:52:44PM -0400, Dennis Dalessandro wrote: > On Thu, Apr 14, 2016 at 10:45:50AM -0600, Jason Gunthorpe wrote: > >On Thu, Apr 14, 2016 at 08:41:35AM -0700, Dennis Dalessandro wrote: > >>This patch series removes the write() interface for us

Re: [PATCH 0/7] IB/hfi1: Remove write() and use ioctl() for user access

2016-04-14 Thread Jason Gunthorpe
On Thu, Apr 14, 2016 at 02:42:01PM -0400, Dennis Dalessandro wrote: > >It certainly can't be years. > > Does fixing the current write()/writev() problem have any real > impact on how we proceed for the "1 char dev to rule them all" idea? We aren't going to take a bad uAPI into mainline. So how

Re: [PATCH 0/7] IB/hfi1: Remove write() and use ioctl() for user access

2016-04-15 Thread Jason Gunthorpe
On Sat, Apr 16, 2016 at 12:23:28AM +0300, Leon Romanovsky wrote: > Intel as usual decided to do it in their way and the result is presented > on this mailing list. Dennis was pretty clear he was going to send the patches to address Al's concern, which he has done. I was also pretty clear I was

Re: [PATCH 0/7] IB/hfi1: Remove write() and use ioctl() for user access

2016-04-18 Thread Jason Gunthorpe
On Mon, Apr 18, 2016 at 06:09:09AM -0700, Christoph Hellwig wrote: > On Thu, Apr 14, 2016 at 10:45:50AM -0600, Jason Gunthorpe wrote: > > On Thu, Apr 14, 2016 at 08:41:35AM -0700, Dennis Dalessandro wrote: > > > This patch series removes the write() interface for us

Re: [PATCH v11 1/4] tpm: Remove all uses of drvdata from the TPM Core

2016-04-19 Thread Jason Gunthorpe
On Tue, Apr 19, 2016 at 06:36:22AM -0400, Stefan Berger wrote: > On 04/19/2016 06:12 AM, Jarkko Sakkinen wrote: > >On Mon, Apr 18, 2016 at 01:26:13PM -0400, Stefan Berger wrote: > >>From: Jason Gunthorpe <jguntho...@obsidianresearch.com> > >> > >>T

Re: [PATCH] tpm_crb: fix mapping of the buffers

2016-04-19 Thread Jason Gunthorpe
vers/char/tpm/tpm_crb.c | 39 --- > 1 file changed, 28 insertions(+), 11 deletions(-) This looks OK Reviewed-by: Jason Gunthorpe <jguntho...@obsidianresearch.com> > + if (cmd_pa != rsp_pa) { > + priv->rsp = crb_map_res(dev, priv, _res, rsp_pa, rsp_size); &g

Re: [PATCH 0/7] IB/hfi1: Remove write() and use ioctl() for user access

2016-04-19 Thread Jason Gunthorpe
On Mon, Apr 18, 2016 at 11:24:11AM -0700, Christoph Hellwig wrote: > On Mon, Apr 18, 2016 at 11:40:47AM -0600, Jason Gunthorpe wrote: > > I wasn't arguing this should integrate into verbs in some way, only > > that the way to access the driver-specific uAPI of a RDMA device should

Re: [PATCH 0/7] IB/hfi1: Remove write() and use ioctl() for user access

2016-04-14 Thread Jason Gunthorpe
On Thu, Apr 14, 2016 at 08:41:35AM -0700, Dennis Dalessandro wrote: > This patch series removes the write() interface for user access in favor of an > ioctl() based approach. This is in response to the complaint that we had > different handlers for write() and writev() doing different things and

Re: [PATCH] tpm_crb: fix mapping of the buffers

2016-04-18 Thread Jason Gunthorpe
On Tue, Apr 19, 2016 at 02:08:00AM +0300, Jarkko Sakkinen wrote: > On my Lenovo x250 the following situation occurs: > > [18697.813871] tpm_crb MSFT0101:00: can't request region for resource > [mem 0xacdff080-0xacdf] Sigh, the BIOS vendors seem to be screwing this up a lot.. No doubt because

Re: [PATCH 0/7] IB/hfi1: Remove write() and use ioctl() for user access

2016-04-14 Thread Jason Gunthorpe
On Thu, Apr 14, 2016 at 01:48:31PM -0400, Ira Weiny wrote: > On Thu, Apr 14, 2016 at 10:45:50AM -0600, Jason Gunthorpe wrote: > > On Thu, Apr 14, 2016 at 08:41:35AM -0700, Dennis Dalessandro wrote: > > > This patch series removes the write() interface for us

<    1   2   3   4   5   6   7   8   9   10   >