qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [ANNOUNCE] QEMU 1.5.0-rc2 is now available
@ 2013-05-15 23:53 Anthony Liguori
  2013-05-16  3:56 ` Dongsheng Song
  2013-05-16 14:21 ` mdroth
  0 siblings, 2 replies; 14+ messages in thread
From: Anthony Liguori @ 2013-05-15 23:53 UTC (permalink / raw)
  To: qemu-devel

Hi,

On behalf of the QEMU Team, I'd like to announce the availability of the
third release candidate for the QEMU 1.5 release.  This release is meant
for testing purposes and should not be used in a production environment.

http://wiki.qemu.org/download/qemu-1.5.0-rc2.tar.bz2

You can help improve the quality of the QEMU 1.5 release by testing this
release and reporting bugs on Launchpad:

https://bugs.launchpad.net/qemu/

The release plan for the 1.5 release is available at:

http://wiki.qemu.org/Planning/1.5

Please add entries to the ChangeLog for the 1.5 release below:

http://wiki.qemu.org/ChangeLog/Next

The following changes have been made since v1.5.0-rc1:

 - qemu-common: Resolve vector build breakes for AltiVec (Paolo Bonzini)
 - ide-test: Fix endianness problems (Kevin Wolf)
 - hw/pci-host/versatile.c: Provide property for forcing broken IRQ mapping (Peter Maydell)
 - hw/pci-host/versatile.c: Update autodetect to detect newer kernels (Peter Maydell)
 - Revert "versatile_pci: Put the host bridge PCI device at slot 29" (Peter Maydell)
 - w32: Fix configure test for -march=i486 (Stefan Weil)
 - configure: Detect uuid on MacOSX (fixes compile failure) (Peter Maydell)
 - vnc: Make ledstate comparison before modifiers updated (Lei Li)
 - virtio-net-x: forward the netclient name and type. (KONRAD Frederic)
 - virtio-net: add virtio_net_set_netclient_name. (KONRAD Frederic)
 - qapi: fix leak in unit tests (Michael Roth)
 - qmp: fix handling of cmd with Equals in qmp-shell (Zhangleiqiang)
 - block: Add hint to -EFBIG error message (Kevin Wolf)
 - qcow2: Catch some L1 table index overflows (Kevin Wolf)
 - osdep: introduce qemu_anon_ram_free to free qemu_anon_ram_alloc-ed memory (Paolo Bonzini)
 - osdep, kvm: rename low-level RAM allocation functions (Paolo Bonzini)
 - readline: Handle xterm escape sequences for Home/End keys (Kevin Wolf)
 - portability: pty.h is glibc-specific (Paolo Bonzini)
 - spitz: fix compilation failure due to pty.h namespace pollution (Paolo Bonzini)
 - acpi: add dummy write function for acpi timer (Gerd Hoffmann)
 - qom: aggressively optimize qom casting (Anthony Liguori)
 - ui/gtk.c: do not use gdk_display_warp_pointer when GTK ver >3.0 (Igor Mitsyanko)
 - Revert "pc: Kill the "use flash device for BIOS unless KVM" misfeature" (Paolo Bonzini)
 - qom: allow turning cast debugging off (Paolo Bonzini)
 - qom: trace asserting casts (Paolo Bonzini)
 - qom: pass file/line/function to asserting casts (Paolo Bonzini)
 - qom: add a fast path to object_class_dynamic_cast (Paolo Bonzini)
 - qom: allow casting of a NULL class (Paolo Bonzini)
 - qom: improve documentation of cast functions (Paolo Bonzini)
 - osdep.h: include sys/types.h for ssize_t definition (Igor Mitsyanko)
 - remove double semicolons (Dong Xu Wang)
 - clean unnecessary code: don't check g_strdup arg for NULL (Dong Xu Wang)
 - docs: mention AddressSpaces in docs/memory.txt (Paolo Bonzini)
 - audio: update documentation after removing --audio-card-list option (Hervé Poussineau)
 - m25p80.c: Sync Flash chip list with Linux (Ed Maste)
 - bsd-user: OS-agnostic 64-bit SYSCTL types (Ed Maste)
 - target-i386: ROR r8/r16 imm instruction fix (Aurelien Jarno)
 - tcg/optimize: fix setcond2 optimization (Aurelien Jarno)
 - qxl: Call spice_qxl_driver_unload from qxl_enter_vga_mode (Hans de Goede)

Regards,

Anthony Liguori

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Qemu-devel] [ANNOUNCE] QEMU 1.5.0-rc2 is now available
  2013-05-15 23:53 [Qemu-devel] [ANNOUNCE] QEMU 1.5.0-rc2 is now available Anthony Liguori
@ 2013-05-16  3:56 ` Dongsheng Song
  2013-05-16 14:21 ` mdroth
  1 sibling, 0 replies; 14+ messages in thread
From: Dongsheng Song @ 2013-05-16  3:56 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: qemu-devel

On Thu, May 16, 2013 at 7:53 AM, Anthony Liguori <aliguori@us.ibm.com> wrote:
> Hi,
>
> On behalf of the QEMU Team, I'd like to announce the availability of the
> third release candidate for the QEMU 1.5 release.  This release is meant
> for testing purposes and should not be used in a production environment.
>
> http://wiki.qemu.org/download/qemu-1.5.0-rc2.tar.bz2
>
> You can help improve the quality of the QEMU 1.5 release by testing this
> release and reporting bugs on Launchpad:
>
> https://bugs.launchpad.net/qemu/
>
> The release plan for the 1.5 release is available at:
>
> http://wiki.qemu.org/Planning/1.5
>
> Please add entries to the ChangeLog for the 1.5 release below:
>
> http://wiki.qemu.org/ChangeLog/Next
>
> The following changes have been made since v1.5.0-rc1:
>
>  - qemu-common: Resolve vector build breakes for AltiVec (Paolo Bonzini)
>  - ide-test: Fix endianness problems (Kevin Wolf)
>  - hw/pci-host/versatile.c: Provide property for forcing broken IRQ mapping (Peter Maydell)
>  - hw/pci-host/versatile.c: Update autodetect to detect newer kernels (Peter Maydell)
>  - Revert "versatile_pci: Put the host bridge PCI device at slot 29" (Peter Maydell)
>  - w32: Fix configure test for -march=i486 (Stefan Weil)
>  - configure: Detect uuid on MacOSX (fixes compile failure) (Peter Maydell)
>  - vnc: Make ledstate comparison before modifiers updated (Lei Li)
>  - virtio-net-x: forward the netclient name and type. (KONRAD Frederic)
>  - virtio-net: add virtio_net_set_netclient_name. (KONRAD Frederic)
>  - qapi: fix leak in unit tests (Michael Roth)
>  - qmp: fix handling of cmd with Equals in qmp-shell (Zhangleiqiang)
>  - block: Add hint to -EFBIG error message (Kevin Wolf)
>  - qcow2: Catch some L1 table index overflows (Kevin Wolf)
>  - osdep: introduce qemu_anon_ram_free to free qemu_anon_ram_alloc-ed memory (Paolo Bonzini)
>  - osdep, kvm: rename low-level RAM allocation functions (Paolo Bonzini)
>  - readline: Handle xterm escape sequences for Home/End keys (Kevin Wolf)
>  - portability: pty.h is glibc-specific (Paolo Bonzini)
>  - spitz: fix compilation failure due to pty.h namespace pollution (Paolo Bonzini)
>  - acpi: add dummy write function for acpi timer (Gerd Hoffmann)
>  - qom: aggressively optimize qom casting (Anthony Liguori)
>  - ui/gtk.c: do not use gdk_display_warp_pointer when GTK ver >3.0 (Igor Mitsyanko)
>  - Revert "pc: Kill the "use flash device for BIOS unless KVM" misfeature" (Paolo Bonzini)
>  - qom: allow turning cast debugging off (Paolo Bonzini)
>  - qom: trace asserting casts (Paolo Bonzini)
>  - qom: pass file/line/function to asserting casts (Paolo Bonzini)
>  - qom: add a fast path to object_class_dynamic_cast (Paolo Bonzini)
>  - qom: allow casting of a NULL class (Paolo Bonzini)
>  - qom: improve documentation of cast functions (Paolo Bonzini)
>  - osdep.h: include sys/types.h for ssize_t definition (Igor Mitsyanko)
>  - remove double semicolons (Dong Xu Wang)
>  - clean unnecessary code: don't check g_strdup arg for NULL (Dong Xu Wang)
>  - docs: mention AddressSpaces in docs/memory.txt (Paolo Bonzini)
>  - audio: update documentation after removing --audio-card-list option (Hervé Poussineau)
>  - m25p80.c: Sync Flash chip list with Linux (Ed Maste)
>  - bsd-user: OS-agnostic 64-bit SYSCTL types (Ed Maste)
>  - target-i386: ROR r8/r16 imm instruction fix (Aurelien Jarno)
>  - tcg/optimize: fix setcond2 optimization (Aurelien Jarno)
>  - qxl: Call spice_qxl_driver_unload from qxl_enter_vga_mode (Hans de Goede)
>
> Regards,
>
> Anthony Liguori
>
>

