Re: [PATCH 5/8] powerpc/eeh: Add eeh_show_enabled()

2019-04-18 Thread Oliver O'Halloran
On Wed, 2019-03-20 at 13:58 +1100, Sam Bobroff wrote: > Move the EEH enabled message into it's own function so that future > work can call it from multiple places. > > Signed-off-by: Sam Bobroff > --- > arch/powerpc/include/asm/eeh.h | 3 +++ > arch/powerpc/kernel/eeh.c | 16 +++---

Re: [PATCH 6/8] powerpc/eeh: Initialize EEH address cache earlier

2019-04-18 Thread Oliver O'Halloran
On Wed, 2019-03-20 at 13:58 +1100, Sam Bobroff wrote: > The EEH address cache is currently initialized and populated by a > single function: eeh_addr_cache_build(). While the initial population > of the cache can only be done once resources are allocated, > initialization (just setting up a spinlo

Re: [PATCH] Add OPAL_GET_SYMBOL / OPAL_LOOKUP_SYMBOL

2020-03-05 Thread Oliver O'Halloran
On Fri, Feb 28, 2020 at 2:09 PM Nicholas Piggin wrote: > > These calls can be used by Linux to annotate BUG addresses with symbols, > look up symbol addresses in xmon, etc. > > This is preferable over having Linux parse the OPAL symbol map itself, > because OPAL's parsing code already exists for i

[PATCH v2 1/6] powerpc/eeh: Add sysfs files in late probe

2020-03-05 Thread Oliver O'Halloran
off Signed-off-by: Oliver O'Halloran --- v2: Reworded commit message based on Sam Bobroff's comments. About the current behaviour being broken. --- arch/powerpc/include/asm/eeh.h | 3 --- arch/powerpc/kernel/eeh.c| 24 +--- arch/p

[PATCH v2 2/6] powerpc/eeh: Remove eeh_add_device_tree_late()

2020-03-05 Thread Oliver O'Halloran
On pseries and PowerNV pcibios_bus_add_device() calls eeh_add_device_late() so there's no need to do a separate tree traversal to bind the eeh_dev and pci_dev together setting up the PHB at boot. As a result we can remove eeh_add_device_tree_late(). Reviewed-by: Sam Bobroff Signed-off-by: O

[PATCH v2 3/6] powerpc/eeh: Do early EEH init only when required

2020-03-05 Thread Oliver O'Halloran
making the early EEH probe pseries specific. Reviewed-by: Sam Bobroff Signed-off-by: Oliver O'Halloran --- arch/powerpc/kernel/pci-hotplug.c | 2 -- drivers/pci/hotplug/rpaphp_core.c | 2 ++ drivers/pci/hotplug/rpaphp_pci.c | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) di

[PATCH v2 4/6] powerpc/eeh: Remove PHB check in probe

2020-03-05 Thread Oliver O'Halloran
pci_dn structures for DT nodes that correspond to PCI devices so there's not much point in doing this check in the eeh_probe path. Reviewed-by: Sam Bobroff Signed-off-by: Oliver O'Halloran --- arch/powerpc/kernel/eeh.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/arch/powe

[PATCH v2 5/6] powerpc/eeh: Make early EEH init pseries specific

2020-03-05 Thread Oliver O'Halloran
ies specific data structure since there's no real requirement for them on PowerNV. To help both goals move the early probe into the pseries containment zone so the platform depedence is more explicit. Reviewed-by: Sam Bobroff Signed-off-by: Oliver O'Halloran --- v2: s/set set/we set/ in the c

[PATCH v2 6/6] powerpc/eeh: Rework eeh_ops->probe()

2020-03-05 Thread Oliver O'Halloran
g) an eeh_dev for a given pci_dev which also removes a use of pci_dn in generic EEH code. This patch also renames eeh_device_add_late() to eeh_device_probe(). This better reflects what it does does and removes the last vestiges of the early/late EEH probe split. Reviewed-by: Sam Bobroff Signed-o

Re: [PATCHv3 2/2] pseries/scm: buffer pmem's bound addr in dt for kexec kernel

2020-03-12 Thread Oliver O'Halloran
ough a dynamic added property "bound-addr" in > dt node 'ibm,pmemory'. > > Signed-off-by: Pingfan Liu > To: linuxppc-dev@lists.ozlabs.org > Cc: Benjamin Herrenschmidt > Cc: Paul Mackerras > Cc: Michael Ellerman > Cc: Hari Bathini > Cc: Aneesh K

Re: [PATCH v8 04/14] powerpc/vas: Alloc and setup IRQ and trigger port address

2020-03-23 Thread Oliver O'Halloran
On Mon, Mar 23, 2020 at 8:28 PM Cédric Le Goater wrote: > > On 3/23/20 10:06 AM, Cédric Le Goater wrote: > > On 3/19/20 7:14 AM, Haren Myneni wrote: > >> > >> Alloc IRQ and get trigger port address for each VAS instance. Kernel > >> register this IRQ per VAS instance and sets this port for each se

Re: [PATCH v4 00/25] Add support for OpenCAPI Persistent Memory devices

2020-04-01 Thread Oliver O'Halloran
plementation: > > https://github.com/open-power/skiboot/blob/master/hw/npu2-opencapi.c#L2328 I'm not sure I'd encourage anyone to read npu2-opencapi.c. I find it hard enough to follow even with access to the workbooks. There's an OPAL call API reference here: http://open-power.github.io/skiboot/doc/opal-api/index.html Oliver

