Skip to contentSkip to conversation

First steps towards documenting qdev devices/options

PATCH Superseded Amit Shah 2 participants 10 messages Sep 15, 2010 – Sep 28, 2010 Arm/Zynq architecture

lore
Share & tools
lore

Amit Shah

author
#0 lore raw

cover First steps towards documenting qdev devices/options

Hello,

This is a rebase of the patchset I'd sent earlier.

I add the 4/4 patch, documenting common block device properties. Other than that, the usual notes apply: this is just the start, just getting the framework in place and a few examples so that people can then pick up and start documenting their devices and options. We want to see all of the devices covered, and hopefully turn on build_bug_on() on an empty doc string.

Maintainers should perhaps also look for patches that introduce options without documentation.

That's the long-term goal (over 0.14). For short-term, I'll be preparing follow-on patches that add doc strings for a few more options and perhaps bug people based on git history as to what documentation is to be added for some options.

If this looks acceptable, please apply!

Amit Shah (4):
qdev: Add a description field for qdev properties for documentation
virtio-serial: Add description fields for qdev properties net.h: Add description fields for qdev properites block_int.h: Provide documentation for common block qdev properties

 block_int.h           |   14 +++++----
 hw/a9mpcore.c         |    2 +-
 hw/acpi_piix4.c       |    2 +-
 hw/apic.c             |    4 +-
 hw/applesmc.c         |    4 +-
 hw/arm11mpcore.c      |    4 +-
 hw/arm_sysctl.c       |    4 +-
 hw/armv7m.c           |    2 +-
 hw/cs4231a.c          |    6 ++--
 hw/debugcon.c         |    6 ++--
 hw/eccmemctl.c        |    2 +-
 hw/escc.c             |   16 +++++-----
 hw/etraxfs_pic.c      |    3 +-
 hw/fdc.c              |   10 +++---
 hw/fw_cfg.c           |    4 +-
 hw/gus.c              |    8 ++--
 hw/hpet.c             |    4 +-
 hw/i2c.c              |    2 +-
 hw/ide/cmd646.c       |    2 +-
 hw/ide/isa.c          |    6 ++--
 hw/ide/qdev.c         |    6 ++--
 hw/integratorcp.c     |    2 +-
 hw/ivshmem.c          |   15 +++++----
 hw/lance.c            |    2 +-
 hw/m48t59.c           |   12 ++++----
 hw/mc146818rtc.c      |    2 +-
 hw/ne2000-isa.c       |    4 +-
 hw/parallel.c         |    8 ++--
 hw/pci.c              |   12 ++++----
 hw/qdev-addr.h        |    4 +-
 hw/qdev.c             |    3 +-
 hw/qdev.h             |   75 ++++++++++++++++++++++++++-----------------------
 hw/s390-virtio-bus.c  |    2 +-
 hw/sb16.c             |   10 +++---
 hw/scsi-bus.c         |    2 +-
 hw/scsi-disk.c        |    4 +-
 hw/serial.c           |    8 ++--
 hw/slavio_timer.c     |    2 +-
 hw/smbus_eeprom.c     |    2 +-
 hw/sparc32_dma.c      |    2 +-
 hw/sun4m.c            |    2 +-
 hw/sun4m_iommu.c      |    2 +-
 hw/sun4u.c            |    2 +-
 hw/syborg_fb.c        |    4 +-
 hw/syborg_interrupt.c |    2 +-
 hw/syborg_keyboard.c  |    2 +-
 hw/syborg_pointer.c   |    4 +-
 hw/syborg_serial.c    |    2 +-
 hw/syborg_timer.c     |    2 +-
 hw/syborg_virtio.c    |    6 ++--
 hw/tcx.c              |   10 +++---
 hw/usb-ohci.c         |    4 +-
 hw/usb-serial.c       |   12 ++++----
 hw/vga-pci.c          |    4 +-
 hw/virtio-blk.h       |    4 +-
 hw/virtio-console.c   |   19 ++++++++----
 hw/virtio-net.h       |   51 +++++++++++++++++++++------------
 hw/virtio-pci.c       |   22 +++++++-------
 hw/virtio-serial.h    |   13 ++++++++
 hw/virtio.h           |    2 +-
 hw/vt82c686.c         |    2 +-
 hw/xilinx_ethlite.c   |    6 ++-
 hw/xilinx_intc.c      |    3 +-
 hw/xilinx_timer.c     |    4 +-
 net.h                 |    9 ++++--
 usb-linux.c           |    8 ++--
 66 files changed, 266 insertions(+), 217 deletions(-)
Signature · 1 line
1.7.2.2
author
#1 lore raw

PATCH 1/4 qdev: Add a description field for qdev properties for documentation

Add a 'description' along with each qdev property to document the input each qdev property takes.

---
 block_int.h           |   10 +++---
 hw/a9mpcore.c         |    2 +-
 hw/acpi_piix4.c       |    2 +-
 hw/apic.c             |    4 +-
 hw/applesmc.c         |    4 +-
 hw/arm11mpcore.c      |    4 +-
 hw/arm_sysctl.c       |    4 +-
 hw/armv7m.c           |    2 +-
 hw/cs4231a.c          |    6 ++--
 hw/debugcon.c         |    6 ++--
 hw/eccmemctl.c        |    2 +-
 hw/escc.c             |   16 +++++-----
 hw/etraxfs_pic.c      |    3 +-
 hw/fdc.c              |   10 +++---
 hw/fw_cfg.c           |    4 +-
 hw/gus.c              |    8 ++--
 hw/hpet.c             |    4 +-
 hw/i2c.c              |    2 +-
 hw/ide/cmd646.c       |    2 +-
 hw/ide/isa.c          |    6 ++--
 hw/ide/qdev.c         |    6 ++--
 hw/integratorcp.c     |    2 +-
 hw/ivshmem.c          |   15 +++++----
 hw/lance.c            |    2 +-
 hw/m48t59.c           |   12 ++++----
 hw/mc146818rtc.c      |    2 +-
 hw/ne2000-isa.c       |    4 +-
 hw/parallel.c         |    8 ++--
 hw/pci.c              |   12 ++++----
 hw/qdev-addr.h        |    4 +-
 hw/qdev.c             |    3 +-
 hw/qdev.h             |   75 ++++++++++++++++++++++++++-----------------------
 hw/s390-virtio-bus.c  |    2 +-
 hw/sb16.c             |   10 +++---
 hw/scsi-bus.c         |    2 +-
 hw/scsi-disk.c        |    4 +-
 hw/serial.c           |    8 ++--
 hw/slavio_timer.c     |    2 +-
 hw/smbus_eeprom.c     |    2 +-
 hw/sparc32_dma.c      |    2 +-
 hw/sun4m.c            |    2 +-
 hw/sun4m_iommu.c      |    2 +-
 hw/sun4u.c            |    2 +-
 hw/syborg_fb.c        |    4 +-
 hw/syborg_interrupt.c |    2 +-
 hw/syborg_keyboard.c  |    2 +-
 hw/syborg_pointer.c   |    4 +-
 hw/syborg_serial.c    |    2 +-
 hw/syborg_timer.c     |    2 +-
 hw/syborg_virtio.c    |    6 ++--
 hw/tcx.c              |   10 +++---
 hw/usb-ohci.c         |    4 +-
 hw/usb-serial.c       |   12 ++++----
 hw/vga-pci.c          |    4 +-
 hw/virtio-blk.h       |    4 +-
 hw/virtio-console.c   |   16 ++++++----
 hw/virtio-net.h       |   51 +++++++++++++++++++++------------
 hw/virtio-pci.c       |   22 +++++++-------
 hw/virtio.h           |    2 +-
 hw/vt82c686.c         |    2 +-
 hw/xilinx_ethlite.c   |    6 ++-
 hw/xilinx_intc.c      |    3 +-
 hw/xilinx_timer.c     |    4 +-
 net.h                 |    6 ++--
 usb-linux.c           |    8 ++--
 65 files changed, 244 insertions(+), 216 deletions(-)
block_int.h +5 -5
index e8e7156..ce20285 100644
@@ -241,12 +241,12 @@ static inline unsigned int get_physical_block_exp(BlockConf *conf)
 }
 
 #define DEFINE_BLOCK_PROPERTIES(_state, _conf)                          \
-    DEFINE_PROP_DRIVE("drive", _state, _conf.bs),                       \
+    DEFINE_PROP_DRIVE("drive", _state, _conf.bs, ""),                   \
     DEFINE_PROP_UINT16("logical_block_size", _state,                    \
-                       _conf.logical_block_size, 512),                  \
+                       _conf.logical_block_size, 512, ""),              \
     DEFINE_PROP_UINT16("physical_block_size", _state,                   \
-                       _conf.physical_block_size, 512),                 \
-    DEFINE_PROP_UINT16("min_io_size", _state, _conf.min_io_size, 0),  \
-    DEFINE_PROP_UINT32("opt_io_size", _state, _conf.opt_io_size, 0)
+                       _conf.physical_block_size, 512, ""),             \
+    DEFINE_PROP_UINT16("min_io_size", _state, _conf.min_io_size, 0, ""), \
+    DEFINE_PROP_UINT32("opt_io_size", _state, _conf.opt_io_size, 0, "")
 
 #endif /* BLOCK_INT_H */
hw/a9mpcore.c +1 -1
index b5e5328..174f5d5 100644
@@ -16,7 +16,7 @@ static SysBusDeviceInfo mpcore_priv_info = {
     .qdev.name  = "a9mpcore_priv",
     .qdev.size  = sizeof(mpcore_priv_state),
     .qdev.props = (Property[]) {
-        DEFINE_PROP_UINT32("num-cpu", mpcore_priv_state, num_cpu, 1),
+        DEFINE_PROP_UINT32("num-cpu", mpcore_priv_state, num_cpu, 1, ""),
         DEFINE_PROP_END_OF_LIST(),
     }
 };
hw/acpi_piix4.c +1 -1
index bfa1d9a..4963afa 100644
@@ -437,7 +437,7 @@ static PCIDeviceInfo piix4_pm_info = {
     .init               = piix4_pm_initfn,
     .config_write       = pm_write_config,
     .qdev.props         = (Property[]) {
-        DEFINE_PROP_UINT32("smb_io_base", PIIX4PMState, smb_io_base, 0),
+        DEFINE_PROP_UINT32("smb_io_base", PIIX4PMState, smb_io_base, 0, ""),
         DEFINE_PROP_END_OF_LIST(),
     }
 };
