tpmdd-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] Merge tpm_tis ACPI and platform drivers
@ 2017-05-04 15:53 Jason Gunthorpe
       [not found] ` <1493913205-18276-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
  0 siblings, 1 reply; 18+ messages in thread
From: Jason Gunthorpe @ 2017-05-04 15:53 UTC (permalink / raw)
  To: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Jarkko Sakkinen

As suggested by Jarkko.

The two precursor patches might want to go to -stable.

Jerry says it worked on his system, but we still to see results from things
like crb systems/etc.

Jason Gunthorpe (3):
  tpm_tis: Fix IRQ autoprobing when using platform_device
  tpm_tis: Use platform_get_irq
  tpm_tis: Consolidate the platform and acpi probe flow

 drivers/char/tpm/tpm_tis.c | 175 +++++++++++++++------------------------------
 1 file changed, 57 insertions(+), 118 deletions(-)

-- 
2.7.4


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v2 1/3] tpm_tis: Fix IRQ autoprobing when using platform_device
       [not found] ` <1493913205-18276-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
@ 2017-05-04 15:53   ` Jason Gunthorpe
       [not found]     ` <1493913205-18276-2-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
  2017-05-04 15:53   ` [PATCH v2 2/3] tpm_tis: Use platform_get_irq Jason Gunthorpe
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 18+ messages in thread
From: Jason Gunthorpe @ 2017-05-04 15:53 UTC (permalink / raw)
  To: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Jarkko Sakkinen

The test was backwards, triggering IRQ autoprobing if the firmware
did not specify an IRQ, instead of triggering it only when the
module force parameter was specified.

Since autoprobing is not enabled on !x86 and the platform device is
currently only used on !x86, or with force, this has gone unnoticed.

Fixes: 00194826e6be ("tpm_tis: Clean up the force=1 module parameter")
Tested-by: Jerry Snitselaar <jsnitsel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
 drivers/char/tpm/tpm_tis.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
index c7e1384f1b0802..56ce2bb1916693 100644
--- a/drivers/char/tpm/tpm_tis.c
+++ b/drivers/char/tpm/tpm_tis.c
@@ -336,7 +336,7 @@ static int tpm_tis_plat_probe(struct platform_device *pdev)
 	if (res) {
 		tpm_info.irq = res->start;
 	} else {
-		if (pdev == force_pdev)
+		if (pdev != force_pdev)
 			tpm_info.irq = -1;
 		else
 			/* When forcing auto probe the IRQ */
-- 
2.7.4


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 2/3] tpm_tis: Use platform_get_irq
       [not found] ` <1493913205-18276-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
  2017-05-04 15:53   ` [PATCH v2 1/3] tpm_tis: Fix IRQ autoprobing when using platform_device Jason Gunthorpe
@ 2017-05-04 15:53   ` Jason Gunthorpe
       [not found]     ` <1493913205-18276-3-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
  2017-05-04 15:53   ` [PATCH v2 3/3] tpm_tis: Consolidate the platform and acpi probe flow Jason Gunthorpe
  2017-05-05  6:45   ` [PATCH v2 0/3] Merge tpm_tis ACPI and platform drivers Jerry Snitselaar
  3 siblings, 1 reply; 18+ messages in thread
From: Jason Gunthorpe @ 2017-05-04 15:53 UTC (permalink / raw)
  To: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Jarkko Sakkinen

Replace the open coded IORESOURCE_IRQ with platform_get_irq, which
supports more cases.

Fixes: 00194826e6be ("tpm_tis: Clean up the force=1 module parameter")
Tested-by: Jerry Snitselaar <jsnitsel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
 drivers/char/tpm/tpm_tis.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
index 56ce2bb1916693..1807b284326b88 100644
--- a/drivers/char/tpm/tpm_tis.c
+++ b/drivers/char/tpm/tpm_tis.c
@@ -332,10 +332,8 @@ static int tpm_tis_plat_probe(struct platform_device *pdev)
 	}
 	tpm_info.res = *res;
 
-	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-	if (res) {
-		tpm_info.irq = res->start;
-	} else {
+	tpm_info.irq = platform_get_irq(pdev, 0);
+	if (tpm_info.irq <= 0) {
 		if (pdev != force_pdev)
 			tpm_info.irq = -1;
 		else
-- 
2.7.4


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 3/3] tpm_tis: Consolidate the platform and acpi probe flow
       [not found] ` <1493913205-18276-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
  2017-05-04 15:53   ` [PATCH v2 1/3] tpm_tis: Fix IRQ autoprobing when using platform_device Jason Gunthorpe
  2017-05-04 15:53   ` [PATCH v2 2/3] tpm_tis: Use platform_get_irq Jason Gunthorpe
