From: Niklas Schnelle <schnelle@linux.ibm.com>
To: "Oliver O'Halloran" <oohall@gmail.com>
Cc: Matthew Rosato <mjrosato@linux.ibm.com>,
Alex Williamson <alex.williamson@redhat.com>,
Bjorn Helgaas <bhelgaas@google.com>,
pmorel@linux.ibm.com, Michael Ellerman <mpe@ellerman.id.au>,
linux-s390@vger.kernel.org,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
KVM list <kvm@vger.kernel.org>,
linux-pci <linux-pci@vger.kernel.org>,
Alexey Kardashevskiy <aik@ozlabs.ru>
Subject: Re: [PATCH v2] PCI: Introduce flag for detached virtual functions
Date: Thu, 13 Aug 2020 14:34:12 +0200 [thread overview]
Message-ID: <17be8c41-8989-f1da-a843-30f0761f42de@linux.ibm.com> (raw)
In-Reply-To: <dc79c8a9-1bbc-380f-741f-bca270a34483@linux.ibm.com>
On 8/13/20 12:40 PM, Niklas Schnelle wrote:
>
>
> On 8/13/20 11:59 AM, Oliver O'Halloran wrote:
>> On Thu, Aug 13, 2020 at 7:00 PM Niklas Schnelle <schnelle@linux.ibm.com> wrote:
>>>
>>>
>>> On 8/13/20 3:55 AM, Oliver O'Halloran wrote:
>>>> On Thu, Aug 13, 2020 at 5:21 AM Matthew Rosato <mjrosato@linux.ibm.com> wrote:
>>>>> *snip*
>>>>> diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
>>>>> index 3902c9f..04ac76d 100644
>>>>> --- a/arch/s390/pci/pci.c
>>>>> +++ b/arch/s390/pci/pci.c
>>>>> @@ -581,6 +581,14 @@ int pcibios_enable_device(struct pci_dev *pdev, int mask)
>>>>> {
>>>>> struct zpci_dev *zdev = to_zpci(pdev);
>>>>>
>>>>> + /*
>>>>> + * If we have a VF on a non-multifunction bus, it must be a VF that is
>>>>> + * detached from its parent PF. We rely on firmware emulation to
>>>>> + * provide underlying PF details.
>>>>> + */
>>>>> + if (zdev->vfn && !zdev->zbus->multifunction)
>>>>> + pdev->detached_vf = 1;
>>>>
>>>> The enable hook seems like it's a bit too late for this sort of
>>>> screwing around with the pci_dev. Anything in the setup path that
>>>> looks at ->detached_vf would see it cleared while anything that looks
>>>> after the device is enabled will see it set. Can this go into
>>>> pcibios_add_device() or a fixup instead?
>>>>
>>>
>>> This particular check could go into pcibios_add_device() yes.
>>> We're also currently working on a slight rework of how
>>> we establish the VF to parent PF linking including the sysfs
>>> part of that. The latter sadly can only go after the sysfs
>>> for the virtfn has been created and that only happens
>>> after all fixups. We would like to do both together because
>>> the latter sets pdev->is_virtfn which I think is closely related.
>>>
>>> I was thinking of starting another discussion
>>> about adding a hook that is executed just after the sysfs entries
>>> for the PCI device are created but haven't yet.
>>
>> if all you need is sysfs then pcibios_bus_add_device() or a bus
>> notifier should work
>
> So this might go a bit off track but the problem is that
> on s390 a VF can be disabled and reenabled with disable_slot()/enable_slot().
> In this case pcibios_bus_add_device() is not called again but
> the PF/VF link needs to be reestablished.
Scratch that I must have made some stupid mistake last time I tried
this, with your suggestion I tried again and it works perfectly
moving the setup into pcibios_bus_add_device().
Thank you, this is actually much nicer!
>
> ... snip ...
>
next prev parent reply other threads:[~2020-08-13 12:34 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-12 19:21 [PATCH v2] PCI: Identifying detached virtual functions Matthew Rosato
2020-08-12 19:21 ` [PATCH v2] PCI: Introduce flag for " Matthew Rosato
2020-08-12 20:32 ` Alex Williamson
2020-08-13 1:59 ` Oliver O'Halloran
2020-08-13 7:54 ` Niklas Schnelle
2020-08-13 13:09 ` Matthew Rosato
2020-08-13 1:55 ` Oliver O'Halloran
2020-08-13 9:00 ` Niklas Schnelle
2020-08-13 9:59 ` Oliver O'Halloran
2020-08-13 10:40 ` Niklas Schnelle
2020-08-13 12:34 ` Niklas Schnelle [this message]
2020-08-13 13:11 ` Matthew Rosato
2020-08-13 13:28 ` Niklas Schnelle
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=17be8c41-8989-f1da-a843-30f0761f42de@linux.ibm.com \
--to=schnelle@linux.ibm.com \
--cc=aik@ozlabs.ru \
--cc=alex.williamson@redhat.com \
--cc=bhelgaas@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=mjrosato@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=oohall@gmail.com \
--cc=pmorel@linux.ibm.com \
/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;
as well as URLs for NNTP newsgroup(s).