[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2d1ea24848d4c389525df63a76fe873723bad900.camel@linux.ibm.com>
Date: Wed, 29 Oct 2025 09:37:09 +0100
From: Niklas Schnelle <schnelle@...ux.ibm.com>
To: Bibo Mao <maobibo@...ngson.cn>, Farhan Ali <alifm@...ux.ibm.com>,
        linux-s390@...r.kernel.org, linux-pci@...r.kernel.org,
        linux-kernel@...r.kernel.org
Cc: helgaas@...nel.org, mjrosato@...ux.ibm.com, bblock@...ux.ibm.com,
        agordeev@...ux.ibm.com, gor@...ux.ibm.com, hca@...ux.ibm.com,
        stable@...r.kernel.org, Tianrui Zhao <zhaotianrui@...ngson.cn>,
        Huacai Chen
	 <chenhuacai@...nel.org>
Subject: Re: [PATCH v2 1/2] PCI: Allow per function PCI slots
On Tue, 2025-10-28 at 09:11 +0800, Bibo Mao wrote:
> 
> On 2025/10/27 下午8:29, Niklas Schnelle wrote:
> > On Wed, 2025-10-22 at 14:24 -0700, Farhan Ali wrote:
> > > On s390 systems, which use a machine level hypervisor, PCI devices are
> > > always accessed through a form of PCI pass-through which fundamentally
> > > operates on a per PCI function granularity. This is also reflected in the
> > > s390 PCI hotplug driver which creates hotplug slots for individual PCI
> > > functions. Its reset_slot() function, which is a wrapper for
> > > zpci_hot_reset_device(), thus also resets individual functions.
> > > 
> > > Currently, the kernel's PCI_SLOT() macro assigns the same pci_slot object
> > > to multifunction devices. This approach worked fine on s390 systems that
> > > only exposed virtual functions as individual PCI domains to the operating
> > > system.  Since commit 44510d6fa0c0 ("s390/pci: Handling multifunctions")
> > > s390 supports exposing the topology of multifunction PCI devices by
> > > grouping them in a shared PCI domain. When attempting to reset a function
> > > through the hotplug driver, the shared slot assignment causes the wrong
> > > function to be reset instead of the intended one. It also leaks memory as
> > > we do create a pci_slot object for the function, but don't correctly free
> > > it in pci_slot_release().
> > > 
> > > Add a flag for struct pci_slot to allow per function PCI slots for
> > > functions managed through a hypervisor, which exposes individual PCI
> > > functions while retaining the topology.
> > 
> > I wonder if LoongArch which now also does per PCI function pass-through
> > might need this too. Adding their KVM maintainers.
> 
> Hi Niklas,
> 
> Thanks for your reminder. Yes, LoongArch do per PCI function 
> pass-throught. In theory, function pci_slot_enabled_per_func() should 
> return true on LoongArch also. Only that now IOMMU driver is not merged, 
> there is no way to test it, however we will write down this as a note 
> inside about this issue and verify it once IOMMU driver is merged.
> 
> 
> Regards
> Bibo Mao
> 
Hi Bibo,
Is your ability to test if it works for you also hindered for my other
patch touching pci_scan_slot()? It sounded like Huacai was looking into
testing that.
Thanks,
Niklas
Powered by blists - more mailing lists
 