@ 2017-05-04 15:53   ` Jason Gunthorpe
       [not found]     ` <1493913205-18276-4-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
  2017-05-05  6:45   ` [PATCH v2 0/3] Merge tpm_tis ACPI and platform drivers Jerry Snitselaar
  3 siblings, 1 reply; 18+ messages in thread
From: Jason Gunthorpe @ 2017-05-04 15:53 UTC (permalink / raw)
  To: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Jarkko Sakkinen

Now that the platform device was merged for OF support we can use the
platform device to match ACPI devices as well and run everything
through tpm_tis_init.

pnp_acpi_device is replaced with ACPI_COMPANION, and ACPI_HANDLE is
pushed further down.

platform_get_resource is used instead of acpi_dev_get_resources.

The itpm global module parameter is no longer changed during itpm
detection, instead the phy specific bit is set directly.

Tested-by: Jerry Snitselaar <jsnitsel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
 drivers/char/tpm/tpm_tis.c | 167 +++++++++++++++------------------------------
 1 file changed, 54 insertions(+), 113 deletions(-)

diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
index 1807b284326b88..54d90e31a7b690 100644
--- a/drivers/char/tpm/tpm_tis.c
+++ b/drivers/char/tpm/tpm_tis.c
@@ -80,6 +80,8 @@ static int has_hid(struct acpi_device *dev, const char *hid)
 
 static inline int is_itpm(struct acpi_device *dev)
 {
+	if (!dev)
+		return 0;
 	return has_hid(dev, "INTC0102");
 }
 #else
@@ -89,6 +91,47 @@ static inline int is_itpm(struct acpi_device *dev)
 }
 #endif
 
+#if defined(CONFIG_ACPI)
+#define DEVICE_IS_TPM2 1
+
+static const struct acpi_device_id tpm_acpi_tbl[] = {
+	{"MSFT0101", DEVICE_IS_TPM2},
+	{},
+};
+MODULE_DEVICE_TABLE(acpi, tpm_acpi_tbl);
+
+static int check_acpi_tpm2(struct device *dev)
+{
+	const struct acpi_device_id *aid = acpi_match_device(tpm_acpi_tbl, dev);
+	struct acpi_table_tpm2 *tbl;
+	acpi_status st;
+
+	if (!aid || aid->driver_data != DEVICE_IS_TPM2)
+		return 0;
+
+	/* If the ACPI TPM2 signature is matched then a global ACPI_SIG_TPM2
+	 * table is mandatory
+	 */
+	st =
+	    acpi_get_table(ACPI_SIG_TPM2, 1, (struct acpi_table_header **)&tbl);
+	if (ACPI_FAILURE(st) || tbl->header.length < sizeof(*tbl)) {
+		dev_err(dev, FW_BUG "failed to get TPM2 ACPI table\n");
+		return -EINVAL;
+	}
+
+	/* The tpm2_crb driver handles this device */
+	if (tbl->start_method != ACPI_TPM2_MEMORY_MAPPED)
+		return -ENODEV;
+
+	return 0;
+}
+#else
+static int check_acpi_tpm2(struct acpi_device *dev)
+{
+	return 0;
+}
+#endif
+
 static int tpm_tcg_read_bytes(struct tpm_tis_data *data, u32 addr, u16 len,
 			      u8 *result)
 {
@@ -141,11 +184,15 @@ static const struct tpm_tis_phy_ops tpm_tcg = {
 	.write32 = tpm_tcg_write32,
 };
 
-static int tpm_tis_init(struct device *dev, struct tpm_info *tpm_info,
-			acpi_handle acpi_dev_handle)
+static int tpm_tis_init(struct device *dev, struct tpm_info *tpm_info)
 {
 	struct tpm_tis_tcg_phy *phy;
 	int irq = -1;
+	int rc;
+
+	rc = check_acpi_tpm2(dev);
+	if (rc)
+		return rc;
 
 	phy = devm_kzalloc(dev, sizeof(struct tpm_tis_tcg_phy), GFP_KERNEL);
 	if (phy == NULL)
@@ -158,11 +205,11 @@ static int tpm_tis_init(struct device *dev, struct tpm_info *tpm_info,
 	if (interrupts)
 		irq = tpm_info->irq;
 
-	if (itpm)
+	if (itpm || is_itpm(ACPI_COMPANION(dev)))
 		phy->priv.flags |= TPM_TIS_ITPM_WORKAROUND;
 
 	return tpm_tis_core_init(dev, &phy->priv, irq, &tpm_tcg,
-				 acpi_dev_handle);
+				 ACPI_HANDLE(dev));
 }
 
 static SIMPLE_DEV_PM_OPS(tpm_tis_pm, tpm_pm_suspend, tpm_tis_resume);
@@ -171,7 +218,6 @@ static int tpm_tis_pnp_init(struct pnp_dev *pnp_dev,
 			    const struct pnp_device_id *pnp_id)
 {
 	struct tpm_info tpm_info = {};
-	acpi_handle acpi_dev_handle = NULL;
 	struct resource *res;
 
 	res = pnp_get_resource(pnp_dev, IORESOURCE_MEM, 0);
@@ -184,14 +230,7 @@ static int tpm_tis_pnp_init(struct pnp_dev *pnp_dev,
 	else
 		tpm_info.irq = -1;
 
-	if (pnp_acpi_device(pnp_dev)) {
-		if (is_itpm(pnp_acpi_device(pnp_dev)))
-			itpm = true;
-
-		acpi_dev_handle = ACPI_HANDLE(&pnp_dev->dev);
-	}
-
-	return tpm_tis_init(&pnp_dev->dev, &tpm_info, acpi_dev_handle);
+	return tpm_tis_init(&pnp_dev->dev, &tpm_info);
 }
 
 static struct pnp_device_id tpm_pnp_tbl[] = {
@@ -231,93 +270,6 @@ module_param_string(hid, tpm_pnp_tbl[TIS_HID_USR_IDX].id,
 		    sizeof(tpm_pnp_tbl[TIS_HID_USR_IDX].id), 0444);
 MODULE_PARM_DESC(hid, "Set additional specific HID for this driver to probe");
 
-#ifdef CONFIG_ACPI
-static int tpm_check_resource(struct acpi_resource *ares, void *data)
-{
-	struct tpm_info *tpm_info = (struct tpm_info *) data;
-	struct resource res;
-
-	if (acpi_dev_resource_interrupt(ares, 0, &res))
-		tpm_info->irq = res.start;
-	else if (acpi_dev_resource_memory(ares, &res)) {
-		tpm_info->res = res;
-		tpm_info->res.name = NULL;
-	}
-
-	return 1;
-}
-
-static int tpm_tis_acpi_init(struct acpi_device *acpi_dev)
-{
-	struct acpi_table_tpm2 *tbl;
-	acpi_status st;
-	struct list_head resources;
-	struct tpm_info tpm_info = {};
-	int ret;
-
-	st = acpi_get_table(ACPI_SIG_TPM2, 1,
-			    (struct acpi_table_header **) &tbl);
-	if (ACPI_FAILURE(st) || tbl->header.length < sizeof(*tbl)) {
-		dev_err(&acpi_dev->dev,
-			FW_BUG "failed to get TPM2 ACPI table\n");
-		return -EINVAL;
-	}
-
-	if (tbl->start_method != ACPI_TPM2_MEMORY_MAPPED)
-		return -ENODEV;
-
-	INIT_LIST_HEAD(&resources);
-	tpm_info.irq = -1;
-	ret = acpi_dev_get_resources(acpi_dev, &resources, tpm_check_resource,
-				     &tpm_info);
-	if (ret < 0)
-		return ret;
-
-	acpi_dev_free_resource_list(&resources);
-
-	if (resource_type(&tpm_info.res) != IORESOURCE_MEM) {
-		dev_err(&acpi_dev->dev,
-			FW_BUG "TPM2 ACPI table does not define a memory resource\n");
-		return -EINVAL;
-	}
-
-	if (is_itpm(acpi_dev))
-		itpm = true;
-
-	return tpm_tis_init(&acpi_dev->dev, &tpm_info, acpi_dev->handle);
-}
-
-static int tpm_tis_acpi_remove(struct acpi_device *dev)
-{
-	struct tpm_chip *chip = dev_get_drvdata(&dev->dev);
-
-	tpm_chip_unregister(chip);
-	tpm_tis_remove(chip);
-
-	return 0;
-}
-
-static struct acpi_device_id tpm_acpi_tbl[] = {
-	{"MSFT0101", 0},	/* TPM 2.0 */
-	/* Add new here */
-	{"", 0},		/* User Specified */
-	{"", 0}			/* Terminator */
-};
-MODULE_DEVICE_TABLE(acpi, tpm_acpi_tbl);
-
-static struct acpi_driver tis_acpi_driver = {
-	.name = "tpm_tis",
-	.ids = tpm_acpi_tbl,
-	.ops = {
-		.add = tpm_tis_acpi_init,
-		.remove = tpm_tis_acpi_remove,
-	},
-	.drv = {
-		.pm = &tpm_tis_pm,
-	},
-};
-#endif
-
 static struct platform_device *force_pdev;
 
 static int tpm_tis_plat_probe(struct platform_device *pdev)
@@ -341,7 +293,7 @@ static int tpm_tis_plat_probe(struct platform_device *pdev)
 			tpm_info.irq = 0;
 	}
 
-	return tpm_tis_init(&pdev->dev, &tpm_info, NULL);
+	return tpm_tis_init(&pdev->dev, &tpm_info);
 }
 
 static int tpm_tis_plat_remove(struct platform_device *pdev)
@@ -369,6 +321,7 @@ static struct platform_driver tis_drv = {
 		.name		= "tpm_tis",
 		.pm		= &tpm_tis_pm,
 		.of_match_table = of_match_ptr(tis_of_platform_match),
+		.acpi_match_table = ACPI_PTR(tpm_acpi_tbl),
 	},
 };
 
@@ -411,11 +364,6 @@ static int __init init_tis(void)
 	if (rc)
 		goto err_platform;
 
-#ifdef CONFIG_ACPI
-	rc = acpi_bus_register_driver(&tis_acpi_driver);
-	if (rc)
-		goto err_acpi;
-#endif
 
 	if (IS_ENABLED(CONFIG_PNP)) {
 		rc = pnp_register_driver(&tis_pnp_driver);
@@ -426,10 +374,6 @@ static int __init init_tis(void)
 	return 0;
 
 err_pnp:
-#ifdef CONFIG_ACPI
-	acpi_bus_unregister_driver(&tis_acpi_driver);
-err_acpi:
-#endif
 	platform_driver_unregister(&tis_drv);
 err_platform:
 	if (force_pdev)
@@ -441,9 +385,6 @@ static int __init init_tis(void)
 static void __exit cleanup_tis(void)
 {
 	pnp_unregister_driver(&tis_pnp_driver);
-#ifdef CONFIG_ACPI
-	acpi_bus_unregister_driver(&tis_acpi_driver);
-#endif
 	platform_driver_unregister(&tis_drv);
 
 	if (force_pdev)
-- 
2.7.4


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 0/3] Merge tpm_tis ACPI and platform drivers
       [not found] ` <1493913205-18276-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
                     ` (2 preceding siblings ...)
  2017-05-04 15:53   ` [PATCH v2 3/3] tpm_tis: Consolidate the platform and acpi probe flow Jason Gunthorpe