For convenience, I had upload qemu-build-dependency-r1.zip,
qemu-1.5.0-rc2-win32.7z and qemu-1.5.0-rc2-win64.7z

https://code.google.com/p/i18n-zh/downloads/list?can=1&q=label:qemu

Regards,
Dongsheng

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Qemu-devel] [ANNOUNCE] QEMU 1.5.0-rc2 is now available
  2013-05-15 23:53 [Qemu-devel] [ANNOUNCE] QEMU 1.5.0-rc2 is now available Anthony Liguori
  2013-05-16  3:56 ` Dongsheng Song
@ 2013-05-16 14:21 ` mdroth
  2013-05-16 14:51   ` Paolo Bonzini
  2013-05-16 15:17   ` KONRAD Frédéric
  1 sibling, 2 replies; 14+ messages in thread
From: mdroth @ 2013-05-16 14:21 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: qemu-devel, fred.konrad

On Wed, May 15, 2013 at 06:53:47PM -0500, Anthony Liguori wrote:
> Hi,
> 
> On behalf of the QEMU Team, I'd like to announce the availability of the
> third release candidate for the QEMU 1.5 release.  This release is meant
> for testing purposes and should not be used in a production environment.
> 
> http://wiki.qemu.org/download/qemu-1.5.0-rc2.tar.bz2
> 
> You can help improve the quality of the QEMU 1.5 release by testing this
> release and reporting bugs on Launchpad:
> 

Sorry to chime in on this so late in the cycle, but I just noticed what
seems to be a pretty serious problem with migration to/from 1.4. This is
the failure for 1.4 -> 1.5-rc2

(qemu) migrate unix:/tmp/migrate.sock
Unknown savevm section or instance '0000:00:03.0/virtio-net' 0

Configuration:

source: v14/x86_64-softmmu/qemu-system-x86_64 -enable-kvm -L v14-bios -M
pc-i440fx-1.4 -m 512M -kernel boot/vmlinuz-x86_64 -initrd
boot/test-initramfs-x86_64.img.gz -vga std -append seed=1234 -drive
file=disk1.img,if=virtio -drive file=disk2.img,if=virtio -net
nic,model=virtio -net user -monitor unix:/tmp/vm-hmp.sock,server,nowait
-qmp unix:/tmp/vm-qmp.sock,server,nowait -vnc :100

target: v15rc2/x86_64-softmmu/qemu-system-x86_64 -enable-kvm -L temp-bios
-M pc-i440fx-1.4 -m 512M -kernel boot/vmlinuz-x86_64 -initrd
boot/test-initramfs-x86_64.img.gz -vga std -append seed=1234 -drive
file=disk1.img,if=virtio -drive file=disk2.img,if=virtio -net
nic,model=virtio -net user -incoming unix:/tmp/migrate.sock -monitor
unix:/tmp/vm-hmp-incoming.sock,server,nowait -qmp
unix:/tmp/vm-qmp-incoming.sock,server,nowait -vnc :101
QEMU 1.4.0 monitor - type 'help' for more information

This seems to have been introduced with the virtio refactoring:

commit e37da3945fa2fde161e1b217f937fc318c4b7639
Author: KONRAD Frederic <fred.konrad@greensocs.com>
Date:   Thu Apr 11 16:29:58 2013 +0200

    virtio-net-pci: switch to the new API.
    
    Here the virtio-net-pci is modified for the new API. The device
    virtio-net-pci extends virtio-pci. It creates and connects a
    virtio-net-device during the init. The properties are not changed.
    
    Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
    Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
    Message-id: 1365690602-22729-4-git-send-email-fred.konrad@greensocs.com
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

And if we roll that back, we have similar failures for virtio-blk, and most
likely the other virtio devices touched by the refactoring.

The issue seems to be a change the way section id strings are generated in
vmstate_register(). In v1.4.x we had:

se->instance_id: 0, se->idstr: 0000:00:03.0/virtio-net

In v1.5.0-rc2 we have:

se->instance_id: 0, se->idstr: virtio-net

This seems to be due to the fact that these devices now sit on a
TYPE_VIRTIO_BUS that has no implementation of TYPE_BUS's get_dev_path()
interface, which is what savevm uses to calculate the id prefix for
se->idstr.

Prior to the refactoring, the device sat on a TYPE_PCI_BUS which used
pcibus_get_dev_path() to calculate this.

I'm not sure what the best fix is for this. I looking at implementing
get_dev_path() for TYPE_VIRTIO_BUS, but to maintain migration
compatibility we'd end up baking in PCI-specific stuff which from what
I gather is exactly what we were trying to avoid there.

I think adding a compat string property to TYPE_VIRTIO_DEVICE and having
that get set somewhere like virtio_bus_plug_device() is a better
approach, but vmstate_register() gets call during TYPE_VIRTIO_DEVICE
init which I think happens before then.

Still looking at it but if someone more familiar with this code has
some ideas or wants to whip up a patch please jump right in.

> 
> Regards,
> 
> Anthony Liguori
> 
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Qemu-devel] [ANNOUNCE] QEMU 1.5.0-rc2 is now available
  2013-05-16 14:21 ` mdroth
@ 2013-05-16 14:51   ` Paolo Bonzini
  2013-05-16 15:54     ` KONRAD Frédéric
  2013-05-16 15:17   ` KONRAD Frédéric
  1 sibling, 1 reply; 14+ messages in thread
From: Paolo Bonzini @ 2013-05-16 14:51 UTC (permalink / raw)
  To: mdroth; +Cc: Anthony Liguori, qemu-devel, fred.konrad

Il 16/05/2013 16:21, mdroth ha scritto:
> commit e37da3945fa2fde161e1b217f937fc318c4b7639
> Author: KONRAD Frederic <fred.konrad@greensocs.com>
> Date:   Thu Apr 11 16:29:58 2013 +0200
> 
>     virtio-net-pci: switch to the new API.
>     
>     Here the virtio-net-pci is modified for the new API. The device
>     virtio-net-pci extends virtio-pci. It creates and connects a
>     virtio-net-device during the init. The properties are not changed.
>     
>     Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
>     Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
>     Message-id: 1365690602-22729-4-git-send-email-fred.konrad@greensocs.com
>     Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
> 
> And if we roll that back, we have similar failures for virtio-blk, and most
> likely the other virtio devices touched by the refactoring.
> 
> The issue seems to be a change the way section id strings are generated in
> vmstate_register(). In v1.4.x we had:
> 
> se->instance_id: 0, se->idstr: 0000:00:03.0/virtio-net
> 
> In v1.5.0-rc2 we have:
> 
> se->instance_id: 0, se->idstr: virtio-net
> 
> This seems to be due to the fact that these devices now sit on a
> TYPE_VIRTIO_BUS that has no implementation of TYPE_BUS's get_dev_path()
> interface, which is what savevm uses to calculate the id prefix for
> se->idstr.
> 
> Prior to the refactoring, the device sat on a TYPE_PCI_BUS which used
> pcibus_get_dev_path() to calculate this.
> 
> I'm not sure what the best fix is for this. I looking at implementing
> get_dev_path() for TYPE_VIRTIO_BUS, but to maintain migration
> compatibility we'd end up baking in PCI-specific stuff which from what
> I gather is exactly what we were trying to avoid there.

