From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (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 C3946606A32C for ; Fri, 4 Dec 2026 22:53:16 +0000 (UTC) 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=eMce+YPI Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4jh6Gf5xrsz2yLY; Sat, 05 Dec 2026 09:53:14 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip="2607:f8b0:4864:20::52f" ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1796424794; cv=none; b=GosAZeTRgIWtfytPDEtoAelpdmPIJIIEFl2Nu2IgWQQRPHTa9hTPl9LfMfBYtamimXgnkxVuGRHzNwOmko0CvvCoHJjTgK6f5+mGeH37up7TfdMr8CTCNtqLfeulp0OQs0LaHc9LYjQ6QNF/6uSdrmhrQ+Zm/FBflcY7n9fpl252JVLOCumsyEECweA1VzmdBlOzaRMohJxRQYj0cdZJoZLoTSPXLmHpCneBA6MNv6r4iayKGKoe5fNG0P7tpZZIX3TjdN9Mxxdx4xwzN1genT7N2MLobvnG4UILzWlyj97dg7FJ+S3lmzZc3W4LNUwUruo0nm2RnJeV1qE19a1wXg== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1796424794; c=relaxed/relaxed; bh=pRZuSFpXJJ9he3koxBOj9dbMkJVnVk3ICuuYyN5bAXc=; h=Mime-Version:Content-Type:Date:Message-Id:Cc:Subject:From:To: References:In-Reply-To; b=Qxxfo3HGHqoeJLfwPGLskRapZkJL+zRhe/zJdxXE9ESruUH9Bp4fYdPKrUN+AboPXVf+VpR1bdqiBX2D9lFco9v6YBl6eSB0bqUY4QtIBfWEbWGZxYYI6OxhLVIAk4JvTcHfyElTBz521Cy8TDrktrYWyXFXrgQx4WmH+ruk/soq7uhPzV3Iv/Zz2gQ+6U458mqi8/rko0uVrirurseKblFxtG4KxhyNl5+OO02m4LAL89DZcs6qDPS2VcP8KVy9F2d0es8bw9h8PyDIYNX/cptk1rVHkcx3WXuRG55ZngtNQp6PjA6amfC+hm4676PWe2ZPtQtAArgGcngD2ChoRA== ARC-Authentication-Results: i=1; lists.ozlabs.org; dmarc=pass (p=reject dis=none) header.from=google.com; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=eMce+YPI; dkim-atps=neutral; spf=pass (client-ip=2607:f8b0:4864:20::52f; helo=mail-pg1-x52f.google.com; envelope-from=dmatlack@google.com; receiver=lists.ozlabs.org) smtp.mailfrom=google.com Authentication-Results: lists.ozlabs.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=eMce+YPI; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=google.com (client-ip=2607:f8b0:4864:20::52f; helo=mail-pg1-x52f.google.com; envelope-from=dmatlack@google.com; receiver=lists.ozlabs.org) Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4jh6Gd2WWgz2yHD for ; Sat, 05 Dec 2026 09:53:12 +1100 (AEDT) Received: by mail-pg1-x52f.google.com with SMTP id 41be03b00d2f7-cddc597d062so871096a12.3 for ; Fri, 04 Dec 2026 14:53:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1796424789; x=1797029589; darn=lists.ozlabs.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=eMce+YPIbsfqnO4iOAzKVumVi/HH3ygeOAcFlldOXAc+JJ6TWCruvRJ2//wrMczib/ KJV2MscTaX82zlgsByVpTe647jFvfxFAHJDldGHCYUjGFWvALiKSqkBlKNwNOJCRcvFL DLDhOlHDnL/KSi+ZYf6nbg6qJJi8utMTo6epVrKInSEWZJZL4rC3LvRGOgHC4HHNPZUB P6T73F8I6m8aDe40NS/YdXgzEKU0BR7BLgxspjj1R2GeaH4XynwoyOAWQ7i+EmVqrMER 14UNv2i30KEGejeZnXJnHND+4WIWiXdQX41e+dWS6wgSlCN9RONB7N6cclCXN+fZ4RQ2 Uylw== 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=l1Nb76MjOQV1qIN/ffqBtYFoWiqqoN9UeFpjBQ8HYocOibsyUEZtuQZZ9GCoV2Q72w IZ2WUT8KTf/WLB6VOdt1uyN1ofDnNF8/EISopZaBwDtN37pQ0cw9As5zj3hR8kuwAWsV 5r6lT8GRkXdCP4G5HsTBBYg6M/udA8jtsw8P2i1nW3pPFBpXDTJe7xfA3HS6g7kcxIm7 JeOANzS+cxUVHRGdY3YsbmLu7CalaO10zEshH2Jlw46bZjMY4vbNdzib/MLVXCRPpYED 6BRy9JMGeYzkPXk8u8m2mIjQL5QwymZXsA5Jzo0PmiGPi/g9NAYmv1o1nfuTCnYXpcT2 HUTQ== X-Forwarded-Encrypted: i=1; AL+hErEY63Y3aaWmDZdaNFFQbBkKuWolStuApQz5kVqWYsf5TG4O8PKx+w4Dr5P+NyhHEWPkzldKZqkz0RmDvDA=@lists.ozlabs.org X-Gm-Message-State: APuU4Z+KF51V2huOg59gGLlAwJ7EXxq0lOfBAQyZFhptfXbSmA4L1E1U 2KES78PxG+YnOSEZAprZ6YBEqcB3CyaESeWvQNbCcVdP+Tebg0OTEwKQYTuteq4Wrw== X-Gm-Gg: AZFdTZcmYvHLyenIhQJEYAMh+kMjxD5OX6RTYwXoW9SnX6qfPoxuEPI340YV7Nl1SXl ibyR/0GneN6xsswuSe5SBMmaULvOkAjx83QHZm0svx9XEHU/XcxRWCUy9WFjLNu7FwNWSDI0txj 5HeOST9J/I6lcWLfRdHDjqbPIhbSg478WoiuzcBclqvxJXdQyAJc/5oBIV7pkcOHdsNWGr4JVCN Q5yw0jUJC98vzlKB7b9oxG4c55DfVtEwq/Y5NONJlLGBXkYt4els3YWNx1mfVQAaHFRdpneOvwx 3ZBB6UjKj84mIL+iMjHaVqTiS/KKjbVYWzGhz9GgwScHu31nKYOmdo/Berdn9H6JhTpoDMr/sSF CLrdubZ6WE41T8T4hRSQ2jOUZzJCgB6ZgRgNlRjXE+XbbpZ6luepRd74nqgbVUvw9CYMZ+/8Y+6 GwI9hlcQ6OL9RKwunc0G6wvmdurhBCZTGc7R9XD09gKN54QS/pdONfW4rCvxpK8RdldPlQDmNE5 zJhNqxIPKB8zu2KOIulaR99VelXQIE4x604p+O2y/4w+vEhYhVXiyRojmUPA1qGWqSzn/UHluae p6rBpeU+8RQwf6vC9eqLHDuBIX1MYrq5xf1F3vRJF/HFeDwN9sR4xkWjGXhNbG1NYyiQZNhnP69 mKOE9VZkju2Y= 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: linuxppc-dev@lists.ozlabs.org List-Id: List-Help: List-Owner: List-Post: List-Archive: , List-Subscribe: , , Precedence: list 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-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_PASS,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.