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 73D6D606A322 for ; Fri, 4 Dec 2026 22:53:32 +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=BRMnCdVt; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=oevHXR9y 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:References:To: From:Subject:Cc:Message-Id:Date:Content-Type:Content-Transfer-Encoding: Mime-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Unsubscribe-Post: List-Owner; bh=pRZuSFpXJJ9he3koxBOj9dbMkJVnVk3ICuuYyN5bAXc=; b=BRMnCdVtUGpnUN kXwb12fJYyrfsJBl6JWGaFURAxJ+3TCC3cMJxsoaf3TlwJ9DqAvdSzsBYOwlwsMlUU0T5GBgyRJns rNDMA2MzvK+QqaqbF84LqigBr1/oVyoGuaa5n2/G4kz/4QH1qsoSKaLGXQfvuEHpX1FMw0FeMK6TD Nhlattq22DMEVbejnmRZgvJ7kxZn3ssFh9O5BP8iHD6vUWAmmnuCXNZIL1RDYF0+zfJk70REC1I1V qReJ4ixwnNtoQ6+UWy6zfkmG4w9B91tqXgpV83A9GQ8Gmr2ez6G5j9ZyvWCJ9FVh20N/xdAkJ+SRP Jax6Z8akS69MYNYir1hw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZc9c-00000001hsg-3ASf; Fri, 04 Dec 2026 22:53:30 +0000 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZc9P-00000001hrl-0uzX for kexec@lists.infradead.org; Fri, 04 Dec 2026 22:53:12 +0000 Received: by mail-pg1-x530.google.com with SMTP id 41be03b00d2f7-cc758830601so1225798a12.2 for ; Fri, 04 Dec 2026 14:53:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1796424789; x=1797029589; darn=lists.infradead.org; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-type:content-transfer-encoding:mime-version:from:to:cc :subject:date:message-id:reply-to:content-type; bh=pRZuSFpXJJ9he3koxBOj9dbMkJVnVk3ICuuYyN5bAXc=; b=oevHXR9yuQ33buU+vZHzV/GhDVOHr1S54pDDYQnQLE9EOBs+tUyg+EjYqa+icaBGhT iKNco9bIuOQ3KFDIklnotsgZpzKKtRlua2fScLtr7BUOUEcrPJ4avRjnFJmIHzCM/8ra 1Vs+7Q4Vr0xotBZU3IwmWjPEBBCNhvnzOVn5gtJ84eM76kzuLKNh7IrTFD7GDBhGzj3S ypG9FUNViw3sxRy+IPMecyHp06Nda/qHCE6qYDESQPq/8aJ7VC6cZCyMN+rDRURo0xcn XNBpsujcXIWqOXgZfrAhNFcFLR4hz26rLFJImxaXfxYhWs1oblViCMLWyXo5FOdT7wI/ FyZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796424789; x=1797029589; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-type:content-transfer-encoding:mime-version:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=pRZuSFpXJJ9he3koxBOj9dbMkJVnVk3ICuu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TrEp9f9eLqQWj7fnUTIYi EVwRaF9WNYmRLsaDhcWZt8/uulpLy+YfXv9oobb2YGnDmK5DMUkzCH//Aextb+fIj7CeSSDVjEC dCu0kRpxFrhA= X-Received: by 2002:a05:6a20:c998:b0:3e2:8114:12e3 with SMTP id adf61e73a8af0-41562226d3emr3907597637.41.1796424788923; Fri, 04 Dec 2026 14:53:08 -0800 (PST) Received: from localhost (33.79.127.34.bc.googleusercontent.com. [34.127.79.33]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-ce12358ee24sm2073148a12.11.2026.12.04.14.53.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 04 Dec 2026 14:53:08 -0800 (PST) X-Archived-By: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Fri, 04 Dec 2026 14:53:07 -0800 Message-Id: Cc: , , , , , , "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 From: "David Matlack" To: "Lukas Wunner" , "David Matlack" X-Mailer: aerc 0.21.0 References: <20261106004218.604799-1-dmatlack@google.com> <20261106004218.604799-2-dmatlack@google.com> In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261204_145311_311987_449EEF52 X-CRM114-Status: GOOD ( 20.77 ) X-Spam-Score: -17.6 (-----------------) 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=-13.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIMWL_WL_MED,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_IN_DEF_DKIM_WL 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 Dec 4, 2026 at 3:43 AM PST, Lukas Wunner wrote: > 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? As you pointed out in your follow-up, a failure there only means DPC Control isn't saved and restored, and the per-capability buffers go away later in the series anyway. So I'll leave dpc_probe() as is in the next version. >> 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(). You're right, thanks for catching this. I missed that the existence of the save buffer was also what kept the kernel from touching DPC Control when firmware hasn't granted control. With this patch, and through the rest of the series, pci_restore_dpc_state() writes DPC Control on every port with a DPC capability. > So my impression is that this patch isn't needed Yeah. I'll drop this patch in v3. My plan is to keep reserving DPC Control in pci_dpc_init() and have pci_restore_dpc_state() skip the write unless the kernel owns DPC, via a flag set in dpc_probe() and cleared in dpc_remove(). That keeps today's behavior of restoring DPC Control only after the DPC service has bound to the port. The one difference is that pci_save_state() would read DPC Control on every port with a DPC capability, since saving reads every reserved register. My understanding is that a read doesn't count as modifying the capability, but I could gate the save on the same flag if you'd prefer.