Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1246023 > unrolled thread

[PATCH] genirq/msi: Do not use pci_msi_[un]mask_irq as default methods

Started byMarc Zyngier <marc.zyngier@arm.com>
First post2015-10-13 20:20 +0200
Last post2015-10-16 14:20 +0200
Articles 5 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] genirq/msi: Do not use pci_msi_[un]mask_irq as default methods Marc Zyngier <marc.zyngier@arm.com> - 2015-10-13 20:20 +0200
    Re: [PATCH] genirq/msi: Do not use pci_msi_[un]mask_irq as default  methods Jiang Liu <jiang.liu@linux.intel.com> - 2015-10-14 04:30 +0200
    Re: [PATCH] genirq/msi: Do not use pci_msi_[un]mask_irq as default  methods Thomas Gleixner <tglx@linutronix.de> - 2015-10-15 10:50 +0200
      Re: [PATCH] genirq/msi: Do not use pci_msi_[un]mask_irq as default  methods Thomas Gleixner <tglx@linutronix.de> - 2015-10-16 12:00 +0200
    [tip:irq/urgent] genirq/msi: Do not use pci_msi_[un]  mask_irq as default methods tip-bot for Marc Zyngier <tipbot@zytor.com> - 2015-10-16 14:20 +0200

#1246023 — [PATCH] genirq/msi: Do not use pci_msi_[un]mask_irq as default methods

FromMarc Zyngier <marc.zyngier@arm.com>
Date2015-10-13 20:20 +0200
Subject[PATCH] genirq/msi: Do not use pci_msi_[un]mask_irq as default methods
Message-ID<qjcl4-642-19@gated-at.bofh.it>
When we create a generic MSI domain, that MSI_FLAG_USE_DEF_CHIP_OPS
is set, and that any of .mask or .unmask are NULL in the irq_chip
structure, we set them to pci_msi_[un]mask_irq.

This is a bad idea for at least two reasons:
- PCI_MSI might not be selected, kernel fails to build (yes, this is
  legitimate, at least on arm64!)
- This may not be a PCI/MSI domain at all (platform MSI, for example)

Either way, this looks wrong. Move the overriding of mask/unmask to
the PCI counterpart, and panic is any of these two methods is not
set in the core code (they really should be present).

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 drivers/pci/msi.c | 4 ++++
 kernel/irq/msi.c  | 6 +-----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index d449714..4a7da3c 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -1243,6 +1243,10 @@ static void pci_msi_domain_update_chip_ops(struct msi_domain_info *info)
 	BUG_ON(!chip);
 	if (!chip->irq_write_msi_msg)
 		chip->irq_write_msi_msg = pci_msi_domain_write_msg;
