linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] vfio: eeh: spapr: Compile and compatibility fixes
@ 2014-08-05 12:29 Alexey Kardashevskiy
  2014-08-05 12:29 ` [PATCH 1/4] powerpc/eeh: Export eeh_iommu_group_to_pe() Alexey Kardashevskiy
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Alexey Kardashevskiy @ 2014-08-05 12:29 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Alexey Kardashevskiy, Alex Williamson, Gavin Shan

Here is what I have in my stash.

Alexey Kardashevskiy (2):
  vfio_spapr_eeh: Enable compile as a module
  vfio_pci: spapr: Enable VFIO if EEH is not supported

Gavin Shan (2):
  powerpc/eeh: Export eeh_iommu_group_to_pe()
  vfio: spapr: Fix build error

 arch/powerpc/kernel/eeh.c     |  1 +
 drivers/vfio/Makefile         |  4 ++--
 drivers/vfio/pci/vfio_pci.c   |  6 ++----
 drivers/vfio/vfio.c           |  1 +
 drivers/vfio/vfio_spapr_eeh.c | 16 ++++++++++++++++
 5 files changed, 22 insertions(+), 6 deletions(-)

-- 
2.0.0

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/4] powerpc/eeh: Export eeh_iommu_group_to_pe()
  2014-08-05 12:29 [PATCH 0/4] vfio: eeh: spapr: Compile and compatibility fixes Alexey Kardashevskiy
@ 2014-08-05 12:29 ` Alexey Kardashevskiy
  2014-08-05 12:29 ` [PATCH 2/4] vfio: spapr: Fix build error Alexey Kardashevskiy
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Alexey Kardashevskiy @ 2014-08-05 12:29 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: Alexey Kardashevskiy, Alex Williamson, Gavin Shan, Gavin Shan

From: Gavin Shan <gwshan@linux.vnet.ibm.com>

The function is used by VFIO driver, which might be built as a
dynamic module.

Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
---
 arch/powerpc/kernel/eeh.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c
index 6043879..59a64f8 100644
--- a/arch/powerpc/kernel/eeh.c
+++ b/arch/powerpc/kernel/eeh.c
@@ -1254,6 +1254,7 @@ struct eeh_pe *eeh_iommu_group_to_pe(struct iommu_group *group)
 
 	return edev->pe;
 }
+EXPORT_SYMBOL_GPL(eeh_iommu_group_to_pe);
 
 #endif /* CONFIG_IOMMU_API */
 
-- 
2.0.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/4] vfio: spapr: Fix build error
  2014-08-05 12:29 [PATCH 0/4] vfio: eeh: spapr: Compile and compatibility fixes Alexey Kardashevskiy
  2014-08-05 12:29 ` [PATCH 1/4] powerpc/eeh: Export eeh_iommu_group_to_pe() Alexey Kardashevskiy
@ 2014-08-05 12:29 ` Alexey Kardashevskiy
  2014-08-05 14:18   ` Alex Williamson
  2014-08-05 12:29 ` [PATCH 3/4] vfio_spapr_eeh: Enable compile as a module Alexey Kardashevskiy
  2014-08-05 12:29 ` [PATCH 4/4] vfio_pci: spapr: Enable VFIO if EEH is not supported Alexey Kardashevskiy
  3 siblings, 1 reply; 7+ messages in thread
From: Alexey Kardashevskiy @ 2014-08-05 12:29 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: Alexey Kardashevskiy, Alex Williamson, Gavin Shan, Gavin Shan

From: Gavin Shan <gwshan@linux.vnet.ibm.com>

The VFIO related components could be built as dynamic modules.
Unfortunately, CONFIG_EEH can't be configured to "m". The patch
fixes the build errors when configuring VFIO related components
as dynamic modules as follows:

  CC [M]  drivers/vfio/vfio_iommu_spapr_tce.o
