From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 01C1423D2B4 for ; Wed, 5 Nov 2025 09:33:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762335208; cv=none; b=m9SbdDS8bJm2zW+dh3AWFlmsU+MpxWm5L3MDJF13lVTVpJXvbBDO7OA7DRbD6hslgHTnWliA/LjUg8+nVYMsYJO7X2ceBWbGOZMv5+im956/xnOHFZICks3WtPGVxWa4V6IMfDhbyqqfFGZ8MzSqpYBKDlNTV2AuQ36LoFBlXak= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762335208; c=relaxed/simple; bh=/BlFRsUqHzpyPFsgXRPVEfArD94AsjLLqYTCp3TIbWc=; h=Date:From:To:CC:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ax9skUdokUiOe0ovdbv6W3tOq+kBc3DCAvnBXjTJtYHXwsKR8N80CRPi0UBBHE/wIFpGdaBD9r4CSZ9d4nbE9fTmef8XoLKSxlc7aCIZKQeqYcRKE1X1rsEuxJ9i7PejWVHu54ffu+rbRsBnXCWPEnRYNCe3VdxFr446TppOD4c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.31]) by frasgout.his.huawei.com (SkyGuard) with ESMTPS id 4d1fqF2qwgzHnGdC; Wed, 5 Nov 2025 17:17:29 +0800 (CST) Received: from dubpeml100005.china.huawei.com (unknown [7.214.146.113]) by mail.maildlp.com (Postfix) with ESMTPS id 700071402A5; Wed, 5 Nov 2025 17:17:34 +0800 (CST) Received: from localhost (10.203.177.15) by dubpeml100005.china.huawei.com (7.214.146.113) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Wed, 5 Nov 2025 09:17:33 +0000 Date: Wed, 5 Nov 2025 09:17:32 +0000 From: Jonathan Cameron To: Dan Williams CC: , , , , , , Ilpo =?ISO-8859-1?Q?J=E4rvinen?= Subject: Re: [PATCH 1/6] resource: Introduce resource_assigned() for discerning active resources Message-ID: <20251105091732.0000302c@huawei.com> In-Reply-To: <20251105040055.2832866-2-dan.j.williams@intel.com> References: <20251105040055.2832866-1-dan.j.williams@intel.com> <20251105040055.2832866-2-dan.j.williams@intel.com> X-Mailer: Claws Mail 4.3.0 (GTK 3.24.42; x86_64-w64-mingw32) Precedence: bulk X-Mailing-List: linux-coco@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: lhrpeml500009.china.huawei.com (7.191.174.84) To dubpeml100005.china.huawei.com (7.214.146.113) On Tue, 4 Nov 2025 20:00:50 -0800 Dan Williams wrote: > A PCI bridge resource lifecycle involves both a "request" and "assign" > phase. At any point in time that resource may not yet be assigned, or may > have failed to assign (because it does not fit). >=20 > There are multiple conventions to determine when assignment has not > completed: IORESOURCE_UNSET, IORESOURCE_DISABLED, and checking whether the > resource is parented. >=20 > In code paths that are known to not be racing assignment, e.g. post > subsys_initcall(), the most reliable method to judge that a bridge resour= ce > is assigned is to check the resource is parented [1]. >=20 > Introduce a resource_assigned() helper for this purpose. >=20 > Link: http://lore.kernel.org/2b9f7f7b-d6a4-be59-14d4-7b4ffccfe373@linux.i= ntel.com [1] > Suggested-by: Ilpo J=E4rvinen > Cc: Bjorn Helgaas > Signed-off-by: Dan Williams One trivial thing on documentation style below. > --- > include/linux/ioport.h | 9 +++++++++ > 1 file changed, 9 insertions(+) >=20 > diff --git a/include/linux/ioport.h b/include/linux/ioport.h > index e8b2d6aa4013..9afa30f9346f 100644 > --- a/include/linux/ioport.h > +++ b/include/linux/ioport.h > @@ -334,6 +334,15 @@ static inline bool resource_union(const struct resou= rce *r1, const struct resour > return true; > } > =20 > +/* > + * Check if this resource is added to a resource tree or detached. Calle= r is > + * responsible for not racing assignment. > + */ Some stuff in this file now has kernel-doc style comments. To me it seems like a better idea to use that style for new function descriptions whilst perhaps not being worth the churn that would be inherent in switching all docs to that style. > +static inline bool resource_assigned(struct resource *res) > +{ > + return res->parent; > +} > + > int find_resource_space(struct resource *root, struct resource *new, > resource_size_t size, struct resource_constraint *constraint); > =20