From patchwork Fri Jul 21 09:51:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 108465 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp596417qge; Fri, 21 Jul 2017 02:59:06 -0700 (PDT) X-Received: by 10.99.43.8 with SMTP id r8mr6818563pgr.313.1500631146636; Fri, 21 Jul 2017 02:59:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500631146; cv=none; d=google.com; s=arc-20160816; b=0dk7kc5lqKAb6CLbGmDr3Bd07nOaZboOJznd83yc2t1mvWSasBvWNvDKmw0holWTgn MEK0akmdt7zG4rD4mW/Y+2fVv28NM4zRt5vhbTXrcrukgMwFz1Knb+b+jCDwM/nU17s+ Sg/jgHeuPFSqV4mwQv0IFG5S17fhymCrpuJu9MNux/F1a4L/joVHXw/9HJPj1D0414G4 lclxlD40zYOuyoBR6bcZPj4RIuUivYFLrRUGv2qLf3X4+USl4s/BHk+tyyOwCAJ/KEVA TE7uCoNfm+AcC39RSU3j3dsz0hAFJ4jf4FSKeM/Hdsuvbl4KeGyNupdS7eLyeAS31lS4 cRKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:arc-authentication-results; bh=3ePq1nFsEgW+HvLbiYsl+Sl+tW08aPhLtq1bCfUs7XA=; b=cR7zZGqqO7zj/jB0yCeIakFRr0SGIVUQoJpgqCyXJFgu1Xpx3mbS4U0WvjAb8LoEz0 0dN8Y6FKlqSz2IdU6gVwvldoobdfXbhHozDSdAbFUB6EAwM0P4QAstr+uiSBqUrrYBWQ 6w82kse1nky2UTlwaxh6vOibNxZZ1SZYHHsaCXrintC20fTmHsT5iwepULzist+bdRoK QnGIxXPP2KAGnnigPPIWrKfIbAXwuH2d2oI6Hh+oEMGv8q2g4CD08/Abm+I6MdFOSODs QRSLo5RDxjVXoTef0rWQS2pO1dPJ85GUry9ot6vQB5ZpmlzEZfLqL5jzBuiyhGB6H1hJ B8Pw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-acpi-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 h7si2922579pgr.234.2017.07.21.02.59.06; Fri, 21 Jul 2017 02:59:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-acpi-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-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753617AbdGUJ7F (ORCPT + 8 others); Fri, 21 Jul 2017 05:59:05 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:10241 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753388AbdGUJ7E (ORCPT ); Fri, 21 Jul 2017 05:59:04 -0400 Received: from 172.30.72.53 (EHLO DGGEML401-HUB.china.huawei.com) ([172.30.72.53]) by dggrg01-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id ASQ03824; Fri, 21 Jul 2017 17:58:47 +0800 (CST) Received: from linux-ibm.site (10.175.102.37) by DGGEML401-HUB.china.huawei.com (10.3.17.32) with Microsoft SMTP Server id 14.3.301.0; Fri, 21 Jul 2017 17:58:39 +0800 From: Hanjun Guo To: Thomas Gleixner , Marc Zyngier CC: , , , , Hanjun Guo , Ganapatrao Kulkarni , Lorenzo Pieralisi Subject: [PATCH] irqchip/gic-v3-its: Allow GIC ITS number more than MAX_NUMNODES Date: Fri, 21 Jul 2017 17:51:55 +0800 Message-ID: <1500630715-2156-1-git-send-email-guohanjun@huawei.com> X-Mailer: git-send-email 1.7.12.4 MIME-Version: 1.0 X-Originating-IP: [10.175.102.37] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090202.5971D059.0088, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: d2cad16323e3a5af49534934ac5fa339 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org From: Hanjun Guo When running 4.13-rc1 on top of D05, I got the boot log: [ 0.000000] SRAT: PXM 0 -> ITS 0 -> Node 0 [ 0.000000] SRAT: PXM 0 -> ITS 1 -> Node 0 [ 0.000000] SRAT: PXM 0 -> ITS 2 -> Node 0 [ 0.000000] SRAT: PXM 1 -> ITS 3 -> Node 1 [ 0.000000] SRAT: ITS affinity exceeding max count[4] This is wrong on D05 as we have 8 ITSes with 4 NUMA nodes. So dynamically alloc the memory needed instead of using its_srat_maps[MAX_NUMNODES], which count the number of ITS entry(ies) in SRAT and alloc its_srat_maps as needed, then build the mapping of numa node to ITS ID. After doing this, I got what I wanted: [ 0.000000] SRAT: PXM 0 -> ITS 0 -> Node 0 [ 0.000000] SRAT: PXM 0 -> ITS 1 -> Node 0 [ 0.000000] SRAT: PXM 0 -> ITS 2 -> Node 0 [ 0.000000] SRAT: PXM 1 -> ITS 3 -> Node 1 [ 0.000000] SRAT: PXM 2 -> ITS 4 -> Node 2 [ 0.000000] SRAT: PXM 2 -> ITS 5 -> Node 2 [ 0.000000] SRAT: PXM 2 -> ITS 6 -> Node 2 [ 0.000000] SRAT: PXM 3 -> ITS 7 -> Node 3 Fixes: dbd2b8267233 ("irqchip/gic-v3-its: Add ACPI NUMA node mapping") Signed-off-by: Hanjun Guo Cc: Ganapatrao Kulkarni Cc: Lorenzo Pieralisi Cc: Marc Zyngier --- drivers/irqchip/irq-gic-v3-its.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) -- 1.7.12.4 -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index 3ccdf76..fb1c090 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -1847,7 +1847,7 @@ struct its_srat_map { u32 its_id; }; -static struct its_srat_map its_srat_maps[MAX_NUMNODES] __initdata; +static struct its_srat_map *its_srat_maps __initdata; static int its_in_srat __initdata; static int __init acpi_get_its_numa_node(u32 its_id) @@ -1861,6 +1861,12 @@ static int __init acpi_get_its_numa_node(u32 its_id) return NUMA_NO_NODE; } +static int __init gic_acpi_match_srat_its(struct acpi_subtable_header *header, + const unsigned long end) +{ + return 0; +} + static int __init gic_acpi_parse_srat_its(struct acpi_subtable_header *header, const unsigned long end) { @@ -1877,12 +1883,6 @@ static int __init gic_acpi_parse_srat_its(struct acpi_subtable_header *header, return -EINVAL; } - if (its_in_srat >= MAX_NUMNODES) { - pr_err("SRAT: ITS affinity exceeding max count[%d]\n", - MAX_NUMNODES); - return -EINVAL; - } - node = acpi_map_pxm_to_node(its_affinity->proximity_domain); if (node == NUMA_NO_NODE || node >= MAX_NUMNODES) { @@ -1901,6 +1901,20 @@ static int __init gic_acpi_parse_srat_its(struct acpi_subtable_header *header, static void __init acpi_table_parse_srat_its(void) { + int count; + + count = acpi_table_parse_entries(ACPI_SIG_SRAT, + sizeof(struct acpi_table_srat), + ACPI_SRAT_TYPE_GIC_ITS_AFFINITY, + gic_acpi_match_srat_its, 0); + if (count <= 0) + return; + + its_srat_maps = kmalloc(count * sizeof(struct its_srat_map), + GFP_KERNEL); + if (!its_srat_maps) + return; + acpi_table_parse_entries(ACPI_SIG_SRAT, sizeof(struct acpi_table_srat), ACPI_SRAT_TYPE_GIC_ITS_AFFINITY,