In file included from drivers/vfio/vfio.c:33:0:
include/linux/vfio.h:101:43: warning: ‘struct pci_dev’ declared \
inside parameter list [enabled by default]
:
  WRAP    arch/powerpc/boot/zImage.pseries
  WRAP    arch/powerpc/boot/zImage.maple
  WRAP    arch/powerpc/boot/zImage.pmac
  WRAP    arch/powerpc/boot/zImage.epapr
  MODPOST 1818 modules
ERROR: ".vfio_spapr_iommu_eeh_ioctl" [drivers/vfio/vfio_iommu_spapr_tce.ko]\
undefined!
ERROR: ".vfio_spapr_pci_eeh_open" [drivers/vfio/pci/vfio-pci.ko] undefined!
ERROR: ".vfio_spapr_pci_eeh_release" [drivers/vfio/pci/vfio-pci.ko] undefined!

Reported-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
---
 drivers/vfio/Makefile         | 4 ++--
 drivers/vfio/vfio.c           | 1 +
 drivers/vfio/vfio_spapr_eeh.c | 6 ++++++
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/vfio/Makefile b/drivers/vfio/Makefile
index 50e30bc..4891cca 100644
--- a/drivers/vfio/Makefile
+++ b/drivers/vfio/Makefile
@@ -1,5 +1,5 @@
 obj-$(CONFIG_VFIO) += vfio.o
 obj-$(CONFIG_VFIO_IOMMU_TYPE1) += vfio_iommu_type1.o
-obj-$(CONFIG_VFIO_IOMMU_SPAPR_TCE) += vfio_iommu_spapr_tce.o
-obj-$(CONFIG_EEH) += vfio_spapr_eeh.o
+obj-$(CONFIG_VFIO_IOMMU_SPAPR_TCE) += vfio_iommu_spapr_tce.o \
+				      vfio_spapr_eeh.o
 obj-$(CONFIG_VFIO_PCI) += pci/
diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c
index f018d8d..b4118e0 100644
--- a/drivers/vfio/vfio.c
+++ b/drivers/vfio/vfio.c
@@ -25,6 +25,7 @@
 #include <linux/miscdevice.h>
 #include <linux/module.h>
 #include <linux/mutex.h>
+#include <linux/pci.h>
 #include <linux/rwsem.h>
 #include <linux/sched.h>
 #include <linux/slab.h>
diff --git a/drivers/vfio/vfio_spapr_eeh.c b/drivers/vfio/vfio_spapr_eeh.c
index f834b4c..1a93e83 100644
--- a/drivers/vfio/vfio_spapr_eeh.c
+++ b/drivers/vfio/vfio_spapr_eeh.c
@@ -14,15 +14,19 @@
 #include <asm/eeh.h>
 
 /* We might build address mapping here for "fast" path later */
+#ifdef CONFIG_EEH
+
 int vfio_spapr_pci_eeh_open(struct pci_dev *pdev)
 {
 	return eeh_dev_open(pdev);
 }
+EXPORT_SYMBOL_GPL(vfio_spapr_pci_eeh_open);
 
 void vfio_spapr_pci_eeh_release(struct pci_dev *pdev)
 {
 	eeh_dev_release(pdev);
 }
+EXPORT_SYMBOL_GPL(vfio_spapr_pci_eeh_release);
 
 long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group,
 				unsigned int cmd, unsigned long arg)
@@ -85,3 +89,5 @@ long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group,
 
 	return ret;
 }
+EXPORT_SYMBOL_GPL(vfio_spapr_iommu_eeh_ioctl);
+#endif /* CONFIG_EEH */
-- 
2.0.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/4] vfio_spapr_eeh: Enable compile as a module
  2014-08-05 12:29 [PATCH 0/4] vfio: eeh: spapr: Compile and compatibility fixes Alexey Kardashevskiy
  2014-08-05 12:29 ` [PATCH 1/4] powerpc/eeh: Export eeh_iommu_group_to_pe() Alexey Kardashevskiy
  2014-08-05 12:29 ` [PATCH 2/4] vfio: spapr: Fix build error Alexey Kardashevskiy
