]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
s390/pci: refresh function handle in iomap
authorNiklas Schnelle <schnelle@linux.ibm.com>
Thu, 17 Mar 2022 15:35:00 +0000 (12:35 -0300)
committerPaolo Pisati <paolo.pisati@canonical.com>
Tue, 22 Mar 2022 16:57:50 +0000 (17:57 +0100)
commita79eda41c2f1bfa19442620d7f84b4f670890872
tree1a998ca3d65e35d7eeb721133683e64cce468a8b
parenta544131a06c909267d39dafbc5324f72e174b74f
s390/pci: refresh function handle in iomap

BugLink: https://bugs.launchpad.net/bugs/1959532
The function handle of a PCI function is updated when disabling or
enabling it as well as when the function's availability changes or it
enters the error state.

Until now this only occurred either while there is no struct pci_dev
associated with the function yet or the function became unavailable.
This meant that leaving a stale function handle in the iomap either
didn't happen because there was no iomap yet or it lead to errors on PCI
access but so would the correct disabled function handle.

In the future a CLP Set PCI Function Disable/Enable cycle during PCI
device recovery may be done while the device is bound to a driver.  In
this case we must update the iomap associated with the now-stale
function handle to ensure that the resulting zPCI instruction references
an accurate function handle.

Since the function handle is accessed by the PCI accessor helpers
without locking use READ_ONCE()/WRITE_ONCE() to mark this access and
prevent compiler optimizations that would move the load/store.

With that infrastructure in place let's also properly update the
function handle in the existing cases. This makes sure that in the
future debugging of a zPCI function access through the handle will
show an up to date handle reducing the chance of confusion. Also it
makes sure we have one single place where a zPCI function handle is
updated after initialization.

Reviewed-by: Pierre Morel <pmorel@linux.ibm.com>
Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
(cherry picked from commit 4fe204977096e900cb91a3298b05c794ac24f540)
Signed-off-by: Patricia Domingues <patricia.domingues@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
arch/s390/include/asm/pci.h
arch/s390/pci/pci.c
arch/s390/pci/pci_event.c
arch/s390/pci/pci_insn.c