From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.215.172 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796424790; b=sHTJxAZnhXA9AjZ0sgzHM2mlJHoI2JZ4Qf+rzoa3wV51VSKN45UTfLafRjgux4H7Ndph 6rTCDisBy8Vdf2Y+qgc4wH+qFpKkmoKwVN4VsZVbTx/PzqehZxoGvll5Fvx6zIh9mXrJ9 d6qG28UrqD2YYVbM08MFCxzlVOBhG2CSQ4KnF88Wtk2hzGfKISMk6lQOrc/MSFeQwm4G5 K/VpDfbO1jSu/2BKTsUwRNIoY67hS4LBDylIphm7I42izbc7BI89p50OKxucISaN64Hvs jDlbzpCDD+DUATd0kYzGHycX6dWWw3hHhQLTLiOV8tjvhnL/1G/US7x8lSaY+jYisfA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796424790; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Mime-Version:Content-Transfer-Encoding:Content-Type:Date:Message-Id: Cc:Subject:From:To:X-Mailer:References:In-Reply-To; bh=pRZuSFpXJJ9he3koxBOj9dbMkJVnVk3ICuuYyN5bAXc=; b=acprMbDtvxJ5nryijhhuQNkzVemcDPnxh5ozsN8eVfcoIZiZtR0YFEJ8Bmy+KhVbaA6t p6okG1qtK/5vxnX97/i90FRthVqRkLzREhYaAEOzwrLaK5n/8H5oMz0mb3790Yf6dCAwj oR2fmQPS2sonSpBfQdrkJiE7lh7axNXhD/SPXaWqwcYJPU/zLMbV91GRANUGjIMFtw/JL ANkxWZmMOaeXy0TMEaPqI+WGlFEmCKYX+LTyrVCCW0260fsM0cVPIvxTo2QfwhHb6Gluz bCIyQGDRnito29HD5vaKVymsBM7KHWLojShW/pW5yNMiX/tkr0cntDJ1of8KPSG0YKg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=exUXWCN1; arc=none smtp.remote-ip=209.85.215.172 Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3C94E606A322 for ; Fri, 4 Dec 2026 22:53:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 3C94E606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=exUXWCN1 Received: by mail-pg1-f172.google.com with SMTP id 41be03b00d2f7-cdd9d0c9bbdso1040882a12.1 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=vger.kernel.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=exUXWCN196BZaNdvDE50JMQo3pbCN0TRbbd6Vf6utBlBwse4IzdublAKdaIlT5PKqV 0eJ7FeRr1wBlbzjC9amGGzALOtW0vvBB86zVlaUHtk0aLFyxbbUO9P9LUzm7YalM3AYa Q8x3kyqWHjExUTXf0uIPfkY2lFIqffHboohgfrfVM+xzp9lOnAyxRMwW6crjZNk14lHV 7wZ56ndn0mLnBEsi9bUlQophcic9ULx3AlYLeKLBuubgrYq4QWk0KzpC4rwxHNs9NVEH VwMDE2bVqsZ4HoT04IDbUJfKe58KmXA56VpscPVAad2+6xUCE3HTRmS1K+eVm5/Zv8cC JHEw== 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=pRZuSFpXJJ9he3koxBOj9dbMkJVnVk3ICuuYyN5bAXc=; b=QRUAAGn1SPtWP2nKOImPifvsZNvZY0LHzPaGsQ1N0D5yKna6jPoEqO7DxFYk2UUjf+ KXyd377fkxWn/3pnk0GHDGywfpgawNmxHwiz7OtWndNHRVcr30jQIdQUyXB30a7oVXOc 7prnE4P5SpqcH0Tswof/eX/0t3Z62pCNU5JLawOdOhySUG6LcCx7mff2fwyw/6+wJqom playQ25Bg6KYX49UHv/UsTa9uhKlAK5fn53Nj6gEkq/amlijrmpVSVmvE+CYfkn0UZS8 BVXGGug2QmkYi2n4j07XHQ4hbk+LcrglWJdJzuiyKMzFBhR/fov7jRK8usYnHt1PBg2h QZqA== X-Forwarded-Encrypted: i=1; AL+hErFXiT4OWQRr6jmlnGrTLnYNrKerBlbkFX8sYxhvuMQPABcNRVbD3eeMjVdy0FCFVyh6s5UEGYR1oWQ=@vger.kernel.org X-Gm-Message-State: APuU4Z+jgXZYUNLsJKIDpuDkK0/0v0Bq7oSCy+tbxdp35EPjhThJL2bT tkCc7qDEkZyD0Mfkz0iR3iWSbmc5wrIdJOW3df8eIaHqFNLteLVjOYRYHbgPIXLbbw== X-Gm-Gg: AZFdTZdlqxRMJVhHEW9fvDSl/mOM8AlKYxl2k19TEpwC4qj94o99JzKBgiAuX8avjci sRZwriZnp/KTUtdSf/Tvb6Yq+ZwxBNISvDC4XoWurXf1Ljn9bdJ65fEuN2JB6lYcxTdhc+BqUNs 8K3vnykCqByGBx6CTTg3g3dbwwlBhbaqC79yakJUox8BsmMxBmo1WFn6SF2ZkLYp9jCQ3qPktXl CySCbjsfBSEtmbovG2SkHWZga9cdvA6Tx4r18bRb8hRdZBGRyL/xzDPh3EM7DR/rruC+pldIUKr n13CCYW5zayif0yk8KO/8pKKiiNHWclfS+LW3TSAsdUEh1BJA8JdYoIWiDj3KjZ4hvo4Lj4Au7x CzSsgc+3sIr+TC1xolW9qx0Y4SM+Ebm5nmHcMHwqiuXgeMFS6RCyIaoaNSIzD4mtfRXAUywKzD9 rjyQFAGR4v9Q/FANWDXSuaZFbVQYpnD9BdVjwnPzGhHyugFJt4eOsES5nbntqXkMPD6bqlN1aq4 36HwF5LHHyeix4uX14kkUZNDFKOy9UXv3N0+6foHL02KpqRVlX87vhGzB+TKVq7aZuNgGmDdwju meFe76mRBR+rahwKB68wGSihpAMi2j7s6T5UB0gQarjIQs1TPc5WomncDDPn+tSQJ4Y5E15lFcq Y3kHy4nb5m1I= 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-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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: 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.