I think get_dev_path for TYPE_VIRTIO_BUS could simply forward to the
parent device's parent bus.

Paolo

> I think adding a compat string property to TYPE_VIRTIO_DEVICE and having
> that get set somewhere like virtio_bus_plug_device() is a better
> approach, but vmstate_register() gets call during TYPE_VIRTIO_DEVICE
> init which I think happens before then.
> 
> Still looking at it but if someone more familiar with this code has
> some ideas or wants to whip up a patch please jump right in.
> 
>>
>> Regards,
>>
>> Anthony Liguori
>>
>>
> 
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Qemu-devel] [ANNOUNCE] QEMU 1.5.0-rc2 is now available
  2013-05-16 14:21 ` mdroth
  2013-05-16 14:51   ` Paolo Bonzini
@ 2013-05-16 15:17   ` KONRAD Frédéric
  1 sibling, 0 replies; 14+ messages in thread
From: KONRAD Frédéric @ 2013-05-16 15:17 UTC (permalink / raw)
  To: mdroth; +Cc: Paolo Bonzini, Anthony Liguori, qemu-devel

On 16/05/2013 16:21, mdroth wrote:
> On Wed, May 15, 2013 at 06:53:47PM -0500, Anthony Liguori wrote:
>> Hi,
>>
>> On behalf of the QEMU Team, I'd like to announce the availability of the
>> third release candidate for the QEMU 1.5 release.  This release is meant
>> for testing purposes and should not be used in a production environment.
>>
>> http://wiki.qemu.org/download/qemu-1.5.0-rc2.tar.bz2
>>
>> You can help improve the quality of the QEMU 1.5 release by testing this
>> release and reporting bugs on Launchpad:
>>
> Sorry to chime in on this so late in the cycle, but I just noticed what
> seems to be a pretty serious problem with migration to/from 1.4. This is
> the failure for 1.4 -> 1.5-rc2
>
> (qemu) migrate unix:/tmp/migrate.sock
> Unknown savevm section or instance '0000:00:03.0/virtio-net' 0
>
> Configuration:
>
> source: v14/x86_64-softmmu/qemu-system-x86_64 -enable-kvm -L v14-bios -M
> pc-i440fx-1.4 -m 512M -kernel boot/vmlinuz-x86_64 -initrd
> boot/test-initramfs-x86_64.img.gz -vga std -append seed=1234 -drive
> file=disk1.img,if=virtio -drive file=disk2.img,if=virtio -net
> nic,model=virtio -net user -monitor unix:/tmp/vm-hmp.sock,server,nowait
> -qmp unix:/tmp/vm-qmp.sock,server,nowait -vnc :100
>
> target: v15rc2/x86_64-softmmu/qemu-system-x86_64 -enable-kvm -L temp-bios
> -M pc-i440fx-1.4 -m 512M -kernel boot/vmlinuz-x86_64 -initrd
> boot/test-initramfs-x86_64.img.gz -vga std -append seed=1234 -drive
> file=disk1.img,if=virtio -drive file=disk2.img,if=virtio -net
> nic,model=virtio -net user -incoming unix:/tmp/migrate.sock -monitor
> unix:/tmp/vm-hmp-incoming.sock,server,nowait -qmp
> unix:/tmp/vm-qmp-incoming.sock,server,nowait -vnc :101
> QEMU 1.4.0 monitor - type 'help' for more information
>
> This seems to have been introduced with the virtio refactoring:
>
> commit e37da3945fa2fde161e1b217f937fc318c4b7639
> Author: KONRAD Frederic <fred.konrad@greensocs.com>
> Date:   Thu Apr 11 16:29:58 2013 +0200
>
>      virtio-net-pci: switch to the new API.
>      
>      Here the virtio-net-pci is modified for the new API. The device
>      virtio-net-pci extends virtio-pci. It creates and connects a
>      virtio-net-device during the init. The properties are not changed.
>      
>      Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
>      Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
>      Message-id: 1365690602-22729-4-git-send-email-fred.konrad@greensocs.com
>      Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
>
> And if we roll that back, we have similar failures for virtio-blk, and most
> likely the other virtio devices touched by the refactoring.
>
> The issue seems to be a change the way section id strings are generated in
> vmstate_register(). In v1.4.x we had:
>
> se->instance_id: 0, se->idstr: 0000:00:03.0/virtio-net
>
> In v1.5.0-rc2 we have:
>
> se->instance_id: 0, se->idstr: virtio-net
>
> This seems to be due to the fact that these devices now sit on a
> TYPE_VIRTIO_BUS that has no implementation of TYPE_BUS's get_dev_path()
> interface, which is what savevm uses to calculate the id prefix for
> se->idstr.
>
> Prior to the refactoring, the device sat on a TYPE_PCI_BUS which used
> pcibus_get_dev_path() to calculate this.
>
> I'm not sure what the best fix is for this. I looking at implementing
> get_dev_path() for TYPE_VIRTIO_BUS, but to maintain migration
> compatibility we'd end up baking in PCI-specific stuff which from what
> I gather is exactly what we were trying to avoid there.
>
> I think adding a compat string property to TYPE_VIRTIO_DEVICE and having
> that get set somewhere like virtio_bus_plug_device() is a better
> approach, but vmstate_register() gets call during TYPE_VIRTIO_DEVICE
> init which I think happens before then.
>
> Still looking at it but if someone more familiar with this code has
> some ideas or wants to whip up a patch please jump right in.

Sorry for that.
Have you made progress?

I'm trying to add get_dev_path function to virtio-pci-bus in 
virtio-pci.c as Paolo suggests.

How do you get those instance_id to check It's working?

Fred
>> Regards,
>>
>> Anthony Liguori
>>
>>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Qemu-devel] [ANNOUNCE] QEMU 1.5.0-rc2 is now available
  2013-05-16 14:51   ` Paolo Bonzini