@ 2014-08-05 12:29 ` Alexey Kardashevskiy
  2014-08-05 12:29 ` [PATCH 4/4] vfio_pci: spapr: Enable VFIO if EEH is not supported Alexey Kardashevskiy
  3 siblings, 0 replies; 7+ messages in thread
From: Alexey Kardashevskiy @ 2014-08-05 12:29 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Alexey Kardashevskiy, Alex Williamson, Gavin Shan

This adds necessary declarations to the module, otherwise multiple
dynamic linker errors happen:

vfio_spapr_eeh: Unknown symbol eeh_pe_set_option (err 0)
vfio_spapr_eeh: Unknown symbol eeh_pe_configure (err 0)
vfio_spapr_eeh: Unknown symbol eeh_pe_reset (err 0)
vfio_spapr_eeh: Unknown symbol eeh_pe_get_state (err 0)
vfio_spapr_eeh: Unknown symbol eeh_iommu_group_to_pe (err 0)
vfio_spapr_eeh: Unknown symbol eeh_dev_open (err 0)
vfio_spapr_eeh: Unknown symbol eeh_pe_set_option (err 0)
vfio_spapr_eeh: Unknown symbol eeh_pe_configure (err 0)
vfio_spapr_eeh: Unknown symbol eeh_pe_reset (err 0)
vfio_spapr_eeh: Unknown symbol eeh_pe_get_state (err 0)
vfio_spapr_eeh: Unknown symbol eeh_iommu_group_to_pe (err 0)
vfio_spapr_eeh: Unknown symbol eeh_dev_open (err 0)

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
 drivers/vfio/vfio_spapr_eeh.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/vfio/vfio_spapr_eeh.c b/drivers/vfio/vfio_spapr_eeh.c
index 1a93e83..a942dd0 100644
--- a/drivers/vfio/vfio_spapr_eeh.c
+++ b/drivers/vfio/vfio_spapr_eeh.c
@@ -9,10 +9,15 @@
  * published by the Free Software Foundation.
  */
 
+#include <linux/module.h>
 #include <linux/uaccess.h>
 #include <linux/vfio.h>
 #include <asm/eeh.h>
 
+#define DRIVER_VERSION  "0.1"
+#define DRIVER_AUTHOR   "Gavin Shan, IBM Corporation"
+#define DRIVER_DESC     "VFIO IOMMU SPAPR EEH"
+
 /* We might build address mapping here for "fast" path later */
 #ifdef CONFIG_EEH
 
@@ -91,3 +96,8 @@ long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group,
 }
 EXPORT_SYMBOL_GPL(vfio_spapr_iommu_eeh_ioctl);
 #endif /* CONFIG_EEH */
+
+MODULE_VERSION(DRIVER_VERSION);
+MODULE_LICENSE("GPL v2");
+MODULE_AUTHOR(DRIVER_AUTHOR);
+MODULE_DESCRIPTION(DRIVER_DESC);
-- 
2.0.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/4] vfio_pci: spapr: Enable VFIO if EEH is not supported
  2014-08-05 12:29 [PATCH 0/4] vfio: eeh: spapr: Compile and compatibility fixes Alexey Kardashevskiy
                   ` (2 preceding siblings ...)
  2014-08-05 12:29 ` [PATCH 3/4] vfio_spapr_eeh: Enable compile as a module Alexey Kardashevskiy
@ 2014-08-05 12:29 ` Alexey Kardashevskiy
  2014-08-05 17:59   ` Alex Williamson
  3 siblings, 1 reply; 7+ messages in thread
From: Alexey Kardashevskiy @ 2014-08-05 12:29 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Alexey Kardashevskiy, Alex Williamson, Gavin Shan

The existing vfio_pci_open() fails if there is no EEH support for PCI.
This breaks POWER7's P5IOC2 PHB support which this patch brings back.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
 drivers/vfio/pci/vfio_pci.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c
