[Qemu-devel] [PATCH] virtio: rename the bar index field name in VirtIOPCIProxy

2016-09-28 Thread Chen Fan
the bar index names are much similar to the bar memory regions, distinguish them to improve the code readability. Signed-off-by: Chen Fan <fan.c...@easystack.cn> --- hw/display/virtio-vga.c | 4 ++-- hw/virtio/virtio-pci.c | 20 ++-- hw/virtio/virtio-pci.h | 8 -

[Qemu-devel] fail to test virtio-gpu with heaven benchmark4.0

2016-08-29 Thread Chen Fan
r: context error reported 3 "Xorg" Illegal command buffer 149816321 -- Sincerely, Chen Fan [root@localhost Unigine_Heaven-4.0]# ./heaven Loading "/root/Desktop/Unigine_Heaven-4.0/bin/../data/heaven_4.0.cfg"... Loading "libGPUMonitor_x64.so"... Loading "libGL.so.1&

Re: [Qemu-devel] [PATCH v2 1/2] vfio : resume notifier

2016-07-19 Thread Chen Fan
I_ERR_IRQ_INDEX, VFIO_PCI_REQ_IRQ_INDEX, + VFIO_PCI_RESUME_IRQ_INDEX, VFIO_PCI_NUM_IRQS }; -- Sincerely, Chen Fan

Re: [Qemu-devel] [PATCH v8 11/12] vfio: register aer resume notification handler for aer resume

2016-06-21 Thread Chen Fan
there are points where the user can interfere with the kernel or exploit the knowledge that the device is going through a reset, the kernel can't rely on a friendly user. Thanks, Alex -- Sincerely, Chen Fan

Re: [Qemu-devel] [patch v6 11/12] vfio: register aer resume notification handler for aer resume

2016-05-05 Thread Chen Fan
On 04/26/2016 10:48 PM, Alex Williamson wrote: On Tue, 26 Apr 2016 11:39:02 +0800 Chen Fan<chen.fan.f...@cn.fujitsu.com> wrote: On 04/14/2016 09:02 AM, Chen Fan wrote: On 04/12/2016 05:38 AM, Alex Williamson wrote: On Tue, 5 Apr 2016 19:42:02 +0800 Cao jin<caoj.f...@cn.fujitsu.co

Re: [Qemu-devel] [patch v6 11/12] vfio: register aer resume notification handler for aer resume

2016-04-25 Thread Chen Fan
On 04/14/2016 09:02 AM, Chen Fan wrote: On 04/12/2016 05:38 AM, Alex Williamson wrote: On Tue, 5 Apr 2016 19:42:02 +0800 Cao jin <caoj.f...@cn.fujitsu.com> wrote: From: Chen Fan <chen.fan.f...@cn.fujitsu.com> for supporting aer recovery, host and guest would run the same aer r

Re: [Qemu-devel] [patch v6 11/12] vfio: register aer resume notification handler for aer resume

2016-04-13 Thread Chen Fan
On 04/12/2016 05:38 AM, Alex Williamson wrote: On Tue, 5 Apr 2016 19:42:02 +0800 Cao jin <caoj.f...@cn.fujitsu.com> wrote: From: Chen Fan <chen.fan.f...@cn.fujitsu.com> for supporting aer recovery, host and guest would run the same aer recovery code, that would do the seconda

Re: [Qemu-devel] [patch v5 11/12] vfio: device may stuck in D3 when doing aer recovery

2016-03-31 Thread Chen Fan
On 04/01/2016 09:40 AM, Chen Fan wrote: On 03/31/2016 11:44 PM, Alex Williamson wrote: On Thu, 31 Mar 2016 14:55:07 +0800 Chen Fan <chen.fan.f...@cn.fujitsu.com> wrote: On 03/25/2016 10:22 AM, Alex Williamson wrote: On Fri, 25 Mar 2016 09:38:09 +0800 Chen Fan <chen.fan.f...@cn.fu

Re: [Qemu-devel] [patch v5 11/12] vfio: device may stuck in D3 when doing aer recovery

2016-03-31 Thread Chen Fan
On 03/31/2016 11:44 PM, Alex Williamson wrote: On Thu, 31 Mar 2016 14:55:07 +0800 Chen Fan <chen.fan.f...@cn.fujitsu.com> wrote: On 03/25/2016 10:22 AM, Alex Williamson wrote: On Fri, 25 Mar 2016 09:38:09 +0800 Chen Fan <chen.fan.f...@cn.fujitsu.com> wrote: On 03/25/2016 06

Re: [Qemu-devel] [patch v5 07/12] pci: add a pci_function_is_valid callback to check function if valid

2016-03-31 Thread Chen Fan
On 03/27/2016 08:19 PM, Michael S. Tsirkin wrote: On Thu, Mar 24, 2016 at 04:54:33PM -0600, Alex Williamson wrote: On Wed, 23 Mar 2016 18:12:02 +0800 Cao jin <caoj.f...@cn.fujitsu.com> wrote: From: Chen Fan <chen.fan.f...@cn.fujitsu.com> PCI hotplug requires that function 0 i

Re: [Qemu-devel] [patch v5 11/12] vfio: device may stuck in D3 when doing aer recovery