hw/apic.c +2 -2
index d686b51..2ef5a03 100644
@@ -1005,8 +1005,8 @@ static SysBusDeviceInfo apic_info = {
     .qdev.reset = apic_reset,
     .qdev.no_user = 1,
     .qdev.props = (Property[]) {
-        DEFINE_PROP_UINT8("id", APICState, id, -1),
-        DEFINE_PROP_PTR("cpu_env", APICState, cpu_env),
+        DEFINE_PROP_UINT8("id", APICState, id, -1, ""),
+        DEFINE_PROP_PTR("cpu_env", APICState, cpu_env, ""),
         DEFINE_PROP_END_OF_LIST(),
     }
 };
hw/applesmc.c +2 -2
index 29b9330..9803be6 100644
@@ -227,8 +227,8 @@ static ISADeviceInfo applesmc_isa_info = {
     .init       = applesmc_isa_init,
     .qdev.props = (Property[]) {
         DEFINE_PROP_HEX32("iobase", struct AppleSMCStatus, iobase,
-                          APPLESMC_DEFAULT_IOBASE),
-        DEFINE_PROP_STRING("osk", struct AppleSMCStatus, osk),
+                          APPLESMC_DEFAULT_IOBASE, ""),
+        DEFINE_PROP_STRING("osk", struct AppleSMCStatus, osk, ""),
         DEFINE_PROP_END_OF_LIST(),
     },
 };
hw/arm11mpcore.c +2 -2
index 3bbd885..a3a7a9d 100644
@@ -88,7 +88,7 @@ static SysBusDeviceInfo mpcore_rirq_info = {
     .qdev.name  = "realview_mpcore",
     .qdev.size  = sizeof(mpcore_rirq_state),
     .qdev.props = (Property[]) {
-        DEFINE_PROP_UINT32("num-cpu", mpcore_rirq_state, num_cpu, 1),
+        DEFINE_PROP_UINT32("num-cpu", mpcore_rirq_state, num_cpu, 1, ""),
         DEFINE_PROP_END_OF_LIST(),
     }
 };
@@ -98,7 +98,7 @@ static SysBusDeviceInfo mpcore_priv_info = {
     .qdev.name  = "arm11mpcore_priv",
     .qdev.size  = sizeof(mpcore_priv_state),
     .qdev.props = (Property[]) {
-        DEFINE_PROP_UINT32("num-cpu", mpcore_priv_state, num_cpu, 1),
+        DEFINE_PROP_UINT32("num-cpu", mpcore_priv_state, num_cpu, 1, ""),
         DEFINE_PROP_END_OF_LIST(),
     }
 };
hw/arm_sysctl.c +2 -2
index 0cb2ffc..b35d269 100644
@@ -232,8 +232,8 @@ static SysBusDeviceInfo arm_sysctl_info = {
     .qdev.size  = sizeof(arm_sysctl_state),
     .qdev.reset = arm_sysctl_reset,
     .qdev.props = (Property[]) {
-        DEFINE_PROP_UINT32("sys_id", arm_sysctl_state, sys_id, 0),
-        DEFINE_PROP_UINT32("proc_id", arm_sysctl_state, proc_id, 0),
+        DEFINE_PROP_UINT32("sys_id", arm_sysctl_state, sys_id, 0, ""),
+        DEFINE_PROP_UINT32("proc_id", arm_sysctl_state, proc_id, 0, ""),
         DEFINE_PROP_END_OF_LIST(),
     }
 };
hw/armv7m.c +1 -1
index 588ec98..eb2b9ff 100644
@@ -250,7 +250,7 @@ static SysBusDeviceInfo bitband_info = {
     .qdev.name  = "ARM,bitband-memory",
     .qdev.size  = sizeof(BitBandState),
     .qdev.props = (Property[]) {
-        DEFINE_PROP_UINT32("base", BitBandState, base, 0),
+        DEFINE_PROP_UINT32("base", BitBandState, base, 0, ""),
         DEFINE_PROP_END_OF_LIST(),
     }
 };
hw/cs4231a.c +3 -3
index 4d5ce5c..330dd4a 100644
@@ -671,9 +671,9 @@ static ISADeviceInfo cs4231a_info = {
     .qdev.vmsd     = &vmstate_cs4231a,
     .init          = cs4231a_initfn,
     .qdev.props    = (Property[]) {
-        DEFINE_PROP_HEX32  ("iobase",  CSState, port, 0x534),
-        DEFINE_PROP_UINT32 ("irq",     CSState, irq,  9),
-        DEFINE_PROP_UINT32 ("dma",     CSState, dma,  3),
+        DEFINE_PROP_HEX32  ("iobase",  CSState, port, 0x534, ""),
+        DEFINE_PROP_UINT32 ("irq",     CSState, irq,  9,     ""),
+        DEFINE_PROP_UINT32 ("dma",     CSState, dma,  3,     ""),
         DEFINE_PROP_END_OF_LIST (),
     },
 };
hw/debugcon.c +3 -3
index 5ee6821..a1e06ee 100644
@@ -92,9 +92,9 @@ static ISADeviceInfo debugcon_isa_info = {
     .qdev.size  = sizeof(ISADebugconState),
     .init       = debugcon_isa_initfn,
     .qdev.props = (Property[]) {
-        DEFINE_PROP_HEX32("iobase", ISADebugconState, iobase, 0xe9),
-        DEFINE_PROP_CHR("chardev",  ISADebugconState, state.chr),
-        DEFINE_PROP_HEX32("readback", ISADebugconState, state.readback, 0xe9),
+        DEFINE_PROP_HEX32("iobase", ISADebugconState, iobase, 0xe9, ""),
+        DEFINE_PROP_CHR("chardev",  ISADebugconState, state.chr, ""),
+        DEFINE_PROP_HEX32("readback", ISADebugconState, state.readback, 0xe9, ""),
         DEFINE_PROP_END_OF_LIST(),
     },
 };
hw/eccmemctl.c +1 -1
index 498c61a..442a695 100644
@@ -324,7 +324,7 @@ static SysBusDeviceInfo ecc_info = {
     .qdev.vmsd  = &vmstate_ecc,
     .qdev.reset = ecc_reset,
     .qdev.props = (Property[]) {
-        DEFINE_PROP_HEX32("version", ECCState, version, -1),
+        DEFINE_PROP_HEX32("version", ECCState, version, -1, ""),
         DEFINE_PROP_END_OF_LIST(),
     }
 };
hw/escc.c +8 -8
index 8714239..0960c17 100644
@@ -936,14 +936,14 @@ static SysBusDeviceInfo escc_info = {
     .qdev.vmsd  = &vmstate_escc,
     .qdev.reset = escc_reset,
     .qdev.props = (Property[]) {
-        DEFINE_PROP_UINT32("frequency", SerialState, frequency,   0),
-        DEFINE_PROP_UINT32("it_shift",  SerialState, it_shift,    0),
-        DEFINE_PROP_UINT32("disabled",  SerialState, disabled,    0),
-        DEFINE_PROP_UINT32("disabled",  SerialState, disabled,    0),
-        DEFINE_PROP_UINT32("chnBtype",  SerialState, chn[0].type, 0),
-        DEFINE_PROP_UINT32("chnAtype",  SerialState, chn[1].type, 0),
-        DEFINE_PROP_CHR("chrB", SerialState, chn[0].chr),
-        DEFINE_PROP_CHR("chrA", SerialState, chn[1].chr),
+        DEFINE_PROP_UINT32("frequency", SerialState, frequency,   0, ""),
+        DEFINE_PROP_UINT32("it_shift",  SerialState, it_shift,    0, ""),
+        DEFINE_PROP_UINT32("disabled",  SerialState, disabled,    0, ""),
+        DEFINE_PROP_UINT32("disabled",  SerialState, disabled,    0, ""),
+        DEFINE_PROP_UINT32("chnBtype",  SerialState, chn[0].type, 0, ""),
+        DEFINE_PROP_UINT32("chnAtype",  SerialState, chn[1].type, 0, ""),
+        DEFINE_PROP_CHR("chrB", SerialState, chn[0].chr, ""),
+        DEFINE_PROP_CHR("chrA", SerialState, chn[1].chr, ""),
         DEFINE_PROP_END_OF_LIST(),
     }
 };
hw/etraxfs_pic.c +2 -1
index b2c4859..3cb6638 100644
@@ -155,7 +155,8 @@ static SysBusDeviceInfo etraxfs_pic_info = {
     .qdev.name  = "etraxfs,pic",
     .qdev.size  = sizeof(struct etrax_pic),
     .qdev.props = (Property[]) {
-        DEFINE_PROP_PTR("interrupt_vector", struct etrax_pic, interrupt_vector),
+        DEFINE_PROP_PTR("interrupt_vector", struct etrax_pic, interrupt_vector,
+                        ""),
         DEFINE_PROP_END_OF_LIST(),
     }
 };
hw/fdc.c +5 -5
index c159dcb..0c977e9 100644
@@ -2045,8 +2045,8 @@ static ISADeviceInfo isa_fdc_info = {
     .qdev.vmsd  = &vmstate_isa_fdc,
     .qdev.reset = fdctrl_external_reset_isa,
     .qdev.props = (Property[]) {
-        DEFINE_PROP_DRIVE("driveA", FDCtrlISABus, state.drives[0].bs),
-        DEFINE_PROP_DRIVE("driveB", FDCtrlISABus, state.drives[1].bs),
+        DEFINE_PROP_DRIVE("driveA", FDCtrlISABus, state.drives[0].bs, ""),
+        DEFINE_PROP_DRIVE("driveB", FDCtrlISABus, state.drives[1].bs, ""),
         DEFINE_PROP_END_OF_LIST(),
     },
 };
@@ -2068,8 +2068,8 @@ static SysBusDeviceInfo sysbus_fdc_info = {
     .qdev.vmsd  = &vmstate_sysbus_fdc,
     .qdev.reset = fdctrl_external_reset_sysbus,
     .qdev.props = (Property[]) {
-        DEFINE_PROP_DRIVE("driveA", FDCtrlSysBus, state.drives[0].bs),
-        DEFINE_PROP_DRIVE("driveB", FDCtrlSysBus, state.drives[1].bs),
+        DEFINE_PROP_DRIVE("driveA", FDCtrlSysBus, state.drives[0].bs, ""),
+        DEFINE_PROP_DRIVE("driveB", FDCtrlSysBus, state.drives[1].bs, ""),
         DEFINE_PROP_END_OF_LIST(),
     },
 };
