mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] GICv3 ITS fixes for v4.3
@ 2015-10-02 15:44 Marc Zyngier
  2015-10-02 15:44 ` [PATCH 1/2] irqchip/gic-v3-its: Silence warning when its_lpi_alloc_chunks gets inlined Marc Zyngier
  2015-10-02 15:44 ` [PATCH 2/2] irqchip/gic-v3-its: Count additional LPIs for the aliased devices Marc Zyngier
  0 siblings, 2 replies; 5+ messages in thread
From: Marc Zyngier @ 2015-10-02 15:44 UTC (permalink / raw)
  To: Thomas Gleixner, Jason Cooper
  Cc: linux-arm-kernel, linux-kernel, Alex Shi, Ard Biesheuvel, David Daney

Thomas, Jason,

A couple of relatively minor fixes for the GICv3 ITS code:
- Silence a warning that seems to happen when GCC is a bit inlining happy,
- Fix a thinko when trying to account for PCI aliases.

Thanks,

	M.

Marc Zyngier (2):
  irqchip/gic-v3-its: Silence warning when its_lpi_alloc_chunks gets
    inlined
  irqchip/gic-v3-its: Count additional LPIs for the aliased devices

 drivers/irqchip/irq-gic-v3-its-pci-msi.c | 2 +-
 drivers/irqchip/irq-gic-v3-its.c         | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

-- 
2.1.4


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

* [PATCH 1/2] irqchip/gic-v3-its: Silence warning when its_lpi_alloc_chunks gets inlined
  2015-10-02 15:44 [PATCH 0/2] GICv3 ITS fixes for v4.3 Marc Zyngier
@ 2015-10-02 15:44 ` Marc Zyngier
  2015-10-02 18:54   ` [tip:irq/urgent] " tip-bot for Marc Zyngier
  2015-10-02 15:44 ` [PATCH 2/2] irqchip/gic-v3-its: Count additional LPIs for the aliased devices Marc Zyngier
  1 sibling, 1 reply; 5+ messages in thread
From: Marc Zyngier @ 2015-10-02 15:44 UTC (permalink / raw)
  To: Thomas Gleixner, Jason Cooper
  Cc: Alex Shi, Ard Biesheuvel, linux-arm-kernel, linux-kernel, David Daney

More agressive inlining in recent versions of GCC have uncovered
a new set of warnings:

	drivers/irqchip/irq-gic-v3-its.c: In function its_msi_prepare:
	drivers/irqchip/irq-gic-v3-its.c:1148:26: warning: lpi_base may be used
	uninitialized in this function [-Wmaybe-uninitialized]
	  dev->event_map.lpi_base = lpi_base;
                          ^
	drivers/irqchip/irq-gic-v3-its.c:1116:6: note: lpi_base was declared here
	  int lpi_base;
	      ^
	drivers/irqchip/irq-gic-v3-its.c:1149:25: warning: nr_lpis may be used
	uninitialized in this function [-Wmaybe-uninitialized]
	  dev->event_map.nr_lpis = nr_lpis;
	                         ^
	drivers/irqchip/irq-gic-v3-its.c:1117:6: note: nr_lpis was declared here
	  int nr_lpis;
	      ^
The warning is fairly benign (there is no code path that could
actually use uninitialized vatiables), but let's silence it anyway
by zeroing the variables on the error path.

Reported-by: Alex Shi <alex.shi@linaro.org>
Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 drivers/irqchip/irq-gic-v3-its.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index ac7ae2b..25ceae9f 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -719,6 +719,9 @@ static unsigned long *its_lpi_alloc_chunks(int nr_irqs, int *base, int *nr_ids)
 out:
 	spin_unlock(&lpi_lock);
 
+	if (!bitmap)
+		*base = *nr_ids = 0;
+
 	return bitmap;
 }
 
-- 
2.1.4


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

* [PATCH 2/2] irqchip/gic-v3-its: Count additional LPIs for the aliased devices
  2015-10-02 15:44 [PATCH 0/2] GICv3 ITS fixes for v4.3 Marc Zyngier
  2015-10-02 15:44 ` [PATCH 1/2] irqchip/gic-v3-its: Silence warning when its_lpi_alloc_chunks gets inlined Marc Zyngier