@ 2013-05-16 15:54     ` KONRAD Frédéric
  2013-05-16 16:07       ` Paolo Bonzini
  2013-05-16 16:33       ` Anthony Liguori
  0 siblings, 2 replies; 14+ messages in thread
From: KONRAD Frédéric @ 2013-05-16 15:54 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Anthony Liguori, mdroth, qemu-devel

On 16/05/2013 16:51, Paolo Bonzini wrote:
> Il 16/05/2013 16:21, mdroth ha scritto:
>> commit e37da3945fa2fde161e1b217f937fc318c4b7639
>> Author: KONRAD Frederic <fred.konrad@greensocs.com>
>> Date:   Thu Apr 11 16:29:58 2013 +0200
>>
>>      virtio-net-pci: switch to the new API.
>>      
>>      Here the virtio-net-pci is modified for the new API. The device
>>      virtio-net-pci extends virtio-pci. It creates and connects a
>>      virtio-net-device during the init. The properties are not changed.
>>      
>>      Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
>>      Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
>>      Message-id: 1365690602-22729-4-git-send-email-fred.konrad@greensocs.com
>>      Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
>>
>> And if we roll that back, we have similar failures for virtio-blk, and most
>> likely the other virtio devices touched by the refactoring.
>>
>> The issue seems to be a change the way section id strings are generated in
>> vmstate_register(). In v1.4.x we had:
>>
>> se->instance_id: 0, se->idstr: 0000:00:03.0/virtio-net
>>
>> In v1.5.0-rc2 we have:
>>
>> se->instance_id: 0, se->idstr: virtio-net
>>
>> This seems to be due to the fact that these devices now sit on a
>> TYPE_VIRTIO_BUS that has no implementation of TYPE_BUS's get_dev_path()
>> interface, which is what savevm uses to calculate the id prefix for
>> se->idstr.
>>
>> Prior to the refactoring, the device sat on a TYPE_PCI_BUS which used
>> pcibus_get_dev_path() to calculate this.
>>
>> I'm not sure what the best fix is for this. I looking at implementing
>> get_dev_path() for TYPE_VIRTIO_BUS, but to maintain migration
>> compatibility we'd end up baking in PCI-specific stuff which from what
>> I gather is exactly what we were trying to avoid there.
> I think get_dev_path for TYPE_VIRTIO_BUS could simply forward to the
> parent device's parent bus.
>
> Paolo

I think this can do the job, any better idea?

diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index d5257ed..e033b53 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -43,7 +43,6 @@
  #endif

  static void pcibus_dev_print(Monitor *mon, DeviceState *dev, int indent);
-static char *pcibus_get_dev_path(DeviceState *dev);
  static char *pcibus_get_fw_dev_path(DeviceState *dev);
  static int pcibus_reset(BusState *qbus);

@@ -2129,7 +2128,7 @@ static char *pcibus_get_fw_dev_path(DeviceState *dev)
      return g_strdup(path);
  }

-static char *pcibus_get_dev_path(DeviceState *dev)
+char *pcibus_get_dev_path(DeviceState *dev)
  {
      PCIDevice *d = container_of(dev, PCIDevice, qdev);
      PCIDevice *t;
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
index 70d2c6b..0241223 100644
--- a/hw/virtio/virtio-pci.c
+++ b/hw/virtio/virtio-pci.c
@@ -1514,11 +1514,19 @@ static void virtio_pci_bus_new(VirtioBusState 
*bus, VirtIOPCIProxy *dev)
      qbus->allow_hotplug = 1;
  }

+static char *virtio_pci_bus_get_dev_path(DeviceState *dev)
+{
+    BusState *bus = qdev_get_parent_bus(dev);
+    DeviceState *proxy = DEVICE(bus->parent);
+    return g_strdup(pcibus_get_dev_path(proxy));
+}
+
  static void virtio_pci_bus_class_init(ObjectClass *klass, void *data)
  {
      BusClass *bus_class = BUS_CLASS(klass);
      VirtioBusClass *k = VIRTIO_BUS_CLASS(klass);
      bus_class->max_dev = 1;
+    bus_class->get_dev_path = virtio_pci_bus_get_dev_path;
      k->notify = virtio_pci_notify;
      k->save_config = virtio_pci_save_config;
      k->load_config = virtio_pci_load_config;
diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
index 8d075ab..fb5723c 100644
--- a/include/hw/pci/pci.h
+++ b/include/hw/pci/pci.h
@@ -708,6 +708,8 @@ static inline void pci_dma_sglist_init(QEMUSGList 
*qsg, PCIDevice *dev,

  extern const VMStateDescription vmstate_pci_device;

+char *pcibus_get_dev_path(DeviceState *dev);
+
  #define VMSTATE_PCI_DEVICE(_field, _state) {                         \
      .name       = (stringify(_field)),                               \
      .size       = sizeof(PCIDevice),                                 \
-- 
1.7.11.7

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [Qemu-devel] [ANNOUNCE] QEMU 1.5.0-rc2 is now available
  2013-05-16 15:54     ` KONRAD Frédéric
@ 2013-05-16 16:07       ` Paolo Bonzini
  2013-05-16 16:34         ` KONRAD Frédéric
  2013-05-16 16:35         ` mdroth
  2013-05-16 16:33       ` Anthony Liguori
  1 sibling, 2 replies; 14+ messages in thread
From: Paolo Bonzini @ 2013-05-16 16:07 UTC (permalink / raw)
  To: KONRAD Frédéric; +Cc: Anthony Liguori, mdroth, qemu-devel