@@ -2081,7 +2081,7 @@ static SysBusDeviceInfo sun4m_fdc_info = {
     .qdev.vmsd  = &vmstate_sysbus_fdc,
     .qdev.reset = fdctrl_external_reset_sysbus,
     .qdev.props = (Property[]) {
-        DEFINE_PROP_DRIVE("drive", FDCtrlSysBus, state.drives[0].bs),
+        DEFINE_PROP_DRIVE("drive", FDCtrlSysBus, state.drives[0].bs, ""),
         DEFINE_PROP_END_OF_LIST(),
     },
 };
hw/fw_cfg.c +2 -2
index 72866ae..e806215 100644
@@ -385,8 +385,8 @@ static SysBusDeviceInfo fw_cfg_info = {
     .qdev.reset = fw_cfg_reset,
     .qdev.no_user = 1,
     .qdev.props = (Property[]) {
-        DEFINE_PROP_HEX32("ctl_iobase", FWCfgState, ctl_iobase, -1),
-        DEFINE_PROP_HEX32("data_iobase", FWCfgState, data_iobase, -1),
+        DEFINE_PROP_HEX32("ctl_iobase", FWCfgState, ctl_iobase, -1, ""),
+        DEFINE_PROP_HEX32("data_iobase", FWCfgState, data_iobase, -1, ""),
         DEFINE_PROP_END_OF_LIST(),
     },
 };
hw/gus.c +4 -4
index e9016d8..2c37ff9 100644
@@ -303,10 +303,10 @@ static ISADeviceInfo gus_info = {
     .qdev.vmsd     = &vmstate_gus,
     .init          = gus_initfn,
     .qdev.props    = (Property[]) {
-        DEFINE_PROP_UINT32 ("freq",    GUSState, freq,        44100),
-        DEFINE_PROP_HEX32  ("iobase",  GUSState, port,        0x240),
-        DEFINE_PROP_UINT32 ("irq",     GUSState, emu.gusirq,  7),
-        DEFINE_PROP_UINT32 ("dma",     GUSState, emu.gusdma,  3),
+        DEFINE_PROP_UINT32 ("freq",    GUSState, freq,        44100, ""),
+        DEFINE_PROP_HEX32  ("iobase",  GUSState, port,        0x240, ""),
+        DEFINE_PROP_UINT32 ("irq",     GUSState, emu.gusirq,  7,     ""),
+        DEFINE_PROP_UINT32 ("dma",     GUSState, emu.gusdma,  3,     ""),
         DEFINE_PROP_END_OF_LIST (),
     },
 };
hw/hpet.c +2 -2
index d5c406c..c31f11f 100644
@@ -733,8 +733,8 @@ static SysBusDeviceInfo hpet_device_info = {
     .qdev.reset   = hpet_reset,
     .init         = hpet_init,
     .qdev.props = (Property[]) {
-        DEFINE_PROP_UINT8("timers", HPETState, num_timers, HPET_MIN_TIMERS),
-        DEFINE_PROP_BIT("msi", HPETState, flags, HPET_MSI_SUPPORT, false),
+        DEFINE_PROP_UINT8("timers", HPETState, num_timers, HPET_MIN_TIMERS, ""),
+        DEFINE_PROP_BIT("msi", HPETState, flags, HPET_MSI_SUPPORT, false, ""),
         DEFINE_PROP_END_OF_LIST(),
     },
 };
hw/i2c.c +1 -1
index f80d12d..f648732 100644
@@ -21,7 +21,7 @@ static struct BusInfo i2c_bus_info = {
     .name = "I2C",
     .size = sizeof(i2c_bus),
     .props = (Property[]) {
-        DEFINE_PROP_UINT8("address", struct i2c_slave, address, 0),
+        DEFINE_PROP_UINT8("address", struct i2c_slave, address, 0, ""),
         DEFINE_PROP_END_OF_LIST(),
     }
 };
hw/ide/cmd646.c +1 -1
index ff80dd5..17d5e0b 100644
@@ -285,7 +285,7 @@ static PCIDeviceInfo cmd646_ide_info[] = {
         .qdev.size    = sizeof(PCIIDEState),
         .init         = pci_cmd646_ide_initfn,
         .qdev.props   = (Property[]) {
-            DEFINE_PROP_UINT32("secondary", PCIIDEState, secondary, 0),
+            DEFINE_PROP_UINT32("secondary", PCIIDEState, secondary, 0, ""),
             DEFINE_PROP_END_OF_LIST(),
         },
     },{
hw/ide/isa.c +3 -3
index 6b57e0d..2ab5411 100644
@@ -102,9 +102,9 @@ static ISADeviceInfo isa_ide_info = {
     .init       = isa_ide_initfn,
     .qdev.reset = isa_ide_reset,
     .qdev.props = (Property[]) {
-        DEFINE_PROP_HEX32("iobase",  ISAIDEState, iobase,  0x1f0),
-        DEFINE_PROP_HEX32("iobase2", ISAIDEState, iobase2, 0x3f6),
-        DEFINE_PROP_UINT32("irq",    ISAIDEState, isairq,  14),
+        DEFINE_PROP_HEX32("iobase",  ISAIDEState, iobase,  0x1f0, ""),
+        DEFINE_PROP_HEX32("iobase2", ISAIDEState, iobase2, 0x3f6, ""),
+        DEFINE_PROP_UINT32("irq",    ISAIDEState, isairq,  14, ""),
         DEFINE_PROP_END_OF_LIST(),
     },
 };
hw/ide/qdev.c +3 -3
index 0808760..dcea68a 100644
@@ -137,10 +137,10 @@ static IDEDeviceInfo ide_drive_info = {
     .qdev.size  = sizeof(IDEDrive),
     .init       = ide_drive_initfn,
     .qdev.props = (Property[]) {
-        DEFINE_PROP_UINT32("unit", IDEDrive, dev.unit, -1),
+        DEFINE_PROP_UINT32("unit", IDEDrive, dev.unit, -1, ""),
         DEFINE_BLOCK_PROPERTIES(IDEDrive, dev.conf),
-        DEFINE_PROP_STRING("ver",  IDEDrive, dev.version),
-        DEFINE_PROP_STRING("serial",  IDEDrive, dev.serial),
+        DEFINE_PROP_STRING("ver",  IDEDrive, dev.version, ""),
+        DEFINE_PROP_STRING("serial",  IDEDrive, dev.serial, ""),
         DEFINE_PROP_END_OF_LIST(),
     }
 };
hw/integratorcp.c +1 -1
index 3bf216b..d21aaea 100644
@@ -528,7 +528,7 @@ static SysBusDeviceInfo core_info = {
     .qdev.name  = "integrator_core",
     .qdev.size  = sizeof(integratorcm_state),
     .qdev.props = (Property[]) {
-        DEFINE_PROP_UINT32("memsz", integratorcm_state, memsz, 0),
+        DEFINE_PROP_UINT32("memsz", integratorcm_state, memsz, 0, ""),
         DEFINE_PROP_END_OF_LIST(),
     }
 };
hw/ivshmem.c +8 -7
index 06dce70..f0febee 100644
@@ -810,13 +810,14 @@ static PCIDeviceInfo ivshmem_info = {
     .init       = pci_ivshmem_init,
     .exit       = pci_ivshmem_uninit,
     .qdev.props = (Property[]) {
-        DEFINE_PROP_CHR("chardev", IVShmemState, server_chr),
-        DEFINE_PROP_STRING("size", IVShmemState, sizearg),
-        DEFINE_PROP_UINT32("vectors", IVShmemState, vectors, 1),
-        DEFINE_PROP_BIT("ioeventfd", IVShmemState, features, IVSHMEM_IOEVENTFD, false),
-        DEFINE_PROP_BIT("msi", IVShmemState, features, IVSHMEM_MSI, true),
-        DEFINE_PROP_STRING("shm", IVShmemState, shmobj),
-        DEFINE_PROP_STRING("role", IVShmemState, role),
+        DEFINE_PROP_CHR("chardev", IVShmemState, server_chr, ""),
+        DEFINE_PROP_STRING("size", IVShmemState, sizearg, ""),
+        DEFINE_PROP_UINT32("vectors", IVShmemState, vectors, 1, ""),
+        DEFINE_PROP_BIT("ioeventfd", IVShmemState, features, IVSHMEM_IOEVENTFD,
+                        false, ""),
+        DEFINE_PROP_BIT("msi", IVShmemState, features, IVSHMEM_MSI, true, ""),
+        DEFINE_PROP_STRING("shm", IVShmemState, shmobj, ""),
+        DEFINE_PROP_STRING("role", IVShmemState, role, ""),
         DEFINE_PROP_END_OF_LIST(),
     }
 };
hw/lance.c +1 -1
index b6b04dd..c64bf36 100644
@@ -151,7 +151,7 @@ static SysBusDeviceInfo lance_info = {
     .qdev.reset = lance_reset,
     .qdev.vmsd  = &vmstate_lance,
     .qdev.props = (Property[]) {
-        DEFINE_PROP_PTR("dma", SysBusPCNetState, state.dma_opaque),
+        DEFINE_PROP_PTR("dma", SysBusPCNetState, state.dma_opaque, ""),
         DEFINE_NIC_PROPERTIES(SysBusPCNetState, state.conf),
         DEFINE_PROP_END_OF_LIST(),
     }
hw/m48t59.c +6 -6
index c7492a6..edbb384 100644
@@ -730,9 +730,9 @@ static ISADeviceInfo m48t59_isa_info = {
     .qdev.reset = m48t59_reset_isa,
     .qdev.no_user = 1,
     .qdev.props = (Property[]) {
-        DEFINE_PROP_UINT32("size",    M48t59ISAState, state.size,    -1),
-        DEFINE_PROP_UINT32("type",    M48t59ISAState, state.type,    -1),
-        DEFINE_PROP_HEX32( "io_base", M48t59ISAState, state.io_base,  0),
+        DEFINE_PROP_UINT32("size",    M48t59ISAState, state.size,    -1, ""),
+        DEFINE_PROP_UINT32("type",    M48t59ISAState, state.type,    -1, ""),
+        DEFINE_PROP_HEX32( "io_base", M48t59ISAState, state.io_base,  0, ""),
         DEFINE_PROP_END_OF_LIST(),
     }
 };
@@ -743,9 +743,9 @@ static SysBusDeviceInfo m48t59_info = {
     .qdev.size = sizeof(M48t59SysBusState),
     .qdev.reset = m48t59_reset_sysbus,
     .qdev.props = (Property[]) {
-        DEFINE_PROP_UINT32("size",    M48t59SysBusState, state.size,    -1),
-        DEFINE_PROP_UINT32("type",    M48t59SysBusState, state.type,    -1),
-        DEFINE_PROP_HEX32( "io_base", M48t59SysBusState, state.io_base,  0),
+        DEFINE_PROP_UINT32("size",    M48t59SysBusState, state.size,    -1, ""),
+        DEFINE_PROP_UINT32("type",    M48t59SysBusState, state.type,    -1, ""),
+        DEFINE_PROP_HEX32( "io_base", M48t59SysBusState, state.io_base,  0, ""),
         DEFINE_PROP_END_OF_LIST(),
     }
 };
hw/mc146818rtc.c +1 -1
index 2b91fa8..6930ab8 100644
@@ -635,7 +635,7 @@ static ISADeviceInfo mc146818rtc_info = {
     .qdev.vmsd     = &vmstate_rtc,
     .init          = rtc_initfn,
     .qdev.props    = (Property[]) {
-        DEFINE_PROP_INT32("base_year", RTCState, base_year, 1980),
+        DEFINE_PROP_INT32("base_year", RTCState, base_year, 1980, ""),
         DEFINE_PROP_END_OF_LIST(),
     }
 };
hw/ne2000-isa.c +2 -2
index 03a5a1f..ec7daa3 100644
@@ -107,8 +107,8 @@ static ISADeviceInfo ne2000_isa_info = {
     .qdev.size  = sizeof(ISANE2000State),
     .init       = isa_ne2000_initfn,
     .qdev.props = (Property[]) {
-        DEFINE_PROP_HEX32("iobase", ISANE2000State, iobase, 0x300),
-        DEFINE_PROP_UINT32("irq",   ISANE2000State, isairq, 9),
+        DEFINE_PROP_HEX32("iobase", ISANE2000State, iobase, 0x300, ""),
+        DEFINE_PROP_UINT32("irq",   ISANE2000State, isairq, 9, ""),
         DEFINE_NIC_PROPERTIES(ISANE2000State, ne2000.c),
         DEFINE_PROP_END_OF_LIST(),
     },
hw/parallel.c +4 -4
index 6b11672..fcf9ee2 100644
@@ -587,10 +587,10 @@ static ISADeviceInfo parallel_isa_info = {
     .qdev.size  = sizeof(ISAParallelState),
     .init       = parallel_isa_initfn,
     .qdev.props = (Property[]) {
-        DEFINE_PROP_UINT32("index", ISAParallelState, index,   -1),
-        DEFINE_PROP_HEX32("iobase", ISAParallelState, iobase,  -1),
-        DEFINE_PROP_UINT32("irq",   ISAParallelState, isairq,  7),
-        DEFINE_PROP_CHR("chardev",  ISAParallelState, state.chr),
+        DEFINE_PROP_UINT32("index", ISAParallelState, index,   -1, ""),
+        DEFINE_PROP_HEX32("iobase", ISAParallelState, iobase,  -1, ""),
+        DEFINE_PROP_UINT32("irq",   ISAParallelState, isairq,  7, ""),
+        DEFINE_PROP_CHR("chardev",  ISAParallelState, state.chr, ""),
         DEFINE_PROP_END_OF_LIST(),
     },
 };
hw/pci.c +6 -6
index a98d6f3..02a7d09 100644
@@ -66,11 +66,11 @@ static struct BusInfo pci_bus_info = {
     .print_dev  = pcibus_dev_print,
     .get_dev_path = pcibus_get_dev_path,
     .props      = (Property[]) {
-        DEFINE_PROP_PCI_DEVFN("addr", PCIDevice, devfn, -1),
-        DEFINE_PROP_STRING("romfile", PCIDevice, romfile),
-        DEFINE_PROP_UINT32("rombar",  PCIDevice, rom_bar, 1),
+        DEFINE_PROP_PCI_DEVFN("addr", PCIDevice, devfn, -1, ""),
+        DEFINE_PROP_STRING("romfile", PCIDevice, romfile, ""),
+        DEFINE_PROP_UINT32("rombar",  PCIDevice, rom_bar, 1, ""),
         DEFINE_PROP_BIT("multifunction", PCIDevice, cap_present,
-                        QEMU_PCI_CAP_MULTIFUNCTION_BITNR, false),
+                        QEMU_PCI_CAP_MULTIFUNCTION_BITNR, false, ""),
         DEFINE_PROP_END_OF_LIST()
     }
 };
@@ -1978,8 +1978,8 @@ static PCIDeviceInfo bridge_info = {
     .config_write = pci_bridge_write_config,
     .is_bridge    = 1,
     .qdev.props   = (Property[]) {
-        DEFINE_PROP_HEX32("vendorid", PCIBridge, vid, 0),
-        DEFINE_PROP_HEX32("deviceid", PCIBridge, did, 0),
+        DEFINE_PROP_HEX32("vendorid", PCIBridge, vid, 0, ""),
+        DEFINE_PROP_HEX32("deviceid", PCIBridge, did, 0, ""),
         DEFINE_PROP_END_OF_LIST(),
     }
 };
hw/qdev-addr.h +2 -2
index a0ddf38..515a887 100644
@@ -1,5 +1,5 @@
-#define DEFINE_PROP_TADDR(_n, _s, _f, _d)                               \
-    DEFINE_PROP_DEFAULT(_n, _s, _f, _d, qdev_prop_taddr, target_phys_addr_t)
+#define DEFINE_PROP_TADDR(_n, _s, _f, _d, _c)				\
+    DEFINE_PROP_DEFAULT(_n, _s, _f, _d, qdev_prop_taddr, target_phys_addr_t, _c)
 
 extern PropertyInfo qdev_prop_taddr;
 void qdev_prop_set_taddr(DeviceState *dev, const char *name, target_phys_addr_t value);
hw/qdev.c +2 -1
index 35858cb..b415025 100644
@@ -188,7 +188,8 @@ int qdev_device_help(QemuOpts *opts)
         if (!prop->info->parse) {
             continue;           /* no way to set it, don't show */
         }
-        error_printf("%s.%s=%s\n", info->name, prop->name, prop->info->name);
+        error_printf("%s.%s=%s, %s\n", info->name, prop->name,
+                     prop->info->name, prop->desc ?: "");
     }
     return 1;
 }