Re: [PATCH v3 1/1] powerpc/kernel: Enables memory hot-remove after reboot on pseries guests

2020-04-02 Thread Oliver O'Halloran
On Fri, Apr 3, 2020 at 6:55 AM Leonardo Bras wrote: > > While providing guests, it's desirable to resize it's memory on demand. > > By now, it's possible to do so by creating a guest with a small base > memory, hot-plugging all the rest, and using 'movable_node' kernel > command-line parameter, wh

Re: [PATCH v3 1/1] powerpc/kernel: Enables memory hot-remove after reboot on pseries guests

2020-04-02 Thread Oliver O'Halloran
On Fri, Apr 3, 2020 at 10:07 AM Leonardo Bras wrote: > > Hello Oliver, thank you for the feedback. > Comments inline: > > On Fri, 2020-04-03 at 09:46 +1100, Oliver O'Halloran wrote: > > > > I don't really understand why the flag is needed at all. Accordi

Re: [PATCH 1/4] powerpc/eeh: fix pseries_eeh_configure_bridge()

2020-04-02 Thread Oliver O'Halloran
this leads to an infinite loop. > > Fix this by correctly bailing out on negative values. > This should probably be a standalone patch. Looks fine otherwise. Reviewed-by: Oliver O'Halloran > Signed-off-by: Sam Bobroff > --- > arch/powerpc/platforms/pseries/eeh_pseries

Re: [PATCH 2/4] powerpc/eeh: Release EEH device state synchronously

2020-04-02 Thread Oliver O'Halloran
switch (action) { > + case BUS_NOTIFY_DEL_DEVICE: > + eeh_remove_device(to_pci_dev(dev)); > + break; > + default: > + break; > + } A comment briefly explaining why we're not doing anything in the add case might be nice. Reviewed-by:

Re: [PATCH 4/4] powerpc/eeh: Clean up edev cleanup for VFs

2020-04-02 Thread Oliver O'Halloran
On Mon, 2020-03-30 at 15:56 +1100, Sam Bobroff wrote: > Because the bus notifier calls eeh_rmv_from_parent_pe() (via > eeh_remove_device()) when a VF is removed, the call in > remove_sriov_vf_pdns() is redundant. eeh_rmv_from_parent_pe() won't actually remove the device if the recovering flag is s

Re: [PATCH 3/4] powerpc/eeh: Remove workaround from eeh_add_device_late()

2020-04-02 Thread Oliver O'Halloran
On Mon, 2020-03-30 at 15:56 +1100, Sam Bobroff wrote: > When EEH device state was released asynchronously by the device > release handler, it was possible for an outstanding reference to > prevent it's release and it was necessary to work around that if a > device was re-discovered at the same PCI

[PATCH 1/7] powerpc/powernv/npu: Clean up compound table group initialisation

2020-04-05 Thread Oliver O'Halloran
range. Cc: Alexey Kardashevskiy Signed-off-by: Oliver O'Halloran --- arch/powerpc/platforms/powernv/npu-dma.c | 46 +++- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/arch/powerpc/platforms/powernv/npu-dma.c b/arch/powerpc/platforms/powernv/npu-dma.c ind

Make PowerNV IOMMU group setup saner (and fix it for hotpug)

2020-04-05 Thread Oliver O'Halloran
Currently on PowerNV the IOMMU group of a device is initialised in boot-time fixup which runs after devices are probed. Because this is only run at boot time hotplugged devices do not recieve an iommu group assignment which prevents them from being passed through to a guest. This series fixes that

[PATCH 2/7] powerpc/powernv/iov: Don't add VFs to iommu group during PE config

2020-04-05 Thread Oliver O'Halloran
In pnv_ioda_setup_vf_PE() we register an iommu group for the VF PE then call pnv_ioda_setup_bus_iommu_group() to add devices to that group. However, this function is called before the VFs are scanned so there's no devices to add. Signed-off-by: Oliver O'Halloran --- arch/powerpc

[PATCH 3/7] powerpc/powernv/pci: Register iommu group at PE DMA setup

2020-04-05 Thread Oliver O'Halloran
he PE that contains it. We need to ensure that group is removed before we add the PE to the compound group that's used to keep the translations see by the PCIe and NVLink buses the same. No functional changes. Probably. Cc: Alexey Kardashevskiy Cc: Reza Arbab Cc: Alistair Popple Signed-off-

[PATCH 4/7] powerpc/powernv/pci: Add device to iommu group during dma_dev_setup()

2020-04-05 Thread Oliver O'Halloran
getting their iommu group via a common path rather than relying on the bus notifier hack in pnv_tce_iommu_bus_notifier() to handle the adding VFs and hotplugged devices to their group. Cc: Alexey Kardashevskiy Signed-off-by: Oliver O'Halloran --- arch/powerpc/platforms/powernv/npu-dma.c | 8

[PATCH 5/7] powerpc/powernv/pci: Delete old iommu recursive iommu setup

2020-04-05 Thread Oliver O'Halloran
No longer used. Signed-off-by: Oliver O'Halloran --- arch/powerpc/platforms/powernv/pci-ioda.c | 32 --- 1 file changed, 32 deletions(-) diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index 9198b7882b57..8b45b8e

[PATCH 6/7] powerpc/powernv/pci: Move tce size parsing to pci-ioda-tce.c

