qdev: add bit property type
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Review
Quoted 11 lines · Michael S. Tsirkin
This adds "bit" property type, which is a boolean stored in a 32 bit integer field, with legal values on and off. Will be used by virtio for feature bits.
(quoted diff) +7
-0+static void *qdev_bit_prop_ptr(DeviceState *dev, Property *prop) +{ + void *ptr = dev; + assert(prop->info->type == PROP_TYPE_BIT); + ptr += prop->offset / 32; + return ptr; +}
I don't like that idea. IMHO prop->offset should be specified in bytes no matter what the property is. Better add a new prop->bitnr field to specify which bit of the 32bit word should be toggled. Then you don't need this function in the first place.
cheers,
Gerd
Quoted 18 lines · Gerd Hoffmann
Review
Quoted 11 lines · Michael S. Tsirkin
This adds "bit" property type, which is a boolean stored in a 32 bit integer field, with legal values on and off. Will be used by virtio for feature bits.
(quoted diff) +7
-0+static void *qdev_bit_prop_ptr(DeviceState *dev, Property *prop) +{ + void *ptr = dev; + assert(prop->info->type == PROP_TYPE_BIT); + ptr += prop->offset / 32; + return ptr; +}I don't like that idea. IMHO
prop->offsetshould be specified in bytes no matter what the property is. Better add a newprop->bitnrfield to specify which bit of the 32bit word should be toggled. Then you don't need this function in the first place.
Quoted 2 lines
cheers,
Gerd
OK, I reworked the patches in this way.
A message that is not in the archive (sent off-list or not yet received): [email protected]
[Qemu-devel] Re: [PATCHv4 2/2] virtio: add features as qdev properties
Quoted 6 lines · Michael S. Tsirkin
Add feature bits as properties to virtio. This makes it possible to e.g. define machine without indirect buffer support, which is required for 0.10 compatibility, or without hardware checksum support, which is required for 0.11 compatibility. Since default values for optional features are now set by qdev,
get_featurescallback has been modified: it sets non-optional bits, and clears bits not supported by host.
I guess you'll need a bunch of entries for pc-0.10 and pc-0.11 to switch the virtio devices into the correct compatibility modes? Should probably go as patch #3 of this series.
cheers,
Gerd
[Qemu-devel] Re: [PATCHv4 2/2] virtio: add features as qdev properties
Quoted 8 lines · Gerd Hoffmann
Quoted 6 lines · Michael S. Tsirkin
Add feature bits as properties to virtio. This makes it possible to e.g. define machine without indirect buffer support, which is required for 0.10 compatibility, or without hardware checksum support, which is required for 0.11 compatibility. Since default values for optional features are now set by qdev,
get_featurescallback has been modified: it sets non-optional bits, and clears bits not supported by host.
Quoted 6 lines
I guess you'll need a bunch of entries for pc-0.10 and pc-0.11 to switch the virtio devices into the correct compatibility modes? Should probably go as patch #3 of this series.
cheers,
Gerd
Yes, but this will be done separately, after these are applied.
Signature · 1 line
MST