linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Juan Alvarez <jjalvare@linux.vnet.ibm.com>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: "Bryant G. Ly" <bryantly@linux.vnet.ibm.com>,
	Alex Williamson <alex.williamson@redhat.com>,
	Steven Royer <seroyer@linux.vnet.ibm.com>,
	Michael Ellerman <mpe@ellerman.id.au>,
	bhelgaas@google.com, benh@kernel.crashing.org, paulus@samba.org,
	linux-pci@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	"Juan J . Alvarez" <jjalvare@us.ibm.com>,
	Bodong Wang <bodong@mellanox.com>, Eli Cohen <eli@mellanox.com>,
	Saeed Mahameed <saeedm@mellanox.com>
Subject: Re: [PATCH v3 2/2] pseries/eeh: Add Pseries pcibios_bus_add_device
Date: Tue, 17 Oct 2017 18:13:35 -0500	[thread overview]
Message-ID: <eb1ac136-a054-ea2b-2368-af740e0c23d4@linux.vnet.ibm.com> (raw)
In-Reply-To: <20171017185242.GG5641@bhelgaas-glaptop.roam.corp.google.com>


On 10/17/17 1:52 PM, Bjorn Helgaas wrote:
> Right.  But that patch isn't really on the path to inclusion (mainly
> because it's test framework and doesn't fix a bug or add support for
> new hardware or features).
I was not aware of this decision and this will cause changes to this patch.
>
> I'm suggesting that maybe there should be a generic way to prevent
> binding to VF devices that works for everybody and doesn't require any
> arch-specific code at all.

The patch that you have suggested in kernel 4.12 is also a generic way.

https://marc.info/?l=linux-kernel&m=149002335105804&w=2

Perhaps we can use the same constructs that this patch uses at our level. Nonetheless,
that will take a rework to this patch and possibly an export of a function to set drivers_autoprobe
globally. I know that was frowned upon on first email thread. Let me know if this is an
acceptable solution.
>>>>>> So like existing way of enabling SRIOV we still rely on the PF driver to
>>>>>> enable VFs - but in this case the attachment phase is done via a user
>>>>>> action via a management console in our case (novalink or hmc) triggered
>>>>>> event that will essentially act like a hotplug.
>>>>>>
>>>>>> So in the fine details of that user triggered action the system
>>>>>> firmware will bind the VFs, allowing resources to be allocated to
>>>>>> the VF.  - Which essentially does all the attaching as we know it
>>>>>> today but is managed by PHYP not by the kernel.
>>>>> What exactly does "firmware binding the VFs" mean?  I guess this must
>>>>> mean assigning a VF to a partition, injecting a hotplug add event to
>>>>> that partition, and making the VF visible in config space?
>>>> Firmware basically adds a device node to the device tree as defined
>>>> in the (PAPR) Power Architecture Platform Requirements document.
>>> From the point of view of the kernel that consumes this device tree
>>> and owns the VF, I guess this looks like a hot-add.  
>> Correct, this is intended. We want to minimize change and only focus
>> on configure SR-IOV path in the PF on PSeries platform.
>>> It would be nice
>>> if this could be exposed to that kernel by having the firmware inject
>>> a normal PCIe hotplug interrupt, but I'm guessing it's not that
>>> simple.
>> I don't understand entirely your suggestion. However, in the case of
>> interrupts PHYP owns all the resources and will be associated accordingly
>> with a partitionable endpoint (PE).
> Assume you have a Linux kernel, and PHYP assigns a VF to it.  What
> happens in that Linux kernel? 

When  kernel boots it goes through the lists of buses in the device tree. For each (physical,virtual)
bus the kernel reads the list of devices. After resources are read and assigned it will probe the devices.

If the kernel is up and running then this will start its flow through the dlpar add bus code.
Which then will read the device node and same operation as boot will entail of going
through the list of devices under the bus.

One should note that dynamically created VFs in configure SR-IOV path will have is_virtfn
set and others do not, therefore pcibios_bus_add_device will only be exercised in certain
cases.
>  How does it discover this new device?
This is treated as a normal hot plug operation for the Operating System that
the device gets assigned which can be  IBMi, AIX or Linux in this environment.
>
> I'm suggesting that it would be cool if that kernel received a hotplug
> interrupt from the Downstream Port leading to the new VF, and the
> pciehp driver could read the Slot Status register and see that
> "Presence Detect Changed" was set.  If that happened, the pciehp
> driver should automatically enumerate the new device and there
> wouldn't be much if any powerpc-specific code in the path.
To re-state Steve's earlier comment, PHYP will enumerate the virtual pci bus and is not
directly correlated to the real PCI bus that the PF is on. We have no control of the pci
bus enumeration for the device node added to the device tree.

Juan J. Alvarez

  reply	other threads:[~2017-10-17 23:13 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-22 14:19 [PATCH v3 0/2] Prepartion for SR-IOV PowerVM Enablement Bryant G. Ly
2017-09-22 14:19 ` [PATCH v3 1/2] powerpc/kernel: Separate SR-IOV Calls Bryant G. Ly
2017-09-22 14:19 ` [PATCH v3 2/2] pseries/eeh: Add Pseries pcibios_bus_add_device Bryant G. Ly
2017-10-11 20:05   ` Bjorn Helgaas
2017-10-12  4:09     ` Michael Ellerman
2017-10-12 18:29       ` Bjorn Helgaas
2017-10-12 19:59         ` Bryant G. Ly
2017-10-13  3:34           ` Bjorn Helgaas
2017-10-13 11:53             ` Steven Royer
2017-10-13 12:01               ` Steven Royer
2017-10-13 18:05                 ` Alex Williamson
2017-10-13 19:12                   ` Bryant G. Ly
2017-10-17 13:51                     ` Bjorn Helgaas
2017-10-17 14:23                       ` Juan Alvarez
2017-10-17 14:33                       ` Juan Alvarez
2017-10-17 16:26                         ` Bjorn Helgaas
2017-10-17 17:23                           ` Juan Alvarez
2017-10-17 18:52                             ` Bjorn Helgaas
2017-10-17 23:13                               ` Juan Alvarez [this message]
2017-10-27 21:30                                 ` Bjorn Helgaas
2017-10-17  3:38           ` Michael Ellerman
2017-10-17 14:11             ` Bryant G. Ly
2017-10-18  1:01               ` Alexey Kardashevskiy
2017-10-18  1:36                 ` Alexey Kardashevskiy
2017-10-18 13:20                   ` Juan Alvarez
2017-10-11 20:07 ` [PATCH v3 0/2] Prepartion for SR-IOV PowerVM Enablement Bjorn Helgaas

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=eb1ac136-a054-ea2b-2368-af740e0c23d4@linux.vnet.ibm.com \
    --to=jjalvare@linux.vnet.ibm.com \
    --cc=alex.williamson@redhat.com \
    --cc=benh@kernel.crashing.org \
    --cc=bhelgaas@google.com \
    --cc=bodong@mellanox.com \
    --cc=bryantly@linux.vnet.ibm.com \
    --cc=eli@mellanox.com \
    --cc=helgaas@kernel.org \
    --cc=jjalvare@us.ibm.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=paulus@samba.org \
    --cc=saeedm@mellanox.com \
    --cc=seroyer@linux.vnet.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).