All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v3 00/17] virtio: pull headers from linux
@ 2015-02-16 21:35 Michael S. Tsirkin
  2015-02-16 21:35 ` [Qemu-devel] [PATCH v3 01/17] scripts/update-linux-headers.sh: pull virtio hdrs Michael S. Tsirkin
                   ` (16 more replies)
  0 siblings, 17 replies; 36+ messages in thread
From: Michael S. Tsirkin @ 2015-02-16 21:35 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Thomas Huth, Alexander Graf, Stefan Hajnoczi,
	Cornelia Huck, Chen, Tiejun

This reuses virtio headers from files exported by linux.
The current situation is quite messy: for example we
have multiple copies of the virtio net packet structure,
and the virtio ring structure.
We already use some of them for linux-specific code,
reusing more widely gets rid of code duplication.

One of the reasons we didn't do this previously
was portability considerations: this patchset addresses
this by fixing up headers in question - turns out to
be easy to do since they are already quite portable.

One of comments asked about support for functionality missing from linux
guests. This patchet addresses this simply by adding code in include/hw/virtio
like we did before.
One example of this is VIRTIO_NET_CTRL_GUEST_OFFLOADS command in
virtio-net, which is currently only used by windows guests.
The definition was therefore left in include/hw/virtio/virtio-net.h,
this approach makes it easy to find functionality that linux guests
are missing, which is important e.g. for testing.

Ability to synchronize headers in this way will bring long-term benefits in
case bugfixes need to apply to both host and guest.

In particular, this gives us known-good virtio 1.0 headers for free, right now.

This refactoring also better separates between guest ABI and internal
qemu functionality, which is a good thing as we need to be extra
careful about guest ABI changes.

This might also enable better static checking with sparse,
as linux tags virtio headers with correct endian-ness.
For now, sparse tags are automatically stripped, for
compatibility with existing code.

Some pieces are more widely applicable (outside virtio): e.g.
everyone will be able to pull ETH_ALEN from the
standard header.

The infrastructure also might be of use for other headers (pci_regs.h)?

s390 patches have been built and smoke-tested by Cornelia.

Tested on linux on x86 and s390 only, with windows and linux guests.
Needs windows, osx host testing.
Testing (even just build-test) reports would be very much appreciated.

changes from v2:
    - rename sys/ to linux/ to address comments by Peter and Paolo
    - address comments by Thomas

Changes from v1:
    - add s390 headers (untested)
    - add code to check no unexpected linux-specific headers are pulled in
      by mistake
    - add if_ether.h to provide ETH_ALEN for virtio net
    - move headers from standard-headers/linux to standard-headers/sys
      and put them under include so they are on search path
    - fix up __leXX
    - fix up __attribute__((packed))

Michael S. Tsirkin (17):
  scripts/update-linux-headers.sh: pull virtio hdrs
  include: import virtio headers from linux 4.0
  virtio: use standard virtio_ring.h
  virtio: use standard-headers
  virtio-balloon: use standard headers
  virtio-9p: use standard headers
  virtio-blk: switch to standard-headers
  virtio-net,tap: use standard-headers
  virtio-rng: use standard-headers
  virtio-scsi: use standard-headers
  virtio-serial: switch to standard-headers
  update-linux-headers: use standard-headers
  linux-headers: use standard-headers
  virtio-pci: use standard headers
  scripts: add arch specific standard-headers
  standard-headers: add s390 virtio headers
  s390: use standard headers

 hw/9pfs/virtio-9p.h                                |  18 +-
 hw/s390x/s390-virtio-bus.h                         |  36 ++--
 hw/s390x/s390-virtio.h                             |   7 +-
 include/hw/virtio/dataplane/vring.h                |   2 +-
 include/hw/virtio/virtio-balloon.h                 |  35 +---
 include/hw/virtio/virtio-blk.h                     |  77 +------
 include/hw/virtio/virtio-net.h                     | 151 +------------
 include/hw/virtio/virtio-rng.h                     |   4 +-
 include/hw/virtio/virtio-scsi.h                    | 120 +----------
 include/hw/virtio/virtio-serial.h                  |  40 +---
 include/hw/virtio/virtio.h                         |  48 +----
 include/net/tap.h                                  |  24 +--
 include/standard-headers/asm-s390/kvm_virtio.h     |  64 ++++++
 include/standard-headers/asm-s390/virtio-ccw.h     |  21 ++
 include/standard-headers/linux/if_ether.h          |   1 +
 include/standard-headers/linux/types.h             |   2 +
 include/standard-headers/linux/virtio_9p.h         |  44 ++++
 include/standard-headers/linux/virtio_balloon.h    |  59 ++++++
 include/standard-headers/linux/virtio_blk.h        | 143 +++++++++++++
 include/standard-headers/linux/virtio_config.h     |  64 ++++++
 include/standard-headers/linux/virtio_console.h    |  78 +++++++
 include/standard-headers/linux/virtio_ids.h        |  43 ++++
 include/standard-headers/linux/virtio_net.h        | 233 +++++++++++++++++++++
 include/standard-headers/linux/virtio_pci.h        | 193 +++++++++++++++++
 .../linux}/virtio_ring.h                           | 138 ++++++------
 include/standard-headers/linux/virtio_rng.h        |   8 +
 include/standard-headers/linux/virtio_scsi.h       | 164 +++++++++++++++
 include/standard-headers/linux/virtio_types.h      |  46 ++++
 linux-headers/linux/virtio_config.h                |  58 +----
 linux-headers/linux/virtio_ring.h                  | 164 +--------------
 hw/block/virtio-blk.c                              |   8 +-
 hw/char/virtio-serial-bus.c                        |   1 +
 hw/net/vhost_net.c                                 |   2 +-
 hw/scsi/virtio-scsi.c                              |   1 +
 hw/virtio/virtio-pci.c                             |  54 +----
 hw/virtio/virtio.c                                 |  23 +-
 scripts/update-linux-headers.sh                    |  51 ++++-
 37 files changed, 1345 insertions(+), 880 deletions(-)
 create mode 100644 include/standard-headers/asm-s390/kvm_virtio.h
 create mode 100644 include/standard-headers/asm-s390/virtio-ccw.h
 create mode 100644 include/standard-headers/linux/if_ether.h
 create mode 100644 include/standard-headers/linux/types.h
 create mode 100644 include/standard-headers/linux/virtio_9p.h
 create mode 100644 include/standard-headers/linux/virtio_balloon.h
 create mode 100644 include/standard-headers/linux/virtio_blk.h
 create mode 100644 include/standard-headers/linux/virtio_config.h
 create mode 100644 include/standard-headers/linux/virtio_console.h
 create mode 100644 include/standard-headers/linux/virtio_ids.h
 create mode 100644 include/standard-headers/linux/virtio_net.h
 create mode 100644 include/standard-headers/linux/virtio_pci.h
 rename include/{hw/virtio => standard-headers/linux}/virtio_ring.h (57%)
 create mode 100644 include/standard-headers/linux/virtio_rng.h
 create mode 100644 include/standard-headers/linux/virtio_scsi.h
 create mode 100644 include/standard-headers/linux/virtio_types.h