hw/qdev.h +40 -35

105 lines not on this page · raw message

hw/s390-virtio-bus.c +1 -1
index 784dc01..ba0f377 100644
@@ -354,7 +354,7 @@ static VirtIOS390DeviceInfo s390_virtio_serial = {
     .qdev.size = sizeof(VirtIOS390Device),
     .qdev.props = (Property[]) {
         DEFINE_PROP_UINT32("max_ports", VirtIOS390Device, max_virtserial_ports,
-                           31),
+                           31, ""),
         DEFINE_PROP_END_OF_LIST(),
     },
 };
hw/sb16.c +5 -5
index 78590a7..f2181a2 100644
@@ -1400,11 +1400,11 @@ static ISADeviceInfo sb16_info = {
     .qdev.vmsd     = &vmstate_sb16,
     .init          = sb16_initfn,
     .qdev.props    = (Property[]) {
-        DEFINE_PROP_HEX32  ("version", SB16State, ver,  0x0405), /* 4.5 */
-        DEFINE_PROP_HEX32  ("iobase",  SB16State, port, 0x220),
-        DEFINE_PROP_UINT32 ("irq",     SB16State, irq,  5),
-        DEFINE_PROP_UINT32 ("dma",     SB16State, dma,  1),
-        DEFINE_PROP_UINT32 ("dma16",   SB16State, hdma, 5),
+        DEFINE_PROP_HEX32  ("version", SB16State, ver,  0x0405, ""), /* 4.5 */
+        DEFINE_PROP_HEX32  ("iobase",  SB16State, port, 0x220, ""),
+        DEFINE_PROP_UINT32 ("irq",     SB16State, irq,  5, ""),
+        DEFINE_PROP_UINT32 ("dma",     SB16State, dma,  1, ""),
+        DEFINE_PROP_UINT32 ("dma16",   SB16State, hdma, 5, ""),
         DEFINE_PROP_END_OF_LIST (),
     },
 };
hw/scsi-bus.c +1 -1
index 7aa0bcd..b501816 100644
@@ -9,7 +9,7 @@ static struct BusInfo scsi_bus_info = {
     .name  = "SCSI",
     .size  = sizeof(SCSIBus),
     .props = (Property[]) {
-        DEFINE_PROP_UINT32("scsi-id", SCSIDevice, id, -1),
+        DEFINE_PROP_UINT32("scsi-id", SCSIDevice, id, -1, ""),
         DEFINE_PROP_END_OF_LIST(),
     },
 };
hw/scsi-disk.c +2 -2
index 1446ca6..e910bf6 100644
@@ -1198,8 +1198,8 @@ static SCSIDeviceInfo scsi_disk_info = {
     .get_buf      = scsi_get_buf,
     .qdev.props   = (Property[]) {
         DEFINE_BLOCK_PROPERTIES(SCSIDiskState, qdev.conf),
-        DEFINE_PROP_STRING("ver",  SCSIDiskState, version),
-        DEFINE_PROP_STRING("serial",  SCSIDiskState, serial),
+        DEFINE_PROP_STRING("ver",  SCSIDiskState, version, ""),
+        DEFINE_PROP_STRING("serial",  SCSIDiskState, serial, ""),
         DEFINE_PROP_END_OF_LIST(),
     },
 };
hw/serial.c +4 -4
index f09ce0a..5dc6bcd 100644
@@ -971,10 +971,10 @@ static ISADeviceInfo serial_isa_info = {
     .qdev.vmsd  = &vmstate_isa_serial,
     .init       = serial_isa_initfn,
     .qdev.props = (Property[]) {
-        DEFINE_PROP_UINT32("index", ISASerialState, index,   -1),
-        DEFINE_PROP_HEX32("iobase", ISASerialState, iobase,  -1),
-        DEFINE_PROP_UINT32("irq",   ISASerialState, isairq,  -1),
-        DEFINE_PROP_CHR("chardev",  ISASerialState, state.chr),
+        DEFINE_PROP_UINT32("index", ISASerialState, index,   -1, ""),
+        DEFINE_PROP_HEX32("iobase", ISASerialState, iobase,  -1, ""),
+        DEFINE_PROP_UINT32("irq",   ISASerialState, isairq,  -1, ""),
+        DEFINE_PROP_CHR("chardev",  ISASerialState, state.chr, ""),
         DEFINE_PROP_END_OF_LIST(),
     },
 };