@ 2017-05-05  6:45   ` Jerry Snitselaar
  2017-05-08 23:52     ` Jarkko Sakkinen
  3 siblings, 1 reply; 18+ messages in thread
From: Jerry Snitselaar @ 2017-05-05  6:45 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Thu May 04 17, Jason Gunthorpe wrote:
>As suggested by Jarkko.
>
>The two precursor patches might want to go to -stable.
>
>Jerry says it worked on his system, but we still to see results from things
>like crb systems/etc.
>
>Jason Gunthorpe (3):
>  tpm_tis: Fix IRQ autoprobing when using platform_device
>  tpm_tis: Use platform_get_irq
>  tpm_tis: Consolidate the platform and acpi probe flow
>
> drivers/char/tpm/tpm_tis.c | 175 +++++++++++++++------------------------------
> 1 file changed, 57 insertions(+), 118 deletions(-)
>
>-- 
>2.7.4
>

I also tested on a crb device, and verified that check_acpi_tpm2 was detecting it.

Reviewed-by: Jerry Snitselaar <jsnitsel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 1/3] tpm_tis: Fix IRQ autoprobing when using platform_device
       [not found]     ` <1493913205-18276-2-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
@ 2017-05-08 23:45       ` Jarkko Sakkinen
       [not found]         ` <20170508234502.2fhj5edbcubdalb5-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 18+ messages in thread
From: Jarkko Sakkinen @ 2017-05-08 23:45 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Thu, May 04, 2017 at 09:53:23AM -0600, Jason Gunthorpe wrote:
> The test was backwards, triggering IRQ autoprobing if the firmware
> did not specify an IRQ, instead of triggering it only when the
> module force parameter was specified.
> 
> Since autoprobing is not enabled on !x86 and the platform device is
> currently only used on !x86, or with force, this has gone unnoticed.
> 
> Fixes: 00194826e6be ("tpm_tis: Clean up the force=1 module parameter")
> Tested-by: Jerry Snitselaar <jsnitsel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>

Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>

> ---
>  drivers/char/tpm/tpm_tis.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
> index c7e1384f1b0802..56ce2bb1916693 100644
> --- a/drivers/char/tpm/tpm_tis.c
> +++ b/drivers/char/tpm/tpm_tis.c
> @@ -336,7 +336,7 @@ static int tpm_tis_plat_probe(struct platform_device *pdev)
>  	if (res) {
>  		tpm_info.irq = res->start;
>  	} else {
> -		if (pdev == force_pdev)
> +		if (pdev != force_pdev)
>  			tpm_info.irq = -1;
>  		else
>  			/* When forcing auto probe the IRQ */
> -- 
> 2.7.4
> 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 2/3] tpm_tis: Use platform_get_irq
       [not found]     ` <1493913205-18276-3-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
