Message ID | 20191120152442.26657-2-marcandre.lureau@redhat.com |
---|---|
State | New |
Headers | show |
Series | Clean-ups: qom-ify serial and remove QDEV_PROP_PTR | expand |
Marc-André Lureau <marcandre.lureau@redhat.com> writes: > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> > --- > hw/core/qdev-properties.c | 32 -------------------------------- > include/hw/qdev-properties.h | 3 --- > 2 files changed, 35 deletions(-) > > diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c > index ac28890e5a..be4cb01f0b 100644 > --- a/hw/core/qdev-properties.c > +++ b/hw/core/qdev-properties.c > @@ -409,31 +409,6 @@ static void set_uint64(Object *obj, Visitor *v, const char *name, > visit_type_uint64(v, name, ptr, errp); > } > > -static void get_int64(Object *obj, Visitor *v, const char *name, > - void *opaque, Error **errp) > -{ > - DeviceState *dev = DEVICE(obj); > - Property *prop = opaque; > - int64_t *ptr = qdev_get_prop_ptr(dev, prop); > - > - visit_type_int64(v, name, ptr, errp); > -} > - > -static void set_int64(Object *obj, Visitor *v, const char *name, > - void *opaque, Error **errp) > -{ > - DeviceState *dev = DEVICE(obj); > - Property *prop = opaque; > - int64_t *ptr = qdev_get_prop_ptr(dev, prop); > - > - if (dev->realized) { > - qdev_prop_set_after_realize(dev, name, errp); > - return; > - } > - > - visit_type_int64(v, name, ptr, errp); > -} > - > const PropertyInfo qdev_prop_uint64 = { > .name = "uint64", > .get = get_uint64, > @@ -441,13 +416,6 @@ const PropertyInfo qdev_prop_uint64 = { > .set_default_value = set_default_value_uint, > }; > > -const PropertyInfo qdev_prop_int64 = { > - .name = "int64", > - .get = get_int64, > - .set = set_int64, > - .set_default_value = set_default_value_int, > -}; > - > /* --- string --- */ > > static void release_string(Object *obj, const char *name, void *opaque) > diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h > index c6a8cb5516..690ff07ae2 100644 > --- a/include/hw/qdev-properties.h > +++ b/include/hw/qdev-properties.h > @@ -13,7 +13,6 @@ extern const PropertyInfo qdev_prop_uint16; > extern const PropertyInfo qdev_prop_uint32; > extern const PropertyInfo qdev_prop_int32; > extern const PropertyInfo qdev_prop_uint64; > -extern const PropertyInfo qdev_prop_int64; > extern const PropertyInfo qdev_prop_size; > extern const PropertyInfo qdev_prop_string; > extern const PropertyInfo qdev_prop_chr; > @@ -164,8 +163,6 @@ extern const PropertyInfo qdev_prop_pcie_link_width; > DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_int32, int32_t) > #define DEFINE_PROP_UINT64(_n, _s, _f, _d) \ > DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_uint64, uint64_t) > -#define DEFINE_PROP_INT64(_n, _s, _f, _d) \ > - DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_int64, int64_t) > #define DEFINE_PROP_SIZE(_n, _s, _f, _d) \ > DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_size, uint64_t) > #define DEFINE_PROP_PCI_DEVFN(_n, _s, _f, _d) \ History of its use: Author: Peter Xu <peterx@redhat.com> Date: Tue Jul 18 11:39:01 2017 +0800 qdev: provide DEFINE_PROP_INT64() We have nearly all the stuff, but this one is missing. Add it in. Am going to use this new helper for MigrationParameters fields, since most of them are int64_t. CC: Markus Armbruster <armbru@redhat.com> CC: Eduardo Habkost <ehabkost@redhat.com> CC: Marc-André Lureau <marcandre.lureau@redhat.com> CC: Peter Xu <peterx@redhat.com> CC: Juan Quintela <quintela@redhat.com> CC: Marcel Apfelbaum <marcel@redhat.com> CC: Eric Blake <eblake@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Marcel Apfelbaum <marcel@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Peter Xu <peterx@redhat.com> Message-Id: <1500349150-13240-2-git-send-email-peterx@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com> commit 89632fafdc64927647b6f45416307cd3d4c746db Author: Peter Xu <peterx@redhat.com> Date: Tue Jul 18 11:39:02 2017 +0800 migration: export parameters to props Export migration parameters to qdev properties. Then we can use, for example: -global migration.x-cpu-throttle-initial=xxx To specify migration parameters during init. Prefix "x-" is appended for each parameter exported to show that this is not a stable interface, and only for debugging/testing purpose. Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Peter Xu <peterx@redhat.com> Message-Id: <1500349150-13240-3-git-send-email-peterx@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com> [More commits adding uses...] commit 741d4086c856320807a2575389d7c0505578270b Author: Juan Quintela <quintela@redhat.com> Date: Fri Dec 1 13:08:38 2017 +0100 migration: Use proper types in json We use int for everything (int64_t), and then we check that value is between 0 and 255. Change it to the valid types. This change only happens for HMP. QMP always use bytes and similar. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> [All uses gone again] We can remove it now, and revert the removal when new uses pop up. Churn. I'd say remove if we think new uses are unlikely. I doubt they are.
Hi On Mon, Dec 2, 2019 at 9:23 AM Markus Armbruster <armbru@redhat.com> wrote: > > Marc-André Lureau <marcandre.lureau@redhat.com> writes: > > > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> > > --- > > hw/core/qdev-properties.c | 32 -------------------------------- > > include/hw/qdev-properties.h | 3 --- > > 2 files changed, 35 deletions(-) > > > > diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c > > index ac28890e5a..be4cb01f0b 100644 > > --- a/hw/core/qdev-properties.c > > +++ b/hw/core/qdev-properties.c > > @@ -409,31 +409,6 @@ static void set_uint64(Object *obj, Visitor *v, const char *name, > > visit_type_uint64(v, name, ptr, errp); > > } > > > > -static void get_int64(Object *obj, Visitor *v, const char *name, > > - void *opaque, Error **errp) > > -{ > > - DeviceState *dev = DEVICE(obj); > > - Property *prop = opaque; > > - int64_t *ptr = qdev_get_prop_ptr(dev, prop); > > - > > - visit_type_int64(v, name, ptr, errp); > > -} > > - > > -static void set_int64(Object *obj, Visitor *v, const char *name, > > - void *opaque, Error **errp) > > -{ > > - DeviceState *dev = DEVICE(obj); > > - Property *prop = opaque; > > - int64_t *ptr = qdev_get_prop_ptr(dev, prop); > > - > > - if (dev->realized) { > > - qdev_prop_set_after_realize(dev, name, errp); > > - return; > > - } > > - > > - visit_type_int64(v, name, ptr, errp); > > -} > > - > > const PropertyInfo qdev_prop_uint64 = { > > .name = "uint64", > > .get = get_uint64, > > @@ -441,13 +416,6 @@ const PropertyInfo qdev_prop_uint64 = { > > .set_default_value = set_default_value_uint, > > }; > > > > -const PropertyInfo qdev_prop_int64 = { > > - .name = "int64", > > - .get = get_int64, > > - .set = set_int64, > > - .set_default_value = set_default_value_int, > > -}; > > - > > /* --- string --- */ > > > > static void release_string(Object *obj, const char *name, void *opaque) > > diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h > > index c6a8cb5516..690ff07ae2 100644 > > --- a/include/hw/qdev-properties.h > > +++ b/include/hw/qdev-properties.h > > @@ -13,7 +13,6 @@ extern const PropertyInfo qdev_prop_uint16; > > extern const PropertyInfo qdev_prop_uint32; > > extern const PropertyInfo qdev_prop_int32; > > extern const PropertyInfo qdev_prop_uint64; > > -extern const PropertyInfo qdev_prop_int64; > > extern const PropertyInfo qdev_prop_size; > > extern const PropertyInfo qdev_prop_string; > > extern const PropertyInfo qdev_prop_chr; > > @@ -164,8 +163,6 @@ extern const PropertyInfo qdev_prop_pcie_link_width; > > DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_int32, int32_t) > > #define DEFINE_PROP_UINT64(_n, _s, _f, _d) \ > > DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_uint64, uint64_t) > > -#define DEFINE_PROP_INT64(_n, _s, _f, _d) \ > > - DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_int64, int64_t) > > #define DEFINE_PROP_SIZE(_n, _s, _f, _d) \ > > DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_size, uint64_t) > > #define DEFINE_PROP_PCI_DEVFN(_n, _s, _f, _d) \ > > History of its use: > > Author: Peter Xu <peterx@redhat.com> > Date: Tue Jul 18 11:39:01 2017 +0800 > > qdev: provide DEFINE_PROP_INT64() > > We have nearly all the stuff, but this one is missing. Add it in. > > Am going to use this new helper for MigrationParameters fields, since > most of them are int64_t. > > CC: Markus Armbruster <armbru@redhat.com> > CC: Eduardo Habkost <ehabkost@redhat.com> > CC: Marc-André Lureau <marcandre.lureau@redhat.com> > CC: Peter Xu <peterx@redhat.com> > CC: Juan Quintela <quintela@redhat.com> > CC: Marcel Apfelbaum <marcel@redhat.com> > CC: Eric Blake <eblake@redhat.com> > Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> > Reviewed-by: Marcel Apfelbaum <marcel@redhat.com> > Reviewed-by: Juan Quintela <quintela@redhat.com> > Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> > Signed-off-by: Peter Xu <peterx@redhat.com> > Message-Id: <1500349150-13240-2-git-send-email-peterx@redhat.com> > Signed-off-by: Juan Quintela <quintela@redhat.com> > > commit 89632fafdc64927647b6f45416307cd3d4c746db > Author: Peter Xu <peterx@redhat.com> > Date: Tue Jul 18 11:39:02 2017 +0800 > > migration: export parameters to props > > Export migration parameters to qdev properties. Then we can use, for > example: > > -global migration.x-cpu-throttle-initial=xxx > > To specify migration parameters during init. > > Prefix "x-" is appended for each parameter exported to show that this is > not a stable interface, and only for debugging/testing purpose. > > Reviewed-by: Juan Quintela <quintela@redhat.com> > Signed-off-by: Peter Xu <peterx@redhat.com> > Message-Id: <1500349150-13240-3-git-send-email-peterx@redhat.com> > Signed-off-by: Juan Quintela <quintela@redhat.com> > > [More commits adding uses...] > > commit 741d4086c856320807a2575389d7c0505578270b > Author: Juan Quintela <quintela@redhat.com> > Date: Fri Dec 1 13:08:38 2017 +0100 > > migration: Use proper types in json > > We use int for everything (int64_t), and then we check that value is > between 0 and 255. Change it to the valid types. > > This change only happens for HMP. QMP always use bytes and similar. > > Signed-off-by: Juan Quintela <quintela@redhat.com> > Reviewed-by: Eric Blake <eblake@redhat.com> > > [All uses gone again] > > We can remove it now, and revert the removal when new uses pop up. > Churn. I'd say remove if we think new uses are unlikely. I doubt they > are. > Oh, somehow I missed those users. I thought the code had never been exercised. Ok, let's keep it for now.
diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index ac28890e5a..be4cb01f0b 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -409,31 +409,6 @@ static void set_uint64(Object *obj, Visitor *v, const char *name, visit_type_uint64(v, name, ptr, errp); } -static void get_int64(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - DeviceState *dev = DEVICE(obj); - Property *prop = opaque; - int64_t *ptr = qdev_get_prop_ptr(dev, prop); - - visit_type_int64(v, name, ptr, errp); -} - -static void set_int64(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - DeviceState *dev = DEVICE(obj); - Property *prop = opaque; - int64_t *ptr = qdev_get_prop_ptr(dev, prop); - - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - - visit_type_int64(v, name, ptr, errp); -} - const PropertyInfo qdev_prop_uint64 = { .name = "uint64", .get = get_uint64, @@ -441,13 +416,6 @@ const PropertyInfo qdev_prop_uint64 = { .set_default_value = set_default_value_uint, }; -const PropertyInfo qdev_prop_int64 = { - .name = "int64", - .get = get_int64, - .set = set_int64, - .set_default_value = set_default_value_int, -}; - /* --- string --- */ static void release_string(Object *obj, const char *name, void *opaque) diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index c6a8cb5516..690ff07ae2 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -13,7 +13,6 @@ extern const PropertyInfo qdev_prop_uint16; extern const PropertyInfo qdev_prop_uint32; extern const PropertyInfo qdev_prop_int32; extern const PropertyInfo qdev_prop_uint64; -extern const PropertyInfo qdev_prop_int64; extern const PropertyInfo qdev_prop_size; extern const PropertyInfo qdev_prop_string; extern const PropertyInfo qdev_prop_chr; @@ -164,8 +163,6 @@ extern const PropertyInfo qdev_prop_pcie_link_width; DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_int32, int32_t) #define DEFINE_PROP_UINT64(_n, _s, _f, _d) \ DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_uint64, uint64_t) -#define DEFINE_PROP_INT64(_n, _s, _f, _d) \ - DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_int64, int64_t) #define DEFINE_PROP_SIZE(_n, _s, _f, _d) \ DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_size, uint64_t) #define DEFINE_PROP_PCI_DEVFN(_n, _s, _f, _d) \
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> --- hw/core/qdev-properties.c | 32 -------------------------------- include/hw/qdev-properties.h | 3 --- 2 files changed, 35 deletions(-)