hw/slavio_timer.c +1 -1
index c125de4..39a81b8 100644
@@ -425,7 +425,7 @@ static SysBusDeviceInfo slavio_timer_info = {
     .qdev.vmsd  = &vmstate_slavio_timer,
     .qdev.reset = slavio_timer_reset,
     .qdev.props = (Property[]) {
-        DEFINE_PROP_UINT32("num_cpus",  SLAVIO_TIMERState, num_cpus,  0),
+        DEFINE_PROP_UINT32("num_cpus",  SLAVIO_TIMERState, num_cpus,  0, ""),
         DEFINE_PROP_END_OF_LIST(),
     }
 };
hw/smbus_eeprom.c +1 -1
index 52463e0..9ee8f54 100644
@@ -108,7 +108,7 @@ static SMBusDeviceInfo smbus_eeprom_info = {
     .i2c.qdev.name = "smbus-eeprom",
     .i2c.qdev.size = sizeof(SMBusEEPROMDevice),
     .i2c.qdev.props = (Property[]) {
-        DEFINE_PROP_PTR("data", SMBusEEPROMDevice, data),
+        DEFINE_PROP_PTR("data", SMBusEEPROMDevice, data, ""),
         DEFINE_PROP_END_OF_LIST(),
     },
     .init = smbus_eeprom_init,
hw/sparc32_dma.c +1 -1
index 984ffc3..1de135f 100644
@@ -289,7 +289,7 @@ static SysBusDeviceInfo sparc32_dma_info = {
     .qdev.vmsd  = &vmstate_dma,
     .qdev.reset = dma_reset,
     .qdev.props = (Property[]) {
-        DEFINE_PROP_PTR("iommu_opaque", DMAState, iommu),
+        DEFINE_PROP_PTR("iommu_opaque", DMAState, iommu, ""),
         DEFINE_PROP_END_OF_LIST(),
     }
 };
hw/sun4m.c +1 -1
index 0392109..a24eb2f 100644
@@ -766,7 +766,7 @@ static SysBusDeviceInfo ram_info = {
     .qdev.name  = "memory",
     .qdev.size  = sizeof(RamDevice),
     .qdev.props = (Property[]) {
-        DEFINE_PROP_UINT64("size", RamDevice, size, 0),
+        DEFINE_PROP_UINT64("size", RamDevice, size, 0, ""),
         DEFINE_PROP_END_OF_LIST(),
     }
 };
hw/sun4m_iommu.c +1 -1
index 1dbe077..fa146b8 100644
@@ -379,7 +379,7 @@ static SysBusDeviceInfo iommu_info = {
     .qdev.vmsd  = &vmstate_iommu,
     .qdev.reset = iommu_reset,
     .qdev.props = (Property[]) {
-        DEFINE_PROP_HEX32("version", IOMMUState, version, 0),
+        DEFINE_PROP_HEX32("version", IOMMUState, version, 0, ""),
         DEFINE_PROP_END_OF_LIST(),
     }
 };
hw/sun4u.c +1 -1
index 45a46d6..d3bb3df 100644
@@ -692,7 +692,7 @@ static SysBusDeviceInfo ram_info = {
     .qdev.name  = "memory",
     .qdev.size  = sizeof(RamDevice),
     .qdev.props = (Property[]) {
-        DEFINE_PROP_UINT64("size", RamDevice, size, 0),
+        DEFINE_PROP_UINT64("size", RamDevice, size, 0, ""),
         DEFINE_PROP_END_OF_LIST(),
     }
 };
hw/syborg_fb.c +2 -2
index ed57203..a938c0f 100644
@@ -536,8 +536,8 @@ static SysBusDeviceInfo syborg_fb_info = {
     .qdev.name  = "syborg,framebuffer",
     .qdev.size  = sizeof(SyborgFBState),
     .qdev.props = (Property[]) {
-        DEFINE_PROP_UINT32("width",  SyborgFBState, cols, 0),
-        DEFINE_PROP_UINT32("height", SyborgFBState, rows, 0),
+        DEFINE_PROP_UINT32("width",  SyborgFBState, cols, 0, ""),
+        DEFINE_PROP_UINT32("height", SyborgFBState, rows, 0, ""),
         DEFINE_PROP_END_OF_LIST(),
     }
 };
hw/syborg_interrupt.c +1 -1
index 30140fb..3693f5c 100644
@@ -224,7 +224,7 @@ static SysBusDeviceInfo syborg_int_info = {
     .qdev.name  = "syborg,interrupt",
     .qdev.size  = sizeof(SyborgIntState),
     .qdev.props = (Property[]) {
-        DEFINE_PROP_UINT32("num-interrupts", SyborgIntState, num_irqs, 64),
+        DEFINE_PROP_UINT32("num-interrupts", SyborgIntState, num_irqs, 64, ""),
         DEFINE_PROP_END_OF_LIST(),
     }
 };
hw/syborg_keyboard.c +1 -1
index 7709100..3a93d3a 100644
@@ -230,7 +230,7 @@ static SysBusDeviceInfo syborg_keyboard_info = {
     .qdev.name  = "syborg,keyboard",
     .qdev.size  = sizeof(SyborgKeyboardState),
     .qdev.props = (Property[]) {
-        DEFINE_PROP_UINT32("fifo-size", SyborgKeyboardState, fifo_size, 16),
+        DEFINE_PROP_UINT32("fifo-size", SyborgKeyboardState, fifo_size, 16, ""),
         DEFINE_PROP_END_OF_LIST(),
     }
 };
hw/syborg_pointer.c +2 -2
index 69b8d96..d59a0e0 100644
@@ -228,8 +228,8 @@ static SysBusDeviceInfo syborg_pointer_info = {
     .qdev.name  = "syborg,pointer",
     .qdev.size  = sizeof(SyborgPointerState),
     .qdev.props = (Property[]) {
-        DEFINE_PROP_UINT32("fifo-size", SyborgPointerState, fifo_size, 16),
-        DEFINE_PROP_UINT32("absolute",  SyborgPointerState, absolute,   1),
+        DEFINE_PROP_UINT32("fifo-size", SyborgPointerState, fifo_size, 16, ""),
+        DEFINE_PROP_UINT32("absolute",  SyborgPointerState, absolute,   1, ""),
         DEFINE_PROP_END_OF_LIST(),
     }
 };
hw/syborg_serial.c +1 -1
index 8c42956..9f550b3 100644
@@ -345,7 +345,7 @@ static SysBusDeviceInfo syborg_serial_info = {
     .qdev.name  = "syborg,serial",
     .qdev.size  = sizeof(SyborgSerialState),
     .qdev.props = (Property[]) {
-        DEFINE_PROP_UINT32("fifo-size", SyborgSerialState, fifo_size, 16),
+        DEFINE_PROP_UINT32("fifo-size", SyborgSerialState, fifo_size, 16, ""),
         DEFINE_PROP_END_OF_LIST(),
     }
 };
hw/syborg_timer.c +1 -1
index 95e07d7..7245b18 100644
@@ -231,7 +231,7 @@ static SysBusDeviceInfo syborg_timer_info = {
     .qdev.name  = "syborg,timer",
     .qdev.size  = sizeof(SyborgTimerState),
     .qdev.props = (Property[]) {
-        DEFINE_PROP_UINT32("frequency",SyborgTimerState, freq, 0),
+        DEFINE_PROP_UINT32("frequency",SyborgTimerState, freq, 0, ""),
         DEFINE_PROP_END_OF_LIST(),
     }
 };
hw/syborg_virtio.c +3 -3
index 4dfd1a8..e81955b 100644
@@ -297,10 +297,10 @@ static SysBusDeviceInfo syborg_virtio_net_info = {
         DEFINE_NIC_PROPERTIES(SyborgVirtIOProxy, nic),
         DEFINE_VIRTIO_NET_FEATURES(SyborgVirtIOProxy, host_features),
         DEFINE_PROP_UINT32("x-txtimer", SyborgVirtIOProxy,
-                           net.txtimer, TX_TIMER_INTERVAL),
+                           net.txtimer, TX_TIMER_INTERVAL, ""),
         DEFINE_PROP_INT32("x-txburst", SyborgVirtIOProxy,
-                          net.txburst, TX_BURST),
-        DEFINE_PROP_STRING("tx", SyborgVirtIOProxy, net.tx),
+                          net.txburst, TX_BURST, ""),
+        DEFINE_PROP_STRING("tx", SyborgVirtIOProxy, net.tx, ""),
         DEFINE_PROP_END_OF_LIST(),
     }
 };
hw/tcx.c +5 -5
index 6ee65bb..b5ff0fd 100644
@@ -633,11 +633,11 @@ static SysBusDeviceInfo tcx_info = {
     .qdev.reset = tcx_reset,
     .qdev.vmsd  = &vmstate_tcx,
     .qdev.props = (Property[]) {
-        DEFINE_PROP_TADDR("addr",      TCXState, addr,      -1),
-        DEFINE_PROP_HEX32("vram_size", TCXState, vram_size, -1),
-        DEFINE_PROP_UINT16("width",    TCXState, width,     -1),
-        DEFINE_PROP_UINT16("height",   TCXState, height,    -1),
-        DEFINE_PROP_UINT16("depth",    TCXState, depth,     -1),
+        DEFINE_PROP_TADDR("addr",      TCXState, addr,      -1, ""),
+        DEFINE_PROP_HEX32("vram_size", TCXState, vram_size, -1, ""),
+        DEFINE_PROP_UINT16("width",    TCXState, width,     -1, ""),
+        DEFINE_PROP_UINT16("height",   TCXState, height,    -1, ""),
+        DEFINE_PROP_UINT16("depth",    TCXState, depth,     -1, ""),
         DEFINE_PROP_END_OF_LIST(),
     }
 };
hw/usb-ohci.c +2 -2
index c60fd8d..8c0e373 100644
@@ -1782,8 +1782,8 @@ static SysBusDeviceInfo ohci_sysbus_info = {
     .qdev.desc    = "OHCI USB Controller",
     .qdev.size    = sizeof(OHCISysBusState),
     .qdev.props = (Property[]) {
-        DEFINE_PROP_UINT32("num-ports", OHCISysBusState, num_ports, 3),
-        DEFINE_PROP_TADDR("dma-offset", OHCISysBusState, dma_offset, 3),
+        DEFINE_PROP_UINT32("num-ports", OHCISysBusState, num_ports, 3, ""),
+        DEFINE_PROP_TADDR("dma-offset", OHCISysBusState, dma_offset, 3, ""),
         DEFINE_PROP_END_OF_LIST(),
     }
 };
