Re: [Qemu-devel] [PATCH v5 2/2] enable multi-function hot-add

2015-10-27 Thread Cao jin
:57:16PM +0800, Cao jin wrote: Hi, warning, there is a long story below O:-) On 10/26/2015 04:29 PM, Michael S. Tsirkin wrote: On Mon, Oct 26, 2015 at 11:29:18AM +0800, Cao jin wrote: Enable pcie device multifunction hot, just ensure the function 0 added last, then driver will got the

Re: [Qemu-devel] [PATCH v5 2/2] enable multi-function hot-add

2015-10-27 Thread Cao jin
Hi Michael Thanks for your quick response On 10/27/2015 05:47 PM, Michael S. Tsirkin wrote: On Tue, Oct 27, 2015 at 05:39:01PM +0800, Cao jin wrote: static bool pcie_has_upstream_port(PCIDevice *dev) { PCIDevice *parent_dev = pci_bridge_get_device(pci_dev->

[Qemu-devel] [PATCH v6 1/2] remove function during multi-function hot-add

2015-10-27 Thread Cao jin
In case user want to cancel the hot-add operation, should roll back, device_del the added function that still don`t work. Signed-off-by: Cao jin --- hw/pci/pcie.c | 23 ++- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c index

[Qemu-devel] [PATCH v6 0/2] PCI-e device multi-function hot-add support

2015-10-27 Thread Cao jin
minor fix according to the v3 comment changelog v3: 1. Flag device as unexposed when func 0 doesn`t exist, via return 0xFF in case of gratuitous pci bus scan. 2. Since device is unexposed to guest, can remove function individually, without interaction with the guest. Cao jin (2): remove

[Qemu-devel] [PATCH v6 2/2] enable multi-function hot-add

2015-10-27 Thread Cao jin
Enable PCIe device multi-function hot-add, just ensure function 0 is added last, then driver will got the notification to scan the slot. Signed-off-by: Cao jin --- hw/pci/pci.c | 40 +++- hw/pci/pci_host.c| 13 +++-- hw/pci/pcie.c

Re: [Qemu-devel] [PATCH v6 2/2] enable multi-function hot-add

2015-10-27 Thread Cao jin
Hi Alex On 10/27/2015 10:21 PM, Alex Williamson wrote: On Tue, 2015-10-27 at 20:51 +0800, Cao jin wrote: Enable PCIe device multi-function hot-add, just ensure function 0 is added last, then driver will got the notification to scan the slot. Signed-off-by: Cao jin --- hw/pci/pci.c

[Qemu-devel] [PATCH v7 0/2] PCIe device multi-function hot-add support

2015-10-27 Thread Cao jin
interaction with the guest. Cao jin (2): remove function during multi-function hot-add enable multi-function hot-add hw/pci/pci.c | 40 +++- hw/pci/pci_host.c| 15 +++ hw/pci/pcie.c| 39

[Qemu-devel] [PATCH v7 1/2] remove function during multi-function hot-add

2015-10-27 Thread Cao jin
In case user want to cancel the hot-add operation, should roll back, device_del the added function that still don`t work. Signed-off-by: Cao jin --- hw/pci/pcie.c | 23 ++- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c index

[Qemu-devel] [PATCH v7 2/2] enable multi-function hot-add

2015-10-27 Thread Cao jin
Enable PCIe device multi-function hot-add, just ensure function 0 is added last, then driver will get the notification to scan the slot. Signed-off-by: Cao jin --- hw/pci/pci.c | 40 +++- hw/pci/pci_host.c| 15 +++ hw/pci/pcie.c

Re: [Qemu-devel] [PATCH] fix bad indentation in pcie_cap_slot_write_config()

2015-10-29 Thread Cao jin
Thanks Michael. and I am sorry if it bothered you. Maybe it can be avoid to have a clear definition of "trivial" to direct the newbies like me:P On 10/29/2015 03:45 PM, Michael Tokarev wrote: 25.10.2015 11:23, Cao jin wrote: bad indentation conflicts with CODING_STYLE doc I

Re: [Qemu-devel] [PATCH] fix bad indentation in pcie_cap_slot_write_config()

2015-10-29 Thread Cao jin
Thanks, /mjt -- Yours Sincerely, Cao Jin

[Qemu-devel] [PATCH] qom/object: fix 2 comment typos

2015-11-02 Thread Cao jin
Signed-off-by: Cao jin --- include/qom/object.h | 2 +- qom/object.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/qom/object.h b/include/qom/object.h index be7280c..9e5162a 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -511,7 +511,7

[Qemu-devel] [PATCH v2] qom/object: fix 2 comment typos

2015-11-02 Thread Cao jin
Also change the misleading definition of macro OBJECT_CLASS_CHECK Signed-off-by: Cao jin --- changelog v2: modified according to peter`s suggestion include/qom/object.h | 10 +- qom/object.c | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/qom

Re: [Qemu-devel] [PATCH] qom/object: fix 2 comment typos

2015-11-02 Thread Cao jin
On 11/02/2015 07:34 PM, Peter Maydell wrote: On 2 November 2015 at 09:04, Cao jin wrote: Signed-off-by: Cao jin --- include/qom/object.h | 2 +- qom/object.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/qom/object.h b/include/qom/object.h index

[Qemu-devel] [PATCH] set_memory_options: remove code that make no sense

2015-11-03 Thread Cao jin
Signed-off-by: Cao jin --- vl.c | 9 - 1 file changed, 9 deletions(-) diff --git a/vl.c b/vl.c index f5f7c3f..13f2c8b 100644 --- a/vl.c +++ b/vl.c @@ -2860,11 +2860,6 @@ static void set_memory_options(uint64_t *ram_slots, ram_addr_t *maxram_size, sz = 0; mem_str

Re: [Qemu-devel] [PATCH] set_memory_options: remove code that make no sense

2015-11-04 Thread Cao jin
hi Michael, Thanks for your explanation that make me realized I am wrong about my patch:-[ ...So, forget it. On 11/03/2015 08:40 PM, Michael Tokarev wrote: 03.11.2015 15:30, Cao jin wrote: Signed-off-by: Cao jin --- vl.c | 9 - 1 file changed, 9 deletions(-) diff --git a

[Qemu-devel] [PATCH] object_new_with_type: remove redundant code

2015-11-04 Thread Cao jin
g_assert & type_initialize are called in object_initialize_with_type Signed-off-by: Cao jin --- qom/object.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/qom/object.c b/qom/object.c index fc6e161..43ac2dd 100644 --- a/qom/object.c +++ b/qom/object.c @@ -423,9 +423,6 @@ Ob

Re: [Qemu-devel] [PATCH] object_new_with_type: remove redundant code

2015-11-04 Thread Cao jin
sorry for this, I am wrong at removing type_initialize. please forget it On 11/05/2015 01:19 PM, Cao jin wrote: g_assert & type_initialize are called in object_initialize_with_type Signed-off-by: Cao jin --- qom/object.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/qom/object

[Qemu-devel] [PATCH] Trivial: update comment of struct Object

2015-11-04 Thread Cao jin
it don`t has "GSList *interfaces" anymore Signed-off-by: Cao jin --- include/qom/object.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/include/qom/object.h b/include/qom/object.h index 0bb89d4..e46cc30 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -39

Re: [Qemu-devel] [PATCH v6 0/6] Xen PCI passthru: Convert to realize()

2016-01-21 Thread Cao jin
On 01/21/2016 11:41 PM, Stefano Stabellini wrote: Hi Cao, I appreciate the reminder, but it looks like Eric hasn't reviewed patch 3/5. Am I wrong? Seems I made a little mistake:-[ Already see your pull request, Thank you:) And thanks for Eric`s review:) -- Yours Sincerely, Cao jin

Re: [Qemu-devel] [PULL 10/11] Add Error **errp for xen_pt_config_init()

2016-01-23 Thread Cao jin
Or any better idea? Paolo -- Yours Sincerely, Cao jin

[Qemu-devel] [PATCH] Xen: fix converity warning of xen_pt_config_init()

2016-01-25 Thread Cao jin
emu_regs is a pointer, ARRAY_SIZE doesn't return what we expect. Since the remaining message is enough for debugging, so just remove it. Also tweaked the message a little. Signed-off-by: Cao jin --- hw/xen/xen_pt_config_init.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)

[Qemu-devel] [PATCH 2/2] pci core: function pci_bus_init() cleanup

2016-01-27 Thread Cao jin
remove unused param Signed-off-by: Cao jin --- hw/pci/pci.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 2a6fb98..b7c2681 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -330,7 +330,6 @@ const char *pci_root_bus_path(PCIDevice *dev

[Qemu-devel] [PATCH 0/2] pci core function cleanup

2016-01-27 Thread Cao jin
See each commit message says please. Cao jin (2): pci core: function pci_host_bus_register() cleanup pci core: function pci_bus_init() cleanup hw/pci/pci.c | 13 + 1 file changed, 5 insertions(+), 8 deletions(-) -- 2.1.0

[Qemu-devel] [PATCH 1/2] pci core: function pci_host_bus_register() cleanup

2016-01-27 Thread Cao jin
remove unused param, and rename the other to a meaningful one. Signed-off-by: Cao jin --- hw/pci/pci.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 168b9cc..2a6fb98 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -277,9 +277,9

[Qemu-devel] [PATCH 0/2] CCID QOMify

2016-01-31 Thread Cao jin
As each commit says Cao jin (2): Emulated CCID card: QOMify Passthru CCID card: QOMify hw/usb/ccid-card-emulated.c | 20 +--- hw/usb/ccid-card-passthru.c | 10 -- hw/usb/ccid.h | 8 3 files changed, 21 insertions(+), 17 deletions(-) -- 2.1.0

[Qemu-devel] [PATCH 1/2] Emulated CCID card: QOMify

2016-01-31 Thread Cao jin
Signed-off-by: Cao jin --- hw/usb/ccid-card-emulated.c | 20 +--- hw/usb/ccid.h | 4 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/hw/usb/ccid-card-emulated.c b/hw/usb/ccid-card-emulated.c index 869a63c..0b05260 100644 --- a/hw/usb/ccid-card

[Qemu-devel] [PATCH 2/2] Passthru CCID card: QOMify

2016-01-31 Thread Cao jin
Signed-off-by: Cao jin --- hw/usb/ccid-card-passthru.c | 10 -- hw/usb/ccid.h | 4 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/hw/usb/ccid-card-passthru.c b/hw/usb/ccid-card-passthru.c index 9f49c05..cbb7c80 100644 --- a/hw/usb/ccid-card-passthru.c

[Qemu-devel] [PATCH] ES1370: QOMify

2016-01-31 Thread Cao jin
Signed-off-by: Cao jin --- hw/audio/es1370.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hw/audio/es1370.c b/hw/audio/es1370.c index 592578b..089dd0e 100644 --- a/hw/audio/es1370.c +++ b/hw/audio/es1370.c @@ -288,6 +288,10 @@ struct chan_bits

[Qemu-devel] [PATCH v2] ES1370: QOMify

2016-01-31 Thread Cao jin
Signed-off-by: Cao jin --- v1 missed "pci_create_simple" modification. hw/audio/es1370.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/hw/audio/es1370.c b/hw/audio/es1370.c index 592578b..f26fea3 100644 --- a/hw/audio/es1370.c +++ b/hw/audio/es1370.c

Re: [Qemu-devel] [PATCH v2] ES1370: QOMify

2016-02-02 Thread Cao jin
Thanks mjt:) On 02/02/2016 04:00 PM, Michael Tokarev wrote: Sorry I replied to the wrong email. I actually applied this one :) /mjt -- Yours Sincerely, Cao jin

Re: [Qemu-devel] [PATCH 0/2] CCID QOMify

2016-02-02 Thread Cao jin
Hi mjt, I guess these two are suitable for trivial too;) but I forget to cc trivial at first... On 02/01/2016 02:53 PM, Cao jin wrote: As each commit says Cao jin (2): Emulated CCID card: QOMify Passthru CCID card: QOMify hw/usb/ccid-card-emulated.c | 20

Re: [Qemu-devel] [PATCH 1/2] Emulated CCID card: QOMify

2016-02-02 Thread Cao jin
On 02/02/2016 04:15 PM, Michael Tokarev wrote: 01.02.2016 09:53, Cao jin wrote: Signed-off-by: Cao jin --- hw/usb/ccid-card-emulated.c | 20 +--- hw/usb/ccid.h | 4 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/hw/usb/ccid-card

Re: [Qemu-devel] [PATCH 1/2] Emulated CCID card: QOMify

2016-02-02 Thread Cao jin
On 02/02/2016 04:30 PM, Michael Tokarev wrote: 02.02.2016 11:25, Cao jin wrote: On 02/02/2016 04:15 PM, Michael Tokarev wrote: Why did you move the type definition from .c to .h file? It is only referenced in .c, no? [] Yes, that type definition is referred only in .c for now, but we are

[Qemu-devel] [PATCH v2 1/2] Emulated CCID card: QOMify

2016-02-02 Thread Cao jin
Signed-off-by: Cao jin --- hw/usb/ccid-card-emulated.c | 23 +-- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/hw/usb/ccid-card-emulated.c b/hw/usb/ccid-card-emulated.c index 869a63c..fe9ec5c 100644 --- a/hw/usb/ccid-card-emulated.c +++ b/hw/usb/ccid-card

[Qemu-devel] [PATCH v2 0/2] CCID QOMify

2016-02-02 Thread Cao jin
v2 changelog 1. move macro definition to its home .c file Cao jin (2): Emulated CCID card: QOMify Passthru CCID card: QOMify hw/usb/ccid-card-emulated.c | 23 +-- hw/usb/ccid-card-passthru.c | 14 -- 2 files changed, 21 insertions(+), 16 deletions

[Qemu-devel] [PATCH v2 2/2] Passthru CCID card: QOMify

2016-02-02 Thread Cao jin
Signed-off-by: Cao jin --- hw/usb/ccid-card-passthru.c | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/hw/usb/ccid-card-passthru.c b/hw/usb/ccid-card-passthru.c index 9f49c05..858e78e 100644 --- a/hw/usb/ccid-card-passthru.c +++ b/hw/usb/ccid-card-passthru.c

[Qemu-devel] [PATCH] Fix inconsistency between comment and variable name

2016-02-02 Thread Cao jin
Signed-off-by: Cao jin --- include/hw/qdev-core.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index abcdee8..42fa5db 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -221,7 +221,7 @@ typedef struct

Re: [Qemu-devel] [PATCH] Fix inconsistency between comment and variable name

2016-02-03 Thread Cao jin
On 02/03/2016 05:35 PM, Markus Armbruster wrote: Michael Tokarev writes: 03.02.2016 06:19, Cao jin wrote: Signed-off-by: Cao jin --- include/hw/qdev-core.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index abcdee8

Re: [Qemu-devel] [PATCH] Fix inconsistency between comment and variable name

2016-02-03 Thread Cao jin
On 02/03/2016 05:35 PM, Markus Armbruster wrote: Michael Tokarev writes: 03.02.2016 06:19, Cao jin wrote: Signed-off-by: Cao jin --- include/hw/qdev-core.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index abcdee8

[Qemu-devel] [PATCH 0/4] vfio-pci: pass the aer error to guest, part1

2016-02-03 Thread Cao jin
From: Chen Fan this patchset are splited out from my aer series patches, this part of aer patches is harmless, and have been reviewed-by. In order to avoid blocking it to merge, so I send it out independently as part1. the part2 is under discussion. Thanks Chen Fan (4): pcie: modify the capabi

[Qemu-devel] [PATCH 2/4] vfio: make the 4 bytes aligned for capability size

2016-02-03 Thread Cao jin
From: Chen Fan this function search the capability from the end, the last size should 0x100 - pos, not 0xff - pos. Signed-off-by: Chen Fan Reviewed-by: Marcel Apfelbaum --- 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

[Qemu-devel] [PATCH 4/4] pcie_aer: expose pcie_aer_msg() interface

2016-02-03 Thread Cao jin
From: 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 Reviewed-by: Michael S. Tsirkin --- hw/pci/pcie_aer.c | 2 +- include/hw/pci/pcie_aer.h | 1 + 2 files changed, 2 insertions(+)

[Qemu-devel] [PATCH 1/4] pcie: modify the capability size assert

2016-02-03 Thread Cao jin
From: Chen Fan Device's Offset and size can reach PCIE_CONFIG_SPACE_SIZE, fix the corresponding assert. Signed-off-by: Chen Fan Reviewed-by: Marcel Apfelbaum Reviewed-by: Michael S. Tsirkin --- hw/pci/pcie.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/pci/pcie.c

[Qemu-devel] [PATCH 3/4] aer: impove pcie_aer_init to support vfio device

2016-02-03 Thread Cao jin
From: 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

[Qemu-devel] [PATCH v13 01/13] vfio: extract vfio_get_hot_reset_info as a single function

2015-11-11 Thread Cao jin
From: 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 --- hw/vfio/pci.c | 66 +++ 1 file changed, 48 insertions(+), 18 deletions(-) diff --git a/h

[Qemu-devel] [PATCH v13 02/13] vfio: squeeze out vfio_pci_do_hot_reset for support bus reset

2015-11-11 Thread Cao jin
From: Chen Fan squeeze out vfio_pci_do_hot_reset to do host bus reset when AER recovery. Signed-off-by: Chen Fan --- hw/vfio/pci.c | 75 +++ 1 file changed, 44 insertions(+), 31 deletions(-) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c ind

[Qemu-devel] [PATCH v13 00/13] vfio-pci: pass the aer error to guest

2015-11-11 Thread Cao jin
From: Chen Fan For now, for vfio pci passthough devices when qemu receives an error from host aer report, currentlly just terminate the guest, but usually user want to know what error occurred but stopping the guest, so this patches add aer capability support for vfio device, and pass the error t

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

2015-11-11 Thread Cao jin
From: Chen Fan Since we support multi-function hotplug. the function 0 indicate the closure of the slot, so we have the chance to do the check. Signed-off-by: Chen Fan --- hw/pci/pci.c | 29 + hw/vfio/pci.c| 19 +++ hw/vfio/pc

[Qemu-devel] [PATCH v13 03/13] pcie: modify the capability size assert

2015-11-11 Thread Cao jin
From: Chen Fan Device's Offset and size can reach PCIE_CONFIG_SPACE_SIZE, fix the corresponding assert. Signed-off-by: Chen Fan Reviewed-by: Marcel Apfelbaum --- 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 0eab29d..8f

[Qemu-devel] [PATCH v13 05/13] vfio: add pcie extanded capability support

2015-11-11 Thread Cao jin
From: 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 --- hw/vfio/pci.c | 70

[Qemu-devel] [PATCH v13 04/13] vfio: make the 4 bytes aligned for capability size

2015-11-11 Thread Cao jin
From: Chen Fan this function search the capability from the end, the last size should 0x100 - pos, not 0xff - pos. Signed-off-by: Chen Fan --- 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 f333dfc..e305cda 100644 --- a/h

[Qemu-devel] [PATCH v13 06/13] aer: impove pcie_aer_init to support vfio device

2015-11-11 Thread Cao jin
From: 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

[Qemu-devel] [PATCH v13 12/13] vfio-pci: pass the aer error to guest

2015-11-11 Thread Cao jin
From: Chen Fan when the vfio device encounters an uncorrectable error in host, the vfio_pci driver will signal the eventfd registered by this vfio device, the results in the qemu eventfd handler getting invoked. this patch is to pass the error to guest and have the guest driver recover from the

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

2015-11-11 Thread Cao jin
From: Chen Fan when init vfio devices done, we should test all the devices supported aer whether conflict with others. For each one, get the hot reset info for the affected device list. For each affected device, all should attach to the VM and on/below the same bus. also, we should test all of t

[Qemu-devel] [PATCH v13 07/13] vfio: add aer support for vfio device

2015-11-11 Thread Cao jin
From: 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 --- hw/vfio/pci.c | 82 --- hw/vfio/pci.h | 3 +++ 2 fil

[Qemu-devel] [PATCH v13 13/13] vfio: add 'aer' property to expose aercap

2015-11-11 Thread Cao jin
From: 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 --- hw/vfio/pci.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/vfio/pci.c b

[Qemu-devel] [PATCH v13 11/13] pcie_aer: expose pcie_aer_msg() interface

2015-11-11 Thread Cao jin
From: 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 --- hw/pci/pcie_aer.c | 2 +- include/hw/pci/pcie_aer.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/

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

2015-11-11 Thread Cao jin
From: 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 device callbacks to specify to do host bus reset. Signed-off-by: Chen Fan --- hw/pci/pci.c

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

2015-11-12 Thread Cao jin
On 11/12/2015 04:49 AM, Alex Williamson wrote: On Wed, 2015-11-11 at 18:34 +0800, Cao jin wrote: From: 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 --- What

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

2015-11-12 Thread Cao jin
ok, will fix these On 11/12/2015 04:53 AM, Alex Williamson wrote: On Wed, 2015-11-11 at 18:34 +0800, Cao jin wrote: From: Chen Fan +error_report("vfio: Cannot get hot reset info"); This needs a more useful error message: -error_report("vfio: Cannot get

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

2015-11-12 Thread Cao jin
On 11/12/2015 04:58 AM, Alex Williamson wrote: On Wed, 2015-11-11 at 18:34 +0800, Cao jin wrote: From: Chen Fan ... diff --git a/hw/vfio/pci.h b/hw/vfio/pci.h index b385f07..1b89b83 100644 --- a/hw/vfio/pci.h +++ b/hw/vfio/pci.h @@ -144,6 +144,8 @@ typedef struct VFIOPCIDevice { bool

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

2015-11-12 Thread Cao jin
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 Since we support multi-function hotplug. the function 0 indicate the closure of the slot, so we have the chance to do the check. Signed-off-by: Chen Fan --- hw/pci

[Qemu-devel] [PATCH v14 01/13] vfio: extract vfio_get_hot_reset_info as a single function

2015-11-17 Thread Cao jin
From: 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 --- hw/vfio/pci.c | 66 +++ 1 file changed, 48 insertions(+), 18 deletions(-) diff --git a/h

[Qemu-devel] [PATCH v14 00/13] vfio-pci: pass the aer error to guest

2015-11-17 Thread Cao jin
From: Chen Fan For now, for vfio pci passthough devices when qemu receives an error from host aer report, currentlly just terminate the guest, but usually user want to know what error occurred but stopping the guest, so this patches add aer capability support for vfio device, and pass the error t

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

2015-11-17 Thread Cao jin
From: Chen Fan Since we support multi-function hotplug. the function 0 indicate the closure of the slot, so we have the chance to do the check. Signed-off-by: Chen Fan --- hw/pci/pci.c | 29 + hw/vfio/pci.c| 19 +++ hw/vfio/pc

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

2015-11-17 Thread Cao jin
From: 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 device callbacks to specify to do host bus reset. Signed-off-by: Chen Fan Reviewed-by: Michael

[Qemu-devel] [PATCH v14 04/13] vfio: make the 4 bytes aligned for capability size

2015-11-17 Thread Cao jin
From: Chen Fan this function search the capability from the end, the last size should 0x100 - pos, not 0xff - pos. Signed-off-by: Chen Fan --- 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 f333dfc..e305cda 100644 --- a/h

[Qemu-devel] [PATCH v14 02/13] vfio: squeeze out vfio_pci_do_hot_reset for support bus reset

2015-11-17 Thread Cao jin
From: Chen Fan squeeze out vfio_pci_do_hot_reset to do host bus reset when AER recovery. Signed-off-by: Chen Fan --- hw/vfio/pci.c | 75 +++ 1 file changed, 44 insertions(+), 31 deletions(-) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c ind

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

2015-11-17 Thread Cao jin
From: Chen Fan when init vfio devices done, we should test all the devices supported aer whether conflict with others. For each one, get the hot reset info for the affected device list. For each affected device, all should attach to the VM and on/below the same bus. also, we should test all of t

[Qemu-devel] [PATCH v14 06/13] aer: impove pcie_aer_init to support vfio device

2015-11-17 Thread Cao jin
From: 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

[Qemu-devel] [PATCH v14 03/13] pcie: modify the capability size assert

2015-11-17 Thread Cao jin
From: Chen Fan Device's Offset and size can reach PCIE_CONFIG_SPACE_SIZE, fix the corresponding assert. Signed-off-by: Chen Fan Reviewed-by: Marcel Apfelbaum Reviewed-by: Michael S. Tsirkin --- hw/pci/pcie.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/pci/pcie.c

[Qemu-devel] [PATCH v14 05/13] vfio: add pcie extanded capability support

2015-11-17 Thread Cao jin
From: 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 --- hw/vfio/pci.c | 70

[Qemu-devel] [PATCH v14 07/13] vfio: add aer support for vfio device

2015-11-17 Thread Cao jin
From: 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 --- hw/vfio/pci.c | 81 --- hw/vfio/pci.h | 3 +++ 2 fil

[Qemu-devel] [PATCH v14 11/13] pcie_aer: expose pcie_aer_msg() interface

2015-11-17 Thread Cao jin
From: 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 Reviewed-by: Michael S. Tsirkin --- hw/pci/pcie_aer.c | 2 +- include/hw/pci/pcie_aer.h | 1 + 2 files changed, 2 insertions(+)

[Qemu-devel] [PATCH v14 13/13] vfio: add 'aer' property to expose aercap

2015-11-17 Thread Cao jin
From: 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 --- hw/vfio/pci.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/vfio/pci.c b

[Qemu-devel] [PATCH v14 12/13] vfio-pci: pass the aer error to guest

2015-11-17 Thread Cao jin
From: Chen Fan when the vfio device encounters an uncorrectable error in host, the vfio_pci driver will signal the eventfd registered by this vfio device, the results in the qemu eventfd handler getting invoked. this patch is to pass the error to guest and have the guest driver recover from the

[Qemu-devel] [PATCH] PCI: minor performance optimization

2015-11-20 Thread Cao jin
1. Do param check in pci_add_capability2(), as it is a public API. 2. As spec says, each capability must be DWORD aligned, so an optimization can be done via Loop Unrolling. Signed-off-by: Cao jin --- hw/pci/pci.c | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git

Re: [Qemu-devel] [PATCH] PCI: minor performance optimization

2015-11-20 Thread Cao jin
On 11/20/2015 06:45 PM, Michael S. Tsirkin wrote: On Fri, Nov 20, 2015 at 06:45:01PM +0800, Cao jin wrote: 1. Do param check in pci_add_capability2(), as it is a public API. Separate patch pls. OK 2. As spec says, each capability must be DWORD aligned, so an optimization can be

Re: [Qemu-devel] [PATCH] PCI: minor performance optimization

2015-11-20 Thread Cao jin
On 11/20/2015 07:26 PM, Michael S. Tsirkin wrote: On Fri, Nov 20, 2015 at 07:04:07PM +0800, Cao jin wrote: On 11/20/2015 06:45 PM, Michael S. Tsirkin wrote: On Fri, Nov 20, 2015 at 06:45:01PM +0800, Cao jin wrote: 2. As spec says, each capability must be DWORD aligned, so an optimization

Re: [Qemu-devel] [PATCH] PCI: minor performance optimization

2015-11-20 Thread Cao jin
On 11/20/2015 09:30 PM, Michael S. Tsirkin wrote: On Fri, Nov 20, 2015 at 07:58:01PM +0800, Cao jin wrote: On 11/20/2015 07:26 PM, Michael S. Tsirkin wrote: On Fri, Nov 20, 2015 at 07:04:07PM +0800, Cao jin wrote: On 11/20/2015 06:45 PM, Michael S. Tsirkin wrote: On Fri, Nov 20, 2015

[Qemu-devel] [PATCH] PCI: add param check for api

2015-11-20 Thread Cao jin
add param check for pci_add_capability2, as it is a public API. Signed-off-by: Cao jin --- hw/pci/pci.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 168b9cc..6938f64 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -2144,6 +2144,9 @@ int

[Qemu-devel] [PATCH] PCI Trivial: remove superfluous code

2015-11-23 Thread Cao jin
remove superfluous code in do_pci_register_device(). See its caller: pci_qdev_realize() Signed-off-by: Cao jin --- hw/pci/pci.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 168b9cc..4d16da0 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -878,7 +878,6

[Qemu-devel] [PATCH] Give detailed info when pcie downstream port init failed

2015-11-24 Thread Cao jin
detailed error info could show user about how to use it. Signed-off-by: Cao jin --- hw/pci-bridge/xio3130_downstream.c | 5 + 1 file changed, 5 insertions(+) When I learned to use root/upstream/downstream port like this: qemu-system-x86_64 -M q35 -device ioh3420,bus=pcie.0,id=br1 -device

Re: [Qemu-devel] [PATCH] Give detailed info when pcie downstream port init failed

2015-11-24 Thread Cao jin
Hi Markus On 11/24/2015 06:08 PM, Markus Armbruster wrote: Cao jin writes: detailed error info could show user about how to use it. Signed-off-by: Cao jin --- hw/pci-bridge/xio3130_downstream.c | 5 + 1 file changed, 5 insertions(+) When I learned to use root/upstream/downstream

Re: [Qemu-devel] [Qemu-trivial] [PATCH] PCI Trivial: remove superfluous code

2015-11-24 Thread Cao jin
On 11/25/2015 02:30 AM, Marcel Apfelbaum wrote: On 11/23/2015 03:19 PM, Cao jin wrote: remove superfluous code in do_pci_register_device(). See its caller: pci_qdev_realize() Signed-off-by: Cao jin --- hw/pci/pci.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/pci/pci.c b/hw/pci

Re: [Qemu-devel] [PATCH v4 0/2] change type of pci_bridge_initfn()

2016-02-04 Thread Cao jin
Hi mst, the series has got reviewed-by for a long while, could it be accepted now? On 01/15/2016 10:23 AM, Cao jin wrote: v4 changelog: 1. fix apb bridge build fail as Marcel find. Test: 1. Compiled on all arch(configure without param) 2. make check passed 3. Hacked to test dec bridge

Re: [Qemu-devel] [PATCH 0/2] pci core function cleanup

2016-02-04 Thread Cao jin
And this one got reviewed-by too, could it be accepted? On 01/27/2016 06:29 PM, Cao jin wrote: See each commit message says please. Cao jin (2): pci core: function pci_host_bus_register() cleanup pci core: function pci_bus_init() cleanup hw/pci/pci.c | 13 + 1 file

[Qemu-devel] [PATCH 00/10] vfio-pci: pass the aer error to guest, part2

2016-02-17 Thread Cao jin
From: Chen Fan this is the part 2 of supporting vfio device with aer enabled, the part 1 has been sent out. the code based on v16 series patchset. v16 -> this: main code changed on the 7/10 and 8/10 patches. others patches only fix some trivial comments or codes sugguested by Marcel. Chen

[Qemu-devel] [PATCH 01/10] vfio: extract vfio_get_hot_reset_info as a single function

2016-02-17 Thread Cao jin
From: 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 --- hw/vfio/pci.c | 66 +++ 1 file changed, 48 insertions(+), 18 deletions(-) diff --git a/h

[Qemu-devel] [PATCH 09/10] vfio-pci: pass the aer error to guest

2016-02-17 Thread Cao jin
From: Chen Fan when the vfio device encounters an uncorrectable error in host, the vfio_pci driver will signal the eventfd registered by this vfio device, resulting in the qemu eventfd handler getting invoked. this patch is to pass the error to guest and let the guest driver recover from the err

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

2016-02-17 Thread Cao jin
From: Chen Fan when boot up a VM that assigning vfio devices with aer enabled, we must check the vfio device whether support host bus reset. because when one error occur. OS driver always recover the device by do a bus reset, in order to recover the vfio device, qemu must to do a host bus reset t

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

2016-02-17 Thread Cao jin
From: Chen Fan squeeze out vfio_pci_do_hot_reset to do host bus reset when AER recovery. Signed-off-by: Chen Fan --- hw/vfio/pci.c | 75 +++ 1 file changed, 44 insertions(+), 31 deletions(-) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c ind

[Qemu-devel] [PATCH 06/10] add check reset mechanism when hotplug vfio device

2016-02-17 Thread Cao jin
From: Chen Fan Since we support multi-function hotplug, the function 0 indicates the closure of the slot, so we have the chance to do the check. Signed-off-by: Chen Fan --- hw/pci/pci.c | 29 + hw/vfio/pci.c| 19 +++ hw/vfio/p

[Qemu-devel] [PATCH 03/10] vfio: add pcie extended capability support

2016-02-17 Thread Cao jin
From: Chen Fan For vfio pcie device, we could expose the extended capability on PCIE bus. due to add a new pcie capability at the tail of the chain, in order to avoid config space overwritten, we introduce a copy config for parsing extended caps. and rebuild the pcie extended config space. Signe

[Qemu-devel] [PATCH 04/10] vfio: add aer support for vfio device

2016-02-17 Thread Cao jin
From: 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 --- hw/vfio/pci.c | 81 --- hw/vfio/pci.h | 3 +++ 2 fil

[Qemu-devel] [PATCH 07/10] pci: introduce pci bus pre reset

2016-02-17 Thread Cao jin
From: Chen Fan 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 reset for that sequence ID. Signed-off-by: Chen Fan --- hw/core/qdev.c | 4 ++-- hw/pci/pci.c | 25 +++

[Qemu-devel] [PATCH 08/10] vfio: introduce last reset sequence id

2016-02-17 Thread Cao jin
From: Chen Fan avoid multi-reset host bus, we introduce sequence id to specify which bus is resetting. and if one of the dependent devices has done a reset. the others should skip. Signed-off-by: Chen Fan --- hw/vfio/pci.c | 14 ++ hw/vfio/pci.h | 3 +++ 2 files changed, 17 insert

[Qemu-devel] [PATCH] remove comment for nonexistent structure member

2016-02-18 Thread Cao jin
Signed-off-by: Cao jin --- include/sysemu/hostmem.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/sysemu/hostmem.h b/include/sysemu/hostmem.h index 1ce4394..82cc6c5 100644 --- a/include/sysemu/hostmem.h +++ b/include/sysemu/hostmem.h @@ -45,7 +45,6 @@ struct HostMemoryBackendClass

Re: [Qemu-devel] [PATCH] Give detailed info when pcie downstream port init failed

2015-11-27 Thread Cao jin
Hi, Markus On 11/24/2015 06:08 PM, Markus Armbruster wrote: Cao jin writes: detailed error info could show user about how to use it. Signed-off-by: Cao jin --- hw/pci-bridge/xio3130_downstream.c | 5 + 1 file changed, 5 insertions(+) When I learned to use root/upstream/downstream

  1   2   3   4   5   6   7   8   9   >