@ 2017-05-08 23:45       ` Jarkko Sakkinen
       [not found]         ` <20170508234539.qnhf6p7fwxxcb5ul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
  2017-05-08 23:49       ` Jarkko Sakkinen
  1 sibling, 1 reply; 18+ messages in thread
From: Jarkko Sakkinen @ 2017-05-08 23:45 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Thu, May 04, 2017 at 09:53:24AM -0600, Jason Gunthorpe wrote:
> Replace the open coded IORESOURCE_IRQ with platform_get_irq, which
> supports more cases.
> 
> Fixes: 00194826e6be ("tpm_tis: Clean up the force=1 module parameter")
> Tested-by: Jerry Snitselaar <jsnitsel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>

Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>

/Jarkko

> ---
>  drivers/char/tpm/tpm_tis.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
> index 56ce2bb1916693..1807b284326b88 100644
> --- a/drivers/char/tpm/tpm_tis.c
> +++ b/drivers/char/tpm/tpm_tis.c
> @@ -332,10 +332,8 @@ static int tpm_tis_plat_probe(struct platform_device *pdev)
>  	}
>  	tpm_info.res = *res;
>  
> -	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
> -	if (res) {
> -		tpm_info.irq = res->start;
> -	} else {
> +	tpm_info.irq = platform_get_irq(pdev, 0);
> +	if (tpm_info.irq <= 0) {
>  		if (pdev != force_pdev)
>  			tpm_info.irq = -1;
>  		else
> -- 
> 2.7.4
> 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 2/3] tpm_tis: Use platform_get_irq
       [not found]     ` <1493913205-18276-3-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
  2017-05-08 23:45       ` Jarkko Sakkinen
@ 2017-05-08 23:49       ` Jarkko Sakkinen
  1 sibling, 0 replies; 18+ messages in thread
From: Jarkko Sakkinen @ 2017-05-08 23:49 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Thu, May 04, 2017 at 09:53:24AM -0600, Jason Gunthorpe wrote:
> Replace the open coded IORESOURCE_IRQ with platform_get_irq, which
> supports more cases.
> 
> Fixes: 00194826e6be ("tpm_tis: Clean up the force=1 module parameter")
> Tested-by: Jerry Snitselaar <jsnitsel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>

Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>

/Jarkko