index e2ee80f..63a73c0 100644
--- a/drivers/vfio/pci/vfio_pci.c
+++ b/drivers/vfio/pci/vfio_pci.c
@@ -179,10 +179,8 @@ static int vfio_pci_open(void *device_data)
 			goto error;
 
 		ret = vfio_spapr_pci_eeh_open(vdev->pdev);
-		if (ret) {
-			vfio_pci_disable(vdev);
-			goto error;
-		}
+		if (ret)
+			pr_warn("EEH is not supported\n");
 	}
 
 	return 0;
-- 
2.0.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/4] vfio: spapr: Fix build error
  2014-08-05 12:29 ` [PATCH 2/4] vfio: spapr: Fix build error Alexey Kardashevskiy
@ 2014-08-05 14:18   ` Alex Williamson
  0 siblings, 0 replies; 7+ messages in thread
From: Alex Williamson @ 2014-08-05 14:18 UTC (permalink / raw)
  To: Alexey Kardashevskiy; +Cc: linuxppc-dev, Gavin Shan, Gavin Shan

On Tue, 2014-08-05 at 22:29 +1000, Alexey Kardashevskiy wrote:
> From: Gavin Shan <gwshan@linux.vnet.ibm.com>
> 
> The VFIO related components could be built as dynamic modules.
> Unfortunately, CONFIG_EEH can't be configured to "m". The patch
> fixes the build errors when configuring VFIO related components
> as dynamic modules as follows:
> 
>   CC [M]  drivers/vfio/vfio_iommu_spapr_tce.o
> In file included from drivers/vfio/vfio.c:33:0:
> include/linux/vfio.h:101:43: warning: ‘struct pci_dev’ declared \
> inside parameter list [enabled by default]
> :
>   WRAP    arch/powerpc/boot/zImage.pseries
>   WRAP    arch/powerpc/boot/zImage.maple
>   WRAP    arch/powerpc/boot/zImage.pmac
>   WRAP    arch/powerpc/boot/zImage.epapr
>   MODPOST 1818 modules
> ERROR: ".vfio_spapr_iommu_eeh_ioctl" [drivers/vfio/vfio_iommu_spapr_tce.ko]\
> undefined!
> ERROR: ".vfio_spapr_pci_eeh_open" [drivers/vfio/pci/vfio-pci.ko] undefined!
> ERROR: ".vfio_spapr_pci_eeh_release" [drivers/vfio/pci/vfio-pci.ko] undefined!
> 
> Reported-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
> ---
>  drivers/vfio/Makefile         | 4 ++--
>  drivers/vfio/vfio.c           | 1 +
>  drivers/vfio/vfio_spapr_eeh.c | 6 ++++++
>  3 files changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/vfio/Makefile b/drivers/vfio/Makefile
> index 50e30bc..4891cca 100644
> --- a/drivers/vfio/Makefile
> +++ b/drivers/vfio/Makefile
> @@ -1,5 +1,5 @@
>  obj-$(CONFIG_VFIO) += vfio.o
>  obj-$(CONFIG_VFIO_IOMMU_TYPE1) += vfio_iommu_type1.o
> -obj-$(CONFIG_VFIO_IOMMU_SPAPR_TCE) += vfio_iommu_spapr_tce.o
> -obj-$(CONFIG_EEH) += vfio_spapr_eeh.o
> +obj-$(CONFIG_VFIO_IOMMU_SPAPR_TCE) += vfio_iommu_spapr_tce.o \
> +				      vfio_spapr_eeh.o
>  obj-$(CONFIG_VFIO_PCI) += pci/
> diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c
> index f018d8d..b4118e0 100644
> --- a/drivers/vfio/vfio.c
> +++ b/drivers/vfio/vfio.c
> @@ -25,6 +25,7 @@
>  #include <linux/miscdevice.h>
>  #include <linux/module.h>
>  #include <linux/mutex.h>
> +#include <linux/pci.h>

VFIO-core shouldn't need to know about PCI, fix it some other way.
Since this code isn't in -next yet, I can't see what's causing it.