2016-03-31 Thread Chen Fan
On 03/25/2016 10:22 AM, Alex Williamson wrote: On Fri, 25 Mar 2016 09:38:09 +0800 Chen Fan <chen.fan.f...@cn.fujitsu.com> wrote: On 03/25/2016 06:54 AM, Alex Williamson wrote: On Wed, 23 Mar 2016 18:12:06 +0800 Cao jin <caoj.f...@cn.fujitsu.com> wrote: From: Chen Fan

Re: [Qemu-devel] [patch v5 11/12] vfio: device may stuck in D3 when doing aer recovery

2016-03-24 Thread Chen Fan
On 03/25/2016 06:54 AM, Alex Williamson wrote: On Wed, 23 Mar 2016 18:12:06 +0800 Cao jin <caoj.f...@cn.fujitsu.com> wrote: From: Chen Fan <chen.fan.f...@cn.fujitsu.com> when a physical device aer occurred, the device state probably is not in D0 in a short time, if we recove

Re: [Qemu-devel] [PATCH v4 08/10] vfio: vote the function 0 to do host bus reset when aer occurred

2016-03-23 Thread Chen Fan
On 03/22/2016 05:40 AM, Alex Williamson wrote: On Mon, 21 Mar 2016 18:08:44 +0800 Cao jin <caoj.f...@cn.fujitsu.com> wrote: From: Chen Fan <chen.fan.f...@cn.fujitsu.com> Due to all devices assigned to VM on the same way as host if enable aer, so we can easily do the hot reset

Re: [Qemu-devel] [PATCH v4 08/10] vfio: vote the function 0 to do host bus reset when aer occurred

2016-03-23 Thread Chen Fan
On 03/22/2016 05:40 AM, Alex Williamson wrote: On Mon, 21 Mar 2016 18:08:44 +0800 Cao jin <caoj.f...@cn.fujitsu.com> wrote: From: Chen Fan <chen.fan.f...@cn.fujitsu.com> Due to all devices assigned to VM on the same way as host if enable aer, so we can easily do the hot reset

Re: [Qemu-devel] [PATCH v4 08/10] vfio: vote the function 0 to do host bus reset when aer occurred

2016-03-22 Thread Chen Fan
On 03/22/2016 05:40 AM, Alex Williamson wrote: On Mon, 21 Mar 2016 18:08:44 +0800 Cao jin <caoj.f...@cn.fujitsu.com> wrote: From: Chen Fan <chen.fan.f...@cn.fujitsu.com> Due to all devices assigned to VM on the same way as host if enable aer, so we can easily do the hot reset

Re: [Qemu-devel] [PATCH v4 06/10] vfio: add check host bus reset is support or not

2016-03-22 Thread Chen Fan
On 03/22/2016 05:40 AM, Alex Williamson wrote: On Mon, 21 Mar 2016 18:08:42 +0800 Cao jin <caoj.f...@cn.fujitsu.com> wrote: From: Chen Fan <chen.fan.f...@cn.fujitsu.com> when boot up a VM that assigning vfio devices with aer enabled, we must check the vfio device whether supp

Re: [Qemu-devel] [patch v3 7/9] vfio: vote the function 0 to do host bus reset when aer occurred

2016-03-19 Thread Chen Fan
On 03/16/2016 04:38 AM, Alex Williamson wrote: On Tue, 15 Mar 2016 09:35:47 +0800 Cao jin <caoj.f...@cn.fujitsu.com> wrote: From: Chen Fan <chen.fan.f...@cn.fujitsu.com> Signed-off-by: Chen Fan <chen.fan.f...@cn.fujitsu.com> --- hw/pci/pci.c | 2

Re: [Qemu-devel] [PATCH v2 09/11] vfio: vote a device to do host bus reset

2016-03-09 Thread Chen Fan
On 03/10/2016 12:37 AM, Alex Williamson wrote: On Mon, 7 Mar 2016 11:23:02 +0800 Cao jin <caoj.f...@cn.fujitsu.com> wrote: From: Chen Fan <chen.fan.f...@cn.fujitsu.com> Signed-off-by: Chen Fan <chen.fan.f...@cn.fujitsu.com> ---

Re: [Qemu-devel] [PATCH v2 06/11] pci: add a is_valid_func callback to check device if complete

2016-03-09 Thread Chen Fan
On 03/10/2016 01:14 AM, Michael S. Tsirkin wrote: On Wed, Mar 09, 2016 at 09:50:31AM -0700, Alex Williamson wrote: On Wed, 9 Mar 2016 18:22:24 +0200 "Michael S. Tsirkin" <m...@redhat.com> wrote: On Mon, Mar 07, 2016 at 11:22:59AM +0800, Cao jin wrote: From: Chen

Re: [Qemu-devel] [PATCH v2 05/11] vfio: add check host bus reset is support or not

2016-03-08 Thread Chen Fan
On 03/09/2016 06:55 AM, Alex Williamson wrote: On Mon, 7 Mar 2016 11:22:58 +0800 Cao jin <caoj.f...@cn.fujitsu.com> wrote: From: Chen Fan <chen.fan.f...@cn.fujitsu.com> when boot up a VM that assigning vfio devices with aer enabled, we must check the vfio device whether supp

Re: [Qemu-devel] [PATCH v2 04/11] vfio: add aer support for vfio device

2016-03-08 Thread Chen Fan
On 03/09/2016 06:55 AM, Alex Williamson wrote: On Mon, 7 Mar 2016 11:22:57 +0800 Cao jin <caoj.f...@cn.fujitsu.com> wrote: From: Chen Fan <chen.fan.f...@cn.fujitsu.com> Calling pcie_aer_init to initilize aer related registers for vfio device, then reload physical related registe