@ 2015-10-02 15:44 ` Marc Zyngier
  2015-10-02 18:55   ` [tip:irq/urgent] " tip-bot for Marc Zyngier
  1 sibling, 1 reply; 5+ messages in thread
From: Marc Zyngier @ 2015-10-02 15:44 UTC (permalink / raw)
  To: Thomas Gleixner, Jason Cooper
  Cc: linux-arm-kernel, linux-kernel, Alex Shi, Ard Biesheuvel, David Daney

When configuring the interrupt mapping for a new device, we
iterate over all the possible aliases to account for their
maximum MSI allocation. This was introduced by e8137f4f5088
("irqchip: gicv3-its: Iterate over PCI aliases to generate ITS configuration").

Turns out that the code doing that is a bit braindead, and repeatedly
accounts for the same device over and over.

Fix this by counting the actual alias that is passed to us by the
core code.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 drivers/irqchip/irq-gic-v3-its-pci-msi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/irqchip/irq-gic-v3-its-pci-msi.c b/drivers/irqchip/irq-gic-v3-its-pci-msi.c
index cf351c6..a7c8c9f 100644
--- a/drivers/irqchip/irq-gic-v3-its-pci-msi.c
+++ b/drivers/irqchip/irq-gic-v3-its-pci-msi.c
@@ -62,7 +62,7 @@ static int its_get_pci_alias(struct pci_dev *pdev, u16 alias, void *data)
 
 	dev_alias->dev_id = alias;
 	if (pdev != dev_alias->pdev)
-		dev_alias->count += its_pci_msi_vec_count(dev_alias->pdev);
+		dev_alias->count += its_pci_msi_vec_count(pdev);
 
 	return 0;
 }
-- 
2.1.4


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

* [tip:irq/urgent] irqchip/gic-v3-its: Silence warning when its_lpi_alloc_chunks gets inlined
  2015-10-02 15:44 ` [PATCH 1/2] irqchip/gic-v3-its: Silence warning when its_lpi_alloc_chunks gets inlined Marc Zyngier
@ 2015-10-02 18:54   ` tip-bot for Marc Zyngier
  0 siblings, 0 replies; 5+ messages in thread
From: tip-bot for Marc Zyngier @ 2015-10-02 18:54 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: mingo, ard.biesheuvel, linux-kernel, ddaney.cavm, jason,
	marc.zyngier, hpa, alex.shi, tglx

Commit-ID:  c8415b9470727f70afce8607d4fe521789aa6c1c
Gitweb:     http://git.kernel.org/tip/c8415b9470727f70afce8607d4fe521789aa6c1c
Author:     Marc Zyngier <marc.zyngier@arm.com>
AuthorDate: Fri, 2 Oct 2015 16:44:05 +0100
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Fri, 2 Oct 2015 20:51:41 +0200

irqchip/gic-v3-its: Silence warning when its_lpi_alloc_chunks gets inlined

More agressive inlining in recent versions of GCC have uncovered
a new set of warnings:

 drivers/irqchip/irq-gic-v3-its.c: In function its_msi_prepare:
  drivers/irqchip/irq-gic-v3-its.c:1148:26: warning: lpi_base may be used
    uninitialized in this function [-Wmaybe-uninitialized]
     dev->event_map.lpi_base = lpi_base;
                          ^
 drivers/irqchip/irq-gic-v3-its.c:1116:6: note: lpi_base was declared here
  int lpi_base;
	      ^
 drivers/irqchip/irq-gic-v3-its.c:1149:25: warning: nr_lpis may be used
  uninitialized in this function [-Wmaybe-uninitialized]
   dev->event_map.nr_lpis = nr_lpis;
	                         ^
 drivers/irqchip/irq-gic-v3-its.c:1117:6: note: nr_lpis was declared here
  int nr_lpis;
	      ^
The warning is fairly benign (there is no code path that could
actually use uninitialized variables), but let's silence it anyway
by zeroing the variables on the error path.