>  #include <linux/rwsem.h>
>  #include <linux/sched.h>
>  #include <linux/slab.h>
> diff --git a/drivers/vfio/vfio_spapr_eeh.c b/drivers/vfio/vfio_spapr_eeh.c
> index f834b4c..1a93e83 100644
> --- a/drivers/vfio/vfio_spapr_eeh.c
> +++ b/drivers/vfio/vfio_spapr_eeh.c
> @@ -14,15 +14,19 @@
>  #include <asm/eeh.h>
>  
>  /* We might build address mapping here for "fast" path later */
> +#ifdef CONFIG_EEH

Why not add a new CONFIG_VFIO_SPAPR_EEH option to handle this instead?

> +
>  int vfio_spapr_pci_eeh_open(struct pci_dev *pdev)
>  {
>  	return eeh_dev_open(pdev);
>  }
> +EXPORT_SYMBOL_GPL(vfio_spapr_pci_eeh_open);
>  
>  void vfio_spapr_pci_eeh_release(struct pci_dev *pdev)
>  {
>  	eeh_dev_release(pdev);
>  }
> +EXPORT_SYMBOL_GPL(vfio_spapr_pci_eeh_release);
>  
>  long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group,
>  				unsigned int cmd, unsigned long arg)
> @@ -85,3 +89,5 @@ long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group,
>  
>  	return ret;
>  }
> +EXPORT_SYMBOL_GPL(vfio_spapr_iommu_eeh_ioctl);
> +#endif /* CONFIG_EEH */

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 4/4] vfio_pci: spapr: Enable VFIO if EEH is not supported
  2014-08-05 12:29 ` [PATCH 4/4] vfio_pci: spapr: Enable VFIO if EEH is not supported Alexey Kardashevskiy
@ 2014-08-05 17:59   ` Alex Williamson
  0 siblings, 0 replies; 7+ messages in thread
From: Alex Williamson @ 2014-08-05 17:59 UTC (permalink / raw)
  To: Alexey Kardashevskiy; +Cc: linuxppc-dev, Gavin Shan

On Tue, 2014-08-05 at 22:29 +1000, Alexey Kardashevskiy wrote:
> The existing vfio_pci_open() fails if there is no EEH support for PCI.
> This breaks POWER7's P5IOC2 PHB support which this patch brings back.
> 
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> ---
>  drivers/vfio/pci/vfio_pci.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c
> index e2ee80f..63a73c0 100644
> --- a/drivers/vfio/pci/vfio_pci.c
> +++ b/drivers/vfio/pci/vfio_pci.c
> @@ -179,10 +179,8 @@ static int vfio_pci_open(void *device_data)
>  			goto error;
>  
>  		ret = vfio_spapr_pci_eeh_open(vdev->pdev);
> -		if (ret) {
> -			vfio_pci_disable(vdev);
> -			goto error;
> -		}
> +		if (ret)
> +			pr_warn("EEH is not supported\n");

Is this really deserving of a warn?  Does it need a warning every time?
pr_warn_once?  pr_info?  pr_info_once?

PS - kvm is the official vfio mailing list; suggest keeping it cc'd

>  	}
>  
>  	return 0;

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-08-05 18:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-05 12:29 [PATCH 0/4] vfio: eeh: spapr: Compile and compatibility fixes Alexey Kardashevskiy
2014-08-05 12:29 ` [PATCH 1/4] powerpc/eeh: Export eeh_iommu_group_to_pe() Alexey Kardashevskiy
2014-08-05 12:29 ` [PATCH 2/4] vfio: spapr: Fix build error Alexey Kardashevskiy
2014-08-05 14:18   ` Alex Williamson
2014-08-05 12:29 ` [PATCH 3/4] vfio_spapr_eeh: Enable compile as a module Alexey Kardashevskiy
2014-08-05 12:29 ` [PATCH 4/4] vfio_pci: spapr: Enable VFIO if EEH is not supported Alexey Kardashevskiy
2014-08-05 17:59   ` Alex Williamson

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).