From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 DF9EA2367D5; Mon, 28 Jul 2025 08:24:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753691089; cv=none; b=jjf90Wpl+LO8dC2AT+rnopu8f/c6sz21VGQmaH/xvjup7DPOK5gGgKKlRiGyDwunf+5KfiXls+ht17hJ04MAKHZzUq42iP5MMH/jPtO0rBG3GvRKYLwEEiDGwUI6rwF6G807tS3MnegUpjTR7ek2qbGhLSGhqBnTVGoPEpV4Hr4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753691089; c=relaxed/simple; bh=DDHEw2l9COqoOnSii06vLrGixN7NrFhwB0y2CTTbV2w=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Y4FfA0fFHdXaOugoaL3dUD8HEKUVDr9tBn8UL0v9MlBGPlJzNvXsuvBR0ieVrf3Jw9CikRGpgXUO6nWkNNftym23uOPCbOG3f40vYdfWMIJ4QgnJxZ7qvbSoJQxlocV/gGCz35MzFoprmGySfJrSKS4jl1x00QAf/OK8ig1J670= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=srjVlvxl; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="srjVlvxl" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F48AC4AF0B; Mon, 28 Jul 2025 08:24:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1753691088; bh=DDHEw2l9COqoOnSii06vLrGixN7NrFhwB0y2CTTbV2w=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=srjVlvxlluDoh0Vj/xjN5mI3mQSTgoM1mo//6tuiu1tHx51su7COlep1BroTMmKj6 lcwCqto57s1tx7mHEJWsYlbaVqGaGNcTwIaWf1Wn+ovuJv0Iq84ZaqIkUfk+yFAqP1 Ys5Thwto14y/A7TtLXAo7alqS+POX+TnBrAXAzgqkQTijkJyLSfQrR3kRQEaOKOckC 3la8bJXllKcVxheHB8oj6LUaMmomgF2+pmOFZ0VGaH0aMdul93AzP0dJi1TTC7CUU8 hJi4NciHgjJKMjxIfnCFytoqmwODc5EM+83MwcCAYBLh7xU8x6J+mlCQs/2RZ51Nju GvOZpikNOjnyw== From: Chris Li Date: Mon, 28 Jul 2025 01:24:32 -0700 Subject: [PATCH RFC 02/25] PCI/LUO: Add struct dev_liveupdate Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20250728-luo-pci-v1-2-955b078dd653@kernel.org> References: <20250728-luo-pci-v1-0-955b078dd653@kernel.org> In-Reply-To: <20250728-luo-pci-v1-0-955b078dd653@kernel.org> To: Bjorn Helgaas , Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , Len Brown Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org, David Matlack , Pasha Tatashin , Jason Miu , Vipin Sharma , Saeed Mahameed , Adithya Jayachandran , Parav Pandit , William Tu , Mike Rapoport , Chris Li , Jason Gunthorpe , Leon Romanovsky X-Mailer: b4 0.14.2 Introduce struct dev_liveupdate and add it to struct device. Use the new struct to track a device's liveupdate states. - requested: The device is requested for a live update. - depended: One of the child devices is requested for live update. When the device is requested, the dev->lu.requested will set to 1. Signed-off-by: Chris Li --- drivers/pci/liveupdate.c | 3 +++ include/linux/dev_liveupdate.h | 35 +++++++++++++++++++++++++++++++++++ include/linux/device.h | 6 ++++++ 3 files changed, 44 insertions(+) diff --git a/drivers/pci/liveupdate.c b/drivers/pci/liveupdate.c index 86b4f3a2fb44781c6e323ba029db510450556fa9..1c69adf412255c8ee5bc6db588ff04b1642e8e19 100644 --- a/drivers/pci/liveupdate.c +++ b/drivers/pci/liveupdate.c @@ -6,8 +6,11 @@ */ #define pr_fmt(fmt) "PCI liveupdate: " fmt +#define dev_fmt(fmt) "PCI liveupdate: " fmt +#include #include +#include "pci.h" #define PCI_SUBSYSTEM_NAME "pci" diff --git a/include/linux/dev_liveupdate.h b/include/linux/dev_liveupdate.h new file mode 100644 index 0000000000000000000000000000000000000000..057407c030b0872bfa8cd666e6ffc305f7aa4083 --- /dev/null +++ b/include/linux/dev_liveupdate.h @@ -0,0 +1,35 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +/* + * Copyright (c) 2025, Google LLC. + * Pasha Tatashin + * Chris Li + */ +#ifndef _LINUX_DEV_LIVEUPDATE_H +#define _LINUX_DEV_LIVEUPDATE_H + +#include + +#ifdef CONFIG_LIVEUPDATE + +/** + * struct dev_liveupdate - Device state for live update operations + * @lu_next: List head for linking the device into live update + * related lists (e.g., a list of devices participating + * in a live update sequence). + * @requested: Set if a live update has been requested for this + * device (i.e. device will participate in live update). + * @depended: Set if the device participtate the live update due to + * one of its child device is requested in live update. + * + * This structure holds the state information required for performing + * live update operations on a device. It is embedded within a struct device. + */ +struct dev_liveupdate { + struct list_head lu_next; + bool requested:1; + bool depended:1; +}; + +#endif /* CONFIG_LIVEUPDATE */ +#endif /* _LINUX_DEV_LIVEUPDATE_H */ diff --git a/include/linux/device.h b/include/linux/device.h index 4940db137fffff4ceacf819b32433a0f4898b125..4aee7912218865168a73fe4c6d3a82646b8dd86f 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -508,6 +509,7 @@ struct device_physical_location { * @pm_domain: Provide callbacks that are executed during system suspend, * hibernation, system resume and during runtime PM transitions * along with subsystem-level and driver-level callbacks. + * @lu: Live update state. * @em_pd: device's energy model performance domain * @pins: For device pin management. * See Documentation/driver-api/pin-control.rst for details. @@ -603,6 +605,10 @@ struct device { struct dev_pm_info power; struct dev_pm_domain *pm_domain; +#ifdef CONFIG_LIVEUPDATE + struct dev_liveupdate lu; +#endif + #ifdef CONFIG_ENERGY_MODEL struct em_perf_domain *em_pd; #endif -- 2.50.1.487.gc89ff58d15-goog