> ---
>  drivers/char/tpm/tpm_tis.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
> index 56ce2bb1916693..1807b284326b88 100644
> --- a/drivers/char/tpm/tpm_tis.c
> +++ b/drivers/char/tpm/tpm_tis.c
> @@ -332,10 +332,8 @@ static int tpm_tis_plat_probe(struct platform_device *pdev)
>  	}
>  	tpm_info.res = *res;
>  
> -	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
> -	if (res) {
> -		tpm_info.irq = res->start;
> -	} else {
> +	tpm_info.irq = platform_get_irq(pdev, 0);
> +	if (tpm_info.irq <= 0) {
>  		if (pdev != force_pdev)
>  			tpm_info.irq = -1;
>  		else
> -- 
> 2.7.4
> 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 3/3] tpm_tis: Consolidate the platform and acpi probe flow
       [not found]     ` <1493913205-18276-4-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
@ 2017-05-08 23:50       ` Jarkko Sakkinen
       [not found]         ` <20170508235033.qcq6my5dvpyvwrwx-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 18+ messages in thread
From: Jarkko Sakkinen @ 2017-05-08 23:50 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Thu, May 04, 2017 at 09:53:25AM -0600, Jason Gunthorpe wrote:
> Now that the platform device was merged for OF support we can use the
> platform device to match ACPI devices as well and run everything
> through tpm_tis_init.
> 
> pnp_acpi_device is replaced with ACPI_COMPANION, and ACPI_HANDLE is
> pushed further down.
> 
> platform_get_resource is used instead of acpi_dev_get_resources.
> 
> The itpm global module parameter is no longer changed during itpm
> detection, instead the phy specific bit is set directly.
> 
> Tested-by: Jerry Snitselaar <jsnitsel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>

Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>

/Jarkko

> ---
>  drivers/char/tpm/tpm_tis.c | 167 +++++++++++++++------------------------------
>  1 file changed, 54 insertions(+), 113 deletions(-)
> 
> diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
> index 1807b284326b88..54d90e31a7b690 100644
> --- a/drivers/char/tpm/tpm_tis.c
> +++ b/drivers/char/tpm/tpm_tis.c
> @@ -80,6 +80,8 @@ static int has_hid(struct acpi_device *dev, const char *hid)
>  
>  static inline int is_itpm(struct acpi_device *dev)
>  {
> +	if (!dev)
> +		return 0;
>  	return has_hid(dev, "INTC0102");
>  }
>  #else
> @@ -89,6 +91,47 @@ static inline int is_itpm(struct acpi_device *dev)
>  }
>  #endif
>  
> +#if defined(CONFIG_ACPI)
> +#define DEVICE_IS_TPM2 1
> +
> +static const struct acpi_device_id tpm_acpi_tbl[] = {
> +	{"MSFT0101", DEVICE_IS_TPM2},
> +	{},
> +};
> +MODULE_DEVICE_TABLE(acpi, tpm_acpi_tbl);
> +
> +static int check_acpi_tpm2(struct device *dev)
> +{
> +	const struct acpi_device_id *aid = acpi_match_device(tpm_acpi_tbl, dev);
> +	struct acpi_table_tpm2 *tbl;
> +	acpi_status st;
> +
> +	if (!aid || aid->driver_data != DEVICE_IS_TPM2)
> +		return 0;
> +
> +	/* If the ACPI TPM2 signature is matched then a global ACPI_SIG_TPM2
> +	 * table is mandatory
> +	 */
> +	st =
> +	    acpi_get_table(ACPI_SIG_TPM2, 1, (struct acpi_table_header **)&tbl);
> +	if (ACPI_FAILURE(st) || tbl->header.length < sizeof(*tbl)) {
> +		dev_err(dev, FW_BUG "failed to get TPM2 ACPI table\n");
> +		return -EINVAL;
> +	}
> +
> +	/* The tpm2_crb driver handles this device */
> +	if (tbl->start_method != ACPI_TPM2_MEMORY_MAPPED)
> +		return -ENODEV;
> +
> +	return 0;
> +}
> +#else
> +static int check_acpi_tpm2(struct acpi_device *dev)
> +{
> +	return 0;
> +}
> +#endif
> +
>  static int tpm_tcg_read_bytes(struct tpm_tis_data *data, u32 addr, u16 len,
>  			      u8 *result)
>  {
> @@ -141,11 +184,15 @@ static const struct tpm_tis_phy_ops tpm_tcg = {
>  	.write32 = tpm_tcg_write32,
>  };
>  
> -static int tpm_tis_init(struct device *dev, struct tpm_info *tpm_info,
> -			acpi_handle acpi_dev_handle)
> +static int tpm_tis_init(struct device *dev, struct tpm_info *tpm_info)
>  {
>  	struct tpm_tis_tcg_phy *phy;
>  	int irq = -1;
> +	int rc;
> +
> +	rc = check_acpi_tpm2(dev);
> +	if (rc)
> +		return rc;
>  
>  	phy = devm_kzalloc(dev, sizeof(struct tpm_tis_tcg_phy), GFP_KERNEL);
>  	if (phy == NULL)
> @@ -158,11 +205,11 @@ static int tpm_tis_init(struct device *dev, struct tpm_info *tpm_info,
>  	if (interrupts)
>  		irq = tpm_info->irq;
>  
> -	if (itpm)
> +	if (itpm || is_itpm(ACPI_COMPANION(dev)))
>  		phy->priv.flags |= TPM_TIS_ITPM_WORKAROUND;
>  
>  	return tpm_tis_core_init(dev, &phy->priv, irq, &tpm_tcg,
> -				 acpi_dev_handle);
> +				 ACPI_HANDLE(dev));
>  }
>  
>  static SIMPLE_DEV_PM_OPS(tpm_tis_pm, tpm_pm_suspend, tpm_tis_resume);
> @@ -171,7 +218,6 @@ static int tpm_tis_pnp_init(struct pnp_dev *pnp_dev,
>  			    const struct pnp_device_id *pnp_id)
>  {
>  	struct tpm_info tpm_info = {};
> -	acpi_handle acpi_dev_handle = NULL;
>  	struct resource *res;
>  
>  	res = pnp_get_resource(pnp_dev, IORESOURCE_MEM, 0);
> @@ -184,14 +230,7 @@ static int tpm_tis_pnp_init(struct pnp_dev *pnp_dev,
>  	else
>  		tpm_info.irq = -1;
>  
> -	if (pnp_acpi_device(pnp_dev)) {
> -		if (is_itpm(pnp_acpi_device(pnp_dev)))
> -			itpm = true;
> -
> -		acpi_dev_handle = ACPI_HANDLE(&pnp_dev->dev);
> -	}
> -
> -	return tpm_tis_init(&pnp_dev->dev, &tpm_info, acpi_dev_handle);
> +	return tpm_tis_init(&pnp_dev->dev, &tpm_info);
>  }
>  
>  static struct pnp_device_id tpm_pnp_tbl[] = {
> @@ -231,93 +270,6 @@ module_param_string(hid, tpm_pnp_tbl[TIS_HID_USR_IDX].id,
>  		    sizeof(tpm_pnp_tbl[TIS_HID_USR_IDX].id), 0444);
>  MODULE_PARM_DESC(hid, "Set additional specific HID for this driver to probe");
>  
> -#ifdef CONFIG_ACPI
> -static int tpm_check_resource(struct acpi_resource *ares, void *data)
> -{
> -	struct tpm_info *tpm_info = (struct tpm_info *) data;
> -	struct resource res;
> -
> -	if (acpi_dev_resource_interrupt(ares, 0, &res))
> -		tpm_info->irq = res.start;
> -	else if (acpi_dev_resource_memory(ares, &res)) {
> -		tpm_info->res = res;
> -		tpm_info->res.name = NULL;
> -	}
> -
> -	return 1;
> -}
> -
> -static int tpm_tis_acpi_init(struct acpi_device *acpi_dev)
> -{
> -	struct acpi_table_tpm2 *tbl;
> -	acpi_status st;
> -	struct list_head resources;
> -	struct tpm_info tpm_info = {};
> -	int ret;
> -
> -	st = acpi_get_table(ACPI_SIG_TPM2, 1,
> -			    (struct acpi_table_header **) &tbl);
> -	if (ACPI_FAILURE(st) || tbl->header.length < sizeof(*tbl)) {
> -		dev_err(&acpi_dev->dev,
> -			FW_BUG "failed to get TPM2 ACPI table\n");
> -		return -EINVAL;
> -	}
> -
> -	if (tbl->start_method != ACPI_TPM2_MEMORY_MAPPED)
> -		return -ENODEV;
> -
> -	INIT_LIST_HEAD(&resources);
> -	tpm_info.irq = -1;
> -	ret = acpi_dev_get_resources(acpi_dev, &resources, tpm_check_resource,
> -				     &tpm_info);
> -	if (ret < 0)
> -		return ret;
> -
> -	acpi_dev_free_resource_list(&resources);
> -
> -	if (resource_type(&tpm_info.res) != IORESOURCE_MEM) {
> -		dev_err(&acpi_dev->dev,
> -			FW_BUG "TPM2 ACPI table does not define a memory resource\n");
> -		return -EINVAL;
> -	}
> -
> -	if (is_itpm(acpi_dev))
> -		itpm = true;
> -
> -	return tpm_tis_init(&acpi_dev->dev, &tpm_info, acpi_dev->handle);
> -}
> -
> -static int tpm_tis_acpi_remove(struct acpi_device *dev)
> -{
> -	struct tpm_chip *chip = dev_get_drvdata(&dev->dev);
> -
> -	tpm_chip_unregister(chip);
> -	tpm_tis_remove(chip);
> -
> -	return 0;
> -}
> -
> -static struct acpi_device_id tpm_acpi_tbl[] = {
> -	{"MSFT0101", 0},	/* TPM 2.0 */
> -	/* Add new here */
> -	{"", 0},		/* User Specified */
> -	{"", 0}			/* Terminator */
> -};
> -MODULE_DEVICE_TABLE(acpi, tpm_acpi_tbl);
> -
> -static struct acpi_driver tis_acpi_driver = {
> -	.name = "tpm_tis",
> -	.ids = tpm_acpi_tbl,
> -	.ops = {
> -		.add = tpm_tis_acpi_init,
> -		.remove = tpm_tis_acpi_remove,
> -	},
> -	.drv = {
> -		.pm = &tpm_tis_pm,
> -	},
> -};
> -#endif
> -
>  static struct platform_device *force_pdev;
>  
>  static int tpm_tis_plat_probe(struct platform_device *pdev)
> @@ -341,7 +293,7 @@ static int tpm_tis_plat_probe(struct platform_device *pdev)
>  			tpm_info.irq = 0;
>  	}
>  
> -	return tpm_tis_init(&pdev->dev, &tpm_info, NULL);
> +	return tpm_tis_init(&pdev->dev, &tpm_info);
>  }
>  
>  static int tpm_tis_plat_remove(struct platform_device *pdev)
> @@ -369,6 +321,7 @@ static struct platform_driver tis_drv = {
>  		.name		= "tpm_tis",
>  		.pm		= &tpm_tis_pm,
>  		.of_match_table = of_match_ptr(tis_of_platform_match),
> +		.acpi_match_table = ACPI_PTR(tpm_acpi_tbl),
>  	},
>  };
>  
> @@ -411,11 +364,6 @@ static int __init init_tis(void)
>  	if (rc)
>  		goto err_platform;
>  
> -#ifdef CONFIG_ACPI
> -	rc = acpi_bus_register_driver(&tis_acpi_driver);
> -	if (rc)
> -		goto err_acpi;
> -#endif
>  
>  	if (IS_ENABLED(CONFIG_PNP)) {
>  		rc = pnp_register_driver(&tis_pnp_driver);
> @@ -426,10 +374,6 @@ static int __init init_tis(void)
>  	return 0;
>  
>  err_pnp:
> -#ifdef CONFIG_ACPI
> -	acpi_bus_unregister_driver(&tis_acpi_driver);
> -err_acpi:
> -#endif
>  	platform_driver_unregister(&tis_drv);
>  err_platform:
>  	if (force_pdev)
> @@ -441,9 +385,6 @@ static int __init init_tis(void)
>  static void __exit cleanup_tis(void)
>  {
>  	pnp_unregister_driver(&tis_pnp_driver);
> -#ifdef CONFIG_ACPI
> -	acpi_bus_unregister_driver(&tis_acpi_driver);
> -#endif
>  	platform_driver_unregister(&tis_drv);
>  
>  	if (force_pdev)
> -- 
> 2.7.4
> 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 0/3] Merge tpm_tis ACPI and platform drivers
  2017-05-05  6:45   ` [PATCH v2 0/3] Merge tpm_tis ACPI and platform drivers Jerry Snitselaar
@ 2017-05-08 23:52     ` Jarkko Sakkinen
       [not found]       ` <20170508235219.2zczjmnujaenw2sv-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 18+ messages in thread
From: Jarkko Sakkinen @ 2017-05-08 23:52 UTC (permalink / raw)
  To: Jerry Snitselaar; +Cc: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Thu, May 04, 2017 at 11:45:20PM -0700, Jerry Snitselaar wrote:
> On Thu May 04 17, Jason Gunthorpe wrote:
> > As suggested by Jarkko.
> > 
> > The two precursor patches might want to go to -stable.
> > 
> > Jerry says it worked on his system, but we still to see results from things
> > like crb systems/etc.
> > 
> > Jason Gunthorpe (3):
> >  tpm_tis: Fix IRQ autoprobing when using platform_device
> >  tpm_tis: Use platform_get_irq
> >  tpm_tis: Consolidate the platform and acpi probe flow
> > 
> > drivers/char/tpm/tpm_tis.c | 175 +++++++++++++++------------------------------
> > 1 file changed, 57 insertions(+), 118 deletions(-)
> > 
> > -- 
> > 2.7.4
> > 
> 
> I also tested on a crb device, and verified that check_acpi_tpm2 was detecting it.
> 
> Reviewed-by: Jerry Snitselaar <jsnitsel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

You tested with TPM2 chips only, right? If this is the case, I'll test
with TPM 1.2.

/Jarkko

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 0/3] Merge tpm_tis ACPI and platform drivers
       [not found]       ` <20170508235219.2zczjmnujaenw2sv-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
@ 2017-05-09  0:27         ` Jerry Snitselaar
  2017-05-09 14:07           ` Jarkko Sakkinen
  0 siblings, 1 reply; 18+ messages in thread
From: Jerry Snitselaar @ 2017-05-09  0:27 UTC (permalink / raw)
  To: Jarkko Sakkinen; +Cc: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Tue May 09 17, Jarkko Sakkinen wrote:
>On Thu, May 04, 2017 at 11:45:20PM -0700, Jerry Snitselaar wrote:
>> On Thu May 04 17, Jason Gunthorpe wrote:
>> > As suggested by Jarkko.
>> >
>> > The two precursor patches might want to go to -stable.
>> >
>> > Jerry says it worked on his system, but we still to see results from things
>> > like crb systems/etc.
>> >
>> > Jason Gunthorpe (3):
>> >  tpm_tis: Fix IRQ autoprobing when using platform_device
>> >  tpm_tis: Use platform_get_irq
>> >  tpm_tis: Consolidate the platform and acpi probe flow
>> >
>> > drivers/char/tpm/tpm_tis.c | 175 +++++++++++++++------------------------------
>> > 1 file changed, 57 insertions(+), 118 deletions(-)
>> >
>> > --
>> > 2.7.4
>> >
>>
>> I also tested on a crb device, and verified that check_acpi_tpm2 was detecting it.
>>
>> Reviewed-by: Jerry Snitselaar <jsnitsel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
>
>You tested with TPM2 chips only, right? If this is the case, I'll test
>with TPM 1.2.
>
>/Jarkko

Yes, I've only tested TPM2 devices so far.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 1/3] tpm_tis: Fix IRQ autoprobing when using platform_device
       [not found]         ` <20170508234502.2fhj5edbcubdalb5-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