2020-04-05 Thread Oliver O'Halloran
Move it in with the rest of the TCE wrangling rather than carting around a static prototype in pci-ioda.c Signed-off-by: Oliver O'Halloran --- arch/powerpc/platforms/powernv/pci-ioda-tce.c | 28 + arch/powerpc/platforms/powernv/pci-ioda.c | 30 ---

[PATCH 7/7] powerpc/powernv/npu: Move IOMMU group setup into npu-dma.c

2020-04-05 Thread Oliver O'Halloran
The NVlink IOMMU group setup is only relevant to NVLink devices so move it into the NPU containment zone. This let us remove some prototypes in pci.h and staticfy some function definitions. Signed-off-by: Oliver O'Halloran --- arch/powerpc/platforms/powernv/npu-dma.c

Re: [PATCH v3] powerpc/powernv: add NULL check after kzalloc in opal_add_one_export

2020-04-06 Thread Oliver O'Halloran
he point of a changelog is to tell a reader doing git archeology why a change happened and this is sufficent for that. Reviewed-by: Oliver O'Halloran

[PATCH] powerpc/boot: Fix the initrd being overwritten under qemu

2019-10-22 Thread Oliver O'Halloran
Image. Cc: sta...@vger.kernel.org Cc: Alexey Kardashevskiy Signed-off-by: Oliver O'Halloran --- First noticed here: https://unix.stackexchange.com/questions/547023/linux-kernel-on-ppc64le-vmlinux-equivalent-in-arch-powerpc-boot --- arch/powerpc/boot/devtree.c | 21 + ar

Re: [PATCH] powerpc/boot: Fix the initrd being overwritten under qemu

2019-10-23 Thread Oliver O'Halloran
On Wed, Oct 23, 2019 at 10:21 PM Segher Boessenkool wrote: > > On Wed, Oct 23, 2019 at 12:36:35PM +1100, Oliver O'Halloran wrote: > > When booting under OF the zImage expects the initrd address and size to be > > passed to it using registers r3 and r4. SLOF (gues

Re: [PATCH 09/10] powerpc: Enable OpenCAPI Storage Class Memory driver on bare metal

2019-10-27 Thread Oliver O'Halloran
On Fri, Oct 25, 2019 at 3:51 PM Alastair D'Silva wrote: > > From: Alastair D'Silva > > Enable OpenCAPI Storage Class Memory driver on bare metal > > Signed-off-by: Alastair D'Silva > --- > arch/powerpc/configs/powernv_defconfig | 4 > 1 file changed, 4 insertions(+) > > diff --git a/arch/p

[PATCH v2 1/3] powernv/iov: Ensure the pdn for VFs always contains a valid PE number

2019-10-28 Thread Oliver O'Halloran
ity. Both bugs can be fixed by just deleting the code. Tested-by: Alexey Kardashevskiy Reviewed-by: Alexey Kardashevskiy Signed-off-by: Oliver O'Halloran --- v2: Re-wrote commit message, got very depressed about the state of things. The real fix here is to move the IOMMU group

[PATCH v2 2/3] powerpc/pci: Fix pcibios_setup_device() ordering

2019-10-28 Thread Oliver O'Halloran
From: Shawn Anastasio Move PCI device setup from pcibios_add_device() and pcibios_fixup_bus() to pcibios_bus_add_device(). This ensures that platform-specific DMA and IOMMU setup occurs after the device has been registered in sysfs, which is a requirement for IOMMU group assignment to work This

[PATCH v2 3/3] powerpc/pci: Remove pcibios_setup_bus_devices()

2019-10-28 Thread Oliver O'Halloran
be run multiple times on a device, once before the device is added to the bus and once after. There's no need to run the setup in the early case any more so just remove it entirely. Signed-off-by: Oliver O'Halloran Tested-by: Alexey Kardashevskiy Reviewed-by: Alexey Kardashevskiy

[PATCH v2 2/2] powerpc/powernv: Use common code for the symbol_map export

2019-10-31 Thread Oliver O'Halloran
Long before we had a generic way for firmware to export memory ranges of interest we added a special case for the skiboot symbol map. The code is pretty much identical to the generic export so re-use the code. Signed-off-by: Oliver O'Halloran --- v2: Actually compile. --- arch/powerpc/plat

[PATCH v2 1/2] powerpc/powernv: Rework exports to support subnodes

2019-10-31 Thread Oliver O'Halloran
d-off-by: Oliver O'Halloran --- arch/powerpc/platforms/powernv/opal.c | 114 +- 1 file changed, 72 insertions(+), 42 deletions(-) diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c index 38e9027..0373da5 100644 --- a/ar

[PATCH 1/2] powerpc/xmon: Allow passing an argument to ppc_md.restart()

2019-11-01 Thread Oliver O'Halloran
On PowerNV a few different kinds of reboot are supported. We'd like to be able to exercise these from xmon so allow 'zr' to take an argument, and pass that to the ppc_md.restart() function. Signed-off-by: Oliver O'Halloran --- arch/powerpc/xmon/xmon.c | 11 +++---

[PATCH 2/2] powerpc/powernv: Allow manually invoking special reboots

2019-11-01 Thread Oliver O'Halloran
to be able to trigger one of these resets directly, so add a way to do that. Signed-off-by: Oliver O'Halloran --- arch/powerpc/platforms/powernv/setup.c | 4 1 file changed, 4 insertions(+) diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c ind

