All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 00/13] Make Q35 devices closer to Qemu object model.
@ 2016-06-17 13:10 Efimov Vasily
  2016-06-17 13:10 ` [Qemu-devel] [PATCH 01/13] ide: move headers to include folder Efimov Vasily
                   ` (12 more replies)
  0 siblings, 13 replies; 31+ messages in thread
From: Efimov Vasily @ 2016-06-17 13:10 UTC (permalink / raw)
  To: qemu-devel
  Cc: Efimov Vasily, John Snow, qemu-block, Gerd Hoffmann,
	Michael S. Tsirkin, Kevin Wolf, Max Reitz, Paolo Bonzini,
	Richard Henderson, Eduardo Habkost, Peter Maydell,
	Kirill Batuzov

The patch series makes several devices closer to Qemu object model.

I am developing a tool that automatize creation of device and machine models.

Recently, I've take part in development of several models. And I noticed that
a significant part of code is same. The examples are:
- Each device represented by a header and a source.
- The device or machine class is described by a set of callbacks containing in
TypeInfo structure.
- Each TypeInfo structure is accounted by a register function.
- A register function is sheduled by a type_init macro.
- Class and state structures of an inherited type are prepended by ones of the
parent type.
- A device must have VM state description.
- A device or a machine can have properties.
- A device can use internal APIs such as: timer, chardev, blockdev, IRQ,
system bys memory and port mapping, PCI BARs, PCI MSI(X), etc.
- A machine consists of devices and memory tree. Devices are linked by IRQs and
buses and assigned property values.
- All of the above should follow the Qemu coding style.

For every listed item can be generated a stub code. All stubs can be generated
with respect to each other forming compileable device (or machine). Ideally,
a programmer have to implement custom device/machine logic and to assign
meaningful names to variables, functions, macroses etc. using a refactoring
tool.

Of cource, a device/machine description for the tool has to be significantly
smaller than the code the tool produced. A GUI constructor is preferred too.

I've chosed Q35 machine to test the tool. The Q35 is one of the most 
complex boards. I have implemented 64-bit CPU, soft MMU, 1GB RAM, 1 HDD,
PCI, USB machine variant. Most of devices is instantiated using the object
model. Some logic (I/O port 80, I/O port F0, A20 line) is dedicated to new
devices. The stubs for thay is also generated by the tool.

In course of implementing Q35 I've noticed that some device models does not
follow Qemu object model close enough. The patch series is desined to make them
closer.


Efimov Vasily (13):
  ide: move headers to include folder
  pcspk: convert "pit" property type from ptr to link
  vmport: identify vmport type by macro TYPE_VMPORT
  pflash: make TYPE_CFI_PFLASH0{1,2} macros public
  Q35: implement property interfece to several parameters
  pc_q35: configure Q35 instance using properties
  pckbd: handle A20 IRQ as GPIO
  port92: handle A20 IRQ as GPIO
  ICH9 SMB: make TYPE_ICH9_SMB_DEVICE macro public
  ICH9 LPC: handle PIC and I/O APIC IRQs as qdev GPIO
  ICH9 LPC: move call of isa_bus_irqs to 'realize' method
  MC146818 RTC: add GPIO access to output IRQ
  ICH9 LPC: configure PCI IRQs routing internally

 hw/audio/pcspk.c          |   7 +-
 hw/block/pflash_cfi01.c   |   1 -
 hw/block/pflash_cfi02.c   |   1 -
 hw/i2c/smbus_ich9.c       |   1 -
 hw/i386/pc.c              |  10 +-
 hw/i386/pc_q35.c          |  35 ++-
 hw/ide/ahci.c             |   2 +-
 hw/ide/ahci.h             | 405 -----------------------------
 hw/ide/internal.h         | 635 ----------------------------------------------
 hw/ide/pci.h              |  76 ------
 hw/input/pckbd.c          |  21 +-
 hw/isa/lpc_ich9.c         |  16 +-
 hw/misc/vmport.c          |   1 -
 hw/pci-host/q35.c         |  20 ++
 hw/timer/mc146818rtc.c    |   4 +-
 include/hw/audio/pcspk.h  |   2 +-
 include/hw/block/flash.h  |   3 +
 include/hw/i386/ich9.h    |   9 +-
 include/hw/i386/pc.h      |   5 +-
 include/hw/ide/ahci.h     | 405 +++++++++++++++++++++++++++++
 include/hw/ide/internal.h | 635 ++++++++++++++++++++++++++++++++++++++++++++++
 include/hw/ide/pci.h      |  76 ++++++
 include/hw/pci-host/q35.h |   5 +
 23 files changed, 1208 insertions(+), 1167 deletions(-)
 delete mode 100644 hw/ide/ahci.h
 delete mode 100644 hw/ide/internal.h
 delete mode 100644 hw/ide/pci.h
 create mode 100644 include/hw/ide/ahci.h
 create mode 100644 include/hw/ide/internal.h
 create mode 100644 include/hw/ide/pci.h

