From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=83.223.95.204 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796384593; b=d/6GwiTQqwaTqV3VcTkO8Gt8sKaK0SoopMO0qBBzq+BKO3OcPl+mGXdOgsB6yd3lTdqG 1jtoxQ5UeN6WcDZfBXuQ+mLU1uzbwVUkE723wXSo9ng8b3GfVBJFIrRDTS4BnnisS5dPI QQ2+a8w/oC3vF13GcDehHGIE5V5c7KFlqfLyVCfqF9sZZ4cUPGLNsw3093LSOyYGdaFUN 63tVTZUc5IYWdLDAcndgW8/gEfitjVYfMeCXlWL7//8HwRIEEydoqeJ22UVt4m11ftWj+ IA585yrKPyO5Km1FVU9N5QLSWqHlZbYg2jkH43gYFxpgeF097YipS+unu0gD0v+LyFA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796384593; h=DMARC-Filter:Received:Received:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=+dvOMN7/1x7H3mXptIwNA2qZe/3rfFD6HJcVgqdu23c=; b=2YTi6c1cNtGdVKUL7TusOholHWR9A66V8HSMRa76pU77RcjkaFsWOENWF8j/InjseD9b oL9Xuq2VRr0+Whp1VzwShaMBCIf7nx09mHwMHk2Eogacw3KiynE1SXu51Q8D0aPiiiWYg MmNi/PwOsngJkg4fuNOxV6ykT+L4C2IOzjhhPfGECC3O7YbMRgoietyCqX7IXB3Ong0iD 0SCR0ssDXh6zE/BIU54pJcq/qeCnIiOKQ/4LJfcyq9r6b6tF1KtmQ96mF6lFmPiUe8rHO vFP+5T144jh3xoz2GPhZ/2hQNjpleV95eUAaeMO/sPqGaoAl/mwc5J4iQTZlob6eqUQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=wunner.de; spf=pass smtp.mailfrom=wunner.de; arc=none smtp.remote-ip=83.223.95.204 Received: from mailout1.hostsharing.net (mailout1.hostsharing.net [83.223.95.204]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B22BC606A322; Fri, 4 Dec 2026 11:43:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B22BC606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=wunner.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wunner.de Received: from h08.hostsharing.net (h08.hostsharing.net [IPv6:2a01:37:1000::53df:5f1c:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384 client-signature ECDSA (secp384r1) client-digest SHA384) (Client CN "*.hostsharing.net", Issuer "GlobalSign GCC R6 AlphaSSL CA 2025" (verified OK)) by mailout1.hostsharing.net (Postfix) with ESMTPS id D31953A4; Fri, 04 Dec 2026 12:43:10 +0100 (CET) Received: by h08.hostsharing.net (Postfix, from userid 100393) id BD45E60CF5CC; Fri, 4 Dec 2026 12:43:10 +0100 (CET) Date: Fri, 4 Dec 2026 12:43:10 +0100 From: Lukas Wunner To: David Matlack Cc: kexec@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-pci@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Alexander Graf , Alex Williamson , Bjorn Helgaas , Jason Gunthorpe , Jonathan Corbet , Josh Hilke , Mahesh J Salgaonkar , Mike Rapoport , Oliver O'Halloran , Pasha Tatashin , Pratyush Yadav , Randy Dunlap , Samiullah Khawaja , Shuah Khan , Vipin Sharma Subject: Re: [PATCH v2 01/17] PCI/DPC: Allocate the DPC save buffer during device setup Message-ID: References: <20261106004218.604799-1-dmatlack@google.com> <20261106004218.604799-2-dmatlack@google.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261106004218.604799-2-dmatlack@google.com> On Fri, Nov 06, 2026 at 12:42:02AM +0000, David Matlack wrote: > Allocate the DPC capability's save buffer in pci_dpc_init() rather than > in dpc_probe(), and report an allocation failure, which dpc_probe() > ignored. Good catch, could you amend dpc_probe() to handle the allocation failure? > > dpc_probe() runs when the portdrv DPC service binds to a port, which is > long after the device has been added, and does not happen at all if the > service is not enabled. Until then pci_save_dpc_state() silently saves > nothing, so a reset in that window loses the DPC Control register. That shouldn't hurt. I think the expectation is that until the DPC port service driver binds, the DPC Extended Capability is in power-on reset state and it's not managed by the kernel. So the kernel doesn't have to care about restoring it. Moreover according to PCI Firmware Spec r3.3 table 4-6 bit 7, the kernel is not supposed to modify the DPC Extended Capability unless it has been granted control by platform firmware. It seems this is violated by moving the allocation to pci_dpc_init(). Note that dpc_probe() is gated by the rules applied in get_port_device_capability(), which checks whether DPC control was granted by the platform. pci_dpc_init() doesn't perform those checks. > Allocating during device setup makes buffer existence depend only on the > capability being present, which is what the save and restore paths > already assume. It also puts every capability save buffer in one phase > of a device's life, which a later patch relies on. pci_save_dpc_state() and pci_restore_dpc_state() become no-ops if no saved_state has been allocated, which never happens if platform firmware hasn't granted control. So my impression is that this patch isn't needed, but a fixup to handle the allocation failure in dpc_probe() is. Thanks, Lukas