Il 16/05/2013 17:54, KONRAD Frédéric ha scritto:
> I think this can do the job, any better idea?
> 
> diff --git a/hw/pci/pci.c b/hw/pci/pci.c
> index d5257ed..e033b53 100644
> --- a/hw/pci/pci.c
> +++ b/hw/pci/pci.c
> @@ -43,7 +43,6 @@
>  #endif
> 
>  static void pcibus_dev_print(Monitor *mon, DeviceState *dev, int indent);
> -static char *pcibus_get_dev_path(DeviceState *dev);
>  static char *pcibus_get_fw_dev_path(DeviceState *dev);
>  static int pcibus_reset(BusState *qbus);
> 
> @@ -2129,7 +2128,7 @@ static char *pcibus_get_fw_dev_path(DeviceState *dev)
>      return g_strdup(path);
>  }
> 
> -static char *pcibus_get_dev_path(DeviceState *dev)
> +char *pcibus_get_dev_path(DeviceState *dev)
>  {
>      PCIDevice *d = container_of(dev, PCIDevice, qdev);
>      PCIDevice *t;
> diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
> index 70d2c6b..0241223 100644
> --- a/hw/virtio/virtio-pci.c
> +++ b/hw/virtio/virtio-pci.c
> @@ -1514,11 +1514,19 @@ static void virtio_pci_bus_new(VirtioBusState
> *bus, VirtIOPCIProxy *dev)
>      qbus->allow_hotplug = 1;
>  }
> 
> +static char *virtio_pci_bus_get_dev_path(DeviceState *dev)
> +{
> +    BusState *bus = qdev_get_parent_bus(dev);
> +    DeviceState *proxy = DEVICE(bus->parent);
> +    return g_strdup(pcibus_get_dev_path(proxy));

You do not need to export pcibus_get_dev_path.  This should just return
qdev_get_dev_path(proxy) and should be in TYPE_VIRTIO_BUS, not in the
PCI-specific subclass.

(The g_strdup is not needed, either).

Paolo

> +}
> +
>  static void virtio_pci_bus_class_init(ObjectClass *klass, void *data)
>  {
>      BusClass *bus_class = BUS_CLASS(klass);
>      VirtioBusClass *k = VIRTIO_BUS_CLASS(klass);
>      bus_class->max_dev = 1;
> +    bus_class->get_dev_path = virtio_pci_bus_get_dev_path;
>      k->notify = virtio_pci_notify;
>      k->save_config = virtio_pci_save_config;
>      k->load_config = virtio_pci_load_config;
> diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
> index 8d075ab..fb5723c 100644
> --- a/include/hw/pci/pci.h
> +++ b/include/hw/pci/pci.h
> @@ -708,6 +708,8 @@ static inline void pci_dma_sglist_init(QEMUSGList
> *qsg, PCIDevice *dev,
> 
>  extern const VMStateDescription vmstate_pci_device;
> 
> +char *pcibus_get_dev_path(DeviceState *dev);
> +
>  #define VMSTATE_PCI_DEVICE(_field, _state) {                         \
>      .name       = (stringify(_field)),                               \
>      .size       = sizeof(PCIDevice),                                 \

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Qemu-devel] [ANNOUNCE] QEMU 1.5.0-rc2 is now available
  2013-05-16 15:54     ` KONRAD Frédéric
  2013-05-16 16:07       ` Paolo Bonzini
@ 2013-05-16 16:33       ` Anthony Liguori
  2013-05-16 16:34         ` KONRAD Frédéric
  1 sibling, 1 reply; 14+ messages in thread
From: Anthony Liguori @ 2013-05-16 16:33 UTC (permalink / raw)
  To: KONRAD Frédéric, Paolo Bonzini; +Cc: mdroth, qemu-devel

KONRAD Frédéric <fred.konrad@greensocs.com> writes:

> On 16/05/2013 16:51, Paolo Bonzini wrote:
>> Il 16/05/2013 16:21, mdroth ha scritto:
>>> commit e37da3945fa2fde161e1b217f937fc318c4b7639
>>> Author: KONRAD Frederic <fred.konrad@greensocs.com>
>>> Date:   Thu Apr 11 16:29:58 2013 +0200
>>>
>>>      virtio-net-pci: switch to the new API.
>>>      
>>>      Here the virtio-net-pci is modified for the new API. The device
>>>      virtio-net-pci extends virtio-pci. It creates and connects a
>>>      virtio-net-device during the init. The properties are not changed.
>>>      
>>>      Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
>>>      Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
>>>      Message-id: 1365690602-22729-4-git-send-email-fred.konrad@greensocs.com
>>>      Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
>>>
>>> And if we roll that back, we have similar failures for virtio-blk, and most
>>> likely the other virtio devices touched by the refactoring.
>>>
>>> The issue seems to be a change the way section id strings are generated in
>>> vmstate_register(). In v1.4.x we had:
>>>
>>> se->instance_id: 0, se->idstr: 0000:00:03.0/virtio-net
>>>
>>> In v1.5.0-rc2 we have:
>>>
>>> se->instance_id: 0, se->idstr: virtio-net
>>>
>>> This seems to be due to the fact that these devices now sit on a
>>> TYPE_VIRTIO_BUS that has no implementation of TYPE_BUS's get_dev_path()
>>> interface, which is what savevm uses to calculate the id prefix for
>>> se->idstr.
>>>
>>> Prior to the refactoring, the device sat on a TYPE_PCI_BUS which used
>>> pcibus_get_dev_path() to calculate this.
>>>
>>> I'm not sure what the best fix is for this. I looking at implementing
>>> get_dev_path() for TYPE_VIRTIO_BUS, but to maintain migration
>>> compatibility we'd end up baking in PCI-specific stuff which from what
>>> I gather is exactly what we were trying to avoid there.
>> I think get_dev_path for TYPE_VIRTIO_BUS could simply forward to the
>> parent device's parent bus.
>>
>> Paolo
>
> I think this can do the job, any better idea?

Monkey patching is a little ugly but it is a concise way of fixing the
problem.

Mike, can you confirm the patch?

Fred, can you add a Signed-off-by and send as a top-level?

Regards,

Anthony Liguori

>
> diff --git a/hw/pci/pci.c b/hw/pci/pci.c
> index d5257ed..e033b53 100644
> --- a/hw/pci/pci.c
> +++ b/hw/pci/pci.c
> @@ -43,7 +43,6 @@
>   #endif
>
>   static void pcibus_dev_print(Monitor *mon, DeviceState *dev, int indent);
> -static char *pcibus_get_dev_path(DeviceState *dev);
>   static char *pcibus_get_fw_dev_path(DeviceState *dev);
>   static int pcibus_reset(BusState *qbus);
>
> @@ -2129,7 +2128,7 @@ static char *pcibus_get_fw_dev_path(DeviceState *dev)
>       return g_strdup(path);
>   }
>
> -static char *pcibus_get_dev_path(DeviceState *dev)
> +char *pcibus_get_dev_path(DeviceState *dev)
>   {
>       PCIDevice *d = container_of(dev, PCIDevice, qdev);
>       PCIDevice *t;
> diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
> index 70d2c6b..0241223 100644
> --- a/hw/virtio/virtio-pci.c
> +++ b/hw/virtio/virtio-pci.c
> @@ -1514,11 +1514,19 @@ static void virtio_pci_bus_new(VirtioBusState 
> *bus, VirtIOPCIProxy *dev)
>       qbus->allow_hotplug = 1;
>   }
>
> +static char *virtio_pci_bus_get_dev_path(DeviceState *dev)
> +{
> +    BusState *bus = qdev_get_parent_bus(dev);
> +    DeviceState *proxy = DEVICE(bus->parent);
> +    return g_strdup(pcibus_get_dev_path(proxy));
> +}
> +
>   static void virtio_pci_bus_class_init(ObjectClass *klass, void *data)
>   {
>       BusClass *bus_class = BUS_CLASS(klass);
>       VirtioBusClass *k = VIRTIO_BUS_CLASS(klass);
>       bus_class->max_dev = 1;
> +    bus_class->get_dev_path = virtio_pci_bus_get_dev_path;
>       k->notify = virtio_pci_notify;
>       k->save_config = virtio_pci_save_config;
>       k->load_config = virtio_pci_load_config;
> diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
> index 8d075ab..fb5723c 100644
> --- a/include/hw/pci/pci.h
> +++ b/include/hw/pci/pci.h
> @@ -708,6 +708,8 @@ static inline void pci_dma_sglist_init(QEMUSGList 
> *qsg, PCIDevice *dev,
>
>   extern const VMStateDescription vmstate_pci_device;
>
> +char *pcibus_get_dev_path(DeviceState *dev);
> +
>   #define VMSTATE_PCI_DEVICE(_field, _state) {                         \
>       .name       = (stringify(_field)),                               \
>       .size       = sizeof(PCIDevice),                                 \
> -- 
> 1.7.11.7

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Qemu-devel] [ANNOUNCE] QEMU 1.5.0-rc2 is now available
  2013-05-16 16:07       ` Paolo Bonzini
@ 2013-05-16 16:34         ` KONRAD Frédéric
  2013-05-16 16:49           ` mdroth
  2013-05-16 16:52           ` Paolo Bonzini
  2013-05-16 16:35         ` mdroth
  1 sibling, 2 replies; 14+ messages in thread
From: KONRAD Frédéric @ 2013-05-16 16:34 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Anthony Liguori, mdroth, qemu-devel

On 16/05/2013 18:07, Paolo Bonzini wrote:
> Il 16/05/2013 17:54, KONRAD Frédéric ha scritto:
>> I think this can do the job, any better idea?
>>
>> diff --git a/hw/pci/pci.c b/hw/pci/pci.c
>> index d5257ed..e033b53 100644
>> --- a/hw/pci/pci.c
>> +++ b/hw/pci/pci.c
>> @@ -43,7 +43,6 @@
>>   #endif
>>
>>   static void pcibus_dev_print(Monitor *mon, DeviceState *dev, int indent);
>> -static char *pcibus_get_dev_path(DeviceState *dev);
>>   static char *pcibus_get_fw_dev_path(DeviceState *dev);
>>   static int pcibus_reset(BusState *qbus);
>>
>> @@ -2129,7 +2128,7 @@ static char *pcibus_get_fw_dev_path(DeviceState *dev)
>>       return g_strdup(path);
>>   }
>>
>> -static char *pcibus_get_dev_path(DeviceState *dev)
>> +char *pcibus_get_dev_path(DeviceState *dev)
>>   {
>>       PCIDevice *d = container_of(dev, PCIDevice, qdev);
>>       PCIDevice *t;
>> diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
>> index 70d2c6b..0241223 100644
>> --- a/hw/virtio/virtio-pci.c
>> +++ b/hw/virtio/virtio-pci.c
>> @@ -1514,11 +1514,19 @@ static void virtio_pci_bus_new(VirtioBusState
>> *bus, VirtIOPCIProxy *dev)
>>       qbus->allow_hotplug = 1;
>>   }
>>
>> +static char *virtio_pci_bus_get_dev_path(DeviceState *dev)
>> +{
>> +    BusState *bus = qdev_get_parent_bus(dev);
>> +    DeviceState *proxy = DEVICE(bus->parent);
>> +    return g_strdup(pcibus_get_dev_path(proxy));
> You do not need to export pcibus_get_dev_path.  This should just return
> qdev_get_dev_path(proxy) and should be in TYPE_VIRTIO_BUS, not in the
> PCI-specific subclass.
>
> (The g_strdup is not needed, either).
>
> Paolo

True, I avoided it because of CCW and S390, but as they don't have there 
get_dev_path, it seems
not to change anything for them.

I think that's better and I get 0000:00:04.0/virtio-net for idstr.

diff --git a/hw/virtio/virtio-bus.c b/hw/virtio/virtio-bus.c
index aab72ff..ea2e11a 100644
--- a/hw/virtio/virtio-bus.c
+++ b/hw/virtio/virtio-bus.c
@@ -154,12 +154,26 @@ void virtio_bus_set_vdev_config(VirtioBusState 
*bus, uint8_t *config)
      }
  }

+static char *virtio_bus_get_dev_path(DeviceState *dev)
+{
+    BusState *bus = qdev_get_parent_bus(dev);
+    DeviceState *proxy = DEVICE(bus->parent);
+    return qdev_get_dev_path(proxy);
+}
+
+static void virtio_bus_class_init(ObjectClass *klass, void *data)
+{
+    BusClass *bus_class = BUS_CLASS(klass);
+    bus_class->get_dev_path = virtio_bus_get_dev_path;
+}
+
  static const TypeInfo virtio_bus_info = {
      .name = TYPE_VIRTIO_BUS,
      .parent = TYPE_BUS,
      .instance_size = sizeof(VirtioBusState),
      .abstract = true,
      .class_size = sizeof(VirtioBusClass),
+    .class_init = virtio_bus_class_init
  };

  static void virtio_register_types(void)
-- 
1.7.11.7

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [Qemu-devel] [ANNOUNCE] QEMU 1.5.0-rc2 is now available
  2013-05-16 16:33       ` Anthony Liguori
@ 2013-05-16 16:34         ` KONRAD Frédéric
  0 siblings, 0 replies; 14+ messages in thread
From: KONRAD Frédéric @ 2013-05-16 16:34 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: Paolo Bonzini, mdroth, qemu-devel

On 16/05/2013 18:33, Anthony Liguori wrote:
> KONRAD Frédéric <fred.konrad@greensocs.com> writes:
>
>> On 16/05/2013 16:51, Paolo Bonzini wrote:
>>> Il 16/05/2013 16:21, mdroth ha scritto:
>>>> commit e37da3945fa2fde161e1b217f937fc318c4b7639
>>>> Author: KONRAD Frederic <fred.konrad@greensocs.com>
>>>> Date:   Thu Apr 11 16:29:58 2013 +0200
>>>>
>>>>       virtio-net-pci: switch to the new API.
>>>>       
>>>>       Here the virtio-net-pci is modified for the new API. The device
>>>>       virtio-net-pci extends virtio-pci. It creates and connects a
>>>>       virtio-net-device during the init. The properties are not changed.
>>>>       
>>>>       Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
>>>>       Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
>>>>       Message-id: 1365690602-22729-4-git-send-email-fred.konrad@greensocs.com
>>>>       Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
>>>>
>>>> And if we roll that back, we have similar failures for virtio-blk, and most
>>>> likely the other virtio devices touched by the refactoring.
>>>>
>>>> The issue seems to be a change the way section id strings are generated in
>>>> vmstate_register(). In v1.4.x we had:
>>>>
>>>> se->instance_id: 0, se->idstr: 0000:00:03.0/virtio-net
>>>>
>>>> In v1.5.0-rc2 we have:
>>>>
>>>> se->instance_id: 0, se->idstr: virtio-net
>>>>
>>>> This seems to be due to the fact that these devices now sit on a
>>>> TYPE_VIRTIO_BUS that has no implementation of TYPE_BUS's get_dev_path()
>>>> interface, which is what savevm uses to calculate the id prefix for
>>>> se->idstr.
>>>>
>>>> Prior to the refactoring, the device sat on a TYPE_PCI_BUS which used
>>>> pcibus_get_dev_path() to calculate this.
>>>>
>>>> I'm not sure what the best fix is for this. I looking at implementing
>>>> get_dev_path() for TYPE_VIRTIO_BUS, but to maintain migration
>>>> compatibility we'd end up baking in PCI-specific stuff which from what
>>>> I gather is exactly what we were trying to avoid there.
>>> I think get_dev_path for TYPE_VIRTIO_BUS could simply forward to the
>>> parent device's parent bus.
>>>
>>> Paolo
>> I think this can do the job, any better idea?
> Monkey patching is a little ugly but it is a concise way of fixing the
> problem.
>
> Mike, can you confirm the patch?
>
> Fred, can you add a Signed-off-by and send as a top-level?
>
> Regards,
>
> Anthony Liguori

I just send a better way.
>
>> diff --git a/hw/pci/pci.c b/hw/pci/pci.c
>> index d5257ed..e033b53 100644
>> --- a/hw/pci/pci.c
>> +++ b/hw/pci/pci.c
>> @@ -43,7 +43,6 @@
>>    #endif
>>
>>    static void pcibus_dev_print(Monitor *mon, DeviceState *dev, int indent);
>> -static char *pcibus_get_dev_path(DeviceState *dev);
>>    static char *pcibus_get_fw_dev_path(DeviceState *dev);
>>    static int pcibus_reset(BusState *qbus);
>>
>> @@ -2129,7 +2128,7 @@ static char *pcibus_get_fw_dev_path(DeviceState *dev)
>>        return g_strdup(path);
>>    }
>>
>> -static char *pcibus_get_dev_path(DeviceState *dev)
>> +char *pcibus_get_dev_path(DeviceState *dev)
>>    {
>>        PCIDevice *d = container_of(dev, PCIDevice, qdev);
>>        PCIDevice *t;
>> diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
>> index 70d2c6b..0241223 100644
>> --- a/hw/virtio/virtio-pci.c
>> +++ b/hw/virtio/virtio-pci.c
>> @@ -1514,11 +1514,19 @@ static void virtio_pci_bus_new(VirtioBusState
>> *bus, VirtIOPCIProxy *dev)
>>        qbus->allow_hotplug = 1;
>>    }
>>
>> +static char *virtio_pci_bus_get_dev_path(DeviceState *dev)
>> +{
>> +    BusState *bus = qdev_get_parent_bus(dev);
>> +    DeviceState *proxy = DEVICE(bus->parent);
>> +    return g_strdup(pcibus_get_dev_path(proxy));
>> +}
>> +
>>    static void virtio_pci_bus_class_init(ObjectClass *klass, void *data)
>>    {
>>        BusClass *bus_class = BUS_CLASS(klass);
>>        VirtioBusClass *k = VIRTIO_BUS_CLASS(klass);
>>        bus_class->max_dev = 1;
>> +    bus_class->get_dev_path = virtio_pci_bus_get_dev_path;
>>        k->notify = virtio_pci_notify;
>>        k->save_config = virtio_pci_save_config;
>>        k->load_config = virtio_pci_load_config;
>> diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
>> index 8d075ab..fb5723c 100644
>> --- a/include/hw/pci/pci.h
>> +++ b/include/hw/pci/pci.h
>> @@ -708,6 +708,8 @@ static inline void pci_dma_sglist_init(QEMUSGList
>> *qsg, PCIDevice *dev,
>>
>>    extern const VMStateDescription vmstate_pci_device;
>>
>> +char *pcibus_get_dev_path(DeviceState *dev);
>> +
>>    #define VMSTATE_PCI_DEVICE(_field, _state) {                         \
>>        .name       = (stringify(_field)),                               \
>>        .size       = sizeof(PCIDevice),                                 \
>> -- 
>> 1.7.11.7

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Qemu-devel] [ANNOUNCE] QEMU 1.5.0-rc2 is now available
  2013-05-16 16:07       ` Paolo Bonzini
  2013-05-16 16:34         ` KONRAD Frédéric
@ 2013-05-16 16:35         ` mdroth
  1 sibling, 0 replies; 14+ messages in thread
From: mdroth @ 2013-05-16 16:35 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Anthony Liguori, qemu-devel, KONRAD Frédéric

On Thu, May 16, 2013 at 06:07:12PM +0200, Paolo Bonzini wrote:
> Il 16/05/2013 17:54, KONRAD Frédéric ha scritto:
> > I think this can do the job, any better idea?
> > 
> > diff --git a/hw/pci/pci.c b/hw/pci/pci.c
> > index d5257ed..e033b53 100644
> > --- a/hw/pci/pci.c
> > +++ b/hw/pci/pci.c
> > @@ -43,7 +43,6 @@
> >  #endif
> > 
> >  static void pcibus_dev_print(Monitor *mon, DeviceState *dev, int indent);
> > -static char *pcibus_get_dev_path(DeviceState *dev);
> >  static char *pcibus_get_fw_dev_path(DeviceState *dev);
> >  static int pcibus_reset(BusState *qbus);
> > 
> > @@ -2129,7 +2128,7 @@ static char *pcibus_get_fw_dev_path(DeviceState *dev)
> >      return g_strdup(path);
> >  }
> > 
> > -static char *pcibus_get_dev_path(DeviceState *dev)
> > +char *pcibus_get_dev_path(DeviceState *dev)
> >  {
> >      PCIDevice *d = container_of(dev, PCIDevice, qdev);
> >      PCIDevice *t;
> > diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
> > index 70d2c6b..0241223 100644
> > --- a/hw/virtio/virtio-pci.c
> > +++ b/hw/virtio/virtio-pci.c
> > @@ -1514,11 +1514,19 @@ static void virtio_pci_bus_new(VirtioBusState
> > *bus, VirtIOPCIProxy *dev)
> >      qbus->allow_hotplug = 1;
> >  }
> > 
> > +static char *virtio_pci_bus_get_dev_path(DeviceState *dev)
> > +{
> > +    BusState *bus = qdev_get_parent_bus(dev);
> > +    DeviceState *proxy = DEVICE(bus->parent);
> > +    return g_strdup(pcibus_get_dev_path(proxy));
> 
> You do not need to export pcibus_get_dev_path.  This should just return
> qdev_get_dev_path(proxy) and should be in TYPE_VIRTIO_BUS, not in the
> PCI-specific subclass.
> 
> (The g_strdup is not needed, either).

I've been testing the patch below and it seems to do the trick. If it seems
reasonable I'll submit it after a bit more testing.

diff --git a/hw/virtio/virtio-bus.c b/hw/virtio/virtio-bus.c
index aab72ff..91b7bad 100644
--- a/hw/virtio/virtio-bus.c
+++ b/hw/virtio/virtio-bus.c
@@ -154,12 +154,35 @@ void virtio_bus_set_vdev_config(VirtioBusState *bus, uint8_t *config)
     }
 }
 
