Re: [PATCH 0/2] VFIO: Accept IOMMU group (PE) ID

2015-09-22 Thread Gavin Shan
On Mon, Sep 21, 2015 at 11:42:28AM +1000, David Gibson wrote: >On Sat, Sep 19, 2015 at 04:22:47PM +1000, David Gibson wrote: >> On Fri, Sep 18, 2015 at 09:47:32AM -0600, Alex Williamson wrote: >> > On Fri, 2015-09-18 at 16:24 +1000, Gavin Shan wrote: >> > > This al

Re: [PATCH 0/2] VFIO: Accept IOMMU group (PE) ID

2015-09-21 Thread Gavin Shan
On Mon, Sep 21, 2015 at 11:42:28AM +1000, David Gibson wrote: >On Sat, Sep 19, 2015 at 04:22:47PM +1000, David Gibson wrote: >> On Fri, Sep 18, 2015 at 09:47:32AM -0600, Alex Williamson wrote: >> > On Fri, 2015-09-18 at 16:24 +1000, Gavin Shan wrote: >> > > This al

[PATCH 0/2] VFIO: Accept IOMMU group (PE) ID

2015-09-17 Thread Gavin Shan
are affected as before. Gavin Shan (2): drivers/vfio: Support EEH API revision drivers/vfio: Support IOMMU group for EEH operations drivers/vfio/vfio_iommu_spapr_tce.c | 50 ++--- drivers/vfio/vfio_spapr_eeh.c | 46

[PATCH 1/2] drivers/vfio: Support EEH API revision

2015-09-17 Thread Gavin Shan
This extends the return value from container's IOCTL command (VFIO_CHECK_EXTENSION + VFIO_EEH) to EEH API revision. Also, extra check is applied to return -ENOTTY if EEH functionality is disabled in vfio_spapr_iommu_eeh_ioctl(). Signed-off-by: Gavin Shan --- drivers/vfio/vfio_iommu_spapr_

[PATCH 2/2] drivers/vfio: Support IOMMU group for EEH operations

2015-09-17 Thread Gavin Shan
o specify IOMMU group (PE) ID when requesting EEH operation. Signed-off-by: Gavin Shan --- drivers/vfio/vfio_iommu_spapr_tce.c | 51 - drivers/vfio/vfio_spapr_eeh.c | 39 include/linux/vfio.h| 7 ++--- include/ua

Re: [PATCH kernel v11 21/34] powerpc/powernv/ioda2: Add TCE invalidation for all attached groups

2015-06-04 Thread Gavin Shan
PE needs to be invalidated so does the patch. > >This does not change pnv_pci_ioda1_tce_invalidate() as there is no plan >to enable TCE table sharing on PHBs older than IODA2. > >Signed-off-by: Alexey Kardashevskiy Reviewed-by: Gavin Shan >--- >Changes: >v10: >

Re: [PATCH kernel v11 20/34] powerpc/powernv/ioda2: Move TCE kill register address to PE

2015-06-04 Thread Gavin Shan
and 64bit DMA was handled via >bypass window (which has no table so no cache was used) but this is going >to change with Dynamic DMA windows (DDW). > >Signed-off-by: Alexey Kardashevskiy Reviewed-by: Gavin Shan Thanks, Gavin >--- >Changes: >v11: >* s/pnv_pci_ioda2_tvt_inv

Re: [PATCH kernel v11 16/34] powerpc/spapr: vfio: Replace iommu_table with iommu_table_group

2015-06-04 Thread Gavin Shan
_pci_ioda2_setup_dma_pe as this is where DMA is actually initialized. >This change is here because those lines had to be changed anyway. > >This should cause no behavioural change. > >Signed-off-by: Alexey Kardashevskiy >[aw: for the vfio related changes] >Acked-by: Alex Williamson

Re: [PATCH kernel v11 05/34] powerpc/iommu: Always release iommu_table in iommu_free_table()

2015-06-04 Thread Gavin Shan
DMA windows, we will need to be able to release >iommu_table even if it was used for VFIO in which case it_map is NULL >so does the patch. > >Signed-off-by: Alexey Kardashevskiy Reviewed-by: Gavin Shan Thanks, Gavin >--- >Changes: >v11: >* fixed parameter checks

Re: [PATCH kernel v11 33/34] vfio: powerpc/spapr: Register memory and define IOMMU v2

2015-06-04 Thread Gavin Shan
On Fri, May 29, 2015 at 06:44:57PM +1000, Alexey Kardashevskiy wrote: >The existing implementation accounts the whole DMA window in >the locked_vm counter. This is going to be worse with multiple >containers and huge DMA windows. Also, real-time accounting would requite >additional tracking of acco

Re: [PATCH v5 3/3] drivers/vfio: Support EEH error injection

2015-03-31 Thread Gavin Shan
On Tue, Mar 31, 2015 at 01:13:26PM -0600, Alex Williamson wrote: >On Thu, 2015-03-26 at 16:42 +1100, Gavin Shan wrote: >> The patch adds one more EEH sub-command (VFIO_EEH_PE_INJECT_ERR) >> to inject the specified EEH error, which is represented by >> (struct vfio_eeh_pe_err)

[PATCH v5 1/3] powerpc/eeh: Move PE state constants around