Re: [Qemu-devel] [PATCH v16 00/14] vfio-pci: pass the aer error to guest

2016-02-03 Thread Chen Fan
On 01/17/2016 02:34 AM, Michael S. Tsirkin wrote: On Tue, Jan 12, 2016 at 10:43:01AM +0800, Cao jin wrote: From: Chen Fan <chen.fan.f...@cn.fujitsu.com> For now, for vfio pci passthough devices when qemu receives an error from host aer report, currentlly just terminate the guest, but u

Re: [Qemu-devel] [PATCH v16 00/14] vfio-pci: pass the aer error to guest

2016-02-03 Thread Chen Fan
On 02/03/2016 09:57 PM, Michael S. Tsirkin wrote: On Wed, Feb 03, 2016 at 04:54:01PM +0800, Chen Fan wrote: On 01/17/2016 02:34 AM, Michael S. Tsirkin wrote: On Tue, Jan 12, 2016 at 10:43:01AM +0800, Cao jin wrote: From: Chen Fan <chen.fan.f...@cn.fujitsu.com> For now, for vf

Re: [Qemu-devel] [PATCH v16 00/14] vfio-pci: pass the aer error to guest

2016-01-19 Thread Chen Fan
On 01/17/2016 02:34 AM, Michael S. Tsirkin wrote: On Tue, Jan 12, 2016 at 10:43:01AM +0800, Cao jin wrote: From: Chen Fan <chen.fan.f...@cn.fujitsu.com> For now, for vfio pci passthough devices when qemu receives an error from host aer report, currentlly just terminate the guest, but u

Re: [Qemu-devel] [PATCH v16 13/14] vfio-pci: pass the aer error to guest

2016-01-19 Thread Chen Fan
On 01/18/2016 06:45 PM, Marcel Apfelbaum wrote: On 01/12/2016 04:43 AM, Cao jin wrote: From: Chen Fan <chen.fan.f...@cn.fujitsu.com> when the vfio device encounters an uncorrectable error in host, the vfio_pci driver will signal the eventfd registered by this vfio device, the r

Re: [Qemu-devel] [PATCH v16 10/14] pci: introduce pci bus pre reset

2016-01-19 Thread Chen Fan
On 01/15/2016 04:36 AM, Alex Williamson wrote: On Tue, 2016-01-12 at 10:43 +0800, Cao jin wrote: From: Chen Fan <chen.fan.f...@cn.fujitsu.com> avoid repeat bus reset, here introduce a sequence ID for each time bus hot reset, so each vfio device could know whether they've already been

Re: [Qemu-devel] [PATCH v16 05/14] vfio: add pcie extanded capability support

2016-01-19 Thread Chen Fan
On 01/17/2016 09:22 PM, Marcel Apfelbaum wrote: On 01/12/2016 04:43 AM, Cao jin wrote: From: Chen Fan <chen.fan.f...@cn.fujitsu.com> Hi, I noticed a type in the subject, extanded -> extended For vfio pcie device, we could expose the extended capability on PCIE bus. in order

Re: [Qemu-devel] [PATCH v16 07/14] vfio: add aer support for vfio device

2016-01-19 Thread Chen Fan
On 01/18/2016 05:12 PM, Marcel Apfelbaum wrote: On 01/12/2016 04:43 AM, Cao jin wrote: From: Chen Fan <chen.fan.f...@cn.fujitsu.com> Calling pcie_aer_init to initilize aer related registers for vfio device, then reload physical related registers to expose device capability. Sign

Re: [Qemu-devel] [PATCH v16 08/14] vfio: add check host bus reset is support or not

2016-01-19 Thread Chen Fan
On 01/18/2016 06:32 PM, Marcel Apfelbaum wrote: On 01/12/2016 04:43 AM, Cao jin wrote: From: Chen Fan <chen.fan.f...@cn.fujitsu.com> Hi, I think the subject should be rephrased. when init vfio devices done, we should test all the devices supported aer whether conflict with

Re: [Qemu-devel] [v15 12/15] vfio: add bus in reset flag

2016-01-11 Thread Chen Fan
On 01/07/2016 12:44 AM, Alex Williamson wrote: On Wed, 2016-01-06 at 10:13 +0800, Chen Fan wrote: On 01/06/2016 03:58 AM, Alex Williamson wrote: On Tue, 2016-01-05 at 09:20 +0800, Cao jin wrote: From: Chen Fan <chen.fan.f...@cn.fujitsu.com> mark the host bus be in reset. avoid mu

Re: [Qemu-devel] [v15 12/15] vfio: add bus in reset flag

2016-01-05 Thread Chen Fan
On 01/06/2016 03:58 AM, Alex Williamson wrote: On Tue, 2016-01-05 at 09:20 +0800, Cao jin wrote: From: Chen Fan <chen.fan.f...@cn.fujitsu.com> mark the host bus be in reset. avoid multiple devices trigger the host bus reset many times. Signed-off-by: Chen Fan <chen.fan.f...@cn.fu

Re: [Qemu-devel] [PATCH v14 Resend 10/13] pci: add pci device pre-post reset callbacks for host bus reset

2015-12-24 Thread Chen Fan
On 12/24/2015 10:34 PM, Michael S. Tsirkin wrote: On Thu, Dec 24, 2015 at 01:10:25PM +0800, Chen Fan wrote: On 12/22/2015 05:07 AM, Alex Williamson wrote: On Fri, 2015-12-18 at 11:29 +0800, Chen Fan wrote: On 12/18/2015 04:31 AM, Alex Williamson wrote: On Thu, 2015-12-17 at 09:41 +0800, Cao

