mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: tip-bot for Ivan Gorinov <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: robh+dt@kernel.org, ivan.gorinov@intel.com, hpa@zytor.com,
	mark.rutland@arm.com, linux-kernel@vger.kernel.org,
	tglx@linutronix.de, mingo@kernel.org
Subject: [tip:x86/platform] x86/devicetree: Fix device IRQ settings in DT
Date: Thu, 8 Mar 2018 01:04:15 -0800	[thread overview]
Message-ID: <tip-0a5169add90e43ab45ab1ba34223b8583fcaf675@git.kernel.org> (raw)
In-Reply-To: <a234dee27ea60ce76141872da0d6bdb378b2a9ee.1520450752.git.ivan.gorinov@intel.com>

Commit-ID:  0a5169add90e43ab45ab1ba34223b8583fcaf675
Gitweb:     https://git.kernel.org/tip/0a5169add90e43ab45ab1ba34223b8583fcaf675
Author:     Ivan Gorinov <ivan.gorinov@intel.com>
AuthorDate: Wed, 7 Mar 2018 11:46:53 -0800
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Thu, 8 Mar 2018 09:59:53 +0100

x86/devicetree: Fix device IRQ settings in DT

IRQ parameters for the SoC devices connected directly to I/O APIC lines
(without PCI IRQ routing) may be specified in the Device Tree.

Called from DT IRQ parser, irq_create_fwspec_mapping() calls
irq_domain_alloc_irqs() with a pointer to irq_fwspec structure as @arg.

But x86-specific DT IRQ allocation code casts @arg to of_phandle_args
structure pointer and crashes trying to read the IRQ parameters. The
function was not converted when the mapping descriptor was changed to
irq_fwspec in the generic irqdomain code.

Fixes: 11e4438ee330 ("irqdomain: Introduce a firmware-specific IRQ specifier structure")
Signed-off-by: Ivan Gorinov <ivan.gorinov@intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Rob Herring <robh+dt@kernel.org>
Link: https://lkml.kernel.org/r/a234dee27ea60ce76141872da0d6bdb378b2a9ee.1520450752.git.ivan.gorinov@intel.com

---
 arch/x86/kernel/devicetree.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/devicetree.c b/arch/x86/kernel/devicetree.c
index 63d2ebc21825..5cd387fcc777 100644
--- a/arch/x86/kernel/devicetree.c
+++ b/arch/x86/kernel/devicetree.c
@@ -195,19 +195,22 @@ static struct of_ioapic_type of_ioapic_type[] =
 static int dt_irqdomain_alloc(struct irq_domain *domain, unsigned int virq,
 			      unsigned int nr_irqs, void *arg)
 {
-	struct of_phandle_args *irq_data = (void *)arg;
+	struct irq_fwspec *fwspec = (struct irq_fwspec *)arg;
 	struct of_ioapic_type *it;
 	struct irq_alloc_info tmp;
+	int type_index;
 
-	if (WARN_ON(irq_data->args_count < 2))
+	if (WARN_ON(fwspec->param_count < 2))
 		return -EINVAL;
-	if (irq_data->args[1] >= ARRAY_SIZE(of_ioapic_type))
+
+	type_index = fwspec->param[1];
+	if (type_index >= ARRAY_SIZE(of_ioapic_type))
 		return -EINVAL;
 
-	it = &of_ioapic_type[irq_data->args[1]];
+	it = &of_ioapic_type[type_index];
 	ioapic_set_alloc_attr(&tmp, NUMA_NO_NODE, it->trigger, it->polarity);
 	tmp.ioapic_id = mpc_ioapic_id(mp_irqdomain_ioapic_idx(domain));
-	tmp.ioapic_pin = irq_data->args[0];
+	tmp.ioapic_pin = fwspec->param[0];
 
 	return mp_irqdomain_alloc(domain, virq, nr_irqs, &tmp);
 }

  reply	other threads:[~2018-03-08  9:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-07 19:45 [PATCH v4 0/4] x86/devicetree: Re-enable x86-specific implementation Ivan Gorinov
2018-03-07 19:46 ` [PATCH v4 1/4] x86/devicetree: Initialize device tree before using it Ivan Gorinov
2018-03-08  9:03   ` [tip:x86/platform] " tip-bot for Ivan Gorinov
2018-03-07 19:46 ` [PATCH v4 2/4] x86/devicetree: Fix device IRQ settings in DT Ivan Gorinov
2018-03-08  9:04   ` tip-bot for Ivan Gorinov [this message]
2018-03-07 19:47 ` [PATCH v4 3/4] of: Documentation: Add x86 local APIC ID property Ivan Gorinov
2018-03-07 20:23   ` Rob Herring
2018-03-08  1:11     ` Ivan Gorinov
2018-03-08  1:34       ` Rob Herring
2018-03-07 19:47 ` [PATCH v4 4/4] x86/devicetree: Enable multiprocessing in DT Ivan Gorinov
2018-03-08  2:16 ` [PATCH v4 0/4] x86/devicetree: Re-enable x86-specific implementation Frank Rowand
2018-03-13 16:08   ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-0a5169add90e43ab45ab1ba34223b8583fcaf675@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=hpa@zytor.com \
    --cc=ivan.gorinov@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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