hw/usb-serial.c +6 -6
index c19580f..f0fb340 100644
@@ -642,9 +642,9 @@ static struct USBDeviceInfo serial_info = {
     .usbdevice_name = "serial",
     .usbdevice_init = usb_serial_init,
     .qdev.props     = (Property[]) {
-        DEFINE_PROP_CHR("chardev",     USBSerialState, cs),
-        DEFINE_PROP_HEX32("vendorid",  USBSerialState, vendorid,  0x0403),
-        DEFINE_PROP_HEX32("productid", USBSerialState, productid, 0x6001),
+        DEFINE_PROP_CHR("chardev",     USBSerialState, cs, ""),
+        DEFINE_PROP_HEX32("vendorid",  USBSerialState, vendorid,  0x0403, ""),
+        DEFINE_PROP_HEX32("productid", USBSerialState, productid, 0x6001, ""),
         DEFINE_PROP_END_OF_LIST(),
     },
 };
@@ -662,9 +662,9 @@ static struct USBDeviceInfo braille_info = {
     .usbdevice_name = "braille",
     .usbdevice_init = usb_braille_init,
     .qdev.props     = (Property[]) {
-        DEFINE_PROP_CHR("chardev",     USBSerialState, cs),
-        DEFINE_PROP_HEX32("vendorid",  USBSerialState, vendorid,  0x0403),
-        DEFINE_PROP_HEX32("productid", USBSerialState, productid, 0xfe72),
+        DEFINE_PROP_CHR("chardev",     USBSerialState, cs, ""),
+        DEFINE_PROP_HEX32("vendorid",  USBSerialState, vendorid,  0x0403, ""),
+        DEFINE_PROP_HEX32("productid", USBSerialState, productid, 0xfe72, ""),
         DEFINE_PROP_END_OF_LIST(),
     },
 };
hw/vga-pci.c +2 -2
index 2315f70..3f7a46c 100644
@@ -131,8 +131,8 @@ static PCIDeviceInfo vga_info = {
     .init         = pci_vga_initfn,
     .config_write = pci_vga_write_config,
     .qdev.props   = (Property[]) {
-        DEFINE_PROP_HEX32("bios-offset", PCIVGAState, vga.bios_offset, 0),
-        DEFINE_PROP_HEX32("bios-size",   PCIVGAState, vga.bios_size,   0),
+        DEFINE_PROP_HEX32("bios-offset", PCIVGAState, vga.bios_offset, 0, ""),
+        DEFINE_PROP_HEX32("bios-size",   PCIVGAState, vga.bios_size,   0, ""),
         DEFINE_PROP_END_OF_LIST(),
     }
 };
hw/virtio-blk.h +2 -2
index fff46da..d587c5b 100644
@@ -97,8 +97,8 @@ struct virtio_scsi_inhdr
 
 #ifdef __linux__
 #define DEFINE_VIRTIO_BLK_FEATURES(_state, _field) \
-        DEFINE_VIRTIO_COMMON_FEATURES(_state, _field), \
-        DEFINE_PROP_BIT("scsi", _state, _field, VIRTIO_BLK_F_SCSI, true)
+        DEFINE_VIRTIO_COMMON_FEATURES(_state, _field),                      \
+        DEFINE_PROP_BIT("scsi", _state, _field, VIRTIO_BLK_F_SCSI, true, "")
 #else
 #define DEFINE_VIRTIO_BLK_FEATURES(_state, _field) \
         DEFINE_VIRTIO_COMMON_FEATURES(_state, _field)
hw/virtio-console.c +9 -7
index caea11f..ccd277a 100644
@@ -95,10 +95,11 @@ static VirtIOSerialPortInfo virtconsole_info = {
     .init          = virtconsole_initfn,
     .exit          = virtconsole_exitfn,
     .qdev.props = (Property[]) {
-        DEFINE_PROP_UINT8("is_console", VirtConsole, port.is_console, 1),
-        DEFINE_PROP_UINT32("nr", VirtConsole, port.id, VIRTIO_CONSOLE_BAD_ID),
-        DEFINE_PROP_CHR("chardev", VirtConsole, chr),
-        DEFINE_PROP_STRING("name", VirtConsole, port.name),
+        DEFINE_PROP_UINT8("is_console", VirtConsole, port.is_console, 1, ""),
+        DEFINE_PROP_UINT32("nr", VirtConsole, port.id, VIRTIO_CONSOLE_BAD_ID,
+                           ""),
+        DEFINE_PROP_CHR("chardev", VirtConsole, chr, ""),
+        DEFINE_PROP_STRING("name", VirtConsole, port.name, ""),
         DEFINE_PROP_END_OF_LIST(),
     },
 };
@@ -131,9 +132,10 @@ static VirtIOSerialPortInfo virtserialport_info = {
     .init          = virtserialport_initfn,
     .exit          = virtconsole_exitfn,
     .qdev.props = (Property[]) {
-        DEFINE_PROP_UINT32("nr", VirtConsole, port.id, VIRTIO_CONSOLE_BAD_ID),
-        DEFINE_PROP_CHR("chardev", VirtConsole, chr),
-        DEFINE_PROP_STRING("name", VirtConsole, port.name),
+        DEFINE_PROP_UINT32("nr", VirtConsole, port.id, VIRTIO_CONSOLE_BAD_ID,
+                           ""),
+        DEFINE_PROP_CHR("chardev", VirtConsole, chr, ""),
+        DEFINE_PROP_STRING("name", VirtConsole, port.name, ""),
         DEFINE_PROP_END_OF_LIST(),
     },
 };
hw/virtio-net.h +33 -18

55 lines not on this page · raw message

hw/virtio-pci.c +11 -11
index 86e6b0a..f4f349b 100644
@@ -674,9 +674,9 @@ static PCIDeviceInfo virtio_info[] = {
         .init      = virtio_blk_init_pci,
         .exit      = virtio_blk_exit_pci,
         .qdev.props = (Property[]) {
-            DEFINE_PROP_HEX32("class", VirtIOPCIProxy, class_code, 0),
+            DEFINE_PROP_HEX32("class", VirtIOPCIProxy, class_code, 0, ""),
             DEFINE_BLOCK_PROPERTIES(VirtIOPCIProxy, block),
-            DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 2),
+            DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 2, ""),
             DEFINE_VIRTIO_BLK_FEATURES(VirtIOPCIProxy, host_features),
             DEFINE_PROP_END_OF_LIST(),
         },
@@ -688,14 +688,14 @@ static PCIDeviceInfo virtio_info[] = {
         .exit       = virtio_net_exit_pci,
         .romfile    = "pxe-virtio.bin",
         .qdev.props = (Property[]) {
-            DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 3),
+            DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 3, ""),
             DEFINE_VIRTIO_NET_FEATURES(VirtIOPCIProxy, host_features),
             DEFINE_NIC_PROPERTIES(VirtIOPCIProxy, nic),
             DEFINE_PROP_UINT32("x-txtimer", VirtIOPCIProxy,
-                               net.txtimer, TX_TIMER_INTERVAL),
+                               net.txtimer, TX_TIMER_INTERVAL, ""),
             DEFINE_PROP_INT32("x-txburst", VirtIOPCIProxy,
-                              net.txburst, TX_BURST),
-            DEFINE_PROP_STRING("tx", VirtIOPCIProxy, net.tx),
+                              net.txburst, TX_BURST, ""),
+            DEFINE_PROP_STRING("tx", VirtIOPCIProxy, net.tx, ""),
             DEFINE_PROP_END_OF_LIST(),
         },
         .qdev.reset = virtio_pci_reset,
@@ -707,11 +707,11 @@ static PCIDeviceInfo virtio_info[] = {
         .exit      = virtio_serial_exit_pci,
         .qdev.props = (Property[]) {
             DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors,
-                               DEV_NVECTORS_UNSPECIFIED),
-            DEFINE_PROP_HEX32("class", VirtIOPCIProxy, class_code, 0),
+                               DEV_NVECTORS_UNSPECIFIED, ""),
+            DEFINE_PROP_HEX32("class", VirtIOPCIProxy, class_code, 0, ""),
             DEFINE_VIRTIO_COMMON_FEATURES(VirtIOPCIProxy, host_features),
             DEFINE_PROP_UINT32("max_ports", VirtIOPCIProxy, max_virtserial_ports,
-                               31),
+                               31, ""),
             DEFINE_PROP_END_OF_LIST(),
         },
         .qdev.reset = virtio_pci_reset,
@@ -732,8 +732,8 @@ static PCIDeviceInfo virtio_info[] = {
         .init      = virtio_9p_init_pci,
         .qdev.props = (Property[]) {
             DEFINE_VIRTIO_COMMON_FEATURES(VirtIOPCIProxy, host_features),
-            DEFINE_PROP_STRING("mount_tag", VirtIOPCIProxy, fsconf.tag),
-            DEFINE_PROP_STRING("fsdev", VirtIOPCIProxy, fsconf.fsdev_id),
+            DEFINE_PROP_STRING("mount_tag", VirtIOPCIProxy, fsconf.tag, ""),
+            DEFINE_PROP_STRING("fsdev", VirtIOPCIProxy, fsconf.fsdev_id, ""),
             DEFINE_PROP_END_OF_LIST(),
         },
     }, {
hw/virtio.h +1 -1
index 96514e6..44af2d3 100644
@@ -204,7 +204,7 @@ void virtio_serial_exit(VirtIODevice *vdev);
 
 #define DEFINE_VIRTIO_COMMON_FEATURES(_state, _field) \
 	DEFINE_PROP_BIT("indirect_desc", _state, _field, \
-			VIRTIO_RING_F_INDIRECT_DESC, true)
+			VIRTIO_RING_F_INDIRECT_DESC, true, "")
 
 target_phys_addr_t virtio_queue_get_desc_addr(VirtIODevice *vdev, int n);
 target_phys_addr_t virtio_queue_get_avail_addr(VirtIODevice *vdev, int n);