Re: [Qemu-devel] [PATCH v14 Resend 10/13] pci: add pci device pre-post reset callbacks for host bus reset

2015-12-24 Thread Chen Fan
Hi mst, thanks for your suggestion. I have replied it in another alex's email. so we could discuss it in there.;) Thanks, Chen On 12/23/2015 08:00 PM, Michael S. Tsirkin wrote: On Thu, Dec 17, 2015 at 09:41:51AM +0800, Cao jin wrote: From: Chen Fan <chen.fan.f...@cn.fujitsu.

Re: [Qemu-devel] [PATCH v14 Resend 10/13] pci: add pci device pre-post reset callbacks for host bus reset

2015-12-24 Thread Chen Fan
On 12/22/2015 05:07 AM, Alex Williamson wrote: On Fri, 2015-12-18 at 11:29 +0800, Chen Fan wrote: On 12/18/2015 04:31 AM, Alex Williamson wrote: On Thu, 2015-12-17 at 09:41 +0800, Cao jin wrote: From: Chen Fan <chen.fan.f...@cn.fujitsu.com> Particularly, For vfio devices, Onc

Re: [Qemu-devel] [PATCH v14 Resend 10/13] pci: add pci device pre-post reset callbacks for host bus reset

2015-12-21 Thread Chen Fan
On 12/22/2015 05:07 AM, Alex Williamson wrote: On Fri, 2015-12-18 at 11:29 +0800, Chen Fan wrote: On 12/18/2015 04:31 AM, Alex Williamson wrote: On Thu, 2015-12-17 at 09:41 +0800, Cao jin wrote: From: Chen Fan <chen.fan.f...@cn.fujitsu.com> Particularly, For vfio devices, Onc

Re: [Qemu-devel] [PATCH v14 Resend 10/13] pci: add pci device pre-post reset callbacks for host bus reset

2015-12-17 Thread Chen Fan
On 12/18/2015 04:31 AM, Alex Williamson wrote: On Thu, 2015-12-17 at 09:41 +0800, Cao jin wrote: From: Chen Fan <chen.fan.f...@cn.fujitsu.com> Particularly, For vfio devices, Once need to recovery devices by bus reset such as AER, we always need to reset the host bus to recovery the d

Re: [Qemu-devel] [PATCH v14 Resend 08/13] vfio: add check host bus reset is support or not

2015-12-17 Thread Chen Fan
On 12/18/2015 04:32 AM, Alex Williamson wrote: On Thu, 2015-12-17 at 09:41 +0800, Cao jin wrote: From: Chen Fan <chen.fan.f...@cn.fujitsu.com> when init vfio devices done, we should test all the devices supported aer whether conflict with others. For each one, get the hot rese

Re: [Qemu-devel] [PATCH v13 09/13] add check reset mechanism when hotplug vfio device

2015-11-16 Thread Chen Fan
with 06:00.1 received the signal. is that right? Thanks, Chen On 11/14/2015 05:04 AM, Alex Williamson wrote: On Fri, 2015-11-13 at 11:28 +0800, Cao jin wrote: On 11/12/2015 07:51 PM, Michael S. Tsirkin wrote: On Wed, Nov 11, 2015 at 06:34:27PM +0800, Cao jin wrote: From: Chen Fan <chen.fa

Re: [Qemu-devel] [PATCH v13 09/13] add check reset mechanism when hotplug vfio device

2015-11-16 Thread Chen Fan
On 11/17/2015 12:05 AM, Alex Williamson wrote: On Mon, 2015-11-16 at 18:18 +0800, Chen Fan wrote: Hi Alex, Thanks for your detailed explanation. during my test, I found that maybe there was another problem in vfio driver, I use a dual-port NIC which address are: 06:00.0 and 06:00.1

Re: [Qemu-devel] [v11 00/15] vfio-pci: pass the aer error to guest

2015-06-30 Thread Chen Fan
ping On 06/24/2015 05:45 PM, Chen Fan wrote: For now, for vfio pci passthough devices when qemu receives an error from host aer report, there just terminate the guest, but usually user want to know what error occurred but stop the guest, so this patches add aer capability support for vfio

[Qemu-devel] [v11 05/15] vfio: add pcie extanded capability support

2015-06-24 Thread Chen Fan
For vfio pcie device, we could expose the extended capability on PCIE bus. in order to avoid config space broken, we introduce a copy config for parsing extended caps. and rebuild the pcie extended config space. Signed-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com --- hw/vfio/pci.c | 72

[Qemu-devel] [v11 01/15] vfio: extract vfio_get_hot_reset_info as a single function

2015-06-24 Thread Chen Fan
the function is used to get affected devices by bus reset. so here extract it, and can used for aer soon. Signed-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com --- hw/vfio/pci.c | 66 +++ 1 file changed, 48 insertions(+), 18 deletions

[Qemu-devel] [v11 04/15] vfio: make the 4 bytes aligned for capability size

2015-06-24 Thread Chen Fan
this function search the capability from the end, the last size should 0x100 - pos, not 0xff - pos. Signed-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com --- hw/vfio/pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index e056c49..52e8ad4

[Qemu-devel] [v11 00/15] vfio-pci: pass the aer error to guest