Re: [PATCH] powerpc/papr_scm: Delete unnecessary assignment for the field “owner”

2019-11-03 Thread Oliver O'Halloran
On Sun, Nov 3, 2019 at 11:31 PM Markus Elfring wrote: > > From: Markus Elfring > Date: Sun, 3 Nov 2019 13:23:13 +0100 > > The field “owner” is set by the core. > Thus delete an unneeded initialisation. Acked-by: Oliver O'Halloran > > Generat

Re: PROBLEM: PCIe Bus Error atleast

2019-11-03 Thread Oliver O'Halloran
27;s hard to say anything more without knowing what the downstream device is, or what the system is. If this is a laptop it might be due to buggy power management, but it might just be flakey hardware. Can you provide the full dmesg and the output of lspci -vv? Oliver

Re: [PATCH RFC 02/15] powerpc/eeh: Rename eeh_pe_get() to eeh_pe_find()

2019-11-12 Thread Oliver O'Halloran
eeh_pe_get() to eeh_pe_find() > because it performs a search. > > Signed-off-by: Sam Bobroff Good idea. Reviewed-by: Oliver O'Halloran

[PATCH] powerpc/powernv: Disable native PCIe port management

2019-11-13 Thread Oliver O'Halloran
e can fix these problems by setting the "pcie_ports_disabled" flag during platform initialisation. The flag indicates the platform owns the PCIe ports which stops the portbus driver being registered. Cc: Sergey Miroshnichenko Fixes: 66725152fb9f ("PCI/hotplug: PowerPC PowerNV PCI hotplug

Re: [PATCH] powerpc/perf: Disable trace_imc pmu

2019-11-13 Thread Oliver O'Halloran
On Thu, Nov 14, 2019 at 6:19 PM Madhavan Srinivasan wrote: > > When a root user or a user with CAP_SYS_ADMIN > privilege use trace_imc performance monitoring > unit events, to monitor application or KVM threads, > may result in a checkstop (System crash). Reason > being frequent switch of the "tra

Re: [PATCH] powerpc/powernv: Disable native PCIe port management

2019-11-14 Thread Oliver O'Halloran
On Thu, Nov 14, 2019 at 1:31 AM Bjorn Helgaas wrote: > > This is fine, but it feels like sort of a blunt instrument. Is there > any practical way to clear pci_host_bridge.native_pcie_hotplug (and > native_aer if appropriate) for the PHBs in question? That would also > prevent pciehp from binding.

Re: [PATCH] powerpc/powernv: Disable native PCIe port management

2019-11-14 Thread Oliver O'Halloran
On Thu, Nov 14, 2019 at 7:39 AM Tyrel Datwyler wrote: > > Nothing but pedantic spelling and grammar nits of the commit log follow. > > -Tyrel Thanks. My speeling is bad even on a good day and it was not a good day.

Re: [PATCH 01/11] powerpc/powernv/ioda: Fix ref count for devices with their own PE

2019-11-17 Thread Oliver O'Halloran
solution would likely be to review the reference counting and to > teach callers of get_*_dev() to call pci_put_dev(), etc. The issue is that the two callers of get_pci_dev() are non-GPL exported symbols so we don't know what's calling them or what their expectations are. We be doing whatever makes sense for OpenCAPI and if that happens to cause a problem for someone else, then they can deal with it. Oliver

[PATCH v2] powerpc/powernv: Disable native PCIe port management

2019-11-17 Thread Oliver O'Halloran
ices drivers that is: AER, PME, BW notifications, hotplug, and DPC. However, this is not a huge disadvantage on PowerNV since these services are either unused or handled through other means. Cc: Sergey Miroshnichenko Fixes: 66725152fb9f ("PCI/hotplug: PowerPC PowerNV PCI hotplug drive

Re: [PATCH 02/11] powerpc/powernv/ioda: Protect PE list

2019-11-19 Thread Oliver O'Halloran
On Tue, Nov 19, 2019 at 11:57 PM Frederic Barrat wrote: > > > Do the other accessors of ioda.pe_list also need mutex protection? > > pnv_ioda_setup_bus_PE() > > pnv_pci_dma_bus_setup() > > pnv_pci_init_ioda_phb() > > pnv_pci_ioda_setup_PEs() > > > I think we could also use it there, it wouldn't hu

PCIPOCALYPSE

2019-11-19 Thread Oliver O'Halloran
This series does a few things and probably needs to be split into two or three smaller ones. I figured I'd post it as-is since I'm sick of sitting on it and some people wanted people to take a look at it. There's three parts: 1) Reworking EEH to move the "pseudo-generic" into the platform backend.

[Very RFC 01/46] powerpc/eeh: Don't attempt to restore VF config space after reset

2019-11-19 Thread Oliver O'Halloran
, and it's getting in the way of doing useful cleanups. Signed-off-by: Oliver O'Halloran --- arch/powerpc/kernel/eeh.c| 59 arch/powerpc/platforms/powernv/eeh-powernv.c | 39 +++-- arch/powerpc/platforms/pseries/eeh_pseries.c | 26 + 3

[Very RFC 02/46] powernv/pci: Add helper to find ioda_pe from BDFN

2019-11-19 Thread Oliver O'Halloran
sts. Signed-off-by: Oliver O'Halloran --- arch/powerpc/platforms/powernv/pci-ioda.c | 10 ++ arch/powerpc/platforms/powernv/pci.h | 1 + 2 files changed, 11 insertions(+) diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda

[Very RFC 03/46] powernv/pci: Remove dma_dev_setup() for NPU PHBs

2019-11-19 Thread Oliver O'Halloran
The pnv_pci_dma_dev_setup() only does something when: 1) There PHB contains VFs, or 2) The PHB defines a dma_dev_setup() callback in the pnv_phb structure. Neither is true for NPU PHBs, so don't set the callback in the pci_controller_ops. Signed-off-by: Oliver O'Halloran --- ar

