Received: by 10.223.185.116 with SMTP id b49csp8004370wrg; Thu, 1 Mar 2018 15:16:16 -0800 (PST) X-Google-Smtp-Source: AG47ELum5AO8FEprc+pPLpzwfF/eOCcSXgGcGewpzMUEfxu2HgirSJtMlHMjbYKoR8juh0+de4zJ X-Received: by 10.98.93.87 with SMTP id r84mr3611053pfb.131.1519946176297; Thu, 01 Mar 2018 15:16:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519946176; cv=none; d=google.com; s=arc-20160816; b=iUv26XltzStv7UXsZckLaVPL0VL8+AEXUfZqJAxR0Ajg0ozLczw3m/spU9dC0DkjsI a7PKmbztdYQKgqby4OJ5XRUUU0zwjY+zLfOAr/rDMmcjg23s2V2UzDMOMsTnskBRp53g +luQpOwqkWImyYw9nVbmBGWppgqTT2CXztZ8xfbLDOrT8GbhMGgvpibFPlrm+PhYcVCH ueBEukRIzq53M4Gqsh6dzk3cmgO/GpJX9tVWf+HAGJKQtU9X/rNMOVcQQIX6dZkC4Ben 5/AYbIDXY5pEna7Y461m9hCu8+t574MG2Z+6/pgHamdbMMa4m4a428YSZFosVa5ys/8+ fTaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date :arc-authentication-results; bh=SpSQOcZSd5mp8/Y8CFr+1AdgpVpW5MoOxyfmr0WOFqo=; b=NE10E3a11AUd9a8SffbpALYkBYp4MRFA5KdbKxzVa9cxeoX8cUGkOobI0cQknMOGFJ fS0zIBH9/aic8Ta7tIsk1VcT9Q77+uRDHdBcEj8Nhnff2DcFIiwgJJ6IGyYf8iup8PwJ ldN0Jd7ulHMUlYtLO9rWmi4AkFF1/jciYL2LBUKrD9Y8bAVwOJ8LEeLj0IuL8dY+D/3O RBnpcfyztwDXXqJnq3Lc50VtXc2pXfq2h6zs15MfSPPCgMt2kblAjCc7uq2IMANbGOL3 8A8pq67baugLYDRFehqMrxYFYpUn1rlNA5nm6bfPQiknJJ7i2/Zy++EBB00e2v52gjgh NuQA== 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 33-v6si3741873plt.429.2018.03.01.15.16.01; Thu, 01 Mar 2018 15:16:16 -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 S1163040AbeCAXOa (ORCPT + 99 others); Thu, 1 Mar 2018 18:14:30 -0500 Received: from mga12.intel.com ([192.55.52.136]:10146 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1162811AbeCAXO2 (ORCPT ); Thu, 1 Mar 2018 18:14:28 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Mar 2018 15:14:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,409,1515484800"; d="scan'208";a="208215639" Received: from dph9ls1.fm.intel.com (HELO intel.com) ([10.80.209.182]) by fmsmga006.fm.intel.com with ESMTP; 01 Mar 2018 15:14:28 -0800 Date: Thu, 1 Mar 2018 15:07:07 -0800 From: Ivan Gorinov To: Thomas Gleixner Cc: Linux Kernel Mailing List , Ingo Molnar Subject: [PATCH v3 3/3] x86: devicetree: fix device IRQ settings in DT Message-ID: <20180301230707.GA48545@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) 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