From patchwork Tue Aug 18 14:24:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 247891 Delivered-To: patch@linaro.org Received: by 2002:a54:3b12:0:0:0:0:0 with SMTP id j18csp3177578ect; Tue, 18 Aug 2020 07:25:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxk+UN3AaRWIbmsGLSstyG/oymfO8jacll9qgYN6c+vr8HWnYirL/b5sW2gfjPp5vhGYDHU X-Received: by 2002:aa7:cccb:: with SMTP id y11mr11043295edt.15.1597760748804; Tue, 18 Aug 2020 07:25:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597760748; cv=none; d=google.com; s=arc-20160816; b=caDu7MAxMhFGrKh0Pit0pNhWw+HydfrUgRlEnYnnaoaJF9GKF1xsNjEOnQr6eTvXzm WXoVPCG4J/g3eCDcwVAmaFg4wacqmuZQQflBe2xOk3Jc94Qd1hUWLzo/8VvCGZgDY+Pq WcrVzkqAL5AAp9zY9QLctxVEE2q8dWUp94vvxoQxWaEY8UimYxFIHIA8n0jbXVSGQI+D QVhNFLHBtL7iUaVHDEnNTKB+rVbZQWfcm9gElylLsBPY0TfMI1JSumWPqHI6aDB7nvqM r1J7gljAQSpH4U4d/qMXJNe7vOG/Qnf994oCd+6aPleGIfy+VB+danrhLTPn/g7wZgbG A7qQ== 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=nu3pb3gTBHTvnW4SDEYq0nEruLNXGVc3G9T9yz/AQ10=; b=fC72S0wIAPMbu6mG6/aI+JJeFRtr/anOY7KQB/9xR0GcAx/EpN5prcJlM3VNJUpnq3 ZLRjnCsEGHlSLLNFvjtZPGeXVpIYs2XqRO4TANLuNHSZsn93xSAMVFMoIbkMwkMRNGqd 9TqK2UJVDZZl76DyxXF3bezIgPMG/KoDXhGL0L6sOTwXBG2u5CmRUfE80BgjT93RHk+U kfvBGb37Q2/hDv8WPmk5VWP8EHv1BBg6l9CYqTG9blCysMMbv0tY0ZoeyU/l0J/LKJ32 caEr9FSp1a9ERa+eTxEVhyH4fg4vs9QKBIX3NHWIreIsvvW4ooUc29Re5L//vcxvmkdq U3Eg== 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 r8si5318233ejr.677.2020.08.18.07.25.48; Tue, 18 Aug 2020 07:25: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 S1726569AbgHROZp (ORCPT + 7 others); Tue, 18 Aug 2020 10:25:45 -0400 Received: from lhrrgout.huawei.com ([185.176.76.210]:2617 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726747AbgHROZh (ORCPT ); Tue, 18 Aug 2020 10:25:37 -0400 Received: from lhreml710-chm.china.huawei.com (unknown [172.18.7.108]) by Forcepoint Email with ESMTP id 916AF35EF72127693B1B; Tue, 18 Aug 2020 15:25:35 +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_GCM_SHA256) id 15.1.1913.5; Tue, 18 Aug 2020 15:25:35 +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 v3 1/6] ACPI: Add out of bounds and numa_off protections to pxm_to_node Date: Tue, 18 Aug 2020 22:24:25 +0800 Message-ID: <20200818142430.1156547-2-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20200818142430.1156547-1-Jonathan.Cameron@huawei.com> References: <20200818142430.1156547-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.123.41.22] X-ClientProxiedBy: lhreml710-chm.china.huawei.com (10.201.108.61) 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 Reviewed-by: Barry Song Reviewed-by: Hanjun Guo --- drivers/acpi/numa/srat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.19.1 diff --git a/drivers/acpi/numa/srat.c b/drivers/acpi/numa/srat.c index 15bbaab8500b..1fb486f46ee2 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 Tue Aug 18 14:24:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 247892 Delivered-To: patch@linaro.org Received: by 2002:a54:3b12:0:0:0:0:0 with SMTP id j18csp3177955ect; Tue, 18 Aug 2020 07:26:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw1yIbKi86/gb2MxB0AKCatZEZL5W6GP+DdVvEimwXM2jYMhHGfpSUHZ2J2hMxQWx/rDE/X X-Received: by 2002:a17:906:c143:: with SMTP id dp3mr20006721ejc.504.1597760783370; Tue, 18 Aug 2020 07:26:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597760783; cv=none; d=google.com; s=arc-20160816; b=p2g4yB0PyxAeTg61bDmxHqs3R8uvGGXeKlKdNRloOsyz2OOD2/6yn/VF+30qGpdbt0 fnV+/iqkJPU34N2o/M4CZ730rjOiUbJVaF4c9AbreRMHePOx1Ti7zxkq0AixlXnDqbxy 2G1wcV32DxPPfx9gB2W1ITvUPNaBa6X+zM35mKT6IFEu0q1IiV60/nTR/A/5jvuZFWEh 5TOOAuVGK0jFf0tf+w4TFdptlnPTMOCV30xr3QY9LOzChKcYGrgrUlEKvtrOYcPXi/Cl oEtCCJ4Sbz+05NkDZpfgB9LI37UbtkS5q9LgxII0A897RrUJcx8AwcgiHBM3GQlHhhbg /Llg== 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=HHKb4KD8XrTyfaqrZpNeO8sVUSaJ2cxtb8GqKKG6YPE=; b=Pqkn9ZdcigBPetFv2+fkAyIJ7cGBAK2pxpbfoyCDd4KU4kt3Vk2zyU2QoWdMnZN5JB MRA9JfZ78c5MSb97lbkjvQFokI0q2xEbbNE/qsbxAm9HbsZM7S/iBVTkW8fraecIp54T QlTd20sUXoQGe2YsyT1uuOKpvl86dGQPVUlzP49WGzQLh0FVo1ELodkC8DgwlKCI2iB4 U0HLV+3qUUVP1u1A2Z+0F7tY0ts3p7qRHe0srXsN7MGLKaZv4wO28ALObm2hxsmsJwGq 9Yfy/YSjHIuXLekAmoU6m5VBO4LbnY/PPq3AJU5ghQMNaQoau6tlkZYwkzZWveDu0jF7 wfPw== 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 dd10si1385168ejb.100.2020.08.18.07.26.23; Tue, 18 Aug 2020 07:26:23 -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 S1726904AbgHRO0V (ORCPT + 7 others); Tue, 18 Aug 2020 10:26:21 -0400 Received: from lhrrgout.huawei.com ([185.176.76.210]:2618 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727023AbgHRO0H (ORCPT ); Tue, 18 Aug 2020 10:26:07 -0400 Received: from lhreml710-chm.china.huawei.com (unknown [172.18.7.107]) by Forcepoint Email with ESMTP id 54371C421462139A9821; Tue, 18 Aug 2020 15:26:06 +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_GCM_SHA256) id 15.1.1913.5; Tue, 18 Aug 2020 15:26:06 +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 v3 2/6] ACPI: Do not create new NUMA domains from ACPI static tables that are not SRAT Date: Tue, 18 Aug 2020 22:24:26 +0800 Message-ID: <20200818142430.1156547-3-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20200818142430.1156547-1-Jonathan.Cameron@huawei.com> References: <20200818142430.1156547-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.123.41.22] X-ClientProxiedBy: lhreml710-chm.china.huawei.com (10.201.108.61) 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 Reviewed-by: Barry Song Reviewed-by: Hanjun Guo --- 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 diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c index ec782e4a0fe4..26005a15cb8b 100644 --- a/drivers/acpi/arm64/iort.c +++ b/drivers/acpi/arm64/iort.c @@ -1335,7 +1335,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 26dd208a0d63..ea0557cb54f7 100644 --- a/drivers/acpi/nfit/core.c +++ b/drivers/acpi/nfit/core.c @@ -3008,8 +3008,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 93e6345f3414..2f3badd41e1b 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 Tue Aug 18 14:24:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 247893 Delivered-To: patch@linaro.org Received: by 2002:a54:3b12:0:0:0:0:0 with SMTP id j18csp3178155ect; Tue, 18 Aug 2020 07:26:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzskd1uvJW4LX86rCWAzY2ifIAfI0KELwbHkjv1B8NzCWcEY05Rpzt7jT8hYZBSS3lnbpf8 X-Received: by 2002:aa7:d304:: with SMTP id p4mr19277085edq.267.1597760802850; Tue, 18 Aug 2020 07:26:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597760802; cv=none; d=google.com; s=arc-20160816; b=mpD76rVrQpYcQmJJeCy1OJaCUsdn3Ttquso9TSaj68pzVs+ijqu5Evkub3v4misfKe zGA+JDiHf/MTs/pYu6m+XUED+ng4WGppy5m2/sT+Yj9wYWYpkxSvbVgX8UtsJ3Q1r/f0 S4tAVYq395oJkKC0Qe6dh5+KB8qEuooV5Ujpesi1maNwhQjtSqjVbNnUSMJ0TkLiZY0L S0fMZA+mbrnzyNEMvxfrmil5tu3Xd8D4jM84z/SGyV/EZuJufEANv45mGAp1yrF7srAO XtOJLpcTaxDq01LBqUvBZIvJOnx+wsx4GvOQ4CN/vfoVIpu6zuA7ixOyWQudRIAfAhlq XA7w== 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=7v3PNtVno2MNybT4a0JwwTABnjpGc29+Z6MYrJ6m89I=; b=mex4pHggTrcxkftSfjV/lez/r3NUjv95L0apwy+I8nkTR/pxXKFZodxtJFVj/l2sWU ZgapMLIXowhOyA45/wXhN3Di5Lhuesh1xycAnnkbvlbqmcgB+MbCsG769KjTlvw/d9dw Xvu5jYHj/MWbStANejXcie2dAo7oGBY2a/F/VEK9f/rhEVDoWEABcjM4c4vwwmV8oqk4 xmkeBoovZphdnBxmgn1FHBWZrMEe4w6P/AwBBGC3IlnjQdjxMFFKVWqCsQ3k4QfqUjE1 2oQQ4OZw3UyIPVKPOUqt8rK4g2jyuaiWBtWdiXlpdFpQVFiPOXXOv6iCFpeEQ+dEpgOc sk2A== 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 gr23si13682989ejb.132.2020.08.18.07.26.42; Tue, 18 Aug 2020 07:26:42 -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 S1726989AbgHRO0k (ORCPT + 7 others); Tue, 18 Aug 2020 10:26:40 -0400 Received: from lhrrgout.huawei.com ([185.176.76.210]:2619 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726709AbgHRO0i (ORCPT ); Tue, 18 Aug 2020 10:26:38 -0400 Received: from lhreml710-chm.china.huawei.com (unknown [172.18.7.107]) by Forcepoint Email with ESMTP id 09C4E3BA7355E06700CE; Tue, 18 Aug 2020 15:26:37 +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_GCM_SHA256) id 15.1.1913.5; Tue, 18 Aug 2020 15:26:36 +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 v3 3/6] ACPI: Remove side effect of partly creating a node in acpi_map_pxm_to_online_node Date: Tue, 18 Aug 2020 22:24:27 +0800 Message-ID: <20200818142430.1156547-4-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20200818142430.1156547-1-Jonathan.Cameron@huawei.com> References: <20200818142430.1156547-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.123.41.22] X-ClientProxiedBy: lhreml710-chm.china.huawei.com (10.201.108.61) 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 Reviewed-by: Hanjun Guo --- 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 1e4cdc6c7ae2..a9fd122ae878 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 Tue Aug 18 14:24:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 247894 Delivered-To: patch@linaro.org Received: by 2002:a54:3b12:0:0:0:0:0 with SMTP id j18csp3178486ect; Tue, 18 Aug 2020 07:27:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxJuq7taGCbEGjEhhrllvo1JNi6WxxLysMt87oVgepf1PG946JlaDRREiKGOzTLPfpFpleu X-Received: by 2002:a05:6402:1a26:: with SMTP id be6mr19882119edb.162.1597760834006; Tue, 18 Aug 2020 07:27:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597760834; cv=none; d=google.com; s=arc-20160816; b=mjQLORdXXgzscD9i0hpEtqWp/3VJ247zM3fnIiU+p+kKfpinVWlKupqDTlFgxN4xHp JJdJpBveaW5AX9e69uepLv5YRClG6sQMaU+5zSXJY0xSI44KIUTAN6CysBrooX2mD9tA NcOKq9uL0JBfa+0UoGl3DI1RgOwqtwWJ6EwdeQJHlWTKL/C23fNxGRc9B/nO+GxLD5eZ no4DzIlwkb14JdCwTrrbxLk91z2dPxDuaZ21eGfOCxh9UpKeahEPBrZu4nugFFFT0O/u nF1NFzrQO2WbsraIWJtMxzU9NQLkykX9OzU3LCldStMuxa+68JuyPaoTx2ZHCCSokVnO fkJw== 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=PuWgEOdbtGo4yQPNGw3pMhAirFWsbe0V0E37T1M7siQ=; b=wAQTGkN04VNl9bC0DZAWP3kIYlcSBFYtDSLAXArEtNC9HL4wILZVXLWeVXaNGHiZWx qW7f7is3dYrvzRdwTAvxTyqki+mBpal1mafi3yTmdfsaF7fsPzGhP4PRoUQy6ttDzEJm sdm7A4SR/UyUA5MY8Xeh2gOP8xjWn5Hg+0SnzUxjCeyo7RptTvsADR4O3mnqA+Kg5QwA xOr0y5NvxvhKXYDtfit9O69lRcodlmB7Q32GHoj/dGP+e+5+UNSHGf/u6UFBb/42jGnk c8TE8ECz/r9vzN7Bc5DSLwG2Qx2Z10Or9uRUlwu0AvuSi3tleIEkYW4c2dhqU0lLO3JJ jAHQ== 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 h7si13339651ejx.254.2020.08.18.07.27.13; Tue, 18 Aug 2020 07:27:13 -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 S1726709AbgHRO1M (ORCPT + 7 others); Tue, 18 Aug 2020 10:27:12 -0400 Received: from lhrrgout.huawei.com ([185.176.76.210]:2620 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726879AbgHRO1I (ORCPT ); Tue, 18 Aug 2020 10:27:08 -0400 Received: from lhreml710-chm.china.huawei.com (unknown [172.18.7.108]) by Forcepoint Email with ESMTP id 7D89130D0973BBB003B5; Tue, 18 Aug 2020 15:27:07 +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_GCM_SHA256) id 15.1.1913.5; Tue, 18 Aug 2020 15:27:07 +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 v3 4/6] ACPI: Rename acpi_map_pxm_to_online_node to pxm_to_online_node Date: Tue, 18 Aug 2020 22:24:28 +0800 Message-ID: <20200818142430.1156547-5-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20200818142430.1156547-1-Jonathan.Cameron@huawei.com> References: <20200818142430.1156547-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.123.41.22] X-ClientProxiedBy: lhreml710-chm.china.huawei.com (10.201.108.61) 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 Reviewed-by: Hanjun Guo --- 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 ea0557cb54f7..8df2f16d1fdf 100644 --- a/drivers/acpi/nfit/core.c +++ b/drivers/acpi/nfit/core.c @@ -3006,8 +3006,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 a9fd122ae878..e9f6cd67943e 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 Tue Aug 18 14:24:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 247895 Delivered-To: patch@linaro.org Received: by 2002:a54:3b12:0:0:0:0:0 with SMTP id j18csp3178771ect; Tue, 18 Aug 2020 07:27:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyOOdtuOug3ZQjxWo8s4y2nJ5Fbkl2tTaON9kTa7gWY7FPQzuUCJ15wdHB5x0Rbf7bBV8Rn X-Received: by 2002:a17:906:5ad8:: with SMTP id x24mr19513848ejs.329.1597760860339; Tue, 18 Aug 2020 07:27:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597760860; cv=none; d=google.com; s=arc-20160816; b=u1EWFSmiOJLnU9AAJaMsp43Sh9toPwsDu7n4xS8l4b4IXFLsWGyV/UHUlnZ9B8JxwD RIiAefUx0A1MUVBoq/WJM4M2hwaR3Zn/5e+d72qjEFRIrpP1I+b7kzHCuPbh5U/ZWfQS MmrGfzCS+VpD9x2NNwUmi9Ca/iYeYZsL3BKFy49gHGWRVzcO9plNwhKlAqrMdij5AAB4 FmHY3TbPtO54XzCVEr4UjpnhBtxSb1sm7bCEAr1ai1XfOOejkJHqo9FrukinBoKXaRlV i77sebw50DUgDa5AZM/1JzjMM4IdBjSDiXssCpBs8+aRbKyxCLAXhX1yJwxciQK/miE+ CJOQ== 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=7nwlFLLZmX874SgDqLUCOBl4TN83PVMhh6CUaw50TM0=; b=BK7DCuUggpRacd/hI8qdTBDEjhF7xG+Yw6XOePNaT00KVHOi45n8t0YKdznZpmpn6Y WCeD07dxUhruunSqP5bZdL6B6+e8CEoye88pNtvN0Pzt8EFcjBO9CAYYsfbhWNeaEKEt Kz4+OUkamI9ui+CMyu5GxS+yJz1iyQ1yyEF1WZOMa19rKQy3IY1kkAy/bb0uQuHb1E68 +TxBlpc2Fl+D4MhPW/RyrFC89NNOWkBl43DV5av0sQ4pnPEImpBFB3OiUUpYmWcq1Im2 ZvmOJWsVMJr2DREA4nG2bv7woyYmeBfg6A0VREYl2GxMa6/OqqXQthk8+ZnGWLUEIzkC 223g== 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 h7si13339651ejx.254.2020.08.18.07.27.40; Tue, 18 Aug 2020 07:27:40 -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 S1726879AbgHRO1j (ORCPT + 7 others); Tue, 18 Aug 2020 10:27:39 -0400 Received: from lhrrgout.huawei.com ([185.176.76.210]:2621 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726660AbgHRO1j (ORCPT ); Tue, 18 Aug 2020 10:27:39 -0400 Received: from lhreml710-chm.china.huawei.com (unknown [172.18.7.108]) by Forcepoint Email with ESMTP id BF20978A59E9C59D0C87; Tue, 18 Aug 2020 15:27:37 +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_GCM_SHA256) id 15.1.1913.5; Tue, 18 Aug 2020 15:27:37 +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 v3 5/6] ACPI: Remove side effect of partly creating a node in acpi_get_node Date: Tue, 18 Aug 2020 22:24:29 +0800 Message-ID: <20200818142430.1156547-6-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20200818142430.1156547-1-Jonathan.Cameron@huawei.com> References: <20200818142430.1156547-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.123.41.22] X-ClientProxiedBy: lhreml710-chm.china.huawei.com (10.201.108.61) 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 Reviewed-by: Hanjun Guo Reviewed-by: Barry Song --- drivers/acpi/numa/srat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.19.1 diff --git a/drivers/acpi/numa/srat.c b/drivers/acpi/numa/srat.c index 1fb486f46ee2..2c9a66c203ff 100644 --- a/drivers/acpi/numa/srat.c +++ b/drivers/acpi/numa/srat.c @@ -436,6 +436,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 Tue Aug 18 14:24:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 247896 Delivered-To: patch@linaro.org Received: by 2002:a54:3b12:0:0:0:0:0 with SMTP id j18csp3179043ect; Tue, 18 Aug 2020 07:28:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwCtXnzEnXXsZPVL8nPMtmh9t2gDfBsNuQGoB+CEgxJVIZYTA5jpVGRs/DwpDF8rqTaLAnm X-Received: by 2002:a17:906:cb91:: with SMTP id mf17mr20096498ejb.527.1597760890952; Tue, 18 Aug 2020 07:28:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597760890; cv=none; d=google.com; s=arc-20160816; b=F4hPu1UMJP0ybjS+q33cqO+ebBD1bCDpTRDa+xj4AOdFNV5H9t5m8VUbeqsDMCY5PL nwAxv/bhuX2vsUrqPZS4s5C5EUoCawOLqGBrBavzBcJuMm3zQgyMk8MtlWqmtERvY17u MVOtjsa9y+6QfgoIn0oNJ/uYU7SUvMLnwWTkd17HW21JWs12/Xu2EHobcnTKI7VSSb3i PfICGWYOTXrDeHaZBOfU45a8IpQP8Uhvl1R/WIs4/MjsgTP2e3t2juhy24+hWd5bn+yr eOZno7CR8wNGwvA1bPSkjTbgP1Wgh4q6NNWP5NRvVYUg1rkGguxLuUaB1y449uhMn2ch uisw== 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=k5em7Vy2LmjV5Y2NdfR2IgKm9PZYI6cHeYiLN8RDARo=; b=l6T1pqOH3y3jXpGbMwWC0zXwYViZlzrk/yM96VqV9ZW56VqaLRU1Pwd/AuMXzlshao x9rh0NTek8r03wJu39WaTJOSZDtbZYTfG6Bm2TEGkxUhKC4I9LB19Di+gbp/3poa1cNg DUUCSDPlq3NG48CReqkE9xWgZMNs1ay1XD+2GTsNKaJms5uFk5jLjrI4FA9huyA2ZWme 8QjVU7xNIUumrR8rctbNUR/5x6O0KiErReAzQbUM6s3R441BmnIZkz0jjWbcsolMCQD0 2f9h8+ETnGuOTPyTtto7k+GdTVd7d2IOAIl4T5NZbUBKPpPRN4kkh7PDd06V8MrbKQ2L fNuA== 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 h7si13339651ejx.254.2020.08.18.07.28.10; Tue, 18 Aug 2020 07:28:10 -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 S1726917AbgHRO2J (ORCPT + 7 others); Tue, 18 Aug 2020 10:28:09 -0400 Received: from lhrrgout.huawei.com ([185.176.76.210]:2622 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726660AbgHRO2J (ORCPT ); Tue, 18 Aug 2020 10:28:09 -0400 Received: from lhreml710-chm.china.huawei.com (unknown [172.18.7.107]) by Forcepoint Email with ESMTP id 0DFD8528DCC75F4E9448; Tue, 18 Aug 2020 15:28:08 +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_GCM_SHA256) id 15.1.1913.5; Tue, 18 Aug 2020 15:28:07 +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 v3 6/6] irq-chip/gic-v3-its: Fix crash if ITS is in a proximity domain without processor or memory Date: Tue, 18 Aug 2020 22:24:30 +0800 Message-ID: <20200818142430.1156547-7-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20200818142430.1156547-1-Jonathan.Cameron@huawei.com> References: <20200818142430.1156547-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.123.41.22] X-ClientProxiedBy: lhreml710-chm.china.huawei.com (10.201.108.61) 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 Reviewed-by: Hanjun Guo --- 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 95f097448f97..b59b63ee3fa6 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -5263,7 +5263,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);