<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-dev/drivers/pci/access.c, branch linus/master</title>
<subtitle>Linux kernel development work - see feature branches</subtitle>
<id>https://git.zx2c4.com/linux-dev/atom/drivers/pci/access.c?h=linus%2Fmaster</id>
<link rel='self' href='https://git.zx2c4.com/linux-dev/atom/drivers/pci/access.c?h=linus%2Fmaster'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/'/>
<updated>2022-03-04T21:59:52Z</updated>
<entry>
<title>PCI: Reduce warnings on possible RW1C corruption</title>
<updated>2022-03-04T21:59:52Z</updated>
<author>
<name>Mark Tomlinson</name>
<email>mark.tomlinson@alliedtelesis.co.nz</email>
</author>
<published>2020-08-06T04:14:55Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=92c45b63ce22c8898aa41806e8d6692bcd577510'/>
<id>urn:sha1:92c45b63ce22c8898aa41806e8d6692bcd577510</id>
<content type='text'>
For hardware that only supports 32-bit writes to PCI there is the
possibility of clearing RW1C (write-one-to-clear) bits. A rate-limited
messages was introduced by fb2659230120, but rate-limiting is not the best
choice here. Some devices may not show the warnings they should if another
device has just produced a bunch of warnings. Also, the number of messages
can be a nuisance on devices which are otherwise working fine.

Change the ratelimit to a single warning per bus. This ensures no bus is
'starved' of emitting a warning and also that there isn't a continuous
stream of warnings. It would be preferable to have a warning per device,
but the pci_dev structure is not available here, and a lookup from devfn
would be far too slow.

Suggested-by: Bjorn Helgaas &lt;helgaas@kernel.org&gt;
Fixes: fb2659230120 ("PCI: Warn on possible RW1C corruption for sub-32 bit config writes")
Link: https://lore.kernel.org/r/20200806041455.11070-1-mark.tomlinson@alliedtelesis.co.nz
Signed-off-by: Mark Tomlinson &lt;mark.tomlinson@alliedtelesis.co.nz&gt;
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Reviewed-by: Florian Fainelli &lt;f.fainelli@gmail.com&gt;
Reviewed-by: Rob Herring &lt;robh@kernel.org&gt;
Acked-by: Scott Branden &lt;scott.branden@broadcom.com&gt;
</content>
</entry>
<entry>
<title>PCI: Use PCI_ERROR_RESPONSE to identify config read errors</title>
<updated>2021-11-18T20:31:43Z</updated>
<author>
<name>Naveen Naidu</name>
<email>naveennaidu479@gmail.com</email>
</author>
<published>2021-11-18T14:03:32Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=289e3ea3a506e02f8d4a6a68d6cc0775f4d232c1'/>
<id>urn:sha1:289e3ea3a506e02f8d4a6a68d6cc0775f4d232c1</id>
<content type='text'>
Include PCI_ERROR_RESPONSE along with 0xFFFF and 0xFFFFFFFF in the comment
about identifying config read errors. This makes checks for config read
errors easier to find. Comment change only.

Link: https://lore.kernel.org/r/866e2db544df45af70df7e64659bf02e03998ae3.1637243717.git.naveennaidu479@gmail.com
Signed-off-by: Naveen Naidu &lt;naveennaidu479@gmail.com&gt;
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
</content>
</entry>
<entry>
<title>PCI: Drop error data fabrication when config read fails</title>
<updated>2021-11-18T19:38:20Z</updated>
<author>
<name>Naveen Naidu</name>
<email>naveennaidu479@gmail.com</email>
</author>
<published>2021-11-18T14:03:14Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=316df7062a7926e315507e2d5b7a23331a3bfa67'/>
<id>urn:sha1:316df7062a7926e315507e2d5b7a23331a3bfa67</id>
<content type='text'>
If config pci_ops.read() methods return failure, the PCI_OP_READ() and
PCI_USER_READ_CONFIG() wrappers use PCI_SET_ERROR_RESPONSE() to set the
data value, so there's no need to set it in the pci_ops.read() methods
themselves.

Drop the unnecessary data value fabrication when pci_ops.read() fails.

Link: https://lore.kernel.org/r/1b2edb060cf19b45f70645b331e6c08c9ba798c0.1637243717.git.naveennaidu479@gmail.com
Signed-off-by: Naveen Naidu &lt;naveennaidu479@gmail.com&gt;
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Reviewed-by: Rob Herring &lt;robh@kernel.org&gt;
</content>
</entry>
<entry>
<title>PCI: Use PCI_SET_ERROR_RESPONSE() for disconnected devices</title>
<updated>2021-11-18T19:37:34Z</updated>
<author>
<name>Naveen Naidu</name>
<email>naveennaidu479@gmail.com</email>
</author>
<published>2021-11-18T14:03:13Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=9bc9310c8f641234a81f139414fdb5b20b1df8c4'/>
<id>urn:sha1:9bc9310c8f641234a81f139414fdb5b20b1df8c4</id>
<content type='text'>
A config read from a PCI device that doesn't exist or doesn't respond
causes a PCI error. There's no real data to return to satisfy the CPU read,
so most hardware fabricates ~0 data.