+static char *virtio_bus_get_dev_path(DeviceState *dev)
+{
+    DeviceState *parent_dev = DEVICE(OBJECT(dev)->parent);
+    BusClass *parent_bus_klass = BUS_GET_CLASS(qdev_get_parent_bus(parent_dev));
+
+    /* pass this call up to the device's parent's bus to get at
+     * guest-visible hardware topology
+     */
+    if (parent_bus_klass->get_dev_path) {
+        return parent_bus_klass->get_dev_path(parent_dev);
+    }
+
+    return NULL;
+}
+
+static void virtio_bus_class_init(ObjectClass *klass, void *data)
+{
+    BusClass *k = BUS_CLASS(klass);
+
+    k->get_dev_path = virtio_bus_get_dev_path;
+}
+
 static const TypeInfo virtio_bus_info = {
     .name = TYPE_VIRTIO_BUS,
     .parent = TYPE_BUS,
     .instance_size = sizeof(VirtioBusState),
     .abstract = true,
     .class_size = sizeof(VirtioBusClass),
+    .class_init = virtio_bus_class_init,
 };

> 
> Paolo
> 
> > +}
> > +
> >  static void virtio_pci_bus_class_init(ObjectClass *klass, void *data)
> >  {
> >      BusClass *bus_class = BUS_CLASS(klass);
> >      VirtioBusClass *k = VIRTIO_BUS_CLASS(klass);
> >      bus_class->max_dev = 1;
> > +    bus_class->get_dev_path = virtio_pci_bus_get_dev_path;
> >      k->notify = virtio_pci_notify;
> >      k->save_config = virtio_pci_save_config;
> >      k->load_config = virtio_pci_load_config;
> > diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
> > index 8d075ab..fb5723c 100644
> > --- a/include/hw/pci/pci.h
> > +++ b/include/hw/pci/pci.h
> > @@ -708,6 +708,8 @@ static inline void pci_dma_sglist_init(QEMUSGList
> > *qsg, PCIDevice *dev,
> > 
> >  extern const VMStateDescription vmstate_pci_device;
> > 
> > +char *pcibus_get_dev_path(DeviceState *dev);
> > +
> >  #define VMSTATE_PCI_DEVICE(_field, _state) {                         \
> >      .name       = (stringify(_field)),                               \
> >      .size       = sizeof(PCIDevice),                                 \
> 

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [Qemu-devel] [ANNOUNCE] QEMU 1.5.0-rc2 is now available
  2013-05-16 16:34         ` KONRAD Frédéric
@ 2013-05-16 16:49           ` mdroth
  2013-05-16 16:53             ` KONRAD Frédéric
  2013-05-16 16:52           ` Paolo Bonzini
  1 sibling, 1 reply; 14+ messages in thread
From: mdroth @ 2013-05-16 16:49 UTC (permalink / raw)
  To: KONRAD Frédéric; +Cc: Paolo Bonzini, Anthony Liguori, qemu-devel

On Thu, May 16, 2013 at 06:34:09PM +0200, KONRAD Frédéric wrote:
> On 16/05/2013 18:07, Paolo Bonzini wrote:
> >Il 16/05/2013 17:54, KONRAD Frédéric ha scritto:
> >>I think this can do the job, any better idea?
> >>
> >>diff --git a/hw/pci/pci.c b/hw/pci/pci.c
> >>index d5257ed..e033b53 100644
> >>--- a/hw/pci/pci.c
> >>+++ b/hw/pci/pci.c
> >>@@ -43,7 +43,6 @@
> >>  #endif
> >>
> >>  static void pcibus_dev_print(Monitor *mon, DeviceState *dev, int indent);
> >>-static char *pcibus_get_dev_path(DeviceState *dev);
> >>  static char *pcibus_get_fw_dev_path(DeviceState *dev);
> >>  static int pcibus_reset(BusState *qbus);
> >>
> >>@@ -2129,7 +2128,7 @@ static char *pcibus_get_fw_dev_path(DeviceState *dev)
> >>      return g_strdup(path);
> >>  }
> >>
> >>-static char *pcibus_get_dev_path(DeviceState *dev)
> >>+char *pcibus_get_dev_path(DeviceState *dev)
> >>  {
> >>      PCIDevice *d = container_of(dev, PCIDevice, qdev);
> >>      PCIDevice *t;
> >>diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
> >>index 70d2c6b..0241223 100644
> >>--- a/hw/virtio/virtio-pci.c
> >>+++ b/hw/virtio/virtio-pci.c
> >>@@ -1514,11 +1514,19 @@ static void virtio_pci_bus_new(VirtioBusState
> >>*bus, VirtIOPCIProxy *dev)
> >>      qbus->allow_hotplug = 1;
> >>  }
> >>
> >>+static char *virtio_pci_bus_get_dev_path(DeviceState *dev)
> >>+{
> >>+    BusState *bus = qdev_get_parent_bus(dev);
> >>+    DeviceState *proxy = DEVICE(bus->parent);
> >>+    return g_strdup(pcibus_get_dev_path(proxy));
> >You do not need to export pcibus_get_dev_path.  This should just return
> >qdev_get_dev_path(proxy) and should be in TYPE_VIRTIO_BUS, not in the
> >PCI-specific subclass.
> >
> >(The g_strdup is not needed, either).
> >
> >Paolo
> 
> True, I avoided it because of CCW and S390, but as they don't have
> there get_dev_path, it seems
> not to change anything for them.
> 
> I think that's better and I get 0000:00:04.0/virtio-net for idstr.

Sorry, my email seems to be malfunctioning this morning and I didn't see
this before sending mine. Not sure which one is better but I'll be happy
to test whatever we decide on.

> 
> diff --git a/hw/virtio/virtio-bus.c b/hw/virtio/virtio-bus.c
> index aab72ff..ea2e11a 100644
> --- a/hw/virtio/virtio-bus.c
> +++ b/hw/virtio/virtio-bus.c
> @@ -154,12 +154,26 @@ void virtio_bus_set_vdev_config(VirtioBusState
> *bus, uint8_t *config)
>      }
>  }
> 
> +static char *virtio_bus_get_dev_path(DeviceState *dev)
> +{
> +    BusState *bus = qdev_get_parent_bus(dev);
> +    DeviceState *proxy = DEVICE(bus->parent);
> +    return qdev_get_dev_path(proxy);
> +}
> +
> +static void virtio_bus_class_init(ObjectClass *klass, void *data)
> +{
> +    BusClass *bus_class = BUS_CLASS(klass);
> +    bus_class->get_dev_path = virtio_bus_get_dev_path;
> +}
> +
>  static const TypeInfo virtio_bus_info = {
>      .name = TYPE_VIRTIO_BUS,
>      .parent = TYPE_BUS,
>      .instance_size = sizeof(VirtioBusState),
>      .abstract = true,
>      .class_size = sizeof(VirtioBusClass),
> +    .class_init = virtio_bus_class_init
>  };
> 
>  static void virtio_register_types(void)
> -- 
> 1.7.11.7
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Qemu-devel] [ANNOUNCE] QEMU 1.5.0-rc2 is now available
  2013-05-16 16:34         ` KONRAD Frédéric
  2013-05-16 16:49           ` mdroth