2015-06-24 Thread Chen Fan
. Chen Fan (15): vfio: extract vfio_get_hot_reset_info as a single function vfio: squeeze out vfio_pci_do_hot_reset for support bus reset pcie: modify the capability size assert vfio: make the 4 bytes aligned for capability size vfio: add pcie extanded capability support aer: impove

[Qemu-devel] [v11 15/15] vfio: add 'aer' property to expose aercap

2015-06-24 Thread Chen Fan
add 'aer' property to let user able to decide whether expose the aer capability. by default we should disable aer feature, because it needs configuration restrictions. Signed-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com --- hw/vfio/pci.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw

[Qemu-devel] [v11 11/15] vfio: modify vfio_pci_hot_reset to support bus reset

2015-06-24 Thread Chen Fan
the vfio_pci_hot_reset differentiate the single and multi in-used devices for reset. but in multi case, when some dependent devices are not assigned to VM, the devices can not be recovered by driver. Signed-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com --- hw/vfio/pci.c | 13 + 1

[Qemu-devel] [v11 12/15] vfio: do hot bus reset when do virtual secondary bus reset

2015-06-24 Thread Chen Fan
when do virtual secondary bus reset, the vfio device under this bus need to do host bus reset to reset the device. so add this case. Signed-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com --- hw/vfio/pci.c | 31 +++ 1 file changed, 31 insertions(+) diff --git a/hw/vfio

[Qemu-devel] [v11 07/15] vfio: add aer support for vfio device

2015-06-24 Thread Chen Fan
Calling pcie_aer_init to initilize aer related registers for vfio device, then reload physical related registers to expose device capability. Signed-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com --- hw/vfio/pci.c | 89 +-- 1 file changed

[Qemu-devel] [v11 10/15] vfio: add sec_bus_reset notifier to notify physical bus reset is needed

2015-06-24 Thread Chen Fan
Signed-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com --- hw/vfio/pci.c | 83 +++ 1 file changed, 83 insertions(+) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index c2af8f1..7cc81ae 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -156,6

[Qemu-devel] [v11 14/15] vfio-pci: pass the aer error to guest

2015-06-24 Thread Chen Fan
-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com --- hw/vfio/pci.c | 45 +++-- 1 file changed, 39 insertions(+), 6 deletions(-) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 9181c15..adc15f8 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -3605,18 +3605,51

[Qemu-devel] [v11 08/15] vfio: add check host bus reset is support or not

2015-06-24 Thread Chen Fan
vfio-pci devices on or below the target bus to verify they have a reset mechanism. Signed-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com --- hw/vfio/pci.c | 213 -- 1 file changed, 206 insertions(+), 7 deletions(-) diff --git a/hw/vfio/pci.c

[Qemu-devel] [v11 13/15] pcie_aer: expose pcie_aer_msg() interface

2015-06-24 Thread Chen Fan
For vfio device, we need to propagate the aer error to Guest OS. we use the pcie_aer_msg() to send aer error to guest. Signed-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com Reviewed-by: Marcel Apfelbaum mar...@redhat.com --- hw/pci/pcie_aer.c | 2 +- include/hw/pci/pcie_aer.h | 1 + 2

[Qemu-devel] [v11 06/15] aer: impove pcie_aer_init to support vfio device

2015-06-24 Thread Chen Fan
pcie_aer_init was used to emulate an aer capability for pcie device, but for vfio device, the aer config space size is mutable and is not always equal to PCI_ERR_SIZEOF(0x48). it depends on where the TLP Prefix register required, so here we add a size argument. Signed-off-by: Chen Fan chen.fan.f

[Qemu-devel] [v11 09/15] pci: add bus reset_notifiers callbacks for host bus reset

2015-06-24 Thread Chen Fan
Particularly, For vfio devices, Once need to recovery devices by bus reset such as AER, we always need to reset the host bus to recovery the devices under the bus, so we need to add pci bus callbacks to specify to do host bus reset. Signed-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com --- hw/pci

[Qemu-devel] [v11 03/15] pcie: modify the capability size assert

2015-06-24 Thread Chen Fan
Device's Offset and size can reach PCIE_CONFIG_SPACE_SIZE, fix the corresponding assert. Signed-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com Reviewed-by: Marcel Apfelbaum mar...@redhat.com --- hw/pci/pcie.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/pci/pcie.c b/hw

[Qemu-devel] [v11 02/15] vfio: squeeze out vfio_pci_do_hot_reset for support bus reset

2015-06-24 Thread Chen Fan
squeeze out vfio_pci_do_hot_reset to do host bus reset when AER recovery. Signed-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com --- hw/vfio/pci.c | 75 +++ 1 file changed, 44 insertions(+), 31 deletions(-) diff --git a/hw/vfio/pci.c b/hw

Re: [Qemu-devel] [RFC v9 14/18] vfio: improve vfio_pci_hot_reset to support more case

2015-06-18 Thread Chen Fan
On 06/17/2015 11:23 PM, Alex Williamson wrote: On Wed, 2015-06-17 at 14:28 +0800, Chen Fan wrote: On 06/16/2015 10:08 PM, Alex Williamson wrote: On Tue, 2015-06-16 at 16:10 +0800, Chen Fan wrote: On 06/10/2015 05:24 AM, Alex Williamson wrote: On Tue, 2015-06-09 at 11:37 +0800, Chen Fan

Re: [Qemu-devel] [RFC v9 14/18] vfio: improve vfio_pci_hot_reset to support more case

