diff options
author | Gavin Shan <gwshan@linux.vnet.ibm.com> | 2015-03-26 01:42:08 -0400 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2015-05-12 06:33:35 -0400 |
commit | ec33d36e5ab5d52d59a8f696f7efb682bfc58494 (patch) | |
tree | 631d4367a6b9a0231962506744d5ffab9ca1e152 | |
parent | ed3e81ff2016b180d8f439a1981f2c8b59b0b53c (diff) |
powerpc/eeh: Introduce eeh_pe_inject_err()
The patch defines PCI error types and functions in uapi/asm/eeh.h
and exports function eeh_pe_inject_err(), which will be called by
VFIO driver to inject the specified PCI error to the indicated
PE for testing purpose.
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
-rw-r--r-- | arch/powerpc/include/asm/eeh.h | 2 | ||||
-rw-r--r-- | arch/powerpc/include/uapi/asm/eeh.h | 26 | ||||
-rw-r--r-- | arch/powerpc/kernel/eeh.c | 35 |
3 files changed, 63 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/eeh.h b/arch/powerpc/include/asm/eeh.h index 7fd7b5429e5a..c5eb86f3d452 100644 --- a/arch/powerpc/include/asm/eeh.h +++ b/arch/powerpc/include/asm/eeh.h | |||
@@ -291,6 +291,8 @@ int eeh_pe_set_option(struct eeh_pe *pe, int option); | |||
291 | int eeh_pe_get_state(struct eeh_pe *pe); | 291 | int eeh_pe_get_state(struct eeh_pe *pe); |
292 | int eeh_pe_reset(struct eeh_pe *pe, int option); | 292 | int eeh_pe_reset(struct eeh_pe *pe, int option); |
293 | int eeh_pe_configure(struct eeh_pe *pe); | 293 | int eeh_pe_configure(struct eeh_pe *pe); |
294 | int eeh_pe_inject_err(struct eeh_pe *pe, int type, int func, | ||
295 | unsigned long addr, unsigned long mask); | ||
294 | 296 | ||
295 | /** | 297 | /** |
296 | * EEH_POSSIBLE_ERROR() -- test for possible MMIO failure. | 298 | * EEH_POSSIBLE_ERROR() -- test for possible MMIO failure. |
diff --git a/arch/powerpc/include/uapi/asm/eeh.h b/arch/powerpc/include/uapi/asm/eeh.h index 8bb34b004995..291b7d1814a6 100644 --- a/arch/powerpc/include/uapi/asm/eeh.h +++ b/arch/powerpc/include/uapi/asm/eeh.h | |||
@@ -27,4 +27,30 @@ | |||
27 | #define EEH_PE_STATE_STOPPED_DMA 4 /* Stopped DMA only */ | 27 | #define EEH_PE_STATE_STOPPED_DMA 4 /* Stopped DMA only */ |
28 | #define EEH_PE_STATE_UNAVAIL 5 /* Unavailable */ | 28 | #define EEH_PE_STATE_UNAVAIL 5 /* Unavailable */ |
29 | 29 | ||
30 | /* EEH error types and functions */ | ||
31 | #define EEH_ERR_TYPE_32 0 /* 32-bits error */ | ||
32 | #define EEH_ERR_TYPE_64 1 /* 64-bits error */ | ||
33 | #define EEH_ERR_FUNC_MIN 0 | ||
34 | #define EEH_ERR_FUNC_LD_MEM_ADDR 0 /* Memory load */ | ||
35 | #define EEH_ERR_FUNC_LD_MEM_DATA 1 | ||
36 | #define EEH_ERR_FUNC_LD_IO_ADDR 2 /* IO load */ | ||
37 | #define EEH_ERR_FUNC_LD_IO_DATA 3 | ||
38 | #define EEH_ERR_FUNC_LD_CFG_ADDR 4 /* Config load */ | ||
39 | #define EEH_ERR_FUNC_LD_CFG_DATA 5 | ||
40 | #define EEH_ERR_FUNC_ST_MEM_ADDR 6 /* Memory store */ | ||
41 | #define EEH_ERR_FUNC_ST_MEM_DATA 7 | ||
42 | #define EEH_ERR_FUNC_ST_IO_ADDR 8 /* IO store */ | ||
43 | #define EEH_ERR_FUNC_ST_IO_DATA 9 | ||
44 | #define EEH_ERR_FUNC_ST_CFG_ADDR 10 /* Config store */ | ||
45 | #define EEH_ERR_FUNC_ST_CFG_DATA 11 | ||
46 | #define EEH_ERR_FUNC_DMA_RD_ADDR 12 /* DMA read */ | ||
47 | #define EEH_ERR_FUNC_DMA_RD_DATA 13 | ||
48 | #define EEH_ERR_FUNC_DMA_RD_MASTER 14 | ||
49 | #define EEH_ERR_FUNC_DMA_RD_TARGET 15 | ||
50 | #define EEH_ERR_FUNC_DMA_WR_ADDR 16 /* DMA write */ | ||
51 | #define EEH_ERR_FUNC_DMA_WR_DATA 17 | ||
52 | #define EEH_ERR_FUNC_DMA_WR_MASTER 18 | ||
53 | #define EEH_ERR_FUNC_DMA_WR_TARGET 19 | ||
54 | #define EEH_ERR_FUNC_MAX 19 | ||
55 | |||
30 | #endif /* _ASM_POWERPC_EEH_H */ | 56 | #endif /* _ASM_POWERPC_EEH_H */ |
diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c index 9ee61d15653d..04b5d94973dc 100644 --- a/arch/powerpc/kernel/eeh.c +++ b/arch/powerpc/kernel/eeh.c | |||
@@ -1647,6 +1647,41 @@ int eeh_pe_configure(struct eeh_pe *pe) | |||
1647 | } | 1647 | } |
1648 | EXPORT_SYMBOL_GPL(eeh_pe_configure); | 1648 | EXPORT_SYMBOL_GPL(eeh_pe_configure); |
1649 | 1649 | ||
1650 | /** | ||
1651 | * eeh_pe_inject_err - Injecting the specified PCI error to the indicated PE | ||
1652 | * @pe: the indicated PE | ||
1653 | * @type: error type | ||
1654 | * @function: error function | ||
1655 | * @addr: address | ||
1656 | * @mask: address mask | ||
1657 | * | ||
1658 | * The routine is called to inject the specified PCI error, which | ||
1659 | * is determined by @type and @function, to the indicated PE for | ||
1660 | * testing purpose. | ||
1661 | */ | ||
1662 | int eeh_pe_inject_err(struct eeh_pe *pe, int type, int func, | ||
1663 | unsigned long addr, unsigned long mask) | ||
1664 | { | ||
1665 | /* Invalid PE ? */ | ||
1666 | if (!pe) | ||
1667 | return -ENODEV; | ||
1668 | |||
1669 | /* Unsupported operation ? */ | ||
1670 | if (!eeh_ops || !eeh_ops->err_inject) | ||
1671 | return -ENOENT; | ||
1672 | |||
1673 | /* Check on PCI error type */ | ||
1674 | if (type != EEH_ERR_TYPE_32 && type != EEH_ERR_TYPE_64) | ||
1675 | return -EINVAL; | ||
1676 | |||
1677 | /* Check on PCI error function */ | ||
1678 | if (func < EEH_ERR_FUNC_MIN || func > EEH_ERR_FUNC_MAX) | ||
1679 | return -EINVAL; | ||
1680 | |||
1681 | return eeh_ops->err_inject(pe, type, func, addr, mask); | ||
1682 | } | ||
1683 | EXPORT_SYMBOL_GPL(eeh_pe_inject_err); | ||
1684 | |||
1650 | static int proc_eeh_show(struct seq_file *m, void *v) | 1685 | static int proc_eeh_show(struct seq_file *m, void *v) |
1651 | { | 1686 | { |
1652 | if (!eeh_enabled()) { | 1687 | if (!eeh_enabled()) { |