From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.215.175 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796424790; b=LxRxkNa8clX52kRNYpExxhgTwfyhtMe0usmShtOw66+BUOJHey1UfnbiEqd0MO/X4fSP jWv0dpoyxQ9Ft4fyW+/bkaiwudyGEcLELREu0B48n0CK1k99efdZDvlNhyqeMlOeXYlxC BImJM7VT2//AvkPoHYedJaF1w+XIdDWUnodTp7FlTxTll2QjDkZxjr5rxWm2cuPhmeXK5 TyXW6svXT67Hy9UoYEgqxRD/AcOv0Nr98Z6M/A0Rd274vzTDgbDmqLQgNp61rLYOdOX4E EVvMqPvSUJ9j9uZiKUPfYWNf7FhVQCiLQ+/nWY5QfTiisbYCS8TzuVSqjXO/107+ZQQ== 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=POuVFzBx04HLS/gWQPpzDtmeQNMk6AFDPU0J/vhGOPJ4A2biUVUe48FZRG8TgVaD4nFU pRB6gnH9mREcpzMS3q5Yt4iGPZvnD/JbDN6siLPXJVzto7EXwggukTR8b7Rh2KUR5+oRO ZqyDTpoHlDEQoHChEOEVOVsQn7l2bHIoRmyjtUPeEly1l8/+9havusvUbZY7v8jri7ozk gxzXaJnHXvLQMYeIVuY3uZjolOLV2eK1AE85qlxIsnmg1AZUqvfLPc3hDYAiYo2NsGQuc dHK6jHCw52R0vZIe+cVdYQ7GYvxGzp1gCUw4Tq8zBG2aMw7T2etzOwnufegZkI2evvg== 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.175 Received: from mail-pg1-f175.google.com (mail-pg1-f175.google.com [209.85.215.175]) (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 432CA606A32D for ; Fri, 4 Dec 2026 22:53:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 432CA606A32D 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-f175.google.com with SMTP id 41be03b00d2f7-ce103a1cf0eso1074631a12.0 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=HFLUJKidjTHVD8oUxQmB3pll2SWcGPGh6SPdwqJeysmw20BPMoO+DtBMl7W2x1A1Xg kUtD4UxS+NvsgBH2hJLkg5MdfI/9LZy2i9GfUiW0JymsqDSz+lVFiG0SyFKJ0tNCASpa St61y9NXSN6a/g9IHWOMg6PL95CXXfvUCfBjuETNQW6voRQNHcR2IynGqKnB0+f43/v/ qnXGefJAAzWUUfW7UjaFrBovtdvNgL1kmyo9meq7ClDeczRBWFbQXltfeOPaQwwx2b0N e6l+Sg8GprCQKNzcwfuLHLA1Z+9HBnwQlFVV9AFfAB+ptgLsVyjVJ7+bzZAtTD+tMZnJ n4Rw== X-Forwarded-Encrypted: i=1; AL+hErEhVGreO6GZop21D6EEs1+UeD8FOUiiEuf4Tr4+HlD6XKDnQrR0if9FwxV6eEbJN/OFki+BaTHaxBY=@vger.kernel.org X-Gm-Message-State: APuU4Z9uGGSpQjIe+fWQlQ6ugZ46edke+vrkIGhqZOwwYScS7DGy0NmX bTpWavnQgdrBXcYfeS6qibfYbR1+NGI1BreYM+Pb6jdSCsTkhhOEfAABDNPtNAvUsA== X-Gm-Gg: AZFdTZeB5NhpbVsdz7EgPIHXSaqVfwxbuZMP0VM3i9PKUamVKZKWdpYjIqGq8HkphI2 01Ta1/kAIOcmzefvUd2v3foIb2kKZM/1kbeCT6ulTw/BEP3Kjf3mvhj2JfxY4GQufVLuKsSvt4y fnplq7Tpikm36zHY7tVkHzotYm0zHKpIjGz7z2Qx/fGgAatow2eFQS+wLeq7BL8QtCqGwlu18fV 98msXr0y2XYEdxUpbcxhZMmD0ISGQ9g/Yd6ZM14/5OUcIFxwDzkWIodNPG+PXbb1w58NvjgJrRy Am5wQfjyOC+7zkD4y8AOKLh3pemATH/GFYhCcNVMWS8zVPHgjMilqySr8gIWiBzy7rhP2t6koRk Cd48KMKh3ITyF/ALEzNPMiAKvCKJjLu+ZN8P0EwPpdeN4bKxzS9llXI9yk+f8KgugPkVI/AGRqZ 2Wj4IGpxdTyuOWeBz4yzOvJXumlZDdvqTkigV6xxYjV1AsPsDiku0DTZA6bMTsfPgmK05Q7mYGx z4yMl3j2065TGijFhpW9Lm4CBG6TK2CZeWQKRo+1bI7/uJv0C+OYvXCgbOekQIC8b0qq/FvpB3R ofvH3C2esib3gzmYmZp87+7ZMty8vhQk4heFTW+Nb3Ag4uTZaFlyVzi+yGBxvl8mJueSDEDhcZC ubs1TWqMOofk= 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-pci@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.