@ 2013-05-16 16:52           ` Paolo Bonzini
  1 sibling, 0 replies; 14+ messages in thread
From: Paolo Bonzini @ 2013-05-16 16:52 UTC (permalink / raw)
  To: KONRAD Frédéric; +Cc: Anthony Liguori, mdroth, qemu-devel

Il 16/05/2013 18:34, KONRAD Frédéric ha scritto:
> True, I avoided it because of CCW and S390, but as they don't have there
> get_dev_path, it seems
> not to change anything for them.
> 
> I think that's better and I get 0000:00:04.0/virtio-net for idstr.

Thanks,

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

Paolo

> diff --git a/hw/virtio/virtio-bus.c b/hw/virtio/virtio-bus.c
> index aab72ff..ea2e11a 100644
> --- a/hw/virtio/virtio-bus.c
> +++ b/hw/virtio/virtio-bus.c
> @@ -154,12 +154,26 @@ void virtio_bus_set_vdev_config(VirtioBusState
> *bus, uint8_t *config)
>      }
>  }
> 
> +static char *virtio_bus_get_dev_path(DeviceState *dev)
> +{
> +    BusState *bus = qdev_get_parent_bus(dev);
> +    DeviceState *proxy = DEVICE(bus->parent);
> +    return qdev_get_dev_path(proxy);
> +}
> +
> +static void virtio_bus_class_init(ObjectClass *klass, void *data)
> +{
> +    BusClass *bus_class = BUS_CLASS(klass);
> +    bus_class->get_dev_path = virtio_bus_get_dev_path;
> +}
> +
>  static const TypeInfo virtio_bus_info = {
>      .name = TYPE_VIRTIO_BUS,
>      .parent = TYPE_BUS,
>      .instance_size = sizeof(VirtioBusState),
>      .abstract = true,
>      .class_size = sizeof(VirtioBusClass),
> +    .class_init = virtio_bus_class_init
>  };
> 
>  static void virtio_register_types(void)

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Qemu-devel] [ANNOUNCE] QEMU 1.5.0-rc2 is now available
  2013-05-16 16:49           ` mdroth
