From patchwork Tue Sep 22 10:33:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolin Wang X-Patchwork-Id: 11792133 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5C8F092C for ; Tue, 22 Sep 2020 10:35:11 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1AB09239A1 for ; Tue, 22 Sep 2020 10:35:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="NX9uznMv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1AB09239A1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Owner; bh=y8s3rKNwHXQZ3o8rxiRhb1GOcO7DBI7HJejcBF4CuDk=; b=NX9uznMvphrZOx1JdGiaB3YTCd SpTIEggshzl578d4PutCTw+O6lgI1O75EMHjXQsEcQ9eQnJrJkd64MgYuyYkywU6LRAaje24MLBNp cLsnj3vSkHqqJwVTdWabPWfhx6LOLCrThdhmv+diYVksvHe6wVGFOmWO6rxT/YV6JzdRTtIMsaL+m DPdo+t0uUJANNx55K5r7hdINZ+K/Yr4Gr0+IrKyrHpbyqyFKdP6yWDXMjWr2Mb4WSfmYke0euuaHZ uTiw/6xEPLf46LZ1VjdEw8E3EJVkQ35QDU94zgRvk3hWMzkVzSiNNb30YEiq9hhy6uC9sKanXrSlc izKWZn2Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKfcL-0004aA-C5; Tue, 22 Sep 2020 10:33:49 +0000 Received: from out30-57.freemail.mail.aliyun.com ([115.124.30.57]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKfcH-0004Y8-3G for linux-arm-kernel@lists.infradead.org; Tue, 22 Sep 2020 10:33:47 +0000 X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R191e4; CH=green; DM=||false|; DS=||; FP=0|-1|-1|-1|0|-1|-1|-1; HT=e01e04420; MF=baolin.wang@linux.alibaba.com; NM=1; PH=DS; RN=6; SR=0; TI=SMTPD_---0U9liOx3_1600770811; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0U9liOx3_1600770811) by smtp.aliyun-inc.com(127.0.0.1); Tue, 22 Sep 2020 18:33:31 +0800 From: Baolin Wang To: catalin.marinas@arm.com, will@kernel.org Subject: [PATCH] arm64: PCI: Validate the node before setting node id for root bus Date: Tue, 22 Sep 2020 18:33:24 +0800 Message-Id: <1600770804-116365-1-git-send-email-baolin.wang@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200922_063345_797262_FEFAB1C2 X-CRM114-Status: GOOD ( 11.50 ) X-Spam-Score: -8.0 (--------) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-8.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [115.124.30.57 listed in list.dnswl.org] -7.5 USER_IN_DEF_SPF_WL From: address is in the default SPF white-list -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.5 ENV_AND_HDR_SPF_MATCH Env and Hdr From used in default SPF WL Match 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: baolin.wang7@gmail.com, linux-arm-kernel@lists.infradead.org, baolin.wang@linux.alibaba.com, linux-kernel@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org If the BIOS disabled the NUMA configuration, but did not change the proximity domain description in the SRAT table, so the PCI root bus device may get a incorrect node id by acpi_get_node(). Thus better to add a numa node validation before setting numa node for the PCI root bus, like pci_acpi_root_get_node() does for X86 architecture. Signed-off-by: Baolin Wang --- arch/arm64/kernel/pci.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c index 1006ed2..24fe2bd 100644 --- a/arch/arm64/kernel/pci.c +++ b/arch/arm64/kernel/pci.c @@ -86,9 +86,13 @@ int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge) struct pci_config_window *cfg = bridge->bus->sysdata; struct acpi_device *adev = to_acpi_device(cfg->parent); struct device *bus_dev = &bridge->bus->dev; + int node = acpi_get_node(acpi_device_handle(adev)); + + if (node != NUMA_NO_NODE && !node_online(node)) + node = NUMA_NO_NODE; ACPI_COMPANION_SET(&bridge->dev, adev); - set_dev_node(bus_dev, acpi_get_node(acpi_device_handle(adev))); + set_dev_node(bus_dev, node); } return 0;