@ 2017-05-09 14:03           ` Jarkko Sakkinen
       [not found]             ` <20170509140301.bqh3hgpjccdcbj5p-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 18+ messages in thread
From: Jarkko Sakkinen @ 2017-05-09 14:03 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Tue, May 09, 2017 at 02:45:02AM +0300, Jarkko Sakkinen wrote:
> On Thu, May 04, 2017 at 09:53:23AM -0600, Jason Gunthorpe wrote:
> > The test was backwards, triggering IRQ autoprobing if the firmware
> > did not specify an IRQ, instead of triggering it only when the
> > module force parameter was specified.
> > 
> > Since autoprobing is not enabled on !x86 and the platform device is
> > currently only used on !x86, or with force, this has gone unnoticed.
> > 
> > Fixes: 00194826e6be ("tpm_tis: Clean up the force=1 module parameter")
> > Tested-by: Jerry Snitselaar <jsnitsel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> > Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
> 
> Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>

Tested-by: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>

/Jarkko

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 2/3] tpm_tis: Use platform_get_irq
       [not found]         ` <20170508234539.qnhf6p7fwxxcb5ul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
@ 2017-05-09 14:03           ` Jarkko Sakkinen
       [not found]             ` <20170509140345.tqesdnggeb3s67be-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 18+ messages in thread
From: Jarkko Sakkinen @ 2017-05-09 14:03 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Tue, May 09, 2017 at 02:45:39AM +0300, Jarkko Sakkinen wrote:
> On Thu, May 04, 2017 at 09:53:24AM -0600, Jason Gunthorpe wrote:
> > Replace the open coded IORESOURCE_IRQ with platform_get_irq, which
> > supports more cases.
> > 
> > Fixes: 00194826e6be ("tpm_tis: Clean up the force=1 module parameter")
> > Tested-by: Jerry Snitselaar <jsnitsel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> > Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
> 
> Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>

Tested-by: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>

/Jarkko

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 3/3] tpm_tis: Consolidate the platform and acpi probe flow
       [not found]         ` <20170508235033.qcq6my5dvpyvwrwx-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