2015-03-25 Thread Gavin Shan
Signed-off-by: Gavin Shan --- arch/powerpc/include/asm/eeh.h | 7 ++- arch/powerpc/include/uapi/asm/eeh.h | 30 ++ 2 files changed, 32 insertions(+), 5 deletions(-) create mode 100644 arch/powerpc/include/uapi/asm/eeh.h diff --git a/arch/powerpc/include/asm/ee

[PATCH v5 0/3] EEH Error Injection Support for VFIO Devices

2015-03-25 Thread Gavin Shan
* Use offsetofend(), instead of sizeof(struct vfio_eeh_pe_op) to calculate argument buffer size. v1 -> v2: * Use EEH_ERR_FUNC_{MIN,MAX} to validate PCI error function. * Put additional arguments for error injection to union in struct vfio_eeh_pe_op. Gavin Shan (3

[PATCH v5 2/3] powerpc/eeh: Introduce eeh_pe_inject_err()

2015-03-25 Thread Gavin Shan
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 Reviewed-by: David Gibson --- arch/powerpc

[PATCH v5 3/3] drivers/vfio: Support EEH error injection

2015-03-25 Thread Gavin Shan
The patch adds one more EEH sub-command (VFIO_EEH_PE_INJECT_ERR) to inject the specified EEH error, which is represented by (struct vfio_eeh_pe_err), to the indicated PE for testing purpose. Signed-off-by: Gavin Shan Reviewed-by: David Gibson --- Documentation/vfio.txt| 12

Re: [PATCH v4 4/4] drivers/vfio: Remove duplicated PE states

2015-03-25 Thread Gavin Shan
On Wed, Mar 25, 2015 at 07:55:41PM -0600, Alex Williamson wrote: >On Thu, 2015-03-26 at 11:59 +1100, Gavin Shan wrote: >> On Wed, Mar 25, 2015 at 06:46:28PM -0600, Alex Williamson wrote: >> >On Thu, 2015-03-26 at 10:20 +1100, Gavin Shan wrote: >> >> The set of cons

Re: [PATCH v4 4/4] drivers/vfio: Remove duplicated PE states

2015-03-25 Thread Gavin Shan
On Thu, Mar 26, 2015 at 12:01:57PM +1100, David Gibson wrote: >On Wed, Mar 25, 2015 at 06:46:28PM -0600, Alex Williamson wrote: >> On Thu, 2015-03-26 at 10:20 +1100, Gavin Shan wrote: >> > The set of constants for PE states defined in uapi/linux/vfio.h is >> > duplic

Re: [PATCH v4 4/4] drivers/vfio: Remove duplicated PE states

2015-03-25 Thread Gavin Shan
On Wed, Mar 25, 2015 at 06:46:28PM -0600, Alex Williamson wrote: >On Thu, 2015-03-26 at 10:20 +1100, Gavin Shan wrote: >> The set of constants for PE states defined in uapi/linux/vfio.h is >> duplicated to uapi/asm/eeh.h. The patch removes the set from the >> former. >&g

[PATCH v4 4/4] drivers/vfio: Remove duplicated PE states

2015-03-25 Thread Gavin Shan
The set of constants for PE states defined in uapi/linux/vfio.h is duplicated to uapi/asm/eeh.h. The patch removes the set from the former. Signed-off-by: Gavin Shan --- include/uapi/linux/vfio.h | 5 - 1 file changed, 5 deletions(-) diff --git a/include/uapi/linux/vfio.h b/include/uapi

[PATCH v4 1/4] powerpc/eeh: Eliminate duplicated PE states

2015-03-25 Thread Gavin Shan
/asm/eeh.h to avoid maintaining two equivalent sets of constants. Suggested-by: David Gibson Signed-off-by: Gavin Shan --- arch/powerpc/include/asm/eeh.h | 7 ++- arch/powerpc/include/uapi/asm/eeh.h | 30 ++ 2 files changed, 32 insertions(+), 5 deletions

[PATCH v4 3/4] drivers/vfio: Support EEH error injection

2015-03-25 Thread Gavin Shan
The patch adds one more EEH sub-command (VFIO_EEH_PE_INJECT_ERR) to inject the specified EEH error, which is represented by (struct vfio_eeh_pe_err), to the indicated PE for testing purpose. Signed-off-by: Gavin Shan Reviewed-by: David Gibson --- Documentation/vfio.txt| 12

[PATCH v4 2/4] powerpc/eeh: Introduce eeh_pe_inject_err()

2015-03-25 Thread Gavin Shan
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 Reviewed-by: David Gibson --- arch/powerpc

[PATCH v4 0/4] EEH Error Injection Support for VFIO Devices

2015-03-25 Thread Gavin Shan
eeh_pe_op. Gavin Shan (4): powerpc/eeh: Eliminate duplicated PE states powerpc/eeh: Introduce eeh_pe_inject_err() drivers/vfio: Support EEH error injection drivers/vfio: Remove duplicated PE states Documentation/vfio.txt | 12 arch/powerpc/include/asm/eeh.h

Re: [PATCH v3 2/2] drivers/vfio: Support EEH error injection

2015-03-23 Thread Gavin Shan
On Tue, Mar 24, 2015 at 12:22:25PM +1100, David Gibson wrote: >On Tue, Mar 24, 2015 at 09:47:54AM +1100, Gavin Shan wrote: >> On Mon, Mar 23, 2015 at 10:14:59AM -0600, Alex Williamson wrote: >> >On Mon, 2015-03-23 at 16:20 +1100, Gavin Shan wrote: >> >> On Mon, Ma

Re: [PATCH v3 2/2] drivers/vfio: Support EEH error injection

2015-03-23 Thread Gavin Shan
On Mon, Mar 23, 2015 at 10:14:59AM -0600, Alex Williamson wrote: >On Mon, 2015-03-23 at 16:20 +1100, Gavin Shan wrote: >> On Mon, Mar 23, 2015 at 04:10:20PM +1100, David Gibson wrote: >> >On Mon, Mar 23, 2015 at 04:03:59PM +1100, Gavin Shan wrote: >> >> On Mon, Ma

Re: [PATCH v3 2/2] drivers/vfio: Support EEH error injection

2015-03-22 Thread Gavin Shan
On Mon, Mar 23, 2015 at 04:10:20PM +1100, David Gibson wrote: >On Mon, Mar 23, 2015 at 04:03:59PM +1100, Gavin Shan wrote: >> On Mon, Mar 23, 2015 at 02:43:03PM +1100, David Gibson wrote: >> >On Mon, Mar 23, 2015 at 12:56:36PM +1100, Gavin Shan wrote: >> >> On Mon, Ma

Re: [PATCH v3 2/2] drivers/vfio: Support EEH error injection

2015-03-22 Thread Gavin Shan
On Mon, Mar 23, 2015 at 02:43:03PM +1100, David Gibson wrote: >On Mon, Mar 23, 2015 at 12:56:36PM +1100, Gavin Shan wrote: >> On Mon, Mar 23, 2015 at 12:39:45PM +1100, David Gibson wrote: >> >On Sat, Mar 21, 2015 at 06:58:45AM +1100, Gavin Shan wrote: >> >> The patch

Re: [PATCH v3 2/2] drivers/vfio: Support EEH error injection

2015-03-22 Thread Gavin Shan
On Mon, Mar 23, 2015 at 12:39:45PM +1100, David Gibson wrote: >On Sat, Mar 21, 2015 at 06:58:45AM +1100, Gavin Shan wrote: >> The patch adds one more EEH sub-command (VFIO_EEH_PE_INJECT_ERR) >> to inject the specified EEH error, which is represented by >> (struct vfio_eeh_pe_e

[PATCH v3 1/2] powerpc/eeh: Introduce eeh_pe_inject_err()

2015-03-20 Thread Gavin Shan
The patch defines PCI error types and functions in 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 --- arch/powerpc/include/asm/eeh.h | 26

[PATCH v3 0/2] EEH Error Injection Support for VFIO Devices

2015-03-20 Thread Gavin Shan
fer size. v1 -> v2: * Use EEH_ERR_FUNC_{MIN,MAX} to validate PCI error function. * Put additional arguments for error injection to union in struct vfio_eeh_pe_op. Gavin Shan (2): powerpc/eeh: Introduce eeh_pe_inject_err() drivers/vfio: Support EEH error inj

[PATCH v3 2/2] drivers/vfio: Support EEH error injection

2015-03-20 Thread Gavin Shan
The patch adds one more EEH sub-command (VFIO_EEH_PE_INJECT_ERR) to inject the specified EEH error, which is represented by (struct vfio_eeh_pe_err), to the indicated PE for testing purpose. Signed-off-by: Gavin Shan --- Documentation/vfio.txt| 12 drivers/vfio

Re: [PATCH v2 2/2] drivers/vfio: Support EEH error injection

2015-03-17 Thread Gavin Shan
On Tue, Mar 17, 2015 at 02:45:49PM -0600, Alex Williamson wrote: >On Mon, 2015-03-16 at 18:01 +1100, Gavin Shan wrote: >> The patch adds one more EEH sub-command (VFIO_EEH_PE_INJECT_ERR) >> to inject the specified EEH error, which is represented by >> (struct vfio_eeh_pe_err)

[PATCH v2 2/2] drivers/vfio: Support EEH error injection

2015-03-16 Thread Gavin Shan
The patch adds one more EEH sub-command (VFIO_EEH_PE_INJECT_ERR) to inject the specified EEH error, which is represented by (struct vfio_eeh_pe_err), to the indicated PE for testing purpose. Signed-off-by: Gavin Shan --- v2: Put additional arguments for error injection to union

[PATCH v2 1/2] powerpc/eeh: Introduce eeh_pe_inject_err()

2015-03-16 Thread Gavin Shan
The patch defines PCI error types and functions in 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 --- v2: Use EEH_ERR_FUNC_{MIN,MAX} to validate PCI error

Re: [PATCH 2/2] drivers/vfio: Support EEH error injection

2015-03-15 Thread Gavin Shan
On Fri, Mar 13, 2015 at 02:35:18PM -0600, Alex Williamson wrote: >On Wed, 2015-03-11 at 17:34 +1100, Gavin Shan wrote: >> The patch adds one more EEH sub-command (VFIO_EEH_PE_INJECT_ERR) >> to inject the specified EEH error, which is represented by >> (struct vfio_eeh_pe_err)

Re: [PATCH 2/2] drivers/vfio: Support EEH error injection

2015-03-15 Thread Gavin Shan
On Fri, Mar 13, 2015 at 02:28:09PM -0600, Alex Williamson wrote: >On Thu, 2015-03-12 at 15:21 +1100, David Gibson wrote: >> On Thu, Mar 12, 2015 at 02:16:42PM +1100, Gavin Shan wrote: >> > On Thu, Mar 12, 2015 at 11:57:21AM +1100, David Gibson wrote: >> > >On Wed, Ma

Re: [PATCH 1/2] powerpc/eeh: Introduce eeh_pe_inject_err()

2015-03-15 Thread Gavin Shan
On Fri, Mar 13, 2015 at 02:28:33PM -0600, Alex Williamson wrote: >On Wed, 2015-03-11 at 17:34 +1100, Gavin Shan wrote: >> The patch defines PCI error types and functions in eeh.h and >> exports function eeh_pe_inject_err(), which will be called by >> VFIO driver to inject th

Re: [PATCH 2/2] drivers/vfio: Support EEH error injection

2015-03-11 Thread Gavin Shan
On Thu, Mar 12, 2015 at 03:21:29PM +1100, David Gibson wrote: >On Thu, Mar 12, 2015 at 02:16:42PM +1100, Gavin Shan wrote: >> On Thu, Mar 12, 2015 at 11:57:21AM +1100, David Gibson wrote: >> >On Wed, Mar 11, 2015 at 05:34:11PM +1100, Gavin Shan wrote: >> >> The patch

Re: [PATCH 2/2] drivers/vfio: Support EEH error injection

2015-03-11 Thread Gavin Shan
On Thu, Mar 12, 2015 at 11:57:21AM +1100, David Gibson wrote: >On Wed, Mar 11, 2015 at 05:34:11PM +1100, Gavin Shan wrote: >> The patch adds one more EEH sub-command (VFIO_EEH_PE_INJECT_ERR) >> to inject the specified EEH error, which is represented by >> (struct vfio_eeh_pe_e

[PATCH 1/2] powerpc/eeh: Introduce eeh_pe_inject_err()

2015-03-10 Thread Gavin Shan
The patch defines PCI error types and functions in 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 --- arch/powerpc/include/asm/eeh.h | 24

[PATCH 2/2] drivers/vfio: Support EEH error injection

2015-03-10 Thread Gavin Shan
The patch adds one more EEH sub-command (VFIO_EEH_PE_INJECT_ERR) to inject the specified EEH error, which is represented by (struct vfio_eeh_pe_err), to the indicated PE for testing purpose. Signed-off-by: Gavin Shan --- Documentation/vfio.txt| 47

[PATCH] drivers/vfio: Export vfio_spapr_iommu_eeh_ioctl() with GPL

2014-09-26 Thread Gavin Shan
The function should have been exported with EXPORT_SYMBOL_GPL() as part of commit 92d18a68 ("drivers/vfio: Fix EEH build error"). Suggested-by: Alexey Kardashevskiy Signed-off-by: Gavin Shan --- drivers/vfio/vfio_spapr_eeh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) di

[RESEND PATCH v3 1/2] PCI: Export MSI message relevant functions

2014-09-26 Thread Gavin Shan
The patch exports 2 MSI message relevant functions, which will be used by VFIO PCI driver. The VFIO PCI driver would be built as a module. Signed-off-by: Gavin Shan Acked-by: Bjorn Helgaas --- drivers/pci/msi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/pci/msi.c b/drivers

[RESEND PATCH v3 2/2] vfio/pci: Restore MSIx message prior to enabling

2014-09-26 Thread Gavin Shan
x the problem by restoring the host cached MSI message prior to enabling each vector. Reported-by: Wen Xiong Signed-off-by: Gavin Shan Signed-off-by: Alex Williamson --- drivers/vfio/pci/vfio_pci_intrs.c | 15 +++ 1 file changed, 15 insertions(+) diff --git a/drivers/vfi

Re: [PATCH 4/4] vfio/pci: Restore MSIx message prior to enabling

2014-09-26 Thread Gavin Shan
On Thu, Sep 25, 2014 at 09:46:44PM -0600, Alex Williamson wrote: >On Fri, 2014-09-26 at 13:19 +1000, Gavin Shan wrote: >> On Wed, Sep 10, 2014 at 06:13:42PM +1000, Gavin Shan wrote: >> >On Mon, May 19, 2014 at 01:01:10PM +1000, Gavin Shan wrote: >> >>The MSIx vecto

Re: [PATCH 4/4] vfio/pci: Restore MSIx message prior to enabling

2014-09-25 Thread Gavin Shan
On Wed, Sep 10, 2014 at 06:13:42PM +1000, Gavin Shan wrote: >On Mon, May 19, 2014 at 01:01:10PM +1000, Gavin Shan wrote: >>The MSIx vector table lives in device memory, which may be cleared as >>part of a backdoor device reset. This is the case on the IBM IPR HBA >>when t

Re: [PATCH 4/4] vfio/pci: Restore MSIx message prior to enabling

2014-09-10 Thread Gavin Shan
On Mon, May 19, 2014 at 01:01:10PM +1000, Gavin Shan wrote: >The MSIx vector table lives in device memory, which may be cleared as >part of a backdoor device reset. This is the case on the IBM IPR HBA >when the BIST is run on the device. When assigned to a QEMU guest, >the guest d

Re: [PATCH 1/4] PCI: Export MSI message relevant functions

2014-09-04 Thread Gavin Shan
On Thu, Sep 04, 2014 at 04:57:36PM -0600, Bjorn Helgaas wrote: >On Mon, May 19, 2014 at 01:01:07PM +1000, Gavin Shan wrote: >> The patch exports 2 MSI message relevant functions, which will be >> used by VFIO PCI driver. The VFIO PCI driver would be built as >> a module.

[PATCH v4 0/5] drivers/vfio: EEH Compile and compatibility

2014-08-06 Thread Gavin Shan
supported Gavin Shan (3): powerpc/eeh: Export eeh_iommu_group_to_pe() powerpc/eeh: Add warning message in eeh_dev_open() drivers/vfio: Fix EEH build error arch/powerpc/kernel/eeh.c | 6 +- drivers/vfio/Kconfig | 6 ++ drivers/vfio/Makefile | 2 +- drivers/vfio

[PATCH v4 4/5] drivers/vfio: Allow EEH to be built as module

2014-08-06 Thread Gavin Shan
) 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 Signed-off-by: Gavin Shan --- drivers/vfio

[PATCH v4 3/5] drivers/vfio: Fix EEH build error

2014-08-06 Thread Gavin Shan
undefined! Reported-by: Alexey Kardashevskiy Signed-off-by: Gavin Shan Signed-off-by: Alexey Kardashevskiy --- v3: Introduce CONFIG_VFIO_SPAPR_EEH and add "struct pci_dev" in vfio.h v2: remove #include from vfio.c --- drivers/vfio/Kconfig | 6 ++ drivers/vfio/Mak

[PATCH v4 5/5] drivers/vfio: Enable VFIO if EEH is not supported

2014-08-06 Thread Gavin Shan
lexey Kardashevskiy Signed-off-by: Gavin Shan --- v3: Drop return value of vfio_spapr_pci_eeh_open() v4: Add warning message in eeh_dev_open() in PATCH[2/5] --- drivers/vfio/pci/vfio_pci.c | 6 +- drivers/vfio/vfio_spapr_eeh.c | 4 ++-- include/linux/vfio.h | 5 ++--- 3 files chang

[PATCH v4 1/5] powerpc/eeh: Export eeh_iommu_group_to_pe()

2014-08-06 Thread Gavin Shan
The function is used by VFIO driver, which might be built as a dynamic module. So it should be exported. Signed-off-by: Gavin Shan --- 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

[PATCH v4 2/5] powerpc/eeh: Add warning message in eeh_dev_open()

2014-08-06 Thread Gavin Shan
The patch adds one warning message in eeh_dev_open() in case the PCI device can't be marked as passed through. Suggested-by: Alexey Kardashevskiy Signed-off-by: Gavin Shan --- arch/powerpc/kernel/eeh.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/k

Re: [PATCH v3 4/4] drivers/vfio: Enable VFIO if EEH is not supported

2014-08-06 Thread Gavin Shan
On Thu, Aug 07, 2014 at 12:10:07PM +1000, Gavin Shan wrote: >On Wed, Aug 06, 2014 at 11:05:43PM +1000, Alexey Kardashevskiy wrote: >>On 08/06/2014 10:50 PM, Alex Williamson wrote: >>> On Wed, 2014-08-06 at 19:49 +1000, Gavin Shan wrote: >>>> From: Alexey Kardash

Re: [PATCH v3 4/4] drivers/vfio: Enable VFIO if EEH is not supported

2014-08-06 Thread Gavin Shan
On Wed, Aug 06, 2014 at 11:05:43PM +1000, Alexey Kardashevskiy wrote: >On 08/06/2014 10:50 PM, Alex Williamson wrote: >> On Wed, 2014-08-06 at 19:49 +1000, Gavin Shan wrote: >>> From: Alexey Kardashevskiy >>> >>> The existing vfio_pci_o

[PATCH v3 1/4] powerpc/eeh: Export eeh_iommu_group_to_pe()

2014-08-06 Thread Gavin Shan
The function is used by VFIO driver, which might be built as a dynamic module. So it should be exported. Signed-off-by: Gavin Shan --- 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

[PATCH v3 2/4] drivers/vfio: Fix EEH build error

2014-08-06 Thread Gavin Shan
undefined! Reported-by: Alexey Kardashevskiy Signed-off-by: Gavin Shan Signed-off-by: Alexey Kardashevskiy --- v3: Introduce CONFIG_VFIO_SPAPR_EEH and add "struct pci_dev" in vfio.h v2: remove #include from vfio.c --- drivers/vfio/Kconfig | 6 ++ drivers/vfio/Mak

[PATCH v3 0/4] drivers/vfio: EEH Compile and compatibility

2014-08-06 Thread Gavin Shan
supported Gavin Shan (2): powerpc/eeh: Export eeh_iommu_group_to_pe() drivers/vfio: Fix EEH build error arch/powerpc/kernel/eeh.c | 1 + drivers/vfio/Kconfig | 6 ++ drivers/vfio/Makefile | 2 +- drivers/vfio/pci/vfio_pci.c | 6 +- drivers/vfio

[PATCH v3 4/4] drivers/vfio: Enable VFIO if EEH is not supported

2014-08-06 Thread Gavin Shan
lexey Kardashevskiy Signed-off-by: Gavin Shan --- v3: Drop return value of vfio_spapr_pci_eeh_open() --- drivers/vfio/pci/vfio_pci.c | 6 +- drivers/vfio/vfio_spapr_eeh.c | 4 ++-- include/linux/vfio.h | 5 ++--- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers

[PATCH v3 3/4] drivers/vfio: Allow EEH to be built as module

2014-08-06 Thread Gavin Shan
) 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 Signed-off-by: Gavin Shan --- drivers/vfio