+	if (!chip->irq_mask)
+		chip->irq_mask = pci_msi_mask_irq;
+	if (!chip->irq_unmask)
+		chip->irq_unmask = pci_msi_unmask_irq;
 }
 
 /**
diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c
index 7e6512b..be9149f 100644
--- a/kernel/irq/msi.c
+++ b/kernel/irq/msi.c
@@ -228,11 +228,7 @@ static void msi_domain_update_chip_ops(struct msi_domain_info *info)
 {
 	struct irq_chip *chip = info->chip;
 
-	BUG_ON(!chip);
-	if (!chip->irq_mask)
-		chip->irq_mask = pci_msi_mask_irq;
-	if (!chip->irq_unmask)
-		chip->irq_unmask = pci_msi_unmask_irq;
+	BUG_ON(!chip || !chip->irq_mask || !chip->irq_unmask);
 	if (!chip->irq_set_affinity)
 		chip->irq_set_affinity = msi_domain_set_affinity;
 }
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1246259 — Re: [PATCH] genirq/msi: Do not use pci_msi_[un]mask_irq as default methods

FromJiang Liu <jiang.liu@linux.intel.com>
Date2015-10-14 04:30 +0200
SubjectRe: [PATCH] genirq/msi: Do not use pci_msi_[un]mask_irq as default methods
Message-ID<qjjZg-1gq-7@gated-at.bofh.it>
In reply to#1246023
On 2015/10/14 2:14, Marc Zyngier wrote:
> When we create a generic MSI domain, that MSI_FLAG_USE_DEF_CHIP_OPS
> is set, and that any of .mask or .unmask are NULL in the irq_chip
> structure, we set them to pci_msi_[un]mask_irq.
> 
> This is a bad idea for at least two reasons:
> - PCI_MSI might not be selected, kernel fails to build (yes, this is
>   legitimate, at least on arm64!)
> - This may not be a PCI/MSI domain at all (platform MSI, for example)
> 
> Either way, this looks wrong. Move the overriding of mask/unmask to
> the PCI counterpart, and panic is any of these two methods is not
> set in the core code (they really should be present).
Hi Marc,
	Thanks for fixing this,
Reviewed-by: Jiang Liu <jiang.liu@linux.intel.com>
Thanks,
Gerry


> 
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
> ---
>  drivers/pci/msi.c | 4 ++++
>  kernel/irq/msi.c  | 6 +-----
>  2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
> index d449714..4a7da3c 100644
> --- a/drivers/pci/msi.c
> +++ b/drivers/pci/msi.c
> @@ -1243,6 +1243,10 @@ static void pci_msi_domain_update_chip_ops(struct msi_domain_info *info)
>  	BUG_ON(!chip);
>  	if (!chip->irq_write_msi_msg)
>  		chip->irq_write_msi_msg = pci_msi_domain_write_msg;
> +	if (!chip->irq_mask)
> +		chip->irq_mask = pci_msi_mask_irq;
> +	if (!chip->irq_unmask)
> +		chip->irq_unmask = pci_msi_unmask_irq;
>  }
>  
>  /**
> diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c
> index 7e6512b..be9149f 100644
> --- a/kernel/irq/msi.c
> +++ b/kernel/irq/msi.c
> @@ -228,11 +228,7 @@ static void msi_domain_update_chip_ops(struct msi_domain_info *info)
>  {
>  	struct irq_chip *chip = info->chip;
>  
> -	BUG_ON(!chip);
> -	if (!chip->irq_mask)
> -		chip->irq_mask = pci_msi_mask_irq;
> -	if (!chip->irq_unmask)
> -		chip->irq_unmask = pci_msi_unmask_irq;
> +	BUG_ON(!chip || !chip->irq_mask || !chip->irq_unmask);
>  	if (!chip->irq_set_affinity)
>  		chip->irq_set_affinity = msi_domain_set_affinity;
>  }
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1247580 — Re: [PATCH] genirq/msi: Do not use pci_msi_[un]mask_irq as default methods

FromThomas Gleixner <tglx@linutronix.de>
Date2015-10-15 10:50 +0200
SubjectRe: [PATCH] genirq/msi: Do not use pci_msi_[un]mask_irq as default methods
Message-ID<qjMoy-1d8-27@gated-at.bofh.it>
In reply to#1246023
On Tue, 13 Oct 2015, Marc Zyngier wrote:

> When we create a generic MSI domain, that MSI_FLAG_USE_DEF_CHIP_OPS
> is set, and that any of .mask or .unmask are NULL in the irq_chip
> structure, we set them to pci_msi_[un]mask_irq.
> 
> This is a bad idea for at least two reasons:
> - PCI_MSI might not be selected, kernel fails to build (yes, this is
>   legitimate, at least on arm64!)
> - This may not be a PCI/MSI domain at all (platform MSI, for example)
> 
> Either way, this looks wrong. Move the overriding of mask/unmask to
> the PCI counterpart, and panic is any of these two methods is not
> set in the core code (they really should be present).
> 
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>

Reviewed-by: Thomas Gleixner <tglx@linutronix.de>

> ---
>  drivers/pci/msi.c | 4 ++++
>  kernel/irq/msi.c  | 6 +-----
>  2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
> index d449714..4a7da3c 100644
> --- a/drivers/pci/msi.c
> +++ b/drivers/pci/msi.c
> @@ -1243,6 +1243,10 @@ static void pci_msi_domain_update_chip_ops(struct msi_domain_info *info)
>  	BUG_ON(!chip);
>  	if (!chip->irq_write_msi_msg)
>  		chip->irq_write_msi_msg = pci_msi_domain_write_msg;
> +	if (!chip->irq_mask)
> +		chip->irq_mask = pci_msi_mask_irq;
> +	if (!chip->irq_unmask)
> +		chip->irq_unmask = pci_msi_unmask_irq;
>  }
>  
>  /**
> diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c
> index 7e6512b..be9149f 100644
> --- a/kernel/irq/msi.c
> +++ b/kernel/irq/msi.c
> @@ -228,11 +228,7 @@ static void msi_domain_update_chip_ops(struct msi_domain_info *info)
>  {
>  	struct irq_chip *chip = info->chip;
>  
> -	BUG_ON(!chip);
> -	if (!chip->irq_mask)
> -		chip->irq_mask = pci_msi_mask_irq;
> -	if (!chip->irq_unmask)
> -		chip->irq_unmask = pci_msi_unmask_irq;
> +	BUG_ON(!chip || !chip->irq_mask || !chip->irq_unmask);
>  	if (!chip->irq_set_affinity)
>  		chip->irq_set_affinity = msi_domain_set_affinity;
>  }
> -- 
> 2.1.4
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1248536 — Re: [PATCH] genirq/msi: Do not use pci_msi_[un]mask_irq as default methods

FromThomas Gleixner <tglx@linutronix.de>
Date2015-10-16 12:00 +0200
SubjectRe: [PATCH] genirq/msi: Do not use pci_msi_[un]mask_irq as default methods
Message-ID<qk9XQ-2Ad-15@gated-at.bofh.it>
In reply to#1247580
Bjorn,

On Thu, 15 Oct 2015, Thomas Gleixner wrote:
> On Tue, 13 Oct 2015, Marc Zyngier wrote:
> 
> > When we create a generic MSI domain, that MSI_FLAG_USE_DEF_CHIP_OPS
> > is set, and that any of .mask or .unmask are NULL in the irq_chip
> > structure, we set them to pci_msi_[un]mask_irq.
> > 
> > This is a bad idea for at least two reasons:
> > - PCI_MSI might not be selected, kernel fails to build (yes, this is
> >   legitimate, at least on arm64!)
> > - This may not be a PCI/MSI domain at all (platform MSI, for example)
> > 
> > Either way, this looks wrong. Move the overriding of mask/unmask to
> > the PCI counterpart, and panic is any of these two methods is not
> > set in the core code (they really should be present).
> > 
> > Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>

Should I take that one?

Thanks,

	tglx
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1248685 — [tip:irq/urgent] genirq/msi: Do not use pci_msi_[un] mask_irq as default methods

Fromtip-bot for Marc Zyngier <tipbot@zytor.com>
Date2015-10-16 14:20 +0200
Subject[tip:irq/urgent] genirq/msi: Do not use pci_msi_[un] mask_irq as default methods
Message-ID<qkc9k-60p-15@gated-at.bofh.it>
In reply to#1246023
Commit-ID:  0701c53e460ea64daf0ee789d0b08fef57800016
Gitweb:     http://git.kernel.org/tip/0701c53e460ea64daf0ee789d0b08fef57800016
Author:     Marc Zyngier <marc.zyngier@arm.com>
AuthorDate: Tue, 13 Oct 2015 19:14:45 +0100
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Fri, 16 Oct 2015 12:40:43 +0200

genirq/msi: Do not use pci_msi_[un]mask_irq as default methods

When we create a generic MSI domain, that MSI_FLAG_USE_DEF_CHIP_OPS
is set, and that any of .mask or .unmask are NULL in the irq_chip
structure, we set them to pci_msi_[un]mask_irq.

This is a bad idea for at least two reasons:
- PCI_MSI might not be selected, kernel fails to build (yes, this is
  legitimate, at least on arm64!)
- This may not be a PCI/MSI domain at all (platform MSI, for example)

Either way, this looks wrong. Move the overriding of mask/unmask to
the PCI counterpart, and panic is any of these two methods is not
set in the core code (they really should be present).

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Cc: Jiang Liu <jiang.liu@linux.intel.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Link: http://lkml.kernel.org/r/1444760085-27857-1-git-send-email-marc.zyngier@arm.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 drivers/pci/msi.c | 4 ++++
 kernel/irq/msi.c  | 6 +-----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index d449714..4a7da3c 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -1243,6 +1243,10 @@ static void pci_msi_domain_update_chip_ops(struct msi_domain_info *info)
 	BUG_ON(!chip);
 	if (!chip->irq_write_msi_msg)
 		chip->irq_write_msi_msg = pci_msi_domain_write_msg;
+	if (!chip->irq_mask)
+		chip->irq_mask = pci_msi_mask_irq;
+	if (!chip->irq_unmask)
+		chip->irq_unmask = pci_msi_unmask_irq;
 }
 
 /**
diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c
index 7e6512b..be9149f 100644
--- a/kernel/irq/msi.c
+++ b/kernel/irq/msi.c
@@ -228,11 +228,7 @@ static void msi_domain_update_chip_ops(struct msi_domain_info *info)
 {
 	struct irq_chip *chip = info->chip;
 
-	BUG_ON(!chip);
-	if (!chip->irq_mask)
-		chip->irq_mask = pci_msi_mask_irq;
-	if (!chip->irq_unmask)
-		chip->irq_unmask = pci_msi_unmask_irq;
+	BUG_ON(!chip || !chip->irq_mask || !chip->irq_unmask);
 	if (!chip->irq_set_affinity)
 		chip->irq_set_affinity = msi_domain_set_affinity;
 }
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web