@ 2017-05-09 14:04           ` Jarkko Sakkinen
       [not found]             ` <20170509140425.zr5hrxpjiytp6hpd-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 18+ messages in thread
From: Jarkko Sakkinen @ 2017-05-09 14:04 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Tue, May 09, 2017 at 02:50:33AM +0300, Jarkko Sakkinen wrote:
> On Thu, May 04, 2017 at 09:53:25AM -0600, Jason Gunthorpe wrote:
> > Now that the platform device was merged for OF support we can use the
> > platform device to match ACPI devices as well and run everything
> > through tpm_tis_init.
> > 
> > pnp_acpi_device is replaced with ACPI_COMPANION, and ACPI_HANDLE is
> > pushed further down.
> > 
> > platform_get_resource is used instead of acpi_dev_get_resources.
> > 
> > The itpm global module parameter is no longer changed during itpm
> > detection, instead the phy specific bit is set directly.
> > 
> > Tested-by: Jerry Snitselaar <jsnitsel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> > Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
> 
> Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>

Tested-by: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>

/Jarkko

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 0/3] Merge tpm_tis ACPI and platform drivers
  2017-05-09  0:27         ` Jerry Snitselaar
@ 2017-05-09 14:07           ` Jarkko Sakkinen
  0 siblings, 0 replies; 18+ messages in thread
From: Jarkko Sakkinen @ 2017-05-09 14:07 UTC (permalink / raw)
  To: Jerry Snitselaar; +Cc: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Mon, May 08, 2017 at 05:27:51PM -0700, Jerry Snitselaar wrote:
> On Tue May 09 17, Jarkko Sakkinen wrote:
> > On Thu, May 04, 2017 at 11:45:20PM -0700, Jerry Snitselaar wrote:
> > > On Thu May 04 17, Jason Gunthorpe wrote:
> > > > As suggested by Jarkko.
> > > >
> > > > The two precursor patches might want to go to -stable.
> > > >
> > > > Jerry says it worked on his system, but we still to see results from things
> > > > like crb systems/etc.
> > > >
> > > > Jason Gunthorpe (3):
> > > >  tpm_tis: Fix IRQ autoprobing when using platform_device
> > > >  tpm_tis: Use platform_get_irq
> > > >  tpm_tis: Consolidate the platform and acpi probe flow
> > > >
> > > > drivers/char/tpm/tpm_tis.c | 175 +++++++++++++++------------------------------
> > > > 1 file changed, 57 insertions(+), 118 deletions(-)
> > > >
> > > > --
> > > > 2.7.4
> > > >
> > > 
> > > I also tested on a crb device, and verified that check_acpi_tpm2 was detecting it.
> > > 
> > > Reviewed-by: Jerry Snitselaar <jsnitsel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> > 
> > You tested with TPM2 chips only, right? If this is the case, I'll test
> > with TPM 1.2.
> > 
> > /Jarkko
> 
> Yes, I've only tested TPM2 devices so far.