[Very RFC 04/46] powernv/pci: Move dma_{dev|bus}_setup into pci-ioda.c

2019-11-19 Thread Oliver O'Halloran
These functions are only used from pci-ioda.c. Move them in there and remove the prototypes from the header files. Signed-off-by: Oliver O'Halloran --- arch/powerpc/platforms/powernv/pci-ioda.c | 43 +++ arch/powerpc/platforms/powernv/pci.c

[Very RFC 05/46] powernv/pci: Remove the pnv_phb dma_dev_setup callback

2019-11-19 Thread Oliver O'Halloran
This is only ever set for IODA PHBs. The only call site is in pnv_pci_dma_dev_setup(), which is also only used by normal IODA PHBs, so remove the callback in favour of a direct call. Signed-off-by: Oliver O'Halloran --- arch/powerpc/platforms/powernv/pci-ioda.c | 4 +--- arch/powerpc/plat

[Very RFC 06/46] powerpc/iov: Move VF pdev fixup into pcibios_fixup_iov()

2019-11-19 Thread Oliver O'Halloran
ical place to do the fixup and it makes dma_dev_setup a bit simpler. Signed-off-by: Oliver O'Halloran --- arch/powerpc/platforms/powernv/pci-ioda.c | 35 +++ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/

[Very RFC 07/46] powernv/pci: Rework IODA PE device accounting

2019-11-19 Thread Oliver O'Halloran
on a per-device basis so we have some symmetry between the setup and teardown paths. Moving the PE assignments to here should also allow us to converge how PE assignment works on all PHB types so it's always done in one place. Signed-off-by: Oliver O'Halloran --- arch/powe

[Very RFC 08/46] powerpc/eeh: Calculate VF index rather than looking it up in pci_dn

2019-11-19 Thread Oliver O'Halloran
nctions to remove a VF are slightly different to those which remove a physical PCI device. Signed-off-by: Oliver O'Halloran --- arch/powerpc/kernel/eeh_driver.c | 44 +++- 1 file changed, 37 insertions(+), 7 deletions(-) diff --git a/arch/powerpc/kernel/eeh_

[Very RFC 09/46] powerpc/eeh: Pass eeh_dev to eeh_ops->{read|write}_config()

2019-11-19 Thread Oliver O'Halloran
Switch the eeh_ops->{read|write}_config methods to take an eeh_dev structure rather than a pci_dn structure to specify the target device. This removes a lot of the uses of pci_dn in both the EEH core and in the platform EEH support. Signed-off-by: Oliver O'Halloran --- arch/powerpc/inc

[Very RFC 10/46] powerpc/eeh: Pass eeh_dev to eeh_ops->restore_config()

2019-11-19 Thread Oliver O'Halloran
Remove another pdn usage. Signed-off-by: Oliver O'Halloran --- arch/powerpc/include/asm/eeh.h | 2 +- arch/powerpc/kernel/eeh.c| 5 ++--- arch/powerpc/kernel/eeh_pe.c | 6 ++ arch/powerpc/platforms/powernv/eeh-powernv.c

[Very RFC 11/46] powerpc/eeh: Convert various printfs to use edev, not pci_dn

2019-11-19 Thread Oliver O'Halloran
We use the pci_dn to retrieve the domain, bus, device, and function numbers for an EEH device. We now have that in the eeh_dev so covert the various printk()s we have around the place to source that information from the eeh_dev. Signed-off-by: Oliver O'Halloran --- arch/powerpc/kernel/

[Very RFC 12/46] powerpc/eeh: Split eeh_probe into probe_pdn and probe_pdev

2019-11-19 Thread Oliver O'Halloran
entations always return NULL so there's not much point to it. Signed-off-by: Oliver O'Halloran --- arch/powerpc/include/asm/eeh.h | 3 +- arch/powerpc/kernel/eeh.c| 6 ++-- arch/powerpc/platforms/powernv/eeh-powernv.c | 29 ++-- arc

[Very RFC 13/46] powerpc/eeh: Rework how pdev_probe() is used

2019-11-19 Thread Oliver O'Halloran
rom using pci_dn on PowerNV and moving the eeh_dev lookup into probe_pdev() allows the EEH core to be oblivious of how the mapping is actually done. Signed-off-by: Oliver O'Halloran --- arch/powerpc/include/asm/eeh.h | 16 +++-- arch/powerpc/kernel/eeh.c

[Very RFC 14/46] powernv/eeh: Remove un-necessary call to eeh_add_device_early()

2019-11-19 Thread Oliver O'Halloran
to squash another pci_dn usage. Signed-off-by: Oliver O'Halloran --- arch/powerpc/platforms/powernv/eeh-powernv.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/arch/powerpc/platforms/powernv/eeh-powernv.c b/arch/powerpc/platforms/powernv/eeh-powernv.c ind