Use PCI_SET_ERROR_RESPONSE() to set the error response when we think the
device has already been disconnected.

This helps unify PCI error response checking and make error checks
consistent and easier to find.

Link: https://lore.kernel.org/r/29db0a6874716db80757e4e3cdd03562f13eb0cb.1637243717.git.naveennaidu479@gmail.com
Signed-off-by: Naveen Naidu &lt;naveennaidu479@gmail.com&gt;
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
</content>
</entry>
<entry>
<title>PCI: Set error response data when config read fails</title>
<updated>2021-11-18T19:36:55Z</updated>
<author>
<name>Naveen Naidu</name>
<email>naveennaidu479@gmail.com</email>
</author>
<published>2021-11-18T14:03:12Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=f4f7eb43c5238fd2636a8e310394ed9920627ab3'/>
<id>urn:sha1:f4f7eb43c5238fd2636a8e310394ed9920627ab3</id>
<content type='text'>
When a PCI config read fails, most PCI host bridges fabricate ~0 data to
complete the CPU read.  But some host bridges do not; their drivers may
only return an error from the pci_ops.read() method.

In PCI_OP_READ() and PCI_USER_READ_CONFIG(), use PCI_SET_ERROR_RESPONSE()
to set the data value to indicate an error when pci_ops.read() fails.

This means the host bridge driver no longer needs to fabricate error data
when they detect errors.

This makes error response fabrication consistent and helps in removal of a
lot of repeated code.

Suggested-by: Rob Herring &lt;robh@kernel.org&gt;
Link: https://lore.kernel.org/r/4188fc5465631ce0d472d1423de3d9fb2f09b8ff.1637243717.git.naveennaidu479@gmail.com
Signed-off-by: Naveen Naidu &lt;naveennaidu479@gmail.com&gt;
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Reviewed-by: Rob Herring &lt;robh@kernel.org&gt;
Reviewed-by: Pali Rohár &lt;pali@kernel.org&gt;
</content>
</entry>
<entry>
<title>Merge branch 'pci/misc'</title>
<updated>2020-08-05T23:24:16Z</updated>
<author>
<name>Bjorn Helgaas</name>
<email>bhelgaas@google.com</email>
</author>
<published>2020-08-05T23:24:16Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=0caa17f5f2bbd3b4734a1a80d4403493e747ed4c'/>
<id>urn:sha1:0caa17f5f2bbd3b4734a1a80d4403493e747ed4c</id>
<content type='text'>
- Convert PCIe capability PCIBIOS errors to errno (Bolarinwa Olayemi
  Saheed)

- Align PCIe capability and PCI accessor return values (Bolarinwa Olayemi
  Saheed)

- Replace http:// links with https:// (Alexander A. Klimov)

- Replace lkml.org, spinics, gmane with lore.kernel.org (Bjorn Helgaas)

- Update panic message to mention kzalloc(), not kmalloc() (Liao Pingfang)

- Move PCI_VENDOR_ID_REDHAT definition to pci_ids.h (Huacai Chen)

- Remove unused pci_lost_interrupt() (Heiner Kallweit)

* pci/misc:
  PCI: Remove unused pci_lost_interrupt()
  PCI: Move PCI_VENDOR_ID_REDHAT definition to pci_ids.h
  PCI: Fix error in panic message
  PCI: Replace lkml.org, spinics, gmane with lore.kernel.org
  PCI: Replace http:// links with https://
  PCI: Align PCIe capability and PCI accessor return values
  PCI: Convert PCIe capability PCIBIOS errors to errno
</content>
</entry>
<entry>
<title>PCI: Fix pci_cfg_wait queue locking problem</title>
<updated>2020-07-07T20:09:01Z</updated>
<author>
<name>Bjorn Helgaas</name>
<email>bhelgaas@google.com</email>
</author>
<published>2020-06-25T23:14:55Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=2a7e32d0547f41c5ce244f84cf5d6ca7fccee7eb'/>
<id>urn:sha1:2a7e32d0547f41c5ce244f84cf5d6ca7fccee7eb</id>
<content type='text'>
The pci_cfg_wait queue is used to prevent user-space config accesses to
devices while they are recovering from reset.

Previously we used these operations on pci_cfg_wait:

  __add_wait_queue(&amp;pci_cfg_wait, ...)
  __remove_wait_queue(&amp;pci_cfg_wait, ...)
  wake_up_all(&amp;pci_cfg_wait)