hw/vt82c686.c +1 -1
index cacc217..502cdd2 100644
@@ -517,7 +517,7 @@ static PCIDeviceInfo via_pm_info = {
     .init               = vt82c686b_pm_initfn,
     .config_write       = pm_write_config,
     .qdev.props         = (Property[]) {
-        DEFINE_PROP_UINT32("smb_io_base", VT686PMState, smb_io_base, 0),
+        DEFINE_PROP_UINT32("smb_io_base", VT686PMState, smb_io_base, 0, ""),
         DEFINE_PROP_END_OF_LIST(),
     }
 };
hw/xilinx_ethlite.c +4 -2
index 37e33ec..80fa5b6 100644
@@ -239,8 +239,10 @@ static SysBusDeviceInfo xilinx_ethlite_info = {
     .qdev.name  = "xilinx,ethlite",
     .qdev.size  = sizeof(struct xlx_ethlite),
     .qdev.props = (Property[]) {
-        DEFINE_PROP_UINT32("txpingpong", struct xlx_ethlite, c_tx_pingpong, 1),
-        DEFINE_PROP_UINT32("rxpingpong", struct xlx_ethlite, c_rx_pingpong, 1),
+        DEFINE_PROP_UINT32("txpingpong", struct xlx_ethlite, c_tx_pingpong, 1,
+                           ""),
+        DEFINE_PROP_UINT32("rxpingpong", struct xlx_ethlite, c_rx_pingpong, 1,
+                           ""),
         DEFINE_NIC_PROPERTIES(struct xlx_ethlite, conf),
         DEFINE_PROP_END_OF_LIST(),
     }
hw/xilinx_intc.c +2 -1
index 8ef6474..c33e878 100644
@@ -163,7 +163,8 @@ static SysBusDeviceInfo xilinx_intc_info = {
     .qdev.name  = "xilinx,intc",
     .qdev.size  = sizeof(struct xlx_pic),
     .qdev.props = (Property[]) {
-        DEFINE_PROP_UINT32("kind-of-intr", struct xlx_pic, c_kind_of_intr, 0),
+        DEFINE_PROP_UINT32("kind-of-intr", struct xlx_pic, c_kind_of_intr, 0,
+                           ""),
         DEFINE_PROP_END_OF_LIST(),
     }
 };
hw/xilinx_timer.c +2 -2
index e2d9541..65155e7 100644
@@ -220,8 +220,8 @@ static SysBusDeviceInfo xilinx_timer_info = {
     .qdev.name  = "xilinx,timer",
     .qdev.size  = sizeof(struct timerblock),
     .qdev.props = (Property[]) {
-        DEFINE_PROP_UINT32("frequency", struct timerblock, freq_hz,   0),
-        DEFINE_PROP_UINT32("nr-timers", struct timerblock, nr_timers, 0),
+        DEFINE_PROP_UINT32("frequency", struct timerblock, freq_hz,   0, ""),
+        DEFINE_PROP_UINT32("nr-timers", struct timerblock, nr_timers, 0, ""),
         DEFINE_PROP_END_OF_LIST(),
     }
 };
net.h +3 -3
index 518cf9c..f11c108 100644
@@ -20,9 +20,9 @@ typedef struct NICConf {
 } NICConf;
 
 #define DEFINE_NIC_PROPERTIES(_state, _conf)                            \
-    DEFINE_PROP_MACADDR("mac",   _state, _conf.macaddr),                \
-    DEFINE_PROP_VLAN("vlan",     _state, _conf.vlan),                   \
-    DEFINE_PROP_NETDEV("netdev", _state, _conf.peer)
+    DEFINE_PROP_MACADDR("mac",   _state, _conf.macaddr, ""),            \
+    DEFINE_PROP_VLAN("vlan",     _state, _conf.vlan, ""),               \
+    DEFINE_PROP_NETDEV("netdev", _state, _conf.peer, "")
 
 /* VLANs support */
 
usb-linux.c +4 -4
index c3c38ec..ccbdd42 100644
@@ -1033,10 +1033,10 @@ static struct USBDeviceInfo usb_host_dev_info = {
     .usbdevice_name = "host",
     .usbdevice_init = usb_host_device_open,
     .qdev.props     = (Property[]) {
-        DEFINE_PROP_UINT32("hostbus",  USBHostDevice, match.bus_num,    0),
-        DEFINE_PROP_UINT32("hostaddr", USBHostDevice, match.addr,       0),
-        DEFINE_PROP_HEX32("vendorid",  USBHostDevice, match.vendor_id,  0),
-        DEFINE_PROP_HEX32("productid", USBHostDevice, match.product_id, 0),
+        DEFINE_PROP_UINT32("hostbus",  USBHostDevice, match.bus_num,    0, ""),
+        DEFINE_PROP_UINT32("hostaddr", USBHostDevice, match.addr,       0, ""),
+        DEFINE_PROP_HEX32("vendorid",  USBHostDevice, match.vendor_id,  0, ""),
+        DEFINE_PROP_HEX32("productid", USBHostDevice, match.product_id, 0, ""),
         DEFINE_PROP_END_OF_LIST(),
     },
 };
Signature · 1 line
1.7.2.2
#2 lore raw

Re: [Qemu-devel] [PATCH 1/4] qdev: Add a description field for qdev properties for documentation

Quoted 2 lines · Amit Shah

Add a 'description' along with each qdev property to document the input each qdev property takes.

[...]

Quoted 5 lines
hw/qdev.c +0 -0
index 35858cb..b415025 100644

hw/qdev.c int qdev_device_help(QemuOpts *opts) · line 195

Quoted 9 lines
hw/qdev.c +2 -1
@@ -188,7 +188,8 @@ int qdev_device_help(QemuOpts *opts)
         if (!prop->info->parse) {
             continue;           /* no way to set it, don't show */
         }
-        error_printf("%s.%s=%s\n", info->name, prop->name, prop->info->name);
+        error_printf("%s.%s=%s, %s\n", info->name, prop->name,
+                     prop->info->name, prop->desc ?: "");
     }
     return 1;
 }

This is the only patch hunk that isn't about defining or initializing the new member desc, isn't it?

[...]

author
#3 lore raw

Re: [Qemu-devel] [PATCH 1/4] qdev: Add a description field for qdev properties for documentation

Quoted 14 lines · Markus Armbruster
Quoted 2 lines · Amit Shah

Add a 'description' along with each qdev property to document the input each qdev property takes.

[...]

Quoted 9 lines
hw/qdev.c +0 -1
index 35858cb..b415025 100644
@@ -188,7 +188,8 @@ int qdev_device_help(QemuOpts *opts)
         if (!prop->info->parse) {
             continue;           /* no way to set it, don't show */
         }
-        error_printf("%s.%s=%s\n", info->name, prop->name, prop->info->name);
Quoted 8 lines

hw/qdev.c int qdev_device_help(QemuOpts *opts) · line 195

Quoted 5 lines
hw/qdev.c +2 -0
+        error_printf("%s.%s=%s, %s\n", info->name, prop->name,
+                     prop->info->name, prop->desc ?: "");
     }
     return 1;
 }

This is the only patch hunk that isn't about defining or initializing the new member desc, isn't it?

Right; the other hunks just add the new desc field for all the callers.

Amit

author
#4 lore raw

PATCH 2/4 virtio-serial: Add description fields for qdev properties

In reply to Amit Shah

Document the parameters for the virtserialport and virtioconsole devices.

Example:

$ ./x86_64-softmmu/qemu-system-x86_64 -device virtserialport,?
virtserialport.nr=uint32, The 'number' for the port for \
predictable port numbers. Use this to spawn ports if you \
plan to migrate the guest.

virtserialport.chardev=chr, The chardev to associate this port with.

virtserialport.name=string, Name for the port that's exposed to \
the guest for port discovery.

---
 hw/virtio-console.c |   17 ++++++++++-------
 hw/virtio-serial.h  |   13 +++++++++++++
 2 files changed, 23 insertions(+), 7 deletions(-)
hw/virtio-console.c +10 -7
index ccd277a..8a99a99 100644
@@ -95,11 +95,13 @@ static VirtIOSerialPortInfo virtconsole_info = {
     .init          = virtconsole_initfn,
     .exit          = virtconsole_exitfn,
     .qdev.props = (Property[]) {
-        DEFINE_PROP_UINT8("is_console", VirtConsole, port.is_console, 1, ""),
+        DEFINE_PROP_UINT8("is_console", VirtConsole, port.is_console, 1,
+                          PROP_VIRTSERIAL_IS_CONSOLE_DESC),
         DEFINE_PROP_UINT32("nr", VirtConsole, port.id, VIRTIO_CONSOLE_BAD_ID,
-                           ""),
-        DEFINE_PROP_CHR("chardev", VirtConsole, chr, ""),
-        DEFINE_PROP_STRING("name", VirtConsole, port.name, ""),
+                           PROP_VIRTSERIAL_NR_DESC),
+        DEFINE_PROP_CHR("chardev", VirtConsole, chr, PROP_VIRTSERIAL_CHR_DESC),
+        DEFINE_PROP_STRING("name", VirtConsole, port.name,
+                           PROP_VIRTSERIAL_NAME_DESC),
         DEFINE_PROP_END_OF_LIST(),
     },
 };
@@ -133,9 +135,10 @@ static VirtIOSerialPortInfo virtserialport_info = {
     .exit          = virtconsole_exitfn,
     .qdev.props = (Property[]) {
         DEFINE_PROP_UINT32("nr", VirtConsole, port.id, VIRTIO_CONSOLE_BAD_ID,
-                           ""),
-        DEFINE_PROP_CHR("chardev", VirtConsole, chr, ""),
-        DEFINE_PROP_STRING("name", VirtConsole, port.name, ""),
+                           PROP_VIRTSERIAL_NR_DESC),
+        DEFINE_PROP_CHR("chardev", VirtConsole, chr, PROP_VIRTSERIAL_CHR_DESC),
+        DEFINE_PROP_STRING("name", VirtConsole, port.name,
+                           PROP_VIRTSERIAL_NAME_DESC),
         DEFINE_PROP_END_OF_LIST(),
     },
 };