Re: [PATCH v2 2/4] vfio: spapr: Fix build error

2014-08-05 Thread Gavin Shan
On Wed, Aug 06, 2014 at 04:33:29PM +1000, Alexey Kardashevskiy wrote: >On 08/06/2014 01:54 PM, Gavin Shan wrote: >> On Tue, Aug 05, 2014 at 09:12:50PM -0600, Alex Williamson wrote: >>> On Wed, 2014-08-06 at 12:48 +1000, Alexey Kardashevskiy wrote: >>>> From: Gavin Sh

Re: [PATCH v2 2/4] vfio: spapr: Fix build error

2014-08-05 Thread Gavin Shan
On Tue, Aug 05, 2014 at 09:12:50PM -0600, Alex Williamson wrote: >On Wed, 2014-08-06 at 12:48 +1000, Alexey Kardashevskiy wrote: >> From: Gavin Shan >> >> The VFIO related components could be built as dynamic modules. >> Unfortunately, CONFIG_EEH can't be confi

Re: [PATCH 4/4] vfio/pci: Restore MSIx message prior to enabling

2014-06-04 Thread Gavin Shan
On Mon, Jun 02, 2014 at 10:57:05AM -0600, Bjorn Helgaas wrote: >On Sat, May 31, 2014 at 5:42 AM, Gavin Shan wrote: >> On Fri, May 30, 2014 at 04:12:32PM -0600, Bjorn Helgaas wrote: >>>On Mon, May 19, 2014 at 01:01:10PM +1000, Gavin Shan wrote: .../... [ Remove the confusing

Re: [PATCH 4/4] vfio/pci: Restore MSIx message prior to enabling

2014-05-31 Thread Gavin Shan
On Fri, May 30, 2014 at 04:12:32PM -0600, Bjorn Helgaas wrote: >On Mon, May 19, 2014 at 01:01:10PM +1000, Gavin Shan wrote: >> The MSIx vector table lives in device memory, which may be cleared as >> part of a backdoor device reset. This is the case on the IBM IPR HBA >> wh

Re: [PATCH 1/4] PCI: Export MSI message relevant functions

2014-05-21 Thread Gavin Shan
On Mon, May 19, 2014 at 01:01:07PM +1000, Gavin Shan wrote: >The patch exports 2 MSI message relevant functions, which will be >used by VFIO PCI driver. The VFIO PCI driver would be built as >a module. > >Signed-off-by: Gavin Shan Bjorn, could you help ack it if you don't hav

[PATCH 4/4] vfio/pci: Restore MSIx message prior to enabling

2014-05-18 Thread Gavin Shan
x the problem by restoring the host cached MSI message prior to enabling each vector. Reported-by: Wen Xiong Signed-off-by: Gavin Shan Signed-off-by: Alex Williamson --- drivers/vfio/pci/vfio_pci_intrs.c | 15 +++ 1 file changed, 15 insertions(+) diff --git a/drivers/vfi

[PATCH 3/4] drivers/vfio/pci: Fix wrong MSI interrupt count

2014-05-18 Thread Gavin Shan
According PCI local bus specification, the register of Message Control for MSI (offset: 2, length: 2) has bit#0 to enable or disable MSI logic and it shouldn't be part contributing to the calculation of MSI interrupt count. The patch fixes the issue. Signed-off-by: Gavin Shan --- drivers

[PATCH 2/4] drivers/vfio: Rework offsetofend()

2014-05-18 Thread Gavin Shan
The macro offsetofend() introduces unnecessary temporary variable "tmp". The patch avoids that and saves a bit memory in stack. Signed-off-by: Gavin Shan --- include/linux/vfio.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/include/linux/vfio.h b/include/li

[PATCH 1/4] PCI: Export MSI message relevant functions

2014-05-18 Thread Gavin Shan
The patch exports 2 MSI message relevant functions, which will be used by VFIO PCI driver. The VFIO PCI driver would be built as a module. Signed-off-by: Gavin Shan --- drivers/pci/msi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 955ab79

[PATCH 0/4] VFIO Misc fixes

2014-05-18 Thread Gavin Shan
Changelog = v1 -> v2: * Change the comments and commit log in PATCH[4/4] (Alex). * Export 2 MSI relevant functions (Alex). v2 -> v3: * Add missed header file in PATCH[4/4]. Gavin Shan (4): PCI: Export MSI message relevant functions drivers/vfio:

Re: [PATCH 4/4] vfio/pci: Restore MSIx message prior to enabling

2014-05-18 Thread Gavin Shan
On Tue, May 13, 2014 at 11:35:24AM +1000, Gavin Shan wrote: >The MSIx vector table lives in device memory, which may be cleared as >part of a backdoor device reset. This is the case on the IBM IPR HBA >when the BIST is run on the device. When assigned to a QEMU guest, >the guest d

[PATCH 1/4] PCI: Export MSI message relevant functions

2014-05-12 Thread Gavin Shan
The patch exports 2 MSI message relevant functions, which will be used by VFIO PCI driver. The VFIO PCI driver would be built as a module. Signed-off-by: Gavin Shan --- drivers/pci/msi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 955ab79

[PATCH v2 0/4] VFIO Misc fixes

2014-05-12 Thread Gavin Shan
Changelog = v1 -> v2: * Change the comments and commit log in PATCH[4/4] (Alex). * Export 2 MSI relevant functions (Alex). Gavin Shan (4): PCI: Export MSI message relevant functions drivers/vfio: Rework offsetofend() drivers/vfio/pci: Fix wrong MSI interrupt co

[PATCH 4/4] vfio/pci: Restore MSIx message prior to enabling

2014-05-12 Thread Gavin Shan
x the problem by restoring the host cached MSI message prior to enabling each vector. Reported-by: Wen Xiong Signed-off-by: Gavin Shan Signed-off-by: Alex Williamson --- drivers/vfio/pci/vfio_pci_intrs.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/drivers/vfi

[PATCH 2/4] drivers/vfio: Rework offsetofend()

2014-05-12 Thread Gavin Shan
The macro offsetofend() introduces unnecessary temporary variable "tmp". The patch avoids that and saves a bit memory in stack. Signed-off-by: Gavin Shan --- include/linux/vfio.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/include/linux/vfio.h b/include/li

[PATCH 3/4] drivers/vfio/pci: Fix wrong MSI interrupt count

2014-05-12 Thread Gavin Shan
According PCI local bus specification, the register of Message Control for MSI (offset: 2, length: 2) has bit#0 to enable or disable MSI logic and it shouldn't be part contributing to the calculation of MSI interrupt count. The patch fixes the issue. Signed-off-by: Gavin Shan --- drivers

Re: [PATCH RFC 00/22] EEH Support for VFIO PCI devices on PowerKVM guest

2014-05-05 Thread Gavin Shan
On Mon, May 05, 2014 at 08:00:12AM -0600, Alex Williamson wrote: >On Mon, 2014-05-05 at 13:56 +0200, Alexander Graf wrote: >> On 05/05/2014 03:27 AM, Gavin Shan wrote: >> > The series of patches intends to support EEH for PCI devices, which have >> > been >> &

[PATCH 14/22] powerpc/eeh: Emulate RTAS call ibm,get-config-addr-info2

2014-05-04 Thread Gavin Shan
The RTAS call "ibm,get-config-addr-info2" is being used by guest to retrieve the corresponding PE number for the specified PCI device. The patch implements the backend to support the emulation of the RTAS call. Signed-off-by: Gavin Shan --- arch/powerpc/platforms/powernv/eeh-r

[PATCH 18/22] powerpc/eeh: Avoid event on passed PE

2014-05-04 Thread Gavin Shan
If we detects frozen state on PE that has been passed to guest, we needn't handle it. Instead, we rely on the guest to detect and recover it. The patch avoid EEH event on the frozen passed PE so that the guest can have chance to handle that. Signed-off-by: Gavin Shan --- arch/powerpc/k

[PATCH 07/22] powerpc/eeh: Function to tear down address mapping

2014-05-04 Thread Gavin Shan
The patch introduces function kvm_vfio_eeh_dev_unmap(), which is expected to be called on IOCTL command issued to the VM device, in order to tear down the address mapping for VFIO PCI device. Signed-off-by: Gavin Shan --- arch/powerpc/kernel/eeh_pe.c | 82

[PATCH 06/22] powerpc/eeh: Function for address mapping

2014-05-04 Thread Gavin Shan
The patch introduces function kvm_vfio_eeh_dev_map(), which is expected to be called on IOCTL command issued to the VM device, in order to build the address mapping for VFIO PCI device. Signed-off-by: Gavin Shan --- arch/powerpc/kernel/eeh_pe.c | 88

[PATCH 12/22] powerpc/eeh: Emulate RTAS call ibm,set-slot-reset

2014-05-04 Thread Gavin Shan
The RTAS call "ibm,set-slot-reset" is being used to reset one particular PE, either foundamental or hot reset. The patche intends to implement the backend to emulate the RTAS call. Signed-off-by: Gavin Shan --- arch/powerpc/platforms/powernv/eeh-rtas.c | 92

[PATCH 11/22] powerpc/eeh: Emulate RTAS call ibm,set-eeh-option

2014-05-04 Thread Gavin Shan
The RTAS call "ibm,set-eeh-option" is being used to enable/disable EEH functionality on the specified PE, or enable MMIO/DMA for the frozen PE. The patch emulates the RTAS call. Signed-off-by: Gavin Shan --- arch/powerpc/platforms/powernv/eeh-rtas.c | 83 +

[PATCH 15/22] powerpc/eeh: Emulate RTAS call ibm,slot-error-detail

2014-05-04 Thread Gavin Shan
The RTAS call "ibm,slot-error-detail" is being used to retrieve the error log (either permanent or temporary) from the underlying firmware. The patch implements the backend to emulate the RTAS call. Signed-off-by: Gavin Shan --- arch/powerpc/platforms/powernv/eeh-r

[PATCH 02/22] powerpc/eeh: Info to trace passed devices

2014-05-04 Thread Gavin Shan
-off-by: Gavin Shan --- arch/powerpc/include/asm/eeh.h | 49 ++ 1 file changed, 49 insertions(+) diff --git a/arch/powerpc/include/asm/eeh.h b/arch/powerpc/include/asm/eeh.h index 7782056..8bfb167 100644 --- a/arch/powerpc/include/asm/eeh.h +++ b/arch

[PATCH 16/22] powerpc/eeh: Emulate RTAS call ibm,configure-pe

2014-05-04 Thread Gavin Shan
The RTAS call "ibm,configure-pe" is being used to restore everything after PE reset. The patch implements the backend to emulate the RTAS call. In that, we restores BARs for the affected PCI device in host side because the guest might not have full access to the config space. Signed-off

[PATCH RFC 00/22] EEH Support for VFIO PCI devices on PowerKVM guest

2014-05-04 Thread Gavin Shan
The series of patches intends to support EEH for PCI devices, which have been passed through to PowerKVM based guest via VFIO. The implementation is straightforward based on the issues or problems we have to resolve to support EEH for PowerKVM based guest. - Emulation for EEH RTAS requests. Thanks

[PATCH 10/22] powerpc/eeh: Introduce kvmppc_eeh_format_addr()

2014-05-04 Thread Gavin Shan
device or PE instance if necessary. The function will be used by subsequent patches. Signed-off-by: Gavin Shan --- arch/powerpc/platforms/powernv/eeh-rtas.c | 52 +++ 1 file changed, 52 insertions(+) diff --git a/arch/powerpc/platforms/powernv/eeh-rtas.c b/arch/powerpc

[PATCH 03/22] powerpc/eeh: Search EEH device by guest address

2014-05-04 Thread Gavin Shan
The patch introduces function eeh_vfio_dev_get() to search the EEH device according to its guest address, which is made up of VM indicator, PHB BUID, bus, slot and function number. The function is useful in the backends for EEH RTAS emulation. Signed-off-by: Gavin Shan --- arch/powerpc/include

[PATCH 19/22] powerpc: Introduce CONFIG_KVM_ERRINJCT

2014-05-04 Thread Gavin Shan
The patch introduces kernel configuration option KVM_ERRINJCT. It enables emulating error injection RTAS services used on IBM POWER (pSeries) servers. Signed-off-by: Gavin Shan --- arch/powerpc/kvm/Kconfig | 8 1 file changed, 8 insertions(+) diff --git a/arch/powerpc/kvm/Kconfig b

[PATCH 09/22] powerpc/powernv: EEH RTAS emulation backend

2014-05-04 Thread Gavin Shan
to kvm layer. The patch implements the infrastructure of powernv platform layer for EEH RTAS emulation. Signed-off-by: Gavin Shan --- arch/powerpc/include/asm/eeh.h| 18 + arch/powerpc/platforms/powernv/Makefile | 1 + arch/powerpc/platforms/powernv/eeh-rtas.c | 64

[PATCH 04/22] powerpc/eeh: Search EEH PE by guest address

2014-05-04 Thread Gavin Shan
The patch introduces function eeh_vfio_pe_get() to search the EEH PE according to its guest address, which is made up of KVM indicator, PHB ID and PE configuration address. The function will be useful in backends for EEH RTAS emulation. Signed-off-by: Gavin Shan --- arch/powerpc/include/asm

[PATCH 21/22] powerpc/powernv: Sync OPAL header file with firmware

2014-05-04 Thread Gavin Shan
The patch synchronizes OPAL header file with firmware so that the host kernel can make OPAL call to do error injection. Signed-off-by: Gavin Shan --- arch/powerpc/include/asm/opal.h| 65 ++ arch/powerpc/platforms/powernv/opal-wrappers.S | 1 + 2 files

[PATCH 13/22] powerpc/eeh: Emulate RTAS call ibm,read-slot-reset-state2

2014-05-04 Thread Gavin Shan
The RTAS call "ibm,read-slot-reset-state2" is being used to retrieve the various states of the specified PE, e.g. reset state, frozen DMA, frozen MMIO etc. The patch implements the backend to emulate the RTAS call. Signed-off-by: Gavin Shan --- arch/powerpc/platforms/powernv/eeh-r

[PATCH 08/22] kvm: Address mapping for VFIO device

2014-05-04 Thread Gavin Shan
The address (domain/bus/slot/function) looks different from the perspective of host and guest. We have to setup the mapping for EEH and tear it down accordingly. The patch introduces additional attributes to KVM VFIO device for address mapping or unmapping. Signed-off-by: Gavin Shan --- arch

[PATCH 17/22] powerpc/kvm: Connect EEH RTAS emulation backend

2014-05-04 Thread Gavin Shan
The patch intends to connect the KVM module with the backend for EEH RTAS emulation. In turn, we can handle the EEH RTAS services from the guest. Signed-off-by: Gavin Shan --- arch/powerpc/include/asm/kvm_ppc.h | 7 +++ arch/powerpc/kvm/book3s_rtas.c | 40

[PATCH 20/22] powerpc/kvm: Infrastructure for error injection

2014-05-04 Thread Gavin Shan
e system. So we maintain an array of handlers with error type as index. The array supports dynamic registration. Signed-off-by: Gavin Shan --- arch/powerpc/include/asm/book3s_errinjct.h | 78 +++ arch/powerpc/kvm/Makefile | 3 + arch/powerpc/kvm/book3s_errinjct.

[PATCH 22/22] powerpc/powernv: Support PCI error injection

2014-05-04 Thread Gavin Shan
The patch introduces the infrastructure of error injection backend for PowerNV platform. For now, we just implement logic to inject PCI errors. We need support injecting other types of errors in future. Signed-off-by: Gavin Shan --- arch/powerpc/include/asm/book3s_errinjct.h | 19 +++ arch

[PATCH 05/22] powerpc/eeh: Release VFIO dev on VM destruction

2014-05-04 Thread Gavin Shan
When the VM is destroyed, the EEH devices and PEs that have been marked as being owned by guest should be returned to host. The patch introduces kvmppc_vfio_pci_free() to do it. Signed-off-by: Gavin Shan --- arch/powerpc/include/asm/eeh.h | 6 +- arch/powerpc/kernel/eeh_pe.c | 42

  1   2   >