Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp3951258pxb; Mon, 4 Oct 2021 13:29:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwuwzrqexot2OWk1VgDTW6ySsPRrdSOwIVu36L5F0C89PdanJibAcgRcaPrxteX8d/k8tD3 X-Received: by 2002:a05:6a00:a0a:b0:44c:52c9:bf25 with SMTP id p10-20020a056a000a0a00b0044c52c9bf25mr10351640pfh.24.1633379352641; Mon, 04 Oct 2021 13:29:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633379352; cv=none; d=google.com; s=arc-20160816; b=VFra1q0XG1DTqzEOM87cOxtA/XSSZl6NqJPtbZB33LKz/iUKR3XIg2a0b4PIx0FK0P qZvOMqhPKmG+WtXAggOv8zjfCEC4csArWGtHwMzJmmhIJbAnBbaOhOaWEv7oLjvGmqBK 7IPrjCNHdAFp20XaSkDDWbSi5SMQrZB7vwdc704wwrznGHkCq/0pJtKVXn7cI9nrAn01 sNIqdGAmhVcJsOFYGQit1fJVjQ+C72glR1H5xPRcYykguRYy+ad8nqx7Ia/9RQhKA5Km wsD4xA9LttCxAkRB4ynprcQlnzKCa2eZtdCOUdFbZwhdYlsY40dP3eMzN4W/UHLyDKmp UKGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pA7HrX34a7X0JLRjmduA5VFn9nOgAip8vh38OohYLz4=; b=FFFYpfcixt2f7fLLjKiiTJeWnTasrGv42pJvy7g5VmNgGDyuka3VkeObvfLR4QlRDH a92X7dwljVUvBAkJbg0fEw0DAbCSL++dulTVaFSGZDWvvjlHHvulWFTuXN8TW/QLBYOj /fdV3Z8BbrP9zZ9ghxNt5Y4eCGyV+rfS+7LDnIvDro6iYHlbrm5bLBjRq7ACWCDdl8lO 7shrlPBPGeE1jF9vfHmn3ZEeuEvqyRC+Ytw1E+1N4Ocfa0OFFdp+6u2zYfo725sBPBd/ 3tNFkmLsc2N0j+nWr8McsdAPWBVAhmrvkX/vAltVmTFEDKGUoZRrMpXCJKBzaKC89A+T OsuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eTWT1FKs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j5si18267103pjg.71.2021.10.04.13.28.59; Mon, 04 Oct 2021 13:29:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eTWT1FKs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237248AbhJDNbz (ORCPT + 99 others); Mon, 4 Oct 2021 09:31:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:43148 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236307AbhJDN34 (ORCPT ); Mon, 4 Oct 2021 09:29:56 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1D91163226; Mon, 4 Oct 2021 13:13:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1633353207; bh=gbzeM37Zhas7eRYhP+wau5J9CfcGmKSSSDNQGx29buo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eTWT1FKsuXB3Awkl1qhh9rJG7juu+37COohuSg+iTdQjNAtcpLMy18oVKXLCBZN/1 Mb2E8WlFYj2I/IgEutJRwwHT7lD6Uz7yHiu9tiEoJT/jWvOwaHO5wfmV1OR/za9nmu bANGWgFVJiveyIH3AZh+FwAMWrrsYiKUWbJECfh0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Williams , Jia He Subject: [PATCH 5.14 038/172] ACPI: NFIT: Use fallback node id when numa info in NFIT table is incorrect Date: Mon, 4 Oct 2021 14:51:28 +0200 Message-Id: <20211004125046.212942681@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211004125044.945314266@linuxfoundation.org> References: <20211004125044.945314266@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jia He commit f060db99374e80e853ac4916b49f0a903f65e9dc upstream. When ACPI NFIT table is failing to populate correct numa information on arm64, dax_kmem will get NUMA_NO_NODE from the NFIT driver. Without this patch, pmem can't be probed as RAM devices on arm64 guest: $ndctl create-namespace -fe namespace0.0 --mode=devdax --map=dev -s 1g -a 128M kmem dax0.0: rejecting DAX region [mem 0x240400000-0x2bfffffff] with invalid node: -1 kmem: probe of dax0.0 failed with error -22 Suggested-by: Dan Williams Signed-off-by: Jia He Cc: Fixes: c221c0b0308f ("device-dax: "Hotplug" persistent memory for use like normal RAM") Link: https://lore.kernel.org/r/20210922152919.6940-1-justin.he@arm.com Signed-off-by: Dan Williams Signed-off-by: Greg Kroah-Hartman --- drivers/acpi/nfit/core.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) --- a/drivers/acpi/nfit/core.c +++ b/drivers/acpi/nfit/core.c @@ -3007,6 +3007,18 @@ static int acpi_nfit_register_region(str ndr_desc->target_node = NUMA_NO_NODE; } + /* Fallback to address based numa information if node lookup failed */ + if (ndr_desc->numa_node == NUMA_NO_NODE) { + ndr_desc->numa_node = memory_add_physaddr_to_nid(spa->address); + dev_info(acpi_desc->dev, "changing numa node from %d to %d for nfit region [%pa-%pa]", + NUMA_NO_NODE, ndr_desc->numa_node, &res.start, &res.end); + } + if (ndr_desc->target_node == NUMA_NO_NODE) { + ndr_desc->target_node = phys_to_target_node(spa->address); + dev_info(acpi_desc->dev, "changing target node from %d to %d for nfit region [%pa-%pa]", + NUMA_NO_NODE, ndr_desc->numa_node, &res.start, &res.end); + } + /* * Persistence domain bits are hierarchical, if * ACPI_NFIT_CAPABILITY_CACHE_FLUSH is set then