hw/virtio-serial.h +13 -0
index ff08c40..187d5e4 100644
@@ -57,6 +57,19 @@ struct virtio_console_control {
 
 /* == In-qemu interface == */
 
+#define PROP_VIRTSERIAL_IS_CONSOLE_DESC                                 \
+    "An hvc console will be spawned in the guest if this is set."
+
+#define PROP_VIRTSERIAL_NR_DESC                                         \
+    "The 'number' for the port for predictable port numbers. Use this to " \
+    "spawn ports if you plan to migrate the guest."
+
+#define PROP_VIRTSERIAL_CHR_DESC                \
+    "The chardev to associate this port with."
+
+#define PROP_VIRTSERIAL_NAME_DESC                \
+    "Name for the port that's exposed to the guest for port discovery."
+
 typedef struct VirtIOSerial VirtIOSerial;
 typedef struct VirtIOSerialBus VirtIOSerialBus;
 typedef struct VirtIOSerialPort VirtIOSerialPort;
Signature · 1 line
1.7.2.2
#5 lore raw

Re: [Qemu-devel] [PATCH 2/4] virtio-serial: Add description fields for qdev properties

Quoted 71 lines · Amit Shah

Document the parameters for the virtserialport and virtioconsole devices.

Example:

$ ./x86_64-softmmu/qemu-system-x86_64 -device virtserialport,?
virtserialport.nr=uint32, The 'number' for the port for \
predictable port numbers. Use this to spawn ports if you \
plan to migrate the guest.

virtserialport.chardev=chr, The chardev to associate this port with.

virtserialport.name=string, Name for the port that's exposed to \
the guest for port discovery.

---
 hw/virtio-console.c |   17 ++++++++++-------
 hw/virtio-serial.h  |   13 +++++++++++++
 2 files changed, 23 insertions(+), 7 deletions(-)
hw/virtio-console.c +10 -7
index ccd277a..8a99a99 100644
@@ -95,11 +95,13 @@ static VirtIOSerialPortInfo virtconsole_info = {
     .init          = virtconsole_initfn,
     .exit          = virtconsole_exitfn,
     .qdev.props = (Property[]) {
-        DEFINE_PROP_UINT8("is_console", VirtConsole, port.is_console, 1, ""),
+        DEFINE_PROP_UINT8("is_console", VirtConsole, port.is_console, 1,
+                          PROP_VIRTSERIAL_IS_CONSOLE_DESC),
         DEFINE_PROP_UINT32("nr", VirtConsole, port.id, VIRTIO_CONSOLE_BAD_ID,
-                           ""),
-        DEFINE_PROP_CHR("chardev", VirtConsole, chr, ""),
-        DEFINE_PROP_STRING("name", VirtConsole, port.name, ""),
+                           PROP_VIRTSERIAL_NR_DESC),
+        DEFINE_PROP_CHR("chardev", VirtConsole, chr, PROP_VIRTSERIAL_CHR_DESC),
+        DEFINE_PROP_STRING("name", VirtConsole, port.name,
+                           PROP_VIRTSERIAL_NAME_DESC),
         DEFINE_PROP_END_OF_LIST(),
     },
 };
@@ -133,9 +135,10 @@ static VirtIOSerialPortInfo virtserialport_info = {
     .exit          = virtconsole_exitfn,
     .qdev.props = (Property[]) {
         DEFINE_PROP_UINT32("nr", VirtConsole, port.id, VIRTIO_CONSOLE_BAD_ID,
-                           ""),
-        DEFINE_PROP_CHR("chardev", VirtConsole, chr, ""),
-        DEFINE_PROP_STRING("name", VirtConsole, port.name, ""),
+                           PROP_VIRTSERIAL_NR_DESC),
+        DEFINE_PROP_CHR("chardev", VirtConsole, chr, PROP_VIRTSERIAL_CHR_DESC),
+        DEFINE_PROP_STRING("name", VirtConsole, port.name,
+                           PROP_VIRTSERIAL_NAME_DESC),
         DEFINE_PROP_END_OF_LIST(),
     },
 };
hw/virtio-serial.h +6 -0
index ff08c40..187d5e4 100644
@@ -57,6 +57,19 @@ struct virtio_console_control {
 
 /* == In-qemu interface == */
 
+#define PROP_VIRTSERIAL_IS_CONSOLE_DESC                                 \
+    "An hvc console will be spawned in the guest if this is set."
+
+#define PROP_VIRTSERIAL_NR_DESC                                         \
+    "The 'number' for the port for predictable port numbers. Use this to " \
+    "spawn ports if you plan to migrate the guest."

hw/virtio-serial.h struct virtio_console_control { · line 75

Quoted 10 lines
hw/virtio-serial.h +7 -0
+
+#define PROP_VIRTSERIAL_CHR_DESC                \
+    "The chardev to associate this port with."
+
+#define PROP_VIRTSERIAL_NAME_DESC                \
+    "Name for the port that's exposed to the guest for port discovery."
+
 typedef struct VirtIOSerial VirtIOSerial;
 typedef struct VirtIOSerialBus VirtIOSerialBus;
 typedef struct VirtIOSerialPort VirtIOSerialPort;

Do you expect these macros to be used elsewhere? If not, I'd rather have them right next to their use, so that they do double-duty documenting source code.

author
#6 lore raw

Re: [Qemu-devel] [PATCH 2/4] virtio-serial: Add description fields for qdev properties

Quoted 20 lines · Markus Armbruster
Quoted 20 lines
hw/virtio-serial.h +12 -0
index ff08c40..187d5e4 100644
@@ -57,6 +57,19 @@ struct virtio_console_control {
 
 /* == In-qemu interface == */
 
+#define PROP_VIRTSERIAL_IS_CONSOLE_DESC                                 \
+    "An hvc console will be spawned in the guest if this is set."
+
+#define PROP_VIRTSERIAL_NR_DESC                                         \
+    "The 'number' for the port for predictable port numbers. Use this to " \
+    "spawn ports if you plan to migrate the guest."
+
+#define PROP_VIRTSERIAL_CHR_DESC                \
+    "The chardev to associate this port with."
+
+#define PROP_VIRTSERIAL_NAME_DESC                \
+    "Name for the port that's exposed to the guest for port discovery."
Quoted 8 lines

hw/virtio-serial.h struct virtio_console_control { · line 75

Quoted 4 lines
hw/virtio-serial.h +1 -0
+
 typedef struct VirtIOSerial VirtIOSerial;
 typedef struct VirtIOSerialBus VirtIOSerialBus;
 typedef struct VirtIOSerialPort VirtIOSerialPort;

Do you expect these macros to be used elsewhere? If not, I'd rather have them right next to their use, so that they do double-duty documenting source code.

Yes, other users of virtio-serial, like spice, clipboard sharing apps, etc.

Amit

author
#7 lore raw

PATCH 3/4 net.h: Add description fields for qdev properites

In reply to Amit Shah

This results in an output like:

$ ./x86_64-softmmu/qemu-system-x86_64 -device virtio-net-pci,?

...

virtio-net-pci.mac=macaddr, The MAC address for the NIC. virtio-net-pci.vlan=vlan, The VLAN to associate the NIC with. virtio-net-pci.netdev=netdev, The peer net device to associate with this virtual NIC.

---
 net.h |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
net.h +6 -3
index f11c108..b6658fd 100644
@@ -20,9 +20,12 @@ typedef struct NICConf {
 } NICConf;
 
 #define DEFINE_NIC_PROPERTIES(_state, _conf)                            \
-    DEFINE_PROP_MACADDR("mac",   _state, _conf.macaddr, ""),            \
-    DEFINE_PROP_VLAN("vlan",     _state, _conf.vlan, ""),               \
-    DEFINE_PROP_NETDEV("netdev", _state, _conf.peer, "")
+    DEFINE_PROP_MACADDR("mac",   _state, _conf.macaddr,                 \
+                        "The MAC address for the NIC."),                \
+    DEFINE_PROP_VLAN("vlan",     _state, _conf.vlan,                    \
+                     "The VLAN to associate the NIC with."),            \
+    DEFINE_PROP_NETDEV("netdev", _state, _conf.peer,                    \
+                       "The peer net device to associate with this virtual NIC.")
 
 /* VLANs support */
 
Signature · 1 line
1.7.2.2
author
#8 lore raw

PATCH 4/4 block_int.h: Provide documentation for common block qdev properties

In reply to Amit Shah

Document the options common to all block devices.

This comes from Kevin.

---
 block_int.h |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
block_int.h +8 -6
index ce20285..06e894d 100644
@@ -241,12 +241,14 @@ static inline unsigned int get_physical_block_exp(BlockConf *conf)
 }
 
 #define DEFINE_BLOCK_PROPERTIES(_state, _conf)                          \
-    DEFINE_PROP_DRIVE("drive", _state, _conf.bs, ""),                   \
-    DEFINE_PROP_UINT16("logical_block_size", _state,                    \
-                       _conf.logical_block_size, 512, ""),              \
+    DEFINE_PROP_DRIVE("drive", _state, _conf.bs, "The host drive details, specified by the -drive parameter"), \
+    DEFINE_PROP_UINT16("logical_block_size", _state, _conf.logical_block_size, \
+                       512, "Logical sector size of the disk"),         \
     DEFINE_PROP_UINT16("physical_block_size", _state,                   \
-                       _conf.physical_block_size, 512, ""),             \
-    DEFINE_PROP_UINT16("min_io_size", _state, _conf.min_io_size, 0, ""), \
-    DEFINE_PROP_UINT32("opt_io_size", _state, _conf.opt_io_size, 0, "")
+                       _conf.physical_block_size, 512, "Physical sector size of the disk"), \
+    DEFINE_PROP_UINT16("min_io_size", _state, _conf.min_io_size, 0,     \
+                       "Minimal size for IO requests in bytes. Must be a power of two that is 512 or greater."), \
+    DEFINE_PROP_UINT32("opt_io_size", _state, _conf.opt_io_size, 0,     \
+                       "Size for IO requests that provides optimal performance (in bytes). Must be a power of two that is 512 or greater.")
 
 #endif /* BLOCK_INT_H */
Signature · 1 line
1.7.2.2
#9 lore raw
In reply to Amit Shah
Quoted 14 lines · Amit Shah

Hello,

This is a rebase of the patchset I'd sent earlier.

I add the 4/4 patch, documenting common block device properties. Other than that, the usual notes apply: this is just the start, just getting the framework in place and a few examples so that people can then pick up and start documenting their devices and options. We want to see all of the devices covered, and hopefully turn on build_bug_on() on an empty doc string.

Maintainers should perhaps also look for patches that introduce options without documentation.

Quoted 6 lines

That's the long-term goal (over 0.14). For short-term, I'll be preparing follow-on patches that add doc strings for a few more options and perhaps bug people based on git history as to what documentation is to be added for some options.

If this looks acceptable, please apply!

For QMP, we'll need to cover more than just device properties, and in more detail than just a help text, but this looks like a sensible step forward.