lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251009155858.0000179c@huawei.com>
Date: Thu, 9 Oct 2025 15:58:58 +0100
From: Jonathan Cameron <jonathan.cameron@...wei.com>
To: Evangelos Petrongonas <epetron@...zon.de>
CC: Bjorn Helgaas <bhelgaas@...gle.com>, Alex Williamson
	<alex.williamson@...hat.com>, "Rafael J . Wysocki" <rafael@...nel.org>, Len
 Brown <lenb@...nel.org>, Pasha Tatashin <pasha.tatashin@...een.com>, David
 Matlack <dmatlack@...gle.com>, Vipin Sharma <vipinsh@...gle.com>, Chris Li
	<chrisl@...nel.org>, Jason Miu <jasonmiu@...gle.com>, "Pratyush Yadav"
	<pratyush@...nel.org>, Stanislav Spassov <stanspas@...zon.de>,
	<linux-pci@...r.kernel.org>, <linux-acpi@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>, <nh-open-source@...zon.com>
Subject: Re: [RFC PATCH 08/13] pci: Save only spec-defined configuration
 space

On Fri, 3 Oct 2025 09:00:44 +0000
Evangelos Petrongonas <epetron@...zon.de> wrote:

> Change PCI configuration space save/restore operations by
> saving only the regions defined by the PCI specification avoiding any
> potential side effects of undefined behaviour.
> 
> The current implementation saves the entire configuration space for
> device restore operations, including reserved and undefined regions.
> This change modifies the save logic to save only architecturally defined
> configuration space regions and skipping the undefined areas.
> 
> This benefits the PCSC hitrate, as a 4byte access to a region where only
> 2 bytes are cacheable and 2 are undefined, therefore uncached, will lead
> to a HW access instead.
> 
> Signed-off-by: Evangelos Petrongonas <epetron@...zon.de>
> ---
>  drivers/pci/pci.c | 61 +++++++++++++++++++++++++++++++++++++++++++----
>  1 file changed, 56 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index db940f8fd408..3e99baaaf8cd 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -1752,11 +1752,62 @@ static void pci_restore_pcix_state(struct pci_dev *dev)
>  int pci_save_state(struct pci_dev *dev)
>  {
>  	int i;
> -	/* XXX: 100% dword access ok here? */
> -	for (i = 0; i < 16; i++) {
> -		pci_read_config_dword(dev, i * 4, &dev->saved_config_space[i]);
> -		pci_dbg(dev, "save config %#04x: %#010x\n",
> -			i * 4, dev->saved_config_space[i]);
> +
> +	if (dev->hdr_type == PCI_HEADER_TYPE_NORMAL) {
> +		for (i = 0; i < 13; i++) {

Needs basing on the register defines not magic numbers.

Same for other cases.

Jonathan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