Received: by 10.223.185.116 with SMTP id b49csp6073166wrg; Thu, 8 Mar 2018 01:06:00 -0800 (PST) X-Google-Smtp-Source: AG47ELuiDR1vJFvlqlIBC4u6r2VwG8LXtFBIoxD97SupIoBhtqaZdvrQ6B1ftbKZkEYKVm3qIzYW X-Received: by 2002:a17:902:2e83:: with SMTP id r3-v6mr23567053plb.84.1520499960300; Thu, 08 Mar 2018 01:06:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520499960; cv=none; d=google.com; s=arc-20160816; b=VNntOjevEzlMftaIT2iP9jtjCqSggHvWZ5fM9uwfh/6M1W0xBmfjpxxxfiCl/+7UMe Qx5DiDOxOi7UrT+I4myU/9EX84KoTsaPIQSjp2o2tGUQNdY2D4Y2a4xYdU3NT0MkCQVa tnkzXikbykYwI55WrCK6rYkp3+2MFzAC4mJMTxoJqbIIlC0Dpco7u3vx5nt40JM4+Fyo QzigiapzqBb++Z3eacm3CLHB8mcavXj1ofAsx8xMM/8ioLT4LaUHMy6FWjirPRcEFeXT n7uB1rm7crl5mg5d5gSp+u7Mr0nkGgMHZUFn2uukL7/wcJle38mkZ53WSc+FQuyZ/+xV NoEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=ApWXM0ECtZqgGypHal+TlQgIlhowrVTks/FT6JcGv9I=; b=P8krEYuuEiN4AvHoW+ClI712VIZOvW5KgKA2aQWxPG0ECLdRC4B6UlAat+jEbLkUA0 JDJx7k1CZdwtNwkeSE/+cSJ77lZLRA0fPcNV81L5I95amM0NQFPb2V2gWrSiOf83wlt2 Bct7RiRaitf0su1JPAKbLZTUGqdbnXg9hyrqqVxPd9sJSg4X6gKF/yIBakrtPnYBBttf YpJC09ky9cfM6iTwJgo6oFz238Ap/w9rpvR/Sx5gatrqdIE86tV6IyTz4XBCcl67V9YD x+qo//Wtb3ErbqxGxvydfsAk5VIKoFl93HzgyYbwL/6MvB0/WBGvP2hLHzEFNpaQHuZP b6hg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ba12-v6si10906034plb.470.2018.03.08.01.05.45; Thu, 08 Mar 2018 01:06:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964936AbeCHJEc (ORCPT + 99 others); Thu, 8 Mar 2018 04:04:32 -0500 Received: from terminus.zytor.com ([198.137.202.136]:40391 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751588AbeCHJE1 (ORCPT ); Thu, 8 Mar 2018 04:04:27 -0500 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTP id w2894GHi021401; Thu, 8 Mar 2018 01:04:16 -0800 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w2894FRU021398; Thu, 8 Mar 2018 01:04:15 -0800 Date: Thu, 8 Mar 2018 01:04:15 -0800 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Ivan Gorinov Message-ID: 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 Reply-To: ivan.gorinov@intel.com, hpa@zytor.com, robh+dt@kernel.org, mingo@kernel.org, mark.rutland@arm.com, tglx@linutronix.de, linux-kernel@vger.kernel.org In-Reply-To: References: To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/platform] x86/devicetree: Fix device IRQ settings in DT Git-Commit-ID: 0a5169add90e43ab45ab1ba34223b8583fcaf675 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 0a5169add90e43ab45ab1ba34223b8583fcaf675 Gitweb: https://git.kernel.org/tip/0a5169add90e43ab45ab1ba34223b8583fcaf675 Author: Ivan Gorinov AuthorDate: Wed, 7 Mar 2018 11:46:53 -0800 Committer: Thomas Gleixner 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 Signed-off-by: Thomas Gleixner Cc: Mark Rutland Cc: Rob Herring 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); }