Skip to contentSkip to conversation

powerpc/pseries/eeh: Fix pseries_eeh_err_inject

PATCH Superseded Narayana Murty N 4 participants 6 messages Aug 23, 2024 – Sep 10, 2024

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 powerpc/pseries/eeh: Fix pseries_eeh_err_inject

VFIO_EEH_PE_INJECT_ERR ioctl is currently failing on pseries due to missing implementation of err_inject eeh_ops for pseries. This patch implements pseries_eeh_err_inject in eeh_ops/pseries eeh_ops. Implements support for injecting MMIO load/store error for testing from user space.

The check on PCI error type code is moved to platform code, since the eeh_pe_inject_err can be allowed to more error types depending on platform requirement.

---

Testing:
========
vfio-test [1] by Alex Willamson, was forked and updated to add support inject error on pSeries guest and used to test this patch[2].

References:
===========
[1] https://github.com/awilliam/tests
[2] https://github.com/nnmwebmin/vfio-ppc-tests/tree/vfio-ppc-ex

================
Changelog:
V1:https://lore.kernel.org/all/[email protected]/
- Resolved build issues for ppc64|le_defconfig by moving the pseries_eeh_err_inject() definition outside of the CONFIG_PCI_IOV code block.
- New eeh_pe_inject_mmio_error wrapper function added to avoid CONFIG_EEH is not set.

---
 arch/powerpc/include/asm/eeh.h               |  6 ++-
 arch/powerpc/kernel/eeh.c                    |  9 +++--
 arch/powerpc/platforms/pseries/eeh_pseries.c | 39 +++++++++++++++++++-
 3 files changed, 48 insertions(+), 6 deletions(-)
arch/powerpc/include/asm/eeh.h +5 -1
index 91a9fd53254f..8da6b047a4fe 100644
@@ -308,7 +308,7 @@ int eeh_pe_reset(struct eeh_pe *pe, int option, bool include_passed);
 int eeh_pe_configure(struct eeh_pe *pe);
 int eeh_pe_inject_err(struct eeh_pe *pe, int type, int func,
 		      unsigned long addr, unsigned long mask);
-
+int eeh_pe_inject_mmio_error(struct pci_dev *pdev);
 /**
  * EEH_POSSIBLE_ERROR() -- test for possible MMIO failure.
  *
@@ -338,6 +338,10 @@ static inline int eeh_check_failure(const volatile void __iomem *token)
 	return 0;
 }
 
+static inline int eeh_pe_inject_mmio_error(struct pci_dev *pdev)
+{
+	return -ENXIO;
+}
 #define eeh_dev_check_failure(x) (0)
 
 static inline void eeh_addr_cache_init(void) { }
arch/powerpc/kernel/eeh.c +5 -4
index d03f17987fca..49ab11a287a3 100644
@@ -1537,10 +1537,6 @@ int eeh_pe_inject_err(struct eeh_pe *pe, int type, int func,
 	if (!eeh_ops || !eeh_ops->err_inject)
 		return -ENOENT;
 
-	/* Check on PCI error type */
-	if (type != EEH_ERR_TYPE_32 && type != EEH_ERR_TYPE_64)
-		return -EINVAL;
-
 	/* Check on PCI error function */
 	if (func < EEH_ERR_FUNC_MIN || func > EEH_ERR_FUNC_MAX)
 		return -EINVAL;
@@ -1851,6 +1847,11 @@ static const struct file_operations eeh_dev_break_fops = {
 	.read   = eeh_debugfs_dev_usage,
 };
 
+int eeh_pe_inject_mmio_error(struct pci_dev *pdev)
+{
+	return eeh_debugfs_break_device(pdev);
+}
+
 static ssize_t eeh_dev_can_recover(struct file *filp,
 				   const char __user *user_buf,
 				   size_t count, loff_t *ppos)
arch/powerpc/platforms/pseries/eeh_pseries.c +38 -1
index b1ae0c0d1187..1893f66371fa 100644
@@ -784,6 +784,43 @@ static int pseries_notify_resume(struct eeh_dev *edev)
 }
 #endif
 