[Very RFC 15/46] powernv/eeh: Use pnv_eeh_*_config() for internal config ops

2019-11-19 Thread Oliver O'Halloran
Use the pnv_eeh_{read|write}_config() functions that take an edev rather than a pci_dn. This allows us to remove most of the explict uses of pci_dn in the PowerNV EEH backend and localises them into a few functions which we can fix later. Signed-off-by: Oliver O'Halloran --- arch/po

[Very RFC 16/46] powernv/eeh: Use eeh_edev_warn() rather than open-coding a BDFN print

2019-11-19 Thread Oliver O'Halloran
Neaten things up a bit and remove a pci_dn use. Signed-off-by: Oliver O'Halloran --- arch/powerpc/platforms/powernv/eeh-powernv.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/platforms/powernv/eeh-powernv.c b/arch/powerpc/platforms/powern

[Very RFC 17/46] powernv/eeh: add pnv_eeh_find_edev()

2019-11-19 Thread Oliver O'Halloran
sting "traverse the pdn tree" method? Probably not. Signed-off-by: Oliver O'Halloran --- arch/powerpc/platforms/powernv/eeh-powernv.c | 31 arch/powerpc/platforms/powernv/pci.h | 2 ++ 2 files changed, 33 insertions(+) diff --git a/arch/powerpc/platforms/p

[Very RFC 18/46] powernv/pci: Add pci_bus_to_pnvhb() helper

2019-11-19 Thread Oliver O'Halloran
_controller inside the function. This is hard to read since it requires you to memorise the contents of the private data fields and kind of error prone since it involves blindly assigning a void pointer. Add a helper to make it more concise and explict. Signed-off-by: Oliver O'Halloran -

[Very RFC 19/46] powernv/eeh: Use standard PCI capability lookup functions

2019-11-19 Thread Oliver O'Halloran
problem if an EEH event occured while probing the device, but I'm pretty sure that's going to be broken anyway. Signed-off-by: Oliver O'Halloran --- arch/powerpc/platforms/powernv/eeh-powernv.c | 67 ++-- 1 file changed, 4 insertions(+), 63 deletions(-) diff --git

[Very RFC 20/46] powernv/eeh: Look up device info from pci_dev

2019-11-19 Thread Oliver O'Halloran
Most of what we fetch from the pci_dn is also in the pci_dev structure. Convert the pnv_eeh_probe_pdev() to use the pdev fields rather than the pci_dn so we can get rid of pci_dn eventually. Signed-off-by: Oliver O'Halloran --- arch/powerpc/platforms/powernv/eeh-powernv.c

[Very RFC 21/46] powernv/eeh: Rework finding an existing edev in probe_pdev()

2019-11-19 Thread Oliver O'Halloran
Use the pnv_eeh_find_edev() helper to look up the eeh_dev for a device rather than doing it via the pci_dn. Signed-off-by: Oliver O'Halloran --- arch/powerpc/platforms/powernv/eeh-powernv.c | 44 ++-- 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/arch/po

[Very RFC 22/46] powernv/eeh: Allocate eeh_dev's when needed

2019-11-19 Thread Oliver O'Halloran
Have the PowerNV EEH backend allocate the eeh_dev if needed rather than using the one attached to the pci_dn. This gets us most of the way towards decoupling pci_dn from the PowerNV EEH code. Signed-off-by: Oliver O'Halloran --- We should probably be free()ing the eeh_dev somewhere. The pc

[Very RFC 23/46] powerpc/eeh: Moving finding the parent PE into the platform

2019-11-19 Thread Oliver O'Halloran
sting lookup method moves into the pseries platform and PowerNV can choose the PE based on the bus heirachy instead. Signed-off-by: Oliver O'Halloran --- "parent" meaning "parent of the PE that actually contains this edev" is stupid, but it's stupid consistent with wh

[Very RFC 24/46] powernv/pci: Make the pre-cfg EEH freeze check use eeh_dev rather than pci_dn

2019-11-19 Thread Oliver O'Halloran
Squash another usage in preperation for making the config accessors pci_dn. Signed-off-by: Oliver O'Halloran --- We might want to move this into eeh-powernv.c --- arch/powerpc/platforms/powernv/pci.c | 37 +--- 1 file changed, 17 insertions(+), 20 deletions(-)

[Very RFC 25/46] powernv/pci: Remove pdn from pnv_pci_config_check_eeh()

2019-11-19 Thread Oliver O'Halloran
Despite the name this function is generic PowerNV PCI code rather than anything EEH specific. Convert to take a phb and bdfn rather than a pci_dn. Signed-off-by: Oliver O'Halloran --- arch/powerpc/platforms/powernv/pci.c | 32 ++-- 1 file changed, 21 insertions(+

[Very RFC 26/46] powernv/pci: Remove pdn from pnv_pci_cfg_{read|write}

2019-11-19 Thread Oliver O'Halloran
Remove the use of pci_dn from the low-level config space access functions. These are used by the eeh's config ops and the bus config ops that we provide to the PCI core. Signed-off-by: Oliver O'Halloran --- arch/powerpc/platforms/powernv/eeh-powernv.c | 14 +++ arch/powerpc

[Very RFC 27/46] powernv/pci: Clear reserved PE freezes

2019-11-19 Thread Oliver O'Halloran
Signed-off-by: Oliver O'Halloran --- arch/powerpc/platforms/powernv/pci.c | 13 + 1 file changed, 13 insertions(+) diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c index 36eea4bb514c..5b1f4677cdce 100644 --- a/arch/powerpc/platforms/powe

[Very RFC 28/46] powernv/iov: Move SR-IOV PF state out of pci_dn

2019-11-19 Thread Oliver O'Halloran
werNV specific structure helps to clarify the role of pci_dn and ensures that the platform specifics stay that way. This will make the code easier to understand and modify since we don't need to so much aboute PowerNV changes breaking pseries and EEH, and vis-a-vis. Signed-off-by: Oliver O'Hal

[Very RFC 29/46] powernv/pci: Remove open-coded PE lookup in PELT-V setup

2019-11-19 Thread Oliver O'Halloran
Signed-off-by: Oliver O'Halloran --- arch/powerpc/platforms/powernv/pci-ioda.c | 32 +-- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index 1c90feed233d..5bd7c1b

[Very RFC 30/46] powernv/pci: Remove open-coded PE lookup in PELT-V teardown

2019-11-19 Thread Oliver O'Halloran
Signed-off-by: Oliver O'Halloran --- arch/powerpc/platforms/powernv/pci-ioda.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index 5bd7c1b058da..d4b5ee926222 100644

[Very RFC 31/46] powernv/pci: Remove open-coded PE lookup in pnv_pci_ioda_dma_dev_setup()

2019-11-19 Thread Oliver O'Halloran
Use the helper to look up the pnv_ioda_pe for the device we're configuring DMA for. In the VF case there's no need set pdn->pe_number since nothing looks at it any more. Signed-off-by: Oliver O'Halloran --- arch/powerpc/platforms/powernv/pci-ioda.c | 3 +-- 1 file changed,

[Very RFC 32/46] powernv/pci: Remove open-coded PE lookup in iommu_bypass_supported()

2019-11-19 Thread Oliver O'Halloran
Signed-off-by: Oliver O'Halloran --- arch/powerpc/platforms/powernv/pci-ioda.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index 98d858999a2d..7e88de18ead6 100644 --- a

[Very RFC 33/46] powernv/pci: Remove open-coded PE lookup in iommu notifier

2019-11-19 Thread Oliver O'Halloran
Signed-off-by: Oliver O'Halloran --- arch/powerpc/platforms/powernv/pci.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c index 5b1f4677cdce..0eeea8652426 100644 --- a/arch/powerpc/plat

[Very RFC 34/46] powernv/pci: Remove open-coded PE lookup in pnv_pci_enable_device_hook()

2019-11-19 Thread Oliver O'Halloran
Signed-off-by: Oliver O'Halloran --- arch/powerpc/platforms/powernv/pci-ioda.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index 7e88de18ead6..4f38652c7cd7 100644 --- a

[Very RFC 35/46] powernv/pci: Remove open-coded PE lookup in pnv_pci_release_device

2019-11-19 Thread Oliver O'Halloran
Signed-off-by: Oliver O'Halloran --- arch/powerpc/platforms/powernv/pci-ioda.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index 4f38652c7cd7..8525642b1256 100644 --- a

[Very RFC 36/46] powernv/npu: Remove open-coded PE lookup for GPU device

2019-11-19 Thread Oliver O'Halloran
Signed-off-by: Oliver O'Halloran --- arch/powerpc/platforms/powernv/npu-dma.c | 13 ++--- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/arch/powerpc/platforms/powernv/npu-dma.c b/arch/powerpc/platforms/powernv/npu-dma.c index b95b9e3c4c98..68bfaef44862 100644 --- a

[Very RFC 37/46] powernv/pci: Use the PHB's rmap for pnv_ioda_to_pe()

2019-11-19 Thread Oliver O'Halloran
g a DMA so this gets us a bit closer to the model used by the HW, which is comprensible by mortals, rather than... whatever the hell is going on currently. Signed-off-by: Oliver O'Halloran --- arch/powerpc/platforms/powernv/pci-ioda.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(

[Very RFC 38/46] powerpc/pci-hotplug: Scan the whole bus when using PCI_PROBE_NORMAL

2019-11-19 Thread Oliver O'Halloran
cause in a PCIe environment the first downstream child will be at devfn 00.0. In any case it's completely broken when no pci_dn is available. Remove the PCI_DN checking and scan each of the device number that might be on the downstream bus. Cc: Benjamin Herrenschmidt Signed-off-by: Oliver O'Hall

[Very RFC 39/46] powernv/npu: Avoid pci_dn when mapping device_node to a pci_dev

2019-11-19 Thread Oliver O'Halloran
There's no need to use the pci_dn to find a device_node from a pci_dev. Just search for the node pointed to by the pci_dev's of_node pointer. Signed-off-by: Oliver O'Halloran --- arch/powerpc/platforms/powernv/npu-dma.c | 8 1 file changed, 4 insertions(+), 4 deletions(-

[Very RFC 40/46] powernv/npu: Don't drop refcount when looking up GPU pci_devs

2019-11-19 Thread Oliver O'Halloran
ction from being called. In other words, the desired behaviour here appears to be leaking a ref. Nice! Signed-off-by: Oliver O'Halloran --- arch/powerpc/platforms/powernv/npu-dma.c | 11 +++ 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/arch/powerpc/platforms/powernv

[Very RFC 41/46] powernv/eeh: Remove pdn setup for SR-IOV VFs

2019-11-19 Thread Oliver O'Halloran
We don't need a pci_dn for the VF any more, so we can skip adding them. Signed-off-by: Oliver O'Halloran --- arch/powerpc/platforms/powernv/pci-ioda.c | 16 1 file changed, 16 deletions(-) diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platfor

[Very RFC 42/46] powernv/pci: Don't clear pdn->pe_number in pnv_pci_release_device

2019-11-19 Thread Oliver O'Halloran
Nothing looks at it anymore. Signed-off-by: Oliver O'Halloran --- arch/powerpc/platforms/powernv/pci-ioda.c | 12 1 file changed, 12 deletions(-) diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index d3e375d71cdc..45d9407

[Very RFC 43/46] powernv/pci: Do not set pdn->pe_number for NPU/CAPI devices

2019-11-19 Thread Oliver O'Halloran
The only thing we need the pdn for in this function is setting the pe_number field, which we don't use anymore. Fix the weird refcounting behaviour while we're here. Signed-off-by: Oliver O'Halloran --- Either Fred, or Reza also fixed this in some patch lately and that'll

[Very RFC 44/46] powerpc/pci: Don't set pdn->pe_number when applying the weird P8 NVLink PE hack

2019-11-19 Thread Oliver O'Halloran
P8 needs to shove four GPUs into three PEs for $reasons. Remove the pdn->pe_assignment done there since we just use the pe_rmap[] now. Signed-off-by: Oliver O'Halloran --- arch/powerpc/platforms/powernv/pci-ioda.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --gi

[Very RFC 45/46] powernv/pci: Remove requirement for a pdn in config accessors

2019-11-19 Thread Oliver O'Halloran
:toot: Signed-off-by: Oliver O'Halloran --- arch/powerpc/platforms/powernv/pci.c | 10 -- 1 file changed, 10 deletions(-) diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c index 0eeea8652426..6383dcfec606 100644 --- a/arch/powerpc/plat

[Very RFC 46/46] HACK: prevent pdn's from being created

2019-11-19 Thread Oliver O'Halloran
Not-Signed-off-by: Oliver O'Halloran --- arch/powerpc/kernel/pci_dn.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/powerpc/kernel/pci_dn.c b/arch/powerpc/kernel/pci_dn.c index f790a8d06f50..0e05c1d7633a 100644 --- a/arch/powerpc/kernel/pci_dn.c +++ b/arch/powerpc/kernel/pci

Re: [Very RFC 04/46] powernv/pci: Move dma_{dev|bus}_setup into pci-ioda.c

2019-11-20 Thread Oliver O'Halloran
On Thu, Nov 21, 2019 at 3:02 PM Alexey Kardashevskiy wrote: > > > > On 20/11/2019 12:28, Oliver O'Halloran wrote: > > These functions are only used from pci-ioda.c. Move them in there and remove > > the prototypes from the header files. > > > Make them stat

Re: [Very RFC 01/46] powerpc/eeh: Don't attempt to restore VF config space after reset

2019-11-20 Thread Oliver O'Halloran
On Thu, Nov 21, 2019 at 2:38 PM Alexey Kardashevskiy wrote: > > > > On 20/11/2019 12:28, Oliver O'Halloran wrote: > > After resetting a VF we call eeh_restore_vf_config() to restore several > > registers in the VFs config space. For physical functions this i

Re: [Very RFC 21/46] powernv/eeh: Rework finding an existing edev in probe_pdev()

2019-11-24 Thread Oliver O'Halloran
On Mon, Nov 25, 2019 at 2:20 PM Alexey Kardashevskiy wrote: > > > > On 20/11/2019 12:28, Oliver O'Halloran wrote: > > Use the pnv_eeh_find_edev() helper to look up the eeh_dev for a device > > rather than doing it via the pci_dn. > > This is not what the patch d

Re: [Very RFC 22/46] powernv/eeh: Allocate eeh_dev's when needed

2019-11-24 Thread Oliver O'Halloran
On Mon, Nov 25, 2019 at 2:27 PM Alexey Kardashevskiy wrote: > > > > On 20/11/2019 12:28, Oliver O'Halloran wrote: > > Have the PowerNV EEH backend allocate the eeh_dev if needed rather than > > using > > the one attached to the pci_dn. > > So that pci_dn

Re: [Very RFC 06/46] powerpc/iov: Move VF pdev fixup into pcibios_fixup_iov()

2019-11-24 Thread Oliver O'Halloran
On Thu, Nov 21, 2019 at 6:48 PM Christoph Hellwig wrote: > > On Wed, Nov 20, 2019 at 12:28:19PM +1100, Oliver O'Halloran wrote: > > Move this out of the PHB's dma_dev_setup() callback and into the > > ppc_md.pcibios_fixup_iov callback. This ensures that the VF PE&

Re: [Very RFC 06/46] powerpc/iov: Move VF pdev fixup into pcibios_fixup_iov()

2019-11-24 Thread Oliver O'Halloran
On Thu, Nov 21, 2019 at 3:34 PM Alexey Kardashevskiy wrote: > > > > On 20/11/2019 12:28, Oliver O'Halloran wrote: > > Move this out of the PHB's dma_dev_setup() callback and into the > > ppc_md.pcibios_fixup_iov callback. This ensures that the VF PE's &

<    1   2   3   4   5   6   7   8   9   >