-- 
MST

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

end of thread, other threads:[~2015-03-11 13:06 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-16 21:35 [Qemu-devel] [PATCH v3 00/17] virtio: pull headers from linux Michael S. Tsirkin
2015-02-16 21:35 ` [Qemu-devel] [PATCH v3 01/17] scripts/update-linux-headers.sh: pull virtio hdrs Michael S. Tsirkin
2015-02-16 21:35 ` [Qemu-devel] [PATCH v3 02/17] include: import virtio headers from linux 4.0 Michael S. Tsirkin
2015-02-17 12:45   ` Thomas Huth
2015-02-18 15:01     ` Michael S. Tsirkin
2015-02-16 21:35 ` [Qemu-devel] [PATCH v3 03/17] virtio: use standard virtio_ring.h Michael S. Tsirkin
2015-02-17 12:44   ` Thomas Huth
2015-02-18 14:59     ` Michael S. Tsirkin
2015-02-16 21:35 ` [Qemu-devel] [PATCH v3 04/17] virtio: use standard-headers Michael S. Tsirkin
2015-02-17 13:16   ` Thomas Huth
2015-02-16 21:35 ` [Qemu-devel] [PATCH v3 05/17] virtio-balloon: use standard headers Michael S. Tsirkin
2015-02-17 13:25   ` Thomas Huth
2015-02-16 21:35 ` [Qemu-devel] [PATCH v3 06/17] virtio-9p: " Michael S. Tsirkin
2015-02-17 13:42   ` Thomas Huth
2015-02-16 21:36 ` [Qemu-devel] [PATCH v3 07/17] virtio-blk: switch to standard-headers Michael S. Tsirkin
2015-02-18  9:19   ` Thomas Huth
2015-02-16 21:36 ` [Qemu-devel] [PATCH v3 08/17] virtio-net, tap: use standard-headers Michael S. Tsirkin
2015-02-18  9:30   ` Thomas Huth
2015-02-16 21:36 ` [Qemu-devel] [PATCH v3 09/17] virtio-rng: " Michael S. Tsirkin
2015-02-18  9:32   ` Thomas Huth
2015-02-16 21:36 ` [Qemu-devel] [PATCH v3 10/17] virtio-scsi: " Michael S. Tsirkin
2015-02-17 14:13   ` Paolo Bonzini
2015-03-11 10:54   ` Nikunj A Dadhania
2015-03-11 12:03     ` Michael S. Tsirkin
2015-03-11 13:06       ` Nikunj A Dadhania
2015-02-16 21:36 ` [Qemu-devel] [PATCH v3 11/17] virtio-serial: switch to standard-headers Michael S. Tsirkin
2015-02-18 14:34   ` Thomas Huth
2015-02-18 14:55     ` Michael S. Tsirkin
2015-02-18 15:36       ` Thomas Huth
2015-02-18 15:41         ` Michael S. Tsirkin
2015-02-16 21:36 ` [Qemu-devel] [PATCH v3 12/17] update-linux-headers: use standard-headers Michael S. Tsirkin
2015-02-16 21:36 ` [Qemu-devel] [PATCH v3 13/17] linux-headers: " Michael S. Tsirkin
2015-02-16 21:36 ` [Qemu-devel] [PATCH v3 14/17] virtio-pci: use standard headers Michael S. Tsirkin
2015-02-16 21:36 ` [Qemu-devel] [PATCH v3 15/17] scripts: add arch specific standard-headers Michael S. Tsirkin
2015-02-16 21:36 ` [Qemu-devel] [PATCH v3 16/17] standard-headers: add s390 virtio headers Michael S. Tsirkin
2015-02-16 21:36 ` [Qemu-devel] [PATCH v3 17/17] s390: use standard headers Michael S. Tsirkin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.