2015-06-17 Thread Chen Fan
On 06/16/2015 10:08 PM, Alex Williamson wrote: On Tue, 2015-06-16 at 16:10 +0800, Chen Fan wrote: On 06/10/2015 05:24 AM, Alex Williamson wrote: On Tue, 2015-06-09 at 11:37 +0800, Chen Fan wrote: the vfio_pci_hot_reset differentiate the single and multi in-used devices for reset

Re: [Qemu-devel] [RFC v10 13/19] pci: add bus reset_notifiers callbacks for host bus reset

2015-06-16 Thread Chen Fan
On 06/16/2015 06:20 PM, Michael S. Tsirkin wrote: On Tue, Jun 16, 2015 at 04:10:57PM +0800, Chen Fan wrote: Particularly, For vfio devices, Once need to recovery devices by bus reset such as AER, we always need to reset the host bus to recovery the devices under the bus, so we need to add pci

[Qemu-devel] [RFC v10 05/19] vfio: add pcie extanded capability support

2015-06-16 Thread Chen Fan
For vfio pcie device, we could expose the extended capability on PCIE bus. in order to avoid config space broken, we introduce a copy config for parsing extended caps. and rebuild the pcie extended config space. Signed-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com --- hw/vfio/pci.c | 72

[Qemu-devel] [RFC v10 16/19] vfio: do hot bus reset when do virtual secondary bus reset

2015-06-16 Thread Chen Fan
when do virtual secondary bus reset, the vfio device under this bus need to do host bus reset to reset the device. so add this case. Signed-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com --- hw/vfio/pci.c | 9 + 1 file changed, 9 insertions(+) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c

[Qemu-devel] [RFC v10 07/19] vfio: add aer support for vfio device

2015-06-16 Thread Chen Fan
Calling pcie_aer_init to initilize aer related registers for vfio device, then reload physical related registers to expose device capability. Signed-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com --- hw/vfio/pci.c | 89 +-- 1 file changed

[Qemu-devel] [RFC v10 10/19] vfio: improve vfio_get_group to support adding as is NULL.

2015-06-16 Thread Chen Fan
Signed-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com --- hw/vfio/common.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hw/vfio/common.c b/hw/vfio/common.c index df3171d..15f19a2 100644 --- a/hw/vfio/common.c +++ b/hw/vfio/common.c @@ -808,11 +808,18 @@ VFIOGroup

[Qemu-devel] [RFC v10 08/19] vfio: add ref for group to support own affected groups

2015-06-16 Thread Chen Fan
Signed-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com --- hw/vfio/common.c | 14 +- include/hw/vfio/vfio-common.h | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/hw/vfio/common.c b/hw/vfio/common.c index b1045da..67881f7 100644 --- a/hw/vfio/common.c

[Qemu-devel] [RFC v10 06/19] aer: impove pcie_aer_init to support vfio device

2015-06-16 Thread Chen Fan
pcie_aer_init was used to emulate an aer capability for pcie device, but for vfio device, the aer config space size is mutable and is not always equal to PCI_ERR_SIZEOF(0x48). it depends on where the TLP Prefix register required, so here we add a size argument. Signed-off-by: Chen Fan chen.fan.f

[Qemu-devel] [RFC v10 13/19] pci: add bus reset_notifiers callbacks for host bus reset

2015-06-16 Thread Chen Fan
Particularly, For vfio devices, Once need to recovery devices by bus reset such as AER, we always need to reset the host bus to recovery the devices under the bus, so we need to add pci bus callbacks to specify to do host bus reset. Signed-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com --- hw/pci

[Qemu-devel] [RFC v10 12/19] vfio: add check host bus reset is support or not

2015-06-16 Thread Chen Fan
all of the non-AER supporting vfio-pci devices on or below the target bus to verify they have a reset mechanism. Signed-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com --- hw/vfio/pci.c | 170 ++ 1 file changed, 170 insertions(+) diff --git

[Qemu-devel] [RFC v10 19/19] vfio: add 'aer' property to expose aercap

2015-06-16 Thread Chen Fan
add 'aer' property to let user able to decide whether expose the aer capability. by default we should disable aer feature, because it needs configuration restrictions. Signed-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com --- hw/vfio/pci.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw

[Qemu-devel] [RFC v10 15/19] vfio: improve vfio_pci_hot_reset to support more case

2015-06-16 Thread Chen Fan
the vfio_pci_hot_reset differentiate the single and multi in-used devices for reset. but sometimes we own the group without any devices, that also should support hot reset. Signed-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com --- hw/vfio/pci.c | 11 +++ 1 file changed, 11 insertions

[Qemu-devel] [RFC v10 02/19] vfio: squeeze out vfio_pci_do_hot_reset for support bus reset

2015-06-16 Thread Chen Fan
squeeze out vfio_pci_do_hot_reset to do host bus reset when AER recovery. Signed-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com --- hw/vfio/pci.c | 75 +++ 1 file changed, 44 insertions(+), 31 deletions(-) diff --git a/hw/vfio/pci.c b/hw

[Qemu-devel] [RFC v10 09/19] vfio: extract vfio_register_container_listener from vfio_connect_container

2015-06-16 Thread Chen Fan
Signed-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com --- hw/vfio/common.c | 60 1 file changed, 39 insertions(+), 21 deletions(-) diff --git a/hw/vfio/common.c b/hw/vfio/common.c index 67881f7..df3171d 100644 --- a/hw/vfio/common.c +++ b

