Skip to content

VMState cleanups and conversion of network drivers

Juan Quintela qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest25 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/25vmstate: Add support for partial buffers transmissionhw/hw.h+9 -00 replies
2/25serial: use post_load version_id field and remove pre_load functionhw/serial.c+3 -80 replies
3/25vnmstate: fix name for uint8_equalsavevm.c+1 -10 replies
4/25vmstate: add VMSTATE_UINT16_EQUAL[_V]hw/hw.h savevm.c+27 -00 replies
5/25vmstate: Rename VMS_VARRAY to VMS_VARRAY_INT32hw/fdc.c hw/hw.h savevm.c+9 -90 replies
6/25vmstate: fix indentationhw/hw.h+6 -60 replies
7/25vmstate: factor vmstate_offset_valuehw/hw.h+13 -180 replies
8/25vmstate: factor vmstate_offset_pointerhw/hw.h+5 -20 replies
9/25vmstate: factor vmstate_offset_arrayhw/hw.h+9 -100 replies
10/25vmstate: factor vmstate_offset_bufferhw/hw.h+7 -60 replies
11/25vmstate: factor VMSTATE_*BUFFER* definitionshw/hw.h+11 -210 replies
12/25vmstate: Unfold VMSTATE_INT32_VARRAY() only use and remove ithw/hw.h hw/pci.c+1 -70 replies
13/25vmstate: add VMS_VARRAY_UINT16_UNSAFE (varrays with uint16 indexes)hw/hw.h savevm.c+16 -10 replies
14/25vmstate: Add version arg to VMSTATE_SINGLE_TEST()hw/hw.h target-i386/machine.c+7 -120 replies
15/25vmstate: Add VMSTATE_BUFFER_UNUSEDhw/hw.h savevm.c+38 -00 replies
16/25vmstate: Introduce the concept of sub-arrayshw/hw.h+19 -00 replies
17/25rtl8139: port TallyCounters to vmstatehw/rtl8139.c+24 -260 replies
18/25rtl8139: port to vmstatehw/rtl8139.c+85 -2160 replies
19/25eeprom93xx: port to vmstatehw/eeprom93xx.c+49 -530 replies
20/25eepro100: port to vmstatehw/eepro100.c+60 -1350 replies
21/25pcnet: port to vmstatehw/pcnet.c+39 -710 replies
22/25ne2000: port to vmstatehw/ne2000-isa.c hw/ne2000.c hw/ne2000.h+51 -890 replies
23/25e1000: unfold mac_reg_tosave arrayhw/e1000.c+74 -130 replies
24/25e1000: unfold mac_regarraystosave arrayhw/e1000.c+14 -160 replies
25/25e1000: port to vmstatehw/e1000.c+81 -1630 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [Qemu-devel] [PATCH 00/25] VMState cleanups and conversion of network drivers

Hi

This series cleans VMState internals and port all the pc network devices to VMState (except virtio-net).
- Cleanups:
* we can send partial buffers, and clean how we do it
* refactor all the buffer code.
* refactor all the offset code
* add VARRAY_UINT16_UNSAFE: unsafe here means that type checking is off (a.k.a. as a cast in C). In this case the problem is that the last element of one struct is int foo[0], and we allocate the right size for the array we want. Problem? I haven't been able to abuse^Wuse gcc + cpp + magic to typecheck that for vmstate:

   We have
   struct FOO {
   	  int32_t foo[0];
   }
   We want to "compare the type of foo (t1) with int32_t (t2)
        ((t1(*)[n])0 - (t2*)0)
   This one don't work, because we don't have 'n'
        ((t1(**))0 - (t2*)0)
   This don't work either because t1 is one array.
        ((t1(*)[])0 - (t2*)0)

Too clever, imposible cast to on array type.
I tried some other variants, but have not able to get one that compiles.
* UNUSED support. This allows to mark some space in the VMStateDescription as "useless", that is there for backwards compatibility. We don't need a field in the State to load/save that values anymore.
* SUB_ARRAY(..,start, num, ...)
This allows us to send only slices of one array, i.e. 'num' elemns starting at position 'start'.
- Network Devices
* rtl8139; Drop support for version < 3, it don't work as non-pci anymore.
* eeprom93xx (only used by eepro100), this one was quite "interesting"
- savevm state had pading by design
- size field changed from 8 bits to 16 bits using the pading space
- VMARRAY with size uint16_t and UNSAFE was needed for this driver
- Wint the price of the more complicated conversion of the series.
* eepro100:
- really, really needed the UNUSED support
- it is the only driver so far that uses a different "name"
* pcnet: nothing special, just port
* ne2000: nothing special, just port
* e1000: after I understood the mac_reg*save arrays just
- unfold them
- save them as SUB_ARRAY
result is clear that previous code.

Reason why cleanup + devices came together is because the cleanups/additons are needed to implement this devices.

Comments?

Later, Juan.

Juan Quintela (25):
vmstate: Add support for partial buffers transmission
serial: use post_load version_id field and remove pre_load function
vnmstate: fix name for uint8_equal
vmstate: add VMSTATE_UINT16_EQUAL[_V]
vmstate: Rename VMS_VARRAY to VMS_VARRAY_INT32
vmstate: fix indentation
vmstate: factor vmstate_offset_value
vmstate: factor vmstate_offset_pointer
vmstate: factor vmstate_offset_array
vmstate: factor vmstate_offset_buffer
vmstate: factor VMSTATE_*BUFFER* definitions
vmstate: Unfold VMSTATE_INT32_VARRAY() only use and remove it
vmstate: add VMS_VARRAY_UINT16_UNSAFE (varrays with uint16 indexes)
vmstate: Add version arg to VMSTATE_SINGLE_TEST()
vmstate: Add VMSTATE_BUFFER_UNUSED
vmstate: Introduce the concept of sub-arrays
rtl8139: port TallyCounters to vmstate
rtl8139: port to vmstate
eeprom93xx: port to vmstate
eepro100: port to vmstate
pcnet: port to vmstate
ne2000: port to vmstate
e1000: unfold mac_reg_tosave array
e1000: unfold mac_regarraystosave array
e1000: port to vmstate

 hw/e1000.c            |  185 ++++++++++++---------------
 hw/eepro100.c         |  195 +++++++++-------------------
 hw/eeprom93xx.c       |  102 +++++++--------
 hw/fdc.c              |    2 +-
 hw/hw.h               |  171 +++++++++++++++---------
 hw/ne2000-isa.c       |    4 +-
 hw/ne2000.c           |  133 +++++++------------
 hw/ne2000.h           |    3 +-
 hw/pci.c              |    2 +-
 hw/pcnet.c            |  110 ++++++----------
 hw/rtl8139.c          |  347 +++++++++++++++----------------------------------
 hw/serial.c           |   11 +-
 savevm.c              |   54 +++++++-
 target-i386/machine.c |    2 +-
 14 files changed, 548 insertions(+), 773 deletions(-)