Great, I tested with TPM 1.2 today. I'm ready to apply these patches.

/Jarkko

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 1/3] tpm_tis: Fix IRQ autoprobing when using platform_device
       [not found]             ` <20170509140301.bqh3hgpjccdcbj5p-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
@ 2017-05-09 14:21               ` Jarkko Sakkinen
  0 siblings, 0 replies; 18+ messages in thread
From: Jarkko Sakkinen @ 2017-05-09 14:21 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Tue, May 09, 2017 at 05:03:01PM +0300, Jarkko Sakkinen wrote:
> On Tue, May 09, 2017 at 02:45:02AM +0300, Jarkko Sakkinen wrote:
> > On Thu, May 04, 2017 at 09:53:23AM -0600, Jason Gunthorpe wrote:
> > > The test was backwards, triggering IRQ autoprobing if the firmware
> > > did not specify an IRQ, instead of triggering it only when the
> > > module force parameter was specified.
> > > 
> > > Since autoprobing is not enabled on !x86 and the platform device is
> > > currently only used on !x86, or with force, this has gone unnoticed.
> > > 
> > > Fixes: 00194826e6be ("tpm_tis: Clean up the force=1 module parameter")
> > > Tested-by: Jerry Snitselaar <jsnitsel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> > > Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
> > 
> > Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> 
> Tested-by: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>

Applied.

/Jarkko

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 2/3] tpm_tis: Use platform_get_irq
       [not found]             ` <20170509140345.tqesdnggeb3s67be-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
@ 2017-05-09 14:21               ` Jarkko Sakkinen
  0 siblings, 0 replies; 18+ messages in thread
From: Jarkko Sakkinen @ 2017-05-09 14:21 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Tue, May 09, 2017 at 05:03:45PM +0300, Jarkko Sakkinen wrote:
> On Tue, May 09, 2017 at 02:45:39AM +0300, Jarkko Sakkinen wrote:
> > On Thu, May 04, 2017 at 09:53:24AM -0600, Jason Gunthorpe wrote:
> > > Replace the open coded IORESOURCE_IRQ with platform_get_irq, which
> > > supports more cases.
> > > 
> > > Fixes: 00194826e6be ("tpm_tis: Clean up the force=1 module parameter")
> > > Tested-by: Jerry Snitselaar <jsnitsel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> > > Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
> > 
> > Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> 
> Tested-by: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>

Applied.

/Jarkko

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 3/3] tpm_tis: Consolidate the platform and acpi probe flow
       [not found]             ` <20170509140425.zr5hrxpjiytp6hpd-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
@ 2017-05-09 14:22               ` Jarkko Sakkinen
  0 siblings, 0 replies; 18+ messages in thread
From: Jarkko Sakkinen @ 2017-05-09 14:22 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Tue, May 09, 2017 at 05:04:25PM +0300, Jarkko Sakkinen wrote:
> On Tue, May 09, 2017 at 02:50:33AM +0300, Jarkko Sakkinen wrote:
> > On Thu, May 04, 2017 at 09:53:25AM -0600, Jason Gunthorpe wrote:
> > > Now that the platform device was merged for OF support we can use the
> > > platform device to match ACPI devices as well and run everything
> > > through tpm_tis_init.
> > > 
> > > pnp_acpi_device is replaced with ACPI_COMPANION, and ACPI_HANDLE is
> > > pushed further down.
> > > 
> > > platform_get_resource is used instead of acpi_dev_get_resources.
> > > 
> > > The itpm global module parameter is no longer changed during itpm
> > > detection, instead the phy specific bit is set directly.
> > > 
> > > Tested-by: Jerry Snitselaar <jsnitsel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> > > Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
> > 
> > Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> 
> Tested-by: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>

Applied.

/Jarkko

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2017-05-09 14:22 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-04 15:53 [PATCH v2 0/3] Merge tpm_tis ACPI and platform drivers Jason Gunthorpe
     [not found] ` <1493913205-18276-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-05-04 15:53   ` [PATCH v2 1/3] tpm_tis: Fix IRQ autoprobing when using platform_device Jason Gunthorpe
     [not found]     ` <1493913205-18276-2-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-05-08 23:45       ` Jarkko Sakkinen
     [not found]         ` <20170508234502.2fhj5edbcubdalb5-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-05-09 14:03           ` Jarkko Sakkinen
     [not found]             ` <20170509140301.bqh3hgpjccdcbj5p-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-05-09 14:21               ` Jarkko Sakkinen
2017-05-04 15:53   ` [PATCH v2 2/3] tpm_tis: Use platform_get_irq Jason Gunthorpe
     [not found]     ` <1493913205-18276-3-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-05-08 23:45       ` Jarkko Sakkinen
     [not found]         ` <20170508234539.qnhf6p7fwxxcb5ul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-05-09 14:03           ` Jarkko Sakkinen
     [not found]             ` <20170509140345.tqesdnggeb3s67be-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-05-09 14:21               ` Jarkko Sakkinen
2017-05-08 23:49       ` Jarkko Sakkinen
2017-05-04 15:53   ` [PATCH v2 3/3] tpm_tis: Consolidate the platform and acpi probe flow Jason Gunthorpe
     [not found]     ` <1493913205-18276-4-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-05-08 23:50       ` Jarkko Sakkinen
     [not found]         ` <20170508235033.qcq6my5dvpyvwrwx-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-05-09 14:04           ` Jarkko Sakkinen
     [not found]             ` <20170509140425.zr5hrxpjiytp6hpd-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-05-09 14:22               ` Jarkko Sakkinen
2017-05-05  6:45   ` [PATCH v2 0/3] Merge tpm_tis ACPI and platform drivers Jerry Snitselaar
2017-05-08 23:52     ` Jarkko Sakkinen
     [not found]       ` <20170508235219.2zczjmnujaenw2sv-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-05-09  0:27         ` Jerry Snitselaar
2017-05-09 14:07           ` Jarkko Sakkinen

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).