From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.210.176 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796426568; b=DMBTMclubpZGffDrq0JTtGSKg8lRB6+dSfpsbz1Kbv/1JGNeFILsVc+YdR9zhoIo1uun m6Zb83reiQlQGZEyFggj+VRw4DD3U3OlWgIzwtwETmmCL3wdxTzFdXpbQ6belyPWbSQbh ogPIcuSgiVnqikpf0PcVdxY/zo8PEO6Kh4dQZtRIJTvkCqe82Ne7yXlAeo/dOpbD+yu2t l5GhjwR5YSqThFc3XMa0Iq2vqUwe+cJnptBolCtYyPWcYiYCuz7Hc11HtO2/zK2mKXvoZ bt1wym43LXz+npKk99UmdubSqZsIiq9EFD7i4rR44k0v9F9iCJidQAQnbNwPgzSqlLg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796426568; 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: To:Cc:Subject:From:X-Mailer:References:In-Reply-To; bh=egEB4tqKAmYu1OVv3TLkXydv5XcabfSGoUbOmkXHZ48=; b=4CYnown6NYNa/69jDKj7ps9mFHppeWql0ErQELpGt9Ko1ny19SaX4L3C4uv7WNjzUnR1 imHjtXs5W5jRCWhy6v/uXY95jh0V+VAl72Sg6DQ4ql9zwVy3LEdYV2S87sjp044LjNVcj QTSavh8eOVhJH5++xb2XdatC0Ga60N+II0SjlmhV3xcZZwhAgjdrqLbRsytuYAa7PXL9Z GlUPShJQPXwOUEZVuN6764IBwjBNiMz2dWe5xZ5oNzYN7c97D3pbHOyBdjtjRO2Q+h2Fa xrLlmb7ffkKCI34pY+y8eQaGAMy26HLliLddb4YS0hXBQ7fDxG0dro3rEXLcQusxCAg== 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=mKUcmb98; arc=none smtp.remote-ip=209.85.210.176 Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) (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 510DF606A322 for ; Fri, 4 Dec 2026 23:22:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 510DF606A322 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=mKUcmb98 Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-8b67f25e6e1so805437b3a.0 for ; Fri, 04 Dec 2026 15:22:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1796426567; x=1797031367; darn=vger.kernel.org; h=in-reply-to:references:from:subject:cc:to:message-id:date :content-type:content-transfer-encoding:mime-version:from:to:cc :subject:date:message-id:reply-to:content-type; bh=egEB4tqKAmYu1OVv3TLkXydv5XcabfSGoUbOmkXHZ48=; b=mKUcmb98a8j0WA2Q5tcJMvfY5GvvwqbV0RJNJETwj6rRJsa0pLQKQoJhXq8BUbGKoJ 9T26FsKREDXJ9XOmDd7V4C1K1V/y69899t0z7osJqXkJaEVzvhMtbHcOaYQr9dq9+XpH BZeE/bUhiPFm1Fqvi3n0F7qMXqTIkL6sJgqLEe95EVtF2HOjsX7UwIPHYwN6kxT+PGQM 5OgGIzuqZDUbd5b832feGr2mwAc4fZ8hS7lgAxL5E0l6uIdpnZYmxHogNC3MfluNquPh mSvWaAD1M2GT6dOyDDO/1yjaXQ5UhTpE1rndnNYEUqxNT05p77Fxyhrr93sYRNyZkcFK eOhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796426567; x=1797031367; h=in-reply-to:references:from:subject:cc:to: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=egEB4tqKAmYu1OVv3TLkXydv5XcabfSGoUbOmkXHZ48=; b=osmHv3cX1Nf+Pi/V6idCMGPOWN3SUACnL2woE0vKMhjfo+ne8v748IjVLPGH8Q+Dyf Z3i+ahF1h1M/eCGk3yI37e0XB/dEDNcqxzUug8ZdGYrdR/W9vP7XCtwEFDamh/hKjxOU omUpHZSBHnaJRf9VDd0vRYwVRaNFDPlTMLALUyg7SKIX+hyvgkzkHnjbDfMk1m4F7Uwt NSenOhqpDsEXn7qcIo+TskJiTvgtUL7B0X2ureacY9lkpGBcYhOtuTr1wU/p9GUoQpbc h/hWq5oJaMjRT2oBbDsQPvzqj+UfV3O9/Q8ChMUpIwF+6MZB6sPXGkhhMsCQNaplTHq2 XIyA== X-Forwarded-Encrypted: i=1; AL+hErF69GJ7uYHtfiUVzzAZ1YpLVFbK+XiXgc5Dj+Kuuz2MsUSXlq0vXAeKnXVwVxtkm2xI/s3814DmkgoU3Ss=@vger.kernel.org X-Gm-Message-State: AB4q+uES7Rz2Qbve5pgDp2g9RUPWm0Gl8YCeV8AhpXBJifW/KuktXw/B 3OQpjSlQQLHDSjnv7EZJe+0/N7L8zqTH8gQRCIHZtn/hcN212WsM+kbbJjNM1FDdyg== X-Gm-Gg: AZFdTZerACWduiDENduZ9bGGBVuJPXeUTitfuzFUgCfdjZL3ZDhH6iZiIVylMG523Oa FT2JkLWMiIUNJXLk44D6gni3rRAbSC/TyAMGxZ0GH8/GJnHswKmdtH30R/L4en6fKult06wkHan f8EyYdyAvsU+1aZi5XtxsY8ujQJiFZ1VhIv9T5Pw5PD8nE0L9vi1iNPqUMXvcYe+jvTcl9dMNRn VgTCSTLGInzYEgd+J1zflVRd4lnZ6Gh+ewc1BFykE1RAnvt3XDUagBRoQ4TGLfAaQpiElBrr3c2 3GfSVc9cIXUIwX3Vi9EH+di3IsC3Bvo/a9CXkN4vH6t2dAi0KmfE45fJOUA6p4vSQSBAuDgmMoq 9gtWz0eaUzrUVId8I14vNuKUWlW+A7CuuzIRcpiB1GT0vQCXNd0zseRq3seV3yVL2aOwkVBway3 Z1sTfCpzUItWMmlhz0H7dMvOX0EQJnLaicoj21AP8XZJzDElPSrcHpntWV3tNNSXqExHHpWAMbj dMAy+nNvUDe60gL9vX203TvJ0PMpxUfkAXlUjQE+X+1cnOIy7USPfa4VZyd3/hGes0k6V1ia5lB 4MQSCGBYsu/1IWat7rvJi+Cr8sTJGimYrZIvhHPeVU+HI3Jna9UczTWPeyfsOMT18+dFlXVbk50 tjgmAZc5eOA== X-Received: by 2002:a17:90b:2d81:b0:3b5:35eb:5ea4 with SMTP id 98e67ed59e1d1-3b5e06a6759mr2859429a91.55.1796426567083; Fri, 04 Dec 2026 15:22:47 -0800 (PST) Received: from localhost (33.79.127.34.bc.googleusercontent.com. [34.127.79.33]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3b6166af840sm651056a91.2.2026.12.04.15.22.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 04 Dec 2026 15:22:45 -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 15:22:45 -0800 Message-Id: To: "Lukas Wunner" , "David Matlack" 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 02/17] PCI: Add an offset-indexed store for saved capability registers From: "David Matlack" X-Mailer: aerc 0.21.0 References: <20261106004218.604799-1-dmatlack@google.com> <20261106004218.604799-3-dmatlack@google.com> In-Reply-To: On Fri Dec 4, 2026 at 9:55 AM PST, Lukas Wunner wrote: > On Fri, Nov 06, 2026 at 12:42:03AM +0000, David Matlack wrote: >> The store holds capability registers only. The configuration space heade= r >> continues to be saved in pci_dev.saved_config_space, which is embedded i= n >> struct pci_dev so that saving it cannot fail. > > I'd prefer moving saved_config_space to the new store as well > for consistency and simplicity. As an optional optimization, > the saved-caps library could skip the hweight and test_bit > operations for the lowest 16 dwords. Agreed, I'll do both in v3 (more details in my reply to your other email on this patch). > >> +/* >> + * Return the slot holding the value saved for the DWORD containing @of= f, or >> + * NULL if there is nowhere to save it. Reservations that do not fit in= the >> + * device's configuration space and a failure to allocate the values we= re >> + * reported during setup, so return NULL quietly for those. Reaching an= y other >> + * register that was not reserved is a kernel bug. >> + */ >> +static u32 *pci_saved_cap_slot(struct pci_dev *dev, unsigned int off) > > Documentation should be kerneldoc-formatted so that it's recognized > by cross referencers such as elixir. Will do. > The "slot" terminology is a little unfortunate as it sounds as if > there's a connection with struct pci_slot.=20 Yes, good point. I'll swap "slot" with "ptr" in the next version. >> +/** >> + * pci_write_saved_cap_word - change the saved value of a 16-bit regist= er >> + * @dev: the PCI device >> + * @off: offset of the register in configuration space >> + * @val: value to save >> + */ >> +void pci_write_saved_cap_word(struct pci_dev *dev, unsigned int off, u1= 6 val) > > Another naming issue: "write" sounds like something is written to > config space. You're actually updating the saved config store. > > Same for pci_read_saved_cap_word(). Maybe "store" / "retrieve"? How about get/set? I'd like to avoid "retrieve" since patch 17 already uses it for Live Update, where it means something else (pci_liveupdate_retrieve_saved_state()). > Aside from the issues mentioned, this looks pretty good! Thanks for the review!