@ 2013-05-16 16:53             ` KONRAD Frédéric
  0 siblings, 0 replies; 14+ messages in thread
From: KONRAD Frédéric @ 2013-05-16 16:53 UTC (permalink / raw)
  To: mdroth; +Cc: Paolo Bonzini, Anthony Liguori, qemu-devel

On 16/05/2013 18:49, mdroth wrote:
> On Thu, May 16, 2013 at 06:34:09PM +0200, KONRAD Frédéric wrote:
>> On 16/05/2013 18:07, Paolo Bonzini wrote:
>>> Il 16/05/2013 17:54, KONRAD Frédéric ha scritto:
>>>> I think this can do the job, any better idea?
>>>>
>>>> diff --git a/hw/pci/pci.c b/hw/pci/pci.c
>>>> index d5257ed..e033b53 100644
>>>> --- a/hw/pci/pci.c
>>>> +++ b/hw/pci/pci.c
>>>> @@ -43,7 +43,6 @@
>>>>   #endif
>>>>
>>>>   static void pcibus_dev_print(Monitor *mon, DeviceState *dev, int indent);
>>>> -static char *pcibus_get_dev_path(DeviceState *dev);
>>>>   static char *pcibus_get_fw_dev_path(DeviceState *dev);
>>>>   static int pcibus_reset(BusState *qbus);
>>>>
>>>> @@ -2129,7 +2128,7 @@ static char *pcibus_get_fw_dev_path(DeviceState *dev)
>>>>       return g_strdup(path);
>>>>   }
>>>>
>>>> -static char *pcibus_get_dev_path(DeviceState *dev)
>>>> +char *pcibus_get_dev_path(DeviceState *dev)
>>>>   {
>>>>       PCIDevice *d = container_of(dev, PCIDevice, qdev);
>>>>       PCIDevice *t;
>>>> diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
>>>> index 70d2c6b..0241223 100644
>>>> --- a/hw/virtio/virtio-pci.c
>>>> +++ b/hw/virtio/virtio-pci.c
>>>> @@ -1514,11 +1514,19 @@ static void virtio_pci_bus_new(VirtioBusState
>>>> *bus, VirtIOPCIProxy *dev)
>>>>       qbus->allow_hotplug = 1;
>>>>   }
>>>>
>>>> +static char *virtio_pci_bus_get_dev_path(DeviceState *dev)
>>>> +{
>>>> +    BusState *bus = qdev_get_parent_bus(dev);
>>>> +    DeviceState *proxy = DEVICE(bus->parent);
>>>> +    return g_strdup(pcibus_get_dev_path(proxy));
>>> You do not need to export pcibus_get_dev_path.  This should just return
>>> qdev_get_dev_path(proxy) and should be in TYPE_VIRTIO_BUS, not in the
>>> PCI-specific subclass.
>>>
>>> (The g_strdup is not needed, either).
>>>
>>> Paolo
>> True, I avoided it because of CCW and S390, but as they don't have
>> there get_dev_path, it seems
>> not to change anything for them.
>>
>> I think that's better and I get 0000:00:04.0/virtio-net for idstr.
> Sorry, my email seems to be malfunctioning this morning and I didn't see
> this before sending mine. Not sure which one is better but I'll be happy
> to test whatever we decide on.

Well, seems our patches are sent at the same moment.
>> diff --git a/hw/virtio/virtio-bus.c b/hw/virtio/virtio-bus.c
>> index aab72ff..ea2e11a 100644
>> --- a/hw/virtio/virtio-bus.c
>> +++ b/hw/virtio/virtio-bus.c
>> @@ -154,12 +154,26 @@ void virtio_bus_set_vdev_config(VirtioBusState
>> *bus, uint8_t *config)
>>       }
>>   }
>>
>> +static char *virtio_bus_get_dev_path(DeviceState *dev)
>> +{
>> +    BusState *bus = qdev_get_parent_bus(dev);
>> +    DeviceState *proxy = DEVICE(bus->parent);
>> +    return qdev_get_dev_path(proxy);
>> +}
>> +
>> +static void virtio_bus_class_init(ObjectClass *klass, void *data)
>> +{
>> +    BusClass *bus_class = BUS_CLASS(klass);
>> +    bus_class->get_dev_path = virtio_bus_get_dev_path;
>> +}
>> +
>>   static const TypeInfo virtio_bus_info = {
>>       .name = TYPE_VIRTIO_BUS,
>>       .parent = TYPE_BUS,
>>       .instance_size = sizeof(VirtioBusState),
>>       .abstract = true,
>>       .class_size = sizeof(VirtioBusClass),
>> +    .class_init = virtio_bus_class_init
>>   };
>>
>>   static void virtio_register_types(void)
>> -- 
>> 1.7.11.7
>>

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2013-05-16 16:53 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-15 23:53 [Qemu-devel] [ANNOUNCE] QEMU 1.5.0-rc2 is now available Anthony Liguori
2013-05-16  3:56 ` Dongsheng Song
2013-05-16 14:21 ` mdroth
2013-05-16 14:51   ` Paolo Bonzini
2013-05-16 15:54     ` KONRAD Frédéric
2013-05-16 16:07       ` Paolo Bonzini
2013-05-16 16:34         ` KONRAD Frédéric
2013-05-16 16:49           ` mdroth
2013-05-16 16:53             ` KONRAD Frédéric
2013-05-16 16:52           ` Paolo Bonzini
2013-05-16 16:35         ` mdroth
2013-05-16 16:33       ` Anthony Liguori
2013-05-16 16:34         ` KONRAD Frédéric
2013-05-16 15:17   ` KONRAD Frédéric

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).