On Thu, 2025-08-14 at 09:33 -0700, Farhan Ali wrote: > On 8/14/2025 6:12 AM, Niklas Schnelle wrote: > > On Wed, 2025-08-13 at 16:56 -0600, Alex Williamson wrote: > > > On Wed, 13 Aug 2025 14:52:24 -0700 > > > Farhan Ali <alifm@xxxxxxxxxxxxx> wrote: > > > > > > > On 8/13/2025 1:30 PM, Alex Williamson wrote: > > > > > On Wed, 13 Aug 2025 10:08:19 -0700 > > > > > Farhan Ali <alifm@xxxxxxxxxxxxx> wrote: > > > > > > > > > > > For zPCI devices we should drive a platform specific function reset > > > > > > as part of VFIO_DEVICE_RESET. This reset is needed recover a zPCI device > > > > > > in error state. > > > > > > > > > > > > Signed-off-by: Farhan Ali <alifm@xxxxxxxxxxxxx> > > > > > > --- > > > > > > arch/s390/pci/pci.c | 1 + > > > > > > drivers/vfio/pci/vfio_pci_core.c | 4 ++++ > > > > > > drivers/vfio/pci/vfio_pci_priv.h | 5 ++++ > > > > > > drivers/vfio/pci/vfio_pci_zdev.c | 39 ++++++++++++++++++++++++++++++++ > > > > > > 4 files changed, 49 insertions(+) > --- snip --- > > Now for pci_reset_hotplug_slot() via VFIO_DEVICE_PCI_HOT_RESET I'm not > > sure why that won't work as is. @Farhan do you know? > > VFIO_DEVICE_PCI_HOT_RESET would have been sufficient interface for > majority of PCI devices on s390x as that would drive a bus reset. It was > sufficient as most devices were single bus devices. But in the latest > generation of machines (z17) we expose true SR-IOV and an OS can have > access to both PF and VFs and so these are on the same bus and can have > different ownership based on what is bound to vfio-pci. > Talked to Farhan a bit off list. I think the problem boils down to this. The s390 PCI support, due to there always being a hypervisor, does hot and cold plug on a per PCI function basis. And so the hotplug driver's reset_slot() is just a wrapper around zpci_hot_reset_device() and also does per PCI function reset. Now when doing a VFIO_PCI_HOT_RESET this still doesn't give us a usable per function reset because vfio_pci_ioctl_get_pci_hot_reset_info()'s grouping assumes, quite naturally, that as a slot reset this will reset an entire slot and so the ownership checks fail when we use this reset on e.g. an SR-IOV capable device with PFs + VFs where s390 exposes their PCI topology even while retaining per function hotplug. As some more background, we've had the virtual PCI topology for SR-IOV capable devices since commit 44510d6fa0c0 ("s390/pci: Handling multifunctions") added in v6.9 but only with z17 will they be generally available. Thanks, Niklas