diff mbox

[tpmdd-devel,7/7] tpm_tis: Tighten IRQ auto-probing

Message ID 1448485536-7282-8-git-send-email-jgunthorpe@obsidianresearch.com
State New
Headers show

Commit Message

Jason Gunthorpe Nov. 25, 2015, 9:05 p.m. UTC
auto-probing doesn't work with shared interrupts, and the auto detection
interrupt range is for x86 only.

Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
---
 drivers/char/tpm/tpm_tis.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

Comments

Jarkko Sakkinen Nov. 30, 2015, 4:27 p.m. UTC | #1
On Wed, Nov 25, 2015 at 02:05:36PM -0700, Jason Gunthorpe wrote:
> auto-probing doesn't work with shared interrupts, and the auto detection
> interrupt range is for x86 only.

Please combine this to your patch that introduces this new probe
function.

/Jarkko

> 
> Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
> ---
>  drivers/char/tpm/tpm_tis.c | 19 ++++++++++++-------
>  1 file changed, 12 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
> index c29ae69f1df6..8a3509cb10da 100644
> --- a/drivers/char/tpm/tpm_tis.c
> +++ b/drivers/char/tpm/tpm_tis.c
> @@ -603,12 +603,13 @@ static irqreturn_t tis_int_handler(int dummy, void *dev_id)
>   * irq is seen then leave the chip setup for IRQ operation, otherwise reverse
>   * everything and leave in polling mode. Returns 0 on success.
>   */
> -static int tpm_tis_probe_irq_single(struct tpm_chip *chip, u32 intmask, int irq)
> +static int tpm_tis_probe_irq_single(struct tpm_chip *chip, u32 intmask,
> +				    int flags, int irq)
>  {
>  	struct priv_data *priv = chip->vendor.priv;
>  	u8 original_int_vec;
>  
> -	if (devm_request_irq(chip->pdev, irq, tis_int_handler, IRQF_SHARED,
> +	if (devm_request_irq(chip->pdev, irq, tis_int_handler, flags,
>  			     chip->devname, chip) != 0) {
>  		dev_info(chip->pdev, "Unable to request irq: %d for probe\n",
>  			 irq);
> @@ -666,10 +667,13 @@ static void tpm_tis_probe_irq(struct tpm_chip *chip, u32 intmask)
>  				   TPM_INT_VECTOR(chip->vendor.locality));
>  
>  	if (!original_int_vec) {
> -		for (i = 3; i <= 15; i++)
> -			if (!tpm_tis_probe_irq_single(chip, intmask, i))
> -				return;
> -	} else if (!tpm_tis_probe_irq_single(chip, intmask, original_int_vec))
> +		if (IS_ENABLED(CONFIG_X86))
> +			for (i = 3; i <= 15; i++)
> +				if (!tpm_tis_probe_irq_single(chip, intmask, 0,
> +							      i))
> +					return;
> +	} else if (!tpm_tis_probe_irq_single(chip, intmask, 0,
> +					     original_int_vec))
>  		return;
>  }
>  
> @@ -805,7 +809,8 @@ static int tpm_tis_init(struct device *dev, struct tpm_info *tpm_info,
>  	init_waitqueue_head(&chip->vendor.int_queue);
>  	if (interrupts) {
>  		if (tpm_info->irq) {
> -			tpm_tis_probe_irq_single(chip, intmask, tpm_info->irq);
> +			tpm_tis_probe_irq_single(chip, intmask, IRQF_SHARED,
> +						 tpm_info->irq);
>  			if (!chip->vendor.irq)
>  				dev_err(chip->pdev, FW_BUG
>  					"TPM interrupt not working, polling instead\n");
> -- 
> 2.1.4
> 

------------------------------------------------------------------------------
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 Nov. 30, 2015, 5:29 p.m. UTC | #2
On Mon, Nov 30, 2015 at 06:27:28PM +0200, Jarkko Sakkinen wrote:
> On Wed, Nov 25, 2015 at 02:05:36PM -0700, Jason Gunthorpe wrote:
> > auto-probing doesn't work with shared interrupts, and the auto detection
> > interrupt range is for x86 only.
> 
> Please combine this to your patch that introduces this new probe
> function.

No, the prior patch is code-motion, it doesn't actually change
any semantics. This is a semantic change, it stays seperate to aide
possible future bisection analysis.

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
diff mbox

Patch

diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
index c29ae69f1df6..8a3509cb10da 100644
--- a/drivers/char/tpm/tpm_tis.c
+++ b/drivers/char/tpm/tpm_tis.c
@@ -603,12 +603,13 @@  static irqreturn_t tis_int_handler(int dummy, void *dev_id)
  * irq is seen then leave the chip setup for IRQ operation, otherwise reverse
  * everything and leave in polling mode. Returns 0 on success.
  */
-static int tpm_tis_probe_irq_single(struct tpm_chip *chip, u32 intmask, int irq)
+static int tpm_tis_probe_irq_single(struct tpm_chip *chip, u32 intmask,
+				    int flags, int irq)
 {
 	struct priv_data *priv = chip->vendor.priv;
 	u8 original_int_vec;
 
-	if (devm_request_irq(chip->pdev, irq, tis_int_handler, IRQF_SHARED,
+	if (devm_request_irq(chip->pdev, irq, tis_int_handler, flags,
 			     chip->devname, chip) != 0) {
 		dev_info(chip->pdev, "Unable to request irq: %d for probe\n",
 			 irq);
@@ -666,10 +667,13 @@  static void tpm_tis_probe_irq(struct tpm_chip *chip, u32 intmask)
 				   TPM_INT_VECTOR(chip->vendor.locality));
 
 	if (!original_int_vec) {
-		for (i = 3; i <= 15; i++)
-			if (!tpm_tis_probe_irq_single(chip, intmask, i))
-				return;
-	} else if (!tpm_tis_probe_irq_single(chip, intmask, original_int_vec))
+		if (IS_ENABLED(CONFIG_X86))
+			for (i = 3; i <= 15; i++)
+				if (!tpm_tis_probe_irq_single(chip, intmask, 0,
+							      i))
+					return;
+	} else if (!tpm_tis_probe_irq_single(chip, intmask, 0,
+					     original_int_vec))
 		return;
 }
 
@@ -805,7 +809,8 @@  static int tpm_tis_init(struct device *dev, struct tpm_info *tpm_info,
 	init_waitqueue_head(&chip->vendor.int_queue);
 	if (interrupts) {
 		if (tpm_info->irq) {
-			tpm_tis_probe_irq_single(chip, intmask, tpm_info->irq);
+			tpm_tis_probe_irq_single(chip, intmask, IRQF_SHARED,
+						 tpm_info->irq);
 			if (!chip->vendor.irq)
 				dev_err(chip->pdev, FW_BUG
 					"TPM interrupt not working, polling instead\n");