Reported-by: Alex Shi <alex.shi@linaro.org>
Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: David Daney <ddaney.cavm@gmail.com>
Cc: Jason Cooper <jason@lakedaemon.net>
Link: http://lkml.kernel.org/r/1443800646-8074-2-git-send-email-marc.zyngier@arm.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 drivers/irqchip/irq-gic-v3-its.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index ac7ae2b..25ceae9f 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -719,6 +719,9 @@ static unsigned long *its_lpi_alloc_chunks(int nr_irqs, int *base, int *nr_ids)
 out:
 	spin_unlock(&lpi_lock);
 
+	if (!bitmap)
+		*base = *nr_ids = 0;
+
 	return bitmap;
 }
 

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

* [tip:irq/urgent] irqchip/gic-v3-its: Count additional LPIs for the aliased devices
  2015-10-02 15:44 ` [PATCH 2/2] irqchip/gic-v3-its: Count additional LPIs for the aliased devices Marc Zyngier
@ 2015-10-02 18:55   ` tip-bot for Marc Zyngier
  0 siblings, 0 replies; 5+ messages in thread
From: tip-bot for Marc Zyngier @ 2015-10-02 18:55 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: hpa, linux-kernel, jason, tglx, ddaney.cavm, ard.biesheuvel,
	marc.zyngier, alex.shi, mingo

Commit-ID:  791c76d58465a248cbd1ee422c8075cb90fa615f
Gitweb:     http://git.kernel.org/tip/791c76d58465a248cbd1ee422c8075cb90fa615f
Author:     Marc Zyngier <marc.zyngier@arm.com>
AuthorDate: Fri, 2 Oct 2015 16:44:06 +0100
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Fri, 2 Oct 2015 20:51:41 +0200

irqchip/gic-v3-its: Count additional LPIs for the aliased devices

When configuring the interrupt mapping for a new device, we
iterate over all the possible aliases to account for their
maximum MSI allocation. This was introduced by e8137f4f5088
("irqchip: gicv3-its: Iterate over PCI aliases to generate ITS configuration").

Turns out that the code doing that is a bit braindead, and repeatedly
accounts for the same device over and over.

Fix this by counting the actual alias that is passed to us by the
core code.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: Alex Shi <alex.shi@linaro.org>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: David Daney <ddaney.cavm@gmail.com>
Cc: Jason Cooper <jason@lakedaemon.net>
Link: http://lkml.kernel.org/r/1443800646-8074-3-git-send-email-marc.zyngier@arm.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 drivers/irqchip/irq-gic-v3-its-pci-msi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/irqchip/irq-gic-v3-its-pci-msi.c b/drivers/irqchip/irq-gic-v3-its-pci-msi.c
index cf351c6..a7c8c9f 100644
--- a/drivers/irqchip/irq-gic-v3-its-pci-msi.c
+++ b/drivers/irqchip/irq-gic-v3-its-pci-msi.c
@@ -62,7 +62,7 @@ static int its_get_pci_alias(struct pci_dev *pdev, u16 alias, void *data)
 
 	dev_alias->dev_id = alias;
 	if (pdev != dev_alias->pdev)
-		dev_alias->count += its_pci_msi_vec_count(dev_alias->pdev);
+		dev_alias->count += its_pci_msi_vec_count(pdev);
 
 	return 0;
 }

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

end of thread, other threads:[~2015-10-02 18:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-02 15:44 [PATCH 0/2] GICv3 ITS fixes for v4.3 Marc Zyngier
2015-10-02 15:44 ` [PATCH 1/2] irqchip/gic-v3-its: Silence warning when its_lpi_alloc_chunks gets inlined Marc Zyngier
2015-10-02 18:54   ` [tip:irq/urgent] " tip-bot for Marc Zyngier
2015-10-02 15:44 ` [PATCH 2/2] irqchip/gic-v3-its: Count additional LPIs for the aliased devices Marc Zyngier
2015-10-02 18:55   ` [tip:irq/urgent] " tip-bot for Marc Zyngier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome