Re: [PATCH v2] KVM: PPC: move iommu_add_device earlier

2013-08-14 Thread Wei Yang
ove_device && dev->iommu_group) So I suggest to add this check here too. BTW, I have a patch like this, which I put the check in iommu_group_remove_device. This could protect the kernel from do the removing without the check outside. Author: Wei Yang Date: Wed Aug 14 04:45:06 2013 -

[PATCH 2/2] powerpc/iommu: check dev->iommu_group before remove a device from iommu_group

2013-08-16 Thread Wei Yang
--- arch/powerpc/kernel/iommu.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c index b20ff17..5abf7c3 100644 --- a/arch/powerpc/kernel/iommu.c +++ b/arch/powerpc/kernel/iommu.c @@ -1149,7 +1149,8 @@ static int io

[PATCH 1/2] iommu: Don't remove device when no iommu_group associated

2013-08-16 Thread Wei Yang
In some cases, one device may not associated with any iommu_group. For example, not enough DMA address space. For those devices, kernel will crash when try to remove it from an iommu_group. This patch do the check before remove it. Signed-off-by: Wei Yang --- drivers/iommu/iommu.c |3

[PATCH 0/2] powerpc/iommu: check dev->iommu_group before remove it

2013-08-16 Thread Wei Yang
are welcome :-) Thanks in advance. Wei Yang (2): iommu: Don't remove device when no iommu_group associated powerpc/iommu: check dev->iommu_group before remove a device from iommu_group arch/powerpc/kernel/iommu.c |3 ++- drivers/iommu/iommu.c |3 +++ 2 files change

Re: [PATCH 2/2] powerpc/iommu: check dev->iommu_group before remove a device from iommu_group

2013-08-18 Thread Wei Yang
On Fri, Aug 16, 2013 at 08:15:36PM +1000, Alexey Kardashevskiy wrote: >On 08/16/2013 08:08 PM, Wei Yang wrote: >> --- >> arch/powerpc/kernel/iommu.c |3 ++- >> 1 files changed, 2 insertions(+), 1 deletions(-) >> >> diff --git a/arch/powerpc/kernel/iomm

Re: [PATCH 2/2] powerpc/iommu: check dev->iommu_group before remove a device from iommu_group

2013-08-18 Thread Wei Yang
On Mon, Aug 19, 2013 at 11:39:49AM +1000, Alexey Kardashevskiy wrote: >On 08/19/2013 11:29 AM, Wei Yang wrote: >> On Fri, Aug 16, 2013 at 08:15:36PM +1000, Alexey Kardashevskiy wrote: >>> On 08/16/2013 08:08 PM, Wei Yang wrote: >>>> --- >>>> arch/power

Re: [PATCH 2/2] powerpc/iommu: check dev->iommu_group before remove a device from iommu_group

2013-08-22 Thread Wei Yang
On Thu, Aug 22, 2013 at 05:23:34PM +1000, Alexey Kardashevskiy wrote: >On 08/19/2013 11:55 AM, Wei Yang wrote: >> On Mon, Aug 19, 2013 at 11:39:49AM +1000, Alexey Kardashevskiy wrote: >>> On 08/19/2013 11:29 AM, Wei Yang wrote: >>>> On Fri, Aug 16, 2013 at 08:15:36

Re: [PATCH 2/2] powerpc/iommu: check dev->iommu_group before remove a device from iommu_group

2013-08-22 Thread Wei Yang
On Thu, Aug 22, 2013 at 09:28:23AM -0600, Alex Williamson wrote: >On Thu, 2013-08-22 at 15:52 +0800, Wei Yang wrote: >> On Thu, Aug 22, 2013 at 05:23:34PM +1000, Alexey Kardashevskiy wrote: >> >On 08/19/2013 11:55 AM, Wei Yang wrote: >> >> On Mon, Aug 19, 20

Re: [PATCH 2/2] powerpc/iommu: check dev->iommu_group before remove a device from iommu_group

2013-08-22 Thread Wei Yang
On Thu, Aug 22, 2013 at 10:17:20AM -0600, Alex Williamson wrote: >On Thu, 2013-08-22 at 23:41 +0800, Wei Yang wrote: >> >> >> >> Alex, >> >> >> >> Sorry for not including you in the very beginning, which may spend you >> >

[PATCH] iommu: WARN_ON when removing a device with no iommu_group associated

2013-08-22 Thread Wei Yang
rom an iommu_group with dev->iommu_group set to NULL. This helps to indicate some bad behavior and also guard the kernel. Signed-off-by: Wei Yang --- drivers/iommu/iommu.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c inde

Re: [PATCH] iommu: WARN_ON when removing a device with no iommu_group associated

2013-09-02 Thread Wei Yang
Any more comments? Or this one is not proper? On Thu, Aug 22, 2013 at 09:33:27PM -0600, Alex Williamson wrote: >[+cc iommu] > >On Fri, 2013-08-23 at 09:55 +0800, Wei Yang wrote: >> When removing a device from the system, iommu_group driver will try to >> disconnect it fro

Re: [PATCH 6/9] powerpc/pci: Use dev_is_pci() to check whether it is pci device

2013-12-15 Thread Wei Yang
Yijing, This one looks good. While I take a look at the source code, there are around 20 places with similar style. Do you think it would be good to change all these places in one patch? On Thu, Dec 05, 2013 at 08:01:20PM +0800, Yijing Wang wrote: >Use PCI standard marco dev_is_pci() instead of

Re: [PATCH 6/9] powerpc/pci: Use dev_is_pci() to check whether it is pci device

2013-12-16 Thread Wei Yang
On Mon, Dec 16, 2013 at 05:05:05PM +0800, Yijing Wang wrote: >On 2013/12/16 15:13, Wei Yang wrote: >> Yijing, >> >> This one looks good. >> >> While I take a look at the source code, there are around 20 places with >> similar style. Do you think it would b

[PATCH 2/2] powerpc/powernc: revert part of commit d905c5df(PPC: POWERNV: move iommu_add_device earlier)

2014-04-20 Thread Wei Yang
it d905c5df(PPC: POWERNV: move iommu_add_device earlier). Signed-off-by: Wei Yang --- arch/powerpc/platforms/powernv/pci-ioda.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index fc4edda.

[PATCH 1/2] powerpc/powernv: clear the refcount for pci_dev on powernv platform

2014-04-20 Thread Wei Yang
de00c8 ebfe0218 [ 204.126966] ---[ end trace 6e7aefd80add2973 ]--- This patch clear the step to get reference. Signed-off-by: Wei Yang --- arch/powerpc/platforms/powernv/pci-ioda.c |1 - 1 file changed, 1 deletion(-) diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/pla

Re: [PATCH 2/2] powerpc/powernc: revert part of commit d905c5df(PPC: POWERNV: move iommu_add_device earlier)

2014-04-20 Thread Wei Yang
On Mon, Apr 21, 2014 at 01:37:32PM +1000, Benjamin Herrenschmidt wrote: >On Mon, 2014-04-21 at 10:25 +0800, Wei Yang wrote: >> Here is a draft call flow: >> >> pci_device_add >>pcibios_add_device >> pci_dma_dev_setup

Re: [PATCH 1/2] powerpc/powernv: clear the refcount for pci_dev on powernv platform

2014-04-20 Thread Wei Yang
On Mon, Apr 21, 2014 at 01:35:34PM +1000, Benjamin Herrenschmidt wrote: >On Mon, 2014-04-21 at 10:25 +0800, Wei Yang wrote: >> When pcibios_remove_pci_devices() is removing pci devices, it will release >> pci device respectively. When the refcount of the device is 0, the pci_dev &g

Re: [PATCH 2/2] powerpc/powernc: revert part of commit d905c5df(PPC: POWERNV: move iommu_add_device earlier)

2014-04-20 Thread Wei Yang
On Mon, Apr 21, 2014 at 01:22:13PM +0800, Wei Yang wrote: >On Mon, Apr 21, 2014 at 01:37:32PM +1000, Benjamin Herrenschmidt wrote: >>On Mon, 2014-04-21 at 10:25 +0800, Wei Yang wrote: >>> Here is a draft call flow: >>> >>> pci_device_add >>>p

Re: [PATCH 1/2] powerpc/powernv: clear the refcount for pci_dev on powernv platform

2014-04-22 Thread Wei Yang
On Tue, Apr 22, 2014 at 09:34:23AM +1000, Gavin Shan wrote: >On Mon, Apr 21, 2014 at 10:25:18AM +0800, Wei Yang wrote: >>When pcibios_remove_pci_devices() is removing pci devices, it will release >>pci device respectively. When the refcount of the device is 0, the pci_dev >

Re: [PATCH 1/2] powerpc/powernv: clear the refcount for pci_dev on powernv platform

2014-04-22 Thread Wei Yang
On Tue, Apr 22, 2014 at 06:25:09PM +1000, Benjamin Herrenschmidt wrote: >On Tue, 2014-04-22 at 15:44 +0800, Wei Yang wrote: >> So this patch(the 2nd one) doesn't contribute to clear the warning and >> error. >> Only the first patch did it. Please ignore this one. >

Re: [PATCH 1/2] powerpc/powernv: clear the refcount for pci_dev on powernv platform

2014-04-22 Thread Wei Yang
On Wed, Apr 23, 2014 at 10:26:18AM +1000, Benjamin Herrenschmidt wrote: >On Wed, 2014-04-23 at 09:00 +1000, Gavin Shan wrote: >> The side effect of holding pci_dev refcount is the pci_dev, eeh_dev, >> eeh_pe instance can't be free'ed during fully hotplug though EEH can >> survive. It's reasonable t

[PATCH 1/2] powerpc/powernv: reduce multi-hit of iommu_add_device()

2014-04-22 Thread Wei Yang
[ 204.126966] ---[ end trace 6e7aefd80add2973 ]--- are cleared. This patch removes iommu_add_device() in pnv_pci_ioda_dma_dev_setup(), which revert part of the change in commit d905c5df(PPC: POWERNV: move iommu_add_device earlier). Signed-off-by: Wei Yang --- arch/powerpc/platforms/powe

[PATCH 2/2] powerpc/powernv: release the refcount for pci_dev

2014-04-22 Thread Wei Yang
On PowerNV platform, we are holding an unnecessary refcount on a pci_dev, which leads to the pci_dev is not destroyed when hotplugging a pci device. This patch release the unnecessary refcount. Signed-off-by: Wei Yang --- arch/powerpc/platforms/powernv/pci-ioda.c |1 - 1 file changed, 1

Re: [PATCH 1/2] powerpc/powernv: reduce multi-hit of iommu_add_device()

2014-04-28 Thread Wei Yang
On Mon, Apr 28, 2014 at 11:35:32PM +1000, Alexey Kardashevskiy wrote: >On 04/23/2014 12:26 PM, Wei Yang wrote: >> During the EEH hotplug event, iommu_add_device() will be invoked three times >> and two of them will trigger warning or error. >> >> The three times to

Re: [PATCH 1/2] powerpc/powernv: reduce multi-hit of iommu_add_device()

2014-04-29 Thread Wei Yang
On Tue, Apr 29, 2014 at 05:55:48PM +1000, Alexey Kardashevskiy wrote: >On 04/29/2014 04:49 PM, Wei Yang wrote: >> On Mon, Apr 28, 2014 at 11:35:32PM +1000, Alexey Kardashevskiy wrote: >>> On 04/23/2014 12:26 PM, Wei Yang wrote: >>>> During the EEH hotplug event, iomm

Re: [PATCH 1/2] powerpc/powernv: reduce multi-hit of iommu_add_device()

2014-04-29 Thread Wei Yang
On Tue, Apr 29, 2014 at 11:11:05PM +1000, Alexey Kardashevskiy wrote: >On 04/29/2014 07:37 PM, Wei Yang wrote: >> On Tue, Apr 29, 2014 at 05:55:48PM +1000, Alexey Kardashevskiy wrote: >>> On 04/29/2014 04:49 PM, Wei Yang wrote: >>>> On Mon, Apr 28, 2014 at 11:35:32

Re: [PATCH 1/2] powerpc/powernv: reduce multi-hit of iommu_add_device()

2014-04-29 Thread Wei Yang
On Wed, Apr 30, 2014 at 10:28:12AM +1000, Gavin Shan wrote: > >It seems that we have 2 problems here: > >- For non-SRIOV case, pcibios_setup_device() is called for towice. That > seems incorrect. We could simply remove pcibios_setup_bus_devices() > from pcibios_fixup_bus(). I have thought about

[PATCH] powerpc: reduce multi-hit of pcibios_setup_device() in hotplug

2014-05-07 Thread Wei Yang
ady in iommu group 7, skipping This patch removes the pcibios_setup_bus_devices() in pcibios_add_pci_devices(). Signed-off-by: Wei Yang --- arch/powerpc/kernel/pci-hotplug.c |1 - 1 file changed, 1 deletion(-) diff --git a/arch/powerpc/kernel/pci-hotplug.c b/arch/powerpc/kernel/pci-hot

[PATCH] powerpc/eeh: skip eeh sysfs when eeh is disabled

2014-06-03 Thread Wei Yang
s/pci:00/:00:00.0/eeh_pe_config_addr' Signed-off-by: Wei Yang Acked-by: Gavin Shan --- arch/powerpc/kernel/eeh_sysfs.c |3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/powerpc/kernel/eeh_sysfs.c b/arch/powerpc/kernel/eeh_sysfs.c index 5d753d4..e2595ba 100644 --- a/arch/po

[RFC PATCH V3 00/17] Enable SRIOV on POWER8

2014-06-09 Thread Wei Yang
ing and assigning" 2. Wrap VF PE code in CONFIG_PCI_IOV 3. Did regression test on P7. Wei Yang (17): pci/iov: Export interface for retrieve VF's BDF pci/of: Match PCI VFs to dev-tree nodes dynamically ppc/pci: don't unset pci resources for VFs PCI: SRIOV: add VF enab

[RFC PATCH V3 01/17] pci/iov: Export interface for retrieve VF's BDF

2014-06-09 Thread Wei Yang
: * Make the virtfn_bus as an interface * Make the virtfn_devfn as an interface * rename them with more specific name * code cleanup in pci_sriov_resource_alignment() Signed-off-by: Wei Yang --- drivers/pci/iov.c | 26 +++--- drivers/pci

[RFC PATCH V3 02/17] pci/of: Match PCI VFs to dev-tree nodes dynamically

2014-06-09 Thread Wei Yang
As introduced by commit 98d9f30c82 ("pci/of: Match PCI devices to dev-tree nodes dynamically"), we need to match PCI devices to their corresponding dev-tree nodes. While for VFs, this step was missed. This patch matches VFs' PCI devices to dev-tree nodes dynamically. Signed-o

[RFC PATCH V3 04/17] PCI: SRIOV: add VF enable/disable hook

2014-06-09 Thread Wei Yang
VFs are dynamically created/released when driver enable them. On some platforms, like PowerNV, special resources are necessary to enable VFs. This patch adds two hooks for platform initialization before creating the VFs. Signed-off-by: Wei Yang --- drivers/pci/iov.c | 19

[RFC PATCH V3 03/17] ppc/pci: don't unset pci resources for VFs

2014-06-09 Thread Wei Yang
VF, skip the resource unset process. Signed-off-by: Wei Yang --- arch/powerpc/kernel/pci-common.c |6 ++ 1 file changed, 6 insertions(+) diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c index d9476c1..c449a26 100644 --- a/arch/powerpc/kernel/pci-common.c

[RFC PATCH V3 05/17] ppc/pnv: user macro to define the TCE size

2014-06-09 Thread Wei Yang
During the initialization of the TVT/TCE, it uses digits to specify the TCE IO Page Size, TCE Table Size, TCE Entry Size, etc. This patch replaces those digits with macros, which will be more meaningful and easy to read. Signed-off-by: Wei Yang --- arch/powerpc/include/asm/tce.h

[RFC PATCH V3 06/17] ppc/pnv: allocate pe->iommu_table dynamically

2014-06-09 Thread Wei Yang
Current iommu_table of a PE is a static field. This will have a problem when iommu_free_table is called. This patch allocate iommu_table dynamically. Signed-off-by: Wei Yang --- arch/powerpc/include/asm/iommu.h |3 +++ arch/powerpc/platforms/powernv/pci-ioda.c | 24

[RFC PATCH V3 07/17] ppc/pnv: Add function to deconfig a PE

2014-06-09 Thread Wei Yang
On PowerNV platform, it will support dynamic PE allocation and deallocation. This patch adds a function to release those resources related to a PE. Signed-off-by: Wei Yang --- arch/powerpc/platforms/powernv/pci-ioda.c | 77 + 1 file changed, 77 insertions(+) diff

[RFC PATCH V3 08/17] PCI: Add weak pcibios_sriov_resource_size() interface

2014-06-09 Thread Wei Yang
alignment, the IOV resource size would be expended. This means the original method couldn't work. This patch introduces a weak pcibios_sriov_resource_size() interface, which gives platform a chance to implement specific method to calculate the sriov resource size. Signed-off-by: Wei Yang --- dr

[RFC PATCH V3 09/17] PCI: Add weak pcibios_sriov_resource_alignment() interface

2014-06-09 Thread Wei Yang
f the IOV BAR. This patch introduces a weak pcibios_sriov_resource_alignment() interface, which gives platform a chance to implement specific method to calculate the sriov resource alignment. Signed-off-by: Wei Yang --- drivers/pci/iov.c | 11 ++- 1 file changed, 10 insertions(+), 1 del

[RFC PATCH V3 10/17] PCI: take additional IOV BAR alignment in sizing and assigning

2014-06-09 Thread Wei Yang
nt is mostly the size of a PF BAR alignemt. This means the alignment is already taken into consideration. While this rule may be violated on some platform. This patch take the additional IOV BAR alignment in sizing and assigning stage explicitly. Signed-off-by: Wei Yang --- drivers/pci/setup-bus.c |

[RFC PATCH V3 12/17] powerpc/powernv: implement pcibios_sriov_resource_alignment on powernv

2014-06-09 Thread Wei Yang
This patch implements the pcibios_sriov_resource_alignment() on powernv platform. Signed-off-by: Wei Yang --- arch/powerpc/include/asm/machdep.h|1 + arch/powerpc/kernel/pci-common.c |8 arch/powerpc/platforms/powernv/pci-ioda.c | 17 + 3

[RFC PATCH V3 11/17] ppc/pnv: Expand VF resources according to the number of total_pe

2014-06-09 Thread Wei Yang
which prevents the conflict. Signed-off-by: Wei Yang --- arch/powerpc/include/asm/machdep.h|6 +++ arch/powerpc/include/asm/pci-bridge.h |3 ++ arch/powerpc/kernel/pci-common.c | 15 ++ arch/powerpc/platforms/powernv/pci-ioda.c | 83 +++

[RFC PATCH V3 13/17] powerpc/powernv: shift VF resource with an offset

2014-06-09 Thread Wei Yang
ned-off-by: Wei Yang --- arch/powerpc/platforms/powernv/pci-ioda.c | 30 + 1 file changed, 30 insertions(+) diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index b0ac851..e46c5bf 100644 --- a/arch/powerpc/platfor

[RFC PATCH V3 14/17] ppc/pci: create/release dev-tree node for VFs

2014-06-09 Thread Wei Yang
pci_dev is created. Signed-off-by: Wei Yang --- arch/powerpc/platforms/powernv/Kconfig|1 + arch/powerpc/platforms/powernv/pci-ioda.c | 103 + arch/powerpc/platforms/powernv/pci.c | 20 ++ 3 files changed, 124 insertions(+) diff --git a/a

[RFC PATCH V3 16/17] ppc/pci: Expanding IOV BAR, with m64_per_iov supported

2014-06-09 Thread Wei Yang
power2. Signed-off-by: Wei Yang --- arch/powerpc/include/asm/pci-bridge.h |2 ++ arch/powerpc/platforms/powernv/pci-ioda.c | 28 ++-- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci

[RFC PATCH V3 15/17] powerpc/powernv: allocate VF PE

2014-06-09 Thread Wei Yang
VFs are created, when driver intends to enable sriov. This patch assign related resources and allocate PEs for VF at this moment. This patch allocate enough M64 for IOV BAR and shift the VF resource to meet the PE# indicated by M64. Signed-off-by: Wei Yang --- arch/powerpc/include/asm/pci

[RFC PATCH V3 17/17] ppc/pnv: Group VF PE when IOV BAR is big on PHB3

2014-06-09 Thread Wei Yang
When IOV BAR is big, each of it is covered by 4 M64 window. This leads to several VF PE sits in one PE in terms of M64. This patch group VF PEs according to the M64 allocation. Signed-off-by: Wei Yang --- arch/powerpc/include/asm/pci-bridge.h |2 +- arch/powerpc/platforms/powernv/pci

Re: [PATCH] powerpc: reduce multi-hit of pcibios_setup_device() in hotplug

2014-06-11 Thread Wei Yang
On Mon, May 12, 2014 at 12:59:19PM +1000, Benjamin Herrenschmidt wrote: >On Thu, 2014-05-08 at 14:30 +0800, Wei Yang wrote: >> During the EEH hotplug event, pcibios_setup_device() will be invoked two >> times. And the last time will trigger a warning of re-attachment of iommu >&

Re: [PATCH] powerpc: reduce multi-hit of pcibios_setup_device() in hotplug

2014-06-11 Thread Wei Yang
On Wed, Jun 11, 2014 at 05:29:44PM +1000, Benjamin Herrenschmidt wrote: >On Wed, 2014-06-11 at 15:12 +0800, Wei Yang wrote: > >> Sorry for the long delay. It took me some time to investigate and test the >> code. >> Currently, the hotplug by qemu monitor command lin

Re: [RFC PATCH V3 14/17] ppc/pci: create/release dev-tree node for VFs

2014-06-18 Thread Wei Yang
On Wed, Jun 18, 2014 at 07:26:27PM +0100, Grant Likely wrote: >On Tue, Jun 10, 2014 at 2:56 AM, Wei Yang wrote: >> Currently, powernv platform is not aware of VFs. This means no dev-node >> represents a VF. Also, VF PCI device is created when PF driver want to enable >> it.

Re: [RFC PATCH V3 14/17] ppc/pci: create/release dev-tree node for VFs

2014-06-19 Thread Wei Yang
On Thu, Jun 19, 2014 at 09:30:47AM +0100, Grant Likely wrote: >On Thu, Jun 19, 2014 at 3:46 AM, Wei Yang wrote: >> On Wed, Jun 18, 2014 at 07:26:27PM +0100, Grant Likely wrote: >>>On Tue, Jun 10, 2014 at 2:56 AM, Wei Yang wrote: >>>> Currently, powernv platform is n

Re: [RFC PATCH V3 14/17] ppc/pci: create/release dev-tree node for VFs

2014-06-19 Thread Wei Yang
On Thu, Jun 19, 2014 at 09:30:47AM +0100, Grant Likely wrote: >On Thu, Jun 19, 2014 at 3:46 AM, Wei Yang wrote: >> On Wed, Jun 18, 2014 at 07:26:27PM +0100, Grant Likely wrote: >>>On Tue, Jun 10, 2014 at 2:56 AM, Wei Yang wrote: >>>> Currently, powernv platform is n

Re: [RFC PATCH V3 02/17] pci/of: Match PCI VFs to dev-tree nodes dynamically

2014-06-22 Thread Wei Yang
On Mon, Jun 23, 2014 at 03:07:47PM +1000, Gavin Shan wrote: >On Tue, Jun 10, 2014 at 09:56:24AM +0800, Wei Yang wrote: >>As introduced by commit 98d9f30c82 ("pci/of: Match PCI devices to dev-tree >>nodes >>dynamically"), we need to match PCI devices to their corres

Re: [RFC PATCH V3 04/17] PCI: SRIOV: add VF enable/disable hook

2014-06-22 Thread Wei Yang
On Mon, Jun 23, 2014 at 03:03:10PM +1000, Gavin Shan wrote: >On Tue, Jun 10, 2014 at 09:56:26AM +0800, Wei Yang wrote: >>VFs are dynamically created/released when driver enable them. On some >>platforms, like PowerNV, special resources are necessary to enable VFs. >> >&g

Re: [RFC PATCH V3 05/17] ppc/pnv: user macro to define the TCE size

2014-06-22 Thread Wei Yang
On Mon, Jun 23, 2014 at 03:12:33PM +1000, Gavin Shan wrote: >On Tue, Jun 10, 2014 at 09:56:27AM +0800, Wei Yang wrote: >>During the initialization of the TVT/TCE, it uses digits to specify the TCE IO >>Page Size, TCE Table Size, TCE Entry Size, etc. >> >>This patch

Re: [RFC PATCH V3 11/17] ppc/pnv: Expand VF resources according to the number of total_pe

2014-06-22 Thread Wei Yang
On Mon, Jun 23, 2014 at 04:07:07PM +1000, Gavin Shan wrote: >On Tue, Jun 10, 2014 at 09:56:33AM +0800, Wei Yang wrote: >>On PHB3, VF resources will be covered by M64 BAR to have better PE isolation. >>Mostly the total_pe number is different from the total_VFs, which will lead

Re: [RFC PATCH V3 08/17] PCI: Add weak pcibios_sriov_resource_size() interface

2014-06-23 Thread Wei Yang
On Mon, Jun 23, 2014 at 03:41:28PM +1000, Gavin Shan wrote: >On Tue, Jun 10, 2014 at 09:56:30AM +0800, Wei Yang wrote: >>When retrieving sriov resource size in pci_sriov_resource_size(), it will >>divide the total IOV resource size with the totalVF number. This is true for >>

Re: [RFC PATCH V3 12/17] powerpc/powernv: implement pcibios_sriov_resource_alignment on powernv

2014-06-23 Thread Wei Yang
On Mon, Jun 23, 2014 at 04:09:47PM +1000, Gavin Shan wrote: >On Tue, Jun 10, 2014 at 09:56:34AM +0800, Wei Yang wrote: >>This patch implements the pcibios_sriov_resource_alignment() on powernv >>platform. >> >>Signed-off-by: Wei Yang >>--- >> arch/powe

Re: [RFC PATCH V3 07/17] ppc/pnv: Add function to deconfig a PE

2014-06-23 Thread Wei Yang
On Mon, Jun 23, 2014 at 03:27:21PM +1000, Gavin Shan wrote: >On Tue, Jun 10, 2014 at 09:56:29AM +0800, Wei Yang wrote: >>On PowerNV platform, it will support dynamic PE allocation and deallocation. >> >>This patch adds a function to release those resources related to a PE. &g

Re: [RFC PATCH V3 12/17] powerpc/powernv: implement pcibios_sriov_resource_alignment on powernv

2014-06-23 Thread Wei Yang
On Tue, Jun 24, 2014 at 09:29:22AM +1000, Gavin Shan wrote: >On Mon, Jun 23, 2014 at 04:21:42PM +0800, Wei Yang wrote: >>On Mon, Jun 23, 2014 at 04:09:47PM +1000, Gavin Shan wrote: >>>On Tue, Jun 10, 2014 at 09:56:34AM +0800, Wei Yang wrote: >>>

Re: [RFC PATCH V3 06/17] ppc/pnv: allocate pe->iommu_table dynamically

2014-06-24 Thread Wei Yang
On Tue, Jun 24, 2014 at 08:06:32PM +1000, Alexey Kardashevskiy wrote: >On 06/10/2014 11:56 AM, Wei Yang wrote: >> Current iommu_table of a PE is a static field. This will have a problem when >> iommu_free_table is called. > >What kind of problem? This table is per PE and PE

Re: [RFC PATCH V3 06/17] ppc/pnv: allocate pe->iommu_table dynamically

2014-06-24 Thread Wei Yang
On Wed, Jun 25, 2014 at 02:12:34PM +1000, Alexey Kardashevskiy wrote: >On 06/25/2014 11:12 AM, Wei Yang wrote: >> On Tue, Jun 24, 2014 at 08:06:32PM +1000, Alexey Kardashevskiy wrote: >>> On 06/10/2014 11:56 AM, Wei Yang wrote: >>>> Current iommu_table of a PE is a

Re: [PATCH] Bugfix: powerpc/eeh: Create eeh sysfs entry in post_init()

2014-06-24 Thread Wei Yang
On Wed, Jun 25, 2014 at 03:33:12PM +1000, Gavin Shan wrote: >On Tue, Jun 24, 2014 at 11:32:07PM -0400, Mike Qiu wrote: > >[ cc Richard ] > >>Eeh sysfs entry created must be after EEH_ENABLED been set >>in eeh_subsystem_flags. >> >>In PowerNV platform, it try to create sysfs entry before >>EEH_ENABL

Re: [RFC PATCH V3 06/17] ppc/pnv: allocate pe->iommu_table dynamically

2014-06-25 Thread Wei Yang
On Wed, Jun 25, 2014 at 05:50:08PM +1000, Alexey Kardashevskiy wrote: >On 06/25/2014 03:27 PM, Wei Yang wrote: >> On Wed, Jun 25, 2014 at 02:12:34PM +1000, Alexey Kardashevskiy wrote: >>> On 06/25/2014 11:12 AM, Wei Yang wrote: >>>> On Tue, Jun 24, 2014 at 08:06:32

Re: [RFC PATCH V3 06/17] ppc/pnv: allocate pe->iommu_table dynamically

2014-06-25 Thread Wei Yang
On Wed, Jun 25, 2014 at 05:56:37PM +1000, Benjamin Herrenschmidt wrote: >On Wed, 2014-06-25 at 17:50 +1000, Alexey Kardashevskiy wrote: > >> > Yes, iommu_talbe's life time equals to PE lifetime, so when releasing a PE >> > we >> > need to release the iommu table. Currently, there is one function t

Re: [RFC PATCH V3 06/17] ppc/pnv: allocate pe->iommu_table dynamically

2014-06-25 Thread Wei Yang
On Wed, Jun 25, 2014 at 09:20:11AM +, David Laight wrote: >From: Wei Yang >> On Wed, Jun 25, 2014 at 02:12:34PM +1000, Alexey Kardashevskiy wrote: >> >On 06/25/2014 11:12 AM, Wei Yang wrote: >> >> On Tue, Jun 24, 2014 at 08:06:32PM +1000, Alexey Kardashevskiy wro

Re: [PATCH 1/6] powerpc/powernv: Enable M64 aperatus for PHB3

2014-07-14 Thread Wei Yang
On Thu, Jul 10, 2014 at 09:53:41PM +0800, Guo Chao wrote: >This patch enable M64 aperatus for PHB3. > >We already had platform hook (ppc_md.pcibios_window_alignment) to affect >the PCI resource assignment done in PCI core so that each PE's M32 resource >was built on basis of M32 segment size. Simil

[PATCH V7 00/17] Enable SRIOV on POWER8

2014-07-23 Thread Wei Yang
wrap VF PE code in CONFIG_PCI_IOV 3. did regression test on P7. Gavin Shan (2): powrepc/pci: Refactor pci_dn powerpc/powernv: Use pci_dn in PCI config accessor Wei Yang (15): PCI/IOV: Export interface for retrieve VF's BDF PCI/IOV: Get VF BAR size from hardware directly when platfo

[PATCH V7 02/17] PCI/IOV: Get VF BAR size from hardware directly when platform needs

2014-07-23 Thread Wei Yang
F BAR size based on that when platform wants so. Signed-off-by: Wei Yang --- drivers/pci/iov.c | 28 include/linux/ioport.h |1 + 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c index 7566238..ef1c546 10

[PATCH V7 03/17] PCI: Add weak pcibios_sriov_resource_alignment() interface

2014-07-23 Thread Wei Yang
f the IOV BAR. This patch introduces a weak pcibios_sriov_resource_alignment() interface, which gives platform a chance to implement specific method to calculate the sriov resource alignment. Signed-off-by: Wei Yang --- drivers/pci/iov.c | 11 ++- include/linux/pci.h |3 +++ 2

[PATCH V7 01/17] PCI/IOV: Export interface for retrieve VF's BDF

2014-07-23 Thread Wei Yang
: * Make the virtfn_bus as an interface * Make the virtfn_devfn as an interface * rename them with more specific name * code cleanup in pci_sriov_resource_alignment() Signed-off-by: Wei Yang --- drivers/pci/iov.c | 26 +++--- drivers/pci

[PATCH V7 04/17] PCI: Take additional IOV BAR alignment in sizing and assigning

2014-07-23 Thread Wei Yang
nt is mostly the size of a PF BAR alignemt. This means the alignment is already taken into consideration. While this rule may be violated on some platform. This patch take the additional IOV BAR alignment in sizing and assigning stage explicitly. Signed-off-by: Wei Yang --- drivers/pci/setup-bus.c |

[PATCH V7 05/17] powerpc/pci: Don't unset pci resources for VFs

2014-07-23 Thread Wei Yang
ndition. If the pci_dev is a VF, skip the resource unset process. Signed-off-by: Wei Yang --- arch/powerpc/kernel/pci-common.c |4 1 file changed, 4 insertions(+) diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c index b49c72f..ee70f57 100644 --- a/arch/pow

[PATCH V7 06/17] powerpc/pci: Define pcibios_disable_device() on powerpc

2014-07-23 Thread Wei Yang
When driver remove a pci_dev, it will call pcibios_disable_device() which is platform dependent. This gives flexibility to platforms. This patch defines this weak function on powerpc architecture. Signed-off-by: Wei Yang --- arch/powerpc/include/asm/machdep.h |5 - arch/powerpc/kernel

[PATCH V7 07/17] powrepc/pci: Refactor pci_dn

2014-07-23 Thread Wei Yang
From: Gavin Shan pci_dn is the extension of PCI device node and it's created from device node. Unfortunately, VFs that are enabled dynamically by PF's driver and they don't have corresponding device nodes, and pci_dn. The patch refactors pci_dn to support VFs: * pci_dn is organized as a hiera

[PATCH V7 08/17] powerpc/powernv: Use pci_dn in PCI config accessor

2014-07-23 Thread Wei Yang
From: Gavin Shan The PCI config accessors rely on device node. Unfortunately, VFs don't have corresponding device nodes. So we have to switch to pci_dn for PCI config access. Signed-off-by: Gavin Shan --- arch/powerpc/platforms/powernv/eeh-powernv.c | 24 - arch/powerpc/platforms/pow

[PATCH V7 09/17] powerpc/powernv: mark IOV BAR with IORESOURCE_ARCH

2014-07-23 Thread Wei Yang
On powernv platform, the IOV BAR size will be adjusted to meet the alignment requirement from hardware. This leads to the VF resource size need to be retrieved from hardware directly. This patch adds this flag for IOV BAR on powernv platform. Signed-off-by: Wei Yang --- arch/powerpc/platforms

[PATCH V7 10/17] powerpc/powernv: Allocate pe->iommu_table dynamically

2014-07-23 Thread Wei Yang
Current iommu_table of a PE is a static field. This will have a problem when iommu_free_table is called. This patch allocate iommu_table dynamically. Signed-off-by: Wei Yang --- arch/powerpc/include/asm/iommu.h |3 +++ arch/powerpc/platforms/powernv/pci-ioda.c | 26

[PATCH V7 12/17] powerpc/powernv: Expand VF resources according to the number of total_pe

2014-07-23 Thread Wei Yang
which prevents the conflict. Signed-off-by: Wei Yang --- arch/powerpc/include/asm/machdep.h|4 ++ arch/powerpc/include/asm/pci-bridge.h |3 + arch/powerpc/kernel/pci-common.c |5 ++ arch/powerpc/platforms/powernv/pci-ioda.c | 91 +

[PATCH V7 11/17] powerpc/powernv: Add function to deconfig a PE

2014-07-23 Thread Wei Yang
On PowerNV platform, it will support dynamic PE allocation and deallocation. This patch adds a function to release those resources related to a PE. Also fix a bug when it is the root bus, there is no bridge associated. Signed-off-by: Wei Yang --- arch/powerpc/platforms/powernv/pci-ioda.c

[PATCH V7 13/17] powerpc/powernv: Implement pcibios_sriov_resource_alignment on powernv

2014-07-23 Thread Wei Yang
This patch implements the pcibios_sriov_resource_alignment() on powernv platform. Signed-off-by: Wei Yang --- arch/powerpc/include/asm/machdep.h|3 +++ arch/powerpc/kernel/pci-common.c | 14 ++ arch/powerpc/platforms/powernv/pci-ioda.c | 18

[PATCH V7 16/17] powerpc/powernv: Expanding IOV BAR, with m64_per_iov supported

2014-07-23 Thread Wei Yang
power2. Signed-off-by: Wei Yang --- arch/powerpc/include/asm/pci-bridge.h |2 ++ arch/powerpc/platforms/powernv/pci-ioda.c | 31 +++-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci

[PATCH V7 15/17] powerpc/powernv: Allocate VF PE

2014-07-23 Thread Wei Yang
VFs are created, when pci device is enabled. This patch tries best to assign maximum resources and PEs for VF when pci device is enabled. Enough M64 assigned to cover the IOV BAR, IOV BAR is shifted to meet the PE# indicated by M64. VF's pdn->pdev and pdn->pe_number are fixed. Signed-

[PATCH V7 17/17] powerpc/powernv: Group VF PE when IOV BAR is big on PHB3

2014-07-23 Thread Wei Yang
When IOV BAR is big, each of it is covered by 4 M64 window. This leads to several VF PE sits in one PE in terms of M64. This patch group VF PEs according to the M64 allocation. Signed-off-by: Wei Yang --- arch/powerpc/include/asm/pci-bridge.h |2 +- arch/powerpc/platforms/powernv/pci

[PATCH V7 14/17] powerpc/powernv: Shift VF resource with an offset

2014-07-23 Thread Wei Yang
ned-off-by: Wei Yang --- arch/powerpc/platforms/powernv/pci-ioda.c | 31 + 1 file changed, 31 insertions(+) diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index 3aeb87b..18e2917 100644 --- a/arch/powerpc/platfor

Re: [PATCH] powerpc/powernv: Fix IOMMU group lost

2014-08-05 Thread Wei Yang
) in iommu_add_device() to allow calling the function >even the specified device already has associated IOMMU group. > >Cc: # 3.16+ >Reported-by: Thadeu Lima de Souza Cascardo >Signed-off-by: Gavin Shan >Tested-by: Wei Yang >--- > arch/powerpc/kernel/iommu.c

Re: [PATCH] powerpc/powernv: Fix IOMMU group lost

2014-08-05 Thread Wei Yang
nt PCI bus isn't involved in hotplug, the IOMMU >group is expected to be bound in (A). > >The patch fixes the issue by reverting commit 3f28c5a and remove >WARN_ON() in iommu_add_device() to allow calling the function >even the specified device already has associated IOMMU group

[PATCH] powerpc/eeh: fix crashing when passing VF

2014-08-18 Thread Wei Yang
7c7e1b78 [ 442.660566] 7c9f2378 6000 6000 e93e02c8 2fa3 41de00c4 2b9f0002 [ 442.660679] ---[ end trace a64ac9546bcf0328 ]--- [ 442.660724] The reason is current VF is not EEH enabled. This patch is a quick fix for this problem. Signed-off-by: Wei Yang --- arch/powerpc/kernel/eeh.c

Re: [PATCH V7 01/17] PCI/IOV: Export interface for retrieve VF's BDF

