From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 AF013606A322 for ; Fri, 4 Dec 2026 11:53:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=oYn6C/YK DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=+dvOMN7/1x7H3mXptIwNA2qZe/3rfFD6HJcVgqdu23c=; b=oYn6C/YKeTpwONBDCmdI5GFEAx PLg7WYmVcibV28ZrG+oYBvfCZjLax3ny1JfL4TKrSRxdTd4AYM4i26pGEKSO9iWH4bX2YWUD2oBaE q2oYOyucVNw5kn+Xsi1zvh/toRckWiUZnCnGmZWGz3ikySFLhHJjFoXnY5l79xElFAPSHHmwJj+mV zcTKfrYx227rInky5kK+hUgIKBfEJIy/oXtHfLctvtbLWYGHy0Ww50y7kTZzrsnZuZRPUmvE157gD UoPu2tutzR44EZDFd9LF5C0jgjljBi18i+rUuZKFMTZOU3iQ/w7Eobhr5K6F79SKazwoEb4BBodoB TCvJiing==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZRqb-00000000AxZ-0BT0; Fri, 04 Dec 2026 11:53:05 +0000 Received: from mailout1.hostsharing.net ([83.223.95.204]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZRhD-00000000AOL-0c7p for kexec@lists.infradead.org; Fri, 04 Dec 2026 11:47:12 +0000 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-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261106004218.604799-2-dmatlack@google.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261204_034332_566683_939C8615 X-CRM114-Status: GOOD ( 17.02 ) X-Spam-Note: SpamAssassin invocation failed X-BeenThere: kexec@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "kexec" X-Spam-Status: No, score=-4.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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