+/**
+ * pseries_eeh_err_inject - Inject specified error to the indicated PE
+ * @pe: the indicated PE
+ * @type: error type
+ * @func: specific error type
+ * @addr: address
+ * @mask: address mask
+ * The routine is called to inject specified error, which is
+ * determined by @type and @func, to the indicated PE
+ */
+static int pseries_eeh_err_inject(struct eeh_pe *pe, int type, int func,
+				  unsigned long addr, unsigned long mask)
+{
+	struct	eeh_dev	*pdev;
+
+	/* Check on PCI error type */
+	if (type != EEH_ERR_TYPE_32 && type != EEH_ERR_TYPE_64)
+		return -EINVAL;
+
+	switch (func) {
+	case EEH_ERR_FUNC_LD_MEM_ADDR:
+	case EEH_ERR_FUNC_LD_MEM_DATA:
+	case EEH_ERR_FUNC_ST_MEM_ADDR:
+	case EEH_ERR_FUNC_ST_MEM_DATA:
+		/* injects a MMIO error for all pdev's belonging to PE */
+		pci_lock_rescan_remove();
+		list_for_each_entry(pdev, &pe->edevs, entry)
+			eeh_pe_inject_mmio_error(pdev->pdev);
+		pci_unlock_rescan_remove();
+		break;
+	default:
+		return -ERANGE;
+	}
+
+	return 0;
+}
+
 static struct eeh_ops pseries_eeh_ops = {
 	.name			= "pseries",
 	.probe			= pseries_eeh_probe,
@@ -792,7 +829,7 @@ static struct eeh_ops pseries_eeh_ops = {
 	.reset			= pseries_eeh_reset,
 	.get_log		= pseries_eeh_get_log,
 	.configure_bridge       = pseries_eeh_configure_bridge,
-	.err_inject		= NULL,
+	.err_inject		= pseries_eeh_err_inject,
 	.read_config		= pseries_eeh_read_config,
 	.write_config		= pseries_eeh_write_config,
 	.next_error		= NULL,
Signature · 1 line
2.45.2
Reviewed-by on v2 1/1
#1 lore raw

Hi Narayana,

Thanks for the patch.

Quoted 11 lines · Narayana Murty N

VFIO_EEH_PE_INJECT_ERR ioctl is currently failing on pseries due to missing implementation of err_inject eeh_ops for pseries. This patch implements pseries_eeh_err_inject in eeh_ops/pseries eeh_ops. Implements support for injecting MMIO load/store error for testing from user space.

The check on PCI error type code is moved to platform code, since the eeh_pe_inject_err can be allowed to more error types depending on platform requirement.

Code changes LGTM, hence

Quoted 138 lines

---

Testing:
========
vfio-test [1] by Alex Willamson, was forked and updated to add support inject error on pSeries guest and used to test this patch[2].

References:
===========
[1] https://github.com/awilliam/tests
[2] https://github.com/nnmwebmin/vfio-ppc-tests/tree/vfio-ppc-ex

================
Changelog:
V1:https://lore.kernel.org/all/[email protected]/
- Resolved build issues for ppc64|le_defconfig by moving the pseries_eeh_err_inject() definition outside of the CONFIG_PCI_IOV code block.
- New eeh_pe_inject_mmio_error wrapper function added to avoid CONFIG_EEH is not set.

---
 arch/powerpc/include/asm/eeh.h               |  6 ++-
 arch/powerpc/kernel/eeh.c                    |  9 +++--
 arch/powerpc/platforms/pseries/eeh_pseries.c | 39 +++++++++++++++++++-
 3 files changed, 48 insertions(+), 6 deletions(-)
arch/powerpc/include/asm/eeh.h +5 -1
index 91a9fd53254f..8da6b047a4fe 100644
@@ -308,7 +308,7 @@ int eeh_pe_reset(struct eeh_pe *pe, int option, bool include_passed);
 int eeh_pe_configure(struct eeh_pe *pe);
 int eeh_pe_inject_err(struct eeh_pe *pe, int type, int func,
 		      unsigned long addr, unsigned long mask);
-
+int eeh_pe_inject_mmio_error(struct pci_dev *pdev);
 /**
  * EEH_POSSIBLE_ERROR() -- test for possible MMIO failure.
  *
@@ -338,6 +338,10 @@ static inline int eeh_check_failure(const volatile void __iomem *token)
 	return 0;
 }
 
+static inline int eeh_pe_inject_mmio_error(struct pci_dev *pdev)
+{
+	return -ENXIO;
+}
 #define eeh_dev_check_failure(x) (0)
 
 static inline void eeh_addr_cache_init(void) { }
arch/powerpc/kernel/eeh.c +5 -4
index d03f17987fca..49ab11a287a3 100644
@@ -1537,10 +1537,6 @@ int eeh_pe_inject_err(struct eeh_pe *pe, int type, int func,
 	if (!eeh_ops || !eeh_ops->err_inject)
 		return -ENOENT;
 
-	/* Check on PCI error type */
-	if (type != EEH_ERR_TYPE_32 && type != EEH_ERR_TYPE_64)
-		return -EINVAL;
-
 	/* Check on PCI error function */
 	if (func < EEH_ERR_FUNC_MIN || func > EEH_ERR_FUNC_MAX)
 		return -EINVAL;
@@ -1851,6 +1847,11 @@ static const struct file_operations eeh_dev_break_fops = {
 	.read   = eeh_debugfs_dev_usage,
 };
 
+int eeh_pe_inject_mmio_error(struct pci_dev *pdev)
+{
+	return eeh_debugfs_break_device(pdev);
+}
+
 static ssize_t eeh_dev_can_recover(struct file *filp,
 				   const char __user *user_buf,
 				   size_t count, loff_t *ppos)
arch/powerpc/platforms/pseries/eeh_pseries.c +38 -1
index b1ae0c0d1187..1893f66371fa 100644
@@ -784,6 +784,43 @@ static int pseries_notify_resume(struct eeh_dev *edev)
 }
 #endif
 
+/**
+ * pseries_eeh_err_inject - Inject specified error to the indicated PE
+ * @pe: the indicated PE
+ * @type: error type
+ * @func: specific error type
+ * @addr: address
+ * @mask: address mask
+ * The routine is called to inject specified error, which is
+ * determined by @type and @func, to the indicated PE
+ */
+static int pseries_eeh_err_inject(struct eeh_pe *pe, int type, int func,
+				  unsigned long addr, unsigned long mask)
+{
+	struct	eeh_dev	*pdev;
+
+	/* Check on PCI error type */
+	if (type != EEH_ERR_TYPE_32 && type != EEH_ERR_TYPE_64)
+		return -EINVAL;
+
+	switch (func) {
+	case EEH_ERR_FUNC_LD_MEM_ADDR:
+	case EEH_ERR_FUNC_LD_MEM_DATA:
+	case EEH_ERR_FUNC_ST_MEM_ADDR:
+	case EEH_ERR_FUNC_ST_MEM_DATA:
+		/* injects a MMIO error for all pdev's belonging to PE */
+		pci_lock_rescan_remove();
+		list_for_each_entry(pdev, &pe->edevs, entry)
+			eeh_pe_inject_mmio_error(pdev->pdev);
+		pci_unlock_rescan_remove();
+		break;
+	default:
+		return -ERANGE;
+	}
+
+	return 0;
+}
+
 static struct eeh_ops pseries_eeh_ops = {
 	.name			= "pseries",
 	.probe			= pseries_eeh_probe,
@@ -792,7 +829,7 @@ static struct eeh_ops pseries_eeh_ops = {
 	.reset			= pseries_eeh_reset,
 	.get_log		= pseries_eeh_get_log,
 	.configure_bridge       = pseries_eeh_configure_bridge,
-	.err_inject		= NULL,
+	.err_inject		= pseries_eeh_err_inject,
 	.read_config		= pseries_eeh_read_config,
 	.write_config		= pseries_eeh_write_config,
 	.next_error		= NULL,
Signature · 1 line
2.45.2
Signature · 2 lines
Cheers
~ Vaibhav
maintainer Reviewed-by Tested-by on v2 1/1
#2 lore raw
In reply to Narayana Murty N
Quoted 116 lines · Narayana Murty N

VFIO_EEH_PE_INJECT_ERR ioctl is currently failing on pseries due to missing implementation of err_inject eeh_ops for pseries. This patch implements pseries_eeh_err_inject in eeh_ops/pseries eeh_ops. Implements support for injecting MMIO load/store error for testing from user space.

The check on PCI error type code is moved to platform code, since the eeh_pe_inject_err can be allowed to more error types depending on platform requirement.

---

Testing:
========
vfio-test [1] by Alex Willamson, was forked and updated to add support inject error on pSeries guest and used to test this patch[2].

References:
===========
[1] https://github.com/awilliam/tests
[2] https://github.com/nnmwebmin/vfio-ppc-tests/tree/vfio-ppc-ex

================
Changelog:
V1:https://lore.kernel.org/all/[email protected]/
- Resolved build issues for ppc64|le_defconfig by moving the pseries_eeh_err_inject() definition outside of the CONFIG_PCI_IOV code block.
- New eeh_pe_inject_mmio_error wrapper function added to avoid CONFIG_EEH is not set.

---
 arch/powerpc/include/asm/eeh.h               |  6 ++-
 arch/powerpc/kernel/eeh.c                    |  9 +++--
 arch/powerpc/platforms/pseries/eeh_pseries.c | 39 +++++++++++++++++++-
 3 files changed, 48 insertions(+), 6 deletions(-)
arch/powerpc/include/asm/eeh.h +5 -1
index 91a9fd53254f..8da6b047a4fe 100644
@@ -308,7 +308,7 @@ int eeh_pe_reset(struct eeh_pe *pe, int option, bool include_passed);
 int eeh_pe_configure(struct eeh_pe *pe);
 int eeh_pe_inject_err(struct eeh_pe *pe, int type, int func,
 		      unsigned long addr, unsigned long mask);
-
+int eeh_pe_inject_mmio_error(struct pci_dev *pdev);
 /**
  * EEH_POSSIBLE_ERROR() -- test for possible MMIO failure.
  *
@@ -338,6 +338,10 @@ static inline int eeh_check_failure(const volatile void __iomem *token)
 	return 0;
 }
 
+static inline int eeh_pe_inject_mmio_error(struct pci_dev *pdev)
+{
+	return -ENXIO;
+}
 #define eeh_dev_check_failure(x) (0)
 
 static inline void eeh_addr_cache_init(void) { }
arch/powerpc/kernel/eeh.c +5 -4
index d03f17987fca..49ab11a287a3 100644
@@ -1537,10 +1537,6 @@ int eeh_pe_inject_err(struct eeh_pe *pe, int type, int func,
 	if (!eeh_ops || !eeh_ops->err_inject)
 		return -ENOENT;
 
-	/* Check on PCI error type */
-	if (type != EEH_ERR_TYPE_32 && type != EEH_ERR_TYPE_64)
-		return -EINVAL;
-
 	/* Check on PCI error function */
 	if (func < EEH_ERR_FUNC_MIN || func > EEH_ERR_FUNC_MAX)
 		return -EINVAL;
@@ -1851,6 +1847,11 @@ static const struct file_operations eeh_dev_break_fops = {
 	.read   = eeh_debugfs_dev_usage,
 };
 
+int eeh_pe_inject_mmio_error(struct pci_dev *pdev)
+{
+	return eeh_debugfs_break_device(pdev);
+}
+
 static ssize_t eeh_dev_can_recover(struct file *filp,
 				   const char __user *user_buf,
 				   size_t count, loff_t *ppos)
arch/powerpc/platforms/pseries/eeh_pseries.c +19 -0
index b1ae0c0d1187..1893f66371fa 100644
@@ -784,6 +784,43 @@ static int pseries_notify_resume(struct eeh_dev *edev)
 }
 #endif
 
+/**
+ * pseries_eeh_err_inject - Inject specified error to the indicated PE
+ * @pe: the indicated PE
+ * @type: error type
+ * @func: specific error type
+ * @addr: address
+ * @mask: address mask
+ * The routine is called to inject specified error, which is
+ * determined by @type and @func, to the indicated PE
+ */
+static int pseries_eeh_err_inject(struct eeh_pe *pe, int type, int func,
+				  unsigned long addr, unsigned long mask)
+{
+	struct	eeh_dev	*pdev;
+
+	/* Check on PCI error type */
+	if (type != EEH_ERR_TYPE_32 && type != EEH_ERR_TYPE_64)
+		return -EINVAL;
+

arch/powerpc/platforms/pseries/eeh_pseries.c static int pseries_notify_resume(struct eeh_dev *edev) · line 815

Quoted 10 lines
arch/powerpc/platforms/pseries/eeh_pseries.c +10 -0
+	switch (func) {
+	case EEH_ERR_FUNC_LD_MEM_ADDR:
+	case EEH_ERR_FUNC_LD_MEM_DATA:
+	case EEH_ERR_FUNC_ST_MEM_ADDR:
+	case EEH_ERR_FUNC_ST_MEM_DATA:
+		/* injects a MMIO error for all pdev's belonging to PE */
+		pci_lock_rescan_remove();
+		list_for_each_entry(pdev, &pe->edevs, entry)
+			eeh_pe_inject_mmio_error(pdev->pdev);
+		pci_unlock_rescan_remove();

Changes looks good to me.

I have tested this with your VFIO chenges at https://github.com/nnmwebmin/vfio-ppc-tests/tree/vfio-ppc-ex

Thanks,
-Mahesh.

#3 lore raw
In reply to Narayana Murty N
Quoted 24 lines · Narayana Murty N

VFIO_EEH_PE_INJECT_ERR ioctl is currently failing on pseries due to missing implementation of err_inject eeh_ops for pseries. This patch implements pseries_eeh_err_inject in eeh_ops/pseries eeh_ops. Implements support for injecting MMIO load/store error for testing from user space.

The check on PCI error type code is moved to platform code, since the eeh_pe_inject_err can be allowed to more error types depending on platform requirement.

---

Testing:
========
vfio-test [1] by Alex Willamson, was forked and updated to add support inject error on pSeries guest and used to test this patch[2].

References:
===========
[1] https://github.com/awilliam/tests
[2] https://github.com/nnmwebmin/vfio-ppc-tests/tree/vfio-ppc-ex

Quoted 8 lines

================
Changelog:
V1:https://lore.kernel.org/all/[email protected]/
- Resolved build issues for ppc64|le_defconfig by moving the pseries_eeh_err_inject() definition outside of the CONFIG_PCI_IOV code block.
- New eeh_pe_inject_mmio_error wrapper function added to avoid CONFIG_EEH is not set.

I don't see why that's necessary?

It's only called from eeh_pseries.c, which is only built for PPC_PSERIES, and when PPC_PSERIES=y, EEH is always enabled.

Quoted 29 lines
arch/powerpc/include/asm/eeh.h +5 -1
index 91a9fd53254f..8da6b047a4fe 100644
@@ -308,7 +308,7 @@ int eeh_pe_reset(struct eeh_pe *pe, int option, bool include_passed);
 int eeh_pe_configure(struct eeh_pe *pe);
 int eeh_pe_inject_err(struct eeh_pe *pe, int type, int func,
 		      unsigned long addr, unsigned long mask);
-
+int eeh_pe_inject_mmio_error(struct pci_dev *pdev);
 /**
  * EEH_POSSIBLE_ERROR() -- test for possible MMIO failure.
  *
@@ -338,6 +338,10 @@ static inline int eeh_check_failure(const volatile void __iomem *token)
 	return 0;
 }
 
+static inline int eeh_pe_inject_mmio_error(struct pci_dev *pdev)
+{
+	return -ENXIO;
+}
 #define eeh_dev_check_failure(x) (0)
 
 static inline void eeh_addr_cache_init(void) { }
arch/powerpc/kernel/eeh.c +0 -0
index d03f17987fca..49ab11a287a3 100644

arch/powerpc/kernel/eeh.c int eeh_pe_inject_err(struct eeh_pe *pe, int type, int func, · line 1543

Quoted 7 lines
arch/powerpc/kernel/eeh.c +0 -4
@@ -1537,10 +1537,6 @@ int eeh_pe_inject_err(struct eeh_pe *pe, int type, int func,
 	if (!eeh_ops || !eeh_ops->err_inject)
 		return -ENOENT;
 
-	/* Check on PCI error type */
-	if (type != EEH_ERR_TYPE_32 && type != EEH_ERR_TYPE_64)
-		return -EINVAL;
-

The change log should mention why it's OK to remove these checks. You add the same checks in pseries_eeh_err_inject(), but what about pnv_eeh_err_inject() ?

It is OK AFAICS, because pnv_eeh_err_inject() already contains equivalent checks, but you should spell that out.

cheers

#4 lore raw
Quoted 80 lines · Michael Ellerman
Quoted 24 lines · Narayana Murty N

VFIO_EEH_PE_INJECT_ERR ioctl is currently failing on pseries due to missing implementation of err_inject eeh_ops for pseries. This patch implements pseries_eeh_err_inject in eeh_ops/pseries eeh_ops. Implements support for injecting MMIO load/store error for testing from user space.

The check on PCI error type code is moved to platform code, since the eeh_pe_inject_err can be allowed to more error types depending on platform requirement.

---

Testing:
========
vfio-test [1] by Alex Willamson, was forked and updated to add support inject error on pSeries guest and used to test this patch[2].

References:
===========
[1] https://github.com/awilliam/tests
[2] https://github.com/nnmwebmin/vfio-ppc-tests/tree/vfio-ppc-ex

Quoted 8 lines

================
Changelog:
V1:https://lore.kernel.org/all/[email protected]/
- Resolved build issues for ppc64|le_defconfig by moving the pseries_eeh_err_inject() definition outside of the CONFIG_PCI_IOV code block.
- New eeh_pe_inject_mmio_error wrapper function added to avoid CONFIG_EEH is not set.

I don't see why that's necessary?

It's only called from eeh_pseries.c, which is only built for PPC_PSERIES, and when PPC_PSERIES=y, EEH is always enabled.

Quoted 29 lines
arch/powerpc/include/asm/eeh.h +5 -1
index 91a9fd53254f..8da6b047a4fe 100644
@@ -308,7 +308,7 @@ int eeh_pe_reset(struct eeh_pe *pe, int option, bool include_passed);
  int eeh_pe_configure(struct eeh_pe *pe);
  int eeh_pe_inject_err(struct eeh_pe *pe, int type, int func,
  		      unsigned long addr, unsigned long mask);
-
+int eeh_pe_inject_mmio_error(struct pci_dev *pdev);
  /**
   * EEH_POSSIBLE_ERROR() -- test for possible MMIO failure.
   *
@@ -338,6 +338,10 @@ static inline int eeh_check_failure(const volatile void __iomem *token)
  	return 0;
  }
 
+static inline int eeh_pe_inject_mmio_error(struct pci_dev *pdev)
+{
+	return -ENXIO;
+}
  #define eeh_dev_check_failure(x) (0)
 
  static inline void eeh_addr_cache_init(void) { }
arch/powerpc/kernel/eeh.c +0 -0
index d03f17987fca..49ab11a287a3 100644

arch/powerpc/kernel/eeh.c int eeh_pe_inject_err(struct eeh_pe *pe, int type, int func, · line 1543

Quoted 7 lines
arch/powerpc/kernel/eeh.c +0 -4
@@ -1537,10 +1537,6 @@ int eeh_pe_inject_err(struct eeh_pe *pe, int type, int func,
  	if (!eeh_ops || !eeh_ops->err_inject)
  		return -ENOENT;
 
-	/* Check on PCI error type */
-	if (type != EEH_ERR_TYPE_32 && type != EEH_ERR_TYPE_64)
-		return -EINVAL;
-

The change log should mention why it's OK to remove these checks. You add the same checks in pseries_eeh_err_inject(), but what about pnv_eeh_err_inject() ?

Quoted 4 lines

It is OK AFAICS, because pnv_eeh_err_inject() already contains equivalent checks, but you should spell that out.

cheers

yes mpe. I do agree, your comments are addressed in V3 posted

here https://lore.kernel.org/all/[email protected]/

regards,

Narayana Murty.

#5 lore raw
Quoted 84 lines · Narayana Murty N
Quoted 83 lines · Michael Ellerman
Quoted 24 lines · Narayana Murty N

VFIO_EEH_PE_INJECT_ERR ioctl is currently failing on pseries due to missing implementation of err_inject eeh_ops for pseries. This patch implements pseries_eeh_err_inject in eeh_ops/pseries eeh_ops. Implements support for injecting MMIO load/store error for testing from user space.

The check on PCI error type code is moved to platform code, since the eeh_pe_inject_err can be allowed to more error types depending on platform requirement.

---

Testing:
========
vfio-test [1] by Alex Willamson, was forked and updated to add support inject error on pSeries guest and used to test this patch[2].

References:
===========
[1] https://github.com/awilliam/tests
[2] https://github.com/nnmwebmin/vfio-ppc-tests/tree/vfio-ppc-ex

Quoted 8 lines

================
Changelog:
V1:https://lore.kernel.org/all/[email protected]/
- Resolved build issues for ppc64|le_defconfig by moving the pseries_eeh_err_inject() definition outside of the CONFIG_PCI_IOV code block.
- New eeh_pe_inject_mmio_error wrapper function added to avoid CONFIG_EEH is not set.

I don't see why that's necessary?

It's only called from eeh_pseries.c, which is only built for PPC_PSERIES, and when PPC_PSERIES=y, EEH is always enabled.

Quoted 29 lines
arch/powerpc/include/asm/eeh.h +5 -1
index 91a9fd53254f..8da6b047a4fe 100644
@@ -308,7 +308,7 @@ int eeh_pe_reset(struct eeh_pe *pe, int option, bool include_passed);
  int eeh_pe_configure(struct eeh_pe *pe);
  int eeh_pe_inject_err(struct eeh_pe *pe, int type, int func,
  		      unsigned long addr, unsigned long mask);
-
+int eeh_pe_inject_mmio_error(struct pci_dev *pdev);
  /**
   * EEH_POSSIBLE_ERROR() -- test for possible MMIO failure.
   *
@@ -338,6 +338,10 @@ static inline int eeh_check_failure(const volatile void __iomem *token)
  	return 0;
  }
 
+static inline int eeh_pe_inject_mmio_error(struct pci_dev *pdev)
+{
+	return -ENXIO;
+}
  #define eeh_dev_check_failure(x) (0)
 
  static inline void eeh_addr_cache_init(void) { }
arch/powerpc/kernel/eeh.c +0 -0
index d03f17987fca..49ab11a287a3 100644

arch/powerpc/kernel/eeh.c int eeh_pe_inject_err(struct eeh_pe *pe, int type, int func, · line 1543

Quoted 7 lines
arch/powerpc/kernel/eeh.c +0 -4
@@ -1537,10 +1537,6 @@ int eeh_pe_inject_err(struct eeh_pe *pe, int type, int func,
  	if (!eeh_ops || !eeh_ops->err_inject)
  		return -ENOENT;
 
-	/* Check on PCI error type */
-	if (type != EEH_ERR_TYPE_32 && type != EEH_ERR_TYPE_64)
-		return -EINVAL;
-

The change log should mention why it's OK to remove these checks. You add the same checks in pseries_eeh_err_inject(), but what about pnv_eeh_err_inject() ?

It is OK AFAICS, because pnv_eeh_err_inject() already contains equivalent checks, but you should spell that out.

Quoted 6 lines
Quoted 1 line

cheers

yes mpe. I do agree, your comments are addressed in V3 posted

here
https://lore.kernel.org/all/[email protected]/

Thanks.

cheers