[tpmdd-devel,v2,0/3] tpm_tis: Clean up force module parameter
diff mbox

Message ID C5A28EF7B98F574C85C70238C8E9ECC04E682BF171@ABGEX74E.FSC.NET
State New
Headers show

Commit Message

Martin Wilck Dec. 4, 2015, 9:10 a.m. UTC
> > ACPI defines a mem resource corresponding to the standard TIS memory
> > area on my system, and it used to be detected fine with Jarkko's patch.
> > Somehow your latest changes broke it, not sure why.
> 
> Are you certain? Based on what you sent me, that output is only
> possible if there is no mem resource.
> 
> With the prior arrangement no mem resource means the x86 default
> address is used, which is the only way I can see how your system
> works.

The following simple change fixes the ACPI probing after applying your
latest series. The must have been another ACPI resource that you were
erroneously using as mem resource. 

The IS_ERR change() didn't fix it. I think it's not needed, although it
probably can't hurt.


------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140

Comments

Jason Gunthorpe Dec. 4, 2015, 6:09 p.m. UTC | #1
On Fri, Dec 04, 2015 at 10:10:15AM +0100, Wilck, Martin wrote:

> The following simple change fixes the ACPI probing after applying your
> latest series. The must have been another ACPI resource that you were
> erroneously using as mem resource. 

Close, acpi_dev_resource_memory destroys it's output parameter when it
fails :(

Should be:

	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;

> The IS_ERR change() didn't fix it. I think it's not needed, although it
> probably can't hurt.

IS_ERR should address the oops though??

I've put all the revised patches here:

https://github.com/jgunthorpe/linux/commits/for-jarkko

If you are OK with them now I'll post the series.

Jason

------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140
Martin Wilck Dec. 7, 2015, 9:59 a.m. UTC | #2
> IS_ERR should address the oops though??

No, see my answer to Jarkko in the other part of the thread.

> I've put all the revised patches here:
> 
> https://github.com/jgunthorpe/linux/commits/for-jarkko
> 
> If you are OK with them now I'll post the series.

I haven't re-reviewed it, but the test went alright. 

As reported before, with "force=1", I get the error message:

[ 1351.677808] tpm_tis MSFT0101:00: can't request region for resource
[mem 0xfed40000-0xfed44fff]
[ 1351.687431] tpm_tis: probe of MSFT0101:00 failed with error -16

This is kind of misleading because the TPM is actually working as a
platform device. But I can follow your previous argument that this is
acceptable because people who use "force=1" should know what they are
doing, so I don't regard this as critical.

Martin

------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140
Jason Gunthorpe Dec. 7, 2015, 5:35 p.m. UTC | #3
On Mon, Dec 07, 2015 at 10:59:15AM +0100, Wilck, Martin wrote:
> > IS_ERR should address the oops though??
> 
> No, see my answer to Jarkko in the other part of the thread.

I'm confused, is there an oops that still need to be fixed?

> As reported before, with "force=1", I get the error message:
> 
> [ 1351.677808] tpm_tis MSFT0101:00: can't request region for resource
> [mem 0xfed40000-0xfed44fff]
> [ 1351.687431] tpm_tis: probe of MSFT0101:00 failed with error -16

Great, that you so much, that is what I expected to see!

> This is kind of misleading because the TPM is actually working as a
> platform device. But I can follow your previous argument that this is
> acceptable because people who use "force=1" should know what they are
> doing, so I don't regard this as critical.

Right.

Jason

------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140

Patch
diff mbox

diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
index a1898c8..4c65a7d 100644
--- a/drivers/char/tpm/tpm_tis.c
+++ b/drivers/char/tpm/tpm_tis.c
@@ -954,7 +954,8 @@  static int tpm_check_resource(struct acpi_resource *ares, void *data)
 
 	if (acpi_dev_resource_interrupt(ares, 0, &res))
 		tpm_info->irq = res.start;
-	acpi_dev_resource_memory(ares, &tpm_info->res);
+	else if (acpi_dev_resource_memory(ares, &res))
+		memcpy(&tpm_info->res, &res, sizeof(res));
 
 	return 1;
 }