The wake_up acquires the wait queue lock, but the add and remove do not.

Originally these were all protected by the pci_lock, but cdcb33f98244
("PCI: Avoid possible deadlock on pci_lock and p-&gt;pi_lock"), moved
wake_up_all() outside pci_lock, so it could race with add/remove
operations, which caused occasional kernel panics, e.g., during vfio-pci
hotplug/unplug testing:

  Unable to handle kernel read from unreadable memory at virtual address ffff802dac469000

Resolve this by using wait_event() instead of __add_wait_queue() and
__remove_wait_queue().  The wait queue lock is held by both wait_event()
and wake_up_all(), so it provides mutual exclusion.

Fixes: cdcb33f98244 ("PCI: Avoid possible deadlock on pci_lock and p-&gt;pi_lock")
Link: https://lore.kernel.org/linux-pci/79827f2f-9b43-4411-1376-b9063b67aee3@huawei.com/T/#u
Based-on: https://lore.kernel.org/linux-pci/20191210031527.40136-1-zhengxiang9@huawei.com/
Based-on-patch-by: Xiang Zheng &lt;zhengxiang9@huawei.com&gt;
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Tested-by: Xiang Zheng &lt;zhengxiang9@huawei.com&gt;
Cc: Heyi Guo &lt;guoheyi@huawei.com&gt;
Cc: Biaoxiang Ye &lt;yebiaoxiang@huawei.com&gt;
</content>
</entry>
<entry>
<title>PCI: Align PCIe capability and PCI accessor return values</title>
<updated>2020-06-26T18:50:41Z</updated>
<author>
<name>Bolarinwa Olayemi Saheed</name>
<email>refactormyself@gmail.com</email>
</author>
<published>2020-06-15T07:32:25Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=b91535812d663acc47952d05386c8a126eae8080'/>
<id>urn:sha1:b91535812d663acc47952d05386c8a126eae8080</id>
<content type='text'>
The PCI config accessors (pci_read_config_word(), et al) return
PCIBIOS_SUCCESSFUL (zero) or positive error values like
PCIBIOS_FUNC_NOT_SUPPORTED.

The PCIe capability accessors similarly return PCIBIOS errors, but in
addition, they can return -EINVAL.  This makes it harder than it should be
to check for errors.

Return PCIBIOS_BAD_REGISTER_NUMBER instead of -EINVAL in all PCIe
capability accessors.

Suggested-by: Bjorn Helgaas &lt;bjorn@helgaas.com&gt;
Link: https://lore.kernel.org/r/20200615073225.24061-9-refactormyself@gmail.com
Signed-off-by: Bolarinwa Olayemi Saheed &lt;refactormyself@gmail.com&gt;
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
</content>
</entry>
<entry>
<title>PCI/AER: Save AER Capability for suspend/resume</title>
<updated>2019-10-18T22:05:42Z</updated>
<author>
<name>Patel, Mayurkumar</name>
<email>mayurkumar.patel@intel.com</email>
</author>
<published>2019-10-18T16:52:21Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=af65d1ad416bc6e069ccb9e649faeda224248f96'/>
<id>urn:sha1:af65d1ad416bc6e069ccb9e649faeda224248f96</id>
<content type='text'>
Previously we did not save and restore the AER configuration on
suspend/resume, so the configuration may be lost after resume.

Save the AER configuration during suspend and restore it during resume.

[bhelgaas: commit log]
Link: https://lore.kernel.org/r/92EBB4272BF81E4089A7126EC1E7B28492C3B007@IRSMSX101.ger.corp.intel.com
Signed-off-by: Mayurkumar Patel &lt;mayurkumar.patel@intel.com&gt;
Signed-off-by: Kuppuswamy Sathyanarayanan &lt;sathyanarayanan.kuppuswamy@linux.intel.com&gt;
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Reviewed-by: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>PCI: Make pcie_downstream_port() available outside of access.c</title>
<updated>2019-09-07T12:45:25Z</updated>
<author>
<name>Mika Westerberg</name>
<email>mika.westerberg@linux.intel.com</email>
</author>
<published>2019-08-22T08:55:52Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=984998e3404e9073479281dbba8af36b104e8c00'/>
<id>urn:sha1:984998e3404e9073479281dbba8af36b104e8c00</id>
<content type='text'>
pcie_downstream_port() is useful in other places where code needs to
determine whether the PCIe port is downstream so make it available outside
of access.c.

Link: https://lore.kernel.org/r/20190822085553.62697-1-mika.westerberg@linux.intel.com
Signed-off-by: Mika Westerberg &lt;mika.westerberg@linux.intel.com&gt;
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Reviewed-by: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
</content>
</entry>
</feed>
