Received: by 10.223.185.116 with SMTP id b49csp6919768wrg; Wed, 28 Feb 2018 18:54:21 -0800 (PST) X-Google-Smtp-Source: AG47ELvtBEMPoX9h8+4FzyhGKuv8Yx9KPgOwCfUkAGFx5qc5sJG3UQ2GbGM1SANhfF6SKMjnO+C6 X-Received: by 10.101.72.199 with SMTP id o7mr264541pgs.303.1519872861773; Wed, 28 Feb 2018 18:54:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519872861; cv=none; d=google.com; s=arc-20160816; b=kAJxkaq07i/5XLg2hsHdzc1YTD64zs2M48IDLkt+mWjjKUog6sEtk9dJKgGA1VvX4f OvtZrzG1/mLGO9Ub7IRyJCzNHQph2oVg4y00VLS3OGXEUA+XmCU6X0UFVSoZqhec+kKG LCSfksq0TDeHEWoVPMk9DhJ+IjqJJiTfdEE/Lyc4+p71jkpy78cP1fgahb2NvodhwgDu ZEM+1B6A+sJbspZWRZQRSkRZvxi+/MLNDyxegnA3HUOMJMqhktX90I7m1lzeuTVEPAjp kJJ9hTsgWYV3KbbDkBdY2bbf+5b1VWtOax3lQ2/s4qr/xhotGSYz85Pxe6OsvmstVDkZ L1og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:date:cc:to:from:subject:message-id :arc-authentication-results; bh=NRgCkk8vMC1G8a09CWVkHIoDcd7xIWgQdYH1zVnasYA=; b=sY5898Bl+BfJgni66jhEIXTajUb3mjNe9i7bbz6ROGCO/9YYJ178vnnh7B8H4pnqq5 M83N5cRgHU37nOC+MdoKHeVrpd4xRi2JoZ2IR0CE+isAMIpdqPe+2or5II5oUZfzD0ax KsyJYqQPqhb/qp04o1mJZEbKPhVzWq8VVOPhugKTCiLnk3OCeFyAICZdj/NOXKuHcYQh kBidN4qwJbeHY5xwXHDNPuy7kpa+Q7qf9FDP7CS0vEQkjluKCRBwcE5UW77eoxdLpI4R sVcTv72zIUURecZAuCkHcOlFg6GHeXPomEAG7k0bRB0uqZbJBwRc720l0fU0pxtGhHy9 TBSw== 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 5si1830610pgg.286.2018.02.28.18.54.07; Wed, 28 Feb 2018 18:54:21 -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 S965624AbeCACxI (ORCPT + 99 others); Wed, 28 Feb 2018 21:53:08 -0500 Received: from mga12.intel.com ([192.55.52.136]:28413 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965544AbeCACxG (ORCPT ); Wed, 28 Feb 2018 21:53:06 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Feb 2018 18:53:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,407,1515484800"; d="scan'208";a="21020279" Received: from dph9ls1.fm.intel.com ([10.80.209.182]) by fmsmga007.fm.intel.com with ESMTP; 28 Feb 2018 18:53:06 -0800 Message-ID: <1519872347.58658.189.camel@intel.com> Subject: [PATCH v2 3/3] x86: devicetree: fix device IRQ settings in DT From: Ivan Gorinov To: Thomas Gleixner Cc: Linux Kernel Mailing List , Ingo Molnar Date: Wed, 28 Feb 2018 18:45:47 -0800 Organization: Intel Corporation Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.18.5.2-0ubuntu3.2 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org IRQ parameters for 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 IRQ parameters. Signed-off-by: Ivan Gorinov ---  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 ef1cd85..b8b5874 100644 --- a/arch/x86/kernel/devicetree.c +++ b/arch/x86/kernel/devicetree.c @@ -215,19 +215,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);  } --  2.7.4