-- 
2.7.4

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

end of thread, other threads:[~2016-06-21 17:08 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-17 13:10 [Qemu-devel] [PATCH 00/13] Make Q35 devices closer to Qemu object model Efimov Vasily
2016-06-17 13:10 ` [Qemu-devel] [PATCH 01/13] ide: move headers to include folder Efimov Vasily
2016-06-17 13:18   ` Paolo Bonzini
2016-06-17 13:10 ` [Qemu-devel] [PATCH 02/13] pcspk: convert "pit" property type from ptr to link Efimov Vasily
2016-06-17 13:19   ` Paolo Bonzini
2016-06-17 13:20   ` Paolo Bonzini
2016-06-17 13:10 ` [Qemu-devel] [PATCH 03/13] vmport: identify vmport type by macro TYPE_VMPORT Efimov Vasily
2016-06-17 13:19   ` Paolo Bonzini
2016-06-17 13:11 ` [Qemu-devel] [PATCH 04/13] pflash: make TYPE_CFI_PFLASH0{1, 2} macros public Efimov Vasily
2016-06-17 13:19   ` Paolo Bonzini
2016-06-17 13:11 ` [Qemu-devel] [PATCH 05/13] Q35: implement property interfece to several parameters Efimov Vasily
2016-06-17 13:20   ` Paolo Bonzini
2016-06-17 13:11 ` [Qemu-devel] [PATCH 06/13] pc_q35: configure Q35 instance using properties Efimov Vasily
2016-06-17 13:20   ` Paolo Bonzini
2016-06-17 13:11 ` [Qemu-devel] [PATCH 07/13] pckbd: handle A20 IRQ as GPIO Efimov Vasily
2016-06-17 13:23   ` Paolo Bonzini
2016-06-17 13:11 ` [Qemu-devel] [PATCH 08/13] port92: " Efimov Vasily
2016-06-17 13:24   ` Paolo Bonzini
2016-06-17 13:11 ` [Qemu-devel] [PATCH 09/13] ICH9 SMB: make TYPE_ICH9_SMB_DEVICE macro public Efimov Vasily
2016-06-17 13:25   ` Paolo Bonzini
2016-06-17 13:11 ` [Qemu-devel] [PATCH 10/13] ICH9 LPC: handle PIC and I/O APIC IRQs as qdev GPIO Efimov Vasily
2016-06-17 13:26   ` Paolo Bonzini
2016-06-17 13:11 ` [Qemu-devel] [PATCH 11/13] ICH9 LPC: move call of isa_bus_irqs to 'realize' method Efimov Vasily
2016-06-17 14:03   ` Paolo Bonzini
2016-06-20 14:40     ` Paolo Bonzini
2016-06-21 13:46       ` Ефимов Василий
2016-06-21 17:08         ` Paolo Bonzini
2016-06-17 13:11 ` [Qemu-devel] [PATCH 12/13] MC146818 RTC: add GPIO access to output IRQ Efimov Vasily
2016-06-17 14:08   ` Paolo Bonzini
2016-06-17 13:11 ` [Qemu-devel] [PATCH 13/13] ICH9 LPC: configure PCI IRQs routing internally Efimov Vasily
2016-06-17 14:11   ` Paolo Bonzini

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.