Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp2737094ybf; Mon, 2 Mar 2020 14:37:15 -0800 (PST) X-Google-Smtp-Source: ADFU+vv+ipfj77Z2rbUuFNswHZgXls5Dz3+Q59jreiVb4G7wdc/7iutZhu00/GmBHJcXV1R+Jikk X-Received: by 2002:a05:6830:104d:: with SMTP id b13mr898136otp.42.1583188635088; Mon, 02 Mar 2020 14:37:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583188635; cv=none; d=google.com; s=arc-20160816; b=ZPBhtKVnhrOC2qBypw9L9UGN0zkREtRoDjiGwsfO37bGI/ixKEHWKFv3eEOdSK+SWv 6HYdHcC7j0wc+R3J89Cil+3JQ9VH0tooTswAqmiOf2g1iCc9+IsYYeyIsXvjsiRsyj1s axhNAQWX/kDx3q7rMAUnoZ7biW6hk3Ml/P/HiPxSgNntoLep2u1X8M9uC5r9zClefCe5 dAa+FQyH7gpy6FklY/kgZ9v/CMBtH8AmufwRjL0yEMg5dx07RmycneHs3RtczzcTWAqq jCII723RGkFhmPZPRH1R/DZHRNnIAeAx6PUw5Gi14341zz60Q79egbIC+y78Vl2MErVD a+Cw== 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 :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject; bh=IFa00QUsntsh4tGfUAPqv1U+q8diplVRd+DXsn3ORuI=; b=h1SxJLIi9gOA8GJVTok8F6Rqy3L/vT37VuH3pGZ0OyYRG3UJEPg8v+/PJ/wjWbcrv0 XyucJPFcbjbUGz4OF0Diq3PJ1IqA4IpSyhytWk4mxcMGHbehhPVCgUgiisBzo8i4FMfb 5KIXvo8YtHfm0jk6XJYTXvioK6+8ZotPnf6ljXqYk/YyVWaKPZOyFogC29Qnb4kmruHq /iyWUc1KcvpnYCsA9zJ6Na4mdeVBc6xnd4q7dYedIGlpzoTzM1IreHDpJcNUeTN1Bokb du/kMY4jVYyvbITMzI+3l9eWgvJguJIdJEg2iqbRsBCTq1m32W8/ownjcKHzaRd3mzFh Iavw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v22si4063607otq.109.2020.03.02.14.37.02; Mon, 02 Mar 2020 14:37:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727026AbgCBWg0 (ORCPT + 99 others); Mon, 2 Mar 2020 17:36:26 -0500 Received: from mga18.intel.com ([134.134.136.126]:11848 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726744AbgCBWg0 (ORCPT ); Mon, 2 Mar 2020 17:36:26 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Mar 2020 14:36:25 -0800 X-IronPort-AV: E=Sophos;i="5.70,508,1574150400"; d="scan'208";a="228639191" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.16]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Mar 2020 14:36:25 -0800 Subject: [PATCH 4/5] resource: Report parent to walk_iomem_res_desc() callback From: Dan Williams To: linux-acpi@vger.kernel.org Cc: Jason Gunthorpe , Dave Hansen , Wei Yang , Tom Lendacky , peterz@infradead.org, ard.biesheuvel@linaro.org, linux-nvdimm@lists.01.org, linux-kernel@vger.kernel.org Date: Mon, 02 Mar 2020 14:20:20 -0800 Message-ID: <158318762012.2216124.16408566404290491508.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <158318759687.2216124.4684754859068906007.stgit@dwillia2-desk3.amr.corp.intel.com> References: <158318759687.2216124.4684754859068906007.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.18-3-g996c MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In support of detecting whether a resource might have been been claimed, report the parent to the walk_iomem_res_desc() callback. For example, the ACPI HMAT parser publishes "hmem" platform devices per target range. However, if the HMAT is disabled / missing a fallback driver can attach devices to the raw memory ranges as a fallback if it sees unclaimed / orphan "Soft Reserved" resources in the resource tree. Otherwise, find_next_iomem_res() returns a resource with garbage data from the stack allocation in __walk_iomem_res_desc() for the res->parent field. Cc: Jason Gunthorpe Cc: Dave Hansen Cc: Wei Yang Cc: Tom Lendacky Signed-off-by: Dan Williams --- kernel/resource.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/resource.c b/kernel/resource.c index 76036a41143b..6e22e312fd55 100644 --- a/kernel/resource.c +++ b/kernel/resource.c @@ -386,6 +386,7 @@ static int find_next_iomem_res(resource_size_t start, resource_size_t end, res->end = min(end, p->end); res->flags = p->flags; res->desc = p->desc; + res->parent = p->parent; } read_unlock(&resource_lock);