From: Niklas Schnelle <schnelle@linux.ibm.com>
To: Bibo Mao <maobibo@loongson.cn>, Farhan Ali <alifm@linux.ibm.com>,
linux-s390@vger.kernel.org, linux-pci@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: helgaas@kernel.org, mjrosato@linux.ibm.com, bblock@linux.ibm.com,
agordeev@linux.ibm.com, gor@linux.ibm.com, hca@linux.ibm.com,
stable@vger.kernel.org, Tianrui Zhao <zhaotianrui@loongson.cn>,
Huacai Chen <chenhuacai@kernel.org>
Subject: Re: [PATCH v2 1/2] PCI: Allow per function PCI slots
Date: Wed, 29 Oct 2025 09:37:09 +0100 [thread overview]
Message-ID: <2d1ea24848d4c389525df63a76fe873723bad900.camel@linux.ibm.com> (raw)
In-Reply-To: <aa0214e8-31be-2b21-c8af-b7831efd60a7@loongson.cn>
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
next prev parent reply other threads:[~2025-10-29 8:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-22 21:24 [PATCH v2 0/2] PCI fixes for s390 Farhan Ali
2025-10-22 21:24 ` [PATCH v2 1/2] PCI: Allow per function PCI slots Farhan Ali
2025-10-27 12:29 ` Niklas Schnelle
2025-10-28 1:11 ` Bibo Mao
2025-10-29 8:37 ` Niklas Schnelle [this message]
2025-10-22 21:24 ` [PATCH v2 2/2] s390/pci: Add architecture specific resource/bus address translation Farhan Ali
2025-11-03 20:06 ` [PATCH v2 0/2] PCI fixes for s390 Farhan Ali
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2d1ea24848d4c389525df63a76fe873723bad900.camel@linux.ibm.com \
--to=schnelle@linux.ibm.com \
--cc=agordeev@linux.ibm.com \
--cc=alifm@linux.ibm.com \
--cc=bblock@linux.ibm.com \
--cc=chenhuacai@kernel.org \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=helgaas@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=maobibo@loongson.cn \
--cc=mjrosato@linux.ibm.com \
--cc=stable@vger.kernel.org \
--cc=zhaotianrui@loongson.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox