Received: by 10.223.185.116 with SMTP id b49csp4413391wrg; Mon, 26 Feb 2018 17:44:47 -0800 (PST) X-Google-Smtp-Source: AH8x226w3yK+2SOz8oGq14BjCWXI3M15L/YQ8QmABQETpcLBbNInDYuRMvHhT1ZFHNA3aW9iFg2l X-Received: by 2002:a17:902:9882:: with SMTP id s2-v6mr12879818plp.196.1519695887025; Mon, 26 Feb 2018 17:44:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519695886; cv=none; d=google.com; s=arc-20160816; b=gUV1wXK6QtHZ8Tb2Lu5//WYq3ef/XYKW8M5kfdce9JPj2037zKik68pTc8kqojr+IA GhlBkfQgKTZvpK7KNfpscxJNoPxmh2PEavqD//hXha6UREDAwY2DoeOMpqeEslwMtbmU zQvNCOXv323aKcJKgSk9Z8mCKZ6FACSiTv/cfkI93chJqGKQoZoYGuN/YH8NrxrbPskl M4TfCmfmj3+jRD8NFXLLPBVOtBvoCsxft6MuKbib1YXYGRUQUEKlMMTBDQwzr0tJyMXD 3AhCWc44dS5RChmS59qqFvSuLpngHv4hUneUa7GZ7UfFnNFOwneXFgP9ROjJz6bIcpt+ xcMA== 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:to:from:subject:message-id :arc-authentication-results; bh=OdMRCFbjqT/9W0MuMb5AztZpyOd6Pl4y0hVCppA5htE=; b=O5pjyeiGJuDxAaVIcSfUxf9u9/ML3SeVYsWv6diY2t8WBIGtxlbanh3k7xl3jqg0H7 Sy39+mhBW/6IU4QFZM6Rt5mtH6otYebfokJq6iqzoNF1T7hNqxcjmq/i1vKN8dr7/G4v 2khIcsrtKBPHQ+GdvpBBbvYCG+H7sh1UKnmoIpysXHmbYGdh4mKtXFf9TbFK68dwm6SC 7aL+kEdJV16mhLnHrg8zWrRs5jnqDntEh8RO1CJdg5nNQSCL1Ak7mfFukDDhdmli2IER GRYae43hRmlsrAlKe0AGTi6zyHQ0mI4lf+BBarimXbpDKJsniutJ82MtL5RkwWzoeaTG RSkA== 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 k1si6318408pgc.638.2018.02.26.17.44.19; Mon, 26 Feb 2018 17:44:46 -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 S1751511AbeB0BnZ (ORCPT + 99 others); Mon, 26 Feb 2018 20:43:25 -0500 Received: from mga02.intel.com ([134.134.136.20]:25081 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751094AbeB0BnY (ORCPT ); Mon, 26 Feb 2018 20:43:24 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Feb 2018 17:43:23 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,398,1515484800"; d="scan'208";a="20578500" Received: from dph9ls1.fm.intel.com ([10.80.209.182]) by fmsmga008.fm.intel.com with ESMTP; 26 Feb 2018 17:43:23 -0800 Message-ID: <1519695367.58658.141.camel@intel.com> Subject: [PATCH] x86: devicetree: enable multiprocessing and interrupt setting in DT From: Ivan Gorinov To: Linux Kernel Mailing List , Thomas Gleixner , Ingo Molnar Date: Mon, 26 Feb 2018 17:36:07 -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 The x86-specific Device Tree implementation only supported single CPU, and IRQ allocation from DT parameters was broken in recent versions. This change enables multiprocessing and fixes broken IRQ allocation. Signed-off-by: Ivan Gorinov ---  arch/x86/kernel/devicetree.c | 41 ++++++++++++++++++++++++++++++++++-------  1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/arch/x86/kernel/devicetree.c b/arch/x86/kernel/devicetree.c index 25de5f6..f885eab 100644 --- a/arch/x86/kernel/devicetree.c +++ b/arch/x86/kernel/devicetree.c @@ -130,6 +130,29 @@ static void __init dtb_setup_hpet(void)  #endif  }   +static void __init dtb_cpu_setup(void) +{ + struct device_node *dn; + struct resource r; + const void *prop; + int apic_id, version; + int ret; + + version = GET_APIC_VERSION(apic_read(APIC_LVR)); + for_each_node_by_type(dn, "cpu") { + prop = of_get_property(dn, "intel,apic-id", NULL); + if (prop) { + apic_id = be32_to_cpup(prop); + } else { + ret = of_address_to_resource(dn, 0, &r); + if (WARN_ON(ret)) + continue; + apic_id = r.start; + } + generic_processor_info(apic_id, version); + } +} +  static void __init dtb_lapic_setup(void)  {  #ifdef CONFIG_X86_LOCAL_APIC @@ -153,8 +176,6 @@ static void __init dtb_lapic_setup(void)   smp_found_config = 1;   pic_mode = 1;   register_lapic_address(r.start); - generic_processor_info(boot_cpu_physical_apicid, -        GET_APIC_VERSION(apic_read(APIC_LVR)));  #endif  }   @@ -194,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);  } @@ -256,6 +280,7 @@ static void __init dtb_ioapic_setup(void) {}  static void __init dtb_apic_setup(void)  {   dtb_lapic_setup(); + dtb_cpu_setup();   dtb_ioapic_setup();  }   @@ -278,6 +303,8 @@ static void __init x86_flattree_get_config(void)   map_len = size;   }   + early_init_dt_verify(dt); +   unflatten_and_copy_device_tree();   early_memunmap(dt, map_len);  } --  2.7.4