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=G0wEE91ktABr5UfOz1HhqP7c//v/d04j3PjFvRAB8fVmgmCZ35biYx0LjRe2n59BfSpB iT/g6QgGr75f33oFmjAPnTCMY8h5rKwCtm+q00tQX5vFXzezH8ww6DwtiSnEzfJJDdBT+ nIPje0MC6fXxCYsc1+ZwavCqYHGLKgmlQjE82OVes4abE2VIPHjISAsxL7g0hYBsYRO5V Lw3R2g7EWsoPYOfOpxnz0su3Qbq8lR18MljHezKT3n+p+xtWWENZsqidYtKdUk41SXns9 fc23NOyL6HsrF0hnmXsnKre/ChvExRCRu/UcEyS4To/iBG8lI5lymC4QKxRuPQB6ASA== 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=ImlDov91cUTLPYN1CdpCPnUtt5V11ewqCeOJad+jjr0uadaWaWfxSUnXi2nJyosICylP NwkPXMD7o/CexeyFPY9TEZFrgzHDgdzk0DX1VN3+JwpUAd81dQ+eRlI/7ZpmRb9oRAx7m sRm2VYZ0MWh+mK+EVOLfu4YNXLOEn84FsMtCIiZKL1ee7oIJ4J/SjcRjVI1N0LrTEXGWc 1dDy6yCAzpNecUf6NOxJSP4ghq9YvfIRjWV3Kv8gHb5wqc+tPnJKHBrD1LiQ8Sz4NZBVA 0qJ5seSroTOp/TRKoLxbPxK4rzkeLzkVcy0avPgGMFNQkqsKevwJsDSDHb1JeOhCmPw== 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 43211606A32C for ; Fri, 4 Dec 2026 22:53:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 43211606A32C 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-cddc597d062so871097a12.3 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=z0kOqbpPr5EKerb1KCcKXaz70DOaMWdOinHk7YkpP4eWL+v5GUtmqWYlqL5lh6pU3a a0PN2D5J106wt/SSlFnNQjsLlfmU3veGYYRuKE7nTKSSzIrFO1cjKYaLnvuSHMkB4XcF NEiGQDe6pQa1l9sOEOnSZ522M7i73b55dlqsjbzJ/DazmGfBj3gwGsevz7WB2NvxKqUZ F+D0+ETpPC6lqJQKJ/8L4WO5br1REXVT4jr9HNlyOq9Dvz22azJU/BJfYbsgRlYKr7uG +MoQgSEyeQQpuMhjMRmSULdd2r+W1drNVaE591d6oyi99UWAqUzZYcePdsx4OhUnQL9j wNcA== X-Forwarded-Encrypted: i=1; AL+hErFIVfoMaPQjrDwV9EFDRU0GFXN9X8E7q8h1UYRERjOOAOvzQbbXAIChXp6jLRaNTMYekquiwoEnziHMXHE=@vger.kernel.org X-Gm-Message-State: APuU4Z9F3BRMm21H1BvDgwytS8iaVDen5BqUKt/iK7VNBwTy+1E73WF2 UpdA5DghQzHygy9ciewB8HKJPxwNygwHKpAG9wWP43Ey2Gozz2g2vVFmcEs/t21CQA== X-Gm-Gg: AZFdTZeLImhGuDJ0p+gWjGeIY3HM5tbxB8p3KisPr3/oTUxTMhuWroKWac6Gq8vhQEA M9b1pAyx1Tii5A9K8XxqYXA1+9iWoDajVmJEPfsxSwOaFGXmJbGjrNc4WCqHKLtsNfdXCWHWX9T dovPFPSuVRbWNaBSJkkynpc40LBIQt2hPD0ASvaZCRzJlScQDRHNH9pd0J8w9QMa8jIldmR3zwI dLflDs26FvcDGjR6tpJrjwH2Pb6fzYdEJb161I4oF5ZMQx7jzKFWa45lNRQ1rKgJujLhyh6iCJa 1bRT7gXUAB62dJKi8rNaDqfJHhRCwwb1mL0Thb56qlh+gGtHI5mA3u+x54yMfruMcpRBy14KtWA I4HanrgeRJZyoVt6u1EsJx4xAPh6JxRcj1ZoMB1HqwHSqG/7VRjHq8GK11MVSTQIgV5Gm5W0y/M wbwVg9MaCKc/80UvBXoIkSc8ABx1TeNc5Y0M7RN0qO2BgaN3vjv1uDi2P3FzLM24C3m6T4hQax4 2Z2R1AnVhVG0qELc+IWVzBMd/Hbp0DqfHoS+N7RVeySoLrNGfgglm7L7mWKoJ4LUXxQgz1OuyIh 19hQLU37qoga6ABcMJjakFb0Fs9h0Ya0GMmevFF1g3jmDKM0wIxsSVuYhjaaQ9A7mPMO6BvMn+J iQB9Kv6Zrrnk= 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-kernel@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.