2014-08-19 Thread Wei Yang
On Tue, Aug 19, 2014 at 03:37:26PM -0600, Bjorn Helgaas wrote: >On Thu, Jul 24, 2014 at 02:22:11PM +0800, Wei Yang wrote: >> When implementing the SR-IOV on PowerNV platform, some resource reservation >> is >> needed for VFs which don't exist at the bootup stag

Re: [PATCH V7 02/17] PCI/IOV: Get VF BAR size from hardware directly when platform needs

2014-08-19 Thread Wei Yang
On Tue, Aug 19, 2014 at 03:44:59PM -0600, Bjorn Helgaas wrote: >On Thu, Jul 24, 2014 at 02:22:12PM +0800, Wei Yang wrote: >> Current implementation calculates VF BAR size from dividing the total size of >> IOV BAR by total VF number. It won't work on PowerNV platform becau

Re: [PATCH V7 00/17] Enable SRIOV on POWER8

2014-08-19 Thread Wei Yang
On Tue, Aug 19, 2014 at 03:19:42PM -0600, Bjorn Helgaas wrote: >On Thu, Jul 24, 2014 at 02:22:10PM +0800, Wei Yang wrote: >> This patch set enables the SRIOV on POWER8. >> >> The gerneral idea is put each VF into one individual PE and allocate required >> resources lik

Re: [PATCH V7 00/17] Enable SRIOV on POWER8

2014-08-19 Thread Wei Yang
On Tue, Aug 19, 2014 at 10:12:27PM -0500, Bjorn Helgaas wrote: >On Tue, Aug 19, 2014 at 9:34 PM, Wei Yang wrote: >> On Tue, Aug 19, 2014 at 03:19:42PM -0600, Bjorn Helgaas wrote: >>>On Thu, Jul 24, 2014 at 02:22:10PM +0800, Wei Yang wrote: >>>> This patch s

Re: [PATCH V7 04/17] PCI: Take additional IOV BAR alignment in sizing and assigning

2014-08-19 Thread Wei Yang
On Tue, Aug 19, 2014 at 09:08:41PM -0600, Bjorn Helgaas wrote: >On Thu, Jul 24, 2014 at 02:22:14PM +0800, Wei Yang wrote: >> At resource sizing/assigning stage, resources are divided into two lists, >> requested list and additional list, while the alignement of the additional &g

Re: [PATCH 2/3] MSI: Use __read_msi_msg() instead of read_msi_msg()

2014-08-21 Thread Wei Yang
On Fri, Aug 15, 2014 at 11:14:29AM +0800, Yijing Wang wrote: >Read_msi_msg() only be called in rtas_setup_msi_irqs(), read_msi_msg() This code looks good to me, while I can't apply on top of 3.17-rc1. If you rebase it, it would be more convenient for maintainer to merge. >use __read_msi_msg() i

Re: [PATCH V7 04/17] PCI: Take additional IOV BAR alignment in sizing and assigning

2014-08-27 Thread Wei Yang
Bjorn, Is my understanding correct? Could I send another version based on your comment, so that we can see it meets your requirement? On Wed, Aug 20, 2014 at 02:14:02PM +0800, Wei Yang wrote: >On Tue, Aug 19, 2014 at 09:08:41PM -0600, Bjorn Helgaas wrote: >>On Thu, Jul 24, 2014 at 0

Re: [PATCH] powerpc/eeh: fix crashing when passing VF

2014-09-09 Thread Wei Yang
Hi, Ben Sounds this is not merged in the mainline yet. Would you like me sending a new version with those fix? Or you don't like this? On Wed, Aug 20, 2014 at 12:07:35PM +1000, Gavin Shan wrote: >On Tue, Aug 19, 2014 at 10:27:09AM +0800, Wei Yang wrote: > >The subject would be &qu

Re: [PATCH V7 04/17] PCI: Take additional IOV BAR alignment in sizing and assigning

2014-09-09 Thread Wei Yang
On Tue, Sep 09, 2014 at 02:09:46PM -0600, Bjorn Helgaas wrote: >On Wed, Aug 20, 2014 at 12:14 AM, Wei Yang wrote: >> On Tue, Aug 19, 2014 at 09:08:41PM -0600, Bjorn Helgaas wrote: >>>On Thu, Jul 24, 2014 at 02:22:14PM +0800, Wei Yang wrote: >>>> At resource sizing/

[PATCH V2] powerpc/eeh: Fix kernel crash when passing through VF

2014-09-10 Thread Wei Yang
7c7e1b78 [ 442.660566] 7c9f2378 6000 6000 e93e02c8 2fa3 41de00c4 2b9f0002 [ 442.660679] ---[ end trace a64ac9546bcf0328 ]--- [ 442.660724] The reason is current VF is not EEH enabled. This patch is a quick fix for this problem. Signed-off-by: Wei Yang Acked-by: Gavin Shan V1 ->

Re: [PATCH V2] powerpc/eeh: Fix kernel crash when passing through VF

2014-09-12 Thread Wei Yang
On Fri, Sep 12, 2014 at 03:05:18PM +1000, Gavin Shan wrote: >On Fri, Sep 12, 2014 at 01:55:23PM +1000, Michael Ellerman wrote: >>On Thu, 2014-09-11 at 11:42 +0800, Wei Yang wrote: >>> diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c >>> index 4a45ba

[PATCH] powerpc/eeh: Fix kernel crash when passing through VF

2014-09-15 Thread Wei Yang
with NULL pointer. Signed-off-by: Wei Yang Acked-by: Gavin Shan V2 -> V3: 1. rebased on 3.17-rc4 2. introduce a marco 3. use this marco in several other places V1 -> V2: 1. code style and patch subject adjustment --- arch/powerpc/kernel/eeh.c|4 ++-- arch/powerpc/

  1   2   3   4   5   6   7   >