[Qemu-devel] [RFC v10 18/19] vfio-pci: pass the aer error to guest

2015-06-16 Thread Chen Fan
-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com --- hw/vfio/pci.c | 45 +++-- 1 file changed, 39 insertions(+), 6 deletions(-) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 5bdfa73..3b76329 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -3699,18 +3699,51

[Qemu-devel] [RFC v10 14/19] vfio: add sec_bus_reset notifier to notify physical bus reset is needed

2015-06-16 Thread Chen Fan
Signed-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com --- hw/vfio/pci.c | 81 +++ 1 file changed, 81 insertions(+) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 53fb544..fad6a80 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -156,6

[Qemu-devel] [RFC v10 11/19] get all affected groups for each device support aer

2015-06-16 Thread Chen Fan
Add the affected groups without any devices into VM, it can keep the VM ownship the all groups. and use a reference to make the group visible. Signed-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com --- hw/vfio/pci.c | 123 ++ 1 file changed

[Qemu-devel] [RFC v10 03/19] pcie: modify the capability size assert

2015-06-16 Thread Chen Fan
. Signed-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com --- hw/pci/pcie.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c index 1463e65..6cdd4a1 100644 --- a/hw/pci/pcie.c +++ b/hw/pci/pcie.c @@ -595,7 +595,7 @@ void pcie_add_capability(PCIDevice *dev

[Qemu-devel] [RFC v10 01/19] vfio: extract vfio_get_hot_reset_info as a single function

2015-06-16 Thread Chen Fan
the function is used to get affected devices by bus reset. so here extract it, and can used for aer soon. Signed-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com --- hw/vfio/pci.c | 66 +++ 1 file changed, 48 insertions(+), 18 deletions

Re: [Qemu-devel] [RFC v9 14/18] vfio: improve vfio_pci_hot_reset to support more case

2015-06-16 Thread Chen Fan
On 06/10/2015 05:24 AM, Alex Williamson wrote: On Tue, 2015-06-09 at 11:37 +0800, Chen Fan wrote: the vfio_pci_hot_reset differentiate the single and multi in-used devices for reset. but sometimes we own the group without any devices, that also should support hot reset. Nope, did you try

[Qemu-devel] [RFC v10 00/19] vfio-pci: pass the aer error to guest

2015-06-16 Thread Chen Fan
without devices in VM. 2. add check for all aer devices if conflict the topology at each initfn time. Chen Fan (19): vfio: extract vfio_get_hot_reset_info as a single function vfio: squeeze out vfio_pci_do_hot_reset for support bus reset pcie: modify the capability size assert

[Qemu-devel] [RFC v10 04/19] vfio: make the 4 bytes aligned for capability size

2015-06-16 Thread Chen Fan
Signed-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com --- hw/vfio/pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index e056c49..52e8ad4 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -2481,7 +2481,8 @@ static void vfio_unmap_bars

[Qemu-devel] [RFC v10 17/19] pcie_aer: expose pcie_aer_msg() interface

2015-06-16 Thread Chen Fan
For vfio device, we need to propagate the aer error to Guest OS. we use the pcie_aer_msg() to send aer error to guest. Signed-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com --- hw/pci/pcie_aer.c | 2 +- include/hw/pci/pcie_aer.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff

[Qemu-devel] [RFC v9 10/18] get all affected groups for each device support aer

2015-06-08 Thread Chen Fan
Add the affected groups without any devices into VM, it can keep the VM ownship the all groups. and use a reference to make the group visible. Signed-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com --- hw/vfio/pci.c | 115 ++ 1 file changed

[Qemu-devel] [RFC v9 07/18] vfio: add aer support for vfio device

2015-06-08 Thread Chen Fan
Calling pcie_aer_init to initilize aer related registers for vfio device, then reload physical related registers to expose device capability. Signed-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com --- hw/vfio/pci.c | 86 ++- 1 file changed

[Qemu-devel] [RFC v9 06/18] aer: impove pcie_aer_init to support vfio device

2015-06-08 Thread Chen Fan
pcie_aer_init was used to emulate an aer capability for pcie device, but for vfio device, the aer config space size is mutable and is not always equal to PCI_ERR_SIZEOF(0x48). it depends on where the TLP Prefix register required, so here we add a size argument. Signed-off-by: Chen Fan chen.fan.f

[Qemu-devel] [RFC v9 05/18] vfio: add pcie extanded capability support

2015-06-08 Thread Chen Fan
For vfio pcie device, we could expose the extended capability on PCIE bus. in order to avoid config space broken, we introduce a copy config for parsing extended caps. and rebuild the pcie extended config space. Signed-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com --- hw/vfio/pci.c | 73

[Qemu-devel] [RFC v9 02/18] vfio: squeeze out vfio_pci_do_hot_reset for support bus reset

2015-06-08 Thread Chen Fan
squeeze out vfio_pci_do_hot_reset to do host bus reset when AER recovery. Signed-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com --- hw/vfio/pci.c | 75 +++ 1 file changed, 44 insertions(+), 31 deletions(-) diff --git a/hw/vfio/pci.c b/hw

[Qemu-devel] [RFC v9 04/18] vfio: make the 4 bytes aligned for capability size

2015-06-08 Thread Chen Fan
Signed-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com --- hw/vfio/pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index e056c49..52e8ad4 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -2481,7 +2481,8 @@ static void vfio_unmap_bars

[Qemu-devel] [RFC v9 03/18] pcie: modify the capability size assert

2015-06-08 Thread Chen Fan
. Signed-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com --- hw/pci/pcie.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c index 1463e65..6cdd4a1 100644 --- a/hw/pci/pcie.c +++ b/hw/pci/pcie.c @@ -595,7 +595,7 @@ void pcie_add_capability(PCIDevice *dev

[Qemu-devel] [RFC v9 01/18] vfio: extract vfio_get_hot_reset_info as a single function

2015-06-08 Thread Chen Fan
the function is used to get affected devices by bus reset. so here extract it, and can used for aer soon. Signed-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com --- hw/vfio/pci.c | 66 +++ 1 file changed, 48 insertions(+), 18 deletions

[Qemu-devel] [RFC v9 15/18] vfio: do hot bus reset when do virtual secondary bus reset

2015-06-08 Thread Chen Fan
when do virtual secondary bus reset, the vfio device under this bus need to do host bus reset to reset the device. so add this case. Signed-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com --- hw/vfio/pci.c | 9 + 1 file changed, 9 insertions(+) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c

[Qemu-devel] [RFC v9 11/18] vfio: add check host bus reset is support or not

2015-06-08 Thread Chen Fan
we introduce a has_bus_reset capability to sign the vfio devices if support host bus reset. Signed-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com --- hw/vfio/pci.c | 169 ++ 1 file changed, 169 insertions(+) diff --git a/hw/vfio/pci.c b/hw

[Qemu-devel] [RFC v9 18/18] vfio: add 'aer' property to expose aercap

2015-06-08 Thread Chen Fan
add 'aer' property to let user able to decide whether expose the aer capability. by default we should disable aer feature, because it needs configuration restrictions. Signed-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com --- hw/vfio/pci.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw

[Qemu-devel] [RFC v9 13/18] vfio: add sec_bus_reset notifier to notify physical bus reset is needed

2015-06-08 Thread Chen Fan
Signed-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com --- hw/vfio/pci.c | 81 +++ 1 file changed, 81 insertions(+) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 97af143..a4e8658 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -156,6

Re: [Qemu-devel] [RFC v8.1 06/13] vfio: add check host bus reset is support or not

2015-06-08 Thread Chen Fan
On 06/04/2015 11:59 PM, Alex Williamson wrote: On Wed, 2015-06-03 at 08:52 +0800, Chen Fan wrote: On 06/03/2015 12:47 AM, Alex Williamson wrote: On Tue, 2015-06-02 at 15:54 +0800, Chen Fan wrote: On 05/28/2015 05:32 AM, Alex Williamson wrote: On Wed, 2015-05-27 at 10:46 +0800, Chen Fan

[Qemu-devel] [RFC v9 00/18] vfio-pci: pass the aer error to guest

2015-06-08 Thread Chen Fan
the topology at each initfn time. Chen Fan (18): vfio: extract vfio_get_hot_reset_info as a single function vfio: squeeze out vfio_pci_do_hot_reset for support bus reset pcie: modify the capability size assert vfio: make the 4 bytes aligned for capability size vfio: add pcie extanded

[Qemu-devel] [RFC v9 14/18] vfio: improve vfio_pci_hot_reset to support more case

2015-06-08 Thread Chen Fan
the vfio_pci_hot_reset differentiate the single and multi in-used devices for reset. but sometimes we own the group without any devices, that also should support hot reset. Signed-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com --- hw/vfio/pci.c | 11 +++ 1 file changed, 11 insertions

[Qemu-devel] [RFC v9 12/18] pci: add bus reset_notifiers callbacks for host bus reset

2015-06-08 Thread Chen Fan
Particularly, For vfio devices, Once need to recovery devices by bus reset such as AER, we always need to reset the host bus to recovery the devices under the bus, so we need to add pci bus callbacks to specify to do host bus reset. Signed-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com --- hw/pci

[Qemu-devel] [RFC v9 09/18] vfio: add ref for group to support own affected groups

2015-06-08 Thread Chen Fan
Signed-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com --- hw/vfio/common.c | 12 include/hw/vfio/vfio-common.h | 1 + 2 files changed, 13 insertions(+) diff --git a/hw/vfio/common.c b/hw/vfio/common.c index 4230f83..eff1930 100644 --- a/hw/vfio/common.c +++ b/hw/vfio

[Qemu-devel] [RFC v9 08/18] vfio: improve vfio_get_group to support adding group without devices

2015-06-08 Thread Chen Fan
Pre-adding all affected groups for aer devices, it could ensure the affected groups are owned in VM. Signed-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com --- hw/vfio/common.c | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/hw/vfio/common.c b/hw/vfio/common.c

[Qemu-devel] [RFC v9 16/18] pcie_aer: expose pcie_aer_msg() interface

2015-06-08 Thread Chen Fan
For vfio device, we need to propagate the aer error to Guest OS. we use the pcie_aer_msg() to send aer error to guest. Signed-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com --- hw/pci/pcie_aer.c | 2 +- include/hw/pci/pcie_aer.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff

[Qemu-devel] [RFC v9 17/18] vfio-pci: pass the aer error to guest

2015-06-08 Thread Chen Fan
-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com --- hw/vfio/pci.c | 45 +++-- 1 file changed, 39 insertions(+), 6 deletions(-) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 655ac59..b2e7601 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -3690,18 +3690,51

  1   2   3   4   5   >