From patchwork Fri Jul 17 17:59:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 235739 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp1925814ilg; Fri, 17 Jul 2020 11:01:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxUhNF4G+obNJx5HgcRZVVw4VCpt3156cvRfowN4Lfq5XQycflazFWHs9oW7Cr6zxBWIEDH X-Received: by 2002:a05:6402:1c96:: with SMTP id cy22mr10189415edb.79.1595008877656; Fri, 17 Jul 2020 11:01:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595008877; cv=none; d=google.com; s=arc-20160816; b=Si5eyeLGQ2zWNXZ5OhotaKzcIEB1qRT4YOf2OSlpPtFbpGsyBcvhYOQiBu3ETPo0Wi YbCADllpkLl+AHG7t9iApDlARSQGr7br/sfDUSpg/ukhmeuaR1Ksjfi7+hHar5SJC/b9 nW2aH3Cb5UGWOkw4p9rHgNGGU87331DcjILbRgfpH9v1ZcP+OoWGMCoZ3g42k7MxWD8G oXId6f6KQbVSI2eSNBMdSwD9mFg6n7Wx2FZLhtBSU3LLuUxkefJGxBO3YBS5nhJXhrgq wLKwp+7Lbsh36cihFCcU/nnP4UOMyc3MUcUatvpYF9g7FHoOkdsH09UkI3Bv4brKnzhp m42g== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=DdUjPFqzEWRlYT3/OW1on38PUy+Gl1dLp04h9e0yZm8=; b=yjyld1gBvjF705BDtLt7lgPAsq01eB/GwQpbkV1Wzu7EhWEpNc+kahtqgL0xvozWPs APvczBIquEP0vkml0jIs31zMmr/dM+/6Ypjxq/2u3pYvtyqFcCwFfcJGOJ7z2UFtxXu2 l0M2axtgTDUuT2lyLUwdGoqh7CkW9vi0HhsqRB9ql3RYjUmA2S0gw/zYMOh0AKip86JG x71tmD3bJ1dx6I2A95c8TN8Hz/ryX6uTlTtAagv+YpGCVuVYer8LBfdQH/KCYgOOanYN QmovWCIsEU469CupmGNjNcCnhK6DuIkxrujYB3D2gCIOKf1uhqDAWdhDkZsGJkiCw1cR /i0Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-acpi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c89si5938817edf.35.2020.07.17.11.01.17; Fri, 17 Jul 2020 11:01:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-acpi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-acpi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727002AbgGQSBQ (ORCPT + 7 others); Fri, 17 Jul 2020 14:01:16 -0400 Received: from lhrrgout.huawei.com ([185.176.76.210]:2498 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726232AbgGQSBQ (ORCPT ); Fri, 17 Jul 2020 14:01:16 -0400 Received: from lhreml710-chm.china.huawei.com (unknown [172.18.7.106]) by Forcepoint Email with ESMTP id 2142BCC913125B7CA8F5; Fri, 17 Jul 2020 19:01:15 +0100 (IST) Received: from lhrphicprd00229.huawei.com (10.123.41.22) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1913.5; Fri, 17 Jul 2020 19:01:14 +0100 From: Jonathan Cameron To: , , , CC: Lorenzo Pieralisi , Bjorn Helgaas , , , Ingo Molnar , , Tony Luck , Fenghua Yu , Thomas Gleixner , , Dan Williams , Song Bao Hua , Jonathan Cameron Subject: [PATCH v2 1/6] ACPI: Add out of bounds and numa_off protections to pxm_to_node Date: Sat, 18 Jul 2020 01:59:54 +0800 Message-ID: <20200717175959.899775-2-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20200717175959.899775-1-Jonathan.Cameron@huawei.com> References: <20200717175959.899775-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.123.41.22] X-ClientProxiedBy: lhreml706-chm.china.huawei.com (10.201.108.55) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org The function should check the validity of the pxm value before using it to index the pxm_to_node_map array. Whilst hardening this code may be good in general, the main intent here is to enable following patches that use this function to replace acpi_map_pxm_to_node for non SRAT usecases which should return NO_NUMA_NODE for PXM entries not matching with those in SRAT. Signed-off-by: Jonathan Cameron --- drivers/acpi/numa/srat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.19.1 Reviewed-by: Barry Song diff --git a/drivers/acpi/numa/srat.c b/drivers/acpi/numa/srat.c index 5be5a977da1b..8ef44ee0d76b 100644 --- a/drivers/acpi/numa/srat.c +++ b/drivers/acpi/numa/srat.c @@ -31,7 +31,7 @@ int acpi_numa __initdata; int pxm_to_node(int pxm) { - if (pxm < 0) + if (pxm < 0 || pxm >= MAX_PXM_DOMAINS || numa_off) return NUMA_NO_NODE; return pxm_to_node_map[pxm]; } From patchwork Fri Jul 17 17:59:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 235740 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp1926292ilg; Fri, 17 Jul 2020 11:01:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwCQp2FCAgxhmrVO+KtoVNtMtu/eUHMdrkthEdwZ4wY2RZAgaTRF8I/WpuiHiHxHIeILBpB X-Received: by 2002:aa7:da89:: with SMTP id q9mr10571971eds.273.1595008908890; Fri, 17 Jul 2020 11:01:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595008908; cv=none; d=google.com; s=arc-20160816; b=nLtbkuRYsKoab4Vn7u4U5TZ57Wd8HAeclu6fII2dI7ICe8b4zwT78Up/MUBXmMITiP 7JFSAO76VaOxnjRU1EgfKlcg0stDv9/1HtT2UK6DxBg63+wnqRQVOU0zB1n2o/GQgpuZ gcx17c+swyJeQi3rhwxvoXvSMVk0z8xp6wWmOKKxqmMqkjNGGRV6D8jN8wZ733Z5mkc+ njY0xfBGtEh5SpxPRmUCd6MFAP4AAZYJ3VuY/GLvESzOW93VpL4v2VCgIazXgWo95iNB QUsfyrV36LsJoKHFYBPTg9nycRFe9SEH5P9Z7nK9FvrDXIhGPtP4YWoIJQcgWulhfcUf iCow== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=0C5mjOe6RHVtBFVVK1AxF6q3bg3KtNsKqXcU8aDD26c=; b=Q1CPd+eAinLKQOoHKrt0YYKSwHpwlZfAYZ9rp1hPV67J5k33+QRUqoWZ1Bca1SbzSS A4CEYsM00NnSDpGZuyaQaMlS2z/jvt5NUszMTPbnWxcb7shkjXvLF3xdeZGV2H6oT4X1 /DYnbqsFt3D3Dtp2QCotytvR/U+KEvVLIrSYaP2SHHzht3bJK0eFaaz0ArG3pcdOD9R+ mKSx4k9KfxZ64CHAKvCShhp7KubPCp95+UcIFrXUUb/ktwMG6TROhkGtvY9RCkaVyRaI 3P80+jE0VmPjtX06nwFvrnFSZqKeoYedoMtkxAA0gBmaB3adxVM52j6XVapa86pt7Zih LuSA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-acpi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h1si5695351ejk.3.2020.07.17.11.01.48; Fri, 17 Jul 2020 11:01:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-acpi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-acpi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727953AbgGQSBr (ORCPT + 7 others); Fri, 17 Jul 2020 14:01:47 -0400 Received: from lhrrgout.huawei.com ([185.176.76.210]:2499 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726232AbgGQSBr (ORCPT ); Fri, 17 Jul 2020 14:01:47 -0400 Received: from lhreml710-chm.china.huawei.com (unknown [172.18.7.107]) by Forcepoint Email with ESMTP id 9528D7C04693B679C619; Fri, 17 Jul 2020 19:01:45 +0100 (IST) Received: from lhrphicprd00229.huawei.com (10.123.41.22) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1913.5; Fri, 17 Jul 2020 19:01:45 +0100 From: Jonathan Cameron To: , , , CC: Lorenzo Pieralisi , Bjorn Helgaas , , , Ingo Molnar , , Tony Luck , Fenghua Yu , Thomas Gleixner , , Dan Williams , Song Bao Hua , Jonathan Cameron Subject: [PATCH v2 2/6] ACPI: Do not create new NUMA domains from ACPI static tables that are not SRAT Date: Sat, 18 Jul 2020 01:59:55 +0800 Message-ID: <20200717175959.899775-3-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20200717175959.899775-1-Jonathan.Cameron@huawei.com> References: <20200717175959.899775-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.123.41.22] X-ClientProxiedBy: lhreml706-chm.china.huawei.com (10.201.108.55) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Several ACPI static tables contain references to proximity domains. ACPI 6.3 has clarified that only entries in SRAT may define a new domain (sec 5.2.16). Those tables described in the ACPI spec have additional clarifying text. NFIT: Table 5-132, "Integer that represents the proximity domain to which the memory belongs. This number must match with corresponding entry in the SRAT table." HMAT: Table 5-145, "... This number must match with the corresponding entry in the SRAT table's processor affinity structure ... if the initiator is a processor, or the Generic Initiator Affinity Structure if the initiator is a generic initiator". IORT and DMAR are defined by external specifications. Intel Virtualization Technology for Directed I/O Rev 3.1 does not make any explicit statements, but the general SRAT statement above will still apply. https://software.intel.com/sites/default/files/managed/c5/15/vt-directed-io-spec.pdf IO Remapping Table, Platform Design Document rev D, also makes not explicit statement, but refers to ACPI SRAT table for more information and again the generic SRAT statement above applies. https://developer.arm.com/documentation/den0049/d/ In conclusion, any proximity domain specified in these tables, should be a reference to a proximity domain also found in SRAT, and they should not be able to instantiate a new domain. Hence we switch to pxm_to_node() which will only return existing nodes. Signed-off-by: Jonathan Cameron --- drivers/acpi/arm64/iort.c | 2 +- drivers/acpi/nfit/core.c | 3 +-- drivers/acpi/numa/hmat.c | 2 +- drivers/iommu/intel/dmar.c | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) -- 2.19.1 Reviewed-by: Barry Song diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c index 28a6b387e80e..eb0f158612c8 100644 --- a/drivers/acpi/arm64/iort.c +++ b/drivers/acpi/arm64/iort.c @@ -1293,7 +1293,7 @@ static int __init arm_smmu_v3_set_proximity(struct device *dev, smmu = (struct acpi_iort_smmu_v3 *)node->node_data; if (smmu->flags & ACPI_IORT_SMMU_V3_PXM_VALID) { - int dev_node = acpi_map_pxm_to_node(smmu->pxm); + int dev_node = pxm_to_node(smmu->pxm); if (dev_node != NUMA_NO_NODE && !node_online(dev_node)) return -EINVAL; diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c index 7c138a4edc03..d933a4636d00 100644 --- a/drivers/acpi/nfit/core.c +++ b/drivers/acpi/nfit/core.c @@ -2947,8 +2947,7 @@ static int acpi_nfit_register_region(struct acpi_nfit_desc *acpi_desc, if (spa->flags & ACPI_NFIT_PROXIMITY_VALID) { ndr_desc->numa_node = acpi_map_pxm_to_online_node( spa->proximity_domain); - ndr_desc->target_node = acpi_map_pxm_to_node( - spa->proximity_domain); + ndr_desc->target_node = pxm_to_node(spa->proximity_domain); } else { ndr_desc->numa_node = NUMA_NO_NODE; ndr_desc->target_node = NUMA_NO_NODE; diff --git a/drivers/acpi/numa/hmat.c b/drivers/acpi/numa/hmat.c index 2c32cfb72370..cf6df2df26cd 100644 --- a/drivers/acpi/numa/hmat.c +++ b/drivers/acpi/numa/hmat.c @@ -666,7 +666,7 @@ static void hmat_register_target_device(struct memory_target *target, pdev->dev.numa_node = acpi_map_pxm_to_online_node(target->memory_pxm); info = (struct memregion_info) { - .target_node = acpi_map_pxm_to_node(target->memory_pxm), + .target_node = pxm_to_node(target->memory_pxm), }; rc = platform_device_add_data(pdev, &info, sizeof(info)); if (rc < 0) { diff --git a/drivers/iommu/intel/dmar.c b/drivers/iommu/intel/dmar.c index 683b812c5c47..b1acdaead059 100644 --- a/drivers/iommu/intel/dmar.c +++ b/drivers/iommu/intel/dmar.c @@ -473,7 +473,7 @@ static int dmar_parse_one_rhsa(struct acpi_dmar_header *header, void *arg) rhsa = (struct acpi_dmar_rhsa *)header; for_each_drhd_unit(drhd) { if (drhd->reg_base_addr == rhsa->base_address) { - int node = acpi_map_pxm_to_node(rhsa->proximity_domain); + int node = pxm_to_node(rhsa->proximity_domain); if (!node_online(node)) node = NUMA_NO_NODE; From patchwork Fri Jul 17 17:59:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 235741 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp1926759ilg; Fri, 17 Jul 2020 11:02:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx7KpktCJt0VSdn5BwKY6wNoxMSNat2WuYV4yeEhrMRX2X/OtInX4fd8uSXr0psf81SSKRl X-Received: by 2002:a17:906:fad4:: with SMTP id lu20mr8157624ejb.1.1595008938808; Fri, 17 Jul 2020 11:02:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595008938; cv=none; d=google.com; s=arc-20160816; b=GtwHnbXBqjPQYLXCPmSYhCEDNOkGJm7Le//ubRvljz57YciLXy4/wqg/l68WeCC4Oe 1mTkwKPxg+2ZDBum53HshExdQTBAusC089kx2UxnXn6fJam+yVS1TtvkxZrLiWuCMK7o mXgVHKiaHr7nXEH4x8URfg18x8u2HBt5pP01eCF33olezfWD1gJITIagvslMhebLs5gs R5eJrgTVImrUCCSE2biguReU3xUMDSB0jmjp+ODyd0zgBfnGyHcJxLoPr+HM8/rFr+OE RbaAxgA9aCESHjYUnuzE7VhuxlawjAirCHdojRUcNL3KhIehXKTHTi/nQ1IxMs/AI+Cy hqSw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=BrWAtnfNJBvhRB5cPUV87sQZwtOYts5C+XH8xaiJdyQ=; b=bEqLs0ZQgkmaJcXb23jlOfAXPOMVKCBC1pFlOVyUUW+wmEumlSyKK2K/wE4KtR4g3e 317rCMnOW/7U/kTZBYKVHG2wR3vCihDJLwKw8GkfAdM5Jgfq1vmHpHPqabZgm9hx669j Pf8klaB0pXq/Ura01lmWqjgJJu/YReSoeK6pu/PaGMMhKtPEWdEOUPndmOy4VWk+GCvg GiagTxMnIFgvTuXdEqMwpcyetPnLIa9ugnYrxBihcPFBXj71g1tutNB9RQEOsiEkfBrY 8qZq0mxPASSPweMBOYi2bd7gR+PkhSSmlYxtcYa1TWd6cmO+vEYsVhQHLFcpjZPpH08w UtyA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-acpi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r12si5851190edo.320.2020.07.17.11.02.18; Fri, 17 Jul 2020 11:02:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-acpi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-acpi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728048AbgGQSCR (ORCPT + 7 others); Fri, 17 Jul 2020 14:02:17 -0400 Received: from lhrrgout.huawei.com ([185.176.76.210]:2500 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726232AbgGQSCR (ORCPT ); Fri, 17 Jul 2020 14:02:17 -0400 Received: from lhreml710-chm.china.huawei.com (unknown [172.18.7.106]) by Forcepoint Email with ESMTP id 102AE61B9167C6AA9A63; Fri, 17 Jul 2020 19:02:16 +0100 (IST) Received: from lhrphicprd00229.huawei.com (10.123.41.22) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1913.5; Fri, 17 Jul 2020 19:02:15 +0100 From: Jonathan Cameron To: , , , CC: Lorenzo Pieralisi , Bjorn Helgaas , , , Ingo Molnar , , Tony Luck , Fenghua Yu , Thomas Gleixner , , Dan Williams , Song Bao Hua , Jonathan Cameron Subject: [PATCH v2 3/6] ACPI: Remove side effect of partly creating a node in acpi_map_pxm_to_online_node Date: Sat, 18 Jul 2020 01:59:56 +0800 Message-ID: <20200717175959.899775-4-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20200717175959.899775-1-Jonathan.Cameron@huawei.com> References: <20200717175959.899775-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.123.41.22] X-ClientProxiedBy: lhreml706-chm.china.huawei.com (10.201.108.55) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Whilst this function will only return an online node, it can have the side effect of partially creating a new node. The existing comments suggest this is intentional, but the usecases of this function are related to NFIT and HMAT parsing, neither of which should be able to define new nodes. One route by which the existing behaviour would cause a crash is to have a _PXM entry in ACPI DSDT attempt to place a device within this partly created proximity domain. A subsequent call to devm_kzalloc or similar would result in an attempt to allocate memory on a node for which zone lists have not been set up and a null pointer dereference. We prevent such cases by switching to pxm_to_node() within acpi_map_pxm_to_online_node which cannot cause a new node to be partly created. If one would previously have been created we now return NO_NUMA_NODE. Documentation updated to reflect this change. We may want to think about renaming acpi_map_pxm_to_online_node to pxm_to_online_node to reflect this change. Signed-off-by: Jonathan Cameron --- include/linux/acpi.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) -- 2.19.1 diff --git a/include/linux/acpi.h b/include/linux/acpi.h index d661cd0ee64d..b541a0b444fd 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -430,13 +430,12 @@ int acpi_get_node(acpi_handle handle); * ACPI device drivers, which are called after the NUMA initialization has * completed in the kernel, can call this interface to obtain their device * NUMA topology from ACPI tables. Such drivers do not have to deal with - * offline nodes. A node may be offline when a device proximity ID is - * unique, SRAT memory entry does not exist, or NUMA is disabled, ex. - * "numa=off" on x86. + * offline nodes. A node may be offline when SRAT memory entry does not exist, + * or NUMA is disabled, ex. "numa=off" on x86. */ static inline int acpi_map_pxm_to_online_node(int pxm) { - int node = acpi_map_pxm_to_node(pxm); + int node = pxm_to_node(pxm); return numa_map_to_online_node(node); } From patchwork Fri Jul 17 17:59:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 235742 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp1927250ilg; Fri, 17 Jul 2020 11:02:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxewqVgoMdg5c5vZ8RiYh98LMLKT9Hkw/ILfLqP2KztD9+128NCrZrhZdOuwfZO+Df/qnyS X-Received: by 2002:a50:d09c:: with SMTP id v28mr10468651edd.58.1595008968581; Fri, 17 Jul 2020 11:02:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595008968; cv=none; d=google.com; s=arc-20160816; b=j3NXOgsvxBPf8qXtJFbnxydolH+BYm1NUvWDqm5x4mlukq87T48ivMdX+KN9DeNx11 t7xqHqVwQCMgcssu4dnhtymEPdBpOEvvl+I+GPhH498CR5sM02KiL+XlLwb0lteHAvUz wunAwm258hEeWth0qq4ynAuNgeXAsG7QPIJ6mJTsi92DvRyhgZufcxMX0UmMtzECRy9P tYqQRi8XiNMoWERLBYX4riCLKClJkIRSTti++AMWbx9fqYKCZiSti0jkRqVOeWi5qGL1 fEcTrprjATzNIGxzWdXElZEq1VgH/kF/jPxw7iRxhsLx6GtcRrN2gAsB0vPD5qtMMWE8 CEXA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=1OZ15YBeNKZbA8HXpqiStGSdggyUrdIBq5rTpeJt0zs=; b=a/lWm+Rnc15yAuNafkRdEGnnRI+GT9Vtzrrq5+ggv7r1qP+rBQUyERktLw/GBGN2Ur aZO8P+bbkjKhO7bhXdQmnnGs3RnVbi/FRMNjI4Koq1l0Uc/5Xdq6XiQPSCQcUNSR5lD2 qqHP9WK1Cr3ActMQi20NWijwH9v9MBm8yldKUrxZJKgm8xOyuzSEr+ZNhpxmW9LoNu7u YP9hHD5tKA0tWoAumuIOaFkuY42pxoE5IiVYZDCmpK4eYTWC2vW/Pc4JrbRO82RacDwW 16LN4GwAKWnpb+fVewpzVOCavOSyzXlGPx8wiL8LZ8HdEABLGs68tmAsT7IzDzB3aB4K a1bg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-acpi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lz15si5538102ejb.406.2020.07.17.11.02.48; Fri, 17 Jul 2020 11:02:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-acpi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-acpi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726411AbgGQSCr (ORCPT + 7 others); Fri, 17 Jul 2020 14:02:47 -0400 Received: from lhrrgout.huawei.com ([185.176.76.210]:2501 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726322AbgGQSCr (ORCPT ); Fri, 17 Jul 2020 14:02:47 -0400 Received: from lhreml710-chm.china.huawei.com (unknown [172.18.7.106]) by Forcepoint Email with ESMTP id 4C0EE5B98F26BD47694C; Fri, 17 Jul 2020 19:02:46 +0100 (IST) Received: from lhrphicprd00229.huawei.com (10.123.41.22) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1913.5; Fri, 17 Jul 2020 19:02:46 +0100 From: Jonathan Cameron To: , , , CC: Lorenzo Pieralisi , Bjorn Helgaas , , , Ingo Molnar , , Tony Luck , Fenghua Yu , Thomas Gleixner , , Dan Williams , Song Bao Hua , Jonathan Cameron Subject: [PATCH v2 4/6] ACPI: Rename acpi_map_pxm_to_online_node to pxm_to_online_node Date: Sat, 18 Jul 2020 01:59:57 +0800 Message-ID: <20200717175959.899775-5-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20200717175959.899775-1-Jonathan.Cameron@huawei.com> References: <20200717175959.899775-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.123.41.22] X-ClientProxiedBy: lhreml706-chm.china.huawei.com (10.201.108.55) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org As this function is no longer allowed to create new mappings let us rename it to reflect this. Note all nodes should already exist before any of the users of this function are called. Signed-off-by: Jonathan Cameron --- drivers/acpi/nfit/core.c | 3 +-- drivers/acpi/numa/hmat.c | 2 +- include/linux/acpi.h | 8 ++++---- 3 files changed, 6 insertions(+), 7 deletions(-) -- 2.19.1 diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c index d933a4636d00..d4ba2eb21ce0 100644 --- a/drivers/acpi/nfit/core.c +++ b/drivers/acpi/nfit/core.c @@ -2945,8 +2945,7 @@ static int acpi_nfit_register_region(struct acpi_nfit_desc *acpi_desc, ndr_desc->provider_data = nfit_spa; ndr_desc->attr_groups = acpi_nfit_region_attribute_groups; if (spa->flags & ACPI_NFIT_PROXIMITY_VALID) { - ndr_desc->numa_node = acpi_map_pxm_to_online_node( - spa->proximity_domain); + ndr_desc->numa_node = pxm_to_online_node(spa->proximity_domain); ndr_desc->target_node = pxm_to_node(spa->proximity_domain); } else { ndr_desc->numa_node = NUMA_NO_NODE; diff --git a/drivers/acpi/numa/hmat.c b/drivers/acpi/numa/hmat.c index cf6df2df26cd..e7add2609c03 100644 --- a/drivers/acpi/numa/hmat.c +++ b/drivers/acpi/numa/hmat.c @@ -664,7 +664,7 @@ static void hmat_register_target_device(struct memory_target *target, goto out_pdev; } - pdev->dev.numa_node = acpi_map_pxm_to_online_node(target->memory_pxm); + pdev->dev.numa_node = pxm_to_online_node(target->memory_pxm); info = (struct memregion_info) { .target_node = pxm_to_node(target->memory_pxm), }; diff --git a/include/linux/acpi.h b/include/linux/acpi.h index b541a0b444fd..a56386fd98a8 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -420,10 +420,10 @@ int acpi_map_pxm_to_node(int pxm); int acpi_get_node(acpi_handle handle); /** - * acpi_map_pxm_to_online_node - Map proximity ID to online node + * pxm_to_online_node - Map proximity ID to online node * @pxm: ACPI proximity ID * - * This is similar to acpi_map_pxm_to_node(), but always returns an online + * This is similar to pxm_to_node(), but always returns an online * node. When the mapped node from a given proximity ID is offline, it * looks up the node distance table and returns the nearest online node. * @@ -433,14 +433,14 @@ int acpi_get_node(acpi_handle handle); * offline nodes. A node may be offline when SRAT memory entry does not exist, * or NUMA is disabled, ex. "numa=off" on x86. */ -static inline int acpi_map_pxm_to_online_node(int pxm) +static inline int pxm_to_online_node(int pxm) { int node = pxm_to_node(pxm); return numa_map_to_online_node(node); } #else -static inline int acpi_map_pxm_to_online_node(int pxm) +static inline int pxm_to_online_node(int pxm) { return 0; } From patchwork Fri Jul 17 17:59:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 235743 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp1927742ilg; Fri, 17 Jul 2020 11:03:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyb8HjoAX/fYCc16nuGL/6d4PadPleu15+wCp+h/oz/yABpa6R4Au6OrB8C681gIEMJEG5P X-Received: by 2002:a50:cf43:: with SMTP id d3mr10846084edk.40.1595008998868; Fri, 17 Jul 2020 11:03:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595008998; cv=none; d=google.com; s=arc-20160816; b=ztMtUAPL+CgoIxSGf5+7R10K6LL2zoDU2txtpa+8zh9SEVTc902h44SI0uGSOpKTHD r/tfyqTmx5dwaudBYu3YRc+qG3/OoZCqABtNcWL74AYiIjBtMMfVCwfoAFuWhomqdxaH Gx/FMmFDyxj0gmTgKlP2WaZ+QvwlODfv0VNJp9b09E+i74a1hYiFcogmEPRBzReHWaG5 Ei/vq52drmFFyA1FAJWtD2DMBZaDCeSGoju+Sh46AOvoCB893pqg6kcpjcpL0m7UD4w6 XLbcPw+9gKDu/bwyYEmvRJnOtKfUXZn6Q8C0QoPorJOznqOu2bJcH/3JWIwn90K1iKg7 Qj3A== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=jY1uTZvL3SDwUlJr38aN0Zxhm4r7MCsYMA7iNoJumnw=; b=bKm4XS4RjpZDoVoLM5zDVUzV6D3RoNKAQTdYHTV1bWjrAFGxnkDqrZ5p3oswu8fM2N 2Wy3fz8IZIKJznz23qFIm5w4LODQTtaxr+cxwEL6ZaweWQNKIfNEZOAkVQehi9xG5OAM SqsTnDX6a8suLRxi6iApsgySX7HMShbtPgkHLr9lRrWsu9cbJ/2iJiAp4KNj6Fi6DMjW VLKjSMZRG15TVVwAQmdWXsGb9s/qeLBSbtq9fUkwwM4u6Hdy01jd8PbeyWEkHo5SNSSb oocGRaFKmK6BLVPOLCf5u0a4oGs21NKRnhF9zoqW0rY8Lg3wN6FEu7zl40Yqagh+SZf4 Givg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-acpi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lz15si5538102ejb.406.2020.07.17.11.03.18; Fri, 17 Jul 2020 11:03:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-acpi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-acpi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728149AbgGQSDS (ORCPT + 7 others); Fri, 17 Jul 2020 14:03:18 -0400 Received: from lhrrgout.huawei.com ([185.176.76.210]:2502 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726322AbgGQSDR (ORCPT ); Fri, 17 Jul 2020 14:03:17 -0400 Received: from lhreml710-chm.china.huawei.com (unknown [172.18.7.108]) by Forcepoint Email with ESMTP id 8236EA905E323B03CF6B; Fri, 17 Jul 2020 19:03:16 +0100 (IST) Received: from lhrphicprd00229.huawei.com (10.123.41.22) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1913.5; Fri, 17 Jul 2020 19:03:16 +0100 From: Jonathan Cameron To: , , , CC: Lorenzo Pieralisi , Bjorn Helgaas , , , Ingo Molnar , , Tony Luck , Fenghua Yu , Thomas Gleixner , , Dan Williams , Song Bao Hua , Jonathan Cameron Subject: [PATCH v2 5/6] ACPI: Remove side effect of partly creating a node in acpi_get_node Date: Sat, 18 Jul 2020 01:59:58 +0800 Message-ID: <20200717175959.899775-6-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20200717175959.899775-1-Jonathan.Cameron@huawei.com> References: <20200717175959.899775-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.123.41.22] X-ClientProxiedBy: lhreml706-chm.china.huawei.com (10.201.108.55) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org acpi_get_node calls acpi_get_pxm to evaluate the _PXM AML method for entries found in DSDT/SSDT. ACPI 6.3 sec 6.2.14 states "_PXM evaluates to an integer that identifies a device as belonging to a Proximity Domain defined in the System Resource Affinity Table (SRAT)." Hence a _PXM method should not result in creation of a new NUMA node. Before this patch, _PXM could result in partial instantiation of NUMA node, missing elements such as zone lists. A call to devm_kzalloc for example results in a null pointer dereference. This patch therefore replaces the acpi_map_pxm_to_node with a call to pxm_to_node. Signed-off-by: Jonathan Cameron --- drivers/acpi/numa/srat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.19.1 Reviewed-by: Barry Song diff --git a/drivers/acpi/numa/srat.c b/drivers/acpi/numa/srat.c index 8ef44ee0d76b..697a5c9e2eb5 100644 --- a/drivers/acpi/numa/srat.c +++ b/drivers/acpi/numa/srat.c @@ -444,6 +444,6 @@ int acpi_get_node(acpi_handle handle) pxm = acpi_get_pxm(handle); - return acpi_map_pxm_to_node(pxm); + return pxm_to_node(pxm); } EXPORT_SYMBOL(acpi_get_node); From patchwork Fri Jul 17 17:59:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 235744 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp1928246ilg; Fri, 17 Jul 2020 11:03:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxYemAqfR95aT+MDE64/9yh1tk7rA99XUvHt7kC/Q92UyOcKqmogzlLh32ZLeVd/EOUmfM0 X-Received: by 2002:aa7:d814:: with SMTP id v20mr10421642edq.296.1595009029302; Fri, 17 Jul 2020 11:03:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595009029; cv=none; d=google.com; s=arc-20160816; b=Sr63KEytyn1CaU2AvKZODuWQxZe63GmEY6Aa4u1lNZJAfIVVSqc5t32BQYZnnrykSM Pjpo3urmjBUGjeEjZcbXxdUqS0lPoiCaPNaugTTcODmCJdsuEMdUL2HLsGsx8V4zWb6q RoF0b5ZP8sYLbJhMEVe9apWOnyq2s6W5c1ME0SwYI1ldVFiU+RYGpLX3xKchRkPYcsg8 k5Zb7ThApgV5+JVjBbJYg2c/tB81YCImhw2Ob3NyA6FJCxcHmlZ1ovsRQ0X4VG7lOsrG tDZy0ZXeN5zh9khZhEke5nhE4T8SCJRZvSCRcZZ8TtPMX9aRgzsJQrIlCxzslgULyc7S Kqow== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=slSNqozzYlxnFMwWUQhHExotzCJSBovPo0SgCzsdQ4Q=; b=gw7a46IANCCF5LmcqHNaOz/LI2uuZcCmd3czPGf3buAERB8g8+6/wQsvqJYAv7wULP 4xJRaHhtXYOJckjyPvPbSUtc8yRZVWmpx/VyDb06MJOyZm3ZKS0b5M8EeIAN+yJrcbUY 7z/MiUoRxqyjpRNNgMmkVjr2VkQ50oHNUhFo/XRB+i+iBq3Zj8m5egui8fG4LdJ5fG2I ajFfilV0z1Qp66Fr3gERly6zidDm3Omm3WwOnMR4V7j4qxW66okXfKESe+qU2ZDtX9dN oTISTAdnGEMxW7ZDMaYIvNyYOiOMPtNOTLjfiZqfd3q8uJl3q/vGc9QoUOqJBE2s5Jtz nVGw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-acpi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i25si5851231edr.503.2020.07.17.11.03.49; Fri, 17 Jul 2020 11:03:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-acpi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-acpi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726670AbgGQSDs (ORCPT + 7 others); Fri, 17 Jul 2020 14:03:48 -0400 Received: from lhrrgout.huawei.com ([185.176.76.210]:2503 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727903AbgGQSDs (ORCPT ); Fri, 17 Jul 2020 14:03:48 -0400 Received: from lhreml710-chm.china.huawei.com (unknown [172.18.7.107]) by Forcepoint Email with ESMTP id BB0A8F4BF11DF7754B29; Fri, 17 Jul 2020 19:03:46 +0100 (IST) Received: from lhrphicprd00229.huawei.com (10.123.41.22) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1913.5; Fri, 17 Jul 2020 19:03:46 +0100 From: Jonathan Cameron To: , , , CC: Lorenzo Pieralisi , Bjorn Helgaas , , , Ingo Molnar , , Tony Luck , Fenghua Yu , Thomas Gleixner , , Dan Williams , Song Bao Hua , Jonathan Cameron Subject: [PATCH v2 6/6] irq-chip/gic-v3-its: Fix crash if ITS is in a proximity domain without processor or memory Date: Sat, 18 Jul 2020 01:59:59 +0800 Message-ID: <20200717175959.899775-7-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20200717175959.899775-1-Jonathan.Cameron@huawei.com> References: <20200717175959.899775-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.123.41.22] X-ClientProxiedBy: lhreml706-chm.china.huawei.com (10.201.108.55) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Note this crash is present before any of the patches in this series, but as explained below it is highly unlikely anyone is shipping a firmware that causes it. Tests were done using an overriden SRAT. On ARM64, the gic-v3 driver directly parses SRAT to locate GIC Interrupt Translation Service (ITS) Affinity Structures. This is done much later in the boot than the parses of SRAT which identify proximity domains. As a result, an ITS placed in a proximity domain that is not defined by another SRAT structure will result in a NUMA node that is not completely configured and a crash. ITS [mem 0x202100000-0x20211ffff] ITS@0x0000000202100000: Using ITS number 0 Unable to handle kernel paging request at virtual address 0000000000001a08 ... Call trace: __alloc_pages_nodemask+0xe8/0x338 alloc_pages_node.constprop.0+0x34/0x40 its_probe_one+0x2f8/0xb18 gic_acpi_parse_madt_its+0x108/0x150 acpi_table_parse_entries_array+0x17c/0x264 acpi_table_parse_entries+0x48/0x6c acpi_table_parse_madt+0x30/0x3c its_init+0x1c4/0x644 gic_init_bases+0x4b8/0x4ec gic_acpi_init+0x134/0x264 acpi_match_madt+0x4c/0x84 acpi_table_parse_entries_array+0x17c/0x264 acpi_table_parse_entries+0x48/0x6c acpi_table_parse_madt+0x30/0x3c __acpi_probe_device_table+0x8c/0xe8 irqchip_init+0x3c/0x48 init_IRQ+0xcc/0x100 start_kernel+0x33c/0x548 ACPI 6.3 allows any set of Affinity Structures in SRAT to define a proximity domain. However, as we do not see this crash, we can conclude that no firmware is currently placing an ITS in a node that is separate from those containing memory and / or processors. We could modify the SRAT parsing behavior to identify the existence of Proximity Domains unique to the ITS structures, and handle them as a special case of a generic initiator (once support for those merges). This patch avoids the complexity that would be needed to handle this corner case, by not allowing the ITS entry parsing code to instantiate new NUMA Nodes. If one is encountered that does not already exist, then NO_NUMA_NODE is assigned and a warning printed just as if the value had been greater than allowed NUMA Nodes. "SRAT: Invalid NUMA node -1 in ITS affinity" Whilst this does not provide the full flexibility allowed by ACPI, it does fix the problem. We can revisit a more sophisticated solution if needed by future platforms. Change is simply to replace acpi_map_pxm_to_node with pxm_to_node reflecting the fact a new mapping is not created. Signed-off-by: Jonathan Cameron --- drivers/irqchip/irq-gic-v3-its.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) -- 2.19.1 diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index 6a5a87fc4601..c26862a074da 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -5248,7 +5248,12 @@ static int __init gic_acpi_parse_srat_its(union acpi_subtable_headers *header, return -EINVAL; } - node = acpi_map_pxm_to_node(its_affinity->proximity_domain); + /* + * Note that in theory a new proximity node could be created by this + * entry as it is an SRAT resource allocation structure. + * We do not currently support doing so. + */ + node = pxm_to_node(its_affinity->proximity_domain); if (node == NUMA_NO_NODE || node >= MAX_NUMNODES) { pr_err("SRAT: Invalid NUMA node %d in ITS affinity\n", node);